@workglow/storage 0.2.31 → 0.2.32

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.
Files changed (60) hide show
  1. package/dist/browser.js +977 -48
  2. package/dist/browser.js.map +23 -13
  3. package/dist/bun.js +1030 -53
  4. package/dist/bun.js.map +24 -14
  5. package/dist/common.d.ts +7 -0
  6. package/dist/common.d.ts.map +1 -1
  7. package/dist/migrations/IMigration.d.ts +57 -0
  8. package/dist/migrations/IMigration.d.ts.map +1 -0
  9. package/dist/migrations/MigrationRunner.d.ts +44 -0
  10. package/dist/migrations/MigrationRunner.d.ts.map +1 -0
  11. package/dist/migrations/TabularMigration.d.ts +85 -0
  12. package/dist/migrations/TabularMigration.d.ts.map +1 -0
  13. package/dist/migrations/TabularMigrationOrchestrator.d.ts +34 -0
  14. package/dist/migrations/TabularMigrationOrchestrator.d.ts.map +1 -0
  15. package/dist/migrations/index.d.ts +11 -0
  16. package/dist/migrations/index.d.ts.map +1 -0
  17. package/dist/migrations/runBackfill.d.ts +19 -0
  18. package/dist/migrations/runBackfill.d.ts.map +1 -0
  19. package/dist/node.js +1030 -53
  20. package/dist/node.js.map +24 -14
  21. package/dist/sql/Dialect.d.ts +26 -0
  22. package/dist/sql/Dialect.d.ts.map +1 -0
  23. package/dist/sql/PredicateBuilder.d.ts +30 -0
  24. package/dist/sql/PredicateBuilder.d.ts.map +1 -0
  25. package/dist/sql/PrefixDdl.d.ts +79 -0
  26. package/dist/sql/PrefixDdl.d.ts.map +1 -0
  27. package/dist/sql/index.d.ts +9 -0
  28. package/dist/sql/index.d.ts.map +1 -0
  29. package/dist/tabular/BaseSqlTabularStorage.d.ts +63 -2
  30. package/dist/tabular/BaseSqlTabularStorage.d.ts.map +1 -1
  31. package/dist/tabular/BaseTabularStorage.d.ts +111 -6
  32. package/dist/tabular/BaseTabularStorage.d.ts.map +1 -1
  33. package/dist/tabular/CachedTabularStorage.d.ts +38 -0
  34. package/dist/tabular/CachedTabularStorage.d.ts.map +1 -1
  35. package/dist/tabular/Cursor.d.ts +79 -0
  36. package/dist/tabular/Cursor.d.ts.map +1 -0
  37. package/dist/tabular/FsFolderTabularStorage.d.ts +5 -1
  38. package/dist/tabular/FsFolderTabularStorage.d.ts.map +1 -1
  39. package/dist/tabular/HuggingFaceTabularStorage.d.ts +26 -2
  40. package/dist/tabular/HuggingFaceTabularStorage.d.ts.map +1 -1
  41. package/dist/tabular/ITabularStorage.d.ts +203 -3
  42. package/dist/tabular/ITabularStorage.d.ts.map +1 -1
  43. package/dist/tabular/InMemoryTabularMigrationApplier.d.ts +39 -0
  44. package/dist/tabular/InMemoryTabularMigrationApplier.d.ts.map +1 -0
  45. package/dist/tabular/InMemoryTabularStorage.d.ts +6 -2
  46. package/dist/tabular/InMemoryTabularStorage.d.ts.map +1 -1
  47. package/dist/tabular/SharedInMemoryTabularStorage.d.ts +4 -1
  48. package/dist/tabular/SharedInMemoryTabularStorage.d.ts.map +1 -1
  49. package/dist/tabular/SqlTabularMigrationApplier.d.ts +53 -0
  50. package/dist/tabular/SqlTabularMigrationApplier.d.ts.map +1 -0
  51. package/dist/tabular/StorageError.d.ts.map +1 -1
  52. package/dist/tabular/TelemetryTabularStorage.d.ts +11 -1
  53. package/dist/tabular/TelemetryTabularStorage.d.ts.map +1 -1
  54. package/dist/tabular/sqlMigrationDdl.d.ts +11 -0
  55. package/dist/tabular/sqlMigrationDdl.d.ts.map +1 -0
  56. package/dist/vector/IVectorStorage.d.ts +61 -1
  57. package/dist/vector/IVectorStorage.d.ts.map +1 -1
  58. package/package.json +3 -3
  59. package/src/tabular/README.md +73 -0
  60. package/src/vector/README.md +79 -0
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Abstracts the dialect-specific differences between SQLite and PostgreSQL
8
+ * for the parts of the storage layer that build SQL by string concatenation.
9
+ *
10
+ * The two things that differ are:
11
+ * - Identifier quoting (backticks vs double quotes)
12
+ * - Parameter placeholders (`?` vs `$N`)
13
+ *
14
+ * Keeping these in one place lets the predicate builder, prefix DDL helpers
15
+ * and migrations runner emit the same SQL shape against either backend.
16
+ */
17
+ export interface ISqlDialect {
18
+ readonly name: "sqlite" | "postgres";
19
+ /** Quote a table or column identifier so it survives unsafe characters. */
20
+ quoteId(id: string): string;
21
+ /** Render a parameter placeholder for the given 1-based index. */
22
+ placeholder(index: number): string;
23
+ }
24
+ export declare const SqliteDialect: ISqlDialect;
25
+ export declare const PostgresDialect: ISqlDialect;
26
+ //# sourceMappingURL=Dialect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialect.d.ts","sourceRoot":"","sources":["../../src/sql/Dialect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IACrC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,kEAAkE;IAClE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,aAAa,EAAE,WAQ3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WAQ7B,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { type DeleteSearchCriteria, type ValueOptionType } from "../tabular/ITabularStorage";
7
+ import type { ISqlDialect } from "./Dialect";
8
+ /**
9
+ * Result of {@link buildSearchWhere} — a parameterized WHERE-clause body
10
+ * (without the leading `WHERE` keyword) and its ordered parameters.
11
+ */
12
+ export interface BuiltWhereClause {
13
+ readonly whereClause: string;
14
+ readonly params: ValueOptionType[];
15
+ }
16
+ /**
17
+ * Builds a parameterized AND-joined WHERE clause from a {@link DeleteSearchCriteria}.
18
+ * Used by every SQL tabular backend so the operator handling stays consistent.
19
+ *
20
+ * @param dialect Identifier-quoting + placeholder rules for the target DB.
21
+ * @param criteria Per-column equality value or {@link SearchOperator} condition.
22
+ * @param schemaProps Schema property bag — unknown columns throw, preventing
23
+ * callers from accidentally letting user input pick a column.
24
+ * @param convertValue Backend-specific JS-to-SQL coercion (e.g. boolean → 0/1).
25
+ * @param startIndex 1-based starting parameter index (defaults to 1).
26
+ * PostgreSQL callers use this when other params have already
27
+ * been bound; SQLite ignores it because placeholders are positional.
28
+ */
29
+ export declare function buildSearchWhere<Entity>(dialect: ISqlDialect, criteria: DeleteSearchCriteria<Entity>, schemaProps: Record<string, unknown>, convertValue: (column: string, value: Entity[keyof Entity]) => ValueOptionType, startIndex?: number): BuiltWhereClause;
30
+ //# sourceMappingURL=PredicateBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PredicateBuilder.d.ts","sourceRoot":"","sources":["../../src/sql/PredicateBuilder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,oBAAoB,EAGzB,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC;CACpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EACrC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACtC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,MAAM,CAAC,KAAK,eAAe,EAC9E,UAAU,GAAE,MAAU,GACrB,gBAAgB,CAgClB"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { ISqlDialect } from "./Dialect";
7
+ /**
8
+ * Minimal column descriptor used by the prefix-DDL helpers. This mirrors the
9
+ * `PrefixColumn` shape that backends like the job queue and rate limiter use,
10
+ * without forcing `@workglow/storage` to take a dependency on those packages.
11
+ *
12
+ * Backends that have their own `PrefixColumn`-like type pass instances of it
13
+ * directly — the structural match is enough.
14
+ */
15
+ export interface ISqlPrefixColumn {
16
+ readonly name: string;
17
+ readonly type: "uuid" | "number";
18
+ }
19
+ /**
20
+ * Throws if any prefix column name would be unsafe to splice into DDL.
21
+ *
22
+ * Beyond shape-checking via {@link SAFE_IDENTIFIER}, this also rejects names
23
+ * that match a common SQL reserved word ({@link SQL_RESERVED_WORDS}) since
24
+ * they're spliced unquoted and would otherwise produce confusing syntax
25
+ * errors at the database level. Every helper in this module that splices
26
+ * `prefix.name` into SQL calls this first, so storage backends don't need to
27
+ * remember to validate at construction time.
28
+ */
29
+ export declare function assertPrefixesSafe(prefixes: readonly ISqlPrefixColumn[]): void;
30
+ /**
31
+ * Throws if any declared prefix column lacks a value in `prefixValues`.
32
+ *
33
+ * Prefix columns are declared `NOT NULL` in the DDL helpers; binding
34
+ * `undefined` for them later yields opaque database errors ("invalid input
35
+ * syntax for type X" / "null value violates not-null constraint"). Catch the
36
+ * misconfiguration at the call site instead.
37
+ */
38
+ export declare function assertPrefixValuesPresent(prefixes: readonly ISqlPrefixColumn[], prefixValues: Readonly<Record<string, string | number>>): void;
39
+ /** Returns the SQL column type for a {@link ISqlPrefixColumn} on the given dialect. */
40
+ export declare function prefixColumnType(dialect: ISqlDialect, type: ISqlPrefixColumn["type"]): string;
41
+ /**
42
+ * Builds the prefix portion of a CREATE TABLE column list, e.g.
43
+ * `tenant_id UUID NOT NULL,\n project_id INTEGER NOT NULL,\n `
44
+ *
45
+ * Returns an empty string when there are no prefixes so callers can splice it
46
+ * directly into a column list without a trailing comma.
47
+ */
48
+ export declare function buildPrefixColumnsSql(dialect: ISqlDialect, prefixes: readonly ISqlPrefixColumn[]): string;
49
+ /** Returns prefix column names in declaration order. */
50
+ export declare function getPrefixColumnNames(prefixes: readonly ISqlPrefixColumn[]): string[];
51
+ /**
52
+ * Comma-joined prefix column list with a trailing `, ` for index/insert use,
53
+ * or an empty string when there are no prefixes.
54
+ */
55
+ export declare function getPrefixIndexPrefix(prefixes: readonly ISqlPrefixColumn[]): string;
56
+ /** Returns the index-name suffix derived from prefix columns. */
57
+ export declare function getPrefixIndexSuffix(prefixes: readonly ISqlPrefixColumn[]): string;
58
+ /**
59
+ * Builds an ` AND col1 = ? AND col2 = ?` (or `$N` for Postgres) suffix.
60
+ *
61
+ * @param startParam 1-based starting parameter index (Postgres only — SQLite
62
+ * placeholders are positional and ignore this).
63
+ */
64
+ export declare function buildPrefixWhereClause(dialect: ISqlDialect, prefixes: readonly ISqlPrefixColumn[], prefixValues: Readonly<Record<string, string | number>>, startParam?: number): {
65
+ conditions: string;
66
+ params: Array<string | number>;
67
+ };
68
+ /** Returns prefix values in column order for binding to placeholders. */
69
+ export declare function getPrefixParamValues(prefixes: readonly ISqlPrefixColumn[], prefixValues: Readonly<Record<string, string | number>>): Array<string | number>;
70
+ /**
71
+ * Builds the prefix-portion of an INSERT column list and its placeholder list,
72
+ * starting at parameter index `startParam`. Returns empty strings when there
73
+ * are no prefixes so callers can concatenate without a trailing comma.
74
+ */
75
+ export declare function buildPrefixInsertFragments(dialect: ISqlDialect, prefixes: readonly ISqlPrefixColumn[], startParam?: number): {
76
+ columns: string;
77
+ placeholders: string;
78
+ };
79
+ //# sourceMappingURL=PrefixDdl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrefixDdl.d.ts","sourceRoot":"","sources":["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E,MAAM,GAAG,MAAM,CAAC,CAAC,EACvD,UAAU,GAAE,MAAU,GACrB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;CAAE,CASxD;AAED,yEAAyE;AACzE,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,GACtD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAIxB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,UAAU,GAAE,MAAU,GACrB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAO3C"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export * from "./Dialect";
7
+ export * from "./PredicateBuilder";
8
+ export * from "./PrefixDdl";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sql/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { DataPortSchemaObject, FromSchema, JsonSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
7
7
  import { BaseTabularStorage, ClientProvidedKeysOption } from "./BaseTabularStorage";
8
- import { AutoGeneratedKeys, InsertEntity, SimplifyPrimaryKey, ValueOptionType } from "./ITabularStorage";
8
+ import { AutoGeneratedKeys, InsertEntity, OrderBy, Page, PageRequest, SearchCriteria, SimplifyPrimaryKey, ValueOptionType } from "./ITabularStorage";
9
9
  /**
10
10
  * Base class for SQL-based tabular repositories that implements common functionality
11
11
  * for both SQLite and PostgreSQL database implementations.
@@ -29,7 +29,7 @@ export declare abstract class BaseSqlTabularStorage<Schema extends DataPortSchem
29
29
  private readonly _valColsCache;
30
30
  private readonly _pkColListCache;
31
31
  private readonly _valColListCache;
32
- constructor(table: string | undefined, schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption);
32
+ constructor(table: string | undefined, schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption, tabularMigrations?: ReadonlyArray<import("../migrations").ITabularMigration>, migrationName?: string);
33
33
  /**
34
34
  * Maps JavaScript/TypeScript types to their corresponding SQL type
35
35
  * Must be implemented by derived classes for specific SQL dialects
@@ -96,5 +96,66 @@ export declare abstract class BaseSqlTabularStorage<Schema extends DataPortSchem
96
96
  * @throws Error if validation fails
97
97
  */
98
98
  protected validateTableAndSchema(): void;
99
+ /**
100
+ * Builds a keyset (seek) WHERE clause that selects rows strictly after
101
+ * the cursor position according to the provided ordering. Handles mixed
102
+ * ASC/DESC by expanding into the OR-of-AND form:
103
+ *
104
+ * (col1 OP1 v1)
105
+ * OR (col1 = v1 AND col2 OP2 v2)
106
+ * OR (col1 = v1 AND col2 = v2 AND col3 OP3 v3)
107
+ * ...
108
+ *
109
+ * NULL handling. We adopt the same NULL ordering as the in-memory
110
+ * comparator: NULLs sort *before* non-null values for ASC, *after* them
111
+ * for DESC. The pair `runSqlPage` / `buildKeysetWhere` enforce this with
112
+ * explicit `NULLS FIRST` / `NULLS LAST` in the ORDER BY plus NULL-aware
113
+ * predicates here. Because the cursor's values are known at SQL-build
114
+ * time, we branch at build time on NULL vs non-NULL rather than relying
115
+ * on dialect-specific operators like `IS NOT DISTINCT FROM`:
116
+ *
117
+ * - Equality on a preceding column:
118
+ * NULL -> `col IS NULL`
119
+ * value -> `col = ?`
120
+ * - Strict comparison on the i-th column:
121
+ * ASC, NULL -> `col IS NOT NULL` (NULL is the smallest)
122
+ * ASC, value -> `col > ?` (NULLs sort before, excluded)
123
+ * DESC, NULL -> `1 = 0` (nothing comes after a NULL trailer)
124
+ * DESC, value-> `(col < ? OR col IS NULL)` (smaller, then NULLs)
125
+ *
126
+ * @param effectiveOrderBy - Ordering to satisfy; must include the primary
127
+ * key columns at the tail so the comparison is total.
128
+ * @param cursorValues - Values pulled from the cursor in the same order
129
+ * as `effectiveOrderBy`.
130
+ * @param quote - Identifier quote character (e.g. `` ` `` or `"`).
131
+ * @param placeholder - Function returning the placeholder string for the
132
+ * given 1-based parameter index.
133
+ * @param startIndex - Param index to start numbering from. Returns the
134
+ * index to use after this clause's params.
135
+ */
136
+ protected buildKeysetWhere(effectiveOrderBy: ReadonlyArray<OrderBy<Entity>>, cursorValues: ReadonlyArray<ValueOptionType>, quote: string, placeholder: (index: number) => string, startIndex: number): {
137
+ whereClause: string;
138
+ params: ValueOptionType[];
139
+ nextIndex: number;
140
+ };
141
+ /**
142
+ * Shared SQL `getPage`/`queryPage` driver. Builds a single SELECT that
143
+ * pushes the keyset predicate, ordering, and limit down to the database
144
+ * so memory and wire traffic are O(pageSize) regardless of table size.
145
+ *
146
+ * Concrete SQL backends call this from their `getPage`/`queryPage`
147
+ * overrides, supplying the dialect-specific quoting, placeholder
148
+ * formatting, search-criteria WHERE builder, and select executor.
149
+ */
150
+ protected runSqlPage(criteria: SearchCriteria<Entity> | undefined, request: PageRequest<Entity>, dialect: {
151
+ readonly quote: string;
152
+ readonly placeholder: (index: number) => string;
153
+ readonly buildSearchWhere: (criteria: SearchCriteria<Entity>, startIndex: number) => {
154
+ whereClause: string;
155
+ params: ValueOptionType[];
156
+ nextIndex: number;
157
+ };
158
+ readonly executeSelect: (sql: string, params: ValueOptionType[]) => Promise<Entity[]>;
159
+ }): Promise<Page<Entity>>;
99
160
  }
100
161
  //# sourceMappingURL=BaseSqlTabularStorage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseSqlTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/BaseSqlTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAI3B;;;;;;GAMG;AACH,8BAAsB,qBAAqB,CACzC,MAAM,SAAS,oBAAoB,EACnC,eAAe,SAAS,aAAa,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,EAEjE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,EACpD,UAAU,GAAG,kBAAkB,CAAC,MAAM,EAAE,eAAe,CAAC,EACxD,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,MAAM,CAAC,EAC5D,UAAU,SAAS,YAAY,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAC/E,MAAM,EACN,iBAAiB,CAAC,MAAM,CAAC,CAC1B,CACD,SAAQ,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC;IAiBxF,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAhBlC;;;;;;;;OAQG;IACH,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAA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Ae,EAAE,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3E,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;KACvF,GACA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CA8EvB;CACF"}
@@ -5,7 +5,9 @@
5
5
  */
6
6
  import { EventEmitter } from "@workglow/util";
7
7
  import { DataPortSchemaObject, FromSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
8
- import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, ITabularStorage, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularEventListener, TabularEventListeners, TabularEventName, TabularEventParameters, TabularSubscribeOptions, ValueOptionType } from "./ITabularStorage";
8
+ import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, ITabularStorage, OrderBy, Page, PageRequest, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularEventListener, TabularEventListeners, TabularEventName, TabularEventParameters, TabularSubscribeOptions, ValueOptionType } from "./ITabularStorage";
9
+ import { CursorPayload, PageCursor } from "./Cursor";
10
+ import { ITabularMigration, ITabularMigrationApplier, RunTabularMigrationsOptions } from "../migrations";
9
11
  export declare const TABULAR_REPOSITORY: import("@workglow/util").ServiceToken<AnyTabularStorage>;
10
12
  /**
11
13
  * Options for controlling how client-provided values for auto-generated keys are handled
@@ -32,6 +34,18 @@ export declare abstract class BaseTabularStorage<Schema extends DataPortSchemaOb
32
34
  protected indexes: Array<keyof Entity>[];
33
35
  protected primaryKeySchema: DataPortSchemaObject;
34
36
  protected valueSchema: DataPortSchemaObject;
37
+ /**
38
+ * Optional declarative migrations evolving older deployments to the
39
+ * current target schema. When set + non-empty, `setupDatabase()` on
40
+ * concrete subclasses delegates to {@link applyTabularMigrations}.
41
+ */
42
+ protected readonly tabularMigrations: ReadonlyArray<ITabularMigration> | undefined;
43
+ /**
44
+ * Default component name used when an `ITabularMigration.component` is
45
+ * omitted. Defaults to `tabular:${storageName}` once the subclass has
46
+ * supplied a name.
47
+ */
48
+ protected migrationComponent: string;
35
49
  /** Name of the auto-generated key column (at most one primary key column may be auto-generated) */
36
50
  protected autoGeneratedKeyName: keyof Entity | null;
37
51
  /** Strategy for generating the auto-generated key */
@@ -46,7 +60,7 @@ export declare abstract class BaseTabularStorage<Schema extends DataPortSchemaOb
46
60
  * while each array creates a compound index with columns in the specified order.
47
61
  * @param clientProvidedKeys - How to handle client-provided values for auto-generated keys
48
62
  */
49
- constructor(schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption);
63
+ constructor(schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption, tabularMigrations?: ReadonlyArray<ITabularMigration>, migrationName?: string);
50
64
  protected filterCompoundKeys(primaryKey: Array<keyof Entity>, potentialKeys: Array<keyof Entity>[]): Array<keyof Entity>[];
51
65
  /**
52
66
  * Adds an event listener for a specific event
@@ -127,18 +141,72 @@ export declare abstract class BaseTabularStorage<Schema extends DataPortSchemaOb
127
141
  abstract getBulk(offset: number, limit: number): Promise<Entity[] | undefined>;
128
142
  /**
129
143
  * Async generator that yields records one at a time.
130
- * Uses getBulk internally to fetch pages of data.
144
+ *
145
+ * Backed by cursor-based pagination so iteration is stable when rows are
146
+ * inserted or deleted concurrently — unlike offset paging, which can skip
147
+ * or duplicate rows under those conditions.
148
+ *
131
149
  * @param pageSize - Number of records to fetch per page (default: 100)
132
- * @yields Individual entity records
133
150
  */
134
151
  records(pageSize?: number): AsyncGenerator<Entity, void, undefined>;
135
152
  /**
136
153
  * Async generator that yields pages of records.
137
- * Uses getBulk internally to fetch pages of data.
154
+ *
155
+ * Backed by cursor-based pagination — stable under concurrent writes.
156
+ * Each yielded array is a fresh copy of `Page.items`; mutating the
157
+ * yielded array won't affect the underlying storage or subsequent
158
+ * pages, at the cost of one allocation per page.
159
+ *
138
160
  * @param pageSize - Number of records per page (default: 100)
139
- * @yields Arrays of entities
140
161
  */
141
162
  pages(pageSize?: number): AsyncGenerator<Entity[], void, undefined>;
163
+ /**
164
+ * Default keyset-pagination implementation. Backends that can express
165
+ * tuple comparison natively (SQL row-value comparisons) should override
166
+ * this for efficiency, but the default works against any implementation
167
+ * of {@link query} / {@link getAll}.
168
+ */
169
+ getPage(request?: PageRequest<Entity>): Promise<Page<Entity>>;
170
+ /** Default cursor-paginated form of {@link query}. */
171
+ queryPage(criteria: SearchCriteria<Entity>, request?: PageRequest<Entity>): Promise<Page<Entity>>;
172
+ /**
173
+ * Shared keyset-pagination engine for both {@link getPage} and
174
+ * {@link queryPage}. Translates the cursor into AND criteria using the
175
+ * primary key column(s) and runs the existing {@link query}/{@link getAll}
176
+ * machinery, then re-encodes the position of the last returned row.
177
+ *
178
+ * For composite primary keys this performs the keyset comparison in
179
+ * memory after fetching a candidate window. SQL backends should override
180
+ * {@link getPage}/{@link queryPage} to push it down to the database.
181
+ */
182
+ protected runPage(criteria: SearchCriteria<Entity> | undefined, request: PageRequest<Entity>): Promise<Page<Entity>>;
183
+ /**
184
+ * Returns the order spec actually used to drive a keyset page: the
185
+ * caller's `orderBy` (if any) followed by every primary-key column as a
186
+ * stable tiebreaker. PK columns are appended in ASC direction unless the
187
+ * caller already specified a direction for them.
188
+ */
189
+ protected buildEffectiveOrderBy(orderBy: ReadonlyArray<OrderBy<Entity>> | undefined, pkColumns: ReadonlyArray<keyof Entity>): ReadonlyArray<OrderBy<Entity>>;
190
+ /**
191
+ * Sorts rows in place by the given order spec, using the same null-first
192
+ * comparison rules as the cursor filter so results are consistent.
193
+ */
194
+ protected sortInMemory(rows: Entity[], orderBy: ReadonlyArray<OrderBy<Entity>>): Entity[];
195
+ /**
196
+ * In-memory keyset filter: drops rows that come at or before the cursor
197
+ * row according to `orderBy + primaryKey`. Used by the default
198
+ * implementation when the backend can't express tuple comparison.
199
+ */
200
+ protected applyKeysetFilter(rows: Entity[], cursor: CursorPayload, effectiveOrderBy: ReadonlyArray<OrderBy<Entity>>, _pkColumns: ReadonlyArray<keyof Entity>): Entity[];
201
+ /**
202
+ * Encodes the position of `row` as an opaque cursor. The caller passes
203
+ * the effective ordering it just used — caller-supplied `orderBy`
204
+ * followed by any primary-key columns not already covered by `orderBy`
205
+ * — and this writes one value per effective column, in the same order.
206
+ * Computing that ordering is the caller's responsibility because they
207
+ * already have it in hand and we don't want to recompute it here.
208
+ */
209
+ protected buildCursor(row: Entity, effectiveOrderBy: ReadonlyArray<OrderBy<Entity>>): PageCursor;
142
210
  /**
143
211
  * Subscribes to changes in the repository (including remote changes).
144
212
  * Default implementation throws an error - override in subclasses that support subscriptions.
@@ -161,6 +229,25 @@ export declare abstract class BaseTabularStorage<Schema extends DataPortSchemaOb
161
229
  * Validates getAll options (orderBy, limit, offset) without criteria.
162
230
  */
163
231
  protected validateGetAllOptions(options?: QueryOptions<Entity>): void;
232
+ /**
233
+ * Validates the `orderBy` clause of a {@link PageRequest}: column names
234
+ * must exist in the schema and directions must be `"ASC"` or `"DESC"`.
235
+ *
236
+ * Page paths (`getPage`/`queryPage`) must call this before any backend
237
+ * builds SQL, because column names from `request.orderBy` end up
238
+ * interpolated directly into `ORDER BY` and the keyset `WHERE` clauses.
239
+ * Without this guard a caller passing arbitrary strings would either
240
+ * trigger a backend SQL error or, worse, allow SQL injection on backends
241
+ * that emit unquoted identifiers.
242
+ */
243
+ protected validateOrderBy(orderBy: ReadonlyArray<OrderBy<Entity>> | undefined): void;
244
+ /**
245
+ * Validates the components of a cursor-paginated request that are about
246
+ * to be used to build a query. Centralises the schema-level guarantees
247
+ * that `runPage`/`runSqlPage`/Supabase's `runSupabasePage` all rely on
248
+ * before they interpolate column names into SQL or PostgREST filters.
249
+ */
250
+ protected validatePageRequest(request: PageRequest<Entity>): void;
164
251
  /**
165
252
  * Validates the `select` array in a {@link CoveringIndexQueryOptions}.
166
253
  * Throws {@link StorageValidationError} when `select` is empty or contains
@@ -226,6 +313,24 @@ export declare abstract class BaseTabularStorage<Schema extends DataPortSchemaOb
226
313
  * @returns The generated key value
227
314
  */
228
315
  protected generateKeyValue(columnName: string, strategy: KeyGenerationStrategy): Promise<string | number> | string | number;
316
+ /**
317
+ * Runs `fn` inside a transaction. The default implementation provides no
318
+ * rollback semantics — it simply invokes `fn(this)`. Concrete subclasses
319
+ * with native transaction support (SQLite, PostgreSQL) override this.
320
+ */
321
+ withTransaction<T>(fn: (tx: this) => Promise<T>): Promise<T>;
322
+ /**
323
+ * Subclass override returning a backend-specific applier. Returning `null`
324
+ * disables tabular migrations for the storage. The base class returns
325
+ * `null`; only backends that have wired up their applier override this.
326
+ */
327
+ getMigrationApplier(): ITabularMigrationApplier | null;
328
+ /**
329
+ * Runs `this.tabularMigrations` through the orchestrator using the
330
+ * backend-supplied applier. Idempotent (no-op when no migrations are
331
+ * declared, or when all are already applied).
332
+ */
333
+ protected applyTabularMigrations(options?: RunTabularMigrationsOptions): Promise<void>;
229
334
  /**
230
335
  * Sets up the database/storage for the repository.
231
336
  * Must be called before using any other methods (except for in-memory implementations).
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/BaseTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsB,YAAY,EAAmB,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EAEZ,eAAe,E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edArraySchemaOptions } from "@workglow/util/schema";
7
7
  import { BaseTabularStorage, ClientProvidedKeysOption } from "./BaseTabularStorage";
8
+ import type { ITabularMigrationApplier } from "../migrations";
8
9
  import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, ITabularStorage, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularSubscribeOptions } from "./ITabularStorage";
9
10
  export declare const CACHED_TABULAR_REPOSITORY: import("@workglow/util").ServiceToken<AnyTabularStorage>;
10
11
  /**
@@ -105,6 +106,31 @@ export declare class CachedTabularStorage<Schema extends DataPortSchemaObject, P
105
106
  * @param criteria - Object with column names as keys and values or SearchConditions
106
107
  */
107
108
  deleteSearch(criteria: DeleteSearchCriteria<Entity>): Promise<void>;
109
+ /**
110
+ * Runs `fn` inside the durable store's transaction. The cache layer is
111
+ * intentionally bypassed for the transaction's duration — coordinating
112
+ * two-phase commit between the durable store and an in-memory cache is
113
+ * out of scope, and callers asking for `withTransaction` are asking for
114
+ * atomicity, which only the durable can provide. Inside `fn`, reads and
115
+ * writes go straight through the durable's transaction handle.
116
+ *
117
+ * **`tx` identity:** the handle passed to `fn` is the durable store's
118
+ * transaction proxy, not a `CachedTabularStorage`, despite the `(tx: this)`
119
+ * type. Wrapper-specific members like `tx.cache` or `tx.invalidateCache()`
120
+ * therefore type-check but throw at runtime — call them on the original
121
+ * wrapper after `withTransaction` resolves instead.
122
+ *
123
+ * **Cache freshness on commit/rollback:** any rows the transaction touched
124
+ * (committed inserts/updates/deletes, or rolled-back attempts that were
125
+ * already mirrored into the cache via earlier non-tx writes) leave the
126
+ * cache potentially out of step with durable. Invalidate unconditionally
127
+ * after `fn` resolves so the next read repopulates the cache from durable
128
+ * — over-invalidating on rollback is cheap and avoids leaking the
129
+ * rollback boundary into the cache layer. Inheriting `BaseTabularStorage`'s
130
+ * no-op default here would silently lose the rollback / atomicity guarantee,
131
+ * since the default just runs `fn(this)` against the cached wrapper itself.
132
+ */
133
+ withTransaction<T>(fn: (tx: this) => Promise<T>): Promise<T>;
108
134
  /**
109
135
  * Invalidates the cache by clearing it and resetting initialization flag
110
136
  */
@@ -123,6 +149,18 @@ export declare class CachedTabularStorage<Schema extends DataPortSchemaObject, P
123
149
  * @returns Unsubscribe function
124
150
  */
125
151
  subscribeToChanges(callback: (change: any) => void, options?: TabularSubscribeOptions): () => void;
152
+ /**
153
+ * Forwards `setupDatabase` to the durable storage (which owns any
154
+ * declared tabular migrations) and to the cache. Migrations themselves
155
+ * are passed when constructing the inner durable storage; the wrapper
156
+ * does not declare its own.
157
+ */
158
+ setupDatabase(): Promise<void>;
159
+ /**
160
+ * Delegates to the durable storage's applier so callers that use the
161
+ * wrapper observe migrations declared on the inner durable layer.
162
+ */
163
+ getMigrationApplier(): ITabularMigrationApplier | null;
126
164
  /**
127
165
  * Destroys the durable and cache repositories.
128
166
  */
@@ -1 +1 @@
1
- {"version":3,"file":"CachedTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/CachedTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,yBAAyB,0DAErC,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,oBAAoB,CAC/B,MAAM,SAAS,oBAAoB,EACnC,eAAe,SAAS,aAAa,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,EAEjE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,EACpD,UAAU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Aa,IAAI,OAAO,CAAC,IAAI,CAAC,CAG5C;IAED;;;OAGG;IACa,mBAAmB,IAAI,wBAAwB,GAAG,IAAI,CAKrE;IAED;;OAEG;IACM,OAAO,IAAI,IAAI,CAGvB;CACF"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Opaque cursor token returned by paginated queries.
8
+ *
9
+ * Encodes the position of the last seen row so the next page can resume
10
+ * from there using keyset (a.k.a. seek) pagination. Callers must treat
11
+ * cursors as opaque — the encoding is an implementation detail.
12
+ *
13
+ * Named `PageCursor` (not `Cursor`) to avoid colliding with the unrelated
14
+ * generic iterator type `Cursor<T>` exported from `@workglow/util`.
15
+ */
16
+ export type PageCursor = string & {
17
+ readonly __pageCursorBrand: unique symbol;
18
+ };
19
+ /**
20
+ * Internal cursor payload.
21
+ *
22
+ * - `v` is a format version (currently 1) so older cursors can be rejected
23
+ * if the encoding ever changes.
24
+ * - `n` (names), `d` (directions, `"a"` ASC / `"d"` DESC), and `c` (column
25
+ * values) are parallel arrays describing the effective ordering of the
26
+ * row the cursor is parked on: caller-supplied `orderBy` columns first,
27
+ * then any primary-key columns not already covered by `orderBy` as a
28
+ * tiebreaker. The flat layout means columns that appear in both the
29
+ * user's `orderBy` and the primary key are stored exactly once (avoids
30
+ * double-encoding the value in DESC-by-PK pagination). Storing column
31
+ * names AND directions lets us reject cursors handed back with a
32
+ * different ordering — same-name + flipped direction would otherwise
33
+ * compute the next page with the wrong comparison operators.
34
+ */
35
+ export interface CursorPayload {
36
+ readonly v: 1;
37
+ readonly n: ReadonlyArray<string>;
38
+ readonly d: ReadonlyArray<"a" | "d">;
39
+ readonly c: ReadonlyArray<string | number | boolean | null>;
40
+ }
41
+ /** Cursor format version recognised by this build. */
42
+ export declare const CURSOR_VERSION: 1;
43
+ /**
44
+ * Maximum accepted cursor length, in characters of the encoded form.
45
+ * Real cursors are well under 1 KB (a few primary-key values plus an
46
+ * orderBy worth of column names); the cap exists so a hostile client
47
+ * can't force the server to base64-decode and JSON-parse arbitrarily
48
+ * large strings, which would be cheap memory/CPU abuse.
49
+ */
50
+ export declare const MAX_CURSOR_LENGTH: number;
51
+ /**
52
+ * Encodes a cursor payload as an opaque, URL-safe string.
53
+ *
54
+ * The transport is base64url(JSON(payload)). The format is intentionally
55
+ * not documented for callers — it's an implementation detail and may be
56
+ * tightened in future versions (signed, length-limited, etc.).
57
+ */
58
+ export declare function encodeCursor(payload: CursorPayload): PageCursor;
59
+ /**
60
+ * Decodes an opaque cursor string into its payload.
61
+ *
62
+ * @throws {StorageValidationError} when the cursor is malformed, exceeds
63
+ * {@link MAX_CURSOR_LENGTH}, or the format version is unknown. Callers
64
+ * should surface these as 4xx errors rather than retrying.
65
+ */
66
+ export declare function decodeCursor(cursor: PageCursor | string): CursorPayload;
67
+ /**
68
+ * Validates that a decoded cursor matches the effective ordering the
69
+ * current request would use, by exact column-name AND direction sequence.
70
+ * A mismatch usually means the caller switched ordering mid-iteration —
71
+ * e.g. asked for `orderBy: [a ASC]` on page 1 and `orderBy: [a DESC]` on
72
+ * page 2, or swapped to a different column entirely — both of which would
73
+ * produce nonsensical results that arity matching alone can't catch.
74
+ */
75
+ export declare function assertCursorMatches(payload: CursorPayload, effectiveOrder: ReadonlyArray<{
76
+ readonly column: string;
77
+ readonly direction: "ASC" | "DESC";
78
+ }>): void;
79
+ //# sourceMappingURL=Cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursor.d.ts","sourceRoot":"","sources":["../../src/tabular/Cursor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;CAC7D;AAED,sDAAsD;AACtD,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAE1C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAwC/D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,aAAa,CA0DvE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,cAAc,EAAE,aAAa,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CAAC,GAC7F,IAAI,CAqBN"}