@api-client/core 0.10.2 → 0.10.4
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/build/cjs/src/amf/AmfMixin.js.map +1 -1
- package/build/cjs/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/cjs/src/runtime/store/FilesSdk.js +11 -21
- package/build/cjs/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/cjs/src/runtime/store/RevisionsSdk.js +4 -1
- package/build/cjs/src/runtime/store/RevisionsSdk.js.map +1 -1
- package/build/cjs/src/runtime/store/RouteBuilder.d.ts +12 -17
- package/build/cjs/src/runtime/store/RouteBuilder.js +25 -40
- package/build/cjs/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/cjs/src/runtime/store/Sdk.d.ts +0 -5
- package/build/cjs/src/runtime/store/Sdk.js +0 -5
- package/build/cjs/src/runtime/store/Sdk.js.map +1 -1
- package/build/cjs/src/runtime/store/SharedSdk.js +1 -2
- package/build/cjs/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/cjs/src/runtime/store/TrashSdk.d.ts +4 -4
- package/build/cjs/src/runtime/store/TrashSdk.js +10 -11
- package/build/cjs/src/runtime/store/TrashSdk.js.map +1 -1
- package/build/cjs/src/testing/TestCliHelper.js.map +1 -1
- package/build/esm/src/amf/AmfMixin.js.map +1 -1
- package/build/esm/src/amf/ApiSchemaValues.js +2 -1
- package/build/esm/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/esm/src/runtime/store/FilesSdk.js +11 -21
- package/build/esm/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/esm/src/runtime/store/RevisionsSdk.js +5 -2
- package/build/esm/src/runtime/store/RevisionsSdk.js.map +1 -1
- package/build/esm/src/runtime/store/RouteBuilder.d.ts +12 -17
- package/build/esm/src/runtime/store/RouteBuilder.js +25 -40
- package/build/esm/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/esm/src/runtime/store/Sdk.d.ts +0 -5
- package/build/esm/src/runtime/store/Sdk.js +0 -5
- package/build/esm/src/runtime/store/Sdk.js.map +1 -1
- package/build/esm/src/runtime/store/SharedSdk.js +1 -2
- package/build/esm/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/esm/src/runtime/store/TrashSdk.d.ts +4 -4
- package/build/esm/src/runtime/store/TrashSdk.js +10 -11
- package/build/esm/src/runtime/store/TrashSdk.js.map +1 -1
- package/build/esm/src/testing/TestCliHelper.js +2 -1
- package/build/esm/src/testing/TestCliHelper.js.map +1 -1
- package/data/models/APIC-187.json +3 -3
- package/data/models/APIC-188.json +3 -3
- package/data/models/APIC-233.json +1 -1
- package/data/models/APIC-391.json +2 -2
- package/data/models/APIC-483.json +1 -1
- package/data/models/APIC-487.json +1 -1
- package/data/models/APIC-655.json +1 -1
- package/data/models/APIC-689.json +1 -1
- package/data/models/APIC-690.json +5 -5
- package/data/models/SE-10469.json +1 -1
- package/data/models/SE-13092.json +5 -5
- package/data/models/SE-22063.json +2 -2
- package/data/models/amf-helper-api.json +14 -14
- package/data/models/arc-demo-api.json +15 -15
- package/data/models/async-api.json +1 -1
- package/data/models/example-generator-api.json +10 -10
- package/data/models/expanded-api.json +1 -1
- package/data/models/flattened-api.json +1 -1
- package/data/models/multiple-servers.json +1 -1
- package/data/models/oas-3-api.json +1 -1
- package/data/models/oas-date.json +1 -1
- package/data/models/oas-types.json +1 -1
- package/data/models/oas-unions.json +1 -1
- package/data/models/petstore.json +1 -1
- package/data/models/raml-date.json +1 -1
- package/data/models/recursive.json +1 -1
- package/data/models/schema-api.json +7915 -7793
- package/data/models/secured-api.json +16 -16
- package/data/models/tracked-to-linked.json +4 -4
- package/package.json +6 -6
- package/src/amf/AmfMixin.ts +2 -2
- package/src/runtime/store/FilesSdk.ts +11 -21
- package/src/runtime/store/RevisionsSdk.ts +5 -2
- package/src/runtime/store/RouteBuilder.ts +25 -45
- package/src/runtime/store/Sdk.ts +0 -6
- package/src/runtime/store/SharedSdk.ts +1 -2
- package/src/runtime/store/TrashSdk.ts +10 -11
- package/build/cjs/src/runtime/store/CertificatesSdk.d.ts +0 -53
- package/build/cjs/src/runtime/store/CertificatesSdk.js +0 -238
- package/build/cjs/src/runtime/store/CertificatesSdk.js.map +0 -1
- package/build/esm/src/runtime/store/CertificatesSdk.d.ts +0 -53
- package/build/esm/src/runtime/store/CertificatesSdk.js +0 -234
- package/build/esm/src/runtime/store/CertificatesSdk.js.map +0 -1
- package/src/runtime/store/CertificatesSdk.ts +0 -238
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"@type": [
|
|
6
6
|
"doc:APIContractProcessingData"
|
|
7
7
|
],
|
|
8
|
-
"apiContract:modelVersion": "3.8.
|
|
8
|
+
"apiContract:modelVersion": "3.8.2",
|
|
9
9
|
"doc:transformed": true,
|
|
10
10
|
"doc:sourceSpec": "RAML 1.0"
|
|
11
11
|
},
|
|
@@ -16122,7 +16122,7 @@
|
|
|
16122
16122
|
"@type": [
|
|
16123
16123
|
"doc:APIContractProcessingData"
|
|
16124
16124
|
],
|
|
16125
|
-
"apiContract:modelVersion": "3.8.
|
|
16125
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16126
16126
|
"doc:sourceSpec": "RAML 1.0"
|
|
16127
16127
|
},
|
|
16128
16128
|
{
|
|
@@ -16168,7 +16168,7 @@
|
|
|
16168
16168
|
"@type": [
|
|
16169
16169
|
"doc:APIContractProcessingData"
|
|
16170
16170
|
],
|
|
16171
|
-
"apiContract:modelVersion": "3.8.
|
|
16171
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16172
16172
|
"doc:sourceSpec": "RAML 1.0"
|
|
16173
16173
|
},
|
|
16174
16174
|
{
|
|
@@ -16204,7 +16204,7 @@
|
|
|
16204
16204
|
"@type": [
|
|
16205
16205
|
"doc:APIContractProcessingData"
|
|
16206
16206
|
],
|
|
16207
|
-
"apiContract:modelVersion": "3.8.
|
|
16207
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16208
16208
|
"doc:sourceSpec": "RAML 1.0"
|
|
16209
16209
|
},
|
|
16210
16210
|
{
|
|
@@ -16258,7 +16258,7 @@
|
|
|
16258
16258
|
"@type": [
|
|
16259
16259
|
"doc:APIContractProcessingData"
|
|
16260
16260
|
],
|
|
16261
|
-
"apiContract:modelVersion": "3.8.
|
|
16261
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16262
16262
|
"doc:sourceSpec": "RAML 1.0"
|
|
16263
16263
|
},
|
|
16264
16264
|
{
|
|
@@ -16304,7 +16304,7 @@
|
|
|
16304
16304
|
"@type": [
|
|
16305
16305
|
"doc:APIContractProcessingData"
|
|
16306
16306
|
],
|
|
16307
|
-
"apiContract:modelVersion": "3.8.
|
|
16307
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16308
16308
|
"doc:sourceSpec": "RAML 1.0"
|
|
16309
16309
|
},
|
|
16310
16310
|
{
|
|
@@ -16340,7 +16340,7 @@
|
|
|
16340
16340
|
"@type": [
|
|
16341
16341
|
"doc:APIContractProcessingData"
|
|
16342
16342
|
],
|
|
16343
|
-
"apiContract:modelVersion": "3.8.
|
|
16343
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16344
16344
|
"doc:sourceSpec": "RAML 1.0"
|
|
16345
16345
|
},
|
|
16346
16346
|
{
|
|
@@ -16381,7 +16381,7 @@
|
|
|
16381
16381
|
"@type": [
|
|
16382
16382
|
"doc:APIContractProcessingData"
|
|
16383
16383
|
],
|
|
16384
|
-
"apiContract:modelVersion": "3.8.
|
|
16384
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16385
16385
|
"doc:sourceSpec": "RAML 1.0"
|
|
16386
16386
|
},
|
|
16387
16387
|
{
|
|
@@ -16422,7 +16422,7 @@
|
|
|
16422
16422
|
"@type": [
|
|
16423
16423
|
"doc:APIContractProcessingData"
|
|
16424
16424
|
],
|
|
16425
|
-
"apiContract:modelVersion": "3.8.
|
|
16425
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16426
16426
|
"doc:sourceSpec": "RAML 1.0"
|
|
16427
16427
|
},
|
|
16428
16428
|
{
|
|
@@ -16458,7 +16458,7 @@
|
|
|
16458
16458
|
"@type": [
|
|
16459
16459
|
"doc:APIContractProcessingData"
|
|
16460
16460
|
],
|
|
16461
|
-
"apiContract:modelVersion": "3.8.
|
|
16461
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16462
16462
|
"doc:sourceSpec": "RAML 1.0"
|
|
16463
16463
|
},
|
|
16464
16464
|
{
|
|
@@ -16499,7 +16499,7 @@
|
|
|
16499
16499
|
"@type": [
|
|
16500
16500
|
"doc:APIContractProcessingData"
|
|
16501
16501
|
],
|
|
16502
|
-
"apiContract:modelVersion": "3.8.
|
|
16502
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16503
16503
|
"doc:sourceSpec": "RAML 1.0"
|
|
16504
16504
|
},
|
|
16505
16505
|
{
|
|
@@ -16540,7 +16540,7 @@
|
|
|
16540
16540
|
"@type": [
|
|
16541
16541
|
"doc:APIContractProcessingData"
|
|
16542
16542
|
],
|
|
16543
|
-
"apiContract:modelVersion": "3.8.
|
|
16543
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16544
16544
|
"doc:sourceSpec": "RAML 1.0"
|
|
16545
16545
|
},
|
|
16546
16546
|
{
|
|
@@ -16576,7 +16576,7 @@
|
|
|
16576
16576
|
"@type": [
|
|
16577
16577
|
"doc:APIContractProcessingData"
|
|
16578
16578
|
],
|
|
16579
|
-
"apiContract:modelVersion": "3.8.
|
|
16579
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16580
16580
|
"doc:sourceSpec": "RAML 1.0"
|
|
16581
16581
|
},
|
|
16582
16582
|
{
|
|
@@ -16612,7 +16612,7 @@
|
|
|
16612
16612
|
"@type": [
|
|
16613
16613
|
"doc:APIContractProcessingData"
|
|
16614
16614
|
],
|
|
16615
|
-
"apiContract:modelVersion": "3.8.
|
|
16615
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16616
16616
|
"doc:sourceSpec": "RAML 1.0"
|
|
16617
16617
|
},
|
|
16618
16618
|
{
|
|
@@ -16648,7 +16648,7 @@
|
|
|
16648
16648
|
"@type": [
|
|
16649
16649
|
"doc:APIContractProcessingData"
|
|
16650
16650
|
],
|
|
16651
|
-
"apiContract:modelVersion": "3.8.
|
|
16651
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16652
16652
|
"doc:sourceSpec": "RAML 1.0"
|
|
16653
16653
|
},
|
|
16654
16654
|
{
|
|
@@ -16681,7 +16681,7 @@
|
|
|
16681
16681
|
"@type": [
|
|
16682
16682
|
"doc:APIContractProcessingData"
|
|
16683
16683
|
],
|
|
16684
|
-
"apiContract:modelVersion": "3.8.
|
|
16684
|
+
"apiContract:modelVersion": "3.8.2",
|
|
16685
16685
|
"doc:sourceSpec": "RAML 1.0"
|
|
16686
16686
|
},
|
|
16687
16687
|
{
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"@type": [
|
|
6
6
|
"doc:APIContractProcessingData"
|
|
7
7
|
],
|
|
8
|
-
"apiContract:modelVersion": "3.8.
|
|
8
|
+
"apiContract:modelVersion": "3.8.2",
|
|
9
9
|
"doc:transformed": true,
|
|
10
10
|
"doc:sourceSpec": "RAML 1.0"
|
|
11
11
|
},
|
|
@@ -1777,7 +1777,7 @@
|
|
|
1777
1777
|
"@type": [
|
|
1778
1778
|
"doc:APIContractProcessingData"
|
|
1779
1779
|
],
|
|
1780
|
-
"apiContract:modelVersion": "3.8.
|
|
1780
|
+
"apiContract:modelVersion": "3.8.2",
|
|
1781
1781
|
"doc:sourceSpec": "RAML 1.0"
|
|
1782
1782
|
},
|
|
1783
1783
|
{
|
|
@@ -1805,7 +1805,7 @@
|
|
|
1805
1805
|
"@type": [
|
|
1806
1806
|
"doc:APIContractProcessingData"
|
|
1807
1807
|
],
|
|
1808
|
-
"apiContract:modelVersion": "3.8.
|
|
1808
|
+
"apiContract:modelVersion": "3.8.2",
|
|
1809
1809
|
"doc:sourceSpec": "RAML 1.0"
|
|
1810
1810
|
},
|
|
1811
1811
|
{
|
|
@@ -1833,7 +1833,7 @@
|
|
|
1833
1833
|
"@type": [
|
|
1834
1834
|
"doc:APIContractProcessingData"
|
|
1835
1835
|
],
|
|
1836
|
-
"apiContract:modelVersion": "3.8.
|
|
1836
|
+
"apiContract:modelVersion": "3.8.2",
|
|
1837
1837
|
"doc:sourceSpec": "RAML 1.0"
|
|
1838
1838
|
},
|
|
1839
1839
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api-client/core",
|
|
3
3
|
"description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.4",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./build/esm/browser.js": {
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@types/sinon": "^10.0.11",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "^5.12.0",
|
|
61
61
|
"@typescript-eslint/parser": "^5.12.0",
|
|
62
|
-
"@web/dev-server-esbuild": "^0.
|
|
63
|
-
"@web/test-runner": "^0.
|
|
64
|
-
"@web/test-runner-playwright": "^0.
|
|
65
|
-
"amf-client-js": "^5.
|
|
62
|
+
"@web/dev-server-esbuild": "^0.4.0",
|
|
63
|
+
"@web/test-runner": "^0.16.0",
|
|
64
|
+
"@web/test-runner-playwright": "^0.10.0",
|
|
65
|
+
"amf-client-js": "^5.2.4-0",
|
|
66
66
|
"chai": "^4.3.4",
|
|
67
67
|
"chai-as-promised": "^7.1.1",
|
|
68
68
|
"chai-uuid": "^1.0.6",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"source-map-support": "^0.5.21",
|
|
86
86
|
"ssl-root-cas": "^1.3.1",
|
|
87
87
|
"ts-node": "^10.4.0",
|
|
88
|
-
"typescript": "^
|
|
88
|
+
"typescript": "^5.0.2"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
91
|
"build:ts": "npm run build:mjs && npm run build:cjs",
|
package/src/amf/AmfMixin.ts
CHANGED
|
@@ -777,7 +777,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
|
|
|
777
777
|
if (!data || !Array.isArray(data)) {
|
|
778
778
|
return undefined;
|
|
779
779
|
}
|
|
780
|
-
return data;
|
|
780
|
+
return data as (string | number | boolean | null | Object)[];
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
/**
|
|
@@ -1041,7 +1041,7 @@ export const AmfMixin = <T extends Constructor<any>>(superClass: T): Constructor
|
|
|
1041
1041
|
const key = this._getAmfKey(expectsKey, context) as string;
|
|
1042
1042
|
const expects = this._ensureArray((method as any)[key]);
|
|
1043
1043
|
if (expects) {
|
|
1044
|
-
return Array.isArray(expects) ? expects[0] : expects;
|
|
1044
|
+
return Array.isArray(expects) ? expects[0] as IAmfRequest : expects as IAmfRequest;
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
1047
|
return undefined;
|
|
@@ -60,12 +60,11 @@ export class FilesSdk extends SdkBase {
|
|
|
60
60
|
*/
|
|
61
61
|
async list(space: string, kinds?: ListFileKind[], options?: ContextListOptions, request: ISdkRequestOptions = {}): Promise<ContextListResult<IFile>> {
|
|
62
62
|
const token = request.token || this.sdk.token;
|
|
63
|
-
const url = this.sdk.getUrl(RouteBuilder.files());
|
|
63
|
+
const url = this.sdk.getUrl(RouteBuilder.files(space));
|
|
64
64
|
this.sdk.appendListOptions(url, options);
|
|
65
65
|
if (Array.isArray(kinds)) {
|
|
66
66
|
kinds.forEach(k => url.searchParams.append('kind', k));
|
|
67
67
|
}
|
|
68
|
-
url.searchParams.set('space', space);
|
|
69
68
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
70
69
|
this.inspectCommonStatusCodes(result);
|
|
71
70
|
const E_PREFIX = 'Unable to list files. ';
|
|
@@ -118,8 +117,7 @@ export class FilesSdk extends SdkBase {
|
|
|
118
117
|
*/
|
|
119
118
|
async createMeta(file: IFile, space: string, opts: IMetaCreateOptions = {}, request: ISdkRequestOptions = {}): Promise<ContextChangeRecord<IFile>> {
|
|
120
119
|
const token = request.token || this.sdk.token;
|
|
121
|
-
const url = this.sdk.getUrl(RouteBuilder.files());
|
|
122
|
-
url.searchParams.set('space', space);
|
|
120
|
+
const url = this.sdk.getUrl(RouteBuilder.files(space));
|
|
123
121
|
if (opts.parent) {
|
|
124
122
|
url.searchParams.set('parent', opts.parent);
|
|
125
123
|
}
|
|
@@ -168,9 +166,8 @@ export class FilesSdk extends SdkBase {
|
|
|
168
166
|
*/
|
|
169
167
|
async createMedia(contents: unknown, space: string, key: string, opts: IMediaCreateOptions = {}, request: ISdkRequestOptions = {}): Promise<void> {
|
|
170
168
|
const token = request.token || this.sdk.token;
|
|
171
|
-
const path = RouteBuilder.file(key);
|
|
169
|
+
const path = RouteBuilder.file(space, key);
|
|
172
170
|
const url = this.sdk.getUrl(path);
|
|
173
|
-
url.searchParams.set('space', space);
|
|
174
171
|
url.searchParams.set('alt', 'media');
|
|
175
172
|
const mime = opts.mime || 'application/json';
|
|
176
173
|
let body: string;
|
|
@@ -225,8 +222,7 @@ export class FilesSdk extends SdkBase {
|
|
|
225
222
|
*/
|
|
226
223
|
async read(space: string, key: string, media?: boolean, request: ISdkRequestOptions = {}): Promise<IFile | unknown> {
|
|
227
224
|
const token = request.token || this.sdk.token;
|
|
228
|
-
const url = this.sdk.getUrl(RouteBuilder.file(key));
|
|
229
|
-
url.searchParams.set('space', space);
|
|
225
|
+
const url = this.sdk.getUrl(RouteBuilder.file(space, key));
|
|
230
226
|
if (media) {
|
|
231
227
|
url.searchParams.set('alt', 'media');
|
|
232
228
|
}
|
|
@@ -268,8 +264,7 @@ export class FilesSdk extends SdkBase {
|
|
|
268
264
|
*/
|
|
269
265
|
async readBulk(space: string, keys: string[], request: ISdkRequestOptions = {}): Promise<IBulkOperationResult<IFile>> {
|
|
270
266
|
const token = request.token || this.sdk.token;
|
|
271
|
-
const url = this.sdk.getUrl(RouteBuilder.filesBatch());
|
|
272
|
-
url.searchParams.set('space', space);
|
|
267
|
+
const url = this.sdk.getUrl(RouteBuilder.filesBatch(space));
|
|
273
268
|
const body = JSON.stringify(keys);
|
|
274
269
|
const result = await this.sdk.http.post(url.toString(), { token, body });
|
|
275
270
|
this.inspectCommonStatusCodes(result);
|
|
@@ -325,8 +320,7 @@ export class FilesSdk extends SdkBase {
|
|
|
325
320
|
*/
|
|
326
321
|
async patch(space: string, key: string, value: IPatchInfo, media?: boolean, request: ISdkRequestOptions = {}): Promise<IPatchRevision> {
|
|
327
322
|
const token = request.token || this.sdk.token;
|
|
328
|
-
const url = this.sdk.getUrl(RouteBuilder.file(key));
|
|
329
|
-
url.searchParams.set('space', space);
|
|
323
|
+
const url = this.sdk.getUrl(RouteBuilder.file(space, key));
|
|
330
324
|
if (media) {
|
|
331
325
|
url.searchParams.set('alt', 'media');
|
|
332
326
|
}
|
|
@@ -368,8 +362,7 @@ export class FilesSdk extends SdkBase {
|
|
|
368
362
|
*/
|
|
369
363
|
async delete(space: string, key: string, request: ISdkRequestOptions = {}): Promise<string> {
|
|
370
364
|
const token = request.token || this.sdk.token;
|
|
371
|
-
const url = this.sdk.getUrl(RouteBuilder.file(key));
|
|
372
|
-
url.searchParams.set('space', space);
|
|
365
|
+
const url = this.sdk.getUrl(RouteBuilder.file(space, key));
|
|
373
366
|
const result = await this.sdk.http.delete(url.toString(), { token });
|
|
374
367
|
this.inspectCommonStatusCodes(result);
|
|
375
368
|
const E_PREFIX = 'Unable to delete a file. ';
|
|
@@ -386,7 +379,7 @@ export class FilesSdk extends SdkBase {
|
|
|
386
379
|
if (!loc) {
|
|
387
380
|
throw new Error(`${E_PREFIX}${E_RESPONSE_LOCATION}`);
|
|
388
381
|
}
|
|
389
|
-
return loc.replace(`${RouteBuilder.trash()}/`, '');
|
|
382
|
+
return loc.replace(`${RouteBuilder.trash(space)}/`, '');
|
|
390
383
|
}
|
|
391
384
|
|
|
392
385
|
/**
|
|
@@ -399,8 +392,7 @@ export class FilesSdk extends SdkBase {
|
|
|
399
392
|
*/
|
|
400
393
|
async patchUsers(space: string, key: string, value: IAccessPatchInfo, request: ISdkRequestOptions = {}): Promise<void> {
|
|
401
394
|
const token = request.token || this.sdk.token;
|
|
402
|
-
const url = this.sdk.getUrl(RouteBuilder.fileUsers(key));
|
|
403
|
-
url.searchParams.set('space', space);
|
|
395
|
+
const url = this.sdk.getUrl(RouteBuilder.fileUsers(space, key));
|
|
404
396
|
const body = JSON.stringify(value);
|
|
405
397
|
const result = await this.sdk.http.patch(url.toString(), { token, body });
|
|
406
398
|
this.inspectCommonStatusCodes(result);
|
|
@@ -470,8 +462,7 @@ export class FilesSdk extends SdkBase {
|
|
|
470
462
|
*/
|
|
471
463
|
async listUsers(space: string, key: string, request: ISdkRequestOptions = {}): Promise<ContextListResult<IUser>> {
|
|
472
464
|
const token = request.token || this.sdk.token;
|
|
473
|
-
const url = this.sdk.getUrl(RouteBuilder.fileUsers(key));
|
|
474
|
-
url.searchParams.set('space', space);
|
|
465
|
+
const url = this.sdk.getUrl(RouteBuilder.fileUsers(space, key));
|
|
475
466
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
476
467
|
this.inspectCommonStatusCodes(result);
|
|
477
468
|
const E_PREFIX = 'Unable to list users in the file. ';
|
|
@@ -505,8 +496,7 @@ export class FilesSdk extends SdkBase {
|
|
|
505
496
|
*/
|
|
506
497
|
async breadcrumbs(space: string, key: string, request: ISdkRequestOptions = {}): Promise<ContextListResult<FileBreadcrumb>> {
|
|
507
498
|
const token = request.token || this.sdk.token;
|
|
508
|
-
const url = this.sdk.getUrl(RouteBuilder.fileBreadcrumbs(key));
|
|
509
|
-
url.searchParams.set('space', space);
|
|
499
|
+
const url = this.sdk.getUrl(RouteBuilder.fileBreadcrumbs(space, key));
|
|
510
500
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
511
501
|
this.inspectCommonStatusCodes(result);
|
|
512
502
|
const E_PREFIX = 'Unable to read a file. ';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN, ISdkRequestOptions } from './SdkBase.js';
|
|
2
2
|
import { RouteBuilder } from './RouteBuilder.js';
|
|
3
3
|
import { ContextListResult, ContextSpaceListOptions } from '../../events/BaseEvents.js';
|
|
4
|
-
import { SdkError } from './Errors.js';
|
|
4
|
+
import { ApiError, SdkError } from './Errors.js';
|
|
5
5
|
import { IRevision } from '../../models/store/Revision.js';
|
|
6
6
|
|
|
7
7
|
export class RevisionsSdk extends SdkBase {
|
|
@@ -12,8 +12,11 @@ export class RevisionsSdk extends SdkBase {
|
|
|
12
12
|
* @param options The list query options
|
|
13
13
|
*/
|
|
14
14
|
async list(key: string, options: ContextSpaceListOptions, request: ISdkRequestOptions = {}): Promise<ContextListResult<IRevision>> {
|
|
15
|
+
if (!options.space) {
|
|
16
|
+
throw new ApiError('The space parameter is required', 400)
|
|
17
|
+
}
|
|
15
18
|
const token = request.token || this.sdk.token;
|
|
16
|
-
const url = this.sdk.getUrl(RouteBuilder.fileRevisions(key));
|
|
19
|
+
const url = this.sdk.getUrl(RouteBuilder.fileRevisions(options.space, key));
|
|
17
20
|
this.sdk.appendListOptions(url, options);
|
|
18
21
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
19
22
|
this.inspectCommonStatusCodes(result);
|
|
@@ -17,43 +17,43 @@ export class RouteBuilder {
|
|
|
17
17
|
/**
|
|
18
18
|
* @returns The path to the /files route.
|
|
19
19
|
*/
|
|
20
|
-
static files(): string {
|
|
21
|
-
return
|
|
20
|
+
static files(space: string): string {
|
|
21
|
+
return `/files/${space}`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @returns The path to the /files/batch route.
|
|
26
26
|
*/
|
|
27
|
-
static filesBatch(): string {
|
|
28
|
-
return
|
|
27
|
+
static filesBatch(space: string): string {
|
|
28
|
+
return `/files/${space}/batch`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @returns The path to the /files/[id] route.
|
|
33
33
|
*/
|
|
34
|
-
static file(key: string): string {
|
|
35
|
-
return `/files/${key}`;
|
|
34
|
+
static file(space: string, key: string): string {
|
|
35
|
+
return `/files/${space}/${key}`;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @returns The path to the /files/[id]/users route.
|
|
40
40
|
*/
|
|
41
|
-
static fileUsers(key: string): string {
|
|
42
|
-
return `/files/${key}/users`;
|
|
41
|
+
static fileUsers(space: string, key: string): string {
|
|
42
|
+
return `/files/${space}/${key}/users`;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @returns The path to the /file/[id]/revisions route.
|
|
47
47
|
*/
|
|
48
|
-
static fileRevisions(file: string): string {
|
|
49
|
-
return `/file/${file}/revisions`;
|
|
48
|
+
static fileRevisions(space: string, file: string): string {
|
|
49
|
+
return `/file/${space}/${file}/revisions`;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @returns The path to the /file/[id]/revisions route.
|
|
54
54
|
*/
|
|
55
|
-
static fileBreadcrumbs(file: string): string {
|
|
56
|
-
return `/file/${file}/breadcrumbs`;
|
|
55
|
+
static fileBreadcrumbs(space: string, file: string): string {
|
|
56
|
+
return `/file/${space}/${file}/breadcrumbs`;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -103,53 +103,33 @@ export class RouteBuilder {
|
|
|
103
103
|
return `/history/clear/${type}/${key.join('/')}`;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
static shared(): string {
|
|
107
|
-
return
|
|
106
|
+
static shared(space: string): string {
|
|
107
|
+
return `/shared/${space}`;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
static
|
|
111
|
-
return
|
|
110
|
+
static trash(space: string): string {
|
|
111
|
+
return `/trash/${space}`
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
static
|
|
115
|
-
return `/certificates/${key}`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static certificatesEmpty(key: string): string {
|
|
119
|
-
return `/certificates/empty/${key}`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static certificateBatchCreate(): string {
|
|
123
|
-
return `/certificate/batch/create`;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
static certificateBatchDelete(): string {
|
|
127
|
-
return `/certificate/batch/delete`;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static trash(): string {
|
|
131
|
-
return `/trash`
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
static trashItem(trashKey: string): string {
|
|
114
|
+
static trashItem(space: string, trashKey: string): string {
|
|
135
115
|
// GET + DELETE (link to ./delete)
|
|
136
|
-
return `/trash/${trashKey}`;
|
|
116
|
+
return `/trash/${space}/${trashKey}`;
|
|
137
117
|
}
|
|
138
118
|
|
|
139
|
-
static trashRestore(trashKey: string): string {
|
|
140
|
-
return `/trash/${trashKey}/restore`
|
|
119
|
+
static trashRestore(space: string, trashKey: string): string {
|
|
120
|
+
return `/trash/${space}/${trashKey}/restore`
|
|
141
121
|
}
|
|
142
122
|
|
|
143
123
|
static trashEmpty(space: string): string {
|
|
144
|
-
return `/trash
|
|
124
|
+
return `/trash/${space}/empty`
|
|
145
125
|
}
|
|
146
126
|
|
|
147
|
-
static trashBatchRestore(): string {
|
|
148
|
-
return `/trash/batch/restore`
|
|
127
|
+
static trashBatchRestore(space: string): string {
|
|
128
|
+
return `/trash/${space}/batch/restore`
|
|
149
129
|
}
|
|
150
130
|
|
|
151
|
-
static trashBatchDelete(): string {
|
|
152
|
-
return `/trash/batch/delete`;
|
|
131
|
+
static trashBatchDelete(space: string): string {
|
|
132
|
+
return `/trash/${space}/batch/delete`;
|
|
153
133
|
}
|
|
154
134
|
|
|
155
135
|
static projectExecutions(): string {
|
package/src/runtime/store/Sdk.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { UsersSdk } from './UsersSdk.js';
|
|
|
7
7
|
import { HistorySdk } from './HistorySdk.js';
|
|
8
8
|
import { SharedSdk } from './SharedSdk.js';
|
|
9
9
|
import { ContextListOptions, ContextSpaceListOptions } from '../../events/BaseEvents.js';
|
|
10
|
-
import { CertificatesSdk } from './CertificatesSdk.js';
|
|
11
10
|
import { RevisionsSdk } from './RevisionsSdk.js';
|
|
12
11
|
import { SpacesSdk } from './SpacesSdk.js';
|
|
13
12
|
import { TrashSdk } from './TrashSdk.js';
|
|
@@ -56,11 +55,6 @@ export abstract class Sdk {
|
|
|
56
55
|
*/
|
|
57
56
|
shared = new SharedSdk(this);
|
|
58
57
|
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated Use the `files` to store certificates.
|
|
61
|
-
*/
|
|
62
|
-
certificates = new CertificatesSdk(this);
|
|
63
|
-
|
|
64
58
|
revisions = new RevisionsSdk(this);
|
|
65
59
|
|
|
66
60
|
spaces = new SpacesSdk(this);
|
|
@@ -15,12 +15,11 @@ export class SharedSdk extends SdkBase {
|
|
|
15
15
|
*/
|
|
16
16
|
async list(space: string, kinds?: ListFileKind[], options?: ContextListOptions, request: ISdkRequestOptions = {}): Promise<ContextListResult<IFile>> {
|
|
17
17
|
const token = request.token || this.sdk.token;
|
|
18
|
-
const url = this.sdk.getUrl(RouteBuilder.shared());
|
|
18
|
+
const url = this.sdk.getUrl(RouteBuilder.shared(space));
|
|
19
19
|
this.sdk.appendListOptions(url, options);
|
|
20
20
|
if (Array.isArray(kinds)) {
|
|
21
21
|
kinds.forEach(k => url.searchParams.append('kind', k));
|
|
22
22
|
}
|
|
23
|
-
url.searchParams.set('space', space);
|
|
24
23
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
25
24
|
this.inspectCommonStatusCodes(result);
|
|
26
25
|
const E_PREFIX = 'Unable to list spaces. ';
|
|
@@ -27,8 +27,7 @@ export class TrashSdk extends SdkBase {
|
|
|
27
27
|
*/
|
|
28
28
|
async add(entry: TrashEntryCreate, space: string, request: ISdkRequestOptions = {}): Promise<ContextChangeRecord<TrashEntry>> {
|
|
29
29
|
const token = request.token || this.sdk.token;
|
|
30
|
-
const url = this.sdk.getUrl(RouteBuilder.trash());
|
|
31
|
-
url.searchParams.set('space', space);
|
|
30
|
+
const url = this.sdk.getUrl(RouteBuilder.trash(space));
|
|
32
31
|
const body = JSON.stringify(entry);
|
|
33
32
|
const result = await this.sdk.http.post(url.toString(), { token, body });
|
|
34
33
|
this.inspectCommonStatusCodes(result);
|
|
@@ -63,7 +62,7 @@ export class TrashSdk extends SdkBase {
|
|
|
63
62
|
*/
|
|
64
63
|
async list(options: ContextSpaceListOptions, request: ISdkRequestOptions = {}): Promise<ContextListResult<TrashEntry>> {
|
|
65
64
|
const token = request.token || this.sdk.token;
|
|
66
|
-
const url = this.sdk.getUrl(RouteBuilder.trash());
|
|
65
|
+
const url = this.sdk.getUrl(RouteBuilder.trash(options.space));
|
|
67
66
|
this.sdk.appendListOptions(url, options);
|
|
68
67
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
69
68
|
this.inspectCommonStatusCodes(result);
|
|
@@ -97,8 +96,8 @@ export class TrashSdk extends SdkBase {
|
|
|
97
96
|
*
|
|
98
97
|
* @param key The key of the deleted object
|
|
99
98
|
*/
|
|
100
|
-
async delete(key: string, request: ISdkRequestOptions = {}): Promise<void> {
|
|
101
|
-
const url = this.sdk.getUrl(RouteBuilder.trashItem(key));
|
|
99
|
+
async delete(space: string, key: string, request: ISdkRequestOptions = {}): Promise<void> {
|
|
100
|
+
const url = this.sdk.getUrl(RouteBuilder.trashItem(space, key));
|
|
102
101
|
return this.genericDelete(url, request);
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -109,8 +108,8 @@ export class TrashSdk extends SdkBase {
|
|
|
109
108
|
* @param request Optional request options.
|
|
110
109
|
* @returns The list of delete records.
|
|
111
110
|
*/
|
|
112
|
-
async batchDelete(keys: string[], request: ISdkRequestOptions = {}): Promise<IBulkOperationResult<ContextDeleteRecord>> {
|
|
113
|
-
const path = RouteBuilder.trashBatchDelete();
|
|
111
|
+
async batchDelete(space: string, keys: string[], request: ISdkRequestOptions = {}): Promise<IBulkOperationResult<ContextDeleteRecord>> {
|
|
112
|
+
const path = RouteBuilder.trashBatchDelete(space);
|
|
114
113
|
const url = this.sdk.getUrl(path);
|
|
115
114
|
return this.genericBatchDelete(url, keys, request);
|
|
116
115
|
}
|
|
@@ -121,8 +120,8 @@ export class TrashSdk extends SdkBase {
|
|
|
121
120
|
*
|
|
122
121
|
* @param key The key of the file to restore
|
|
123
122
|
*/
|
|
124
|
-
async restore(key: string, request: ISdkRequestOptions = {}): Promise<ContextChangeRecord<IFile>> {
|
|
125
|
-
const url = this.sdk.getUrl(RouteBuilder.trashRestore(key));
|
|
123
|
+
async restore(space: string, key: string, request: ISdkRequestOptions = {}): Promise<ContextChangeRecord<IFile>> {
|
|
124
|
+
const url = this.sdk.getUrl(RouteBuilder.trashRestore(space, key));
|
|
126
125
|
const token = request.token || this.sdk.token;
|
|
127
126
|
const result = await this.sdk.http.put(url.toString(), { token });
|
|
128
127
|
this.inspectCommonStatusCodes(result);
|
|
@@ -151,8 +150,8 @@ export class TrashSdk extends SdkBase {
|
|
|
151
150
|
return data;
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
async batchRestore(keys: string[], request: ISdkRequestOptions = {}): Promise<IBulkOperationResult<ContextChangeRecord<IFile>>> {
|
|
155
|
-
const url = this.sdk.getUrl(RouteBuilder.trashBatchRestore());
|
|
153
|
+
async batchRestore(space: string, keys: string[], request: ISdkRequestOptions = {}): Promise<IBulkOperationResult<ContextChangeRecord<IFile>>> {
|
|
154
|
+
const url = this.sdk.getUrl(RouteBuilder.trashBatchRestore(space));
|
|
156
155
|
const token = request.token || this.sdk.token;
|
|
157
156
|
const result = await this.sdk.http.post(url.toString(), { token, body: JSON.stringify(keys) });
|
|
158
157
|
this.inspectCommonStatusCodes(result);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { SdkBase, ISdkRequestOptions } from './SdkBase.js';
|
|
2
|
-
import { ContextChangeRecord, ContextDeleteRecord, ContextListResult, ContextSpaceListOptions, IBulkOperationResult } from '../../events/BaseEvents.js';
|
|
3
|
-
import { HttpCertificate } from '../../models/ClientCertificate.js';
|
|
4
|
-
export declare class CertificatesSdk extends SdkBase {
|
|
5
|
-
/**
|
|
6
|
-
* Inserts a certificate to the store
|
|
7
|
-
*
|
|
8
|
-
* @param value The value to insert.
|
|
9
|
-
* @param space The parent space of the certificate.
|
|
10
|
-
* @deprecated Use the `files` to store certificates.
|
|
11
|
-
*/
|
|
12
|
-
add(value: HttpCertificate, space: string, request?: ISdkRequestOptions): Promise<ContextChangeRecord<HttpCertificate>>;
|
|
13
|
-
/**
|
|
14
|
-
* Adds certificates in a bulk operation.
|
|
15
|
-
* @param value The lits of certificates to add.
|
|
16
|
-
* @param space The parent workspace
|
|
17
|
-
* @returns The list of inserted certificates. `undefined` when there was an error inserting a certificate.
|
|
18
|
-
* @deprecated Use the `files` to store certificates.
|
|
19
|
-
*/
|
|
20
|
-
addBulk(values: HttpCertificate[], space: string, request?: ISdkRequestOptions): Promise<IBulkOperationResult<ContextChangeRecord<HttpCertificate>>>;
|
|
21
|
-
/**
|
|
22
|
-
* @param key The key of the certificate to read.
|
|
23
|
-
* @deprecated Use the `files` to store certificates.
|
|
24
|
-
*/
|
|
25
|
-
read(key: string, request?: ISdkRequestOptions): Promise<HttpCertificate>;
|
|
26
|
-
/**
|
|
27
|
-
* Lists certificate entires.
|
|
28
|
-
*
|
|
29
|
-
* @param space The parent space of the certificate.
|
|
30
|
-
* @param options The list query options.
|
|
31
|
-
* @deprecated Use the `files` to store certificates.
|
|
32
|
-
*/
|
|
33
|
-
list(options?: ContextSpaceListOptions, request?: ISdkRequestOptions): Promise<ContextListResult<HttpCertificate>>;
|
|
34
|
-
/**
|
|
35
|
-
* Marks the certificate as deleted.
|
|
36
|
-
*
|
|
37
|
-
* @param key The key of the certificate to delete.
|
|
38
|
-
* @deprecated Use the `files` to store certificates.
|
|
39
|
-
*/
|
|
40
|
-
delete(key: string, request?: ISdkRequestOptions): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Removed certificates in a bulk operation.
|
|
43
|
-
* @param keys The list of certificate keys to delete.
|
|
44
|
-
* @deprecated Use the `files` to store certificates.
|
|
45
|
-
*/
|
|
46
|
-
deleteBulk(keys: string[], request?: ISdkRequestOptions): Promise<IBulkOperationResult<ContextDeleteRecord>>;
|
|
47
|
-
/**
|
|
48
|
-
* Removes all certificates from the store for the given workspace.
|
|
49
|
-
* @param space The parent workspace key
|
|
50
|
-
* @deprecated Use the `files` to store certificates.
|
|
51
|
-
*/
|
|
52
|
-
empty(space: string, request?: ISdkRequestOptions): Promise<void>;
|
|
53
|
-
}
|