Skip to content

Commit 7dd518c

Browse files
Swimburgerjsklan
authored andcommitted
Fix .fernignore'd files
1 parent a40c998 commit 7dd518c

36 files changed

+636
-449
lines changed

.fernignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ src/index.ts
99
src/errors/SquareError.ts
1010
src/core/index.ts
1111
src/core/crypto
12-
src/core/json.ts
1312
tests/unit/error.test.ts
1413
tests/unit/fetcher/stream-wrappers/webpack.test.ts
1514
tests/integration

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/setup-node@v3
2828

2929
- name: Compile
30-
run: yarn && yarn test
30+
run: yarn && yarn test:unit
3131

3232
publish:
3333
needs: [ compile ]

jest.config.mjs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,7 @@ export default {
1313
roots: ["<rootDir>/tests"],
1414
testPathIgnorePatterns: ["\.browser\.(spec|test)\.[jt]sx?$", "/tests/wire/", "/tests/integration/"],
1515
setupFilesAfterEnv: [],
16-
transformIgnorePatterns: [
17-
"node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)",
18-
],
19-
transform: {
20-
"^.+\\.tsx?$": "ts-jest",
21-
"^.+\\.m?jsx?$": "ts-jest",
22-
},
23-
},
24-
{
25-
displayName: "browser",
26-
preset: "ts-jest",
27-
testEnvironment: "<rootDir>/tests/BrowserTestEnvironment.ts",
28-
moduleNameMapper: {
29-
"^(\.{1,2}/.*)\.js$": "$1",
30-
},
31-
roots: ["<rootDir>/tests"],
32-
testMatch: ["<rootDir>/tests/unit/**/?(*.)+(browser).(spec|test).[jt]s?(x)"],
33-
setupFilesAfterEnv: [],
34-
transformIgnorePatterns: [
35-
"node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)",
36-
],
16+
transformIgnorePatterns: ["node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)"],
3717
transform: {
3818
"^.+\\.tsx?$": "ts-jest",
3919
"^.+\\.m?jsx?$": "ts-jest",
@@ -48,9 +28,7 @@ export default {
4828
},
4929
roots: ["<rootDir>/tests/wire"],
5030
setupFilesAfterEnv: ["<rootDir>/tests/mock-server/setup.ts"],
51-
transformIgnorePatterns: [
52-
"node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)",
53-
],
31+
transformIgnorePatterns: ["node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)"],
5432
transform: {
5533
"^.+\\.tsx?$": "ts-jest",
5634
"^.+\\.m?jsx?$": "ts-jest",
@@ -64,9 +42,7 @@ export default {
6442
"^(\.{1,2}/.*)\.js$": "$1",
6543
},
6644
roots: ["<rootDir>/tests/integration"],
67-
transformIgnorePatterns: [
68-
"node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)",
69-
],
45+
transformIgnorePatterns: ["node_modules/(?!(msw|@mswjs|@bundled-es-modules|until-async)/)"],
7046
transform: {
7147
"^.+\\.tsx?$": "ts-jest",
7248
"^.+\\.m?jsx?$": "ts-jest",
@@ -75,4 +51,4 @@ export default {
7551
],
7652
workerThreads: false,
7753
passWithNoTests: true,
78-
};
54+
};

legacy/exports/index.d.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from "square-legacy";
1+
export * from "square-legacy";

legacy/exports/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from "square-legacy";
1+
export * from "square-legacy";

legacy/exports/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("square-legacy");
1+
module.exports = require("square-legacy");

legacy/exports/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from "square-legacy";
1+
export * from "square-legacy";
Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,49 @@
11
export async function createHmacOverride(payload: string, key: string): Promise<string> {
22
try {
3-
const crypto = require('crypto');
4-
const hmac = crypto.createHmac('sha256', key);
5-
hmac.update(payload, 'utf8');
6-
return hmac.digest('base64');
7-
}
8-
catch (err) {
3+
const crypto = require("crypto");
4+
const hmac = crypto.createHmac("sha256", key);
5+
hmac.update(payload, "utf8");
6+
return hmac.digest("base64");
7+
} catch (_err) {
98
// Not in Node environmnet; use subtle crypto.
109
}
1110
const subtleCrypto = getSubtleCrypto();
1211
if (!subtleCrypto) {
13-
throw new Error('No crypto implementation available');
12+
throw new Error("No crypto implementation available");
1413
}
1514
const encoder = new TextEncoder();
1615
const cryptoKey = await subtleCrypto.importKey(
17-
'raw',
16+
"raw",
1817
encoder.encode(key),
1918
{
20-
name: 'HMAC',
21-
hash: { name: 'SHA-256' }
19+
name: "HMAC",
20+
hash: { name: "SHA-256" },
2221
},
2322
false,
24-
['sign']
25-
);
26-
const signatureBuffer = await subtleCrypto.sign(
27-
'HMAC',
28-
cryptoKey,
29-
encoder.encode(payload)
23+
["sign"],
3024
);
25+
const signatureBuffer = await subtleCrypto.sign("HMAC", cryptoKey, encoder.encode(payload));
3126
return arrayBufferToBase64(signatureBuffer);
3227
}
3328

3429
function getSubtleCrypto(): SubtleCrypto | undefined {
35-
if (typeof window !== 'undefined' && window?.crypto?.subtle) {
30+
if (typeof window !== "undefined" && window?.crypto?.subtle) {
3631
return window.crypto.subtle;
3732
}
3833
return undefined;
3934
}
4035

4136
function arrayBufferToBase64(buffer: ArrayBuffer): string {
42-
if (typeof btoa === 'function') {
37+
if (typeof btoa === "function") {
4338
// Browser environment
4439
const bytes = new Uint8Array(buffer);
45-
let binary = '';
40+
let binary = "";
4641
for (let i = 0; i < bytes.byteLength; i++) {
4742
binary += String.fromCharCode(bytes[i]);
4843
}
4944
return btoa(binary);
5045
} else {
5146
// Node environment
52-
return Buffer.from(buffer).toString('base64');
47+
return Buffer.from(buffer).toString("base64");
5348
}
54-
}
49+
}

src/core/index.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
export * from "./fetcher";
2-
export * from "./auth";
3-
export * from "./runtime";
4-
export * from "./utils";
5-
export * from "./pagination";
6-
export * from "./form-data-utils";
7-
export * as url from "./url";
8-
export * as serialization from "./schemas";
1+
export * from "./auth/index.js";
2+
export * from "./base64.js";
3+
export * from "./crypto/index.js";
4+
export * from "./fetcher/index.js";
5+
export * as file from "./file/index.js";
6+
export * from "./form-data-utils/index.js";
7+
export * from "./pagination/index.js";
8+
export * from "./runtime/index.js";
9+
export * as serialization from "./schemas/index.js";
10+
export * as url from "./url/index.js";
11+
export * from "./utils/index.js";

0 commit comments

Comments
 (0)