@haverstack/record-adapter-sqlite 0.33.0 → 0.35.0
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/index.d.ts +21 -34
- package/dist/index.js +849 -747
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StackCapabilities, StackRecord,
|
|
2
|
-
import { StackRecordAdapter, JournalOptions } from '@haverstack/core/adapter';
|
|
1
|
+
import { StackCapabilities, StackRecord, TypeId, QueryResult, FileId, BaseId, VersionsQuery, RecordVersion, JournalQuery, RecordJournalEntry, StackType, AssociationEdit, DataAssociation, AuthorityAssociation, Actor } from '@haverstack/core';
|
|
2
|
+
import { StackRecordAdapter, JournalOptions, MutateOptions, AspectWriteOptions, AdapterQuery, Reach, ElementWriteOptions } from '@haverstack/core/adapter';
|
|
3
3
|
import { StackTokenStore, TokenSession, TokenInfo } from '@haverstack/core/wire';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -24,14 +24,10 @@ interface SqlExecutor {
|
|
|
24
24
|
/** Run a parameterized statement and return all result rows. */
|
|
25
25
|
all<T = Record<string, unknown>>(sql: string, params?: readonly unknown[]): T[];
|
|
26
26
|
/**
|
|
27
|
-
* Run `fn` atomically: every statement it issues commits
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* transaction (BEGIN/COMMIT/ROLLBACK) implements this with one; a
|
|
32
|
-
* binding whose transaction primitive is itself a callback wrapper
|
|
33
|
-
* (e.g. a Durable Object's storage.transactionSync) can pass `fn`
|
|
34
|
-
* straight through to it.
|
|
27
|
+
* Run `fn` atomically: every statement it issues commits, or none do if it
|
|
28
|
+
* throws. A callback rather than BEGIN/COMMIT text because some engines
|
|
29
|
+
* only offer one (a Durable Object's storage.transactionSync); for the
|
|
30
|
+
* same reason `fn` must be synchronous and use only this executor.
|
|
35
31
|
*/
|
|
36
32
|
transaction<T>(fn: () => T): T;
|
|
37
33
|
}
|
|
@@ -44,7 +40,7 @@ type StackConfig = {
|
|
|
44
40
|
|
|
45
41
|
/**
|
|
46
42
|
* The engine-independent half of a SQLite-backed StackRecordAdapter: the
|
|
47
|
-
* capability declaration and the delegation of all
|
|
43
|
+
* capability declaration and the delegation of all twenty-three
|
|
48
44
|
* StackRecordAdapter methods onto SharedSqlRecordLogic. Every method here
|
|
49
45
|
* is a forward with no engine-specific content, so an adapter that owns a
|
|
50
46
|
* SqlExecutor already knows how to answer all of them.
|
|
@@ -67,30 +63,18 @@ declare abstract class SharedSqlRecordAdapter implements StackRecordAdapter {
|
|
|
67
63
|
protected constructor(exec: SqlExecutor, config: StackConfig);
|
|
68
64
|
createRecord(record: StackRecord, opts?: JournalOptions): Promise<StackRecord>;
|
|
69
65
|
getRecord(id: string): Promise<StackRecord | null>;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
bumpsVersion?: boolean;
|
|
74
|
-
} & ActorOptions & JournalOptions): Promise<StackRecord>;
|
|
66
|
+
patchContent(id: string, patch: Record<string, unknown | null>, opts?: MutateOptions): Promise<StackRecord>;
|
|
67
|
+
setParent(id: string, parentId: string | null, opts?: AspectWriteOptions): Promise<StackRecord>;
|
|
68
|
+
setUnlisted(id: string, unlisted: boolean, opts?: AspectWriteOptions): Promise<StackRecord>;
|
|
75
69
|
deleteRecord(id: string, opts?: {
|
|
76
70
|
purge?: boolean;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
restoreVersion(id: string, version: number, opts?: {
|
|
85
|
-
ifVersion?: number;
|
|
86
|
-
snapshot?: RecordVersion;
|
|
87
|
-
} & ActorOptions & JournalOptions): Promise<StackRecord>;
|
|
88
|
-
commitMigration(id: string, toTypeId: TypeId, content: Record<string, unknown>, opts?: {
|
|
89
|
-
ifVersion?: number;
|
|
90
|
-
snapshot?: RecordVersion;
|
|
91
|
-
} & ActorOptions & JournalOptions): Promise<StackRecord>;
|
|
92
|
-
queryRecords(query: StackQuery): Promise<QueryResult>;
|
|
93
|
-
deleteUnreferencedAttachmentRecords(fileId: FileId, metadataTypeIds: TypeId[]): Promise<StackRecord[]>;
|
|
71
|
+
} & MutateOptions): Promise<StackRecord | null>;
|
|
72
|
+
undeleteRecord(id: string, opts?: MutateOptions): Promise<StackRecord>;
|
|
73
|
+
restoreVersion(id: string, version: number, opts?: MutateOptions): Promise<StackRecord>;
|
|
74
|
+
commitMigration(id: string, toTypeId: TypeId, content: Record<string, unknown>, opts?: MutateOptions): Promise<StackRecord>;
|
|
75
|
+
queryRecords(query: AdapterQuery): Promise<QueryResult>;
|
|
76
|
+
queryReadable(query: AdapterQuery, reach: Reach): Promise<QueryResult>;
|
|
77
|
+
deleteUnreferencedAttachmentRecords(fileId: FileId, metadataBaseId: BaseId): Promise<StackRecord[]>;
|
|
94
78
|
getVersions(id: string, query?: VersionsQuery): Promise<RecordVersion[]>;
|
|
95
79
|
getVersion(id: string, version: number): Promise<RecordVersion | null>;
|
|
96
80
|
saveVersion(id: string, version: RecordVersion): Promise<void>;
|
|
@@ -98,7 +82,10 @@ declare abstract class SharedSqlRecordAdapter implements StackRecordAdapter {
|
|
|
98
82
|
saveType(type: StackType): Promise<void>;
|
|
99
83
|
getType(id: TypeId): Promise<StackType | null>;
|
|
100
84
|
listTypes(): Promise<StackType[]>;
|
|
101
|
-
|
|
85
|
+
editAssociations(id: string, edits: AssociationEdit[], opts?: ElementWriteOptions<DataAssociation>): Promise<StackRecord>;
|
|
86
|
+
setAssociations(id: string, associations: DataAssociation[], opts?: ElementWriteOptions<DataAssociation>): Promise<StackRecord>;
|
|
87
|
+
editAccess(id: string, edits: AssociationEdit[], opts?: ElementWriteOptions<AuthorityAssociation>): Promise<StackRecord>;
|
|
88
|
+
setAccess(id: string, permissions: AuthorityAssociation[], opts?: ElementWriteOptions<AuthorityAssociation>): Promise<StackRecord>;
|
|
102
89
|
abstract flush(): Promise<void>;
|
|
103
90
|
abstract close(): Promise<void>;
|
|
104
91
|
}
|