@hraness/oh 0.4.1 → 0.4.2
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/LICENSE +3 -0
- package/README.md +4 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +15590 -1705
- package/dist/index.js +15209 -261
- package/dist/libsql-model.d.ts +75 -0
- package/dist/libsql-model.d.ts.map +1 -0
- package/dist/libsql-platform.d.ts +24 -0
- package/dist/libsql-platform.d.ts.map +1 -0
- package/dist/libsql-program.d.ts +64 -0
- package/dist/libsql-program.d.ts.map +1 -0
- package/dist/libsql-runtime.d.ts +13 -0
- package/dist/libsql-runtime.d.ts.map +1 -0
- package/dist/libsql.d.ts +4 -36
- package/dist/libsql.d.ts.map +1 -1
- package/dist/libsql.js +16583 -1426
- package/dist/memory-authority-platform.d.ts +210 -0
- package/dist/memory-authority-platform.d.ts.map +1 -0
- package/dist/memory-authority-program.d.ts +15 -0
- package/dist/memory-authority-program.d.ts.map +1 -0
- package/dist/memory-authority-runtime.d.ts +4 -0
- package/dist/memory-authority-runtime.d.ts.map +1 -0
- package/dist/memory-core.d.ts +522 -0
- package/dist/memory-core.d.ts.map +1 -0
- package/dist/memory.d.ts +5 -445
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +18232 -4143
- package/dist/sdk.js +15266 -318
- package/dist/semantic-cloud.js +1 -260
- package/dist/semantic-model.d.ts +75 -0
- package/dist/semantic-model.d.ts.map +1 -0
- package/dist/semantic-platform.d.ts +32 -0
- package/dist/semantic-platform.d.ts.map +1 -0
- package/dist/semantic-program.d.ts +18 -0
- package/dist/semantic-program.d.ts.map +1 -0
- package/dist/semantic-runtime.d.ts +6 -0
- package/dist/semantic-runtime.d.ts.map +1 -0
- package/dist/semantic.d.ts +6 -57
- package/dist/semantic.d.ts.map +1 -1
- package/dist/semantic.js +15541 -514
- package/dist/sqlite/index.js +1148 -1378
- package/dist/sqlite/port.d.ts +1 -1
- package/dist/sqlite/port.d.ts.map +1 -1
- package/dist/sync-libsql-program.d.ts +5 -0
- package/dist/sync-libsql-program.d.ts.map +1 -0
- package/dist/sync-model.d.ts +60 -0
- package/dist/sync-model.d.ts.map +1 -0
- package/dist/sync-platform.d.ts +41 -0
- package/dist/sync-platform.d.ts.map +1 -0
- package/dist/sync-program.d.ts +11 -0
- package/dist/sync-program.d.ts.map +1 -0
- package/dist/sync-runtime.d.ts +6 -0
- package/dist/sync-runtime.d.ts.map +1 -0
- package/dist/sync.d.ts +5 -55
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +15174 -226
- package/package.json +7 -5
- package/skills/oh/SKILL.md +2 -1
- package/spec/v1/store.md +14 -0
- package/src/cli.test.ts +35 -0
- package/src/cli.ts +4 -3
- package/src/cloudflare-embedding.ts +1 -1
- package/src/libsql-lifecycle.test.ts +76 -0
- package/src/libsql-model.ts +350 -0
- package/src/libsql-platform.ts +51 -0
- package/src/libsql-program.ts +1583 -0
- package/src/libsql-runtime.ts +89 -0
- package/src/libsql-semantic-v2.ts +1 -1
- package/src/libsql-semantic.ts +1 -1
- package/src/libsql.test.ts +245 -0
- package/src/libsql.ts +26 -1698
- package/src/memory-authority-platform.ts +133 -0
- package/src/memory-authority-program.ts +309 -0
- package/src/memory-authority-runtime.ts +40 -0
- package/src/memory-core.ts +2401 -0
- package/src/memory.test.ts +55 -0
- package/src/memory.ts +68 -2759
- package/src/semantic-model.ts +142 -0
- package/src/semantic-platform.ts +130 -0
- package/src/semantic-program.ts +113 -0
- package/src/semantic-runtime.ts +53 -0
- package/src/semantic.test.ts +115 -1
- package/src/semantic.ts +14 -324
- package/src/sqlite/port.ts +1 -1
- package/src/sync-libsql-program.ts +170 -0
- package/src/sync-lifecycle.test.ts +110 -0
- package/src/sync-model.ts +530 -0
- package/src/sync-platform.ts +87 -0
- package/src/sync-program.ts +117 -0
- package/src/sync-runtime.ts +33 -0
- package/src/sync.ts +10 -765
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type Sha256Hex } from "./canonical";
|
|
2
|
+
import { type OhOperationV1 } from "./operation";
|
|
3
|
+
import { type OhHeadV1, type OhSpacePurgeReceiptV1, type OhStoreBindingV1, type OhStoreProfileV1 } from "./store";
|
|
4
|
+
export type OhLibSqlValueV1 = ArrayBuffer | Date | Uint8Array | bigint | boolean | null | number | string;
|
|
5
|
+
export type OhLibSqlStatementV1 = Readonly<{
|
|
6
|
+
args?: readonly OhLibSqlValueV1[];
|
|
7
|
+
sql: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type OhLibSqlResultV1 = Readonly<{
|
|
10
|
+
rows: readonly (Readonly<Record<string, unknown>> | readonly unknown[])[];
|
|
11
|
+
rowsAffected?: number;
|
|
12
|
+
}>;
|
|
13
|
+
/** Structural subset implemented by `@libsql/client` clients. */
|
|
14
|
+
export interface OhLibSqlClientV1 {
|
|
15
|
+
batch(statements: readonly OhLibSqlStatementV1[], mode?: "deferred" | "read" | "write"): Promise<readonly OhLibSqlResultV1[]>;
|
|
16
|
+
close?(): void;
|
|
17
|
+
execute(statement: OhLibSqlStatementV1 | string): Promise<OhLibSqlResultV1>;
|
|
18
|
+
}
|
|
19
|
+
export type OhLibSqlStoreAuthorityOptionsV1 = Readonly<{
|
|
20
|
+
closeClient?: boolean;
|
|
21
|
+
profile?: OhStoreProfileV1;
|
|
22
|
+
realmId?: string;
|
|
23
|
+
spaceId?: string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const OH_LIBSQL_STORE_LIMITS_V1: Readonly<{
|
|
26
|
+
changesPerCommit: 64;
|
|
27
|
+
changeFeedLimit: 7;
|
|
28
|
+
dependenciesPerCommit: 512;
|
|
29
|
+
historyBytes: number;
|
|
30
|
+
historyOperations: 16384;
|
|
31
|
+
operationBytes: number;
|
|
32
|
+
providerResponseBytes: 9000000;
|
|
33
|
+
snapshotComponentBytes: number;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const AUTHORITY_SCHEMA_NAME = "oh.libsql-authority.v1";
|
|
36
|
+
export declare const AUTHORITY_SCHEMA_VERSION = 1;
|
|
37
|
+
export declare const EMPTY_RECORDS_SHA256: Sha256Hex;
|
|
38
|
+
export declare const PURGE_ROW_SELECT = "SELECT space_id, binding_sha256, prior_operation_sha256,\n prior_sequence, purged_at, receipt_sha256, receipt_json\n FROM oh_authority_purges WHERE space_id = ?";
|
|
39
|
+
export declare const BINDING_ROW_SELECT = "SELECT space_id, realm_id, profile_id, profile_kind,\n profile_sha256, binding_sha256, binding_json FROM oh_authority_bindings WHERE space_id = ?";
|
|
40
|
+
export declare const SPACE_PURGE_PROOF_SELECT = "SELECT generation, graph_revision_sha256, head_operation_sha256,\n records_sha256, sequence, contract_id FROM oh_authority_spaces WHERE space_id = ?";
|
|
41
|
+
export declare const OPERATION_ROW_COLUMNS = "operation_sha256, space_id, sequence, operation_id,\n parent_operation_sha256, graph_revision_sha256, records_sha256, operation_json, instant";
|
|
42
|
+
export declare const OPERATION_RESPONSE_BYTES = "2 * length(CAST(operation.operation_json AS BLOB))\n + 2 * (length(operation.operation_sha256) + length(operation.space_id)\n + length(operation.operation_id) + coalesce(length(operation.parent_operation_sha256), 0)\n + length(operation.graph_revision_sha256) + length(operation.records_sha256)\n + length(operation.instant)) + 512";
|
|
43
|
+
export declare const RECORD_RESPONSE_BYTES = "2 * length(CAST(record.record_json AS BLOB))\n + 2 * (length(record.record_key) + length(record.kind) + length(record.record_sha256)\n + length(record.operation_sha256)) + 384";
|
|
44
|
+
export declare const DEPENDENCY_RESPONSE_BYTES = "2 * (length(dependency.record_key)\n + length(dependency.dependency_key)) + 192";
|
|
45
|
+
export declare const OPERATION_RECORD_RESPONSE_BYTES = "2 * (length(materialized.space_id)\n + length(materialized.operation_sha256) + length(materialized.record_key)\n + length(materialized.change_kind) + length(materialized.record_sha256)) + 320";
|
|
46
|
+
export declare const AUTHORITY_SCHEMA_TABLE_STATEMENT = "CREATE TABLE IF NOT EXISTS oh_authority_schemas (\n version INTEGER PRIMARY KEY,\n name TEXT NOT NULL UNIQUE,\n schema_sha256 TEXT NOT NULL,\n applied_at TEXT NOT NULL\n) STRICT";
|
|
47
|
+
export declare const AUTHORITY_SCHEMA_STATEMENTS: readonly string[];
|
|
48
|
+
export declare function normalizedSchemaSql(sql: string): string;
|
|
49
|
+
export declare function expectedSchemaObject(statement: string): Readonly<{
|
|
50
|
+
name: string;
|
|
51
|
+
sql: string;
|
|
52
|
+
tableName: string;
|
|
53
|
+
type: "index" | "table" | "trigger";
|
|
54
|
+
}>;
|
|
55
|
+
export declare const AUTHORITY_SCHEMA_OBJECTS: readonly Readonly<{
|
|
56
|
+
name: string;
|
|
57
|
+
sql: string;
|
|
58
|
+
tableName: string;
|
|
59
|
+
type: "index" | "table" | "trigger";
|
|
60
|
+
}>[];
|
|
61
|
+
export declare const AUTHORITY_SCHEMA_SHA256: Sha256Hex;
|
|
62
|
+
export declare function rowValue(row: Readonly<Record<string, unknown>> | readonly unknown[], key: string, index: number): unknown;
|
|
63
|
+
export declare function integer(value: unknown): number | null;
|
|
64
|
+
export declare function normalizeLimit(value: number | undefined, fallback?: number, maximum?: number): number;
|
|
65
|
+
export declare function parseOperationJson(value: unknown): OhOperationV1;
|
|
66
|
+
export declare function parseOperationRow(row: Readonly<Record<string, unknown>> | readonly unknown[], expected?: Readonly<{
|
|
67
|
+
operationId?: string;
|
|
68
|
+
operationSha256?: string;
|
|
69
|
+
spaceId?: string;
|
|
70
|
+
}>): OhOperationV1;
|
|
71
|
+
export declare function parseBindingRow(row: Readonly<Record<string, unknown>> | readonly unknown[], expectedSpaceId: string): OhStoreBindingV1;
|
|
72
|
+
export declare function parsePurgeReceiptRow(row: Readonly<Record<string, unknown>> | readonly unknown[], expectedSpaceId: string, expectedBindingSha256?: Sha256Hex): OhSpacePurgeReceiptV1;
|
|
73
|
+
export declare function parseHeadRow(row: Readonly<Record<string, unknown>> | readonly unknown[]): OhHeadV1;
|
|
74
|
+
export declare const PURGE_PAYLOAD_TABLES: readonly ["oh_authority_spaces", "oh_authority_bindings", "oh_authority_operations", "oh_authority_operation_records", "oh_authority_records", "oh_authority_dependencies"];
|
|
75
|
+
//# sourceMappingURL=libsql-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libsql-model.d.ts","sourceRoot":"","sources":["../src/libsql-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7F,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAC1G,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAAE,IAAI,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC/F,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CACH,UAAU,EAAE,SAAS,mBAAmB,EAAE,EAC1C,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,GACnC,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAAC;IACxC,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,OAAO,CAAC,SAAS,EAAE,mBAAmB,GA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CAAC,CAAC,GAAG,SAAS,OAAO,EAAE,GAAG,QAAQ,CAgBlG;AAED,eAAO,MAAM,oBAAoB,6KAEM,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import type { OhLibSqlClientV1, OhLibSqlResultV1, OhLibSqlStatementV1 } from "./libsql-model";
|
|
3
|
+
export type LibSqlFailure = Readonly<{
|
|
4
|
+
_tag: "LibSqlConflict" | "LibSqlDependency" | "LibSqlIntegrity" | "LibSqlProfile" | "LibSqlPurged" | "LibSqlClosed" | "LibSqlCapacity" | "LibSqlValidation" | "LibSqlForeign";
|
|
5
|
+
/** Kept locally to reproduce the existing public rejection value. */
|
|
6
|
+
cause: unknown;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function libSqlFailure(cause: unknown): LibSqlFailure;
|
|
9
|
+
/** Existing canonical validators may throw; unrelated generator defects remain defects. */
|
|
10
|
+
export declare function libSqlValue<A>(evaluate: () => A): Effect.Effect<A, LibSqlFailure>;
|
|
11
|
+
export interface LibSqlAuthorityClientService {
|
|
12
|
+
execute(statement: OhLibSqlStatementV1 | string): Effect.Effect<OhLibSqlResultV1, LibSqlFailure>;
|
|
13
|
+
batch(statements: readonly OhLibSqlStatementV1[], mode?: "deferred" | "read" | "write"): Effect.Effect<readonly OhLibSqlResultV1[], LibSqlFailure>;
|
|
14
|
+
readonly close: Effect.Effect<void, LibSqlFailure>;
|
|
15
|
+
readonly currentInstant: Effect.Effect<string, LibSqlFailure>;
|
|
16
|
+
}
|
|
17
|
+
declare const LibSqlAuthorityClient_base: Context.TagClass<LibSqlAuthorityClient, "@hraness/oh/LibSqlAuthorityClient", LibSqlAuthorityClientService>;
|
|
18
|
+
export declare class LibSqlAuthorityClient extends LibSqlAuthorityClient_base {
|
|
19
|
+
}
|
|
20
|
+
/** The structural client owns transaction atomicity. Never split a batch or
|
|
21
|
+
* abandon its foreign Promise when a fiber is interrupted; no retry is added. */
|
|
22
|
+
export declare function libSqlAuthorityClientLive(client: OhLibSqlClientV1): Layer.Layer<LibSqlAuthorityClient>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=libsql-platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libsql-platform.d.ts","sourceRoot":"","sources":["../src/libsql-platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE9F,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,eAAe,GAAG,cAAc,GAAG,cAAc,GAC/G,gBAAgB,GAAG,kBAAkB,GAAG,eAAe,CAAC;IAC5D,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAQ3D;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAEjF;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,CAAC,SAAS,EAAE,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IACjG,KAAK,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,GACpF,MAAM,CAAC,MAAM,CAAC,SAAS,gBAAgB,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACnD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC/D;;AAED,qBAAa,qBAAsB,SAAQ,0BAExC;CAAG;AAEN;iFACiF;AACjF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAStG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { type Sha256Hex } from "./canonical";
|
|
3
|
+
import { type OhOperationV1 } from "./operation";
|
|
4
|
+
import { type OhChangesPageV1, type OhCommitInputV1, type OhDependencyClosureV1, type OhHeadRefV1, type OhHeadV1, type OhSnapshotV1, type OhSpacePurgeReceiptV1, type OhStoreBindingV1, type OhStoreVerificationV1 } from "./store";
|
|
5
|
+
import { type OhLibSqlStoreAuthorityOptionsV1 } from "./libsql-model";
|
|
6
|
+
import { type LibSqlFailure, type LibSqlAuthorityClientService } from "./libsql-platform";
|
|
7
|
+
/** One-time schema operation for a client authorized to create authority tables. */
|
|
8
|
+
export declare function bootstrapAuthority(client: LibSqlAuthorityClientService): Effect.Effect<Readonly<{
|
|
9
|
+
schemaSha256: Sha256Hex;
|
|
10
|
+
schemaVersion: 1;
|
|
11
|
+
v: 1;
|
|
12
|
+
}>, LibSqlFailure>;
|
|
13
|
+
export declare class LibSqlStoreProgram {
|
|
14
|
+
#private;
|
|
15
|
+
readonly binding: OhStoreBindingV1;
|
|
16
|
+
constructor(client: LibSqlAuthorityClientService, binding: OhStoreBindingV1);
|
|
17
|
+
closedFailure(): LibSqlFailure;
|
|
18
|
+
purgeFromHost(input: Readonly<{
|
|
19
|
+
purgedAt?: string;
|
|
20
|
+
}>): Effect.Effect<OhSpacePurgeReceiptV1, LibSqlFailure>;
|
|
21
|
+
head(): Effect.Effect<OhHeadV1, LibSqlFailure>;
|
|
22
|
+
snapshot(options?: Readonly<{
|
|
23
|
+
head?: OhHeadRefV1;
|
|
24
|
+
maximumRecords?: number;
|
|
25
|
+
}>): Effect.Effect<OhSnapshotV1, LibSqlFailure>;
|
|
26
|
+
changesSince(fromValue: OhHeadRefV1, options?: Readonly<{
|
|
27
|
+
limit?: number;
|
|
28
|
+
through?: OhHeadRefV1;
|
|
29
|
+
}>): Effect.Effect<OhChangesPageV1, LibSqlFailure>;
|
|
30
|
+
commit(input: OhCommitInputV1): Effect.Effect<OhOperationV1, LibSqlFailure>;
|
|
31
|
+
exportDependencyClosure(input: Readonly<{
|
|
32
|
+
head?: OhHeadRefV1;
|
|
33
|
+
maximumRecords?: number;
|
|
34
|
+
roots: readonly string[];
|
|
35
|
+
}>): Effect.Effect<OhDependencyClosureV1, LibSqlFailure>;
|
|
36
|
+
verify(): Effect.Effect<OhStoreVerificationV1, LibSqlFailure>;
|
|
37
|
+
purgeWorkingSpace(purgedAt: string): Effect.Effect<OhSpacePurgeReceiptV1, LibSqlFailure>;
|
|
38
|
+
}
|
|
39
|
+
/** Opens a direct libSQL/Turso authority; this is not operation-log sync. */
|
|
40
|
+
export declare function createAuthority(client: LibSqlAuthorityClientService, options?: OhLibSqlStoreAuthorityOptionsV1): Effect.Effect<LibSqlStoreProgram, LibSqlFailure>;
|
|
41
|
+
/**
|
|
42
|
+
* Opens an already-bound direct libSQL/Turso authority without creating or
|
|
43
|
+
* updating data. This seam is for separately held read or purge custody that
|
|
44
|
+
* must fail closed instead of acquiring space-creation authority.
|
|
45
|
+
*/
|
|
46
|
+
export declare function openExistingAuthority(client: LibSqlAuthorityClientService, options?: OhLibSqlStoreAuthorityOptionsV1): Effect.Effect<LibSqlStoreProgram, LibSqlFailure>;
|
|
47
|
+
/**
|
|
48
|
+
* Purges an existing working authority or atomically fences its exact binding
|
|
49
|
+
* when creation never completed. The empty-space receipt prevents a delayed
|
|
50
|
+
* creator from resurrecting abandoned custody without granting the purge
|
|
51
|
+
* credential permission to create a space or binding.
|
|
52
|
+
*/
|
|
53
|
+
export declare function purgeWorkingSpace(client: LibSqlAuthorityClientService, options?: OhLibSqlStoreAuthorityOptionsV1 & Readonly<{
|
|
54
|
+
purgedAt?: string;
|
|
55
|
+
}>): Effect.Effect<OhSpacePurgeReceiptV1, LibSqlFailure>;
|
|
56
|
+
/** Admission and drain are one local authority lifetime. SQL still arbitrates
|
|
57
|
+
* concurrent commits; this gate does not serialize independent operations. */
|
|
58
|
+
export declare const makeLibSqlOwner: Effect.Effect<{
|
|
59
|
+
admit: Effect.Effect<boolean, never, never>;
|
|
60
|
+
beginClose: Effect.Effect<void, never, never>;
|
|
61
|
+
drained: Effect.Effect<void, never, never>;
|
|
62
|
+
complete: <A>(operation: Effect.Effect<A, LibSqlFailure>) => Effect.Effect<A, LibSqlFailure>;
|
|
63
|
+
}, never, never>;
|
|
64
|
+
//# sourceMappingURL=libsql-program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libsql-program.d.ts","sourceRoot":"","sources":["../src/libsql-program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAe,MAAM,QAAQ,CAAC;AACvD,OAAO,EAML,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AASrB,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAgBL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EAGL,KAAK,+BAA+B,EA0BrC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,4BAA4B,EAClC,MAAM,mBAAmB,CAAC;AAyD3B,oFAAoF;AACpF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,4BAA4B,GACn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AAqB,EAAE,aAAa,CAAC;IAiBxD,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;IAkB7D,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;CAgFzF;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAC7B,MAAM,EAAE,4BAA4B,EACpC,OAAO,GAAE,+BAAoC,GAC5C,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAalD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,4BAA4B,EACpC,OAAO,GAAE,+BAAoC,GAC5C,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAalD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,4BAA4B,EACpC,OAAO,GAAE,+BAA+B,GAAG,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,GAC9E,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAkHrD;AACD;8EAC8E;AAC9E,eAAO,MAAM,eAAe;;;;eAoBb,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC;gBAG5F,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OhLibSqlClientV1, OhLibSqlStoreAuthorityOptionsV1 } from "./libsql-model";
|
|
2
|
+
import type { OhStoreAuthorityV1, OhSpacePurgeReceiptV1 } from "./store";
|
|
3
|
+
export declare function bootstrapOhLibSqlAuthorityV1(client: OhLibSqlClientV1): Promise<Readonly<{
|
|
4
|
+
schemaSha256: import("./canonical").Sha256Hex;
|
|
5
|
+
schemaVersion: 1;
|
|
6
|
+
v: 1;
|
|
7
|
+
}>>;
|
|
8
|
+
export declare function createOhLibSqlStoreAuthorityV1(client: OhLibSqlClientV1, options?: OhLibSqlStoreAuthorityOptionsV1): Promise<OhStoreAuthorityV1>;
|
|
9
|
+
export declare function openExistingOhLibSqlStoreAuthorityV1(client: OhLibSqlClientV1, options?: OhLibSqlStoreAuthorityOptionsV1): Promise<OhStoreAuthorityV1>;
|
|
10
|
+
export declare function purgeOhLibSqlWorkingSpaceV1(client: OhLibSqlClientV1, options?: OhLibSqlStoreAuthorityOptionsV1 & Readonly<{
|
|
11
|
+
purgedAt?: string;
|
|
12
|
+
}>): Promise<OhSpacePurgeReceiptV1>;
|
|
13
|
+
//# sourceMappingURL=libsql-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libsql-runtime.d.ts","sourceRoot":"","sources":["../src/libsql-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAmC,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAkD1G,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,gBAAgB,GACnE,OAAO,CAAC,QAAQ,CAAC;IAAE,YAAY,EAAE,OAAO,aAAa,EAAE,SAAS,CAAC;IAAC,aAAa,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC,CAI7F;AAUD,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,EACrE,OAAO,GAAE,+BAAoC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE5E;AAED,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,gBAAgB,EAC3E,OAAO,GAAE,+BAAoC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE5E;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAClE,OAAO,GAAE,+BAA+B,GAAG,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAUjH"}
|
package/dist/libsql.d.ts
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export type OhLibSqlStatementV1 = Readonly<{
|
|
5
|
-
args?: readonly OhLibSqlValueV1[];
|
|
6
|
-
sql: string;
|
|
7
|
-
}>;
|
|
8
|
-
export type OhLibSqlResultV1 = Readonly<{
|
|
9
|
-
rows: readonly (Readonly<Record<string, unknown>> | readonly unknown[])[];
|
|
10
|
-
rowsAffected?: number;
|
|
11
|
-
}>;
|
|
12
|
-
/** Structural subset implemented by `@libsql/client` clients. */
|
|
13
|
-
export interface OhLibSqlClientV1 {
|
|
14
|
-
batch(statements: readonly OhLibSqlStatementV1[], mode?: "deferred" | "read" | "write"): Promise<readonly OhLibSqlResultV1[]>;
|
|
15
|
-
close?(): void;
|
|
16
|
-
execute(statement: OhLibSqlStatementV1 | string): Promise<OhLibSqlResultV1>;
|
|
17
|
-
}
|
|
18
|
-
export type OhLibSqlStoreAuthorityOptionsV1 = Readonly<{
|
|
19
|
-
closeClient?: boolean;
|
|
20
|
-
profile?: OhStoreProfileV1;
|
|
21
|
-
realmId?: string;
|
|
22
|
-
spaceId?: string;
|
|
23
|
-
}>;
|
|
1
|
+
import type { OhLibSqlClientV1, OhLibSqlStoreAuthorityOptionsV1 } from "./libsql-model";
|
|
2
|
+
import type { Sha256Hex } from "./canonical";
|
|
3
|
+
import type { OhStoreAuthorityV1, OhSpacePurgeReceiptV1 } from "./store";
|
|
24
4
|
export declare const OH_LIBSQL_STORE_LIMITS_V1: Readonly<{
|
|
25
5
|
changesPerCommit: 64;
|
|
26
6
|
changeFeedLimit: 7;
|
|
@@ -31,26 +11,14 @@ export declare const OH_LIBSQL_STORE_LIMITS_V1: Readonly<{
|
|
|
31
11
|
providerResponseBytes: 9000000;
|
|
32
12
|
snapshotComponentBytes: number;
|
|
33
13
|
}>;
|
|
34
|
-
|
|
14
|
+
export type { OhLibSqlClientV1, OhLibSqlResultV1, OhLibSqlStatementV1, OhLibSqlStoreAuthorityOptionsV1, OhLibSqlValueV1 } from "./libsql-model";
|
|
35
15
|
export declare function bootstrapOhLibSqlAuthorityV1(client: OhLibSqlClientV1): Promise<Readonly<{
|
|
36
16
|
schemaSha256: Sha256Hex;
|
|
37
17
|
schemaVersion: 1;
|
|
38
18
|
v: 1;
|
|
39
19
|
}>>;
|
|
40
|
-
/** Opens a direct libSQL/Turso authority; this is not operation-log sync. */
|
|
41
20
|
export declare function createOhLibSqlStoreAuthorityV1(client: OhLibSqlClientV1, options?: OhLibSqlStoreAuthorityOptionsV1): Promise<OhStoreAuthorityV1>;
|
|
42
|
-
/**
|
|
43
|
-
* Opens an already-bound direct libSQL/Turso authority without creating or
|
|
44
|
-
* updating data. This seam is for separately held read or purge custody that
|
|
45
|
-
* must fail closed instead of acquiring space-creation authority.
|
|
46
|
-
*/
|
|
47
21
|
export declare function openExistingOhLibSqlStoreAuthorityV1(client: OhLibSqlClientV1, options?: OhLibSqlStoreAuthorityOptionsV1): Promise<OhStoreAuthorityV1>;
|
|
48
|
-
/**
|
|
49
|
-
* Purges an existing working authority or atomically fences its exact binding
|
|
50
|
-
* when creation never completed. The empty-space receipt prevents a delayed
|
|
51
|
-
* creator from resurrecting abandoned custody without granting the purge
|
|
52
|
-
* credential permission to create a space or binding.
|
|
53
|
-
*/
|
|
54
22
|
export declare function purgeOhLibSqlWorkingSpaceV1(client: OhLibSqlClientV1, options?: OhLibSqlStoreAuthorityOptionsV1 & Readonly<{
|
|
55
23
|
purgedAt?: string;
|
|
56
24
|
}>): Promise<OhSpacePurgeReceiptV1>;
|
package/dist/libsql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libsql.d.ts","sourceRoot":"","sources":["../src/libsql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"libsql.d.ts","sourceRoot":"","sources":["../src/libsql.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAQzE,eAAO,MAAM,yBAAyB;;;;;;;;;EAAS,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,mBAAmB,EACnE,+BAA+B,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE3E,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,gBAAgB,GACzE,OAAO,CAAC,QAAQ,CAAC;IAAE,YAAY,EAAE,SAAS,CAAC;IAAC,aAAa,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC,CAEvE;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,EAC3E,OAAO,GAAE,+BAAoC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE5E;AAED,wBAAsB,oCAAoC,CAAC,MAAM,EAAE,gBAAgB,EACjF,OAAO,GAAE,+BAAoC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE5E;AAED,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EACxE,OAAO,GAAE,+BAA+B,GAAG,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,GAC/E,OAAO,CAAC,qBAAqB,CAAC,CAE/B"}
|