target-supabase-sdk 0.2.10 → 0.2.12
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/browser.d.ts +4 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +3 -3
- package/dist/chunks/{enable-log-persist-BB-unD4p.js → enable-log-persist-Dl55_mv2.js} +160 -30
- package/dist/chunks/enable-log-persist-Dl55_mv2.js.map +1 -0
- package/dist/chunks/{list.api-6Q4_-7oN.js → list.api-BzbTJBsM.js} +81 -13
- package/dist/chunks/list.api-BzbTJBsM.js.map +1 -0
- package/dist/chunks/{task-queue-D5uWjqVN.js → task-queue-H4mpSW8R.js} +55 -16
- package/dist/chunks/task-queue-H4mpSW8R.js.map +1 -0
- package/dist/core.api.d.ts +6 -15
- package/dist/core.api.d.ts.map +1 -1
- package/dist/core.interface.d.ts +5 -0
- package/dist/core.interface.d.ts.map +1 -1
- package/dist/core.schema.d.ts +77 -0
- package/dist/core.schema.d.ts.map +1 -0
- package/dist/link/index.d.ts +10 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/link.build.d.ts +45 -0
- package/dist/link/link.build.d.ts.map +1 -0
- package/dist/list/index.d.ts +10 -0
- package/dist/list/index.d.ts.map +1 -0
- package/dist/list/list.build.d.ts +21 -0
- package/dist/list/list.build.d.ts.map +1 -0
- package/dist/node/preload/run-service-preload.d.ts +1 -0
- package/dist/node/preload/run-service-preload.d.ts.map +1 -1
- package/dist/node/preload/service-preload.interface.d.ts +5 -0
- package/dist/node/preload/service-preload.interface.d.ts.map +1 -1
- package/dist/node.js +6 -6
- package/dist/parcel/parcel.api.d.ts +3 -3
- package/dist/parcel/parcel.api.d.ts.map +1 -1
- package/dist/preload.js +14 -3
- package/dist/preload.js.map +1 -1
- package/dist/resource/resource.interface.d.ts +20 -0
- package/dist/resource/resource.interface.d.ts.map +1 -0
- package/dist/service/config.api.d.ts.map +1 -1
- package/dist/service/service.api.d.ts +6 -6
- package/dist/service/service.api.d.ts.map +1 -1
- package/dist/shared/log/index.d.ts +2 -0
- package/dist/shared/log/index.d.ts.map +1 -1
- package/dist/shared/log/log-min-level.d.ts +15 -0
- package/dist/shared/log/log-min-level.d.ts.map +1 -0
- package/dist/shared/log/log-persist-errors.d.ts +4 -0
- package/dist/shared/log/log-persist-errors.d.ts.map +1 -0
- package/dist/shared/log/log-persist-logger.d.ts +1 -0
- package/dist/shared/log/log-persist-logger.d.ts.map +1 -1
- package/dist/shared/log/log-persist.config.d.ts.map +1 -1
- package/dist/shared/log/log-persist.d.ts +8 -1
- package/dist/shared/log/log-persist.d.ts.map +1 -1
- package/dist/shared/log/log-persist.interface.d.ts +8 -0
- package/dist/shared/log/log-persist.interface.d.ts.map +1 -1
- package/dist/task/task-post-validated.api.d.ts +2 -2
- package/dist/task/task-post.api.d.ts +6 -6
- package/dist/trigger/trigger.api.d.ts +6 -6
- package/package.json +1 -1
- package/src/browser.ts +6 -5
- package/src/core.api.ts +19 -28
- package/src/core.interface.ts +6 -0
- package/src/core.schema.ts +51 -0
- package/src/link/index.ts +10 -0
- package/src/link/link.build.ts +48 -0
- package/src/list/index.ts +13 -0
- package/src/list/list.build.ts +51 -0
- package/src/node/preload/run-service-preload.ts +14 -0
- package/src/node/preload/service-preload.interface.ts +6 -0
- package/src/resource/resource.interface.ts +37 -0
- package/src/service/config.api.ts +1 -0
- package/src/shared/log/index.ts +7 -0
- package/src/shared/log/log-min-level.ts +46 -0
- package/src/shared/log/log-persist-errors.ts +16 -0
- package/src/shared/log/log-persist-logger.ts +28 -0
- package/src/shared/log/log-persist.config.ts +20 -0
- package/src/shared/log/log-persist.interface.ts +8 -0
- package/src/shared/log/log-persist.ts +161 -43
- package/dist/chunks/enable-log-persist-BB-unD4p.js.map +0 -1
- package/dist/chunks/list.api-6Q4_-7oN.js.map +0 -1
- package/dist/chunks/task-queue-D5uWjqVN.js.map +0 -1
- package/dist/idea/idea.interface.d.ts +0 -25
- package/dist/idea/idea.interface.d.ts.map +0 -1
- package/src/idea/idea.interface.ts +0 -28
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export declare const LOG_PERSIST_TOPIC = "log-persist";
|
|
3
3
|
/** Operational logs from the persist pipeline — never re-offered to avoid feedback loops. */
|
|
4
4
|
export declare const LOG_PERSIST_INTERNAL_TOPIC = "log-persist-internal";
|
|
5
|
+
export declare function configurePersistLoggerRateLimit(ms: number): void;
|
|
5
6
|
export declare function isLogPersistInternalTopic(topic: string | undefined): boolean;
|
|
6
7
|
type PersistLogData = Record<string, unknown>;
|
|
7
8
|
export declare const persistLogger: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-persist-logger.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist-logger.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAE/C,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"log-persist-logger.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist-logger.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAE/C,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AAOjE,wBAAgB,+BAA+B,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE5E;AAED,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA8B9C,eAAO,MAAM,aAAa;qBACL,MAAM,SAAS,cAAc;oBAC9B,MAAM,SAAS,cAAc;oBAC7B,MAAM,SAAS,cAAc;qBAC5B,MAAM,SAAS,cAAc;CACjD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAE5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-persist.config.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist.config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,0BAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"log-persist.config.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist.config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,0BAA0B,EAAE,gBAqBxC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAa7F;AAED,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAEtF;AAED,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAGjG;AAED,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAGjG;AAED,wBAAgB,4BAA4B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAOrG;AAED,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,gBAAgB,CAkD9F"}
|
|
@@ -15,8 +15,12 @@ declare class LogPersist {
|
|
|
15
15
|
private mediumDebounceTimer;
|
|
16
16
|
private slowQueueStartedAt;
|
|
17
17
|
private fastRetryTimer;
|
|
18
|
+
private mediumRetryTimer;
|
|
19
|
+
private slowRetryTimer;
|
|
18
20
|
private heartbeatTimer;
|
|
19
21
|
private lastHeartbeatAt;
|
|
22
|
+
private permanentFailureCount;
|
|
23
|
+
private circuitBreakerTripped;
|
|
20
24
|
private laneFlushing;
|
|
21
25
|
private consecutiveFailures;
|
|
22
26
|
private lastFlushAt;
|
|
@@ -35,6 +39,10 @@ declare class LogPersist {
|
|
|
35
39
|
private drainQueues;
|
|
36
40
|
private recordLaneError;
|
|
37
41
|
private recordLaneSuccess;
|
|
42
|
+
private handleLaneFlushFailure;
|
|
43
|
+
private tripCircuitBreaker;
|
|
44
|
+
private cancelLaneRetryTimers;
|
|
45
|
+
private scheduleLaneRetry;
|
|
38
46
|
private queueSnapshot;
|
|
39
47
|
private installShutdownHook;
|
|
40
48
|
private startHeartbeat;
|
|
@@ -47,7 +55,6 @@ declare class LogPersist {
|
|
|
47
55
|
private evictMediumOverflow;
|
|
48
56
|
private evictSlowOverflow;
|
|
49
57
|
private flushFast;
|
|
50
|
-
private scheduleFastRetry;
|
|
51
58
|
private flushMedium;
|
|
52
59
|
private flushSlow;
|
|
53
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-persist.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EACR,uBAAuB,EAGvB,eAAe,EAClB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"log-persist.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EACR,uBAAuB,EAGvB,eAAe,EAClB,MAAM,yBAAyB,CAAC;AAyBjC,cAAM,UAAU;IACZ,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAElD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO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C,mBAAmB;IAc3B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,aAAa;YAOP,sBAAsB;IAepC,OAAO,CAAC,mBAAmB;IAkC3B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,iBAAiB;YA0BX,SAAS;YAoET,WAAW;YA6EX,SAAS;CAgF1B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -34,6 +34,12 @@ export interface LogPersistConfig {
|
|
|
34
34
|
postTimeoutMs: number;
|
|
35
35
|
/** Graceful shutdown drain ceiling */
|
|
36
36
|
shutdownDrainTimeoutMs: number;
|
|
37
|
+
/** Delay before medium/slow lane flush retries after failure (fast lane uses the same interval). */
|
|
38
|
+
laneRetryIntervalMs: number;
|
|
39
|
+
/** Suppress duplicate persistLogger warn/error lines with the same message within this window. */
|
|
40
|
+
errorLogRateLimitMs: number;
|
|
41
|
+
/** Disable log-persist after this many consecutive permanent flush errors. */
|
|
42
|
+
circuitBreakerPermanentFailureThreshold: number;
|
|
37
43
|
}
|
|
38
44
|
export interface EnableLogPersistOptions {
|
|
39
45
|
service: string;
|
|
@@ -75,6 +81,8 @@ export interface LogPersistQueueBytesStats {
|
|
|
75
81
|
export interface LogPersistStats {
|
|
76
82
|
enabled: boolean;
|
|
77
83
|
draining: boolean;
|
|
84
|
+
circuitBreakerTripped: boolean;
|
|
85
|
+
permanentFailureCount: number;
|
|
78
86
|
service: string | null;
|
|
79
87
|
process: string | null;
|
|
80
88
|
queues: LogPersistQueueStats;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-persist.interface.d.ts","sourceRoot":"","sources":["../../../src/shared/log/log-persist.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,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ACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,6BAA6B;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACpC,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -7,13 +7,13 @@ import type { Task } from "./task.interface";
|
|
|
7
7
|
* @see target-supabase-sdk/node
|
|
8
8
|
*/
|
|
9
9
|
export declare const postTaskWithValidation: (payload: {
|
|
10
|
-
name: string;
|
|
11
10
|
value: string;
|
|
11
|
+
name: string;
|
|
12
12
|
tagList: string[];
|
|
13
13
|
taskStatus: import("./task.interface").TaskStatus.OPEN | import("./task.interface").TaskStatus.TODO;
|
|
14
|
+
params?: unknown;
|
|
14
15
|
extra?: string | undefined;
|
|
15
16
|
traceId?: string | undefined;
|
|
16
17
|
traceParentId?: string | null | undefined;
|
|
17
|
-
params?: unknown;
|
|
18
18
|
}) => SupabaseResponse<Task> | Promise<SupabaseResponse<Task>>;
|
|
19
19
|
//# sourceMappingURL=task-post-validated.api.d.ts.map
|
|
@@ -13,22 +13,22 @@ export declare const postTaskSchema: z.ZodObject<{
|
|
|
13
13
|
traceId: z.ZodOptional<z.ZodString>;
|
|
14
14
|
traceParentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
name: string;
|
|
17
16
|
value: string;
|
|
17
|
+
name: string;
|
|
18
18
|
tagList: string[];
|
|
19
19
|
taskStatus: TaskStatus.OPEN | TaskStatus.TODO;
|
|
20
|
+
params?: unknown;
|
|
20
21
|
extra?: string | undefined;
|
|
21
22
|
traceId?: string | undefined;
|
|
22
23
|
traceParentId?: string | null | undefined;
|
|
23
|
-
params?: unknown;
|
|
24
24
|
}, {
|
|
25
|
-
name: string;
|
|
26
25
|
value: string;
|
|
26
|
+
name: string;
|
|
27
|
+
params?: unknown;
|
|
27
28
|
tagList?: string[] | undefined;
|
|
28
29
|
extra?: string | undefined;
|
|
29
30
|
traceId?: string | undefined;
|
|
30
31
|
traceParentId?: string | null | undefined;
|
|
31
|
-
params?: unknown;
|
|
32
32
|
taskStatus?: TaskStatus.OPEN | TaskStatus.TODO | undefined;
|
|
33
33
|
}>;
|
|
34
34
|
export type PostTaskPayload = z.infer<typeof postTaskSchema>;
|
|
@@ -42,13 +42,13 @@ export declare function createTaskRow({ name, value, params, taskStatus, tagList
|
|
|
42
42
|
* Execution-time checks live in {@link TaskManager.prepareTask}.
|
|
43
43
|
*/
|
|
44
44
|
export declare const postTask: (payload: {
|
|
45
|
-
name: string;
|
|
46
45
|
value: string;
|
|
46
|
+
name: string;
|
|
47
47
|
tagList: string[];
|
|
48
48
|
taskStatus: TaskStatus.OPEN | TaskStatus.TODO;
|
|
49
|
+
params?: unknown;
|
|
49
50
|
extra?: string | undefined;
|
|
50
51
|
traceId?: string | undefined;
|
|
51
52
|
traceParentId?: string | null | undefined;
|
|
52
|
-
params?: unknown;
|
|
53
53
|
}) => SupabaseResponse<Task> | Promise<SupabaseResponse<Task>>;
|
|
54
54
|
//# sourceMappingURL=task-post.api.d.ts.map
|
|
@@ -41,10 +41,10 @@ export declare const postTriggerSchema: z.ZodObject<{
|
|
|
41
41
|
tagList: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
42
42
|
traceId: z.ZodOptional<z.ZodString>;
|
|
43
43
|
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
|
|
44
|
+
status: TriggerStatus;
|
|
45
45
|
value: string;
|
|
46
|
+
name: string;
|
|
46
47
|
tagList: string[];
|
|
47
|
-
status: TriggerStatus;
|
|
48
48
|
action: {
|
|
49
49
|
taskTypeKey: string;
|
|
50
50
|
kind: "post_task";
|
|
@@ -59,8 +59,8 @@ export declare const postTriggerSchema: z.ZodObject<{
|
|
|
59
59
|
};
|
|
60
60
|
traceId?: string | undefined;
|
|
61
61
|
}, {
|
|
62
|
-
name: string;
|
|
63
62
|
value: string;
|
|
63
|
+
name: string;
|
|
64
64
|
action: {
|
|
65
65
|
taskTypeKey: string;
|
|
66
66
|
kind: "post_task";
|
|
@@ -73,9 +73,9 @@ export declare const postTriggerSchema: z.ZodObject<{
|
|
|
73
73
|
minute: number;
|
|
74
74
|
kind: "daily";
|
|
75
75
|
};
|
|
76
|
+
status?: TriggerStatus | undefined;
|
|
76
77
|
tagList?: string[] | undefined;
|
|
77
78
|
traceId?: string | undefined;
|
|
78
|
-
status?: TriggerStatus | undefined;
|
|
79
79
|
}>;
|
|
80
80
|
export type PostTriggerPayload = z.infer<typeof postTriggerSchema>;
|
|
81
81
|
export declare const scanEnabledTriggersSchema: z.ZodObject<{
|
|
@@ -109,10 +109,10 @@ export declare const scanEnabledTriggers: (payload: {
|
|
|
109
109
|
}) => SupabaseResponse<Trigger[]> | Promise<SupabaseResponse<Trigger[]>>;
|
|
110
110
|
/** Create a trigger row (scheduler / admin). */
|
|
111
111
|
export declare const postTrigger: (payload: {
|
|
112
|
-
|
|
112
|
+
status: TriggerStatus;
|
|
113
113
|
value: string;
|
|
114
|
+
name: string;
|
|
114
115
|
tagList: string[];
|
|
115
|
-
status: TriggerStatus;
|
|
116
116
|
action: {
|
|
117
117
|
taskTypeKey: string;
|
|
118
118
|
kind: "post_task";
|
package/package.json
CHANGED
package/src/browser.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export type { SupabaseClient } from "@supabase/supabase-js";
|
|
9
9
|
export * from "./core.api";
|
|
10
10
|
export * from "./core.interface";
|
|
11
|
+
export * from "./core.schema";
|
|
11
12
|
export * from "./core.utils";
|
|
12
13
|
export type {
|
|
13
14
|
GetExtractionPayload,
|
|
@@ -27,11 +28,8 @@ export {
|
|
|
27
28
|
} from "./extraction/extraction.api";
|
|
28
29
|
export type { Extraction, ExtractionDetails } from "./extraction/extraction.interface";
|
|
29
30
|
export { CategoryExtraction } from "./extraction/extraction.interface";
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./link/link.interface";
|
|
33
|
-
export * from "./list/list.api";
|
|
34
|
-
export * from "./list/list.interface";
|
|
31
|
+
export * from "./link/index";
|
|
32
|
+
export * from "./list/index";
|
|
35
33
|
export * from "./node/node.api";
|
|
36
34
|
export * from "./node/node.interface";
|
|
37
35
|
export type {
|
|
@@ -215,10 +213,13 @@ export {
|
|
|
215
213
|
isLogBatchList,
|
|
216
214
|
isLogEntry,
|
|
217
215
|
LOG_BATCH_LOADER_KEY,
|
|
216
|
+
LOG_MIN_LEVEL_ENV_KEY,
|
|
218
217
|
LOG_PERSIST_LOADER_KEY,
|
|
219
218
|
LogLevel,
|
|
220
219
|
logManager,
|
|
220
|
+
logMinLevelFromEnv,
|
|
221
221
|
parseLogBatchMeta,
|
|
222
|
+
resolveLogMinLevel,
|
|
222
223
|
} from "./shared/log";
|
|
223
224
|
export { isHttpUrl, resolveFetchUrl } from "./shared/utils/fetch-url";
|
|
224
225
|
export { getValueAtPath } from "./shared/utils/get-value-at-path";
|
package/src/core.api.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { PostgrestFilterBuilder } from "@supabase/postgrest-js";
|
|
2
2
|
import type { ZodError, ZodType } from "zod";
|
|
3
|
-
import { generateResponse, type Target, type TargetDraft } from "./core.interface";
|
|
4
|
-
import {
|
|
3
|
+
import { generateResponse, type QueryFilter, type Target, type TargetDraft } from "./core.interface";
|
|
4
|
+
import { type PostTargetPayload, postTargetPayloadSchema } from "./core.schema";
|
|
5
|
+
import { type BaseValidator, handleSupabaseError } from "./core.utils";
|
|
5
6
|
import { supabase } from "./supabase";
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export type { QueryFilter } from "./core.interface";
|
|
9
|
+
export type { PostTargetPayload } from "./core.schema";
|
|
10
|
+
export {
|
|
11
|
+
formatZodError,
|
|
12
|
+
postTargetPayloadSchema,
|
|
13
|
+
queryFilterSchema,
|
|
14
|
+
safeParseWithSchema,
|
|
15
|
+
targetDraftSchema,
|
|
16
|
+
} from "./core.schema";
|
|
12
17
|
|
|
13
18
|
export const MAX_TARGET_LIST_PAGE_SIZE = 100;
|
|
14
19
|
|
|
@@ -379,30 +384,16 @@ export const deleteTarget = async ({ id, filterList }: { id: string; filterList?
|
|
|
379
384
|
return generateResponse.success();
|
|
380
385
|
};
|
|
381
386
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
tagList: Target["tagList"];
|
|
387
|
-
extra?: Target["extra"];
|
|
388
|
-
details?: Target["details"];
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
class PostTargetPayloadValidator extends BaseValidator<PostTargetPayload> {
|
|
392
|
-
protected requiredFields: (keyof PostTargetPayload)[] = ["category", "name", "value", "tagList"];
|
|
393
|
-
protected optionalFields: (keyof PostTargetPayload)[] = ["extra", "details"];
|
|
394
|
-
|
|
395
|
-
constructor() {
|
|
396
|
-
super();
|
|
397
|
-
// Add custom
|
|
398
|
-
this.addCustomValidator((_val) => {
|
|
399
|
-
return true;
|
|
400
|
-
});
|
|
387
|
+
function parsePostTargetPayload(payload: unknown): PostTargetPayload {
|
|
388
|
+
const result = postTargetPayloadSchema.safeParse(payload);
|
|
389
|
+
if (!result.success) {
|
|
390
|
+
throw formatZodValidationError("PostTargetPayload", result.error);
|
|
401
391
|
}
|
|
392
|
+
return result.data;
|
|
402
393
|
}
|
|
403
394
|
|
|
404
395
|
export const postTarget = async (payload: PostTargetPayload) => {
|
|
405
|
-
const validPayload =
|
|
396
|
+
const validPayload = parsePostTargetPayload(payload);
|
|
406
397
|
|
|
407
398
|
const { data, error } = await supabase.client
|
|
408
399
|
.from("target")
|
|
@@ -443,7 +434,7 @@ export const patchTarget = async ({ id, ...restPayload }: PatchTargetPayload) =>
|
|
|
443
434
|
}
|
|
444
435
|
if (fetchError) handleSupabaseError("patchTarget", fetchError, "Failed to fetch target.");
|
|
445
436
|
|
|
446
|
-
const updatedTarget =
|
|
437
|
+
const updatedTarget = parsePostTargetPayload(restPayload);
|
|
447
438
|
|
|
448
439
|
const { data, error } = await supabase.client
|
|
449
440
|
.from("target")
|
package/src/core.interface.ts
CHANGED
|
@@ -14,6 +14,12 @@ export interface Target {
|
|
|
14
14
|
/** Target row before persistence — no `id` or `created_at`. */
|
|
15
15
|
export type TargetDraft<T extends Target> = Omit<T, "id" | "created_at">;
|
|
16
16
|
|
|
17
|
+
export interface QueryFilter {
|
|
18
|
+
field: string;
|
|
19
|
+
operator: "eq" | "neq" | "in";
|
|
20
|
+
value: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
export enum StatusCode {
|
|
18
24
|
SUCCESS = 200,
|
|
19
25
|
ERROR = 400,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ZodError, type ZodType, z } from "zod";
|
|
2
|
+
import type { QueryFilter } from "./core.interface";
|
|
3
|
+
|
|
4
|
+
/** {@link QueryFilter} — shared by createTarget redundancy checks and message payloads. */
|
|
5
|
+
export const queryFilterSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
field: z.string().trim().min(1),
|
|
8
|
+
operator: z.enum(["eq", "neq", "in"]),
|
|
9
|
+
value: z.any(),
|
|
10
|
+
})
|
|
11
|
+
.transform(
|
|
12
|
+
(row): QueryFilter => ({
|
|
13
|
+
field: row.field,
|
|
14
|
+
operator: row.operator,
|
|
15
|
+
value: row.value,
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
/** Persisted Target create/patch body (no `id` / `created_at`). */
|
|
20
|
+
export const postTargetPayloadSchema = z.object({
|
|
21
|
+
name: z.string(),
|
|
22
|
+
value: z.string(),
|
|
23
|
+
category: z.string(),
|
|
24
|
+
tagList: z.array(z.string()),
|
|
25
|
+
extra: z.string().optional(),
|
|
26
|
+
details: z.unknown().optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type PostTargetPayload = z.infer<typeof postTargetPayloadSchema>;
|
|
30
|
+
|
|
31
|
+
/** {@link TargetDraft} — stricter trim on identity fields for draft/message boundaries. */
|
|
32
|
+
export const targetDraftSchema = postTargetPayloadSchema.extend({
|
|
33
|
+
name: z.string().trim().min(1),
|
|
34
|
+
value: z.string().trim().min(1),
|
|
35
|
+
category: z.string().trim().min(1),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export function formatZodError(error: ZodError): string {
|
|
39
|
+
return error.issues.map((issue) => issue.message).join("; ");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function safeParseWithSchema<T extends ZodType>(
|
|
43
|
+
schema: T,
|
|
44
|
+
input: unknown,
|
|
45
|
+
): { ok: true; data: z.infer<T> } | { ok: false; error: string } {
|
|
46
|
+
const result = schema.safeParse(input);
|
|
47
|
+
if (!result.success) {
|
|
48
|
+
return { ok: false, error: formatZodError(result.error) };
|
|
49
|
+
}
|
|
50
|
+
return { ok: true, data: result.data };
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link domain public API — curated re-exports only.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type { PostLinkCreatePayload } from "./link.api";
|
|
6
|
+
export { PostLinkValidator, postLinkCreate } from "./link.api";
|
|
7
|
+
export type { LinkTargetDraftBuildInput } from "./link.build";
|
|
8
|
+
export { buildLinkTargetDraft, LINK_MANIFEST_VERSION, linkTargetDraftBuildInputSchema } from "./link.build";
|
|
9
|
+
export type { Link, LinkDetails } from "./link.interface";
|
|
10
|
+
export { CategoryLink } from "./link.interface";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { TargetDraft } from "../core.interface";
|
|
3
|
+
import { CategoryLink, type Link } from "./link.interface";
|
|
4
|
+
|
|
5
|
+
export const LINK_MANIFEST_VERSION = 0;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Convenience input for {@link buildLinkTargetDraft} — must not include `category`.
|
|
9
|
+
* Also accepted in {@link buildListTargetDraft} `items` as syntactic sugar (see `list.build.ts`).
|
|
10
|
+
*/
|
|
11
|
+
export interface LinkTargetDraftBuildInput<O = unknown> {
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
description: string;
|
|
15
|
+
preview?: string;
|
|
16
|
+
loaderKey: string;
|
|
17
|
+
tagList?: string[];
|
|
18
|
+
original: O;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Runtime shape check for {@link LinkTargetDraftBuildInput} — `.strict()` rejects `category` and other extra keys. */
|
|
22
|
+
export const linkTargetDraftBuildInputSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
value: z.string(),
|
|
26
|
+
description: z.string(),
|
|
27
|
+
preview: z.string().optional(),
|
|
28
|
+
loaderKey: z.string(),
|
|
29
|
+
tagList: z.array(z.string()).optional(),
|
|
30
|
+
original: z.unknown(),
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
|
|
34
|
+
export function buildLinkTargetDraft<O = unknown>(input: LinkTargetDraftBuildInput<O>): TargetDraft<Link> {
|
|
35
|
+
return {
|
|
36
|
+
name: input.name,
|
|
37
|
+
value: input.value,
|
|
38
|
+
category: CategoryLink.LINK,
|
|
39
|
+
tagList: input.tagList ?? [],
|
|
40
|
+
details: {
|
|
41
|
+
manifestVersion: LINK_MANIFEST_VERSION,
|
|
42
|
+
description: input.description,
|
|
43
|
+
preview: input.preview ?? "",
|
|
44
|
+
loaderKey: input.loaderKey,
|
|
45
|
+
original: input.original,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List domain public API — curated re-exports only.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type { PostListCreatePayload } from "./list.api";
|
|
6
|
+
export { PostListValidator, postListCreate, postLogListCreate } from "./list.api";
|
|
7
|
+
export type { BuildListTargetDraftInput } from "./list.build";
|
|
8
|
+
export {
|
|
9
|
+
buildListTargetDraft,
|
|
10
|
+
LIST_MANIFEST_VERSION,
|
|
11
|
+
} from "./list.build";
|
|
12
|
+
export type { List, ListDetails } from "./list.interface";
|
|
13
|
+
export { CategoryList } from "./list.interface";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { TargetDraft } from "../core.interface";
|
|
2
|
+
import {
|
|
3
|
+
buildLinkTargetDraft,
|
|
4
|
+
type LinkTargetDraftBuildInput,
|
|
5
|
+
linkTargetDraftBuildInputSchema,
|
|
6
|
+
} from "../link/link.build";
|
|
7
|
+
import { CategoryList, type List, type ListDetails } from "./list.interface";
|
|
8
|
+
|
|
9
|
+
export const LIST_MANIFEST_VERSION = 0;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Input for {@link buildListTargetDraft}.
|
|
13
|
+
*
|
|
14
|
+
* `items`: most lists store Link rows. {@link LinkTargetDraftBuildInput} is syntactic
|
|
15
|
+
* sugar — expanded via `buildLinkTargetDraft`. Any other shape is stored as-is.
|
|
16
|
+
*/
|
|
17
|
+
export type BuildListTargetDraftInput<O = unknown, TCustom = unknown> = {
|
|
18
|
+
loaderKey: string;
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
meta?: unknown;
|
|
22
|
+
preview?: string;
|
|
23
|
+
tagList?: string[];
|
|
24
|
+
items: Array<LinkTargetDraftBuildInput<O> | TCustom>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function isLinkTargetDraftBuildInput(item: unknown): item is LinkTargetDraftBuildInput {
|
|
28
|
+
return linkTargetDraftBuildInputSchema.safeParse(item).success;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function buildListTargetDraft<O = unknown, TCustom = unknown>(
|
|
32
|
+
input: BuildListTargetDraftInput<O, TCustom>,
|
|
33
|
+
): TargetDraft<List> {
|
|
34
|
+
const items = input.items.map((item) => (isLinkTargetDraftBuildInput(item) ? buildLinkTargetDraft(item) : item));
|
|
35
|
+
|
|
36
|
+
const details: ListDetails = {
|
|
37
|
+
manifestVersion: LIST_MANIFEST_VERSION,
|
|
38
|
+
meta: input.meta ?? "",
|
|
39
|
+
preview: input.preview ?? "",
|
|
40
|
+
loaderKey: input.loaderKey,
|
|
41
|
+
items,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
name: input.name,
|
|
46
|
+
value: input.value,
|
|
47
|
+
category: CategoryList.LIST,
|
|
48
|
+
tagList: input.tagList ?? [],
|
|
49
|
+
details,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { validateLogPersistPreloadEnv } from "../../shared/log/enable-log-persist";
|
|
3
|
+
import { logManager } from "../../shared/log/log-manager";
|
|
4
|
+
import { resolveLogMinLevel } from "../../shared/log/log-min-level";
|
|
3
5
|
import { logPersistEnabledFromEnv } from "../../shared/log/log-persist.config";
|
|
4
6
|
import { loadEnvFiles, pinEnvProfileFromArgv } from "../env/load-env";
|
|
5
7
|
import { resolveProjectRootByPackageName } from "../env/project-root";
|
|
@@ -22,12 +24,22 @@ function applyServiceEnvDefaults(projectRoot: string, options: ServicePreloadOpt
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
function applyLogMinLevelFromEnv(options: ServicePreloadOptions): void {
|
|
28
|
+
if (options.applyLogMinLevel === false) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
logManager.setOptions({
|
|
32
|
+
minLevel: resolveLogMinLevel({ defaultLevel: options.defaultLogMinLevel }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
/**
|
|
26
37
|
* Unified Node `--import` preload runner (sync only).
|
|
27
38
|
*
|
|
28
39
|
* Phase 1 — Resolve project root from service package name
|
|
29
40
|
* Phase 2 — Load env files (`.env.local` / `.env`, or `.env.prod` when `--prod`)
|
|
30
41
|
* Phase 3 — Apply SDK service env defaults + optional L3 hook
|
|
42
|
+
* Phase 3½ — Apply LOG_MIN_LEVEL → logManager.minLevel (after env load)
|
|
31
43
|
* Phase 4 — Validate log-persist env when enabled
|
|
32
44
|
* Phase 5 — Process diagnostics (TODO)
|
|
33
45
|
*
|
|
@@ -42,6 +54,8 @@ export function runServicePreload(options: ServicePreloadOptions): void {
|
|
|
42
54
|
applyServiceEnvDefaults(projectRoot, options);
|
|
43
55
|
options.applyEnvDefaults?.(projectRoot);
|
|
44
56
|
|
|
57
|
+
applyLogMinLevelFromEnv(options);
|
|
58
|
+
|
|
45
59
|
validateLogPersistPreloadEnv();
|
|
46
60
|
|
|
47
61
|
// TODO: Phase 5 — optional unhandledRejection / uncaughtException formatters
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { LogLevel } from "../../shared/log/log-manager";
|
|
2
|
+
|
|
1
3
|
export interface ServicePreloadOptions {
|
|
2
4
|
/** `import.meta.url` from the service `scripts/preload.mjs`. */
|
|
3
5
|
callerImportMetaUrl: string;
|
|
@@ -11,4 +13,8 @@ export interface ServicePreloadOptions {
|
|
|
11
13
|
afterLoadEnv?: () => void;
|
|
12
14
|
/** L3 hook after SDK defaults (legacy aliases, etc.). */
|
|
13
15
|
applyEnvDefaults?: (projectRoot: string) => void;
|
|
16
|
+
/** Default when `LOG_MIN_LEVEL` unset; SDK default is DEBUG in dev, INFO in prod. */
|
|
17
|
+
defaultLogMinLevel?: LogLevel;
|
|
18
|
+
/** Apply `logManager.setOptions({ minLevel })` from env (default true). */
|
|
19
|
+
applyLogMinLevel?: boolean;
|
|
14
20
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Target } from "../core.interface";
|
|
2
|
+
|
|
3
|
+
export enum CategoryResource {
|
|
4
|
+
RESOURCE = "resource",
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Resource extends Target {
|
|
8
|
+
/** For now same to value */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Unique id, "vultr:149.28.16.125" */
|
|
11
|
+
value: string;
|
|
12
|
+
category: CategoryResource;
|
|
13
|
+
details: ResourceDetails;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ResourceDetails {
|
|
17
|
+
manifestVersion: 0;
|
|
18
|
+
/** "vultr-vps" | "supabase-project" | "telegram-storage" */
|
|
19
|
+
loaderKey: string;
|
|
20
|
+
meta: unknown;
|
|
21
|
+
runtime: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// {
|
|
25
|
+
// name: "windows-storage:DESKTOP-K32MS2Q",
|
|
26
|
+
// value: "windows-storage:DESKTOP-K32MS2Q",
|
|
27
|
+
// category: CategoryResource.RESOURCE,
|
|
28
|
+
// tagList: [],
|
|
29
|
+
// details: {
|
|
30
|
+
// manifestVersion: 0,
|
|
31
|
+
// loaderKey: "windows-storage",
|
|
32
|
+
// meta: {
|
|
33
|
+
// hostname: "DESKTOP-K32MS2Q",
|
|
34
|
+
// },
|
|
35
|
+
// runtime: {},
|
|
36
|
+
// },
|
|
37
|
+
// }
|
|
@@ -61,6 +61,7 @@ export const DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS: readonly SystemRegistrySeedSlot
|
|
|
61
61
|
{ serviceValue: "storage-service" },
|
|
62
62
|
{ serviceValue: "gc-service" },
|
|
63
63
|
{ serviceValue: "upload-service" },
|
|
64
|
+
{ serviceValue: "cv-service" },
|
|
64
65
|
] as const;
|
|
65
66
|
|
|
66
67
|
const configCategoryFilter: QueryFilter = {
|
package/src/shared/log/index.ts
CHANGED
|
@@ -23,6 +23,13 @@ export {
|
|
|
23
23
|
export type { LogEntry, LoggerWithScope, LogOptions, LogRestParams, WithScopeOptions } from "./log-manager";
|
|
24
24
|
// log-manager
|
|
25
25
|
export { LogLevel, LogManager, logManager } from "./log-manager";
|
|
26
|
+
export type { ResolveLogMinLevelOptions } from "./log-min-level";
|
|
27
|
+
// log-min-level
|
|
28
|
+
export {
|
|
29
|
+
LOG_MIN_LEVEL_ENV_KEY,
|
|
30
|
+
logMinLevelFromEnv,
|
|
31
|
+
resolveLogMinLevel,
|
|
32
|
+
} from "./log-min-level";
|
|
26
33
|
export type { LogBatchMeta, LogPersistLane } from "./log-persist.interface";
|
|
27
34
|
export { LOG_BATCH_LOADER_KEY, LOG_PERSIST_LOADER_KEY } from "./log-persist.interface";
|
|
28
35
|
export type {
|