@midsummer-ai/sdk 0.1.0-next.901 → 0.1.0-staging.3100
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/auth-1W-SzpD3.mjs +441 -0
- package/build-DQo-JrlN.d.mts +120 -0
- package/bytes-C2pcyl9u.mjs +280 -0
- package/{connection-CDk7H1FL.mjs → connection-Cu2GSOaR.mjs} +171 -31
- package/database/build.d.mts +2 -2
- package/database/build.mjs +1404 -117
- package/database/client.d.mts +85 -9
- package/database/client.mjs +550 -32
- package/database/contract.d.mts +92 -2
- package/database/contract.mjs +2179 -3
- package/database/errors.d.mts +1 -22
- package/database/react.d.mts +133 -0
- package/database/react.mjs +488 -0
- package/database/server.d.mts +2 -3
- package/database/server.mjs +3 -320
- package/database/stand-in.d.mts +95 -9
- package/database/stand-in.mjs +1436 -116
- package/errors-x2vXKi0u.d.mts +25 -0
- package/index-DNNXNny7.d.mts +410 -0
- package/key-BrRdFY-n.mjs +11 -0
- package/package.json +114 -1
- package/schema-CTHQMRsW.mjs +217 -0
- package/server-B5HK2Ou9.d.mts +574 -0
- package/server-EDRbF2u-.mjs +1893 -0
- package/{store-BzI9at5x.mjs → store-lIZ5GxVv.mjs} +1 -1
- package/{tabs-D-P8_ci_.mjs → tabs-zCh8kceo.mjs} +1 -1
- package/vector/contract.d.mts +1 -1
- package/vector/contract.mjs +773 -1
- package/vector/index.d.mts +2 -2
- package/vector/index.mjs +71 -3
- package/vector/stand-in.d.mts +1 -1
- package/vector/stand-in.mjs +326 -23
- package/vector/wire.d.mts +11 -2
- package/vector/wire.mjs +179 -14
- package/build-SQ44jwSa.d.mts +0 -41
- package/index-DdoK0y7D.d.mts +0 -192
- package/schema-BF-Y1EVu.mjs +0 -142
- package/schema-DS8x1Dn8.mjs +0 -115
- package/schema-f7E9uzUn.d.mts +0 -74
- package/server-C7O7CICU.d.mts +0 -182
package/schema-DS8x1Dn8.mjs
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/vector/errors.ts
|
|
3
|
-
const vectorErrorCodes = [
|
|
4
|
-
"invalid",
|
|
5
|
-
"not_found",
|
|
6
|
-
"conflict",
|
|
7
|
-
"forbidden",
|
|
8
|
-
"unavailable"
|
|
9
|
-
];
|
|
10
|
-
var VectorError = class extends Error {
|
|
11
|
-
code;
|
|
12
|
-
constructor(code, why) {
|
|
13
|
-
super(why);
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.name = "VectorError";
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/vector/schema.ts
|
|
20
|
-
/**
|
|
21
|
-
* What Vector DB accepts, as zod schemas: the client checks a call with them before it leaves the
|
|
22
|
-
* caller, and `serve` checks every frame with them again, because a frame comes from the network.
|
|
23
|
-
* A limit lives here once, so both edges hold the same one.
|
|
24
|
-
*/
|
|
25
|
-
/** Most numbers a Vector holds. */
|
|
26
|
-
const MAX_DIMENSION = 4096;
|
|
27
|
-
/** Most Vectors one upsert takes, and most ids one fetch or delete names. */
|
|
28
|
-
const MAX_BATCH = 1e3;
|
|
29
|
-
/** The most matches one query returns. */
|
|
30
|
-
const MAX_TOP_K = 100;
|
|
31
|
-
/** Most characters a text to embed has. */
|
|
32
|
-
const MAX_TEXT = 3e4;
|
|
33
|
-
/** Most bytes a Vector's metadata takes, as JSON. */
|
|
34
|
-
const MAX_METADATA_BYTES = 10240;
|
|
35
|
-
/** 1 to 63 lowercase letters, digits and hyphens, starting with a letter or digit. */
|
|
36
|
-
const NamespaceName = z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/, "a Vector namespace's name is 1 to 63 lowercase letters, digits and hyphens, starting with a letter or digit");
|
|
37
|
-
/** How closeness is measured, fixed when a Vector namespace is made. */
|
|
38
|
-
const Metric = z.enum([
|
|
39
|
-
"cosine",
|
|
40
|
-
"euclidean",
|
|
41
|
-
"dot"
|
|
42
|
-
]);
|
|
43
|
-
const Dimension = z.number().int().min(1).max(MAX_DIMENSION);
|
|
44
|
-
const VectorId = z.string().min(1).max(512);
|
|
45
|
-
const Scalar = z.union([
|
|
46
|
-
z.string().max(2048),
|
|
47
|
-
z.number().refine(Number.isFinite, "a number in metadata is finite"),
|
|
48
|
-
z.boolean()
|
|
49
|
-
]);
|
|
50
|
-
const FieldName = z.string().min(1).max(64).refine((name) => !name.startsWith("$") && !name.includes("."), "a metadata field's name does not start with $ or hold a dot");
|
|
51
|
-
const Metadata = z.record(FieldName, Scalar).refine((metadata) => new TextEncoder().encode(JSON.stringify(metadata)).length <= MAX_METADATA_BYTES, `metadata is at most ${MAX_METADATA_BYTES} bytes as JSON`);
|
|
52
|
-
/**
|
|
53
|
-
* The largest value a Vector holds. Engines keep values and scores as 32-bit floats, and within it
|
|
54
|
-
* every score of 4,096 values is one, finite: a squared distance is at most 4,096 · (2e17)², about
|
|
55
|
-
* 1.6e38, under a 32-bit float's 3.4e38. Scores are exact to a 32-bit float's precision for values
|
|
56
|
-
* from 1e-17 up.
|
|
57
|
-
*/
|
|
58
|
-
const MAX_VALUE = 0x16345785d8a0000;
|
|
59
|
-
const Values = z.array(z.number().refine((value) => Number.isFinite(value) && Math.abs(value) <= 0x16345785d8a0000, `a Vector's values are finite numbers of at most ${MAX_VALUE} in size`)).min(1).max(MAX_DIMENSION);
|
|
60
|
-
const Vector = z.object({
|
|
61
|
-
id: VectorId,
|
|
62
|
-
values: Values,
|
|
63
|
-
metadata: Metadata.optional()
|
|
64
|
-
}).strict();
|
|
65
|
-
const Text = z.string().max(MAX_TEXT).refine((text) => text.trim().length > 0, "a text to embed is not empty or all spaces");
|
|
66
|
-
const TextVector = z.object({
|
|
67
|
-
id: VectorId,
|
|
68
|
-
text: Text,
|
|
69
|
-
metadata: Metadata.optional()
|
|
70
|
-
}).strict();
|
|
71
|
-
const Vectors = z.array(z.union([Vector, TextVector])).min(1).max(MAX_BATCH).refine((vectors) => new Set(vectors.map((v) => v.id)).size === vectors.length, "each id is upserted once a call");
|
|
72
|
-
const Ids = z.array(VectorId).min(1).max(MAX_BATCH);
|
|
73
|
-
const Bound = z.union([z.string().max(2048), z.number().refine(Number.isFinite)]);
|
|
74
|
-
const Condition = z.union([Scalar, z.object({
|
|
75
|
-
$eq: Scalar.optional(),
|
|
76
|
-
$ne: Scalar.optional(),
|
|
77
|
-
$in: z.array(Scalar).min(1).max(100).optional(),
|
|
78
|
-
$nin: z.array(Scalar).min(1).max(100).optional(),
|
|
79
|
-
$gt: Bound.optional(),
|
|
80
|
-
$gte: Bound.optional(),
|
|
81
|
-
$lt: Bound.optional(),
|
|
82
|
-
$lte: Bound.optional()
|
|
83
|
-
}).strict().refine((condition) => Object.keys(condition).length > 0, "a condition names an operator")]);
|
|
84
|
-
/** Each field's condition, all of which must hold. A bare value is `$eq`. */
|
|
85
|
-
const Filter = z.record(FieldName, Condition).refine((filter) => Object.keys(filter).length <= 20, "a filter names at most 20 fields");
|
|
86
|
-
const QueryOptions = {
|
|
87
|
-
topK: z.number().int().min(1).max(100),
|
|
88
|
-
filter: Filter.optional(),
|
|
89
|
-
includeValues: z.boolean(),
|
|
90
|
-
includeMetadata: z.boolean(),
|
|
91
|
-
consistency: z.enum(["strong", "eventual"]).optional()
|
|
92
|
-
};
|
|
93
|
-
const Query = z.union([z.object({
|
|
94
|
-
vector: Values,
|
|
95
|
-
...QueryOptions
|
|
96
|
-
}).strict(), z.object({
|
|
97
|
-
text: Text,
|
|
98
|
-
...QueryOptions
|
|
99
|
-
}).strict()]);
|
|
100
|
-
/** An embedding model's name, as the platform offers it. */
|
|
101
|
-
const EmbeddingModel = z.string().min(1).max(100);
|
|
102
|
-
const Settings = z.object({
|
|
103
|
-
dimension: Dimension,
|
|
104
|
-
metric: Metric,
|
|
105
|
-
embed: EmbeddingModel.optional()
|
|
106
|
-
}).strict();
|
|
107
|
-
/** `value` as `schema` reads it, or `invalid` with why not. */
|
|
108
|
-
function checked(schema, value) {
|
|
109
|
-
const parsed = schema.safeParse(value);
|
|
110
|
-
if (parsed.success) return parsed.data;
|
|
111
|
-
const issue = parsed.error.issues[0];
|
|
112
|
-
throw new VectorError("invalid", `${issue && issue.path.length > 0 ? `${issue.path.join(".")}: ` : ""}${issue?.message ?? "not valid"}`);
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
export { MAX_TEXT as a, NamespaceName as c, Vectors as d, checked as f, MAX_METADATA_BYTES as i, Query as l, vectorErrorCodes as m, MAX_BATCH as n, MAX_TOP_K as o, VectorError as p, MAX_DIMENSION as r, MAX_VALUE as s, Ids as t, Settings as u };
|
package/schema-f7E9uzUn.d.mts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
//#region src/database/schema.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* A Database's shapes: `v`, `defineTable`, `defineSchema`, and the check of a value against a
|
|
4
|
-
* shape. Plain data and pure functions, the same as the engine's, so a schema built here is the one
|
|
5
|
-
* the Database builds.
|
|
6
|
-
*
|
|
7
|
-
* export default defineSchema({
|
|
8
|
-
* messages: defineTable({ channel: v.string(), body: v.string() }).index("by_channel", "channel"),
|
|
9
|
-
* })
|
|
10
|
-
*/
|
|
11
|
-
/** A shape, as `v` makes it: a name for the simple ones, an object for the rest. */
|
|
12
|
-
type Shape = "string" | "number" | "boolean" | "document" | "int64" | "bytes" | "timestamp" | "decimal" | {
|
|
13
|
-
readonly optional: Shape;
|
|
14
|
-
} | {
|
|
15
|
-
readonly array: Shape;
|
|
16
|
-
} | {
|
|
17
|
-
readonly object: Readonly<Record<string, Shape>>;
|
|
18
|
-
} | {
|
|
19
|
-
readonly literal: unknown;
|
|
20
|
-
} | {
|
|
21
|
-
readonly union: ReadonlyArray<Shape>;
|
|
22
|
-
} | {
|
|
23
|
-
readonly record: Shape;
|
|
24
|
-
} | {
|
|
25
|
-
readonly id: string;
|
|
26
|
-
};
|
|
27
|
-
declare const v: Readonly<{
|
|
28
|
-
string: () => Shape;
|
|
29
|
-
number: () => Shape;
|
|
30
|
-
boolean: () => Shape;
|
|
31
|
-
/** Any JSON value, at any depth. */
|
|
32
|
-
document: () => Shape;
|
|
33
|
-
/** May be left out or null. */
|
|
34
|
-
optional: (shape: Shape) => Shape;
|
|
35
|
-
array: (shape: Shape) => Shape;
|
|
36
|
-
object: (fields: Record<string, Shape>) => Shape;
|
|
37
|
-
int64: () => Shape;
|
|
38
|
-
bytes: () => Shape;
|
|
39
|
-
timestamp: () => Shape;
|
|
40
|
-
decimal: () => Shape;
|
|
41
|
-
literal: (value: string | number | boolean) => Shape;
|
|
42
|
-
union: (...shapes: Shape[]) => Shape;
|
|
43
|
-
record: (shape: Shape) => Shape;
|
|
44
|
-
id: (table: string) => Shape;
|
|
45
|
-
}>;
|
|
46
|
-
/** An index as declared: one field, a list of them for a compound index, or either with `unique`. */
|
|
47
|
-
type IndexDeclaration = string | ReadonlyArray<string> | {
|
|
48
|
-
readonly fields: string | ReadonlyArray<string>;
|
|
49
|
-
readonly unique: true;
|
|
50
|
-
};
|
|
51
|
-
interface Table {
|
|
52
|
-
readonly fields: Readonly<Record<string, Shape>>;
|
|
53
|
-
readonly indexes: Readonly<Record<string, IndexDeclaration>>;
|
|
54
|
-
/** A new table with the index added: one field, or a list for a compound index; `{ unique: true }` lets no two rows share its key. */
|
|
55
|
-
index(name: string, field: string | ReadonlyArray<string>, options?: {
|
|
56
|
-
readonly unique?: boolean;
|
|
57
|
-
}): Table;
|
|
58
|
-
searchIndex(name: string): never;
|
|
59
|
-
vectorIndex(name: string): never;
|
|
60
|
-
}
|
|
61
|
-
interface Schema {
|
|
62
|
-
readonly schema: true;
|
|
63
|
-
readonly tables: Readonly<Record<string, Readonly<Record<string, Shape>>>>;
|
|
64
|
-
/** Every table's indexes, by name; a table with none has `{}`. */
|
|
65
|
-
readonly indexes: Readonly<Record<string, Readonly<Record<string, IndexDeclaration>>>>;
|
|
66
|
-
}
|
|
67
|
-
/** An index's fields in order. */
|
|
68
|
-
declare function indexFields(declared: IndexDeclaration): string[];
|
|
69
|
-
declare function defineTable(fields: Record<string, Shape>): Table;
|
|
70
|
-
declare function defineSchema(tables: Record<string, Table>): Schema;
|
|
71
|
-
/** Whether `value` fits `shape`: null, or the reason. An id is a non-empty string. */
|
|
72
|
-
declare function shapeError(shape: Shape, value: unknown, at?: string): string | null;
|
|
73
|
-
//#endregion
|
|
74
|
-
export { defineSchema as a, shapeError as c, Table as i, v as l, Schema as n, defineTable as o, Shape as r, indexFields as s, IndexDeclaration as t };
|
package/server-C7O7CICU.d.mts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { r as Shape } from "./schema-f7E9uzUn.mjs";
|
|
2
|
-
//#region src/database/server.d.ts
|
|
3
|
-
/** A row as the Database keeps it: its fields, and its own `_`-fields. */
|
|
4
|
-
type Row = Readonly<Record<string, unknown>>;
|
|
5
|
-
/** A row as a function reads it. */
|
|
6
|
-
type Document = Readonly<Record<string, unknown>> & {
|
|
7
|
-
readonly _id: string;
|
|
8
|
-
readonly _version: number;
|
|
9
|
-
};
|
|
10
|
-
/** A range's bounds on an index's first field, its order, and at most `limit` rows. */
|
|
11
|
-
interface RangeOptions {
|
|
12
|
-
readonly eq?: unknown;
|
|
13
|
-
readonly gte?: unknown;
|
|
14
|
-
readonly gt?: unknown;
|
|
15
|
-
readonly lte?: unknown;
|
|
16
|
-
readonly lt?: unknown;
|
|
17
|
-
readonly order?: "asc" | "desc";
|
|
18
|
-
readonly limit?: number;
|
|
19
|
-
}
|
|
20
|
-
/** A scheduled run, as `ctx.scheduler.status` returns it. */
|
|
21
|
-
interface ScheduledRun {
|
|
22
|
-
readonly name: string;
|
|
23
|
-
readonly args: unknown;
|
|
24
|
-
readonly at: number;
|
|
25
|
-
readonly state: string;
|
|
26
|
-
readonly error?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* What a Database gives a query or mutation to run against: its rows, the caller and the call. The
|
|
30
|
-
* Stand-in is one such; the Database's engine is another. Every read returns at once.
|
|
31
|
-
*/
|
|
32
|
-
interface Rows {
|
|
33
|
-
get(table: string, id: string): Row | null;
|
|
34
|
-
set(table: string, id: string, fields: Row): void;
|
|
35
|
-
delete(table: string, id: string): void;
|
|
36
|
-
/** The rows of `index` ("_id" for the table's order) within the bounds, each with its `_id`. Bounds are lists, one value for each of the index's leading fields. */
|
|
37
|
-
range(table: string, index: string, options: {
|
|
38
|
-
readonly eq?: ReadonlyArray<unknown>;
|
|
39
|
-
readonly gte?: unknown;
|
|
40
|
-
readonly gt?: unknown;
|
|
41
|
-
readonly lte?: unknown;
|
|
42
|
-
readonly lt?: unknown;
|
|
43
|
-
readonly order?: "asc" | "desc";
|
|
44
|
-
readonly limit: number;
|
|
45
|
-
}): ReadonlyArray<Row & {
|
|
46
|
-
readonly _id: string;
|
|
47
|
-
}>;
|
|
48
|
-
/** The call's own time. */
|
|
49
|
-
readonly now: number;
|
|
50
|
-
/** The signed-in caller, by the Project's sign-in's subject; null for none. */
|
|
51
|
-
readonly user: string | null;
|
|
52
|
-
/** Whether the Project's own server code, or the Database itself, is the caller. */
|
|
53
|
-
readonly server: boolean;
|
|
54
|
-
/** The sign-in provider the Database trusts, when it trusts exactly one. */
|
|
55
|
-
readonly issuer?: string | null;
|
|
56
|
-
/** The call's identity: a mutation's inserted ids come from it, so a run again makes the same ids. */
|
|
57
|
-
readonly call?: string | null;
|
|
58
|
-
/** Whether another function is the caller, which may call internal ones. */
|
|
59
|
-
readonly internal?: boolean;
|
|
60
|
-
/** The tables the schema declares, by field; none: every write is admitted. */
|
|
61
|
-
readonly schema?: Readonly<Record<string, Readonly<Record<string, Shape>>>> | null;
|
|
62
|
-
runAfter(ms: number, name: string, args: unknown): string;
|
|
63
|
-
scheduledRow(id: string): {
|
|
64
|
-
readonly name: string;
|
|
65
|
-
readonly args?: unknown;
|
|
66
|
-
readonly due: number;
|
|
67
|
-
readonly state: string;
|
|
68
|
-
readonly error?: string;
|
|
69
|
-
} | null;
|
|
70
|
-
cancelScheduled(id: string): boolean;
|
|
71
|
-
}
|
|
72
|
-
/** What a Database gives an action: reads that may wait, the network, and the other functions. */
|
|
73
|
-
interface Capabilities {
|
|
74
|
-
get(table: string, id: string): Promise<Row | null>;
|
|
75
|
-
range(table: string, index: string, options: Parameters<Rows["range"]>[2]): Promise<ReadonlyArray<Row & {
|
|
76
|
-
readonly _id: string;
|
|
77
|
-
}>>;
|
|
78
|
-
readonly user: string | null;
|
|
79
|
-
readonly server: boolean;
|
|
80
|
-
readonly issuer?: string | null;
|
|
81
|
-
readonly internal?: boolean;
|
|
82
|
-
fetch(url: URL, init?: RequestInit): Promise<Response>;
|
|
83
|
-
now(): number;
|
|
84
|
-
random(bytes: number): Uint8Array;
|
|
85
|
-
run(name: string, args: unknown): Promise<unknown>;
|
|
86
|
-
schedule(ms: number, name: string, args: unknown): Promise<string>;
|
|
87
|
-
scheduled(id: string): Promise<ScheduledRun | null>;
|
|
88
|
-
cancel(id: string): Promise<boolean>;
|
|
89
|
-
}
|
|
90
|
-
type FunctionKind = "query" | "mutation" | "action";
|
|
91
|
-
/** A function as defined: its name (none until it is exported under one), what runs it, and its options. */
|
|
92
|
-
interface RegisteredFunction {
|
|
93
|
-
readonly name: string | null;
|
|
94
|
-
readonly handler: (on: Rows & Capabilities, args: unknown) => unknown;
|
|
95
|
-
readonly options: {
|
|
96
|
-
readonly kind: FunctionKind;
|
|
97
|
-
readonly args: {
|
|
98
|
-
readonly object: Readonly<Record<string, Shape>>;
|
|
99
|
-
} | null;
|
|
100
|
-
readonly returns: Shape | null;
|
|
101
|
-
readonly internal: boolean;
|
|
102
|
-
readonly cron: string | null;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
/** A function's reference, as `api.<file>.<export>` holds it: its name and kind. */
|
|
106
|
-
interface FunctionReference<Kind extends FunctionKind = FunctionKind> {
|
|
107
|
-
readonly name: string;
|
|
108
|
-
readonly kind: Kind;
|
|
109
|
-
}
|
|
110
|
-
declare const OPERATOR: unique symbol;
|
|
111
|
-
interface Operator {
|
|
112
|
-
readonly [OPERATOR]: "increment" | "take" | "give";
|
|
113
|
-
readonly n: number;
|
|
114
|
-
}
|
|
115
|
-
/** A field's value plus `n` (a field not yet there counts as 0). */
|
|
116
|
-
declare const increment: (n?: number) => Operator;
|
|
117
|
-
/** A field's value minus `n`; below zero the whole mutation fails with `InsufficientError` and writes nothing. */
|
|
118
|
-
declare const take: (n?: number) => Operator;
|
|
119
|
-
/** A field's value plus `n`: the inverse of `take`. */
|
|
120
|
-
declare const give: (n?: number) => Operator;
|
|
121
|
-
/** A `take` asked for more than the field holds: the mutation wrote nothing. */
|
|
122
|
-
declare class InsufficientError extends Error {
|
|
123
|
-
readonly detail: {
|
|
124
|
-
readonly table: string;
|
|
125
|
-
readonly id: string;
|
|
126
|
-
readonly field: string;
|
|
127
|
-
readonly has: number;
|
|
128
|
-
readonly asked: number;
|
|
129
|
-
};
|
|
130
|
-
constructor(detail: {
|
|
131
|
-
readonly table: string;
|
|
132
|
-
readonly id: string;
|
|
133
|
-
readonly field: string;
|
|
134
|
-
readonly has: number;
|
|
135
|
-
readonly asked: number;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
/** A mutation patched or replaced a row that is not there. */
|
|
139
|
-
declare class NotFoundError extends Error {
|
|
140
|
-
readonly detail: {
|
|
141
|
-
readonly table: string;
|
|
142
|
-
readonly id: string;
|
|
143
|
-
};
|
|
144
|
-
constructor(detail: {
|
|
145
|
-
readonly table: string;
|
|
146
|
-
readonly id: string;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
/** A call the Database refused: `why` is its reason, as the client's `DatabaseError` carries it. */
|
|
150
|
-
declare class Refusal extends Error {
|
|
151
|
-
readonly why: string;
|
|
152
|
-
readonly detail?: unknown;
|
|
153
|
-
constructor(why: string, message: string, detail?: unknown);
|
|
154
|
-
}
|
|
155
|
-
type Definition = {
|
|
156
|
-
readonly args?: Record<string, Shape>;
|
|
157
|
-
readonly returns?: Shape;
|
|
158
|
-
readonly cron?: string;
|
|
159
|
-
readonly handler: (ctx: any, args: any) => unknown;
|
|
160
|
-
};
|
|
161
|
-
/** A function that reads rows and never writes them: `export const list = query({ args, returns, handler: (ctx, args) => ... })`. */
|
|
162
|
-
declare function query(name: string | Definition, given?: Definition, extra?: {
|
|
163
|
-
internal?: boolean;
|
|
164
|
-
}): RegisteredFunction;
|
|
165
|
-
/** One serializable transaction: `export const send = mutation({ args, returns, handler: (ctx, args) => ... })`. */
|
|
166
|
-
declare function mutation(name: string | Definition, given?: Definition, extra?: {
|
|
167
|
-
internal?: boolean;
|
|
168
|
-
}): RegisteredFunction;
|
|
169
|
-
/** May wait on the network: `export const charge = action({ args, returns, handler: async (ctx, args) => ... })`. */
|
|
170
|
-
declare function action(name: string | Definition, given?: Definition, extra?: {
|
|
171
|
-
internal?: boolean;
|
|
172
|
-
}): RegisteredFunction;
|
|
173
|
-
/** As `query`, callable only by another function, never a client. */
|
|
174
|
-
declare const internalQuery: (name: string | Definition, given?: Definition) => RegisteredFunction;
|
|
175
|
-
/** As `mutation`, callable only by another function, never a client. */
|
|
176
|
-
declare const internalMutation: (name: string | Definition, given?: Definition) => RegisteredFunction;
|
|
177
|
-
/** As `action`, callable only by another function, never a client. */
|
|
178
|
-
declare const internalAction: (name: string | Definition, given?: Definition) => RegisteredFunction;
|
|
179
|
-
/** Whether a value is a function defined here, as a module of `db/` exports it. */
|
|
180
|
-
declare const isFunction: (value: unknown) => value is RegisteredFunction;
|
|
181
|
-
//#endregion
|
|
182
|
-
export { take as C, query as S, internalAction as _, InsufficientError as a, isFunction as b, RangeOptions as c, Row as d, Rows as f, increment as g, give as h, FunctionReference as i, Refusal as l, action as m, Document as n, NotFoundError as o, ScheduledRun as p, FunctionKind as r, Operator as s, Capabilities as t, RegisteredFunction as u, internalMutation as v, mutation as x, internalQuery as y };
|