@nsp-labs/agnostic-sdk 1.1.0 → 1.4.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/CHANGELOG.md +49 -0
- package/README.md +75 -1
- package/package.json +1 -1
- package/src/generated/openapi.d.ts +829 -0
- package/src/index.d.ts +2 -2
- package/src/index.js +4 -1
- package/src/lib/manifest.d.ts +5 -3
- package/src/lib/manifest.js +20 -2
- package/src/lib/runtime-client.d.ts +25 -1
- package/src/lib/runtime-client.js +88 -1
- package/src/lib/types.d.ts +93 -0
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AgnosticRuntime, RuntimeAppAuthNamespace, RuntimeContextNamespace, RuntimeDataNamespace, RuntimeDataRecordsClient, RuntimeDataTableClient, RuntimeDataViewClient, RuntimeDataViewTableClient, RuntimeWorkflowRunsNamespace, RuntimeWorkflowsNamespace, createAgnosticRuntime, } from './lib/runtime-client';
|
|
1
|
+
export { AgnosticRuntime, RuntimeAppAuthNamespace, RuntimeContextNamespace, RuntimeDataNamespace, RuntimeDataRecordsClient, RuntimeDataTableClient, RuntimeDataViewClient, RuntimeDataViewTableClient, RuntimeAnonymousUploadsClient, RuntimeStorageBucketClient, RuntimeStorageNamespace, RuntimeWorkflowRunsNamespace, RuntimeWorkflowsNamespace, createAgnosticRuntime, } from './lib/runtime-client';
|
|
2
2
|
export { normalizeApiUrl, resolveRuntimeContext } from './lib/context';
|
|
3
3
|
export { AgnosticRuntimeError } from './lib/errors';
|
|
4
4
|
export { AGNOSTIC_RUNTIME_SDK_MANIFEST, type AgnosticRuntimeSdkManifest, } from './lib/manifest';
|
|
5
|
-
export type { AgnosticRuntimeConfig, ResolvedRuntimeContext, RuntimeActorMetadata, RuntimeActorType, RuntimeAppAuthActor, RuntimeAppAuthCachePolicy, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthSessionClaims, RuntimeAppAuthUserClaims, RuntimeAppAuthUserResult, RuntimeCreateRecordInput, RuntimeDataField, RuntimeDataViewState, RuntimeIdentityContext, RuntimeListRecordsOptions, RuntimeListWindowOptions, RuntimeRecord, RuntimeRecordMutation, RuntimeRecordsList, RuntimeRequestOptions, RuntimeRowData, RuntimeRowValue, RuntimeTableWindow, RuntimeUpdateRecordInput, RuntimeWorkflowRun, RuntimeWorkflowStepRun, RuntimeWorkflowWaitOptions, WorkflowRunStatus, } from './lib/types';
|
|
5
|
+
export type { AgnosticRuntimeConfig, RuntimeAggregateMetric, RuntimeAggregateOperation, RuntimeAggregateOrderBy, RuntimeAggregateRecordsInput, RuntimeAggregateRecordsResult, RuntimeAggregateRow, ResolvedRuntimeContext, RuntimeActorMetadata, RuntimeActorType, RuntimeAnonymousClaimFileHandle, RuntimeAnonymousClaimInput, RuntimeAnonymousClaimResult, RuntimeAppAuthActor, RuntimeAppAuthCachePolicy, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthSessionClaims, RuntimeAppAuthUserClaims, RuntimeAppAuthUserResult, RuntimeCreateRecordInput, RuntimeCreateFileUploadInput, RuntimeDataField, RuntimeDataViewState, RuntimeIdentityContext, RuntimeFileAccessMode, RuntimeFileDownloadUrl, RuntimeFileObject, RuntimeFileObjectStatus, RuntimeFileUploadCompletion, RuntimeFileUploadGrant, RuntimeListRecordsOptions, RuntimeListWindowOptions, RuntimeRecord, RuntimeRecordMutation, RuntimeRecordsList, RuntimeRequestOptions, RuntimeRowData, RuntimeRowValue, RuntimeTableWindow, RuntimeUpdateRecordInput, RuntimeWorkflowRun, RuntimeWorkflowStepRun, RuntimeWorkflowWaitOptions, WorkflowRunStatus, } from './lib/types';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AGNOSTIC_RUNTIME_SDK_MANIFEST = exports.AgnosticRuntimeError = exports.resolveRuntimeContext = exports.normalizeApiUrl = exports.createAgnosticRuntime = exports.RuntimeWorkflowsNamespace = exports.RuntimeWorkflowRunsNamespace = exports.RuntimeDataViewTableClient = exports.RuntimeDataViewClient = exports.RuntimeDataTableClient = exports.RuntimeDataRecordsClient = exports.RuntimeDataNamespace = exports.RuntimeContextNamespace = exports.RuntimeAppAuthNamespace = exports.AgnosticRuntime = void 0;
|
|
3
|
+
exports.AGNOSTIC_RUNTIME_SDK_MANIFEST = exports.AgnosticRuntimeError = exports.resolveRuntimeContext = exports.normalizeApiUrl = exports.createAgnosticRuntime = exports.RuntimeWorkflowsNamespace = exports.RuntimeWorkflowRunsNamespace = exports.RuntimeStorageNamespace = exports.RuntimeStorageBucketClient = exports.RuntimeAnonymousUploadsClient = exports.RuntimeDataViewTableClient = exports.RuntimeDataViewClient = exports.RuntimeDataTableClient = exports.RuntimeDataRecordsClient = exports.RuntimeDataNamespace = exports.RuntimeContextNamespace = exports.RuntimeAppAuthNamespace = exports.AgnosticRuntime = void 0;
|
|
4
4
|
var runtime_client_1 = require("./lib/runtime-client");
|
|
5
5
|
Object.defineProperty(exports, "AgnosticRuntime", { enumerable: true, get: function () { return runtime_client_1.AgnosticRuntime; } });
|
|
6
6
|
Object.defineProperty(exports, "RuntimeAppAuthNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeAppAuthNamespace; } });
|
|
@@ -10,6 +10,9 @@ Object.defineProperty(exports, "RuntimeDataRecordsClient", { enumerable: true, g
|
|
|
10
10
|
Object.defineProperty(exports, "RuntimeDataTableClient", { enumerable: true, get: function () { return runtime_client_1.RuntimeDataTableClient; } });
|
|
11
11
|
Object.defineProperty(exports, "RuntimeDataViewClient", { enumerable: true, get: function () { return runtime_client_1.RuntimeDataViewClient; } });
|
|
12
12
|
Object.defineProperty(exports, "RuntimeDataViewTableClient", { enumerable: true, get: function () { return runtime_client_1.RuntimeDataViewTableClient; } });
|
|
13
|
+
Object.defineProperty(exports, "RuntimeAnonymousUploadsClient", { enumerable: true, get: function () { return runtime_client_1.RuntimeAnonymousUploadsClient; } });
|
|
14
|
+
Object.defineProperty(exports, "RuntimeStorageBucketClient", { enumerable: true, get: function () { return runtime_client_1.RuntimeStorageBucketClient; } });
|
|
15
|
+
Object.defineProperty(exports, "RuntimeStorageNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeStorageNamespace; } });
|
|
13
16
|
Object.defineProperty(exports, "RuntimeWorkflowRunsNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeWorkflowRunsNamespace; } });
|
|
14
17
|
Object.defineProperty(exports, "RuntimeWorkflowsNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeWorkflowsNamespace; } });
|
|
15
18
|
Object.defineProperty(exports, "createAgnosticRuntime", { enumerable: true, get: function () { return runtime_client_1.createAgnosticRuntime; } });
|
package/src/lib/manifest.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const AGNOSTIC_RUNTIME_SDK_MANIFEST: Readonly<{
|
|
|
9
9
|
readonly schema: "agnostic_runtime_sdk_manifest.v1";
|
|
10
10
|
readonly package: Readonly<{
|
|
11
11
|
name: "@nsp-labs/agnostic-sdk";
|
|
12
|
-
version: "1.
|
|
12
|
+
version: "1.4.0";
|
|
13
13
|
factory: "createAgnosticRuntime";
|
|
14
14
|
runtime: "server_only";
|
|
15
15
|
}>;
|
|
@@ -18,12 +18,13 @@ export declare const AGNOSTIC_RUNTIME_SDK_MANIFEST: Readonly<{
|
|
|
18
18
|
environmentVariables: readonly string[];
|
|
19
19
|
secretEnvironmentVariables: readonly string[];
|
|
20
20
|
}>;
|
|
21
|
-
readonly rootMembers: readonly [...("data" | "auth" | "context" | "workflows" | "workflowRuns")[], "getRuntimeContext"];
|
|
21
|
+
readonly rootMembers: readonly [...("data" | "auth" | "context" | "storage" | "workflows" | "workflowRuns")[], "getRuntimeContext"];
|
|
22
22
|
readonly clientMethods: readonly ["getRuntimeContext"];
|
|
23
23
|
readonly namespaces: Readonly<{
|
|
24
24
|
auth: readonly ("requireSession" | "getSession" | "requireScopes" | "getUser")[];
|
|
25
25
|
context: readonly "get"[];
|
|
26
|
-
data: readonly ("table(name).records.delete" | "table(name).records.list" | "table(name).records.create" | "table(name).records.update" | "view(id).table.window")[];
|
|
26
|
+
data: readonly ("table(name).records.delete" | "table(name).records.list" | "table(name).records.aggregate" | "table(name).records.create" | "table(name).records.update" | "view(id).table.window")[];
|
|
27
|
+
storage: readonly ("bucket(name).get" | "bucket(name).delete" | "bucket(name).createUpload" | "bucket(name).completeUpload" | "bucket(name).createDownloadUrl" | "bucket(name).anonymousUploads.claim")[];
|
|
27
28
|
workflows: readonly ("start" | "getRun")[];
|
|
28
29
|
workflowRuns: readonly ("get" | "wait" | "listSteps")[];
|
|
29
30
|
}>;
|
|
@@ -32,6 +33,7 @@ export declare const AGNOSTIC_RUNTIME_SDK_MANIFEST: Readonly<{
|
|
|
32
33
|
controlPlaneProvisioning: "agent_product_tools";
|
|
33
34
|
runtimeAccess: "server_sdk";
|
|
34
35
|
browserAccess: "public_api_or_app_auth_session";
|
|
36
|
+
appAuthSelfService: "public_api_via_project_backend_bff";
|
|
35
37
|
browserPackageImportAllowed: false;
|
|
36
38
|
browserRuntimeTokenAllowed: false;
|
|
37
39
|
}>;
|
package/src/lib/manifest.js
CHANGED
|
@@ -17,6 +17,7 @@ const DATA_TABLE_KEYS_LITERAL = ['records'];
|
|
|
17
17
|
const DATA_TABLE_KEYS = DATA_TABLE_KEYS_LITERAL;
|
|
18
18
|
const DATA_RECORD_KEYS_LITERAL = [
|
|
19
19
|
'list',
|
|
20
|
+
'aggregate',
|
|
20
21
|
'create',
|
|
21
22
|
'update',
|
|
22
23
|
'delete',
|
|
@@ -26,6 +27,19 @@ const DATA_VIEW_KEYS_LITERAL = ['table'];
|
|
|
26
27
|
const DATA_VIEW_KEYS = DATA_VIEW_KEYS_LITERAL;
|
|
27
28
|
const DATA_VIEW_TABLE_KEYS_LITERAL = ['window'];
|
|
28
29
|
const DATA_VIEW_TABLE_KEYS = DATA_VIEW_TABLE_KEYS_LITERAL;
|
|
30
|
+
const STORAGE_NAMESPACE_KEYS_LITERAL = ['bucket'];
|
|
31
|
+
const STORAGE_NAMESPACE_KEYS = STORAGE_NAMESPACE_KEYS_LITERAL;
|
|
32
|
+
const STORAGE_BUCKET_KEYS_LITERAL = [
|
|
33
|
+
'anonymousUploads',
|
|
34
|
+
'createUpload',
|
|
35
|
+
'completeUpload',
|
|
36
|
+
'get',
|
|
37
|
+
'createDownloadUrl',
|
|
38
|
+
'delete',
|
|
39
|
+
];
|
|
40
|
+
const STORAGE_BUCKET_KEYS = STORAGE_BUCKET_KEYS_LITERAL;
|
|
41
|
+
const ANONYMOUS_UPLOAD_KEYS_LITERAL = ['claim'];
|
|
42
|
+
const ANONYMOUS_UPLOAD_KEYS = ANONYMOUS_UPLOAD_KEYS_LITERAL;
|
|
29
43
|
const WORKFLOW_KEYS_LITERAL = ['start', 'getRun'];
|
|
30
44
|
const WORKFLOW_KEYS = WORKFLOW_KEYS_LITERAL;
|
|
31
45
|
const WORKFLOW_RUN_KEYS_LITERAL = ['get', 'wait', 'listSteps'];
|
|
@@ -38,6 +52,10 @@ const NAMESPACES = Object.freeze({
|
|
|
38
52
|
...DATA_RECORD_KEYS.map((method) => `${DATA_NAMESPACE_KEYS[0]}(name).${DATA_TABLE_KEYS[0]}.${method}`),
|
|
39
53
|
...DATA_VIEW_TABLE_KEYS.map((method) => `${DATA_NAMESPACE_KEYS[1]}(id).${DATA_VIEW_KEYS[0]}.${method}`),
|
|
40
54
|
]),
|
|
55
|
+
storage: Object.freeze([
|
|
56
|
+
...STORAGE_BUCKET_KEYS.filter((method) => method !== 'anonymousUploads').map((method) => `${STORAGE_NAMESPACE_KEYS[0]}(name).${method}`),
|
|
57
|
+
...ANONYMOUS_UPLOAD_KEYS.map((method) => `${STORAGE_NAMESPACE_KEYS[0]}(name).${STORAGE_BUCKET_KEYS[0]}.${method}`),
|
|
58
|
+
]),
|
|
41
59
|
workflows: Object.freeze([...WORKFLOW_KEYS]),
|
|
42
60
|
workflowRuns: Object.freeze([...WORKFLOW_RUN_KEYS]),
|
|
43
61
|
});
|
|
@@ -50,7 +68,7 @@ const MANIFEST_CONTRACT = Object.freeze({
|
|
|
50
68
|
schema: 'agnostic_runtime_sdk_manifest.v1',
|
|
51
69
|
package: Object.freeze({
|
|
52
70
|
name: '@nsp-labs/agnostic-sdk',
|
|
53
|
-
version: '1.
|
|
71
|
+
version: '1.4.0',
|
|
54
72
|
factory: 'createAgnosticRuntime',
|
|
55
73
|
runtime: 'server_only',
|
|
56
74
|
}),
|
|
@@ -73,12 +91,12 @@ const MANIFEST_CONTRACT = Object.freeze({
|
|
|
73
91
|
'gateway',
|
|
74
92
|
'jobs',
|
|
75
93
|
'realtime',
|
|
76
|
-
'storage',
|
|
77
94
|
]),
|
|
78
95
|
boundaries: Object.freeze({
|
|
79
96
|
controlPlaneProvisioning: 'agent_product_tools',
|
|
80
97
|
runtimeAccess: 'server_sdk',
|
|
81
98
|
browserAccess: 'public_api_or_app_auth_session',
|
|
99
|
+
appAuthSelfService: 'public_api_via_project_backend_bff',
|
|
82
100
|
browserPackageImportAllowed: false,
|
|
83
101
|
browserRuntimeTokenAllowed: false,
|
|
84
102
|
}),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type RuntimeOpenApiClient } from './http-client';
|
|
2
|
-
import type { AgnosticRuntimeConfig, ResolvedRuntimeContext, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthUserResult, RuntimeCreateRecordInput, RuntimeIdentityContext, RuntimeListRecordsOptions, RuntimeListWindowOptions, RuntimeRecordMutation, RuntimeRecordsList, RuntimeRequestOptions, RuntimeRowData, RuntimeTableWindow, RuntimeUpdateRecordInput, RuntimeWorkflowRun, RuntimeWorkflowStepRun, RuntimeWorkflowWaitOptions } from './types';
|
|
2
|
+
import type { AgnosticRuntimeConfig, ResolvedRuntimeContext, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthUserResult, RuntimeAnonymousClaimInput, RuntimeAnonymousClaimResult, RuntimeAggregateRecordsInput, RuntimeAggregateRecordsResult, RuntimeCreateFileUploadInput, RuntimeCreateRecordInput, RuntimeIdentityContext, RuntimeFileDownloadUrl, RuntimeFileObject, RuntimeFileUploadCompletion, RuntimeFileUploadGrant, RuntimeListRecordsOptions, RuntimeListWindowOptions, RuntimeRecordMutation, RuntimeRecordsList, RuntimeRequestOptions, RuntimeRowData, RuntimeTableWindow, RuntimeUpdateRecordInput, RuntimeWorkflowRun, RuntimeWorkflowStepRun, RuntimeWorkflowWaitOptions } from './types';
|
|
3
3
|
export declare class AgnosticRuntime {
|
|
4
4
|
readonly auth: RuntimeAppAuthNamespace;
|
|
5
5
|
readonly context: RuntimeContextNamespace;
|
|
6
6
|
readonly data: RuntimeDataNamespace;
|
|
7
|
+
readonly storage: RuntimeStorageNamespace;
|
|
7
8
|
readonly workflows: RuntimeWorkflowsNamespace;
|
|
8
9
|
readonly workflowRuns: RuntimeWorkflowRunsNamespace;
|
|
9
10
|
private readonly openapi;
|
|
@@ -31,6 +32,28 @@ export declare class RuntimeDataNamespace {
|
|
|
31
32
|
table(tableName: string): RuntimeDataTableClient;
|
|
32
33
|
view(viewId: string): RuntimeDataViewClient;
|
|
33
34
|
}
|
|
35
|
+
export declare class RuntimeStorageNamespace {
|
|
36
|
+
private readonly openapi;
|
|
37
|
+
constructor(openapi: RuntimeOpenApiClient);
|
|
38
|
+
bucket(bucketIdOrSlug: string): RuntimeStorageBucketClient;
|
|
39
|
+
}
|
|
40
|
+
export declare class RuntimeStorageBucketClient {
|
|
41
|
+
private readonly openapi;
|
|
42
|
+
private readonly bucketIdOrSlug;
|
|
43
|
+
readonly anonymousUploads: RuntimeAnonymousUploadsClient;
|
|
44
|
+
constructor(openapi: RuntimeOpenApiClient, bucketIdOrSlug: string);
|
|
45
|
+
createUpload(input: RuntimeCreateFileUploadInput, options?: RuntimeRequestOptions): Promise<RuntimeFileUploadGrant>;
|
|
46
|
+
completeUpload(uploadId: string, options?: RuntimeRequestOptions): Promise<RuntimeFileUploadCompletion>;
|
|
47
|
+
get(fileId: string, options?: RuntimeRequestOptions): Promise<RuntimeFileObject>;
|
|
48
|
+
createDownloadUrl(fileId: string, options?: RuntimeRequestOptions): Promise<RuntimeFileDownloadUrl>;
|
|
49
|
+
delete(fileId: string, options?: RuntimeRequestOptions): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export declare class RuntimeAnonymousUploadsClient {
|
|
52
|
+
private readonly openapi;
|
|
53
|
+
private readonly bucketIdOrSlug;
|
|
54
|
+
constructor(openapi: RuntimeOpenApiClient, bucketIdOrSlug: string);
|
|
55
|
+
claim(input: RuntimeAnonymousClaimInput, options?: RuntimeRequestOptions): Promise<RuntimeAnonymousClaimResult>;
|
|
56
|
+
}
|
|
34
57
|
export declare class RuntimeDataTableClient {
|
|
35
58
|
private readonly tableName;
|
|
36
59
|
readonly records: RuntimeDataRecordsClient;
|
|
@@ -41,6 +64,7 @@ export declare class RuntimeDataRecordsClient {
|
|
|
41
64
|
private readonly tableName;
|
|
42
65
|
constructor(openapi: RuntimeOpenApiClient, tableName: string);
|
|
43
66
|
list(query?: RuntimeListRecordsOptions, options?: RuntimeRequestOptions): Promise<RuntimeRecordsList>;
|
|
67
|
+
aggregate(input: RuntimeAggregateRecordsInput, options?: RuntimeRequestOptions): Promise<RuntimeAggregateRecordsResult>;
|
|
44
68
|
create(input: RuntimeCreateRecordInput | RuntimeRowData, options?: RuntimeRequestOptions): Promise<RuntimeRecordMutation>;
|
|
45
69
|
update(recordId: string, input: RuntimeUpdateRecordInput | RuntimeRowData, options?: RuntimeRequestOptions): Promise<RuntimeRecordMutation>;
|
|
46
70
|
delete(recordId: string, options?: RuntimeRequestOptions): Promise<RuntimeRecordMutation>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuntimeWorkflowRunsNamespace = exports.RuntimeWorkflowsNamespace = exports.RuntimeDataViewTableClient = exports.RuntimeDataViewClient = exports.RuntimeDataRecordsClient = exports.RuntimeDataTableClient = exports.RuntimeDataNamespace = exports.RuntimeContextNamespace = exports.RuntimeAppAuthNamespace = exports.AgnosticRuntime = void 0;
|
|
3
|
+
exports.RuntimeWorkflowRunsNamespace = exports.RuntimeWorkflowsNamespace = exports.RuntimeDataViewTableClient = exports.RuntimeDataViewClient = exports.RuntimeDataRecordsClient = exports.RuntimeDataTableClient = exports.RuntimeAnonymousUploadsClient = exports.RuntimeStorageBucketClient = exports.RuntimeStorageNamespace = exports.RuntimeDataNamespace = exports.RuntimeContextNamespace = exports.RuntimeAppAuthNamespace = exports.AgnosticRuntime = void 0;
|
|
4
4
|
exports.createAgnosticRuntime = createAgnosticRuntime;
|
|
5
5
|
const http_client_1 = require("./http-client");
|
|
6
6
|
const context_1 = require("./context");
|
|
@@ -9,8 +9,14 @@ const APP_AUTH_VERIFY_SESSION_PATH = '/api/v1/runtime/app-auth/session/verify';
|
|
|
9
9
|
const APP_AUTH_USER_PATH = '/api/v1/runtime/app-auth/users/{userId}';
|
|
10
10
|
const AUTH_CONTEXT_PATH = '/api/v1/runtime/auth/context';
|
|
11
11
|
const DATA_RECORDS_PATH = '/api/v1/runtime/data/tables/{tableName}/records';
|
|
12
|
+
const DATA_AGGREGATE_PATH = '/api/v1/runtime/data/tables/{tableName}/records/aggregate';
|
|
12
13
|
const DATA_RECORD_PATH = '/api/v1/runtime/data/tables/{tableName}/records/{recordId}';
|
|
13
14
|
const DATA_VIEW_WINDOW_PATH = '/api/v1/runtime/data/views/{viewId}/table/window';
|
|
15
|
+
const FILES_ANONYMOUS_CLAIM_PATH = '/api/v1/runtime/files/buckets/{bucketRef}/anonymous-upload-sessions/claim';
|
|
16
|
+
const FILES_UPLOADS_PATH = '/api/v1/runtime/files/buckets/{bucketRef}/uploads';
|
|
17
|
+
const FILES_UPLOAD_COMPLETE_PATH = '/api/v1/runtime/files/buckets/{bucketRef}/uploads/{uploadId}/complete';
|
|
18
|
+
const FILES_OBJECT_PATH = '/api/v1/runtime/files/buckets/{bucketRef}/objects/{fileId}';
|
|
19
|
+
const FILES_DOWNLOAD_PATH = '/api/v1/runtime/files/buckets/{bucketRef}/objects/{fileId}/download';
|
|
14
20
|
const WORKFLOWS_START_PATH = '/api/v1/runtime/workflows/{workflowSlug}/runs';
|
|
15
21
|
const WORKFLOW_RUN_PATH = '/api/v1/runtime/workflow-runs/{runId}';
|
|
16
22
|
const WORKFLOW_RUN_STEPS_PATH = '/api/v1/runtime/workflow-runs/{runId}/steps';
|
|
@@ -32,6 +38,7 @@ class AgnosticRuntime {
|
|
|
32
38
|
this.auth = new RuntimeAppAuthNamespace(this.openapi);
|
|
33
39
|
this.context = new RuntimeContextNamespace(this.openapi);
|
|
34
40
|
this.data = new RuntimeDataNamespace(this.openapi);
|
|
41
|
+
this.storage = new RuntimeStorageNamespace(this.openapi);
|
|
35
42
|
this.workflowRuns = new RuntimeWorkflowRunsNamespace(this.openapi);
|
|
36
43
|
this.workflows = new RuntimeWorkflowsNamespace(this.openapi, this.workflowRuns);
|
|
37
44
|
}
|
|
@@ -133,6 +140,76 @@ class RuntimeDataNamespace {
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
exports.RuntimeDataNamespace = RuntimeDataNamespace;
|
|
143
|
+
class RuntimeStorageNamespace {
|
|
144
|
+
constructor(openapi) {
|
|
145
|
+
this.openapi = openapi;
|
|
146
|
+
}
|
|
147
|
+
bucket(bucketIdOrSlug) {
|
|
148
|
+
return new RuntimeStorageBucketClient(this.openapi, bucketIdOrSlug);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.RuntimeStorageNamespace = RuntimeStorageNamespace;
|
|
152
|
+
class RuntimeStorageBucketClient {
|
|
153
|
+
constructor(openapi, bucketIdOrSlug) {
|
|
154
|
+
this.openapi = openapi;
|
|
155
|
+
this.bucketIdOrSlug = bucketIdOrSlug;
|
|
156
|
+
this.anonymousUploads = new RuntimeAnonymousUploadsClient(openapi, bucketIdOrSlug);
|
|
157
|
+
}
|
|
158
|
+
async createUpload(input, options) {
|
|
159
|
+
const result = await this.openapi.POST(FILES_UPLOADS_PATH, {
|
|
160
|
+
body: input,
|
|
161
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
162
|
+
params: { path: { bucketRef: this.bucketIdOrSlug } },
|
|
163
|
+
});
|
|
164
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to create file upload');
|
|
165
|
+
}
|
|
166
|
+
async completeUpload(uploadId, options) {
|
|
167
|
+
const result = await this.openapi.POST(FILES_UPLOAD_COMPLETE_PATH, {
|
|
168
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
169
|
+
params: { path: { bucketRef: this.bucketIdOrSlug, uploadId } },
|
|
170
|
+
});
|
|
171
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to complete file upload');
|
|
172
|
+
}
|
|
173
|
+
async get(fileId, options) {
|
|
174
|
+
const result = await this.openapi.GET(FILES_OBJECT_PATH, {
|
|
175
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
176
|
+
params: { path: { bucketRef: this.bucketIdOrSlug, fileId } },
|
|
177
|
+
});
|
|
178
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to load file status');
|
|
179
|
+
}
|
|
180
|
+
async createDownloadUrl(fileId, options) {
|
|
181
|
+
const result = await this.openapi.POST(FILES_DOWNLOAD_PATH, {
|
|
182
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
183
|
+
params: { path: { bucketRef: this.bucketIdOrSlug, fileId } },
|
|
184
|
+
});
|
|
185
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to create file download URL');
|
|
186
|
+
}
|
|
187
|
+
async delete(fileId, options) {
|
|
188
|
+
const result = await this.openapi.DELETE(FILES_OBJECT_PATH, {
|
|
189
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
190
|
+
params: { path: { bucketRef: this.bucketIdOrSlug, fileId } },
|
|
191
|
+
});
|
|
192
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to delete file');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.RuntimeStorageBucketClient = RuntimeStorageBucketClient;
|
|
196
|
+
class RuntimeAnonymousUploadsClient {
|
|
197
|
+
constructor(openapi, bucketIdOrSlug) {
|
|
198
|
+
this.openapi = openapi;
|
|
199
|
+
this.bucketIdOrSlug = bucketIdOrSlug;
|
|
200
|
+
}
|
|
201
|
+
async claim(input, options) {
|
|
202
|
+
const result = await this.openapi.POST(FILES_ANONYMOUS_CLAIM_PATH, {
|
|
203
|
+
body: input,
|
|
204
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
205
|
+
params: {
|
|
206
|
+
path: { bucketRef: this.bucketIdOrSlug },
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to claim anonymous uploads');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.RuntimeAnonymousUploadsClient = RuntimeAnonymousUploadsClient;
|
|
136
213
|
class RuntimeDataTableClient {
|
|
137
214
|
constructor(openapi, tableName) {
|
|
138
215
|
this.tableName = tableName;
|
|
@@ -155,6 +232,16 @@ class RuntimeDataRecordsClient {
|
|
|
155
232
|
});
|
|
156
233
|
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to list data records');
|
|
157
234
|
}
|
|
235
|
+
async aggregate(input, options) {
|
|
236
|
+
const result = await this.openapi.POST(DATA_AGGREGATE_PATH, {
|
|
237
|
+
body: input,
|
|
238
|
+
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
239
|
+
params: {
|
|
240
|
+
path: { tableName: this.tableName },
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to aggregate data records');
|
|
244
|
+
}
|
|
158
245
|
async create(input, options) {
|
|
159
246
|
const result = await this.openapi.POST(DATA_RECORDS_PATH, {
|
|
160
247
|
body: normalizeCreateRecordInput(input),
|
package/src/lib/types.d.ts
CHANGED
|
@@ -39,6 +39,72 @@ export interface RuntimeRequestOptions {
|
|
|
39
39
|
actor?: RuntimeActorMetadata | null;
|
|
40
40
|
headers?: Record<string, string>;
|
|
41
41
|
}
|
|
42
|
+
export interface RuntimeAnonymousClaimInput {
|
|
43
|
+
token: string;
|
|
44
|
+
externalRef: string;
|
|
45
|
+
idempotencyKey: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RuntimeAnonymousClaimFileHandle {
|
|
48
|
+
fileId: string;
|
|
49
|
+
status: 'ready' | 'processing';
|
|
50
|
+
}
|
|
51
|
+
export interface RuntimeAnonymousClaimResult {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
bucketId: string;
|
|
54
|
+
externalRef: string;
|
|
55
|
+
claimedAt: string;
|
|
56
|
+
files: RuntimeAnonymousClaimFileHandle[];
|
|
57
|
+
}
|
|
58
|
+
export type RuntimeFileAccessMode = 'private' | 'authenticated' | 'team' | 'public';
|
|
59
|
+
export type RuntimeFileObjectStatus = 'pending_upload' | 'uploaded' | 'scanning' | 'ready' | 'verified_unclaimed' | 'claimed_ready' | 'deleting' | 'deleted' | 'rejected' | 'quarantined' | 'expired';
|
|
60
|
+
export interface RuntimeCreateFileUploadInput {
|
|
61
|
+
fileName: string;
|
|
62
|
+
contentType: string;
|
|
63
|
+
size: number;
|
|
64
|
+
checksumSha256: string;
|
|
65
|
+
access?: RuntimeFileAccessMode;
|
|
66
|
+
idempotencyKey: string;
|
|
67
|
+
}
|
|
68
|
+
export interface RuntimeFileUploadGrant {
|
|
69
|
+
id: string;
|
|
70
|
+
fileId: string;
|
|
71
|
+
bucketId: string;
|
|
72
|
+
status: 'issued' | 'uploaded' | 'verifying' | 'completed' | 'rejected' | 'expired';
|
|
73
|
+
expectedSizeBytes: number;
|
|
74
|
+
expiresAt: string;
|
|
75
|
+
completedAt: string | null;
|
|
76
|
+
uploadUrl: string;
|
|
77
|
+
uploadUrlExpiresAt: string;
|
|
78
|
+
requiredHeaders: Readonly<Record<string, string>>;
|
|
79
|
+
}
|
|
80
|
+
export interface RuntimeFileObject {
|
|
81
|
+
id: string;
|
|
82
|
+
bucketId: string;
|
|
83
|
+
projectId: string;
|
|
84
|
+
environment: string;
|
|
85
|
+
originalName: string;
|
|
86
|
+
detectedMime: string | null;
|
|
87
|
+
sizeBytes: number | null;
|
|
88
|
+
checksumSha256: string | null;
|
|
89
|
+
status: RuntimeFileObjectStatus;
|
|
90
|
+
access: RuntimeFileAccessMode;
|
|
91
|
+
readyAt: string | null;
|
|
92
|
+
deletedAt: string | null;
|
|
93
|
+
billableUntil: string | null;
|
|
94
|
+
physicalDeleteDueAt: string | null;
|
|
95
|
+
physicalDeletedAt: string | null;
|
|
96
|
+
expiresAt: string | null;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
updatedAt: string;
|
|
99
|
+
}
|
|
100
|
+
export interface RuntimeFileUploadCompletion {
|
|
101
|
+
upload: Omit<RuntimeFileUploadGrant, 'uploadUrl' | 'uploadUrlExpiresAt' | 'requiredHeaders'>;
|
|
102
|
+
file: RuntimeFileObject;
|
|
103
|
+
}
|
|
104
|
+
export interface RuntimeFileDownloadUrl {
|
|
105
|
+
url: string;
|
|
106
|
+
expiresAt: string;
|
|
107
|
+
}
|
|
42
108
|
export type RuntimeHeaderValue = string | string[] | undefined;
|
|
43
109
|
export interface RuntimeAppAuthRequestLike {
|
|
44
110
|
headers?: Headers | Record<string, RuntimeHeaderValue> | {
|
|
@@ -92,6 +158,33 @@ export interface RuntimeListRecordsOptions {
|
|
|
92
158
|
q?: string;
|
|
93
159
|
sort?: string;
|
|
94
160
|
}
|
|
161
|
+
export type RuntimeAggregateOperation = 'count' | 'sum' | 'avg' | 'min' | 'max';
|
|
162
|
+
export interface RuntimeAggregateMetric {
|
|
163
|
+
operation: RuntimeAggregateOperation;
|
|
164
|
+
field?: string;
|
|
165
|
+
as: string;
|
|
166
|
+
}
|
|
167
|
+
export interface RuntimeAggregateOrderBy {
|
|
168
|
+
by: string;
|
|
169
|
+
direction: 'asc' | 'desc';
|
|
170
|
+
}
|
|
171
|
+
export interface RuntimeAggregateRecordsInput {
|
|
172
|
+
filter?: Record<string, unknown>;
|
|
173
|
+
q?: string;
|
|
174
|
+
groupBy?: string[];
|
|
175
|
+
metrics: RuntimeAggregateMetric[];
|
|
176
|
+
orderBy?: RuntimeAggregateOrderBy[];
|
|
177
|
+
limit?: number;
|
|
178
|
+
}
|
|
179
|
+
export interface RuntimeAggregateRow {
|
|
180
|
+
dimensions: Record<string, RuntimeScalar>;
|
|
181
|
+
metrics: Record<string, string | number | null>;
|
|
182
|
+
}
|
|
183
|
+
export interface RuntimeAggregateRecordsResult {
|
|
184
|
+
rows: RuntimeAggregateRow[];
|
|
185
|
+
limit: number;
|
|
186
|
+
hasMore: boolean;
|
|
187
|
+
}
|
|
95
188
|
export interface RuntimeListWindowOptions {
|
|
96
189
|
cursor?: string;
|
|
97
190
|
limit?: number;
|