ai-database 2.1.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/README.md +880 -669
- package/dist/actions.d.ts +2 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +1 -1
- package/dist/actions.js.map +1 -1
- package/dist/ai-promise-db.d.ts +49 -23
- package/dist/ai-promise-db.d.ts.map +1 -1
- package/dist/ai-promise-db.js +91 -63
- package/dist/ai-promise-db.js.map +1 -1
- package/dist/authorization.d.ts.map +1 -1
- package/dist/authorization.js +38 -30
- package/dist/authorization.js.map +1 -1
- package/dist/cascade-orchestrator.d.ts +404 -0
- package/dist/cascade-orchestrator.d.ts.map +1 -0
- package/dist/cascade-orchestrator.js +828 -0
- package/dist/cascade-orchestrator.js.map +1 -0
- package/dist/cascade-write-strategy.d.ts +584 -0
- package/dist/cascade-write-strategy.d.ts.map +1 -0
- package/dist/cascade-write-strategy.js +590 -0
- package/dist/cascade-write-strategy.js.map +1 -0
- package/dist/ch-adapter.d.ts +358 -0
- package/dist/ch-adapter.d.ts.map +1 -0
- package/dist/ch-adapter.js +929 -0
- package/dist/ch-adapter.js.map +1 -0
- package/dist/client/index.d.ts +42 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +43 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client.d.ts +266 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +81 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +64 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +52 -2
- package/dist/constants.js.map +1 -1
- package/dist/dataloader.d.ts +99 -0
- package/dist/dataloader.d.ts.map +1 -0
- package/dist/dataloader.js +225 -0
- package/dist/dataloader.js.map +1 -0
- package/dist/db-provider-port.d.ts +501 -0
- package/dist/db-provider-port.d.ts.map +1 -0
- package/dist/db-provider-port.js +113 -0
- package/dist/db-provider-port.js.map +1 -0
- package/dist/digital-objects-provider.d.ts +49 -0
- package/dist/digital-objects-provider.d.ts.map +1 -0
- package/dist/digital-objects-provider.js +55 -0
- package/dist/digital-objects-provider.js.map +1 -0
- package/dist/do-sqlite-adapter.d.ts +402 -0
- package/dist/do-sqlite-adapter.d.ts.map +1 -0
- package/dist/do-sqlite-adapter.js +745 -0
- package/dist/do-sqlite-adapter.js.map +1 -0
- package/dist/docs-rels/custom-types.d.ts +134 -0
- package/dist/docs-rels/custom-types.d.ts.map +1 -0
- package/dist/docs-rels/custom-types.js +70 -0
- package/dist/docs-rels/custom-types.js.map +1 -0
- package/dist/docs-rels/index.d.ts +16 -0
- package/dist/docs-rels/index.d.ts.map +1 -0
- package/dist/docs-rels/index.js +16 -0
- package/dist/docs-rels/index.js.map +1 -0
- package/dist/docs-rels/migrations/index.d.ts +30 -0
- package/dist/docs-rels/migrations/index.d.ts.map +1 -0
- package/dist/docs-rels/migrations/index.js +128 -0
- package/dist/docs-rels/migrations/index.js.map +1 -0
- package/dist/docs-rels/schema.d.ts +2961 -0
- package/dist/docs-rels/schema.d.ts.map +1 -0
- package/dist/docs-rels/schema.js +244 -0
- package/dist/docs-rels/schema.js.map +1 -0
- package/dist/durable-clickhouse.d.ts.map +1 -1
- package/dist/durable-clickhouse.js +16 -13
- package/dist/durable-clickhouse.js.map +1 -1
- package/dist/durable-promise.d.ts.map +1 -1
- package/dist/durable-promise.js +34 -15
- package/dist/durable-promise.js.map +1 -1
- package/dist/errors.d.ts +127 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +210 -0
- package/dist/errors.js.map +1 -0
- package/dist/eventbridge.d.ts +117 -0
- package/dist/eventbridge.d.ts.map +1 -0
- package/dist/eventbridge.js +238 -0
- package/dist/eventbridge.js.map +1 -0
- package/dist/events.d.ts +2 -2
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +1 -1
- package/dist/events.js.map +1 -1
- package/dist/execution-queue.d.ts.map +1 -1
- package/dist/execution-queue.js +4 -5
- package/dist/execution-queue.js.map +1 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -6
- package/dist/index.js.map +1 -1
- package/dist/linguistic.d.ts +3 -108
- package/dist/linguistic.d.ts.map +1 -1
- package/dist/linguistic.js +3 -372
- package/dist/linguistic.js.map +1 -1
- package/dist/logger.d.ts +132 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +137 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory-provider.d.ts +128 -0
- package/dist/memory-provider.d.ts.map +1 -1
- package/dist/memory-provider.js +592 -257
- package/dist/memory-provider.js.map +1 -1
- package/dist/pg-adapter.d.ts +424 -0
- package/dist/pg-adapter.d.ts.map +1 -0
- package/dist/pg-adapter.js +921 -0
- package/dist/pg-adapter.js.map +1 -0
- package/dist/pipelines-iceberg-emitter.d.ts +327 -0
- package/dist/pipelines-iceberg-emitter.d.ts.map +1 -0
- package/dist/pipelines-iceberg-emitter.js +351 -0
- package/dist/pipelines-iceberg-emitter.js.map +1 -0
- package/dist/provider-capabilities.d.ts +146 -0
- package/dist/provider-capabilities.d.ts.map +1 -0
- package/dist/provider-capabilities.js +214 -0
- package/dist/provider-capabilities.js.map +1 -0
- package/dist/rdb-provider-adapter.d.ts +195 -0
- package/dist/rdb-provider-adapter.d.ts.map +1 -0
- package/dist/rdb-provider-adapter.js +291 -0
- package/dist/rdb-provider-adapter.js.map +1 -0
- package/dist/schema/cascade.d.ts +48 -17
- package/dist/schema/cascade.d.ts.map +1 -1
- package/dist/schema/cascade.js +477 -278
- package/dist/schema/cascade.js.map +1 -1
- package/dist/schema/definition-caches.d.ts +24 -0
- package/dist/schema/definition-caches.d.ts.map +1 -0
- package/dist/schema/definition-caches.js +26 -0
- package/dist/schema/definition-caches.js.map +1 -0
- package/dist/schema/dependency-graph.d.ts +21 -109
- package/dist/schema/dependency-graph.d.ts.map +1 -1
- package/dist/schema/dependency-graph.js +25 -333
- package/dist/schema/dependency-graph.js.map +1 -1
- package/dist/schema/diff.d.ts +103 -0
- package/dist/schema/diff.d.ts.map +1 -0
- package/dist/schema/diff.js +329 -0
- package/dist/schema/diff.js.map +1 -0
- package/dist/schema/entity-operations.d.ts +99 -0
- package/dist/schema/entity-operations.d.ts.map +1 -0
- package/dist/schema/entity-operations.js +818 -0
- package/dist/schema/entity-operations.js.map +1 -0
- package/dist/schema/index.d.ts +28 -34
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +454 -521
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/migration.d.ts +205 -0
- package/dist/schema/migration.d.ts.map +1 -0
- package/dist/schema/migration.js +327 -0
- package/dist/schema/migration.js.map +1 -0
- package/dist/schema/nl-query-generator.d.ts +68 -0
- package/dist/schema/nl-query-generator.d.ts.map +1 -0
- package/dist/schema/nl-query-generator.js +362 -0
- package/dist/schema/nl-query-generator.js.map +1 -0
- package/dist/schema/nl-query.d.ts +65 -0
- package/dist/schema/nl-query.d.ts.map +1 -0
- package/dist/schema/nl-query.js +178 -0
- package/dist/schema/nl-query.js.map +1 -0
- package/dist/schema/parse.d.ts.map +1 -1
- package/dist/schema/parse.js +144 -89
- package/dist/schema/parse.js.map +1 -1
- package/dist/schema/provider.d.ts +37 -0
- package/dist/schema/provider.d.ts.map +1 -1
- package/dist/schema/provider.js +15 -7
- package/dist/schema/provider.js.map +1 -1
- package/dist/schema/resolve.d.ts +46 -5
- package/dist/schema/resolve.d.ts.map +1 -1
- package/dist/schema/resolve.js +237 -95
- package/dist/schema/resolve.js.map +1 -1
- package/dist/schema/search-utils.d.ts +76 -0
- package/dist/schema/search-utils.d.ts.map +1 -0
- package/dist/schema/search-utils.js +86 -0
- package/dist/schema/search-utils.js.map +1 -0
- package/dist/schema/seed.d.ts +53 -0
- package/dist/schema/seed.d.ts.map +1 -0
- package/dist/schema/seed.js +94 -0
- package/dist/schema/seed.js.map +1 -0
- package/dist/schema/semantic.d.ts +10 -0
- package/dist/schema/semantic.d.ts.map +1 -1
- package/dist/schema/semantic.js +192 -86
- package/dist/schema/semantic.js.map +1 -1
- package/dist/schema/sub-apis.d.ts +52 -0
- package/dist/schema/sub-apis.d.ts.map +1 -0
- package/dist/schema/sub-apis.js +216 -0
- package/dist/schema/sub-apis.js.map +1 -0
- package/dist/schema/system-entities.d.ts +42 -0
- package/dist/schema/system-entities.d.ts.map +1 -0
- package/dist/schema/system-entities.js +101 -0
- package/dist/schema/system-entities.js.map +1 -0
- package/dist/schema/types.d.ts +91 -9
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/union-fallback.d.ts.map +1 -1
- package/dist/schema/union-fallback.js +21 -15
- package/dist/schema/union-fallback.js.map +1 -1
- package/dist/schema/value-generators/ai.d.ts +54 -0
- package/dist/schema/value-generators/ai.d.ts.map +1 -0
- package/dist/schema/value-generators/ai.js +136 -0
- package/dist/schema/value-generators/ai.js.map +1 -0
- package/dist/schema/value-generators/index.d.ts +126 -0
- package/dist/schema/value-generators/index.d.ts.map +1 -0
- package/dist/schema/value-generators/index.js +219 -0
- package/dist/schema/value-generators/index.js.map +1 -0
- package/dist/schema/value-generators/placeholder.d.ts +52 -0
- package/dist/schema/value-generators/placeholder.d.ts.map +1 -0
- package/dist/schema/value-generators/placeholder.js +328 -0
- package/dist/schema/value-generators/placeholder.js.map +1 -0
- package/dist/schema/value-generators/types.d.ts +116 -0
- package/dist/schema/value-generators/types.d.ts.map +1 -0
- package/dist/schema/value-generators/types.js +11 -0
- package/dist/schema/value-generators/types.js.map +1 -0
- package/dist/schema/version.d.ts +111 -0
- package/dist/schema/version.d.ts.map +1 -0
- package/dist/schema/version.js +190 -0
- package/dist/schema/version.js.map +1 -0
- package/dist/schema.d.ts +1095 -24
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2852 -40
- package/dist/schema.js.map +1 -1
- package/dist/semantic-vectors.d.ts +39 -0
- package/dist/semantic-vectors.d.ts.map +1 -0
- package/dist/semantic-vectors.js +334 -0
- package/dist/semantic-vectors.js.map +1 -0
- package/dist/semantic.d.ts +29 -1
- package/dist/semantic.d.ts.map +1 -1
- package/dist/semantic.js +26 -16
- package/dist/semantic.js.map +1 -1
- package/dist/telemetry.d.ts +128 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +305 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tests.d.ts.map +1 -1
- package/dist/tests.js +30 -22
- package/dist/tests.js.map +1 -1
- package/dist/type-guards.d.ts +50 -5
- package/dist/type-guards.d.ts.map +1 -1
- package/dist/type-guards.js +87 -16
- package/dist/type-guards.js.map +1 -1
- package/dist/types.d.ts +33 -245
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +62 -72
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +2 -5
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +65 -93
- package/dist/validation.js.map +1 -1
- package/dist/worker/db-provider.d.ts +168 -0
- package/dist/worker/db-provider.d.ts.map +1 -0
- package/dist/worker/db-provider.js +277 -0
- package/dist/worker/db-provider.js.map +1 -0
- package/dist/worker/index.d.ts +35 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +37 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker.d.ts +779 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +2786 -0
- package/dist/worker.js.map +1 -0
- package/package.json +46 -16
- package/src/docs-rels/migrations/0001-init.sql +125 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/value-generators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAcH,4BAA4B;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;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ministic, context-aware placeholder values for testing.
|
|
5
|
+
* This generator uses keyword matching on context and hints to produce
|
|
6
|
+
* appropriate values for common field names.
|
|
7
|
+
*
|
|
8
|
+
* **PURPOSE**: This is a test fixture generator that provides:
|
|
9
|
+
* - Deterministic, predictable outputs for testing
|
|
10
|
+
* - Expected behavior and API contract demonstration
|
|
11
|
+
* - Specific assertions about generated content
|
|
12
|
+
*
|
|
13
|
+
* In production, the AIValueGenerator would be used instead.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import type { ValueGenerator, GenerationRequest, GenerationResult } from './types.js';
|
|
18
|
+
/**
|
|
19
|
+
* PlaceholderValueGenerator
|
|
20
|
+
*
|
|
21
|
+
* Generates deterministic values based on field name and context keywords.
|
|
22
|
+
* Used for testing and development when AI generation is not needed.
|
|
23
|
+
*/
|
|
24
|
+
export declare class PlaceholderValueGenerator implements ValueGenerator {
|
|
25
|
+
/**
|
|
26
|
+
* Generate a context-aware placeholder value
|
|
27
|
+
*
|
|
28
|
+
* Uses keyword matching on the context and hint to produce contextually
|
|
29
|
+
* relevant values for common field names.
|
|
30
|
+
*
|
|
31
|
+
* @param request - The generation request
|
|
32
|
+
* @returns Promise resolving to the generated value with metadata
|
|
33
|
+
*/
|
|
34
|
+
generate(request: GenerationRequest): Promise<GenerationResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Synchronous value generation
|
|
37
|
+
*
|
|
38
|
+
* This is the core generation logic, exposed for callers that need
|
|
39
|
+
* synchronous operation (e.g., backward-compatible cascade.ts).
|
|
40
|
+
*
|
|
41
|
+
* @param request - The generation request
|
|
42
|
+
* @returns The generated value string
|
|
43
|
+
*/
|
|
44
|
+
generateSync(request: GenerationRequest): string;
|
|
45
|
+
/**
|
|
46
|
+
* Core value generation logic
|
|
47
|
+
*
|
|
48
|
+
* Moved from cascade.ts generateContextAwareValue function.
|
|
49
|
+
*/
|
|
50
|
+
private generateValue;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=placeholder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.d.ts","sourceRoot":"","sources":["../../../src/schema/value-generators/placeholder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAErF;;;;;GAKG;AACH,qBAAa,yBAA0B,YAAW,cAAc;IAC9D;;;;;;;;OAQG;IACG,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQrE;;;;;;;;OAQG;IACH,YAAY,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAIhD;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAgTtB"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlaceholderValueGenerator Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides deterministic, context-aware placeholder values for testing.
|
|
5
|
+
* This generator uses keyword matching on context and hints to produce
|
|
6
|
+
* appropriate values for common field names.
|
|
7
|
+
*
|
|
8
|
+
* **PURPOSE**: This is a test fixture generator that provides:
|
|
9
|
+
* - Deterministic, predictable outputs for testing
|
|
10
|
+
* - Expected behavior and API contract demonstration
|
|
11
|
+
* - Specific assertions about generated content
|
|
12
|
+
*
|
|
13
|
+
* In production, the AIValueGenerator would be used instead.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* PlaceholderValueGenerator
|
|
19
|
+
*
|
|
20
|
+
* Generates deterministic values based on field name and context keywords.
|
|
21
|
+
* Used for testing and development when AI generation is not needed.
|
|
22
|
+
*/
|
|
23
|
+
export class PlaceholderValueGenerator {
|
|
24
|
+
/**
|
|
25
|
+
* Generate a context-aware placeholder value
|
|
26
|
+
*
|
|
27
|
+
* Uses keyword matching on the context and hint to produce contextually
|
|
28
|
+
* relevant values for common field names.
|
|
29
|
+
*
|
|
30
|
+
* @param request - The generation request
|
|
31
|
+
* @returns Promise resolving to the generated value with metadata
|
|
32
|
+
*/
|
|
33
|
+
async generate(request) {
|
|
34
|
+
const value = this.generateValue(request);
|
|
35
|
+
return {
|
|
36
|
+
value,
|
|
37
|
+
metadata: { source: 'placeholder' },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Synchronous value generation
|
|
42
|
+
*
|
|
43
|
+
* This is the core generation logic, exposed for callers that need
|
|
44
|
+
* synchronous operation (e.g., backward-compatible cascade.ts).
|
|
45
|
+
*
|
|
46
|
+
* @param request - The generation request
|
|
47
|
+
* @returns The generated value string
|
|
48
|
+
*/
|
|
49
|
+
generateSync(request) {
|
|
50
|
+
return this.generateValue(request);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Core value generation logic
|
|
54
|
+
*
|
|
55
|
+
* Moved from cascade.ts generateContextAwareValue function.
|
|
56
|
+
*/
|
|
57
|
+
generateValue(request) {
|
|
58
|
+
const { fieldName, type, fullContext, hint, parentData = {} } = request;
|
|
59
|
+
// If parent has the same field, copy its value (for self-referential types like Company.competitor)
|
|
60
|
+
const parentValue = parentData[fieldName];
|
|
61
|
+
if (typeof parentValue === 'string' && parentValue) {
|
|
62
|
+
return parentValue;
|
|
63
|
+
}
|
|
64
|
+
const contextLower = (fullContext || '').toLowerCase();
|
|
65
|
+
const hintLower = (hint || '').toLowerCase();
|
|
66
|
+
// For 'name' field, use hint-based generation with keyword matching
|
|
67
|
+
// Note: hint takes priority, check hint first before context
|
|
68
|
+
if (fieldName === 'name') {
|
|
69
|
+
if (hintLower.includes('philosopher') || contextLower.includes('philosopher'))
|
|
70
|
+
return 'Aristotle';
|
|
71
|
+
if (hintLower.includes('tech entrepreneur') || hintLower.includes('startup'))
|
|
72
|
+
return 'Alex Chen';
|
|
73
|
+
if (hint && hint.trim())
|
|
74
|
+
return `${type}: ${hint}`;
|
|
75
|
+
// Fall back to static placeholder if no context or hint
|
|
76
|
+
if (!fullContext || fullContext.trim() === '') {
|
|
77
|
+
return `Generated ${fieldName} for ${type}`;
|
|
78
|
+
}
|
|
79
|
+
return `Generated ${fieldName} for ${type}`;
|
|
80
|
+
}
|
|
81
|
+
// For 'style' field
|
|
82
|
+
if (fieldName === 'style') {
|
|
83
|
+
if (hintLower.includes('energetic') || contextLower.includes('energetic'))
|
|
84
|
+
return 'Energetic and engaging presentation style';
|
|
85
|
+
if (contextLower.includes('horror') || contextLower.includes('dark'))
|
|
86
|
+
return 'Dark and atmospheric horror style';
|
|
87
|
+
if (contextLower.includes('sci-fi') || contextLower.includes('futuristic'))
|
|
88
|
+
return 'Atmospheric sci-fi suspense style';
|
|
89
|
+
return `${fieldName}: ${fullContext}`;
|
|
90
|
+
}
|
|
91
|
+
// For 'background' field
|
|
92
|
+
if (fieldName === 'background') {
|
|
93
|
+
if (hintLower.includes('tech entrepreneur') || hintLower.includes('startup'))
|
|
94
|
+
return 'Tech startup founder with 10 years experience';
|
|
95
|
+
if (hintLower.includes('aristocrat') || hintLower.includes('noble'))
|
|
96
|
+
return 'English aristocrat from old noble family';
|
|
97
|
+
if (contextLower.includes('renewable') || contextLower.includes('energy'))
|
|
98
|
+
return 'Background in renewable energy sector';
|
|
99
|
+
if (!fullContext || fullContext.trim() === '') {
|
|
100
|
+
return `Generated ${fieldName} for ${type}`;
|
|
101
|
+
}
|
|
102
|
+
return `${fieldName}: ${fullContext}`;
|
|
103
|
+
}
|
|
104
|
+
// For 'specialty' field - hint takes priority over context
|
|
105
|
+
if (fieldName === 'specialty') {
|
|
106
|
+
// Check hint first for priority
|
|
107
|
+
if (hintLower.includes('security'))
|
|
108
|
+
return 'Security and authentication systems';
|
|
109
|
+
if (hintLower.includes('history') || hintLower.includes('medieval'))
|
|
110
|
+
return 'Medieval history specialist';
|
|
111
|
+
// Then check context
|
|
112
|
+
if (contextLower.includes('french') || contextLower.includes('restaurant'))
|
|
113
|
+
return 'French classical cuisine';
|
|
114
|
+
if (contextLower.includes('security'))
|
|
115
|
+
return 'Security and authentication systems';
|
|
116
|
+
if (!fullContext || fullContext.trim() === '') {
|
|
117
|
+
return `Generated ${fieldName} for ${type}`;
|
|
118
|
+
}
|
|
119
|
+
return `${fieldName}: ${fullContext}`;
|
|
120
|
+
}
|
|
121
|
+
// For 'training' field
|
|
122
|
+
if (fieldName === 'training') {
|
|
123
|
+
if (contextLower.includes('french') || contextLower.includes('restaurant'))
|
|
124
|
+
return 'Trained in classical French culinary techniques';
|
|
125
|
+
return `${fieldName}: ${fullContext}`;
|
|
126
|
+
}
|
|
127
|
+
// For 'backstory' field
|
|
128
|
+
if (fieldName === 'backstory') {
|
|
129
|
+
if (contextLower.includes('medieval') || contextLower.includes('fantasy'))
|
|
130
|
+
return 'A noble knight who served the King in the great castle, completing many quests across the kingdom';
|
|
131
|
+
if (contextLower.includes('sci-fi') || contextLower.includes('space'))
|
|
132
|
+
return 'A starship captain with years of deep space exploration';
|
|
133
|
+
return `${fieldName}: ${fullContext}`;
|
|
134
|
+
}
|
|
135
|
+
// For 'headline' field
|
|
136
|
+
if (fieldName === 'headline') {
|
|
137
|
+
// Check for name mentions in context for personalized headlines
|
|
138
|
+
if (contextLower.includes('codehelper'))
|
|
139
|
+
return 'CodeHelper: Dev Tools';
|
|
140
|
+
if (contextLower.includes('techcorp'))
|
|
141
|
+
return 'TechCorp Solutions';
|
|
142
|
+
if (contextLower.includes('software engineer'))
|
|
143
|
+
return 'For Dev Teams';
|
|
144
|
+
if (contextLower.includes('tech') || contextLower.includes('startup'))
|
|
145
|
+
return 'Tech Startup Solutions';
|
|
146
|
+
return `Headline for ${type}`.slice(0, 30);
|
|
147
|
+
}
|
|
148
|
+
// For 'copy' field
|
|
149
|
+
if (fieldName === 'copy') {
|
|
150
|
+
if (contextLower.includes('tech') || contextLower.includes('startup'))
|
|
151
|
+
return 'Innovative tech solutions for startups and growing companies';
|
|
152
|
+
if (contextLower.includes('marketing') || contextLower.includes('campaign'))
|
|
153
|
+
return 'Effective marketing campaign for tech launch';
|
|
154
|
+
return `${fieldName}: ${fullContext}`;
|
|
155
|
+
}
|
|
156
|
+
// For 'tagline' field
|
|
157
|
+
if (fieldName === 'tagline') {
|
|
158
|
+
if (contextLower.includes('luxury') || contextLower.includes('premium'))
|
|
159
|
+
return 'Luxury craftsmanship meets elegant design';
|
|
160
|
+
if (contextLower.includes('quality') || contextLower.includes('craftsmanship'))
|
|
161
|
+
return 'Premium quality with expert craftsmanship';
|
|
162
|
+
if (contextLower.includes('tech'))
|
|
163
|
+
return 'Technology for the future';
|
|
164
|
+
return `${fieldName}: ${fullContext}`;
|
|
165
|
+
}
|
|
166
|
+
// For 'description' field
|
|
167
|
+
if (fieldName === 'description') {
|
|
168
|
+
if (contextLower.includes('cyberpunk') ||
|
|
169
|
+
contextLower.includes('neon') ||
|
|
170
|
+
contextLower.includes('futuristic'))
|
|
171
|
+
return 'Cyberpunk character with neural augmentations';
|
|
172
|
+
if (contextLower.includes('luxury') ||
|
|
173
|
+
contextLower.includes('high-end') ||
|
|
174
|
+
contextLower.includes('premium'))
|
|
175
|
+
return 'A luxury premium product with elegant craftsmanship';
|
|
176
|
+
if (contextLower.includes('enterprise') || contextLower.includes('b2b'))
|
|
177
|
+
return 'Enterprise solution for business customers';
|
|
178
|
+
if (contextLower.includes('nurse') || contextLower.includes('healthcare'))
|
|
179
|
+
return 'Healthcare documentation solution for nurses and medical staff';
|
|
180
|
+
return `${fieldName}: ${fullContext}`;
|
|
181
|
+
}
|
|
182
|
+
// For 'abilities' field
|
|
183
|
+
if (fieldName === 'abilities') {
|
|
184
|
+
if (contextLower.includes('cyberpunk') || contextLower.includes('futuristic'))
|
|
185
|
+
return 'Neural hacking and digital infiltration';
|
|
186
|
+
return `${fieldName}: ${fullContext}`;
|
|
187
|
+
}
|
|
188
|
+
// For 'method' field
|
|
189
|
+
if (fieldName === 'method') {
|
|
190
|
+
if (hintLower.includes('wit') || hintLower.includes('sharp'))
|
|
191
|
+
return 'Brilliant deduction and clever observation';
|
|
192
|
+
return `${fieldName}: ${fullContext}`;
|
|
193
|
+
}
|
|
194
|
+
// For 'expertise' field - check hint first, then context
|
|
195
|
+
if (fieldName === 'expertise') {
|
|
196
|
+
// Check hint first for priority
|
|
197
|
+
if (hintLower.includes('machine learning') ||
|
|
198
|
+
hintLower.includes('medical') ||
|
|
199
|
+
hintLower.includes('ai'))
|
|
200
|
+
return 'Machine learning for medical applications';
|
|
201
|
+
if (hintLower.includes('physics') || hintLower.includes('professor'))
|
|
202
|
+
return 'Physics professor specializing in quantum mechanics';
|
|
203
|
+
if (hintLower.includes('journalist') || hintLower.includes('science'))
|
|
204
|
+
return 'Science journalist covering physics research';
|
|
205
|
+
// Then check context
|
|
206
|
+
if (contextLower.includes('machine learning') ||
|
|
207
|
+
contextLower.includes('medical') ||
|
|
208
|
+
contextLower.includes('ai'))
|
|
209
|
+
return 'Machine learning for medical applications';
|
|
210
|
+
if (!fullContext || fullContext.trim() === '') {
|
|
211
|
+
return `Generated ${fieldName} for ${type}`;
|
|
212
|
+
}
|
|
213
|
+
return `${fieldName}: ${fullContext}`;
|
|
214
|
+
}
|
|
215
|
+
// For 'focus' field
|
|
216
|
+
if (fieldName === 'focus') {
|
|
217
|
+
if (contextLower.includes('renewable') ||
|
|
218
|
+
contextLower.includes('energy') ||
|
|
219
|
+
contextLower.includes('green'))
|
|
220
|
+
return 'Focus on sustainable energy transformation';
|
|
221
|
+
if (contextLower.includes('tech') || contextLower.includes('programming'))
|
|
222
|
+
return 'Focus on technical programming topics';
|
|
223
|
+
return `${fieldName}: ${fullContext}`;
|
|
224
|
+
}
|
|
225
|
+
// For 'qualifications' field
|
|
226
|
+
if (fieldName === 'qualifications') {
|
|
227
|
+
if (contextLower.includes('astrophysics') ||
|
|
228
|
+
contextLower.includes('astronomy') ||
|
|
229
|
+
contextLower.includes('space'))
|
|
230
|
+
return 'PhD in Astrophysics from MIT';
|
|
231
|
+
return `${fieldName}: ${fullContext}`;
|
|
232
|
+
}
|
|
233
|
+
// For 'teachingStyle' field
|
|
234
|
+
if (fieldName === 'teachingStyle') {
|
|
235
|
+
if (contextLower.includes('beginner') || contextLower.includes('introduct'))
|
|
236
|
+
return 'Patient and accessible approach for beginners';
|
|
237
|
+
return `${fieldName}: ${fullContext}`;
|
|
238
|
+
}
|
|
239
|
+
// For 'experience' field
|
|
240
|
+
if (fieldName === 'experience') {
|
|
241
|
+
if (contextLower.includes('horror') || contextLower.includes('film'))
|
|
242
|
+
return 'Experience in horror film production';
|
|
243
|
+
return `${fieldName}: ${fullContext}`;
|
|
244
|
+
}
|
|
245
|
+
// For 'role' field
|
|
246
|
+
if (fieldName === 'role') {
|
|
247
|
+
if (hintLower.includes('research') ||
|
|
248
|
+
hintLower.includes('machine learning') ||
|
|
249
|
+
hintLower.includes('phd'))
|
|
250
|
+
return 'Machine learning researcher';
|
|
251
|
+
return `${fieldName}: ${fullContext}`;
|
|
252
|
+
}
|
|
253
|
+
// For 'portfolio' field
|
|
254
|
+
if (fieldName === 'portfolio') {
|
|
255
|
+
if (hintLower.includes('award') ||
|
|
256
|
+
hintLower.includes('beaux-arts') ||
|
|
257
|
+
hintLower.includes('ecole'))
|
|
258
|
+
return 'Award-winning design portfolio from Beaux-Arts';
|
|
259
|
+
return `${fieldName}: ${fullContext}`;
|
|
260
|
+
}
|
|
261
|
+
// For 'challenges' field
|
|
262
|
+
if (fieldName === 'challenges') {
|
|
263
|
+
if (contextLower.includes('enterprise') || contextLower.includes('software'))
|
|
264
|
+
return 'Budget constraints and decision-making complexity in enterprise software procurement';
|
|
265
|
+
if (contextLower.includes('startup') || contextLower.includes('tech'))
|
|
266
|
+
return 'Scaling challenges and market competition in tech startup growth';
|
|
267
|
+
return `${fieldName}: ${fullContext}`;
|
|
268
|
+
}
|
|
269
|
+
// For 'severity' field - return one of the enum options
|
|
270
|
+
if (fieldName === 'severity') {
|
|
271
|
+
// Check hint for enum options like 'low/medium/high'
|
|
272
|
+
if (hintLower.includes('low') || hintLower.includes('medium') || hintLower.includes('high')) {
|
|
273
|
+
// Return a contextually appropriate severity
|
|
274
|
+
if (contextLower.includes('critical') || contextLower.includes('urgent'))
|
|
275
|
+
return 'high';
|
|
276
|
+
if (contextLower.includes('minor') || contextLower.includes('small'))
|
|
277
|
+
return 'low';
|
|
278
|
+
return 'medium'; // default to medium
|
|
279
|
+
}
|
|
280
|
+
return 'medium';
|
|
281
|
+
}
|
|
282
|
+
// For 'effort' field - return one of the enum options
|
|
283
|
+
if (fieldName === 'effort') {
|
|
284
|
+
if (hintLower.includes('easy') ||
|
|
285
|
+
hintLower.includes('medium') ||
|
|
286
|
+
hintLower.includes('hard')) {
|
|
287
|
+
if (contextLower.includes('simple') || contextLower.includes('quick'))
|
|
288
|
+
return 'easy';
|
|
289
|
+
if (contextLower.includes('complex') || contextLower.includes('difficult'))
|
|
290
|
+
return 'hard';
|
|
291
|
+
return 'medium';
|
|
292
|
+
}
|
|
293
|
+
return 'medium';
|
|
294
|
+
}
|
|
295
|
+
// For 'level' field - return one of the enum options
|
|
296
|
+
if (fieldName === 'level') {
|
|
297
|
+
if (hintLower.includes('beginner') ||
|
|
298
|
+
hintLower.includes('intermediate') ||
|
|
299
|
+
hintLower.includes('expert')) {
|
|
300
|
+
if (contextLower.includes('beginner') || contextLower.includes('basic'))
|
|
301
|
+
return 'beginner';
|
|
302
|
+
if (contextLower.includes('expert') || contextLower.includes('advanced'))
|
|
303
|
+
return 'expert';
|
|
304
|
+
return 'intermediate';
|
|
305
|
+
}
|
|
306
|
+
return 'intermediate';
|
|
307
|
+
}
|
|
308
|
+
// For 'persona' field
|
|
309
|
+
if (fieldName === 'persona') {
|
|
310
|
+
if (contextLower.includes('enterprise') || contextLower.includes('software'))
|
|
311
|
+
return 'Enterprise software buyer persona';
|
|
312
|
+
if (contextLower.includes('tech') || contextLower.includes('startup'))
|
|
313
|
+
return 'Tech-savvy startup founder persona';
|
|
314
|
+
return `${fieldName}: ${fullContext}`;
|
|
315
|
+
}
|
|
316
|
+
// For 'jobTitle' field
|
|
317
|
+
if (fieldName === 'jobTitle') {
|
|
318
|
+
if (contextLower.includes('enterprise') || contextLower.includes('software'))
|
|
319
|
+
return 'VP of Engineering';
|
|
320
|
+
if (contextLower.includes('tech') || contextLower.includes('startup'))
|
|
321
|
+
return 'CTO';
|
|
322
|
+
return `${fieldName}: ${fullContext}`;
|
|
323
|
+
}
|
|
324
|
+
// Default: include context in the generated value
|
|
325
|
+
return `${fieldName}: ${fullContext}`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../src/schema/value-generators/placeholder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IACpC;;;;;;;;OAQG;IACH,KAAK,CAAC,QAAQ,CAAC,OAA0B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QACzC,OAAO;YACL,KAAK;YACL,QAAQ,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;SACpC,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,OAA0B;QACrC,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,OAA0B;QAC9C,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;QAEvE,oGAAoG;QACpG,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;QACzC,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,EAAE,CAAC;YACnD,OAAO,WAAW,CAAA;QACpB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
|
+
* ValueGenerator Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Defines the interface for value generation strategies used during
|
|
5
|
+
* entity creation. Supports both placeholder (deterministic test fixtures)
|
|
6
|
+
* and AI-powered (production) generation.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import type { Entity } from '../generation-context.js';
|
|
11
|
+
/**
|
|
12
|
+
* Context about the array field being generated
|
|
13
|
+
*/
|
|
14
|
+
export interface ArrayContext {
|
|
15
|
+
/** The name of the array field */
|
|
16
|
+
fieldName: string;
|
|
17
|
+
/** Previously generated items in this array */
|
|
18
|
+
previousItems: Entity[];
|
|
19
|
+
/** Current index being generated */
|
|
20
|
+
index: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Extended generation context from GenerationContext
|
|
24
|
+
*/
|
|
25
|
+
export interface GenerationContextData {
|
|
26
|
+
/** Chain of parent entities leading to this entity */
|
|
27
|
+
parentChain?: Entity[];
|
|
28
|
+
/** All entities previously generated in this session */
|
|
29
|
+
previouslyGenerated?: Entity[];
|
|
30
|
+
/** Context for array field generation */
|
|
31
|
+
arrayContext?: ArrayContext;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Request for generating a field value
|
|
35
|
+
*/
|
|
36
|
+
export interface GenerationRequest {
|
|
37
|
+
/** Name of the field being generated */
|
|
38
|
+
fieldName: string;
|
|
39
|
+
/** Entity type name */
|
|
40
|
+
type: string;
|
|
41
|
+
/** Combined context string (instructions, parent data, etc.) */
|
|
42
|
+
fullContext?: string;
|
|
43
|
+
/** Optional hint for guiding generation (e.g., prompt field type) */
|
|
44
|
+
hint?: string;
|
|
45
|
+
/** Data from parent entity for context inheritance */
|
|
46
|
+
parentData?: Record<string, unknown>;
|
|
47
|
+
/** Extended generation context with parent chain and array info */
|
|
48
|
+
generationContext?: GenerationContextData;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Metadata about how the value was generated
|
|
52
|
+
*/
|
|
53
|
+
export interface GenerationMetadata {
|
|
54
|
+
/** Source of the generated value */
|
|
55
|
+
source: 'placeholder' | 'ai' | 'test';
|
|
56
|
+
/** Model used for AI generation */
|
|
57
|
+
model?: string;
|
|
58
|
+
/** Token count for AI generation */
|
|
59
|
+
tokens?: number;
|
|
60
|
+
/** Whether the result was cached */
|
|
61
|
+
cached?: boolean;
|
|
62
|
+
/** Whether this was a fallback from AI to placeholder */
|
|
63
|
+
fallback?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Result of value generation
|
|
67
|
+
*/
|
|
68
|
+
export interface GenerationResult {
|
|
69
|
+
/** The generated value */
|
|
70
|
+
value: string;
|
|
71
|
+
/** Optional metadata about generation */
|
|
72
|
+
metadata?: GenerationMetadata;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Interface for value generation strategies
|
|
76
|
+
*
|
|
77
|
+
* Implementations provide different generation approaches:
|
|
78
|
+
* - PlaceholderValueGenerator: Deterministic values for testing
|
|
79
|
+
* - AIValueGenerator: AI-powered contextual generation
|
|
80
|
+
*/
|
|
81
|
+
export interface ValueGenerator {
|
|
82
|
+
/**
|
|
83
|
+
* Generate a value for a field
|
|
84
|
+
*
|
|
85
|
+
* @param request - The generation request with field info and context
|
|
86
|
+
* @returns Promise resolving to the generated value and metadata
|
|
87
|
+
*/
|
|
88
|
+
generate(request: GenerationRequest): Promise<GenerationResult>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* AI function signature for value generation
|
|
92
|
+
*/
|
|
93
|
+
export type AIFunction = (prompt: string) => Promise<{
|
|
94
|
+
text: string;
|
|
95
|
+
usage?: {
|
|
96
|
+
tokens: number;
|
|
97
|
+
};
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Configuration for creating a ValueGenerator
|
|
101
|
+
*/
|
|
102
|
+
export interface ValueGeneratorConfig {
|
|
103
|
+
/** Type of generator to create */
|
|
104
|
+
type?: 'placeholder' | 'ai';
|
|
105
|
+
/** AI function for AI generator (required when type is 'ai') */
|
|
106
|
+
aiFunction?: AIFunction;
|
|
107
|
+
/** Model to use for AI generation */
|
|
108
|
+
model?: string;
|
|
109
|
+
/** Maximum tokens for AI generation */
|
|
110
|
+
maxTokens?: number;
|
|
111
|
+
/** Temperature for AI generation */
|
|
112
|
+
temperature?: number;
|
|
113
|
+
/** Whether to fall back to placeholder on AI errors */
|
|
114
|
+
fallbackToPlaceholder?: boolean;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/schema/value-generators/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAMtD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,wDAAwD;IACxD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,yCAAyC;IACzC,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAA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;CAChC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ValueGenerator Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Defines the interface for value generation strategies used during
|
|
5
|
+
* entity creation. Supports both placeholder (deterministic test fixtures)
|
|
6
|
+
* and AI-powered (production) generation.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/schema/value-generators/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema Version Tracking
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for tracking schema versions, computing schema hashes,
|
|
5
|
+
* and storing/retrieving version metadata from the database.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { DatabaseSchema } from '../types.js';
|
|
10
|
+
import type { DBProvider } from './provider.js';
|
|
11
|
+
/**
|
|
12
|
+
* Schema version metadata stored in the database
|
|
13
|
+
*/
|
|
14
|
+
export interface SchemaVersionInfo {
|
|
15
|
+
/** The version number (incremented on each migration) */
|
|
16
|
+
version: number;
|
|
17
|
+
/** Hash of the schema structure for change detection */
|
|
18
|
+
schemaHash: string;
|
|
19
|
+
/** When this version was applied */
|
|
20
|
+
appliedAt?: string;
|
|
21
|
+
/** Description of the migration (if any) */
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Compute a deterministic hash of a database schema
|
|
26
|
+
*
|
|
27
|
+
* The hash is computed by:
|
|
28
|
+
* 1. Sorting entity names alphabetically
|
|
29
|
+
* 2. For each entity, sorting field names alphabetically
|
|
30
|
+
* 3. Creating a normalized JSON representation
|
|
31
|
+
* 4. Computing a hash of the JSON string
|
|
32
|
+
*
|
|
33
|
+
* This ensures the same schema always produces the same hash,
|
|
34
|
+
* regardless of property insertion order in the original object.
|
|
35
|
+
*
|
|
36
|
+
* @param schema - The database schema to hash
|
|
37
|
+
* @returns A hex string hash of the schema
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const hash = computeSchemaHash({
|
|
42
|
+
* User: { name: 'string', email: 'string' },
|
|
43
|
+
* Post: { title: 'string', author: 'User.posts' }
|
|
44
|
+
* })
|
|
45
|
+
* // => '8a7b3c9d...'
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function computeSchemaHash(schema: DatabaseSchema): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get the current schema version from the database
|
|
51
|
+
*
|
|
52
|
+
* Reads the _schema_meta entity to retrieve the current schema version
|
|
53
|
+
* and hash. Returns null if no version has been set yet (first run).
|
|
54
|
+
*
|
|
55
|
+
* @param provider - The database provider
|
|
56
|
+
* @returns The current schema version info, or null if not set
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const version = await getSchemaVersion(provider)
|
|
61
|
+
* if (version) {
|
|
62
|
+
* console.log(`Current version: ${version.version}`)
|
|
63
|
+
* console.log(`Schema hash: ${version.schemaHash}`)
|
|
64
|
+
* } else {
|
|
65
|
+
* console.log('No schema version set - first run')
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function getSchemaVersion(provider: DBProvider): Promise<SchemaVersionInfo | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Set the schema version in the database
|
|
72
|
+
*
|
|
73
|
+
* Stores the schema version and hash as a _schema_meta entity.
|
|
74
|
+
* Creates the entity if it doesn't exist, or updates it if it does.
|
|
75
|
+
*
|
|
76
|
+
* @param provider - The database provider
|
|
77
|
+
* @param version - The new version number
|
|
78
|
+
* @param schemaHash - The hash of the current schema
|
|
79
|
+
* @param description - Optional description of the migration
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* await setSchemaVersion(provider, 1, 'abc123', 'Initial schema')
|
|
84
|
+
* await setSchemaVersion(provider, 2, 'def456', 'Added email field to User')
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function setSchemaVersion(provider: DBProvider, version: number, schemaHash: string, description?: string): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Check if the schema has changed since the last recorded version
|
|
90
|
+
*
|
|
91
|
+
* Compares the current schema hash with the stored hash to detect changes.
|
|
92
|
+
*
|
|
93
|
+
* @param provider - The database provider
|
|
94
|
+
* @param schema - The current schema definition
|
|
95
|
+
* @returns Object with changed status and hashes
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const { changed, currentHash, storedHash } = await hasSchemaChanged(provider, schema)
|
|
100
|
+
* if (changed) {
|
|
101
|
+
* console.log('Schema has changed, migration may be needed')
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function hasSchemaChanged(provider: DBProvider, schema: DatabaseSchema): Promise<{
|
|
106
|
+
changed: boolean;
|
|
107
|
+
currentHash: string;
|
|
108
|
+
storedHash: string | null;
|
|
109
|
+
storedVersion: number | null;
|
|
110
|
+
}>;
|
|
111
|
+
//# sourceMappingURL=version.d.ts.map
|