@sequenceholdings/managed-functions 0.1.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 +115 -0
- package/dist/cache.d.ts +37 -0
- package/dist/cache.js +194 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +36 -0
- package/dist/http-tracing.d.ts +1 -0
- package/dist/http-tracing.js +24 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +64 -0
- package/dist/limits.d.ts +153 -0
- package/dist/limits.js +98 -0
- package/dist/memory.d.ts +22 -0
- package/dist/memory.js +67 -0
- package/dist/runtime.cjs +56122 -0
- package/dist/storage.d.ts +398 -0
- package/dist/storage.js +13 -0
- package/dist/tracing.d.ts +6 -0
- package/dist/tracing.js +363 -0
- package/dist/valkey.d.ts +41 -0
- package/dist/valkey.js +175 -0
- package/package.json +48 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
export declare function createFunctionStorageClient({ baseUrl, headers, mode, }: {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
headers: Record<string, string | string[] | undefined>;
|
|
4
|
+
mode?: 'user' | 'service';
|
|
5
|
+
}): {
|
|
6
|
+
capabilities: () => Promise<{
|
|
7
|
+
canProvision: boolean;
|
|
8
|
+
uploadMethods: string[];
|
|
9
|
+
}>;
|
|
10
|
+
list: (options?: import("@sequenceholdings/storage").StorageListOptions) => Promise<{
|
|
11
|
+
items: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
environment: string;
|
|
16
|
+
state: "active" | "trashed" | "purging";
|
|
17
|
+
revision: number;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
role: "viewer" | "editor" | "admin" | "owner";
|
|
20
|
+
quotaBytes: number;
|
|
21
|
+
usedBytes: number;
|
|
22
|
+
reservedBytes: number;
|
|
23
|
+
}[];
|
|
24
|
+
nextCursor: string | null;
|
|
25
|
+
}>;
|
|
26
|
+
shared: (options?: import("@sequenceholdings/storage").StorageListOptions & {
|
|
27
|
+
trash?: boolean;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
items: {
|
|
30
|
+
id: string;
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
parentId: string | null;
|
|
33
|
+
name: string;
|
|
34
|
+
kind: "file" | "folder";
|
|
35
|
+
state: "active" | "trashed" | "purging";
|
|
36
|
+
restricted: boolean;
|
|
37
|
+
revision: number;
|
|
38
|
+
currentVersionId: string | null;
|
|
39
|
+
metadata: Record<string, string>;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
role: "viewer" | "editor" | "admin";
|
|
43
|
+
size: number | null;
|
|
44
|
+
contentType: string | null;
|
|
45
|
+
}[];
|
|
46
|
+
nextCursor: string | null;
|
|
47
|
+
}>;
|
|
48
|
+
apply: (manifest: import("@sequenceholdings/storage").WorkspaceManifest) => Promise<{
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
environment: string;
|
|
53
|
+
state: "active" | "trashed" | "purging";
|
|
54
|
+
revision: number;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
role: "viewer" | "editor" | "admin" | "owner";
|
|
57
|
+
quotaBytes: number;
|
|
58
|
+
usedBytes: number;
|
|
59
|
+
reservedBytes: number;
|
|
60
|
+
}>;
|
|
61
|
+
workspace(id: string): {
|
|
62
|
+
get: () => Promise<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
environment: string;
|
|
67
|
+
state: "active" | "trashed" | "purging";
|
|
68
|
+
revision: number;
|
|
69
|
+
createdAt: string;
|
|
70
|
+
role: "viewer" | "editor" | "admin" | "owner";
|
|
71
|
+
quotaBytes: number;
|
|
72
|
+
usedBytes: number;
|
|
73
|
+
reservedBytes: number;
|
|
74
|
+
}>;
|
|
75
|
+
delete: (expectedRevision: number) => Promise<{
|
|
76
|
+
id: string;
|
|
77
|
+
workspaceId: string;
|
|
78
|
+
targetId: string | null;
|
|
79
|
+
kind: "purge" | "delete_version";
|
|
80
|
+
status: "queued" | "running" | "succeeded" | "failed";
|
|
81
|
+
completed: number;
|
|
82
|
+
total: number;
|
|
83
|
+
error: string | null;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
canRetry: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
list: (options?: import("@sequenceholdings/storage").StorageListOptions & {
|
|
89
|
+
parentId?: string | null;
|
|
90
|
+
trash?: boolean;
|
|
91
|
+
}) => Promise<{
|
|
92
|
+
items: {
|
|
93
|
+
id: string;
|
|
94
|
+
workspaceId: string;
|
|
95
|
+
parentId: string | null;
|
|
96
|
+
name: string;
|
|
97
|
+
kind: "file" | "folder";
|
|
98
|
+
state: "active" | "trashed" | "purging";
|
|
99
|
+
restricted: boolean;
|
|
100
|
+
revision: number;
|
|
101
|
+
currentVersionId: string | null;
|
|
102
|
+
metadata: Record<string, string>;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
updatedAt: string;
|
|
105
|
+
role: "viewer" | "editor" | "admin";
|
|
106
|
+
size: number | null;
|
|
107
|
+
contentType: string | null;
|
|
108
|
+
}[];
|
|
109
|
+
nextCursor: string | null;
|
|
110
|
+
}>;
|
|
111
|
+
getNode: (id: string) => Promise<{
|
|
112
|
+
id: string;
|
|
113
|
+
workspaceId: string;
|
|
114
|
+
parentId: string | null;
|
|
115
|
+
name: string;
|
|
116
|
+
kind: "file" | "folder";
|
|
117
|
+
state: "active" | "trashed" | "purging";
|
|
118
|
+
restricted: boolean;
|
|
119
|
+
revision: number;
|
|
120
|
+
currentVersionId: string | null;
|
|
121
|
+
metadata: Record<string, string>;
|
|
122
|
+
createdAt: string;
|
|
123
|
+
updatedAt: string;
|
|
124
|
+
role: "viewer" | "editor" | "admin";
|
|
125
|
+
size: number | null;
|
|
126
|
+
contentType: string | null;
|
|
127
|
+
}>;
|
|
128
|
+
createFolder: (name: string, parentId?: string | null, { idempotencyKey, }?: {
|
|
129
|
+
idempotencyKey?: string;
|
|
130
|
+
}) => Promise<{
|
|
131
|
+
id: string;
|
|
132
|
+
workspaceId: string;
|
|
133
|
+
parentId: string | null;
|
|
134
|
+
name: string;
|
|
135
|
+
kind: "file" | "folder";
|
|
136
|
+
state: "active" | "trashed" | "purging";
|
|
137
|
+
restricted: boolean;
|
|
138
|
+
revision: number;
|
|
139
|
+
currentVersionId: string | null;
|
|
140
|
+
metadata: Record<string, string>;
|
|
141
|
+
createdAt: string;
|
|
142
|
+
updatedAt: string;
|
|
143
|
+
role: "viewer" | "editor" | "admin";
|
|
144
|
+
size: number | null;
|
|
145
|
+
contentType: string | null;
|
|
146
|
+
}>;
|
|
147
|
+
update: (id: string, input: import("zod").input<typeof import("@sequenceholdings/storage").updateNodeSchema>) => Promise<{
|
|
148
|
+
id: string;
|
|
149
|
+
workspaceId: string;
|
|
150
|
+
parentId: string | null;
|
|
151
|
+
name: string;
|
|
152
|
+
kind: "file" | "folder";
|
|
153
|
+
state: "active" | "trashed" | "purging";
|
|
154
|
+
restricted: boolean;
|
|
155
|
+
revision: number;
|
|
156
|
+
currentVersionId: string | null;
|
|
157
|
+
metadata: Record<string, string>;
|
|
158
|
+
createdAt: string;
|
|
159
|
+
updatedAt: string;
|
|
160
|
+
role: "viewer" | "editor" | "admin";
|
|
161
|
+
size: number | null;
|
|
162
|
+
contentType: string | null;
|
|
163
|
+
}>;
|
|
164
|
+
trash: (id: string, expectedRevision: number) => Promise<{
|
|
165
|
+
id: string;
|
|
166
|
+
workspaceId: string;
|
|
167
|
+
parentId: string | null;
|
|
168
|
+
name: string;
|
|
169
|
+
kind: "file" | "folder";
|
|
170
|
+
state: "active" | "trashed" | "purging";
|
|
171
|
+
restricted: boolean;
|
|
172
|
+
revision: number;
|
|
173
|
+
currentVersionId: string | null;
|
|
174
|
+
metadata: Record<string, string>;
|
|
175
|
+
createdAt: string;
|
|
176
|
+
updatedAt: string;
|
|
177
|
+
role: "viewer" | "editor" | "admin";
|
|
178
|
+
size: number | null;
|
|
179
|
+
contentType: string | null;
|
|
180
|
+
}>;
|
|
181
|
+
restore: (id: string, expectedRevision: number) => Promise<{
|
|
182
|
+
id: string;
|
|
183
|
+
workspaceId: string;
|
|
184
|
+
parentId: string | null;
|
|
185
|
+
name: string;
|
|
186
|
+
kind: "file" | "folder";
|
|
187
|
+
state: "active" | "trashed" | "purging";
|
|
188
|
+
restricted: boolean;
|
|
189
|
+
revision: number;
|
|
190
|
+
currentVersionId: string | null;
|
|
191
|
+
metadata: Record<string, string>;
|
|
192
|
+
createdAt: string;
|
|
193
|
+
updatedAt: string;
|
|
194
|
+
role: "viewer" | "editor" | "admin";
|
|
195
|
+
size: number | null;
|
|
196
|
+
contentType: string | null;
|
|
197
|
+
}>;
|
|
198
|
+
purge: (id: string, expectedRevision: number) => Promise<{
|
|
199
|
+
id: string;
|
|
200
|
+
workspaceId: string;
|
|
201
|
+
targetId: string | null;
|
|
202
|
+
kind: "purge" | "delete_version";
|
|
203
|
+
status: "queued" | "running" | "succeeded" | "failed";
|
|
204
|
+
completed: number;
|
|
205
|
+
total: number;
|
|
206
|
+
error: string | null;
|
|
207
|
+
createdAt: string;
|
|
208
|
+
updatedAt: string;
|
|
209
|
+
canRetry: boolean;
|
|
210
|
+
}>;
|
|
211
|
+
download: (id: string, options?: {
|
|
212
|
+
versionId?: string;
|
|
213
|
+
preview?: boolean;
|
|
214
|
+
}) => Promise<{
|
|
215
|
+
url: string;
|
|
216
|
+
expiresAt: string;
|
|
217
|
+
preview: boolean;
|
|
218
|
+
}>;
|
|
219
|
+
versions: (id: string, options?: {
|
|
220
|
+
before?: number;
|
|
221
|
+
limit?: number;
|
|
222
|
+
}) => Promise<{
|
|
223
|
+
items: {
|
|
224
|
+
id: string;
|
|
225
|
+
fileId: string;
|
|
226
|
+
revision: number;
|
|
227
|
+
size: number;
|
|
228
|
+
checksum: string;
|
|
229
|
+
contentType: string;
|
|
230
|
+
createdAt: string;
|
|
231
|
+
createdBy: string;
|
|
232
|
+
state: "active" | "purging";
|
|
233
|
+
}[];
|
|
234
|
+
nextRevision: number | null;
|
|
235
|
+
}>;
|
|
236
|
+
restoreVersion: (id: string, versionId: string, expectedRevision: number) => Promise<{
|
|
237
|
+
id: string;
|
|
238
|
+
fileId: string;
|
|
239
|
+
revision: number;
|
|
240
|
+
size: number;
|
|
241
|
+
checksum: string;
|
|
242
|
+
contentType: string;
|
|
243
|
+
createdAt: string;
|
|
244
|
+
createdBy: string;
|
|
245
|
+
state: "active" | "purging";
|
|
246
|
+
}>;
|
|
247
|
+
deleteVersion: (id: string, versionId: string, expectedRevision: number) => Promise<{
|
|
248
|
+
id: string;
|
|
249
|
+
workspaceId: string;
|
|
250
|
+
targetId: string | null;
|
|
251
|
+
kind: "purge" | "delete_version";
|
|
252
|
+
status: "queued" | "running" | "succeeded" | "failed";
|
|
253
|
+
completed: number;
|
|
254
|
+
total: number;
|
|
255
|
+
error: string | null;
|
|
256
|
+
createdAt: string;
|
|
257
|
+
updatedAt: string;
|
|
258
|
+
canRetry: boolean;
|
|
259
|
+
}>;
|
|
260
|
+
access: (id?: string) => Promise<{
|
|
261
|
+
revision: number;
|
|
262
|
+
restricted: boolean;
|
|
263
|
+
grants: {
|
|
264
|
+
type: "user" | "group" | "organization" | "service_account";
|
|
265
|
+
id: string;
|
|
266
|
+
role: "viewer" | "editor" | "admin";
|
|
267
|
+
}[];
|
|
268
|
+
owner: string | null;
|
|
269
|
+
inherited: boolean;
|
|
270
|
+
workspaceAdminOverride: true;
|
|
271
|
+
displayNames: Record<string, string>;
|
|
272
|
+
}>;
|
|
273
|
+
setAccess: (input: import("zod").input<typeof import("@sequenceholdings/storage").updateStorageAccessSchema>, id?: string) => Promise<{
|
|
274
|
+
revision: number;
|
|
275
|
+
restricted: boolean;
|
|
276
|
+
grants: {
|
|
277
|
+
type: "user" | "group" | "organization" | "service_account";
|
|
278
|
+
id: string;
|
|
279
|
+
role: "viewer" | "editor" | "admin";
|
|
280
|
+
}[];
|
|
281
|
+
owner: string | null;
|
|
282
|
+
inherited: boolean;
|
|
283
|
+
workspaceAdminOverride: true;
|
|
284
|
+
displayNames: Record<string, string>;
|
|
285
|
+
}>;
|
|
286
|
+
transferOwner: (principal: {
|
|
287
|
+
type: "user" | "service_account";
|
|
288
|
+
id: string;
|
|
289
|
+
}, expectedRevision: number) => Promise<{
|
|
290
|
+
revision: number;
|
|
291
|
+
restricted: boolean;
|
|
292
|
+
grants: {
|
|
293
|
+
type: "user" | "group" | "organization" | "service_account";
|
|
294
|
+
id: string;
|
|
295
|
+
role: "viewer" | "editor" | "admin";
|
|
296
|
+
}[];
|
|
297
|
+
owner: string | null;
|
|
298
|
+
inherited: boolean;
|
|
299
|
+
workspaceAdminOverride: true;
|
|
300
|
+
displayNames: Record<string, string>;
|
|
301
|
+
}>;
|
|
302
|
+
operations: (options?: {
|
|
303
|
+
before?: string;
|
|
304
|
+
limit?: number;
|
|
305
|
+
scope?: import("@sequenceholdings/storage").StorageOperationScope;
|
|
306
|
+
}) => Promise<{
|
|
307
|
+
items: {
|
|
308
|
+
id: string;
|
|
309
|
+
workspaceId: string;
|
|
310
|
+
targetId: string | null;
|
|
311
|
+
kind: "purge" | "delete_version";
|
|
312
|
+
status: "queued" | "running" | "succeeded" | "failed";
|
|
313
|
+
completed: number;
|
|
314
|
+
total: number;
|
|
315
|
+
error: string | null;
|
|
316
|
+
createdAt: string;
|
|
317
|
+
updatedAt: string;
|
|
318
|
+
canRetry: boolean;
|
|
319
|
+
}[];
|
|
320
|
+
nextCursor: string | null;
|
|
321
|
+
}>;
|
|
322
|
+
retryOperation: (id: string) => Promise<{
|
|
323
|
+
id: string;
|
|
324
|
+
workspaceId: string;
|
|
325
|
+
targetId: string | null;
|
|
326
|
+
kind: "purge" | "delete_version";
|
|
327
|
+
status: "queued" | "running" | "succeeded" | "failed";
|
|
328
|
+
completed: number;
|
|
329
|
+
total: number;
|
|
330
|
+
error: string | null;
|
|
331
|
+
createdAt: string;
|
|
332
|
+
updatedAt: string;
|
|
333
|
+
canRetry: boolean;
|
|
334
|
+
}>;
|
|
335
|
+
uploads: {
|
|
336
|
+
start: (input: import("@sequenceholdings/storage").StartStorageUpload) => Promise<{
|
|
337
|
+
id: string;
|
|
338
|
+
fileId: string;
|
|
339
|
+
uploadUrl: string | null;
|
|
340
|
+
expiresAt: string;
|
|
341
|
+
state: "pending" | "complete" | "aborted";
|
|
342
|
+
versionId: string | null;
|
|
343
|
+
maxBytes: number;
|
|
344
|
+
}>;
|
|
345
|
+
get: (id: string) => Promise<{
|
|
346
|
+
id: string;
|
|
347
|
+
fileId: string;
|
|
348
|
+
uploadUrl: string | null;
|
|
349
|
+
expiresAt: string;
|
|
350
|
+
state: "pending" | "complete" | "aborted";
|
|
351
|
+
versionId: string | null;
|
|
352
|
+
maxBytes: number;
|
|
353
|
+
}>;
|
|
354
|
+
complete: (id: string, input?: import("@sequenceholdings/storage").CompleteStorageUpload) => Promise<{
|
|
355
|
+
id: string;
|
|
356
|
+
fileId: string;
|
|
357
|
+
uploadUrl: string | null;
|
|
358
|
+
expiresAt: string;
|
|
359
|
+
state: "pending" | "complete" | "aborted";
|
|
360
|
+
versionId: string | null;
|
|
361
|
+
maxBytes: number;
|
|
362
|
+
}>;
|
|
363
|
+
abort: (id: string) => Promise<{
|
|
364
|
+
id: string;
|
|
365
|
+
fileId: string;
|
|
366
|
+
uploadUrl: string | null;
|
|
367
|
+
expiresAt: string;
|
|
368
|
+
state: "pending" | "complete" | "aborted";
|
|
369
|
+
versionId: string | null;
|
|
370
|
+
maxBytes: number;
|
|
371
|
+
}>;
|
|
372
|
+
resume(id: string, source: import("@sequenceholdings/storage").StorageUploadSource, options?: import("@sequenceholdings/storage").StorageTransferOptions & {
|
|
373
|
+
size?: number;
|
|
374
|
+
}): Promise<{
|
|
375
|
+
id: string;
|
|
376
|
+
fileId: string;
|
|
377
|
+
uploadUrl: string | null;
|
|
378
|
+
expiresAt: string;
|
|
379
|
+
state: "pending" | "complete" | "aborted";
|
|
380
|
+
versionId: string | null;
|
|
381
|
+
maxBytes: number;
|
|
382
|
+
}>;
|
|
383
|
+
put(input: Omit<import("@sequenceholdings/storage").StartStorageUpload, "idempotencyKey"> & {
|
|
384
|
+
idempotencyKey?: string;
|
|
385
|
+
}, source: import("@sequenceholdings/storage").StorageUploadSource, { keepSessionOnFailure, ...options }?: import("@sequenceholdings/storage").StorageTransferOptions & {
|
|
386
|
+
keepSessionOnFailure?: boolean;
|
|
387
|
+
}): Promise<{
|
|
388
|
+
id: string;
|
|
389
|
+
fileId: string;
|
|
390
|
+
uploadUrl: string | null;
|
|
391
|
+
expiresAt: string;
|
|
392
|
+
state: "pending" | "complete" | "aborted";
|
|
393
|
+
versionId: string | null;
|
|
394
|
+
maxBytes: number;
|
|
395
|
+
}>;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
};
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFunctionStorageClient = createFunctionStorageClient;
|
|
4
|
+
const storage_1 = require("@sequenceholdings/storage");
|
|
5
|
+
function createFunctionStorageClient({ baseUrl, headers, mode = 'user', }) {
|
|
6
|
+
const token = headers[mode === 'service' ? storage_1.STORAGE_SERVICE_TOKEN_HEADER : storage_1.STORAGE_TOKEN_HEADER];
|
|
7
|
+
if (typeof token !== 'string' || !token)
|
|
8
|
+
throw new Error('Storage access is not declared for this function invocation');
|
|
9
|
+
return (0, storage_1.createStorageClient)({
|
|
10
|
+
baseUrl,
|
|
11
|
+
getHeaders: () => ({ [storage_1.STORAGE_TOKEN_HEADER]: token }),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ServerResponse } from 'node:http';
|
|
2
|
+
export declare function installFunctionTracing(): void;
|
|
3
|
+
export declare function runWithFunctionTracing<T>(request: {
|
|
4
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
5
|
+
}, run: () => Promise<T>, response?: ServerResponse): Promise<T>;
|
|
6
|
+
export declare const FUNCTION_EGRESS_SUMMARY = "traces.function_egress.summary";
|