@axiom-lattice/pg-stores 1.0.2 → 1.0.4

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/pg-stores@1.0.2 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@1.0.4 build /home/runner/work/agentic/agentic/packages/pg-stores
3
3
  > tsup src/index.ts --format cjs,esm --dts --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,13 +8,13 @@
8
8
  CLI Target: es2020
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/index.mjs 15.71 KB
12
- ESM dist/index.mjs.map 30.15 KB
13
- ESM ⚡️ Build success in 85ms
14
- CJS dist/index.js 16.98 KB
15
- CJS dist/index.js.map 30.95 KB
16
- CJS ⚡️ Build success in 88ms
11
+ CJS dist/index.js 34.68 KB
12
+ CJS dist/index.js.map 61.72 KB
13
+ CJS ⚡️ Build success in 199ms
14
+ ESM dist/index.mjs 33.20 KB
15
+ ESM dist/index.mjs.map 60.64 KB
16
+ ESM ⚡️ Build success in 200ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 4633ms
19
- DTS dist/index.d.ts 5.38 KB
20
- DTS dist/index.d.mts 5.38 KB
18
+ DTS ⚡️ Build success in 6520ms
19
+ DTS dist/index.d.ts 8.83 KB
20
+ DTS dist/index.d.mts 8.83 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 1.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ef0fb84]
8
+ - @axiom-lattice/protocols@2.1.9
9
+ - @axiom-lattice/core@2.1.15
10
+
11
+ ## 1.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - d43ea0b: add schedule task
16
+ - Updated dependencies [d43ea0b]
17
+ - @axiom-lattice/protocols@2.1.8
18
+ - @axiom-lattice/core@2.1.14
19
+
3
20
  ## 1.0.2
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PoolConfig, PoolClient, Pool } from 'pg';
2
- import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest } from '@axiom-lattice/protocols';
3
- export { Assistant, AssistantStore, CreateAssistantRequest, CreateThreadRequest, Thread, ThreadStore } from '@axiom-lattice/protocols';
2
+ import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType } from '@axiom-lattice/protocols';
3
+ export { Assistant, AssistantStore, CreateAssistantRequest, CreateThreadRequest, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Thread, ThreadStore } from '@axiom-lattice/protocols';
4
4
 
5
5
  /**
6
6
  * PostgreSQL implementation of ThreadStore
@@ -144,6 +144,120 @@ declare class PostgreSQLAssistantStore implements AssistantStore {
144
144
  private mapRowToAssistant;
145
145
  }
146
146
 
147
+ /**
148
+ * PostgreSQL implementation of ScheduleStorage
149
+ *
150
+ * Provides persistent storage for scheduled tasks
151
+ * Data survives service restarts
152
+ */
153
+
154
+ /**
155
+ * PostgreSQL ScheduleStorage options
156
+ */
157
+ interface PostgreSQLScheduleStorageOptions {
158
+ /**
159
+ * PostgreSQL connection pool configuration
160
+ * Can be a connection string or PoolConfig object
161
+ */
162
+ poolConfig: string | PoolConfig;
163
+ /**
164
+ * Whether to run migrations automatically on initialization
165
+ * @default true
166
+ */
167
+ autoMigrate?: boolean;
168
+ }
169
+ /**
170
+ * PostgreSQL implementation of ScheduleStorage
171
+ */
172
+ declare class PostgreSQLScheduleStorage implements ScheduleStorage {
173
+ private pool;
174
+ private migrationManager;
175
+ private initialized;
176
+ constructor(options: PostgreSQLScheduleStorageOptions);
177
+ /**
178
+ * Dispose resources and close the connection pool
179
+ */
180
+ dispose(): Promise<void>;
181
+ /**
182
+ * Initialize the store and run migrations
183
+ */
184
+ initialize(): Promise<void>;
185
+ /**
186
+ * Ensure store is initialized
187
+ */
188
+ private ensureInitialized;
189
+ /**
190
+ * Save a new task
191
+ */
192
+ save(task: ScheduledTaskDefinition): Promise<void>;
193
+ /**
194
+ * Get task by ID
195
+ */
196
+ get(taskId: string): Promise<ScheduledTaskDefinition | null>;
197
+ /**
198
+ * Update task
199
+ */
200
+ update(taskId: string, updates: Partial<ScheduledTaskDefinition>): Promise<void>;
201
+ /**
202
+ * Delete task
203
+ */
204
+ delete(taskId: string): Promise<void>;
205
+ /**
206
+ * Get all active tasks (pending or paused)
207
+ */
208
+ getActiveTasks(): Promise<ScheduledTaskDefinition[]>;
209
+ /**
210
+ * Get tasks by type
211
+ */
212
+ getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;
213
+ /**
214
+ * Get tasks by status
215
+ */
216
+ getTasksByStatus(status: ScheduledTaskStatus): Promise<ScheduledTaskDefinition[]>;
217
+ /**
218
+ * Get tasks by execution type
219
+ */
220
+ getTasksByExecutionType(executionType: ScheduleExecutionType): Promise<ScheduledTaskDefinition[]>;
221
+ /**
222
+ * Get tasks by assistant ID
223
+ */
224
+ getTasksByAssistantId(assistantId: string): Promise<ScheduledTaskDefinition[]>;
225
+ /**
226
+ * Get tasks by thread ID
227
+ */
228
+ getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;
229
+ /**
230
+ * Get all tasks with optional filters
231
+ */
232
+ getAllTasks(filters?: {
233
+ status?: ScheduledTaskStatus;
234
+ executionType?: ScheduleExecutionType;
235
+ taskType?: string;
236
+ assistantId?: string;
237
+ threadId?: string;
238
+ limit?: number;
239
+ offset?: number;
240
+ }): Promise<ScheduledTaskDefinition[]>;
241
+ /**
242
+ * Count tasks with optional filters
243
+ */
244
+ countTasks(filters?: {
245
+ status?: ScheduledTaskStatus;
246
+ executionType?: ScheduleExecutionType;
247
+ taskType?: string;
248
+ assistantId?: string;
249
+ threadId?: string;
250
+ }): Promise<number>;
251
+ /**
252
+ * Delete completed/cancelled/failed tasks older than specified time
253
+ */
254
+ deleteOldTasks(olderThanMs: number): Promise<number>;
255
+ /**
256
+ * Map database row to ScheduledTaskDefinition
257
+ */
258
+ private mapRowToTask;
259
+ }
260
+
147
261
  /**
148
262
  * Migration system for database schema management
149
263
  */
@@ -208,4 +322,13 @@ declare const createThreadsTable: Migration;
208
322
  */
209
323
  declare const createAssistantsTable: Migration;
210
324
 
211
- export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createThreadsTable };
325
+ /**
326
+ * PostgreSQL migrations for scheduled tasks table
327
+ */
328
+
329
+ /**
330
+ * Create the scheduled_tasks table
331
+ */
332
+ declare const createScheduledTasksTable: Migration;
333
+
334
+ export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createScheduledTasksTable, createThreadsTable };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PoolConfig, PoolClient, Pool } from 'pg';
2
- import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest } from '@axiom-lattice/protocols';
3
- export { Assistant, AssistantStore, CreateAssistantRequest, CreateThreadRequest, Thread, ThreadStore } from '@axiom-lattice/protocols';
2
+ import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType } from '@axiom-lattice/protocols';
3
+ export { Assistant, AssistantStore, CreateAssistantRequest, CreateThreadRequest, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Thread, ThreadStore } from '@axiom-lattice/protocols';
4
4
 
5
5
  /**
6
6
  * PostgreSQL implementation of ThreadStore
@@ -144,6 +144,120 @@ declare class PostgreSQLAssistantStore implements AssistantStore {
144
144
  private mapRowToAssistant;
145
145
  }
146
146
 
147
+ /**
148
+ * PostgreSQL implementation of ScheduleStorage
149
+ *
150
+ * Provides persistent storage for scheduled tasks
151
+ * Data survives service restarts
152
+ */
153
+
154
+ /**
155
+ * PostgreSQL ScheduleStorage options
156
+ */
157
+ interface PostgreSQLScheduleStorageOptions {
158
+ /**
159
+ * PostgreSQL connection pool configuration
160
+ * Can be a connection string or PoolConfig object
161
+ */
162
+ poolConfig: string | PoolConfig;
163
+ /**
164
+ * Whether to run migrations automatically on initialization
165
+ * @default true
166
+ */
167
+ autoMigrate?: boolean;
168
+ }
169
+ /**
170
+ * PostgreSQL implementation of ScheduleStorage
171
+ */
172
+ declare class PostgreSQLScheduleStorage implements ScheduleStorage {
173
+ private pool;
174
+ private migrationManager;
175
+ private initialized;
176
+ constructor(options: PostgreSQLScheduleStorageOptions);
177
+ /**
178
+ * Dispose resources and close the connection pool
179
+ */
180
+ dispose(): Promise<void>;
181
+ /**
182
+ * Initialize the store and run migrations
183
+ */
184
+ initialize(): Promise<void>;
185
+ /**
186
+ * Ensure store is initialized
187
+ */
188
+ private ensureInitialized;
189
+ /**
190
+ * Save a new task
191
+ */
192
+ save(task: ScheduledTaskDefinition): Promise<void>;
193
+ /**
194
+ * Get task by ID
195
+ */
196
+ get(taskId: string): Promise<ScheduledTaskDefinition | null>;
197
+ /**
198
+ * Update task
199
+ */
200
+ update(taskId: string, updates: Partial<ScheduledTaskDefinition>): Promise<void>;
201
+ /**
202
+ * Delete task
203
+ */
204
+ delete(taskId: string): Promise<void>;
205
+ /**
206
+ * Get all active tasks (pending or paused)
207
+ */
208
+ getActiveTasks(): Promise<ScheduledTaskDefinition[]>;
209
+ /**
210
+ * Get tasks by type
211
+ */
212
+ getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;
213
+ /**
214
+ * Get tasks by status
215
+ */
216
+ getTasksByStatus(status: ScheduledTaskStatus): Promise<ScheduledTaskDefinition[]>;
217
+ /**
218
+ * Get tasks by execution type
219
+ */
220
+ getTasksByExecutionType(executionType: ScheduleExecutionType): Promise<ScheduledTaskDefinition[]>;
221
+ /**
222
+ * Get tasks by assistant ID
223
+ */
224
+ getTasksByAssistantId(assistantId: string): Promise<ScheduledTaskDefinition[]>;
225
+ /**
226
+ * Get tasks by thread ID
227
+ */
228
+ getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;
229
+ /**
230
+ * Get all tasks with optional filters
231
+ */
232
+ getAllTasks(filters?: {
233
+ status?: ScheduledTaskStatus;
234
+ executionType?: ScheduleExecutionType;
235
+ taskType?: string;
236
+ assistantId?: string;
237
+ threadId?: string;
238
+ limit?: number;
239
+ offset?: number;
240
+ }): Promise<ScheduledTaskDefinition[]>;
241
+ /**
242
+ * Count tasks with optional filters
243
+ */
244
+ countTasks(filters?: {
245
+ status?: ScheduledTaskStatus;
246
+ executionType?: ScheduleExecutionType;
247
+ taskType?: string;
248
+ assistantId?: string;
249
+ threadId?: string;
250
+ }): Promise<number>;
251
+ /**
252
+ * Delete completed/cancelled/failed tasks older than specified time
253
+ */
254
+ deleteOldTasks(olderThanMs: number): Promise<number>;
255
+ /**
256
+ * Map database row to ScheduledTaskDefinition
257
+ */
258
+ private mapRowToTask;
259
+ }
260
+
147
261
  /**
148
262
  * Migration system for database schema management
149
263
  */
@@ -208,4 +322,13 @@ declare const createThreadsTable: Migration;
208
322
  */
209
323
  declare const createAssistantsTable: Migration;
210
324
 
211
- export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createThreadsTable };
325
+ /**
326
+ * PostgreSQL migrations for scheduled tasks table
327
+ */
328
+
329
+ /**
330
+ * Create the scheduled_tasks table
331
+ */
332
+ declare const createScheduledTasksTable: Migration;
333
+
334
+ export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createScheduledTasksTable, createThreadsTable };