@salable/sdk 1.0.42 → 1.0.44
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/dist/index.es.js +438 -233
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +438 -233
- package/dist/index.js.map +1 -1
- package/dist/sdk/api/events/index.d.ts +1 -0
- package/dist/sdk/api/webhooks/item/index.d.ts +10 -1
- package/dist/sdk/api/webhooks/item/ping/index.d.ts +32 -0
- package/dist/sdk/models/index.d.ts +20 -0
- package/dist/serialization.d.ts +18 -0
- package/package.json +7 -7
package/dist/index.es.js
CHANGED
|
@@ -407,21 +407,21 @@ const deserializeIntoUntypedNode = (untypedNode = {}) => {
|
|
|
407
407
|
* @param node The object to check.
|
|
408
408
|
* @returns boolean indicating if the node is an UntypedNumber.
|
|
409
409
|
*/
|
|
410
|
-
|
|
410
|
+
const isUntypedNumber = (node) => {
|
|
411
411
|
const proposedNode = node;
|
|
412
412
|
return proposedNode && typeof proposedNode.value === "number";
|
|
413
|
-
}
|
|
413
|
+
};
|
|
414
414
|
/**
|
|
415
415
|
* Factory to create an UntypedNumber from a number.
|
|
416
416
|
* @param value The number value to create from.
|
|
417
417
|
* @returns The created UntypedNumber.
|
|
418
418
|
*/
|
|
419
|
-
|
|
419
|
+
const createUntypedNumber = (value) => {
|
|
420
420
|
return {
|
|
421
421
|
value,
|
|
422
422
|
getValue: () => value,
|
|
423
423
|
};
|
|
424
|
-
}
|
|
424
|
+
};
|
|
425
425
|
|
|
426
426
|
/**
|
|
427
427
|
* -------------------------------------------------------------------------------------------
|
|
@@ -455,19 +455,19 @@ const createUntypedArray = (value) => {
|
|
|
455
455
|
* @param node The object to check.
|
|
456
456
|
* @returns boolean indicating if the node is an UntypedNull.
|
|
457
457
|
*/
|
|
458
|
-
|
|
458
|
+
const isUntypedNull = (node) => {
|
|
459
459
|
return node.value === null;
|
|
460
|
-
}
|
|
460
|
+
};
|
|
461
461
|
/**
|
|
462
|
-
* Factory to create an UntypedNull
|
|
462
|
+
* Factory to create an UntypedNull.
|
|
463
463
|
* @returns The created UntypedNull.
|
|
464
464
|
*/
|
|
465
|
-
|
|
465
|
+
const createUntypedNull = () => {
|
|
466
466
|
return {
|
|
467
467
|
value: null,
|
|
468
468
|
getValue: () => null,
|
|
469
469
|
};
|
|
470
|
-
}
|
|
470
|
+
};
|
|
471
471
|
|
|
472
472
|
/**
|
|
473
473
|
* -------------------------------------------------------------------------------------------
|
|
@@ -501,42 +501,42 @@ const createUntypedObject = (value) => {
|
|
|
501
501
|
* @param node The object to check.
|
|
502
502
|
* @returns boolean indicating if the node is an UntypedString.
|
|
503
503
|
*/
|
|
504
|
-
|
|
504
|
+
const isUntypedString = (node) => {
|
|
505
505
|
const proposedNode = node;
|
|
506
506
|
return proposedNode && typeof proposedNode.value === "string";
|
|
507
|
-
}
|
|
507
|
+
};
|
|
508
508
|
/**
|
|
509
509
|
* Factory to create an UntypedString from a string.
|
|
510
510
|
* @param value The string value to create from.
|
|
511
511
|
* @returns The created UntypedString.
|
|
512
512
|
*/
|
|
513
|
-
|
|
513
|
+
const createUntypedString = (value) => {
|
|
514
514
|
return {
|
|
515
515
|
value,
|
|
516
516
|
getValue: () => value,
|
|
517
517
|
};
|
|
518
|
-
}
|
|
518
|
+
};
|
|
519
519
|
|
|
520
520
|
/**
|
|
521
521
|
* Type guard to assert that an UntypedNode instance is an UntypedBoolean.
|
|
522
522
|
* @param node The UntypedNode to check.
|
|
523
523
|
* @returns boolean indicating if the node is an UntypedBoolean.
|
|
524
524
|
*/
|
|
525
|
-
|
|
525
|
+
const isUntypedBoolean = (node) => {
|
|
526
526
|
const proposedNode = node;
|
|
527
527
|
return proposedNode && typeof proposedNode.value === "boolean";
|
|
528
|
-
}
|
|
528
|
+
};
|
|
529
529
|
/**
|
|
530
530
|
* Factory to create an UntypedBoolean from a boolean.
|
|
531
531
|
* @param value The boolean value to create from.
|
|
532
532
|
* @returns The created UntypedBoolean.
|
|
533
533
|
*/
|
|
534
|
-
|
|
534
|
+
const createUntypedBoolean = (value) => {
|
|
535
535
|
return {
|
|
536
536
|
value,
|
|
537
537
|
getValue: () => value,
|
|
538
538
|
};
|
|
539
|
-
}
|
|
539
|
+
};
|
|
540
540
|
|
|
541
541
|
/**
|
|
542
542
|
* -------------------------------------------------------------------------------------------
|
|
@@ -790,10 +790,10 @@ const BackingStoreKey = "backingStoreEnabled";
|
|
|
790
790
|
* @param fields The fields of the object
|
|
791
791
|
* @returns boolean indicating if the object is a BackedModel
|
|
792
792
|
*/
|
|
793
|
-
|
|
793
|
+
const isBackingStoreEnabled = (fields) => {
|
|
794
794
|
// Check if the fields contain the backing store key
|
|
795
795
|
return Object.keys(fields).includes(BackingStoreKey);
|
|
796
|
-
}
|
|
796
|
+
};
|
|
797
797
|
|
|
798
798
|
/**
|
|
799
799
|
* -------------------------------------------------------------------------------------------
|
|
@@ -808,7 +808,7 @@ function isBackingStoreEnabled(fields) {
|
|
|
808
808
|
* @param original The serialization writer to enable the backing store on.
|
|
809
809
|
* @returns A new serialization writer with the backing store enabled.
|
|
810
810
|
*/
|
|
811
|
-
|
|
811
|
+
const enableBackingStoreForSerializationWriterFactory = (serializationWriterFactoryRegistry, parseNodeFactoryRegistry, original) => {
|
|
812
812
|
if (!original)
|
|
813
813
|
throw new Error("Original must be specified");
|
|
814
814
|
let result = original;
|
|
@@ -821,14 +821,14 @@ function enableBackingStoreForSerializationWriterFactory(serializationWriterFact
|
|
|
821
821
|
enableBackingStoreForSerializationRegistry(serializationWriterFactoryRegistry);
|
|
822
822
|
enableBackingStoreForParseNodeRegistry(parseNodeFactoryRegistry);
|
|
823
823
|
return result;
|
|
824
|
-
}
|
|
824
|
+
};
|
|
825
825
|
/**
|
|
826
826
|
* Enables the backing store on default parse node factories and the given parse node factory.
|
|
827
827
|
* @param parseNodeFactoryRegistry The parse node factory registry to enable the backing store on.
|
|
828
828
|
* @param original The parse node factory to enable the backing store on.
|
|
829
829
|
* @returns A new parse node factory with the backing store enabled.
|
|
830
830
|
*/
|
|
831
|
-
|
|
831
|
+
const enableBackingStoreForParseNodeFactory = (parseNodeFactoryRegistry, original) => {
|
|
832
832
|
if (!original)
|
|
833
833
|
throw new Error("Original must be specified");
|
|
834
834
|
let result = original;
|
|
@@ -840,29 +840,29 @@ function enableBackingStoreForParseNodeFactory(parseNodeFactoryRegistry, origina
|
|
|
840
840
|
}
|
|
841
841
|
enableBackingStoreForParseNodeRegistry(parseNodeFactoryRegistry);
|
|
842
842
|
return result;
|
|
843
|
-
}
|
|
843
|
+
};
|
|
844
844
|
/**
|
|
845
845
|
* Enables the backing store on the given parse node factory registry.
|
|
846
846
|
* @param registry The parse node factory registry to enable the backing store on.
|
|
847
847
|
*/
|
|
848
|
-
|
|
848
|
+
const enableBackingStoreForParseNodeRegistry = (registry) => {
|
|
849
849
|
for (const [k, v] of registry.contentTypeAssociatedFactories) {
|
|
850
850
|
if (!(v instanceof BackingStoreParseNodeFactory || v instanceof ParseNodeFactoryRegistry)) {
|
|
851
851
|
registry.contentTypeAssociatedFactories.set(k, new BackingStoreParseNodeFactory(v));
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
|
-
}
|
|
854
|
+
};
|
|
855
855
|
/**
|
|
856
856
|
* Enables the backing store on the given serialization factory registry.
|
|
857
857
|
* @param registry The serialization factory registry to enable the backing store on.
|
|
858
858
|
*/
|
|
859
|
-
|
|
859
|
+
const enableBackingStoreForSerializationRegistry = (registry) => {
|
|
860
860
|
for (const [k, v] of registry.contentTypeAssociatedFactories) {
|
|
861
861
|
if (!(v instanceof BackingStoreSerializationWriterProxyFactory || v instanceof SerializationWriterFactoryRegistry)) {
|
|
862
862
|
registry.contentTypeAssociatedFactories.set(k, new BackingStoreSerializationWriterProxyFactory(v));
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
-
}
|
|
865
|
+
};
|
|
866
866
|
|
|
867
867
|
/*
|
|
868
868
|
* Copyright The OpenTelemetry Authors
|
|
@@ -2635,9 +2635,9 @@ class DateOnly {
|
|
|
2635
2635
|
* @param digits The number of digits to pad
|
|
2636
2636
|
* @returns The formatted segment
|
|
2637
2637
|
*/
|
|
2638
|
-
|
|
2638
|
+
const formatSegment = (segment, digits = 2) => {
|
|
2639
2639
|
return segment.toString().padStart(digits, "0");
|
|
2640
|
-
}
|
|
2640
|
+
};
|
|
2641
2641
|
|
|
2642
2642
|
var dist = {};
|
|
2643
2643
|
|
|
@@ -2868,7 +2868,7 @@ class Duration {
|
|
|
2868
2868
|
* @param canon The function that canonicalizes the property name.
|
|
2869
2869
|
* @returns A new object that can be used as a dictionary with case-insensitive keys.
|
|
2870
2870
|
*/
|
|
2871
|
-
|
|
2871
|
+
const dictionaryWithCanonicalKeys = (canon) => {
|
|
2872
2872
|
const keysNormalizationMap = new Map();
|
|
2873
2873
|
return new Proxy({}, {
|
|
2874
2874
|
/**
|
|
@@ -2877,7 +2877,7 @@ function dictionaryWithCanonicalKeys(canon) {
|
|
|
2877
2877
|
* @param prop The property to get.
|
|
2878
2878
|
* @returns The value of the property.
|
|
2879
2879
|
*/
|
|
2880
|
-
get(target, prop) {
|
|
2880
|
+
get: (target, prop) => {
|
|
2881
2881
|
const normalKey = canon(prop);
|
|
2882
2882
|
return Reflect.get(target, normalKey);
|
|
2883
2883
|
},
|
|
@@ -2888,7 +2888,7 @@ function dictionaryWithCanonicalKeys(canon) {
|
|
|
2888
2888
|
* @param value The value to set.
|
|
2889
2889
|
* @returns A boolean indicating whether the property was set.
|
|
2890
2890
|
*/
|
|
2891
|
-
set(target, prop, value) {
|
|
2891
|
+
set: (target, prop, value) => {
|
|
2892
2892
|
const nonNormalKey = prop.toString();
|
|
2893
2893
|
const normalKey = canon(prop);
|
|
2894
2894
|
keysNormalizationMap.set(normalKey, nonNormalKey);
|
|
@@ -2900,7 +2900,7 @@ function dictionaryWithCanonicalKeys(canon) {
|
|
|
2900
2900
|
* @param prop The property to check.
|
|
2901
2901
|
* @returns A boolean indicating whether the property exists.
|
|
2902
2902
|
*/
|
|
2903
|
-
has(_, prop) {
|
|
2903
|
+
has: (_, prop) => {
|
|
2904
2904
|
const normalKey = canon(prop);
|
|
2905
2905
|
return keysNormalizationMap.has(normalKey);
|
|
2906
2906
|
},
|
|
@@ -2911,7 +2911,7 @@ function dictionaryWithCanonicalKeys(canon) {
|
|
|
2911
2911
|
* @param attribs The attributes of the property.
|
|
2912
2912
|
* @returns A boolean indicating whether the property was defined.
|
|
2913
2913
|
*/
|
|
2914
|
-
defineProperty(target, prop, attribs) {
|
|
2914
|
+
defineProperty: (target, prop, attribs) => {
|
|
2915
2915
|
const nonNormalKey = prop.toString();
|
|
2916
2916
|
const normalKey = canon(prop);
|
|
2917
2917
|
keysNormalizationMap.set(normalKey, nonNormalKey);
|
|
@@ -2923,7 +2923,7 @@ function dictionaryWithCanonicalKeys(canon) {
|
|
|
2923
2923
|
* @param prop The property to delete.
|
|
2924
2924
|
* @returns A boolean indicating whether the property was deleted.
|
|
2925
2925
|
*/
|
|
2926
|
-
deleteProperty(target, prop) {
|
|
2926
|
+
deleteProperty: (target, prop) => {
|
|
2927
2927
|
const normalKey = canon(prop);
|
|
2928
2928
|
keysNormalizationMap.delete(normalKey);
|
|
2929
2929
|
return Reflect.deleteProperty(target, normalKey);
|
|
@@ -2934,19 +2934,19 @@ function dictionaryWithCanonicalKeys(canon) {
|
|
|
2934
2934
|
* @param prop The property to gets its descriptor.
|
|
2935
2935
|
* @returns The property descriptor.
|
|
2936
2936
|
*/
|
|
2937
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
2937
|
+
getOwnPropertyDescriptor: (target, prop) => {
|
|
2938
2938
|
return Reflect.getOwnPropertyDescriptor(target, canon(prop));
|
|
2939
2939
|
},
|
|
2940
|
-
ownKeys() {
|
|
2940
|
+
ownKeys: () => {
|
|
2941
2941
|
return [...keysNormalizationMap.values()];
|
|
2942
2942
|
},
|
|
2943
2943
|
});
|
|
2944
|
-
}
|
|
2944
|
+
};
|
|
2945
2945
|
/**
|
|
2946
2946
|
* A wrapper for type Record that creates a Record with case insensitive keys
|
|
2947
2947
|
* @returns A new object that can be used as a dictionary with case-insensitive keys.
|
|
2948
2948
|
*/
|
|
2949
|
-
|
|
2949
|
+
const createRecordWithCaseInsensitiveKeys = () => {
|
|
2950
2950
|
/**
|
|
2951
2951
|
* A function that takes a property name and returns its canonical form.
|
|
2952
2952
|
* @param prop The property name to be canonicalized.
|
|
@@ -2954,7 +2954,7 @@ function createRecordWithCaseInsensitiveKeys() {
|
|
|
2954
2954
|
*/
|
|
2955
2955
|
const record = dictionaryWithCanonicalKeys((p) => (typeof p === "string" ? p.toLowerCase() : p.toString().toLowerCase()));
|
|
2956
2956
|
return record;
|
|
2957
|
-
}
|
|
2957
|
+
};
|
|
2958
2958
|
|
|
2959
2959
|
/**
|
|
2960
2960
|
* -------------------------------------------------------------------------------------------
|
|
@@ -3054,6 +3054,7 @@ class Headers extends Map {
|
|
|
3054
3054
|
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each header in the dictionary.
|
|
3055
3055
|
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
3056
3056
|
*/
|
|
3057
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3057
3058
|
forEach(callbackfn, thisArg) {
|
|
3058
3059
|
for (const header in this.headers) {
|
|
3059
3060
|
if (Object.prototype.hasOwnProperty.call(this.headers, header)) {
|
|
@@ -3335,10 +3336,10 @@ const serializeMultipartBody = (writer, multipartBody = new MultipartBody()) =>
|
|
|
3335
3336
|
writer.writeStringValue(undefined, part.content);
|
|
3336
3337
|
}
|
|
3337
3338
|
else if (part.content instanceof ArrayBuffer) {
|
|
3338
|
-
writer.writeByteArrayValue(undefined, new Uint8Array(part.content));
|
|
3339
|
+
writer.writeByteArrayValue(undefined, new Uint8Array(part.content).buffer);
|
|
3339
3340
|
}
|
|
3340
3341
|
else if (part.content instanceof Uint8Array) {
|
|
3341
|
-
writer.writeByteArrayValue(undefined, part.content);
|
|
3342
|
+
writer.writeByteArrayValue(undefined, part.content.buffer);
|
|
3342
3343
|
}
|
|
3343
3344
|
else if (part.serializationCallback) {
|
|
3344
3345
|
if (!multipartBody.requestAdapter) {
|
|
@@ -3354,7 +3355,7 @@ const serializeMultipartBody = (writer, multipartBody = new MultipartBody()) =>
|
|
|
3354
3355
|
}
|
|
3355
3356
|
partSerializationWriter.writeObjectValue(undefined, part.content, part.serializationCallback);
|
|
3356
3357
|
const partContent = partSerializationWriter.getSerializedContent();
|
|
3357
|
-
writer.writeByteArrayValue(undefined, new Uint8Array(partContent));
|
|
3358
|
+
writer.writeByteArrayValue(undefined, new Uint8Array(partContent).buffer);
|
|
3358
3359
|
}
|
|
3359
3360
|
else {
|
|
3360
3361
|
throw new Error("unsupported content type for multipart body: " + typeof part.content);
|
|
@@ -4018,6 +4019,10 @@ const apiClientProxifier = (requestAdapter, pathParameters, navigationMetadata,
|
|
|
4018
4019
|
return apiClientProxifier(requestAdapter, downWardPathParameters, navigationCandidate.navigationMetadata, navigationCandidate.requestsMetadata);
|
|
4019
4020
|
};
|
|
4020
4021
|
}
|
|
4022
|
+
if (name === "then") {
|
|
4023
|
+
// handle returning proxy from an async method
|
|
4024
|
+
return undefined;
|
|
4025
|
+
}
|
|
4021
4026
|
throw new Error(`couldn't find navigation property ${name} data: ${JSON.stringify(navigationMetadata)}`);
|
|
4022
4027
|
}
|
|
4023
4028
|
},
|
|
@@ -4055,7 +4060,7 @@ class AllowedHostsValidator {
|
|
|
4055
4060
|
*/
|
|
4056
4061
|
constructor(allowedHosts = new Set()) {
|
|
4057
4062
|
this.validateHosts(allowedHosts);
|
|
4058
|
-
this.allowedHosts = allowedHosts
|
|
4063
|
+
this.allowedHosts = this.normalizeHosts(allowedHosts);
|
|
4059
4064
|
}
|
|
4060
4065
|
/**
|
|
4061
4066
|
* Gets the list of valid hosts. If the list is empty, all hosts are valid.
|
|
@@ -4070,7 +4075,7 @@ class AllowedHostsValidator {
|
|
|
4070
4075
|
*/
|
|
4071
4076
|
setAllowedHosts(allowedHosts) {
|
|
4072
4077
|
this.validateHosts(allowedHosts);
|
|
4073
|
-
this.allowedHosts = allowedHosts;
|
|
4078
|
+
this.allowedHosts = this.normalizeHosts(allowedHosts);
|
|
4074
4079
|
}
|
|
4075
4080
|
/**
|
|
4076
4081
|
* Checks whether the provided host is valid.
|
|
@@ -4078,7 +4083,7 @@ class AllowedHostsValidator {
|
|
|
4078
4083
|
* @returns True if the host is valid, false otherwise.
|
|
4079
4084
|
*/
|
|
4080
4085
|
isUrlHostValid(url) {
|
|
4081
|
-
var _a
|
|
4086
|
+
var _a;
|
|
4082
4087
|
if (!url)
|
|
4083
4088
|
return false;
|
|
4084
4089
|
if (this.allowedHosts.size === 0)
|
|
@@ -4095,7 +4100,7 @@ class AllowedHostsValidator {
|
|
|
4095
4100
|
return this.isHostAndPathValid(url);
|
|
4096
4101
|
}
|
|
4097
4102
|
if ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) {
|
|
4098
|
-
return this.
|
|
4103
|
+
return this.isHostValid(window.location.host);
|
|
4099
4104
|
}
|
|
4100
4105
|
return false;
|
|
4101
4106
|
}
|
|
@@ -4104,11 +4109,21 @@ class AllowedHostsValidator {
|
|
|
4104
4109
|
if (hostAndRest.length >= 2) {
|
|
4105
4110
|
const host = hostAndRest[0];
|
|
4106
4111
|
if (host) {
|
|
4107
|
-
return this.
|
|
4112
|
+
return this.isHostValid(host.split(":")[0]);
|
|
4108
4113
|
}
|
|
4109
4114
|
}
|
|
4110
4115
|
return false;
|
|
4111
4116
|
}
|
|
4117
|
+
isHostValid(host) {
|
|
4118
|
+
const normalizedHost = host.toLowerCase();
|
|
4119
|
+
if (this.allowedHosts.has(normalizedHost)) {
|
|
4120
|
+
return true;
|
|
4121
|
+
}
|
|
4122
|
+
return Array.from(this.allowedHosts).some((allowedHost) => allowedHost.startsWith(".") && normalizedHost.endsWith(allowedHost));
|
|
4123
|
+
}
|
|
4124
|
+
normalizeHosts(hostsToNormalize) {
|
|
4125
|
+
return new Set(Array.from(hostsToNormalize, (host) => host.toLowerCase()));
|
|
4126
|
+
}
|
|
4112
4127
|
validateHosts(hostsToValidate) {
|
|
4113
4128
|
if (!hostsToValidate) {
|
|
4114
4129
|
throw new Error("hostsToValidate cannot be null");
|
|
@@ -4132,27 +4147,27 @@ const localhostStrings = new Set(["localhost", "[::1]", "::1", "127.0.0.1"]);
|
|
|
4132
4147
|
* Validates the protocol of the url.
|
|
4133
4148
|
* @param url - The url to validate.
|
|
4134
4149
|
*/
|
|
4135
|
-
|
|
4150
|
+
const validateProtocol = (url) => {
|
|
4136
4151
|
if (!isLocalhostUrl(url) && !url.toLocaleLowerCase().startsWith("https://") && !windowUrlStartsWithHttps()) {
|
|
4137
4152
|
throw new Error("Authentication scheme can only be used with https requests");
|
|
4138
4153
|
}
|
|
4139
|
-
}
|
|
4154
|
+
};
|
|
4140
4155
|
/**
|
|
4141
4156
|
* Checks if the window url starts with https.
|
|
4142
4157
|
* @returns True if the window url starts with https, false otherwise.
|
|
4143
4158
|
*/
|
|
4144
|
-
|
|
4159
|
+
const windowUrlStartsWithHttps = () => {
|
|
4145
4160
|
if (!inNodeEnv()) {
|
|
4146
4161
|
return window.location.protocol.toLocaleLowerCase() === "https:";
|
|
4147
4162
|
}
|
|
4148
4163
|
return false;
|
|
4149
|
-
}
|
|
4164
|
+
};
|
|
4150
4165
|
/**
|
|
4151
4166
|
* Checks if the url is a localhost url.
|
|
4152
4167
|
* @param urlString - The url to check.
|
|
4153
4168
|
* @returns True if the url is a localhost url, false otherwise.
|
|
4154
4169
|
*/
|
|
4155
|
-
|
|
4170
|
+
const isLocalhostUrl = (urlString) => {
|
|
4156
4171
|
try {
|
|
4157
4172
|
const url = new URL(urlString);
|
|
4158
4173
|
return localhostStrings.has(url.hostname);
|
|
@@ -4160,7 +4175,7 @@ function isLocalhostUrl(urlString) {
|
|
|
4160
4175
|
catch (_a) {
|
|
4161
4176
|
return false;
|
|
4162
4177
|
}
|
|
4163
|
-
}
|
|
4178
|
+
};
|
|
4164
4179
|
|
|
4165
4180
|
/** Authenticate a request by using an API Key */
|
|
4166
4181
|
class ApiKeyAuthenticationProvider {
|
|
@@ -4285,14 +4300,9 @@ class HttpClient {
|
|
|
4285
4300
|
middlewares = (middlewares === null || middlewares === void 0 ? void 0 : middlewares.length) && middlewares[0] ? middlewares : MiddlewareFactory.getDefaultMiddlewares(customFetch);
|
|
4286
4301
|
// If a custom fetch function is provided, add a CustomFetchHandler to the end of the middleware chain
|
|
4287
4302
|
if (this.customFetch) {
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
// eslint-disable-next-line no-console
|
|
4292
|
-
console.debug("Registered middlewares: " + middlewares.map((m) => m.constructor.name).join(", "));
|
|
4293
|
-
// eslint-disable-next-line no-console
|
|
4294
|
-
console.debug("Hint: To improve performance, use MiddlewareFactory.getPerformanceMiddlewares(customFetch) instead of MiddlewareFactory.getDefaultMiddlewares(customFetch)");
|
|
4295
|
-
// Set the middleware chain
|
|
4303
|
+
middlewares.push(new CustomFetchHandler(this.customFetch));
|
|
4304
|
+
}
|
|
4305
|
+
// Set the middleware handlers chain
|
|
4296
4306
|
this.setMiddleware(...middlewares);
|
|
4297
4307
|
}
|
|
4298
4308
|
/**
|
|
@@ -4347,7 +4357,7 @@ class ObservabilityOptionsImpl {
|
|
|
4347
4357
|
* @param requestOptions The request options
|
|
4348
4358
|
* @returns The observability options
|
|
4349
4359
|
*/
|
|
4350
|
-
|
|
4360
|
+
const getObservabilityOptionsFromRequest = (requestOptions) => {
|
|
4351
4361
|
if (requestOptions) {
|
|
4352
4362
|
const observabilityOptions = requestOptions[ObservabilityOptionKey];
|
|
4353
4363
|
if (observabilityOptions instanceof ObservabilityOptionsImpl) {
|
|
@@ -4355,7 +4365,7 @@ function getObservabilityOptionsFromRequest(requestOptions) {
|
|
|
4355
4365
|
}
|
|
4356
4366
|
}
|
|
4357
4367
|
return undefined;
|
|
4358
|
-
}
|
|
4368
|
+
};
|
|
4359
4369
|
|
|
4360
4370
|
/**
|
|
4361
4371
|
* -------------------------------------------------------------------------------------------
|
|
@@ -4430,31 +4440,34 @@ class FetchRequestAdapter {
|
|
|
4430
4440
|
case "number":
|
|
4431
4441
|
case "boolean":
|
|
4432
4442
|
case "Date":
|
|
4443
|
+
case "Duration":
|
|
4444
|
+
case "DateOnly":
|
|
4445
|
+
case "TimeOnly":
|
|
4433
4446
|
// eslint-disable-next-line no-case-declarations
|
|
4434
4447
|
const rootNode = await this.getRootParseNode(response);
|
|
4435
4448
|
return trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan(`getCollectionOf${responseType}Value`, (deserializeSpan) => {
|
|
4436
4449
|
try {
|
|
4437
4450
|
span.setAttribute(FetchRequestAdapter.responseTypeAttributeKey, responseType);
|
|
4438
4451
|
if (responseType === "string") {
|
|
4439
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4452
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4440
4453
|
}
|
|
4441
4454
|
else if (responseType === "number") {
|
|
4442
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4455
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4443
4456
|
}
|
|
4444
4457
|
else if (responseType === "boolean") {
|
|
4445
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4458
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4446
4459
|
}
|
|
4447
4460
|
else if (responseType === "Date") {
|
|
4448
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4461
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4449
4462
|
}
|
|
4450
4463
|
else if (responseType === "Duration") {
|
|
4451
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4464
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4452
4465
|
}
|
|
4453
4466
|
else if (responseType === "DateOnly") {
|
|
4454
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4467
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4455
4468
|
}
|
|
4456
4469
|
else if (responseType === "TimeOnly") {
|
|
4457
|
-
return rootNode.getCollectionOfPrimitiveValues();
|
|
4470
|
+
return rootNode.getCollectionOfPrimitiveValues(responseType);
|
|
4458
4471
|
}
|
|
4459
4472
|
else {
|
|
4460
4473
|
throw new Error("unexpected type to deserialize");
|
|
@@ -4985,7 +4998,7 @@ FetchRequestAdapter.authenticateChallengedEventKey = "com.microsoft.kiota.authen
|
|
|
4985
4998
|
* @returns A header value for the given key from the request
|
|
4986
4999
|
*/
|
|
4987
5000
|
const getRequestHeader = (options, key) => {
|
|
4988
|
-
if (options
|
|
5001
|
+
if (options === null || options === void 0 ? void 0 : options.headers) {
|
|
4989
5002
|
return options.headers[key];
|
|
4990
5003
|
}
|
|
4991
5004
|
return undefined;
|
|
@@ -5206,7 +5219,7 @@ class CompressionHandler {
|
|
|
5206
5219
|
}
|
|
5207
5220
|
const uint8ArrayToStream = (uint8Array) => {
|
|
5208
5221
|
return new ReadableStream({
|
|
5209
|
-
start(controller) {
|
|
5222
|
+
start: (controller) => {
|
|
5210
5223
|
controller.enqueue(uint8Array);
|
|
5211
5224
|
controller.close();
|
|
5212
5225
|
},
|
|
@@ -5463,6 +5476,47 @@ class ParametersNameDecodingHandler {
|
|
|
5463
5476
|
* -------------------------------------------------------------------------------------------
|
|
5464
5477
|
*/
|
|
5465
5478
|
const RedirectHandlerOptionKey = "RedirectHandlerOption";
|
|
5479
|
+
/**
|
|
5480
|
+
* The default implementation for scrubbing sensitive headers during redirects.
|
|
5481
|
+
* This function removes Authorization, Cookie, and Proxy-Authorization headers when the host or scheme changes.
|
|
5482
|
+
*
|
|
5483
|
+
* It is exported so that consumers providing a custom {@link ScrubSensitiveHeaders} callback can call it to
|
|
5484
|
+
* retain the default behavior and then layer additional logic on top (e.g. removing custom headers such as
|
|
5485
|
+
* `X-Api-Key`), matching the composable pattern available in the .NET and Python Kiota SDKs.
|
|
5486
|
+
*
|
|
5487
|
+
* Note: In browser environments, `Proxy-Authorization` is a forbidden header name and typically cannot be set;
|
|
5488
|
+
* it is still removed here if present (e.g. in Node.js or other non-browser runtimes).
|
|
5489
|
+
* @param headers - The headers object to modify
|
|
5490
|
+
* @param originalUrl - The original request URL
|
|
5491
|
+
* @param newUrl - The new redirect URL
|
|
5492
|
+
*/
|
|
5493
|
+
const defaultScrubSensitiveHeaders = (headers, originalUrl, newUrl) => {
|
|
5494
|
+
if (!headers || !originalUrl || !newUrl) {
|
|
5495
|
+
return;
|
|
5496
|
+
}
|
|
5497
|
+
try {
|
|
5498
|
+
const originalUri = new URL(originalUrl);
|
|
5499
|
+
const newUri = new URL(newUrl);
|
|
5500
|
+
// Remove Authorization, Cookie, and Proxy-Authorization headers if the request's scheme or host changes.
|
|
5501
|
+
// Header keys must be matched case-insensitively because FetchRequestAdapter.getRequestFromRequestInformation
|
|
5502
|
+
// lower-cases every header key before the headers object reaches this middleware, so PascalCase
|
|
5503
|
+
// property deletes such as `delete headers.Authorization` would otherwise be a no-op.
|
|
5504
|
+
const isDifferentHostOrScheme = originalUri.host.toLowerCase() !== newUri.host.toLowerCase() || originalUri.protocol.toLowerCase() !== newUri.protocol.toLowerCase();
|
|
5505
|
+
if (isDifferentHostOrScheme) {
|
|
5506
|
+
for (const key of Object.keys(headers)) {
|
|
5507
|
+
const lower = key.toLowerCase();
|
|
5508
|
+
if (lower === "authorization" || lower === "cookie" || lower === "proxy-authorization") {
|
|
5509
|
+
delete headers[key];
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
catch (_a) {
|
|
5515
|
+
// If URL parsing fails, don't modify headers
|
|
5516
|
+
// This handles cases where invalid URLs are passed
|
|
5517
|
+
return;
|
|
5518
|
+
}
|
|
5519
|
+
};
|
|
5466
5520
|
/**
|
|
5467
5521
|
* MiddlewareOptions
|
|
5468
5522
|
* A class representing RedirectHandlerOptions
|
|
@@ -5477,7 +5531,7 @@ class RedirectHandlerOptions {
|
|
|
5477
5531
|
* @example const options = new RedirectHandlerOptions({ maxRedirects: 5 });
|
|
5478
5532
|
*/
|
|
5479
5533
|
constructor(options = {}) {
|
|
5480
|
-
var _a, _b;
|
|
5534
|
+
var _a, _b, _c;
|
|
5481
5535
|
if (options.maxRedirects && options.maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) {
|
|
5482
5536
|
const error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`);
|
|
5483
5537
|
error.name = "MaxLimitExceeded";
|
|
@@ -5490,6 +5544,7 @@ class RedirectHandlerOptions {
|
|
|
5490
5544
|
}
|
|
5491
5545
|
this.maxRedirects = (_a = options.maxRedirects) !== null && _a !== void 0 ? _a : RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS;
|
|
5492
5546
|
this.shouldRedirect = (_b = options.shouldRedirect) !== null && _b !== void 0 ? _b : RedirectHandlerOptions.defaultShouldRetry;
|
|
5547
|
+
this.scrubSensitiveHeaders = (_c = options.scrubSensitiveHeaders) !== null && _c !== void 0 ? _c : RedirectHandlerOptions.defaultScrubSensitiveHeaders;
|
|
5493
5548
|
}
|
|
5494
5549
|
getKey() {
|
|
5495
5550
|
return RedirectHandlerOptionKey;
|
|
@@ -5509,6 +5564,11 @@ RedirectHandlerOptions.MAX_MAX_REDIRECTS = 20;
|
|
|
5509
5564
|
* @returns true
|
|
5510
5565
|
*/
|
|
5511
5566
|
RedirectHandlerOptions.defaultShouldRetry = () => true;
|
|
5567
|
+
/**
|
|
5568
|
+
* The default {@link ScrubSensitiveHeaders} callback used when none is supplied.
|
|
5569
|
+
* Delegates to the exported {@link defaultScrubSensitiveHeaders} function.
|
|
5570
|
+
*/
|
|
5571
|
+
RedirectHandlerOptions.defaultScrubSensitiveHeaders = defaultScrubSensitiveHeaders;
|
|
5512
5572
|
|
|
5513
5573
|
/**
|
|
5514
5574
|
* -------------------------------------------------------------------------------------------
|
|
@@ -5575,27 +5635,6 @@ class RedirectHandler {
|
|
|
5575
5635
|
isRelativeURL(url) {
|
|
5576
5636
|
return !url.includes("://");
|
|
5577
5637
|
}
|
|
5578
|
-
/**
|
|
5579
|
-
*
|
|
5580
|
-
* To check whether the authorization header in the request should be dropped for consequent redirected requests
|
|
5581
|
-
* @param requestUrl - The request url value
|
|
5582
|
-
* @param redirectUrl - The redirect url value
|
|
5583
|
-
* @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests
|
|
5584
|
-
*/
|
|
5585
|
-
shouldDropAuthorizationHeader(requestUrl, redirectUrl) {
|
|
5586
|
-
const schemeHostRegex = /^[A-Za-z].+?:\/\/.+?(?=\/|$)/;
|
|
5587
|
-
const requestMatches = schemeHostRegex.exec(requestUrl);
|
|
5588
|
-
let requestAuthority;
|
|
5589
|
-
let redirectAuthority;
|
|
5590
|
-
if (requestMatches !== null) {
|
|
5591
|
-
requestAuthority = requestMatches[0];
|
|
5592
|
-
}
|
|
5593
|
-
const redirectMatches = schemeHostRegex.exec(redirectUrl);
|
|
5594
|
-
if (redirectMatches !== null) {
|
|
5595
|
-
redirectAuthority = redirectMatches[0];
|
|
5596
|
-
}
|
|
5597
|
-
return typeof requestAuthority !== "undefined" && typeof redirectAuthority !== "undefined" && requestAuthority !== redirectAuthority;
|
|
5598
|
-
}
|
|
5599
5638
|
/**
|
|
5600
5639
|
* To execute the next middleware and to handle in case of redirect response returned by the server
|
|
5601
5640
|
* @param url - The url string value
|
|
@@ -5614,19 +5653,22 @@ class RedirectHandler {
|
|
|
5614
5653
|
}
|
|
5615
5654
|
if (redirectCount < currentOptions.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && currentOptions.shouldRedirect(response)) {
|
|
5616
5655
|
++redirectCount;
|
|
5656
|
+
const redirectUrl = this.getLocationHeader(response);
|
|
5657
|
+
if (!redirectUrl) {
|
|
5658
|
+
return response;
|
|
5659
|
+
}
|
|
5660
|
+
// Resolve relative URLs
|
|
5661
|
+
const newUrl = this.isRelativeURL(redirectUrl) ? new URL(redirectUrl, url).toString() : redirectUrl;
|
|
5662
|
+
// Scrub sensitive headers before following the redirect
|
|
5663
|
+
if (fetchRequestInit.headers) {
|
|
5664
|
+
currentOptions.scrubSensitiveHeaders(fetchRequestInit.headers, url, newUrl);
|
|
5665
|
+
}
|
|
5666
|
+
// Handle 303 See Other: change POST to GET
|
|
5617
5667
|
if (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) {
|
|
5618
5668
|
fetchRequestInit.method = HttpMethod.GET;
|
|
5619
5669
|
delete fetchRequestInit.body;
|
|
5620
5670
|
}
|
|
5621
|
-
|
|
5622
|
-
const redirectUrl = this.getLocationHeader(response);
|
|
5623
|
-
if (redirectUrl) {
|
|
5624
|
-
if (fetchRequestInit.headers && !this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(url, redirectUrl)) {
|
|
5625
|
-
delete fetchRequestInit.headers[RedirectHandler.AUTHORIZATION_HEADER];
|
|
5626
|
-
}
|
|
5627
|
-
url = redirectUrl;
|
|
5628
|
-
}
|
|
5629
|
-
}
|
|
5671
|
+
url = newUrl;
|
|
5630
5672
|
if (tracerName) {
|
|
5631
5673
|
return trace.getTracer(tracerName).startActiveSpan(`redirectHandler - redirect ${redirectCount}`, (span) => {
|
|
5632
5674
|
try {
|
|
@@ -5692,10 +5734,6 @@ RedirectHandler.STATUS_CODE_SEE_OTHER = 303;
|
|
|
5692
5734
|
* A member holding the name of the location header
|
|
5693
5735
|
*/
|
|
5694
5736
|
RedirectHandler.LOCATION_HEADER = "Location";
|
|
5695
|
-
/**
|
|
5696
|
-
* A member representing the authorization header name
|
|
5697
|
-
*/
|
|
5698
|
-
RedirectHandler.AUTHORIZATION_HEADER = "Authorization";
|
|
5699
5737
|
/**
|
|
5700
5738
|
* A member holding the manual redirect value
|
|
5701
5739
|
*/
|
|
@@ -6192,7 +6230,6 @@ class MiddlewareFactory {
|
|
|
6192
6230
|
* Returns the default middleware chain an array with the middleware handlers
|
|
6193
6231
|
* @returns an array of the middleware handlers of the default middleware chain
|
|
6194
6232
|
*/
|
|
6195
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
6196
6233
|
static getDefaultMiddlewares(customFetch = (...args) => fetch(...args)) {
|
|
6197
6234
|
return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new HeadersInspectionHandler(), new UrlReplaceHandler(), new CustomFetchHandler(customFetch)];
|
|
6198
6235
|
}
|
|
@@ -6201,7 +6238,6 @@ class MiddlewareFactory {
|
|
|
6201
6238
|
* Returns the default middleware chain + performance middleware
|
|
6202
6239
|
* @returns an array of the middleware handlers of the default + performance middleware chain
|
|
6203
6240
|
*/
|
|
6204
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
6205
6241
|
static getPerformanceMiddlewares(customFetch = (...args) => fetch(...args)) {
|
|
6206
6242
|
const middlewares = MiddlewareFactory.getDefaultMiddlewares(customFetch);
|
|
6207
6243
|
middlewares.splice(middlewares.length - 3, 0, new CompressionHandler()); // insert CompressionHandler before HeadersInspectionHandler
|
|
@@ -9656,6 +9692,7 @@ function deserializeIntoCreateWebhookRequestResponseSchema_data(createWebhookReq
|
|
|
9656
9692
|
return {
|
|
9657
9693
|
"createdAt": n => { createWebhookRequestResponseSchema_data.createdAt = n.getStringValue(); },
|
|
9658
9694
|
"description": n => { createWebhookRequestResponseSchema_data.description = n.getStringValue(); },
|
|
9695
|
+
"disabledAt": n => { createWebhookRequestResponseSchema_data.disabledAt = n.getStringValue(); },
|
|
9659
9696
|
"id": n => { createWebhookRequestResponseSchema_data.id = n.getStringValue(); },
|
|
9660
9697
|
"name": n => { createWebhookRequestResponseSchema_data.name = n.getStringValue(); },
|
|
9661
9698
|
"organisation": n => { createWebhookRequestResponseSchema_data.organisation = n.getStringValue(); },
|
|
@@ -10648,6 +10685,7 @@ function deserializeIntoGetEventDetailSchema_data_destinations_data_webhook(getE
|
|
|
10648
10685
|
return {
|
|
10649
10686
|
"createdAt": n => { getEventDetailSchema_data_destinations_data_webhook.createdAt = n.getStringValue(); },
|
|
10650
10687
|
"description": n => { getEventDetailSchema_data_destinations_data_webhook.description = n.getStringValue(); },
|
|
10688
|
+
"disabledAt": n => { getEventDetailSchema_data_destinations_data_webhook.disabledAt = n.getStringValue(); },
|
|
10651
10689
|
"id": n => { getEventDetailSchema_data_destinations_data_webhook.id = n.getStringValue(); },
|
|
10652
10690
|
"name": n => { getEventDetailSchema_data_destinations_data_webhook.name = n.getStringValue(); },
|
|
10653
10691
|
"organisation": n => { getEventDetailSchema_data_destinations_data_webhook.organisation = n.getStringValue(); },
|
|
@@ -12316,7 +12354,7 @@ function deserializeIntoGetPlanListSchema_data_tierTag(getPlanListSchema_data_ti
|
|
|
12316
12354
|
// @ts-ignore
|
|
12317
12355
|
function deserializeIntoGetPlanListSchema_filterOptions(getPlanListSchema_filterOptions = {}) {
|
|
12318
12356
|
return {
|
|
12319
|
-
"currencies": n => { getPlanListSchema_filterOptions.currencies = n.getCollectionOfPrimitiveValues(); },
|
|
12357
|
+
"currencies": n => { getPlanListSchema_filterOptions.currencies = n.getCollectionOfPrimitiveValues("string"); },
|
|
12320
12358
|
"intervals": n => { getPlanListSchema_filterOptions.intervals = n.getCollectionOfObjectValues(createGetPlanListSchema_filterOptions_intervalsFromDiscriminatorValue); },
|
|
12321
12359
|
};
|
|
12322
12360
|
}
|
|
@@ -13165,7 +13203,7 @@ function deserializeIntoGetSubscriptionInvoicesSchema_data_lines_data_parent_sub
|
|
|
13165
13203
|
function deserializeIntoGetSubscriptionInvoicesSchema_data_lines_data_parent_subscription_item_details_proration_details_credited_items(getSubscriptionInvoicesSchema_data_lines_data_parent_subscription_item_details_proration_details_credited_items = {}) {
|
|
13166
13204
|
return {
|
|
13167
13205
|
"invoice": n => { getSubscriptionInvoicesSchema_data_lines_data_parent_subscription_item_details_proration_details_credited_items.invoice = n.getStringValue(); },
|
|
13168
|
-
"invoice_line_items": n => { getSubscriptionInvoicesSchema_data_lines_data_parent_subscription_item_details_proration_details_credited_items.invoiceLineItems = n.getCollectionOfPrimitiveValues(); },
|
|
13206
|
+
"invoice_line_items": n => { getSubscriptionInvoicesSchema_data_lines_data_parent_subscription_item_details_proration_details_credited_items.invoiceLineItems = n.getCollectionOfPrimitiveValues("string"); },
|
|
13169
13207
|
};
|
|
13170
13208
|
}
|
|
13171
13209
|
/**
|
|
@@ -13318,7 +13356,7 @@ function deserializeIntoGetSubscriptionInvoicesSchema_data_lines_data_proration_
|
|
|
13318
13356
|
function deserializeIntoGetSubscriptionInvoicesSchema_data_lines_data_proration_details_credited_items(getSubscriptionInvoicesSchema_data_lines_data_proration_details_credited_items = {}) {
|
|
13319
13357
|
return {
|
|
13320
13358
|
"invoice": n => { getSubscriptionInvoicesSchema_data_lines_data_proration_details_credited_items.invoice = n.getStringValue(); },
|
|
13321
|
-
"invoice_line_items": n => { getSubscriptionInvoicesSchema_data_lines_data_proration_details_credited_items.invoiceLineItems = n.getCollectionOfPrimitiveValues(); },
|
|
13359
|
+
"invoice_line_items": n => { getSubscriptionInvoicesSchema_data_lines_data_proration_details_credited_items.invoiceLineItems = n.getCollectionOfPrimitiveValues("string"); },
|
|
13322
13360
|
};
|
|
13323
13361
|
}
|
|
13324
13362
|
/**
|
|
@@ -14062,6 +14100,7 @@ function deserializeIntoGetWebhookDetailSchema_data(getWebhookDetailSchema_data
|
|
|
14062
14100
|
"createdAt": n => { getWebhookDetailSchema_data.createdAt = n.getStringValue(); },
|
|
14063
14101
|
"description": n => { getWebhookDetailSchema_data.description = n.getStringValue(); },
|
|
14064
14102
|
"destinations": n => { getWebhookDetailSchema_data.destinations = n.getObjectValue(createGetWebhookDetailSchema_data_destinationsFromDiscriminatorValue); },
|
|
14103
|
+
"disabledAt": n => { getWebhookDetailSchema_data.disabledAt = n.getStringValue(); },
|
|
14065
14104
|
"eventTypes": n => { getWebhookDetailSchema_data.eventTypes = n.getObjectValue(createGetWebhookDetailSchema_data_eventTypesFromDiscriminatorValue); },
|
|
14066
14105
|
"id": n => { getWebhookDetailSchema_data.id = n.getStringValue(); },
|
|
14067
14106
|
"name": n => { getWebhookDetailSchema_data.name = n.getStringValue(); },
|
|
@@ -14174,6 +14213,7 @@ function deserializeIntoGetWebhookListSchema_data(getWebhookListSchema_data = {}
|
|
|
14174
14213
|
return {
|
|
14175
14214
|
"createdAt": n => { getWebhookListSchema_data.createdAt = n.getStringValue(); },
|
|
14176
14215
|
"description": n => { getWebhookListSchema_data.description = n.getStringValue(); },
|
|
14216
|
+
"disabledAt": n => { getWebhookListSchema_data.disabledAt = n.getStringValue(); },
|
|
14177
14217
|
"eventTypes": n => { getWebhookListSchema_data.eventTypes = n.getObjectValue(createGetWebhookListSchema_data_eventTypesFromDiscriminatorValue); },
|
|
14178
14218
|
"id": n => { getWebhookListSchema_data.id = n.getStringValue(); },
|
|
14179
14219
|
"name": n => { getWebhookListSchema_data.name = n.getStringValue(); },
|
|
@@ -15446,6 +15486,7 @@ function serializeUpdateWebhookRequestSchema(writer, updateWebhookRequestSchema
|
|
|
15446
15486
|
return;
|
|
15447
15487
|
}
|
|
15448
15488
|
writer.writeStringValue("description", updateWebhookRequestSchema.description);
|
|
15489
|
+
writer.writeBooleanValue("disabled", updateWebhookRequestSchema.disabled);
|
|
15449
15490
|
if (updateWebhookRequestSchema.events)
|
|
15450
15491
|
writer.writeCollectionOfEnumValues("events", updateWebhookRequestSchema.events);
|
|
15451
15492
|
writer.writeStringValue("name", updateWebhookRequestSchema.name);
|
|
@@ -19739,6 +19780,36 @@ const UsageRecordsRequestBuilderRequestsMetadata = {
|
|
|
19739
19780
|
/* tslint:enable */
|
|
19740
19781
|
/* eslint-enable */
|
|
19741
19782
|
|
|
19783
|
+
/* tslint:disable */
|
|
19784
|
+
/* eslint-disable */
|
|
19785
|
+
// Generated by Microsoft Kiota
|
|
19786
|
+
// @ts-ignore
|
|
19787
|
+
/**
|
|
19788
|
+
* Uri template for the request builder.
|
|
19789
|
+
*/
|
|
19790
|
+
const PingRequestBuilderUriTemplate = "{+baseurl}/api/webhooks/{id}/ping";
|
|
19791
|
+
/**
|
|
19792
|
+
* Metadata for all the requests in the request builder.
|
|
19793
|
+
*/
|
|
19794
|
+
const PingRequestBuilderRequestsMetadata = {
|
|
19795
|
+
post: {
|
|
19796
|
+
uriTemplate: PingRequestBuilderUriTemplate,
|
|
19797
|
+
responseBodyContentType: "application/json",
|
|
19798
|
+
errorMappings: {
|
|
19799
|
+
400: createErrorResponseBodyFromDiscriminatorValue,
|
|
19800
|
+
401: createErrorResponseBodyFromDiscriminatorValue,
|
|
19801
|
+
403: createErrorResponseBodyFromDiscriminatorValue,
|
|
19802
|
+
404: createErrorResponseBodyFromDiscriminatorValue,
|
|
19803
|
+
405: createErrorResponseBodyFromDiscriminatorValue,
|
|
19804
|
+
429: createErrorResponseBodyFromDiscriminatorValue,
|
|
19805
|
+
500: createErrorResponseBodyFromDiscriminatorValue,
|
|
19806
|
+
},
|
|
19807
|
+
adapterMethodName: "sendNoResponseContent",
|
|
19808
|
+
},
|
|
19809
|
+
};
|
|
19810
|
+
/* tslint:enable */
|
|
19811
|
+
/* eslint-enable */
|
|
19812
|
+
|
|
19742
19813
|
/* tslint:disable */
|
|
19743
19814
|
/* eslint-disable */
|
|
19744
19815
|
// Generated by Microsoft Kiota
|
|
@@ -19747,6 +19818,14 @@ const UsageRecordsRequestBuilderRequestsMetadata = {
|
|
|
19747
19818
|
* Uri template for the request builder.
|
|
19748
19819
|
*/
|
|
19749
19820
|
const WebhooksItemRequestBuilderUriTemplate = "{+baseurl}/api/webhooks/{id}{?expand}";
|
|
19821
|
+
/**
|
|
19822
|
+
* Metadata for all the navigation properties in the request builder.
|
|
19823
|
+
*/
|
|
19824
|
+
const WebhooksItemRequestBuilderNavigationMetadata = {
|
|
19825
|
+
ping: {
|
|
19826
|
+
requestsMetadata: PingRequestBuilderRequestsMetadata,
|
|
19827
|
+
},
|
|
19828
|
+
};
|
|
19750
19829
|
/**
|
|
19751
19830
|
* Metadata for all the requests in the request builder.
|
|
19752
19831
|
*/
|
|
@@ -19815,6 +19894,7 @@ const WebhooksRequestBuilderUriTemplate = "{+baseurl}/api/webhooks{?expand}";
|
|
|
19815
19894
|
const WebhooksRequestBuilderNavigationMetadata = {
|
|
19816
19895
|
byId: {
|
|
19817
19896
|
requestsMetadata: WebhooksItemRequestBuilderRequestsMetadata,
|
|
19897
|
+
navigationMetadata: WebhooksItemRequestBuilderNavigationMetadata,
|
|
19818
19898
|
pathParametersMappings: ["id"],
|
|
19819
19899
|
},
|
|
19820
19900
|
};
|
|
@@ -20001,58 +20081,40 @@ class FormParseNode {
|
|
|
20001
20081
|
this._rawString = _rawString;
|
|
20002
20082
|
this.backingStoreFactory = backingStoreFactory;
|
|
20003
20083
|
this._fields = {};
|
|
20004
|
-
this.
|
|
20005
|
-
this.getStringValue = () => decodeURIComponent(this._rawString);
|
|
20084
|
+
this.getStringValue = () => this.getStringValueFromRaw(this._rawString);
|
|
20006
20085
|
this.getChildNode = (identifier) => {
|
|
20007
20086
|
if (this._fields[identifier]) {
|
|
20008
20087
|
return new FormParseNode(this._fields[identifier], this.backingStoreFactory);
|
|
20009
20088
|
}
|
|
20010
20089
|
return undefined;
|
|
20011
20090
|
};
|
|
20012
|
-
this.getBooleanValue = () =>
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
return
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20037
|
-
|
|
20038
|
-
|
|
20039
|
-
else if (typeOfX === "number") {
|
|
20040
|
-
return currentParseNode.getNumberValue();
|
|
20041
|
-
}
|
|
20042
|
-
else if (x instanceof Date) {
|
|
20043
|
-
return currentParseNode.getDateValue();
|
|
20044
|
-
}
|
|
20045
|
-
else if (x instanceof DateOnly) {
|
|
20046
|
-
return currentParseNode.getDateValue();
|
|
20047
|
-
}
|
|
20048
|
-
else if (x instanceof TimeOnly) {
|
|
20049
|
-
return currentParseNode.getDateValue();
|
|
20050
|
-
}
|
|
20051
|
-
else if (x instanceof Duration) {
|
|
20052
|
-
return currentParseNode.getDateValue();
|
|
20053
|
-
}
|
|
20054
|
-
else {
|
|
20055
|
-
throw new Error(`encountered an unknown type during deserialization ${typeof x}`);
|
|
20091
|
+
this.getBooleanValue = () => this.getBooleanValueFromRaw(this._rawString);
|
|
20092
|
+
this.getNumberValue = () => this.getNumberValueFromRaw(this._rawString);
|
|
20093
|
+
this.getGuidValue = () => this.getGuidValueFromRaw(this._rawString);
|
|
20094
|
+
this.getDateValue = () => this.getDateValueFromRaw(this._rawString);
|
|
20095
|
+
this.getDateOnlyValue = () => this.getDateOnlyValueFromRaw(this._rawString);
|
|
20096
|
+
this.getTimeOnlyValue = () => this.getTimeOnlyValueFromRaw(this._rawString);
|
|
20097
|
+
this.getDurationValue = () => this.getDurationValueFromRaw(this._rawString);
|
|
20098
|
+
this.getCollectionOfPrimitiveValues = (primitiveType) => {
|
|
20099
|
+
const values = this._rawString.split(",");
|
|
20100
|
+
return values.map((x) => {
|
|
20101
|
+
switch (primitiveType) {
|
|
20102
|
+
case "boolean":
|
|
20103
|
+
return this.getBooleanValueFromRaw(x);
|
|
20104
|
+
case "number":
|
|
20105
|
+
return this.getNumberValueFromRaw(x);
|
|
20106
|
+
case "Date":
|
|
20107
|
+
return this.getDateValueFromRaw(x);
|
|
20108
|
+
case "DateOnly":
|
|
20109
|
+
return this.getDateOnlyValueFromRaw(x);
|
|
20110
|
+
case "TimeOnly":
|
|
20111
|
+
return this.getTimeOnlyValueFromRaw(x);
|
|
20112
|
+
case "Duration":
|
|
20113
|
+
return this.getDurationValueFromRaw(x);
|
|
20114
|
+
case "string":
|
|
20115
|
+
return this.getStringValueFromRaw(x);
|
|
20116
|
+
default:
|
|
20117
|
+
throw new Error(`encountered an unsupported type during deserialization ${primitiveType}`);
|
|
20056
20118
|
}
|
|
20057
20119
|
});
|
|
20058
20120
|
};
|
|
@@ -20079,7 +20141,6 @@ class FormParseNode {
|
|
|
20079
20141
|
if (!rawValues) {
|
|
20080
20142
|
return [];
|
|
20081
20143
|
}
|
|
20082
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
20083
20144
|
return rawValues.split(",").map((x) => getEnumValueFromStringValue(x, type));
|
|
20084
20145
|
};
|
|
20085
20146
|
this.getEnumValue = (type) => {
|
|
@@ -20089,20 +20150,6 @@ class FormParseNode {
|
|
|
20089
20150
|
}
|
|
20090
20151
|
return getEnumValueFromStringValue(rawValue, type);
|
|
20091
20152
|
};
|
|
20092
|
-
this.assignFieldValues = (model, parsableFactory) => {
|
|
20093
|
-
const fields = parsableFactory(this)(model);
|
|
20094
|
-
Object.entries(this._fields)
|
|
20095
|
-
.filter((x) => !/^null$/i.test(x[1]))
|
|
20096
|
-
.forEach(([k, v]) => {
|
|
20097
|
-
const deserializer = fields[k];
|
|
20098
|
-
if (deserializer) {
|
|
20099
|
-
deserializer(new FormParseNode(v, this.backingStoreFactory));
|
|
20100
|
-
}
|
|
20101
|
-
else {
|
|
20102
|
-
model[k] = v;
|
|
20103
|
-
}
|
|
20104
|
-
});
|
|
20105
|
-
};
|
|
20106
20153
|
if (!_rawString) {
|
|
20107
20154
|
throw new Error("rawString cannot be undefined");
|
|
20108
20155
|
}
|
|
@@ -20120,9 +20167,57 @@ class FormParseNode {
|
|
|
20120
20167
|
}
|
|
20121
20168
|
});
|
|
20122
20169
|
}
|
|
20170
|
+
normalizeKey(key) {
|
|
20171
|
+
return decodeURIComponent(key).trim();
|
|
20172
|
+
}
|
|
20173
|
+
getStringValueFromRaw(value) {
|
|
20174
|
+
return decodeURIComponent(value);
|
|
20175
|
+
}
|
|
20176
|
+
getBooleanValueFromRaw(value) {
|
|
20177
|
+
const decoded = this.getStringValueFromRaw(value).toLowerCase();
|
|
20178
|
+
if (decoded === "true" || decoded === "1") {
|
|
20179
|
+
return true;
|
|
20180
|
+
}
|
|
20181
|
+
else if (decoded === "false" || decoded === "0") {
|
|
20182
|
+
return false;
|
|
20183
|
+
}
|
|
20184
|
+
return undefined;
|
|
20185
|
+
}
|
|
20186
|
+
getNumberValueFromRaw(value) {
|
|
20187
|
+
return parseFloat(this.getStringValueFromRaw(value));
|
|
20188
|
+
}
|
|
20189
|
+
getGuidValueFromRaw(value) {
|
|
20190
|
+
return parseGuidString(this.getStringValueFromRaw(value));
|
|
20191
|
+
}
|
|
20192
|
+
getDateValueFromRaw(value) {
|
|
20193
|
+
return new Date(Date.parse(this.getStringValueFromRaw(value)));
|
|
20194
|
+
}
|
|
20195
|
+
getDateOnlyValueFromRaw(value) {
|
|
20196
|
+
return DateOnly.parse(this.getStringValueFromRaw(value));
|
|
20197
|
+
}
|
|
20198
|
+
getTimeOnlyValueFromRaw(value) {
|
|
20199
|
+
return TimeOnly.parse(this.getStringValueFromRaw(value));
|
|
20200
|
+
}
|
|
20201
|
+
getDurationValueFromRaw(value) {
|
|
20202
|
+
return Duration.parse(this.getStringValueFromRaw(value));
|
|
20203
|
+
}
|
|
20123
20204
|
getByteArrayValue() {
|
|
20124
20205
|
throw new Error("serialization of byt arrays is not supported with URI encoding");
|
|
20125
20206
|
}
|
|
20207
|
+
assignFieldValues(model, parsableFactory) {
|
|
20208
|
+
const fields = parsableFactory(this)(model);
|
|
20209
|
+
Object.entries(this._fields)
|
|
20210
|
+
.filter((x) => !/^null$/i.test(x[1]))
|
|
20211
|
+
.forEach(([k, v]) => {
|
|
20212
|
+
const deserializer = fields[k];
|
|
20213
|
+
if (deserializer) {
|
|
20214
|
+
deserializer(new FormParseNode(v, this.backingStoreFactory));
|
|
20215
|
+
}
|
|
20216
|
+
else {
|
|
20217
|
+
model[k] = v;
|
|
20218
|
+
}
|
|
20219
|
+
});
|
|
20220
|
+
}
|
|
20126
20221
|
}
|
|
20127
20222
|
|
|
20128
20223
|
/**
|
|
@@ -20205,6 +20300,7 @@ class FormSerializationWriter {
|
|
|
20205
20300
|
throw new Error(`serialization of collections is not supported with URI encoding`);
|
|
20206
20301
|
};
|
|
20207
20302
|
this.writeObjectValue = (key, value, serializerMethod) => {
|
|
20303
|
+
var _a, _b, _c;
|
|
20208
20304
|
if (++this.depth > 0) {
|
|
20209
20305
|
throw new Error(`serialization of nested objects is not supported with URI encoding`);
|
|
20210
20306
|
}
|
|
@@ -20215,10 +20311,10 @@ class FormSerializationWriter {
|
|
|
20215
20311
|
if (key) {
|
|
20216
20312
|
this.writePropertyName(key);
|
|
20217
20313
|
}
|
|
20218
|
-
this.onBeforeObjectSerialization
|
|
20219
|
-
this.onStartObjectSerialization
|
|
20314
|
+
(_a = this.onBeforeObjectSerialization) === null || _a === void 0 ? void 0 : _a.call(this, value);
|
|
20315
|
+
(_b = this.onStartObjectSerialization) === null || _b === void 0 ? void 0 : _b.call(this, value, this);
|
|
20220
20316
|
serializerMethod(this, value);
|
|
20221
|
-
this.onAfterObjectSerialization
|
|
20317
|
+
(_c = this.onAfterObjectSerialization) === null || _c === void 0 ? void 0 : _c.call(this, value);
|
|
20222
20318
|
if (this.writer.length > 0 && this.writer[this.writer.length - 1] === FormSerializationWriter.propertySeparator) {
|
|
20223
20319
|
// removing the last separator
|
|
20224
20320
|
this.writer.pop();
|
|
@@ -20377,47 +20473,52 @@ class JsonParseNode {
|
|
|
20377
20473
|
constructor(_jsonNode, backingStoreFactory) {
|
|
20378
20474
|
this._jsonNode = _jsonNode;
|
|
20379
20475
|
this.backingStoreFactory = backingStoreFactory;
|
|
20380
|
-
this.getStringValue = () =>
|
|
20476
|
+
this.getStringValue = () => this.getStringValueFromRaw(this._jsonNode);
|
|
20381
20477
|
this.getChildNode = (identifier) => (this._jsonNode && typeof this._jsonNode === "object" && this._jsonNode[identifier] !== undefined ? new JsonParseNode(this._jsonNode[identifier], this.backingStoreFactory) : undefined);
|
|
20382
20478
|
this.getBooleanValue = () => (typeof this._jsonNode === "boolean" ? this._jsonNode : undefined);
|
|
20383
20479
|
this.getNumberValue = () => (typeof this._jsonNode === "number" ? this._jsonNode : undefined);
|
|
20384
|
-
this.getGuidValue = () =>
|
|
20385
|
-
this.getDateValue = () =>
|
|
20386
|
-
this.getDateOnlyValue = () =>
|
|
20387
|
-
this.getTimeOnlyValue = () =>
|
|
20388
|
-
this.getDurationValue = () =>
|
|
20389
|
-
this.getCollectionOfPrimitiveValues = () => {
|
|
20480
|
+
this.getGuidValue = () => this.getGuidValueFromRaw(this._jsonNode);
|
|
20481
|
+
this.getDateValue = () => this.getDateValueFromRaw(this._jsonNode);
|
|
20482
|
+
this.getDateOnlyValue = () => this.getDateOnlyValueFromRaw(this._jsonNode);
|
|
20483
|
+
this.getTimeOnlyValue = () => this.getTimeOnlyValueFromRaw(this._jsonNode);
|
|
20484
|
+
this.getDurationValue = () => this.getDurationValueFromRaw(this._jsonNode);
|
|
20485
|
+
this.getCollectionOfPrimitiveValues = (primitiveType) => {
|
|
20390
20486
|
if (!Array.isArray(this._jsonNode)) {
|
|
20391
20487
|
return undefined;
|
|
20392
20488
|
}
|
|
20393
|
-
return this._jsonNode.map((x) =>
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20409
|
-
return
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
|
|
20413
|
-
|
|
20414
|
-
|
|
20415
|
-
return
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
|
|
20419
|
-
|
|
20420
|
-
|
|
20489
|
+
return this._jsonNode.map((x) => this.getPrimitiveValue(x, primitiveType));
|
|
20490
|
+
};
|
|
20491
|
+
this.getPrimitiveValue = (value, primitiveType) => {
|
|
20492
|
+
if (value === null) {
|
|
20493
|
+
return null;
|
|
20494
|
+
}
|
|
20495
|
+
switch (primitiveType) {
|
|
20496
|
+
case "boolean":
|
|
20497
|
+
if (typeof value !== "boolean") {
|
|
20498
|
+
throw new Error(`encountered an unsupported type during deserialization ${typeof value}`);
|
|
20499
|
+
}
|
|
20500
|
+
return value;
|
|
20501
|
+
case "number":
|
|
20502
|
+
if (typeof value !== "number") {
|
|
20503
|
+
throw new Error(`encountered an unsupported type during deserialization ${typeof value}`);
|
|
20504
|
+
}
|
|
20505
|
+
return value;
|
|
20506
|
+
case "Date":
|
|
20507
|
+
return this.getDateValueFromRaw(value);
|
|
20508
|
+
case "DateOnly":
|
|
20509
|
+
return this.getDateOnlyValueFromRaw(value);
|
|
20510
|
+
case "TimeOnly":
|
|
20511
|
+
return this.getTimeOnlyValueFromRaw(value);
|
|
20512
|
+
case "Duration":
|
|
20513
|
+
return this.getDurationValueFromRaw(value);
|
|
20514
|
+
case "string":
|
|
20515
|
+
if (typeof value !== "string") {
|
|
20516
|
+
throw new Error(`encountered an unsupported type during deserialization ${typeof value}`);
|
|
20517
|
+
}
|
|
20518
|
+
return value;
|
|
20519
|
+
default:
|
|
20520
|
+
throw new Error(`encountered an unsupported type during deserialization ${primitiveType}`);
|
|
20521
|
+
}
|
|
20421
20522
|
};
|
|
20422
20523
|
this.getCollectionOfObjectValues = (method) => {
|
|
20423
20524
|
if (!Array.isArray(this._jsonNode)) {
|
|
@@ -20492,10 +20593,12 @@ class JsonParseNode {
|
|
|
20492
20593
|
if (Array.isArray(this._jsonNode)) {
|
|
20493
20594
|
return this._jsonNode
|
|
20494
20595
|
.map((x) => {
|
|
20495
|
-
|
|
20496
|
-
|
|
20596
|
+
if (typeof x === "string") {
|
|
20597
|
+
return getEnumValueFromStringValue(x, type);
|
|
20598
|
+
}
|
|
20599
|
+
return undefined;
|
|
20497
20600
|
})
|
|
20498
|
-
.filter(
|
|
20601
|
+
.filter((value) => value !== undefined);
|
|
20499
20602
|
}
|
|
20500
20603
|
return [];
|
|
20501
20604
|
};
|
|
@@ -20507,6 +20610,33 @@ class JsonParseNode {
|
|
|
20507
20610
|
return getEnumValueFromStringValue(rawValue, type);
|
|
20508
20611
|
};
|
|
20509
20612
|
}
|
|
20613
|
+
getStringValueFromRaw(value) {
|
|
20614
|
+
return typeof value === "string" ? value : undefined;
|
|
20615
|
+
}
|
|
20616
|
+
getGuidValueFromRaw(value) {
|
|
20617
|
+
return parseGuidString(this.getStringValueFromRaw(value));
|
|
20618
|
+
}
|
|
20619
|
+
getDateValueFromRaw(value) {
|
|
20620
|
+
if (value instanceof Date) {
|
|
20621
|
+
return new Date(value.getTime());
|
|
20622
|
+
}
|
|
20623
|
+
if (typeof value === "number") {
|
|
20624
|
+
return new Date(value);
|
|
20625
|
+
}
|
|
20626
|
+
if (typeof value === "string") {
|
|
20627
|
+
return new Date(value);
|
|
20628
|
+
}
|
|
20629
|
+
return undefined;
|
|
20630
|
+
}
|
|
20631
|
+
getDateOnlyValueFromRaw(value) {
|
|
20632
|
+
return value instanceof DateOnly ? value : DateOnly.parse(this.getStringValueFromRaw(value));
|
|
20633
|
+
}
|
|
20634
|
+
getTimeOnlyValueFromRaw(value) {
|
|
20635
|
+
return value instanceof TimeOnly ? value : TimeOnly.parse(this.getStringValueFromRaw(value));
|
|
20636
|
+
}
|
|
20637
|
+
getDurationValueFromRaw(value) {
|
|
20638
|
+
return value instanceof Duration ? value : Duration.parse(this.getStringValueFromRaw(value));
|
|
20639
|
+
}
|
|
20510
20640
|
getByteArrayValue() {
|
|
20511
20641
|
const strValue = this.getStringValue();
|
|
20512
20642
|
if (strValue && strValue.length > 0) {
|
|
@@ -20522,7 +20652,7 @@ class JsonParseNode {
|
|
|
20522
20652
|
* TODO: Consider standardizing on a cross-platform UInt8Array.fromBase64 (after the API is stabilized across browsers)
|
|
20523
20653
|
* in the future instead of the current environment-specific approach
|
|
20524
20654
|
*/
|
|
20525
|
-
return inNodeEnv() ? new Uint8Array(Buffer.from(strValue, "base64")).buffer : new TextEncoder().encode(strValue);
|
|
20655
|
+
return inNodeEnv() ? new Uint8Array(Buffer.from(strValue, "base64")).buffer : new TextEncoder().encode(strValue).buffer;
|
|
20526
20656
|
}
|
|
20527
20657
|
return undefined;
|
|
20528
20658
|
}
|
|
@@ -20584,7 +20714,6 @@ class JsonSerializationWriter {
|
|
|
20584
20714
|
}
|
|
20585
20715
|
if (this.shouldWriteValueOrNull(key, value)) {
|
|
20586
20716
|
key && this.writePropertyName(key);
|
|
20587
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
20588
20717
|
this.writer.push(`"${value}"`);
|
|
20589
20718
|
key && this.writer.push(JsonSerializationWriter.propertySeparator);
|
|
20590
20719
|
}
|
|
@@ -20689,10 +20818,9 @@ class JsonSerializationWriter {
|
|
|
20689
20818
|
}
|
|
20690
20819
|
};
|
|
20691
20820
|
this.writeNonParsableObjectValue = (key, value) => {
|
|
20692
|
-
|
|
20693
|
-
|
|
20694
|
-
|
|
20695
|
-
this.writer.push(JSON.stringify(value), JsonSerializationWriter.propertySeparator);
|
|
20821
|
+
key && this.writePropertyName(key);
|
|
20822
|
+
this.writer.push(JSON.stringify(value));
|
|
20823
|
+
key && this.writer.push(JsonSerializationWriter.propertySeparator);
|
|
20696
20824
|
};
|
|
20697
20825
|
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
20698
20826
|
this.writeAnyValue = (key, value) => {
|
|
@@ -20743,6 +20871,7 @@ class JsonSerializationWriter {
|
|
|
20743
20871
|
this.writeStringValue(key, b64);
|
|
20744
20872
|
}
|
|
20745
20873
|
writeObjectValue(key, value, serializerMethod) {
|
|
20874
|
+
var _a, _b, _c;
|
|
20746
20875
|
if (value === undefined) {
|
|
20747
20876
|
return;
|
|
20748
20877
|
}
|
|
@@ -20801,11 +20930,11 @@ class JsonSerializationWriter {
|
|
|
20801
20930
|
}
|
|
20802
20931
|
if (key)
|
|
20803
20932
|
this.writePropertyName(key);
|
|
20804
|
-
this.onBeforeObjectSerialization
|
|
20933
|
+
(_a = this.onBeforeObjectSerialization) === null || _a === void 0 ? void 0 : _a.call(this, value);
|
|
20805
20934
|
this.startObject();
|
|
20806
|
-
this.onStartObjectSerialization
|
|
20807
|
-
serializerMethod
|
|
20808
|
-
this.onAfterObjectSerialization
|
|
20935
|
+
(_b = this.onStartObjectSerialization) === null || _b === void 0 ? void 0 : _b.call(this, value, this);
|
|
20936
|
+
serializerMethod === null || serializerMethod === void 0 ? void 0 : serializerMethod(this, value);
|
|
20937
|
+
(_c = this.onAfterObjectSerialization) === null || _c === void 0 ? void 0 : _c.call(this, value);
|
|
20809
20938
|
this.removeLastSeparator();
|
|
20810
20939
|
this.endObject();
|
|
20811
20940
|
if (key)
|
|
@@ -20878,7 +21007,6 @@ class JsonSerializationWriterFactory {
|
|
|
20878
21007
|
* See License in the project root for license information.
|
|
20879
21008
|
* -------------------------------------------------------------------------------------------
|
|
20880
21009
|
*/
|
|
20881
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
20882
21010
|
/** Serialization writer for multipart/form-data */
|
|
20883
21011
|
class MultipartSerializationWriter {
|
|
20884
21012
|
constructor() {
|
|
@@ -20938,6 +21066,7 @@ class MultipartSerializationWriter {
|
|
|
20938
21066
|
throw new Error(`serialization of collections is not supported with multipart`);
|
|
20939
21067
|
};
|
|
20940
21068
|
this.writeObjectValue = (key, value, serializerMethod) => {
|
|
21069
|
+
var _a, _b, _c;
|
|
20941
21070
|
if (!value) {
|
|
20942
21071
|
throw new Error(`value cannot be undefined`);
|
|
20943
21072
|
}
|
|
@@ -20947,10 +21076,10 @@ class MultipartSerializationWriter {
|
|
|
20947
21076
|
if (!serializerMethod) {
|
|
20948
21077
|
throw new Error(`serializer method cannot be undefined`);
|
|
20949
21078
|
}
|
|
20950
|
-
this.onBeforeObjectSerialization
|
|
20951
|
-
this.onStartObjectSerialization
|
|
21079
|
+
(_a = this.onBeforeObjectSerialization) === null || _a === void 0 ? void 0 : _a.call(this, value);
|
|
21080
|
+
(_b = this.onStartObjectSerialization) === null || _b === void 0 ? void 0 : _b.call(this, value, this);
|
|
20952
21081
|
serializerMethod(this, value);
|
|
20953
|
-
this.onAfterObjectSerialization
|
|
21082
|
+
(_c = this.onAfterObjectSerialization) === null || _c === void 0 ? void 0 : _c.call(this, value);
|
|
20954
21083
|
};
|
|
20955
21084
|
this.writeEnumValue = (
|
|
20956
21085
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -21042,8 +21171,28 @@ class TextParseNode {
|
|
|
21042
21171
|
this.getDateOnlyValue = () => DateOnly.parse(this.getStringValue());
|
|
21043
21172
|
this.getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue());
|
|
21044
21173
|
this.getDurationValue = () => Duration.parse(this.getStringValue());
|
|
21045
|
-
this.getCollectionOfPrimitiveValues = () => {
|
|
21046
|
-
|
|
21174
|
+
this.getCollectionOfPrimitiveValues = (primitiveType) => {
|
|
21175
|
+
return this.text.split(",").map((x) => {
|
|
21176
|
+
const node = new TextParseNode(x);
|
|
21177
|
+
switch (primitiveType) {
|
|
21178
|
+
case "boolean":
|
|
21179
|
+
return node.getBooleanValue();
|
|
21180
|
+
case "number":
|
|
21181
|
+
return node.getNumberValue();
|
|
21182
|
+
case "Date":
|
|
21183
|
+
return node.getDateValue();
|
|
21184
|
+
case "DateOnly":
|
|
21185
|
+
return node.getDateOnlyValue();
|
|
21186
|
+
case "TimeOnly":
|
|
21187
|
+
return node.getTimeOnlyValue();
|
|
21188
|
+
case "Duration":
|
|
21189
|
+
return node.getDurationValue();
|
|
21190
|
+
case "string":
|
|
21191
|
+
return node.getStringValue();
|
|
21192
|
+
default:
|
|
21193
|
+
throw new Error(`encountered an unsupported type during deserialization ${primitiveType}`);
|
|
21194
|
+
}
|
|
21195
|
+
});
|
|
21047
21196
|
};
|
|
21048
21197
|
this.getCollectionOfEnumValues = (type) => {
|
|
21049
21198
|
throw new Error(TextParseNode.noStructuredDataMessage);
|
|
@@ -21074,7 +21223,7 @@ class TextParseNode {
|
|
|
21074
21223
|
* TODO: Consider standardizing on a cross-platform UInt8Array.fromBase64 (after the API is stabilized across browsers)
|
|
21075
21224
|
* in the future instead of the current environment-specific approach
|
|
21076
21225
|
*/
|
|
21077
|
-
return inNodeEnv() ? new Uint8Array(Buffer.from(strValue, "base64")).buffer : new TextEncoder().encode(strValue);
|
|
21226
|
+
return inNodeEnv() ? new Uint8Array(Buffer.from(strValue, "base64")).buffer : new TextEncoder().encode(strValue).buffer;
|
|
21078
21227
|
}
|
|
21079
21228
|
return undefined;
|
|
21080
21229
|
}
|
|
@@ -21131,7 +21280,6 @@ class TextSerializationWriter {
|
|
|
21131
21280
|
return this.writeNullValue(key);
|
|
21132
21281
|
}
|
|
21133
21282
|
if (value) {
|
|
21134
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
21135
21283
|
this.writeStringValue(key, `"${value}"`);
|
|
21136
21284
|
}
|
|
21137
21285
|
};
|
|
@@ -21315,12 +21463,69 @@ const SalableNavigationMetadata = {
|
|
|
21315
21463
|
/* tslint:enable */
|
|
21316
21464
|
/* eslint-enable */
|
|
21317
21465
|
|
|
21466
|
+
/**
|
|
21467
|
+
* Kiota's JsonSerializationWriter stringifies null enum values, producing
|
|
21468
|
+
* `"interval": "null"` instead of `"interval": null`, which the API rejects
|
|
21469
|
+
* with an invalid_enum_value error. Unlike every other write method, its
|
|
21470
|
+
* writeEnumValue/writeCollectionOfEnumValues only filter out undefined before
|
|
21471
|
+
* template-stringifying, so null slips through as the string "null".
|
|
21472
|
+
* See https://github.com/microsoft/kiota-typescript — present up to at least
|
|
21473
|
+
* 1.0.0-preview.107. This subclass emits a proper JSON null instead.
|
|
21474
|
+
*/
|
|
21475
|
+
class NullSafeJsonSerializationWriter extends JsonSerializationWriter {
|
|
21476
|
+
writeEnumValue = (key, ...values) => {
|
|
21477
|
+
const provided = values.filter((x) => x !== undefined);
|
|
21478
|
+
if (provided.length === 0) {
|
|
21479
|
+
return;
|
|
21480
|
+
}
|
|
21481
|
+
const rawValues = provided.filter((x) => x !== null).map((x) => `${x}`);
|
|
21482
|
+
if (rawValues.length === 0) {
|
|
21483
|
+
this.writeNullValue(key);
|
|
21484
|
+
return;
|
|
21485
|
+
}
|
|
21486
|
+
this.writeStringValue(key, rawValues.join(', '));
|
|
21487
|
+
};
|
|
21488
|
+
writeCollectionOfEnumValues = (key, values) => {
|
|
21489
|
+
if (values === null) {
|
|
21490
|
+
this.writeNullValue(key);
|
|
21491
|
+
return;
|
|
21492
|
+
}
|
|
21493
|
+
if (!values || values.length === 0) {
|
|
21494
|
+
return;
|
|
21495
|
+
}
|
|
21496
|
+
const rawValues = values
|
|
21497
|
+
.filter((x) => x !== undefined)
|
|
21498
|
+
.map((x) => (x === null ? null : `${x}`));
|
|
21499
|
+
if (rawValues.length === 0) {
|
|
21500
|
+
return;
|
|
21501
|
+
}
|
|
21502
|
+
this.writeCollectionOfPrimitiveValues(key, rawValues);
|
|
21503
|
+
};
|
|
21504
|
+
}
|
|
21505
|
+
class NullSafeJsonSerializationWriterFactory extends JsonSerializationWriterFactory {
|
|
21506
|
+
getSerializationWriter(contentType) {
|
|
21507
|
+
if (!contentType) {
|
|
21508
|
+
throw new Error('content type cannot be undefined or empty');
|
|
21509
|
+
}
|
|
21510
|
+
if (this.getValidContentType() !== contentType) {
|
|
21511
|
+
throw new Error(`expected a ${this.getValidContentType()} content type`);
|
|
21512
|
+
}
|
|
21513
|
+
return new NullSafeJsonSerializationWriter();
|
|
21514
|
+
}
|
|
21515
|
+
}
|
|
21516
|
+
|
|
21318
21517
|
class Salable {
|
|
21319
21518
|
api;
|
|
21320
21519
|
constructor(apiKey) {
|
|
21321
21520
|
const authProvider = new ApiKeyAuthenticationProvider('Bearer ' + apiKey, 'Authorization', ApiKeyLocation.Header);
|
|
21322
21521
|
const adapter = new FetchRequestAdapter(authProvider);
|
|
21323
21522
|
this.api = createSalable(adapter).api;
|
|
21523
|
+
// Must run after createSalable, which registers the stock JSON serializer;
|
|
21524
|
+
// re-registering replaces the application/json factory with the null-safe one.
|
|
21525
|
+
const writerRegistry = adapter.getSerializationWriterFactory();
|
|
21526
|
+
if (writerRegistry.registerDefaultSerializer) {
|
|
21527
|
+
writerRegistry.registerDefaultSerializer(NullSafeJsonSerializationWriterFactory);
|
|
21528
|
+
}
|
|
21324
21529
|
}
|
|
21325
21530
|
}
|
|
21326
21531
|
|