dominus-sdk-nodejs 1.14.0 → 1.16.0
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/index.d.ts +32 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/console-capture.d.ts +32 -0
- package/dist/lib/console-capture.d.ts.map +1 -0
- package/dist/lib/console-capture.js +136 -0
- package/dist/lib/console-capture.js.map +1 -0
- package/dist/lib/user-session.d.ts +60 -0
- package/dist/lib/user-session.d.ts.map +1 -0
- package/dist/lib/user-session.js +139 -0
- package/dist/lib/user-session.js.map +1 -0
- package/dist/namespaces/admin.d.ts +30 -0
- package/dist/namespaces/admin.d.ts.map +1 -1
- package/dist/namespaces/admin.js +31 -0
- package/dist/namespaces/admin.js.map +1 -1
- package/dist/namespaces/artifacts.d.ts +101 -0
- package/dist/namespaces/artifacts.d.ts.map +1 -0
- package/dist/namespaces/artifacts.js +78 -0
- package/dist/namespaces/artifacts.js.map +1 -0
- package/dist/namespaces/db.d.ts +5 -4
- package/dist/namespaces/db.d.ts.map +1 -1
- package/dist/namespaces/db.js +85 -69
- package/dist/namespaces/db.js.map +1 -1
- package/dist/namespaces/ddl.js +10 -10
- package/dist/namespaces/ddl.js.map +1 -1
- package/dist/namespaces/files.d.ts +2 -1
- package/dist/namespaces/files.d.ts.map +1 -1
- package/dist/namespaces/files.js.map +1 -1
- package/dist/namespaces/jobs.d.ts +113 -0
- package/dist/namespaces/jobs.d.ts.map +1 -0
- package/dist/namespaces/jobs.js +112 -0
- package/dist/namespaces/jobs.js.map +1 -0
- package/dist/namespaces/portal.d.ts +3 -0
- package/dist/namespaces/portal.d.ts.map +1 -1
- package/dist/namespaces/portal.js +44 -1
- package/dist/namespaces/portal.js.map +1 -1
- package/dist/namespaces/processor.d.ts +44 -0
- package/dist/namespaces/processor.d.ts.map +1 -0
- package/dist/namespaces/processor.js +59 -0
- package/dist/namespaces/processor.js.map +1 -0
- package/dist/namespaces/sync.d.ts +40 -0
- package/dist/namespaces/sync.d.ts.map +1 -0
- package/dist/namespaces/sync.js +40 -0
- package/dist/namespaces/sync.js.map +1 -0
- package/package.json +1 -1
package/dist/namespaces/admin.js
CHANGED
|
@@ -56,5 +56,36 @@ export class AdminNamespace {
|
|
|
56
56
|
timeout: 120000, // 2 minutes for reset + reseed
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
+
// ========================================
|
|
60
|
+
// PLATFORM KV OPERATIONS
|
|
61
|
+
// ========================================
|
|
62
|
+
/**
|
|
63
|
+
* Export hashed tokens from the platform database.
|
|
64
|
+
*
|
|
65
|
+
* Returns all tokens with their project_slug, environment, system, and token_hash.
|
|
66
|
+
* Requires admin or ecosystem system level.
|
|
67
|
+
*/
|
|
68
|
+
async exportTokens() {
|
|
69
|
+
return this.client.request({
|
|
70
|
+
endpoint: '/api/admin/tokens/export',
|
|
71
|
+
method: 'GET',
|
|
72
|
+
useGateway: true,
|
|
73
|
+
timeout: 30000,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Seed KV store with tokens and project metadata from the database.
|
|
78
|
+
*
|
|
79
|
+
* Syncs token hashes and project info into Cloudflare KV for fast lookups.
|
|
80
|
+
* Also syncs the JWT public key. Requires admin system level.
|
|
81
|
+
*/
|
|
82
|
+
async seedKV() {
|
|
83
|
+
return this.client.request({
|
|
84
|
+
endpoint: '/api/admin/kv/seed',
|
|
85
|
+
method: 'POST',
|
|
86
|
+
useGateway: true,
|
|
87
|
+
timeout: 60000,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
59
90
|
}
|
|
60
91
|
//# sourceMappingURL=admin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/namespaces/admin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/namespaces/admin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuCH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,2CAA2C;IAC3C,4BAA4B;IAC5B,2CAA2C;IAE3C;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,mBAAmB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,QAAQ,EAAE,kCAAkC;YAC5C,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,KAAK,EAAE,uBAAuB;SACxC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,kBAAkB;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,QAAQ,EAAE,iCAAiC;YAC3C,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,MAAM,EAAE,+BAA+B;SACjD,CAAC,CAAC;IACL,CAAC;IAED,2CAA2C;IAC3C,yBAAyB;IACzB,2CAA2C;IAE3C;;;;;OAKG;IACH,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,QAAQ,EAAE,0BAA0B;YACpC,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,QAAQ,EAAE,oBAAoB;YAC9B,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifacts Namespace - Temporary artifact storage via Artifact Worker.
|
|
3
|
+
*
|
|
4
|
+
* Artifacts are stored in Redis (< 1MB) or B2 (>= 1MB) with automatic
|
|
5
|
+
* TTL-based expiration. Metadata tracked in object.artifacts_live table.
|
|
6
|
+
*/
|
|
7
|
+
import type { DominusClient } from '../lib/client.js';
|
|
8
|
+
export interface ArtifactHealth {
|
|
9
|
+
service: string;
|
|
10
|
+
status: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
}
|
|
13
|
+
export interface StoreArtifactOptions {
|
|
14
|
+
/** Optional caller-provided key (UUID generated if not provided) */
|
|
15
|
+
key?: string;
|
|
16
|
+
/** Base64-encoded data */
|
|
17
|
+
data: string;
|
|
18
|
+
/** TTL in seconds (default 3600) */
|
|
19
|
+
ttl_seconds?: number;
|
|
20
|
+
/** Optional category for organization */
|
|
21
|
+
category?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface StoreArtifactResult {
|
|
24
|
+
key: string;
|
|
25
|
+
ref: string;
|
|
26
|
+
storage_type: 'redis' | 'b2';
|
|
27
|
+
size_bytes: number;
|
|
28
|
+
expires_at: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RetrieveArtifactResult {
|
|
31
|
+
key: string;
|
|
32
|
+
data: string;
|
|
33
|
+
storage_type: 'redis' | 'b2';
|
|
34
|
+
size_bytes: number;
|
|
35
|
+
expires_at: string;
|
|
36
|
+
}
|
|
37
|
+
export interface DeleteArtifactResult {
|
|
38
|
+
deleted: boolean;
|
|
39
|
+
key: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CleanupArtifactOptions {
|
|
42
|
+
/** Skip throttle check */
|
|
43
|
+
force?: boolean;
|
|
44
|
+
/** Max items to clean (default 100) */
|
|
45
|
+
limit?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface CleanupArtifactResult {
|
|
48
|
+
cleaned: number;
|
|
49
|
+
skipped: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface ArtifactListOptions {
|
|
52
|
+
/** Max items to return (default 100, max 500) */
|
|
53
|
+
limit?: number;
|
|
54
|
+
/** Filter by category */
|
|
55
|
+
category?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ArtifactListResult {
|
|
58
|
+
artifacts: ArtifactMetaEntry[];
|
|
59
|
+
count: number;
|
|
60
|
+
total_size_bytes: number;
|
|
61
|
+
}
|
|
62
|
+
export interface ArtifactMetaEntry {
|
|
63
|
+
id: string;
|
|
64
|
+
artifact_key: string;
|
|
65
|
+
storage_type: 'redis' | 'b2';
|
|
66
|
+
b2_object_id?: string;
|
|
67
|
+
size_bytes: number;
|
|
68
|
+
ttl_seconds: number;
|
|
69
|
+
expires_at: string;
|
|
70
|
+
category?: string;
|
|
71
|
+
created_at: string;
|
|
72
|
+
}
|
|
73
|
+
export declare class ArtifactsNamespace {
|
|
74
|
+
private client;
|
|
75
|
+
constructor(client: DominusClient);
|
|
76
|
+
/**
|
|
77
|
+
* List artifacts for the current project/environment.
|
|
78
|
+
*/
|
|
79
|
+
list(options?: ArtifactListOptions): Promise<ArtifactListResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Check artifact worker health.
|
|
82
|
+
*/
|
|
83
|
+
getHealth(): Promise<ArtifactHealth>;
|
|
84
|
+
/**
|
|
85
|
+
* Store an artifact.
|
|
86
|
+
*/
|
|
87
|
+
store(options: StoreArtifactOptions): Promise<StoreArtifactResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieve an artifact by key.
|
|
90
|
+
*/
|
|
91
|
+
retrieve(key: string): Promise<RetrieveArtifactResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Delete an artifact by key.
|
|
94
|
+
*/
|
|
95
|
+
delete(key: string): Promise<DeleteArtifactResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Cleanup expired artifacts (admin only).
|
|
98
|
+
*/
|
|
99
|
+
cleanup(options?: CleanupArtifactOptions): Promise<CleanupArtifactResult>;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceR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1MB) or B2 (>= 1MB) with automatic
|
|
5
|
+
* TTL-based expiration. Metadata tracked in object.artifacts_live table.
|
|
6
|
+
*/
|
|
7
|
+
export class ArtifactsNamespace {
|
|
8
|
+
client;
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List artifacts for the current project/environment.
|
|
14
|
+
*/
|
|
15
|
+
async list(options) {
|
|
16
|
+
return this.client.request({
|
|
17
|
+
endpoint: '/api/artifact/list',
|
|
18
|
+
method: 'POST',
|
|
19
|
+
body: (options || {}),
|
|
20
|
+
useGateway: true,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check artifact worker health.
|
|
25
|
+
*/
|
|
26
|
+
async getHealth() {
|
|
27
|
+
return this.client.request({
|
|
28
|
+
endpoint: '/api/artifact/health',
|
|
29
|
+
method: 'GET',
|
|
30
|
+
useGateway: true,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Store an artifact.
|
|
35
|
+
*/
|
|
36
|
+
async store(options) {
|
|
37
|
+
return this.client.request({
|
|
38
|
+
endpoint: '/api/artifact/store',
|
|
39
|
+
method: 'POST',
|
|
40
|
+
body: { ...options },
|
|
41
|
+
useGateway: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Retrieve an artifact by key.
|
|
46
|
+
*/
|
|
47
|
+
async retrieve(key) {
|
|
48
|
+
return this.client.request({
|
|
49
|
+
endpoint: '/api/artifact/retrieve',
|
|
50
|
+
method: 'POST',
|
|
51
|
+
body: { key },
|
|
52
|
+
useGateway: true,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Delete an artifact by key.
|
|
57
|
+
*/
|
|
58
|
+
async delete(key) {
|
|
59
|
+
return this.client.request({
|
|
60
|
+
endpoint: '/api/artifact/delete',
|
|
61
|
+
method: 'POST',
|
|
62
|
+
body: { key },
|
|
63
|
+
useGateway: true,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Cleanup expired artifacts (admin only).
|
|
68
|
+
*/
|
|
69
|
+
async cleanup(options) {
|
|
70
|
+
return this.client.request({
|
|
71
|
+
endpoint: '/api/artifact/cleanup',
|
|
72
|
+
method: 'POST',
|
|
73
|
+
body: (options || {}),
|
|
74
|
+
useGateway: true,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/namespaces/artifacts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmFH,MAAM,OAAO,kBAAkB;IACP;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,oBAAoB;YAC9B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,CAAC,OAAO,IAAI,EAAE,CAA4B;YAChD,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,sBAAsB;YAChC,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,OAA6B;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,qBAAqB;YAC/B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,GAAG,OAAO,EAA6B;YAC/C,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,GAAG,EAAE;YACb,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,GAAW;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,sBAAsB;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,GAAG,EAAE;YACb,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,OAAgC;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACvB,QAAQ,EAAE,uBAAuB;YACjC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,CAAC,OAAO,IAAI,EAAE,CAA4B;YAChD,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/namespaces/db.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Database Namespace -
|
|
2
|
+
* Database Namespace - DB Worker data CRUD operations.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Routes all database operations through the DB Worker (Cloudflare Worker)
|
|
5
|
+
* via the gateway at /svc/database/*.
|
|
5
6
|
*/
|
|
6
7
|
import type { DominusClient } from '../lib/client.js';
|
|
7
8
|
export interface QueryOptions {
|
|
@@ -34,7 +35,7 @@ export declare class DbNamespace {
|
|
|
34
35
|
* List accessible schemas.
|
|
35
36
|
*
|
|
36
37
|
* Returns schemas that the current user can access (public, tenant_*, etc.)
|
|
37
|
-
* Excludes system schemas (
|
|
38
|
+
* Excludes system schemas (pg_catalog, information_schema, etc.)
|
|
38
39
|
*
|
|
39
40
|
* @returns List of schema names
|
|
40
41
|
*/
|
|
@@ -107,7 +108,7 @@ export declare class DbNamespace {
|
|
|
107
108
|
affected_rows: number;
|
|
108
109
|
}>;
|
|
109
110
|
/**
|
|
110
|
-
* Insert multiple rows at once.
|
|
111
|
+
* Insert multiple rows at once using a transaction.
|
|
111
112
|
*
|
|
112
113
|
* @param table - Table name
|
|
113
114
|
* @param rows - List of column:value dictionaries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/namespaces/db.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/namespaces/db.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;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ACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GACjE,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAmBrC;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GACjE,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;KAAE,CAAC;IA2C7E;;;;;;;;;OASG;IACG,UAAU,IAAI,OAAO,CAAC;QAC1B,OAAO,EAAE,OAAO,CAAC;QACjB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,OAAO,CAAC,EAAE;YACR,OAAO,EAAE,OAAO,CAAC;YACjB,eAAe,EAAE,MAAM,EAAE,CAAC;SAC3B,CAAC;KACH,CAAC;CAOH"}
|
package/dist/namespaces/db.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Database Namespace -
|
|
2
|
+
* Database Namespace - DB Worker data CRUD operations.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Routes all database operations through the DB Worker (Cloudflare Worker)
|
|
5
|
+
* via the gateway at /svc/database/*.
|
|
5
6
|
*/
|
|
6
7
|
export class DbNamespace {
|
|
7
8
|
client;
|
|
@@ -12,17 +13,15 @@ export class DbNamespace {
|
|
|
12
13
|
* List accessible schemas.
|
|
13
14
|
*
|
|
14
15
|
* Returns schemas that the current user can access (public, tenant_*, etc.)
|
|
15
|
-
* Excludes system schemas (
|
|
16
|
+
* Excludes system schemas (pg_catalog, information_schema, etc.)
|
|
16
17
|
*
|
|
17
18
|
* @returns List of schema names
|
|
18
19
|
*/
|
|
19
20
|
async schemas() {
|
|
20
21
|
const result = await this.client.request({
|
|
21
|
-
endpoint: '/api/
|
|
22
|
-
|
|
22
|
+
endpoint: '/api/database/schemas',
|
|
23
|
+
body: {},
|
|
23
24
|
});
|
|
24
|
-
if (Array.isArray(result))
|
|
25
|
-
return result;
|
|
26
25
|
return result.schemas || [];
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
@@ -33,11 +32,9 @@ export class DbNamespace {
|
|
|
33
32
|
*/
|
|
34
33
|
async tables(schema = 'public') {
|
|
35
34
|
const result = await this.client.request({
|
|
36
|
-
endpoint:
|
|
37
|
-
|
|
35
|
+
endpoint: '/api/database/tables',
|
|
36
|
+
body: { schema },
|
|
38
37
|
});
|
|
39
|
-
if (Array.isArray(result))
|
|
40
|
-
return result;
|
|
41
38
|
return result.tables || [];
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
@@ -49,11 +46,9 @@ export class DbNamespace {
|
|
|
49
46
|
*/
|
|
50
47
|
async columns(table, schema = 'public') {
|
|
51
48
|
const result = await this.client.request({
|
|
52
|
-
endpoint:
|
|
53
|
-
|
|
49
|
+
endpoint: '/api/database/columns',
|
|
50
|
+
body: { table, schema },
|
|
54
51
|
});
|
|
55
|
-
if (Array.isArray(result))
|
|
56
|
-
return result;
|
|
57
52
|
return result.columns || [];
|
|
58
53
|
}
|
|
59
54
|
/**
|
|
@@ -64,26 +59,25 @@ export class DbNamespace {
|
|
|
64
59
|
* @returns Query result with rows and total count
|
|
65
60
|
*/
|
|
66
61
|
async query(table, options = {}) {
|
|
67
|
-
const { schema = 'public', filters, sortBy, sortOrder = 'ASC', limit = 100, offset = 0,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
limit,
|
|
73
|
-
offset,
|
|
74
|
-
};
|
|
75
|
-
if (reason)
|
|
76
|
-
body.reason = reason;
|
|
77
|
-
if (actor)
|
|
78
|
-
body.actor = actor;
|
|
79
|
-
// Backend returns {items, total, limit, offset} but we normalize to {rows, total}
|
|
62
|
+
const { schema = 'public', filters, sortBy, sortOrder = 'ASC', limit = 100, offset = 0, } = options;
|
|
63
|
+
// Build order_by in DB Worker format: [{column, direction}]
|
|
64
|
+
const order_by = sortBy
|
|
65
|
+
? [{ column: sortBy, direction: sortOrder }]
|
|
66
|
+
: undefined;
|
|
80
67
|
const result = await this.client.request({
|
|
81
|
-
endpoint:
|
|
82
|
-
body
|
|
68
|
+
endpoint: '/api/database/select',
|
|
69
|
+
body: {
|
|
70
|
+
table,
|
|
71
|
+
schema,
|
|
72
|
+
where: filters,
|
|
73
|
+
order_by,
|
|
74
|
+
limit,
|
|
75
|
+
offset,
|
|
76
|
+
},
|
|
83
77
|
});
|
|
84
78
|
return {
|
|
85
|
-
rows: result.
|
|
86
|
-
total: result.
|
|
79
|
+
rows: result.rows || [],
|
|
80
|
+
total: result.row_count ?? 0,
|
|
87
81
|
};
|
|
88
82
|
}
|
|
89
83
|
/**
|
|
@@ -95,16 +89,18 @@ export class DbNamespace {
|
|
|
95
89
|
* @returns Inserted row data
|
|
96
90
|
*/
|
|
97
91
|
async insert(table, data, options = {}) {
|
|
98
|
-
const { schema = 'public'
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
body
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
const { schema = 'public' } = options;
|
|
93
|
+
const result = await this.client.request({
|
|
94
|
+
endpoint: '/api/database/insert',
|
|
95
|
+
body: {
|
|
96
|
+
table,
|
|
97
|
+
schema,
|
|
98
|
+
data,
|
|
99
|
+
returning: ['*'],
|
|
100
|
+
},
|
|
107
101
|
});
|
|
102
|
+
// Return the first inserted row, or the whole result
|
|
103
|
+
return result.rows?.[0] || result;
|
|
108
104
|
}
|
|
109
105
|
/**
|
|
110
106
|
* Update rows matching filters.
|
|
@@ -116,16 +112,18 @@ export class DbNamespace {
|
|
|
116
112
|
* @returns Affected rows count
|
|
117
113
|
*/
|
|
118
114
|
async update(table, data, filters, options = {}) {
|
|
119
|
-
const { schema = 'public'
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
body
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
const { schema = 'public' } = options;
|
|
116
|
+
const result = await this.client.request({
|
|
117
|
+
endpoint: '/api/database/update',
|
|
118
|
+
body: {
|
|
119
|
+
table,
|
|
120
|
+
schema,
|
|
121
|
+
data,
|
|
122
|
+
where: filters,
|
|
123
|
+
returning: ['*'],
|
|
124
|
+
},
|
|
128
125
|
});
|
|
126
|
+
return { affected_rows: result.row_count ?? 0 };
|
|
129
127
|
}
|
|
130
128
|
/**
|
|
131
129
|
* Delete rows matching filters.
|
|
@@ -136,19 +134,20 @@ export class DbNamespace {
|
|
|
136
134
|
* @returns Affected rows count
|
|
137
135
|
*/
|
|
138
136
|
async delete(table, filters, options = {}) {
|
|
139
|
-
const { schema = 'public'
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
body
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
const { schema = 'public' } = options;
|
|
138
|
+
const result = await this.client.request({
|
|
139
|
+
endpoint: '/api/database/delete',
|
|
140
|
+
body: {
|
|
141
|
+
table,
|
|
142
|
+
schema,
|
|
143
|
+
where: filters,
|
|
144
|
+
returning: ['*'],
|
|
145
|
+
},
|
|
148
146
|
});
|
|
147
|
+
return { affected_rows: result.row_count ?? 0 };
|
|
149
148
|
}
|
|
150
149
|
/**
|
|
151
|
-
* Insert multiple rows at once.
|
|
150
|
+
* Insert multiple rows at once using a transaction.
|
|
152
151
|
*
|
|
153
152
|
* @param table - Table name
|
|
154
153
|
* @param rows - List of column:value dictionaries
|
|
@@ -156,16 +155,33 @@ export class DbNamespace {
|
|
|
156
155
|
* @returns Insert count and optionally rows
|
|
157
156
|
*/
|
|
158
157
|
async bulkInsert(table, rows, options = {}) {
|
|
159
|
-
const { schema = 'public'
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
158
|
+
const { schema = 'public' } = options;
|
|
159
|
+
if (!rows.length) {
|
|
160
|
+
return { inserted_count: 0, rows: [] };
|
|
161
|
+
}
|
|
162
|
+
// Build a multi-row INSERT using /raw endpoint
|
|
163
|
+
// INSERT INTO table (col1, col2) VALUES ($1, $2), ($3, $4) RETURNING *
|
|
164
|
+
const columns = Object.keys(rows[0]);
|
|
165
|
+
const quotedCols = columns.map(c => `"${c}"`).join(', ');
|
|
166
|
+
const params = [];
|
|
167
|
+
const valueClauses = [];
|
|
168
|
+
for (const row of rows) {
|
|
169
|
+
const placeholders = [];
|
|
170
|
+
for (const col of columns) {
|
|
171
|
+
params.push(row[col] ?? null);
|
|
172
|
+
placeholders.push(`$${params.length}`);
|
|
173
|
+
}
|
|
174
|
+
valueClauses.push(`(${placeholders.join(', ')})`);
|
|
175
|
+
}
|
|
176
|
+
const sql = `INSERT INTO "${table}" (${quotedCols}) VALUES ${valueClauses.join(', ')} RETURNING *`;
|
|
177
|
+
const result = await this.client.request({
|
|
178
|
+
endpoint: '/api/database/raw',
|
|
179
|
+
body: { sql, params, schema },
|
|
168
180
|
});
|
|
181
|
+
return {
|
|
182
|
+
inserted_count: result.row_count ?? 0,
|
|
183
|
+
rows: result.rows,
|
|
184
|
+
};
|
|
169
185
|
}
|
|
170
186
|
// ========================================
|
|
171
187
|
// PROVISIONING
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/namespaces/db.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/namespaces/db.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+BH,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAwB;YAC9D,QAAQ,EAAE,uBAAuB;YACjC,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0B;YAChE,QAAQ,EAAE,sBAAsB;YAChC,IAAI,EAAE,EAAE,MAAM,EAAE;SACjB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,KAAa,EAAE,MAAM,GAAG,QAAQ;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA4B;YAClE,QAAQ,EAAE,uBAAuB;YACjC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACxB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,KAAa,EAAE,UAAwB,EAAE;QACnD,MAAM,EACJ,MAAM,GAAG,QAAQ,EACjB,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@ -216,7 +216,7 @@ export class DdlNamespace {
|
|
|
216
216
|
*/
|
|
217
217
|
async getCategoryStructure(categorySlug) {
|
|
218
218
|
return this.client.request({
|
|
219
|
-
endpoint: `/api/
|
|
219
|
+
endpoint: `/api/database/builder/category/${categorySlug}/structure`,
|
|
220
220
|
method: 'GET',
|
|
221
221
|
});
|
|
222
222
|
}
|
|
@@ -225,7 +225,7 @@ export class DdlNamespace {
|
|
|
225
225
|
*/
|
|
226
226
|
async getCategoryMigrationHistory(categorySlug) {
|
|
227
227
|
return this.client.request({
|
|
228
|
-
endpoint: `/api/
|
|
228
|
+
endpoint: `/api/database/builder/category/${categorySlug}/migrations`,
|
|
229
229
|
method: 'GET',
|
|
230
230
|
});
|
|
231
231
|
}
|
|
@@ -234,7 +234,7 @@ export class DdlNamespace {
|
|
|
234
234
|
*/
|
|
235
235
|
async previewMigration(categorySlug, operation, params, migrationName) {
|
|
236
236
|
return this.client.request({
|
|
237
|
-
endpoint: `/api/
|
|
237
|
+
endpoint: `/api/database/builder/category/${categorySlug}/preview-migration`,
|
|
238
238
|
body: {
|
|
239
239
|
operation,
|
|
240
240
|
params,
|
|
@@ -248,7 +248,7 @@ export class DdlNamespace {
|
|
|
248
248
|
*/
|
|
249
249
|
async applyBuilderMigration(categorySlug, operation, params, migrationName) {
|
|
250
250
|
return this.client.request({
|
|
251
|
-
endpoint: `/api/
|
|
251
|
+
endpoint: `/api/database/builder/category/${categorySlug}/apply-migration`,
|
|
252
252
|
body: {
|
|
253
253
|
operation,
|
|
254
254
|
params,
|
|
@@ -262,7 +262,7 @@ export class DdlNamespace {
|
|
|
262
262
|
*/
|
|
263
263
|
async getMigrationFile(categorySlug, versionId) {
|
|
264
264
|
return this.client.request({
|
|
265
|
-
endpoint: `/api/
|
|
265
|
+
endpoint: `/api/database/builder/category/${categorySlug}/migrations/${versionId}`,
|
|
266
266
|
method: 'GET',
|
|
267
267
|
});
|
|
268
268
|
}
|
|
@@ -272,7 +272,7 @@ export class DdlNamespace {
|
|
|
272
272
|
*/
|
|
273
273
|
async getTenantSyncStatus(categorySlug) {
|
|
274
274
|
return this.client.request({
|
|
275
|
-
endpoint: `/api/
|
|
275
|
+
endpoint: `/api/database/builder/category/${categorySlug}/sync-status`,
|
|
276
276
|
method: 'GET',
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -283,7 +283,7 @@ export class DdlNamespace {
|
|
|
283
283
|
*/
|
|
284
284
|
async syncTenantsToLatest(categorySlug) {
|
|
285
285
|
return this.client.request({
|
|
286
|
-
endpoint: `/api/
|
|
286
|
+
endpoint: `/api/database/builder/category/${categorySlug}/sync-tenants`,
|
|
287
287
|
method: 'POST',
|
|
288
288
|
timeout: 120000, // 2 minutes for sync operations
|
|
289
289
|
});
|
|
@@ -305,7 +305,7 @@ export class DdlNamespace {
|
|
|
305
305
|
*/
|
|
306
306
|
async resetCategorySchema(categorySlug) {
|
|
307
307
|
return this.client.request({
|
|
308
|
-
endpoint: `/api/
|
|
308
|
+
endpoint: `/api/database/builder/category/${categorySlug}/reset`,
|
|
309
309
|
method: 'DELETE',
|
|
310
310
|
timeout: 120000, // 2 minutes for reset operations
|
|
311
311
|
});
|
|
@@ -322,7 +322,7 @@ export class DdlNamespace {
|
|
|
322
322
|
*/
|
|
323
323
|
async resetTenantSchema(categorySlug, tenantSlug) {
|
|
324
324
|
return this.client.request({
|
|
325
|
-
endpoint: `/api/
|
|
325
|
+
endpoint: `/api/database/builder/category/${categorySlug}/tenants/${tenantSlug}/reset`,
|
|
326
326
|
method: 'DELETE',
|
|
327
327
|
timeout: 60000, // 1 minute for single tenant reset
|
|
328
328
|
});
|
|
@@ -338,7 +338,7 @@ export class DdlNamespace {
|
|
|
338
338
|
*/
|
|
339
339
|
async deleteMigration(categorySlug, versionId) {
|
|
340
340
|
return this.client.request({
|
|
341
|
-
endpoint: `/api/
|
|
341
|
+
endpoint: `/api/database/builder/category/${categorySlug}/migrations/${versionId}`,
|
|
342
342
|
method: 'DELETE',
|
|
343
343
|
});
|
|
344
344
|
}
|