@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/database/contract.d.mts
CHANGED
|
@@ -1,11 +1,101 @@
|
|
|
1
1
|
import { DatabaseClient } from "./stand-in.mjs";
|
|
2
2
|
//#region src/database/contract.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The fixture's folder, served by every Database the cases run against: `schema.ts`, the functions in
|
|
5
|
+
* the files beside it and in `admin/tools.ts`, the helper `lib/text.ts`, and `zod` 4.1.12 from the
|
|
6
|
+
* installed packages. A Database is given its build (`buildDatabase` with `installed`), as a deploy uploads it.
|
|
7
|
+
* The sign-in cases (`databaseAuthContract`) serve it with an `auth.config.ts` beside it, from `testIssuer`.
|
|
8
|
+
*/
|
|
4
9
|
declare const contractFolder: URL;
|
|
10
|
+
/**
|
|
11
|
+
* The fixture of what the Stand-in serves ahead of the Database: `schema.ts` with a vector index, and
|
|
12
|
+
* `places.ts` and `nearest.ts`. A build refuses it unless built with `ahead`; its cases are
|
|
13
|
+
* `databaseAheadContract`.
|
|
14
|
+
*/
|
|
15
|
+
declare const contractAheadFolder: URL;
|
|
5
16
|
interface ContractCase {
|
|
6
17
|
readonly name: string;
|
|
7
18
|
run(db: DatabaseClient): Promise<void>;
|
|
8
19
|
}
|
|
20
|
+
/** Query chains, cursor pages and document metadata, runnable through any database client. */
|
|
21
|
+
declare const databaseQueryContract: ReadonlyArray<ContractCase>;
|
|
22
|
+
/** Every database guarantee, including the query and metadata cases. */
|
|
9
23
|
declare const databaseContract: ReadonlyArray<ContractCase>;
|
|
24
|
+
/** A request's body may be at most this many bytes: 20 MiB. A larger one is refused 413 before an HTTP action runs. */
|
|
25
|
+
declare const HTTP_BODY_LIMIT: number;
|
|
26
|
+
/**
|
|
27
|
+
* A Database's HTTP side, for the cases that reach past its rows. A Database's runner gives it, and the
|
|
28
|
+
* Database serves the fixture with the environment value `CONTRACT_GREETING` set to
|
|
29
|
+
* `hello from the environment` and no `CONTRACT_UNSET`.
|
|
30
|
+
*/
|
|
31
|
+
interface DatabaseWeb {
|
|
32
|
+
/** Sends a request to the Database: its files' URLs, its upload URLs and its HTTP actions. */
|
|
33
|
+
fetch(request: Request): Promise<Response>;
|
|
34
|
+
/** Where its HTTP actions are: a route's path follows it (`<httpUrl>/echo`). */
|
|
35
|
+
readonly httpUrl: string;
|
|
36
|
+
/**
|
|
37
|
+
* An https URL an action may fetch, that returns the body it is sent with status 200 and
|
|
38
|
+
* `content-type: application/octet-stream`; with `?bytes=<n>`, n zero bytes instead.
|
|
39
|
+
*/
|
|
40
|
+
readonly echoUrl: string;
|
|
41
|
+
/** A token the Database verifies as `subject`'s, sent as `Authorization: Bearer <token>`. */
|
|
42
|
+
token(subject: string): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
interface ServerCase {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
run(db: DatabaseClient, web: DatabaseWeb): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What a Database's functions reach beyond its rows: its files, its HTTP actions, the environment's
|
|
50
|
+
* values and the network. Each case is given a client, as above, and the Database's `DatabaseWeb`.
|
|
51
|
+
*
|
|
52
|
+
* for (const item of databaseServerContract) test(item.name, () => item.run(client, web))
|
|
53
|
+
*/
|
|
54
|
+
declare const databaseServerContract: ReadonlyArray<ServerCase>;
|
|
55
|
+
/**
|
|
56
|
+
* What the Stand-in serves ahead of the Database, which refuses vector indexes today: the cases the
|
|
57
|
+
* engine passes once it serves them, run with `contractAheadFolder`'s build.
|
|
58
|
+
*/
|
|
59
|
+
declare const databaseAheadContract: ReadonlyArray<ContractCase>;
|
|
60
|
+
/**
|
|
61
|
+
* A deploy's case: `deploy` sends `files`, a build as a deploy uploads it, and gives back null when
|
|
62
|
+
* the Database takes it, or why it was refused.
|
|
63
|
+
*/
|
|
64
|
+
interface DeployCase {
|
|
65
|
+
readonly name: string;
|
|
66
|
+
run(deploy: (files: Readonly<Record<string, string>>) => Promise<string | null>): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/** The limits a deploy keeps, each at its edge: 1 MiB a file, 8 MiB in all and 4000 files. */
|
|
69
|
+
declare const databaseDeployContract: ReadonlyArray<DeployCase>;
|
|
70
|
+
/**
|
|
71
|
+
* An issuer of sign-in tokens made on this machine for the sign-in cases: an RSA key of its own, never one
|
|
72
|
+
* that is published or kept. `authConfig` is the `auth.config.ts` that trusts it, its key set given as a
|
|
73
|
+
* `data:` URI so a Database needs no network to check its tokens.
|
|
74
|
+
*/
|
|
75
|
+
interface TestIssuer {
|
|
76
|
+
readonly issuer: string;
|
|
77
|
+
readonly audience: string;
|
|
78
|
+
/** This issuer as one provider of `auth.config.ts`'s list, as source: to trust it beside others. */
|
|
79
|
+
readonly provider: string;
|
|
80
|
+
/** The source of an `auth.config.ts` trusting this issuer for `audience`; `anonymous` admits callers with no token. */
|
|
81
|
+
authConfig(options: {
|
|
82
|
+
readonly anonymous: boolean;
|
|
83
|
+
}): string;
|
|
84
|
+
/**
|
|
85
|
+
* A token of `claims` over `iss`, `aud`, `iat` and an `exp` 10 minutes on, signed RS256 by this issuer's key, or
|
|
86
|
+
* by a key it never published when `forged`. A claim set to undefined is left out.
|
|
87
|
+
*/
|
|
88
|
+
sign(claims: Readonly<Record<string, unknown>>, options?: {
|
|
89
|
+
readonly forged?: boolean;
|
|
90
|
+
}): Promise<string>;
|
|
91
|
+
}
|
|
92
|
+
declare function testIssuer(): Promise<TestIssuer>;
|
|
93
|
+
/** A sign-in case: run against the fixture served with `issuer.authConfig({ anonymous })`. */
|
|
94
|
+
interface AuthContractCase {
|
|
95
|
+
readonly name: string;
|
|
96
|
+
readonly anonymous: boolean;
|
|
97
|
+
run(db: DatabaseClient, issuer: TestIssuer): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
declare const databaseAuthContract: ReadonlyArray<AuthContractCase>;
|
|
10
100
|
//#endregion
|
|
11
|
-
export { ContractCase, contractFolder, databaseContract };
|
|
101
|
+
export { AuthContractCase, ContractCase, DatabaseWeb, DeployCase, HTTP_BODY_LIMIT, ServerCase, TestIssuer, contractAheadFolder, contractFolder, databaseAheadContract, databaseAuthContract, databaseContract, databaseDeployContract, databaseQueryContract, databaseServerContract, testIssuer };
|