apps 0.0.1-beta.4 → 0.0.1-beta.40
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 +68 -44
- package/framework-reference.json +1 -1
- package/js/{chunk-QKHR7BMF.js → chunk-3MMG2H6M.js} +89 -53
- package/js/chunk-4TLZGG4B.js +729 -0
- package/js/chunk-6KABJTDO.js +255 -0
- package/js/{chunk-FDNTX5QJ.js → chunk-CQD3WSYH.js} +2 -2
- package/js/{chunk-EQB7JMAL.js → chunk-DHX2OI2X.js} +146 -31
- package/js/{chunk-EVJUVWN2.js → chunk-DKUEYTYD.js} +463 -218
- package/js/chunk-EM4UL26F.js +118 -0
- package/js/{chunk-WFSQXYUT.js → chunk-GHXRRFZA.js} +418 -52
- package/js/{chunk-5MQZEB6Y.js → chunk-KANDIVIH.js} +40 -12
- package/js/chunk-KAQD3DTI.js +16 -0
- package/js/chunk-KIM5HXNK.js +49 -0
- package/js/{chunk-FW5HBOIK.js → chunk-MXDKXAY4.js} +19117 -18309
- package/js/{chunk-2VPJHFOU.js → chunk-MYF7KWUB.js} +128 -24
- package/js/{chunk-T2LAZCAD.js → chunk-NKWWPJYX.js} +3 -3
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-3M2MEDNL.js → chunk-OTCLXFLL.js} +1337 -188
- package/js/chunk-P7MGDPFD.js +240 -0
- package/js/chunk-PDS2E2OZ.js +42 -0
- package/js/{chunk-ZCAMUXSG.js → chunk-PNVCCB4L.js} +432 -79
- package/js/{chunk-D47C7KG5.js → chunk-RIXVGVA6.js} +2 -2
- package/js/{chunk-6VRYO2BG.js → chunk-SALJXSS3.js} +779 -251
- package/js/{chunk-NQ3OMCA5.js → chunk-TT6OU4UG.js} +2 -2
- package/js/{chunk-YEJOQEII.js → chunk-UOZMSUJ2.js} +61 -9
- package/js/{chunk-G7ZIRKMK.js → chunk-VIU2XXA7.js} +228 -264
- package/js/{chunk-HDJH3RPR.js → chunk-VJQXXOQ3.js} +4 -4
- package/js/chunk-XDGUGB2A.js +156 -0
- package/js/{chunk-SATWJKN6.js → chunk-YQ35E7KS.js} +2 -2
- package/js/chunk-ZUKBIHMK.js +92 -0
- package/js/client.js +122 -88
- package/js/contracts.js +116 -25
- package/js/effect.js +19 -20
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +57 -55
- package/js/host.js +19 -20
- package/js/index.js +245 -212
- package/js/mcp/effect.js +23 -22
- package/js/mcp/stdio.js +34 -30
- package/js/mcp.js +104 -68
- package/js/openapi.js +4087 -1503
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +147 -65
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8517 -214
- package/package.json +2 -3
- package/runtime.json +1 -1
- package/types/app-data/src/contracts/database.d.ts +33 -6
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -8
- package/types/apps/src/contracts/cache.d.ts +14 -0
- package/types/apps/src/contracts/context.d.ts +12 -11
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/failure.d.ts +54 -0
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +44 -17
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +96 -10
- package/types/apps/src/contracts/network.d.ts +84 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +32 -3
- package/types/apps/src/contracts/openapi.d.ts +45 -9
- package/types/apps/src/contracts/operations.d.ts +8 -9
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +263 -74
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +66 -24
- package/types/apps/src/contracts/protocols/3.d.ts +715 -0
- package/types/apps/src/contracts/protocols/4.d.ts +1297 -0
- package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
- package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1130 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +115 -10
- package/types/apps/src/contracts/router.d.ts +59 -0
- package/types/apps/src/contracts/skills.d.ts +39 -9
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- package/types/apps/src/contracts/workflows.d.ts +40 -3
- package/types/apps/src/facet.d.ts +4 -5
- 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/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +32 -5
- package/types/apps/src/implementation/elicitation.d.ts +9 -9
- package/types/apps/src/implementation/failure-detail.d.ts +47 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +4 -1
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
- package/types/apps/src/implementation/mcp-client.d.ts +49 -25
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +52 -25
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +8 -6
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +36 -3
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -5
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +223 -0
- package/types/apps/src/implementation/router.d.ts +68 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +86 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +66 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +11 -5
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- 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 +30 -13
- package/types/apps/src/mcp-stdio.d.ts +2 -5
- package/types/apps/src/mcp.d.ts +25 -5
- package/types/apps/src/openapi.d.ts +6 -6
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +6 -3
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/recorded-failure.d.ts +20 -0
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +53 -0
- package/types/utils/src/recorded-message.d.ts +15 -0
- package/js/chunk-BMOIAIVR.js +0 -138
- package/js/chunk-DHUDODG5.js +0 -213
- package/js/chunk-FZJOYIZO.js +0 -19
- package/js/chunk-LGIYBDWA.js +0 -85
- package/js/chunk-M6ZRRIBI.js +0 -877
- package/js/chunk-PLCMJREA.js +0 -590
- package/js/chunk-PYUYJRSK.js +0 -93
- package/js/chunk-SWPD52J7.js +0 -35
- package/js/chunk-W7D7WVSY.js +0 -18
- package/js/chunk-Z5NMEGJN.js +0 -29
- package/js/chunk-ZJWDMTE3.js +0 -63
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -33
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/account-operations.d.ts +0 -151
- package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
- package/types/apps/src/implementation/storage.d.ts +0 -13
package/js/chunk-BMOIAIVR.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Schema_exports
|
|
3
|
-
} from "./chunk-FW5HBOIK.js";
|
|
4
|
-
|
|
5
|
-
// ../app-data/src/contracts/database.ts
|
|
6
|
-
var DataName = Schema_exports.String.check(
|
|
7
|
-
Schema_exports.makeFilter((value) => /^[A-Za-z][A-Za-z0-9_]*$/.test(value) && value.length <= 128)
|
|
8
|
-
);
|
|
9
|
-
var Scalar = Schema_exports.Union([Schema_exports.String, Schema_exports.Finite, Schema_exports.Boolean]);
|
|
10
|
-
var Field = Schema_exports.Struct({
|
|
11
|
-
kind: Schema_exports.Literals(["string", "number", "boolean", "id", "userId"]),
|
|
12
|
-
optional: Schema_exports.optional(Schema_exports.Boolean),
|
|
13
|
-
default: Schema_exports.optional(Scalar),
|
|
14
|
-
references: Schema_exports.optional(DataName)
|
|
15
|
-
});
|
|
16
|
-
var Index = Schema_exports.Struct({ name: DataName, fields: Schema_exports.NonEmptyArray(DataName) });
|
|
17
|
-
var Table = Schema_exports.Struct({
|
|
18
|
-
fields: Schema_exports.Record(DataName, Field),
|
|
19
|
-
indexes: Schema_exports.Array(Index)
|
|
20
|
-
});
|
|
21
|
-
var DatabaseSchema = Schema_exports.Record(DataName, Table);
|
|
22
|
-
var Row = Schema_exports.Record(Schema_exports.String, Scalar);
|
|
23
|
-
var RowMetadata = Schema_exports.Struct({
|
|
24
|
-
id: Schema_exports.NonEmptyString,
|
|
25
|
-
createdAt: Schema_exports.String,
|
|
26
|
-
updatedAt: Schema_exports.String
|
|
27
|
-
});
|
|
28
|
-
var Patch = Schema_exports.Record(DataName, Schema_exports.NullOr(Scalar));
|
|
29
|
-
var RangeClause = Schema_exports.Struct({
|
|
30
|
-
field: DataName,
|
|
31
|
-
op: Schema_exports.Literals(["eq", "gt", "gte", "lt", "lte"]),
|
|
32
|
-
value: Schema_exports.NullOr(Scalar)
|
|
33
|
-
});
|
|
34
|
-
var QueryPlan = Schema_exports.Struct({
|
|
35
|
-
table: DataName,
|
|
36
|
-
index: DataName,
|
|
37
|
-
order: Schema_exports.Literals(["asc", "desc"]),
|
|
38
|
-
clauses: Schema_exports.Array(RangeClause)
|
|
39
|
-
});
|
|
40
|
-
var QueryTerminal = Schema_exports.Union([
|
|
41
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("collect") }),
|
|
42
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("count") }),
|
|
43
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("first") }),
|
|
44
|
-
Schema_exports.Struct({
|
|
45
|
-
kind: Schema_exports.Literal("take"),
|
|
46
|
-
count: Schema_exports.Int.check(Schema_exports.isGreaterThanOrEqualTo(0))
|
|
47
|
-
}),
|
|
48
|
-
Schema_exports.Struct({
|
|
49
|
-
kind: Schema_exports.Literal("paginate"),
|
|
50
|
-
cursor: Schema_exports.NullOr(Schema_exports.String),
|
|
51
|
-
numItems: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
52
|
-
})
|
|
53
|
-
]);
|
|
54
|
-
var DatabaseOperation = Schema_exports.Union([
|
|
55
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("get"), table: DataName, id: Schema_exports.NonEmptyString }),
|
|
56
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("insert"), table: DataName, value: Patch }),
|
|
57
|
-
Schema_exports.Struct({
|
|
58
|
-
kind: Schema_exports.Literal("update"),
|
|
59
|
-
table: DataName,
|
|
60
|
-
id: Schema_exports.NonEmptyString,
|
|
61
|
-
patch: Patch
|
|
62
|
-
}),
|
|
63
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("delete"), table: DataName, id: Schema_exports.NonEmptyString }),
|
|
64
|
-
Schema_exports.Struct({ kind: Schema_exports.Literal("query"), plan: QueryPlan, terminal: QueryTerminal })
|
|
65
|
-
]);
|
|
66
|
-
var PaginationResult = Schema_exports.Struct({
|
|
67
|
-
page: Schema_exports.Array(Row),
|
|
68
|
-
continueCursor: Schema_exports.NullOr(Schema_exports.String),
|
|
69
|
-
isDone: Schema_exports.Boolean
|
|
70
|
-
});
|
|
71
|
-
var OperationResult = Schema_exports.Union([
|
|
72
|
-
Row,
|
|
73
|
-
Schema_exports.Array(Row),
|
|
74
|
-
PaginationResult,
|
|
75
|
-
Schema_exports.Boolean,
|
|
76
|
-
Schema_exports.Finite,
|
|
77
|
-
Schema_exports.Null
|
|
78
|
-
]);
|
|
79
|
-
var AppDatabaseError = class extends Schema_exports.TaggedError()("AppDatabaseError", {
|
|
80
|
-
reason: Schema_exports.Literals([
|
|
81
|
-
"schema",
|
|
82
|
-
"schema_changed",
|
|
83
|
-
"table",
|
|
84
|
-
"index",
|
|
85
|
-
"range",
|
|
86
|
-
"value",
|
|
87
|
-
"readonly",
|
|
88
|
-
"cursor",
|
|
89
|
-
"limit",
|
|
90
|
-
"closed",
|
|
91
|
-
"storage",
|
|
92
|
-
"replay"
|
|
93
|
-
])
|
|
94
|
-
}) {
|
|
95
|
-
};
|
|
96
|
-
var DatabaseLimits = Schema_exports.Struct({
|
|
97
|
-
rowsRead: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
98
|
-
rowsReturned: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
99
|
-
bytesRead: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
100
|
-
writes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
101
|
-
scanCalls: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
102
|
-
directGets: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
103
|
-
valueBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
104
|
-
indexBytes: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
105
|
-
});
|
|
106
|
-
var defaultDatabaseLimits = {
|
|
107
|
-
rowsRead: 5e3,
|
|
108
|
-
rowsReturned: 1e3,
|
|
109
|
-
bytesRead: 4 * 1024 * 1024,
|
|
110
|
-
writes: 1e3,
|
|
111
|
-
scanCalls: 100,
|
|
112
|
-
directGets: 1e3,
|
|
113
|
-
valueBytes: 64 * 1024,
|
|
114
|
-
indexBytes: 2048
|
|
115
|
-
};
|
|
116
|
-
var DatabaseRuntimeLimits = Schema_exports.Struct({
|
|
117
|
-
maxCursorChars: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
118
|
-
connectionCacheCapacity: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
119
|
-
connectionCacheTtlMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
120
|
-
});
|
|
121
|
-
var defaultDatabaseRuntimeLimits = DatabaseRuntimeLimits.make({
|
|
122
|
-
maxCursorChars: 8192,
|
|
123
|
-
connectionCacheCapacity: 64,
|
|
124
|
-
connectionCacheTtlMs: 5 * 60 * 1e3
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
DatabaseSchema,
|
|
129
|
-
Row,
|
|
130
|
-
RowMetadata,
|
|
131
|
-
RangeClause,
|
|
132
|
-
DatabaseOperation,
|
|
133
|
-
PaginationResult,
|
|
134
|
-
AppDatabaseError,
|
|
135
|
-
DatabaseLimits,
|
|
136
|
-
defaultDatabaseLimits,
|
|
137
|
-
defaultDatabaseRuntimeLimits
|
|
138
|
-
};
|
package/js/chunk-DHUDODG5.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseDatabaseSchema,
|
|
3
|
-
promiseTable
|
|
4
|
-
} from "./chunk-PLCMJREA.js";
|
|
5
|
-
import {
|
|
6
|
-
fromPromise,
|
|
7
|
-
nativeOperation
|
|
8
|
-
} from "./chunk-PYUYJRSK.js";
|
|
9
|
-
import {
|
|
10
|
-
ScheduleTiming
|
|
11
|
-
} from "./chunk-3M2MEDNL.js";
|
|
12
|
-
import {
|
|
13
|
-
decoderOf,
|
|
14
|
-
isSchema,
|
|
15
|
-
storageFieldOf
|
|
16
|
-
} from "./chunk-WFSQXYUT.js";
|
|
17
|
-
import {
|
|
18
|
-
AppStorageUnavailable
|
|
19
|
-
} from "./chunk-FZJOYIZO.js";
|
|
20
|
-
import {
|
|
21
|
-
JsonValue
|
|
22
|
-
} from "./chunk-SATWJKN6.js";
|
|
23
|
-
import {
|
|
24
|
-
Effect_exports,
|
|
25
|
-
Schema_exports
|
|
26
|
-
} from "./chunk-FW5HBOIK.js";
|
|
27
|
-
|
|
28
|
-
// src/implementation/workflows.ts
|
|
29
|
-
var NativeWorkflow = /* @__PURE__ */ Symbol("apps.Workflow");
|
|
30
|
-
var workflow = (options, run) => ({
|
|
31
|
-
[NativeWorkflow]: {
|
|
32
|
-
input: decoderOf(options.input),
|
|
33
|
-
...options.output === void 0 ? {} : { output: decoderOf(options.output) },
|
|
34
|
-
...options.description === void 0 ? {} : { description: options.description },
|
|
35
|
-
run: (context, input) => Effect_exports.tryPromise({
|
|
36
|
-
// SAFETY: defineApp checks required context; the host supplies the pinned run's capabilities.
|
|
37
|
-
try: () => run(context, input),
|
|
38
|
-
catch: (error) => error
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var nativeWorkflow = (value) => {
|
|
43
|
-
if (typeof value !== "object" || value === null || !(NativeWorkflow in value)) return void 0;
|
|
44
|
-
return value[NativeWorkflow];
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// src/implementation/app.ts
|
|
48
|
-
var InternalApp = /* @__PURE__ */ Symbol("apps.App");
|
|
49
|
-
var isApp = (value) => typeof value === "object" && value !== null && InternalApp in value;
|
|
50
|
-
var toEffectApp = (app) => app[InternalApp];
|
|
51
|
-
function adaptDefinition(definition) {
|
|
52
|
-
if ("tools" in definition) throw new Error("Use queries and mutations instead of tools");
|
|
53
|
-
const webhooks = definition.webhooks === void 0 ? {} : {
|
|
54
|
-
webhooks: Object.fromEntries(
|
|
55
|
-
Object.entries(definition.webhooks).map(([name, webhook]) => [
|
|
56
|
-
name,
|
|
57
|
-
{
|
|
58
|
-
...webhook,
|
|
59
|
-
...webhook.register === void 0 ? {} : { register: fromPromise(webhook.register) },
|
|
60
|
-
handle: fromPromise(webhook.handle),
|
|
61
|
-
...webhook.unregister === void 0 ? {} : { unregister: fromPromise(webhook.unregister) },
|
|
62
|
-
..."config" in webhook && isSchema(webhook.config) ? { config: decoderOf(webhook.config) } : {},
|
|
63
|
-
..."state" in webhook && isSchema(webhook.state) ? { state: decoderOf(webhook.state) } : {}
|
|
64
|
-
}
|
|
65
|
-
])
|
|
66
|
-
)
|
|
67
|
-
};
|
|
68
|
-
const operations = (kind, catalog) => Object.fromEntries(
|
|
69
|
-
Object.entries(catalog).map(([name, value]) => {
|
|
70
|
-
const operation = nativeOperation(value);
|
|
71
|
-
if (operation === void 0 || operation.kind !== kind)
|
|
72
|
-
throw new Error("Invalid app data operation");
|
|
73
|
-
return [name, operation];
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
const workflows = definition.workflows === void 0 ? {} : {
|
|
77
|
-
workflows: Object.fromEntries(
|
|
78
|
-
Object.entries(definition.workflows).map(([name, value]) => {
|
|
79
|
-
const declared = nativeWorkflow(value);
|
|
80
|
-
if (declared === void 0) throw new Error("Invalid workflow declaration");
|
|
81
|
-
return [name, declared];
|
|
82
|
-
})
|
|
83
|
-
)
|
|
84
|
-
};
|
|
85
|
-
const data = {
|
|
86
|
-
...definition.queries === void 0 ? {} : { queries: operations("query", definition.queries) },
|
|
87
|
-
...definition.mutations === void 0 ? {} : { mutations: operations("mutation", definition.mutations) }
|
|
88
|
-
};
|
|
89
|
-
const schedules = definition.schedules === void 0 ? {} : {
|
|
90
|
-
schedules: Object.fromEntries(
|
|
91
|
-
Object.entries(definition.schedules).map(([name, schedule]) => {
|
|
92
|
-
const matches = Object.entries(definition.mutations ?? {}).filter(
|
|
93
|
-
([, operation]) => operation === schedule.operation
|
|
94
|
-
);
|
|
95
|
-
const match = matches[0];
|
|
96
|
-
if (match === void 0 || matches.length !== 1)
|
|
97
|
-
throw new Error("A schedule must reference exactly one named mutation in this app");
|
|
98
|
-
return [
|
|
99
|
-
name,
|
|
100
|
-
{
|
|
101
|
-
timing: Schema_exports.decodeUnknownSync(ScheduleTiming)(schedule.timing),
|
|
102
|
-
input: Schema_exports.decodeUnknownSync(JsonValue)(schedule.input),
|
|
103
|
-
tool: `mutations.${match[0]}`
|
|
104
|
-
}
|
|
105
|
-
];
|
|
106
|
-
})
|
|
107
|
-
)
|
|
108
|
-
};
|
|
109
|
-
return {
|
|
110
|
-
...definition,
|
|
111
|
-
...webhooks,
|
|
112
|
-
...workflows,
|
|
113
|
-
...data,
|
|
114
|
-
...schedules
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
var defineApp = (requirements, definition) => {
|
|
118
|
-
const evaluate = typeof definition === "function" ? definition : async () => definition;
|
|
119
|
-
const factory = fromPromise(evaluate);
|
|
120
|
-
const native = {
|
|
121
|
-
accounts: requirements.accounts,
|
|
122
|
-
...requirements.database === void 0 ? {} : { database: requirements.database },
|
|
123
|
-
evaluate: (context) => factory(context).pipe(Effect_exports.map((value) => adaptDefinition(value)))
|
|
124
|
-
};
|
|
125
|
-
return {
|
|
126
|
-
[InternalApp]: native,
|
|
127
|
-
accounts: native.accounts,
|
|
128
|
-
evaluate: (context) => Effect_exports.runPromise(factory(context))
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// src/implementation/storage.ts
|
|
133
|
-
var table = (fields) => tableWithIndexes(fields, []);
|
|
134
|
-
var tableWithIndexes = (fields, indexes) => ({
|
|
135
|
-
fields,
|
|
136
|
-
indexes,
|
|
137
|
-
index: (name, fieldsInIndex) => tableWithIndexes(fields, [...indexes, { name, fields: fieldsInIndex }])
|
|
138
|
-
});
|
|
139
|
-
var serialize = (tables) => {
|
|
140
|
-
const definitions = Object.fromEntries(
|
|
141
|
-
Object.entries(tables).map(([name, table2]) => [
|
|
142
|
-
name,
|
|
143
|
-
{
|
|
144
|
-
fields: Object.fromEntries(
|
|
145
|
-
Object.entries(table2.fields).map(([fieldName, schema]) => {
|
|
146
|
-
const field = storageFieldOf(schema);
|
|
147
|
-
if (field === void 0) throw new Error("Database columns must use a scalar schema");
|
|
148
|
-
return [fieldName, field];
|
|
149
|
-
})
|
|
150
|
-
),
|
|
151
|
-
indexes: table2.indexes
|
|
152
|
-
}
|
|
153
|
-
])
|
|
154
|
-
);
|
|
155
|
-
return Effect_exports.runSync(parseDatabaseSchema(definitions));
|
|
156
|
-
};
|
|
157
|
-
var authorDatabase = (tables, session, signal, writable) => {
|
|
158
|
-
return Object.fromEntries(
|
|
159
|
-
Object.entries(tables).map(([name, table2]) => {
|
|
160
|
-
const api = promiseTable(session, name, signal);
|
|
161
|
-
const parseFields = (input, partial) => {
|
|
162
|
-
const values = Schema_exports.decodeUnknownSync(
|
|
163
|
-
Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)
|
|
164
|
-
)(input);
|
|
165
|
-
const fields = {};
|
|
166
|
-
for (const [key, value] of Object.entries(values)) {
|
|
167
|
-
if (value === void 0) continue;
|
|
168
|
-
const field = Object.hasOwn(table2.fields, key) ? table2.fields[key] : void 0;
|
|
169
|
-
if (field === void 0) throw new Error("Unknown database column");
|
|
170
|
-
const definition = storageFieldOf(field);
|
|
171
|
-
fields[key] = value === null && definition?.optional ? null : field.parse(value);
|
|
172
|
-
}
|
|
173
|
-
if (!partial) {
|
|
174
|
-
for (const [key, field] of Object.entries(table2.fields))
|
|
175
|
-
if (!Object.hasOwn(fields, key)) {
|
|
176
|
-
const value = field.parse(void 0);
|
|
177
|
-
if (value !== void 0) fields[key] = value;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return fields;
|
|
181
|
-
};
|
|
182
|
-
const read = { get: api.get, withIndex: api.withIndex };
|
|
183
|
-
return [
|
|
184
|
-
name,
|
|
185
|
-
writable ? {
|
|
186
|
-
...read,
|
|
187
|
-
insert: (value) => api.insert(parseFields(value, false)),
|
|
188
|
-
update: (id, value) => api.update(id, parseFields(value, true)),
|
|
189
|
-
delete: api.delete
|
|
190
|
-
} : read
|
|
191
|
-
];
|
|
192
|
-
})
|
|
193
|
-
);
|
|
194
|
-
};
|
|
195
|
-
var defineDatabase = (tables) => ({
|
|
196
|
-
schema: serialize(tables),
|
|
197
|
-
tables
|
|
198
|
-
});
|
|
199
|
-
var unavailableStorage = {
|
|
200
|
-
read: () => Effect_exports.fail(new AppStorageUnavailable()),
|
|
201
|
-
mutate: () => Effect_exports.fail(new AppStorageUnavailable())
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export {
|
|
205
|
-
workflow,
|
|
206
|
-
isApp,
|
|
207
|
-
toEffectApp,
|
|
208
|
-
defineApp,
|
|
209
|
-
table,
|
|
210
|
-
authorDatabase,
|
|
211
|
-
defineDatabase,
|
|
212
|
-
unavailableStorage
|
|
213
|
-
};
|
package/js/chunk-FZJOYIZO.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Schema_exports
|
|
3
|
-
} from "./chunk-FW5HBOIK.js";
|
|
4
|
-
|
|
5
|
-
// src/contracts/storage.ts
|
|
6
|
-
var StorageName = Schema_exports.NonEmptyString.check(Schema_exports.isMaxLength(200));
|
|
7
|
-
var AppStorageUnavailable = class extends Schema_exports.TaggedError()(
|
|
8
|
-
"AppStorageUnavailable",
|
|
9
|
-
{}
|
|
10
|
-
) {
|
|
11
|
-
};
|
|
12
|
-
var AppStorageError = class extends Schema_exports.TaggedError()("AppStorageError", {}) {
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
StorageName,
|
|
17
|
-
AppStorageUnavailable,
|
|
18
|
-
AppStorageError
|
|
19
|
-
};
|
package/js/chunk-LGIYBDWA.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Schema_exports
|
|
3
|
-
} from "./chunk-FW5HBOIK.js";
|
|
4
|
-
|
|
5
|
-
// ../app-cache/src/contracts/cache.ts
|
|
6
|
-
var CacheError = class extends Schema_exports.TaggedError()("CacheError", {
|
|
7
|
-
reason: Schema_exports.Literals(["unavailable", "storage", "invalid", "capacity", "timeout"])
|
|
8
|
-
}) {
|
|
9
|
-
};
|
|
10
|
-
var cacheLimits = {
|
|
11
|
-
keyBytes: 8192,
|
|
12
|
-
entryBytes: 2e6,
|
|
13
|
-
batchBytes: 8e6,
|
|
14
|
-
batchEntries: 128,
|
|
15
|
-
totalBytes: 128e6,
|
|
16
|
-
totalEntries: 1e5,
|
|
17
|
-
retentionMs: 7 * 24 * 60 * 60 * 1e3,
|
|
18
|
-
loadTimeoutMs: 9e4,
|
|
19
|
-
/**
|
|
20
|
-
* A loader's lease lapses this long after its host last renewed it. Hosts renew every
|
|
21
|
-
* `renewMs` while the invocation that claimed it runs, so a stalled or lost holder frees the
|
|
22
|
-
* key well inside an MCP execute budget.
|
|
23
|
-
*/
|
|
24
|
-
leaseMs: 15e3,
|
|
25
|
-
renewMs: 5e3,
|
|
26
|
-
/** The longest a caller waits on another loader before loading for itself without publishing. */
|
|
27
|
-
waitMs: 1e4,
|
|
28
|
-
/** Bound for one command to a host store; a lost reply fails instead of holding its caller. */
|
|
29
|
-
commandTimeoutMs: 1e4
|
|
30
|
-
};
|
|
31
|
-
var Key = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{64}$/));
|
|
32
|
-
var Time = Schema_exports.Finite.check(Schema_exports.isGreaterThanOrEqualTo(0));
|
|
33
|
-
var CacheEntry = Schema_exports.Struct({
|
|
34
|
-
value: Schema_exports.Json,
|
|
35
|
-
version: Schema_exports.String,
|
|
36
|
-
freshUntil: Time,
|
|
37
|
-
staleUntil: Time
|
|
38
|
-
});
|
|
39
|
-
var CacheAcquired = Schema_exports.Struct({
|
|
40
|
-
entry: Schema_exports.NullOr(CacheEntry),
|
|
41
|
-
lease: Schema_exports.NullOr(Schema_exports.String)
|
|
42
|
-
});
|
|
43
|
-
var CacheCommand = Schema_exports.Union([
|
|
44
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("read"), keys: Schema_exports.Array(Key) }),
|
|
45
|
-
Schema_exports.Struct({
|
|
46
|
-
operation: Schema_exports.Literal("acquire"),
|
|
47
|
-
key: Key,
|
|
48
|
-
/** Claim even a fresh entry, as an explicit refresh does. */
|
|
49
|
-
refresh: Schema_exports.Boolean,
|
|
50
|
-
/** Claim only while the entry still has this version. Absent accepts the current one. */
|
|
51
|
-
version: Schema_exports.optionalKey(Schema_exports.NullOr(Schema_exports.String))
|
|
52
|
-
}),
|
|
53
|
-
Schema_exports.Struct({
|
|
54
|
-
operation: Schema_exports.Literal("claim"),
|
|
55
|
-
key: Key,
|
|
56
|
-
version: Schema_exports.NullOr(Schema_exports.String)
|
|
57
|
-
}),
|
|
58
|
-
Schema_exports.Struct({
|
|
59
|
-
operation: Schema_exports.Literal("publish"),
|
|
60
|
-
key: Key,
|
|
61
|
-
lease: Schema_exports.String,
|
|
62
|
-
entry: CacheEntry
|
|
63
|
-
}),
|
|
64
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("release"), key: Key, lease: Schema_exports.String }),
|
|
65
|
-
/** Extend a lease its holder still owns. Replies false once the lease lapsed or was replaced. */
|
|
66
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("renew"), key: Key, lease: Schema_exports.String }),
|
|
67
|
-
Schema_exports.Struct({
|
|
68
|
-
operation: Schema_exports.Literal("write"),
|
|
69
|
-
entries: Schema_exports.Array(Schema_exports.Struct({ key: Key, entry: CacheEntry }))
|
|
70
|
-
}),
|
|
71
|
-
Schema_exports.Struct({ operation: Schema_exports.Literal("invalidate"), key: Key })
|
|
72
|
-
]);
|
|
73
|
-
var CacheReply = Schema_exports.Union([
|
|
74
|
-
Schema_exports.Struct({ ok: Schema_exports.Literal(true), value: Schema_exports.Json }),
|
|
75
|
-
Schema_exports.Struct({ ok: Schema_exports.Literal(false), error: CacheError })
|
|
76
|
-
]);
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
CacheError,
|
|
80
|
-
cacheLimits,
|
|
81
|
-
CacheEntry,
|
|
82
|
-
CacheAcquired,
|
|
83
|
-
CacheCommand,
|
|
84
|
-
CacheReply
|
|
85
|
-
};
|