apps 0.0.1-beta.1 → 0.0.1-beta.11
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 +65 -43
- package/framework-reference.json +1 -1
- package/js/browser-XIPJGLH2.js +65 -0
- package/js/{chunk-SATWJKN6.js → chunk-27F7W2LG.js} +1 -1
- package/js/{chunk-HDJH3RPR.js → chunk-57RKNWL2.js} +2 -2
- package/js/{chunk-2HHMABB6.js → chunk-5T57N25Q.js} +61 -13
- package/js/{chunk-FW5HBOIK.js → chunk-CDL5PM2Q.js} +307 -169
- package/js/{chunk-X7SFGU4Q.js → chunk-EFAPIRVB.js} +28 -9
- package/js/chunk-GPFVWWDZ.js +209 -0
- package/js/{chunk-OHRT55C4.js → chunk-IJX4CYZO.js} +3 -6
- package/js/{chunk-ZTFQHGEB.js → chunk-IPI4MFSN.js} +3 -5
- package/js/{chunk-YEJOQEII.js → chunk-JU7VHODU.js} +1 -1
- package/js/{chunk-IHQ4ML7K.js → chunk-KRSCJDTW.js} +586 -111
- package/js/chunk-KUMBKVJD.js +39 -0
- package/js/{chunk-EVJUVWN2.js → chunk-M3B3DE4K.js} +2 -2
- package/js/{chunk-ZJWDMTE3.js → chunk-MKWZPDR6.js} +3 -3
- package/js/{chunk-BMOIAIVR.js → chunk-N7YDVXYJ.js} +49 -1
- package/js/chunk-NKLWZJLE.js +172 -0
- package/js/{chunk-ZCAMUXSG.js → chunk-ODEIDRGW.js} +3 -4
- package/js/{chunk-M6ZRRIBI.js → chunk-PJJ24GU7.js} +1 -1
- package/js/{chunk-FZJOYIZO.js → chunk-PZB6T6KU.js} +1 -1
- package/js/chunk-R3EV5FTO.js +97 -0
- package/js/{chunk-KOXMLKTM.js → chunk-RELFXUOO.js} +308 -316
- package/js/{chunk-6YBRWRK3.js → chunk-RFVIONFX.js} +43 -14
- package/js/{chunk-RBAC33PQ.js → chunk-TYVDBQSI.js} +58 -83
- package/js/{chunk-QKHR7BMF.js → chunk-UK573G7W.js} +1 -1
- package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
- package/js/{chunk-4LPG6RCH.js → chunk-VFZKSM3T.js} +5 -25
- package/js/{chunk-6IIO4NPI.js → chunk-WVVV4TX2.js} +21 -9
- package/js/{chunk-G7IE6BKC.js → chunk-YBRC463S.js} +8 -8
- package/js/chunk-Z2QY3YTF.js +507 -0
- package/js/{chunk-PLCMJREA.js → chunk-ZQINWV4W.js} +60 -20
- package/js/client.js +10 -26
- package/js/contracts.js +70 -15
- package/js/effect.js +19 -19
- package/js/es-APDZKREY.js +40968 -0
- package/js/graphql.js +34 -39
- package/js/host.js +23 -23
- package/js/index.js +199 -195
- package/js/mcp/effect.js +21 -21
- package/js/mcp/stdio.js +25 -25
- package/js/mcp.js +60 -44
- package/js/openapi.js +826 -41682
- package/js/react.js +3 -3
- package/js/skills/effect.js +3 -4
- package/js/skills.js +53 -17
- package/js/storage/facet.js +4 -4
- package/js/ui/auth/contracts.js +8 -9
- package/js/ui/auth.js +16 -14
- package/js/ui/contracts.js +4 -4
- package/js/ui/serving.js +9 -8
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +42 -2
- package/types/app-cache/src/index.d.ts +59 -1
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/app-data/src/implementation/schema.d.ts +2 -17
- package/types/apps/src/contracts/app.d.ts +7 -6
- package/types/apps/src/contracts/cache.d.ts +4 -1
- package/types/apps/src/contracts/failure.d.ts +25 -0
- package/types/apps/src/contracts/host.d.ts +34 -679
- package/types/apps/src/contracts/mcp.d.ts +16 -0
- package/types/apps/src/contracts/openapi.d.ts +11 -1
- package/types/apps/src/contracts/operations.d.ts +0 -5
- package/types/apps/src/contracts/protocol-version.d.ts +6 -0
- package/types/apps/src/contracts/protocols/1.d.ts +1589 -0
- package/types/apps/src/contracts/protocols/2.d.ts +668 -0
- package/types/apps/src/contracts/protocols/3.d.ts +676 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
- package/types/apps/src/contracts/provider.d.ts +56 -5
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/skills.d.ts +17 -8
- package/types/apps/src/contracts/storage.d.ts +3 -3
- package/types/apps/src/contracts/ui-auth.d.ts +6 -14
- package/types/apps/src/contracts/workflows.d.ts +34 -3
- package/types/apps/src/graphql.d.ts +1 -3
- package/types/apps/src/implementation/account-router.d.ts +12 -0
- package/types/apps/src/implementation/app.d.ts +5 -4
- package/types/apps/src/implementation/cache.d.ts +3 -1
- package/types/apps/src/implementation/catalog-cache.d.ts +9 -2
- package/types/apps/src/implementation/elicitation.d.ts +1 -1
- package/types/apps/src/implementation/failure-detail.d.ts +25 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +1 -4
- package/types/apps/src/implementation/mcp-catalog.d.ts +1 -4
- package/types/apps/src/implementation/mcp-client.d.ts +35 -19
- package/types/apps/src/implementation/mcp.d.ts +35 -19
- package/types/apps/src/implementation/openapi-compile.d.ts +3 -2
- package/types/apps/src/implementation/openapi-document.d.ts +0 -2
- package/types/apps/src/implementation/openapi-names.d.ts +18 -0
- package/types/apps/src/implementation/openapi-request.d.ts +0 -1
- package/types/apps/src/implementation/openapi-source.d.ts +7 -7
- package/types/apps/src/implementation/operations.d.ts +26 -3
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
- package/types/apps/src/implementation/provider.d.ts +9 -4
- package/types/apps/src/implementation/router-catalog.d.ts +225 -0
- package/types/apps/src/implementation/router.d.ts +59 -0
- package/types/apps/src/implementation/schema.d.ts +5 -6
- package/types/apps/src/implementation/storage.d.ts +5 -3
- package/types/apps/src/implementation/swagger-client.d.ts +28 -0
- package/types/apps/src/implementation/ui-auth.d.ts +11 -5
- package/types/apps/src/implementation/ui-serving.d.ts +4 -2
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflow-context.d.ts +11 -3
- package/types/apps/src/index.d.ts +21 -6
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +5 -4
- package/types/apps/src/openapi.d.ts +6 -6
- package/types/apps/src/skills.d.ts +6 -3
- package/types/apps/src/ui-auth.d.ts +2 -2
- package/types/telemetry/src/browser-operations.d.ts +5 -2
- package/js/chunk-PZ36XMXW.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-TE4KO4HI.js +0 -47
- package/js/chunk-W7D7WVSY.js +0 -18
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R3EV5FTO.js";
|
|
4
4
|
import {
|
|
5
5
|
wrap
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5T57N25Q.js";
|
|
7
7
|
import {
|
|
8
8
|
JsonObject
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-27F7W2LG.js";
|
|
10
10
|
import {
|
|
11
11
|
Duration_exports,
|
|
12
12
|
Effect_exports,
|
|
13
13
|
Schema_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CDL5PM2Q.js";
|
|
15
15
|
|
|
16
16
|
// src/implementation/catalog-cache.ts
|
|
17
17
|
var schema = (decoder) => wrap(decoder, false);
|
|
18
18
|
var Manifest = Schema_exports.Struct({
|
|
19
19
|
revision: Schema_exports.String,
|
|
20
20
|
pages: Schema_exports.Int,
|
|
21
|
-
summaries: Schema_exports.Int
|
|
21
|
+
summaries: Schema_exports.Int,
|
|
22
|
+
header: Schema_exports.optionalKey(JsonObject)
|
|
22
23
|
});
|
|
23
24
|
var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
|
|
24
25
|
var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
@@ -35,9 +36,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
35
36
|
const retention = Duration_exports.toMillis(Duration_exports.fromInputUnsafe(freshFor)) + Duration_exports.toMillis(Duration_exports.fromInputUnsafe(staleFor)) + 3e5;
|
|
36
37
|
const local = yield* Effect_exports.cached(options.load());
|
|
37
38
|
const refresh = (context) => Effect_exports.gen(function* () {
|
|
38
|
-
const tools = yield* options.load(context);
|
|
39
|
+
const { tools, header } = yield* options.load(context);
|
|
39
40
|
const digest = yield* invoke(
|
|
40
|
-
() => crypto.subtle.digest(
|
|
41
|
+
() => crypto.subtle.digest(
|
|
42
|
+
"SHA-256",
|
|
43
|
+
new TextEncoder().encode(JSON.stringify({ tools, header: header ?? null }))
|
|
44
|
+
)
|
|
41
45
|
);
|
|
42
46
|
const revision = Array.from(
|
|
43
47
|
new Uint8Array(digest),
|
|
@@ -51,10 +55,22 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
51
55
|
let summaryBytes = 0;
|
|
52
56
|
let batch = [];
|
|
53
57
|
let batchBytes = 0;
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
let flushes = 0;
|
|
59
|
+
const flush = () => Effect_exports.suspend(() => {
|
|
60
|
+
const entries = batch;
|
|
61
|
+
const bytes = batchBytes;
|
|
56
62
|
batch = [];
|
|
57
63
|
batchBytes = 0;
|
|
64
|
+
if (!entries.length) return Effect_exports.void;
|
|
65
|
+
return invoke(() => context.cache.write(entries, retention)).pipe(
|
|
66
|
+
Effect_exports.withSpan("app.cache.flush", {
|
|
67
|
+
attributes: {
|
|
68
|
+
"cache.flush.index": flushes++,
|
|
69
|
+
"cache.flush.entries": entries.length,
|
|
70
|
+
"cache.flush.bytes": bytes
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
);
|
|
58
74
|
});
|
|
59
75
|
const append = (entry) => Effect_exports.gen(function* () {
|
|
60
76
|
const bytes = new TextEncoder().encode(JSON.stringify(entry)).byteLength;
|
|
@@ -92,7 +108,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
92
108
|
yield* pageOut();
|
|
93
109
|
yield* summaryOut();
|
|
94
110
|
yield* flush();
|
|
95
|
-
return {
|
|
111
|
+
return {
|
|
112
|
+
revision,
|
|
113
|
+
pages: pages2,
|
|
114
|
+
summaries,
|
|
115
|
+
...header === void 0 ? {} : { header: yield* json(header) }
|
|
116
|
+
};
|
|
96
117
|
});
|
|
97
118
|
const getOptions = {
|
|
98
119
|
key,
|
|
@@ -101,7 +122,12 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
101
122
|
staleFor,
|
|
102
123
|
load: (context) => Effect_exports.runPromise(refresh(context), { signal: context.signal })
|
|
103
124
|
};
|
|
104
|
-
|
|
125
|
+
let reading;
|
|
126
|
+
const current = () => cache === void 0 ? Effect_exports.fail(new CacheError({ reason: "unavailable" })) : invoke(
|
|
127
|
+
() => reading ??= cache.get(getOptions).finally(() => {
|
|
128
|
+
reading = void 0;
|
|
129
|
+
})
|
|
130
|
+
);
|
|
105
131
|
if (options.revalidate) {
|
|
106
132
|
if (cache === void 0) yield* local;
|
|
107
133
|
else yield* invoke(() => cache.revalidate(getOptions));
|
|
@@ -128,14 +154,17 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
128
154
|
return values;
|
|
129
155
|
});
|
|
130
156
|
const metadata = () => Effect_exports.gen(function* () {
|
|
131
|
-
if (cache === void 0) return yield* local;
|
|
157
|
+
if (cache === void 0) return (yield* local).tools;
|
|
132
158
|
const manifest = yield* current();
|
|
133
159
|
return yield* pages(cache, manifest.revision, "page", manifest.pages, options.schema);
|
|
134
160
|
});
|
|
135
161
|
return {
|
|
136
162
|
list: metadata,
|
|
163
|
+
/** The record stored with the current revision, if the source supplied one. */
|
|
164
|
+
header: () => cache === void 0 ? local.pipe(Effect_exports.map(({ header }) => header)) : current().pipe(Effect_exports.map((manifest) => manifest.header)),
|
|
137
165
|
summaries: () => Effect_exports.gen(function* () {
|
|
138
|
-
if (cache === void 0)
|
|
166
|
+
if (cache === void 0)
|
|
167
|
+
return (yield* local).tools.map((tool) => options.summary.of(tool));
|
|
139
168
|
const manifest = yield* current();
|
|
140
169
|
return yield* pages(
|
|
141
170
|
cache,
|
|
@@ -145,7 +174,7 @@ var catalogCache = (options) => Effect_exports.gen(function* () {
|
|
|
145
174
|
options.summary.schema
|
|
146
175
|
);
|
|
147
176
|
}),
|
|
148
|
-
resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map((tools) => tools.find((tool) => tool.name === name))) : current().pipe(
|
|
177
|
+
resolve: (name) => cache === void 0 ? local.pipe(Effect_exports.map(({ tools }) => tools.find((tool) => tool.name === name))) : current().pipe(
|
|
149
178
|
Effect_exports.flatMap(
|
|
150
179
|
(manifest) => invoke(
|
|
151
180
|
() => cache.read(part(manifest.revision, "tool", name), schema(options.schema))
|
|
@@ -1,78 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
|
-
parseDatabaseSchema,
|
|
3
2
|
promiseTable
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZQINWV4W.js";
|
|
5
4
|
import {
|
|
5
|
+
declaredOperations,
|
|
6
6
|
fromPromise,
|
|
7
|
-
nativeOperation
|
|
8
|
-
|
|
7
|
+
nativeOperation,
|
|
8
|
+
nativeRouter
|
|
9
|
+
} from "./chunk-GPFVWWDZ.js";
|
|
9
10
|
import {
|
|
10
11
|
ScheduleTiming
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KRSCJDTW.js";
|
|
13
|
+
import {
|
|
14
|
+
DatabaseSchema
|
|
15
|
+
} from "./chunk-N7YDVXYJ.js";
|
|
12
16
|
import {
|
|
13
17
|
decoderOf,
|
|
14
18
|
isSchema,
|
|
15
19
|
storageFieldOf
|
|
16
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-5T57N25Q.js";
|
|
17
21
|
import {
|
|
18
22
|
AppStorageUnavailable
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-PZB6T6KU.js";
|
|
20
24
|
import {
|
|
21
25
|
JsonValue
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-27F7W2LG.js";
|
|
23
27
|
import {
|
|
24
28
|
Effect_exports,
|
|
25
29
|
Schema_exports
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-CDL5PM2Q.js";
|
|
27
31
|
|
|
28
|
-
//
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
+
// src/contracts/http.ts
|
|
33
|
+
var ResponseStatusError = class extends Schema_exports.TaggedError()(
|
|
34
|
+
"ResponseStatusError",
|
|
35
|
+
{ status: Schema_exports.Number }
|
|
36
|
+
) {
|
|
37
|
+
get message() {
|
|
38
|
+
return `Request failed with status ${this.status}`;
|
|
39
|
+
}
|
|
32
40
|
};
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
retentionMs: 7 * 24 * 60 * 60 * 1e3,
|
|
41
|
-
loadTimeoutMs: 9e4,
|
|
42
|
-
leaseMs: 12e4
|
|
41
|
+
var ResponseDecodeError = class extends Schema_exports.TaggedError()(
|
|
42
|
+
"ResponseDecodeError",
|
|
43
|
+
{}
|
|
44
|
+
) {
|
|
45
|
+
get message() {
|
|
46
|
+
return "Response body did not match the expected schema";
|
|
47
|
+
}
|
|
43
48
|
};
|
|
44
|
-
var Key = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/));
|
|
45
|
-
var Time = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
|
|
46
|
-
var CacheEntry = Schema_exports.Struct({
|
|
47
|
-
value: Schema_exports.Json,
|
|
48
|
-
version: Schema_exports.String,
|
|
49
|
-
freshUntil: Time,
|
|
50
|
-
staleUntil: Time
|
|
51
|
-
});
|
|
52
|
-
var CacheCommand = Schema_exports.Union([
|
|
53
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("read"), keys: Schema_exports.Array(Key) }),
|
|
54
|
-
Schema_exports.Struct({
|
|
55
|
-
operation: Schema_exports.Literal("claim"),
|
|
56
|
-
key: Key,
|
|
57
|
-
version: Schema_exports.NullOr(Schema_exports.String)
|
|
58
|
-
}),
|
|
59
|
-
Schema_exports.Struct({
|
|
60
|
-
operation: Schema_exports.Literal("publish"),
|
|
61
|
-
key: Key,
|
|
62
|
-
lease: Schema_exports.String,
|
|
63
|
-
entry: CacheEntry
|
|
64
|
-
}),
|
|
65
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("release"), key: Key, lease: Schema_exports.String }),
|
|
66
|
-
Schema_exports.Struct({
|
|
67
|
-
operation: Schema_exports.Literal("write"),
|
|
68
|
-
entries: Schema_exports.Array(Schema_exports.Struct({ key: Key, entry: CacheEntry }))
|
|
69
|
-
}),
|
|
70
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("invalidate"), key: Key })
|
|
71
|
-
]);
|
|
72
|
-
var CacheReply = Schema_exports.Union([
|
|
73
|
-
Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: Schema_exports.Json }),
|
|
74
|
-
Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: CacheError })
|
|
75
|
-
]);
|
|
76
49
|
|
|
77
50
|
// src/implementation/workflows.ts
|
|
78
51
|
var NativeWorkflow = /* @__PURE__ */ Symbol("apps.Workflow");
|
|
@@ -97,8 +70,12 @@ var nativeWorkflow = (value) => {
|
|
|
97
70
|
var InternalApp = /* @__PURE__ */ Symbol("apps.App");
|
|
98
71
|
var isApp = (value) => typeof value === "object" && value !== null && InternalApp in value;
|
|
99
72
|
var toEffectApp = (app) => app[InternalApp];
|
|
73
|
+
function rejectCatalogs(definition) {
|
|
74
|
+
if ("queries" in definition || "mutations" in definition)
|
|
75
|
+
throw new Error("Put queries and mutations in a router under tools");
|
|
76
|
+
}
|
|
100
77
|
function adaptDefinition(definition) {
|
|
101
|
-
|
|
78
|
+
rejectCatalogs(definition);
|
|
102
79
|
const webhooks = definition.webhooks === void 0 ? {} : {
|
|
103
80
|
webhooks: Object.fromEntries(
|
|
104
81
|
Object.entries(definition.webhooks).map(([name, webhook]) => [
|
|
@@ -114,42 +91,42 @@ function adaptDefinition(definition) {
|
|
|
114
91
|
])
|
|
115
92
|
)
|
|
116
93
|
};
|
|
117
|
-
const operations = (kind, catalog) => Object.fromEntries(
|
|
118
|
-
Object.entries(catalog).map(([name, value]) => {
|
|
119
|
-
const operation = nativeOperation(value);
|
|
120
|
-
if (operation === void 0 || operation.kind !== kind)
|
|
121
|
-
throw new Error("Invalid app data operation");
|
|
122
|
-
return [name, operation];
|
|
123
|
-
})
|
|
124
|
-
);
|
|
125
94
|
const workflows = definition.workflows === void 0 ? {} : {
|
|
126
95
|
workflows: Object.fromEntries(
|
|
127
96
|
Object.entries(definition.workflows).map(([name, value]) => {
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
return [name,
|
|
97
|
+
const declared2 = nativeWorkflow(value);
|
|
98
|
+
if (declared2 === void 0) throw new Error("Invalid workflow declaration");
|
|
99
|
+
return [name, declared2];
|
|
131
100
|
})
|
|
132
101
|
)
|
|
133
102
|
};
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
};
|
|
103
|
+
const root = definition.tools === void 0 ? void 0 : nativeRouter(definition.tools);
|
|
104
|
+
if (definition.tools !== void 0 && root === void 0)
|
|
105
|
+
throw new Error("tools must be a router");
|
|
106
|
+
const data = root === void 0 ? {} : { tools: root };
|
|
107
|
+
const declared = root?.kind === "router" ? declaredOperations(root) : [];
|
|
108
|
+
const mutations = /* @__PURE__ */ new Set();
|
|
109
|
+
for (const { operation } of declared) {
|
|
110
|
+
if (operation.kind !== "mutation") continue;
|
|
111
|
+
if (mutations.has(operation))
|
|
112
|
+
throw new Error("A mutation can be mounted at only one path in tools");
|
|
113
|
+
mutations.add(operation);
|
|
114
|
+
}
|
|
138
115
|
const schedules = definition.schedules === void 0 ? {} : {
|
|
139
116
|
schedules: Object.fromEntries(
|
|
140
117
|
Object.entries(definition.schedules).map(([name, schedule]) => {
|
|
141
|
-
const
|
|
142
|
-
|
|
118
|
+
const target = nativeOperation(schedule.operation);
|
|
119
|
+
const match = declared.find(
|
|
120
|
+
({ operation }) => operation === target && operation.kind === "mutation"
|
|
143
121
|
);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
throw new Error("A schedule must reference exactly one named mutation in this app");
|
|
122
|
+
if (match === void 0)
|
|
123
|
+
throw new Error("A schedule must reference a mutation in this app's tools");
|
|
147
124
|
return [
|
|
148
125
|
name,
|
|
149
126
|
{
|
|
150
127
|
timing: Schema_exports.decodeUnknownSync(ScheduleTiming)(schedule.timing),
|
|
151
128
|
input: Schema_exports.decodeUnknownSync(JsonValue)(schedule.input),
|
|
152
|
-
tool:
|
|
129
|
+
tool: match.name
|
|
153
130
|
}
|
|
154
131
|
];
|
|
155
132
|
})
|
|
@@ -164,6 +141,7 @@ function adaptDefinition(definition) {
|
|
|
164
141
|
};
|
|
165
142
|
}
|
|
166
143
|
var defineApp = (requirements, definition) => {
|
|
144
|
+
if (typeof definition !== "function") rejectCatalogs(definition);
|
|
167
145
|
const evaluate = typeof definition === "function" ? definition : async () => definition;
|
|
168
146
|
const factory = fromPromise(evaluate);
|
|
169
147
|
const native = {
|
|
@@ -201,7 +179,7 @@ var serialize = (tables) => {
|
|
|
201
179
|
}
|
|
202
180
|
])
|
|
203
181
|
);
|
|
204
|
-
return
|
|
182
|
+
return Schema_exports.decodeUnknownSync(DatabaseSchema)(definitions);
|
|
205
183
|
};
|
|
206
184
|
var authorDatabase = (tables, session, signal, writable) => {
|
|
207
185
|
return Object.fromEntries(
|
|
@@ -251,11 +229,8 @@ var unavailableStorage = {
|
|
|
251
229
|
};
|
|
252
230
|
|
|
253
231
|
export {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
CacheEntry,
|
|
257
|
-
CacheCommand,
|
|
258
|
-
CacheReply,
|
|
232
|
+
ResponseStatusError,
|
|
233
|
+
ResponseDecodeError,
|
|
259
234
|
workflow,
|
|
260
235
|
isApp,
|
|
261
236
|
toEffectApp,
|