@kmlckj/licos-platform-sdk 0.6.7 → 0.6.8

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.
Files changed (3) hide show
  1. package/README.md +84 -56
  2. package/dist/index.d.ts +295 -295
  3. package/package.json +42 -42
package/README.md CHANGED
@@ -17,79 +17,107 @@ is resolved automatically by the runtime:
17
17
 
18
18
  ## Database
19
19
 
20
- Database CRUD helpers call the runtime database data plane only. Tooling helpers
21
- can fetch platform schema metadata for ORM export. The SDK does not expose
22
- service deletion APIs.
23
-
24
- ```js
25
- import { database } from '@kmlckj/licos-platform-sdk';
26
-
27
- const rows = await database
20
+ Database CRUD helpers call the runtime database data plane only. Tooling helpers
21
+ can fetch platform schema metadata for ORM export. The SDK does not expose
22
+ service deletion APIs.
23
+
24
+ `database.table(name)` is a query builder. Use it for `select` queries only.
25
+
26
+ ```js
27
+ import { database } from '@kmlckj/licos-platform-sdk';
28
+
29
+ const rows = await database
28
30
  .table('todos')
29
31
  .select('id', 'title')
30
32
  .eq('done', false)
31
33
  .order('created_at', { desc: true })
32
- .limit(10)
33
- .execute();
34
- ```
35
-
36
- ORM export is a tooling helper. It fetches platform schema metadata and returns
37
- source text; it does not use direct database credentials.
38
-
39
- ```js
40
- import { database } from '@kmlckj/licos-platform-sdk';
41
-
42
- const source = await database.exportOrm({ language: 'typescript', orm: 'drizzle' });
34
+ .limit(10)
35
+ .execute();
43
36
  ```
44
37
 
45
- Studio project database management is exposed through `studioDatabase` for
46
- server-side tooling flows. Use it for tables, rows, controlled SQL, migrations,
47
- sync, and backup. Do not import it into browser/client bundles.
38
+ Use top-level helpers for mutations:
48
39
 
49
40
  ```js
50
- import { studioDatabase } from '@kmlckj/licos-platform-sdk';
41
+ import { database } from '@kmlckj/licos-platform-sdk';
51
42
 
52
- await studioDatabase.createTable('users', {
53
- columns: [{ name: 'email', type: 'text', nullable: false }],
43
+ const inserted = await database.insert('todos', {
44
+ row: { title: 'Call customer', done: false },
45
+ returning: true,
54
46
  });
55
47
 
56
- const schema = await studioDatabase.getSchema({ environment: 'dev' });
57
- ```
48
+ await database.updateRows('todos', {
49
+ filters: [{ field: 'id', op: 'eq', value: inserted.data?.[0]?.id }],
50
+ values: { done: true },
51
+ });
58
52
 
59
- ## Object Storage
53
+ await database.deleteRows('todos', {
54
+ filters: [{ field: 'done', op: 'eq', value: true }],
55
+ });
56
+ ```
60
57
 
61
- ```js
62
- import { storage } from '@kmlckj/licos-platform-sdk';
58
+ Do not call `.table('todos').insert(...)`, `.table('todos').updateRows(...)`,
59
+ or `.table('todos').deleteRows(...)`; those methods do not exist on the query
60
+ builder.
63
61
 
62
+ ORM export is a tooling helper. It fetches platform schema metadata and returns
63
+ source text; it does not use direct database credentials.
64
+
65
+ ```js
66
+ import { database } from '@kmlckj/licos-platform-sdk';
67
+
68
+ const source = await database.exportOrm({ language: 'typescript', orm: 'drizzle' });
69
+ ```
70
+
71
+ Studio project database management is exposed through `studioDatabase` for
72
+ server-side tooling flows. Use it for tables, rows, controlled SQL, migrations,
73
+ sync, and backup. Do not import it into browser/client bundles. Do not put
74
+ schema creation or migration logic in normal project runtime request handlers;
75
+ run those operations from LICOS agent/tooling flows before the app starts.
76
+
77
+ ```js
78
+ import { studioDatabase } from '@kmlckj/licos-platform-sdk';
79
+
80
+ await studioDatabase.createTable('users', {
81
+ columns: [{ name: 'email', type: 'text', nullable: false }],
82
+ });
83
+
84
+ const schema = await studioDatabase.getSchema({ environment: 'dev' });
85
+ ```
86
+
87
+ ## Object Storage
88
+
89
+ ```js
90
+ import { storage } from '@kmlckj/licos-platform-sdk';
91
+
64
92
  await storage.createFolder('reports');
65
93
  const file = await storage.uploadFile('/tmp/report.pdf');
66
94
  const link = await storage.shareUrl(file.id);
67
95
  ```
68
96
 
69
97
  `uploadFile` limits each file to 20 MiB.
70
-
71
- The browser entry does not export object storage helpers because runtime tokens
72
- must not be bundled into public frontend code.
73
-
74
- ## Knowledge
75
-
76
- Knowledge helpers import project documents and run semantic retrieval through
77
- the LICOS Knowledge API. Search without dataset filters retrieves from all
78
- accessible datasets. Use dataset IDs or names only when the user explicitly
79
- targets a specific knowledge base.
80
-
81
- ```js
82
- import { knowledge } from '@kmlckj/licos-platform-sdk';
83
-
84
- await knowledge.addText('FAQ content', {
85
- datasetName: 'project_docs',
86
- name: 'faq.txt',
87
- });
88
-
89
- const results = await knowledge.search('How do I reset my password?', {
90
- topK: 5,
91
- });
92
- ```
93
-
94
- The browser entry does not export knowledge helpers because runtime tokens must
95
- not be bundled into public frontend code.
98
+
99
+ The browser entry does not export object storage helpers because runtime tokens
100
+ must not be bundled into public frontend code.
101
+
102
+ ## Knowledge
103
+
104
+ Knowledge helpers import project documents and run semantic retrieval through
105
+ the LICOS Knowledge API. Search without dataset filters retrieves from all
106
+ accessible datasets. Use dataset IDs or names only when the user explicitly
107
+ targets a specific knowledge base.
108
+
109
+ ```js
110
+ import { knowledge } from '@kmlckj/licos-platform-sdk';
111
+
112
+ await knowledge.addText('FAQ content', {
113
+ datasetName: 'project_docs',
114
+ name: 'faq.txt',
115
+ });
116
+
117
+ const results = await knowledge.search('How do I reset my password?', {
118
+ topK: 5,
119
+ });
120
+ ```
121
+
122
+ The browser entry does not export knowledge helpers because runtime tokens must
123
+ not be bundled into public frontend code.
package/dist/index.d.ts CHANGED
@@ -4,218 +4,218 @@ export class PlatformSdkError extends Error {
4
4
  details?: unknown;
5
5
  }
6
6
 
7
- export class ConfigurationError extends PlatformSdkError {}
8
- export class ApiError extends PlatformSdkError {}
9
-
10
- export const DataSourceType: {
11
- TEXT: 0;
12
- URL: 1;
13
- URI: 2;
14
- };
15
-
16
- export type KnowledgeDataSourceType = 0 | 1 | 2 | 'text' | 'url' | 'uri' | 'raw' | 'content' | 'web' | 'file' | 'source_file_id';
17
-
18
- export interface KnowledgeChunkConfig {
19
- separator?: string;
20
- maxTokens?: number;
21
- max_tokens?: number;
22
- removeExtraSpaces?: boolean;
23
- remove_extra_spaces?: boolean;
24
- removeUrlsEmails?: boolean;
25
- remove_urls_emails?: boolean;
26
- }
27
-
28
- export class ChunkConfig {
29
- separator: string;
30
- max_tokens: number;
31
- remove_extra_spaces: boolean;
32
- remove_urls_emails: boolean;
33
- constructor(options?: KnowledgeChunkConfig);
34
- }
35
-
36
- export interface KnowledgeDocumentOptions {
37
- source?: KnowledgeDataSourceType;
38
- source_type?: KnowledgeDataSourceType;
39
- raw_data?: string;
40
- content?: string;
41
- text?: string;
42
- url?: string;
43
- web_url?: string;
44
- uri?: string;
45
- source_file_id?: string;
46
- name?: string;
47
- file_type?: string;
48
- update_rule?: Record<string, unknown>;
49
- }
50
-
51
- export class KnowledgeDocument {
52
- constructor(options?: KnowledgeDocumentOptions);
53
- }
54
-
55
- export interface KnowledgeDataset {
56
- name?: string;
57
- description?: string;
58
- status?: number;
59
- dataset_id?: string;
60
- space_id?: string;
61
- doc_count?: number;
62
- slice_count?: number;
63
- search_method?: string;
64
- supported_search_methods?: string[];
65
- [key: string]: unknown;
66
- }
67
-
68
- export interface ListDatasetsOptions {
69
- name?: string;
70
- spaceId?: string;
71
- space_id?: string;
72
- formatType?: number;
73
- format_type?: number;
74
- pageSize?: number;
75
- page_size?: number;
76
- pageNum?: number;
77
- page_num?: number;
78
- }
79
-
80
- export interface CreateDatasetOptions {
81
- description?: string;
82
- spaceId?: string;
83
- space_id?: string;
84
- config?: Record<string, unknown>;
85
- formatType?: number;
86
- format_type?: number;
87
- sourceType?: string;
88
- source_type?: string;
89
- engineType?: string;
90
- engine_type?: string;
91
- accessScope?: string;
92
- access_scope?: string;
93
- multimodalEnabled?: boolean;
94
- multimodal_enabled?: boolean;
95
- graphEnabled?: boolean;
96
- graph_enabled?: boolean;
97
- embeddingModel?: string;
98
- embedding_model?: string;
99
- embeddingDim?: number;
100
- embedding_dim?: number;
101
- chunkingStrategy?: Record<string, unknown>;
102
- chunking_strategy?: Record<string, unknown>;
103
- processingProfile?: Record<string, unknown>;
104
- processing_profile?: Record<string, unknown>;
105
- }
106
-
107
- export interface AddDocumentsOptions {
108
- datasetId?: string;
109
- dataset_id?: string;
110
- datasetName?: string;
111
- dataset_name?: string;
112
- chunkConfig?: KnowledgeChunkConfig | ChunkConfig | Record<string, unknown>;
113
- chunk_config?: KnowledgeChunkConfig | ChunkConfig | Record<string, unknown>;
114
- formatType?: number;
115
- format_type?: number;
116
- batchId?: string;
117
- batch_id?: string;
118
- batchName?: string;
119
- batch_name?: string;
120
- processingProfile?: Record<string, unknown>;
121
- processing_profile?: Record<string, unknown>;
122
- chunkingStrategy?: Record<string, unknown>;
123
- chunking_strategy?: Record<string, unknown>;
124
- name?: string;
125
- }
126
-
127
- export interface SearchKnowledgeOptions {
128
- datasetId?: string;
129
- dataset_id?: string;
130
- datasetIds?: string[];
131
- dataset_ids?: string[];
132
- datasetName?: string;
133
- dataset_name?: string;
134
- datasetNames?: string[];
135
- dataset_names?: string[];
136
- topK?: number;
137
- top_k?: number;
138
- minScore?: number;
139
- min_score?: number;
140
- candidateTopK?: number;
141
- candidate_top_k?: number;
142
- searchMethod?: string;
143
- search_method?: string;
144
- enableRerank?: boolean;
145
- enable_rerank?: boolean;
146
- needCitation?: boolean;
147
- need_citation?: boolean;
148
- needTrace?: boolean;
149
- need_trace?: boolean;
150
- }
151
-
152
- export interface KnowledgeDocumentInfo {
153
- id?: string;
154
- sourceId?: string;
155
- name?: string;
156
- contentType?: string;
157
- fileSize?: number;
158
- status?: string;
159
- errorMessage?: string;
160
- chunkCount?: number;
161
- createdAt?: string;
162
- [key: string]: unknown;
163
- }
164
-
165
- export interface KnowledgeSearchResult {
166
- segment_infos?: Array<{
167
- content?: string;
168
- score?: number;
169
- metadata?: Record<string, unknown>;
170
- segment_id?: string;
171
- dataset_id?: string;
172
- document_id?: string;
173
- document_name?: string;
174
- [key: string]: unknown;
175
- }>;
176
- citations?: unknown[];
177
- request_id?: string;
178
- dataset_ids?: string[];
179
- route_trace?: Record<string, unknown>;
180
- [key: string]: unknown;
181
- }
182
-
183
- export function runtime(): Promise<Record<string, unknown>>;
184
- export function modelCatalog(): Promise<Record<string, unknown>>;
185
- export function listDatasets(options?: ListDatasetsOptions): Promise<{ total_count?: number; dataset_list?: KnowledgeDataset[]; [key: string]: unknown }>;
186
- export function getDataset(datasetId: string): Promise<KnowledgeDataset>;
187
- export function createDataset(name: string, options?: CreateDatasetOptions): Promise<KnowledgeDataset>;
188
- export function deleteDataset(datasetId: string): Promise<void>;
189
- export function findDatasetByName(name: string): Promise<KnowledgeDataset | null>;
190
- export function ensureDataset(name: string, options?: CreateDatasetOptions): Promise<KnowledgeDataset>;
191
- export function addDocuments(documents: KnowledgeDocumentOptions[], options?: AddDocumentsOptions): Promise<{ document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
192
- export function addText(content: string, options?: AddDocumentsOptions): Promise<{ document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
193
- export function addUrl(url: string, options?: AddDocumentsOptions): Promise<{ document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
194
- export function listDocuments(datasetId: string, options?: { page?: number; size?: number }): Promise<{ total?: number; document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
195
- export function deleteDocuments(datasetId: string, documentIds: string[]): Promise<void>;
196
- export function search(query: string, options?: SearchKnowledgeOptions): Promise<KnowledgeSearchResult>;
197
-
198
- export const knowledge: {
199
- DataSourceType: typeof DataSourceType;
200
- ChunkConfig: typeof ChunkConfig;
201
- KnowledgeDocument: typeof KnowledgeDocument;
202
- runtime: typeof runtime;
203
- modelCatalog: typeof modelCatalog;
204
- listDatasets: typeof listDatasets;
205
- getDataset: typeof getDataset;
206
- createDataset: typeof createDataset;
207
- deleteDataset: typeof deleteDataset;
208
- findDatasetByName: typeof findDatasetByName;
209
- ensureDataset: typeof ensureDataset;
210
- addDocuments: typeof addDocuments;
211
- addText: typeof addText;
212
- addUrl: typeof addUrl;
213
- listDocuments: typeof listDocuments;
214
- deleteDocuments: typeof deleteDocuments;
215
- search: typeof search;
216
- };
217
-
218
- export interface DatabaseFilter {
7
+ export class ConfigurationError extends PlatformSdkError {}
8
+ export class ApiError extends PlatformSdkError {}
9
+
10
+ export const DataSourceType: {
11
+ TEXT: 0;
12
+ URL: 1;
13
+ URI: 2;
14
+ };
15
+
16
+ export type KnowledgeDataSourceType = 0 | 1 | 2 | 'text' | 'url' | 'uri' | 'raw' | 'content' | 'web' | 'file' | 'source_file_id';
17
+
18
+ export interface KnowledgeChunkConfig {
19
+ separator?: string;
20
+ maxTokens?: number;
21
+ max_tokens?: number;
22
+ removeExtraSpaces?: boolean;
23
+ remove_extra_spaces?: boolean;
24
+ removeUrlsEmails?: boolean;
25
+ remove_urls_emails?: boolean;
26
+ }
27
+
28
+ export class ChunkConfig {
29
+ separator: string;
30
+ max_tokens: number;
31
+ remove_extra_spaces: boolean;
32
+ remove_urls_emails: boolean;
33
+ constructor(options?: KnowledgeChunkConfig);
34
+ }
35
+
36
+ export interface KnowledgeDocumentOptions {
37
+ source?: KnowledgeDataSourceType;
38
+ source_type?: KnowledgeDataSourceType;
39
+ raw_data?: string;
40
+ content?: string;
41
+ text?: string;
42
+ url?: string;
43
+ web_url?: string;
44
+ uri?: string;
45
+ source_file_id?: string;
46
+ name?: string;
47
+ file_type?: string;
48
+ update_rule?: Record<string, unknown>;
49
+ }
50
+
51
+ export class KnowledgeDocument {
52
+ constructor(options?: KnowledgeDocumentOptions);
53
+ }
54
+
55
+ export interface KnowledgeDataset {
56
+ name?: string;
57
+ description?: string;
58
+ status?: number;
59
+ dataset_id?: string;
60
+ space_id?: string;
61
+ doc_count?: number;
62
+ slice_count?: number;
63
+ search_method?: string;
64
+ supported_search_methods?: string[];
65
+ [key: string]: unknown;
66
+ }
67
+
68
+ export interface ListDatasetsOptions {
69
+ name?: string;
70
+ spaceId?: string;
71
+ space_id?: string;
72
+ formatType?: number;
73
+ format_type?: number;
74
+ pageSize?: number;
75
+ page_size?: number;
76
+ pageNum?: number;
77
+ page_num?: number;
78
+ }
79
+
80
+ export interface CreateDatasetOptions {
81
+ description?: string;
82
+ spaceId?: string;
83
+ space_id?: string;
84
+ config?: Record<string, unknown>;
85
+ formatType?: number;
86
+ format_type?: number;
87
+ sourceType?: string;
88
+ source_type?: string;
89
+ engineType?: string;
90
+ engine_type?: string;
91
+ accessScope?: string;
92
+ access_scope?: string;
93
+ multimodalEnabled?: boolean;
94
+ multimodal_enabled?: boolean;
95
+ graphEnabled?: boolean;
96
+ graph_enabled?: boolean;
97
+ embeddingModel?: string;
98
+ embedding_model?: string;
99
+ embeddingDim?: number;
100
+ embedding_dim?: number;
101
+ chunkingStrategy?: Record<string, unknown>;
102
+ chunking_strategy?: Record<string, unknown>;
103
+ processingProfile?: Record<string, unknown>;
104
+ processing_profile?: Record<string, unknown>;
105
+ }
106
+
107
+ export interface AddDocumentsOptions {
108
+ datasetId?: string;
109
+ dataset_id?: string;
110
+ datasetName?: string;
111
+ dataset_name?: string;
112
+ chunkConfig?: KnowledgeChunkConfig | ChunkConfig | Record<string, unknown>;
113
+ chunk_config?: KnowledgeChunkConfig | ChunkConfig | Record<string, unknown>;
114
+ formatType?: number;
115
+ format_type?: number;
116
+ batchId?: string;
117
+ batch_id?: string;
118
+ batchName?: string;
119
+ batch_name?: string;
120
+ processingProfile?: Record<string, unknown>;
121
+ processing_profile?: Record<string, unknown>;
122
+ chunkingStrategy?: Record<string, unknown>;
123
+ chunking_strategy?: Record<string, unknown>;
124
+ name?: string;
125
+ }
126
+
127
+ export interface SearchKnowledgeOptions {
128
+ datasetId?: string;
129
+ dataset_id?: string;
130
+ datasetIds?: string[];
131
+ dataset_ids?: string[];
132
+ datasetName?: string;
133
+ dataset_name?: string;
134
+ datasetNames?: string[];
135
+ dataset_names?: string[];
136
+ topK?: number;
137
+ top_k?: number;
138
+ minScore?: number;
139
+ min_score?: number;
140
+ candidateTopK?: number;
141
+ candidate_top_k?: number;
142
+ searchMethod?: string;
143
+ search_method?: string;
144
+ enableRerank?: boolean;
145
+ enable_rerank?: boolean;
146
+ needCitation?: boolean;
147
+ need_citation?: boolean;
148
+ needTrace?: boolean;
149
+ need_trace?: boolean;
150
+ }
151
+
152
+ export interface KnowledgeDocumentInfo {
153
+ id?: string;
154
+ sourceId?: string;
155
+ name?: string;
156
+ contentType?: string;
157
+ fileSize?: number;
158
+ status?: string;
159
+ errorMessage?: string;
160
+ chunkCount?: number;
161
+ createdAt?: string;
162
+ [key: string]: unknown;
163
+ }
164
+
165
+ export interface KnowledgeSearchResult {
166
+ segment_infos?: Array<{
167
+ content?: string;
168
+ score?: number;
169
+ metadata?: Record<string, unknown>;
170
+ segment_id?: string;
171
+ dataset_id?: string;
172
+ document_id?: string;
173
+ document_name?: string;
174
+ [key: string]: unknown;
175
+ }>;
176
+ citations?: unknown[];
177
+ request_id?: string;
178
+ dataset_ids?: string[];
179
+ route_trace?: Record<string, unknown>;
180
+ [key: string]: unknown;
181
+ }
182
+
183
+ export function runtime(): Promise<Record<string, unknown>>;
184
+ export function modelCatalog(): Promise<Record<string, unknown>>;
185
+ export function listDatasets(options?: ListDatasetsOptions): Promise<{ total_count?: number; dataset_list?: KnowledgeDataset[]; [key: string]: unknown }>;
186
+ export function getDataset(datasetId: string): Promise<KnowledgeDataset>;
187
+ export function createDataset(name: string, options?: CreateDatasetOptions): Promise<KnowledgeDataset>;
188
+ export function deleteDataset(datasetId: string): Promise<void>;
189
+ export function findDatasetByName(name: string): Promise<KnowledgeDataset | null>;
190
+ export function ensureDataset(name: string, options?: CreateDatasetOptions): Promise<KnowledgeDataset>;
191
+ export function addDocuments(documents: KnowledgeDocumentOptions[], options?: AddDocumentsOptions): Promise<{ document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
192
+ export function addText(content: string, options?: AddDocumentsOptions): Promise<{ document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
193
+ export function addUrl(url: string, options?: AddDocumentsOptions): Promise<{ document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
194
+ export function listDocuments(datasetId: string, options?: { page?: number; size?: number }): Promise<{ total?: number; document_infos?: KnowledgeDocumentInfo[]; [key: string]: unknown }>;
195
+ export function deleteDocuments(datasetId: string, documentIds: string[]): Promise<void>;
196
+ export function search(query: string, options?: SearchKnowledgeOptions): Promise<KnowledgeSearchResult>;
197
+
198
+ export const knowledge: {
199
+ DataSourceType: typeof DataSourceType;
200
+ ChunkConfig: typeof ChunkConfig;
201
+ KnowledgeDocument: typeof KnowledgeDocument;
202
+ runtime: typeof runtime;
203
+ modelCatalog: typeof modelCatalog;
204
+ listDatasets: typeof listDatasets;
205
+ getDataset: typeof getDataset;
206
+ createDataset: typeof createDataset;
207
+ deleteDataset: typeof deleteDataset;
208
+ findDatasetByName: typeof findDatasetByName;
209
+ ensureDataset: typeof ensureDataset;
210
+ addDocuments: typeof addDocuments;
211
+ addText: typeof addText;
212
+ addUrl: typeof addUrl;
213
+ listDocuments: typeof listDocuments;
214
+ deleteDocuments: typeof deleteDocuments;
215
+ search: typeof search;
216
+ };
217
+
218
+ export interface DatabaseFilter {
219
219
  field: string;
220
220
  op: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'not_in' | 'is_null' | 'is_not_null' | 'like' | 'ilike' | string;
221
221
  value?: unknown;
@@ -342,10 +342,10 @@ export function generateOrm(schemaPayload: DatabaseSchema, options: GenerateOrmO
342
342
  export function exportOrm(options: GenerateOrmOptions): Promise<string>;
343
343
  export function table(name: string): TableQuery;
344
344
 
345
- export const database: {
346
- query: typeof query;
347
- single: typeof single;
348
- maybeSingle: typeof maybeSingle;
345
+ export const database: {
346
+ query: typeof query;
347
+ single: typeof single;
348
+ maybeSingle: typeof maybeSingle;
349
349
  aggregate: typeof aggregate;
350
350
  insert: typeof insert;
351
351
  updateRows: typeof updateRows;
@@ -356,85 +356,85 @@ export const database: {
356
356
  getSchema: typeof getSchema;
357
357
  defaultOrm: typeof defaultOrm;
358
358
  generateOrm: typeof generateOrm;
359
- exportOrm: typeof exportOrm;
360
- table: typeof table;
361
- };
362
-
363
- export interface StudioDatabaseColumn {
364
- originalName?: string;
365
- name?: string;
366
- type?: string;
367
- defaultValue?: string | null;
368
- primaryKey?: boolean;
369
- nullable?: boolean;
370
- unique?: boolean;
371
- array?: boolean;
372
- checkExpression?: string;
373
- [key: string]: unknown;
374
- }
375
-
376
- export interface StudioDatabaseTableOptions {
377
- envScope?: 'dev' | 'prod' | string;
378
- schema?: string;
379
- description?: string;
380
- columns?: StudioDatabaseColumn[];
381
- }
382
-
383
- export interface StudioDatabaseRowOptions {
384
- envScope?: 'dev' | 'prod' | string;
385
- schema?: string;
386
- rowId?: string;
387
- rowIndex?: number;
388
- rowIds?: string[];
389
- rowIndexes?: number[];
390
- }
391
-
392
- export interface StudioDatabaseSyncOptions {
393
- sourceScope?: 'dev' | 'prod' | string;
394
- targetScope?: 'dev' | 'prod' | string;
395
- tables?: string[];
396
- sourceProjectId?: string;
397
- targetProjectId?: string;
398
- }
399
-
400
- export interface StudioDatabaseControlOptions {
401
- environment?: 'dev' | 'prod' | string;
402
- }
403
-
404
- export const studioDatabase: {
405
- getDatabase(options?: { envScope?: string }): Promise<Record<string, unknown>>;
406
- createDefaultDatabase(options?: { envScope?: string }): Promise<Record<string, unknown>>;
407
- deleteDatabase(options?: { envScope?: string }): Promise<void>;
408
- listTables(options?: { envScope?: string; keyword?: string }): Promise<Record<string, unknown>[]>;
409
- createTable(tableName: string, options?: StudioDatabaseTableOptions): Promise<Record<string, unknown>>;
410
- updateTable(tableName: string, options?: StudioDatabaseTableOptions & { newTableName?: string }): Promise<Record<string, unknown>>;
411
- deleteTable(tableName: string, options?: Pick<StudioDatabaseTableOptions, 'envScope' | 'schema'>): Promise<void>;
412
- addColumn(tableName: string, options: StudioDatabaseTableOptions & { name: string; type: string; defaultValue?: string | null; array?: boolean; primaryKey?: boolean; nullable?: boolean; unique?: boolean; checkExpression?: string }): Promise<Record<string, unknown>>;
413
- getTableData(tableName: string, options?: Pick<StudioDatabaseTableOptions, 'envScope' | 'schema'>): Promise<Record<string, unknown>>;
414
- insertRow(tableName: string, values: Record<string, unknown>, options?: Pick<StudioDatabaseTableOptions, 'envScope' | 'schema'>): Promise<Record<string, unknown>>;
415
- updateRow(tableName: string, values: Record<string, unknown>, options?: StudioDatabaseRowOptions): Promise<Record<string, unknown>>;
416
- deleteRows(tableName: string, options?: StudioDatabaseRowOptions): Promise<Record<string, unknown>>;
417
- executeSql(sqlText: string, options?: { envScope?: string }): Promise<Record<string, unknown>>;
418
- sqlHistory(options?: { envScope?: string }): Promise<Record<string, unknown>[]>;
419
- exportBackup(options?: { envScope?: string }): Promise<Record<string, unknown>>;
420
- importBackup(backup: Record<string, unknown>, options?: { envScope?: string }): Promise<Record<string, unknown>>;
421
- sync(options?: StudioDatabaseSyncOptions): Promise<Record<string, unknown>>;
422
- syncProject(sourceProjectId: string, targetProjectId: string, options?: StudioDatabaseSyncOptions): Promise<Record<string, unknown>>;
423
- ensureDatabase(options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
424
- getSchema(options?: StudioDatabaseControlOptions): Promise<DatabaseSchema>;
425
- getConfig(options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
426
- controlSql(sqlText: string, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
427
- explainSql(sqlText: string, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
428
- validateSchema(schema: DatabaseSchema, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
429
- diffSchema(schema: DatabaseSchema, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
430
- listMigrations(options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>[]>;
431
- createMigration(options: StudioDatabaseControlOptions & { title: string; statements?: string[]; schema?: DatabaseSchema; dryRun?: boolean }): Promise<Record<string, unknown>>;
432
- getMigration(migrationId: string): Promise<Record<string, unknown>>;
433
- };
434
-
435
- export interface StorageSummary {
436
- workspaceId?: string;
437
- projectId?: string;
359
+ exportOrm: typeof exportOrm;
360
+ table: typeof table;
361
+ };
362
+
363
+ export interface StudioDatabaseColumn {
364
+ originalName?: string;
365
+ name?: string;
366
+ type?: string;
367
+ defaultValue?: string | null;
368
+ primaryKey?: boolean;
369
+ nullable?: boolean;
370
+ unique?: boolean;
371
+ array?: boolean;
372
+ checkExpression?: string;
373
+ [key: string]: unknown;
374
+ }
375
+
376
+ export interface StudioDatabaseTableOptions {
377
+ envScope?: 'dev' | 'prod' | string;
378
+ schema?: string;
379
+ description?: string;
380
+ columns?: StudioDatabaseColumn[];
381
+ }
382
+
383
+ export interface StudioDatabaseRowOptions {
384
+ envScope?: 'dev' | 'prod' | string;
385
+ schema?: string;
386
+ rowId?: string;
387
+ rowIndex?: number;
388
+ rowIds?: string[];
389
+ rowIndexes?: number[];
390
+ }
391
+
392
+ export interface StudioDatabaseSyncOptions {
393
+ sourceScope?: 'dev' | 'prod' | string;
394
+ targetScope?: 'dev' | 'prod' | string;
395
+ tables?: string[];
396
+ sourceProjectId?: string;
397
+ targetProjectId?: string;
398
+ }
399
+
400
+ export interface StudioDatabaseControlOptions {
401
+ environment?: 'dev' | 'prod' | string;
402
+ }
403
+
404
+ export const studioDatabase: {
405
+ getDatabase(options?: { envScope?: string }): Promise<Record<string, unknown>>;
406
+ createDefaultDatabase(options?: { envScope?: string }): Promise<Record<string, unknown>>;
407
+ deleteDatabase(options?: { envScope?: string }): Promise<void>;
408
+ listTables(options?: { envScope?: string; keyword?: string }): Promise<Record<string, unknown>[]>;
409
+ createTable(tableName: string, options?: StudioDatabaseTableOptions): Promise<Record<string, unknown>>;
410
+ updateTable(tableName: string, options?: StudioDatabaseTableOptions & { newTableName?: string }): Promise<Record<string, unknown>>;
411
+ deleteTable(tableName: string, options?: Pick<StudioDatabaseTableOptions, 'envScope' | 'schema'>): Promise<void>;
412
+ addColumn(tableName: string, options: StudioDatabaseTableOptions & { name: string; type: string; defaultValue?: string | null; array?: boolean; primaryKey?: boolean; nullable?: boolean; unique?: boolean; checkExpression?: string }): Promise<Record<string, unknown>>;
413
+ getTableData(tableName: string, options?: Pick<StudioDatabaseTableOptions, 'envScope' | 'schema'>): Promise<Record<string, unknown>>;
414
+ insertRow(tableName: string, values: Record<string, unknown>, options?: Pick<StudioDatabaseTableOptions, 'envScope' | 'schema'>): Promise<Record<string, unknown>>;
415
+ updateRow(tableName: string, values: Record<string, unknown>, options?: StudioDatabaseRowOptions): Promise<Record<string, unknown>>;
416
+ deleteRows(tableName: string, options?: StudioDatabaseRowOptions): Promise<Record<string, unknown>>;
417
+ executeSql(sqlText: string, options?: { envScope?: string }): Promise<Record<string, unknown>>;
418
+ sqlHistory(options?: { envScope?: string }): Promise<Record<string, unknown>[]>;
419
+ exportBackup(options?: { envScope?: string }): Promise<Record<string, unknown>>;
420
+ importBackup(backup: Record<string, unknown>, options?: { envScope?: string }): Promise<Record<string, unknown>>;
421
+ sync(options?: StudioDatabaseSyncOptions): Promise<Record<string, unknown>>;
422
+ syncProject(sourceProjectId: string, targetProjectId: string, options?: StudioDatabaseSyncOptions): Promise<Record<string, unknown>>;
423
+ ensureDatabase(options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
424
+ getSchema(options?: StudioDatabaseControlOptions): Promise<DatabaseSchema>;
425
+ getConfig(options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
426
+ controlSql(sqlText: string, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
427
+ explainSql(sqlText: string, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
428
+ validateSchema(schema: DatabaseSchema, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
429
+ diffSchema(schema: DatabaseSchema, options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>>;
430
+ listMigrations(options?: StudioDatabaseControlOptions): Promise<Record<string, unknown>[]>;
431
+ createMigration(options: StudioDatabaseControlOptions & { title: string; statements?: string[]; schema?: DatabaseSchema; dryRun?: boolean }): Promise<Record<string, unknown>>;
432
+ getMigration(migrationId: string): Promise<Record<string, unknown>>;
433
+ };
434
+
435
+ export interface StorageSummary {
436
+ workspaceId?: string;
437
+ projectId?: string;
438
438
  scope?: string;
439
439
  bucketName?: string;
440
440
  usedSizeBytes?: number;
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
1
  {
2
2
  "name": "@kmlckj/licos-platform-sdk",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "LICOS platform SDK package shell for browser and Node runtimes",
5
- "author": "kmlckj",
6
- "type": "module",
7
- "main": "./dist/index.js",
8
- "browser": "./dist/browser.js",
9
- "types": "./dist/index.d.ts",
10
- "typesVersions": {
11
- "*": {
12
- "browser": [
13
- "dist/browser.d.ts"
14
- ]
15
- }
16
- },
17
- "exports": {
18
- ".": {
19
- "browser": {
20
- "types": "./dist/browser.d.ts",
21
- "default": "./dist/browser.js"
22
- },
23
- "types": "./dist/index.d.ts",
24
- "import": "./dist/index.js",
25
- "default": "./dist/index.js"
26
- },
27
- "./browser": {
28
- "types": "./dist/browser.d.ts",
29
- "import": "./dist/browser.js",
30
- "default": "./dist/browser.js"
31
- }
32
- },
33
- "files": [
34
- "dist",
35
- "README.md"
36
- ],
37
- "scripts": {
38
- "build": "node build.mjs",
39
- "prepack": "npm run build",
40
- "test": "node --test"
41
- },
42
- "devDependencies": {
43
- "terser": "5.48.0"
44
- },
45
- "license": "MIT",
5
+ "author": "kmlckj",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "browser": "./dist/browser.js",
9
+ "types": "./dist/index.d.ts",
10
+ "typesVersions": {
11
+ "*": {
12
+ "browser": [
13
+ "dist/browser.d.ts"
14
+ ]
15
+ }
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "browser": {
20
+ "types": "./dist/browser.d.ts",
21
+ "default": "./dist/browser.js"
22
+ },
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./browser": {
28
+ "types": "./dist/browser.d.ts",
29
+ "import": "./dist/browser.js",
30
+ "default": "./dist/browser.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md"
36
+ ],
37
+ "scripts": {
38
+ "build": "node build.mjs",
39
+ "prepack": "npm run build",
40
+ "test": "node --test"
41
+ },
42
+ "devDependencies": {
43
+ "terser": "5.48.0"
44
+ },
45
+ "license": "MIT",
46
46
  "publishConfig": {
47
47
  "access": "public",
48
48
  "registry": "https://registry.npmjs.org"