@haverstack/record-adapter-sqlite 0.33.0 → 0.34.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 CHANGED
@@ -1,5 +1,5 @@
1
- import { StackCapabilities, StackRecord, RecordChangeSet, RecordVersion, ActorOptions, TypeId, StackQuery, QueryResult, FileId, VersionsQuery, JournalQuery, RecordJournalEntry, StackType, AssociationEdit, Actor } from '@haverstack/core';
2
- import { StackRecordAdapter, JournalOptions } from '@haverstack/core/adapter';
1
+ import { StackCapabilities, StackRecord, RecordChangeSet, TypeId, StackQuery, QueryResult, FileId, VersionsQuery, RecordVersion, JournalQuery, RecordJournalEntry, StackType, AssociationEdit, Actor } from '@haverstack/core';
2
+ import { StackRecordAdapter, JournalOptions, MutateOptions, BumpVersionOptions } 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 together, or
28
- * none do if it throws. `fn` must be synchronous and call back into
29
- * this executor only — not every engine's transaction primitive can
30
- * straddle a suspended call. A binding with a real multi-statement
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
  }
@@ -67,28 +63,13 @@ 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
- mutateRecord(id: string, changes: RecordChangeSet, opts?: {
71
- ifVersion?: number;
72
- snapshot?: RecordVersion;
73
- bumpsVersion?: boolean;
74
- } & ActorOptions & JournalOptions): Promise<StackRecord>;
66
+ mutateRecord(id: string, changes: RecordChangeSet, opts?: MutateOptions & BumpVersionOptions): Promise<StackRecord>;
75
67
  deleteRecord(id: string, opts?: {
76
68
  purge?: boolean;
77
- ifVersion?: number;
78
- snapshot?: RecordVersion;
79
- } & ActorOptions & JournalOptions): Promise<StackRecord | null>;
80
- undeleteRecord(id: string, opts?: {
81
- ifVersion?: number;
82
- snapshot?: RecordVersion;
83
- } & ActorOptions & JournalOptions): Promise<StackRecord>;
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>;
69
+ } & MutateOptions): Promise<StackRecord | null>;
70
+ undeleteRecord(id: string, opts?: MutateOptions): Promise<StackRecord>;
71
+ restoreVersion(id: string, version: number, opts?: MutateOptions): Promise<StackRecord>;
72
+ commitMigration(id: string, toTypeId: TypeId, content: Record<string, unknown>, opts?: MutateOptions): Promise<StackRecord>;
92
73
  queryRecords(query: StackQuery): Promise<QueryResult>;
93
74
  deleteUnreferencedAttachmentRecords(fileId: FileId, metadataTypeIds: TypeId[]): Promise<StackRecord[]>;
94
75
  getVersions(id: string, query?: VersionsQuery): Promise<RecordVersion[]>;