@squidcloud/local-backend 1.0.66 → 1.0.67
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.context.d.ts +13 -13
- package/dist/common/src/ai-assistant.context.js +19 -19
- package/dist/common/src/ai-assistant.schemas.d.ts +243 -243
- package/dist/common/src/ai-assistant.schemas.js +210 -210
- package/dist/common/src/ai-assistant.types.d.ts +90 -90
- package/dist/common/src/ai-assistant.types.js +11 -11
- 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 +23 -23
- package/dist/common/src/api.types.js +2 -2
- package/dist/common/src/application.schemas.d.ts +1312 -1312
- package/dist/common/src/application.schemas.js +860 -860
- package/dist/common/src/application.types.d.ts +186 -186
- package/dist/common/src/application.types.js +89 -89
- package/dist/common/src/backend-function.schemas.d.ts +3 -3
- package/dist/common/src/backend-function.schemas.js +12 -12
- package/dist/common/src/backend-function.types.d.ts +6 -6
- 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 +96 -96
- package/dist/common/src/bundle-api.types.d.ts +63 -63
- package/dist/common/src/bundle-api.types.js +2 -2
- package/dist/common/src/bundle-data.types.d.ts +59 -59
- package/dist/common/src/bundle-data.types.js +2 -2
- package/dist/common/src/communication.types.d.ts +18 -18
- package/dist/common/src/communication.types.js +40 -40
- 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 +5 -5
- package/dist/common/src/distributed-lock.context.js +10 -10
- 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/index.d.ts +55 -55
- package/dist/common/src/index.js +71 -71
- package/dist/common/src/integrations/ai_assistant.types.d.ts +24 -24
- package/dist/common/src/integrations/ai_assistant.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 +231 -231
- package/dist/common/src/integrations/database.types.js +2 -2
- package/dist/common/src/integrations/index.d.ts +124 -124
- package/dist/common/src/integrations/index.js +111 -111
- 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/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/named-query.context.d.ts +4 -4
- package/dist/common/src/named-query.context.js +9 -9
- package/dist/common/src/named-query.schemas.d.ts +3 -3
- package/dist/common/src/named-query.schemas.js +13 -13
- package/dist/common/src/named-query.types.d.ts +8 -8
- package/dist/common/src/named-query.types.js +2 -2
- package/dist/common/src/query/base-query-builder.d.ts +37 -37
- package/dist/common/src/query/base-query-builder.js +36 -36
- 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 +42 -42
- package/dist/common/src/query/pagination.js +164 -164
- 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 +153 -153
- 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 +172 -172
- package/dist/common/src/secret.schemas.d.ts +6 -6
- package/dist/common/src/secret.schemas.js +38 -38
- package/dist/common/src/secret.types.d.ts +49 -49
- 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 +58 -58
- package/dist/common/src/socket.types.d.ts +112 -112
- package/dist/common/src/socket.types.js +2 -2
- package/dist/common/src/time-units.d.ts +5 -5
- package/dist/common/src/time-units.js +8 -8
- 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 +8 -8
- package/dist/common/src/utils/assert.js +49 -49
- 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 +10 -10
- package/dist/common/src/utils/global.utils.js +46 -46
- package/dist/common/src/utils/http.d.ts +2 -2
- package/dist/common/src/utils/http.js +41 -41
- 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/nullish.d.ts +2 -2
- package/dist/common/src/utils/nullish.js +11 -11
- 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 +6 -6
- package/dist/common/src/utils/serialization.js +77 -77
- package/dist/common/src/utils/transforms.d.ts +18 -18
- package/dist/common/src/utils/transforms.js +92 -92
- 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 +209 -209
- 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 +76 -76
- package/dist/internal-common/src/async-queue.d.ts +4 -4
- package/dist/internal-common/src/async-queue.js +17 -17
- 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/dao.types.d.ts +46 -46
- package/dist/internal-common/src/dao.types.js +2 -2
- package/dist/internal-common/src/environment/environment.types.d.ts +74 -74
- package/dist/internal-common/src/environment/environment.types.js +2 -2
- package/dist/internal-common/src/environment/index.d.ts +6 -6
- package/dist/internal-common/src/environment/index.js +27 -27
- package/dist/internal-common/src/environment/local.environment.d.ts +2 -2
- package/dist/internal-common/src/environment/local.environment.js +62 -62
- package/dist/internal-common/src/filters/custom-exception.filter.d.ts +6 -6
- package/dist/internal-common/src/filters/custom-exception.filter.js +44 -44
- package/dist/internal-common/src/index.d.ts +14 -14
- package/dist/internal-common/src/index.js +32 -32
- package/dist/internal-common/src/interceptors/body.interceptor.d.ts +5 -5
- package/dist/internal-common/src/interceptors/body.interceptor.js +24 -24
- package/dist/internal-common/src/kafka/kafka.manager.d.ts +22 -22
- package/dist/internal-common/src/kafka/kafka.manager.js +129 -129
- package/dist/internal-common/src/kafka/kafka.types.d.ts +17 -17
- package/dist/internal-common/src/kafka/kafka.types.js +2 -2
- package/dist/internal-common/src/kafka-observability-publisher.d.ts +11 -11
- package/dist/internal-common/src/kafka-observability-publisher.js +20 -20
- 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/internal-common/src/observability-publisher.d.ts +9 -9
- package/dist/internal-common/src/observability-publisher.js +58 -58
- package/dist/internal-common/src/observability.types.d.ts +17 -17
- package/dist/internal-common/src/observability.types.js +2 -2
- package/dist/internal-common/src/shutdown.manager.d.ts +20 -20
- package/dist/internal-common/src/shutdown.manager.js +75 -75
- package/dist/internal-common/src/utils.d.ts +5 -5
- package/dist/internal-common/src/utils.js +29 -29
- package/dist/local-backend/src/index.d.ts +4 -4
- package/dist/local-backend/src/index.js +20 -20
- package/dist/local-backend/src/local-backend-socket.service.d.ts +19 -19
- package/dist/local-backend/src/local-backend-socket.service.js +110 -110
- 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 +49 -49
- package/dist/local-backend/src/local-backend.module.d.ts +8 -8
- package/dist/local-backend/src/local-backend.module.js +53 -53
- package/dist/local-backend/src/local-backend.service.d.ts +15 -15
- package/dist/local-backend/src/local-backend.service.js +165 -165
- package/package.json +1 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateTruthy = exports.notNullish = exports.truthy = exports.assertValidateTruthy = exports.assertNotNullish = exports.assertTruthy = void 0;
|
|
4
|
-
const http_status_enum_1 = require("../http-status.enum");
|
|
5
|
-
const nullish_1 = require("./nullish");
|
|
6
|
-
const validation_1 = require("./validation");
|
|
7
|
-
function assertTruthy(value, error) {
|
|
8
|
-
if (value) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const messageOrObject = typeof error === 'function' ? error() : error;
|
|
12
|
-
if (messageOrObject instanceof Error) {
|
|
13
|
-
throw messageOrObject;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
throw new Error(messageOrObject !== null && messageOrObject !== void 0 ? messageOrObject : 'Assertion error');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.assertTruthy = assertTruthy;
|
|
20
|
-
function assertNotNullish(value, error) {
|
|
21
|
-
if ((0, nullish_1.isNotNullish)(value))
|
|
22
|
-
return;
|
|
23
|
-
const messageOrObject = typeof error === 'function' ? error() : error;
|
|
24
|
-
if (messageOrObject instanceof Error) {
|
|
25
|
-
throw messageOrObject;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
throw new Error(messageOrObject !== null && messageOrObject !== void 0 ? messageOrObject : 'Assertion error');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.assertNotNullish = assertNotNullish;
|
|
32
|
-
function assertValidateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
33
|
-
assertTruthy(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
34
|
-
}
|
|
35
|
-
exports.assertValidateTruthy = assertValidateTruthy;
|
|
36
|
-
function truthy(value, error) {
|
|
37
|
-
assertTruthy(value, error);
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
exports.truthy = truthy;
|
|
41
|
-
function notNullish(value, error) {
|
|
42
|
-
assertNotNullish(value, error);
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
exports.notNullish = notNullish;
|
|
46
|
-
function validateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
47
|
-
return truthy(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
48
|
-
}
|
|
49
|
-
exports.validateTruthy = validateTruthy;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateTruthy = exports.notNullish = exports.truthy = exports.assertValidateTruthy = exports.assertNotNullish = exports.assertTruthy = void 0;
|
|
4
|
+
const http_status_enum_1 = require("../http-status.enum");
|
|
5
|
+
const nullish_1 = require("./nullish");
|
|
6
|
+
const validation_1 = require("./validation");
|
|
7
|
+
function assertTruthy(value, error) {
|
|
8
|
+
if (value) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const messageOrObject = typeof error === 'function' ? error() : error;
|
|
12
|
+
if (messageOrObject instanceof Error) {
|
|
13
|
+
throw messageOrObject;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
throw new Error(messageOrObject !== null && messageOrObject !== void 0 ? messageOrObject : 'Assertion error');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.assertTruthy = assertTruthy;
|
|
20
|
+
function assertNotNullish(value, error) {
|
|
21
|
+
if ((0, nullish_1.isNotNullish)(value))
|
|
22
|
+
return;
|
|
23
|
+
const messageOrObject = typeof error === 'function' ? error() : error;
|
|
24
|
+
if (messageOrObject instanceof Error) {
|
|
25
|
+
throw messageOrObject;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
throw new Error(messageOrObject !== null && messageOrObject !== void 0 ? messageOrObject : 'Assertion error');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.assertNotNullish = assertNotNullish;
|
|
32
|
+
function assertValidateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
33
|
+
assertTruthy(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
34
|
+
}
|
|
35
|
+
exports.assertValidateTruthy = assertValidateTruthy;
|
|
36
|
+
function truthy(value, error) {
|
|
37
|
+
assertTruthy(value, error);
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
exports.truthy = truthy;
|
|
41
|
+
function notNullish(value, error) {
|
|
42
|
+
assertNotNullish(value, error);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
exports.notNullish = notNullish;
|
|
46
|
+
function validateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
|
|
47
|
+
return truthy(value, () => new validation_1.ValidationError(message, statusCode, details));
|
|
48
|
+
}
|
|
49
|
+
exports.validateTruthy = validateTruthy;
|
|
50
50
|
//# 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,10 +1,10 @@
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
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 global = getGlobal();
|
|
19
|
-
return global && global['SQUID_DEBUG_ENABLED'];
|
|
20
|
-
}
|
|
21
|
-
exports.isDebugEnabled = isDebugEnabled;
|
|
22
|
-
function enableDebugLogs() {
|
|
23
|
-
const global = getGlobal();
|
|
24
|
-
global['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[${new Date().toLocaleTimeString()}] INFO`, 'color:green', ...args);
|
|
33
|
-
}
|
|
34
|
-
static warn(...args) {
|
|
35
|
-
console.warn(`%c[${new Date().toLocaleTimeString()}] WARN`, 'color:yellow', ...args);
|
|
36
|
-
}
|
|
37
|
-
static error(...args) {
|
|
38
|
-
console.error(`%c[${new Date().toLocaleTimeString()}] ERROR`, 'color:red', ...args);
|
|
39
|
-
}
|
|
40
|
-
static debug(...args) {
|
|
41
|
-
if (!isDebugEnabled())
|
|
42
|
-
return;
|
|
43
|
-
console.log(`%c[${new Date().toLocaleTimeString()}] DEBUG`, 'color:cyan', ...args);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
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 global = getGlobal();
|
|
19
|
+
return global && global['SQUID_DEBUG_ENABLED'];
|
|
20
|
+
}
|
|
21
|
+
exports.isDebugEnabled = isDebugEnabled;
|
|
22
|
+
function enableDebugLogs() {
|
|
23
|
+
const global = getGlobal();
|
|
24
|
+
global['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[${new Date().toLocaleTimeString()}] INFO`, 'color:green', ...args);
|
|
33
|
+
}
|
|
34
|
+
static warn(...args) {
|
|
35
|
+
console.warn(`%c[${new Date().toLocaleTimeString()}] WARN`, 'color:yellow', ...args);
|
|
36
|
+
}
|
|
37
|
+
static error(...args) {
|
|
38
|
+
console.error(`%c[${new Date().toLocaleTimeString()}] ERROR`, 'color:red', ...args);
|
|
39
|
+
}
|
|
40
|
+
static debug(...args) {
|
|
41
|
+
if (!isDebugEnabled())
|
|
42
|
+
return;
|
|
43
|
+
console.log(`%c[${new Date().toLocaleTimeString()}] DEBUG`, 'color:cyan', ...args);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.DebugLogger = DebugLogger;
|
|
47
47
|
//# 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,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getApplicationHttpHeaders = exports.getApplicationUrl = void 0;
|
|
4
|
-
const kotlinControllers = ['query', 'aiData', 'api', 'backend-function', 'webhooks', 'ws'];
|
|
5
|
-
function getApplicationUrl(regionPrefix, appId, path) {
|
|
6
|
-
const baseUrl = 'https://squid.cloud';
|
|
7
|
-
const parsedBaseUrl = new URL(baseUrl);
|
|
8
|
-
parsedBaseUrl.host = `${appId}.${regionPrefix}.${parsedBaseUrl.host}`;
|
|
9
|
-
const controller = path.split('/')[0] || '';
|
|
10
|
-
if (isLocal(regionPrefix)) {
|
|
11
|
-
parsedBaseUrl.protocol = 'http';
|
|
12
|
-
parsedBaseUrl.port = kotlinControllers.includes(controller) ? '8001' : '8000';
|
|
13
|
-
if (isAndroid(regionPrefix)) {
|
|
14
|
-
parsedBaseUrl.host = '10.0.2.2';
|
|
15
|
-
}
|
|
16
|
-
else if (isIOS(regionPrefix)) {
|
|
17
|
-
parsedBaseUrl.host = 'localhost';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const url = parsedBaseUrl.toString();
|
|
21
|
-
path = path.startsWith('/') ? path.slice(1) : path;
|
|
22
|
-
return (url.endsWith('/') ? url : url + '/') + path;
|
|
23
|
-
}
|
|
24
|
-
exports.getApplicationUrl = getApplicationUrl;
|
|
25
|
-
function getApplicationHttpHeaders(regionPrefix, appId) {
|
|
26
|
-
const headers = {};
|
|
27
|
-
if (isLocal(regionPrefix)) {
|
|
28
|
-
headers['x-squid-appid'] = appId;
|
|
29
|
-
}
|
|
30
|
-
return headers;
|
|
31
|
-
}
|
|
32
|
-
exports.getApplicationHttpHeaders = getApplicationHttpHeaders;
|
|
33
|
-
function isLocal(regionPrefix) {
|
|
34
|
-
return /^local/.test(regionPrefix);
|
|
35
|
-
}
|
|
36
|
-
function isAndroid(regionPrefix) {
|
|
37
|
-
return /android$/.test(regionPrefix);
|
|
38
|
-
}
|
|
39
|
-
function isIOS(regionPrefix) {
|
|
40
|
-
return /ios$/.test(regionPrefix);
|
|
41
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getApplicationHttpHeaders = exports.getApplicationUrl = void 0;
|
|
4
|
+
const kotlinControllers = ['query', 'aiData', 'api', 'backend-function', 'webhooks', 'ws'];
|
|
5
|
+
function getApplicationUrl(regionPrefix, appId, path) {
|
|
6
|
+
const baseUrl = 'https://squid.cloud';
|
|
7
|
+
const parsedBaseUrl = new URL(baseUrl);
|
|
8
|
+
parsedBaseUrl.host = `${appId}.${regionPrefix}.${parsedBaseUrl.host}`;
|
|
9
|
+
const controller = path.split('/')[0] || '';
|
|
10
|
+
if (isLocal(regionPrefix)) {
|
|
11
|
+
parsedBaseUrl.protocol = 'http';
|
|
12
|
+
parsedBaseUrl.port = kotlinControllers.includes(controller) ? '8001' : '8000';
|
|
13
|
+
if (isAndroid(regionPrefix)) {
|
|
14
|
+
parsedBaseUrl.host = '10.0.2.2';
|
|
15
|
+
}
|
|
16
|
+
else if (isIOS(regionPrefix)) {
|
|
17
|
+
parsedBaseUrl.host = 'localhost';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const url = parsedBaseUrl.toString();
|
|
21
|
+
path = path.startsWith('/') ? path.slice(1) : path;
|
|
22
|
+
return (url.endsWith('/') ? url : url + '/') + path;
|
|
23
|
+
}
|
|
24
|
+
exports.getApplicationUrl = getApplicationUrl;
|
|
25
|
+
function getApplicationHttpHeaders(regionPrefix, appId) {
|
|
26
|
+
const headers = {};
|
|
27
|
+
if (isLocal(regionPrefix)) {
|
|
28
|
+
headers['x-squid-appid'] = appId;
|
|
29
|
+
}
|
|
30
|
+
return headers;
|
|
31
|
+
}
|
|
32
|
+
exports.getApplicationHttpHeaders = getApplicationHttpHeaders;
|
|
33
|
+
function isLocal(regionPrefix) {
|
|
34
|
+
return /^local/.test(regionPrefix);
|
|
35
|
+
}
|
|
36
|
+
function isAndroid(regionPrefix) {
|
|
37
|
+
return /android$/.test(regionPrefix);
|
|
38
|
+
}
|
|
39
|
+
function isIOS(regionPrefix) {
|
|
40
|
+
return /ios$/.test(regionPrefix);
|
|
41
|
+
}
|
|
42
42
|
//# 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 assert_1 = require("./assert");
|
|
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(([ignored, 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, assert_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, assert_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 assert_1 = require("./assert");
|
|
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(([ignored, 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, assert_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, assert_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,2 +1,2 @@
|
|
|
1
|
-
export declare function isNotNullish<T>(t: T | undefined | null): t is T;
|
|
2
|
-
export declare function isString(t: unknown): t is string;
|
|
1
|
+
export declare function isNotNullish<T>(t: T | undefined | null): t is T;
|
|
2
|
+
export declare function isString(t: unknown): t is string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isString = exports.isNotNullish = void 0;
|
|
4
|
-
function isNotNullish(t) {
|
|
5
|
-
return t !== null && t !== undefined;
|
|
6
|
-
}
|
|
7
|
-
exports.isNotNullish = isNotNullish;
|
|
8
|
-
function isString(t) {
|
|
9
|
-
return typeof t === 'string';
|
|
10
|
-
}
|
|
11
|
-
exports.isString = isString;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isString = exports.isNotNullish = void 0;
|
|
4
|
+
function isNotNullish(t) {
|
|
5
|
+
return t !== null && t !== undefined;
|
|
6
|
+
}
|
|
7
|
+
exports.isNotNullish = isNotNullish;
|
|
8
|
+
function isString(t) {
|
|
9
|
+
return typeof t === 'string';
|
|
10
|
+
}
|
|
11
|
+
exports.isString = isString;
|
|
12
12
|
//# sourceMappingURL=nullish.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;
|