@opexa/portal-sdk 0.59.133 → 0.59.135
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/README.md +1745 -1745
- package/dist/{chunk-WVFSGB7Y.js → chunk-77N5VUZS.js} +14 -14
- package/dist/chunk-77N5VUZS.js.map +1 -0
- package/dist/{chunk-ISVV44MD.js → chunk-N4FAQNKD.js} +10 -10
- package/dist/chunk-N4FAQNKD.js.map +1 -0
- package/dist/{chunk-7APXFZ5G.js → chunk-ZBLHFIBW.js} +3 -3
- package/dist/chunk-ZBLHFIBW.js.map +1 -0
- package/dist/index.cjs +70 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +54 -6
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +19 -19
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +8 -3
- package/dist/services/index.d.ts +8 -3
- package/dist/services/index.js +2 -2
- package/dist/{types-DOm8J_aC.d.ts → types-BGfb4anC.d.ts} +5 -1
- package/dist/{types-Lu2ILDtj.d.cts → types-Bv7ZtPEZ.d.cts} +5 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7APXFZ5G.js.map +0 -1
- package/dist/chunk-ISVV44MD.js.map +0 -1
- package/dist/chunk-WVFSGB7Y.js.map +0 -1
|
@@ -8,6 +8,18 @@ function gql(strings, ...values) {
|
|
|
8
8
|
return result.trim();
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
// src/utils/call-if-fn.ts
|
|
12
|
+
function isFunction(value) {
|
|
13
|
+
return typeof value === "function";
|
|
14
|
+
}
|
|
15
|
+
function callIfFn(value, ...args) {
|
|
16
|
+
if (isFunction(value)) {
|
|
17
|
+
return value(...args);
|
|
18
|
+
} else {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
11
23
|
// src/utils/status-code-to-operation-error.ts
|
|
12
24
|
function statusCodeToOperationError(value, message) {
|
|
13
25
|
const e = ERROR_MAP[value] ? ERROR_MAP[value] : ERROR_MAP[500];
|
|
@@ -26,18 +38,6 @@ var ERROR_MAP = {
|
|
|
26
38
|
500: { name: "HttpInternalServerError", message: "Internal Server Error" }
|
|
27
39
|
};
|
|
28
40
|
|
|
29
|
-
// src/utils/call-if-fn.ts
|
|
30
|
-
function isFunction(value) {
|
|
31
|
-
return typeof value === "function";
|
|
32
|
-
}
|
|
33
|
-
function callIfFn(value, ...args) {
|
|
34
|
-
if (isFunction(value)) {
|
|
35
|
-
return value(...args);
|
|
36
|
-
} else {
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
41
|
export { callIfFn, gql, statusCodeToOperationError };
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-77N5VUZS.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-77N5VUZS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/gql.ts","../src/utils/call-if-fn.ts","../src/utils/status-code-to-operation-error.ts"],"names":[],"mappings":";AAAO,SAAS,GAAA,CAAI,YAAkC,MAAA,EAAmB;AACxE,EAAA,IAAI,MAAA,GAAS,EAAA;AAEb,EAAA,KAAA,MAAW,CAAC,KAAA,EAAO,MAAM,CAAA,IAAK,OAAA,CAAQ,SAAQ,EAAG;AAChD,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,EAAA,CAAG,KAAK,CAAA,IAAK,EAAA;AAElC,IAAA,MAAA,GAAS,CAAA,EAAG,MAAM,CAAA,EAAG,MAAM,GAAG,KAAK,CAAA,CAAA;AAAA,EACpC;AAEA,EAAA,OAAO,OAAO,IAAA,EAAK;AACpB;;;ACVA,SAAS,WACR,KAAA,EACuC;AACvC,EAAA,OAAO,OAAO,KAAA,KAAU,UAAA;AACzB;AAEO,SAAS,QAAA,CACf,UACG,IAAA,EACF;AACD,EAAA,IAAI,UAAA,CAAyB,KAAK,CAAA,EAAG;AACpC,IAAA,OAAO,KAAA,CAAM,GAAG,IAAI,CAAA;AAAA,EACrB,CAAA,MAAO;AACN,IAAA,OAAO,KAAA;AAAA,EACR;AACD;;;ACbO,SAAS,0BAAA,CACf,OACA,OAAA,EAC4B;AAC5B,EAAA,MAAM,CAAA,GAAI,UAAU,KAAK,CAAA,GAAI,UAAU,KAAK,CAAA,GAAI,UAAU,GAAG,CAAA;AAE7D,EAAA,OAAO;AAAA,IACN,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,OAAA,EAAS,WAAW,CAAA,CAAE;AAAA,GACvB;AACD;AAEA,IAAM,SAAA,GAAuD;AAAA,EAC5D,GAAA,EAAK,EAAE,IAAA,EAAM,gBAAA,EAAkB,SAAS,aAAA,EAAc;AAAA,EACtD,GAAA,EAAK,EAAE,IAAA,EAAM,kBAAA,EAAoB,SAAS,cAAA,EAAe;AAAA,EACzD,GAAA,EAAK,EAAE,IAAA,EAAM,eAAA,EAAiB,SAAS,WAAA,EAAY;AAAA,EACnD,GAAA,EAAK,EAAE,IAAA,EAAM,cAAA,EAAgB,SAAS,WAAA,EAAY;AAAA,EAClD,GAAA,EAAK,EAAE,IAAA,EAAM,oBAAA,EAAsB,SAAS,iBAAA,EAAkB;AAAA,EAC9D,GAAA,EAAK,EAAE,IAAA,EAAM,qBAAA,EAAuB,SAAS,mBAAA,EAAoB;AAAA,EACjE,GAAA,EAAK,EAAE,IAAA,EAAM,yBAAA,EAA2B,SAAS,uBAAA;AAClD,CAAA","file":"chunk-77N5VUZS.js","sourcesContent":["export function gql(strings: TemplateStringsArray, ...values: unknown[]) {\n\tlet result = '';\n\n\tfor (const [index, string] of strings.entries()) {\n\t\tconst value = values.at(index) ?? '';\n\n\t\tresult = `${result}${string}${value}`;\n\t}\n\n\treturn result.trim();\n}\n","function isFunction<Return, Args = never>(\n\tvalue: unknown | ((...args: Args[]) => Return),\n): value is (...args: Args[]) => Return {\n\treturn typeof value === 'function';\n}\n\nexport function callIfFn<Return, Args = never>(\n\tvalue: Return | ((...args: Args[]) => Return),\n\t...args: Args[]\n) {\n\tif (isFunction<Return, Args>(value)) {\n\t\treturn value(...args);\n\t} else {\n\t\treturn value;\n\t}\n}\n","import type { HttpError, OperationError } from '../types/index.js';\n\nexport function statusCodeToOperationError(\n\tvalue: number,\n\tmessage?: string,\n): OperationError<HttpError> {\n\tconst e = ERROR_MAP[value] ? ERROR_MAP[value] : ERROR_MAP[500];\n\n\treturn {\n\t\tname: e.name,\n\t\tmessage: message ?? e.message,\n\t};\n}\n\nconst ERROR_MAP: Record<number, OperationError<HttpError>> = {\n\t400: { name: 'HttpBadRequest', message: 'Bad Request' },\n\t401: { name: 'HttpUnauthorized', message: 'Unauthorized' },\n\t403: { name: 'HttpForbidden', message: 'Forbidden' },\n\t404: { name: 'HttpNotFound', message: 'Not Found' },\n\t408: { name: 'HttpRequestTimeout', message: 'Request Timeout' },\n\t429: { name: 'HttpTooManyRequests', message: 'Too Many Requests' },\n\t500: { name: 'HttpInternalServerError', message: 'Internal Server Error' },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gql,
|
|
1
|
+
import { gql, callIfFn, statusCodeToOperationError } from './chunk-77N5VUZS.js';
|
|
2
2
|
import { Thumbmark } from '@thumbmarkjs/thumbmarkjs';
|
|
3
3
|
import { Capacitor } from '@capacitor/core';
|
|
4
4
|
|
|
@@ -4900,7 +4900,7 @@ var AuthService = class {
|
|
|
4900
4900
|
return await this.graphqlClient.request(GENERATE_OUTBOUND_SINGLE_SIGN_ON_REDIRECT_URL_MUTATION, variables);
|
|
4901
4901
|
}
|
|
4902
4902
|
get headers() {
|
|
4903
|
-
const headers = new Headers(this.options.headers);
|
|
4903
|
+
const headers = new Headers(callIfFn(this.options).headers);
|
|
4904
4904
|
headers.append("Accept", "application/json, text/plain");
|
|
4905
4905
|
headers.append("Content-Type", "application/json");
|
|
4906
4906
|
return headers;
|
|
@@ -5420,16 +5420,16 @@ var CmsPortalService = class {
|
|
|
5420
5420
|
async getJson(path, params) {
|
|
5421
5421
|
const config = callIfFn(this.config);
|
|
5422
5422
|
const fetch_ = config.fetch ?? fetch;
|
|
5423
|
+
const headers = new Headers(config.headers);
|
|
5424
|
+
headers.set("Accept", "application/json");
|
|
5425
|
+
headers.set("Content-Type", "application/json");
|
|
5426
|
+
headers.set("Site-ID", config.site);
|
|
5427
|
+
headers.set("Platform-ID", config.platform);
|
|
5423
5428
|
const req = new Request(
|
|
5424
5429
|
`${config.url}${path}?${params?.toString() ?? ""}`,
|
|
5425
5430
|
{
|
|
5426
5431
|
method: "GET",
|
|
5427
|
-
headers
|
|
5428
|
-
Accept: "application/json",
|
|
5429
|
-
"Content-Type": "application/json",
|
|
5430
|
-
"Site-ID": config.site,
|
|
5431
|
-
"Platform-ID": config.platform
|
|
5432
|
-
}
|
|
5432
|
+
headers
|
|
5433
5433
|
}
|
|
5434
5434
|
);
|
|
5435
5435
|
try {
|
|
@@ -7142,5 +7142,5 @@ var ExtensionService = class {
|
|
|
7142
7142
|
};
|
|
7143
7143
|
|
|
7144
7144
|
export { AccountService, AuthService, CmsPortalService, ExtensionService, FileService, GameService, PortalService, ReportService, TriggerService, WalletService, getFingerPrint, isIOSPlatform };
|
|
7145
|
-
//# sourceMappingURL=chunk-
|
|
7146
|
-
//# sourceMappingURL=chunk-
|
|
7145
|
+
//# sourceMappingURL=chunk-N4FAQNKD.js.map
|
|
7146
|
+
//# sourceMappingURL=chunk-N4FAQNKD.js.map
|