@squidcloud/local-backend 1.0.148 → 1.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/src/ai-assistant.types.d.ts +50 -50
- package/dist/common/src/ai-assistant.types.js +2 -2
- package/dist/common/src/ai-chatbot.context.d.ts +13 -13
- package/dist/common/src/ai-chatbot.context.js +19 -19
- package/dist/common/src/ai-chatbot.schemas.d.ts +18 -18
- package/dist/common/src/ai-chatbot.schemas.js +21 -21
- package/dist/common/src/ai-chatbot.types.d.ts +125 -123
- package/dist/common/src/ai-chatbot.types.js +18 -18
- package/dist/common/src/api-call.context.d.ts +13 -13
- package/dist/common/src/api-call.context.js +16 -16
- package/dist/common/src/api.types.d.ts +22 -22
- package/dist/common/src/api.types.js +2 -2
- package/dist/common/src/application.schemas.d.ts +1648 -1648
- package/dist/common/src/application.schemas.js +948 -948
- package/dist/common/src/application.types.d.ts +193 -193
- package/dist/common/src/application.types.js +89 -89
- package/dist/common/src/application.types.js.map +1 -1
- package/dist/common/src/backend-function.schemas.d.ts +3 -3
- package/dist/common/src/backend-function.schemas.js +11 -11
- package/dist/common/src/backend-function.types.d.ts +4 -4
- package/dist/common/src/backend-function.types.js +2 -2
- package/dist/common/src/backend-run.types.d.ts +54 -54
- package/dist/common/src/backend-run.types.js +92 -95
- package/dist/common/src/backend-run.types.js.map +1 -1
- package/dist/common/src/bundle-api.types.d.ts +65 -69
- package/dist/common/src/bundle-api.types.js +2 -2
- package/dist/common/src/bundle-data.types.d.ts +69 -74
- package/dist/common/src/bundle-data.types.js +2 -2
- package/dist/common/src/communication.types.d.ts +20 -19
- package/dist/common/src/communication.types.js +41 -40
- package/dist/common/src/communication.types.js.map +1 -1
- package/dist/common/src/context.types.d.ts +24 -24
- package/dist/common/src/context.types.js +2 -2
- package/dist/common/src/distributed-lock.context.d.ts +4 -4
- package/dist/common/src/distributed-lock.context.js +9 -9
- package/dist/common/src/document.types.d.ts +32 -32
- package/dist/common/src/document.types.js +50 -50
- package/dist/common/src/graphql.context.d.ts +14 -14
- package/dist/common/src/graphql.context.js +12 -12
- package/dist/common/src/graphql.types.d.ts +11 -11
- package/dist/common/src/graphql.types.js +34 -34
- package/dist/common/src/heartbeat.types.d.ts +4 -4
- package/dist/common/src/heartbeat.types.js +16 -16
- package/dist/common/src/http-status.enum.d.ts +50 -50
- package/dist/common/src/http-status.enum.js +54 -54
- package/dist/common/src/http-status.enum.js.map +1 -1
- package/dist/common/src/index.d.ts +54 -57
- package/dist/common/src/index.js +70 -73
- package/dist/common/src/index.js.map +1 -1
- package/dist/common/src/integrations/ai_chatbot.types.d.ts +31 -31
- package/dist/common/src/integrations/ai_chatbot.types.js +2 -2
- package/dist/common/src/integrations/api.types.d.ts +80 -80
- package/dist/common/src/integrations/api.types.js +2 -2
- package/dist/common/src/integrations/auth.types.d.ts +39 -39
- package/dist/common/src/integrations/auth.types.js +2 -2
- package/dist/common/src/integrations/database.types.d.ts +274 -274
- package/dist/common/src/integrations/database.types.js +2 -2
- package/dist/common/src/integrations/index.d.ts +134 -134
- package/dist/common/src/integrations/index.js +119 -119
- package/dist/common/src/integrations/index.js.map +1 -1
- package/dist/common/src/integrations/observability.types.d.ts +23 -23
- package/dist/common/src/integrations/observability.types.js +23 -23
- package/dist/common/src/logger.types.d.ts +21 -21
- package/dist/common/src/logger.types.js +11 -11
- package/dist/common/src/logger.types.js.map +1 -1
- package/dist/common/src/metrics.types.d.ts +73 -73
- package/dist/common/src/metrics.types.js +11 -11
- package/dist/common/src/mutation.context.d.ts +13 -13
- package/dist/common/src/mutation.context.js +26 -26
- package/dist/common/src/mutation.schemas.d.ts +5 -5
- package/dist/common/src/mutation.schemas.js +114 -114
- package/dist/common/src/mutation.types.d.ts +63 -63
- package/dist/common/src/mutation.types.js +142 -142
- package/dist/common/src/native-query.context.d.ts +7 -7
- package/dist/common/src/native-query.context.js +11 -11
- package/dist/common/src/native-query.types.d.ts +16 -16
- package/dist/common/src/native-query.types.js +2 -2
- package/dist/common/src/query/base-query-builder.d.ts +38 -38
- package/dist/common/src/query/base-query-builder.js +39 -39
- package/dist/common/src/query/index.d.ts +4 -4
- package/dist/common/src/query/index.js +20 -20
- package/dist/common/src/query/pagination.d.ts +46 -46
- package/dist/common/src/query/pagination.js +211 -211
- package/dist/common/src/query/query-context.d.ts +47 -47
- package/dist/common/src/query/query-context.js +159 -159
- package/dist/common/src/query/serialized-query.types.d.ts +24 -24
- package/dist/common/src/query/serialized-query.types.js +2 -2
- package/dist/common/src/query.types.d.ts +86 -86
- package/dist/common/src/query.types.js +97 -97
- package/dist/common/src/regions.d.ts +21 -21
- package/dist/common/src/regions.js +46 -46
- package/dist/common/src/schema/schema.types.d.ts +30 -30
- package/dist/common/src/schema/schema.types.js +173 -173
- package/dist/common/src/secret.schemas.d.ts +4 -4
- package/dist/common/src/secret.schemas.js +17 -17
- package/dist/common/src/secret.types.d.ts +68 -68
- package/dist/common/src/secret.types.js +5 -5
- package/dist/common/src/security.types.d.ts +3 -3
- package/dist/common/src/security.types.js +2 -2
- package/dist/common/src/socket.schemas.d.ts +3 -3
- package/dist/common/src/socket.schemas.js +57 -57
- package/dist/common/src/socket.types.d.ts +126 -126
- package/dist/common/src/socket.types.js +9 -9
- package/dist/common/src/socket.types.js.map +1 -1
- package/dist/common/src/time-units.d.ts +11 -11
- package/dist/common/src/time-units.js +14 -14
- package/dist/common/src/trigger.types.d.ts +15 -15
- package/dist/common/src/trigger.types.js +2 -2
- package/dist/common/src/types.d.ts +21 -21
- package/dist/common/src/types.js +2 -2
- package/dist/common/src/utils/array.d.ts +8 -8
- package/dist/common/src/utils/array.js +54 -54
- package/dist/common/src/utils/assert.d.ts +3 -3
- package/dist/common/src/utils/assert.js +14 -14
- package/dist/common/src/utils/error.d.ts +4 -4
- package/dist/common/src/utils/error.js +10 -10
- package/dist/common/src/utils/global.utils.d.ts +11 -11
- package/dist/common/src/utils/global.utils.js +50 -50
- package/dist/common/src/utils/http.d.ts +2 -2
- package/dist/common/src/utils/http.js +51 -51
- package/dist/common/src/utils/id.d.ts +2 -2
- package/dist/common/src/utils/id.js +21 -21
- package/dist/common/src/utils/lock.manager.d.ts +9 -9
- package/dist/common/src/utils/lock.manager.js +39 -39
- package/dist/common/src/utils/object.d.ts +5 -5
- package/dist/common/src/utils/object.js +75 -75
- package/dist/common/src/utils/serialization.d.ts +5 -5
- package/dist/common/src/utils/serialization.js +73 -73
- package/dist/common/src/utils/transforms.d.ts +18 -18
- package/dist/common/src/utils/transforms.js +104 -104
- package/dist/common/src/utils/url.d.ts +1 -1
- package/dist/common/src/utils/url.js +15 -15
- package/dist/common/src/utils/validation.d.ts +17 -17
- package/dist/common/src/utils/validation.js +199 -199
- package/dist/common/src/webhook-response.d.ts +6 -6
- package/dist/common/src/webhook-response.js +2 -2
- package/dist/common/src/websocket.impl.d.ts +21 -21
- package/dist/common/src/websocket.impl.js +79 -79
- package/dist/internal-common/src/code-executor.types.d.ts +13 -13
- package/dist/internal-common/src/code-executor.types.js +2 -2
- package/dist/internal-common/src/local-dev.types.d.ts +35 -35
- package/dist/internal-common/src/local-dev.types.js +2 -2
- package/dist/local-backend/package.json +48 -48
- package/dist/local-backend/src/index.d.ts +4 -4
- package/dist/local-backend/src/index.js +26 -26
- package/dist/local-backend/src/local-backend-socket.service.d.ts +18 -18
- package/dist/local-backend/src/local-backend-socket.service.js +107 -108
- package/dist/local-backend/src/local-backend-socket.service.js.map +1 -1
- package/dist/local-backend/src/local-backend.app.d.ts +2 -2
- package/dist/local-backend/src/local-backend.app.js +19 -19
- package/dist/local-backend/src/local-backend.controller.d.ts +8 -8
- package/dist/local-backend/src/local-backend.controller.js +48 -49
- package/dist/local-backend/src/local-backend.controller.js.map +1 -1
- package/dist/local-backend/src/local-backend.module.d.ts +8 -8
- package/dist/local-backend/src/local-backend.module.js +51 -53
- package/dist/local-backend/src/local-backend.module.js.map +1 -1
- package/dist/local-backend/src/local-backend.service.d.ts +15 -15
- package/dist/local-backend/src/local-backend.service.js +173 -176
- package/dist/local-backend/src/local-backend.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/common/src/named-query.context.d.ts +0 -4
- package/dist/common/src/named-query.context.js +0 -10
- package/dist/common/src/named-query.context.js.map +0 -1
- package/dist/common/src/named-query.schemas.d.ts +0 -3
- package/dist/common/src/named-query.schemas.js +0 -14
- package/dist/common/src/named-query.schemas.js.map +0 -1
- package/dist/common/src/named-query.types.d.ts +0 -8
- package/dist/common/src/named-query.types.js +0 -3
- package/dist/common/src/named-query.types.js.map +0 -1
- package/dist/internal-common/src/utils/logger-utils.d.ts +0 -3
- package/dist/internal-common/src/utils/logger-utils.js +0 -29
- package/dist/internal-common/src/utils/logger-utils.js.map +0 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrayMergeCustomizer = exports.asyncGroupBy = exports.removeSorted = exports.insertSorted = exports.binarySearch = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
function binarySearch(arr, key, comparator = (a, b) => (a > b ? 1 : a < b ? -1 : 0), low = 0, high = arr.length - 1) {
|
|
6
|
-
if (high < low)
|
|
7
|
-
return -1;
|
|
8
|
-
const mid = Math.trunc((low + high) / 2);
|
|
9
|
-
if (comparator(key, arr[mid]) === 0)
|
|
10
|
-
return mid;
|
|
11
|
-
if (comparator(key, arr[mid]) > 0)
|
|
12
|
-
return binarySearch(arr, key, comparator, mid + 1, high);
|
|
13
|
-
return binarySearch(arr, key, comparator, low, mid - 1);
|
|
14
|
-
}
|
|
15
|
-
exports.binarySearch = binarySearch;
|
|
16
|
-
function insertSorted(arr, key, comparator = (a, b) => (a > b ? 1 : a < b ? -1 : 0)) {
|
|
17
|
-
if (binarySearch(arr, key, comparator) !== -1) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const len = arr.length;
|
|
21
|
-
let i;
|
|
22
|
-
for (i = len - 1; i >= 0 && comparator(arr[i], key) > 0; i--)
|
|
23
|
-
arr[i + 1] = arr[i];
|
|
24
|
-
arr[i + 1] = key;
|
|
25
|
-
}
|
|
26
|
-
exports.insertSorted = insertSorted;
|
|
27
|
-
function removeSorted(arr, key, comparator = (a, b) => (a > b ? 1 : a < b ? -1 : 0)) {
|
|
28
|
-
const index = binarySearch(arr, key, comparator);
|
|
29
|
-
if (index > -1) {
|
|
30
|
-
arr.splice(index, 1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.removeSorted = removeSorted;
|
|
34
|
-
async function asyncGroupBy(arr, groupNamer) {
|
|
35
|
-
const groups = {};
|
|
36
|
-
for (const element of arr) {
|
|
37
|
-
const key = await groupNamer(element);
|
|
38
|
-
if (!groups[key]) {
|
|
39
|
-
groups[key] = [];
|
|
40
|
-
}
|
|
41
|
-
groups[key].push(element);
|
|
42
|
-
}
|
|
43
|
-
return groups;
|
|
44
|
-
}
|
|
45
|
-
exports.asyncGroupBy = asyncGroupBy;
|
|
46
|
-
const arrayMergeCustomizer = (a, b) => {
|
|
47
|
-
if ((0, lodash_1.isArray)(a)) {
|
|
48
|
-
return a.concat(b);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.arrayMergeCustomizer = arrayMergeCustomizer;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayMergeCustomizer = exports.asyncGroupBy = exports.removeSorted = exports.insertSorted = exports.binarySearch = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
function binarySearch(arr, key, comparator = (a, b) => (a > b ? 1 : a < b ? -1 : 0), low = 0, high = arr.length - 1) {
|
|
6
|
+
if (high < low)
|
|
7
|
+
return -1;
|
|
8
|
+
const mid = Math.trunc((low + high) / 2);
|
|
9
|
+
if (comparator(key, arr[mid]) === 0)
|
|
10
|
+
return mid;
|
|
11
|
+
if (comparator(key, arr[mid]) > 0)
|
|
12
|
+
return binarySearch(arr, key, comparator, mid + 1, high);
|
|
13
|
+
return binarySearch(arr, key, comparator, low, mid - 1);
|
|
14
|
+
}
|
|
15
|
+
exports.binarySearch = binarySearch;
|
|
16
|
+
function insertSorted(arr, key, comparator = (a, b) => (a > b ? 1 : a < b ? -1 : 0)) {
|
|
17
|
+
if (binarySearch(arr, key, comparator) !== -1) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const len = arr.length;
|
|
21
|
+
let i;
|
|
22
|
+
for (i = len - 1; i >= 0 && comparator(arr[i], key) > 0; i--)
|
|
23
|
+
arr[i + 1] = arr[i];
|
|
24
|
+
arr[i + 1] = key;
|
|
25
|
+
}
|
|
26
|
+
exports.insertSorted = insertSorted;
|
|
27
|
+
function removeSorted(arr, key, comparator = (a, b) => (a > b ? 1 : a < b ? -1 : 0)) {
|
|
28
|
+
const index = binarySearch(arr, key, comparator);
|
|
29
|
+
if (index > -1) {
|
|
30
|
+
arr.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.removeSorted = removeSorted;
|
|
34
|
+
async function asyncGroupBy(arr, groupNamer) {
|
|
35
|
+
const groups = {};
|
|
36
|
+
for (const element of arr) {
|
|
37
|
+
const key = await groupNamer(element);
|
|
38
|
+
if (!groups[key]) {
|
|
39
|
+
groups[key] = [];
|
|
40
|
+
}
|
|
41
|
+
groups[key].push(element);
|
|
42
|
+
}
|
|
43
|
+
return groups;
|
|
44
|
+
}
|
|
45
|
+
exports.asyncGroupBy = asyncGroupBy;
|
|
46
|
+
const arrayMergeCustomizer = (a, b) => {
|
|
47
|
+
if ((0, lodash_1.isArray)(a)) {
|
|
48
|
+
return a.concat(b);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.arrayMergeCustomizer = arrayMergeCustomizer;
|
|
55
55
|
//# sourceMappingURL=array.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StatusCode } from './validation';
|
|
2
|
-
export declare function assertValidateTruthy(value: unknown, message: string, statusCode?: StatusCode, details?: Record<string, any>): asserts value;
|
|
3
|
-
export declare function validateTruthy<T>(value: T, message: string, statusCode?: StatusCode, details?: Record<string, any>): NonNullable<T>;
|
|
1
|
+
import { StatusCode } from './validation';
|
|
2
|
+
export declare function assertValidateTruthy(value: unknown, message: string, statusCode?: StatusCode, details?: Record<string, any>): asserts value;
|
|
3
|
+
export declare function validateTruthy<T>(value: T, message: string, statusCode?: StatusCode, details?: Record<string, any>): NonNullable<T>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateTruthy = exports.assertValidateTruthy = void 0;
|
|
4
|
-
const http_status_enum_1 = require("../http-status.enum");
|
|
5
|
-
const validation_1 = require("./validation");
|
|
6
|
-
const assertic_1 = require("assertic");
|
|
7
|
-
function assertValidateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
8
|
-
(0, assertic_1.assertTruthy)(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
9
|
-
}
|
|
10
|
-
exports.assertValidateTruthy = assertValidateTruthy;
|
|
11
|
-
function validateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
12
|
-
return (0, assertic_1.truthy)(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
13
|
-
}
|
|
14
|
-
exports.validateTruthy = validateTruthy;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateTruthy = exports.assertValidateTruthy = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status.enum");
|
|
5
|
+
const validation_1 = require("./validation");
|
|
6
|
+
const assertic_1 = require("assertic");
|
|
7
|
+
function assertValidateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
8
|
+
(0, assertic_1.assertTruthy)(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
9
|
+
}
|
|
10
|
+
exports.assertValidateTruthy = assertValidateTruthy;
|
|
11
|
+
function validateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
12
|
+
return (0, assertic_1.truthy)(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
13
|
+
}
|
|
14
|
+
exports.validateTruthy = validateTruthy;
|
|
15
15
|
//# sourceMappingURL=assert.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class CodeExecutionError extends Error {
|
|
2
|
-
readonly details?: string | undefined;
|
|
3
|
-
constructor(error: string, details?: string | undefined);
|
|
4
|
-
}
|
|
1
|
+
export declare class CodeExecutionError extends Error {
|
|
2
|
+
readonly details?: string | undefined;
|
|
3
|
+
constructor(error: string, details?: string | undefined);
|
|
4
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CodeExecutionError = void 0;
|
|
4
|
-
class CodeExecutionError extends Error {
|
|
5
|
-
constructor(error, details) {
|
|
6
|
-
super(error);
|
|
7
|
-
this.details = details;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CodeExecutionError = CodeExecutionError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeExecutionError = void 0;
|
|
4
|
+
class CodeExecutionError extends Error {
|
|
5
|
+
constructor(error, details) {
|
|
6
|
+
super(error);
|
|
7
|
+
this.details = details;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CodeExecutionError = CodeExecutionError;
|
|
11
11
|
//# sourceMappingURL=error.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare function getGlobal(): any;
|
|
2
|
-
export declare function isDebugEnabled(): boolean;
|
|
3
|
-
export declare function enableDebugLogs(): void;
|
|
4
|
-
export declare class DebugLogger {
|
|
5
|
-
static log(...args: any[]): void;
|
|
6
|
-
static info(...args: any[]): void;
|
|
7
|
-
static warn(...args: any[]): void;
|
|
8
|
-
static error(...args: any[]): void;
|
|
9
|
-
static debug(...args: any[]): void;
|
|
10
|
-
private static getTimestampString;
|
|
11
|
-
}
|
|
1
|
+
export declare function getGlobal(): any;
|
|
2
|
+
export declare function isDebugEnabled(): boolean;
|
|
3
|
+
export declare function enableDebugLogs(): void;
|
|
4
|
+
export declare class DebugLogger {
|
|
5
|
+
static log(...args: any[]): void;
|
|
6
|
+
static info(...args: any[]): void;
|
|
7
|
+
static warn(...args: any[]): void;
|
|
8
|
+
static error(...args: any[]): void;
|
|
9
|
+
static debug(...args: any[]): void;
|
|
10
|
+
private static getTimestampString;
|
|
11
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DebugLogger = exports.enableDebugLogs = exports.isDebugEnabled = exports.getGlobal = void 0;
|
|
4
|
-
function getGlobal() {
|
|
5
|
-
if (typeof window !== 'undefined') {
|
|
6
|
-
return window;
|
|
7
|
-
}
|
|
8
|
-
if (typeof global !== 'undefined') {
|
|
9
|
-
return global;
|
|
10
|
-
}
|
|
11
|
-
if (typeof self !== 'undefined') {
|
|
12
|
-
return self;
|
|
13
|
-
}
|
|
14
|
-
throw new Error('Unable to locate global object');
|
|
15
|
-
}
|
|
16
|
-
exports.getGlobal = getGlobal;
|
|
17
|
-
function isDebugEnabled() {
|
|
18
|
-
const globalObj = getGlobal();
|
|
19
|
-
return globalObj && globalObj['SQUID_DEBUG_ENABLED'];
|
|
20
|
-
}
|
|
21
|
-
exports.isDebugEnabled = isDebugEnabled;
|
|
22
|
-
function enableDebugLogs() {
|
|
23
|
-
const globalObj = getGlobal();
|
|
24
|
-
globalObj['SQUID_DEBUG_ENABLED'] = true;
|
|
25
|
-
}
|
|
26
|
-
exports.enableDebugLogs = enableDebugLogs;
|
|
27
|
-
class DebugLogger {
|
|
28
|
-
static log(...args) {
|
|
29
|
-
DebugLogger.info(...args);
|
|
30
|
-
}
|
|
31
|
-
static info(...args) {
|
|
32
|
-
console.log(`%c[${DebugLogger.getTimestampString()}] INFO`, 'color:green', ...args);
|
|
33
|
-
}
|
|
34
|
-
static warn(...args) {
|
|
35
|
-
console.warn(`%c[${DebugLogger.getTimestampString()}] WARN`, 'color:yellow', ...args);
|
|
36
|
-
}
|
|
37
|
-
static error(...args) {
|
|
38
|
-
console.error(`%c[${DebugLogger.getTimestampString()}] ERROR`, 'color:red', ...args);
|
|
39
|
-
}
|
|
40
|
-
static debug(...args) {
|
|
41
|
-
if (!isDebugEnabled())
|
|
42
|
-
return;
|
|
43
|
-
console.log(`%c[${DebugLogger.getTimestampString()}] DEBUG`, 'color:cyan', ...args);
|
|
44
|
-
}
|
|
45
|
-
static getTimestampString() {
|
|
46
|
-
const date = new Date();
|
|
47
|
-
return `${date.toLocaleTimeString()}.${date.getMilliseconds()}`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.DebugLogger = DebugLogger;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DebugLogger = exports.enableDebugLogs = exports.isDebugEnabled = exports.getGlobal = void 0;
|
|
4
|
+
function getGlobal() {
|
|
5
|
+
if (typeof window !== 'undefined') {
|
|
6
|
+
return window;
|
|
7
|
+
}
|
|
8
|
+
if (typeof global !== 'undefined') {
|
|
9
|
+
return global;
|
|
10
|
+
}
|
|
11
|
+
if (typeof self !== 'undefined') {
|
|
12
|
+
return self;
|
|
13
|
+
}
|
|
14
|
+
throw new Error('Unable to locate global object');
|
|
15
|
+
}
|
|
16
|
+
exports.getGlobal = getGlobal;
|
|
17
|
+
function isDebugEnabled() {
|
|
18
|
+
const globalObj = getGlobal();
|
|
19
|
+
return globalObj && globalObj['SQUID_DEBUG_ENABLED'];
|
|
20
|
+
}
|
|
21
|
+
exports.isDebugEnabled = isDebugEnabled;
|
|
22
|
+
function enableDebugLogs() {
|
|
23
|
+
const globalObj = getGlobal();
|
|
24
|
+
globalObj['SQUID_DEBUG_ENABLED'] = true;
|
|
25
|
+
}
|
|
26
|
+
exports.enableDebugLogs = enableDebugLogs;
|
|
27
|
+
class DebugLogger {
|
|
28
|
+
static log(...args) {
|
|
29
|
+
DebugLogger.info(...args);
|
|
30
|
+
}
|
|
31
|
+
static info(...args) {
|
|
32
|
+
console.log(`%c[${DebugLogger.getTimestampString()}] INFO`, 'color:green', ...args);
|
|
33
|
+
}
|
|
34
|
+
static warn(...args) {
|
|
35
|
+
console.warn(`%c[${DebugLogger.getTimestampString()}] WARN`, 'color:yellow', ...args);
|
|
36
|
+
}
|
|
37
|
+
static error(...args) {
|
|
38
|
+
console.error(`%c[${DebugLogger.getTimestampString()}] ERROR`, 'color:red', ...args);
|
|
39
|
+
}
|
|
40
|
+
static debug(...args) {
|
|
41
|
+
if (!isDebugEnabled())
|
|
42
|
+
return;
|
|
43
|
+
console.log(`%c[${DebugLogger.getTimestampString()}] DEBUG`, 'color:cyan', ...args);
|
|
44
|
+
}
|
|
45
|
+
static getTimestampString() {
|
|
46
|
+
const date = new Date();
|
|
47
|
+
return `${date.toLocaleTimeString()}.${date.getMilliseconds()}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.DebugLogger = DebugLogger;
|
|
51
51
|
//# sourceMappingURL=global.utils.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
|
|
2
|
-
export declare function getApplicationHttpHeaders(regionPrefix: string, appId: string): Record<string, string>;
|
|
1
|
+
export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
|
|
2
|
+
export declare function getApplicationHttpHeaders(regionPrefix: string, appId: string): Record<string, string>;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getApplicationHttpHeaders = exports.getApplicationUrl = void 0;
|
|
4
|
-
const kotlinControllers = [
|
|
5
|
-
'query',
|
|
6
|
-
'aiData',
|
|
7
|
-
'api',
|
|
8
|
-
'backend-function',
|
|
9
|
-
'webhooks',
|
|
10
|
-
'ws',
|
|
11
|
-
'quota',
|
|
12
|
-
'named-query',
|
|
13
|
-
'native-query',
|
|
14
|
-
];
|
|
15
|
-
function getApplicationUrl(regionPrefix, appId, path) {
|
|
16
|
-
const baseUrl = 'https://squid.cloud';
|
|
17
|
-
const parsedBaseUrl = new URL(baseUrl);
|
|
18
|
-
parsedBaseUrl.host = `${appId}.${regionPrefix}.${parsedBaseUrl.host}`;
|
|
19
|
-
const controller = path.split('/')[0] || '';
|
|
20
|
-
if (isLocal(regionPrefix)) {
|
|
21
|
-
parsedBaseUrl.protocol = 'http';
|
|
22
|
-
parsedBaseUrl.port = kotlinControllers.includes(controller) ? '8001' : '8000';
|
|
23
|
-
if (isAndroid(regionPrefix)) {
|
|
24
|
-
parsedBaseUrl.host = '10.0.2.2';
|
|
25
|
-
}
|
|
26
|
-
else if (isIOS(regionPrefix)) {
|
|
27
|
-
parsedBaseUrl.host = 'localhost';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const url = parsedBaseUrl.toString();
|
|
31
|
-
path = path.startsWith('/') ? path.slice(1) : path;
|
|
32
|
-
return (url.endsWith('/') ? url : url + '/') + path;
|
|
33
|
-
}
|
|
34
|
-
exports.getApplicationUrl = getApplicationUrl;
|
|
35
|
-
function getApplicationHttpHeaders(regionPrefix, appId) {
|
|
36
|
-
const headers = {};
|
|
37
|
-
if (isLocal(regionPrefix)) {
|
|
38
|
-
headers['x-squid-appid'] = appId;
|
|
39
|
-
}
|
|
40
|
-
return headers;
|
|
41
|
-
}
|
|
42
|
-
exports.getApplicationHttpHeaders = getApplicationHttpHeaders;
|
|
43
|
-
function isLocal(regionPrefix) {
|
|
44
|
-
return /^local/.test(regionPrefix);
|
|
45
|
-
}
|
|
46
|
-
function isAndroid(regionPrefix) {
|
|
47
|
-
return /android$/.test(regionPrefix);
|
|
48
|
-
}
|
|
49
|
-
function isIOS(regionPrefix) {
|
|
50
|
-
return /ios$/.test(regionPrefix);
|
|
51
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getApplicationHttpHeaders = exports.getApplicationUrl = void 0;
|
|
4
|
+
const kotlinControllers = [
|
|
5
|
+
'query',
|
|
6
|
+
'aiData',
|
|
7
|
+
'api',
|
|
8
|
+
'backend-function',
|
|
9
|
+
'webhooks',
|
|
10
|
+
'ws',
|
|
11
|
+
'quota',
|
|
12
|
+
'named-query',
|
|
13
|
+
'native-query',
|
|
14
|
+
];
|
|
15
|
+
function getApplicationUrl(regionPrefix, appId, path) {
|
|
16
|
+
const baseUrl = 'https://squid.cloud';
|
|
17
|
+
const parsedBaseUrl = new URL(baseUrl);
|
|
18
|
+
parsedBaseUrl.host = `${appId}.${regionPrefix}.${parsedBaseUrl.host}`;
|
|
19
|
+
const controller = path.split('/')[0] || '';
|
|
20
|
+
if (isLocal(regionPrefix)) {
|
|
21
|
+
parsedBaseUrl.protocol = 'http';
|
|
22
|
+
parsedBaseUrl.port = kotlinControllers.includes(controller) ? '8001' : '8000';
|
|
23
|
+
if (isAndroid(regionPrefix)) {
|
|
24
|
+
parsedBaseUrl.host = '10.0.2.2';
|
|
25
|
+
}
|
|
26
|
+
else if (isIOS(regionPrefix)) {
|
|
27
|
+
parsedBaseUrl.host = 'localhost';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const url = parsedBaseUrl.toString();
|
|
31
|
+
path = path.startsWith('/') ? path.slice(1) : path;
|
|
32
|
+
return (url.endsWith('/') ? url : url + '/') + path;
|
|
33
|
+
}
|
|
34
|
+
exports.getApplicationUrl = getApplicationUrl;
|
|
35
|
+
function getApplicationHttpHeaders(regionPrefix, appId) {
|
|
36
|
+
const headers = {};
|
|
37
|
+
if (isLocal(regionPrefix)) {
|
|
38
|
+
headers['x-squid-appid'] = appId;
|
|
39
|
+
}
|
|
40
|
+
return headers;
|
|
41
|
+
}
|
|
42
|
+
exports.getApplicationHttpHeaders = getApplicationHttpHeaders;
|
|
43
|
+
function isLocal(regionPrefix) {
|
|
44
|
+
return /^local/.test(regionPrefix);
|
|
45
|
+
}
|
|
46
|
+
function isAndroid(regionPrefix) {
|
|
47
|
+
return /android$/.test(regionPrefix);
|
|
48
|
+
}
|
|
49
|
+
function isIOS(regionPrefix) {
|
|
50
|
+
return /ios$/.test(regionPrefix);
|
|
51
|
+
}
|
|
52
52
|
//# sourceMappingURL=http.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function generateId(): string;
|
|
2
|
-
export declare function generateShortId(length?: number): string;
|
|
1
|
+
export declare function generateId(): string;
|
|
2
|
+
export declare function generateShortId(length?: number): string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateShortId = exports.generateId = void 0;
|
|
4
|
-
function generateId() {
|
|
5
|
-
let dt = new Date().getTime();
|
|
6
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
7
|
-
const r = (dt + Math.random() * 16) % 16 | 0;
|
|
8
|
-
dt = Math.floor(dt / 16);
|
|
9
|
-
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
exports.generateId = generateId;
|
|
13
|
-
function generateShortId(length = 18) {
|
|
14
|
-
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
15
|
-
let id = '';
|
|
16
|
-
for (let i = 0; i < length; i++) {
|
|
17
|
-
id += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
18
|
-
}
|
|
19
|
-
return id;
|
|
20
|
-
}
|
|
21
|
-
exports.generateShortId = generateShortId;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateShortId = exports.generateId = void 0;
|
|
4
|
+
function generateId() {
|
|
5
|
+
let dt = new Date().getTime();
|
|
6
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
7
|
+
const r = (dt + Math.random() * 16) % 16 | 0;
|
|
8
|
+
dt = Math.floor(dt / 16);
|
|
9
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.generateId = generateId;
|
|
13
|
+
function generateShortId(length = 18) {
|
|
14
|
+
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
15
|
+
let id = '';
|
|
16
|
+
for (let i = 0; i < length; i++) {
|
|
17
|
+
id += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
18
|
+
}
|
|
19
|
+
return id;
|
|
20
|
+
}
|
|
21
|
+
exports.generateShortId = generateShortId;
|
|
22
22
|
//# sourceMappingURL=id.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
type LockMutex = string;
|
|
2
|
-
export declare class LockManager {
|
|
3
|
-
private readonly locks;
|
|
4
|
-
lock(...mutexes: LockMutex[]): Promise<void>;
|
|
5
|
-
release(...mutexes: LockMutex[]): void;
|
|
6
|
-
canGetLock(...mutexes: LockMutex[]): boolean;
|
|
7
|
-
lockSync(...mutexes: LockMutex[]): void;
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
1
|
+
type LockMutex = string;
|
|
2
|
+
export declare class LockManager {
|
|
3
|
+
private readonly locks;
|
|
4
|
+
lock(...mutexes: LockMutex[]): Promise<void>;
|
|
5
|
+
release(...mutexes: LockMutex[]): void;
|
|
6
|
+
canGetLock(...mutexes: LockMutex[]): boolean;
|
|
7
|
+
lockSync(...mutexes: LockMutex[]): void;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LockManager = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const assertic_1 = require("assertic");
|
|
6
|
-
class LockManager {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.locks = {};
|
|
9
|
-
}
|
|
10
|
-
async lock(...mutexes) {
|
|
11
|
-
if (this.canGetLock(...mutexes)) {
|
|
12
|
-
this.lockSync(...mutexes);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const relevantLocks = Object.entries(this.locks)
|
|
16
|
-
.filter(([mutex]) => mutexes.includes(mutex))
|
|
17
|
-
.map(([, isLockedSubject]) => isLockedSubject);
|
|
18
|
-
await (0, rxjs_1.lastValueFrom)((0, rxjs_1.combineLatest)(relevantLocks).pipe((0, rxjs_1.filter)((isLockedArray) => !isLockedArray.includes(true)), (0, rxjs_1.take)(1)));
|
|
19
|
-
await this.lock(...mutexes);
|
|
20
|
-
}
|
|
21
|
-
release(...mutexes) {
|
|
22
|
-
for (const mutex of mutexes) {
|
|
23
|
-
const isLockedSubject = (0, assertic_1.truthy)(this.locks[mutex]);
|
|
24
|
-
isLockedSubject.next(false);
|
|
25
|
-
isLockedSubject.complete();
|
|
26
|
-
delete this.locks[mutex];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
canGetLock(...mutexes) {
|
|
30
|
-
return !mutexes.some(mutex => { var _a; return (_a = this.locks[mutex]) === null || _a === void 0 ? void 0 : _a.value; });
|
|
31
|
-
}
|
|
32
|
-
lockSync(...mutexes) {
|
|
33
|
-
(0, assertic_1.assertTruthy)(this.canGetLock(...mutexes), 'Cannot acquire lock sync');
|
|
34
|
-
for (const mutex of mutexes) {
|
|
35
|
-
this.locks[mutex] = new rxjs_1.BehaviorSubject(true);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.LockManager = LockManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LockManager = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const assertic_1 = require("assertic");
|
|
6
|
+
class LockManager {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.locks = {};
|
|
9
|
+
}
|
|
10
|
+
async lock(...mutexes) {
|
|
11
|
+
if (this.canGetLock(...mutexes)) {
|
|
12
|
+
this.lockSync(...mutexes);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const relevantLocks = Object.entries(this.locks)
|
|
16
|
+
.filter(([mutex]) => mutexes.includes(mutex))
|
|
17
|
+
.map(([, isLockedSubject]) => isLockedSubject);
|
|
18
|
+
await (0, rxjs_1.lastValueFrom)((0, rxjs_1.combineLatest)(relevantLocks).pipe((0, rxjs_1.filter)((isLockedArray) => !isLockedArray.includes(true)), (0, rxjs_1.take)(1)));
|
|
19
|
+
await this.lock(...mutexes);
|
|
20
|
+
}
|
|
21
|
+
release(...mutexes) {
|
|
22
|
+
for (const mutex of mutexes) {
|
|
23
|
+
const isLockedSubject = (0, assertic_1.truthy)(this.locks[mutex]);
|
|
24
|
+
isLockedSubject.next(false);
|
|
25
|
+
isLockedSubject.complete();
|
|
26
|
+
delete this.locks[mutex];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
canGetLock(...mutexes) {
|
|
30
|
+
return !mutexes.some(mutex => { var _a; return (_a = this.locks[mutex]) === null || _a === void 0 ? void 0 : _a.value; });
|
|
31
|
+
}
|
|
32
|
+
lockSync(...mutexes) {
|
|
33
|
+
(0, assertic_1.assertTruthy)(this.canGetLock(...mutexes), 'Cannot acquire lock sync');
|
|
34
|
+
for (const mutex of mutexes) {
|
|
35
|
+
this.locks[mutex] = new rxjs_1.BehaviorSubject(true);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.LockManager = LockManager;
|
|
40
40
|
//# sourceMappingURL=lock.manager.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function getInPath(obj: any, path: string, delimiter?: string): any;
|
|
2
|
-
export declare function setInPath(obj: any, path: string, value: any, delimiter?: string): void;
|
|
3
|
-
export declare function deleteInPath(obj: any, path: string, delimiter?: string): void;
|
|
4
|
-
export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
|
|
5
|
-
export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
|
|
1
|
+
export declare function getInPath(obj: any, path: string, delimiter?: string): any;
|
|
2
|
+
export declare function setInPath(obj: any, path: string, value: any, delimiter?: string): void;
|
|
3
|
+
export declare function deleteInPath(obj: any, path: string, delimiter?: string): void;
|
|
4
|
+
export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
|
|
5
|
+
export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
|