@apigames/sdk-core 23.3.1 → 23.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/classes/index.d.ts +1 -1
- package/lib/classes/resource.container.d.ts +1 -0
- package/lib/classes/resource.container.js +4 -1
- package/lib/classes/resource.object.js +1 -1
- package/lib/classes/sdk.config.d.ts +3 -0
- package/lib/classes/sdk.config.js +5 -0
- package/lib/interfaces/resource.interfaces.d.ts +1 -0
- package/package.json +12 -12
package/lib/classes/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { default as ResourceContainer, ResourceContainerParams, ResourceFilterTy
|
|
|
2
2
|
export { default as ResourceObject, ResourceObjectClass, ResourceObjectMode } from './resource.object';
|
|
3
3
|
export { ResourceHeaderParams } from './resource.header.params';
|
|
4
4
|
export { ResourcePathParams } from './resource.path.params';
|
|
5
|
-
export { SDKConfiguration, SDKConfig } from './sdk.config';
|
|
5
|
+
export { SDKConfiguration, SDKConfig, UriRewriter } from './sdk.config';
|
|
@@ -54,5 +54,6 @@ export default class ResourceContainer implements IResourceContainer {
|
|
|
54
54
|
Include(include: ResourceIncludeOption): IResourceContainer;
|
|
55
55
|
PageOffset(pageOffset: number, pageSize: number): IResourceContainer;
|
|
56
56
|
PageNumber(pageNumber: number, pageSize: number): IResourceContainer;
|
|
57
|
+
RewriteUri(uri: string): string;
|
|
57
58
|
toJSON(): any;
|
|
58
59
|
}
|
|
@@ -60,7 +60,7 @@ class ResourceContainer {
|
|
|
60
60
|
uriPath = uriPath.replace(`{${pathParam}}`, this.pathParams[pathParam]);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
return uriPath;
|
|
63
|
+
return this.RewriteUri(uriPath);
|
|
64
64
|
}
|
|
65
65
|
isResourceObject(value) {
|
|
66
66
|
return (0, json_1.isObject)(value);
|
|
@@ -318,6 +318,9 @@ class ResourceContainer {
|
|
|
318
318
|
this._queryParams.pagination.size = pageSize;
|
|
319
319
|
return this;
|
|
320
320
|
}
|
|
321
|
+
RewriteUri(uri) {
|
|
322
|
+
return this.sdkConfig.RewriteUri(uri);
|
|
323
|
+
}
|
|
321
324
|
toJSON() {
|
|
322
325
|
if ((0, json_1.isDefined)(this.data)) {
|
|
323
326
|
if ((0, __1.isResourceObject)(this.data))
|
|
@@ -2,15 +2,18 @@ import { ResourceObjectClass } from './resource.object';
|
|
|
2
2
|
export type SDKResourceMap = {
|
|
3
3
|
[index: string]: ResourceObjectClass;
|
|
4
4
|
};
|
|
5
|
+
export type UriRewriter = (uri: string) => string;
|
|
5
6
|
export declare class SDKConfiguration {
|
|
6
7
|
private _accessToken;
|
|
7
8
|
private _apiKey;
|
|
8
9
|
private _hostName;
|
|
9
10
|
private _resourceMap;
|
|
11
|
+
private _uriRewriter;
|
|
10
12
|
constructor();
|
|
11
13
|
RegisterResourceClass(type: string, resourceClass: ResourceObjectClass): void;
|
|
12
14
|
ResourceClass(type: string): ResourceObjectClass;
|
|
13
15
|
FormatURL(path: string): string;
|
|
16
|
+
RewriteUri(uri: string): string;
|
|
14
17
|
get accessToken(): string;
|
|
15
18
|
set accessToken(value: string);
|
|
16
19
|
get apiKey(): string;
|
|
@@ -17,6 +17,11 @@ class SDKConfiguration {
|
|
|
17
17
|
url = url.endsWith('/') ? url.slice(0, -1) : url;
|
|
18
18
|
return path.startsWith('/') ? `${url}${path}` : `${url}/${path}`;
|
|
19
19
|
}
|
|
20
|
+
RewriteUri(uri) {
|
|
21
|
+
if ((0, json_1.isDefined)(this._uriRewriter))
|
|
22
|
+
return this._uriRewriter(uri);
|
|
23
|
+
return uri;
|
|
24
|
+
}
|
|
20
25
|
get accessToken() {
|
|
21
26
|
return this._accessToken;
|
|
22
27
|
}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"description": "API Games SDK Core",
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"version": "23.3.
|
|
16
|
+
"version": "23.3.3",
|
|
17
17
|
"main": "lib/index.js",
|
|
18
18
|
"types": "lib/index.d.ts",
|
|
19
19
|
"scripts": {
|
|
@@ -33,26 +33,26 @@
|
|
|
33
33
|
"test:watch": "jest --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@apigames/json": "23.3.
|
|
37
|
-
"@apigames/rest-client": "23.3.
|
|
36
|
+
"@apigames/json": "23.3.2",
|
|
37
|
+
"@apigames/rest-client": "23.3.2",
|
|
38
38
|
"object-hash": "3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/date-and-time": "0.13.0",
|
|
42
|
-
"@types/jest": "29.5.
|
|
43
|
-
"@types/node": "20.
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "6.4
|
|
45
|
-
"@typescript-eslint/parser": "6.4
|
|
46
|
-
"date-and-time": "3.0.
|
|
47
|
-
"eslint": "8.
|
|
42
|
+
"@types/jest": "29.5.5",
|
|
43
|
+
"@types/node": "20.8.2",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
45
|
+
"@typescript-eslint/parser": "6.7.4",
|
|
46
|
+
"date-and-time": "3.0.3",
|
|
47
|
+
"eslint": "8.50.0",
|
|
48
48
|
"eslint-config-airbnb": "19.0.4",
|
|
49
|
-
"eslint-plugin-import": "2.28.
|
|
49
|
+
"eslint-plugin-import": "2.28.1",
|
|
50
50
|
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
51
51
|
"eslint-plugin-react": "7.33.2",
|
|
52
52
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
53
|
-
"jest": "29.
|
|
53
|
+
"jest": "29.7.0",
|
|
54
54
|
"ts-jest": "29.1.1",
|
|
55
|
-
"typescript": "5.
|
|
55
|
+
"typescript": "5.2.2"
|
|
56
56
|
},
|
|
57
57
|
"eslintConfig": {},
|
|
58
58
|
"repository": {
|