@nsp-labs/agnostic-sdk 0.1.0 → 1.0.1
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 +19 -0
- package/README.md +8 -41
- package/package.json +1 -1
- package/src/generated/openapi.d.ts +0 -261
- package/src/index.d.ts +2 -2
- package/src/index.js +1 -4
- package/src/lib/runtime-client.d.ts +1 -23
- package/src/lib/runtime-client.js +1 -75
- package/src/lib/types.d.ts +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,25 @@ and pass the runtime OpenAPI schema check.
|
|
|
9
9
|
|
|
10
10
|
## Unreleased
|
|
11
11
|
|
|
12
|
+
## 1.0.1 - 2026-06-18
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Reissued the SDK package through the shared npm release workflow without
|
|
17
|
+
Runtime SDK API or runtime OpenAPI schema changes since `1.0.0`.
|
|
18
|
+
|
|
19
|
+
## 1.0.0 - 2026-06-17
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Removed `events`, `jobs`, and `gateway` from the public Runtime SDK surface
|
|
24
|
+
until the product exposes the corresponding runtime flows end-to-end.
|
|
25
|
+
- Generated from runtime API schema at commit `996ea17`.
|
|
26
|
+
|
|
27
|
+
## 0.1.0 - 2026-06-06
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
12
31
|
- Prepared npm package metadata for `@nsp-labs/agnostic-sdk`.
|
|
13
32
|
- Added CI coverage for generated Runtime SDK OpenAPI schema drift.
|
|
14
33
|
- Documented Runtime SDK semver, changelog, and browser-token security policy.
|
package/README.md
CHANGED
|
@@ -35,6 +35,9 @@ const agnostic = createAgnosticRuntime({
|
|
|
35
35
|
Runtime tokens are server-side credentials. Do not put
|
|
36
36
|
`AGNOSTIC_RUNTIME_TOKEN` in browser, mobile, Vite, or static frontend bundles.
|
|
37
37
|
|
|
38
|
+
The current public runtime surface includes `auth`, `context`, `data`,
|
|
39
|
+
`workflows`, and `workflowRuns`.
|
|
40
|
+
|
|
38
41
|
## App Auth
|
|
39
42
|
|
|
40
43
|
Use `agnostic.auth.requireSession(request)` in an application backend to verify
|
|
@@ -43,9 +46,9 @@ the incoming App Auth session through the runtime helper:
|
|
|
43
46
|
```ts
|
|
44
47
|
const session = await agnostic.auth.requireSession(request);
|
|
45
48
|
|
|
46
|
-
await agnostic.
|
|
47
|
-
'
|
|
48
|
-
{
|
|
49
|
+
await agnostic.data.table('orders').records.update(
|
|
50
|
+
'order_123',
|
|
51
|
+
{ values: { status: 'fulfilled' } },
|
|
49
52
|
{ actor: session.actor },
|
|
50
53
|
);
|
|
51
54
|
```
|
|
@@ -79,42 +82,6 @@ await agnostic.data.table('orders').records.update(created.id, {
|
|
|
79
82
|
await agnostic.data.table('orders').records.delete(created.id);
|
|
80
83
|
```
|
|
81
84
|
|
|
82
|
-
## Events
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
await agnostic.events.publish('order.fulfilled', {
|
|
86
|
-
orderId: 'order_123',
|
|
87
|
-
customerId: 'cust_123',
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
await agnostic.events.publishBatch('order.fulfilled', [
|
|
91
|
-
{ payload: { orderId: 'order_123' } },
|
|
92
|
-
{ payload: { orderId: 'order_124' } },
|
|
93
|
-
]);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Jobs
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
await agnostic.jobs.enqueue(
|
|
100
|
-
'send-receipt',
|
|
101
|
-
{ orderId: 'order_123' },
|
|
102
|
-
{ delaySeconds: 30 },
|
|
103
|
-
);
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Gateway
|
|
107
|
-
|
|
108
|
-
```ts
|
|
109
|
-
const result = await agnostic.gateway.call('billing/create-invoice', {
|
|
110
|
-
orderId: 'order_123',
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
if (result.status >= 400) {
|
|
114
|
-
throw new Error('Gateway route failed');
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
85
|
## Workflows
|
|
119
86
|
|
|
120
87
|
```ts
|
|
@@ -133,8 +100,8 @@ After an application backend has verified its App Auth session and business
|
|
|
133
100
|
guardrails, it can pass actor metadata for audit context:
|
|
134
101
|
|
|
135
102
|
```ts
|
|
136
|
-
await agnostic.
|
|
137
|
-
'
|
|
103
|
+
await agnostic.workflows.start(
|
|
104
|
+
'send-receipt',
|
|
138
105
|
{ orderId: 'order_123' },
|
|
139
106
|
{
|
|
140
107
|
actor: {
|
package/package.json
CHANGED
|
@@ -73,57 +73,6 @@ export interface paths {
|
|
|
73
73
|
patch?: never;
|
|
74
74
|
trace?: never;
|
|
75
75
|
};
|
|
76
|
-
"/api/v1/runtime/events/{eventName}": {
|
|
77
|
-
parameters: {
|
|
78
|
-
query?: never;
|
|
79
|
-
header?: never;
|
|
80
|
-
path?: never;
|
|
81
|
-
cookie?: never;
|
|
82
|
-
};
|
|
83
|
-
get?: never;
|
|
84
|
-
put?: never;
|
|
85
|
-
/** Publish a runtime event into a project queue */
|
|
86
|
-
post: operations["runtimeEventsPublish"];
|
|
87
|
-
delete?: never;
|
|
88
|
-
options?: never;
|
|
89
|
-
head?: never;
|
|
90
|
-
patch?: never;
|
|
91
|
-
trace?: never;
|
|
92
|
-
};
|
|
93
|
-
"/api/v1/runtime/jobs/{jobName}": {
|
|
94
|
-
parameters: {
|
|
95
|
-
query?: never;
|
|
96
|
-
header?: never;
|
|
97
|
-
path?: never;
|
|
98
|
-
cookie?: never;
|
|
99
|
-
};
|
|
100
|
-
get?: never;
|
|
101
|
-
put?: never;
|
|
102
|
-
/** Enqueue a runtime job into a project queue */
|
|
103
|
-
post: operations["runtimeJobsEnqueue"];
|
|
104
|
-
delete?: never;
|
|
105
|
-
options?: never;
|
|
106
|
-
head?: never;
|
|
107
|
-
patch?: never;
|
|
108
|
-
trace?: never;
|
|
109
|
-
};
|
|
110
|
-
"/api/v1/runtime/gateway/{routeName}": {
|
|
111
|
-
parameters: {
|
|
112
|
-
query?: never;
|
|
113
|
-
header?: never;
|
|
114
|
-
path?: never;
|
|
115
|
-
cookie?: never;
|
|
116
|
-
};
|
|
117
|
-
get?: never;
|
|
118
|
-
put?: never;
|
|
119
|
-
/** Call a named gateway route in the runtime context */
|
|
120
|
-
post: operations["runtimeGatewayCall"];
|
|
121
|
-
delete?: never;
|
|
122
|
-
options?: never;
|
|
123
|
-
head?: never;
|
|
124
|
-
patch?: never;
|
|
125
|
-
trace?: never;
|
|
126
|
-
};
|
|
127
76
|
"/api/v1/runtime/workflows/{workflowSlug}/runs": {
|
|
128
77
|
parameters: {
|
|
129
78
|
query?: never;
|
|
@@ -468,99 +417,6 @@ export interface components {
|
|
|
468
417
|
capabilities: string[];
|
|
469
418
|
actor?: components["schemas"]["RuntimeActorMetadataDto"] | null;
|
|
470
419
|
};
|
|
471
|
-
RuntimeEnqueueJobDto: {
|
|
472
|
-
/**
|
|
473
|
-
* @example {
|
|
474
|
-
* "orderId": "order-123"
|
|
475
|
-
* }
|
|
476
|
-
*/
|
|
477
|
-
payload?: {
|
|
478
|
-
[key: string]: unknown;
|
|
479
|
-
};
|
|
480
|
-
/** @example 30 */
|
|
481
|
-
delaySeconds?: number;
|
|
482
|
-
/** @example jobs */
|
|
483
|
-
messageGroupId?: string;
|
|
484
|
-
/** @example send-receipt-order-123 */
|
|
485
|
-
messageDeduplicationId?: string;
|
|
486
|
-
};
|
|
487
|
-
RuntimeGatewayCallDto: {
|
|
488
|
-
/**
|
|
489
|
-
* @example {
|
|
490
|
-
* "orderId": "order-123"
|
|
491
|
-
* }
|
|
492
|
-
*/
|
|
493
|
-
payload?: {
|
|
494
|
-
[key: string]: unknown;
|
|
495
|
-
};
|
|
496
|
-
/**
|
|
497
|
-
* @example {
|
|
498
|
-
* "x-request-id": "req-123"
|
|
499
|
-
* }
|
|
500
|
-
*/
|
|
501
|
-
headers?: {
|
|
502
|
-
[key: string]: string;
|
|
503
|
-
};
|
|
504
|
-
/**
|
|
505
|
-
* @example {
|
|
506
|
-
* "preview": "true"
|
|
507
|
-
* }
|
|
508
|
-
*/
|
|
509
|
-
query?: {
|
|
510
|
-
[key: string]: string;
|
|
511
|
-
};
|
|
512
|
-
};
|
|
513
|
-
RuntimeGatewayCallResultDto: {
|
|
514
|
-
/** @example health */
|
|
515
|
-
routeName: string;
|
|
516
|
-
/** @example /health */
|
|
517
|
-
routePath: string;
|
|
518
|
-
/** @example 200 */
|
|
519
|
-
status: number;
|
|
520
|
-
data: {
|
|
521
|
-
[key: string]: unknown;
|
|
522
|
-
};
|
|
523
|
-
/**
|
|
524
|
-
* @example {
|
|
525
|
-
* "content-type": "application/json"
|
|
526
|
-
* }
|
|
527
|
-
*/
|
|
528
|
-
headers: {
|
|
529
|
-
[key: string]: string;
|
|
530
|
-
};
|
|
531
|
-
};
|
|
532
|
-
RuntimePublishEventDto: {
|
|
533
|
-
/**
|
|
534
|
-
* @example {
|
|
535
|
-
* "orderId": "order-123"
|
|
536
|
-
* }
|
|
537
|
-
*/
|
|
538
|
-
payload?: {
|
|
539
|
-
[key: string]: unknown;
|
|
540
|
-
};
|
|
541
|
-
/** @example 5 */
|
|
542
|
-
delaySeconds?: number;
|
|
543
|
-
/** @example orders */
|
|
544
|
-
messageGroupId?: string;
|
|
545
|
-
/** @example order-123-created */
|
|
546
|
-
messageDeduplicationId?: string;
|
|
547
|
-
};
|
|
548
|
-
RuntimeQueuedMessageDto: {
|
|
549
|
-
/** @example order.created */
|
|
550
|
-
name: string;
|
|
551
|
-
/** @example uuid */
|
|
552
|
-
queueId: string;
|
|
553
|
-
/** @example order.created */
|
|
554
|
-
queueName: string;
|
|
555
|
-
/** @example production */
|
|
556
|
-
environment: string;
|
|
557
|
-
/** @example ymq-message-abc123 */
|
|
558
|
-
messageId: string;
|
|
559
|
-
/** @example md5-hash */
|
|
560
|
-
md5OfMessageBody?: string;
|
|
561
|
-
/** @example ymq-send-abc123 */
|
|
562
|
-
requestId?: string;
|
|
563
|
-
};
|
|
564
420
|
RuntimeStartWorkflowDto: {
|
|
565
421
|
/**
|
|
566
422
|
* @example {
|
|
@@ -913,123 +769,6 @@ export interface operations {
|
|
|
913
769
|
};
|
|
914
770
|
};
|
|
915
771
|
};
|
|
916
|
-
runtimeEventsPublish: {
|
|
917
|
-
parameters: {
|
|
918
|
-
query?: never;
|
|
919
|
-
header?: never;
|
|
920
|
-
path: {
|
|
921
|
-
eventName: string;
|
|
922
|
-
};
|
|
923
|
-
cookie?: never;
|
|
924
|
-
};
|
|
925
|
-
requestBody: {
|
|
926
|
-
content: {
|
|
927
|
-
"application/json": components["schemas"]["RuntimePublishEventDto"];
|
|
928
|
-
};
|
|
929
|
-
};
|
|
930
|
-
responses: {
|
|
931
|
-
202: {
|
|
932
|
-
headers: {
|
|
933
|
-
[name: string]: unknown;
|
|
934
|
-
};
|
|
935
|
-
content: {
|
|
936
|
-
"application/json": components["schemas"]["RuntimeQueuedMessageDto"];
|
|
937
|
-
};
|
|
938
|
-
};
|
|
939
|
-
/** @description Invalid runtime token */
|
|
940
|
-
401: {
|
|
941
|
-
headers: {
|
|
942
|
-
[name: string]: unknown;
|
|
943
|
-
};
|
|
944
|
-
content?: never;
|
|
945
|
-
};
|
|
946
|
-
/** @description Missing runtime capability */
|
|
947
|
-
403: {
|
|
948
|
-
headers: {
|
|
949
|
-
[name: string]: unknown;
|
|
950
|
-
};
|
|
951
|
-
content?: never;
|
|
952
|
-
};
|
|
953
|
-
};
|
|
954
|
-
};
|
|
955
|
-
runtimeJobsEnqueue: {
|
|
956
|
-
parameters: {
|
|
957
|
-
query?: never;
|
|
958
|
-
header?: never;
|
|
959
|
-
path: {
|
|
960
|
-
jobName: string;
|
|
961
|
-
};
|
|
962
|
-
cookie?: never;
|
|
963
|
-
};
|
|
964
|
-
requestBody: {
|
|
965
|
-
content: {
|
|
966
|
-
"application/json": components["schemas"]["RuntimeEnqueueJobDto"];
|
|
967
|
-
};
|
|
968
|
-
};
|
|
969
|
-
responses: {
|
|
970
|
-
202: {
|
|
971
|
-
headers: {
|
|
972
|
-
[name: string]: unknown;
|
|
973
|
-
};
|
|
974
|
-
content: {
|
|
975
|
-
"application/json": components["schemas"]["RuntimeQueuedMessageDto"];
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
/** @description Invalid runtime token */
|
|
979
|
-
401: {
|
|
980
|
-
headers: {
|
|
981
|
-
[name: string]: unknown;
|
|
982
|
-
};
|
|
983
|
-
content?: never;
|
|
984
|
-
};
|
|
985
|
-
/** @description Missing runtime capability */
|
|
986
|
-
403: {
|
|
987
|
-
headers: {
|
|
988
|
-
[name: string]: unknown;
|
|
989
|
-
};
|
|
990
|
-
content?: never;
|
|
991
|
-
};
|
|
992
|
-
};
|
|
993
|
-
};
|
|
994
|
-
runtimeGatewayCall: {
|
|
995
|
-
parameters: {
|
|
996
|
-
query?: never;
|
|
997
|
-
header?: never;
|
|
998
|
-
path: {
|
|
999
|
-
routeName: string;
|
|
1000
|
-
};
|
|
1001
|
-
cookie?: never;
|
|
1002
|
-
};
|
|
1003
|
-
requestBody: {
|
|
1004
|
-
content: {
|
|
1005
|
-
"application/json": components["schemas"]["RuntimeGatewayCallDto"];
|
|
1006
|
-
};
|
|
1007
|
-
};
|
|
1008
|
-
responses: {
|
|
1009
|
-
200: {
|
|
1010
|
-
headers: {
|
|
1011
|
-
[name: string]: unknown;
|
|
1012
|
-
};
|
|
1013
|
-
content: {
|
|
1014
|
-
"application/json": components["schemas"]["RuntimeGatewayCallResultDto"];
|
|
1015
|
-
};
|
|
1016
|
-
};
|
|
1017
|
-
/** @description Invalid runtime token */
|
|
1018
|
-
401: {
|
|
1019
|
-
headers: {
|
|
1020
|
-
[name: string]: unknown;
|
|
1021
|
-
};
|
|
1022
|
-
content?: never;
|
|
1023
|
-
};
|
|
1024
|
-
/** @description Missing runtime capability */
|
|
1025
|
-
403: {
|
|
1026
|
-
headers: {
|
|
1027
|
-
[name: string]: unknown;
|
|
1028
|
-
};
|
|
1029
|
-
content?: never;
|
|
1030
|
-
};
|
|
1031
|
-
};
|
|
1032
|
-
};
|
|
1033
772
|
runtimeWorkflowsStartRun: {
|
|
1034
773
|
parameters: {
|
|
1035
774
|
query?: never;
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AgnosticRuntime, RuntimeAppAuthNamespace, RuntimeContextNamespace, RuntimeDataNamespace, RuntimeDataRecordsClient, RuntimeDataTableClient, RuntimeDataViewClient, RuntimeDataViewTableClient,
|
|
1
|
+
export { AgnosticRuntime, RuntimeAppAuthNamespace, RuntimeContextNamespace, RuntimeDataNamespace, RuntimeDataRecordsClient, RuntimeDataTableClient, RuntimeDataViewClient, RuntimeDataViewTableClient, RuntimeWorkflowRunsNamespace, RuntimeWorkflowsNamespace, createAgnosticRuntime, } from './lib/runtime-client';
|
|
2
2
|
export { normalizeApiUrl, resolveRuntimeContext } from './lib/context';
|
|
3
3
|
export { AgnosticRuntimeError } from './lib/errors';
|
|
4
|
-
export type { AgnosticRuntimeConfig, ResolvedRuntimeContext, RuntimeActorMetadata, RuntimeActorType, RuntimeAppAuthActor, RuntimeAppAuthCachePolicy, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthSessionClaims, RuntimeAppAuthUserClaims, RuntimeAppAuthUserResult, RuntimeCreateRecordInput, RuntimeDataField, RuntimeDataViewState,
|
|
4
|
+
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';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgnosticRuntimeError = exports.resolveRuntimeContext = exports.normalizeApiUrl = exports.createAgnosticRuntime = exports.RuntimeWorkflowsNamespace = exports.RuntimeWorkflowRunsNamespace = exports.
|
|
3
|
+
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;
|
|
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,9 +10,6 @@ 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, "RuntimeEventsNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeEventsNamespace; } });
|
|
14
|
-
Object.defineProperty(exports, "RuntimeGatewayNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeGatewayNamespace; } });
|
|
15
|
-
Object.defineProperty(exports, "RuntimeJobsNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeJobsNamespace; } });
|
|
16
13
|
Object.defineProperty(exports, "RuntimeWorkflowRunsNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeWorkflowRunsNamespace; } });
|
|
17
14
|
Object.defineProperty(exports, "RuntimeWorkflowsNamespace", { enumerable: true, get: function () { return runtime_client_1.RuntimeWorkflowsNamespace; } });
|
|
18
15
|
Object.defineProperty(exports, "createAgnosticRuntime", { enumerable: true, get: function () { return runtime_client_1.createAgnosticRuntime; } });
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { type RuntimeOpenApiClient } from './http-client';
|
|
2
|
-
import type { AgnosticRuntimeConfig, ResolvedRuntimeContext, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthUserResult, RuntimeCreateRecordInput,
|
|
2
|
+
import type { AgnosticRuntimeConfig, ResolvedRuntimeContext, RuntimeAppAuthRequestLike, RuntimeAppAuthSession, RuntimeAppAuthUserResult, RuntimeCreateRecordInput, RuntimeIdentityContext, 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 events: RuntimeEventsNamespace;
|
|
8
|
-
readonly jobs: RuntimeJobsNamespace;
|
|
9
|
-
readonly gateway: RuntimeGatewayNamespace;
|
|
10
7
|
readonly workflows: RuntimeWorkflowsNamespace;
|
|
11
8
|
readonly workflowRuns: RuntimeWorkflowRunsNamespace;
|
|
12
9
|
private readonly openapi;
|
|
@@ -56,25 +53,6 @@ export declare class RuntimeDataViewTableClient {
|
|
|
56
53
|
constructor(openapi: RuntimeOpenApiClient, viewId: string);
|
|
57
54
|
window(query?: RuntimeListWindowOptions, options?: RuntimeRequestOptions): Promise<RuntimeTableWindow>;
|
|
58
55
|
}
|
|
59
|
-
export declare class RuntimeEventsNamespace {
|
|
60
|
-
private readonly openapi;
|
|
61
|
-
constructor(openapi: RuntimeOpenApiClient);
|
|
62
|
-
publish(eventName: string, payload?: Record<string, unknown>, options?: RuntimeQueueOptions & RuntimeRequestOptions): Promise<RuntimeQueuedMessage>;
|
|
63
|
-
publishBatch(eventName: string, messages: Array<{
|
|
64
|
-
payload?: Record<string, unknown>;
|
|
65
|
-
options?: RuntimeQueueOptions & RuntimeRequestOptions;
|
|
66
|
-
}>, options?: RuntimeRequestOptions): Promise<RuntimeQueuedMessage[]>;
|
|
67
|
-
}
|
|
68
|
-
export declare class RuntimeJobsNamespace {
|
|
69
|
-
private readonly openapi;
|
|
70
|
-
constructor(openapi: RuntimeOpenApiClient);
|
|
71
|
-
enqueue(jobName: string, payload?: Record<string, unknown>, options?: RuntimeQueueOptions & RuntimeRequestOptions): Promise<RuntimeQueuedMessage>;
|
|
72
|
-
}
|
|
73
|
-
export declare class RuntimeGatewayNamespace {
|
|
74
|
-
private readonly openapi;
|
|
75
|
-
constructor(openapi: RuntimeOpenApiClient);
|
|
76
|
-
call(routeName: string, payload?: Record<string, unknown>, options?: RuntimeGatewayCallOptions): Promise<RuntimeGatewayCallResult>;
|
|
77
|
-
}
|
|
78
56
|
export declare class RuntimeWorkflowsNamespace {
|
|
79
57
|
private readonly openapi;
|
|
80
58
|
private readonly workflowRuns;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RuntimeWorkflowRunsNamespace = exports.RuntimeWorkflowsNamespace = exports.
|
|
3
|
+
exports.RuntimeWorkflowRunsNamespace = exports.RuntimeWorkflowsNamespace = exports.RuntimeDataViewTableClient = exports.RuntimeDataViewClient = exports.RuntimeDataRecordsClient = exports.RuntimeDataTableClient = 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");
|
|
@@ -11,9 +11,6 @@ const AUTH_CONTEXT_PATH = '/api/v1/runtime/auth/context';
|
|
|
11
11
|
const DATA_RECORDS_PATH = '/api/v1/runtime/data/tables/{tableName}/records';
|
|
12
12
|
const DATA_RECORD_PATH = '/api/v1/runtime/data/tables/{tableName}/records/{recordId}';
|
|
13
13
|
const DATA_VIEW_WINDOW_PATH = '/api/v1/runtime/data/views/{viewId}/table/window';
|
|
14
|
-
const EVENTS_PATH = '/api/v1/runtime/events/{eventName}';
|
|
15
|
-
const JOBS_PATH = '/api/v1/runtime/jobs/{jobName}';
|
|
16
|
-
const GATEWAY_PATH = '/api/v1/runtime/gateway/{routeName}';
|
|
17
14
|
const WORKFLOWS_START_PATH = '/api/v1/runtime/workflows/{workflowSlug}/runs';
|
|
18
15
|
const WORKFLOW_RUN_PATH = '/api/v1/runtime/workflow-runs/{runId}';
|
|
19
16
|
const WORKFLOW_RUN_STEPS_PATH = '/api/v1/runtime/workflow-runs/{runId}/steps';
|
|
@@ -35,9 +32,6 @@ class AgnosticRuntime {
|
|
|
35
32
|
this.auth = new RuntimeAppAuthNamespace(this.openapi);
|
|
36
33
|
this.context = new RuntimeContextNamespace(this.openapi);
|
|
37
34
|
this.data = new RuntimeDataNamespace(this.openapi);
|
|
38
|
-
this.events = new RuntimeEventsNamespace(this.openapi);
|
|
39
|
-
this.jobs = new RuntimeJobsNamespace(this.openapi);
|
|
40
|
-
this.gateway = new RuntimeGatewayNamespace(this.openapi);
|
|
41
35
|
this.workflowRuns = new RuntimeWorkflowRunsNamespace(this.openapi);
|
|
42
36
|
this.workflows = new RuntimeWorkflowsNamespace(this.openapi, this.workflowRuns);
|
|
43
37
|
}
|
|
@@ -184,74 +178,6 @@ class RuntimeDataViewTableClient {
|
|
|
184
178
|
}
|
|
185
179
|
}
|
|
186
180
|
exports.RuntimeDataViewTableClient = RuntimeDataViewTableClient;
|
|
187
|
-
class RuntimeEventsNamespace {
|
|
188
|
-
constructor(openapi) {
|
|
189
|
-
this.openapi = openapi;
|
|
190
|
-
}
|
|
191
|
-
async publish(eventName, payload = {}, options = {}) {
|
|
192
|
-
const result = await this.openapi.POST(EVENTS_PATH, {
|
|
193
|
-
body: {
|
|
194
|
-
delaySeconds: options.delaySeconds,
|
|
195
|
-
messageDeduplicationId: options.messageDeduplicationId,
|
|
196
|
-
messageGroupId: options.messageGroupId,
|
|
197
|
-
payload,
|
|
198
|
-
},
|
|
199
|
-
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
200
|
-
params: {
|
|
201
|
-
path: { eventName },
|
|
202
|
-
},
|
|
203
|
-
});
|
|
204
|
-
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to publish runtime event');
|
|
205
|
-
}
|
|
206
|
-
async publishBatch(eventName, messages, options) {
|
|
207
|
-
return Promise.all(messages.map((message) => this.publish(eventName, message.payload ?? {}, {
|
|
208
|
-
...(options ?? {}),
|
|
209
|
-
...(message.options ?? {}),
|
|
210
|
-
})));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
exports.RuntimeEventsNamespace = RuntimeEventsNamespace;
|
|
214
|
-
class RuntimeJobsNamespace {
|
|
215
|
-
constructor(openapi) {
|
|
216
|
-
this.openapi = openapi;
|
|
217
|
-
}
|
|
218
|
-
async enqueue(jobName, payload = {}, options = {}) {
|
|
219
|
-
const result = await this.openapi.POST(JOBS_PATH, {
|
|
220
|
-
body: {
|
|
221
|
-
delaySeconds: options.delaySeconds,
|
|
222
|
-
messageDeduplicationId: options.messageDeduplicationId,
|
|
223
|
-
messageGroupId: options.messageGroupId,
|
|
224
|
-
payload,
|
|
225
|
-
},
|
|
226
|
-
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
227
|
-
params: {
|
|
228
|
-
path: { jobName },
|
|
229
|
-
},
|
|
230
|
-
});
|
|
231
|
-
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to enqueue runtime job');
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
exports.RuntimeJobsNamespace = RuntimeJobsNamespace;
|
|
235
|
-
class RuntimeGatewayNamespace {
|
|
236
|
-
constructor(openapi) {
|
|
237
|
-
this.openapi = openapi;
|
|
238
|
-
}
|
|
239
|
-
async call(routeName, payload = {}, options = {}) {
|
|
240
|
-
const result = await this.openapi.POST(GATEWAY_PATH, {
|
|
241
|
-
body: {
|
|
242
|
-
headers: options.headers,
|
|
243
|
-
payload,
|
|
244
|
-
query: options.query,
|
|
245
|
-
},
|
|
246
|
-
headers: (0, http_client_1.runtimeRequestHeaders)(options),
|
|
247
|
-
params: {
|
|
248
|
-
path: { routeName },
|
|
249
|
-
},
|
|
250
|
-
});
|
|
251
|
-
return (0, http_client_1.unwrapRuntimeResult)(result, 'Failed to call runtime gateway route');
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
exports.RuntimeGatewayNamespace = RuntimeGatewayNamespace;
|
|
255
181
|
class RuntimeWorkflowsNamespace {
|
|
256
182
|
constructor(openapi, workflowRuns) {
|
|
257
183
|
this.openapi = openapi;
|
package/src/lib/types.d.ts
CHANGED
|
@@ -149,31 +149,6 @@ export interface RuntimeTableWindow {
|
|
|
149
149
|
totalCount: number;
|
|
150
150
|
viewState: RuntimeDataViewState;
|
|
151
151
|
}
|
|
152
|
-
export interface RuntimeQueueOptions {
|
|
153
|
-
delaySeconds?: number;
|
|
154
|
-
messageDeduplicationId?: string;
|
|
155
|
-
messageGroupId?: string;
|
|
156
|
-
}
|
|
157
|
-
export interface RuntimeQueuedMessage {
|
|
158
|
-
name: string;
|
|
159
|
-
queueId: string;
|
|
160
|
-
queueName: string;
|
|
161
|
-
environment: string;
|
|
162
|
-
messageId: string;
|
|
163
|
-
md5OfMessageBody?: string;
|
|
164
|
-
requestId?: string;
|
|
165
|
-
}
|
|
166
|
-
export interface RuntimeGatewayCallOptions extends RuntimeRequestOptions {
|
|
167
|
-
headers?: Record<string, string>;
|
|
168
|
-
query?: Record<string, string>;
|
|
169
|
-
}
|
|
170
|
-
export interface RuntimeGatewayCallResult {
|
|
171
|
-
routeName: string;
|
|
172
|
-
routePath: string;
|
|
173
|
-
status: number;
|
|
174
|
-
data: unknown;
|
|
175
|
-
headers: Record<string, string>;
|
|
176
|
-
}
|
|
177
152
|
export type WorkflowRunStatus = 'queued' | 'running' | 'waiting' | 'succeeded' | 'failed' | 'cancelled';
|
|
178
153
|
export interface RuntimeWorkflowRun {
|
|
179
154
|
id: string;
|