apps 0.0.1-beta.36 → 0.0.1-beta.38
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/framework-reference.json +1 -1
- package/js/{chunk-KOOJUMLR.js → chunk-3MMG2H6M.js} +2 -2
- package/js/{chunk-XEXUHXC3.js → chunk-3V575NIW.js} +226 -18
- package/js/{chunk-KZFV3WCJ.js → chunk-5P2WQRRM.js} +385 -56
- package/js/{chunk-4U2VUDET.js → chunk-5TJA7364.js} +2 -2
- package/js/{chunk-BKJDZYK7.js → chunk-7CSHVXVR.js} +3 -3
- package/js/{chunk-ZQWDOHEO.js → chunk-BO4US6DZ.js} +9 -49
- package/js/{chunk-A4O72Z3A.js → chunk-DKUEYTYD.js} +167 -30
- package/js/{chunk-UBAKWXAJ.js → chunk-DWMEIU2L.js} +411 -94
- package/js/{chunk-ENJCQWVF.js → chunk-E4BWL7KQ.js} +3 -3
- package/js/{chunk-CZLCA2O4.js → chunk-F3TBO2U3.js} +7 -94
- package/js/{chunk-POOIHRPF.js → chunk-GHXRRFZA.js} +11 -34
- package/js/{chunk-RSNZDT4L.js → chunk-JTMDWPCH.js} +2 -2
- package/js/{chunk-YW333DH3.js → chunk-KANDIVIH.js} +4 -4
- package/js/chunk-KAQD3DTI.js +16 -0
- package/js/{chunk-556EWA6P.js → chunk-MLHNVYHT.js} +17 -4
- package/js/{chunk-IJQ5LE74.js → chunk-MXDKXAY4.js} +363 -401
- package/js/{chunk-A2NN45C7.js → chunk-NROBHRTG.js} +7 -7
- package/js/{chunk-BI6R577B.js → chunk-P7MGDPFD.js} +2 -2
- package/js/{chunk-SRB2WDU7.js → chunk-Q4QZDB2F.js} +3 -3
- package/js/{chunk-JU7F4PRK.js → chunk-RIXVGVA6.js} +2 -2
- package/js/{chunk-WAGGHNWH.js → chunk-RJCWJNCH.js} +9 -9
- package/js/{chunk-WMVTBHGK.js → chunk-U5PFZDVB.js} +2 -2
- package/js/{chunk-PHO7HXTC.js → chunk-VIU2XXA7.js} +294 -47
- package/js/{chunk-TADLIUEU.js → chunk-VJQXXOQ3.js} +2 -2
- package/js/{chunk-NHCFIWN5.js → chunk-W2NV54JD.js} +1 -1
- package/js/{chunk-BI45HZWM.js → chunk-YQ35E7KS.js} +1 -1
- package/js/{chunk-WDBUOIWV.js → chunk-ZUKBIHMK.js} +3 -3
- package/js/client.js +13 -16
- package/js/contracts.js +16 -20
- package/js/effect.js +19 -23
- package/js/graphql.js +21 -25
- package/js/host.js +19 -23
- package/js/index.js +13 -25
- package/js/mcp/effect.js +21 -25
- package/js/mcp/stdio.js +21 -25
- package/js/mcp.js +23 -27
- package/js/openapi.js +17 -20
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -6
- package/js/skills.js +15 -16
- package/js/storage/facet.js +1 -214
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -6
- package/js/ui/serving.js +10 -10
- package/package.json +1 -2
- package/runtime.json +1 -1
- package/types/apps/src/contracts/app.d.ts +0 -2
- package/types/apps/src/contracts/context.d.ts +12 -11
- package/types/apps/src/contracts/host.d.ts +10 -8
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/operations.d.ts +3 -3
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/4.d.ts +3 -3
- package/types/apps/src/contracts/protocols/5.d.ts +1 -1
- package/types/apps/src/contracts/protocols/6.d.ts +1 -1
- package/types/apps/src/contracts/protocols/7.d.ts +1 -1
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/implementation/openapi-compile.d.ts +2 -2
- package/types/apps/src/implementation/schema.d.ts +1 -10
- package/types/apps/src/implementation/sql.d.ts +66 -0
- package/types/apps/src/index.d.ts +1 -2
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/recorded-failure.d.ts +20 -0
- package/types/utils/src/api-error.d.ts +5 -0
- package/types/utils/src/recorded-message.d.ts +15 -0
- package/js/chunk-73AV3JVU.js +0 -186
- package/js/chunk-HDAQBRT5.js +0 -1254
- package/js/chunk-IU7CCCUC.js +0 -630
- package/js/chunk-NHUHTWAF.js +0 -0
- package/js/chunk-V5DWGYRK.js +0 -268
- package/js/chunk-Y3XN4X4Q.js +0 -19
- 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 -18
- 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/storage.d.ts +0 -68
- package/types/apps/src/implementation/storage.d.ts +0 -15
|
@@ -313,7 +313,7 @@ export declare class HostKindMismatch extends HostKindMismatch_base {
|
|
|
313
313
|
* Safe error envelope. Author failures carry only their name and bounded message with account
|
|
314
314
|
* secrets replaced; no source, account fields, stack or cause value is serialized.
|
|
315
315
|
*/
|
|
316
|
-
export declare const HostError: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof HostDeclarationInvalid, typeof HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/
|
|
316
|
+
export declare const HostError: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof HostDeclarationInvalid, typeof HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/contracts/database.js").DatabaseLimitExceeded, typeof import("../../../../app-data/src/contracts/database.js").DatabaseFieldReserved, typeof import("./1.js").HostToolNotFound, typeof import("./1.js").HostInputInvalid, typeof import("./1.js").HostOutputInvalid, typeof import("./1.js").HostToolBlocked, typeof import("./1.js").HostToolApprovalRequired, typeof import("./1.js").HostToolPolicyFailed, typeof import("../elicitation.js").ElicitationFailed, typeof HostKindMismatch]>;
|
|
317
317
|
/** Expected host failures. */
|
|
318
318
|
export type HostError = typeof HostError.Type;
|
|
319
319
|
/** Portable response envelope; callers parse the success value for their operation. */
|
|
@@ -323,7 +323,7 @@ export declare const HostResponse: Schema.Union<readonly [Schema.Struct<{
|
|
|
323
323
|
readonly toolError: Schema.optionalKey<Schema.Literal<true>>;
|
|
324
324
|
}>, Schema.Struct<{
|
|
325
325
|
readonly ok: Schema.Literal<false>;
|
|
326
|
-
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof HostDeclarationInvalid, typeof HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/
|
|
326
|
+
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof HostDeclarationInvalid, typeof HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/contracts/database.js").DatabaseLimitExceeded, typeof import("../../../../app-data/src/contracts/database.js").DatabaseFieldReserved, typeof import("./1.js").HostToolNotFound, typeof import("./1.js").HostInputInvalid, typeof import("./1.js").HostOutputInvalid, typeof import("./1.js").HostToolBlocked, typeof import("./1.js").HostToolApprovalRequired, typeof import("./1.js").HostToolPolicyFailed, typeof import("../elicitation.js").ElicitationFailed, typeof HostKindMismatch]>;
|
|
327
327
|
}>]>;
|
|
328
328
|
/** Parsed response envelope. */
|
|
329
329
|
export type HostResponse = typeof HostResponse.Type;
|
|
@@ -949,7 +949,7 @@ export declare const protocol4: {
|
|
|
949
949
|
readonly toolError: Schema.optionalKey<Schema.Literal<true>>;
|
|
950
950
|
}>, Schema.Struct<{
|
|
951
951
|
readonly ok: Schema.Literal<false>;
|
|
952
|
-
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof HostDeclarationInvalid, typeof HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/
|
|
952
|
+
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof ProviderError, typeof McpError, typeof SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof HostDeclarationInvalid, typeof HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/contracts/database.js").DatabaseLimitExceeded, typeof import("../../../../app-data/src/contracts/database.js").DatabaseFieldReserved, typeof import("./1.js").HostToolNotFound, typeof import("./1.js").HostInputInvalid, typeof import("./1.js").HostOutputInvalid, typeof import("./1.js").HostToolBlocked, typeof import("./1.js").HostToolApprovalRequired, typeof import("./1.js").HostToolPolicyFailed, typeof import("../elicitation.js").ElicitationFailed, typeof HostKindMismatch]>;
|
|
953
953
|
}>]>;
|
|
954
954
|
readonly requirements: Schema.Struct<{
|
|
955
955
|
readonly capabilities: Schema.optionalKey<Schema.Struct<{
|
|
@@ -918,7 +918,7 @@ export declare const protocol5: {
|
|
|
918
918
|
readonly toolError: Schema.optionalKey<Schema.Literal<true>>;
|
|
919
919
|
}>, Schema.Struct<{
|
|
920
920
|
readonly ok: Schema.Literal<false>;
|
|
921
|
-
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof import("./1.js").ProviderError, typeof import("./1.js").McpError, typeof import("./1.js").SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof import("./3.js").HostDeclarationInvalid, typeof import("./3.js").HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/
|
|
921
|
+
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof import("./1.js").ProviderError, typeof import("./1.js").McpError, typeof import("./1.js").SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof import("./3.js").HostDeclarationInvalid, typeof import("./3.js").HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/contracts/database.js").DatabaseLimitExceeded, typeof import("../../../../app-data/src/contracts/database.js").DatabaseFieldReserved, typeof import("./1.js").HostToolNotFound, typeof import("./1.js").HostInputInvalid, typeof import("./1.js").HostOutputInvalid, typeof import("./1.js").HostToolBlocked, typeof import("./1.js").HostToolApprovalRequired, typeof import("./1.js").HostToolPolicyFailed, typeof import("../elicitation.js").ElicitationFailed, typeof import("./4.js").HostKindMismatch]>;
|
|
922
922
|
}>]>;
|
|
923
923
|
readonly catalog: Schema.Struct<{
|
|
924
924
|
readonly tools: Schema.$Array<Schema.Struct<{
|
|
@@ -1364,7 +1364,7 @@ export declare const protocol6: {
|
|
|
1364
1364
|
readonly toolError: Schema.optionalKey<Schema.Literal<true>>;
|
|
1365
1365
|
}>, Schema.Struct<{
|
|
1366
1366
|
readonly ok: Schema.Literal<false>;
|
|
1367
|
-
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof import("./1.js").ProviderError, typeof import("./1.js").McpError, typeof import("./1.js").SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof import("./3.js").HostDeclarationInvalid, typeof import("./3.js").HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/
|
|
1367
|
+
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof import("./1.js").ProviderError, typeof import("./1.js").McpError, typeof import("./1.js").SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof import("./3.js").HostDeclarationInvalid, typeof import("./3.js").HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/contracts/database.js").DatabaseLimitExceeded, typeof import("../../../../app-data/src/contracts/database.js").DatabaseFieldReserved, typeof import("./1.js").HostToolNotFound, typeof import("./1.js").HostInputInvalid, typeof import("./1.js").HostOutputInvalid, typeof import("./1.js").HostToolBlocked, typeof import("./1.js").HostToolApprovalRequired, typeof import("./1.js").HostToolPolicyFailed, typeof import("../elicitation.js").ElicitationFailed, typeof import("./4.js").HostKindMismatch]>;
|
|
1368
1368
|
}>]>;
|
|
1369
1369
|
readonly catalog: Schema.Struct<{
|
|
1370
1370
|
readonly tools: Schema.$Array<Schema.Struct<{
|
|
@@ -1528,7 +1528,7 @@ export declare const protocol7: {
|
|
|
1528
1528
|
readonly toolError: Schema.optionalKey<Schema.Literal<true>>;
|
|
1529
1529
|
}>, Schema.Struct<{
|
|
1530
1530
|
readonly ok: Schema.Literal<false>;
|
|
1531
|
-
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof import("./1.js").ProviderError, typeof import("./1.js").McpError, typeof import("./1.js").SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof import("./3.js").HostDeclarationInvalid, typeof import("./3.js").HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/
|
|
1531
|
+
readonly error: Schema.Union<readonly [typeof import("../api-response-error.js").OpenapiResponseError, typeof import("./1.js").ProviderError, typeof import("./1.js").McpError, typeof import("./1.js").SkillLoadFailed, typeof import("../workflows.js").WorkflowFailure, typeof import("./1.js").HostRequestInvalid, typeof import("./1.js").HostAccountsInvalid, typeof import("./3.js").HostDeclarationInvalid, typeof import("./3.js").HostEvaluationFailed, typeof import("./1.js").HostOperationNotFound, typeof import("./3.js").HostOperationFailed, typeof import("../../../../app-data/src/contracts/database.js").DatabaseLimitExceeded, typeof import("../../../../app-data/src/contracts/database.js").DatabaseFieldReserved, typeof import("./1.js").HostToolNotFound, typeof import("./1.js").HostInputInvalid, typeof import("./1.js").HostOutputInvalid, typeof import("./1.js").HostToolBlocked, typeof import("./1.js").HostToolApprovalRequired, typeof import("./1.js").HostToolPolicyFailed, typeof import("../elicitation.js").ElicitationFailed, typeof import("./4.js").HostKindMismatch]>;
|
|
1532
1532
|
}>]>;
|
|
1533
1533
|
readonly catalog: Schema.Struct<{
|
|
1534
1534
|
readonly tools: Schema.$Array<Schema.Struct<{
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-owned SQLite. An app with migrations in `migrations/` reads and writes its own database with
|
|
3
|
+
* plain SQL. The author API mirrors Cloudflare's `SqlStorage`, so tools built for Durable Object
|
|
4
|
+
* SQLite fit it.
|
|
5
|
+
*/
|
|
6
|
+
/** A value SQLite stores or returns. */
|
|
7
|
+
export type SqlValue = string | number | null | ArrayBuffer;
|
|
8
|
+
/** One result row, keyed by column name. */
|
|
9
|
+
export type SqlRow = Record<string, SqlValue>;
|
|
10
|
+
/** The rows of one statement, already read, and what the statement read and wrote. */
|
|
11
|
+
export interface SqlCursor<Row extends SqlRow = SqlRow> extends Iterable<Row> {
|
|
12
|
+
readonly columnNames: readonly string[];
|
|
13
|
+
readonly rowsRead: number;
|
|
14
|
+
readonly rowsWritten: number;
|
|
15
|
+
toArray(): Row[];
|
|
16
|
+
/** The only row. Throws unless the statement returned exactly one. */
|
|
17
|
+
one(): Row;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Read-only SQL. Query tools receive this. A query runs in a transaction that is always rolled
|
|
21
|
+
* back, so nothing it changes commits; one that changes rows fails.
|
|
22
|
+
*/
|
|
23
|
+
export interface SqlReader {
|
|
24
|
+
exec<Row extends SqlRow = SqlRow>(query: string, ...bindings: SqlValue[]): SqlCursor<Row>;
|
|
25
|
+
}
|
|
26
|
+
/** SQL inside one transaction. */
|
|
27
|
+
export type SqlTransaction = SqlReader;
|
|
28
|
+
/**
|
|
29
|
+
* Writable SQL. Outside a transaction every statement commits on its own. `transaction` runs its
|
|
30
|
+
* callback synchronously in one SQLite transaction, so no transaction can stay open while the app
|
|
31
|
+
* waits on anything else; throwing rolls it back. Apps call outside services between transactions.
|
|
32
|
+
*/
|
|
33
|
+
export interface Sql extends SqlReader {
|
|
34
|
+
transaction<T>(work: (tx: SqlTransaction) => Synchronous<T>): T;
|
|
35
|
+
}
|
|
36
|
+
/** A transaction callback's result: a Promise means the callback awaited, which is refused. */
|
|
37
|
+
export type Synchronous<T> = T extends PromiseLike<unknown> ? never : T;
|
|
38
|
+
/** The Durable Object storage a data facet hands its app. App code never receives it. */
|
|
39
|
+
export interface AppSqlStorage {
|
|
40
|
+
readonly sql: {
|
|
41
|
+
exec(query: string, ...bindings: SqlValue[]): {
|
|
42
|
+
readonly columnNames: string[];
|
|
43
|
+
readonly rowsRead: number;
|
|
44
|
+
readonly rowsWritten: number;
|
|
45
|
+
toArray(): Record<string, SqlValue>[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
transactionSync<T>(work: () => T): T;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Tables Executor keeps in an app's database: applied migrations, workflow step receipts, and
|
|
52
|
+
* `_executor_legacy_rows (table_name, id, body)`, the rows of the document API apps used before
|
|
53
|
+
* SQL, with JSON bodies (empty for apps that never stored any). Apps should only read them; a
|
|
54
|
+
* changed migration history fails the next deploy.
|
|
55
|
+
*/
|
|
56
|
+
export declare const reservedTablePrefix = "_executor_";
|
|
57
|
+
/** Where an app keeps its migrations: `0001_create_notes.sql`, applied in number order. */
|
|
58
|
+
export declare const migrationsDirectory = "migrations";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Portable workflow declarations, run views and durable execution capabilities. */
|
|
2
2
|
import { Schema, type Effect } from "effect";
|
|
3
|
+
import { RecordedMessage } from "../../../utils/src/recorded-message.js";
|
|
3
4
|
import { JsonValue } from "./schema.js";
|
|
4
5
|
import type { AppContext, AppRequirements, QueryContext, MutationContext } from "./context.js";
|
|
5
6
|
import type { Operation } from "../implementation/operations.js";
|
|
@@ -49,6 +50,11 @@ declare const WorkflowFailure_base: Schema.Class<WorkflowFailure, Schema.TaggedS
|
|
|
49
50
|
}>, import("effect/Cause").YieldableError>;
|
|
50
51
|
/** Failures cross host boundaries as reason codes plus the app's own bounded error detail. */
|
|
51
52
|
export declare class WorkflowFailure extends WorkflowFailure_base {
|
|
53
|
+
/**
|
|
54
|
+
* The step name and error detail are the app's. Its run's owner reads them; telemetry records
|
|
55
|
+
* only the reason, however the failure was built or decoded.
|
|
56
|
+
*/
|
|
57
|
+
get [RecordedMessage](): string | undefined;
|
|
52
58
|
}
|
|
53
59
|
/** Explicitly stop retrying an authored step. Its message is reported like any step error. */
|
|
54
60
|
export declare class NonRetryableError extends Error {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const facetStorage: (storage: NonNullable<Sqlite.SqliteClientConfig["storage"]>) => AppStorage;
|
|
1
|
+
/** The data facet's storage capability; used only by the generated data facet, never browser bundles. */
|
|
2
|
+
import type { AppSqlStorage } from "./contracts/sql.js";
|
|
3
|
+
/** Bind one facet's storage at the runtime edge. App code receives `ctx.sql` over it, never the storage. */
|
|
4
|
+
export declare const facetStorage: (storage: AppSqlStorage) => AppSqlStorage;
|
|
@@ -25,11 +25,10 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
25
25
|
}) => Effect.Effect<{
|
|
26
26
|
operations: {
|
|
27
27
|
readonly description: string;
|
|
28
|
-
readonly name: string;
|
|
29
28
|
readonly request: {
|
|
30
29
|
readonly parameters: readonly {
|
|
31
30
|
readonly name: string;
|
|
32
|
-
readonly in: "
|
|
31
|
+
readonly in: "path" | "query" | "querystring" | "header" | "cookie";
|
|
33
32
|
readonly required?: boolean;
|
|
34
33
|
readonly schema?: {
|
|
35
34
|
readonly [x: string]: Schema.Json;
|
|
@@ -65,6 +64,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
65
64
|
};
|
|
66
65
|
};
|
|
67
66
|
readonly path: string;
|
|
67
|
+
readonly name: string;
|
|
68
68
|
readonly input: {
|
|
69
69
|
readonly [x: string]: Schema.Json;
|
|
70
70
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/** Author schema facade. Internals use the native decoder retained by each value. */
|
|
2
2
|
import { Effect, Schema as EffectSchema } from "effect";
|
|
3
3
|
import { JsonObject, ValidationError } from "../contracts/schema.js";
|
|
4
|
-
import type { Field } from "../../../app-data/src/contracts/database.js";
|
|
5
4
|
import type { FieldExposure } from "../contracts/provider.js";
|
|
6
|
-
declare const StorageField: unique symbol;
|
|
7
5
|
declare const Decoder: unique symbol;
|
|
8
6
|
/** An author-facing value schema. Effect is never required in author code. */
|
|
9
7
|
export interface Schema<T, Optional extends boolean = false> {
|
|
10
|
-
readonly [StorageField]?: Field;
|
|
11
8
|
readonly [Decoder]: EffectSchema.Decoder<T>;
|
|
12
9
|
readonly optionalValue: Optional;
|
|
13
10
|
/** Parse an unknown value; invalid input throws a safe ValidationError. */
|
|
@@ -46,7 +43,7 @@ export declare const schemaArgument: <S extends Schema<unknown, boolean>>(value:
|
|
|
46
43
|
/** Decode within an Effect program. Invalid input is omitted from the failure. */
|
|
47
44
|
export declare const parse: <T>(decoder: EffectSchema.Decoder<T>, input: unknown) => Effect.Effect<T, ValidationError>;
|
|
48
45
|
/** Present a native decoder through the synchronous author API. */
|
|
49
|
-
export declare function wrap<T, Optional extends boolean>(decoder: EffectSchema.Decoder<T>, optionalValue: Optional
|
|
46
|
+
export declare function wrap<T, Optional extends boolean>(decoder: EffectSchema.Decoder<T>, optionalValue: Optional): Schema<T, Optional>;
|
|
50
47
|
/** A string, optionally with a minimum length. No coercion. */
|
|
51
48
|
export declare function string(options?: {
|
|
52
49
|
readonly minLength?: number;
|
|
@@ -165,12 +162,6 @@ export declare const preparedJsonSchemaDecoder: (document: JsonObject) => {
|
|
|
165
162
|
export declare const jsonSchemaDecoder: (input: unknown) => Effect.Effect<EffectSchema.declareConstructor<EffectSchema.Json, EffectSchema.Json, readonly [], EffectSchema.Json>, ValidationError, never>;
|
|
166
163
|
/** Import JSON metadata now; unsupported schemas and invalid values fail when parsed. */
|
|
167
164
|
export declare const jsonSchema: (input: unknown) => Schema<EffectSchema.Json>;
|
|
168
|
-
/** Database declaration retained by primitive constructors; nested payload schemas are not database fields. */
|
|
169
|
-
export declare const storageFieldOf: (schema: Schema<unknown, boolean>) => Field | undefined;
|
|
170
|
-
/** A row reference records the target table; existence is not a foreign-key constraint. */
|
|
171
|
-
export declare const id: (table: string) => Schema<string>;
|
|
172
|
-
/** A host user identifier, stored as a string without imposing a product auth model. */
|
|
173
|
-
export declare const userId: () => Schema<string>;
|
|
174
165
|
/** Render a decoder as a JSON Schema document, keeping an imported upstream document as-is. */
|
|
175
166
|
export declare const jsonSchemaDocument: (decoder: EffectSchema.Decoder<unknown>) => Effect.Effect<{
|
|
176
167
|
readonly [x: string]: EffectSchema.Json;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ctx.sql` over a data facet's SQLite storage, and the deploy-time migrator.
|
|
3
|
+
*
|
|
4
|
+
* Every statement runs inside a synchronous SQLite transaction: alone, or inside the author's
|
|
5
|
+
* `transaction`. Nothing here can wait on another call, so no lock or transaction outlives the
|
|
6
|
+
* statement that needs it. What a statement may do is decided by SQLite, not by reading the SQL:
|
|
7
|
+
* a query runs in a transaction that is always rolled back.
|
|
8
|
+
*/
|
|
9
|
+
import { Effect, Schema } from "effect";
|
|
10
|
+
import { type AppSqlStorage, type Sql, type SqlReader } from "../contracts/sql.js";
|
|
11
|
+
import type { SkillFile } from "../contracts/skills.js";
|
|
12
|
+
export declare const noDatabase: Sql;
|
|
13
|
+
/** A workflow step mutation's identity, from the host's replay record. */
|
|
14
|
+
export interface StepReplay {
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly fingerprint: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One invocation's SQL. Once the invocation ends or `signal` aborts, every statement is refused, so
|
|
20
|
+
* code still running after a timeout or cancellation cannot write late.
|
|
21
|
+
*/
|
|
22
|
+
export declare const authorSql: (storage: AppSqlStorage, options: {
|
|
23
|
+
readonly signal: AbortSignal;
|
|
24
|
+
readonly step?: StepReplay;
|
|
25
|
+
}) => {
|
|
26
|
+
reader: SqlReader;
|
|
27
|
+
writer: Sql;
|
|
28
|
+
close: () => void;
|
|
29
|
+
};
|
|
30
|
+
declare const MigrationFileInvalid_base: Schema.Class<MigrationFileInvalid, Schema.TaggedStruct<"MigrationFileInvalid", {
|
|
31
|
+
readonly path: Schema.String;
|
|
32
|
+
readonly reason: Schema.String;
|
|
33
|
+
}>, import("effect/Cause").YieldableError>;
|
|
34
|
+
/** A file in `migrations/` that is not a migration the host can order. */
|
|
35
|
+
export declare class MigrationFileInvalid extends MigrationFileInvalid_base {
|
|
36
|
+
get message(): string;
|
|
37
|
+
}
|
|
38
|
+
declare const MigrationHistoryChanged_base: Schema.Class<MigrationHistoryChanged, Schema.TaggedStruct<"MigrationHistoryChanged", {
|
|
39
|
+
readonly reason: Schema.String;
|
|
40
|
+
}>, import("effect/Cause").YieldableError>;
|
|
41
|
+
/** The build's migrations no longer start with the ones already applied to the database. */
|
|
42
|
+
export declare class MigrationHistoryChanged extends MigrationHistoryChanged_base {
|
|
43
|
+
get message(): string;
|
|
44
|
+
}
|
|
45
|
+
declare const MigrationFailed_base: Schema.Class<MigrationFailed, Schema.TaggedStruct<"MigrationFailed", {
|
|
46
|
+
readonly path: Schema.String;
|
|
47
|
+
readonly reason: Schema.String;
|
|
48
|
+
}>, import("effect/Cause").YieldableError>;
|
|
49
|
+
/** SQLite rejected a migration. Every migration of the deploy rolled back. */
|
|
50
|
+
export declare class MigrationFailed extends MigrationFailed_base {
|
|
51
|
+
get message(): string;
|
|
52
|
+
}
|
|
53
|
+
/** Whether a build's files give the app a database: any `.sql` file in `migrations/`. */
|
|
54
|
+
export declare const hasMigrations: (files: readonly {
|
|
55
|
+
readonly path: string;
|
|
56
|
+
}[]) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Apply the build's pending migrations and report which ran. Every pending migration runs in one
|
|
59
|
+
* transaction, so a failing one leaves the database exactly as the active deployment knows it. The
|
|
60
|
+
* migrations already applied must still be the build's first ones, byte for byte.
|
|
61
|
+
*/
|
|
62
|
+
export declare const migrate: (storage: AppSqlStorage, files: readonly SkillFile[]) => Effect.Effect<{
|
|
63
|
+
readonly id: number;
|
|
64
|
+
readonly name: string;
|
|
65
|
+
}[], MigrationFileInvalid | MigrationHistoryChanged | MigrationFailed, never>;
|
|
66
|
+
export {};
|
|
@@ -73,8 +73,7 @@ export type JsonResponse = PromiseMethods<NativeResponse>;
|
|
|
73
73
|
export declare const decodeJson: <T>(response: JsonResponse, schema: Schema<T, boolean>) => Promise<T>;
|
|
74
74
|
export { NotImplemented } from "./contracts/app.js";
|
|
75
75
|
export { ElicitationFailed, type FormElicitation, type ElicitationResponse, type Elicit, } from "./contracts/elicitation.js";
|
|
76
|
-
export {
|
|
77
|
-
export { id, userId } from "./implementation/schema.js";
|
|
76
|
+
export type { Sql, SqlCursor, SqlReader, SqlRow, SqlTransaction, SqlValue, } from "./contracts/sql.js";
|
|
78
77
|
export { query, mutation, withApproval, toolAnnotations, type Operation, type OperationOptions, } from "./implementation/operations.js";
|
|
79
78
|
export type { OperationContext } from "./contracts/operations.js";
|
|
80
79
|
export { workflow, type Workflow, type WorkflowDeclaration } from "./implementation/workflows.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host keeps of the spans and logs an app isolate returns.
|
|
3
|
+
*
|
|
4
|
+
* Those records come from whatever framework the app's build bundles, and the app's own code runs
|
|
5
|
+
* in the same isolate: it can throw any text, name its errors and codes, and rewrite every record
|
|
6
|
+
* before the isolate returns it. So the host does not filter the records it receives. It builds
|
|
7
|
+
* new ones from a closed vocabulary: the framework's span names, attributes whose values are
|
|
8
|
+
* closed sets, counts and status codes, and each exception's kind. Ids, parents and timings are
|
|
9
|
+
* kept. Everything else, including events other than exceptions, links, status and exception
|
|
10
|
+
* messages, stacks and log bodies, is dropped or replaced with a fixed sentence.
|
|
11
|
+
*
|
|
12
|
+
* The vocabulary is the framework's (`packages/apps`, `app-cache`, `app-data`): host request
|
|
13
|
+
* operations, failure sources and reasons, MCP and cache attributes. A name or value outside it is
|
|
14
|
+
* recorded as `unrecognized` or not at all. `bun run check` (`scripts/check-app-telemetry.ts`)
|
|
15
|
+
* fails when the framework names a span or sets an attribute key this vocabulary does not know.
|
|
16
|
+
*/
|
|
17
|
+
import type { Schema } from "effect";
|
|
18
|
+
type Json = Schema.Json;
|
|
19
|
+
type JsonObject = {
|
|
20
|
+
readonly [key: string]: Json;
|
|
21
|
+
};
|
|
22
|
+
/** What an exception message, stack or log body from an app isolate records instead. */
|
|
23
|
+
export declare const appText = "Text from the app is not recorded";
|
|
24
|
+
/** The framework's span names, and the libraries' spans it runs. */
|
|
25
|
+
export declare const appSpanNames: ReadonlySet<string>;
|
|
26
|
+
export declare const appSpanAttributeKeys: ReadonlySet<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Attributes the framework sets whose values the app chooses, such as its tool names, so the host
|
|
29
|
+
* drops them. `scripts/check-app-telemetry.ts` fails on a framework attribute in neither set.
|
|
30
|
+
*/
|
|
31
|
+
export declare const droppedAppAttributeKeys: ReadonlySet<string>;
|
|
32
|
+
/** The span the host records for one an app isolate returned, or nothing without its timings. */
|
|
33
|
+
export declare const appSpan: (span: JsonObject & {
|
|
34
|
+
readonly traceId: string;
|
|
35
|
+
readonly spanId: string;
|
|
36
|
+
}) => JsonObject | undefined;
|
|
37
|
+
/** The log record the host records for one an app isolate returned. */
|
|
38
|
+
export declare const appLog: (log: JsonObject & {
|
|
39
|
+
readonly traceId?: string | undefined;
|
|
40
|
+
readonly spanId?: string | undefined;
|
|
41
|
+
}) => JsonObject;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failures as Executor's telemetry records them. An error whose message can carry an app's own
|
|
3
|
+
* text declares a fixed sentence instead (see `RecordedMessage`); traces and error reports record
|
|
4
|
+
* that sentence with the error's name. The error itself, and what its caller receives, are
|
|
5
|
+
* unchanged.
|
|
6
|
+
*/
|
|
7
|
+
import { Cause } from "effect";
|
|
8
|
+
/**
|
|
9
|
+
* The error a trace or error report records in place of `error`. Its stack is generated here and
|
|
10
|
+
* names no frames: the error's own stack begins with its message, which can span lines that look
|
|
11
|
+
* like frames, so none of its text is kept. Traces still show where it failed through the
|
|
12
|
+
* operation's own spans, which Effect appends to a recorded stack.
|
|
13
|
+
*/
|
|
14
|
+
export declare const recordedError: (error: unknown) => unknown;
|
|
15
|
+
/**
|
|
16
|
+
* A failure's cause as traces record it. A defect is recorded the same way when it is an error that
|
|
17
|
+
* declares a recorded message, such as a workflow failure a host turned into a defect; other
|
|
18
|
+
* defects and interruptions are unchanged. Each reason keeps its annotations, which locate it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const recordedCause: <E>(cause: Cause.Cause<E>) => Cause.Cause<unknown>;
|
|
@@ -23,6 +23,11 @@ type Definition<Tag extends string, Fields extends Schema.Struct.Fields> = Heade
|
|
|
23
23
|
* record, so it never includes credentials, upstream response text or submitted values.
|
|
24
24
|
*/
|
|
25
25
|
readonly message: string | ((fields: Schema.Struct.Type<Fields>) => string);
|
|
26
|
+
/**
|
|
27
|
+
* What traces and error reports record instead of `message`, when the message quotes an app's
|
|
28
|
+
* own error or a service's stated error for its caller. Only fixed text and typed fields.
|
|
29
|
+
*/
|
|
30
|
+
readonly recorded?: (fields: Schema.Struct.Type<Fields>) => string;
|
|
26
31
|
};
|
|
27
32
|
type ErrorFields<Tag extends string, Fields extends Schema.Struct.Fields> = Omit<Schema.TaggedStruct<Tag, Fields & {
|
|
28
33
|
readonly message: typeof MessageField;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What traces and error reports record for an error in place of its message. An error declares
|
|
3
|
+
* one when its message can carry text from outside Executor: an app's own error or output, or an
|
|
4
|
+
* error a service stated through an app. That text still reaches the caller the error is for;
|
|
5
|
+
* Executor's telemetry records only this fixed sentence, beside the error's name.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RecordedMessage: unique symbol;
|
|
8
|
+
/** The fixed sentence an error declares for telemetry, if it declares one. */
|
|
9
|
+
export declare const recordedMessage: (error: unknown) => string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Declare a recorded message on one error that Executor did not define the text of, such as an
|
|
12
|
+
* error decoded from an app's reply. An error class's own declaration is kept. The error's fields
|
|
13
|
+
* and wire encoding are unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export declare const recordAs: <E>(error: E, message: string) => E;
|
package/js/chunk-73AV3JVU.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Schema_exports
|
|
3
|
-
} from "./chunk-IJQ5LE74.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 DatabaseLimit = Schema_exports.Literals([
|
|
117
|
-
"scanCalls",
|
|
118
|
-
"directGets",
|
|
119
|
-
"rowsRead",
|
|
120
|
-
"rowsReturned",
|
|
121
|
-
"pageSize",
|
|
122
|
-
"bytesRead",
|
|
123
|
-
"writes",
|
|
124
|
-
"valueBytes"
|
|
125
|
-
]);
|
|
126
|
-
var count = (value) => value.toLocaleString("en-US");
|
|
127
|
-
var limitMessages = {
|
|
128
|
-
scanCalls: (maximum, requested) => `This invocation made ${count(requested)} index queries; the limit is ${count(maximum)}. Each first(), take(), collect(), count() or paginate() call on withIndex(...) counts once. Read related rows with one take() or paginate() over a shared index prefix instead of one first() per item, use get(id) for known IDs, or split the work across workflow steps.`,
|
|
129
|
-
directGets: (maximum, requested) => `This invocation made ${count(requested)} get(id) calls, including those made by update and delete; the limit is ${count(maximum)}. Split the work across workflow steps or mutations.`,
|
|
130
|
-
rowsRead: (maximum, requested) => `This invocation scanned ${count(requested)} rows; the limit is ${count(maximum)}. Narrow the index range, or page with paginate() across calls or workflow steps.`,
|
|
131
|
-
rowsReturned: (maximum, requested) => `This invocation returned ${count(requested)} rows; the limit is ${count(maximum)}. collect() fails rather than truncating. Page with paginate() across calls or workflow steps.`,
|
|
132
|
-
pageSize: (maximum, requested) => `One call asked for ${count(requested)} rows; take(n) and paginate({ numItems }) accept at most ${count(maximum)}. Page with paginate() across calls or workflow steps.`,
|
|
133
|
-
bytesRead: (maximum, requested) => `This invocation read ${count(requested)} bytes; the limit is ${count(maximum)}. Read fewer or smaller rows per call, or page with paginate() across calls or workflow steps.`,
|
|
134
|
-
writes: (maximum, requested) => `This mutation made ${count(requested)} writes; the limit is ${count(maximum)}. Split large ingests into batches, one batch per mutation or workflow step.`,
|
|
135
|
-
valueBytes: (maximum, requested) => `A row encodes to ${count(requested)} bytes; each row may use at most ${count(maximum)}. Store large content outside the row or split it across rows.`
|
|
136
|
-
};
|
|
137
|
-
var DatabaseLimitExceeded = class extends Schema_exports.TaggedError()(
|
|
138
|
-
"DatabaseLimitExceeded",
|
|
139
|
-
{
|
|
140
|
-
limit: DatabaseLimit,
|
|
141
|
-
maximum: Schema_exports.Int,
|
|
142
|
-
requested: Schema_exports.Int
|
|
143
|
-
}
|
|
144
|
-
) {
|
|
145
|
-
get message() {
|
|
146
|
-
return limitMessages[this.limit](this.maximum, this.requested);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
var reservedFieldNames = ["id", "createdAt", "updatedAt"];
|
|
150
|
-
var DatabaseFieldReserved = class extends Schema_exports.TaggedError()(
|
|
151
|
-
"DatabaseFieldReserved",
|
|
152
|
-
{
|
|
153
|
-
table: Schema_exports.String,
|
|
154
|
-
field: Schema_exports.Literals(reservedFieldNames)
|
|
155
|
-
}
|
|
156
|
-
) {
|
|
157
|
-
get message() {
|
|
158
|
-
return `Table "${this.table}" declares "${this.field}", which is reserved: the host adds id, createdAt and updatedAt to every row. Rename the field, or use the row's own ${this.field}.`;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
var DatabaseRuntimeLimits = Schema_exports.Struct({
|
|
162
|
-
maxCursorChars: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
163
|
-
connectionCacheCapacity: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
164
|
-
connectionCacheTtlMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
165
|
-
});
|
|
166
|
-
var defaultDatabaseRuntimeLimits = DatabaseRuntimeLimits.make({
|
|
167
|
-
maxCursorChars: 8192,
|
|
168
|
-
connectionCacheCapacity: 64,
|
|
169
|
-
connectionCacheTtlMs: 5 * 60 * 1e3
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
export {
|
|
173
|
-
DatabaseSchema,
|
|
174
|
-
Row,
|
|
175
|
-
RowMetadata,
|
|
176
|
-
RangeClause,
|
|
177
|
-
DatabaseOperation,
|
|
178
|
-
PaginationResult,
|
|
179
|
-
AppDatabaseError,
|
|
180
|
-
DatabaseLimits,
|
|
181
|
-
defaultDatabaseLimits,
|
|
182
|
-
DatabaseLimitExceeded,
|
|
183
|
-
reservedFieldNames,
|
|
184
|
-
DatabaseFieldReserved,
|
|
185
|
-
defaultDatabaseRuntimeLimits
|
|
186
|
-
};
|