ai-database 2.0.1 → 2.1.1
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/CHANGELOG.md +43 -0
- package/dist/actions.d.ts +247 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +260 -0
- package/dist/actions.js.map +1 -0
- package/dist/ai-promise-db.d.ts +34 -2
- package/dist/ai-promise-db.d.ts.map +1 -1
- package/dist/ai-promise-db.js +511 -66
- package/dist/ai-promise-db.js.map +1 -1
- package/dist/constants.d.ts +16 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +16 -0
- package/dist/constants.js.map +1 -0
- package/dist/events.d.ts +153 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +154 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/memory-provider.d.ts +144 -2
- package/dist/memory-provider.d.ts.map +1 -1
- package/dist/memory-provider.js +569 -13
- package/dist/memory-provider.js.map +1 -1
- package/dist/schema/cascade.d.ts +96 -0
- package/dist/schema/cascade.d.ts.map +1 -0
- package/dist/schema/cascade.js +528 -0
- package/dist/schema/cascade.js.map +1 -0
- package/dist/schema/index.d.ts +197 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +1211 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/parse.d.ts +225 -0
- package/dist/schema/parse.d.ts.map +1 -0
- package/dist/schema/parse.js +732 -0
- package/dist/schema/parse.js.map +1 -0
- package/dist/schema/provider.d.ts +176 -0
- package/dist/schema/provider.d.ts.map +1 -0
- package/dist/schema/provider.js +258 -0
- package/dist/schema/provider.js.map +1 -0
- package/dist/schema/resolve.d.ts +87 -0
- package/dist/schema/resolve.d.ts.map +1 -0
- package/dist/schema/resolve.js +474 -0
- package/dist/schema/resolve.js.map +1 -0
- package/dist/schema/semantic.d.ts +53 -0
- package/dist/schema/semantic.d.ts.map +1 -0
- package/dist/schema/semantic.js +247 -0
- package/dist/schema/semantic.js.map +1 -0
- package/dist/schema/types.d.ts +528 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +9 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema.d.ts +24 -867
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +41 -1124
- package/dist/schema.js.map +1 -1
- package/dist/semantic.d.ts +175 -0
- package/dist/semantic.d.ts.map +1 -0
- package/dist/semantic.js +338 -0
- package/dist/semantic.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +13 -4
- package/.turbo/turbo-build.log +0 -5
- package/TESTING.md +0 -410
- package/TEST_SUMMARY.md +0 -250
- package/TODO.md +0 -128
- package/src/ai-promise-db.ts +0 -1243
- package/src/authorization.ts +0 -1102
- package/src/durable-clickhouse.ts +0 -596
- package/src/durable-promise.ts +0 -582
- package/src/execution-queue.ts +0 -608
- package/src/index.test.ts +0 -868
- package/src/index.ts +0 -337
- package/src/linguistic.ts +0 -404
- package/src/memory-provider.test.ts +0 -1036
- package/src/memory-provider.ts +0 -1119
- package/src/schema.test.ts +0 -1254
- package/src/schema.ts +0 -2296
- package/src/tests.ts +0 -725
- package/src/types.ts +0 -1177
- package/test/README.md +0 -153
- package/test/edge-cases.test.ts +0 -646
- package/test/provider-resolution.test.ts +0 -402
- package/tsconfig.json +0 -9
- package/vitest.config.ts +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# ai-database
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6beb531: Add TDD RED phase tests for type system unification
|
|
8
|
+
|
|
9
|
+
- ai-functions: Add tests for AIFunction<Output, Input> generic order flip
|
|
10
|
+
- ai-workflows: Add tests for EventHandler<TOutput, TInput> order and OnProxy/EveryProxy autocomplete
|
|
11
|
+
- ai-database: Existing package - no changes in this release
|
|
12
|
+
- @primitives/types: New shared types package with failing tests for RED phase
|
|
13
|
+
|
|
14
|
+
These tests document the expected behavior for the GREEN phase implementation where generic type parameters will be reordered to put Output first (matching Promise<T> convention).
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [6beb531]
|
|
17
|
+
- ai-functions@2.1.1
|
|
18
|
+
|
|
19
|
+
## 2.1.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- **Natural Language Query Execution**: Wire up tagged template literal handler (`db.Lead\`query\``) and `db.ask()`method for natural language database queries. Supports AI-powered query generation via`setNLQueryGenerator()` with fallback to keyword search.
|
|
24
|
+
|
|
25
|
+
- **Schema Input Validation**: Comprehensive validation for entity names, field names, field types, and operator syntax. Prevents SQL injection, XSS, and provides helpful error messages. Throws `SchemaValidationError` with error codes and paths for programmatic handling.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Fixed TypeScript build error in parse.ts operator validation
|
|
30
|
+
|
|
31
|
+
## 2.0.3
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
- rpc.do@0.2.0
|
|
37
|
+
- ai-functions@2.0.3
|
|
38
|
+
|
|
39
|
+
## 2.0.2
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- ai-functions@2.0.2
|
|
45
|
+
|
|
3
46
|
## 2.0.1
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions API - Public interface for durable execution
|
|
3
|
+
*
|
|
4
|
+
* Actions represent long-running operations that survive restarts.
|
|
5
|
+
* They track progress through a lifecycle: pending -> active -> completed/failed.
|
|
6
|
+
*
|
|
7
|
+
* Key use cases:
|
|
8
|
+
* - Batch operations (processing thousands of records)
|
|
9
|
+
* - Background jobs (generating reports, sending emails)
|
|
10
|
+
* - Resumable workflows (surviving crashes and restarts)
|
|
11
|
+
* - Progress tracking (showing users what percentage is complete)
|
|
12
|
+
*
|
|
13
|
+
* @module actions
|
|
14
|
+
*
|
|
15
|
+
* @example Basic usage - creating and tracking an action
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { DB } from '@org.ai/db'
|
|
18
|
+
*
|
|
19
|
+
* const { db, actions } = DB({
|
|
20
|
+
* Lead: { name: 'string', email: 'string', score: 'number' },
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // Create a long-running action
|
|
24
|
+
* const action = await actions.create({
|
|
25
|
+
* actor: 'system',
|
|
26
|
+
* action: 'generate',
|
|
27
|
+
* object: 'Lead',
|
|
28
|
+
* objectData: { count: 1000 },
|
|
29
|
+
* total: 1000,
|
|
30
|
+
* })
|
|
31
|
+
*
|
|
32
|
+
* console.log(action.id) // 'action-abc123'
|
|
33
|
+
* console.log(action.status) // 'pending'
|
|
34
|
+
* console.log(action.activity) // 'generating' (auto-conjugated)
|
|
35
|
+
*
|
|
36
|
+
* // Start the action
|
|
37
|
+
* await actions.update(action.id, { status: 'active' })
|
|
38
|
+
*
|
|
39
|
+
* // Update progress during processing
|
|
40
|
+
* for (let i = 0; i < 1000; i += 100) {
|
|
41
|
+
* await processLeads(i, i + 100)
|
|
42
|
+
* await actions.update(action.id, { progress: i + 100 })
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* // Complete the action
|
|
46
|
+
* await actions.update(action.id, {
|
|
47
|
+
* status: 'completed',
|
|
48
|
+
* result: { processed: 1000 },
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Using forEach with persistence
|
|
53
|
+
* ```ts
|
|
54
|
+
* // Actions integrate with forEach for automatic progress tracking
|
|
55
|
+
* const result = await db.Lead.forEach(
|
|
56
|
+
* async (lead) => {
|
|
57
|
+
* await enrichLead(lead)
|
|
58
|
+
* },
|
|
59
|
+
* {
|
|
60
|
+
* persist: true, // Creates an action automatically
|
|
61
|
+
* concurrency: 10,
|
|
62
|
+
* }
|
|
63
|
+
* )
|
|
64
|
+
*
|
|
65
|
+
* console.log(result.actionId) // Can be used to resume if interrupted
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Resuming after a crash
|
|
69
|
+
* ```ts
|
|
70
|
+
* // If your process restarts, resume from where you left off
|
|
71
|
+
* const result = await db.Lead.forEach(
|
|
72
|
+
* async (lead) => {
|
|
73
|
+
* await enrichLead(lead)
|
|
74
|
+
* },
|
|
75
|
+
* {
|
|
76
|
+
* resume: 'action-abc123', // Skip already-processed items
|
|
77
|
+
* }
|
|
78
|
+
* )
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example Listing and monitoring actions
|
|
82
|
+
* ```ts
|
|
83
|
+
* // Find all active actions
|
|
84
|
+
* const active = await actions.list({ status: 'active' })
|
|
85
|
+
* for (const action of active) {
|
|
86
|
+
* console.log(`${action.activity} ${action.object}: ${action.progress}/${action.total}`)
|
|
87
|
+
* }
|
|
88
|
+
*
|
|
89
|
+
* // Find failed actions to retry
|
|
90
|
+
* const failed = await actions.list({ status: 'failed' })
|
|
91
|
+
* for (const action of failed) {
|
|
92
|
+
* console.log(`Failed: ${action.error}`)
|
|
93
|
+
* await actions.retry(action.id)
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example Cancelling actions
|
|
98
|
+
* ```ts
|
|
99
|
+
* // Cancel a pending or active action
|
|
100
|
+
* const action = await actions.create({
|
|
101
|
+
* actor: 'user:john',
|
|
102
|
+
* action: 'export',
|
|
103
|
+
* object: 'Report',
|
|
104
|
+
* objectData: { format: 'csv' },
|
|
105
|
+
* })
|
|
106
|
+
*
|
|
107
|
+
* // User changes their mind
|
|
108
|
+
* await actions.cancel(action.id)
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example Verb conjugation
|
|
112
|
+
* ```ts
|
|
113
|
+
* // Actions auto-conjugate verbs for semantic clarity
|
|
114
|
+
* const action = await actions.create({
|
|
115
|
+
* actor: 'system',
|
|
116
|
+
* action: 'generate', // Base verb
|
|
117
|
+
* object: 'Lead',
|
|
118
|
+
* })
|
|
119
|
+
*
|
|
120
|
+
* console.log(action.action) // 'generate' - base form
|
|
121
|
+
* console.log(action.act) // 'generates' - 3rd person present
|
|
122
|
+
* console.log(action.activity) // 'generating' - gerund (for "currently...")
|
|
123
|
+
*
|
|
124
|
+
* // Use conjugate() to get all forms for any verb
|
|
125
|
+
* const verb = actions.conjugate('publish')
|
|
126
|
+
* console.log(verb)
|
|
127
|
+
* // { action: 'publish', act: 'publishes', activity: 'publishing', actor: 'publisher' }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export type { DBAction, ActionsAPI, CreateActionOptions, } from './schema.js';
|
|
131
|
+
export type { ActionStatus } from './types.js';
|
|
132
|
+
/**
|
|
133
|
+
* Standard action statuses
|
|
134
|
+
*
|
|
135
|
+
* Actions move through these statuses during their lifecycle:
|
|
136
|
+
*
|
|
137
|
+
* ```
|
|
138
|
+
* pending -> active -> completed
|
|
139
|
+
* \-> failed
|
|
140
|
+
* \-> cancelled
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* - `pending`: Action created but not started
|
|
144
|
+
* - `active`: Action is currently running
|
|
145
|
+
* - `completed`: Action finished successfully
|
|
146
|
+
* - `failed`: Action encountered an error
|
|
147
|
+
* - `cancelled`: Action was cancelled before completion
|
|
148
|
+
*/
|
|
149
|
+
export declare const ActionStatuses: {
|
|
150
|
+
/** Action created but not yet started */
|
|
151
|
+
readonly PENDING: "pending";
|
|
152
|
+
/** Action is currently running */
|
|
153
|
+
readonly ACTIVE: "active";
|
|
154
|
+
/** Action completed successfully */
|
|
155
|
+
readonly COMPLETED: "completed";
|
|
156
|
+
/** Action failed with an error */
|
|
157
|
+
readonly FAILED: "failed";
|
|
158
|
+
/** Action was cancelled */
|
|
159
|
+
readonly CANCELLED: "cancelled";
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Type for action status values
|
|
163
|
+
*/
|
|
164
|
+
export type ActionStatusType = (typeof ActionStatuses)[keyof typeof ActionStatuses];
|
|
165
|
+
/**
|
|
166
|
+
* Check if an action is in a terminal state (completed, failed, or cancelled)
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const action = await actions.get(id)
|
|
171
|
+
* if (isTerminal(action.status)) {
|
|
172
|
+
* console.log('Action is finished')
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export declare function isTerminal(status: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Check if an action is still in progress (pending or active)
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* const action = await actions.get(id)
|
|
183
|
+
* if (isInProgress(action.status)) {
|
|
184
|
+
* console.log('Action is still running')
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export declare function isInProgress(status: string): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Check if an action can be retried (only failed actions)
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* const action = await actions.get(id)
|
|
195
|
+
* if (canRetry(action.status)) {
|
|
196
|
+
* await actions.retry(action.id)
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export declare function canRetry(status: string): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Check if an action can be cancelled (pending or active)
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* const action = await actions.get(id)
|
|
207
|
+
* if (canCancel(action.status)) {
|
|
208
|
+
* await actions.cancel(action.id)
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export declare function canCancel(status: string): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Calculate progress percentage for an action
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* const action = await actions.get(id)
|
|
219
|
+
* console.log(`Progress: ${getProgressPercent(action)}%`)
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
export declare function getProgressPercent(action: {
|
|
223
|
+
progress?: number;
|
|
224
|
+
total?: number;
|
|
225
|
+
}): number;
|
|
226
|
+
/**
|
|
227
|
+
* Format action status for display
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* const action = await actions.get(id)
|
|
232
|
+
* console.log(formatActionStatus(action))
|
|
233
|
+
* // 'generating leads (45%)'
|
|
234
|
+
* // or 'completed: generated 1000 leads'
|
|
235
|
+
* // or 'failed: Connection timeout'
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare function formatActionStatus(action: {
|
|
239
|
+
status: string;
|
|
240
|
+
activity?: string;
|
|
241
|
+
object?: string;
|
|
242
|
+
progress?: number;
|
|
243
|
+
total?: number;
|
|
244
|
+
result?: unknown;
|
|
245
|
+
error?: string;
|
|
246
|
+
}): string;
|
|
247
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgIG;AAGH,YAAY,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAGpB,YAAY,EAAE,Y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* Actions represent long-running operations that survive restarts.
|
|
5
|
+
* They track progress through a lifecycle: pending -> active -> completed/failed.
|
|
6
|
+
*
|
|
7
|
+
* Key use cases:
|
|
8
|
+
* - Batch operations (processing thousands of records)
|
|
9
|
+
* - Background jobs (generating reports, sending emails)
|
|
10
|
+
* - Resumable workflows (surviving crashes and restarts)
|
|
11
|
+
* - Progress tracking (showing users what percentage is complete)
|
|
12
|
+
*
|
|
13
|
+
* @module actions
|
|
14
|
+
*
|
|
15
|
+
* @example Basic usage - creating and tracking an action
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { DB } from '@org.ai/db'
|
|
18
|
+
*
|
|
19
|
+
* const { db, actions } = DB({
|
|
20
|
+
* Lead: { name: 'string', email: 'string', score: 'number' },
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // Create a long-running action
|
|
24
|
+
* const action = await actions.create({
|
|
25
|
+
* actor: 'system',
|
|
26
|
+
* action: 'generate',
|
|
27
|
+
* object: 'Lead',
|
|
28
|
+
* objectData: { count: 1000 },
|
|
29
|
+
* total: 1000,
|
|
30
|
+
* })
|
|
31
|
+
*
|
|
32
|
+
* console.log(action.id) // 'action-abc123'
|
|
33
|
+
* console.log(action.status) // 'pending'
|
|
34
|
+
* console.log(action.activity) // 'generating' (auto-conjugated)
|
|
35
|
+
*
|
|
36
|
+
* // Start the action
|
|
37
|
+
* await actions.update(action.id, { status: 'active' })
|
|
38
|
+
*
|
|
39
|
+
* // Update progress during processing
|
|
40
|
+
* for (let i = 0; i < 1000; i += 100) {
|
|
41
|
+
* await processLeads(i, i + 100)
|
|
42
|
+
* await actions.update(action.id, { progress: i + 100 })
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* // Complete the action
|
|
46
|
+
* await actions.update(action.id, {
|
|
47
|
+
* status: 'completed',
|
|
48
|
+
* result: { processed: 1000 },
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Using forEach with persistence
|
|
53
|
+
* ```ts
|
|
54
|
+
* // Actions integrate with forEach for automatic progress tracking
|
|
55
|
+
* const result = await db.Lead.forEach(
|
|
56
|
+
* async (lead) => {
|
|
57
|
+
* await enrichLead(lead)
|
|
58
|
+
* },
|
|
59
|
+
* {
|
|
60
|
+
* persist: true, // Creates an action automatically
|
|
61
|
+
* concurrency: 10,
|
|
62
|
+
* }
|
|
63
|
+
* )
|
|
64
|
+
*
|
|
65
|
+
* console.log(result.actionId) // Can be used to resume if interrupted
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Resuming after a crash
|
|
69
|
+
* ```ts
|
|
70
|
+
* // If your process restarts, resume from where you left off
|
|
71
|
+
* const result = await db.Lead.forEach(
|
|
72
|
+
* async (lead) => {
|
|
73
|
+
* await enrichLead(lead)
|
|
74
|
+
* },
|
|
75
|
+
* {
|
|
76
|
+
* resume: 'action-abc123', // Skip already-processed items
|
|
77
|
+
* }
|
|
78
|
+
* )
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example Listing and monitoring actions
|
|
82
|
+
* ```ts
|
|
83
|
+
* // Find all active actions
|
|
84
|
+
* const active = await actions.list({ status: 'active' })
|
|
85
|
+
* for (const action of active) {
|
|
86
|
+
* console.log(`${action.activity} ${action.object}: ${action.progress}/${action.total}`)
|
|
87
|
+
* }
|
|
88
|
+
*
|
|
89
|
+
* // Find failed actions to retry
|
|
90
|
+
* const failed = await actions.list({ status: 'failed' })
|
|
91
|
+
* for (const action of failed) {
|
|
92
|
+
* console.log(`Failed: ${action.error}`)
|
|
93
|
+
* await actions.retry(action.id)
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example Cancelling actions
|
|
98
|
+
* ```ts
|
|
99
|
+
* // Cancel a pending or active action
|
|
100
|
+
* const action = await actions.create({
|
|
101
|
+
* actor: 'user:john',
|
|
102
|
+
* action: 'export',
|
|
103
|
+
* object: 'Report',
|
|
104
|
+
* objectData: { format: 'csv' },
|
|
105
|
+
* })
|
|
106
|
+
*
|
|
107
|
+
* // User changes their mind
|
|
108
|
+
* await actions.cancel(action.id)
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @example Verb conjugation
|
|
112
|
+
* ```ts
|
|
113
|
+
* // Actions auto-conjugate verbs for semantic clarity
|
|
114
|
+
* const action = await actions.create({
|
|
115
|
+
* actor: 'system',
|
|
116
|
+
* action: 'generate', // Base verb
|
|
117
|
+
* object: 'Lead',
|
|
118
|
+
* })
|
|
119
|
+
*
|
|
120
|
+
* console.log(action.action) // 'generate' - base form
|
|
121
|
+
* console.log(action.act) // 'generates' - 3rd person present
|
|
122
|
+
* console.log(action.activity) // 'generating' - gerund (for "currently...")
|
|
123
|
+
*
|
|
124
|
+
* // Use conjugate() to get all forms for any verb
|
|
125
|
+
* const verb = actions.conjugate('publish')
|
|
126
|
+
* console.log(verb)
|
|
127
|
+
* // { action: 'publish', act: 'publishes', activity: 'publishing', actor: 'publisher' }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Standard action statuses
|
|
132
|
+
*
|
|
133
|
+
* Actions move through these statuses during their lifecycle:
|
|
134
|
+
*
|
|
135
|
+
* ```
|
|
136
|
+
* pending -> active -> completed
|
|
137
|
+
* \-> failed
|
|
138
|
+
* \-> cancelled
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* - `pending`: Action created but not started
|
|
142
|
+
* - `active`: Action is currently running
|
|
143
|
+
* - `completed`: Action finished successfully
|
|
144
|
+
* - `failed`: Action encountered an error
|
|
145
|
+
* - `cancelled`: Action was cancelled before completion
|
|
146
|
+
*/
|
|
147
|
+
export const ActionStatuses = {
|
|
148
|
+
/** Action created but not yet started */
|
|
149
|
+
PENDING: 'pending',
|
|
150
|
+
/** Action is currently running */
|
|
151
|
+
ACTIVE: 'active',
|
|
152
|
+
/** Action completed successfully */
|
|
153
|
+
COMPLETED: 'completed',
|
|
154
|
+
/** Action failed with an error */
|
|
155
|
+
FAILED: 'failed',
|
|
156
|
+
/** Action was cancelled */
|
|
157
|
+
CANCELLED: 'cancelled',
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Check if an action is in a terminal state (completed, failed, or cancelled)
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const action = await actions.get(id)
|
|
165
|
+
* if (isTerminal(action.status)) {
|
|
166
|
+
* console.log('Action is finished')
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export function isTerminal(status) {
|
|
171
|
+
return status === 'completed' || status === 'failed' || status === 'cancelled';
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if an action is still in progress (pending or active)
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* const action = await actions.get(id)
|
|
179
|
+
* if (isInProgress(action.status)) {
|
|
180
|
+
* console.log('Action is still running')
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
export function isInProgress(status) {
|
|
185
|
+
return status === 'pending' || status === 'active';
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Check if an action can be retried (only failed actions)
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* const action = await actions.get(id)
|
|
193
|
+
* if (canRetry(action.status)) {
|
|
194
|
+
* await actions.retry(action.id)
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export function canRetry(status) {
|
|
199
|
+
return status === 'failed';
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Check if an action can be cancelled (pending or active)
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* const action = await actions.get(id)
|
|
207
|
+
* if (canCancel(action.status)) {
|
|
208
|
+
* await actions.cancel(action.id)
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export function canCancel(status) {
|
|
213
|
+
return status === 'pending' || status === 'active';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Calculate progress percentage for an action
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* const action = await actions.get(id)
|
|
221
|
+
* console.log(`Progress: ${getProgressPercent(action)}%`)
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
export function getProgressPercent(action) {
|
|
225
|
+
if (!action.total || action.total === 0)
|
|
226
|
+
return 0;
|
|
227
|
+
const progress = action.progress ?? 0;
|
|
228
|
+
return Math.round((progress / action.total) * 100);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Format action status for display
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* const action = await actions.get(id)
|
|
236
|
+
* console.log(formatActionStatus(action))
|
|
237
|
+
* // 'generating leads (45%)'
|
|
238
|
+
* // or 'completed: generated 1000 leads'
|
|
239
|
+
* // or 'failed: Connection timeout'
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export function formatActionStatus(action) {
|
|
243
|
+
switch (action.status) {
|
|
244
|
+
case 'pending':
|
|
245
|
+
return `pending: ${action.activity ?? 'waiting to start'} ${action.object ?? ''}`;
|
|
246
|
+
case 'active': {
|
|
247
|
+
const percent = getProgressPercent(action);
|
|
248
|
+
return `${action.activity ?? 'processing'} ${action.object ?? ''} (${percent}%)`;
|
|
249
|
+
}
|
|
250
|
+
case 'completed':
|
|
251
|
+
return `completed: ${action.result ? JSON.stringify(action.result) : 'done'}`;
|
|
252
|
+
case 'failed':
|
|
253
|
+
return `failed: ${action.error ?? 'unknown error'}`;
|
|
254
|
+
case 'cancelled':
|
|
255
|
+
return 'cancelled';
|
|
256
|
+
default:
|
|
257
|
+
return action.status;
|
|
258
|
+
}
|
|
259
|
+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,OAAO,CAAC,CAAA;IACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAA;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAA;AACpD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAQlC;IACC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,YAAY,MAAM,CAAC,QAAQ,IAAI,kBAAkB,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAA;QACnF,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;YAC1C,OAAO,GAAG,MAAM,CAAC,QAAQ,IAAI,YAAY,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,KAAK,OAAO,IAAI,CAAA;QAClF,CAAC;QACD,KAAK,WAAW;YACd,OAAO,cAAc,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;QAC/E,KAAK,QAAQ;YACX,OAAO,WAAW,MAAM,CAAC,KAAK,IAAI,eAAe,EAAE,CAAA;QACrD,KAAK,WAAW;YACd,OAAO,WAAW,CAAA;QACpB;YACE,OAAO,MAAM,CAAC,MAAM,CAAA;IACxB,CAAC;AACH,CAAC"}
|
package/dist/ai-promise-db.d.ts
CHANGED
|
@@ -20,6 +20,16 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @packageDocumentation
|
|
22
22
|
*/
|
|
23
|
+
import type { DBProvider } from './schema.js';
|
|
24
|
+
/**
|
|
25
|
+
* Set the provider resolver function (called from schema.ts)
|
|
26
|
+
*/
|
|
27
|
+
export declare function setProviderResolver(resolver: () => Promise<DBProvider>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Set schema relation info for batch loading nested relations
|
|
30
|
+
* Called from schema.ts when DB() is initialized
|
|
31
|
+
*/
|
|
32
|
+
export declare function setSchemaRelationInfo(info: Map<string, Map<string, string>>): void;
|
|
23
33
|
/** Symbol to identify DBPromise instances */
|
|
24
34
|
export declare const DB_PROMISE_SYMBOL: unique symbol;
|
|
25
35
|
/** Symbol to get raw promise */
|
|
@@ -54,6 +64,8 @@ interface RelationRecording {
|
|
|
54
64
|
type: string;
|
|
55
65
|
isArray: boolean;
|
|
56
66
|
nestedPaths: Set<string>;
|
|
67
|
+
/** Nested relations accessed on this relation (e.g., customer.address where address is a relation) */
|
|
68
|
+
nestedRelations: Map<string, RelationRecording>;
|
|
57
69
|
}
|
|
58
70
|
/**
|
|
59
71
|
* Progress info for forEach operations
|
|
@@ -102,7 +114,7 @@ export interface ForEachActionsAPI {
|
|
|
102
114
|
export interface ForEachActionState {
|
|
103
115
|
id: string;
|
|
104
116
|
type: string;
|
|
105
|
-
status: 'pending' | 'active' | 'completed' | 'failed';
|
|
117
|
+
status: 'pending' | 'active' | 'completed' | 'failed' | 'cancelled';
|
|
106
118
|
progress?: number;
|
|
107
119
|
total?: number;
|
|
108
120
|
data: {
|
|
@@ -349,6 +361,15 @@ export declare function wrapEntityOperations<T>(typeName: string, operations: {
|
|
|
349
361
|
list: (options?: any) => Promise<T[]>;
|
|
350
362
|
find: (where: any) => Promise<T[]>;
|
|
351
363
|
search: (query: string, options?: any) => Promise<T[]>;
|
|
364
|
+
semanticSearch?: (query: string, options?: any) => Promise<Array<T & {
|
|
365
|
+
$score: number;
|
|
366
|
+
}>>;
|
|
367
|
+
hybridSearch?: (query: string, options?: any) => Promise<Array<T & {
|
|
368
|
+
$rrfScore: number;
|
|
369
|
+
$ftsRank: number;
|
|
370
|
+
$semanticRank: number;
|
|
371
|
+
$score: number;
|
|
372
|
+
}>>;
|
|
352
373
|
create: (...args: any[]) => Promise<T>;
|
|
353
374
|
update: (id: string, data: any) => Promise<T>;
|
|
354
375
|
upsert: (id: string, data: any) => Promise<T>;
|
|
@@ -359,12 +380,23 @@ export declare function wrapEntityOperations<T>(typeName: string, operations: {
|
|
|
359
380
|
list: (options?: any) => DBPromise<T[]>;
|
|
360
381
|
find: (where: any) => DBPromise<T[]>;
|
|
361
382
|
search: (query: string, options?: any) => DBPromise<T[]>;
|
|
362
|
-
|
|
383
|
+
semanticSearch: (query: string, options?: any) => Promise<Array<T & {
|
|
384
|
+
$score: number;
|
|
385
|
+
}>>;
|
|
386
|
+
hybridSearch: (query: string, options?: any) => Promise<Array<T & {
|
|
387
|
+
$rrfScore: number;
|
|
388
|
+
$ftsRank: number;
|
|
389
|
+
$semanticRank: number;
|
|
390
|
+
$score: number;
|
|
391
|
+
}>>;
|
|
392
|
+
create: (...args: any[]) => Promise<T | unknown>;
|
|
363
393
|
update: (id: string, data: any) => Promise<T>;
|
|
364
394
|
upsert: (id: string, data: any) => Promise<T>;
|
|
365
395
|
delete: (id: string) => Promise<boolean>;
|
|
366
396
|
forEach: <U>(callback: (item: T, index: number) => U | Promise<U>, options?: ForEachOptions<T>) => Promise<ForEachResult>;
|
|
367
397
|
first: () => DBPromise<T | null>;
|
|
398
|
+
draft?: (data: any, options?: any) => Promise<unknown>;
|
|
399
|
+
resolve?: (draft: unknown, options?: any) => Promise<unknown>;
|
|
368
400
|
};
|
|
369
401
|
export {};
|
|
370
402
|
//# sourceMappingURL=ai-promise-db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-promise-db.d.ts","sourceRoot":"","sources":["../src/ai-promise-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"ai-promise-db.d.ts","sourceRoot":"","sources":["../src/ai-promise-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAA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