@vireocodedev/sqlite 0.2.0 → 0.2.1
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/dist/concurrency/createSqliteOperationCoordinator.d.ts +24 -0
- package/dist/core/sqliteCrud.d.ts +4 -0
- package/dist/core/sqliteEntityFactory.d.ts +134 -0
- package/dist/core/sqliteRequestHandlers.d.ts +7 -0
- package/dist/core/sqliteRuntime.d.ts +7 -0
- package/dist/core/sqliteTypes.d.ts +12 -0
- package/dist/core/sqliteWorkerProtocol.d.ts +18 -0
- package/dist/core/sqliteWorkerRuntime.d.ts +19 -0
- package/dist/devtools/createSqlConsoleClient.d.ts +20 -0
- package/dist/hydration/createHydrationContributorRegistry.d.ts +11 -0
- package/dist/hydration/createHydrationController.d.ts +60 -0
- package/dist/hydration/createHydrationEntityClient.d.ts +16 -0
- package/dist/hydration/createHydrationGate.d.ts +22 -0
- package/dist/hydration/createHydrationRequestQueue.d.ts +22 -0
- package/dist/hydration/createHydrationStatus.d.ts +26 -0
- package/dist/hydration/createLocalReflectionQueue.d.ts +11 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +1508 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle/createDatabaseOwnerStore.d.ts +11 -0
- package/dist/lifecycle/createOfflineDataLifecycle.d.ts +26 -0
- package/dist/lifecycle/createOpfsDatabaseFiles.d.ts +15 -0
- package/dist/offline/hydration/hydratePagedSnapshot.d.ts +14 -0
- package/dist/offline/index.d.ts +7 -0
- package/dist/offline/index.js +99 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/offline/mutations/offlineMutations.d.ts +20 -0
- package/dist/offline/queue/queueingHeaders.d.ts +4 -0
- package/dist/offline/queue/queueingPolicy.d.ts +2 -0
- package/dist/offline/queue/queueingTypes.d.ts +18 -0
- package/dist/offline/status/offlineStatusRuntime.d.ts +2 -0
- package/dist/offline/status/offlineStatusTypes.d.ts +23 -0
- package/dist/offline-queue/createOfflineQueueCapture.d.ts +16 -0
- package/dist/offline-queue/createOfflineQueueClient.d.ts +23 -0
- package/dist/offline-queue/createOfflineQueueStatus.d.ts +18 -0
- package/dist/offline-queue/offlineQueueStateSqlite.d.ts +30 -0
- package/dist/offline-queue/replayOfflineSyncBatch.d.ts +29 -0
- package/dist/queueingHeaders-B7TBifLV.js +20 -0
- package/dist/queueingHeaders-B7TBifLV.js.map +1 -0
- package/dist/runtime/contracts.d.ts +54 -0
- package/dist/runtime/createManagedSqliteRuntime.d.ts +23 -0
- package/dist/runtime/createSqliteEntityClient.d.ts +32 -0
- package/dist/runtime/createSqliteTransport.d.ts +17 -0
- package/dist/runtime/hydrationEntityStateSqlite.d.ts +20 -0
- package/dist/runtime/sqlConsoleSqlite.d.ts +20 -0
- package/dist/sqliteWorkerConfig.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type OfflineStatusSnapshot = {
|
|
2
|
+
online: boolean;
|
|
3
|
+
heartbeatEnabled: boolean;
|
|
4
|
+
heartbeatConnected: boolean;
|
|
5
|
+
syncInProgress: boolean;
|
|
6
|
+
lastHeartbeatAt: number | null;
|
|
7
|
+
};
|
|
8
|
+
export type OfflineStatusRuntimeOptions = {
|
|
9
|
+
staleAfterMs?: number;
|
|
10
|
+
bootstrapAssumeOnlineMs?: number;
|
|
11
|
+
tickMs?: number;
|
|
12
|
+
now?: () => number;
|
|
13
|
+
};
|
|
14
|
+
export type OfflineStatusRuntime = {
|
|
15
|
+
start: () => () => void;
|
|
16
|
+
getSnapshot: () => OfflineStatusSnapshot;
|
|
17
|
+
setHeartbeatEnabled: (enabled: boolean) => void;
|
|
18
|
+
markHeartbeatConnected: () => void;
|
|
19
|
+
markHeartbeatDisconnected: () => void;
|
|
20
|
+
markHeartbeatReceived: (syncInProgress: boolean) => void;
|
|
21
|
+
markBackendUnavailable: () => void;
|
|
22
|
+
markBackendAvailable: () => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OfflineSyncCommand } from '../offline/queue/queueingTypes';
|
|
2
|
+
export type OfflineQueueCaptureRequest = {
|
|
3
|
+
method?: string;
|
|
4
|
+
body?: unknown;
|
|
5
|
+
headers?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
export type CreateOfflineQueueCaptureConfig<TRequest extends OfflineQueueCaptureRequest> = {
|
|
8
|
+
resolveUrl: (request: TRequest) => string;
|
|
9
|
+
createCommandId: () => string;
|
|
10
|
+
now: () => number;
|
|
11
|
+
enqueue: (command: OfflineSyncCommand) => Promise<void>;
|
|
12
|
+
markEnqueued: () => void;
|
|
13
|
+
refreshStatus: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
/** Captures a transport request as a replayable command; transport-specific URL resolution stays injected. */
|
|
16
|
+
export declare function createOfflineQueueCapture<TRequest extends OfflineQueueCaptureRequest>(config: CreateOfflineQueueCaptureConfig<TRequest>): (request: TRequest) => Promise<OfflineSyncCommand>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OfflineQueuedCommand, OfflineQueueStatusCounts } from './offlineQueueStateSqlite';
|
|
2
|
+
import { InMemorySqliteStore } from '../runtime/createManagedSqliteRuntime';
|
|
3
|
+
import { SqliteTransport } from '../runtime/createSqliteTransport';
|
|
4
|
+
import { OfflineSyncCommand } from '../offline/queue/queueingTypes';
|
|
5
|
+
export type OfflineQueueClientRuntime = {
|
|
6
|
+
shouldUseInMemoryFallback: () => boolean;
|
|
7
|
+
registerInMemoryStore: (store: InMemorySqliteStore) => () => void;
|
|
8
|
+
};
|
|
9
|
+
export type OfflineQueueClient = {
|
|
10
|
+
enqueue: (command: OfflineSyncCommand) => Promise<void>;
|
|
11
|
+
getBatch: (batchSize: number) => Promise<OfflineQueuedCommand[]>;
|
|
12
|
+
delete: (commandIds: string[]) => Promise<void>;
|
|
13
|
+
markRetryable: (commandIds: string[], lastError: string | null, maxRetryCount: number) => Promise<void>;
|
|
14
|
+
markPermanentlyFailed: (commandIds: string[], lastError: string | null) => Promise<void>;
|
|
15
|
+
getSize: () => Promise<number>;
|
|
16
|
+
getStatusCounts: () => Promise<OfflineQueueStatusCounts>;
|
|
17
|
+
dispose: () => void;
|
|
18
|
+
};
|
|
19
|
+
export type CreateOfflineQueueClientConfig = {
|
|
20
|
+
runtime: OfflineQueueClientRuntime;
|
|
21
|
+
transport: Pick<SqliteTransport, "sendWorkerRequest">;
|
|
22
|
+
};
|
|
23
|
+
export declare function createOfflineQueueClient(config: CreateOfflineQueueClientConfig): OfflineQueueClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OfflineQueueStatusCounts } from './offlineQueueStateSqlite';
|
|
2
|
+
export type OfflineQueueStatusSnapshot = OfflineQueueStatusCounts & {
|
|
3
|
+
enqueueTick: number;
|
|
4
|
+
};
|
|
5
|
+
export type OfflineQueueStatusListener = (snapshot: OfflineQueueStatusSnapshot) => void;
|
|
6
|
+
export type OfflineQueueStatus = {
|
|
7
|
+
getSnapshot: () => OfflineQueueStatusSnapshot;
|
|
8
|
+
subscribe: (listener: OfflineQueueStatusListener) => () => void;
|
|
9
|
+
markEnqueued: () => void;
|
|
10
|
+
refresh: () => Promise<void>;
|
|
11
|
+
resetCounts: () => void;
|
|
12
|
+
};
|
|
13
|
+
export type CreateOfflineQueueStatusConfig = {
|
|
14
|
+
readStatusCounts: () => Promise<OfflineQueueStatusCounts>;
|
|
15
|
+
onReadError?: (error: unknown) => void;
|
|
16
|
+
};
|
|
17
|
+
/** Framework-neutral observable queue status with non-blocking persistence refreshes. */
|
|
18
|
+
export declare function createOfflineQueueStatus(config: CreateOfflineQueueStatusConfig): OfflineQueueStatus;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SqliteDatabase } from '../core/sqliteTypes';
|
|
2
|
+
import { OfflineSyncCommandRecord } from '../runtime/contracts';
|
|
3
|
+
export declare const OFFLINE_QUEUE_PENDING = "PENDING";
|
|
4
|
+
export declare const OFFLINE_QUEUE_PERMANENTLY_FAILED = "PERMANENTLY_FAILED";
|
|
5
|
+
export type OfflineQueuedCommandStatus = typeof OFFLINE_QUEUE_PENDING | typeof OFFLINE_QUEUE_PERMANENTLY_FAILED;
|
|
6
|
+
export type OfflineQueuedCommand = OfflineSyncCommandRecord & {
|
|
7
|
+
status: OfflineQueuedCommandStatus;
|
|
8
|
+
retryCount: number;
|
|
9
|
+
lastError: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type OfflineQueueStatusCounts = {
|
|
12
|
+
pending: number;
|
|
13
|
+
permanentlyFailed: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function enqueueOfflineCommand(db: SqliteDatabase, command: OfflineSyncCommandRecord): void;
|
|
16
|
+
export declare function getPendingOfflineCommands(db: SqliteDatabase, batchSize: number): OfflineQueuedCommand[];
|
|
17
|
+
export declare function deleteOfflineCommands(db: SqliteDatabase, commandIds: string[]): void;
|
|
18
|
+
export declare function getOfflineQueueSize(db: SqliteDatabase): number;
|
|
19
|
+
export declare function getOfflineQueueStatusCounts(db: SqliteDatabase): OfflineQueueStatusCounts;
|
|
20
|
+
export declare function markOfflineCommandsRetryable(db: SqliteDatabase, commandIds: string[], lastError: string | null, maxRetryCount: number): void;
|
|
21
|
+
export declare function markOfflineCommandsPermanentlyFailed(db: SqliteDatabase, commandIds: string[], lastError: string | null): void;
|
|
22
|
+
export declare const OFFLINE_QUEUE_STATE_SQLITE_REQUEST_HANDLERS: {
|
|
23
|
+
enqueue: (db: SqliteDatabase, request: import('..').WorkerRequest) => null;
|
|
24
|
+
getPendingBatch: (db: SqliteDatabase, request: import('..').WorkerRequest) => OfflineQueuedCommand[];
|
|
25
|
+
deleteCommands: (db: SqliteDatabase, request: import('..').WorkerRequest) => null;
|
|
26
|
+
getQueueSize: (db: SqliteDatabase) => number;
|
|
27
|
+
getStatusCounts: (db: SqliteDatabase) => OfflineQueueStatusCounts;
|
|
28
|
+
markCommandsRetryable: (db: SqliteDatabase, request: import('..').WorkerRequest) => null;
|
|
29
|
+
markCommandsPermanentlyFailed: (db: SqliteDatabase, request: import('..').WorkerRequest) => null;
|
|
30
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OfflineSyncCommand } from '../offline/queue/queueingTypes';
|
|
2
|
+
export type OfflineSyncResultReason = "APPLIED" | "ALREADY_APPLIED" | "RETRYABLE" | "REJECTED" | "RETRY_LIMIT_EXCEEDED";
|
|
3
|
+
export type OfflineSyncCommandResult = {
|
|
4
|
+
commandId: string;
|
|
5
|
+
success: boolean;
|
|
6
|
+
status: number;
|
|
7
|
+
error: string | null;
|
|
8
|
+
reason?: OfflineSyncResultReason | null;
|
|
9
|
+
};
|
|
10
|
+
export type OfflineSyncBatchResponse = {
|
|
11
|
+
accepted: number;
|
|
12
|
+
failed: number;
|
|
13
|
+
results: OfflineSyncCommandResult[];
|
|
14
|
+
};
|
|
15
|
+
export type OfflineSyncCommandDto = Pick<OfflineSyncCommand, "commandId" | "method" | "url" | "body" | "headers">;
|
|
16
|
+
export type OfflineSyncReplayDependencies = {
|
|
17
|
+
getBatch: (batchSize: number) => Promise<OfflineSyncCommand[]>;
|
|
18
|
+
sendBatch: (commands: OfflineSyncCommandDto[]) => Promise<OfflineSyncBatchResponse>;
|
|
19
|
+
cleanupSuccessfulCommands: (commands: OfflineSyncCommand[]) => Promise<void>;
|
|
20
|
+
deleteSuccessful: (commandIds: string[]) => Promise<void>;
|
|
21
|
+
markPermanentlyFailed: (commandIds: string[], lastError: string | null) => Promise<void>;
|
|
22
|
+
markRetryable: (commandIds: string[], lastError: string | null, maxAttempts: number) => Promise<void>;
|
|
23
|
+
refreshStatus: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
export declare function replayOfflineSyncBatch(args: {
|
|
26
|
+
batchSize: number;
|
|
27
|
+
maxAttempts: number;
|
|
28
|
+
dependencies: OfflineSyncReplayDependencies;
|
|
29
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/offline/queue/queueingHeaders.ts
|
|
2
|
+
var e = "X-Offline-Temp-Id", t = "X-Offline-Temp-Product-Id";
|
|
3
|
+
function n(e) {
|
|
4
|
+
let t = {};
|
|
5
|
+
if (!e) return t;
|
|
6
|
+
for (let [n, r] of Object.entries(e)) r != null && (t[n.toLowerCase()] = String(r));
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
function r(t) {
|
|
10
|
+
let r = n(t), i = {}, a = r["idempotency-key"];
|
|
11
|
+
a && (i["Idempotency-Key"] = a);
|
|
12
|
+
let o = r["content-type"];
|
|
13
|
+
o && (i["Content-Type"] = o);
|
|
14
|
+
let s = r["x-offline-temp-id"] ?? r["x-offline-temp-product-id"];
|
|
15
|
+
return s && (i[e] = s), i;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as i, t as n, r, e as t };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=queueingHeaders-B7TBifLV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queueingHeaders-B7TBifLV.js","names":[],"sources":["../src/offline/queue/queueingHeaders.ts"],"sourcesContent":["export const OFFLINE_TEMP_ID_HEADER = \"X-Offline-Temp-Id\";\nexport const OFFLINE_TEMP_PRODUCT_ID_LEGACY_HEADER = \"X-Offline-Temp-Product-Id\";\n\nexport function normalizeHeaders(input: Record<string, unknown> | undefined): Record<string, string> {\n const normalized: Record<string, string> = {};\n\n if (!input) {\n return normalized;\n }\n\n for (const [key, value] of Object.entries(input)) {\n if (value == null) {\n continue;\n }\n\n normalized[key.toLowerCase()] = String(value);\n }\n\n return normalized;\n}\n\nexport function extractReplayHeaders(headers: Record<string, unknown> | undefined): Record<string, string> {\n const record = normalizeHeaders(headers);\n const replay: Record<string, string> = {};\n\n const idempotencyKey = record[\"idempotency-key\"];\n if (idempotencyKey) {\n replay[\"Idempotency-Key\"] = idempotencyKey;\n }\n\n const contentType = record[\"content-type\"];\n if (contentType) {\n replay[\"Content-Type\"] = contentType;\n }\n\n const offlineTempId =\n record[OFFLINE_TEMP_ID_HEADER.toLowerCase()] ?? record[OFFLINE_TEMP_PRODUCT_ID_LEGACY_HEADER.toLowerCase()];\n if (offlineTempId) {\n replay[OFFLINE_TEMP_ID_HEADER] = offlineTempId;\n }\n\n return replay;\n}\n"],"mappings":";AAAA,IAAa,IAAyB,qBACzB,IAAwC;AAErD,SAAgB,EAAiB,GAAoE;CACnG,IAAM,IAAqC,CAAC;CAE5C,IAAI,CAAC,GACH,OAAO;CAGT,KAAK,IAAM,CAAC,GAAK,MAAU,OAAO,QAAQ,CAAK,GACzC,KAAS,SAIb,EAAW,EAAI,YAAY,KAAK,OAAO,CAAK;CAG9C,OAAO;AACT;AAEA,SAAgB,EAAqB,GAAsE;CACzG,IAAM,IAAS,EAAiB,CAAO,GACjC,IAAiC,CAAC,GAElC,IAAiB,EAAO;CAC9B,AAAI,MACF,EAAO,qBAAqB;CAG9B,IAAM,IAAc,EAAO;CAC3B,AAAI,MACF,EAAO,kBAAkB;CAG3B,IAAM,IACJ,EAAA,wBAAgD,EAAA;CAKlD,OAJI,MACF,EAAO,KAA0B,IAG5B;AACT"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SqliteRequestHandlers } from '../core/sqliteRequestHandlers';
|
|
2
|
+
import { SqliteMigration } from '../core/sqliteTypes';
|
|
3
|
+
export type OfflineSyncCommandRecord = {
|
|
4
|
+
commandId: string;
|
|
5
|
+
method: string;
|
|
6
|
+
url: string;
|
|
7
|
+
body: unknown | null;
|
|
8
|
+
headers: Record<string, string>;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
};
|
|
11
|
+
export type SqliteHydrationEntityStateRecord = {
|
|
12
|
+
entityKey: string;
|
|
13
|
+
appliedRevision: number;
|
|
14
|
+
isStale: boolean;
|
|
15
|
+
lastHydratedAt: number | null;
|
|
16
|
+
lastRowCount: number | null;
|
|
17
|
+
lastError: string | null;
|
|
18
|
+
};
|
|
19
|
+
export type SqlExecutionStatementResult = {
|
|
20
|
+
statement: string;
|
|
21
|
+
columns: string[];
|
|
22
|
+
rows: unknown[][];
|
|
23
|
+
rowsAffected: number;
|
|
24
|
+
};
|
|
25
|
+
export type SqlExecutionResult = {
|
|
26
|
+
statements: SqlExecutionStatementResult[];
|
|
27
|
+
};
|
|
28
|
+
export type SqlPagedQueryRequest = {
|
|
29
|
+
selectSql: string;
|
|
30
|
+
fromSql: string;
|
|
31
|
+
whereSql: string;
|
|
32
|
+
orderBySql: string;
|
|
33
|
+
limit: number | null;
|
|
34
|
+
offset: number | null;
|
|
35
|
+
includeTotalCount?: boolean;
|
|
36
|
+
clientSentAtMs?: number;
|
|
37
|
+
};
|
|
38
|
+
export type SqlPagedQueryResult = {
|
|
39
|
+
columns: string[];
|
|
40
|
+
rows: unknown[][];
|
|
41
|
+
totalElements: number | null;
|
|
42
|
+
queueWaitMs?: number;
|
|
43
|
+
workerExecMs?: number;
|
|
44
|
+
};
|
|
45
|
+
export type SqliteWorkerEntityBundleConfig = {
|
|
46
|
+
requestHandlers: SqliteRequestHandlers;
|
|
47
|
+
};
|
|
48
|
+
export type CreateSqliteWorkerRuntimeConfigInput = {
|
|
49
|
+
dbFile: string;
|
|
50
|
+
migrations: SqliteMigration[];
|
|
51
|
+
entityBundles: SqliteWorkerEntityBundleConfig[];
|
|
52
|
+
debug?: boolean;
|
|
53
|
+
extraRequestHandlers?: SqliteRequestHandlers[];
|
|
54
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WorkerRequestInput, WorkerResponseResult } from '../core/sqliteWorkerProtocol';
|
|
2
|
+
export type InMemorySqliteStore = {
|
|
3
|
+
clear: () => void;
|
|
4
|
+
};
|
|
5
|
+
export type ManagedSqliteRuntimeConfig = {
|
|
6
|
+
workerFactory: () => Worker;
|
|
7
|
+
shouldUseInMemoryFallback?: () => boolean;
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
bootLogPrefix?: string;
|
|
10
|
+
now?: () => number;
|
|
11
|
+
};
|
|
12
|
+
export type ManagedSqliteRuntime = {
|
|
13
|
+
registerInMemoryStore: (store: InMemorySqliteStore) => () => void;
|
|
14
|
+
clearInMemoryStores: () => void;
|
|
15
|
+
shouldUseInMemoryFallback: () => boolean;
|
|
16
|
+
send: <T extends WorkerResponseResult>(payload: WorkerRequestInput) => Promise<T>;
|
|
17
|
+
ensureInitialized: () => Promise<void>;
|
|
18
|
+
warmup: () => Promise<void>;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
dispose: () => void;
|
|
21
|
+
};
|
|
22
|
+
/** Owns worker lifecycle, initialization, pending requests, fallback stores and deterministic teardown. */
|
|
23
|
+
export declare function createManagedSqliteRuntime(config: ManagedSqliteRuntimeConfig): ManagedSqliteRuntime;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { InMemorySqliteStore } from './createManagedSqliteRuntime';
|
|
2
|
+
import { SqliteTransport } from './createSqliteTransport';
|
|
3
|
+
type SqliteEntityClientRequest = {
|
|
4
|
+
type: string;
|
|
5
|
+
payloadKey: string;
|
|
6
|
+
};
|
|
7
|
+
export type SqliteEntityClient<TRecord, TKey> = {
|
|
8
|
+
replace: (records: TRecord[]) => Promise<void>;
|
|
9
|
+
upsert: (record: TRecord) => Promise<void>;
|
|
10
|
+
list: () => Promise<TRecord[]>;
|
|
11
|
+
delete: (keys: TKey[]) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export type SqliteEntityClientRuntime = {
|
|
14
|
+
shouldUseInMemoryFallback: () => boolean;
|
|
15
|
+
registerInMemoryStore: (store: InMemorySqliteStore) => () => void;
|
|
16
|
+
};
|
|
17
|
+
export type SqliteEntityClientConfig<TRecord, TKey> = {
|
|
18
|
+
runtime: SqliteEntityClientRuntime;
|
|
19
|
+
transport: Pick<SqliteTransport, "sendWorkerRequest">;
|
|
20
|
+
getKey: (record: TRecord) => TKey;
|
|
21
|
+
compare: (left: TRecord, right: TRecord) => number;
|
|
22
|
+
requests: {
|
|
23
|
+
replace: SqliteEntityClientRequest;
|
|
24
|
+
upsert: SqliteEntityClientRequest;
|
|
25
|
+
list: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
delete: SqliteEntityClientRequest;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare function createSqliteEntityClient<TRecord, TKey>(config: SqliteEntityClientConfig<TRecord, TKey>): SqliteEntityClient<TRecord, TKey>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WorkerRequestInput, WorkerResponseResult } from '../core/sqliteWorkerProtocol';
|
|
2
|
+
export type SqliteTransportRuntime = {
|
|
3
|
+
shouldUseInMemoryFallback: () => boolean;
|
|
4
|
+
ensureInitialized: () => Promise<void>;
|
|
5
|
+
send: <T extends WorkerResponseResult>(payload: WorkerRequestInput) => Promise<T>;
|
|
6
|
+
};
|
|
7
|
+
export type SqliteTransport = {
|
|
8
|
+
sendRequest: <TResponse = unknown>(type: string, payload?: Record<string, unknown>) => Promise<TResponse>;
|
|
9
|
+
sendWorkerRequest: <T extends WorkerResponseResult>(payload: {
|
|
10
|
+
type: string;
|
|
11
|
+
} & Record<string, unknown>) => Promise<T>;
|
|
12
|
+
};
|
|
13
|
+
export type CreateSqliteTransportConfig = {
|
|
14
|
+
runtime: SqliteTransportRuntime;
|
|
15
|
+
createUnavailableError?: (requestType: string) => Error;
|
|
16
|
+
};
|
|
17
|
+
export declare function createSqliteTransport({ runtime, createUnavailableError, }: CreateSqliteTransportConfig): SqliteTransport;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SqliteDatabase } from '../core/sqliteTypes';
|
|
2
|
+
import { SqliteHydrationEntityStateRecord } from './contracts';
|
|
3
|
+
export type HydrationEntityStateSqliteOperationMap = {
|
|
4
|
+
listHydrationEntityStates: {
|
|
5
|
+
request: Record<string, never>;
|
|
6
|
+
response: SqliteHydrationEntityStateRecord[];
|
|
7
|
+
};
|
|
8
|
+
upsertHydrationEntityState: {
|
|
9
|
+
request: {
|
|
10
|
+
state: SqliteHydrationEntityStateRecord;
|
|
11
|
+
};
|
|
12
|
+
response: null;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function listHydrationEntityStates(db: SqliteDatabase): SqliteHydrationEntityStateRecord[];
|
|
16
|
+
export declare function upsertHydrationEntityState(db: SqliteDatabase, state: SqliteHydrationEntityStateRecord): void;
|
|
17
|
+
export declare const HYDRATION_ENTITY_STATE_SQLITE_REQUEST_HANDLERS: {
|
|
18
|
+
listHydrationEntityStates: (db: SqliteDatabase) => SqliteHydrationEntityStateRecord[];
|
|
19
|
+
upsertHydrationEntityState: (db: SqliteDatabase, request: import('..').WorkerRequest) => null;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SqliteDatabase } from '../core/sqliteTypes';
|
|
2
|
+
import { SqlExecutionResult, SqlPagedQueryRequest, SqlPagedQueryResult } from './contracts';
|
|
3
|
+
export type SqlConsoleSqliteOperationMap = {
|
|
4
|
+
executeSqlScript: {
|
|
5
|
+
request: {
|
|
6
|
+
script: string;
|
|
7
|
+
};
|
|
8
|
+
response: SqlExecutionResult;
|
|
9
|
+
};
|
|
10
|
+
executePagedQuery: {
|
|
11
|
+
request: SqlPagedQueryRequest;
|
|
12
|
+
response: SqlPagedQueryResult;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function executeSqlScript(db: SqliteDatabase, script: string): SqlExecutionResult;
|
|
16
|
+
export declare function executePagedQuery(db: SqliteDatabase, request: SqlPagedQueryRequest): SqlPagedQueryResult;
|
|
17
|
+
export declare const SQL_CONSOLE_SQLITE_REQUEST_HANDLERS: {
|
|
18
|
+
executeSqlScript: (db: SqliteDatabase, request: import('..').WorkerRequest) => SqlExecutionResult;
|
|
19
|
+
executePagedQuery: (db: SqliteDatabase, request: import('..').WorkerRequest) => SqlPagedQueryResult;
|
|
20
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SqliteWorkerRuntimeConfig } from './core/sqliteWorkerRuntime';
|
|
2
|
+
import { CreateSqliteWorkerRuntimeConfigInput } from './runtime/contracts';
|
|
3
|
+
export declare function createSqliteWorkerRuntimeConfig(input: CreateSqliteWorkerRuntimeConfigInput): SqliteWorkerRuntimeConfig;
|