@workglow/storage 0.2.27 → 0.2.29

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 (92) hide show
  1. package/dist/browser.d.ts +0 -10
  2. package/dist/browser.d.ts.map +1 -1
  3. package/dist/browser.js +406 -4207
  4. package/dist/browser.js.map +8 -24
  5. package/dist/bun.js +341 -7235
  6. package/dist/bun.js.map +8 -35
  7. package/dist/common-server.d.ts +0 -21
  8. package/dist/common-server.d.ts.map +1 -1
  9. package/dist/common.d.ts +1 -6
  10. package/dist/common.d.ts.map +1 -1
  11. package/dist/node.js +341 -7236
  12. package/dist/node.js.map +8 -35
  13. package/package.json +5 -71
  14. package/dist/kv/IndexedDbKvStorage.d.ts +0 -27
  15. package/dist/kv/IndexedDbKvStorage.d.ts.map +0 -1
  16. package/dist/kv/PostgresKvStorage.d.ts +0 -28
  17. package/dist/kv/PostgresKvStorage.d.ts.map +0 -1
  18. package/dist/kv/SqliteKvStorage.d.ts +0 -28
  19. package/dist/kv/SqliteKvStorage.d.ts.map +0 -1
  20. package/dist/kv/SupabaseKvStorage.d.ts +0 -33
  21. package/dist/kv/SupabaseKvStorage.d.ts.map +0 -1
  22. package/dist/postgres/browser.d.ts +0 -32
  23. package/dist/postgres/browser.d.ts.map +0 -1
  24. package/dist/postgres/browser.js +0 -150
  25. package/dist/postgres/browser.js.map +0 -11
  26. package/dist/postgres/node-bun.d.ts +0 -26
  27. package/dist/postgres/node-bun.d.ts.map +0 -1
  28. package/dist/postgres/node-bun.js +0 -41
  29. package/dist/postgres/node-bun.js.map +0 -10
  30. package/dist/postgres/pglite-pool.d.ts +0 -21
  31. package/dist/postgres/pglite-pool.d.ts.map +0 -1
  32. package/dist/queue/IQueueStorage.d.ts +0 -229
  33. package/dist/queue/IQueueStorage.d.ts.map +0 -1
  34. package/dist/queue/InMemoryQueueStorage.d.ts +0 -149
  35. package/dist/queue/InMemoryQueueStorage.d.ts.map +0 -1
  36. package/dist/queue/IndexedDbQueueStorage.d.ts +0 -166
  37. package/dist/queue/IndexedDbQueueStorage.d.ts.map +0 -1
  38. package/dist/queue/PostgresQueueStorage.d.ts +0 -154
  39. package/dist/queue/PostgresQueueStorage.d.ts.map +0 -1
  40. package/dist/queue/SqliteQueueStorage.d.ts +0 -149
  41. package/dist/queue/SqliteQueueStorage.d.ts.map +0 -1
  42. package/dist/queue/SupabaseQueueStorage.d.ts +0 -195
  43. package/dist/queue/SupabaseQueueStorage.d.ts.map +0 -1
  44. package/dist/queue/TelemetryQueueStorage.d.ts +0 -33
  45. package/dist/queue/TelemetryQueueStorage.d.ts.map +0 -1
  46. package/dist/queue-limiter/IRateLimiterStorage.d.ts +0 -127
  47. package/dist/queue-limiter/IRateLimiterStorage.d.ts.map +0 -1
  48. package/dist/queue-limiter/InMemoryRateLimiterStorage.d.ts +0 -43
  49. package/dist/queue-limiter/InMemoryRateLimiterStorage.d.ts.map +0 -1
  50. package/dist/queue-limiter/IndexedDbRateLimiterStorage.d.ts +0 -79
  51. package/dist/queue-limiter/IndexedDbRateLimiterStorage.d.ts.map +0 -1
  52. package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts +0 -57
  53. package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts.map +0 -1
  54. package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts +0 -62
  55. package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts.map +0 -1
  56. package/dist/queue-limiter/SupabaseRateLimiterStorage.d.ts +0 -54
  57. package/dist/queue-limiter/SupabaseRateLimiterStorage.d.ts.map +0 -1
  58. package/dist/sqlite/browser.d.ts +0 -37
  59. package/dist/sqlite/browser.d.ts.map +0 -1
  60. package/dist/sqlite/browser.js +0 -125
  61. package/dist/sqlite/browser.js.map +0 -10
  62. package/dist/sqlite/bun.d.ts +0 -32
  63. package/dist/sqlite/bun.d.ts.map +0 -1
  64. package/dist/sqlite/bun.js +0 -84
  65. package/dist/sqlite/bun.js.map +0 -10
  66. package/dist/sqlite/canonical-api.d.ts +0 -34
  67. package/dist/sqlite/canonical-api.d.ts.map +0 -1
  68. package/dist/sqlite/node.d.ts +0 -34
  69. package/dist/sqlite/node.d.ts.map +0 -1
  70. package/dist/sqlite/node.js +0 -65
  71. package/dist/sqlite/node.js.map +0 -10
  72. package/dist/tabular/IndexedDbTabularStorage.d.ts +0 -199
  73. package/dist/tabular/IndexedDbTabularStorage.d.ts.map +0 -1
  74. package/dist/tabular/PostgresTabularStorage.d.ts +0 -196
  75. package/dist/tabular/PostgresTabularStorage.d.ts.map +0 -1
  76. package/dist/tabular/SqliteTabularStorage.d.ts +0 -167
  77. package/dist/tabular/SqliteTabularStorage.d.ts.map +0 -1
  78. package/dist/tabular/SupabaseTabularStorage.d.ts +0 -174
  79. package/dist/tabular/SupabaseTabularStorage.d.ts.map +0 -1
  80. package/dist/util/IndexedDbTable.d.ts +0 -40
  81. package/dist/util/IndexedDbTable.d.ts.map +0 -1
  82. package/dist/util/traced.d.ts +0 -10
  83. package/dist/util/traced.d.ts.map +0 -1
  84. package/dist/vector/IndexedDbVectorStorage.d.ts +0 -53
  85. package/dist/vector/IndexedDbVectorStorage.d.ts.map +0 -1
  86. package/dist/vector/PostgresVectorStorage.d.ts +0 -39
  87. package/dist/vector/PostgresVectorStorage.d.ts.map +0 -1
  88. package/dist/vector/SqliteAiVectorStorage.d.ts +0 -100
  89. package/dist/vector/SqliteAiVectorStorage.d.ts.map +0 -1
  90. package/dist/vector/SqliteVectorStorage.d.ts +0 -49
  91. package/dist/vector/SqliteVectorStorage.d.ts.map +0 -1
  92. package/src/queue/README.md +0 -41
@@ -1,196 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { Pool } from "@workglow/storage/postgres";
7
- import { DataPortSchemaObject, FromSchema, JsonSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
8
- import { BaseSqlTabularStorage } from "./BaseSqlTabularStorage";
9
- import { ClientProvidedKeysOption } from "./BaseTabularStorage";
10
- import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions, ValueOptionType } from "./ITabularStorage";
11
- export declare const POSTGRES_TABULAR_REPOSITORY: import("@workglow/util").ServiceToken<AnyTabularStorage>;
12
- /**
13
- * A PostgreSQL-based tabular repository implementation that extends BaseSqlTabularStorage.
14
- * This class provides persistent storage for data in a PostgreSQL database,
15
- * making it suitable for multi-user scenarios.
16
- *
17
- * @template Schema - The schema definition for the entity
18
- * @template PrimaryKeyNames - Array of property names that form the primary key
19
- */
20
- export declare class PostgresTabularStorage<Schema extends DataPortSchemaObject, PrimaryKeyNames extends ReadonlyArray<keyof Schema["properties"]>, Entity = FromSchema<Schema, TypedArraySchemaOptions>, PrimaryKey = SimplifyPrimaryKey<Entity, PrimaryKeyNames>, Value = Omit<Entity, PrimaryKeyNames[number] & keyof Entity>, InsertType extends InsertEntity<Entity, AutoGeneratedKeys<Schema>> = InsertEntity<Entity, AutoGeneratedKeys<Schema>>> extends BaseSqlTabularStorage<Schema, PrimaryKeyNames, Entity, PrimaryKey, Value, InsertType> {
21
- protected db: Pool;
22
- /**
23
- * Creates a new PostgresTabularStorage instance.
24
- *
25
- * @param db - PostgreSQL db
26
- * @param table - Name of the table to store data (defaults to "tabular_store")
27
- * @param schema - Schema defining the structure of the entity
28
- * @param primaryKeyNames - Array of property names that form the primary key
29
- * @param indexes - Array of columns or column arrays to make searchable. Each string or single column creates a single-column index,
30
- * while each array creates a compound index with columns in the specified order.
31
- * @param clientProvidedKeys - How to handle client-provided values for auto-generated keys
32
- */
33
- constructor(db: Pool, table: string | undefined, schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption);
34
- /**
35
- * Initializes the database table with the required schema.
36
- * Creates the table if it doesn't exist with primary key and value columns.
37
- * Must be called before using any other methods.
38
- */
39
- setupDatabase(): Promise<void>;
40
- protected isVectorFormat(format?: string): boolean;
41
- protected getVectorDimensions(typeDef: JsonSchema): number | undefined;
42
- /**
43
- * Maps TypeScript/JavaScript types to corresponding PostgreSQL data types.
44
- * Uses additional schema information like minimum/maximum values, nullable status,
45
- * and string lengths to create more optimized column types.
46
- *
47
- * @param typeDef - The TypeScript/JavaScript type to map
48
- * @returns The corresponding PostgreSQL data type
49
- */
50
- protected mapTypeToSQL(typeDef: JsonSchema): string;
51
- /**
52
- * Generates the SQL column definitions for primary key fields with constraints
53
- * Handles auto-generated keys using SERIAL for integers and UUID DEFAULT for strings
54
- * @returns SQL string containing primary key column definitions
55
- */
56
- protected constructPrimaryKeyColumns($delimiter?: string): string;
57
- /**
58
- * Generates the SQL column definitions for value fields with constraints
59
- * @returns SQL string containing value column definitions
60
- */
61
- protected constructValueColumns($delimiter?: string): string;
62
- /**
63
- * Convert JavaScript values to PostgreSQL values, including TypedArray to vector string
64
- */
65
- protected jsToSqlValue(column: string, value: Entity[keyof Entity]): ValueOptionType;
66
- /**
67
- * Convert PostgreSQL values to JS values. Ensures numeric strings become numbers where schema says number.
68
- */
69
- protected sqlToJsValue(column: string, value: ValueOptionType): Entity[keyof Entity];
70
- /**
71
- * Determines if a field should be treated as unsigned based on schema properties
72
- * @param typeDef - The schema type definition
73
- * @returns true if the field should be treated as unsigned
74
- */
75
- protected shouldBeUnsigned(typeDef: JsonSchema): boolean;
76
- /**
77
- * Gets information about vector columns in the schema
78
- * @returns Array of objects with column name and dimension
79
- */
80
- protected getVectorColumns(): Array<{
81
- column: string;
82
- dimension: number;
83
- }>;
84
- /**
85
- * Creates vector-specific indexes (HNSW for pgvector)
86
- * Called after table creation if vector columns exist
87
- */
88
- protected createVectorIndexes(): Promise<void>;
89
- /**
90
- * Stores or updates a row in the database.
91
- * Uses UPSERT (INSERT ... ON CONFLICT DO UPDATE) for atomic operations.
92
- *
93
- * @param entity - The entity to store (may be missing auto-generated keys)
94
- * @returns The entity with any server-generated fields updated
95
- * @emits "put" event with the updated entity when successful
96
- */
97
- put(entity: InsertType): Promise<Entity>;
98
- /**
99
- * Stores multiple rows in the database in a bulk operation.
100
- * Uses individual put calls to ensure auto-generated keys are handled correctly.
101
- *
102
- * @param entities - Array of entities to store (may be missing auto-generated keys)
103
- * @returns Array of entities with any server-generated fields updated
104
- * @emits "put" event for each entity stored
105
- */
106
- putBulk(entities: InsertType[]): Promise<Entity[]>;
107
- /**
108
- * Retrieves a value from the database by its primary key.
109
- *
110
- * @param key - The primary key object to look up
111
- * @returns The stored value or undefined if not found
112
- * @emits "get" event with the key when successful
113
- */
114
- get(key: PrimaryKey): Promise<Entity | undefined>;
115
- /**
116
- * Deletes a row from the database.
117
- *
118
- * @param key - The primary key object to delete
119
- * @emits "delete" event with the key when successful
120
- */
121
- delete(value: PrimaryKey | Entity): Promise<void>;
122
- /**
123
- * Retrieves all entries from the database table, with optional ordering, offset, and limit.
124
- * @param options - Optional ordering, limit, and offset options
125
- * @returns Promise resolving to an array of entries or undefined if not found
126
- */
127
- getAll(options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
128
- /**
129
- * Deletes all rows from the database table.
130
- * @emits "clearall" event when successful
131
- */
132
- deleteAll(): Promise<void>;
133
- /**
134
- * Returns the total number of rows in the database.
135
- *
136
- * @returns Promise resolving to the count of stored items
137
- */
138
- size(): Promise<number>;
139
- /**
140
- * Counts rows matching the specified search criteria.
141
- */
142
- count(criteria?: SearchCriteria<Entity>): Promise<number>;
143
- /**
144
- * Fetches a page of records from the repository.
145
- * @param offset - Number of records to skip
146
- * @param limit - Maximum number of records to return
147
- * @returns Array of entities or undefined if no records found
148
- */
149
- getBulk(offset: number, limit: number): Promise<Entity[] | undefined>;
150
- /**
151
- * Builds WHERE clause conditions from delete search criteria.
152
- * @param criteria - The search criteria object
153
- * @returns Object with whereClause string and params array
154
- */
155
- protected buildDeleteSearchWhere(criteria: DeleteSearchCriteria<Entity>): {
156
- whereClause: string;
157
- params: ValueOptionType[];
158
- };
159
- /**
160
- * Deletes all entries matching the specified search criteria.
161
- * Supports multiple columns with optional comparison operators.
162
- *
163
- * @param criteria - Object with column names as keys and values or SearchConditions
164
- */
165
- deleteSearch(criteria: DeleteSearchCriteria<Entity>): Promise<void>;
166
- /**
167
- * Queries entries matching the specified search criteria with optional ordering, limit, and offset.
168
- *
169
- * @param criteria - Object with column names as keys and values or SearchConditions
170
- * @param options - Optional ordering, limit, and offset options
171
- * @returns Array of matching entities or undefined if no matches found
172
- */
173
- query(criteria: SearchCriteria<Entity>, options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
174
- /**
175
- * Queries entries matching the specified search criteria, returning only the selected columns.
176
- * Requires a covering index that satisfies the criteria, orderBy, and select columns.
177
- *
178
- * @param criteria - Object with column names as keys and values or SearchConditions
179
- * @param options - Required select columns plus optional orderBy, limit, and offset
180
- * @returns Array of partial entities containing only the selected columns
181
- * @throws {CoveringIndexMissingError} when no registered index covers the query
182
- */
183
- queryIndex<K extends keyof Entity & string>(criteria: SearchCriteria<Entity>, options: CoveringIndexQueryOptions<Entity, K>): Promise<Pick<Entity, K>[]>;
184
- /**
185
- * Subscribes to changes in the repository.
186
- * NOT IMPLEMENTED for PostgreSQL storage.
187
- *
188
- * @throws Error always - subscribeToChanges is not supported for PostgreSQL storage
189
- */
190
- subscribeToChanges(callback: (change: TabularChangePayload<Entity>) => void, options?: TabularSubscribeOptions): () => void;
191
- /**
192
- * Destroys the repository and frees up resources.
193
- */
194
- destroy(): void;
195
- }
196
- //# sourceMappingURL=PostgresTabularStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgresTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/PostgresTabularStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B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;IAED;;;;;;;;OAQG;IACY,UAAU,CAAC,CAAC,SAAS,MAAM,MAAM,GAAG,MAAM,EACvD,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,yBAAyB,CAAC,MAAM,EAAE,CAAC,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAiD5B;IAED;;;;;OAKG;IACa,kBAAkB,CAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,IAAI,EACxD,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,IAAI,CAEZ;IAED;;OAEG;IACa,OAAO,IAAI,IAAI,CAE9B;CACF"}
@@ -1,167 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { Sqlite } from "@workglow/storage/sqlite";
7
- import { DataPortSchemaObject, FromSchema, JsonSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
8
- import { BaseSqlTabularStorage } from "./BaseSqlTabularStorage";
9
- import { ClientProvidedKeysOption, KeyGenerationStrategy } from "./BaseTabularStorage";
10
- import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions, ValueOptionType } from "./ITabularStorage";
11
- export declare const SQLITE_TABULAR_REPOSITORY: import("@workglow/util").ServiceToken<AnyTabularStorage>;
12
- /**
13
- * A SQLite-based key-value repository implementation.
14
- * @template Schema - The schema definition for the entity
15
- * @template PrimaryKeyNames - Array of property names that form the primary key
16
- */
17
- export declare class SqliteTabularStorage<Schema extends DataPortSchemaObject, PrimaryKeyNames extends ReadonlyArray<keyof Schema["properties"]>, Entity = FromSchema<Schema, TypedArraySchemaOptions>, PrimaryKey = SimplifyPrimaryKey<Entity, PrimaryKeyNames>, Value = Omit<Entity, PrimaryKeyNames[number] & keyof Entity>, InsertType extends InsertEntity<Entity, AutoGeneratedKeys<Schema>> = InsertEntity<Entity, AutoGeneratedKeys<Schema>>> extends BaseSqlTabularStorage<Schema, PrimaryKeyNames, Entity, PrimaryKey, Value, InsertType> {
18
- /** The SQLite database instance */
19
- private db;
20
- /** Protected accessor for subclasses that need direct database access */
21
- protected get database(): Sqlite.Database;
22
- /**
23
- * Creates a new SQLite key-value repository
24
- * @param dbOrPath - Either a Database instance or a path to the SQLite database file
25
- * @param table - The name of the table to use for storage (defaults to 'tabular_store')
26
- * @param schema - Schema defining the structure of the entity
27
- * @param primaryKeyNames - Array of property names that form the primary key
28
- * @param indexes - Array of columns or column arrays to make searchable. Each string or single column creates a single-column index,
29
- * while each array creates a compound index with columns in the specified order.
30
- * @param clientProvidedKeys - How to handle client-provided values for auto-generated keys
31
- */
32
- constructor(dbOrPath: string | Sqlite.Database, table: string | undefined, schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption);
33
- /**
34
- * Override to handle SQLite's INTEGER PRIMARY KEY for auto-increment
35
- */
36
- protected constructPrimaryKeyColumns($delimiter?: string): string;
37
- /**
38
- * Creates the database table if it doesn't exist with the defined schema.
39
- * Must be called before using any other methods.
40
- */
41
- setupDatabase(): Promise<void>;
42
- /**
43
- * Convert JS values to SQLite-compatible values. Ensures booleans are stored as 0/1.
44
- */
45
- protected jsToSqlValue(column: string, value: Entity[keyof Entity]): ValueOptionType;
46
- /**
47
- * Convert SQLite values to JS values. Ensures 0/1 become booleans where schema says boolean.
48
- */
49
- protected sqlToJsValue(column: string, value: ValueOptionType): Entity[keyof Entity];
50
- /**
51
- * Maps TypeScript/JavaScript types to their SQLite column type equivalents
52
- * Uses additional schema information like minimum/maximum values, nullable status,
53
- * and string lengths to create more optimized column types.
54
- *
55
- * @param typeDef - The TypeScript/JavaScript type definition
56
- * @returns The corresponding SQLite column type
57
- */
58
- protected mapTypeToSQL(typeDef: JsonSchema): string;
59
- /**
60
- * Generates a key value for string UUID keys
61
- * Integer keys are auto-generated by SQLite's INTEGER PRIMARY KEY
62
- * @param columnName - Name of the column to generate a key for
63
- * @param strategy - The generation strategy to use
64
- * @returns The generated key value
65
- */
66
- protected generateKeyValue(columnName: string, strategy: KeyGenerationStrategy): string | number;
67
- /**
68
- * Stores a key-value pair in the database
69
- * @param entity - The entity to store (may be missing auto-generated keys)
70
- * @returns The entity with any server-generated fields updated
71
- * @emits 'put' event when successful
72
- */
73
- put(entity: InsertType): Promise<Entity>;
74
- /**
75
- * Stores multiple key-value pairs in the database in a bulk operation
76
- * @param entities - Array of entities to store (may be missing auto-generated keys)
77
- * @returns Array of entities with any server-generated fields updated
78
- * @emits 'put' event for each entity stored
79
- */
80
- putBulk(entities: InsertType[]): Promise<Entity[]>;
81
- /**
82
- * Retrieves a value from the database by its key
83
- * @param key - The primary key object to look up
84
- * @returns The stored value or undefined if not found
85
- * @emits 'get' event when successful
86
- */
87
- get(key: PrimaryKey): Promise<Entity | undefined>;
88
- /**
89
- * Deletes a key-value pair from the database
90
- * @param key - The primary key object to delete
91
- * @emits 'delete' event when successful
92
- */
93
- delete(key: PrimaryKey): Promise<void>;
94
- /**
95
- * Retrieves all entries from the database table, with optional ordering, offset, and limit.
96
- * @param options - Optional ordering, limit, and offset options
97
- * @returns Promise resolving to an array of entries or undefined if not found
98
- */
99
- getAll(options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
100
- /**
101
- * Deletes all entries from the database table
102
- * @emits 'clearall' event when successful
103
- */
104
- deleteAll(): Promise<void>;
105
- /**
106
- * Gets the total number of entries in the database table
107
- * @returns The count of entries
108
- */
109
- size(): Promise<number>;
110
- /**
111
- * Counts rows matching the specified search criteria.
112
- */
113
- count(criteria?: SearchCriteria<Entity>): Promise<number>;
114
- /**
115
- * Fetches a page of records from the repository.
116
- * @param offset - Number of records to skip
117
- * @param limit - Maximum number of records to return
118
- * @returns Array of entities or undefined if no records found
119
- */
120
- getBulk(offset: number, limit: number): Promise<Entity[] | undefined>;
121
- /**
122
- * Builds WHERE clause conditions from delete search criteria.
123
- * @param criteria - The search criteria object
124
- * @returns Object with whereClause string and params array
125
- */
126
- protected buildDeleteSearchWhere(criteria: DeleteSearchCriteria<Entity>): {
127
- whereClause: string;
128
- params: ValueOptionType[];
129
- };
130
- /**
131
- * Deletes all entries matching the specified search criteria.
132
- * Supports multiple columns with optional comparison operators.
133
- *
134
- * @param criteria - Object with column names as keys and values or SearchConditions
135
- */
136
- deleteSearch(criteria: DeleteSearchCriteria<Entity>): Promise<void>;
137
- /**
138
- * Queries entries matching the specified search criteria with optional ordering, limit, and offset.
139
- *
140
- * @param criteria - Object with column names as keys and values or SearchConditions
141
- * @param options - Optional ordering, limit, and offset options
142
- * @returns Array of matching entities or undefined if no matches found
143
- */
144
- query(criteria: SearchCriteria<Entity>, options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
145
- /**
146
- * Queries entries matching the specified search criteria, returning only the selected columns.
147
- * Requires a covering index that satisfies the criteria, orderBy, and select columns.
148
- *
149
- * @param criteria - Object with column names as keys and values or SearchConditions
150
- * @param options - Required select columns plus optional orderBy, limit, and offset
151
- * @returns Array of partial entities containing only the selected columns
152
- * @throws {CoveringIndexMissingError} when no registered index covers the query
153
- */
154
- queryIndex<K extends keyof Entity & string>(criteria: SearchCriteria<Entity>, options: CoveringIndexQueryOptions<Entity, K>): Promise<Pick<Entity, K>[]>;
155
- /**
156
- * Subscribes to changes in the repository.
157
- * NOT IMPLEMENTED for SQLite storage.
158
- *
159
- * @throws Error always - subscribeToChanges is not supported for SQLite storage
160
- */
161
- subscribeToChanges(callback: (change: TabularChangePayload<Entity>) => void, options?: TabularSubscribeOptions): () => void;
162
- /**
163
- * Destroys the repository and frees up resources.
164
- */
165
- destroy(): void;
166
- }
167
- //# sourceMappingURL=SqliteTabularStorage.d.ts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AC,MAAM,EAAE,CAAC,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAkD5B;IAED;;;;;OAKG;IACa,kBAAkB,CAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,IAAI,EACxD,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,IAAI,CAEZ;IAED;;OAEG;IACa,OAAO,IAAI,IAAI,CAE9B;CACF"}
@@ -1,174 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { SupabaseClient } from "@supabase/supabase-js";
7
- import { DataPortSchemaObject, FromSchema, JsonSchema, TypedArraySchemaOptions } from "@workglow/util/schema";
8
- import { BaseSqlTabularStorage } from "./BaseSqlTabularStorage";
9
- import { ClientProvidedKeysOption } from "./BaseTabularStorage";
10
- import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions, ValueOptionType } from "./ITabularStorage";
11
- export declare const SUPABASE_TABULAR_REPOSITORY: import("@workglow/util").ServiceToken<AnyTabularStorage>;
12
- /**
13
- * A Supabase-based tabular repository implementation that extends BaseSqlTabularStorage.
14
- * This class provides persistent storage for data in a Supabase database,
15
- * making it suitable for multi-user scenarios.
16
- *
17
- * @template Schema - The schema definition for the entity
18
- * @template PrimaryKeyNames - Array of property names that form the primary key
19
- */
20
- export declare class SupabaseTabularStorage<Schema extends DataPortSchemaObject, PrimaryKeyNames extends ReadonlyArray<keyof Schema["properties"]>, Entity = FromSchema<Schema, TypedArraySchemaOptions>, PrimaryKey = SimplifyPrimaryKey<Entity, PrimaryKeyNames>, Value = Omit<Entity, PrimaryKeyNames[number] & keyof Entity>, InsertType extends InsertEntity<Entity, AutoGeneratedKeys<Schema>> = InsertEntity<Entity, AutoGeneratedKeys<Schema>>> extends BaseSqlTabularStorage<Schema, PrimaryKeyNames, Entity, PrimaryKey, Value, InsertType> {
21
- protected readonly client: SupabaseClient;
22
- private realtimeChannel;
23
- /**
24
- * Creates a new SupabaseTabularStorage instance.
25
- *
26
- * @param client - Supabase client instance
27
- * @param table - Name of the table to store data (defaults to "tabular_store")
28
- * @param schema - Schema defining the structure of the entity
29
- * @param primaryKeyNames - Array of property names that form the primary key
30
- * @param indexes - Array of columns or column arrays to make searchable. Each string or single column creates a single-column index,
31
- * while each array creates a compound index with columns in the specified order.
32
- * @param clientProvidedKeys - How to handle client-provided values for auto-generated keys
33
- */
34
- constructor(client: unknown, table: string | undefined, schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer<Entity> | readonly (keyof NoInfer<Entity>)[])[], clientProvidedKeys?: ClientProvidedKeysOption);
35
- /**
36
- * Initializes the database table with the required schema.
37
- * Creates the table if it doesn't exist with primary key and value columns.
38
- * Must be called before using any other methods.
39
- */
40
- setupDatabase(): Promise<void>;
41
- /**
42
- * Maps TypeScript/JavaScript types to corresponding PostgreSQL data types.
43
- * Uses additional schema information like minimum/maximum values, nullable status,
44
- * and string lengths to create more optimized column types.
45
- *
46
- * @param typeDef - The TypeScript/JavaScript type to map
47
- * @returns The corresponding PostgreSQL data type
48
- */
49
- protected mapTypeToSQL(typeDef: JsonSchema): string;
50
- /**
51
- * Generates the SQL column definitions for primary key fields with constraints
52
- * Handles auto-generated keys using SERIAL for integers and UUID DEFAULT for strings
53
- * @returns SQL string containing primary key column definitions
54
- */
55
- protected constructPrimaryKeyColumns($delimiter?: string): string;
56
- /**
57
- * Generates the SQL column definitions for value fields with constraints
58
- * @returns SQL string containing value column definitions
59
- */
60
- protected constructValueColumns($delimiter?: string): string;
61
- /**
62
- * Convert Supabase values to JS values. Ensures numeric strings become numbers where schema says number.
63
- */
64
- protected sqlToJsValue(column: string, value: ValueOptionType): Entity[keyof Entity];
65
- /**
66
- * Determines if a field should be treated as unsigned based on schema properties
67
- * @param typeDef - The schema type definition
68
- * @returns true if the field should be treated as unsigned
69
- */
70
- protected shouldBeUnsigned(typeDef: JsonSchema): boolean;
71
- /**
72
- * Stores or updates a row in the database.
73
- * Uses UPSERT (INSERT ... ON CONFLICT DO UPDATE) for atomic operations.
74
- *
75
- * @param entity - The entity to store (may be missing auto-generated keys)
76
- * @returns The entity with any server-generated fields updated
77
- * @emits "put" event with the updated entity when successful
78
- */
79
- put(entity: InsertType): Promise<Entity>;
80
- /**
81
- * Stores multiple rows in the database in a bulk operation.
82
- * Uses individual put calls to ensure auto-generated keys are handled correctly.
83
- *
84
- * @param entities - Array of entities to store (may be missing auto-generated keys)
85
- * @returns Array of entities with any server-generated fields updated
86
- * @emits "put" event for each entity stored
87
- */
88
- putBulk(entities: InsertType[]): Promise<Entity[]>;
89
- /**
90
- * Retrieves a value from the database by its primary key.
91
- *
92
- * @param key - The primary key object to look up
93
- * @returns The stored entity or undefined if not found
94
- * @emits "get" event with the key when successful
95
- */
96
- get(key: PrimaryKey): Promise<Entity | undefined>;
97
- /**
98
- * Deletes a row from the database.
99
- *
100
- * @param value - The primary key object or entity to delete
101
- * @emits "delete" event with the key when successful
102
- */
103
- delete(value: PrimaryKey | Entity): Promise<void>;
104
- /**
105
- * Retrieves all entries from the database table, with optional ordering, offset, and limit.
106
- * @param options - Optional ordering, limit, and offset options
107
- * @returns Promise resolving to an array of entries or undefined if not found
108
- */
109
- getAll(options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
110
- /**
111
- * Deletes all rows from the database table.
112
- * @emits "clearall" event when successful
113
- */
114
- deleteAll(): Promise<void>;
115
- /**
116
- * Returns the total number of rows in the database.
117
- *
118
- * @returns Promise resolving to the count of stored items
119
- */
120
- size(): Promise<number>;
121
- /**
122
- * Fetches a page of records from the repository.
123
- * @param offset - Number of records to skip
124
- * @param limit - Maximum number of records to return
125
- * @returns Array of entities or undefined if no records found
126
- */
127
- getBulk(offset: number, limit: number): Promise<Entity[] | undefined>;
128
- /**
129
- * Applies criteria to a Supabase filter builder. Typed as `any` because the
130
- * `PostgrestFilterBuilder` generics are deep enough to trip TS2589.
131
- */
132
- private applyCriteriaToFilter;
133
- /**
134
- * Counts rows matching the specified search criteria.
135
- */
136
- count(criteria?: SearchCriteria<Entity>): Promise<number>;
137
- /**
138
- * Deletes all entries matching the specified search criteria.
139
- * Supports multiple columns with optional comparison operators.
140
- *
141
- * @param criteria - Object with column names as keys and values or SearchConditions
142
- */
143
- deleteSearch(criteria: DeleteSearchCriteria<Entity>): Promise<void>;
144
- /**
145
- * Queries entries matching the specified search criteria with optional ordering, limit, and offset.
146
- *
147
- * @param criteria - Object with column names as keys and values or SearchConditions
148
- * @param options - Optional ordering, limit, and offset options
149
- * @returns Array of matching entities or undefined if no matches found
150
- */
151
- query(criteria: SearchCriteria<Entity>, options?: QueryOptions<Entity>): Promise<Entity[] | undefined>;
152
- queryIndex<K extends keyof Entity & string>(criteria: SearchCriteria<Entity>, options: CoveringIndexQueryOptions<Entity, K>): Promise<Pick<Entity, K>[]>;
153
- /**
154
- * Converts a row from Supabase realtime payload to an Entity with proper type conversions.
155
- *
156
- * @param row - The raw row data from Supabase realtime
157
- * @returns The converted entity
158
- */
159
- private convertRealtimeRow;
160
- /**
161
- * Subscribes to changes in the repository using Supabase realtime.
162
- * Receives notifications for INSERT, UPDATE, and DELETE operations from any source.
163
- *
164
- * @param callback - Function called when a change occurs
165
- * @param options - Optional subscription options (not used for Supabase realtime)
166
- * @returns Unsubscribe function
167
- */
168
- subscribeToChanges(callback: (change: TabularChangePayload<Entity>) => void, options?: TabularSubscribeOptions): () => void;
169
- /**
170
- * Destroys the repository and frees up resources.
171
- */
172
- destroy(): void;
173
- }
174
- //# sourceMappingURL=SupabaseTabularStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseTabularStorage.d.ts","sourceRoot":"","sources":["../../src/tabular/SupabaseTabularStorage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"}
@@ -1,40 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export interface ExpectedIndexDefinition {
7
- name: string;
8
- keyPath: string | string[];
9
- options?: IDBIndexParameters;
10
- }
11
- export interface MigrationContext {
12
- db: IDBDatabase;
13
- transaction: IDBTransaction;
14
- oldVersion: number;
15
- newVersion: number;
16
- tableName: string;
17
- }
18
- export interface DataTransformer {
19
- (oldData: any): any | Promise<any>;
20
- }
21
- export interface MigrationOptions {
22
- /** Custom data transformer to apply during migration */
23
- dataTransformer?: DataTransformer;
24
- /** Whether to allow destructive operations (delete and recreate). Default: false */
25
- allowDestructiveMigration?: boolean;
26
- /** Callback for migration progress/logging */
27
- onMigrationProgress?: (message: string, progress?: number) => void;
28
- /** Callback for migration errors (non-fatal warnings) */
29
- onMigrationWarning?: (message: string, error?: Error) => void;
30
- }
31
- /**
32
- * Ensures that an IndexedDB table exists with the specified schema.
33
- * Performs migrations as needed without data loss when possible.
34
- */
35
- export declare function ensureIndexedDbTable(tableName: string, primaryKey: string | string[], expectedIndexes?: ExpectedIndexDefinition[], options?: MigrationOptions, autoIncrement?: boolean): Promise<IDBDatabase>;
36
- /**
37
- * Utility function to delete a database (for testing or cleanup)
38
- */
39
- export declare function dropIndexedDbTable(tableName: string): Promise<void>;
40
- //# sourceMappingURL=IndexedDbTable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IndexedDbTable.d.ts","sourceRoot":"","sources":["../../src/util/IndexedDbTable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,WAAW,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oFAAoF;IACpF,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,8CAA8C;IAC9C,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;CAC/D;AAsZD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAC7B,eAAe,GAAE,uBAAuB,EAAO,EAC/C,OAAO,GAAE,gBAAqB,EAC9B,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,WAAW,CAAC,CA6KtB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE"}
@@ -1,10 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * Executes an async function within a telemetry span.
8
- */
9
- export declare function traced<T>(spanName: string, storageName: string, fn: () => Promise<T>): Promise<T>;
10
- //# sourceMappingURL=traced.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"traced.d.ts","sourceRoot":"","sources":["../../src/util/traced.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAC5B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAgBZ"}