@workos-inc/node 8.0.0-beta.1 → 8.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions/actions.cjs +1 -0
- package/lib/actions/actions.cjs.map +1 -1
- package/lib/actions/actions.js +1 -0
- package/lib/actions/actions.js.map +1 -1
- package/lib/common/crypto/crypto-provider.cjs +1 -3
- package/lib/common/crypto/crypto-provider.cjs.map +1 -1
- package/lib/common/crypto/crypto-provider.js +1 -3
- package/lib/common/crypto/crypto-provider.js.map +1 -1
- package/lib/common/crypto/signature-provider.cjs +1 -0
- package/lib/common/crypto/signature-provider.cjs.map +1 -1
- package/lib/common/crypto/signature-provider.js +1 -0
- package/lib/common/crypto/signature-provider.js.map +1 -1
- package/lib/common/crypto/subtle-crypto-provider.cjs +1 -0
- package/lib/common/crypto/subtle-crypto-provider.cjs.map +1 -1
- package/lib/common/crypto/subtle-crypto-provider.js +1 -0
- package/lib/common/crypto/subtle-crypto-provider.js.map +1 -1
- package/lib/common/exceptions/bad-request.exception.cjs +9 -6
- package/lib/common/exceptions/bad-request.exception.cjs.map +1 -1
- package/lib/common/exceptions/bad-request.exception.js +9 -6
- package/lib/common/exceptions/bad-request.exception.js.map +1 -1
- package/lib/common/exceptions/conflict.exception.cjs +6 -5
- package/lib/common/exceptions/conflict.exception.cjs.map +1 -1
- package/lib/common/exceptions/conflict.exception.js +6 -5
- package/lib/common/exceptions/conflict.exception.js.map +1 -1
- package/lib/common/exceptions/generic-server.exception.cjs +2 -2
- package/lib/common/exceptions/generic-server.exception.cjs.map +1 -1
- package/lib/common/exceptions/generic-server.exception.js +2 -2
- package/lib/common/exceptions/generic-server.exception.js.map +1 -1
- package/lib/common/exceptions/no-api-key-provided.exception.cjs +3 -6
- package/lib/common/exceptions/no-api-key-provided.exception.cjs.map +1 -1
- package/lib/common/exceptions/no-api-key-provided.exception.js +3 -6
- package/lib/common/exceptions/no-api-key-provided.exception.js.map +1 -1
- package/lib/common/exceptions/not-found.exception.cjs +8 -5
- package/lib/common/exceptions/not-found.exception.cjs.map +1 -1
- package/lib/common/exceptions/not-found.exception.js +8 -5
- package/lib/common/exceptions/not-found.exception.js.map +1 -1
- package/lib/common/exceptions/oauth.exception.cjs +1 -1
- package/lib/common/exceptions/oauth.exception.cjs.map +1 -1
- package/lib/common/exceptions/oauth.exception.js +1 -1
- package/lib/common/exceptions/oauth.exception.js.map +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.cjs +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.cjs.map +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.js +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.js.map +1 -1
- package/lib/common/exceptions/signature-verification.exception.cjs +4 -4
- package/lib/common/exceptions/signature-verification.exception.cjs.map +1 -1
- package/lib/common/exceptions/signature-verification.exception.js +4 -4
- package/lib/common/exceptions/signature-verification.exception.js.map +1 -1
- package/lib/common/exceptions/unauthorized.exception.cjs +3 -2
- package/lib/common/exceptions/unauthorized.exception.cjs.map +1 -1
- package/lib/common/exceptions/unauthorized.exception.js +3 -2
- package/lib/common/exceptions/unauthorized.exception.js.map +1 -1
- package/lib/common/exceptions/unprocessable-entity.exception.cjs +8 -6
- package/lib/common/exceptions/unprocessable-entity.exception.cjs.map +1 -1
- package/lib/common/exceptions/unprocessable-entity.exception.js +8 -6
- package/lib/common/exceptions/unprocessable-entity.exception.js.map +1 -1
- package/lib/common/net/fetch-client.cjs +2 -0
- package/lib/common/net/fetch-client.cjs.map +1 -1
- package/lib/common/net/fetch-client.js +2 -0
- package/lib/common/net/fetch-client.js.map +1 -1
- package/lib/common/net/http-client.cjs +15 -12
- package/lib/common/net/http-client.cjs.map +1 -1
- package/lib/common/net/http-client.js +15 -12
- package/lib/common/net/http-client.js.map +1 -1
- package/lib/common/utils/fetch-error.cjs +6 -5
- package/lib/common/utils/fetch-error.cjs.map +1 -1
- package/lib/common/utils/fetch-error.js +6 -5
- package/lib/common/utils/fetch-error.js.map +1 -1
- package/lib/common/utils/pagination.cjs +2 -1
- package/lib/common/utils/pagination.cjs.map +1 -1
- package/lib/common/utils/pagination.js +2 -1
- package/lib/common/utils/pagination.js.map +1 -1
- package/lib/fga/interfaces/check.interface.cjs +5 -0
- package/lib/fga/interfaces/check.interface.cjs.map +1 -1
- package/lib/fga/interfaces/check.interface.js +5 -0
- package/lib/fga/interfaces/check.interface.js.map +1 -1
- package/lib/fga/utils/fga-paginatable.cjs +1 -0
- package/lib/fga/utils/fga-paginatable.cjs.map +1 -1
- package/lib/fga/utils/fga-paginatable.js +1 -0
- package/lib/fga/utils/fga-paginatable.js.map +1 -1
- package/lib/user-management/session.cjs +4 -0
- package/lib/user-management/session.cjs.map +1 -1
- package/lib/user-management/session.js +4 -0
- package/lib/user-management/session.js.map +1 -1
- package/lib/user-management/user-management.cjs +2 -0
- package/lib/user-management/user-management.cjs.map +1 -1
- package/lib/user-management/user-management.js +2 -0
- package/lib/user-management/user-management.js.map +1 -1
- package/lib/vault/vault.cjs +1 -0
- package/lib/vault/vault.cjs.map +1 -1
- package/lib/vault/vault.js +1 -0
- package/lib/vault/vault.js.map +1 -1
- package/lib/webhooks/webhooks.cjs +1 -0
- package/lib/webhooks/webhooks.cjs.map +1 -1
- package/lib/webhooks/webhooks.js +1 -0
- package/lib/webhooks/webhooks.js.map +1 -1
- package/lib/workos.cjs +19 -13
- package/lib/workos.cjs.map +1 -1
- package/lib/workos.js +19 -13
- package/lib/workos.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
class NotFoundException extends Error {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "NotFoundException");
|
|
6
|
+
}
|
|
7
|
+
status = 404;
|
|
8
|
+
name = "NotFoundException";
|
|
9
|
+
message;
|
|
10
|
+
code;
|
|
11
|
+
requestID;
|
|
4
12
|
constructor({
|
|
5
13
|
code,
|
|
6
14
|
message,
|
|
@@ -8,15 +16,10 @@ class NotFoundException extends Error {
|
|
|
8
16
|
requestID
|
|
9
17
|
}) {
|
|
10
18
|
super();
|
|
11
|
-
this.status = 404;
|
|
12
|
-
this.name = "NotFoundException";
|
|
13
19
|
this.code = code;
|
|
14
20
|
this.message = message ?? `The requested path '${path}' could not be found.`;
|
|
15
21
|
this.requestID = requestID;
|
|
16
22
|
}
|
|
17
|
-
static {
|
|
18
|
-
__name(this, "NotFoundException");
|
|
19
|
-
}
|
|
20
23
|
}
|
|
21
24
|
export {
|
|
22
25
|
NotFoundException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/not-found.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class NotFoundException extends Error implements RequestException {\n readonly status = 404;\n readonly name = 'NotFoundException';\n readonly message: string;\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n message,\n path,\n requestID,\n }: {\n code?: string;\n message?: string;\n path: string;\n requestID: string;\n }) {\n super();\n this.code = code;\n this.message =\n message ?? `The requested path '${path}' could not be found.`;\n this.requestID = requestID;\n }\n}\n"],"mappings":";;AAEO,MAAM,0BAA0B,MAAkC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/not-found.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class NotFoundException extends Error implements RequestException {\n readonly status = 404;\n readonly name = 'NotFoundException';\n readonly message: string;\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n message,\n path,\n requestID,\n }: {\n code?: string;\n message?: string;\n path: string;\n requestID: string;\n }) {\n super();\n this.code = code;\n this.message =\n message ?? `The requested path '${path}' could not be found.`;\n this.requestID = requestID;\n }\n}\n"],"mappings":";;AAEO,MAAM,0BAA0B,MAAkC;AAAA,EAFzE,OAEyE;AAAA;AAAA;AAAA,EAC9D,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,UACH,WAAW,uBAAuB,IAAI;AACxC,SAAK,YAAY;AAAA,EACnB;AACF;","names":[]}
|
|
@@ -30,7 +30,6 @@ class OauthException extends Error {
|
|
|
30
30
|
this.error = error;
|
|
31
31
|
this.errorDescription = errorDescription;
|
|
32
32
|
this.rawData = rawData;
|
|
33
|
-
this.name = "OauthException";
|
|
34
33
|
if (error && errorDescription) {
|
|
35
34
|
this.message = `Error: ${error}
|
|
36
35
|
Error Description: ${errorDescription}`;
|
|
@@ -43,6 +42,7 @@ Error Description: ${errorDescription}`;
|
|
|
43
42
|
static {
|
|
44
43
|
__name(this, "OauthException");
|
|
45
44
|
}
|
|
45
|
+
name = "OauthException";
|
|
46
46
|
}
|
|
47
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
48
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/oauth.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class OauthException extends Error implements RequestException {\n readonly name = 'OauthException';\n\n constructor(\n readonly status: number,\n readonly requestID: string,\n readonly error: string | undefined,\n readonly errorDescription: string | undefined,\n readonly rawData: unknown,\n ) {\n super();\n if (error && errorDescription) {\n this.message = `Error: ${error}\\nError Description: ${errorDescription}`;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An error has occurred.`;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,uBAAuB,MAAkC;AAAA,EAGpE,YACW,QACA,WACA,OACA,kBACA,SACT;AACA,UAAM;AANG;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/oauth.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class OauthException extends Error implements RequestException {\n readonly name = 'OauthException';\n\n constructor(\n readonly status: number,\n readonly requestID: string,\n readonly error: string | undefined,\n readonly errorDescription: string | undefined,\n readonly rawData: unknown,\n ) {\n super();\n if (error && errorDescription) {\n this.message = `Error: ${error}\\nError Description: ${errorDescription}`;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An error has occurred.`;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,uBAAuB,MAAkC;AAAA,EAGpE,YACW,QACA,WACA,OACA,kBACA,SACT;AACA,UAAM;AANG;AACA;AACA;AACA;AACA;AAGT,QAAI,SAAS,kBAAkB;AAC7B,WAAK,UAAU,UAAU,KAAK;AAAA,qBAAwB,gBAAgB;AAAA,IACxE,WAAW,OAAO;AAChB,WAAK,UAAU,UAAU,KAAK;AAAA,IAChC,OAAO;AACL,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AAAA,EApBF,OAEsE;AAAA;AAAA;AAAA,EAC3D,OAAO;AAkBlB;","names":[]}
|
|
@@ -8,7 +8,6 @@ class OauthException extends Error {
|
|
|
8
8
|
this.error = error;
|
|
9
9
|
this.errorDescription = errorDescription;
|
|
10
10
|
this.rawData = rawData;
|
|
11
|
-
this.name = "OauthException";
|
|
12
11
|
if (error && errorDescription) {
|
|
13
12
|
this.message = `Error: ${error}
|
|
14
13
|
Error Description: ${errorDescription}`;
|
|
@@ -21,6 +20,7 @@ Error Description: ${errorDescription}`;
|
|
|
21
20
|
static {
|
|
22
21
|
__name(this, "OauthException");
|
|
23
22
|
}
|
|
23
|
+
name = "OauthException";
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
26
26
|
OauthException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/oauth.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class OauthException extends Error implements RequestException {\n readonly name = 'OauthException';\n\n constructor(\n readonly status: number,\n readonly requestID: string,\n readonly error: string | undefined,\n readonly errorDescription: string | undefined,\n readonly rawData: unknown,\n ) {\n super();\n if (error && errorDescription) {\n this.message = `Error: ${error}\\nError Description: ${errorDescription}`;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An error has occurred.`;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,uBAAuB,MAAkC;AAAA,EAGpE,YACW,QACA,WACA,OACA,kBACA,SACT;AACA,UAAM;AANG;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/oauth.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class OauthException extends Error implements RequestException {\n readonly name = 'OauthException';\n\n constructor(\n readonly status: number,\n readonly requestID: string,\n readonly error: string | undefined,\n readonly errorDescription: string | undefined,\n readonly rawData: unknown,\n ) {\n super();\n if (error && errorDescription) {\n this.message = `Error: ${error}\\nError Description: ${errorDescription}`;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An error has occurred.`;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,uBAAuB,MAAkC;AAAA,EAGpE,YACW,QACA,WACA,OACA,kBACA,SACT;AACA,UAAM;AANG;AACA;AACA;AACA;AACA;AAGT,QAAI,SAAS,kBAAkB;AAC7B,WAAK,UAAU,UAAU,KAAK;AAAA,qBAAwB,gBAAgB;AAAA,IACxE,WAAW,OAAO;AAChB,WAAK,UAAU,UAAU,KAAK;AAAA,IAChC,OAAO;AACL,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AAAA,EApBF,OAEsE;AAAA;AAAA;AAAA,EAC3D,OAAO;AAkBlB;","names":[]}
|
|
@@ -27,11 +27,11 @@ class RateLimitExceededException extends import_generic_server.GenericServerExce
|
|
|
27
27
|
constructor(message, requestID, retryAfter) {
|
|
28
28
|
super(429, message, {}, requestID);
|
|
29
29
|
this.retryAfter = retryAfter;
|
|
30
|
-
this.name = "RateLimitExceededException";
|
|
31
30
|
}
|
|
32
31
|
static {
|
|
33
32
|
__name(this, "RateLimitExceededException");
|
|
34
33
|
}
|
|
34
|
+
name = "RateLimitExceededException";
|
|
35
35
|
}
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/rate-limit-exceeded.exception.ts"],"sourcesContent":["import { GenericServerException } from './generic-server.exception';\n\n// Inheriting from `GenericServerException` in order to maintain backwards\n// compatibility with what 429 errors would have previously been thrown as.\n//\n// TODO: Consider making it the base class for all request errors.\nexport class RateLimitExceededException extends GenericServerException {\n readonly name = 'RateLimitExceededException';\n\n constructor(\n message: string,\n requestID: string,\n /**\n * The number of seconds to wait before retrying the request.\n */\n readonly retryAfter: number | null,\n ) {\n super(429, message, {}, requestID);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAuC;AAMhC,MAAM,mCAAmC,6CAAuB;AAAA,EAGrE,YACE,SACA,WAIS,YACT;AACA,UAAM,KAAK,SAAS,CAAC,GAAG,SAAS;AAFxB;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/rate-limit-exceeded.exception.ts"],"sourcesContent":["import { GenericServerException } from './generic-server.exception';\n\n// Inheriting from `GenericServerException` in order to maintain backwards\n// compatibility with what 429 errors would have previously been thrown as.\n//\n// TODO: Consider making it the base class for all request errors.\nexport class RateLimitExceededException extends GenericServerException {\n readonly name = 'RateLimitExceededException';\n\n constructor(\n message: string,\n requestID: string,\n /**\n * The number of seconds to wait before retrying the request.\n */\n readonly retryAfter: number | null,\n ) {\n super(429, message, {}, requestID);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAuC;AAMhC,MAAM,mCAAmC,6CAAuB;AAAA,EAGrE,YACE,SACA,WAIS,YACT;AACA,UAAM,KAAK,SAAS,CAAC,GAAG,SAAS;AAFxB;AAAA,EAGX;AAAA,EAlBF,OAMuE;AAAA;AAAA;AAAA,EAC5D,OAAO;AAYlB;","names":[]}
|
|
@@ -5,11 +5,11 @@ class RateLimitExceededException extends GenericServerException {
|
|
|
5
5
|
constructor(message, requestID, retryAfter) {
|
|
6
6
|
super(429, message, {}, requestID);
|
|
7
7
|
this.retryAfter = retryAfter;
|
|
8
|
-
this.name = "RateLimitExceededException";
|
|
9
8
|
}
|
|
10
9
|
static {
|
|
11
10
|
__name(this, "RateLimitExceededException");
|
|
12
11
|
}
|
|
12
|
+
name = "RateLimitExceededException";
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
15
|
RateLimitExceededException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/rate-limit-exceeded.exception.ts"],"sourcesContent":["import { GenericServerException } from './generic-server.exception';\n\n// Inheriting from `GenericServerException` in order to maintain backwards\n// compatibility with what 429 errors would have previously been thrown as.\n//\n// TODO: Consider making it the base class for all request errors.\nexport class RateLimitExceededException extends GenericServerException {\n readonly name = 'RateLimitExceededException';\n\n constructor(\n message: string,\n requestID: string,\n /**\n * The number of seconds to wait before retrying the request.\n */\n readonly retryAfter: number | null,\n ) {\n super(429, message, {}, requestID);\n }\n}\n"],"mappings":";;AAAA,SAAS,8BAA8B;AAMhC,MAAM,mCAAmC,uBAAuB;AAAA,EAGrE,YACE,SACA,WAIS,YACT;AACA,UAAM,KAAK,SAAS,CAAC,GAAG,SAAS;AAFxB;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/rate-limit-exceeded.exception.ts"],"sourcesContent":["import { GenericServerException } from './generic-server.exception';\n\n// Inheriting from `GenericServerException` in order to maintain backwards\n// compatibility with what 429 errors would have previously been thrown as.\n//\n// TODO: Consider making it the base class for all request errors.\nexport class RateLimitExceededException extends GenericServerException {\n readonly name = 'RateLimitExceededException';\n\n constructor(\n message: string,\n requestID: string,\n /**\n * The number of seconds to wait before retrying the request.\n */\n readonly retryAfter: number | null,\n ) {\n super(429, message, {}, requestID);\n }\n}\n"],"mappings":";;AAAA,SAAS,8BAA8B;AAMhC,MAAM,mCAAmC,uBAAuB;AAAA,EAGrE,YACE,SACA,WAIS,YACT;AACA,UAAM,KAAK,SAAS,CAAC,GAAG,SAAS;AAFxB;AAAA,EAGX;AAAA,EAlBF,OAMuE;AAAA;AAAA;AAAA,EAC5D,OAAO;AAYlB;","names":[]}
|
|
@@ -23,13 +23,13 @@ __export(signature_verification_exception_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(signature_verification_exception_exports);
|
|
25
25
|
class SignatureVerificationException extends Error {
|
|
26
|
-
constructor(message) {
|
|
27
|
-
super(message || "Signature verification failed.");
|
|
28
|
-
this.name = "SignatureVerificationException";
|
|
29
|
-
}
|
|
30
26
|
static {
|
|
31
27
|
__name(this, "SignatureVerificationException");
|
|
32
28
|
}
|
|
29
|
+
name = "SignatureVerificationException";
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message || "Signature verification failed.");
|
|
32
|
+
}
|
|
33
33
|
}
|
|
34
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
35
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/signature-verification.exception.ts"],"sourcesContent":["export class SignatureVerificationException extends Error {\n readonly name = 'SignatureVerificationException';\n\n constructor(message: string) {\n super(message || 'Signature verification failed.');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uCAAuC,MAAM;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/signature-verification.exception.ts"],"sourcesContent":["export class SignatureVerificationException extends Error {\n readonly name = 'SignatureVerificationException';\n\n constructor(message: string) {\n super(message || 'Signature verification failed.');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uCAAuC,MAAM;AAAA,EAA1D,OAA0D;AAAA;AAAA;AAAA,EAC/C,OAAO;AAAA,EAEhB,YAAY,SAAiB;AAC3B,UAAM,WAAW,gCAAgC;AAAA,EACnD;AACF;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
class SignatureVerificationException extends Error {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message || "Signature verification failed.");
|
|
6
|
-
this.name = "SignatureVerificationException";
|
|
7
|
-
}
|
|
8
4
|
static {
|
|
9
5
|
__name(this, "SignatureVerificationException");
|
|
10
6
|
}
|
|
7
|
+
name = "SignatureVerificationException";
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message || "Signature verification failed.");
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
13
|
SignatureVerificationException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/signature-verification.exception.ts"],"sourcesContent":["export class SignatureVerificationException extends Error {\n readonly name = 'SignatureVerificationException';\n\n constructor(message: string) {\n super(message || 'Signature verification failed.');\n }\n}\n"],"mappings":";;AAAO,MAAM,uCAAuC,MAAM;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/signature-verification.exception.ts"],"sourcesContent":["export class SignatureVerificationException extends Error {\n readonly name = 'SignatureVerificationException';\n\n constructor(message: string) {\n super(message || 'Signature verification failed.');\n }\n}\n"],"mappings":";;AAAO,MAAM,uCAAuC,MAAM;AAAA,EAA1D,OAA0D;AAAA;AAAA;AAAA,EAC/C,OAAO;AAAA,EAEhB,YAAY,SAAiB;AAC3B,UAAM,WAAW,gCAAgC;AAAA,EACnD;AACF;","names":[]}
|
|
@@ -26,13 +26,14 @@ class UnauthorizedException extends Error {
|
|
|
26
26
|
constructor(requestID) {
|
|
27
27
|
super();
|
|
28
28
|
this.requestID = requestID;
|
|
29
|
-
this.status = 401;
|
|
30
|
-
this.name = "UnauthorizedException";
|
|
31
29
|
this.message = `Could not authorize the request. Maybe your API key is invalid?`;
|
|
32
30
|
}
|
|
33
31
|
static {
|
|
34
32
|
__name(this, "UnauthorizedException");
|
|
35
33
|
}
|
|
34
|
+
status = 401;
|
|
35
|
+
name = "UnauthorizedException";
|
|
36
|
+
message;
|
|
36
37
|
}
|
|
37
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
39
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/unauthorized.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnauthorizedException extends Error implements RequestException {\n readonly status = 401;\n readonly name = 'UnauthorizedException';\n readonly message: string;\n\n constructor(readonly requestID: string) {\n super();\n this.message = `Could not authorize the request. Maybe your API key is invalid?`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,8BAA8B,MAAkC;AAAA,EAK3E,YAAqB,WAAmB;AACtC,UAAM;AADa;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/unauthorized.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnauthorizedException extends Error implements RequestException {\n readonly status = 401;\n readonly name = 'UnauthorizedException';\n readonly message: string;\n\n constructor(readonly requestID: string) {\n super();\n this.message = `Could not authorize the request. Maybe your API key is invalid?`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,8BAA8B,MAAkC;AAAA,EAK3E,YAAqB,WAAmB;AACtC,UAAM;AADa;AAEnB,SAAK,UAAU;AAAA,EACjB;AAAA,EAVF,OAE6E;AAAA;AAAA;AAAA,EAClE,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AAMX;","names":[]}
|
|
@@ -4,13 +4,14 @@ class UnauthorizedException extends Error {
|
|
|
4
4
|
constructor(requestID) {
|
|
5
5
|
super();
|
|
6
6
|
this.requestID = requestID;
|
|
7
|
-
this.status = 401;
|
|
8
|
-
this.name = "UnauthorizedException";
|
|
9
7
|
this.message = `Could not authorize the request. Maybe your API key is invalid?`;
|
|
10
8
|
}
|
|
11
9
|
static {
|
|
12
10
|
__name(this, "UnauthorizedException");
|
|
13
11
|
}
|
|
12
|
+
status = 401;
|
|
13
|
+
name = "UnauthorizedException";
|
|
14
|
+
message;
|
|
14
15
|
}
|
|
15
16
|
export {
|
|
16
17
|
UnauthorizedException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/unauthorized.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnauthorizedException extends Error implements RequestException {\n readonly status = 401;\n readonly name = 'UnauthorizedException';\n readonly message: string;\n\n constructor(readonly requestID: string) {\n super();\n this.message = `Could not authorize the request. Maybe your API key is invalid?`;\n }\n}\n"],"mappings":";;AAEO,MAAM,8BAA8B,MAAkC;AAAA,EAK3E,YAAqB,WAAmB;AACtC,UAAM;AADa;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/unauthorized.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnauthorizedException extends Error implements RequestException {\n readonly status = 401;\n readonly name = 'UnauthorizedException';\n readonly message: string;\n\n constructor(readonly requestID: string) {\n super();\n this.message = `Could not authorize the request. Maybe your API key is invalid?`;\n }\n}\n"],"mappings":";;AAEO,MAAM,8BAA8B,MAAkC;AAAA,EAK3E,YAAqB,WAAmB;AACtC,UAAM;AADa;AAEnB,SAAK,UAAU;AAAA,EACjB;AAAA,EAVF,OAE6E;AAAA;AAAA;AAAA,EAClE,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AAMX;","names":[]}
|
|
@@ -34,6 +34,14 @@ __export(unprocessable_entity_exception_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(unprocessable_entity_exception_exports);
|
|
35
35
|
var import_pluralize = __toESM(require("pluralize"), 1);
|
|
36
36
|
class UnprocessableEntityException extends Error {
|
|
37
|
+
static {
|
|
38
|
+
__name(this, "UnprocessableEntityException");
|
|
39
|
+
}
|
|
40
|
+
status = 422;
|
|
41
|
+
name = "UnprocessableEntityException";
|
|
42
|
+
message = "Unprocessable entity";
|
|
43
|
+
code;
|
|
44
|
+
requestID;
|
|
37
45
|
constructor({
|
|
38
46
|
code,
|
|
39
47
|
errors,
|
|
@@ -41,9 +49,6 @@ class UnprocessableEntityException extends Error {
|
|
|
41
49
|
requestID
|
|
42
50
|
}) {
|
|
43
51
|
super();
|
|
44
|
-
this.status = 422;
|
|
45
|
-
this.name = "UnprocessableEntityException";
|
|
46
|
-
this.message = "Unprocessable entity";
|
|
47
52
|
this.requestID = requestID;
|
|
48
53
|
if (message) {
|
|
49
54
|
this.message = message;
|
|
@@ -61,9 +66,6 @@ class UnprocessableEntityException extends Error {
|
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
|
-
static {
|
|
65
|
-
__name(this, "UnprocessableEntityException");
|
|
66
|
-
}
|
|
67
69
|
}
|
|
68
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
71
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/unprocessable-entity.exception.ts"],"sourcesContent":["import pluralize from 'pluralize';\n\nimport { UnprocessableEntityError } from '../interfaces';\nimport { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnprocessableEntityException\n extends Error\n implements RequestException\n{\n readonly status = 422;\n readonly name = 'UnprocessableEntityException';\n readonly message: string = 'Unprocessable entity';\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: UnprocessableEntityError[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n const requirement: string = pluralize('requirement', errors.length);\n\n this.message = `The following ${requirement} must be met:\\n`;\n\n for (const { code } of errors) {\n this.message = this.message.concat(`\\t${code}\\n`);\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAKf,MAAM,qCACH,MAEV;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/unprocessable-entity.exception.ts"],"sourcesContent":["import pluralize from 'pluralize';\n\nimport { UnprocessableEntityError } from '../interfaces';\nimport { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnprocessableEntityException\n extends Error\n implements RequestException\n{\n readonly status = 422;\n readonly name = 'UnprocessableEntityException';\n readonly message: string = 'Unprocessable entity';\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: UnprocessableEntityError[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n const requirement: string = pluralize('requirement', errors.length);\n\n this.message = `The following ${requirement} must be met:\\n`;\n\n for (const { code } of errors) {\n this.message = this.message.concat(`\\t${code}\\n`);\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB;AAKf,MAAM,qCACH,MAEV;AAAA,EARA,OAQA;AAAA;AAAA;AAAA,EACW,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAEN,SAAK,YAAY;AAEjB,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB;AAEA,QAAI,MAAM;AACR,WAAK,OAAO;AAAA,IACd;AAEA,QAAI,QAAQ;AACV,YAAM,kBAAsB,iBAAAA,SAAU,eAAe,OAAO,MAAM;AAElE,WAAK,UAAU,iBAAiB,WAAW;AAAA;AAE3C,iBAAW,EAAE,MAAAC,MAAK,KAAK,QAAQ;AAC7B,aAAK,UAAU,KAAK,QAAQ,OAAO,IAAKA,KAAI;AAAA,CAAI;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AACF;","names":["pluralize","code"]}
|
|
@@ -2,6 +2,14 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import pluralize from "pluralize";
|
|
4
4
|
class UnprocessableEntityException extends Error {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "UnprocessableEntityException");
|
|
7
|
+
}
|
|
8
|
+
status = 422;
|
|
9
|
+
name = "UnprocessableEntityException";
|
|
10
|
+
message = "Unprocessable entity";
|
|
11
|
+
code;
|
|
12
|
+
requestID;
|
|
5
13
|
constructor({
|
|
6
14
|
code,
|
|
7
15
|
errors,
|
|
@@ -9,9 +17,6 @@ class UnprocessableEntityException extends Error {
|
|
|
9
17
|
requestID
|
|
10
18
|
}) {
|
|
11
19
|
super();
|
|
12
|
-
this.status = 422;
|
|
13
|
-
this.name = "UnprocessableEntityException";
|
|
14
|
-
this.message = "Unprocessable entity";
|
|
15
20
|
this.requestID = requestID;
|
|
16
21
|
if (message) {
|
|
17
22
|
this.message = message;
|
|
@@ -29,9 +34,6 @@ class UnprocessableEntityException extends Error {
|
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
|
-
static {
|
|
33
|
-
__name(this, "UnprocessableEntityException");
|
|
34
|
-
}
|
|
35
37
|
}
|
|
36
38
|
export {
|
|
37
39
|
UnprocessableEntityException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/unprocessable-entity.exception.ts"],"sourcesContent":["import pluralize from 'pluralize';\n\nimport { UnprocessableEntityError } from '../interfaces';\nimport { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnprocessableEntityException\n extends Error\n implements RequestException\n{\n readonly status = 422;\n readonly name = 'UnprocessableEntityException';\n readonly message: string = 'Unprocessable entity';\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: UnprocessableEntityError[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n const requirement: string = pluralize('requirement', errors.length);\n\n this.message = `The following ${requirement} must be met:\\n`;\n\n for (const { code } of errors) {\n this.message = this.message.concat(`\\t${code}\\n`);\n }\n }\n }\n}\n"],"mappings":";;AAAA,OAAO,eAAe;AAKf,MAAM,qCACH,MAEV;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/unprocessable-entity.exception.ts"],"sourcesContent":["import pluralize from 'pluralize';\n\nimport { UnprocessableEntityError } from '../interfaces';\nimport { RequestException } from '../interfaces/request-exception.interface';\n\nexport class UnprocessableEntityException\n extends Error\n implements RequestException\n{\n readonly status = 422;\n readonly name = 'UnprocessableEntityException';\n readonly message: string = 'Unprocessable entity';\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: UnprocessableEntityError[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n const requirement: string = pluralize('requirement', errors.length);\n\n this.message = `The following ${requirement} must be met:\\n`;\n\n for (const { code } of errors) {\n this.message = this.message.concat(`\\t${code}\\n`);\n }\n }\n }\n}\n"],"mappings":";;AAAA,OAAO,eAAe;AAKf,MAAM,qCACH,MAEV;AAAA,EARA,OAQA;AAAA;AAAA;AAAA,EACW,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAEN,SAAK,YAAY;AAEjB,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB;AAEA,QAAI,MAAM;AACR,WAAK,OAAO;AAAA,IACd;AAEA,QAAI,QAAQ;AACV,YAAM,cAAsB,UAAU,eAAe,OAAO,MAAM;AAElE,WAAK,UAAU,iBAAiB,WAAW;AAAA;AAE3C,iBAAW,EAAE,MAAAA,MAAK,KAAK,QAAQ;AAC7B,aAAK,UAAU,KAAK,QAAQ,OAAO,IAAKA,KAAI;AAAA,CAAI;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AACF;","names":["code"]}
|
|
@@ -42,6 +42,7 @@ class FetchHttpClient extends import_http_client2.HttpClient {
|
|
|
42
42
|
static {
|
|
43
43
|
__name(this, "FetchHttpClient");
|
|
44
44
|
}
|
|
45
|
+
_fetchFn;
|
|
45
46
|
/** @override */
|
|
46
47
|
getClientName() {
|
|
47
48
|
return "fetch";
|
|
@@ -209,6 +210,7 @@ class FetchHttpClientResponse extends import_http_client2.HttpClientResponse {
|
|
|
209
210
|
static {
|
|
210
211
|
__name(this, "FetchHttpClientResponse");
|
|
211
212
|
}
|
|
213
|
+
_res;
|
|
212
214
|
constructor(res) {
|
|
213
215
|
super(
|
|
214
216
|
res.status,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/net/fetch-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\nimport { HttpClient, HttpClientError, HttpClientResponse } from './http-client';\n\nexport class FetchHttpClient extends HttpClient implements HttpClientInterface {\n private readonly _fetchFn;\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n fetchFn?: typeof fetch,\n ) {\n super(baseURL, options);\n\n // Default to global fetch if available\n if (!fetchFn) {\n if (!globalThis.fetch) {\n throw new Error(\n 'Fetch function not defined in the global scope and no replacement was provided.',\n );\n }\n fetchFn = globalThis.fetch;\n }\n\n this._fetchFn = fetchFn.bind(globalThis);\n }\n\n /** @override */\n getClientName(): string {\n return 'fetch';\n }\n\n async get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'GET',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(resourceURL, 'GET', null, options.headers);\n }\n }\n\n async post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n }\n }\n\n private async fetchRequest(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n // For methods which expect payloads, we should always pass a body value\n // even when it is empty. Without this, some JS runtimes (eg. Deno) will\n // inject a second Content-Length header.\n const methodHasPayload =\n method === 'POST' || method === 'PUT' || method === 'PATCH';\n\n const requestBody = body || (methodHasPayload ? '' : undefined);\n\n const { 'User-Agent': userAgent } = this.options?.headers as RequestHeaders;\n\n const res = await this._fetchFn(url, {\n method,\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n ...this.options?.headers,\n ...headers,\n 'User-Agent': this.addClientToUserAgent(userAgent.toString()),\n },\n body: requestBody,\n });\n\n if (!res.ok) {\n throw new HttpClientError({\n message: res.statusText,\n response: {\n status: res.status,\n headers: res.headers,\n data: await res.json(),\n },\n });\n }\n\n return new FetchHttpClientResponse(res);\n }\n\n private async fetchRequestWithRetry(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n let response: HttpClientResponseInterface;\n let retryAttempts = 1;\n\n const makeRequest = async (): Promise<HttpClientResponseInterface> => {\n let requestError: any = null;\n\n try {\n response = await this.fetchRequest(url, method, body, headers);\n } catch (e) {\n requestError = e;\n }\n\n if (this.shouldRetryRequest(requestError, retryAttempts)) {\n retryAttempts++;\n await this.sleep(retryAttempts);\n return makeRequest();\n }\n\n if (requestError != null) {\n throw requestError;\n }\n\n return response;\n };\n\n return makeRequest();\n }\n\n private shouldRetryRequest(requestError: any, retryAttempt: number): boolean {\n if (retryAttempt > this.MAX_RETRY_ATTEMPTS) {\n return false;\n }\n\n if (requestError != null) {\n if (requestError instanceof TypeError) {\n return true;\n }\n\n if (\n requestError instanceof HttpClientError &&\n this.RETRY_STATUS_CODES.includes(requestError.response.status)\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\n// tslint:disable-next-line\nexport class FetchHttpClientResponse\n extends HttpClientResponse\n implements HttpClientResponseInterface\n{\n _res: Response;\n\n constructor(res: Response) {\n super(\n res.status,\n FetchHttpClientResponse._transformHeadersToObject(res.headers),\n );\n this._res = res;\n }\n\n getRawResponse(): Response {\n return this._res;\n }\n\n toJSON(): Promise<any> | null {\n const contentType = this._res.headers.get('content-type');\n const isJsonResponse = contentType?.includes('application/json');\n\n return isJsonResponse ? this._res.json() : null;\n }\n\n static _transformHeadersToObject(headers: Headers): ResponseHeaders {\n // Fetch uses a Headers instance so this must be converted to a barebones\n // JS object to meet the HttpClient interface.\n const headersObj: ResponseHeaders = {};\n for (const entry of Object.entries(headers)) {\n if (!Array.isArray(entry) || entry.length !== 2) {\n throw new Error(\n 'Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.',\n );\n }\n\n headersObj[entry[0]] = entry[1];\n }\n\n return headersObj;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,IAAAA,sBAAgE;AAEzD,MAAM,wBAAwB,+BAA0C;AAAA,EAG7E,YACW,SACA,SACT,SACA;AACA,UAAM,SAAS,OAAO;AAJb;AACA;AAMT,QAAI,CAAC,SAAS;AACZ,UAAI,CAAC,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACR;A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AA,EAEA,SAA8B;AAC5B,UAAM,cAAc,KAAK,KAAK,QAAQ,IAAI,cAAc;AACxD,UAAM,iBAAiB,aAAa,SAAS,kBAAkB;AAE/D,WAAO,iBAAiB,KAAK,KAAK,KAAK,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,SAAmC;AAGlE,UAAM,aAA8B,CAAC;AACrC,eAAW,SAAS,OAAO,QAAQ,OAAO,GAAG;AAC3C,UAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC/C,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,iBAAW,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AACF;","names":["import_http_client"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/common/net/fetch-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\nimport { HttpClient, HttpClientError, HttpClientResponse } from './http-client';\n\nexport class FetchHttpClient extends HttpClient implements HttpClientInterface {\n private readonly _fetchFn;\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n fetchFn?: typeof fetch,\n ) {\n super(baseURL, options);\n\n // Default to global fetch if available\n if (!fetchFn) {\n if (!globalThis.fetch) {\n throw new Error(\n 'Fetch function not defined in the global scope and no replacement was provided.',\n );\n }\n fetchFn = globalThis.fetch;\n }\n\n this._fetchFn = fetchFn.bind(globalThis);\n }\n\n /** @override */\n getClientName(): string {\n return 'fetch';\n }\n\n async get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'GET',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(resourceURL, 'GET', null, options.headers);\n }\n }\n\n async post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n }\n }\n\n private async fetchRequest(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n // For methods which expect payloads, we should always pass a body value\n // even when it is empty. Without this, some JS runtimes (eg. Deno) will\n // inject a second Content-Length header.\n const methodHasPayload =\n method === 'POST' || method === 'PUT' || method === 'PATCH';\n\n const requestBody = body || (methodHasPayload ? '' : undefined);\n\n const { 'User-Agent': userAgent } = this.options?.headers as RequestHeaders;\n\n const res = await this._fetchFn(url, {\n method,\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n ...this.options?.headers,\n ...headers,\n 'User-Agent': this.addClientToUserAgent(userAgent.toString()),\n },\n body: requestBody,\n });\n\n if (!res.ok) {\n throw new HttpClientError({\n message: res.statusText,\n response: {\n status: res.status,\n headers: res.headers,\n data: await res.json(),\n },\n });\n }\n\n return new FetchHttpClientResponse(res);\n }\n\n private async fetchRequestWithRetry(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n let response: HttpClientResponseInterface;\n let retryAttempts = 1;\n\n const makeRequest = async (): Promise<HttpClientResponseInterface> => {\n let requestError: any = null;\n\n try {\n response = await this.fetchRequest(url, method, body, headers);\n } catch (e) {\n requestError = e;\n }\n\n if (this.shouldRetryRequest(requestError, retryAttempts)) {\n retryAttempts++;\n await this.sleep(retryAttempts);\n return makeRequest();\n }\n\n if (requestError != null) {\n throw requestError;\n }\n\n return response;\n };\n\n return makeRequest();\n }\n\n private shouldRetryRequest(requestError: any, retryAttempt: number): boolean {\n if (retryAttempt > this.MAX_RETRY_ATTEMPTS) {\n return false;\n }\n\n if (requestError != null) {\n if (requestError instanceof TypeError) {\n return true;\n }\n\n if (\n requestError instanceof HttpClientError &&\n this.RETRY_STATUS_CODES.includes(requestError.response.status)\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\n// tslint:disable-next-line\nexport class FetchHttpClientResponse\n extends HttpClientResponse\n implements HttpClientResponseInterface\n{\n _res: Response;\n\n constructor(res: Response) {\n super(\n res.status,\n FetchHttpClientResponse._transformHeadersToObject(res.headers),\n );\n this._res = res;\n }\n\n getRawResponse(): Response {\n return this._res;\n }\n\n toJSON(): Promise<any> | null {\n const contentType = this._res.headers.get('content-type');\n const isJsonResponse = contentType?.includes('application/json');\n\n return isJsonResponse ? this._res.json() : null;\n }\n\n static _transformHeadersToObject(headers: Headers): ResponseHeaders {\n // Fetch uses a Headers instance so this must be converted to a barebones\n // JS object to meet the HttpClient interface.\n const headersObj: ResponseHeaders = {};\n for (const entry of Object.entries(headers)) {\n if (!Array.isArray(entry) || entry.length !== 2) {\n throw new Error(\n 'Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.',\n );\n }\n\n headersObj[entry[0]] = entry[1];\n }\n\n return headersObj;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,IAAAA,sBAAgE;AAEzD,MAAM,wBAAwB,+BAA0C;AAAA,EAG7E,YACW,SACA,SACT,SACA;AACA,UAAM,SAAS,OAAO;AAJb;AACA;AAMT,QAAI,CAAC,SAAS;AACZ,UAAI,CAAC,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,gBAAU,WAAW;AAAA,IACvB;AAEA,SAAK,WAAW,QAAQ,KAAK,UAAU;AAAA,EACzC;AAAA,EA9BF,OAS+E;AAAA;AAAA;AAAA,EAC5D;AAAA;AAAA,EAuBjB,gBAAwB;AACtB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,IACJ,MACA,SACsC;AACtC,UAAM,cAAc,+BAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MACA,QAAQ;AAAA,IACV;AAEA,QAAI,KAAK,WAAW,OAAO,GAAG;AAC5B,aAAO,MAAM,KAAK;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,IACF,OAAO;AACL,aAAO,MAAM,KAAK,aAAa,aAAa,OAAO,MAAM,QAAQ,OAAO;AAAA,IAC1E;AAAA,EACF;AAAA,EAEA,MAAM,KACJ,MACA,QACA,SACsC;AACtC,UAAM,cAAc,+BAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MAC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EA,aAAO;AAAA,IACT,GApBoB;AAsBpB,WAAO,YAAY;AAAA,EACrB;AAAA,EAEQ,mBAAmB,cAAmB,cAA+B;AAC3E,QAAI,eAAe,KAAK,oBAAoB;AAC1C,aAAO;AAAA,IACT;AAEA,QAAI,gBAAgB,MAAM;AACxB,UAAI,wBAAwB,WAAW;AACrC,eAAO;AAAA,MACT;AAEA,UACE,wBAAwB,uCACxB,KAAK,mBAAmB,SAAS,aAAa,SAAS,MAAM,GAC7D;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAGO,MAAM,gCACH,uCAEV;AAAA,EAhQA,OAgQA;AAAA;AAAA;AAAA,EACE;AAAA,EAEA,YAAY,KAAe;AACzB;AAAA,MACE,IAAI;AAAA,MACJ,wBAAwB,0BAA0B,IAAI,OAAO;AAAA,IAC/D;AACA,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,iBAA2B;AACzB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,SAA8B;AAC5B,UAAM,cAAc,KAAK,KAAK,QAAQ,IAAI,cAAc;AACxD,UAAM,iBAAiB,aAAa,SAAS,kBAAkB;AAE/D,WAAO,iBAAiB,KAAK,KAAK,KAAK,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,SAAmC;AAGlE,UAAM,aAA8B,CAAC;AACrC,eAAW,SAAS,OAAO,QAAQ,OAAO,GAAG;AAC3C,UAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC/C,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,iBAAW,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AACF;","names":["import_http_client"]}
|
|
@@ -19,6 +19,7 @@ class FetchHttpClient extends HttpClient {
|
|
|
19
19
|
static {
|
|
20
20
|
__name(this, "FetchHttpClient");
|
|
21
21
|
}
|
|
22
|
+
_fetchFn;
|
|
22
23
|
/** @override */
|
|
23
24
|
getClientName() {
|
|
24
25
|
return "fetch";
|
|
@@ -186,6 +187,7 @@ class FetchHttpClientResponse extends HttpClientResponse {
|
|
|
186
187
|
static {
|
|
187
188
|
__name(this, "FetchHttpClientResponse");
|
|
188
189
|
}
|
|
190
|
+
_res;
|
|
189
191
|
constructor(res) {
|
|
190
192
|
super(
|
|
191
193
|
res.status,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/net/fetch-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\nimport { HttpClient, HttpClientError, HttpClientResponse } from './http-client';\n\nexport class FetchHttpClient extends HttpClient implements HttpClientInterface {\n private readonly _fetchFn;\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n fetchFn?: typeof fetch,\n ) {\n super(baseURL, options);\n\n // Default to global fetch if available\n if (!fetchFn) {\n if (!globalThis.fetch) {\n throw new Error(\n 'Fetch function not defined in the global scope and no replacement was provided.',\n );\n }\n fetchFn = globalThis.fetch;\n }\n\n this._fetchFn = fetchFn.bind(globalThis);\n }\n\n /** @override */\n getClientName(): string {\n return 'fetch';\n }\n\n async get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'GET',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(resourceURL, 'GET', null, options.headers);\n }\n }\n\n async post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n }\n }\n\n private async fetchRequest(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n // For methods which expect payloads, we should always pass a body value\n // even when it is empty. Without this, some JS runtimes (eg. Deno) will\n // inject a second Content-Length header.\n const methodHasPayload =\n method === 'POST' || method === 'PUT' || method === 'PATCH';\n\n const requestBody = body || (methodHasPayload ? '' : undefined);\n\n const { 'User-Agent': userAgent } = this.options?.headers as RequestHeaders;\n\n const res = await this._fetchFn(url, {\n method,\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n ...this.options?.headers,\n ...headers,\n 'User-Agent': this.addClientToUserAgent(userAgent.toString()),\n },\n body: requestBody,\n });\n\n if (!res.ok) {\n throw new HttpClientError({\n message: res.statusText,\n response: {\n status: res.status,\n headers: res.headers,\n data: await res.json(),\n },\n });\n }\n\n return new FetchHttpClientResponse(res);\n }\n\n private async fetchRequestWithRetry(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n let response: HttpClientResponseInterface;\n let retryAttempts = 1;\n\n const makeRequest = async (): Promise<HttpClientResponseInterface> => {\n let requestError: any = null;\n\n try {\n response = await this.fetchRequest(url, method, body, headers);\n } catch (e) {\n requestError = e;\n }\n\n if (this.shouldRetryRequest(requestError, retryAttempts)) {\n retryAttempts++;\n await this.sleep(retryAttempts);\n return makeRequest();\n }\n\n if (requestError != null) {\n throw requestError;\n }\n\n return response;\n };\n\n return makeRequest();\n }\n\n private shouldRetryRequest(requestError: any, retryAttempt: number): boolean {\n if (retryAttempt > this.MAX_RETRY_ATTEMPTS) {\n return false;\n }\n\n if (requestError != null) {\n if (requestError instanceof TypeError) {\n return true;\n }\n\n if (\n requestError instanceof HttpClientError &&\n this.RETRY_STATUS_CODES.includes(requestError.response.status)\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\n// tslint:disable-next-line\nexport class FetchHttpClientResponse\n extends HttpClientResponse\n implements HttpClientResponseInterface\n{\n _res: Response;\n\n constructor(res: Response) {\n super(\n res.status,\n FetchHttpClientResponse._transformHeadersToObject(res.headers),\n );\n this._res = res;\n }\n\n getRawResponse(): Response {\n return this._res;\n }\n\n toJSON(): Promise<any> | null {\n const contentType = this._res.headers.get('content-type');\n const isJsonResponse = contentType?.includes('application/json');\n\n return isJsonResponse ? this._res.json() : null;\n }\n\n static _transformHeadersToObject(headers: Headers): ResponseHeaders {\n // Fetch uses a Headers instance so this must be converted to a barebones\n // JS object to meet the HttpClient interface.\n const headersObj: ResponseHeaders = {};\n for (const entry of Object.entries(headers)) {\n if (!Array.isArray(entry) || entry.length !== 2) {\n throw new Error(\n 'Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.',\n );\n }\n\n headersObj[entry[0]] = entry[1];\n }\n\n return headersObj;\n }\n}\n"],"mappings":";;AAOA,SAAS,YAAY,iBAAiB,0BAA0B;AAEzD,MAAM,wBAAwB,WAA0C;AAAA,EAG7E,YACW,SACA,SACT,SACA;AACA,UAAM,SAAS,OAAO;AAJb;AACA;AAMT,QAAI,CAAC,SAAS;AACZ,UAAI,CAAC,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,gBAAU,WAAW;AAAA,IACvB;AAEA,SAAK,WAAW,QAAQ,KAAK,UAAU;AAAA,EACzC;AAAA,EA9BF,OAS+E;AAAA;AAAA;AAAA;AAAA,EAwB7E,gBAAwB;AACtB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,IACJ,MACA,SACsC;AACtC,UAAM,cAAc,WAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MACA,QAAQ;AAAA,IACV;AAEA,QAAI,KAAK,WAAW,OAAO,GAAG;AAC5B,aAAO,MAAM,KAAK;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,IACF,OAAO;AACL,aAAO,MAAM,KAAK,aAAa,aAAa,OAAO,MAAM,QAAQ,OAAO;AAAA,IAC1E;AAAA,EACF;AAAA,EAEA,MAAM,KACJ,MACA,QACA,SACsC;AACtC,UAAM,cAAc,WAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MACA,QAAQ;AAAA,IACV;AAEA,QAAI,KAAK,WAAW,OAAO,GAAG;AAC5B,aAAO,MAAM,KAAK;AAAA,QAChB;AAAA,QACA;AAAA,QACA,WAAW,QAAQ,MAAM;AAAA,QACzB;AAAA,UACE,GAAG,WAAW,qBAAqB,MAAM;AAAA,UACzC,GAAG,QAAQ;AAAA,QACb;AAAA,MACF;AAAA,IACF,OAAO;AACL,aAAO,MAAM,KAAK;AAAA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,MAAM,GAC7D;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAGO,MAAM,gCACH,mBAEV;AAAA,EAhQA,OAgQA;AAAA;AAAA;AAAA,EAGE,YAAY,KAAe;AACzB;AAAA,MACE,IAAI;AAAA,MACJ,wBAAwB,0BAA0B,IAAI,OAAO;AAAA,IAC/D;AACA,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,iBAA2B;AACzB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,SAA8B;AAC5B,UAAM,cAAc,KAAK,KAAK,QAAQ,IAAI,cAAc;AACxD,UAAM,iBAAiB,aAAa,SAAS,kBAAkB;AAE/D,WAAO,iBAAiB,KAAK,KAAK,KAAK,IAAI;AAAA,EAC7C;AAAA,EAEA,OAAO,0BAA0B,SAAmC;AAGlE,UAAM,aAA8B,CAAC;AACrC,eAAW,SAAS,OAAO,QAAQ,OAAO,GAAG;AAC3C,UAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC/C,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAEA,iBAAW,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/common/net/fetch-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\nimport { HttpClient, HttpClientError, HttpClientResponse } from './http-client';\n\nexport class FetchHttpClient extends HttpClient implements HttpClientInterface {\n private readonly _fetchFn;\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n fetchFn?: typeof fetch,\n ) {\n super(baseURL, options);\n\n // Default to global fetch if available\n if (!fetchFn) {\n if (!globalThis.fetch) {\n throw new Error(\n 'Fetch function not defined in the global scope and no replacement was provided.',\n );\n }\n fetchFn = globalThis.fetch;\n }\n\n this._fetchFn = fetchFn.bind(globalThis);\n }\n\n /** @override */\n getClientName(): string {\n return 'fetch';\n }\n\n async get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'GET',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(resourceURL, 'GET', null, options.headers);\n }\n }\n\n async post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'POST',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'PUT',\n HttpClient.getBody(entity),\n {\n ...HttpClient.getContentTypeHeader(entity),\n ...options.headers,\n },\n );\n }\n }\n\n async delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface> {\n const resourceURL = HttpClient.getResourceURL(\n this.baseURL,\n path,\n options.params,\n );\n\n if (path.startsWith('/fga/')) {\n return await this.fetchRequestWithRetry(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n } else {\n return await this.fetchRequest(\n resourceURL,\n 'DELETE',\n null,\n options.headers,\n );\n }\n }\n\n private async fetchRequest(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n // For methods which expect payloads, we should always pass a body value\n // even when it is empty. Without this, some JS runtimes (eg. Deno) will\n // inject a second Content-Length header.\n const methodHasPayload =\n method === 'POST' || method === 'PUT' || method === 'PATCH';\n\n const requestBody = body || (methodHasPayload ? '' : undefined);\n\n const { 'User-Agent': userAgent } = this.options?.headers as RequestHeaders;\n\n const res = await this._fetchFn(url, {\n method,\n headers: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n ...this.options?.headers,\n ...headers,\n 'User-Agent': this.addClientToUserAgent(userAgent.toString()),\n },\n body: requestBody,\n });\n\n if (!res.ok) {\n throw new HttpClientError({\n message: res.statusText,\n response: {\n status: res.status,\n headers: res.headers,\n data: await res.json(),\n },\n });\n }\n\n return new FetchHttpClientResponse(res);\n }\n\n private async fetchRequestWithRetry(\n url: string,\n method: string,\n body?: any,\n headers?: RequestHeaders,\n ): Promise<HttpClientResponseInterface> {\n let response: HttpClientResponseInterface;\n let retryAttempts = 1;\n\n const makeRequest = async (): Promise<HttpClientResponseInterface> => {\n let requestError: any = null;\n\n try {\n response = await this.fetchRequest(url, method, body, headers);\n } catch (e) {\n requestError = e;\n }\n\n if (this.shouldRetryRequest(requestError, retryAttempts)) {\n retryAttempts++;\n await this.sleep(retryAttempts);\n return makeRequest();\n }\n\n if (requestError != null) {\n throw requestError;\n }\n\n return response;\n };\n\n return makeRequest();\n }\n\n private shouldRetryRequest(requestError: any, retryAttempt: number): boolean {\n if (retryAttempt > this.MAX_RETRY_ATTEMPTS) {\n return false;\n }\n\n if (requestError != null) {\n if (requestError instanceof TypeError) {\n return true;\n }\n\n if (\n requestError instanceof HttpClientError &&\n this.RETRY_STATUS_CODES.includes(requestError.response.status)\n ) {\n return true;\n }\n }\n\n return false;\n }\n}\n\n// tslint:disable-next-line\nexport class FetchHttpClientResponse\n extends HttpClientResponse\n implements HttpClientResponseInterface\n{\n _res: Response;\n\n constructor(res: Response) {\n super(\n res.status,\n FetchHttpClientResponse._transformHeadersToObject(res.headers),\n );\n this._res = res;\n }\n\n getRawResponse(): Response {\n return this._res;\n }\n\n toJSON(): Promise<any> | null {\n const contentType = this._res.headers.get('content-type');\n const isJsonResponse = contentType?.includes('application/json');\n\n return isJsonResponse ? this._res.json() : null;\n }\n\n static _transformHeadersToObject(headers: Headers): ResponseHeaders {\n // Fetch uses a Headers instance so this must be converted to a barebones\n // JS object to meet the HttpClient interface.\n const headersObj: ResponseHeaders = {};\n for (const entry of Object.entries(headers)) {\n if (!Array.isArray(entry) || entry.length !== 2) {\n throw new Error(\n 'Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.',\n );\n }\n\n headersObj[entry[0]] = entry[1];\n }\n\n return headersObj;\n }\n}\n"],"mappings":";;AAOA,SAAS,YAAY,iBAAiB,0BAA0B;AAEzD,MAAM,wBAAwB,WAA0C;AAAA,EAG7E,YACW,SACA,SACT,SACA;AACA,UAAM,SAAS,OAAO;AAJb;AACA;AAMT,QAAI,CAAC,SAAS;AACZ,UAAI,CAAC,WAAW,OAAO;AACrB,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,gBAAU,WAAW;AAAA,IACvB;AAEA,SAAK,WAAW,QAAQ,KAAK,UAAU;AAAA,EACzC;AAAA,EA9BF,OAS+E;AAAA;AAAA;AAAA,EAC5D;AAAA;AAAA,EAuBjB,gBAAwB;AACtB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,IACJ,MACA,SACsC;AACtC,UAAM,cAAc,WAAW;AAAA,MAC7B,KAAK;AAAA,MACL;AAAA,MACA,QAAQ;AAAA,IACV;AAEA,QAAI,KAAK,WAAW,OAAO,GAAG;AAC5B,aAAO,MAAM,KAAK;AAAA,Q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AAAA,MACF;AAEA,iBAAW,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -28,17 +28,14 @@ class HttpClient {
|
|
|
28
28
|
constructor(baseURL, options) {
|
|
29
29
|
this.baseURL = baseURL;
|
|
30
30
|
this.options = options;
|
|
31
|
-
this.MAX_RETRY_ATTEMPTS = 3;
|
|
32
|
-
this.BACKOFF_MULTIPLIER = 1.5;
|
|
33
|
-
this.MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;
|
|
34
|
-
this.RETRY_STATUS_CODES = [500, 502, 504];
|
|
35
|
-
this.sleep = /* @__PURE__ */ __name((retryAttempt) => new Promise(
|
|
36
|
-
(resolve) => setTimeout(resolve, this.getSleepTimeInMilliseconds(retryAttempt))
|
|
37
|
-
), "sleep");
|
|
38
31
|
}
|
|
39
32
|
static {
|
|
40
33
|
__name(this, "HttpClient");
|
|
41
34
|
}
|
|
35
|
+
MAX_RETRY_ATTEMPTS = 3;
|
|
36
|
+
BACKOFF_MULTIPLIER = 1.5;
|
|
37
|
+
MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;
|
|
38
|
+
RETRY_STATUS_CODES = [500, 502, 504];
|
|
42
39
|
/** The HTTP client name used for diagnostics */
|
|
43
40
|
getClientName() {
|
|
44
41
|
throw new Error("getClientName not implemented");
|
|
@@ -82,11 +79,16 @@ class HttpClient {
|
|
|
82
79
|
const jitter = Math.random() + 0.5;
|
|
83
80
|
return sleepTime * jitter;
|
|
84
81
|
}
|
|
82
|
+
sleep = /* @__PURE__ */ __name((retryAttempt) => new Promise(
|
|
83
|
+
(resolve) => setTimeout(resolve, this.getSleepTimeInMilliseconds(retryAttempt))
|
|
84
|
+
), "sleep");
|
|
85
85
|
}
|
|
86
86
|
class HttpClientResponse {
|
|
87
87
|
static {
|
|
88
88
|
__name(this, "HttpClientResponse");
|
|
89
89
|
}
|
|
90
|
+
_statusCode;
|
|
91
|
+
_headers;
|
|
90
92
|
constructor(statusCode, headers) {
|
|
91
93
|
this._statusCode = statusCode;
|
|
92
94
|
this._headers = headers;
|
|
@@ -99,19 +101,20 @@ class HttpClientResponse {
|
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
class HttpClientError extends Error {
|
|
104
|
+
static {
|
|
105
|
+
__name(this, "HttpClientError");
|
|
106
|
+
}
|
|
107
|
+
name = "HttpClientError";
|
|
108
|
+
message = "The request could not be completed.";
|
|
109
|
+
response;
|
|
102
110
|
constructor({
|
|
103
111
|
message,
|
|
104
112
|
response
|
|
105
113
|
}) {
|
|
106
114
|
super(message);
|
|
107
|
-
this.name = "HttpClientError";
|
|
108
|
-
this.message = "The request could not be completed.";
|
|
109
115
|
this.message = message;
|
|
110
116
|
this.response = response;
|
|
111
117
|
}
|
|
112
|
-
static {
|
|
113
|
-
__name(this, "HttpClientError");
|
|
114
|
-
}
|
|
115
118
|
}
|
|
116
119
|
// Annotate the CommonJS export names for ESM import in node:
|
|
117
120
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/net/http-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\n\nexport abstract class HttpClient implements HttpClientInterface {\n readonly MAX_RETRY_ATTEMPTS = 3;\n readonly BACKOFF_MULTIPLIER = 1.5;\n readonly MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;\n readonly RETRY_STATUS_CODES = [500, 502, 504];\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n ) {}\n\n /** The HTTP client name used for diagnostics */\n getClientName(): string {\n throw new Error('getClientName not implemented');\n }\n\n abstract get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n addClientToUserAgent(userAgent: string): string {\n if (userAgent.indexOf(' ') > -1) {\n return userAgent.replace(/\\b\\s/, `/${this.getClientName()} `);\n } else {\n return (userAgent += `/${this.getClientName()}`);\n }\n }\n\n static getResourceURL(\n baseURL: string,\n path: string,\n params?: Record<string, any>,\n ) {\n const queryString = HttpClient.getQueryString(params);\n const url = new URL([path, queryString].filter(Boolean).join('?'), baseURL);\n return url.toString();\n }\n\n static getQueryString(queryObj?: Record<string, any>) {\n if (!queryObj) return undefined;\n\n const sanitizedQueryObj: Record<string, any> = {};\n\n Object.entries(queryObj).forEach(([param, value]) => {\n if (value !== '' && value !== undefined) sanitizedQueryObj[param] = value;\n });\n\n return new URLSearchParams(sanitizedQueryObj).toString();\n }\n\n static getContentTypeHeader(entity: any): RequestHeaders | undefined {\n if (entity instanceof URLSearchParams) {\n return {\n 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',\n };\n }\n return undefined;\n }\n\n static getBody(entity: any): BodyInit | null | undefined {\n if (entity === null || entity instanceof URLSearchParams) {\n return entity;\n }\n\n return JSON.stringify(entity);\n }\n\n private getSleepTimeInMilliseconds(retryAttempt: number): number {\n const sleepTime =\n this.MINIMUM_SLEEP_TIME_IN_MILLISECONDS *\n Math.pow(this.BACKOFF_MULTIPLIER, retryAttempt);\n const jitter = Math.random() + 0.5;\n return sleepTime * jitter;\n }\n\n sleep = (retryAttempt: number) =>\n new Promise((resolve) =>\n setTimeout(resolve, this.getSleepTimeInMilliseconds(retryAttempt)),\n );\n}\n\n// tslint:disable-next-line\nexport abstract class HttpClientResponse\n implements HttpClientResponseInterface\n{\n _statusCode: number;\n _headers: ResponseHeaders;\n\n constructor(statusCode: number, headers: ResponseHeaders) {\n this._statusCode = statusCode;\n this._headers = headers;\n }\n\n getStatusCode(): number {\n return this._statusCode;\n }\n\n getHeaders(): ResponseHeaders {\n return this._headers;\n }\n\n abstract getRawResponse(): unknown;\n\n abstract toJSON(): any | null;\n}\n\n// tslint:disable-next-line\nexport class HttpClientError<T> extends Error {\n readonly name: string = 'HttpClientError';\n readonly message: string = 'The request could not be completed.';\n readonly response: { status: number; headers: any; data: T };\n\n constructor({\n message,\n response,\n }: {\n message: string;\n readonly response: HttpClientError<T>['response'];\n }) {\n super(message);\n this.message = message;\n this.response = response;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,MAAe,WAA0C;AAAA,EAM9D,YACW,SACA,SACT;AAFS;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/net/http-client.ts"],"sourcesContent":["import {\n HttpClientInterface,\n HttpClientResponseInterface,\n RequestHeaders,\n RequestOptions,\n ResponseHeaders,\n} from '../interfaces/http-client.interface';\n\nexport abstract class HttpClient implements HttpClientInterface {\n readonly MAX_RETRY_ATTEMPTS = 3;\n readonly BACKOFF_MULTIPLIER = 1.5;\n readonly MINIMUM_SLEEP_TIME_IN_MILLISECONDS = 500;\n readonly RETRY_STATUS_CODES = [500, 502, 504];\n\n constructor(\n readonly baseURL: string,\n readonly options?: RequestInit,\n ) {}\n\n /** The HTTP client name used for diagnostics */\n getClientName(): string {\n throw new Error('getClientName not implemented');\n }\n\n abstract get(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract post<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract put<Entity = any>(\n path: string,\n entity: Entity,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n abstract delete(\n path: string,\n options: RequestOptions,\n ): Promise<HttpClientResponseInterface>;\n\n addClientToUserAgent(userAgent: string): string {\n if (userAgent.indexOf(' ') > -1) {\n return userAgent.replace(/\\b\\s/, `/${this.getClientName()} `);\n } else {\n return (userAgent += `/${this.getClientName()}`);\n }\n }\n\n static getResourceURL(\n baseURL: string,\n path: string,\n params?: Record<string, any>,\n ) {\n const queryString = HttpClient.getQueryString(params);\n const url = new URL([path, queryString].filter(Boolean).join('?'), baseURL);\n return url.toString();\n }\n\n static getQueryString(queryObj?: Record<string, any>) {\n if (!queryObj) return undefined;\n\n const sanitizedQueryObj: Record<string, any> = {};\n\n Object.entries(queryObj).forEach(([param, value]) => {\n if (value !== '' && value !== undefined) sanitizedQueryObj[param] = value;\n });\n\n return new URLSearchParams(sanitizedQueryObj).toString();\n }\n\n static getContentTypeHeader(entity: any): RequestHeaders | undefined {\n if (entity instanceof URLSearchParams) {\n return {\n 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',\n };\n }\n return undefined;\n }\n\n static getBody(entity: any): BodyInit | null | undefined {\n if (entity === null || entity instanceof URLSearchParams) {\n return entity;\n }\n\n return JSON.stringify(entity);\n }\n\n private getSleepTimeInMilliseconds(retryAttempt: number): number {\n const sleepTime =\n this.MINIMUM_SLEEP_TIME_IN_MILLISECONDS *\n Math.pow(this.BACKOFF_MULTIPLIER, retryAttempt);\n const jitter = Math.random() + 0.5;\n return sleepTime * jitter;\n }\n\n sleep = (retryAttempt: number) =>\n new Promise((resolve) =>\n setTimeout(resolve, this.getSleepTimeInMilliseconds(retryAttempt)),\n );\n}\n\n// tslint:disable-next-line\nexport abstract class HttpClientResponse\n implements HttpClientResponseInterface\n{\n _statusCode: number;\n _headers: ResponseHeaders;\n\n constructor(statusCode: number, headers: ResponseHeaders) {\n this._statusCode = statusCode;\n this._headers = headers;\n }\n\n getStatusCode(): number {\n return this._statusCode;\n }\n\n getHeaders(): ResponseHeaders {\n return this._headers;\n }\n\n abstract getRawResponse(): unknown;\n\n abstract toJSON(): any | null;\n}\n\n// tslint:disable-next-line\nexport class HttpClientError<T> extends Error {\n readonly name: string = 'HttpClientError';\n readonly message: string = 'The request could not be completed.';\n readonly response: { status: number; headers: any; data: T };\n\n constructor({\n message,\n response,\n }: {\n message: string;\n readonly response: HttpClientError<T>['response'];\n }) {\n super(message);\n this.message = message;\n this.response = response;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,MAAe,WAA0C;AAAA,EAM9D,YACW,SACA,SACT;AAFS;AACA;AAAA,EACR;AAAA,EAjBL,OAQgE;AAAA;AAAA;AAAA,EACrD,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qCAAqC;AAAA,EACrC,qBAAqB,CAAC,KAAK,KAAK,GAAG;AAAA;AAAA,EAQ5C,gBAAwB;AACtB,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAAA,EAwBA,qBAAqB,WAA2B;AAC9C,QAAI,UAAU,QAAQ,GAAG,IAAI,IAAI;AAC/B,aAAO,UAAU,QAAQ,QAAQ,IAAI,KAAK,cAAc,CAAC,GAAG;AAAA,IAC9D,OAAO;AACL,aAAQ,aAAa,IAAI,KAAK,cAAc,CAAC;AAAA,IAC/C;AAAA,EACF;AAAA,EAEA,OAAO,eACL,SACA,MACA,QACA;AACA,UAAM,cAAc,WAAW,eAAe,MAAM;AACpD,UAAM,MAAM,IAAI,IAAI,CAAC,MAAM,WAAW,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG,OAAO;AAC1E,WAAO,IAAI,SAAS;AAAA,EACtB;AAAA,EAEA,OAAO,eAAe,UAAgC;AACpD,QAAI,CAAC,SAAU,QAAO;AAEtB,UAAM,oBAAyC,CAAC;AAEhD,WAAO,QAAQ,QAAQ,EAAE,QAAQ,CAAC,CAAC,OAAO,KAAK,MAAM;AACnD,UAAI,UAAU,MAAM,UAAU,OAAW,mBAAkB,KAAK,IAAI;AAAA,IACtE,CAAC;AAED,WAAO,IAAI,gBAAgB,iBAAiB,EAAE,SAAS;AAAA,EACzD;AAAA,EAEA,OAAO,qBAAqB,QAAyC;AACnE,QAAI,kBAAk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