@b3os/sdk 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +233 -2
- package/dist/cjs/core/client.d.ts +165 -0
- package/dist/cjs/core/client.js +825 -0
- package/dist/cjs/core/client.js.map +1 -0
- package/dist/cjs/core/errors.d.ts +101 -0
- package/dist/cjs/core/errors.js +249 -0
- package/dist/cjs/core/errors.js.map +1 -0
- package/dist/cjs/core/index.d.ts +12 -0
- package/dist/cjs/core/index.js +42 -0
- package/dist/cjs/core/index.js.map +1 -0
- package/dist/cjs/core/jobs.d.ts +31 -0
- package/dist/cjs/core/jobs.js +72 -0
- package/dist/cjs/core/jobs.js.map +1 -0
- package/dist/cjs/core/namespace.d.ts +7 -0
- package/dist/cjs/core/namespace.js +13 -0
- package/dist/cjs/core/namespace.js.map +1 -0
- package/dist/cjs/core/op.d.ts +47 -0
- package/dist/cjs/core/op.js +5 -0
- package/dist/cjs/core/op.js.map +1 -0
- package/dist/cjs/core/promise.d.ts +106 -0
- package/dist/cjs/core/promise.js +200 -0
- package/dist/cjs/core/promise.js.map +1 -0
- package/dist/cjs/core/response.d.ts +54 -0
- package/dist/cjs/core/response.js +92 -0
- package/dist/cjs/core/response.js.map +1 -0
- package/dist/cjs/core/sse.d.ts +79 -0
- package/dist/cjs/core/sse.js +291 -0
- package/dist/cjs/core/sse.js.map +1 -0
- package/dist/cjs/core/timing.d.ts +20 -0
- package/dist/cjs/core/timing.js +96 -0
- package/dist/cjs/core/timing.js.map +1 -0
- package/dist/cjs/core/transport.d.ts +80 -0
- package/dist/cjs/core/transport.js +472 -0
- package/dist/cjs/core/transport.js.map +1 -0
- package/dist/cjs/core/util.d.ts +25 -0
- package/dist/cjs/core/util.js +142 -0
- package/dist/cjs/core/util.js.map +1 -0
- package/dist/cjs/core/ws.d.ts +52 -0
- package/dist/cjs/core/ws.js +181 -0
- package/dist/cjs/core/ws.js.map +1 -0
- package/dist/cjs/generated/client.d.ts +62 -0
- package/dist/cjs/generated/client.js +130 -0
- package/dist/cjs/generated/client.js.map +1 -0
- package/dist/cjs/generated/errors.d.ts +4 -0
- package/dist/cjs/generated/errors.js +160 -0
- package/dist/cjs/generated/errors.js.map +1 -0
- package/dist/cjs/generated/ids.d.ts +114 -0
- package/dist/cjs/generated/ids.js +47 -0
- package/dist/cjs/generated/ids.js.map +1 -0
- package/dist/cjs/generated/jobs.d.ts +10 -0
- package/dist/cjs/generated/jobs.js +24 -0
- package/dist/cjs/generated/jobs.js.map +1 -0
- package/dist/cjs/generated/ns/actions.d.ts +161 -0
- package/dist/cjs/generated/ns/actions.js +304 -0
- package/dist/cjs/generated/ns/actions.js.map +1 -0
- package/dist/cjs/generated/ns/infer.d.ts +190 -0
- package/dist/cjs/generated/ns/infer.js +253 -0
- package/dist/cjs/generated/ns/infer.js.map +1 -0
- package/dist/cjs/generated/ns/keys.d.ts +76 -0
- package/dist/cjs/generated/ns/keys.js +144 -0
- package/dist/cjs/generated/ns/keys.js.map +1 -0
- package/dist/cjs/generated/ns/limits.d.ts +22 -0
- package/dist/cjs/generated/ns/limits.js +32 -0
- package/dist/cjs/generated/ns/limits.js.map +1 -0
- package/dist/cjs/generated/ns/orgs.d.ts +38 -0
- package/dist/cjs/generated/ns/orgs.js +68 -0
- package/dist/cjs/generated/ns/orgs.js.map +1 -0
- package/dist/cjs/generated/ns/projects.d.ts +57 -0
- package/dist/cjs/generated/ns/projects.js +115 -0
- package/dist/cjs/generated/ns/projects.js.map +1 -0
- package/dist/cjs/generated/ns/render.d.ts +159 -0
- package/dist/cjs/generated/ns/render.js +299 -0
- package/dist/cjs/generated/ns/render.js.map +1 -0
- package/dist/cjs/generated/ns/requests.d.ts +36 -0
- package/dist/cjs/generated/ns/requests.js +54 -0
- package/dist/cjs/generated/ns/requests.js.map +1 -0
- package/dist/cjs/generated/ns/routines.d.ts +212 -0
- package/dist/cjs/generated/ns/routines.js +419 -0
- package/dist/cjs/generated/ns/routines.js.map +1 -0
- package/dist/cjs/generated/ns/sandboxes.d.ts +318 -0
- package/dist/cjs/generated/ns/sandboxes.js +549 -0
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -0
- package/dist/cjs/generated/ns/usage.d.ts +30 -0
- package/dist/cjs/generated/ns/usage.js +49 -0
- package/dist/cjs/generated/ns/usage.js.map +1 -0
- package/dist/cjs/generated/ns/vault.d.ts +69 -0
- package/dist/cjs/generated/ns/vault.js +122 -0
- package/dist/cjs/generated/ns/vault.js.map +1 -0
- package/dist/cjs/generated/ns/vision.d.ts +376 -0
- package/dist/cjs/generated/ns/vision.js +736 -0
- package/dist/cjs/generated/ns/vision.js.map +1 -0
- package/dist/cjs/generated/ns/webhooks.d.ts +50 -0
- package/dist/cjs/generated/ns/webhooks.js +91 -0
- package/dist/cjs/generated/ns/webhooks.js.map +1 -0
- package/dist/cjs/generated/types.d.ts +4613 -0
- package/dist/cjs/generated/types.js +4 -0
- package/dist/cjs/generated/types.js.map +1 -0
- package/dist/cjs/index.d.ts +22 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/webhooks.d.ts +19 -0
- package/dist/cjs/webhooks.js +85 -0
- package/dist/cjs/webhooks.js.map +1 -0
- package/dist/esm/core/client.d.ts +165 -0
- package/dist/esm/core/client.js +821 -0
- package/dist/esm/core/client.js.map +1 -0
- package/dist/esm/core/errors.d.ts +101 -0
- package/dist/esm/core/errors.js +239 -0
- package/dist/esm/core/errors.js.map +1 -0
- package/dist/esm/core/index.d.ts +12 -0
- package/dist/esm/core/index.js +15 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/jobs.d.ts +31 -0
- package/dist/esm/core/jobs.js +66 -0
- package/dist/esm/core/jobs.js.map +1 -0
- package/dist/esm/core/namespace.d.ts +7 -0
- package/dist/esm/core/namespace.js +9 -0
- package/dist/esm/core/namespace.js.map +1 -0
- package/dist/esm/core/op.d.ts +47 -0
- package/dist/esm/core/op.js +4 -0
- package/dist/esm/core/op.js.map +1 -0
- package/dist/esm/core/promise.d.ts +106 -0
- package/dist/esm/core/promise.js +193 -0
- package/dist/esm/core/promise.js.map +1 -0
- package/dist/esm/core/response.d.ts +54 -0
- package/dist/esm/core/response.js +86 -0
- package/dist/esm/core/response.js.map +1 -0
- package/dist/esm/core/sse.d.ts +79 -0
- package/dist/esm/core/sse.js +286 -0
- package/dist/esm/core/sse.js.map +1 -0
- package/dist/esm/core/timing.d.ts +20 -0
- package/dist/esm/core/timing.js +92 -0
- package/dist/esm/core/timing.js.map +1 -0
- package/dist/esm/core/transport.d.ts +80 -0
- package/dist/esm/core/transport.js +465 -0
- package/dist/esm/core/transport.js.map +1 -0
- package/dist/esm/core/util.d.ts +25 -0
- package/dist/esm/core/util.js +128 -0
- package/dist/esm/core/util.js.map +1 -0
- package/dist/esm/core/ws.d.ts +52 -0
- package/dist/esm/core/ws.js +175 -0
- package/dist/esm/core/ws.js.map +1 -0
- package/dist/esm/generated/client.d.ts +62 -0
- package/dist/esm/generated/client.js +126 -0
- package/dist/esm/generated/client.js.map +1 -0
- package/dist/esm/generated/errors.d.ts +4 -0
- package/dist/esm/generated/errors.js +157 -0
- package/dist/esm/generated/errors.js.map +1 -0
- package/dist/esm/generated/ids.d.ts +114 -0
- package/dist/esm/generated/ids.js +42 -0
- package/dist/esm/generated/ids.js.map +1 -0
- package/dist/esm/generated/jobs.d.ts +10 -0
- package/dist/esm/generated/jobs.js +21 -0
- package/dist/esm/generated/jobs.js.map +1 -0
- package/dist/esm/generated/ns/actions.d.ts +161 -0
- package/dist/esm/generated/ns/actions.js +300 -0
- package/dist/esm/generated/ns/actions.js.map +1 -0
- package/dist/esm/generated/ns/infer.d.ts +190 -0
- package/dist/esm/generated/ns/infer.js +249 -0
- package/dist/esm/generated/ns/infer.js.map +1 -0
- package/dist/esm/generated/ns/keys.d.ts +76 -0
- package/dist/esm/generated/ns/keys.js +140 -0
- package/dist/esm/generated/ns/keys.js.map +1 -0
- package/dist/esm/generated/ns/limits.d.ts +22 -0
- package/dist/esm/generated/ns/limits.js +28 -0
- package/dist/esm/generated/ns/limits.js.map +1 -0
- package/dist/esm/generated/ns/orgs.d.ts +38 -0
- package/dist/esm/generated/ns/orgs.js +64 -0
- package/dist/esm/generated/ns/orgs.js.map +1 -0
- package/dist/esm/generated/ns/projects.d.ts +57 -0
- package/dist/esm/generated/ns/projects.js +111 -0
- package/dist/esm/generated/ns/projects.js.map +1 -0
- package/dist/esm/generated/ns/render.d.ts +159 -0
- package/dist/esm/generated/ns/render.js +295 -0
- package/dist/esm/generated/ns/render.js.map +1 -0
- package/dist/esm/generated/ns/requests.d.ts +36 -0
- package/dist/esm/generated/ns/requests.js +50 -0
- package/dist/esm/generated/ns/requests.js.map +1 -0
- package/dist/esm/generated/ns/routines.d.ts +212 -0
- package/dist/esm/generated/ns/routines.js +415 -0
- package/dist/esm/generated/ns/routines.js.map +1 -0
- package/dist/esm/generated/ns/sandboxes.d.ts +318 -0
- package/dist/esm/generated/ns/sandboxes.js +545 -0
- package/dist/esm/generated/ns/sandboxes.js.map +1 -0
- package/dist/esm/generated/ns/usage.d.ts +30 -0
- package/dist/esm/generated/ns/usage.js +45 -0
- package/dist/esm/generated/ns/usage.js.map +1 -0
- package/dist/esm/generated/ns/vault.d.ts +69 -0
- package/dist/esm/generated/ns/vault.js +118 -0
- package/dist/esm/generated/ns/vault.js.map +1 -0
- package/dist/esm/generated/ns/vision.d.ts +376 -0
- package/dist/esm/generated/ns/vision.js +732 -0
- package/dist/esm/generated/ns/vision.js.map +1 -0
- package/dist/esm/generated/ns/webhooks.d.ts +50 -0
- package/dist/esm/generated/ns/webhooks.js +87 -0
- package/dist/esm/generated/ns/webhooks.js.map +1 -0
- package/dist/esm/generated/types.d.ts +4613 -0
- package/dist/esm/generated/types.js +3 -0
- package/dist/esm/generated/types.js.map +1 -0
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/webhooks.d.ts +19 -0
- package/dist/esm/webhooks.js +79 -0
- package/dist/esm/webhooks.js.map +1 -0
- package/package.json +97 -3
- package/src/core/client.ts +1022 -0
- package/src/core/errors.ts +296 -0
- package/src/core/index.ts +45 -0
- package/src/core/jobs.ts +94 -0
- package/src/core/namespace.ts +10 -0
- package/src/core/op.ts +53 -0
- package/src/core/promise.ts +268 -0
- package/src/core/response.ts +115 -0
- package/src/core/sse.ts +305 -0
- package/src/core/timing.ts +106 -0
- package/src/core/transport.ts +489 -0
- package/src/core/util.ts +138 -0
- package/src/core/ws.ts +215 -0
- package/src/generated/client.ts +143 -0
- package/src/generated/errors.ts +313 -0
- package/src/generated/ids.ts +47 -0
- package/src/generated/jobs.ts +25 -0
- package/src/generated/ns/actions.ts +353 -0
- package/src/generated/ns/infer.ts +332 -0
- package/src/generated/ns/keys.ts +152 -0
- package/src/generated/ns/limits.ts +35 -0
- package/src/generated/ns/orgs.ts +77 -0
- package/src/generated/ns/projects.ts +122 -0
- package/src/generated/ns/render.ts +348 -0
- package/src/generated/ns/requests.ts +61 -0
- package/src/generated/ns/routines.ts +474 -0
- package/src/generated/ns/sandboxes.ts +671 -0
- package/src/generated/ns/usage.ts +56 -0
- package/src/generated/ns/vault.ts +136 -0
- package/src/generated/ns/vision.ts +836 -0
- package/src/generated/ns/webhooks.ts +100 -0
- package/src/generated/types.ts +5131 -0
- package/src/index.ts +30 -0
- package/src/webhooks.ts +100 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare const ID_PATTERN: RegExp;
|
|
2
|
+
export declare const ID_PREFIXES: {
|
|
3
|
+
readonly brs: {
|
|
4
|
+
readonly object: "browser_session";
|
|
5
|
+
readonly product: "vision";
|
|
6
|
+
};
|
|
7
|
+
readonly prof: {
|
|
8
|
+
readonly object: "profile";
|
|
9
|
+
readonly product: "vision";
|
|
10
|
+
};
|
|
11
|
+
readonly crawl: {
|
|
12
|
+
readonly object: "crawl";
|
|
13
|
+
readonly product: "vision";
|
|
14
|
+
};
|
|
15
|
+
readonly batch: {
|
|
16
|
+
readonly object: "batch_scrape";
|
|
17
|
+
readonly product: "vision";
|
|
18
|
+
};
|
|
19
|
+
readonly shot: {
|
|
20
|
+
readonly object: "screenshot";
|
|
21
|
+
readonly product: "render";
|
|
22
|
+
};
|
|
23
|
+
readonly vid: {
|
|
24
|
+
readonly object: "video";
|
|
25
|
+
readonly product: "render";
|
|
26
|
+
};
|
|
27
|
+
readonly art: {
|
|
28
|
+
readonly object: "artifact";
|
|
29
|
+
readonly product: "render";
|
|
30
|
+
};
|
|
31
|
+
readonly sbx: {
|
|
32
|
+
readonly object: "sandbox";
|
|
33
|
+
readonly product: "sandboxes";
|
|
34
|
+
};
|
|
35
|
+
readonly snap: {
|
|
36
|
+
readonly object: "snapshot";
|
|
37
|
+
readonly product: "sandboxes";
|
|
38
|
+
};
|
|
39
|
+
readonly tpl: {
|
|
40
|
+
readonly object: "template";
|
|
41
|
+
readonly product: "sandboxes";
|
|
42
|
+
};
|
|
43
|
+
readonly rtn: {
|
|
44
|
+
readonly object: "routine";
|
|
45
|
+
readonly product: "routines";
|
|
46
|
+
};
|
|
47
|
+
readonly ver: {
|
|
48
|
+
readonly object: "routine_version";
|
|
49
|
+
readonly product: "routines";
|
|
50
|
+
};
|
|
51
|
+
readonly run: {
|
|
52
|
+
readonly object: "routine_run";
|
|
53
|
+
readonly product: "routines";
|
|
54
|
+
};
|
|
55
|
+
readonly hk: {
|
|
56
|
+
readonly object: "hook";
|
|
57
|
+
readonly product: "routines";
|
|
58
|
+
readonly secret: true;
|
|
59
|
+
};
|
|
60
|
+
readonly conn: {
|
|
61
|
+
readonly object: "connection";
|
|
62
|
+
readonly product: "vault";
|
|
63
|
+
};
|
|
64
|
+
readonly tsub: {
|
|
65
|
+
readonly object: "trigger_subscription";
|
|
66
|
+
readonly product: "actions";
|
|
67
|
+
};
|
|
68
|
+
readonly clink: {
|
|
69
|
+
readonly object: "connect_link";
|
|
70
|
+
readonly product: "vault";
|
|
71
|
+
};
|
|
72
|
+
readonly org: {
|
|
73
|
+
readonly object: "organization";
|
|
74
|
+
readonly product: "platform";
|
|
75
|
+
};
|
|
76
|
+
readonly prj: {
|
|
77
|
+
readonly object: "project";
|
|
78
|
+
readonly product: "platform";
|
|
79
|
+
};
|
|
80
|
+
readonly key: {
|
|
81
|
+
readonly object: "api_key";
|
|
82
|
+
readonly product: "platform";
|
|
83
|
+
};
|
|
84
|
+
readonly req: {
|
|
85
|
+
readonly object: "request";
|
|
86
|
+
readonly product: "platform";
|
|
87
|
+
};
|
|
88
|
+
readonly use: {
|
|
89
|
+
readonly object: "usage_record";
|
|
90
|
+
readonly product: "platform";
|
|
91
|
+
};
|
|
92
|
+
readonly job: {
|
|
93
|
+
readonly object: "job";
|
|
94
|
+
readonly product: "platform";
|
|
95
|
+
};
|
|
96
|
+
readonly tkt: {
|
|
97
|
+
readonly object: "stream_ticket";
|
|
98
|
+
readonly product: "platform";
|
|
99
|
+
readonly secret: true;
|
|
100
|
+
};
|
|
101
|
+
readonly evt: {
|
|
102
|
+
readonly object: "event";
|
|
103
|
+
readonly product: "platform";
|
|
104
|
+
};
|
|
105
|
+
readonly usr: {
|
|
106
|
+
readonly object: "user";
|
|
107
|
+
readonly product: "platform";
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export type IdPrefix = keyof typeof ID_PREFIXES;
|
|
111
|
+
/** True when `id` is a well-formed B3OS id, optionally with the given prefix (`isId(x, "sbx")`). */
|
|
112
|
+
export declare function isId(id: unknown, prefix?: IdPrefix): id is string;
|
|
113
|
+
/** The host-safe form for DNS labels and URL segments (`sbx_01…` → `sbx-01…`). */
|
|
114
|
+
export declare function toHostSafe(id: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ID_PREFIXES = exports.ID_PATTERN = void 0;
|
|
5
|
+
exports.isId = isId;
|
|
6
|
+
exports.toHostSafe = toHostSafe;
|
|
7
|
+
// ID prefixes (packages/spec/dist/ids.json). IDs are `<prefix>_<26 lowercase Crockford base32>` (a ULID).
|
|
8
|
+
exports.ID_PATTERN = /^[a-z]+_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
9
|
+
exports.ID_PREFIXES = {
|
|
10
|
+
brs: { object: "browser_session", product: "vision" },
|
|
11
|
+
prof: { object: "profile", product: "vision" },
|
|
12
|
+
crawl: { object: "crawl", product: "vision" },
|
|
13
|
+
batch: { object: "batch_scrape", product: "vision" },
|
|
14
|
+
shot: { object: "screenshot", product: "render" },
|
|
15
|
+
vid: { object: "video", product: "render" },
|
|
16
|
+
art: { object: "artifact", product: "render" },
|
|
17
|
+
sbx: { object: "sandbox", product: "sandboxes" },
|
|
18
|
+
snap: { object: "snapshot", product: "sandboxes" },
|
|
19
|
+
tpl: { object: "template", product: "sandboxes" },
|
|
20
|
+
rtn: { object: "routine", product: "routines" },
|
|
21
|
+
ver: { object: "routine_version", product: "routines" },
|
|
22
|
+
run: { object: "routine_run", product: "routines" },
|
|
23
|
+
hk: { object: "hook", product: "routines", secret: true },
|
|
24
|
+
conn: { object: "connection", product: "vault" },
|
|
25
|
+
tsub: { object: "trigger_subscription", product: "actions" },
|
|
26
|
+
clink: { object: "connect_link", product: "vault" },
|
|
27
|
+
org: { object: "organization", product: "platform" },
|
|
28
|
+
prj: { object: "project", product: "platform" },
|
|
29
|
+
key: { object: "api_key", product: "platform" },
|
|
30
|
+
req: { object: "request", product: "platform" },
|
|
31
|
+
use: { object: "usage_record", product: "platform" },
|
|
32
|
+
job: { object: "job", product: "platform" },
|
|
33
|
+
tkt: { object: "stream_ticket", product: "platform", secret: true },
|
|
34
|
+
evt: { object: "event", product: "platform" },
|
|
35
|
+
usr: { object: "user", product: "platform" },
|
|
36
|
+
};
|
|
37
|
+
/** True when `id` is a well-formed B3OS id, optionally with the given prefix (`isId(x, "sbx")`). */
|
|
38
|
+
function isId(id, prefix) {
|
|
39
|
+
if (typeof id !== "string" || !exports.ID_PATTERN.test(id))
|
|
40
|
+
return false;
|
|
41
|
+
return prefix === undefined || id.startsWith(`${prefix}_`);
|
|
42
|
+
}
|
|
43
|
+
/** The host-safe form for DNS labels and URL segments (`sbx_01…` → `sbx-01…`). */
|
|
44
|
+
function toHostSafe(id) {
|
|
45
|
+
return id.replace("_", "-");
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../../src/generated/ids.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JobOps } from "../core/op.ts";
|
|
2
|
+
/** Job operations by job ID prefix (`crawl_` → the crawl's get, events and cancel operations). */
|
|
3
|
+
export declare const JOB_OPS: Readonly<Record<string, JobOps>>;
|
|
4
|
+
/**
|
|
5
|
+
* Generic jobs (the platform-wide `job_` prefix, object `job`) by their `kind`: the id alone does not say which
|
|
6
|
+
* product's operations serve a `job_` id, so these are found from the job object.
|
|
7
|
+
*/
|
|
8
|
+
export declare const JOB_KIND_OPS: Readonly<Record<string, JobOps>>;
|
|
9
|
+
/** ID prefixes that several job kinds share (found by `kind`, never by prefix). */
|
|
10
|
+
export declare const GENERIC_JOB_PREFIXES: readonly string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GENERIC_JOB_PREFIXES = exports.JOB_KIND_OPS = exports.JOB_OPS = void 0;
|
|
5
|
+
const render_ts_1 = require("./ns/render.js");
|
|
6
|
+
const routines_ts_1 = require("./ns/routines.js");
|
|
7
|
+
const vision_ts_1 = require("./ns/vision.js");
|
|
8
|
+
/** Job operations by job ID prefix (`crawl_` → the crawl's get, events and cancel operations). */
|
|
9
|
+
exports.JOB_OPS = {
|
|
10
|
+
batch: vision_ts_1.visionOps.createBatch.job,
|
|
11
|
+
crawl: vision_ts_1.visionOps.createCrawl.job,
|
|
12
|
+
vid: render_ts_1.renderOps.createVideo.job,
|
|
13
|
+
run: routines_ts_1.routinesOps.createRun.job,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Generic jobs (the platform-wide `job_` prefix, object `job`) by their `kind`: the id alone does not say which
|
|
17
|
+
* product's operations serve a `job_` id, so these are found from the job object.
|
|
18
|
+
*/
|
|
19
|
+
exports.JOB_KIND_OPS = {
|
|
20
|
+
"vision.extract": vision_ts_1.visionOps.createExtract.job,
|
|
21
|
+
};
|
|
22
|
+
/** ID prefixes that several job kinds share (found by `kind`, never by prefix). */
|
|
23
|
+
exports.GENERIC_JOB_PREFIXES = ["job"];
|
|
24
|
+
//# sourceMappingURL=jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../../src/generated/jobs.ts"],"names":[],"mappings":";AAAA,4GAA4G;;;AAG5G,8CAA2C;AAC3C,kDAA+C;AAC/C,8CAA2C;AAE3C,kGAAkG;AACrF,QAAA,OAAO,GAAqC;IACvD,KAAK,EAAE,qBAAS,CAAC,WAAW,CAAC,GAAa;IAC1C,KAAK,EAAE,qBAAS,CAAC,WAAW,CAAC,GAAa;IAC1C,GAAG,EAAE,qBAAS,CAAC,WAAW,CAAC,GAAa;IACxC,GAAG,EAAE,yBAAW,CAAC,SAAS,CAAC,GAAa;CACzC,CAAC;AAEF;;;GAGG;AACU,QAAA,YAAY,GAAqC;IAC5D,gBAAgB,EAAE,qBAAS,CAAC,aAAa,CAAC,GAAa;CACxD,CAAC;AAEF,mFAAmF;AACtE,QAAA,oBAAoB,GAAsB,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { BinaryInput, RequestOptions } from "../../core/client.ts";
|
|
2
|
+
import { Namespace } from "../../core/namespace.ts";
|
|
3
|
+
import type { Op } from "../../core/op.ts";
|
|
4
|
+
import type { APIPromise, ListPromise } from "../../core/promise.ts";
|
|
5
|
+
import type * as T from "../types.ts";
|
|
6
|
+
/** Descriptors of every actions operation, keyed by method name (for tooling and custom clients). */
|
|
7
|
+
export declare const actionsOps: {
|
|
8
|
+
readonly call: Op;
|
|
9
|
+
readonly describe: Op;
|
|
10
|
+
readonly listPacks: Op;
|
|
11
|
+
readonly getPack: Op;
|
|
12
|
+
readonly getPackManifest: Op;
|
|
13
|
+
readonly listRegistryPacks: Op;
|
|
14
|
+
readonly publishPack: Op;
|
|
15
|
+
readonly getRegistryPack: Op;
|
|
16
|
+
readonly getRegistryPackVersion: Op;
|
|
17
|
+
readonly downloadPack: Op;
|
|
18
|
+
readonly search: Op;
|
|
19
|
+
readonly listSubscriptions: Op;
|
|
20
|
+
readonly getSubscription: Op;
|
|
21
|
+
readonly listTriggers: Op;
|
|
22
|
+
};
|
|
23
|
+
/** Marketplace actions and triggers: search, describe, call, packs and the registry (`/v1/actions`). */
|
|
24
|
+
export declare class ActionsAPI extends Namespace {
|
|
25
|
+
/**
|
|
26
|
+
* Call an action
|
|
27
|
+
*
|
|
28
|
+
* Validates `input` against the action's schema, runs it, validates the result against its output schema and
|
|
29
|
+
* returns it. Credentials come from `connections` (pack connection key to `conn_` ID), or else from your
|
|
30
|
+
* project's most recently created connection for that pack and key; when that connection belongs to an end
|
|
31
|
+
* user (it has a `subject`), the call is refused with `422 connection_required` instead, so an unnamed key
|
|
32
|
+
* never uses one end user's credential for another: name end-user connections explicitly. Using a stored
|
|
33
|
+
* connection, named or not, also needs `vault:run`. Only `pure` and `read` actions are retried automatically; send `Idempotency-Key`
|
|
34
|
+
* with `write` actions so a retry of your own does not repeat the effect (packs that declare an
|
|
35
|
+
* idempotency header pass it upstream). `timing` phases: `validate` (input schema), `inject` (connections),
|
|
36
|
+
* `render` (request templates), `upstream` (every HTTP exchange, retries and redirects included), `map`
|
|
37
|
+
* (response mapping and output schema) for declarative HTTP actions; `sidecar` for JavaScript actions.
|
|
38
|
+
* Bills one `actions.call` once the action ran.
|
|
39
|
+
*
|
|
40
|
+
* `POST /v1/actions/call` · scope `actions:run` · served by the node
|
|
41
|
+
*/
|
|
42
|
+
call(body: T.ActionCallRequest, options?: RequestOptions): APIPromise<T.ActionResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Describe an action
|
|
45
|
+
*
|
|
46
|
+
* Returns everything needed to call one action: input and output JSON Schemas, effect class, MCP annotations
|
|
47
|
+
* and tool definition, and the connections it needs. A reference with `@<major>` resolves to the newest
|
|
48
|
+
* matching release; the response shows the exact version.
|
|
49
|
+
*
|
|
50
|
+
* `GET /v1/actions/describe` · scope `actions:read` · served by the node
|
|
51
|
+
*/
|
|
52
|
+
describe(params: T.ActionsDescribeParams, options?: RequestOptions): APIPromise<T.ActionDescription>;
|
|
53
|
+
/**
|
|
54
|
+
* List packs
|
|
55
|
+
*
|
|
56
|
+
* Lists the packs available on the node, alphabetically by ID, optionally filtered by a search phrase.
|
|
57
|
+
*
|
|
58
|
+
* `GET /v1/actions/packs` · scope `actions:read` · served by the node
|
|
59
|
+
*/
|
|
60
|
+
listPacks(params?: T.ActionsListPacksParams, options?: RequestOptions): ListPromise<T.PackList, T.PackSummary>;
|
|
61
|
+
/**
|
|
62
|
+
* Get a pack
|
|
63
|
+
*
|
|
64
|
+
* Returns a pack version (the latest unless `version` is given) with its actions, triggers, connections and egress hosts.
|
|
65
|
+
*
|
|
66
|
+
* `GET /v1/actions/packs/{namespace}/{name}` · scope `actions:read` · served by the node
|
|
67
|
+
*/
|
|
68
|
+
getPack(namespace: string, name: string, params?: T.ActionsGetPackParams, options?: RequestOptions): APIPromise<T.Pack>;
|
|
69
|
+
/**
|
|
70
|
+
* Get a pack manifest
|
|
71
|
+
*
|
|
72
|
+
* Returns the exact `b3pack.json` of one pack version, as published and signed.
|
|
73
|
+
*
|
|
74
|
+
* `GET /v1/actions/packs/{namespace}/{name}/versions/{version}/manifest` · scope `actions:read` · served by the node
|
|
75
|
+
*/
|
|
76
|
+
getPackManifest(namespace: string, name: string, version: string, options?: RequestOptions): APIPromise<T.B3Pack>;
|
|
77
|
+
/**
|
|
78
|
+
* List registry packs
|
|
79
|
+
*
|
|
80
|
+
* Lists packs in the registry with their latest version. Nodes use it to keep their local index current.
|
|
81
|
+
*
|
|
82
|
+
* `GET /v1/actions/registry/packs` · scope `actions:read` · served by beta-api.b3os.org
|
|
83
|
+
*/
|
|
84
|
+
listRegistryPacks(params?: T.PlatformListRegistryPacksParams, options?: RequestOptions): ListPromise<T.RegistryPackList, T.RegistryPack>;
|
|
85
|
+
/**
|
|
86
|
+
* Publish a pack version
|
|
87
|
+
*
|
|
88
|
+
* Uploads a pack bundle: a gzip-compressed tar with `b3pack.json` at its root plus the files it references (at
|
|
89
|
+
* most 2,000 files and 16 MiB once decompressed; other organizations are refused before the upload is read). The
|
|
90
|
+
* manifest's `signature` must verify: `sig` is Ed25519 over `b3pack-sig-v1\n<pack>\n<version>\n<contentHash>`
|
|
91
|
+
* with the publisher key `kid`, and `contentHash` covers the bundle with the signature removed. Versions are
|
|
92
|
+
* immutable. In the beta only first-party publishers (`io.b3os`) may publish.
|
|
93
|
+
*
|
|
94
|
+
* `POST /v1/actions/registry/packs` · scope `actions:write` · served by beta-api.b3os.org
|
|
95
|
+
*/
|
|
96
|
+
publishPack(data: BinaryInput, options?: RequestOptions): APIPromise<T.RegistryPackVersion>;
|
|
97
|
+
/**
|
|
98
|
+
* Get a registry pack
|
|
99
|
+
*
|
|
100
|
+
* Returns one pack's registry record with every published version.
|
|
101
|
+
*
|
|
102
|
+
* `GET /v1/actions/registry/packs/{namespace}/{name}` · scope `actions:read` · served by beta-api.b3os.org
|
|
103
|
+
*/
|
|
104
|
+
getRegistryPack(namespace: string, name: string, options?: RequestOptions): APIPromise<T.RegistryPack>;
|
|
105
|
+
/**
|
|
106
|
+
* Get a registry pack version
|
|
107
|
+
*
|
|
108
|
+
* Returns the record nodes verify before loading a pack version (content hash, signature, publisher key) and its download URL.
|
|
109
|
+
*
|
|
110
|
+
* `GET /v1/actions/registry/packs/{namespace}/{name}/versions/{version}` · scope `actions:read` · served by beta-api.b3os.org
|
|
111
|
+
*/
|
|
112
|
+
getRegistryPackVersion(namespace: string, name: string, version: string, options?: RequestOptions): APIPromise<T.RegistryPackVersion>;
|
|
113
|
+
/**
|
|
114
|
+
* Download a pack version
|
|
115
|
+
*
|
|
116
|
+
* Redirects to a short-lived signed URL for the bundle. Verify `content_hash` and the signature before loading it.
|
|
117
|
+
*
|
|
118
|
+
* `GET /v1/actions/registry/packs/{namespace}/{name}/versions/{version}/download` · scope `actions:read` · served by beta-api.b3os.org
|
|
119
|
+
*/
|
|
120
|
+
downloadPack(namespace: string, name: string, version: string, options?: RequestOptions): APIPromise<Uint8Array>;
|
|
121
|
+
/**
|
|
122
|
+
* Search actions
|
|
123
|
+
*
|
|
124
|
+
* Full-text search over action titles, descriptions and pack names, ranked for agents. Returns references you
|
|
125
|
+
* can pass to describe and call. The same results back the `actions_search` MCP tool.
|
|
126
|
+
*
|
|
127
|
+
* `GET /v1/actions/search` · scope `actions:read` · served by the node
|
|
128
|
+
*/
|
|
129
|
+
search(params: T.ActionsSearchParams, options?: RequestOptions): APIPromise<T.ActionSearchResult>;
|
|
130
|
+
/**
|
|
131
|
+
* List trigger subscriptions
|
|
132
|
+
*
|
|
133
|
+
* Lists the trigger subscriptions in your project, newest first. A subscription connects one `type: action`
|
|
134
|
+
* trigger of a published routine version to a pack trigger: publishing the version creates or updates it,
|
|
135
|
+
* and a rollback to a version without that trigger, a version that drops it, or deleting the routine removes
|
|
136
|
+
* it. Subscriptions are read-only here; change them by publishing the routine. Filter by routine or pack.
|
|
137
|
+
*
|
|
138
|
+
* `GET /v1/actions/subscriptions` · scope `actions:read` · served by the node
|
|
139
|
+
*/
|
|
140
|
+
listSubscriptions(params?: T.ActionsListSubscriptionsParams, options?: RequestOptions): ListPromise<T.TriggerSubscriptionList, T.TriggerSubscription>;
|
|
141
|
+
/**
|
|
142
|
+
* Get a trigger subscription
|
|
143
|
+
*
|
|
144
|
+
* Returns one trigger subscription: the routine trigger it serves, the exact pack trigger version, the
|
|
145
|
+
* configuration and connections bound at publish, and its status (`failed` with `error` when subscribing at
|
|
146
|
+
* the provider failed; B3OS retries).
|
|
147
|
+
*
|
|
148
|
+
* `GET /v1/actions/subscriptions/{subscription_id}` · scope `actions:read` · served by the node
|
|
149
|
+
*/
|
|
150
|
+
getSubscription(subscriptionId: string, options?: RequestOptions): APIPromise<T.TriggerSubscription>;
|
|
151
|
+
/**
|
|
152
|
+
* List triggers
|
|
153
|
+
*
|
|
154
|
+
* Lists the triggers packs provide (webhook, poll and schedule), with their configuration and event schemas.
|
|
155
|
+
* Routines subscribe to them from their definition with a `type: action` trigger; each published one becomes a
|
|
156
|
+
* trigger subscription (`GET /v1/actions/subscriptions`).
|
|
157
|
+
*
|
|
158
|
+
* `GET /v1/actions/triggers` · scope `actions:read` · served by the node
|
|
159
|
+
*/
|
|
160
|
+
listTriggers(params?: T.ActionsListTriggersParams, options?: RequestOptions): ListPromise<T.TriggerList, T.TriggerSummary>;
|
|
161
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ActionsAPI = exports.actionsOps = void 0;
|
|
5
|
+
const namespace_ts_1 = require("../../core/namespace.js");
|
|
6
|
+
const callOp = {
|
|
7
|
+
id: "actionsCall",
|
|
8
|
+
method: "POST",
|
|
9
|
+
path: "/v1/actions/call",
|
|
10
|
+
body: "json",
|
|
11
|
+
idem: true,
|
|
12
|
+
timeoutMs: 65000,
|
|
13
|
+
scope: "actions:run",
|
|
14
|
+
};
|
|
15
|
+
const describeOp = {
|
|
16
|
+
id: "actionsDescribe",
|
|
17
|
+
method: "GET",
|
|
18
|
+
path: "/v1/actions/describe",
|
|
19
|
+
timeoutMs: 10000,
|
|
20
|
+
scope: "actions:read",
|
|
21
|
+
};
|
|
22
|
+
const listPacksOp = {
|
|
23
|
+
id: "actionsListPacks",
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/v1/actions/packs",
|
|
26
|
+
timeoutMs: 10000,
|
|
27
|
+
scope: "actions:read",
|
|
28
|
+
};
|
|
29
|
+
const getPackOp = {
|
|
30
|
+
id: "actionsGetPack",
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: "/v1/actions/packs/{namespace}/{name}",
|
|
33
|
+
params: ["namespace", "name"],
|
|
34
|
+
timeoutMs: 10000,
|
|
35
|
+
scope: "actions:read",
|
|
36
|
+
};
|
|
37
|
+
const getPackManifestOp = {
|
|
38
|
+
id: "actionsGetPackManifest",
|
|
39
|
+
method: "GET",
|
|
40
|
+
path: "/v1/actions/packs/{namespace}/{name}/versions/{version}/manifest",
|
|
41
|
+
params: ["namespace", "name", "version"],
|
|
42
|
+
timeoutMs: 10000,
|
|
43
|
+
scope: "actions:read",
|
|
44
|
+
};
|
|
45
|
+
const listRegistryPacksOp = {
|
|
46
|
+
id: "platformListRegistryPacks",
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: "/v1/actions/registry/packs",
|
|
49
|
+
edge: true,
|
|
50
|
+
timeoutMs: 10000,
|
|
51
|
+
scope: "actions:read",
|
|
52
|
+
};
|
|
53
|
+
const publishPackOp = {
|
|
54
|
+
id: "platformPublishPack",
|
|
55
|
+
method: "POST",
|
|
56
|
+
path: "/v1/actions/registry/packs",
|
|
57
|
+
body: "bytes",
|
|
58
|
+
contentType: "application/gzip",
|
|
59
|
+
edge: true,
|
|
60
|
+
timeoutMs: 30000,
|
|
61
|
+
scope: "actions:write",
|
|
62
|
+
};
|
|
63
|
+
const getRegistryPackOp = {
|
|
64
|
+
id: "platformGetRegistryPack",
|
|
65
|
+
method: "GET",
|
|
66
|
+
path: "/v1/actions/registry/packs/{namespace}/{name}",
|
|
67
|
+
params: ["namespace", "name"],
|
|
68
|
+
edge: true,
|
|
69
|
+
timeoutMs: 10000,
|
|
70
|
+
scope: "actions:read",
|
|
71
|
+
};
|
|
72
|
+
const getRegistryPackVersionOp = {
|
|
73
|
+
id: "platformGetRegistryPackVersion",
|
|
74
|
+
method: "GET",
|
|
75
|
+
path: "/v1/actions/registry/packs/{namespace}/{name}/versions/{version}",
|
|
76
|
+
params: ["namespace", "name", "version"],
|
|
77
|
+
edge: true,
|
|
78
|
+
timeoutMs: 10000,
|
|
79
|
+
scope: "actions:read",
|
|
80
|
+
};
|
|
81
|
+
const downloadPackOp = {
|
|
82
|
+
id: "platformDownloadPack",
|
|
83
|
+
method: "GET",
|
|
84
|
+
path: "/v1/actions/registry/packs/{namespace}/{name}/versions/{version}/download",
|
|
85
|
+
params: ["namespace", "name", "version"],
|
|
86
|
+
edge: true,
|
|
87
|
+
timeoutMs: 10000,
|
|
88
|
+
scope: "actions:read",
|
|
89
|
+
};
|
|
90
|
+
const searchOp = {
|
|
91
|
+
id: "actionsSearch",
|
|
92
|
+
method: "GET",
|
|
93
|
+
path: "/v1/actions/search",
|
|
94
|
+
timeoutMs: 10000,
|
|
95
|
+
scope: "actions:read",
|
|
96
|
+
};
|
|
97
|
+
const listSubscriptionsOp = {
|
|
98
|
+
id: "actionsListSubscriptions",
|
|
99
|
+
method: "GET",
|
|
100
|
+
path: "/v1/actions/subscriptions",
|
|
101
|
+
timeoutMs: 10000,
|
|
102
|
+
scope: "actions:read",
|
|
103
|
+
};
|
|
104
|
+
const getSubscriptionOp = {
|
|
105
|
+
id: "actionsGetSubscription",
|
|
106
|
+
method: "GET",
|
|
107
|
+
path: "/v1/actions/subscriptions/{subscription_id}",
|
|
108
|
+
params: ["subscription_id"],
|
|
109
|
+
timeoutMs: 10000,
|
|
110
|
+
scope: "actions:read",
|
|
111
|
+
};
|
|
112
|
+
const listTriggersOp = {
|
|
113
|
+
id: "actionsListTriggers",
|
|
114
|
+
method: "GET",
|
|
115
|
+
path: "/v1/actions/triggers",
|
|
116
|
+
timeoutMs: 10000,
|
|
117
|
+
scope: "actions:read",
|
|
118
|
+
};
|
|
119
|
+
/** Descriptors of every actions operation, keyed by method name (for tooling and custom clients). */
|
|
120
|
+
exports.actionsOps = {
|
|
121
|
+
call: callOp,
|
|
122
|
+
describe: describeOp,
|
|
123
|
+
listPacks: listPacksOp,
|
|
124
|
+
getPack: getPackOp,
|
|
125
|
+
getPackManifest: getPackManifestOp,
|
|
126
|
+
listRegistryPacks: listRegistryPacksOp,
|
|
127
|
+
publishPack: publishPackOp,
|
|
128
|
+
getRegistryPack: getRegistryPackOp,
|
|
129
|
+
getRegistryPackVersion: getRegistryPackVersionOp,
|
|
130
|
+
downloadPack: downloadPackOp,
|
|
131
|
+
search: searchOp,
|
|
132
|
+
listSubscriptions: listSubscriptionsOp,
|
|
133
|
+
getSubscription: getSubscriptionOp,
|
|
134
|
+
listTriggers: listTriggersOp,
|
|
135
|
+
};
|
|
136
|
+
/** Marketplace actions and triggers: search, describe, call, packs and the registry (`/v1/actions`). */
|
|
137
|
+
class ActionsAPI extends namespace_ts_1.Namespace {
|
|
138
|
+
/**
|
|
139
|
+
* Call an action
|
|
140
|
+
*
|
|
141
|
+
* Validates `input` against the action's schema, runs it, validates the result against its output schema and
|
|
142
|
+
* returns it. Credentials come from `connections` (pack connection key to `conn_` ID), or else from your
|
|
143
|
+
* project's most recently created connection for that pack and key; when that connection belongs to an end
|
|
144
|
+
* user (it has a `subject`), the call is refused with `422 connection_required` instead, so an unnamed key
|
|
145
|
+
* never uses one end user's credential for another: name end-user connections explicitly. Using a stored
|
|
146
|
+
* connection, named or not, also needs `vault:run`. Only `pure` and `read` actions are retried automatically; send `Idempotency-Key`
|
|
147
|
+
* with `write` actions so a retry of your own does not repeat the effect (packs that declare an
|
|
148
|
+
* idempotency header pass it upstream). `timing` phases: `validate` (input schema), `inject` (connections),
|
|
149
|
+
* `render` (request templates), `upstream` (every HTTP exchange, retries and redirects included), `map`
|
|
150
|
+
* (response mapping and output schema) for declarative HTTP actions; `sidecar` for JavaScript actions.
|
|
151
|
+
* Bills one `actions.call` once the action ran.
|
|
152
|
+
*
|
|
153
|
+
* `POST /v1/actions/call` · scope `actions:run` · served by the node
|
|
154
|
+
*/
|
|
155
|
+
call(body, options) {
|
|
156
|
+
return this._client._call(callOp, { body }, options);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Describe an action
|
|
160
|
+
*
|
|
161
|
+
* Returns everything needed to call one action: input and output JSON Schemas, effect class, MCP annotations
|
|
162
|
+
* and tool definition, and the connections it needs. A reference with `@<major>` resolves to the newest
|
|
163
|
+
* matching release; the response shows the exact version.
|
|
164
|
+
*
|
|
165
|
+
* `GET /v1/actions/describe` · scope `actions:read` · served by the node
|
|
166
|
+
*/
|
|
167
|
+
describe(params, options) {
|
|
168
|
+
return this._client._call(describeOp, { query: params }, options);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* List packs
|
|
172
|
+
*
|
|
173
|
+
* Lists the packs available on the node, alphabetically by ID, optionally filtered by a search phrase.
|
|
174
|
+
*
|
|
175
|
+
* `GET /v1/actions/packs` · scope `actions:read` · served by the node
|
|
176
|
+
*/
|
|
177
|
+
listPacks(params, options) {
|
|
178
|
+
return this._client._list(listPacksOp, { query: params }, options);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get a pack
|
|
182
|
+
*
|
|
183
|
+
* Returns a pack version (the latest unless `version` is given) with its actions, triggers, connections and egress hosts.
|
|
184
|
+
*
|
|
185
|
+
* `GET /v1/actions/packs/{namespace}/{name}` · scope `actions:read` · served by the node
|
|
186
|
+
*/
|
|
187
|
+
getPack(namespace, name, params, options) {
|
|
188
|
+
return this._client._call(getPackOp, { path: [namespace, name], query: params }, options);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Get a pack manifest
|
|
192
|
+
*
|
|
193
|
+
* Returns the exact `b3pack.json` of one pack version, as published and signed.
|
|
194
|
+
*
|
|
195
|
+
* `GET /v1/actions/packs/{namespace}/{name}/versions/{version}/manifest` · scope `actions:read` · served by the node
|
|
196
|
+
*/
|
|
197
|
+
getPackManifest(namespace, name, version, options) {
|
|
198
|
+
return this._client._call(getPackManifestOp, { path: [namespace, name, version] }, options);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* List registry packs
|
|
202
|
+
*
|
|
203
|
+
* Lists packs in the registry with their latest version. Nodes use it to keep their local index current.
|
|
204
|
+
*
|
|
205
|
+
* `GET /v1/actions/registry/packs` · scope `actions:read` · served by beta-api.b3os.org
|
|
206
|
+
*/
|
|
207
|
+
listRegistryPacks(params, options) {
|
|
208
|
+
return this._client._list(listRegistryPacksOp, { query: params }, options);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Publish a pack version
|
|
212
|
+
*
|
|
213
|
+
* Uploads a pack bundle: a gzip-compressed tar with `b3pack.json` at its root plus the files it references (at
|
|
214
|
+
* most 2,000 files and 16 MiB once decompressed; other organizations are refused before the upload is read). The
|
|
215
|
+
* manifest's `signature` must verify: `sig` is Ed25519 over `b3pack-sig-v1\n<pack>\n<version>\n<contentHash>`
|
|
216
|
+
* with the publisher key `kid`, and `contentHash` covers the bundle with the signature removed. Versions are
|
|
217
|
+
* immutable. In the beta only first-party publishers (`io.b3os`) may publish.
|
|
218
|
+
*
|
|
219
|
+
* `POST /v1/actions/registry/packs` · scope `actions:write` · served by beta-api.b3os.org
|
|
220
|
+
*/
|
|
221
|
+
publishPack(data, options) {
|
|
222
|
+
return this._client._call(publishPackOp, { body: data }, options);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get a registry pack
|
|
226
|
+
*
|
|
227
|
+
* Returns one pack's registry record with every published version.
|
|
228
|
+
*
|
|
229
|
+
* `GET /v1/actions/registry/packs/{namespace}/{name}` · scope `actions:read` · served by beta-api.b3os.org
|
|
230
|
+
*/
|
|
231
|
+
getRegistryPack(namespace, name, options) {
|
|
232
|
+
return this._client._call(getRegistryPackOp, { path: [namespace, name] }, options);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Get a registry pack version
|
|
236
|
+
*
|
|
237
|
+
* Returns the record nodes verify before loading a pack version (content hash, signature, publisher key) and its download URL.
|
|
238
|
+
*
|
|
239
|
+
* `GET /v1/actions/registry/packs/{namespace}/{name}/versions/{version}` · scope `actions:read` · served by beta-api.b3os.org
|
|
240
|
+
*/
|
|
241
|
+
getRegistryPackVersion(namespace, name, version, options) {
|
|
242
|
+
return this._client._call(getRegistryPackVersionOp, { path: [namespace, name, version] }, options);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Download a pack version
|
|
246
|
+
*
|
|
247
|
+
* Redirects to a short-lived signed URL for the bundle. Verify `content_hash` and the signature before loading it.
|
|
248
|
+
*
|
|
249
|
+
* `GET /v1/actions/registry/packs/{namespace}/{name}/versions/{version}/download` · scope `actions:read` · served by beta-api.b3os.org
|
|
250
|
+
*/
|
|
251
|
+
downloadPack(namespace, name, version, options) {
|
|
252
|
+
return this._client._call(downloadPackOp, { path: [namespace, name, version] }, options, "application/gzip, application/octet-stream", "bytes");
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Search actions
|
|
256
|
+
*
|
|
257
|
+
* Full-text search over action titles, descriptions and pack names, ranked for agents. Returns references you
|
|
258
|
+
* can pass to describe and call. The same results back the `actions_search` MCP tool.
|
|
259
|
+
*
|
|
260
|
+
* `GET /v1/actions/search` · scope `actions:read` · served by the node
|
|
261
|
+
*/
|
|
262
|
+
search(params, options) {
|
|
263
|
+
return this._client._call(searchOp, { query: params }, options);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* List trigger subscriptions
|
|
267
|
+
*
|
|
268
|
+
* Lists the trigger subscriptions in your project, newest first. A subscription connects one `type: action`
|
|
269
|
+
* trigger of a published routine version to a pack trigger: publishing the version creates or updates it,
|
|
270
|
+
* and a rollback to a version without that trigger, a version that drops it, or deleting the routine removes
|
|
271
|
+
* it. Subscriptions are read-only here; change them by publishing the routine. Filter by routine or pack.
|
|
272
|
+
*
|
|
273
|
+
* `GET /v1/actions/subscriptions` · scope `actions:read` · served by the node
|
|
274
|
+
*/
|
|
275
|
+
listSubscriptions(params, options) {
|
|
276
|
+
return this._client._list(listSubscriptionsOp, { query: params }, options);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get a trigger subscription
|
|
280
|
+
*
|
|
281
|
+
* Returns one trigger subscription: the routine trigger it serves, the exact pack trigger version, the
|
|
282
|
+
* configuration and connections bound at publish, and its status (`failed` with `error` when subscribing at
|
|
283
|
+
* the provider failed; B3OS retries).
|
|
284
|
+
*
|
|
285
|
+
* `GET /v1/actions/subscriptions/{subscription_id}` · scope `actions:read` · served by the node
|
|
286
|
+
*/
|
|
287
|
+
getSubscription(subscriptionId, options) {
|
|
288
|
+
return this._client._call(getSubscriptionOp, { path: [subscriptionId] }, options);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* List triggers
|
|
292
|
+
*
|
|
293
|
+
* Lists the triggers packs provide (webhook, poll and schedule), with their configuration and event schemas.
|
|
294
|
+
* Routines subscribe to them from their definition with a `type: action` trigger; each published one becomes a
|
|
295
|
+
* trigger subscription (`GET /v1/actions/subscriptions`).
|
|
296
|
+
*
|
|
297
|
+
* `GET /v1/actions/triggers` · scope `actions:read` · served by the node
|
|
298
|
+
*/
|
|
299
|
+
listTriggers(params, options) {
|
|
300
|
+
return this._client._list(listTriggersOp, { query: params }, options);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
exports.ActionsAPI = ActionsAPI;
|
|
304
|
+
//# sourceMappingURL=actions.js.map
|