@commercetools/sdk-client-v2 3.0.0 → 3.3.1
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/CHANGELOG.md +34 -5
- package/dist/commercetools-sdk-client-v2.browser.cjs.js +4 -4
- package/dist/commercetools-sdk-client-v2.browser.esm.js +4 -4
- package/dist/commercetools-sdk-client-v2.cjs.dev.js +4 -4
- package/dist/commercetools-sdk-client-v2.cjs.prod.js +4 -4
- package/dist/commercetools-sdk-client-v2.esm.js +4 -4
- package/dist/commercetools-sdk-client-v2.umd.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @commercetools/sdk-client-v2
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1219](https://github.com/commercetools/commercetools-sdk-typescript/pull/1219) [`c665e6d`](https://github.com/commercetools/commercetools-sdk-typescript/commit/c665e6d12fe11e66baa303059869bca2b7364b1c) Thanks [@ShipilA](https://github.com/ShipilA)! - Monthly release
|
|
8
|
+
|
|
9
|
+
## 3.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#1205](https://github.com/commercetools/commercetools-sdk-typescript/pull/1205) [`1ceb53b`](https://github.com/commercetools/commercetools-sdk-typescript/commit/1ceb53bf00457494ad061d7fe77a8d1b5a010d04) Thanks [@ajimae](https://github.com/ajimae)! - release packages
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#1205](https://github.com/commercetools/commercetools-sdk-typescript/pull/1205) [`1ceb53b`](https://github.com/commercetools/commercetools-sdk-typescript/commit/1ceb53bf00457494ad061d7fe77a8d1b5a010d04) Thanks [@ajimae](https://github.com/ajimae)! - release packages
|
|
18
|
+
|
|
19
|
+
- [#1205](https://github.com/commercetools/commercetools-sdk-typescript/pull/1205) [`1ceb53b`](https://github.com/commercetools/commercetools-sdk-typescript/commit/1ceb53bf00457494ad061d7fe77a8d1b5a010d04) Thanks [@ajimae](https://github.com/ajimae)! - release changeset
|
|
20
|
+
|
|
21
|
+
## 3.2.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [#1203](https://github.com/commercetools/commercetools-sdk-typescript/pull/1203) [`e0b0fcc`](https://github.com/commercetools/commercetools-sdk-typescript/commit/e0b0fccaed4812c0ac47b0c8c4724e81174b0255) Thanks [@ajimae](https://github.com/ajimae)! - release packages
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#1203](https://github.com/commercetools/commercetools-sdk-typescript/pull/1203) [`e0b0fcc`](https://github.com/commercetools/commercetools-sdk-typescript/commit/e0b0fccaed4812c0ac47b0c8c4724e81174b0255) Thanks [@ajimae](https://github.com/ajimae)! - release changeset
|
|
30
|
+
|
|
31
|
+
## 3.1.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- [#1201](https://github.com/commercetools/commercetools-sdk-typescript/pull/1201) [`f7c3101`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f7c31015ae0e18111c31fcdb3baee8e964bad99b) Thanks [@ajimae](https://github.com/ajimae)! - release packages
|
|
36
|
+
|
|
3
37
|
## 3.0.0
|
|
4
38
|
|
|
5
39
|
### Major Changes
|
|
@@ -130,7 +164,6 @@
|
|
|
130
164
|
- [#347](https://github.com/commercetools/commercetools-sdk-typescript/pull/347) [`f0e84dd`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f0e84ddb2e34b908385a380175c6da596db6817a) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated SDKs
|
|
131
165
|
|
|
132
166
|
Add `quotes()` method for the `My Quote endpoint`
|
|
133
|
-
|
|
134
167
|
- [Diff Link](https://github.com/commercetools/commercetools-sdk-typescript/pull/347/files#diff-17ea32dc184ca17b337fbf5e126f27f16651feadc9c879fae88db2580537cf8eR142)
|
|
135
168
|
|
|
136
169
|
**Usage:**
|
|
@@ -145,15 +178,12 @@
|
|
|
145
178
|
```
|
|
146
179
|
|
|
147
180
|
Add `ByProjectKeyMeQuotesByIDRequestBuilder` class for `quotes-request` model
|
|
148
|
-
|
|
149
181
|
- [Diff Link](https://github.com/commercetools/commercetools-sdk-typescript/pull/347/files#diff-a5bab13a41c9ece596cf0fcc545109385e16b6b1877755e58d8ec064125e2041R12)
|
|
150
182
|
|
|
151
183
|
Add `ByProjectKeyMeQuotesKeyByKeyRequestBuilder` class for `quotes-request` model
|
|
152
|
-
|
|
153
184
|
- [Diff Link](https://github.com/commercetools/commercetools-sdk-typescript/pull/347/files#diff-034feddaefb558f6391d5238391e177290d7f018904308b2884dfa016c81bc0dR12)
|
|
154
185
|
|
|
155
186
|
Add `ByProjectKeyMeQuotesRequestBuilder` class for `quotes-request` model
|
|
156
|
-
|
|
157
187
|
- [Diff Link](https://github.com/commercetools/commercetools-sdk-typescript/pull/347/files#diff-26e9b7a9cef621eaf88d81d1e2bb61858402450c444e1fe4d11bde5b51d22638R13)
|
|
158
188
|
|
|
159
189
|
## 2.0.0
|
|
@@ -194,7 +224,6 @@
|
|
|
194
224
|
### Minor Changes
|
|
195
225
|
|
|
196
226
|
- [#241](https://github.com/commercetools/commercetools-sdk-typescript/pull/241) [`85f5be3`](https://github.com/commercetools/commercetools-sdk-typescript/commit/85f5be349a9b0fa46539259981bfd8d5fc2ffdc6) Thanks [@ajimae](https://github.com/ajimae)! - Releasing the TS SDK with the following changelogs
|
|
197
|
-
|
|
198
227
|
- added functionalities to extend client user agent
|
|
199
228
|
- custom field added to OrderFromCardDraft
|
|
200
229
|
|
|
@@ -1057,7 +1057,7 @@ function createQueueMiddleware({
|
|
|
1057
1057
|
|
|
1058
1058
|
var packageJson = {
|
|
1059
1059
|
name: "@commercetools/sdk-client-v2",
|
|
1060
|
-
version: "3.
|
|
1060
|
+
version: "3.3.1",
|
|
1061
1061
|
engines: {
|
|
1062
1062
|
node: ">=18"
|
|
1063
1063
|
},
|
|
@@ -1084,7 +1084,7 @@ var packageJson = {
|
|
|
1084
1084
|
},
|
|
1085
1085
|
repository: {
|
|
1086
1086
|
type: "git",
|
|
1087
|
-
url: "
|
|
1087
|
+
url: "https://github.com/commercetools/commercetools-sdk-typescript"
|
|
1088
1088
|
},
|
|
1089
1089
|
bugs: {
|
|
1090
1090
|
url: "https://github.com/commercetools/commercetools-sdk-typescript/issues"
|
|
@@ -1105,9 +1105,9 @@ var packageJson = {
|
|
|
1105
1105
|
},
|
|
1106
1106
|
devDependencies: {
|
|
1107
1107
|
"common-tags": "1.8.2",
|
|
1108
|
-
dotenv: "
|
|
1108
|
+
dotenv: "17.2.2",
|
|
1109
1109
|
jest: "29.7.0",
|
|
1110
|
-
nock: "
|
|
1110
|
+
nock: "14.0.10",
|
|
1111
1111
|
"organize-imports-cli": "0.10.0"
|
|
1112
1112
|
},
|
|
1113
1113
|
scripts: {
|
|
@@ -1053,7 +1053,7 @@ function createQueueMiddleware({
|
|
|
1053
1053
|
|
|
1054
1054
|
var packageJson = {
|
|
1055
1055
|
name: "@commercetools/sdk-client-v2",
|
|
1056
|
-
version: "3.
|
|
1056
|
+
version: "3.3.1",
|
|
1057
1057
|
engines: {
|
|
1058
1058
|
node: ">=18"
|
|
1059
1059
|
},
|
|
@@ -1080,7 +1080,7 @@ var packageJson = {
|
|
|
1080
1080
|
},
|
|
1081
1081
|
repository: {
|
|
1082
1082
|
type: "git",
|
|
1083
|
-
url: "
|
|
1083
|
+
url: "https://github.com/commercetools/commercetools-sdk-typescript"
|
|
1084
1084
|
},
|
|
1085
1085
|
bugs: {
|
|
1086
1086
|
url: "https://github.com/commercetools/commercetools-sdk-typescript/issues"
|
|
@@ -1101,9 +1101,9 @@ var packageJson = {
|
|
|
1101
1101
|
},
|
|
1102
1102
|
devDependencies: {
|
|
1103
1103
|
"common-tags": "1.8.2",
|
|
1104
|
-
dotenv: "
|
|
1104
|
+
dotenv: "17.2.2",
|
|
1105
1105
|
jest: "29.7.0",
|
|
1106
|
-
nock: "
|
|
1106
|
+
nock: "14.0.10",
|
|
1107
1107
|
"organize-imports-cli": "0.10.0"
|
|
1108
1108
|
},
|
|
1109
1109
|
scripts: {
|
|
@@ -1057,7 +1057,7 @@ function createQueueMiddleware({
|
|
|
1057
1057
|
|
|
1058
1058
|
var packageJson = {
|
|
1059
1059
|
name: "@commercetools/sdk-client-v2",
|
|
1060
|
-
version: "3.
|
|
1060
|
+
version: "3.3.1",
|
|
1061
1061
|
engines: {
|
|
1062
1062
|
node: ">=18"
|
|
1063
1063
|
},
|
|
@@ -1084,7 +1084,7 @@ var packageJson = {
|
|
|
1084
1084
|
},
|
|
1085
1085
|
repository: {
|
|
1086
1086
|
type: "git",
|
|
1087
|
-
url: "
|
|
1087
|
+
url: "https://github.com/commercetools/commercetools-sdk-typescript"
|
|
1088
1088
|
},
|
|
1089
1089
|
bugs: {
|
|
1090
1090
|
url: "https://github.com/commercetools/commercetools-sdk-typescript/issues"
|
|
@@ -1105,9 +1105,9 @@ var packageJson = {
|
|
|
1105
1105
|
},
|
|
1106
1106
|
devDependencies: {
|
|
1107
1107
|
"common-tags": "1.8.2",
|
|
1108
|
-
dotenv: "
|
|
1108
|
+
dotenv: "17.2.2",
|
|
1109
1109
|
jest: "29.7.0",
|
|
1110
|
-
nock: "
|
|
1110
|
+
nock: "14.0.10",
|
|
1111
1111
|
"organize-imports-cli": "0.10.0"
|
|
1112
1112
|
},
|
|
1113
1113
|
scripts: {
|
|
@@ -1057,7 +1057,7 @@ function createQueueMiddleware({
|
|
|
1057
1057
|
|
|
1058
1058
|
var packageJson = {
|
|
1059
1059
|
name: "@commercetools/sdk-client-v2",
|
|
1060
|
-
version: "3.
|
|
1060
|
+
version: "3.3.1",
|
|
1061
1061
|
engines: {
|
|
1062
1062
|
node: ">=18"
|
|
1063
1063
|
},
|
|
@@ -1084,7 +1084,7 @@ var packageJson = {
|
|
|
1084
1084
|
},
|
|
1085
1085
|
repository: {
|
|
1086
1086
|
type: "git",
|
|
1087
|
-
url: "
|
|
1087
|
+
url: "https://github.com/commercetools/commercetools-sdk-typescript"
|
|
1088
1088
|
},
|
|
1089
1089
|
bugs: {
|
|
1090
1090
|
url: "https://github.com/commercetools/commercetools-sdk-typescript/issues"
|
|
@@ -1105,9 +1105,9 @@ var packageJson = {
|
|
|
1105
1105
|
},
|
|
1106
1106
|
devDependencies: {
|
|
1107
1107
|
"common-tags": "1.8.2",
|
|
1108
|
-
dotenv: "
|
|
1108
|
+
dotenv: "17.2.2",
|
|
1109
1109
|
jest: "29.7.0",
|
|
1110
|
-
nock: "
|
|
1110
|
+
nock: "14.0.10",
|
|
1111
1111
|
"organize-imports-cli": "0.10.0"
|
|
1112
1112
|
},
|
|
1113
1113
|
scripts: {
|
|
@@ -1053,7 +1053,7 @@ function createQueueMiddleware({
|
|
|
1053
1053
|
|
|
1054
1054
|
var packageJson = {
|
|
1055
1055
|
name: "@commercetools/sdk-client-v2",
|
|
1056
|
-
version: "3.
|
|
1056
|
+
version: "3.3.1",
|
|
1057
1057
|
engines: {
|
|
1058
1058
|
node: ">=18"
|
|
1059
1059
|
},
|
|
@@ -1080,7 +1080,7 @@ var packageJson = {
|
|
|
1080
1080
|
},
|
|
1081
1081
|
repository: {
|
|
1082
1082
|
type: "git",
|
|
1083
|
-
url: "
|
|
1083
|
+
url: "https://github.com/commercetools/commercetools-sdk-typescript"
|
|
1084
1084
|
},
|
|
1085
1085
|
bugs: {
|
|
1086
1086
|
url: "https://github.com/commercetools/commercetools-sdk-typescript/issues"
|
|
@@ -1101,9 +1101,9 @@ var packageJson = {
|
|
|
1101
1101
|
},
|
|
1102
1102
|
devDependencies: {
|
|
1103
1103
|
"common-tags": "1.8.2",
|
|
1104
|
-
dotenv: "
|
|
1104
|
+
dotenv: "17.2.2",
|
|
1105
1105
|
jest: "29.7.0",
|
|
1106
|
-
nock: "
|
|
1106
|
+
nock: "14.0.10",
|
|
1107
1107
|
"organize-imports-cli": "0.10.0"
|
|
1108
1108
|
},
|
|
1109
1109
|
scripts: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var window;(window||={})["@commercetools/sdk-client-v2"]=(()=>{var Ar=Object.create;var ue=Object.defineProperty;var Br=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames;var Ir=Object.getPrototypeOf,Fr=Object.prototype.hasOwnProperty;var Ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ke=(t,e)=>{for(var r in e)ue(t,r,{get:e[r],enumerable:!0})},He=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rr(e))!Fr.call(t,n)&&n!==r&&ue(t,n,{get:()=>e[n],enumerable:!(i=Br(e,n))||i.enumerable});return t};var Be=(t,e,r)=>(r=t!=null?Ar(Ir(t)):{},He(e||!t||!t.__esModule?ue(r,"default",{value:t,enumerable:!0}):r,t)),Tr=t=>He(ue({},"__esModule",{value:!0}),t);var We=Ae(de=>{"use strict";de.byteLength=Nr;de.toByteArray=jr;de.fromByteArray=_r;var b=[],R=[],Or=typeof Uint8Array<"u"?Uint8Array:Array,Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(D=0,Qe=Fe.length;D<Qe;++D)b[D]=Fe[D],R[Fe.charCodeAt(D)]=D;var D,Qe;R[45]=62;R[95]=63;function Ve(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Nr(t){var e=Ve(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Pr(t,e,r){return(e+r)*3/4-r}function jr(t){var e,r=Ve(t),i=r[0],n=r[1],o=new Or(Pr(t,i,n)),s=0,u=n>0?i-4:i,l;for(l=0;l<u;l+=4)e=R[t.charCodeAt(l)]<<18|R[t.charCodeAt(l+1)]<<12|R[t.charCodeAt(l+2)]<<6|R[t.charCodeAt(l+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return n===2&&(e=R[t.charCodeAt(l)]<<2|R[t.charCodeAt(l+1)]>>4,o[s++]=e&255),n===1&&(e=R[t.charCodeAt(l)]<<10|R[t.charCodeAt(l+1)]<<4|R[t.charCodeAt(l+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function qr(t){return b[t>>18&63]+b[t>>12&63]+b[t>>6&63]+b[t&63]}function Lr(t,e,r){for(var i,n=[],o=e;o<r;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(qr(i));return n.join("")}function _r(t){for(var e,r=t.length,i=r%3,n=[],o=16383,s=0,u=r-i;s<u;s+=o)n.push(Lr(t,s,s+o>u?u:s+o));return i===1?(e=t[r-1],n.push(b[e>>2]+b[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(b[e>>10]+b[e>>4&63]+b[e<<2&63]+"=")),n.join("")}});var Ye=Ae(Te=>{Te.read=function(t,e,r,i,n){var o,s,u=n*8-i-1,l=(1<<u)-1,c=l>>1,h=-7,d=r?n-1:0,f=r?-1:1,p=t[e+d];for(d+=f,o=p&(1<<-h)-1,p>>=-h,h+=u;h>0;o=o*256+t[e+d],d+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+t[e+d],d+=f,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-c}return(p?-1:1)*s*Math.pow(2,o-i)};Te.write=function(t,e,r,i,n,o){var s,u,l,c=o*8-n-1,h=(1<<c)-1,d=h>>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,g=i?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=f/l:e+=f*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=h?(u=0,s=h):s+d>=1?(u=(e*l-1)*Math.pow(2,n),s=s+d):(u=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+p]=u&255,p+=g,u/=256,n-=8);for(s=s<<n|u,c+=n;c>0;t[r+p]=s&255,p+=g,s/=256,c-=8);t[r+p-g]|=k*128}});var pe=Ae(Q=>{"use strict";var Ce=We(),G=Ye(),Xe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q.Buffer=a;Q.SlowBuffer=Gr;Q.INSPECT_MAX_BYTES=50;var he=2147483647;Q.kMaxLength=he;a.TYPED_ARRAY_SUPPORT=$r();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function $r(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function O(t){if(t>he)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Se(t)}return rr(t,e,r)}a.poolSize=8192;function rr(t,e,r){if(typeof t=="string")return Kr(t,e);if(ArrayBuffer.isView(t))return Hr(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(U(t,ArrayBuffer)||t&&U(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(U(t,SharedArrayBuffer)||t&&U(t.buffer,SharedArrayBuffer)))return Ue(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return a.from(i,e,r);let n=zr(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}a.from=function(t,e,r){return rr(t,e,r)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function tr(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Dr(t,e,r){return tr(t),t<=0?O(t):e!==void 0?typeof r=="string"?O(t).fill(e,r):O(t).fill(e):O(t)}a.alloc=function(t,e,r){return Dr(t,e,r)};function Se(t){return tr(t),O(t<0?0:Oe(t)|0)}a.allocUnsafe=function(t){return Se(t)};a.allocUnsafeSlow=function(t){return Se(t)};function Kr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ir(t,e)|0,i=O(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function be(t){let e=t.length<0?0:Oe(t.length)|0,r=O(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Hr(t){if(U(t,Uint8Array)){let e=new Uint8Array(t);return Ue(e.buffer,e.byteOffset,e.byteLength)}return be(t)}function Ue(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,a.prototype),i}function zr(t){if(a.isBuffer(t)){let e=Oe(t.length)|0,r=O(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Pe(t.length)?O(0):be(t);if(t.type==="Buffer"&&Array.isArray(t.data))return be(t.data)}function Oe(t){if(t>=he)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+he.toString(16)+" bytes");return t|0}function Gr(t){return+t!=t&&(t=0),a.alloc(+t)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype};a.compare=function(e,r){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),U(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(e)||!a.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(e[o]!==r[o]){i=e[o],n=r[o];break}return i<n?-1:n<i?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=a.allocUnsafe(r),o=0;for(i=0;i<e.length;++i){let s=e[i];if(U(s,Uint8Array))o+s.length>n.length?(a.isBuffer(s)||(s=a.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(a.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function ir(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||U(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ke(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return hr(t).length;default:if(n)return i?-1:ke(t).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=ir;function Jr(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return tt(this,e,r);case"utf8":case"utf-8":return or(this,e,r);case"ascii":return et(this,e,r);case"latin1":case"binary":return rt(this,e,r);case"base64":return Zr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return it(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}a.prototype._isBuffer=!0;function K(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)K(this,r,r+1);return this};a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)K(this,r,r+3),K(this,r+1,r+2);return this};a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)K(this,r,r+7),K(this,r+1,r+6),K(this,r+2,r+5),K(this,r+3,r+4);return this};a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?or(this,0,e):Jr.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.inspect=function(){let e="",r=Q.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Xe&&(a.prototype[Xe]=a.prototype.inspect);a.prototype.compare=function(e,r,i,n,o){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;let s=o-n,u=i-r,l=Math.min(s,u),c=this.slice(n,o),h=e.slice(r,i);for(let d=0;d<l;++d)if(c[d]!==h[d]){s=c[d],u=h[d];break}return s<u?-1:u<s?1:0};function nr(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Pe(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=a.from(e,i)),a.isBuffer(e))return e.length===0?-1:Ze(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ze(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Ze(t,e,r,i,n){let o=1,s=t.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,r/=2}function l(h,d){return o===1?h[d]:h.readUInt16BE(d*o)}let c;if(n){let h=-1;for(c=r;c<s;c++)if(l(t,c)===l(e,h===-1?0:c-h)){if(h===-1&&(h=c),c-h+1===u)return h*o}else h!==-1&&(c-=c-h),h=-1}else for(r+u>s&&(r=s-u),c=r;c>=0;c--){let h=!0;for(let d=0;d<u;d++)if(l(t,c+d)!==l(e,d)){h=!1;break}if(h)return c}return-1}a.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};a.prototype.indexOf=function(e,r,i){return nr(this,e,r,i,!0)};a.prototype.lastIndexOf=function(e,r,i){return nr(this,e,r,i,!1)};function Qr(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=e.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let u=parseInt(e.substr(s*2,2),16);if(Pe(u))return s;t[r+s]=u}return s}function Vr(t,e,r,i){return fe(ke(e,t.length-r),t,r,i)}function Wr(t,e,r,i){return fe(at(e),t,r,i)}function Yr(t,e,r,i){return fe(hr(e),t,r,i)}function Xr(t,e,r,i){return fe(ut(e,t.length-r),t,r,i)}a.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return Qr(this,e,r,i);case"utf8":case"utf-8":return Vr(this,e,r,i);case"ascii":case"latin1":case"binary":return Wr(this,e,r,i);case"base64":return Yr(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xr(this,e,r,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Zr(t,e,r){return e===0&&r===t.length?Ce.fromByteArray(t):Ce.fromByteArray(t.slice(e,r))}function or(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let o=t[n],s=null,u=o>239?4:o>223?3:o>191?2:1;if(n+u<=r){let l,c,h,d;switch(u){case 1:o<128&&(s=o);break;case 2:l=t[n+1],(l&192)===128&&(d=(o&31)<<6|l&63,d>127&&(s=d));break;case 3:l=t[n+1],c=t[n+2],(l&192)===128&&(c&192)===128&&(d=(o&15)<<12|(l&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:l=t[n+1],c=t[n+2],h=t[n+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(d=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=u}return vr(i)}var ve=4096;function vr(t){let e=t.length;if(e<=ve)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ve));return r}function et(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function rt(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function tt(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=e;o<r;++o)n+=lt[t[o]];return n}function it(t,e,r){let i=t.slice(e,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}a.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,a.prototype),n};function y(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=this[e],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[e+s]*o;return n};a.prototype.readUintBE=a.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=this[e+--r],o=1;for(;r>0&&(o*=256);)n+=this[e+--r]*o;return n};a.prototype.readUint8=a.prototype.readUInt8=function(e,r){return e=e>>>0,r||y(e,1,this.length),this[e]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||y(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||y(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||y(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readBigUInt64LE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});a.prototype.readBigUInt64BE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});a.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=this[e],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};a.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=r,o=1,s=this[e+--n];for(;n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};a.prototype.readInt8=function(e,r){return e=e>>>0,r||y(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,r){e=e>>>0,r||y(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(e,r){e=e>>>0,r||y(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(e,r){return e=e>>>0,r||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,r){return e=e>>>0,r||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readBigInt64LE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});a.prototype.readBigInt64BE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});a.prototype.readFloatLE=function(e,r){return e=e>>>0,r||y(e,4,this.length),G.read(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,r){return e=e>>>0,r||y(e,4,this.length),G.read(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||y(e,8,this.length),G.read(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||y(e,8,this.length),G.read(this,e,!1,52,8)};function M(t,e,r,i,n,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;M(this,e,r,i,u,0)}let o=1,s=0;for(this[r]=e&255;++s<i&&(o*=256);)this[r+s]=e/o&255;return r+i};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;M(this,e,r,i,u,0)}let o=i-1,s=1;for(this[r+o]=e&255;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+i};a.prototype.writeUint8=a.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,1,255,0),this[r]=e&255,r+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function sr(t,e,r,i,n){dr(e,i,n,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function ar(t,e,r,i,n){dr(e,i,n,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o=o>>8,t[r+6]=o,o=o>>8,t[r+5]=o,o=o>>8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}a.prototype.writeBigUInt64LE=q(function(e,r=0){return sr(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeBigUInt64BE=q(function(e,r=0){return ar(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);M(this,e,r,i,l-1,-l)}let o=0,s=1,u=0;for(this[r]=e&255;++o<i&&(s*=256);)e<0&&u===0&&this[r+o-1]!==0&&(u=1),this[r+o]=(e/s>>0)-u&255;return r+i};a.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);M(this,e,r,i,l-1,-l)}let o=i-1,s=1,u=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/s>>0)-u&255;return r+i};a.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};a.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};a.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};a.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};a.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};a.prototype.writeBigInt64LE=q(function(e,r=0){return sr(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});a.prototype.writeBigInt64BE=q(function(e,r=0){return ar(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ur(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function lr(t,e,r,i,n){return e=+e,r=r>>>0,n||ur(t,e,r,4,34028234663852886e22,-34028234663852886e22),G.write(t,e,r,i,23,4),r+4}a.prototype.writeFloatLE=function(e,r,i){return lr(this,e,r,!0,i)};a.prototype.writeFloatBE=function(e,r,i){return lr(this,e,r,!1,i)};function cr(t,e,r,i,n){return e=+e,r=r>>>0,n||ur(t,e,r,8,17976931348623157e292,-17976931348623157e292),G.write(t,e,r,i,52,8),r+8}a.prototype.writeDoubleLE=function(e,r,i){return cr(this,e,r,!0,i)};a.prototype.writeDoubleBE=function(e,r,i){return cr(this,e,r,!1,i)};a.prototype.copy=function(e,r,i,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let o=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),o};a.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let s=e.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o<i;++o)this[o]=e;else{let s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(u===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=s[o%u]}return this};var z={};function Ne(t,e,r){z[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Ne("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Ne("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Ne("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=er(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=er(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function er(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function nt(t,e,r){J(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&W(e,t.length-(r+1))}function dr(t,e,r,i,n,o){if(t>r||t<e){let s=typeof e=="bigint"?"n":"",u;throw o>3?e===0||e===BigInt(0)?u=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:u=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:u=`>= ${e}${s} and <= ${r}${s}`,new z.ERR_OUT_OF_RANGE("value",u,t)}nt(i,n,o)}function J(t,e){if(typeof t!="number")throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,r){throw Math.floor(t)!==t?(J(t,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new z.ERR_BUFFER_OUT_OF_BOUNDS:new z.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ot=/[^+/0-9A-Za-z-_]/g;function st(t){if(t=t.split("=")[0],t=t.trim().replace(ot,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ke(t,e){e=e||1/0;let r,i=t.length,n=null,o=[];for(let s=0;s<i;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function at(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function ut(t,e){let r,i,n,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function hr(t){return Ce.toByteArray(st(t))}function fe(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function U(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Pe(t){return t!==t}var lt=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function q(t){return typeof BigInt>"u"?ct:t}function ct(){throw new Error("BigInt not supported")}});var Ct={};Ke(Ct,{ClientBuilder:()=>ae,Process:()=>Ie,createAuthForAnonymousSessionFlow:()=>Y,createAuthForClientCredentialsFlow:()=>X,createAuthForPasswordFlow:()=>v,createAuthForRefreshTokenFlow:()=>ee,createAuthWithExistingToken:()=>Z,createClient:()=>H,createCorrelationIdMiddleware:()=>re,createHttpClient:()=>ie,createLoggerMiddleware:()=>ne,createQueueMiddleware:()=>oe,createUserAgentMiddleware:()=>se,getErrorByCode:()=>te});function ze(t){return typeof t<"u"&&t!==null}function Cr(t){return ze(t)?typeof t=="string"?t:Object.fromEntries(Object.entries(t).filter(([e,r])=>![null,void 0,""].includes(r))):""}function br(t){let e={},r=new URLSearchParams(t);for(let i of r.keys())r.getAll(i).length>1?e[i]=r.getAll(i):e[i]=r.get(i);return e}function Ur(t){if(t=Cr(t),!t)return"";let e=new URLSearchParams(t);for(let[r,i]of Object.entries(t))Array.isArray(i)&&(e.delete(r),i.filter(ze).forEach(n=>e.append(r,n)));return e.toString()}function Re(t,e=br){return e(t)}function le(t,e=Ur){return e(t)}var Ge=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];function ce(t,e,r={allowedMethods:Ge}){if(!e)throw new Error(`The "${t}" function requires a "Request" object as an argument. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(typeof e.uri!="string")throw new Error(`The "${t}" Request object requires a valid uri. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(!r.allowedMethods.includes(e.method))throw new Error(`The "${t}" Request object requires a valid method. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`)}var Je,kr=20;function Sr(...t){return t=t.filter(e=>typeof e=="function"),t.length===1?t[0]:t.reduce((e,r)=>(...i)=>e(r(...i)))}function Ie(t,e,r){if(ce("process",t,{allowedMethods:["GET"]}),typeof e!="function")throw new Error('The "process" function accepts a "Function" as a second argument that returns a Promise. See https://commercetools.github.io/nodejs/sdk/api/sdkClient.html#processrequest-processfn-options');let i={limit:kr,total:Number.POSITIVE_INFINITY,accumulate:!0,...r};return new Promise((n,o)=>{let s,u="";if(t&&t.uri){let[p,g]=t.uri.split("?");s=p,u=g}let l={...Re(u)},c={limit:i.limit,...l},h=!1,d=i.total,f=async(p,g=[])=>{let k=c.limit<d?c.limit:d,L=le({...c,limit:k}),_={sort:i.sort||"id asc",withTotal:!1,...p?{where:`id > "${p}"`}:{}},I=le(_),w={...t,uri:`${s}?${I}&${L}`};try{let T=await H(Je).execute(w),{results:Ee,count:E}=T.body;if(!E&&h)return n(g||[]);let j=await Promise.resolve(e(T)),C=[];if(h=!0,i.accumulate&&(C=g.concat(j||[])),d-=E,E<c.limit||!d)return n(C||[]);let m=Ee[E-1],$=m&&m.id;f($,C)}catch(T){o(T)}};f()})}function H(t){if(Je=t,!t)throw new Error("Missing required options");if(t.middlewares&&!Array.isArray(t.middlewares))throw new Error("Middlewares should be an array");if(!t.middlewares||!Array.isArray(t.middlewares)||!t.middlewares.length)throw new Error("You need to provide at least one middleware");return{process:Ie,execute(e){return ce("exec",e),new Promise((r,i)=>{let n=(s,u)=>{if(u.error)u.reject(u.error);else{let l={body:u.body||{},statusCode:u.statusCode};u.headers&&(l.headers=u.headers),u.request&&(l.request=u.request),u.resolve(l)}};Sr(...t.middlewares)(n)(e,{resolve:r,reject:i,body:void 0,error:void 0})})}}}var Le={};Ke(Le,{createAuthMiddlewareForAnonymousSessionFlow:()=>Y,createAuthMiddlewareForClientCredentialsFlow:()=>X,createAuthMiddlewareForPasswordFlow:()=>v,createAuthMiddlewareForRefreshTokenFlow:()=>ee,createAuthMiddlewareWithExistingToken:()=>Z});var we=Be(pe());function je(t){if(!t)throw new Error("Missing required options");if(!t.host)throw new Error("Missing required option (host)");if(!t.projectKey)throw new Error("Missing required option (projectKey)");if(!t.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:r}=t.credentials;if(!(e&&r))throw new Error("Missing required credentials (clientId, clientSecret)");let i=t.scopes?t.scopes.join(" "):void 0,n=we.Buffer.from(`${e}:${r}`).toString("base64"),o=t.oauthUri||"/oauth/token",s=t.host.replace(/\/$/,"")+o,u=`grant_type=client_credentials${i?`&scope=${i}`:""}`;return{basicAuth:n,url:s,body:u}}function fr(t){if(!t)throw new Error("Missing required options");if(!t.host)throw new Error("Missing required option (host)");if(!t.projectKey)throw new Error("Missing required option (projectKey)");if(!t.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:r,user:i}=t.credentials,n=t.projectKey;if(!(e&&r&&i))throw new Error("Missing required credentials (clientId, clientSecret, user)");let{username:o,password:s}=i;if(!(o&&s))throw new Error("Missing required user credentials (username, password)");let u=(t.scopes||[]).join(" "),l=u?`&scope=${u}`:"",c=we.Buffer.from(`${e}:${r}`).toString("base64"),h=t.oauthUri||`/oauth/${n}/customers/token`,d=t.host.replace(/\/$/,"")+h,f=`grant_type=password&username=${encodeURIComponent(o)}&password=${encodeURIComponent(s)}${l}`;return{basicAuth:c,url:d,body:f}}function me(t){if(!t)throw new Error("Missing required options");if(!t.host)throw new Error("Missing required option (host)");if(!t.projectKey)throw new Error("Missing required option (projectKey)");if(!t.credentials)throw new Error("Missing required option (credentials)");if(!t.refreshToken)throw new Error("Missing required option (refreshToken)");let{clientId:e,clientSecret:r}=t.credentials;if(!(e&&r))throw new Error("Missing required credentials (clientId, clientSecret)");let i=we.Buffer.from(`${e}:${r}`).toString("base64"),n=t.oauthUri||"/oauth/token",o=t.host.replace(/\/$/,"")+n,s=`grant_type=refresh_token&refresh_token=${encodeURIComponent(t.refreshToken)}`;return{basicAuth:i,url:o,body:s}}function pr(t){if(!t)throw new Error("Missing required options");if(!t.projectKey)throw new Error("Missing required option (projectKey)");let e=t.projectKey;t.oauthUri=t.oauthUri||`/oauth/${e}/anonymous/token`;let r=je(t);return t.credentials.anonymousId&&(r.body+=`&anonymous_id=${t.credentials.anonymousId}`),{...r}}var mr=Be(pe());function yr(t,e){return{...e,headers:{...e.headers,Authorization:`Bearer ${t}`}}}function dt(t){return Date.now()+t*1e3-5*60*1e3}async function wr({fetcher:t,url:e,basicAuth:r,body:i,tokenCache:n,requestState:o,pendingTasks:s,response:u,tokenCacheKey:l}){try{let c=await t(e,{method:"POST",headers:{Authorization:`Basic ${r}`,"Content-Length":mr.Buffer.byteLength(i).toString(),"Content-Type":"application/x-www-form-urlencoded"},body:i});if(c.ok){let{access_token:p,expires_in:g,refresh_token:k}=await c.json(),L=dt(g);n.set({token:p,expirationTime:L,refreshToken:k},l),o.set(!1);let _=s.slice();s=[],_.forEach(I=>{let w=yr(p,I.request);I.next(w,I.response)});return}let h,d=await c.text();try{h=JSON.parse(d)}catch{}let f=new Error(h?h.message:d);h&&(f.body=h),o.set(!1),u.reject(f)}catch(c){o.set(!1),u&&typeof u.reject=="function"&&u.reject(c)}}function N({request:t,response:e,url:r,basicAuth:i,body:n,pendingTasks:o,requestState:s,tokenCache:u,tokenCacheKey:l,fetch:c},h,d){if(!c&&typeof fetch>"u")throw new Error("`fetch` is not available. Please pass in `fetch` as an option or have it globally available.");if(c||(c=fetch),t.headers&&t.headers.authorization||t.headers&&t.headers.Authorization){h(t,e);return}let f=u.get(l);if(f&&f.token&&Date.now()<f.expirationTime){let p=yr(f.token,t);h(p,e);return}if(o.push({request:t,response:e,next:h}),!s.get()){if(s.set(!0),f&&f.refreshToken&&(!f.token||f.token&&Date.now()>f.expirationTime)){if(!d)throw new Error("Missing required options");wr({fetcher:c,...me({...d,refreshToken:f.refreshToken}),tokenCacheKey:l,tokenCache:u,requestState:s,pendingTasks:o,response:e});return}wr({fetcher:c,url:r,basicAuth:i,body:n,tokenCacheKey:l,tokenCache:u,requestState:s,pendingTasks:o,response:e})}}function A(t){let e=t;return{get:r=>e,set:(r,i)=>{e=r}}}function Y(t){let e=t.tokenCache||A({token:"",expirationTime:-1}),r=[],i=A(!1);return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...pr(t),pendingTasks:r,requestState:i,tokenCache:e,fetch:t.fetch};N(u,n,t)}}function qe(t){return{clientId:t.credentials.clientId,host:t.host,projectKey:t.projectKey}}function X(t){let e=t.tokenCache||A({token:"",expirationTime:-1}),r=A(!1),i=[];return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...je(t),pendingTasks:i,requestState:r,tokenCache:e,tokenCacheKey:qe(t),fetch:t.fetch};N(u,n)}}function Z(t="",e={}){return r=>(i,n)=>{if(typeof t!="string")throw new Error("authorization must be a string");let o=e.force===void 0?!0:e.force;if(!t||(i.headers&&i.headers.authorization||i.headers&&i.headers.Authorization)&&o===!1)return r(i,n);let s={...i,headers:{...i.headers,Authorization:t}};return r(s,n)}}function v(t){let e=t.tokenCache||A({}),r=[],i=A(!1);return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...fr(t),pendingTasks:r,requestState:i,tokenCache:e,fetch:t.fetch};N(u,n,t)}}function ee(t){let e=t.tokenCache||A({token:"",expirationTime:-1}),r=[],i=A(!1);return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...me(t),pendingTasks:r,requestState:i,tokenCache:e,fetch:t.fetch};N(u,n)}}function re(t){return e=>(r,i)=>{let n={...r,headers:{...r.headers,"X-Correlation-ID":t.generate()}};e(n,i)}}var Mr=Be(pe());function P(t,e,r={}){this.status=this.statusCode=this.code=t,this.message=e,Object.assign(this,r),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function ye(...t){P.call(this,0,...t)}function gr(...t){P.call(this,...t)}function ht(...t){P.call(this,400,...t)}function ft(...t){P.call(this,401,...t)}function pt(...t){P.call(this,403,...t)}function wt(...t){P.call(this,404,...t)}function mt(...t){P.call(this,409,...t)}function yt(...t){P.call(this,500,...t)}function gt(...t){P.call(this,503,...t)}function te(t){switch(t){case 0:return ye;case 400:return ht;case 401:return ft;case 403:return pt;case 404:return wt;case 409:return mt;case 500:return yt;case 503:return gt;default:return}}function ge(t){if(t.raw)return t.raw();if(!t.forEach)return{};let e={};return t.forEach((r,i)=>{e[i]=r}),e}function xr(t){return t!=null&&t.constructor!=null&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function xt({statusCode:t,message:e,...r}){let i=e||"Unexpected non-JSON error response";t===404&&(i=`URI not found: ${r.originalRequest?.uri||r.uri}`,delete r.uri);let n=te(t);return n?new n(i,r):new gr(t,i,r)}function xe(t,e,r,i,n){return i&&t!==0?Math.min(Math.round((Math.random()+1)*e*2**t),n):e}function Me(t,e){e&&(t&&t.headers&&t.headers.authorization&&(t.headers.authorization="Bearer ********"),t&&t.headers&&t.headers.Authorization&&(t.headers.Authorization="Bearer ********"))}function ie({host:t,credentialsMode:e,includeResponseHeaders:r,includeOriginalRequest:i,includeRequestInErrorResponse:n=!0,maskSensitiveHeaderData:o=!0,headersWithStringBody:s=[],enableRetry:u,timeout:l,retryConfig:{maxRetries:c=10,backoff:h=!0,retryDelay:d=200,maxDelay:f=1/0,retryOnAbort:p=!1,retryCodes:g=[503]}={},fetch:k,getAbortController:L}){if(!k)throw new Error("`fetch` is not available. Please pass in `fetch` as an option or have it globally available.");if(l&&!L)throw new Error("`AbortController` is not available. Please pass in `getAbortController` as an option or have AbortController globally available when using timeout.");let _;if(k?_=k:_=fetch,!Array.isArray(g))throw new Error("`retryCodes` option must be an array of retry status (error) codes.");if(!Array.isArray(s))throw new Error("`headersWithStringBody` option must be an array of strings");return I=>(w,T)=>{let Ee=t.replace(/\/$/,"")+w.uri,E={...w.headers};Object.prototype.hasOwnProperty.call(E,"Content-Type")||Object.prototype.hasOwnProperty.call(E,"content-type")||(E["Content-Type"]="application/json"),E["Content-Type"]===null&&delete E["Content-Type"];let j=["application/json","application/graphql",...s].indexOf(E["Content-Type"])>-1&&typeof w.body=="string"||xr(w.body)?w.body:JSON.stringify(w.body||void 0);j&&(typeof j=="string"||xr(j))&&(E["Content-Length"]=Mr.Buffer.byteLength(j).toString());let C={method:w.method,headers:E};e&&(C.credentialsMode=e),j&&(C.body=j);let m=0;function $(){let $e,V;l&&(V=(L?L():null)||new AbortController,C.signal=V.signal,$e=setTimeout(()=>{V.abort()},l)),_(Ee,C).then(B=>{if(B.ok){if(C.method==="HEAD"){I(w,{...T,statusCode:B.status});return}B.text().then(F=>{let x;try{x=F.length>0?JSON.parse(F):{}}catch{if(u&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}x=F}let S={...T,body:x,statusCode:B.status};r&&(S.headers=ge(B.headers)),i&&(S.request={...C},Me(S.request,o)),I(w,S)}).catch(F=>{if(u&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}let x=new ye(F.message,{...n?{originalRequest:w}:{},retryCount:m});Me(x.originalRequest,o),I(w,{...T,error:x,statusCode:0})});return}B.text().then(F=>{let x;try{x=JSON.parse(F)}catch{x=F}let S=xt({statusCode:B.status,...n?{originalRequest:w}:B.status===404?{uri:w.uri}:{},retryCount:m,headers:ge(B.headers),...typeof x=="object"?{message:x.message,body:x}:{message:x,body:x}});if(u&&(g.indexOf(S.statusCode)!==-1||g?.indexOf(S.message)!==-1)&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}Me(S.originalRequest,o);let De={...T,error:S,statusCode:B.status};I(w,De)})},B=>{if(u&&(p||!V||!V.signal)&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}let F=new ye(B.message,{...n?{originalRequest:w}:{},retryCount:m});Me(F.originalRequest,o),I(w,{...T,error:F,statusCode:0})}).finally(()=>{clearTimeout($e)})}$()}}function ne(){return t=>(e,r)=>{let{error:i,body:n,statusCode:o}=r;console.log("Request: ",e),console.log("Response: ",{error:i,body:n,statusCode:o}),t(e,r)}}function oe({concurrency:t=20}){let e=[],r=0,i=n=>{if(r-=1,e.length&&r<=t){let o=e.shift();r+=1,n(o.request,o.response)}};return n=>(o,s)=>{let u={...s,resolve(l){s.resolve(l),i(n)},reject(l){s.reject(l),i(n)}};if(e.push({request:o,response:u}),r<t){let l=e.shift();r+=1,n(l.request,l.response)}}}var Er={name:"@commercetools/sdk-client-v2",version:"3.0.0",engines:{node:">=18"},description:"commercetools Composable Commerce TypeScript SDK client.",keywords:["commercetools","composable commerce","sdk","typescript","client","middleware","http","oauth","auth"],homepage:"https://github.com/commercetools/commercetools-sdk-typescript",license:"MIT",directories:{lib:"lib",test:"test"},publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/commercetools/commercetools-sdk-typescript.git"},bugs:{url:"https://github.com/commercetools/commercetools-sdk-typescript/issues"},dependencies:{buffer:"^6.0.3"},files:["dist","CHANGELOG.md"],author:"Chukwuemeka Ajima <meeky.ae@gmail.com>",main:"dist/commercetools-sdk-client-v2.cjs.js",module:"dist/commercetools-sdk-client-v2.esm.js",browser:{"./dist/commercetools-sdk-client-v2.cjs.js":"./dist/commercetools-sdk-client-v2.browser.cjs.js","./dist/commercetools-sdk-client-v2.esm.js":"./dist/commercetools-sdk-client-v2.browser.esm.js"},devDependencies:{"common-tags":"1.8.2",dotenv:"16.4.5",jest:"29.7.0",nock:"^14.0.0-beta.19","organize-imports-cli":"0.10.0"},scripts:{organize_imports:"find src -type f -name '*.ts' | xargs organize-imports-cli",postbuild:"yarn organize_imports",post_process_generate:"yarn organize_imports",docs:"typedoc --out docs"}};var Et=()=>typeof window<"u"&&window.document&&window.document.nodeType===9;function At(){return Et()?window.navigator.userAgent:`node.js/${process?.version.slice(1)||"12"}`}function _e(t){if(!t||Object.keys(t).length===0||!{}.hasOwnProperty.call(t,"name"))throw new Error("Missing required option `name`");let e=t.version?`${t.name}/${t.version}`:t.name,r=null;t.libraryName&&!t.libraryVersion?r=t.libraryName:t.libraryName&&t.libraryVersion&&(r=`${t.libraryName}/${t.libraryVersion}`);let i=null;t.contactUrl&&!t.contactEmail?i=`(+${t.contactUrl})`:!t.contactUrl&&t.contactEmail?i=`(+${t.contactEmail})`:t.contactUrl&&t.contactEmail&&(i=`(+${t.contactUrl}; +${t.contactEmail})`);let n=At(),o=t.customAgent||"";return[e,n,r,i,o].filter(Boolean).join(" ")}function se(t){let e=_e({...t,name:`commercetools-sdk-javascript-v2/${Er.version}`});return r=>(i,n)=>{let o={...i,headers:{...i.headers,"User-Agent":e}};r(o,n)}}var{createAuthMiddlewareForPasswordFlow:Bt,createAuthMiddlewareForAnonymousSessionFlow:Rt,createAuthMiddlewareForClientCredentialsFlow:It,createAuthMiddlewareForRefreshTokenFlow:Ft,createAuthMiddlewareWithExistingToken:Tt}=Le,ae=class{projectKey;authMiddleware;httpMiddleware;userAgentMiddleware;correlationIdMiddleware;loggerMiddleware;queueMiddleware;telemetryMiddleware;beforeMiddleware;afterMiddleware;middlewares=[];withProjectKey(e){return this.projectKey=e,this}defaultClient(e,r,i,n){return this.withClientCredentialsFlow({host:i,projectKey:n||this.projectKey,credentials:r}).withHttpMiddleware({host:e,fetch}).withLoggerMiddleware().withUserAgentMiddleware()}withAuthMiddleware(e){return this.authMiddleware=e,this}withMiddleware(e){return this.middlewares.push(e),this}withClientCredentialsFlow(e){return this.withAuthMiddleware(It({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||""},oauthUri:e.oauthUri||"",scopes:e.scopes,fetch:e.fetch||fetch,...e}))}withPasswordFlow(e){return this.withAuthMiddleware(Bt({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||"",user:{username:e.credentials.user.username||"",password:e.credentials.user.password||""}},fetch:e.fetch||fetch,...e}))}withAnonymousSessionFlow(e){return this.withAuthMiddleware(Rt({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||"",anonymousId:e.credentials.anonymousId||""},fetch:e.fetch||fetch,...e}))}withRefreshTokenFlow(e){return this.withAuthMiddleware(Ft({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||""},fetch:e.fetch||fetch,refreshToken:e.refreshToken||"",...e}))}withExistingTokenFlow(e,r){return this.withAuthMiddleware(Tt(e,{force:r.force||!0,...r}))}withHttpMiddleware(e){return this.httpMiddleware=ie({host:e.host||"https://api.europe-west1.gcp.commercetools.com",fetch:e.fetch||fetch,...e}),this}withUserAgentMiddleware(e){return this.userAgentMiddleware=se(e),this}withQueueMiddleware(e){return this.queueMiddleware=oe({concurrency:e.concurrency||20,...e}),this}withLoggerMiddleware(e){let{logger:r,...i}=e||{};return this.loggerMiddleware=typeof e?.logger=="function"&&e.logger(i)||ne(),this}withCorrelationIdMiddleware(e){return this.correlationIdMiddleware=re({generate:e.generate||null,...e}),this}withTelemetryMiddleware(e){let{createTelemetryMiddleware:r,...i}=e;return this.withUserAgentMiddleware({customAgent:i?.userAgent||"typescript-sdk-apm-middleware"}),this.telemetryMiddleware=r(i),this}withBeforeExecutionMiddleware(e){let{middleware:r,...i}=e||{};return this.beforeMiddleware=e.middleware(i),this}withAfterExecutionMiddleware(e){let{middleware:r,...i}=e||{};return this.afterMiddleware=e.middleware(i),this}build(){let e=this.middlewares.slice();return this.telemetryMiddleware&&e.push(this.telemetryMiddleware),this.correlationIdMiddleware&&e.push(this.correlationIdMiddleware),this.userAgentMiddleware&&e.push(this.userAgentMiddleware),this.authMiddleware&&e.push(this.authMiddleware),this.beforeMiddleware&&e.push(this.beforeMiddleware),this.queueMiddleware&&e.push(this.queueMiddleware),this.httpMiddleware&&e.push(this.httpMiddleware),this.afterMiddleware&&e.push(this.afterMiddleware),this.loggerMiddleware&&e.push(this.loggerMiddleware),H({middlewares:e})}};return Tr(Ct);})();
|
|
1
|
+
var window;(window||={})["@commercetools/sdk-client-v2"]=(()=>{var Ar=Object.create;var ue=Object.defineProperty;var Br=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames;var Ir=Object.getPrototypeOf,Fr=Object.prototype.hasOwnProperty;var Ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ke=(t,e)=>{for(var r in e)ue(t,r,{get:e[r],enumerable:!0})},He=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rr(e))!Fr.call(t,n)&&n!==r&&ue(t,n,{get:()=>e[n],enumerable:!(i=Br(e,n))||i.enumerable});return t};var Be=(t,e,r)=>(r=t!=null?Ar(Ir(t)):{},He(e||!t||!t.__esModule?ue(r,"default",{value:t,enumerable:!0}):r,t)),Tr=t=>He(ue({},"__esModule",{value:!0}),t);var We=Ae(de=>{"use strict";de.byteLength=Nr;de.toByteArray=jr;de.fromByteArray=_r;var U=[],R=[],Or=typeof Uint8Array<"u"?Uint8Array:Array,Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(D=0,Qe=Fe.length;D<Qe;++D)U[D]=Fe[D],R[Fe.charCodeAt(D)]=D;var D,Qe;R[45]=62;R[95]=63;function Ve(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Nr(t){var e=Ve(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Pr(t,e,r){return(e+r)*3/4-r}function jr(t){var e,r=Ve(t),i=r[0],n=r[1],o=new Or(Pr(t,i,n)),s=0,u=n>0?i-4:i,l;for(l=0;l<u;l+=4)e=R[t.charCodeAt(l)]<<18|R[t.charCodeAt(l+1)]<<12|R[t.charCodeAt(l+2)]<<6|R[t.charCodeAt(l+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return n===2&&(e=R[t.charCodeAt(l)]<<2|R[t.charCodeAt(l+1)]>>4,o[s++]=e&255),n===1&&(e=R[t.charCodeAt(l)]<<10|R[t.charCodeAt(l+1)]<<4|R[t.charCodeAt(l+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function qr(t){return U[t>>18&63]+U[t>>12&63]+U[t>>6&63]+U[t&63]}function Lr(t,e,r){for(var i,n=[],o=e;o<r;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),n.push(qr(i));return n.join("")}function _r(t){for(var e,r=t.length,i=r%3,n=[],o=16383,s=0,u=r-i;s<u;s+=o)n.push(Lr(t,s,s+o>u?u:s+o));return i===1?(e=t[r-1],n.push(U[e>>2]+U[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(U[e>>10]+U[e>>4&63]+U[e<<2&63]+"=")),n.join("")}});var Ye=Ae(Te=>{Te.read=function(t,e,r,i,n){var o,s,u=n*8-i-1,l=(1<<u)-1,c=l>>1,h=-7,d=r?n-1:0,f=r?-1:1,p=t[e+d];for(d+=f,o=p&(1<<-h)-1,p>>=-h,h+=u;h>0;o=o*256+t[e+d],d+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+t[e+d],d+=f,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-c}return(p?-1:1)*s*Math.pow(2,o-i)};Te.write=function(t,e,r,i,n,o){var s,u,l,c=o*8-n-1,h=(1<<c)-1,d=h>>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,g=i?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=f/l:e+=f*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=h?(u=0,s=h):s+d>=1?(u=(e*l-1)*Math.pow(2,n),s=s+d):(u=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+p]=u&255,p+=g,u/=256,n-=8);for(s=s<<n|u,c+=n;c>0;t[r+p]=s&255,p+=g,s/=256,c-=8);t[r+p-g]|=k*128}});var pe=Ae(Q=>{"use strict";var Ce=We(),G=Ye(),Xe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q.Buffer=a;Q.SlowBuffer=Gr;Q.INSPECT_MAX_BYTES=50;var he=2147483647;Q.kMaxLength=he;a.TYPED_ARRAY_SUPPORT=$r();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function $r(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function O(t){if(t>he)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Se(t)}return rr(t,e,r)}a.poolSize=8192;function rr(t,e,r){if(typeof t=="string")return Kr(t,e);if(ArrayBuffer.isView(t))return Hr(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(b(t,ArrayBuffer)||t&&b(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(b(t,SharedArrayBuffer)||t&&b(t.buffer,SharedArrayBuffer)))return be(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return a.from(i,e,r);let n=zr(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}a.from=function(t,e,r){return rr(t,e,r)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function tr(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Dr(t,e,r){return tr(t),t<=0?O(t):e!==void 0?typeof r=="string"?O(t).fill(e,r):O(t).fill(e):O(t)}a.alloc=function(t,e,r){return Dr(t,e,r)};function Se(t){return tr(t),O(t<0?0:Oe(t)|0)}a.allocUnsafe=function(t){return Se(t)};a.allocUnsafeSlow=function(t){return Se(t)};function Kr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ir(t,e)|0,i=O(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function Ue(t){let e=t.length<0?0:Oe(t.length)|0,r=O(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Hr(t){if(b(t,Uint8Array)){let e=new Uint8Array(t);return be(e.buffer,e.byteOffset,e.byteLength)}return Ue(t)}function be(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,a.prototype),i}function zr(t){if(a.isBuffer(t)){let e=Oe(t.length)|0,r=O(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Pe(t.length)?O(0):Ue(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ue(t.data)}function Oe(t){if(t>=he)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+he.toString(16)+" bytes");return t|0}function Gr(t){return+t!=t&&(t=0),a.alloc(+t)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype};a.compare=function(e,r){if(b(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),b(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(e)||!a.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(e[o]!==r[o]){i=e[o],n=r[o];break}return i<n?-1:n<i?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=a.allocUnsafe(r),o=0;for(i=0;i<e.length;++i){let s=e[i];if(b(s,Uint8Array))o+s.length>n.length?(a.isBuffer(s)||(s=a.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(a.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function ir(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||b(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ke(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return hr(t).length;default:if(n)return i?-1:ke(t).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=ir;function Jr(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return tt(this,e,r);case"utf8":case"utf-8":return or(this,e,r);case"ascii":return et(this,e,r);case"latin1":case"binary":return rt(this,e,r);case"base64":return Zr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return it(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}a.prototype._isBuffer=!0;function K(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)K(this,r,r+1);return this};a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)K(this,r,r+3),K(this,r+1,r+2);return this};a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)K(this,r,r+7),K(this,r+1,r+6),K(this,r+2,r+5),K(this,r+3,r+4);return this};a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?or(this,0,e):Jr.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.inspect=function(){let e="",r=Q.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Xe&&(a.prototype[Xe]=a.prototype.inspect);a.prototype.compare=function(e,r,i,n,o){if(b(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;let s=o-n,u=i-r,l=Math.min(s,u),c=this.slice(n,o),h=e.slice(r,i);for(let d=0;d<l;++d)if(c[d]!==h[d]){s=c[d],u=h[d];break}return s<u?-1:u<s?1:0};function nr(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Pe(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=a.from(e,i)),a.isBuffer(e))return e.length===0?-1:Ze(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ze(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Ze(t,e,r,i,n){let o=1,s=t.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,r/=2}function l(h,d){return o===1?h[d]:h.readUInt16BE(d*o)}let c;if(n){let h=-1;for(c=r;c<s;c++)if(l(t,c)===l(e,h===-1?0:c-h)){if(h===-1&&(h=c),c-h+1===u)return h*o}else h!==-1&&(c-=c-h),h=-1}else for(r+u>s&&(r=s-u),c=r;c>=0;c--){let h=!0;for(let d=0;d<u;d++)if(l(t,c+d)!==l(e,d)){h=!1;break}if(h)return c}return-1}a.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};a.prototype.indexOf=function(e,r,i){return nr(this,e,r,i,!0)};a.prototype.lastIndexOf=function(e,r,i){return nr(this,e,r,i,!1)};function Qr(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=e.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let u=parseInt(e.substr(s*2,2),16);if(Pe(u))return s;t[r+s]=u}return s}function Vr(t,e,r,i){return fe(ke(e,t.length-r),t,r,i)}function Wr(t,e,r,i){return fe(at(e),t,r,i)}function Yr(t,e,r,i){return fe(hr(e),t,r,i)}function Xr(t,e,r,i){return fe(ut(e,t.length-r),t,r,i)}a.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return Qr(this,e,r,i);case"utf8":case"utf-8":return Vr(this,e,r,i);case"ascii":case"latin1":case"binary":return Wr(this,e,r,i);case"base64":return Yr(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xr(this,e,r,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Zr(t,e,r){return e===0&&r===t.length?Ce.fromByteArray(t):Ce.fromByteArray(t.slice(e,r))}function or(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let o=t[n],s=null,u=o>239?4:o>223?3:o>191?2:1;if(n+u<=r){let l,c,h,d;switch(u){case 1:o<128&&(s=o);break;case 2:l=t[n+1],(l&192)===128&&(d=(o&31)<<6|l&63,d>127&&(s=d));break;case 3:l=t[n+1],c=t[n+2],(l&192)===128&&(c&192)===128&&(d=(o&15)<<12|(l&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:l=t[n+1],c=t[n+2],h=t[n+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(d=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=u}return vr(i)}var ve=4096;function vr(t){let e=t.length;if(e<=ve)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ve));return r}function et(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function rt(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function tt(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=e;o<r;++o)n+=lt[t[o]];return n}function it(t,e,r){let i=t.slice(e,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}a.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,a.prototype),n};function y(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=this[e],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[e+s]*o;return n};a.prototype.readUintBE=a.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=this[e+--r],o=1;for(;r>0&&(o*=256);)n+=this[e+--r]*o;return n};a.prototype.readUint8=a.prototype.readUInt8=function(e,r){return e=e>>>0,r||y(e,1,this.length),this[e]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||y(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||y(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||y(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readBigUInt64LE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});a.prototype.readBigUInt64BE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});a.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=this[e],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};a.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||y(e,r,this.length);let n=r,o=1,s=this[e+--n];for(;n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};a.prototype.readInt8=function(e,r){return e=e>>>0,r||y(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,r){e=e>>>0,r||y(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(e,r){e=e>>>0,r||y(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(e,r){return e=e>>>0,r||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,r){return e=e>>>0,r||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readBigInt64LE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});a.prototype.readBigInt64BE=q(function(e){e=e>>>0,J(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&W(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});a.prototype.readFloatLE=function(e,r){return e=e>>>0,r||y(e,4,this.length),G.read(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,r){return e=e>>>0,r||y(e,4,this.length),G.read(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||y(e,8,this.length),G.read(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||y(e,8,this.length),G.read(this,e,!1,52,8)};function M(t,e,r,i,n,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;M(this,e,r,i,u,0)}let o=1,s=0;for(this[r]=e&255;++s<i&&(o*=256);)this[r+s]=e/o&255;return r+i};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let u=Math.pow(2,8*i)-1;M(this,e,r,i,u,0)}let o=i-1,s=1;for(this[r+o]=e&255;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+i};a.prototype.writeUint8=a.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,1,255,0),this[r]=e&255,r+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function sr(t,e,r,i,n){dr(e,i,n,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function ar(t,e,r,i,n){dr(e,i,n,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o=o>>8,t[r+6]=o,o=o>>8,t[r+5]=o,o=o>>8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}a.prototype.writeBigUInt64LE=q(function(e,r=0){return sr(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeBigUInt64BE=q(function(e,r=0){return ar(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);M(this,e,r,i,l-1,-l)}let o=0,s=1,u=0;for(this[r]=e&255;++o<i&&(s*=256);)e<0&&u===0&&this[r+o-1]!==0&&(u=1),this[r+o]=(e/s>>0)-u&255;return r+i};a.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);M(this,e,r,i,l-1,-l)}let o=i-1,s=1,u=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/s>>0)-u&255;return r+i};a.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};a.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};a.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};a.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};a.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||M(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};a.prototype.writeBigInt64LE=q(function(e,r=0){return sr(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});a.prototype.writeBigInt64BE=q(function(e,r=0){return ar(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ur(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function lr(t,e,r,i,n){return e=+e,r=r>>>0,n||ur(t,e,r,4,34028234663852886e22,-34028234663852886e22),G.write(t,e,r,i,23,4),r+4}a.prototype.writeFloatLE=function(e,r,i){return lr(this,e,r,!0,i)};a.prototype.writeFloatBE=function(e,r,i){return lr(this,e,r,!1,i)};function cr(t,e,r,i,n){return e=+e,r=r>>>0,n||ur(t,e,r,8,17976931348623157e292,-17976931348623157e292),G.write(t,e,r,i,52,8),r+8}a.prototype.writeDoubleLE=function(e,r,i){return cr(this,e,r,!0,i)};a.prototype.writeDoubleBE=function(e,r,i){return cr(this,e,r,!1,i)};a.prototype.copy=function(e,r,i,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let o=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),o};a.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let s=e.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o<i;++o)this[o]=e;else{let s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(u===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=s[o%u]}return this};var z={};function Ne(t,e,r){z[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Ne("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Ne("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Ne("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=er(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=er(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function er(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function nt(t,e,r){J(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&W(e,t.length-(r+1))}function dr(t,e,r,i,n,o){if(t>r||t<e){let s=typeof e=="bigint"?"n":"",u;throw o>3?e===0||e===BigInt(0)?u=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:u=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:u=`>= ${e}${s} and <= ${r}${s}`,new z.ERR_OUT_OF_RANGE("value",u,t)}nt(i,n,o)}function J(t,e){if(typeof t!="number")throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,r){throw Math.floor(t)!==t?(J(t,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new z.ERR_BUFFER_OUT_OF_BOUNDS:new z.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ot=/[^+/0-9A-Za-z-_]/g;function st(t){if(t=t.split("=")[0],t=t.trim().replace(ot,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ke(t,e){e=e||1/0;let r,i=t.length,n=null,o=[];for(let s=0;s<i;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function at(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function ut(t,e){let r,i,n,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function hr(t){return Ce.toByteArray(st(t))}function fe(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function b(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Pe(t){return t!==t}var lt=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function q(t){return typeof BigInt>"u"?ct:t}function ct(){throw new Error("BigInt not supported")}});var Ct={};Ke(Ct,{ClientBuilder:()=>ae,Process:()=>Ie,createAuthForAnonymousSessionFlow:()=>Y,createAuthForClientCredentialsFlow:()=>X,createAuthForPasswordFlow:()=>v,createAuthForRefreshTokenFlow:()=>ee,createAuthWithExistingToken:()=>Z,createClient:()=>H,createCorrelationIdMiddleware:()=>re,createHttpClient:()=>ie,createLoggerMiddleware:()=>ne,createQueueMiddleware:()=>oe,createUserAgentMiddleware:()=>se,getErrorByCode:()=>te});function ze(t){return typeof t<"u"&&t!==null}function Cr(t){return ze(t)?typeof t=="string"?t:Object.fromEntries(Object.entries(t).filter(([e,r])=>![null,void 0,""].includes(r))):""}function Ur(t){let e={},r=new URLSearchParams(t);for(let i of r.keys())r.getAll(i).length>1?e[i]=r.getAll(i):e[i]=r.get(i);return e}function br(t){if(t=Cr(t),!t)return"";let e=new URLSearchParams(t);for(let[r,i]of Object.entries(t))Array.isArray(i)&&(e.delete(r),i.filter(ze).forEach(n=>e.append(r,n)));return e.toString()}function Re(t,e=Ur){return e(t)}function le(t,e=br){return e(t)}var Ge=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];function ce(t,e,r={allowedMethods:Ge}){if(!e)throw new Error(`The "${t}" function requires a "Request" object as an argument. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(typeof e.uri!="string")throw new Error(`The "${t}" Request object requires a valid uri. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(!r.allowedMethods.includes(e.method))throw new Error(`The "${t}" Request object requires a valid method. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`)}var Je,kr=20;function Sr(...t){return t=t.filter(e=>typeof e=="function"),t.length===1?t[0]:t.reduce((e,r)=>(...i)=>e(r(...i)))}function Ie(t,e,r){if(ce("process",t,{allowedMethods:["GET"]}),typeof e!="function")throw new Error('The "process" function accepts a "Function" as a second argument that returns a Promise. See https://commercetools.github.io/nodejs/sdk/api/sdkClient.html#processrequest-processfn-options');let i={limit:kr,total:Number.POSITIVE_INFINITY,accumulate:!0,...r};return new Promise((n,o)=>{let s,u="";if(t&&t.uri){let[p,g]=t.uri.split("?");s=p,u=g}let l={...Re(u)},c={limit:i.limit,...l},h=!1,d=i.total,f=async(p,g=[])=>{let k=c.limit<d?c.limit:d,L=le({...c,limit:k}),_={sort:i.sort||"id asc",withTotal:!1,...p?{where:`id > "${p}"`}:{}},I=le(_),w={...t,uri:`${s}?${I}&${L}`};try{let T=await H(Je).execute(w),{results:Ee,count:E}=T.body;if(!E&&h)return n(g||[]);let j=await Promise.resolve(e(T)),C=[];if(h=!0,i.accumulate&&(C=g.concat(j||[])),d-=E,E<c.limit||!d)return n(C||[]);let m=Ee[E-1],$=m&&m.id;f($,C)}catch(T){o(T)}};f()})}function H(t){if(Je=t,!t)throw new Error("Missing required options");if(t.middlewares&&!Array.isArray(t.middlewares))throw new Error("Middlewares should be an array");if(!t.middlewares||!Array.isArray(t.middlewares)||!t.middlewares.length)throw new Error("You need to provide at least one middleware");return{process:Ie,execute(e){return ce("exec",e),new Promise((r,i)=>{let n=(s,u)=>{if(u.error)u.reject(u.error);else{let l={body:u.body||{},statusCode:u.statusCode};u.headers&&(l.headers=u.headers),u.request&&(l.request=u.request),u.resolve(l)}};Sr(...t.middlewares)(n)(e,{resolve:r,reject:i,body:void 0,error:void 0})})}}}var Le={};Ke(Le,{createAuthMiddlewareForAnonymousSessionFlow:()=>Y,createAuthMiddlewareForClientCredentialsFlow:()=>X,createAuthMiddlewareForPasswordFlow:()=>v,createAuthMiddlewareForRefreshTokenFlow:()=>ee,createAuthMiddlewareWithExistingToken:()=>Z});var we=Be(pe());function je(t){if(!t)throw new Error("Missing required options");if(!t.host)throw new Error("Missing required option (host)");if(!t.projectKey)throw new Error("Missing required option (projectKey)");if(!t.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:r}=t.credentials;if(!(e&&r))throw new Error("Missing required credentials (clientId, clientSecret)");let i=t.scopes?t.scopes.join(" "):void 0,n=we.Buffer.from(`${e}:${r}`).toString("base64"),o=t.oauthUri||"/oauth/token",s=t.host.replace(/\/$/,"")+o,u=`grant_type=client_credentials${i?`&scope=${i}`:""}`;return{basicAuth:n,url:s,body:u}}function fr(t){if(!t)throw new Error("Missing required options");if(!t.host)throw new Error("Missing required option (host)");if(!t.projectKey)throw new Error("Missing required option (projectKey)");if(!t.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:r,user:i}=t.credentials,n=t.projectKey;if(!(e&&r&&i))throw new Error("Missing required credentials (clientId, clientSecret, user)");let{username:o,password:s}=i;if(!(o&&s))throw new Error("Missing required user credentials (username, password)");let u=(t.scopes||[]).join(" "),l=u?`&scope=${u}`:"",c=we.Buffer.from(`${e}:${r}`).toString("base64"),h=t.oauthUri||`/oauth/${n}/customers/token`,d=t.host.replace(/\/$/,"")+h,f=`grant_type=password&username=${encodeURIComponent(o)}&password=${encodeURIComponent(s)}${l}`;return{basicAuth:c,url:d,body:f}}function me(t){if(!t)throw new Error("Missing required options");if(!t.host)throw new Error("Missing required option (host)");if(!t.projectKey)throw new Error("Missing required option (projectKey)");if(!t.credentials)throw new Error("Missing required option (credentials)");if(!t.refreshToken)throw new Error("Missing required option (refreshToken)");let{clientId:e,clientSecret:r}=t.credentials;if(!(e&&r))throw new Error("Missing required credentials (clientId, clientSecret)");let i=we.Buffer.from(`${e}:${r}`).toString("base64"),n=t.oauthUri||"/oauth/token",o=t.host.replace(/\/$/,"")+n,s=`grant_type=refresh_token&refresh_token=${encodeURIComponent(t.refreshToken)}`;return{basicAuth:i,url:o,body:s}}function pr(t){if(!t)throw new Error("Missing required options");if(!t.projectKey)throw new Error("Missing required option (projectKey)");let e=t.projectKey;t.oauthUri=t.oauthUri||`/oauth/${e}/anonymous/token`;let r=je(t);return t.credentials.anonymousId&&(r.body+=`&anonymous_id=${t.credentials.anonymousId}`),{...r}}var mr=Be(pe());function yr(t,e){return{...e,headers:{...e.headers,Authorization:`Bearer ${t}`}}}function dt(t){return Date.now()+t*1e3-300*1e3}async function wr({fetcher:t,url:e,basicAuth:r,body:i,tokenCache:n,requestState:o,pendingTasks:s,response:u,tokenCacheKey:l}){try{let c=await t(e,{method:"POST",headers:{Authorization:`Basic ${r}`,"Content-Length":mr.Buffer.byteLength(i).toString(),"Content-Type":"application/x-www-form-urlencoded"},body:i});if(c.ok){let{access_token:p,expires_in:g,refresh_token:k}=await c.json(),L=dt(g);n.set({token:p,expirationTime:L,refreshToken:k},l),o.set(!1);let _=s.slice();s=[],_.forEach(I=>{let w=yr(p,I.request);I.next(w,I.response)});return}let h,d=await c.text();try{h=JSON.parse(d)}catch{}let f=new Error(h?h.message:d);h&&(f.body=h),o.set(!1),u.reject(f)}catch(c){o.set(!1),u&&typeof u.reject=="function"&&u.reject(c)}}function N({request:t,response:e,url:r,basicAuth:i,body:n,pendingTasks:o,requestState:s,tokenCache:u,tokenCacheKey:l,fetch:c},h,d){if(!c&&typeof fetch>"u")throw new Error("`fetch` is not available. Please pass in `fetch` as an option or have it globally available.");if(c||(c=fetch),t.headers&&t.headers.authorization||t.headers&&t.headers.Authorization){h(t,e);return}let f=u.get(l);if(f&&f.token&&Date.now()<f.expirationTime){let p=yr(f.token,t);h(p,e);return}if(o.push({request:t,response:e,next:h}),!s.get()){if(s.set(!0),f&&f.refreshToken&&(!f.token||f.token&&Date.now()>f.expirationTime)){if(!d)throw new Error("Missing required options");wr({fetcher:c,...me({...d,refreshToken:f.refreshToken}),tokenCacheKey:l,tokenCache:u,requestState:s,pendingTasks:o,response:e});return}wr({fetcher:c,url:r,basicAuth:i,body:n,tokenCacheKey:l,tokenCache:u,requestState:s,pendingTasks:o,response:e})}}function A(t){let e=t;return{get:r=>e,set:(r,i)=>{e=r}}}function Y(t){let e=t.tokenCache||A({token:"",expirationTime:-1}),r=[],i=A(!1);return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...pr(t),pendingTasks:r,requestState:i,tokenCache:e,fetch:t.fetch};N(u,n,t)}}function qe(t){return{clientId:t.credentials.clientId,host:t.host,projectKey:t.projectKey}}function X(t){let e=t.tokenCache||A({token:"",expirationTime:-1}),r=A(!1),i=[];return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...je(t),pendingTasks:i,requestState:r,tokenCache:e,tokenCacheKey:qe(t),fetch:t.fetch};N(u,n)}}function Z(t="",e={}){return r=>(i,n)=>{if(typeof t!="string")throw new Error("authorization must be a string");let o=e.force===void 0?!0:e.force;if(!t||(i.headers&&i.headers.authorization||i.headers&&i.headers.Authorization)&&o===!1)return r(i,n);let s={...i,headers:{...i.headers,Authorization:t}};return r(s,n)}}function v(t){let e=t.tokenCache||A({}),r=[],i=A(!1);return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...fr(t),pendingTasks:r,requestState:i,tokenCache:e,fetch:t.fetch};N(u,n,t)}}function ee(t){let e=t.tokenCache||A({token:"",expirationTime:-1}),r=[],i=A(!1);return n=>(o,s)=>{if(o.headers&&o.headers.authorization||o.headers&&o.headers.Authorization){n(o,s);return}let u={request:o,response:s,...me(t),pendingTasks:r,requestState:i,tokenCache:e,fetch:t.fetch};N(u,n)}}function re(t){return e=>(r,i)=>{let n={...r,headers:{...r.headers,"X-Correlation-ID":t.generate()}};e(n,i)}}var Mr=Be(pe());function P(t,e,r={}){this.status=this.statusCode=this.code=t,this.message=e,Object.assign(this,r),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function ye(...t){P.call(this,0,...t)}function gr(...t){P.call(this,...t)}function ht(...t){P.call(this,400,...t)}function ft(...t){P.call(this,401,...t)}function pt(...t){P.call(this,403,...t)}function wt(...t){P.call(this,404,...t)}function mt(...t){P.call(this,409,...t)}function yt(...t){P.call(this,500,...t)}function gt(...t){P.call(this,503,...t)}function te(t){switch(t){case 0:return ye;case 400:return ht;case 401:return ft;case 403:return pt;case 404:return wt;case 409:return mt;case 500:return yt;case 503:return gt;default:return}}function ge(t){if(t.raw)return t.raw();if(!t.forEach)return{};let e={};return t.forEach((r,i)=>{e[i]=r}),e}function xr(t){return t!=null&&t.constructor!=null&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function xt({statusCode:t,message:e,...r}){let i=e||"Unexpected non-JSON error response";t===404&&(i=`URI not found: ${r.originalRequest?.uri||r.uri}`,delete r.uri);let n=te(t);return n?new n(i,r):new gr(t,i,r)}function xe(t,e,r,i,n){return i&&t!==0?Math.min(Math.round((Math.random()+1)*e*2**t),n):e}function Me(t,e){e&&(t&&t.headers&&t.headers.authorization&&(t.headers.authorization="Bearer ********"),t&&t.headers&&t.headers.Authorization&&(t.headers.Authorization="Bearer ********"))}function ie({host:t,credentialsMode:e,includeResponseHeaders:r,includeOriginalRequest:i,includeRequestInErrorResponse:n=!0,maskSensitiveHeaderData:o=!0,headersWithStringBody:s=[],enableRetry:u,timeout:l,retryConfig:{maxRetries:c=10,backoff:h=!0,retryDelay:d=200,maxDelay:f=1/0,retryOnAbort:p=!1,retryCodes:g=[503]}={},fetch:k,getAbortController:L}){if(!k)throw new Error("`fetch` is not available. Please pass in `fetch` as an option or have it globally available.");if(l&&!L)throw new Error("`AbortController` is not available. Please pass in `getAbortController` as an option or have AbortController globally available when using timeout.");let _;if(k?_=k:_=fetch,!Array.isArray(g))throw new Error("`retryCodes` option must be an array of retry status (error) codes.");if(!Array.isArray(s))throw new Error("`headersWithStringBody` option must be an array of strings");return I=>(w,T)=>{let Ee=t.replace(/\/$/,"")+w.uri,E={...w.headers};Object.prototype.hasOwnProperty.call(E,"Content-Type")||Object.prototype.hasOwnProperty.call(E,"content-type")||(E["Content-Type"]="application/json"),E["Content-Type"]===null&&delete E["Content-Type"];let j=["application/json","application/graphql",...s].indexOf(E["Content-Type"])>-1&&typeof w.body=="string"||xr(w.body)?w.body:JSON.stringify(w.body||void 0);j&&(typeof j=="string"||xr(j))&&(E["Content-Length"]=Mr.Buffer.byteLength(j).toString());let C={method:w.method,headers:E};e&&(C.credentialsMode=e),j&&(C.body=j);let m=0;function $(){let $e,V;l&&(V=(L?L():null)||new AbortController,C.signal=V.signal,$e=setTimeout(()=>{V.abort()},l)),_(Ee,C).then(B=>{if(B.ok){if(C.method==="HEAD"){I(w,{...T,statusCode:B.status});return}B.text().then(F=>{let x;try{x=F.length>0?JSON.parse(F):{}}catch{if(u&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}x=F}let S={...T,body:x,statusCode:B.status};r&&(S.headers=ge(B.headers)),i&&(S.request={...C},Me(S.request,o)),I(w,S)}).catch(F=>{if(u&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}let x=new ye(F.message,{...n?{originalRequest:w}:{},retryCount:m});Me(x.originalRequest,o),I(w,{...T,error:x,statusCode:0})});return}B.text().then(F=>{let x;try{x=JSON.parse(F)}catch{x=F}let S=xt({statusCode:B.status,...n?{originalRequest:w}:B.status===404?{uri:w.uri}:{},retryCount:m,headers:ge(B.headers),...typeof x=="object"?{message:x.message,body:x}:{message:x,body:x}});if(u&&(g.indexOf(S.statusCode)!==-1||g?.indexOf(S.message)!==-1)&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}Me(S.originalRequest,o);let De={...T,error:S,statusCode:B.status};I(w,De)})},B=>{if(u&&(p||!V||!V.signal)&&m<c){setTimeout($,xe(m,d,c,h,f)),m+=1;return}let F=new ye(B.message,{...n?{originalRequest:w}:{},retryCount:m});Me(F.originalRequest,o),I(w,{...T,error:F,statusCode:0})}).finally(()=>{clearTimeout($e)})}$()}}function ne(){return t=>(e,r)=>{let{error:i,body:n,statusCode:o}=r;console.log("Request: ",e),console.log("Response: ",{error:i,body:n,statusCode:o}),t(e,r)}}function oe({concurrency:t=20}){let e=[],r=0,i=n=>{if(r-=1,e.length&&r<=t){let o=e.shift();r+=1,n(o.request,o.response)}};return n=>(o,s)=>{let u={...s,resolve(l){s.resolve(l),i(n)},reject(l){s.reject(l),i(n)}};if(e.push({request:o,response:u}),r<t){let l=e.shift();r+=1,n(l.request,l.response)}}}var Er={name:"@commercetools/sdk-client-v2",version:"3.3.1",engines:{node:">=18"},description:"commercetools Composable Commerce TypeScript SDK client.",keywords:["commercetools","composable commerce","sdk","typescript","client","middleware","http","oauth","auth"],homepage:"https://github.com/commercetools/commercetools-sdk-typescript",license:"MIT",directories:{lib:"lib",test:"test"},publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/commercetools/commercetools-sdk-typescript"},bugs:{url:"https://github.com/commercetools/commercetools-sdk-typescript/issues"},dependencies:{buffer:"^6.0.3"},files:["dist","CHANGELOG.md"],author:"Chukwuemeka Ajima <meeky.ae@gmail.com>",main:"dist/commercetools-sdk-client-v2.cjs.js",module:"dist/commercetools-sdk-client-v2.esm.js",browser:{"./dist/commercetools-sdk-client-v2.cjs.js":"./dist/commercetools-sdk-client-v2.browser.cjs.js","./dist/commercetools-sdk-client-v2.esm.js":"./dist/commercetools-sdk-client-v2.browser.esm.js"},devDependencies:{"common-tags":"1.8.2",dotenv:"17.2.2",jest:"29.7.0",nock:"14.0.10","organize-imports-cli":"0.10.0"},scripts:{organize_imports:"find src -type f -name '*.ts' | xargs organize-imports-cli",postbuild:"yarn organize_imports",post_process_generate:"yarn organize_imports",docs:"typedoc --out docs"}};var Et=()=>typeof window<"u"&&window.document&&window.document.nodeType===9;function At(){return Et()?window.navigator.userAgent:`node.js/${process?.version.slice(1)||"12"}`}function _e(t){if(!t||Object.keys(t).length===0||!{}.hasOwnProperty.call(t,"name"))throw new Error("Missing required option `name`");let e=t.version?`${t.name}/${t.version}`:t.name,r=null;t.libraryName&&!t.libraryVersion?r=t.libraryName:t.libraryName&&t.libraryVersion&&(r=`${t.libraryName}/${t.libraryVersion}`);let i=null;t.contactUrl&&!t.contactEmail?i=`(+${t.contactUrl})`:!t.contactUrl&&t.contactEmail?i=`(+${t.contactEmail})`:t.contactUrl&&t.contactEmail&&(i=`(+${t.contactUrl}; +${t.contactEmail})`);let n=At(),o=t.customAgent||"";return[e,n,r,i,o].filter(Boolean).join(" ")}function se(t){let e=_e({...t,name:`commercetools-sdk-javascript-v2/${Er.version}`});return r=>(i,n)=>{let o={...i,headers:{...i.headers,"User-Agent":e}};r(o,n)}}var{createAuthMiddlewareForPasswordFlow:Bt,createAuthMiddlewareForAnonymousSessionFlow:Rt,createAuthMiddlewareForClientCredentialsFlow:It,createAuthMiddlewareForRefreshTokenFlow:Ft,createAuthMiddlewareWithExistingToken:Tt}=Le,ae=class{projectKey;authMiddleware;httpMiddleware;userAgentMiddleware;correlationIdMiddleware;loggerMiddleware;queueMiddleware;telemetryMiddleware;beforeMiddleware;afterMiddleware;middlewares=[];withProjectKey(e){return this.projectKey=e,this}defaultClient(e,r,i,n){return this.withClientCredentialsFlow({host:i,projectKey:n||this.projectKey,credentials:r}).withHttpMiddleware({host:e,fetch}).withLoggerMiddleware().withUserAgentMiddleware()}withAuthMiddleware(e){return this.authMiddleware=e,this}withMiddleware(e){return this.middlewares.push(e),this}withClientCredentialsFlow(e){return this.withAuthMiddleware(It({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||""},oauthUri:e.oauthUri||"",scopes:e.scopes,fetch:e.fetch||fetch,...e}))}withPasswordFlow(e){return this.withAuthMiddleware(Bt({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||"",user:{username:e.credentials.user.username||"",password:e.credentials.user.password||""}},fetch:e.fetch||fetch,...e}))}withAnonymousSessionFlow(e){return this.withAuthMiddleware(Rt({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||"",anonymousId:e.credentials.anonymousId||""},fetch:e.fetch||fetch,...e}))}withRefreshTokenFlow(e){return this.withAuthMiddleware(Ft({host:e.host||"https://auth.europe-west1.gcp.commercetools.com",projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||"",clientSecret:e.credentials.clientSecret||""},fetch:e.fetch||fetch,refreshToken:e.refreshToken||"",...e}))}withExistingTokenFlow(e,r){return this.withAuthMiddleware(Tt(e,{force:r.force||!0,...r}))}withHttpMiddleware(e){return this.httpMiddleware=ie({host:e.host||"https://api.europe-west1.gcp.commercetools.com",fetch:e.fetch||fetch,...e}),this}withUserAgentMiddleware(e){return this.userAgentMiddleware=se(e),this}withQueueMiddleware(e){return this.queueMiddleware=oe({concurrency:e.concurrency||20,...e}),this}withLoggerMiddleware(e){let{logger:r,...i}=e||{};return this.loggerMiddleware=typeof e?.logger=="function"&&e.logger(i)||ne(),this}withCorrelationIdMiddleware(e){return this.correlationIdMiddleware=re({generate:e.generate||null,...e}),this}withTelemetryMiddleware(e){let{createTelemetryMiddleware:r,...i}=e;return this.withUserAgentMiddleware({customAgent:i?.userAgent||"typescript-sdk-apm-middleware"}),this.telemetryMiddleware=r(i),this}withBeforeExecutionMiddleware(e){let{middleware:r,...i}=e||{};return this.beforeMiddleware=e.middleware(i),this}withAfterExecutionMiddleware(e){let{middleware:r,...i}=e||{};return this.afterMiddleware=e.middleware(i),this}build(){let e=this.middlewares.slice();return this.telemetryMiddleware&&e.push(this.telemetryMiddleware),this.correlationIdMiddleware&&e.push(this.correlationIdMiddleware),this.userAgentMiddleware&&e.push(this.userAgentMiddleware),this.authMiddleware&&e.push(this.authMiddleware),this.beforeMiddleware&&e.push(this.beforeMiddleware),this.queueMiddleware&&e.push(this.queueMiddleware),this.httpMiddleware&&e.push(this.httpMiddleware),this.afterMiddleware&&e.push(this.afterMiddleware),this.loggerMiddleware&&e.push(this.loggerMiddleware),H({middlewares:e})}};return Tr(Ct);})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
ieee754/index.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/sdk-client-v2",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18"
|
|
6
6
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "
|
|
30
|
+
"url": "https://github.com/commercetools/commercetools-sdk-typescript"
|
|
31
31
|
},
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/commercetools/commercetools-sdk-typescript/issues"
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"common-tags": "1.8.2",
|
|
48
|
-
"dotenv": "
|
|
48
|
+
"dotenv": "17.2.2",
|
|
49
49
|
"jest": "29.7.0",
|
|
50
|
-
"nock": "
|
|
50
|
+
"nock": "14.0.10",
|
|
51
51
|
"organize-imports-cli": "0.10.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|