lemma-sdk 0.2.28 → 0.2.31
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/README.md +241 -201
- package/bin/lemma-sdk.js +108 -0
- package/dist/browser/lemma-client.js +125 -4
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/datastore-query.d.ts +54 -0
- package/dist/datastore-query.js +157 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3 -0
- package/dist/namespaces/datastore.d.ts +9 -0
- package/dist/namespaces/datastore.js +13 -0
- package/dist/namespaces/records.d.ts +1 -1
- package/dist/openapi_client/index.d.ts +4 -0
- package/dist/openapi_client/index.js +1 -0
- package/dist/openapi_client/models/ConvertedArtifactResponse.d.ts +6 -0
- package/dist/openapi_client/models/ConvertedFileResponse.d.ts +10 -0
- package/dist/openapi_client/models/ConvertedFileResponse.js +1 -0
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +3 -1
- package/dist/openapi_client/models/FlowRunEntity.d.ts +1 -0
- package/dist/openapi_client/models/ScheduledFlowStart.d.ts +3 -6
- package/dist/openapi_client/models/ScheduledFlowStartType.d.ts +4 -0
- package/dist/openapi_client/models/ScheduledFlowStartType.js +9 -0
- package/dist/openapi_client/models/WorkflowInstallRequest.d.ts +5 -0
- package/dist/openapi_client/models/WorkflowTimeInstallConfig.d.ts +19 -0
- package/dist/openapi_client/models/WorkflowTimeInstallConfig.js +1 -0
- package/dist/openapi_client/services/FilesService.d.ts +27 -1
- package/dist/openapi_client/services/FilesService.js +69 -1
- package/dist/openapi_client/services/WorkflowsService.d.ts +1 -1
- package/dist/openapi_client/services/WorkflowsService.js +1 -1
- package/dist/react/assistant-output.d.ts +6 -0
- package/dist/react/assistant-output.js +90 -0
- package/dist/react/index.d.ts +62 -8
- package/dist/react/index.js +31 -4
- package/dist/react/useAgentInputSchema.d.ts +19 -0
- package/dist/react/useAgentInputSchema.js +73 -0
- package/dist/react/useAgentRun.d.ts +17 -0
- package/dist/react/useAgentRun.js +56 -0
- package/dist/react/useAgentRuns.d.ts +33 -0
- package/dist/react/useAgentRuns.js +149 -0
- package/dist/react/useAssistantRun.d.ts +9 -0
- package/dist/react/useAssistantRun.js +28 -17
- package/dist/react/useAssistantSession.d.ts +5 -0
- package/dist/react/useAssistantSession.js +135 -86
- package/dist/react/useBulkRecords.d.ts +20 -0
- package/dist/react/useBulkRecords.js +65 -0
- package/dist/react/useConversation.d.ts +18 -0
- package/dist/react/useConversation.js +75 -0
- package/dist/react/useConversationMessages.d.ts +59 -0
- package/dist/react/useConversationMessages.js +167 -0
- package/dist/react/useConversations.d.ts +52 -0
- package/dist/react/useConversations.js +228 -0
- package/dist/react/useCreateRecord.d.ts +18 -0
- package/dist/react/useCreateRecord.js +51 -0
- package/dist/react/useCurrentUser.d.ts +14 -0
- package/dist/react/useCurrentUser.js +68 -0
- package/dist/react/useDeleteRecord.d.ts +21 -0
- package/dist/react/useDeleteRecord.js +52 -0
- package/dist/react/useFlowRunHistory.js +1 -5
- package/dist/react/useFlowSession.js +41 -33
- package/dist/react/useForeignKeyOptions.d.ts +31 -0
- package/dist/react/useForeignKeyOptions.js +161 -0
- package/dist/react/useFunctionRun.d.ts +19 -0
- package/dist/react/useFunctionRun.js +30 -0
- package/dist/react/useFunctionRuns.d.ts +33 -0
- package/dist/react/useFunctionRuns.js +149 -0
- package/dist/react/useFunctionSession.js +37 -29
- package/dist/react/useJoinedRecords.d.ts +18 -0
- package/dist/react/useJoinedRecords.js +80 -0
- package/dist/react/useMembers.d.ts +26 -0
- package/dist/react/useMembers.js +98 -0
- package/dist/react/useOrganizationMembers.d.ts +26 -0
- package/dist/react/useOrganizationMembers.js +113 -0
- package/dist/react/usePodAccess.d.ts +22 -0
- package/dist/react/usePodAccess.js +128 -0
- package/dist/react/useRecord.d.ts +18 -0
- package/dist/react/useRecord.js +75 -0
- package/dist/react/useRecordForm.d.ts +42 -0
- package/dist/react/useRecordForm.js +221 -0
- package/dist/react/useRecordSchema.d.ts +20 -0
- package/dist/react/useRecordSchema.js +24 -0
- package/dist/react/useRecords.d.ts +20 -0
- package/dist/react/useRecords.js +146 -0
- package/dist/react/useRelatedRecords.d.ts +43 -0
- package/dist/react/useRelatedRecords.js +239 -0
- package/dist/react/useReverseRelatedRecords.d.ts +47 -0
- package/dist/react/useReverseRelatedRecords.js +235 -0
- package/dist/react/useSchemaForm.d.ts +24 -0
- package/dist/react/useSchemaForm.js +104 -0
- package/dist/react/useTable.d.ts +16 -0
- package/dist/react/useTable.js +70 -0
- package/dist/react/useTables.d.ts +26 -0
- package/dist/react/useTables.js +113 -0
- package/dist/react/useTaskSession.js +11 -22
- package/dist/react/useUpdateRecord.d.ts +21 -0
- package/dist/react/useUpdateRecord.js +55 -0
- package/dist/react/useWorkflowResume.d.ts +18 -0
- package/dist/react/useWorkflowResume.js +45 -0
- package/dist/react/useWorkflowRun.d.ts +21 -0
- package/dist/react/useWorkflowRun.js +49 -0
- package/dist/react/useWorkflowRuns.d.ts +33 -0
- package/dist/react/useWorkflowRuns.js +149 -0
- package/dist/react/useWorkflowStart.d.ts +33 -0
- package/dist/react/useWorkflowStart.js +148 -0
- package/dist/react/utils.d.ts +5 -0
- package/dist/react/utils.js +25 -0
- package/dist/record-form.d.ts +30 -0
- package/dist/record-form.js +199 -0
- package/dist/schema-form.d.ts +41 -0
- package/dist/schema-form.js +200 -0
- package/dist/types.d.ts +6 -1
- package/package.json +11 -8
- package/dist/react/components/AssistantChrome.d.ts +0 -86
- package/dist/react/components/AssistantChrome.js +0 -48
- package/dist/react/components/AssistantEmbedded.d.ts +0 -10
- package/dist/react/components/AssistantEmbedded.js +0 -15
- package/dist/react/components/AssistantExperience.d.ts +0 -96
- package/dist/react/components/AssistantExperience.js +0 -1294
- package/dist/react/components/assistant-types.d.ts +0 -80
- package/dist/react/styles.css +0 -2407
- /package/dist/{react/components/assistant-types.js → openapi_client/models/ConvertedArtifactResponse.js} +0 -0
|
@@ -55,6 +55,7 @@ const tables_js_1 = require("./namespaces/tables.js");
|
|
|
55
55
|
const tasks_js_1 = require("./namespaces/tasks.js");
|
|
56
56
|
const users_js_1 = require("./namespaces/users.js");
|
|
57
57
|
const workflows_js_1 = require("./namespaces/workflows.js");
|
|
58
|
+
const datastore_js_1 = require("./namespaces/datastore.js");
|
|
58
59
|
class LemmaClient {
|
|
59
60
|
constructor(overrides = {}, internalOptions = {}) {
|
|
60
61
|
this._config = (0, config_js_1.resolveConfig)(overrides);
|
|
@@ -81,6 +82,7 @@ class LemmaClient {
|
|
|
81
82
|
this.desks = new desks_js_1.DesksNamespace(this._generated, this._http, podIdFn);
|
|
82
83
|
this.integrations = new integrations_js_1.IntegrationsNamespace(this._generated);
|
|
83
84
|
this.resources = new resources_js_1.ResourcesNamespace(this._http);
|
|
85
|
+
this.datastore = new datastore_js_1.DatastoreNamespace(this._generated, podIdFn);
|
|
84
86
|
this.users = new users_js_1.UsersNamespace(this._generated);
|
|
85
87
|
this.icons = new icons_js_1.IconsNamespace(this._generated);
|
|
86
88
|
this.pods = new pods_js_1.PodsNamespace(this._generated, this._http);
|
|
@@ -164,11 +166,11 @@ function resolveConfig(overrides = {}) {
|
|
|
164
166
|
const apiUrl = overrides.apiUrl ??
|
|
165
167
|
win.apiUrl ??
|
|
166
168
|
fromEnv("API_URL") ??
|
|
167
|
-
"
|
|
169
|
+
"https://api.asur.work";
|
|
168
170
|
const authUrl = overrides.authUrl ??
|
|
169
171
|
win.authUrl ??
|
|
170
172
|
fromEnv("AUTH_URL") ??
|
|
171
|
-
"
|
|
173
|
+
"https://auth.asur.work";
|
|
172
174
|
const podId = overrides.podId ??
|
|
173
175
|
win.podId ??
|
|
174
176
|
fromEnv("POD_ID");
|
|
@@ -2125,7 +2127,7 @@ class FilesService {
|
|
|
2125
2127
|
});
|
|
2126
2128
|
}
|
|
2127
2129
|
/**
|
|
2128
|
-
* Delete File Or Folder
|
|
2130
|
+
* Delete File Or Folder
|
|
2129
2131
|
* @param podId
|
|
2130
2132
|
* @param path
|
|
2131
2133
|
* @returns DatastoreMessageResponse Successful Response
|
|
@@ -2189,6 +2191,74 @@ class FilesService {
|
|
|
2189
2191
|
},
|
|
2190
2192
|
});
|
|
2191
2193
|
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Get Converted File Metadata
|
|
2196
|
+
* @param podId
|
|
2197
|
+
* @param path
|
|
2198
|
+
* @returns ConvertedFileResponse Successful Response
|
|
2199
|
+
* @throws ApiError
|
|
2200
|
+
*/
|
|
2201
|
+
static fileConvertedGet(podId, path) {
|
|
2202
|
+
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2203
|
+
method: 'GET',
|
|
2204
|
+
url: '/pods/{pod_id}/datastore/files/converted/by-path',
|
|
2205
|
+
path: {
|
|
2206
|
+
'pod_id': podId,
|
|
2207
|
+
},
|
|
2208
|
+
query: {
|
|
2209
|
+
'path': path,
|
|
2210
|
+
},
|
|
2211
|
+
errors: {
|
|
2212
|
+
422: `Validation Error`,
|
|
2213
|
+
},
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Download Converted File Artifact
|
|
2218
|
+
* @param podId
|
|
2219
|
+
* @param path
|
|
2220
|
+
* @param artifact
|
|
2221
|
+
* @returns any Successful Response
|
|
2222
|
+
* @throws ApiError
|
|
2223
|
+
*/
|
|
2224
|
+
static fileConvertedDownload(podId, path, artifact = 'document.md') {
|
|
2225
|
+
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2226
|
+
method: 'GET',
|
|
2227
|
+
url: '/pods/{pod_id}/datastore/files/converted/download',
|
|
2228
|
+
path: {
|
|
2229
|
+
'pod_id': podId,
|
|
2230
|
+
},
|
|
2231
|
+
query: {
|
|
2232
|
+
'path': path,
|
|
2233
|
+
'artifact': artifact,
|
|
2234
|
+
},
|
|
2235
|
+
errors: {
|
|
2236
|
+
422: `Validation Error`,
|
|
2237
|
+
},
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
/**
|
|
2241
|
+
* Render Converted File As HTML
|
|
2242
|
+
* @param podId
|
|
2243
|
+
* @param path
|
|
2244
|
+
* @returns any Successful Response
|
|
2245
|
+
* @throws ApiError
|
|
2246
|
+
*/
|
|
2247
|
+
static fileConvertedRender(podId, path) {
|
|
2248
|
+
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2249
|
+
method: 'GET',
|
|
2250
|
+
url: '/pods/{pod_id}/datastore/files/converted/render',
|
|
2251
|
+
path: {
|
|
2252
|
+
'pod_id': podId,
|
|
2253
|
+
},
|
|
2254
|
+
query: {
|
|
2255
|
+
'path': path,
|
|
2256
|
+
},
|
|
2257
|
+
errors: {
|
|
2258
|
+
422: `Validation Error`,
|
|
2259
|
+
},
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2192
2262
|
/**
|
|
2193
2263
|
* Download File
|
|
2194
2264
|
* @param podId
|
|
@@ -4929,7 +4999,7 @@ class WorkflowsService {
|
|
|
4929
4999
|
}
|
|
4930
5000
|
/**
|
|
4931
5001
|
* Install Workflow
|
|
4932
|
-
* Install a workflow for runtime execution. Provide `account_id` when the workflow needs an integration account binding.
|
|
5002
|
+
* Install a workflow for runtime execution. Provide `account_id` when the workflow needs an integration account binding, and provide `schedule` when installing a scheduled workflow.
|
|
4933
5003
|
* @param podId
|
|
4934
5004
|
* @param workflowName
|
|
4935
5005
|
* @param requestBody
|
|
@@ -5022,6 +5092,57 @@ class WorkflowsService {
|
|
|
5022
5092
|
}
|
|
5023
5093
|
exports.WorkflowsService = WorkflowsService;
|
|
5024
5094
|
|
|
5095
|
+
},
|
|
5096
|
+
"./namespaces/datastore.js": function (module, exports, require) {
|
|
5097
|
+
"use strict";
|
|
5098
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5099
|
+
exports.DatastoreNamespace = void 0;
|
|
5100
|
+
const QueryService_js_1 = require("./openapi_client/services/QueryService.js");
|
|
5101
|
+
class DatastoreNamespace {
|
|
5102
|
+
constructor(client, podId) {
|
|
5103
|
+
this.client = client;
|
|
5104
|
+
this.podId = podId;
|
|
5105
|
+
}
|
|
5106
|
+
query(request) {
|
|
5107
|
+
const payload = typeof request === "string" ? { query: request } : request;
|
|
5108
|
+
return this.client.request(() => QueryService_js_1.QueryService.queryExecute(this.podId(), payload));
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
exports.DatastoreNamespace = DatastoreNamespace;
|
|
5112
|
+
|
|
5113
|
+
},
|
|
5114
|
+
"./openapi_client/services/QueryService.js": function (module, exports, require) {
|
|
5115
|
+
"use strict";
|
|
5116
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5117
|
+
exports.QueryService = void 0;
|
|
5118
|
+
const OpenAPI_js_1 = require("./openapi_client/core/OpenAPI.js");
|
|
5119
|
+
const request_js_1 = require("./openapi_client/core/request.js");
|
|
5120
|
+
class QueryService {
|
|
5121
|
+
/**
|
|
5122
|
+
* Execute Query
|
|
5123
|
+
* Execute a read-only SQL query inside the datastore schema. Joins, aggregates, subqueries, and cross-table reads are allowed as long as the statement is read only.
|
|
5124
|
+
* @param podId
|
|
5125
|
+
* @param requestBody
|
|
5126
|
+
* @returns DatastoreQueryResponse Successful Response
|
|
5127
|
+
* @throws ApiError
|
|
5128
|
+
*/
|
|
5129
|
+
static queryExecute(podId, requestBody) {
|
|
5130
|
+
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
5131
|
+
method: 'POST',
|
|
5132
|
+
url: '/pods/{pod_id}/datastore/query',
|
|
5133
|
+
path: {
|
|
5134
|
+
'pod_id': podId,
|
|
5135
|
+
},
|
|
5136
|
+
body: requestBody,
|
|
5137
|
+
mediaType: 'application/json',
|
|
5138
|
+
errors: {
|
|
5139
|
+
422: `Validation Error`,
|
|
5140
|
+
},
|
|
5141
|
+
});
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
5144
|
+
exports.QueryService = QueryService;
|
|
5145
|
+
|
|
5025
5146
|
}
|
|
5026
5147
|
};
|
|
5027
5148
|
|
package/dist/client.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { TablesNamespace } from "./namespaces/tables.js";
|
|
|
18
18
|
import { TasksNamespace } from "./namespaces/tasks.js";
|
|
19
19
|
import { UsersNamespace } from "./namespaces/users.js";
|
|
20
20
|
import { WorkflowsNamespace } from "./namespaces/workflows.js";
|
|
21
|
+
import { DatastoreNamespace } from "./namespaces/datastore.js";
|
|
21
22
|
export type { LemmaConfig };
|
|
22
23
|
export { AuthManager };
|
|
23
24
|
export type { AuthState, AuthListener };
|
|
@@ -44,6 +45,7 @@ export declare class LemmaClient {
|
|
|
44
45
|
readonly desks: DesksNamespace;
|
|
45
46
|
readonly integrations: IntegrationsNamespace;
|
|
46
47
|
readonly resources: ResourcesNamespace;
|
|
48
|
+
readonly datastore: DatastoreNamespace;
|
|
47
49
|
readonly users: UsersNamespace;
|
|
48
50
|
readonly icons: IconsNamespace;
|
|
49
51
|
readonly pods: PodsNamespace;
|
package/dist/client.js
CHANGED
|
@@ -20,6 +20,7 @@ import { TablesNamespace } from "./namespaces/tables.js";
|
|
|
20
20
|
import { TasksNamespace } from "./namespaces/tasks.js";
|
|
21
21
|
import { UsersNamespace } from "./namespaces/users.js";
|
|
22
22
|
import { WorkflowsNamespace } from "./namespaces/workflows.js";
|
|
23
|
+
import { DatastoreNamespace } from "./namespaces/datastore.js";
|
|
23
24
|
export { AuthManager };
|
|
24
25
|
export class LemmaClient {
|
|
25
26
|
_config;
|
|
@@ -42,6 +43,7 @@ export class LemmaClient {
|
|
|
42
43
|
desks;
|
|
43
44
|
integrations;
|
|
44
45
|
resources;
|
|
46
|
+
datastore;
|
|
45
47
|
users;
|
|
46
48
|
icons;
|
|
47
49
|
pods;
|
|
@@ -74,6 +76,7 @@ export class LemmaClient {
|
|
|
74
76
|
this.desks = new DesksNamespace(this._generated, this._http, podIdFn);
|
|
75
77
|
this.integrations = new IntegrationsNamespace(this._generated);
|
|
76
78
|
this.resources = new ResourcesNamespace(this._http);
|
|
79
|
+
this.datastore = new DatastoreNamespace(this._generated, podIdFn);
|
|
77
80
|
this.users = new UsersNamespace(this._generated);
|
|
78
81
|
this.icons = new IconsNamespace(this._generated);
|
|
79
82
|
this.pods = new PodsNamespace(this._generated, this._http);
|
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface LemmaConfig {
|
|
2
|
-
/** API base URL, e.g. https://api.
|
|
2
|
+
/** API base URL, e.g. https://api.asur.work */
|
|
3
3
|
apiUrl: string;
|
|
4
|
-
/** Auth service URL, e.g. https://auth.
|
|
4
|
+
/** Auth service URL, e.g. https://auth.asur.work */
|
|
5
5
|
authUrl: string;
|
|
6
6
|
/** Pod ID to scope all pod-level API calls */
|
|
7
7
|
podId?: string;
|
package/dist/config.js
CHANGED
|
@@ -37,11 +37,11 @@ export function resolveConfig(overrides = {}) {
|
|
|
37
37
|
const apiUrl = overrides.apiUrl ??
|
|
38
38
|
win.apiUrl ??
|
|
39
39
|
fromEnv("API_URL") ??
|
|
40
|
-
"
|
|
40
|
+
"https://api.asur.work";
|
|
41
41
|
const authUrl = overrides.authUrl ??
|
|
42
42
|
win.authUrl ??
|
|
43
43
|
fromEnv("AUTH_URL") ??
|
|
44
|
-
"
|
|
44
|
+
"https://auth.asur.work";
|
|
45
45
|
const podId = overrides.podId ??
|
|
46
46
|
win.podId ??
|
|
47
47
|
fromEnv("POD_ID");
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface ForeignKeyReference {
|
|
2
|
+
table: string;
|
|
3
|
+
column: string;
|
|
4
|
+
}
|
|
5
|
+
export interface JoinedRecordsSource {
|
|
6
|
+
table: string;
|
|
7
|
+
alias?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface JoinedRecordsColumnRef {
|
|
10
|
+
table?: string;
|
|
11
|
+
column: string;
|
|
12
|
+
}
|
|
13
|
+
export interface JoinedRecordsSelectField {
|
|
14
|
+
table?: string;
|
|
15
|
+
column?: string;
|
|
16
|
+
expression?: string;
|
|
17
|
+
as?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface JoinedRecordsJoinCondition {
|
|
20
|
+
left: string | JoinedRecordsColumnRef;
|
|
21
|
+
right: string | JoinedRecordsColumnRef;
|
|
22
|
+
operator?: "=" | "!=" | "<>" | ">" | ">=" | "<" | "<=";
|
|
23
|
+
}
|
|
24
|
+
export interface JoinedRecordsJoin {
|
|
25
|
+
type?: "inner" | "left" | "left outer" | "right" | "right outer" | "full" | "full outer";
|
|
26
|
+
table: string;
|
|
27
|
+
alias?: string;
|
|
28
|
+
on: string | JoinedRecordsJoinCondition;
|
|
29
|
+
}
|
|
30
|
+
export interface JoinedRecordsFilter {
|
|
31
|
+
field?: string | JoinedRecordsColumnRef;
|
|
32
|
+
expression?: string;
|
|
33
|
+
operator?: "=" | "!=" | "<>" | ">" | ">=" | "<" | "<=" | "LIKE" | "ILIKE" | "IN" | "NOT IN" | "IS" | "IS NOT";
|
|
34
|
+
value?: unknown;
|
|
35
|
+
values?: unknown[];
|
|
36
|
+
}
|
|
37
|
+
export interface JoinedRecordsOrderBy {
|
|
38
|
+
field?: string | JoinedRecordsColumnRef;
|
|
39
|
+
expression?: string;
|
|
40
|
+
direction?: "asc" | "desc";
|
|
41
|
+
nulls?: "first" | "last";
|
|
42
|
+
}
|
|
43
|
+
export interface JoinedRecordsQueryDefinition {
|
|
44
|
+
from: string | JoinedRecordsSource;
|
|
45
|
+
select?: Array<string | JoinedRecordsSelectField>;
|
|
46
|
+
joins?: JoinedRecordsJoin[];
|
|
47
|
+
filters?: JoinedRecordsFilter[];
|
|
48
|
+
orderBy?: Array<string | JoinedRecordsOrderBy>;
|
|
49
|
+
limit?: number;
|
|
50
|
+
offset?: number;
|
|
51
|
+
distinct?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function parseForeignKeyReference(references: string): ForeignKeyReference | null;
|
|
54
|
+
export declare function buildJoinedRecordsQuery(definition: JoinedRecordsQueryDefinition): string;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
function quoteIdentifierPart(value) {
|
|
2
|
+
return `"${value.replace(/"/g, "\"\"")}"`;
|
|
3
|
+
}
|
|
4
|
+
function quoteIdentifierPath(value) {
|
|
5
|
+
return value
|
|
6
|
+
.split(".")
|
|
7
|
+
.map((part) => (part === "*" ? part : quoteIdentifierPart(part)))
|
|
8
|
+
.join(".");
|
|
9
|
+
}
|
|
10
|
+
function isSimpleIdentifierPath(value) {
|
|
11
|
+
return /^[A-Za-z_][A-Za-z0-9_$]*(\.(\*|[A-Za-z_][A-Za-z0-9_$]*))*$/.test(value);
|
|
12
|
+
}
|
|
13
|
+
function renderIdentifierOrExpression(value) {
|
|
14
|
+
return isSimpleIdentifierPath(value) ? quoteIdentifierPath(value) : value;
|
|
15
|
+
}
|
|
16
|
+
function renderColumnRef(value) {
|
|
17
|
+
if (typeof value === "string") {
|
|
18
|
+
return renderIdentifierOrExpression(value);
|
|
19
|
+
}
|
|
20
|
+
const tablePrefix = value.table ? `${quoteIdentifierPart(value.table)}.` : "";
|
|
21
|
+
if (value.column === "*") {
|
|
22
|
+
return `${tablePrefix}*`;
|
|
23
|
+
}
|
|
24
|
+
return `${tablePrefix}${quoteIdentifierPart(value.column)}`;
|
|
25
|
+
}
|
|
26
|
+
function renderSource(source) {
|
|
27
|
+
if (typeof source === "string") {
|
|
28
|
+
return renderIdentifierOrExpression(source);
|
|
29
|
+
}
|
|
30
|
+
const renderedTable = quoteIdentifierPart(source.table);
|
|
31
|
+
if (!source.alias)
|
|
32
|
+
return renderedTable;
|
|
33
|
+
return `${renderedTable} AS ${quoteIdentifierPart(source.alias)}`;
|
|
34
|
+
}
|
|
35
|
+
function escapeSqlString(value) {
|
|
36
|
+
return value.replace(/'/g, "''");
|
|
37
|
+
}
|
|
38
|
+
function encodeSqlValue(value) {
|
|
39
|
+
if (value === null || typeof value === "undefined")
|
|
40
|
+
return "NULL";
|
|
41
|
+
if (typeof value === "boolean")
|
|
42
|
+
return value ? "TRUE" : "FALSE";
|
|
43
|
+
if (typeof value === "number") {
|
|
44
|
+
if (!Number.isFinite(value)) {
|
|
45
|
+
throw new Error("Joined record query values must be finite numbers.");
|
|
46
|
+
}
|
|
47
|
+
return String(value);
|
|
48
|
+
}
|
|
49
|
+
if (typeof value === "bigint")
|
|
50
|
+
return String(value);
|
|
51
|
+
if (value instanceof Date)
|
|
52
|
+
return `'${escapeSqlString(value.toISOString())}'`;
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
return `(${value.map((entry) => encodeSqlValue(entry)).join(", ")})`;
|
|
55
|
+
}
|
|
56
|
+
if (typeof value === "object") {
|
|
57
|
+
return `'${escapeSqlString(JSON.stringify(value))}'`;
|
|
58
|
+
}
|
|
59
|
+
return `'${escapeSqlString(String(value))}'`;
|
|
60
|
+
}
|
|
61
|
+
function renderSelectField(field) {
|
|
62
|
+
if (typeof field === "string") {
|
|
63
|
+
return renderIdentifierOrExpression(field);
|
|
64
|
+
}
|
|
65
|
+
const base = field.expression
|
|
66
|
+
? field.expression
|
|
67
|
+
: renderColumnRef({
|
|
68
|
+
table: field.table,
|
|
69
|
+
column: field.column || "*",
|
|
70
|
+
});
|
|
71
|
+
if (!field.as)
|
|
72
|
+
return base;
|
|
73
|
+
return `${base} AS ${quoteIdentifierPart(field.as)}`;
|
|
74
|
+
}
|
|
75
|
+
function renderJoinCondition(condition) {
|
|
76
|
+
if (typeof condition === "string") {
|
|
77
|
+
return condition;
|
|
78
|
+
}
|
|
79
|
+
return `${renderColumnRef(condition.left)} ${condition.operator ?? "="} ${renderColumnRef(condition.right)}`;
|
|
80
|
+
}
|
|
81
|
+
function renderJoin(join) {
|
|
82
|
+
const joinType = (join.type ?? "left").toUpperCase();
|
|
83
|
+
const source = renderSource({ table: join.table, alias: join.alias });
|
|
84
|
+
return `${joinType} JOIN ${source} ON ${renderJoinCondition(join.on)}`;
|
|
85
|
+
}
|
|
86
|
+
function renderFilter(filter) {
|
|
87
|
+
const lhs = filter.expression
|
|
88
|
+
? filter.expression
|
|
89
|
+
: filter.field
|
|
90
|
+
? renderColumnRef(filter.field)
|
|
91
|
+
: null;
|
|
92
|
+
if (!lhs) {
|
|
93
|
+
throw new Error("Joined record filters require either `expression` or `field`.");
|
|
94
|
+
}
|
|
95
|
+
const operator = (filter.operator ?? "=").toUpperCase();
|
|
96
|
+
const values = Array.isArray(filter.values) ? filter.values : undefined;
|
|
97
|
+
const rhs = values ? encodeSqlValue(values) : encodeSqlValue(filter.value);
|
|
98
|
+
if ((operator === "IN" || operator === "NOT IN") && !values) {
|
|
99
|
+
return `${lhs} ${operator} (${rhs})`;
|
|
100
|
+
}
|
|
101
|
+
return `${lhs} ${operator} ${rhs}`;
|
|
102
|
+
}
|
|
103
|
+
function renderOrderBy(orderBy) {
|
|
104
|
+
if (typeof orderBy === "string") {
|
|
105
|
+
return renderIdentifierOrExpression(orderBy);
|
|
106
|
+
}
|
|
107
|
+
const base = orderBy.expression
|
|
108
|
+
? orderBy.expression
|
|
109
|
+
: orderBy.field
|
|
110
|
+
? renderColumnRef(orderBy.field)
|
|
111
|
+
: null;
|
|
112
|
+
if (!base) {
|
|
113
|
+
throw new Error("Joined record sort entries require either `expression` or `field`.");
|
|
114
|
+
}
|
|
115
|
+
const direction = (orderBy.direction ?? "asc").toUpperCase();
|
|
116
|
+
const nulls = orderBy.nulls ? ` NULLS ${orderBy.nulls.toUpperCase()}` : "";
|
|
117
|
+
return `${base} ${direction}${nulls}`;
|
|
118
|
+
}
|
|
119
|
+
function normalizePositiveInteger(value, field) {
|
|
120
|
+
if (typeof value === "undefined" || value === null)
|
|
121
|
+
return undefined;
|
|
122
|
+
const parsed = Number(value);
|
|
123
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
124
|
+
throw new Error(`${field} must be a non-negative number.`);
|
|
125
|
+
}
|
|
126
|
+
return Math.floor(parsed);
|
|
127
|
+
}
|
|
128
|
+
export function parseForeignKeyReference(references) {
|
|
129
|
+
const value = references.trim();
|
|
130
|
+
const separator = value.indexOf(".");
|
|
131
|
+
if (separator <= 0 || separator === value.length - 1) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
table: value.slice(0, separator),
|
|
136
|
+
column: value.slice(separator + 1),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export function buildJoinedRecordsQuery(definition) {
|
|
140
|
+
const select = definition.select?.length
|
|
141
|
+
? definition.select.map((field) => renderSelectField(field)).join(", ")
|
|
142
|
+
: "*";
|
|
143
|
+
const distinct = definition.distinct ? "DISTINCT " : "";
|
|
144
|
+
const from = renderSource(definition.from);
|
|
145
|
+
const joins = definition.joins?.length ? ` ${definition.joins.map((join) => renderJoin(join)).join(" ")}` : "";
|
|
146
|
+
const where = definition.filters?.length
|
|
147
|
+
? ` WHERE ${definition.filters.map((filter) => renderFilter(filter)).join(" AND ")}`
|
|
148
|
+
: "";
|
|
149
|
+
const orderBy = definition.orderBy?.length
|
|
150
|
+
? ` ORDER BY ${definition.orderBy.map((entry) => renderOrderBy(entry)).join(", ")}`
|
|
151
|
+
: "";
|
|
152
|
+
const limit = normalizePositiveInteger(definition.limit, "limit");
|
|
153
|
+
const offset = normalizePositiveInteger(definition.offset, "offset");
|
|
154
|
+
const limitClause = typeof limit === "number" ? ` LIMIT ${limit}` : "";
|
|
155
|
+
const offsetClause = typeof offset === "number" ? ` OFFSET ${offset}` : "";
|
|
156
|
+
return `SELECT ${distinct}${select} FROM ${from}${joins}${where}${orderBy}${limitClause}${offsetClause}`.trim();
|
|
157
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,14 @@ export { parseTaskStreamEvent, upsertTaskMessage } from "./task-events.js";
|
|
|
12
12
|
export type { ParsedTaskStreamEvent } from "./task-events.js";
|
|
13
13
|
export { parseAssistantStreamEvent, upsertConversationMessage } from "./assistant-events.js";
|
|
14
14
|
export type { ParsedAssistantStreamEvent } from "./assistant-events.js";
|
|
15
|
+
export { buildRecordFormValues, buildRecordPayload, buildRecordSchemaFields, formatRecordValueForForm, getEditableRecordFields, getRecordFieldKind, } from "./record-form.js";
|
|
16
|
+
export type { BuildRecordPayloadOptions, BuildRecordPayloadResult, RecordSchemaField, RecordSchemaFieldKind, } from "./record-form.js";
|
|
17
|
+
export { buildSchemaFormFields, buildSchemaFormPayload, buildSchemaFormValues, formatSchemaFieldValueForForm, } from "./schema-form.js";
|
|
18
|
+
export type { BuildSchemaFormPayloadResult, JsonSchemaLike, JsonSchemaPrimitiveType, SchemaFormField, SchemaFormFieldKind, } from "./schema-form.js";
|
|
19
|
+
export { buildJoinedRecordsQuery, parseForeignKeyReference, } from "./datastore-query.js";
|
|
20
|
+
export type { ForeignKeyReference, JoinedRecordsColumnRef, JoinedRecordsFilter, JoinedRecordsJoin, JoinedRecordsJoinCondition, JoinedRecordsOrderBy, JoinedRecordsQueryDefinition, JoinedRecordsSelectField, JoinedRecordsSource, } from "./datastore-query.js";
|
|
15
21
|
export type { AgentsNamespace } from "./namespaces/agents.js";
|
|
22
|
+
export type { DatastoreNamespace } from "./namespaces/datastore.js";
|
|
16
23
|
export type { AssistantsNamespace, ConversationsNamespace } from "./namespaces/assistants.js";
|
|
17
24
|
export type { DesksNamespace } from "./namespaces/desks.js";
|
|
18
25
|
export type { FilesNamespace } from "./namespaces/files.js";
|
package/dist/index.js
CHANGED
|
@@ -6,3 +6,6 @@ export { readSSE, parseSSEJson } from "./streams.js";
|
|
|
6
6
|
export { normalizeRunStatus, isTerminalTaskStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
|
|
7
7
|
export { parseTaskStreamEvent, upsertTaskMessage } from "./task-events.js";
|
|
8
8
|
export { parseAssistantStreamEvent, upsertConversationMessage } from "./assistant-events.js";
|
|
9
|
+
export { buildRecordFormValues, buildRecordPayload, buildRecordSchemaFields, formatRecordValueForForm, getEditableRecordFields, getRecordFieldKind, } from "./record-form.js";
|
|
10
|
+
export { buildSchemaFormFields, buildSchemaFormPayload, buildSchemaFormValues, formatSchemaFieldValueForForm, } from "./schema-form.js";
|
|
11
|
+
export { buildJoinedRecordsQuery, parseForeignKeyReference, } from "./datastore-query.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GeneratedClientAdapter } from "../generated.js";
|
|
2
|
+
import type { DatastoreQueryRequest } from "../openapi_client/models/DatastoreQueryRequest.js";
|
|
3
|
+
import type { DatastoreQueryResponse } from "../openapi_client/models/DatastoreQueryResponse.js";
|
|
4
|
+
export declare class DatastoreNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
private readonly podId;
|
|
7
|
+
constructor(client: GeneratedClientAdapter, podId: () => string);
|
|
8
|
+
query(request: string | DatastoreQueryRequest): Promise<DatastoreQueryResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QueryService } from "../openapi_client/services/QueryService.js";
|
|
2
|
+
export class DatastoreNamespace {
|
|
3
|
+
client;
|
|
4
|
+
podId;
|
|
5
|
+
constructor(client, podId) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.podId = podId;
|
|
8
|
+
}
|
|
9
|
+
query(request) {
|
|
10
|
+
const payload = typeof request === "string" ? { query: request } : request;
|
|
11
|
+
return this.client.request(() => QueryService.queryExecute(this.podId(), payload));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -26,6 +26,6 @@ export declare class RecordsNamespace {
|
|
|
26
26
|
readonly bulk: {
|
|
27
27
|
create: (table: string, records: Record<string, unknown>[]) => Promise<import("../types.js").DatastoreMessageResponse>;
|
|
28
28
|
update: (table: string, records: Record<string, unknown>[]) => Promise<import("../types.js").DatastoreMessageResponse>;
|
|
29
|
-
delete: (table: string, recordIds: string
|
|
29
|
+
delete: (table: string, recordIds: Array<string | number>) => Promise<import("../types.js").DatastoreMessageResponse>;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
@@ -43,6 +43,8 @@ export type { ConversationMessageListResponse } from './models/ConversationMessa
|
|
|
43
43
|
export type { ConversationMessageResponse } from './models/ConversationMessageResponse.js';
|
|
44
44
|
export type { ConversationResponse } from './models/ConversationResponse.js';
|
|
45
45
|
export { ConversationStatus } from './models/ConversationStatus.js';
|
|
46
|
+
export type { ConvertedArtifactResponse } from './models/ConvertedArtifactResponse.js';
|
|
47
|
+
export type { ConvertedFileResponse } from './models/ConvertedFileResponse.js';
|
|
46
48
|
export type { CreateAgentRequest } from './models/CreateAgentRequest.js';
|
|
47
49
|
export type { CreateAssistantRequest } from './models/CreateAssistantRequest.js';
|
|
48
50
|
export type { CreateConversationRequest } from './models/CreateConversationRequest.js';
|
|
@@ -166,6 +168,7 @@ export type { RecordResponse } from './models/RecordResponse.js';
|
|
|
166
168
|
export type { ResourceFileListResponse } from './models/ResourceFileListResponse.js';
|
|
167
169
|
export { ResourceType } from './models/ResourceType.js';
|
|
168
170
|
export type { ScheduledFlowStart } from './models/ScheduledFlowStart.js';
|
|
171
|
+
export { ScheduledFlowStartType } from './models/ScheduledFlowStartType.js';
|
|
169
172
|
export { SearchMethod } from './models/SearchMethod.js';
|
|
170
173
|
export type { SearchResult } from './models/SearchResult.js';
|
|
171
174
|
export type { SeatInfoResponse } from './models/SeatInfoResponse.js';
|
|
@@ -228,6 +231,7 @@ export { WorkflowInstallMode } from './models/WorkflowInstallMode.js';
|
|
|
228
231
|
export type { WorkflowInstallRequest } from './models/WorkflowInstallRequest.js';
|
|
229
232
|
export type { WorkflowListResponse } from './models/WorkflowListResponse.js';
|
|
230
233
|
export type { WorkflowRunListResponse } from './models/WorkflowRunListResponse.js';
|
|
234
|
+
export type { WorkflowTimeInstallConfig } from './models/WorkflowTimeInstallConfig.js';
|
|
231
235
|
export type { WorkflowUpdateRequest } from './models/WorkflowUpdateRequest.js';
|
|
232
236
|
export { AgentFilesService } from './services/AgentFilesService.js';
|
|
233
237
|
export { AgentsService } from './services/AgentsService.js';
|
|
@@ -27,6 +27,7 @@ export { PodAppMode } from './models/PodAppMode.js';
|
|
|
27
27
|
export { PodJoinRequestStatus } from './models/PodJoinRequestStatus.js';
|
|
28
28
|
export { PodRole } from './models/PodRole.js';
|
|
29
29
|
export { ResourceType } from './models/ResourceType.js';
|
|
30
|
+
export { ScheduledFlowStartType } from './models/ScheduledFlowStartType.js';
|
|
30
31
|
export { SearchMethod } from './models/SearchMethod.js';
|
|
31
32
|
export { SubscriptionStatus } from './models/SubscriptionStatus.js';
|
|
32
33
|
export { TableAccessMode } from './models/TableAccessMode.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConvertedArtifactResponse } from './ConvertedArtifactResponse.js';
|
|
2
|
+
export type ConvertedFileResponse = {
|
|
3
|
+
artifacts?: Array<ConvertedArtifactResponse>;
|
|
4
|
+
detected_languages?: Array<string>;
|
|
5
|
+
extraction_mode: string;
|
|
6
|
+
generated_at: string;
|
|
7
|
+
source_mime_type?: (string | null);
|
|
8
|
+
source_name: string;
|
|
9
|
+
source_path: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { FileVisibility } from './FileVisibility.js';
|
|
2
2
|
export type CreateFolderRequest = {
|
|
3
3
|
description?: (string | null);
|
|
4
|
-
|
|
4
|
+
name?: (string | null);
|
|
5
|
+
parent_id?: (string | null);
|
|
6
|
+
path?: (string | null);
|
|
5
7
|
/**
|
|
6
8
|
* Optional visibility override for the new folder.
|
|
7
9
|
*/
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import type { ScheduledFlowStartType } from './ScheduledFlowStartType.js';
|
|
1
2
|
export type ScheduledFlowStart = {
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Time trigger mode for this workflow definition. Concrete schedule values are provided during installation.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* IANA timezone used when evaluating `cron_expression`.
|
|
8
|
-
*/
|
|
9
|
-
timezone?: string;
|
|
6
|
+
schedule_type: ScheduledFlowStartType;
|
|
10
7
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export var ScheduledFlowStartType;
|
|
6
|
+
(function (ScheduledFlowStartType) {
|
|
7
|
+
ScheduledFlowStartType["ONCE"] = "ONCE";
|
|
8
|
+
ScheduledFlowStartType["CRON"] = "CRON";
|
|
9
|
+
})(ScheduledFlowStartType || (ScheduledFlowStartType = {}));
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type { WorkflowTimeInstallConfig } from './WorkflowTimeInstallConfig.js';
|
|
1
2
|
export type WorkflowInstallRequest = {
|
|
2
3
|
/**
|
|
3
4
|
* Optional integration account to bind when installing an event-driven workflow. Scheduled and datastore-event workflows usually do not need this.
|
|
4
5
|
*/
|
|
5
6
|
account_id?: (string | null);
|
|
7
|
+
/**
|
|
8
|
+
* Concrete time trigger settings for scheduled workflows. Provide either a one-time `time` or a recurring `cron_expression`.
|
|
9
|
+
*/
|
|
10
|
+
schedule?: (WorkflowTimeInstallConfig | null);
|
|
6
11
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ScheduledFlowStartType } from './ScheduledFlowStartType.js';
|
|
2
|
+
export type WorkflowTimeInstallConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* Cron expression for `CRON` schedules.
|
|
5
|
+
*/
|
|
6
|
+
cron_expression?: (string | null);
|
|
7
|
+
/**
|
|
8
|
+
* Concrete time trigger mode to install: `ONCE` or `CRON`.
|
|
9
|
+
*/
|
|
10
|
+
schedule_type: ScheduledFlowStartType;
|
|
11
|
+
/**
|
|
12
|
+
* One-time execution timestamp for `ONCE` schedules.
|
|
13
|
+
*/
|
|
14
|
+
time?: (string | null);
|
|
15
|
+
/**
|
|
16
|
+
* IANA timezone used for cron evaluation or naive one-time values.
|
|
17
|
+
*/
|
|
18
|
+
timezone?: (string | null);
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|