Skip to content

Commit

Permalink
refactor: move peerDeps to deps, improve apple errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Jul 18, 2023
1 parent 8dedbe3 commit 94e2614
Show file tree
Hide file tree
Showing 11 changed files with 1,838 additions and 2,618 deletions.
3 changes: 1 addition & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "1.4.0",
"npmClient": "yarn",
"useWorkspaces": true,
"useNx": true,
"packages": [
"packages/*"
],
Expand Down
11 changes: 11 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
Expand All @@ -8,5 +9,15 @@
]
}
}
},
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"sharedGlobals": [],
"production": [
"default"
]
}
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
"release:ci": "lerna publish --yes --no-private"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.53.0",
"@typescript-eslint/parser": "5.53.0",
"conventional-changelog-conventionalcommits": "5.0.0",
"eslint": "8.34.0",
"eslint-config-prettier": "8.6.0",
"@typescript-eslint/eslint-plugin": "6.1.0",
"@typescript-eslint/parser": "6.1.0",
"conventional-changelog-conventionalcommits": "6.1.0",
"eslint": "8.45.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-simple-import-sort": "9.0.0",
"lerna": "5.3.0",
"nx": "14.5.2",
"patch-package": "6.4.7",
"prettier": "2.8.4",
"typescript": "4.9.5"
"lerna": "7.1.4",
"nx": "16.5.2",
"patch-package": "7.0.2",
"prettier": "3.0.0",
"typescript": "5.1.6"
}
}
4 changes: 2 additions & 2 deletions packages/apple-api-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint:tsc": "yarn tsc -p tsconfig.json --noEmit --skipLibCheck"
},
"devDependencies": {
"@types/node": "18.14.0",
"typescript": "4.9.5"
"@types/node": "20.4.2",
"typescript": "5.1.6"
}
}
4 changes: 2 additions & 2 deletions packages/google-api-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint:tsc": "yarn tsc -p tsconfig.json --noEmit --skipLibCheck"
},
"devDependencies": {
"@types/node": "18.14.0",
"typescript": "4.9.5"
"@types/node": "20.4.2",
"typescript": "5.1.6"
}
}
13 changes: 5 additions & 8 deletions packages/nest-iap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
"lint:tsc": "yarn tsc -p tsconfig.json --noEmit --skipLibCheck"
},
"dependencies": {
"@jeremybarbet/node-iap": "1.4.0"
"@jeremybarbet/node-iap": "1.4.0",
"@nestjs/common": "10.1.0"
},
"devDependencies": {
"@nestjs/common": "9.0.7",
"@types/node": "18.14.0",
"@types/node": "20.4.2",
"reflect-metadata": "0.1.13",
"rxjs": "7.5.6",
"typescript": "4.9.5"
},
"peerDependencies": {
"@nestjs/common": "*"
"rxjs": "7.8.1",
"typescript": "5.1.6"
}
}
14 changes: 5 additions & 9 deletions packages/node-iap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@
},
"dependencies": {
"@jeremybarbet/apple-api-types": "1.4.0",
"@jeremybarbet/google-api-types": "1.4.0"
"@jeremybarbet/google-api-types": "1.4.0",
"axios": "1.4.0",
"google-auth-library": "8.9.0"
},
"devDependencies": {
"@types/node": "18.14.0",
"axios": "0.27.2",
"google-auth-library": "8.1.1",
"@types/node": "20.4.2",
"ts-node": "10.9.1",
"typescript": "4.9.5"
},
"peerDependencies": {
"axios": "*",
"google-auth-library": "*"
"typescript": "5.1.6"
}
}
5 changes: 3 additions & 2 deletions packages/node-iap/src/apple/apple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ export const verify = async ({ transactionReceipt }: RequestBody, config: Config

return handleResponse(data);
} catch (error) {
const status = (error as ErrorResponse)?.response?.status ?? 500;
const status = (error as ErrorResponse<ErrorStatus>)?.response?.status;
const message = status ? errors[status] : 'Unknown error';

return {
valid: false,
data: undefined,
message: errors?.[status as ErrorStatus],
message,
status,
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/node-iap/src/apple/config.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface RequestBody {

export type DataResponse = ResponseBody;

export type StatusResponse = SuccessStatus | ErrorStatus | number;
export type StatusResponse = SuccessStatus | ErrorStatus;

export interface VerifyResponse {
valid: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/node-iap/src/types/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface ErrorResponse {
export interface ErrorResponse<T = number> {
response?: {
status: number;
status: T;
};
}
Loading

0 comments on commit 94e2614

Please sign in to comment.