@sequenceholdings/artifact-studio 0.4.0 → 0.6.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/README.md +35 -1
- package/VERSION-PIN.md +29 -0
- package/dist/active-deploy-policy.d.ts +9 -3
- package/dist/active-deploy-policy.js +20 -8
- package/dist/artifact-env-bindings.d.ts +9 -0
- package/dist/artifact-env-bindings.js +32 -0
- package/dist/build.js +6 -0
- package/dist/cli.js +62 -13
- package/dist/deployment-validation.d.ts +2 -0
- package/dist/deployment-validation.js +2 -0
- package/dist/dev-link.js +28 -2
- package/dist/env-binding-scan.d.ts +10 -0
- package/dist/env-binding-scan.js +179 -0
- package/dist/env-bindings.d.ts +52 -0
- package/dist/env-bindings.js +180 -0
- package/dist/gateway/control.d.ts +33 -0
- package/dist/gateway/control.js +29 -0
- package/dist/gateway/hosted-proxy.d.ts +5 -0
- package/dist/gateway/hosted-proxy.js +4 -1
- package/dist/gateway/lattice-invoke.d.ts +48 -0
- package/dist/gateway/lattice-invoke.js +245 -0
- package/dist/gateway/lattice-upstream.d.ts +38 -0
- package/dist/gateway/lattice-upstream.js +136 -0
- package/dist/gateway/server.js +2 -3
- package/dist/gateway/session.d.ts +3 -1
- package/dist/gateway/session.js +10 -3
- package/dist/manifest-next.d.ts +55 -0
- package/dist/manifest-next.js +35 -2
- package/dist/manifest-static.d.ts +35 -0
- package/dist/manifest-static.js +12 -0
- package/dist/manifest.d.ts +48 -0
- package/dist/next-build.d.ts +2 -1
- package/dist/next-build.js +12 -7
- package/dist/offline/cache.d.ts +4 -0
- package/dist/offline/cache.js +7 -0
- package/dist/offline/connector.d.ts +28 -0
- package/dist/offline/connector.js +122 -0
- package/dist/offline/crypto.d.ts +5 -0
- package/dist/offline/crypto.js +24 -0
- package/dist/offline/index.d.ts +8 -0
- package/dist/offline/index.js +7 -0
- package/dist/offline/indexed-db.d.ts +10 -0
- package/dist/offline/indexed-db.js +104 -0
- package/dist/offline/management-types.d.ts +25 -0
- package/dist/offline/management-types.js +1 -0
- package/dist/offline/outbox.d.ts +7 -0
- package/dist/offline/outbox.js +46 -0
- package/dist/offline/replay.d.ts +25 -0
- package/dist/offline/replay.js +192 -0
- package/dist/offline/secure-store.d.ts +6 -0
- package/dist/offline/secure-store.js +51 -0
- package/dist/offline/types.d.ts +162 -0
- package/dist/offline/types.js +1 -0
- package/dist/orm-json-scalars.d.ts +21 -0
- package/dist/orm-json-scalars.js +21 -0
- package/dist/runtime-contracts.d.ts +7 -7
- package/dist/runtime-contracts.js +1 -1
- package/dist/sdk-orm.d.ts +7 -1
- package/dist/sdk-orm.js +12 -5
- package/dist/sdk.d.ts +134 -1
- package/dist/server/api-client.d.ts +26 -0
- package/dist/server/api-client.js +38 -0
- package/dist/server/broker-contract.d.ts +191 -5
- package/dist/server/broker-contract.js +142 -1
- package/dist/server/client.d.ts +82 -47
- package/dist/server/client.js +138 -59
- package/dist/server/connection-retry.d.ts +12 -0
- package/dist/server/connection-retry.js +40 -0
- package/dist/server/errors.d.ts +61 -0
- package/dist/server/errors.js +89 -0
- package/dist/server/external-context.d.ts +21 -0
- package/dist/server/external-context.js +19 -0
- package/dist/server/internal/signed-token.d.ts +15 -0
- package/dist/server/internal/signed-token.js +67 -0
- package/dist/server/internal/v1-context.d.ts +18 -0
- package/dist/server/internal/v1-context.js +26 -0
- package/dist/server/internal/verify-any.d.ts +22 -0
- package/dist/server/internal/verify-any.js +53 -0
- package/dist/server/logger.d.ts +1 -1
- package/dist/server/managed-server-path.d.ts +6 -0
- package/dist/server/managed-server-path.js +14 -0
- package/dist/server/principal.d.ts +48 -0
- package/dist/server/principal.js +39 -0
- package/dist/server/processes.d.ts +290 -0
- package/dist/server/processes.js +56 -0
- package/dist/server/request-context.d.ts +121 -3
- package/dist/server/request-context.js +111 -33
- package/dist/server/testing.d.ts +40 -0
- package/dist/server/testing.js +86 -0
- package/dist/server.d.ts +13 -4
- package/dist/server.js +6 -2
- package/dist/source-resolver.d.ts +9 -2
- package/dist/source-resolver.js +55 -8
- package/dist/templates/nextjs/AGENTS.md +10 -0
- package/dist/templates/nextjs/CLAUDE.md +1 -0
- package/dist/templates/nextjs/README.md +88 -0
- package/dist/templates/nextjs/package.json +3 -1
- package/dist/templates/nextjs/tests/server.test.mjs +25 -0
- package/dist/templates/react-vite/AGENTS.md +8 -88
- package/dist/templates/react-vite/CLAUDE.md +0 -6
- package/dist/templates/react-vite/package.json +1 -1
- package/dist/templates/react-vite/src/App.tsx +37 -14
- package/dist/templates/react-vite/src/styles.css +10 -0
- package/package.json +15 -3
- package/templates/nextjs/AGENTS.md +10 -0
- package/templates/nextjs/CLAUDE.md +1 -0
- package/templates/nextjs/README.md +88 -0
- package/templates/nextjs/package.json +3 -1
- package/templates/nextjs/tests/server.test.mjs +25 -0
- package/templates/react-vite/AGENTS.md +8 -88
- package/templates/react-vite/CLAUDE.md +0 -6
- package/templates/react-vite/package.json +1 -1
- package/templates/react-vite/src/App.tsx +37 -14
- package/templates/react-vite/src/styles.css +10 -0
|
@@ -72,9 +72,9 @@ export declare const artifactOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
72
72
|
projectId: z.ZodString;
|
|
73
73
|
environment: z.ZodString;
|
|
74
74
|
kind: z.ZodEnum<{
|
|
75
|
-
preview: "preview";
|
|
76
75
|
build: "build";
|
|
77
76
|
deploy: "deploy";
|
|
77
|
+
preview: "preview";
|
|
78
78
|
rollback: "rollback";
|
|
79
79
|
suspend: "suspend";
|
|
80
80
|
delete: "delete";
|
|
@@ -92,9 +92,9 @@ export declare const artifactOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
92
92
|
projectId: z.ZodString;
|
|
93
93
|
environment: z.ZodString;
|
|
94
94
|
kind: z.ZodEnum<{
|
|
95
|
-
preview: "preview";
|
|
96
95
|
build: "build";
|
|
97
96
|
deploy: "deploy";
|
|
97
|
+
preview: "preview";
|
|
98
98
|
rollback: "rollback";
|
|
99
99
|
suspend: "suspend";
|
|
100
100
|
delete: "delete";
|
|
@@ -109,9 +109,9 @@ export declare const artifactOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
109
109
|
projectId: z.ZodString;
|
|
110
110
|
environment: z.ZodString;
|
|
111
111
|
kind: z.ZodEnum<{
|
|
112
|
-
preview: "preview";
|
|
113
112
|
build: "build";
|
|
114
113
|
deploy: "deploy";
|
|
114
|
+
preview: "preview";
|
|
115
115
|
rollback: "rollback";
|
|
116
116
|
suspend: "suspend";
|
|
117
117
|
delete: "delete";
|
|
@@ -130,9 +130,9 @@ export declare const artifactOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
130
130
|
projectId: z.ZodString;
|
|
131
131
|
environment: z.ZodString;
|
|
132
132
|
kind: z.ZodEnum<{
|
|
133
|
-
preview: "preview";
|
|
134
133
|
build: "build";
|
|
135
134
|
deploy: "deploy";
|
|
135
|
+
preview: "preview";
|
|
136
136
|
rollback: "rollback";
|
|
137
137
|
suspend: "suspend";
|
|
138
138
|
delete: "delete";
|
|
@@ -147,9 +147,9 @@ export declare const artifactOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
147
147
|
projectId: z.ZodString;
|
|
148
148
|
environment: z.ZodString;
|
|
149
149
|
kind: z.ZodEnum<{
|
|
150
|
-
preview: "preview";
|
|
151
150
|
build: "build";
|
|
152
151
|
deploy: "deploy";
|
|
152
|
+
preview: "preview";
|
|
153
153
|
rollback: "rollback";
|
|
154
154
|
suspend: "suspend";
|
|
155
155
|
delete: "delete";
|
|
@@ -164,9 +164,9 @@ export declare const artifactRuntimeSessionSchema: z.ZodObject<{
|
|
|
164
164
|
projectId: z.ZodString;
|
|
165
165
|
environment: z.ZodString;
|
|
166
166
|
mode: z.ZodEnum<{
|
|
167
|
+
local: "local";
|
|
167
168
|
preview: "preview";
|
|
168
169
|
published: "published";
|
|
169
|
-
local: "local";
|
|
170
170
|
}>;
|
|
171
171
|
origin: z.ZodString;
|
|
172
172
|
parentOrigin: z.ZodString;
|
|
@@ -187,12 +187,12 @@ export declare const artifactLocalDevSessionSchema: z.ZodObject<{
|
|
|
187
187
|
sourceRevision: z.ZodOptional<z.ZodString>;
|
|
188
188
|
revision: z.ZodNumber;
|
|
189
189
|
state: z.ZodEnum<{
|
|
190
|
+
offline: "offline";
|
|
190
191
|
failed: "failed";
|
|
191
192
|
starting: "starting";
|
|
192
193
|
compiling: "compiling";
|
|
193
194
|
ready: "ready";
|
|
194
195
|
reconnecting: "reconnecting";
|
|
195
|
-
offline: "offline";
|
|
196
196
|
revoked: "revoked";
|
|
197
197
|
expired: "expired";
|
|
198
198
|
}>;
|
|
@@ -20,7 +20,7 @@ const imageReferenceSchema = z.string().max(1024).regex(/^[a-z0-9]+(?:[.-][a-z0-
|
|
|
20
20
|
const excludedSourceSegments = new Set([
|
|
21
21
|
'.git', 'node_modules', '.next', '.npmrc', '.netrc', '.aws', '.ssh', '.config',
|
|
22
22
|
'dist', '.artifact-studio', '.git-credentials', '.pypirc', '.azure', '.gcloud', '.doppler',
|
|
23
|
-
'.turbo', 'coverage', '.docker',
|
|
23
|
+
'.turbo', 'coverage', '.docker', '.seq-next-output.json',
|
|
24
24
|
]);
|
|
25
25
|
/** Shared upload exclusion policy. Content scanning and filesystem containment remain separate checks. */
|
|
26
26
|
export function isExcludedArtifactSourcePath({ path }) {
|
package/dist/sdk-orm.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OperationExecutor } from '@sequenceholdings/orm/client';
|
|
2
|
+
import { type ArtifactOrmJsonScalars } from './orm-json-scalars.js';
|
|
2
3
|
import { type SequenceApi } from './sdk.js';
|
|
3
4
|
export interface ArtifactOrmExecutorConfig {
|
|
4
5
|
namespace: string;
|
|
@@ -8,6 +9,11 @@ export interface ArtifactOrmExecutorConfig {
|
|
|
8
9
|
sdk?: {
|
|
9
10
|
api: Pick<SequenceApi, 'fetch'>;
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* `lossless-v1` returns numeric and bigint values as strings instead of JSON numbers.
|
|
14
|
+
* The executor refuses any successful result the host does not acknowledge in that form.
|
|
15
|
+
*/
|
|
16
|
+
jsonScalars?: ArtifactOrmJsonScalars;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
19
|
* Execute persisted operations as the signed-in Artifact user. The host owns
|
|
@@ -15,4 +21,4 @@ export interface ArtifactOrmExecutorConfig {
|
|
|
15
21
|
* Declare the namespace path in capabilities.api.write (queries also use POST).
|
|
16
22
|
* Namespace grants, capabilities, row policies, and write checks still apply.
|
|
17
23
|
*/
|
|
18
|
-
export declare function createArtifactOrmExecutor({ namespace, manifest, sdk }: ArtifactOrmExecutorConfig): OperationExecutor;
|
|
24
|
+
export declare function createArtifactOrmExecutor({ namespace, manifest, sdk, jsonScalars }: ArtifactOrmExecutorConfig): OperationExecutor;
|
package/dist/sdk-orm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createOperationExecutorWithTransport, OrmClientError } from '@sequenceholdings/orm/client';
|
|
2
|
+
import { assertJsonScalarsAcknowledged, ORM_JSON_SCALARS_HEADER } from './orm-json-scalars.js';
|
|
2
3
|
import { seq } from './sdk.js';
|
|
3
4
|
/**
|
|
4
5
|
* Execute persisted operations as the signed-in Artifact user. The host owns
|
|
@@ -6,16 +7,22 @@ import { seq } from './sdk.js';
|
|
|
6
7
|
* Declare the namespace path in capabilities.api.write (queries also use POST).
|
|
7
8
|
* Namespace grants, capabilities, row policies, and write checks still apply.
|
|
8
9
|
*/
|
|
9
|
-
export function createArtifactOrmExecutor({ namespace, manifest, sdk = seq }) {
|
|
10
|
+
export function createArtifactOrmExecutor({ namespace, manifest, sdk = seq, jsonScalars }) {
|
|
10
11
|
if (!sdk || typeof sdk.api?.fetch !== 'function') {
|
|
11
12
|
throw new OrmClientError('Artifact ORM requires the authenticated Artifact Studio host; open the deployed artifact or its Preview');
|
|
12
13
|
}
|
|
13
14
|
return createOperationExecutorWithTransport({
|
|
14
15
|
namespace,
|
|
15
16
|
manifest,
|
|
16
|
-
transport: ({ namespace: target, op, variables }) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
transport: async ({ namespace: target, op, variables, idempotencyKey }) => {
|
|
18
|
+
const response = await sdk.api.fetch(`/api/data/v2/${target}`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: { op, variables, ...(idempotencyKey === undefined ? {} : { idempotencyKey }) },
|
|
21
|
+
...(jsonScalars ? { headers: { [ORM_JSON_SCALARS_HEADER]: jsonScalars } } : {}),
|
|
22
|
+
});
|
|
23
|
+
if (response.ok)
|
|
24
|
+
assertJsonScalarsAcknowledged({ requested: jsonScalars, acknowledged: response.headers?.[ORM_JSON_SCALARS_HEADER], status: response.status });
|
|
25
|
+
return response;
|
|
26
|
+
},
|
|
20
27
|
});
|
|
21
28
|
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { SequenceOfflineManagement } from './offline/management-types.js';
|
|
2
|
+
export type { SequenceOfflineManagement, SequenceOfflineManagementStatus, SequenceOfflineManagementIssue } from './offline/management-types.js';
|
|
1
3
|
import { type StartStorageUpload, type StorageUploadSession } from '@sequenceholdings/storage';
|
|
2
4
|
export { createArtifactOrmExecutor, type ArtifactOrmExecutorConfig } from './sdk-orm.js';
|
|
5
|
+
export type { ArtifactOrmJsonScalars } from './orm-json-scalars.js';
|
|
3
6
|
export interface SequenceStorageOptions {
|
|
4
7
|
signal?: AbortSignal;
|
|
5
8
|
timeoutMs?: number;
|
|
@@ -48,6 +51,57 @@ export interface SequenceApi {
|
|
|
48
51
|
patch<TBody = unknown>(path: string, body?: unknown): Promise<TBody>;
|
|
49
52
|
delete<TBody = unknown>(path: string, body?: unknown): Promise<TBody>;
|
|
50
53
|
}
|
|
54
|
+
export type SequenceOfflineRequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
55
|
+
export interface SequenceOfflineRequest {
|
|
56
|
+
method: SequenceOfflineRequestMethod;
|
|
57
|
+
path: string;
|
|
58
|
+
body?: unknown;
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
export interface SequenceOfflineConnectorExecution<TBody = unknown> {
|
|
62
|
+
request: SequenceOfflineRequest;
|
|
63
|
+
/**
|
|
64
|
+
* Invoke the authenticated Artifact Studio bridge. Authentication remains
|
|
65
|
+
* host-owned and is never exposed to the connector or durable storage.
|
|
66
|
+
*/
|
|
67
|
+
network: (request: SequenceOfflineRequest) => Promise<SequenceApiFetchResponse<TBody>>;
|
|
68
|
+
}
|
|
69
|
+
export interface SequenceOfflineNetwork {
|
|
70
|
+
execute<TBody = unknown>(request: SequenceOfflineRequest): Promise<SequenceApiFetchResponse<TBody>>;
|
|
71
|
+
}
|
|
72
|
+
export interface SequenceOfflineRequestConnector {
|
|
73
|
+
execute<TBody = unknown>(execution: SequenceOfflineConnectorExecution<TBody>): Promise<SequenceApiFetchResponse<TBody>>;
|
|
74
|
+
/**
|
|
75
|
+
* Receives a capability-gated bridge executor for durable outbox replay.
|
|
76
|
+
* It carries no bearer token and remains subject to the active manifest.
|
|
77
|
+
*/
|
|
78
|
+
attach?(context: {
|
|
79
|
+
network: SequenceOfflineNetwork;
|
|
80
|
+
}): void | (() => void);
|
|
81
|
+
}
|
|
82
|
+
export interface SequenceOffline {
|
|
83
|
+
registerManagement(adapter: SequenceOfflineManagement): () => void;
|
|
84
|
+
openSettings(): Promise<void>;
|
|
85
|
+
isManagementSession(): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Install the artifact's request policy beneath seq.api. Returns a disposer
|
|
88
|
+
* that restores the network-only default when it still owns registration.
|
|
89
|
+
*/
|
|
90
|
+
registerConnector(registration: {
|
|
91
|
+
connector: SequenceOfflineRequestConnector;
|
|
92
|
+
}): () => void;
|
|
93
|
+
/** Cache the current artifact shell on this device after the user's opt-in. */
|
|
94
|
+
enroll(options?: {
|
|
95
|
+
maxAgeHours?: number;
|
|
96
|
+
}): Promise<void>;
|
|
97
|
+
/** Remove this artifact's cached shell. App-owned data should be wiped too. */
|
|
98
|
+
remove(): Promise<void>;
|
|
99
|
+
status(): Promise<{
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
enrolled: boolean;
|
|
102
|
+
expiresAt?: number;
|
|
103
|
+
}>;
|
|
104
|
+
}
|
|
51
105
|
export interface SequenceFunctions {
|
|
52
106
|
invoke<TOutput = unknown>(id: string, params?: Record<string, unknown>, traceAction?: {
|
|
53
107
|
id: string;
|
|
@@ -135,6 +189,7 @@ export interface SequenceHost {
|
|
|
135
189
|
export interface SequenceArtifactSdk {
|
|
136
190
|
storage: SequenceStorage;
|
|
137
191
|
api: SequenceApi;
|
|
192
|
+
offline: SequenceOffline;
|
|
138
193
|
ai: {
|
|
139
194
|
fetch(path: string, options?: SequenceApiFetchOptions): Promise<Response>;
|
|
140
195
|
};
|
|
@@ -211,6 +266,73 @@ export declare function createArtifactStorageClient(sdk?: SequenceArtifactSdk):
|
|
|
211
266
|
versionId: string | null;
|
|
212
267
|
maxBytes: number;
|
|
213
268
|
}>;
|
|
269
|
+
startBatch: (items: StartStorageUpload[]) => Promise<{
|
|
270
|
+
items: {
|
|
271
|
+
id: string;
|
|
272
|
+
fileId: string;
|
|
273
|
+
uploadUrl: string | null;
|
|
274
|
+
expiresAt: string;
|
|
275
|
+
state: "pending" | "complete" | "aborted";
|
|
276
|
+
versionId: string | null;
|
|
277
|
+
maxBytes: number;
|
|
278
|
+
}[];
|
|
279
|
+
}>;
|
|
280
|
+
list: () => Promise<{
|
|
281
|
+
items: {
|
|
282
|
+
id: string;
|
|
283
|
+
fileId: string;
|
|
284
|
+
name: string;
|
|
285
|
+
state: "pending" | "complete" | "aborted";
|
|
286
|
+
expiresAt: string;
|
|
287
|
+
maxBytes: number;
|
|
288
|
+
expectedSize: number | null;
|
|
289
|
+
versionId: string | null;
|
|
290
|
+
}[];
|
|
291
|
+
limits: {
|
|
292
|
+
perPrincipal: number;
|
|
293
|
+
perWorkspace: number;
|
|
294
|
+
};
|
|
295
|
+
}>;
|
|
296
|
+
reconcile: (input?: {
|
|
297
|
+
abortIncomplete?: boolean;
|
|
298
|
+
}) => Promise<{
|
|
299
|
+
completed: {
|
|
300
|
+
id: string;
|
|
301
|
+
fileId: string;
|
|
302
|
+
name: string;
|
|
303
|
+
state: "pending" | "complete" | "aborted";
|
|
304
|
+
expiresAt: string;
|
|
305
|
+
maxBytes: number;
|
|
306
|
+
expectedSize: number | null;
|
|
307
|
+
versionId: string | null;
|
|
308
|
+
code: string;
|
|
309
|
+
message: string;
|
|
310
|
+
}[];
|
|
311
|
+
aborted: {
|
|
312
|
+
id: string;
|
|
313
|
+
fileId: string;
|
|
314
|
+
name: string;
|
|
315
|
+
state: "pending" | "complete" | "aborted";
|
|
316
|
+
expiresAt: string;
|
|
317
|
+
maxBytes: number;
|
|
318
|
+
expectedSize: number | null;
|
|
319
|
+
versionId: string | null;
|
|
320
|
+
code: string;
|
|
321
|
+
message: string;
|
|
322
|
+
}[];
|
|
323
|
+
pending: {
|
|
324
|
+
id: string;
|
|
325
|
+
fileId: string;
|
|
326
|
+
name: string;
|
|
327
|
+
state: "pending" | "complete" | "aborted";
|
|
328
|
+
expiresAt: string;
|
|
329
|
+
maxBytes: number;
|
|
330
|
+
expectedSize: number | null;
|
|
331
|
+
versionId: string | null;
|
|
332
|
+
code: string;
|
|
333
|
+
message: string;
|
|
334
|
+
}[];
|
|
335
|
+
}>;
|
|
214
336
|
};
|
|
215
337
|
get: () => Promise<{
|
|
216
338
|
id: string;
|
|
@@ -278,7 +400,9 @@ export declare function createArtifactStorageClient(sdk?: SequenceArtifactSdk):
|
|
|
278
400
|
size: number | null;
|
|
279
401
|
contentType: string | null;
|
|
280
402
|
}>;
|
|
281
|
-
createFolder: (name: string, parentId
|
|
403
|
+
createFolder: (name: string, parentId
|
|
404
|
+
/** The specific step run (the assignee's task) — the step-scoped id reviewers hold access to. */
|
|
405
|
+
? /** The specific step run (the assignee's task) — the step-scoped id reviewers hold access to. */: string | null, { idempotencyKey, }?: {
|
|
282
406
|
idempotencyKey?: string;
|
|
283
407
|
}) => Promise<{
|
|
284
408
|
id: string;
|
|
@@ -489,6 +613,15 @@ export declare function createArtifactStorageClient(sdk?: SequenceArtifactSdk):
|
|
|
489
613
|
capabilities: () => Promise<{
|
|
490
614
|
canProvision: boolean;
|
|
491
615
|
uploadMethods: string[];
|
|
616
|
+
pendingUploads: {
|
|
617
|
+
perPrincipal: number;
|
|
618
|
+
perWorkspace: number;
|
|
619
|
+
};
|
|
620
|
+
uploadBatchLimit: number;
|
|
621
|
+
importConcurrency: {
|
|
622
|
+
default: number;
|
|
623
|
+
max: number;
|
|
624
|
+
};
|
|
492
625
|
}>;
|
|
493
626
|
list: (options?: import("@sequenceholdings/storage").StorageListOptions) => Promise<{
|
|
494
627
|
items: {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SequenceApiFetchResponse } from '../sdk.js';
|
|
2
|
+
import { type ArtifactServerMode, type ArtifactServerRequest } from './broker-contract.js';
|
|
3
|
+
export interface ArtifactServerFetchOptions {
|
|
4
|
+
method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
5
|
+
body?: unknown;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
/** Sends one broker operation; the client's transport (retries, the external-principal gate). */
|
|
9
|
+
export type ArtifactBrokerRequest = (operation: ArtifactServerRequest, options?: {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}) => Promise<Response>;
|
|
12
|
+
/** `client.api`: Atlas routes reached through the broker as `api` operations. */
|
|
13
|
+
export declare function createApiClient({ mode, request, json }: {
|
|
14
|
+
mode: ArtifactServerMode;
|
|
15
|
+
request: ArtifactBrokerRequest;
|
|
16
|
+
json: (operation: ArtifactServerRequest, signal?: AbortSignal) => Promise<unknown>;
|
|
17
|
+
}): {
|
|
18
|
+
request: (path: string, options?: ArtifactServerFetchOptions) => Promise<Response>;
|
|
19
|
+
fetch<TBody = unknown>(path: string, options?: ArtifactServerFetchOptions): Promise<SequenceApiFetchResponse<TBody>>;
|
|
20
|
+
stream(path: string, options?: ArtifactServerFetchOptions): Promise<ReadableStream<Uint8Array<ArrayBuffer>>>;
|
|
21
|
+
get: <T = unknown>(path: string) => Promise<T>;
|
|
22
|
+
post: <T = unknown>(path: string, body?: unknown) => Promise<T>;
|
|
23
|
+
put: <T = unknown>(path: string, body?: unknown) => Promise<T>;
|
|
24
|
+
patch: <T = unknown>(path: string, body?: unknown) => Promise<T>;
|
|
25
|
+
delete: <T = unknown>(path: string, body?: unknown) => Promise<T>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { artifactServerRequestSchema } from './broker-contract.js';
|
|
2
|
+
import { ArtifactServerError, stepUpErrorFromResponse } from './errors.js';
|
|
3
|
+
const responseHeaders = ['content-type', 'content-disposition', 'content-length', 'retry-after'];
|
|
4
|
+
/** `client.api`: Atlas routes reached through the broker as `api` operations. */
|
|
5
|
+
export function createApiClient({ mode, request, json }) {
|
|
6
|
+
const operation = (path, options = {}) => artifactServerRequestSchema.parse({ operation: 'api', mode, method: options.method ?? 'GET', path, body: options.body });
|
|
7
|
+
const fetchResponse = (path, options = {}) => request(operation(path, options), { signal: options.signal });
|
|
8
|
+
const typedJson = async (path, options = {}) => {
|
|
9
|
+
// Explicit caller result types match the existing browser SDK; the server validates endpoint schemas.
|
|
10
|
+
return await json(operation(path, options), options.signal);
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
request: fetchResponse,
|
|
14
|
+
async fetch(path, options = {}) {
|
|
15
|
+
const response = await fetchResponse(path, options);
|
|
16
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
17
|
+
const body = response.status === 204 ? undefined : contentType.includes('json') ? await response.json() : await response.arrayBuffer();
|
|
18
|
+
// The caller declares the endpoint's response type, consistent with SequenceApiFetchResponse.
|
|
19
|
+
return { ok: response.ok, status: response.status, body: body, headers: Object.fromEntries(responseHeaders.flatMap(key => {
|
|
20
|
+
const value = response.headers.get(key);
|
|
21
|
+
return value === null ? [] : [[key, value]];
|
|
22
|
+
})) };
|
|
23
|
+
},
|
|
24
|
+
async stream(path, options = {}) {
|
|
25
|
+
const response = await fetchResponse(path, options);
|
|
26
|
+
if (!response.ok || !response.body) {
|
|
27
|
+
throw await stepUpErrorFromResponse(response) ??
|
|
28
|
+
new ArtifactServerError(response.status, 'stream_unavailable', 'Atlas did not return a readable response');
|
|
29
|
+
}
|
|
30
|
+
return response.body;
|
|
31
|
+
},
|
|
32
|
+
get: (path) => typedJson(path),
|
|
33
|
+
post: (path, body) => typedJson(path, { method: 'POST', body }),
|
|
34
|
+
put: (path, body) => typedJson(path, { method: 'PUT', body }),
|
|
35
|
+
patch: (path, body) => typedJson(path, { method: 'PATCH', body }),
|
|
36
|
+
delete: (path, body) => typedJson(path, { method: 'DELETE', body }),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export { ORM_JSON_SCALARS_HEADER, ORM_LOSSLESS_JSON_SCALARS, type ArtifactOrmJsonScalars } from '../orm-json-scalars.js';
|
|
2
3
|
export declare const artifactServerMethodSchema: z.ZodEnum<{
|
|
3
4
|
GET: "GET";
|
|
4
5
|
POST: "POST";
|
|
@@ -8,17 +9,38 @@ export declare const artifactServerMethodSchema: z.ZodEnum<{
|
|
|
8
9
|
PATCH: "PATCH";
|
|
9
10
|
}>;
|
|
10
11
|
export declare const artifactServerModeSchema: z.ZodDefault<z.ZodEnum<{
|
|
11
|
-
user: "user";
|
|
12
12
|
service: "service";
|
|
13
|
+
user: "user";
|
|
13
14
|
}>>;
|
|
14
15
|
/** Reject paths that intermediaries can normalize into a different authorization target. */
|
|
15
16
|
export declare function isArtifactApiPath(path: string): boolean;
|
|
17
|
+
/** A Lattice run's lifecycle status, as `GET /api/lattice/runs` filters it. */
|
|
18
|
+
export declare const ARTIFACT_PROCESS_RUN_STATUSES: readonly ["pending", "running", "completed", "failed", "cancelled", "timed_out"];
|
|
19
|
+
/** Lattice lists at most this many runs per call. */
|
|
20
|
+
export declare const ARTIFACT_PROCESS_RUNS_LIMIT = 500;
|
|
21
|
+
/** Which of the user's human steps to list: parked and waiting on them, or already done. */
|
|
22
|
+
export declare const ARTIFACT_PROCESS_TASK_VIEWS: readonly ["active", "completed"];
|
|
23
|
+
/** Lattice lists at most this many human steps per call, as its own inbox does. */
|
|
24
|
+
export declare const ARTIFACT_PROCESS_TASKS_LIMIT = 500;
|
|
25
|
+
/** A grant or revocation names at most this many users and groups together. */
|
|
26
|
+
export declare const ARTIFACT_PROCESS_PRINCIPALS_PER_CALL = 100;
|
|
27
|
+
/** A principal search returns at most this many users and groups together, as Lattice's own picker. */
|
|
28
|
+
export declare const ARTIFACT_PROCESS_PRINCIPAL_SEARCH_LIMIT = 50;
|
|
29
|
+
export declare const ARTIFACT_PROCESS_PRINCIPAL_TYPES: readonly ["user", "group"];
|
|
30
|
+
/** A start seeds assignments for at most this many human nodes. */
|
|
31
|
+
export declare const ARTIFACT_PROCESS_START_ASSIGNMENT_NODES = 64;
|
|
32
|
+
export declare const ARTIFACT_FLAGS_PER_REQUEST = 32;
|
|
33
|
+
/** The audit actions an application may record. Sign-in, identity merges and webhooks stay Atlas's. */
|
|
34
|
+
export declare const ARTIFACT_AUDIT_ACTIONS: readonly ["view", "search", "create", "update", "delete", "download", "upload", "export", "import", "share", "submit", "approve", "reject", "execute"];
|
|
35
|
+
/** One bulk action (archive the 100 selected applications) is one event naming each of them. */
|
|
36
|
+
export declare const ARTIFACT_AUDIT_RESOURCES_PER_EVENT = 100;
|
|
37
|
+
export declare const ARTIFACT_AUDIT_METADATA_KEYS = 32;
|
|
16
38
|
/** Atlas validates these operations against current manifest, bindings and principal grants. */
|
|
17
39
|
export declare const artifactServerRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
40
|
operation: z.ZodLiteral<"api">;
|
|
19
41
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
20
|
-
user: "user";
|
|
21
42
|
service: "service";
|
|
43
|
+
user: "user";
|
|
22
44
|
}>>;
|
|
23
45
|
method: z.ZodEnum<{
|
|
24
46
|
GET: "GET";
|
|
@@ -33,17 +55,18 @@ export declare const artifactServerRequestSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
33
55
|
}, z.core.$strict>, z.ZodObject<{
|
|
34
56
|
operation: z.ZodLiteral<"orm">;
|
|
35
57
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
36
|
-
user: "user";
|
|
37
58
|
service: "service";
|
|
59
|
+
user: "user";
|
|
38
60
|
}>>;
|
|
39
61
|
namespace: z.ZodString;
|
|
40
62
|
op: z.ZodString;
|
|
41
63
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
64
|
+
jsonScalars: z.ZodOptional<z.ZodLiteral<"lossless-v1">>;
|
|
42
65
|
}, z.core.$strict>, z.ZodObject<{
|
|
43
66
|
operation: z.ZodLiteral<"storage">;
|
|
44
67
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
45
|
-
user: "user";
|
|
46
68
|
service: "service";
|
|
69
|
+
user: "user";
|
|
47
70
|
}>>;
|
|
48
71
|
method: z.ZodEnum<{
|
|
49
72
|
GET: "GET";
|
|
@@ -58,11 +81,174 @@ export declare const artifactServerRequestSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
58
81
|
}, z.core.$strict>, z.ZodObject<{
|
|
59
82
|
operation: z.ZodLiteral<"function">;
|
|
60
83
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
61
|
-
user: "user";
|
|
62
84
|
service: "service";
|
|
85
|
+
user: "user";
|
|
63
86
|
}>>;
|
|
64
87
|
id: z.ZodString;
|
|
65
88
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
+
operation: z.ZodLiteral<"lattice">;
|
|
91
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
92
|
+
service: "service";
|
|
93
|
+
user: "user";
|
|
94
|
+
}>>;
|
|
95
|
+
process: z.ZodString;
|
|
96
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
97
|
+
title: z.ZodOptional<z.ZodString>;
|
|
98
|
+
entity: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
type: z.ZodString;
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
}, z.core.$strict>>;
|
|
102
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
103
|
+
assignments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
104
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strict>>>;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
operation: z.ZodLiteral<"lattice_runs">;
|
|
109
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
110
|
+
service: "service";
|
|
111
|
+
user: "user";
|
|
112
|
+
}>>;
|
|
113
|
+
process: z.ZodString;
|
|
114
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
115
|
+
running: "running";
|
|
116
|
+
failed: "failed";
|
|
117
|
+
cancelled: "cancelled";
|
|
118
|
+
pending: "pending";
|
|
119
|
+
completed: "completed";
|
|
120
|
+
timed_out: "timed_out";
|
|
121
|
+
}>>;
|
|
122
|
+
entity: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
type: z.ZodString;
|
|
124
|
+
id: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
129
|
+
operation: z.ZodLiteral<"lattice_run">;
|
|
130
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
131
|
+
service: "service";
|
|
132
|
+
user: "user";
|
|
133
|
+
}>>;
|
|
134
|
+
runId: z.ZodString;
|
|
135
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
136
|
+
operation: z.ZodLiteral<"lattice_process">;
|
|
137
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
138
|
+
service: "service";
|
|
139
|
+
user: "user";
|
|
140
|
+
}>>;
|
|
141
|
+
process: z.ZodString;
|
|
142
|
+
version: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
144
|
+
operation: z.ZodLiteral<"lattice_tasks">;
|
|
145
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
146
|
+
service: "service";
|
|
147
|
+
user: "user";
|
|
148
|
+
}>>;
|
|
149
|
+
processes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
150
|
+
view: z.ZodOptional<z.ZodEnum<{
|
|
151
|
+
active: "active";
|
|
152
|
+
completed: "completed";
|
|
153
|
+
}>>;
|
|
154
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
156
|
+
operation: z.ZodLiteral<"lattice_advance">;
|
|
157
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
158
|
+
service: "service";
|
|
159
|
+
user: "user";
|
|
160
|
+
}>>;
|
|
161
|
+
runId: z.ZodString;
|
|
162
|
+
stepId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
edgeId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
165
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
166
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
operation: z.ZodLiteral<"lattice_assign">;
|
|
169
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
170
|
+
service: "service";
|
|
171
|
+
user: "user";
|
|
172
|
+
}>>;
|
|
173
|
+
runId: z.ZodString;
|
|
174
|
+
stepId: z.ZodString;
|
|
175
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
176
|
+
operation: z.ZodLiteral<"lattice_viewers">;
|
|
177
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
178
|
+
service: "service";
|
|
179
|
+
user: "user";
|
|
180
|
+
}>>;
|
|
181
|
+
runId: z.ZodString;
|
|
182
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
183
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
184
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
185
|
+
operation: z.ZodLiteral<"lattice_viewer_grant">;
|
|
186
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
187
|
+
service: "service";
|
|
188
|
+
user: "user";
|
|
189
|
+
}>>;
|
|
190
|
+
runId: z.ZodString;
|
|
191
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
192
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
193
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
194
|
+
operation: z.ZodLiteral<"lattice_viewer_revoke">;
|
|
195
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
196
|
+
service: "service";
|
|
197
|
+
user: "user";
|
|
198
|
+
}>>;
|
|
199
|
+
runId: z.ZodString;
|
|
200
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
201
|
+
operation: z.ZodLiteral<"lattice_principals">;
|
|
202
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
203
|
+
service: "service";
|
|
204
|
+
user: "user";
|
|
205
|
+
}>>;
|
|
206
|
+
q: z.ZodString;
|
|
207
|
+
types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
208
|
+
user: "user";
|
|
209
|
+
group: "group";
|
|
210
|
+
}>>>;
|
|
211
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
operation: z.ZodLiteral<"flags">;
|
|
214
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
215
|
+
service: "service";
|
|
216
|
+
user: "user";
|
|
217
|
+
}>>;
|
|
218
|
+
names: z.ZodArray<z.ZodString>;
|
|
219
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
220
|
+
eventId: z.ZodUUID;
|
|
221
|
+
action: z.ZodEnum<{
|
|
222
|
+
search: "search";
|
|
223
|
+
delete: "delete";
|
|
224
|
+
import: "import";
|
|
225
|
+
share: "share";
|
|
226
|
+
upload: "upload";
|
|
227
|
+
submit: "submit";
|
|
228
|
+
view: "view";
|
|
229
|
+
create: "create";
|
|
230
|
+
update: "update";
|
|
231
|
+
download: "download";
|
|
232
|
+
export: "export";
|
|
233
|
+
approve: "approve";
|
|
234
|
+
reject: "reject";
|
|
235
|
+
execute: "execute";
|
|
236
|
+
}>;
|
|
237
|
+
detail: z.ZodString;
|
|
238
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
239
|
+
type: z.ZodString;
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
}, z.core.$strict>>;
|
|
242
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
243
|
+
operation: z.ZodLiteral<"audit">;
|
|
244
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
245
|
+
service: "service";
|
|
246
|
+
user: "user";
|
|
247
|
+
}>>;
|
|
66
248
|
}, z.core.$strict>], "operation">;
|
|
67
249
|
export type ArtifactServerRequest = z.infer<typeof artifactServerRequestSchema>;
|
|
68
250
|
export type ArtifactServerMode = z.infer<typeof artifactServerModeSchema>;
|
|
251
|
+
export type ArtifactAuditAction = (typeof ARTIFACT_AUDIT_ACTIONS)[number];
|
|
252
|
+
export type ArtifactProcessRunStatus = (typeof ARTIFACT_PROCESS_RUN_STATUSES)[number];
|
|
253
|
+
export type ArtifactProcessTaskView = (typeof ARTIFACT_PROCESS_TASK_VIEWS)[number];
|
|
254
|
+
export type ArtifactProcessPrincipalType = (typeof ARTIFACT_PROCESS_PRINCIPAL_TYPES)[number];
|