@api-client/core 0.8.4 → 0.8.6
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/src/Platform.d.ts +4 -0
- package/build/src/Platform.js +4 -0
- package/build/src/Platform.js.map +1 -1
- package/build/src/events/BaseEvents.d.ts +34 -1
- package/build/src/events/BaseEvents.js.map +1 -1
- package/build/src/lib/transformers/PayloadSerializer.js +5 -4
- package/build/src/lib/transformers/PayloadSerializer.js.map +1 -1
- package/build/src/runtime/http-engine/CoreEngine.js +6 -2
- package/build/src/runtime/http-engine/CoreEngine.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 +20 -8
- 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 +33 -21
- package/data/models/arc-demo-api.json +15 -15
- package/data/models/async-api.json +1 -1
- package/data/models/example-generator-api.json +4975 -4866
- 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 +2 -2
- package/data/models/secured-api.json +16 -16
- package/data/models/tracked-to-linked.json +4 -4
- package/package.json +2 -2
- package/src/Platform.ts +5 -0
- package/src/events/BaseEvents.ts +34 -1
- package/src/lib/transformers/PayloadSerializer.ts +5 -4
- package/src/runtime/http-engine/CoreEngine.ts +8 -4
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"@type": [
|
|
6
6
|
"doc:APIContractProcessingData"
|
|
7
7
|
],
|
|
8
|
-
"apiContract:modelVersion": "3.8.
|
|
8
|
+
"apiContract:modelVersion": "3.8.1",
|
|
9
9
|
"doc:transformed": true,
|
|
10
10
|
"doc:sourceSpec": "RAML 1.0"
|
|
11
11
|
},
|
|
@@ -13128,7 +13128,7 @@
|
|
|
13128
13128
|
"@type": [
|
|
13129
13129
|
"doc:APIContractProcessingData"
|
|
13130
13130
|
],
|
|
13131
|
-
"apiContract:modelVersion": "3.8.
|
|
13131
|
+
"apiContract:modelVersion": "3.8.1",
|
|
13132
13132
|
"doc:sourceSpec": "RAML 1.0"
|
|
13133
13133
|
},
|
|
13134
13134
|
{
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"@type": [
|
|
6
6
|
"doc:APIContractProcessingData"
|
|
7
7
|
],
|
|
8
|
-
"apiContract:modelVersion": "3.8.
|
|
8
|
+
"apiContract:modelVersion": "3.8.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
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.1",
|
|
9
9
|
"doc:transformed": true,
|
|
10
10
|
"doc:sourceSpec": "RAML 1.0"
|
|
11
11
|
},
|
|
@@ -1737,7 +1737,7 @@
|
|
|
1737
1737
|
"@type": [
|
|
1738
1738
|
"doc:APIContractProcessingData"
|
|
1739
1739
|
],
|
|
1740
|
-
"apiContract:modelVersion": "3.8.
|
|
1740
|
+
"apiContract:modelVersion": "3.8.1",
|
|
1741
1741
|
"doc:sourceSpec": "RAML 1.0"
|
|
1742
1742
|
},
|
|
1743
1743
|
{
|
|
@@ -1765,7 +1765,7 @@
|
|
|
1765
1765
|
"@type": [
|
|
1766
1766
|
"doc:APIContractProcessingData"
|
|
1767
1767
|
],
|
|
1768
|
-
"apiContract:modelVersion": "3.8.
|
|
1768
|
+
"apiContract:modelVersion": "3.8.1",
|
|
1769
1769
|
"doc:sourceSpec": "RAML 1.0"
|
|
1770
1770
|
},
|
|
1771
1771
|
{
|
|
@@ -1793,7 +1793,7 @@
|
|
|
1793
1793
|
"@type": [
|
|
1794
1794
|
"doc:APIContractProcessingData"
|
|
1795
1795
|
],
|
|
1796
|
-
"apiContract:modelVersion": "3.8.
|
|
1796
|
+
"apiContract:modelVersion": "3.8.1",
|
|
1797
1797
|
"doc:sourceSpec": "RAML 1.0"
|
|
1798
1798
|
},
|
|
1799
1799
|
{
|
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.8.
|
|
4
|
+
"version": "0.8.6",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"mocha": "^10.0.0",
|
|
60
60
|
"nock": "^13.2.7",
|
|
61
61
|
"oauth2-mock-server": "^5.0.0",
|
|
62
|
-
"sinon": "^
|
|
62
|
+
"sinon": "^15.0.1",
|
|
63
63
|
"source-map-support": "^0.5.21",
|
|
64
64
|
"ssl-root-cas": "^1.3.1",
|
|
65
65
|
"ts-node": "^10.4.0",
|
package/src/Platform.ts
CHANGED
|
@@ -6,6 +6,11 @@ export const hasFormData: boolean = typeof FormData === 'function';
|
|
|
6
6
|
* Whether the current platform has Blob interface
|
|
7
7
|
*/
|
|
8
8
|
export const hasBlob: boolean = typeof Blob === 'function';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether the current platform has File interface
|
|
12
|
+
*/
|
|
13
|
+
export const hasFile: boolean = typeof File === 'function';
|
|
9
14
|
/**
|
|
10
15
|
* Whether the current platform has the `Buffer` interface.
|
|
11
16
|
*/
|
package/src/events/BaseEvents.ts
CHANGED
|
@@ -298,8 +298,13 @@ export interface ContextListResult<T> {
|
|
|
298
298
|
/**
|
|
299
299
|
* Next page token to be used with pagination.
|
|
300
300
|
* It is not set when the query has not returned any results.
|
|
301
|
+
* @deprecated Use `cursor` instead.
|
|
301
302
|
*/
|
|
302
303
|
nextPageToken?: string;
|
|
304
|
+
/**
|
|
305
|
+
* The cursor to use with the next query. It has the list state encoded in it.
|
|
306
|
+
*/
|
|
307
|
+
cursor?: string;
|
|
303
308
|
/**
|
|
304
309
|
* The list of items in the response.
|
|
305
310
|
* May be empty array when there was no more results.
|
|
@@ -317,12 +322,40 @@ export interface ContextListOptions {
|
|
|
317
322
|
limit?: number;
|
|
318
323
|
/**
|
|
319
324
|
* A string that should be used with the pagination.
|
|
325
|
+
* @deprecated Use `cursor` instead.
|
|
320
326
|
*/
|
|
321
327
|
nextPageToken?: string;
|
|
322
328
|
/**
|
|
323
|
-
*
|
|
329
|
+
* Page cursor to use with the query. This is returned by the
|
|
330
|
+
*/
|
|
331
|
+
cursor?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Optional general purpose parent for the query.
|
|
324
334
|
*/
|
|
325
335
|
parent?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Supported by some endpoints. When set it performs a query on the data store.
|
|
338
|
+
*/
|
|
339
|
+
query?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Only with the `query` property. Tells the system in which fields to search for the query term.
|
|
342
|
+
*/
|
|
343
|
+
queryField?: string[];
|
|
344
|
+
/**
|
|
345
|
+
* Whether to use the `descending` order.
|
|
346
|
+
*/
|
|
347
|
+
descending?: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* General purpose type property to filer the results.
|
|
350
|
+
* This is used, for example, by the history store to list history for a specific type of requests,
|
|
351
|
+
*/
|
|
352
|
+
type?: string;
|
|
353
|
+
/**
|
|
354
|
+
* Used when synchronizing data in the local store with the data stored in the net-store.
|
|
355
|
+
* The timestamp when the last synchronization was performed. The resulting array will contain only items that
|
|
356
|
+
* have been updated since that date.
|
|
357
|
+
*/
|
|
358
|
+
since?: number;
|
|
326
359
|
}
|
|
327
360
|
|
|
328
361
|
export class ContextListEvent<T> extends ContextEvent<ContextListOptions, ContextListResult<T>> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasBlob, hasBuffer, hasFormData } from '../../Platform.js';
|
|
1
|
+
import { hasBlob, hasBuffer, hasFile, hasFormData } from '../../Platform.js';
|
|
2
2
|
|
|
3
3
|
export type PayloadTypes = 'string' | 'file' | 'blob' | 'buffer' | 'arraybuffer' | 'formdata' | 'x-www-form-urlencoded';
|
|
4
4
|
export type DeserializedPayload = string | Blob | File | FormData | Buffer | ArrayBuffer | undefined;
|
|
@@ -137,7 +137,7 @@ export class PayloadSerializer {
|
|
|
137
137
|
// return payload;
|
|
138
138
|
// }
|
|
139
139
|
|
|
140
|
-
if (
|
|
140
|
+
if (hasFile && payload instanceof File) {
|
|
141
141
|
return PayloadSerializer.stringifyFile(payload);
|
|
142
142
|
}
|
|
143
143
|
if (hasBlob && payload instanceof Blob) {
|
|
@@ -266,7 +266,7 @@ export class PayloadSerializer {
|
|
|
266
266
|
let value: ISafePayload;
|
|
267
267
|
// API Client adds the "blob" when adding a text value with a mime type.
|
|
268
268
|
// This is recognized by the UI to restore the entry as the text and not a file.
|
|
269
|
-
if (file instanceof File && file.name !== 'blob') {
|
|
269
|
+
if (hasFile && file instanceof File && file.name !== 'blob') {
|
|
270
270
|
value = await PayloadSerializer.stringifyFile(file);
|
|
271
271
|
} else {
|
|
272
272
|
value = await PayloadSerializer.stringifyBlob(file);
|
|
@@ -289,7 +289,7 @@ export class PayloadSerializer {
|
|
|
289
289
|
if (typeof payload === 'string') {
|
|
290
290
|
return payload;
|
|
291
291
|
}
|
|
292
|
-
if (hasBuffer && !hasBlob) {
|
|
292
|
+
if (hasBuffer && (!hasBlob || !hasFile)) {
|
|
293
293
|
// we are in the nodejs environment.
|
|
294
294
|
// We mostly gonna return a Buffer here.
|
|
295
295
|
switch (payload.type) {
|
|
@@ -298,6 +298,7 @@ export class PayloadSerializer {
|
|
|
298
298
|
case 'blob': return PayloadSerializer.deserializeBlobBuffer(payload);
|
|
299
299
|
case 'buffer': return PayloadSerializer.deserializeBuffer(payload.data as number[]);
|
|
300
300
|
case 'arraybuffer': return PayloadSerializer.deserializeArrayBufferBuffer(payload.data as number[]);
|
|
301
|
+
// generally speaking in this ecosystem we don't ever need to read FormData from a request/response in Node.
|
|
301
302
|
case 'formdata': return undefined;
|
|
302
303
|
default: return undefined;
|
|
303
304
|
}
|
|
@@ -80,7 +80,7 @@ export class CoreEngine extends HttpEngine {
|
|
|
80
80
|
const message = await this.prepareMessage();
|
|
81
81
|
await this.writeMessage(message);
|
|
82
82
|
} catch (cause) {
|
|
83
|
-
const e = cause as
|
|
83
|
+
const e = cause as SerializableError;
|
|
84
84
|
const err = new SerializableError(e.message, { cause: e });
|
|
85
85
|
if (e.code || e.code === 0) {
|
|
86
86
|
err.code = e.code as string;
|
|
@@ -259,6 +259,9 @@ export class CoreEngine extends HttpEngine {
|
|
|
259
259
|
options.checkServerIdentity = this._checkServerIdentity.bind(this);
|
|
260
260
|
} else {
|
|
261
261
|
options.rejectUnauthorized = false;
|
|
262
|
+
options.checkServerIdentity = (): Error | undefined => {
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
|
262
265
|
// target.requestOCSP = false;
|
|
263
266
|
}
|
|
264
267
|
const certs = this.opts.certificates;
|
|
@@ -412,7 +415,7 @@ export class CoreEngine extends HttpEngine {
|
|
|
412
415
|
headers.set('Authorization', `NTLM ${msg.toBase64()}`);
|
|
413
416
|
headers.set('Connection', 'keep-alive');
|
|
414
417
|
} else if (this.auth && this.auth.state === 1) {
|
|
415
|
-
const msg = auth.createMessage3(this.auth.challengeHeader
|
|
418
|
+
const msg = auth.createMessage3(this.auth.challengeHeader as string, this.uri.host);
|
|
416
419
|
this.auth.state = 2;
|
|
417
420
|
headers.set('Authorization', `NTLM ${msg.toBase64()}`);
|
|
418
421
|
}
|
|
@@ -651,8 +654,9 @@ export class CoreEngine extends HttpEngine {
|
|
|
651
654
|
if (msg && msg.indexOf('\n') !== -1) {
|
|
652
655
|
msg = msg.split('\n')[0];
|
|
653
656
|
}
|
|
654
|
-
this.currentResponse
|
|
655
|
-
|
|
657
|
+
const cr = this.currentResponse as Response;
|
|
658
|
+
cr.status = typedStatus;
|
|
659
|
+
cr.statusText = msg;
|
|
656
660
|
this.logger.info('Received status', typedStatus, msg);
|
|
657
661
|
this.state = RequestState.Headers;
|
|
658
662
|
return data;
|