ai-database 0.0.0-development → 0.2.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/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-test.log +102 -0
- package/README.md +402 -47
- package/TESTING.md +410 -0
- package/TEST_SUMMARY.md +250 -0
- package/TODO.md +128 -0
- package/dist/ai-promise-db.d.ts +370 -0
- package/dist/ai-promise-db.d.ts.map +1 -0
- package/dist/ai-promise-db.js +839 -0
- package/dist/ai-promise-db.js.map +1 -0
- package/dist/authorization.d.ts +531 -0
- package/dist/authorization.d.ts.map +1 -0
- package/dist/authorization.js +632 -0
- package/dist/authorization.js.map +1 -0
- package/dist/durable-clickhouse.d.ts +193 -0
- package/dist/durable-clickhouse.d.ts.map +1 -0
- package/dist/durable-clickhouse.js +422 -0
- package/dist/durable-clickhouse.js.map +1 -0
- package/dist/durable-promise.d.ts +182 -0
- package/dist/durable-promise.d.ts.map +1 -0
- package/dist/durable-promise.js +409 -0
- package/dist/durable-promise.js.map +1 -0
- package/dist/execution-queue.d.ts +239 -0
- package/dist/execution-queue.d.ts.map +1 -0
- package/dist/execution-queue.js +400 -0
- package/dist/execution-queue.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/linguistic.d.ts +115 -0
- package/dist/linguistic.d.ts.map +1 -0
- package/dist/linguistic.js +379 -0
- package/dist/linguistic.js.map +1 -0
- package/dist/memory-provider.d.ts +304 -0
- package/dist/memory-provider.d.ts.map +1 -0
- package/dist/memory-provider.js +785 -0
- package/dist/memory-provider.js.map +1 -0
- package/dist/schema.d.ts +899 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +1165 -0
- package/dist/schema.js.map +1 -0
- package/dist/tests.d.ts +107 -0
- package/dist/tests.d.ts.map +1 -0
- package/dist/tests.js +568 -0
- package/dist/tests.js.map +1 -0
- package/dist/types.d.ts +972 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +126 -0
- package/dist/types.js.map +1 -0
- package/package.json +37 -23
- package/src/ai-promise-db.ts +1243 -0
- package/src/authorization.ts +1102 -0
- package/src/durable-clickhouse.ts +596 -0
- package/src/durable-promise.ts +582 -0
- package/src/execution-queue.ts +608 -0
- package/src/index.test.ts +868 -0
- package/src/index.ts +337 -0
- package/src/linguistic.ts +404 -0
- package/src/memory-provider.test.ts +1036 -0
- package/src/memory-provider.ts +1119 -0
- package/src/schema.test.ts +1254 -0
- package/src/schema.ts +2296 -0
- package/src/tests.ts +725 -0
- package/src/types.ts +1177 -0
- package/test/README.md +153 -0
- package/test/edge-cases.test.ts +646 -0
- package/test/provider-resolution.test.ts +402 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +19 -0
- package/LICENSE +0 -21
- package/dist/types/database.d.ts +0 -46
- package/dist/types/document.d.ts +0 -15
- package/dist/types/index.d.ts +0 -5
- package/dist/types/mdxdb/embedding.d.ts +0 -7
- package/dist/types/mdxdb/types.d.ts +0 -59
- package/dist/types/synthetic.d.ts +0 -9
- package/dist/types/tools.d.ts +0 -10
- package/dist/types/vector.d.ts +0 -16
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ai-database - Schema-first database with promise pipelining
|
|
3
|
+
*
|
|
4
|
+
* Supports both direct and destructured usage:
|
|
5
|
+
*
|
|
6
|
+
* @example Direct usage - everything on one object
|
|
7
|
+
* ```ts
|
|
8
|
+
* const { db } = DB({
|
|
9
|
+
* Lead: {
|
|
10
|
+
* name: 'string',
|
|
11
|
+
* company: 'Company.leads',
|
|
12
|
+
* },
|
|
13
|
+
* Company: {
|
|
14
|
+
* name: 'string',
|
|
15
|
+
* }
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* // Chain without await
|
|
19
|
+
* const leads = db.Lead.list()
|
|
20
|
+
* const qualified = await leads.filter(l => l.score > 80)
|
|
21
|
+
*
|
|
22
|
+
* // Batch relationship loading
|
|
23
|
+
* const withCompanies = await leads.map(l => ({
|
|
24
|
+
* name: l.name,
|
|
25
|
+
* company: l.company, // Batch loaded!
|
|
26
|
+
* }))
|
|
27
|
+
*
|
|
28
|
+
* // Natural language queries
|
|
29
|
+
* const results = await db.Lead`who closed deals this month?`
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Provider is resolved transparently from environment (DATABASE_URL).
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
export { DB } from './schema.js';
|
|
37
|
+
export type { ThingFlat, ThingExpanded, DatabaseSchema, EntitySchema, FieldDefinition, PrimitiveType, ParsedSchema, ParsedEntity, ParsedField, TypedDB, EntityOperations, PipelineEntityOperations, DBProvider, ListOptions, SearchOptions, InferEntity, GenerateOptions, DBResult, Noun, NounProperty, NounRelationship, Verb, TypeMeta, EventsAPI, ActionsAPI, ArtifactsAPI, NounsAPI, VerbsAPI, DBEvent, ActorData, CreateEventOptions as DBCreateEventOptions, DBAction, CreateActionOptions as DBCreateActionOptions, DBArtifact, NLQueryResult, NLQueryFn, NLQueryGenerator, NLQueryContext, NLQueryPlan, EntityId, Thing, Relationship, QueryOptions, ThingSearchOptions, CreateOptions, UpdateOptions, RelateOptions, StoreArtifactOptions, EventQueryOptions, ActionQueryOptions, ActionStatus, ArtifactType, DBClient, DBClientExtended, } from './schema.js';
|
|
38
|
+
export type { CreateEventOptions, CreateActionOptions, } from './types.js';
|
|
39
|
+
export { toExpanded, toFlat, setProvider, setNLQueryGenerator, parseSchema, defineNoun, defineVerb, nounToSchema, Verbs, conjugate, pluralize, singularize, inferNoun, Type, resolveUrl, resolveShortUrl, parseUrl, } from './schema.js';
|
|
40
|
+
export { MemoryProvider, createMemoryProvider, Semaphore, } from './memory-provider.js';
|
|
41
|
+
export type { Event as MemoryEvent, Action as MemoryAction, Artifact as MemoryArtifact, MemoryProviderOptions, } from './memory-provider.js';
|
|
42
|
+
export type { Event, Action, Artifact } from './schema.js';
|
|
43
|
+
export { DBPromise, isDBPromise, getRawDBPromise, createListPromise, createEntityPromise, createSearchPromise, wrapEntityOperations, DB_PROMISE_SYMBOL, RAW_DB_PROMISE_SYMBOL, } from './ai-promise-db.js';
|
|
44
|
+
export type { DBPromiseOptions, ForEachOptions, ForEachResult, ForEachProgress, ForEachErrorAction, } from './ai-promise-db.js';
|
|
45
|
+
export type { Subject, SubjectType, Resource, ResourceRef, ResourceType, Permission, Role, RoleLevel, Assignment, AssignmentInput, AuthzCheckRequest, AuthzCheckResult, AuthzBatchCheckRequest, AuthzBatchCheckResult, ResourceHierarchy, AuthorizedNoun, BusinessRole, AuthorizationEngine, } from './authorization.js';
|
|
46
|
+
export { StandardHierarchies, StandardPermissions, CRUDPermissions, createStandardRoles, verbPermission, nounPermissions, matchesPermission, parseSubject, formatSubject, parseResource, formatResource, subjectMatches, resourceMatches, authorizeNoun, linkBusinessRole, InMemoryAuthorizationEngine, RoleNoun, AssignmentNoun, PermissionNoun, AuthorizationNouns, } from './authorization.js';
|
|
47
|
+
export type { Document, DocWithScore, DocListOptions, DocListResult, DocSearchOptions, DocSearchResult, DocGetOptions, DocSetOptions, DocSetResult, DocDeleteOptions, DocDeleteResult, DocumentDatabase, DocumentDatabaseConfig, CreateDocumentDatabase, DocumentDatabaseWithViews, ViewEntityItem, ViewComponent, ViewDocument, ViewContext, ViewRenderResult, ViewRelationshipMutation, ViewSyncResult, ViewManager, } from './types.js';
|
|
48
|
+
export { DurablePromise, isDurablePromise, durable, DURABLE_PROMISE_SYMBOL, getCurrentContext, withContext, setDefaultContext, getBatchScheduler, setBatchScheduler, } from './durable-promise.js';
|
|
49
|
+
export type { ExecutionPriority, DurablePromiseOptions, DurablePromiseResult, BatchScheduler, } from './durable-promise.js';
|
|
50
|
+
export { ExecutionQueue, createExecutionQueue, getDefaultQueue, setDefaultQueue, } from './execution-queue.js';
|
|
51
|
+
export type { ExecutionQueueOptions, QueueStats, BatchSubmission, BatchProvider, BatchRequest, BatchStatus, BatchResult, } from './execution-queue.js';
|
|
52
|
+
export { ClickHouseDurableProvider, createClickHouseDurableProvider, } from './durable-clickhouse.js';
|
|
53
|
+
export type { ClickHouseExecutor, ClickHouseDurableConfig, } from './durable-clickhouse.js';
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,YAAY,EAEV,SAAS,EACT,aAAa,EAEb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EAEf,QAAQ,EAER,IAAI,EACJ,YAAY,EACZ,gBAAgB,EAChB,IAAI,EACJ,QAAQ,EAER,SAAS,EACT,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EAER,OAAO,EACP,SAAS,EACT,kBAAkB,IAAI,oBAAoB,EAE1C,QAAQ,EACR,mBAAmB,IAAI,qBAAqB,EAE5C,UAAU,EAEV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,WAAW,EAEX,QAAQ,EACR,KAAK,EACL,YAAY,EAEZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EAEb,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,YAAY,EAEZ,QAAQ,EACR,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAIpB,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAA;AAEnB,OAAO,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2BAA2B,EAG3B,QAAQ,EACR,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAI3B,YAAY,EAEV,QAAQ,EACR,YAAY,EAEZ,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EAEf,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EAEf,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EAEzB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,YAAY,CAAA;AAOnB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,sBAAsB,EAEtB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EAEjB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAE7B,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,GAChB,MAAM,sBAAsB,CAAA;AAE7B,YAAY,EACV,qBAAqB,EACrB,UAAU,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EACL,yBAAyB,EACzB,+BAA+B,GAChC,MAAM,yBAAyB,CAAA;AAEhC,YAAY,EACV,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ai-database - Schema-first database with promise pipelining
|
|
3
|
+
*
|
|
4
|
+
* Supports both direct and destructured usage:
|
|
5
|
+
*
|
|
6
|
+
* @example Direct usage - everything on one object
|
|
7
|
+
* ```ts
|
|
8
|
+
* const { db } = DB({
|
|
9
|
+
* Lead: {
|
|
10
|
+
* name: 'string',
|
|
11
|
+
* company: 'Company.leads',
|
|
12
|
+
* },
|
|
13
|
+
* Company: {
|
|
14
|
+
* name: 'string',
|
|
15
|
+
* }
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* // Chain without await
|
|
19
|
+
* const leads = db.Lead.list()
|
|
20
|
+
* const qualified = await leads.filter(l => l.score > 80)
|
|
21
|
+
*
|
|
22
|
+
* // Batch relationship loading
|
|
23
|
+
* const withCompanies = await leads.map(l => ({
|
|
24
|
+
* name: l.name,
|
|
25
|
+
* company: l.company, // Batch loaded!
|
|
26
|
+
* }))
|
|
27
|
+
*
|
|
28
|
+
* // Natural language queries
|
|
29
|
+
* const results = await db.Lead`who closed deals this month?`
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Provider is resolved transparently from environment (DATABASE_URL).
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
export { DB } from './schema.js';
|
|
37
|
+
export {
|
|
38
|
+
// Thing conversion utilities
|
|
39
|
+
toExpanded, toFlat,
|
|
40
|
+
// Configuration
|
|
41
|
+
setProvider, setNLQueryGenerator,
|
|
42
|
+
// Schema parsing
|
|
43
|
+
parseSchema,
|
|
44
|
+
// Schema Definition
|
|
45
|
+
defineNoun, defineVerb, nounToSchema, Verbs,
|
|
46
|
+
// AI Inference
|
|
47
|
+
conjugate, pluralize, singularize, inferNoun, Type,
|
|
48
|
+
// URL utilities
|
|
49
|
+
resolveUrl, resolveShortUrl, parseUrl, } from './schema.js';
|
|
50
|
+
export { MemoryProvider, createMemoryProvider, Semaphore, } from './memory-provider.js';
|
|
51
|
+
// Promise pipelining exports
|
|
52
|
+
export { DBPromise, isDBPromise, getRawDBPromise, createListPromise, createEntityPromise, createSearchPromise, wrapEntityOperations, DB_PROMISE_SYMBOL, RAW_DB_PROMISE_SYMBOL, } from './ai-promise-db.js';
|
|
53
|
+
export {
|
|
54
|
+
// Standard definitions
|
|
55
|
+
StandardHierarchies, StandardPermissions, CRUDPermissions, createStandardRoles,
|
|
56
|
+
// Verb-scoped permissions
|
|
57
|
+
verbPermission, nounPermissions, matchesPermission,
|
|
58
|
+
// Helper functions
|
|
59
|
+
parseSubject, formatSubject, parseResource, formatResource, subjectMatches, resourceMatches,
|
|
60
|
+
// Schema integration
|
|
61
|
+
authorizeNoun, linkBusinessRole,
|
|
62
|
+
// In-memory engine
|
|
63
|
+
InMemoryAuthorizationEngine,
|
|
64
|
+
// Nouns
|
|
65
|
+
RoleNoun, AssignmentNoun, PermissionNoun, AuthorizationNouns, } from './authorization.js';
|
|
66
|
+
// =============================================================================
|
|
67
|
+
// Durable Promise - Time-agnostic execution
|
|
68
|
+
// =============================================================================
|
|
69
|
+
// Core durable promise exports
|
|
70
|
+
export { DurablePromise, isDurablePromise, durable, DURABLE_PROMISE_SYMBOL,
|
|
71
|
+
// Context management
|
|
72
|
+
getCurrentContext, withContext, setDefaultContext,
|
|
73
|
+
// Batch scheduler
|
|
74
|
+
getBatchScheduler, setBatchScheduler, } from './durable-promise.js';
|
|
75
|
+
// Execution queue for priority-based scheduling
|
|
76
|
+
export { ExecutionQueue, createExecutionQueue, getDefaultQueue, setDefaultQueue, } from './execution-queue.js';
|
|
77
|
+
// ClickHouse-backed durable provider
|
|
78
|
+
export { ClickHouseDurableProvider, createClickHouseDurableProvider, } from './durable-clickhouse.js';
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AA8EhC,OAAO;AACL,6BAA6B;AAC7B,UAAU,EACV,MAAM;AACN,gBAAgB;AAChB,WAAW,EACX,mBAAmB;AACnB,iBAAiB;AACjB,WAA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,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linguistic Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utilities for verb conjugation, noun pluralization, and linguistic inference.
|
|
5
|
+
* Used for auto-generating forms, events, and semantic metadata.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { Verbs, type Noun, type Verb, type TypeMeta } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Auto-conjugate a verb from just the base form
|
|
12
|
+
*
|
|
13
|
+
* Given just "publish", generates all forms:
|
|
14
|
+
* - actor: publisher
|
|
15
|
+
* - act: publishes
|
|
16
|
+
* - activity: publishing
|
|
17
|
+
* - result: publication
|
|
18
|
+
* - reverse: { at: publishedAt, by: publishedBy, ... }
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* conjugate('publish')
|
|
23
|
+
* // => { action: 'publish', actor: 'publisher', act: 'publishes', activity: 'publishing', ... }
|
|
24
|
+
*
|
|
25
|
+
* conjugate('create')
|
|
26
|
+
* // => { action: 'create', actor: 'creator', act: 'creates', activity: 'creating', ... }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function conjugate(action: string): Verb;
|
|
30
|
+
/**
|
|
31
|
+
* Auto-pluralize a noun
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* pluralize('post') // => 'posts'
|
|
36
|
+
* pluralize('category') // => 'categories'
|
|
37
|
+
* pluralize('person') // => 'people'
|
|
38
|
+
* pluralize('child') // => 'children'
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function pluralize(singular: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Auto-singularize a noun (reverse of pluralize)
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* singularize('posts') // => 'post'
|
|
48
|
+
* singularize('categories') // => 'category'
|
|
49
|
+
* singularize('people') // => 'person'
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function singularize(plural: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Infer a complete Noun from just a type name
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* inferNoun('BlogPost')
|
|
59
|
+
* // => { singular: 'blog post', plural: 'blog posts', ... }
|
|
60
|
+
*
|
|
61
|
+
* inferNoun('Category')
|
|
62
|
+
* // => { singular: 'category', plural: 'categories', ... }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function inferNoun(typeName: string): Noun;
|
|
66
|
+
/**
|
|
67
|
+
* Create TypeMeta from a type name - all linguistic forms auto-inferred
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const meta = createTypeMeta('BlogPost')
|
|
72
|
+
* meta.singular // 'blog post'
|
|
73
|
+
* meta.plural // 'blog posts'
|
|
74
|
+
* meta.slug // 'blog-post'
|
|
75
|
+
* meta.created // 'BlogPost.created'
|
|
76
|
+
* meta.createdAt // 'createdAt'
|
|
77
|
+
* meta.creator // 'creator'
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function createTypeMeta(typeName: string): TypeMeta;
|
|
81
|
+
/**
|
|
82
|
+
* Get or create TypeMeta for a type name (cached)
|
|
83
|
+
*/
|
|
84
|
+
export declare function getTypeMeta(typeName: string): TypeMeta;
|
|
85
|
+
/**
|
|
86
|
+
* Type proxy - provides dynamic access to type metadata
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const Post = Type('Post')
|
|
91
|
+
* Post.singular // 'post'
|
|
92
|
+
* Post.plural // 'posts'
|
|
93
|
+
* Post.created // 'Post.created'
|
|
94
|
+
*
|
|
95
|
+
* // In event handlers:
|
|
96
|
+
* on.create(thing => {
|
|
97
|
+
* console.log(thing.$type.plural) // 'posts'
|
|
98
|
+
* })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function Type(name: string): TypeMeta;
|
|
102
|
+
/**
|
|
103
|
+
* Get reverse property names for a verb action
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* getVerbFields('create')
|
|
108
|
+
* // => { at: 'createdAt', by: 'createdBy', in: 'createdIn', for: 'createdFor' }
|
|
109
|
+
*
|
|
110
|
+
* getVerbFields('publish')
|
|
111
|
+
* // => { at: 'publishedAt', by: 'publishedBy' }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare function getVerbFields(action: keyof typeof Verbs): Record<string, string>;
|
|
115
|
+
//# sourceMappingURL=linguistic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linguistic.d.ts","sourceRoot":"","sources":["../src/linguistic.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAA;AA0GvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAsB9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAsDlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAoDlD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAWhD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAwBzD;AAKD;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAOtD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAE3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,OAAO,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEhF"}
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linguistic Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utilities for verb conjugation, noun pluralization, and linguistic inference.
|
|
5
|
+
* Used for auto-generating forms, events, and semantic metadata.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { Verbs } from './types.js';
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Internal Helpers
|
|
12
|
+
// =============================================================================
|
|
13
|
+
function capitalize(s) {
|
|
14
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
15
|
+
}
|
|
16
|
+
function preserveCase(original, replacement) {
|
|
17
|
+
if (original[0] === original[0]?.toUpperCase()) {
|
|
18
|
+
return capitalize(replacement);
|
|
19
|
+
}
|
|
20
|
+
return replacement;
|
|
21
|
+
}
|
|
22
|
+
function isVowel(char) {
|
|
23
|
+
return char ? 'aeiou'.includes(char.toLowerCase()) : false;
|
|
24
|
+
}
|
|
25
|
+
function splitCamelCase(s) {
|
|
26
|
+
return s.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');
|
|
27
|
+
}
|
|
28
|
+
/** Check if we should double the final consonant (CVC pattern) */
|
|
29
|
+
function shouldDoubleConsonant(verb) {
|
|
30
|
+
if (verb.length < 2)
|
|
31
|
+
return false;
|
|
32
|
+
const last = verb[verb.length - 1];
|
|
33
|
+
const secondLast = verb[verb.length - 2];
|
|
34
|
+
// Don't double w, x, y
|
|
35
|
+
if ('wxy'.includes(last))
|
|
36
|
+
return false;
|
|
37
|
+
// Must end in consonant preceded by vowel
|
|
38
|
+
if (isVowel(last) || !isVowel(secondLast))
|
|
39
|
+
return false;
|
|
40
|
+
// Common verbs that double the final consonant
|
|
41
|
+
const doublingVerbs = ['submit', 'commit', 'permit', 'omit', 'admit', 'emit', 'transmit', 'refer', 'prefer', 'defer', 'occur', 'recur', 'begin', 'stop', 'drop', 'shop', 'plan', 'scan', 'ban', 'run', 'gun', 'stun', 'cut', 'shut', 'hit', 'sit', 'fit', 'spit', 'quit', 'knit', 'get', 'set', 'pet', 'wet', 'bet', 'let', 'put', 'drag', 'brag', 'flag', 'tag', 'bag', 'nag', 'wag', 'hug', 'bug', 'mug', 'tug', 'rub', 'scrub', 'grab', 'stab', 'rob', 'sob', 'throb', 'nod', 'prod', 'plod', 'plot', 'rot', 'blot', 'spot', 'knot', 'trot', 'chat', 'pat', 'bat', 'mat', 'rat', 'slap', 'clap', 'flap', 'tap', 'wrap', 'snap', 'trap', 'cap', 'map', 'nap', 'zap', 'tip', 'sip', 'dip', 'rip', 'zip', 'slip', 'trip', 'drip', 'chip', 'clip', 'flip', 'grip', 'ship', 'skip', 'whip', 'strip', 'equip', 'hop', 'pop', 'mop', 'cop', 'chop', 'crop', 'prop', 'flop', 'swim', 'trim', 'slim', 'skim', 'dim', 'rim', 'brim', 'grim', 'hem', 'stem', 'jam', 'cram', 'ram', 'slam', 'dam', 'ham', 'scam', 'spam', 'tram', 'hum', 'drum', 'strum', 'sum', 'gum', 'chum', 'plum'];
|
|
42
|
+
// Short words (3 letters) almost always double
|
|
43
|
+
if (verb.length <= 3)
|
|
44
|
+
return true;
|
|
45
|
+
// Check if verb matches any known doubling pattern
|
|
46
|
+
return doublingVerbs.some(v => verb === v || verb.endsWith(v));
|
|
47
|
+
}
|
|
48
|
+
/** Convert verb to past participle (create → created, publish → published) */
|
|
49
|
+
function toPastParticiple(verb) {
|
|
50
|
+
if (verb.endsWith('e'))
|
|
51
|
+
return verb + 'd';
|
|
52
|
+
if (verb.endsWith('y') && !isVowel(verb[verb.length - 2])) {
|
|
53
|
+
return verb.slice(0, -1) + 'ied';
|
|
54
|
+
}
|
|
55
|
+
if (shouldDoubleConsonant(verb)) {
|
|
56
|
+
return verb + verb[verb.length - 1] + 'ed';
|
|
57
|
+
}
|
|
58
|
+
return verb + 'ed';
|
|
59
|
+
}
|
|
60
|
+
/** Convert verb to actor noun (create → creator, publish → publisher) */
|
|
61
|
+
function toActor(verb) {
|
|
62
|
+
if (verb.endsWith('e'))
|
|
63
|
+
return verb + 'r';
|
|
64
|
+
if (verb.endsWith('y') && !isVowel(verb[verb.length - 2])) {
|
|
65
|
+
return verb.slice(0, -1) + 'ier';
|
|
66
|
+
}
|
|
67
|
+
if (shouldDoubleConsonant(verb)) {
|
|
68
|
+
return verb + verb[verb.length - 1] + 'er';
|
|
69
|
+
}
|
|
70
|
+
return verb + 'er';
|
|
71
|
+
}
|
|
72
|
+
/** Convert verb to present 3rd person (create → creates, publish → publishes) */
|
|
73
|
+
function toPresent(verb) {
|
|
74
|
+
if (verb.endsWith('y') && !isVowel(verb[verb.length - 2])) {
|
|
75
|
+
return verb.slice(0, -1) + 'ies';
|
|
76
|
+
}
|
|
77
|
+
if (verb.endsWith('s') || verb.endsWith('x') || verb.endsWith('z') ||
|
|
78
|
+
verb.endsWith('ch') || verb.endsWith('sh')) {
|
|
79
|
+
return verb + 'es';
|
|
80
|
+
}
|
|
81
|
+
return verb + 's';
|
|
82
|
+
}
|
|
83
|
+
/** Convert verb to gerund (create → creating, publish → publishing) */
|
|
84
|
+
function toGerund(verb) {
|
|
85
|
+
if (verb.endsWith('ie'))
|
|
86
|
+
return verb.slice(0, -2) + 'ying';
|
|
87
|
+
if (verb.endsWith('e') && !verb.endsWith('ee'))
|
|
88
|
+
return verb.slice(0, -1) + 'ing';
|
|
89
|
+
if (shouldDoubleConsonant(verb)) {
|
|
90
|
+
return verb + verb[verb.length - 1] + 'ing';
|
|
91
|
+
}
|
|
92
|
+
return verb + 'ing';
|
|
93
|
+
}
|
|
94
|
+
/** Convert verb to result noun (create → creation, publish → publication) */
|
|
95
|
+
function toResult(verb) {
|
|
96
|
+
// Common -ate → -ation
|
|
97
|
+
if (verb.endsWith('ate'))
|
|
98
|
+
return verb.slice(0, -1) + 'ion';
|
|
99
|
+
// Common -ify → -ification
|
|
100
|
+
if (verb.endsWith('ify'))
|
|
101
|
+
return verb.slice(0, -1) + 'ication';
|
|
102
|
+
// Common -ize → -ization
|
|
103
|
+
if (verb.endsWith('ize'))
|
|
104
|
+
return verb.slice(0, -1) + 'ation';
|
|
105
|
+
// Common -e → -ion (but not always correct)
|
|
106
|
+
if (verb.endsWith('e'))
|
|
107
|
+
return verb.slice(0, -1) + 'ion';
|
|
108
|
+
// Default: just add -ion
|
|
109
|
+
return verb + 'ion';
|
|
110
|
+
}
|
|
111
|
+
// =============================================================================
|
|
112
|
+
// Public API
|
|
113
|
+
// =============================================================================
|
|
114
|
+
/**
|
|
115
|
+
* Auto-conjugate a verb from just the base form
|
|
116
|
+
*
|
|
117
|
+
* Given just "publish", generates all forms:
|
|
118
|
+
* - actor: publisher
|
|
119
|
+
* - act: publishes
|
|
120
|
+
* - activity: publishing
|
|
121
|
+
* - result: publication
|
|
122
|
+
* - reverse: { at: publishedAt, by: publishedBy, ... }
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* conjugate('publish')
|
|
127
|
+
* // => { action: 'publish', actor: 'publisher', act: 'publishes', activity: 'publishing', ... }
|
|
128
|
+
*
|
|
129
|
+
* conjugate('create')
|
|
130
|
+
* // => { action: 'create', actor: 'creator', act: 'creates', activity: 'creating', ... }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export function conjugate(action) {
|
|
134
|
+
// Check if it's a known verb first
|
|
135
|
+
if (action in Verbs) {
|
|
136
|
+
return Verbs[action];
|
|
137
|
+
}
|
|
138
|
+
const base = action.toLowerCase();
|
|
139
|
+
const pastParticiple = toPastParticiple(base);
|
|
140
|
+
return {
|
|
141
|
+
action: base,
|
|
142
|
+
actor: toActor(base),
|
|
143
|
+
act: toPresent(base),
|
|
144
|
+
activity: toGerund(base),
|
|
145
|
+
result: toResult(base),
|
|
146
|
+
reverse: {
|
|
147
|
+
at: `${pastParticiple}At`,
|
|
148
|
+
by: `${pastParticiple}By`,
|
|
149
|
+
in: `${pastParticiple}In`,
|
|
150
|
+
for: `${pastParticiple}For`,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Auto-pluralize a noun
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* pluralize('post') // => 'posts'
|
|
160
|
+
* pluralize('category') // => 'categories'
|
|
161
|
+
* pluralize('person') // => 'people'
|
|
162
|
+
* pluralize('child') // => 'children'
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export function pluralize(singular) {
|
|
166
|
+
const lower = singular.toLowerCase();
|
|
167
|
+
// Irregular plurals
|
|
168
|
+
const irregulars = {
|
|
169
|
+
person: 'people',
|
|
170
|
+
child: 'children',
|
|
171
|
+
man: 'men',
|
|
172
|
+
woman: 'women',
|
|
173
|
+
foot: 'feet',
|
|
174
|
+
tooth: 'teeth',
|
|
175
|
+
goose: 'geese',
|
|
176
|
+
mouse: 'mice',
|
|
177
|
+
ox: 'oxen',
|
|
178
|
+
leaf: 'leaves',
|
|
179
|
+
life: 'lives',
|
|
180
|
+
knife: 'knives',
|
|
181
|
+
wife: 'wives',
|
|
182
|
+
half: 'halves',
|
|
183
|
+
self: 'selves',
|
|
184
|
+
calf: 'calves',
|
|
185
|
+
analysis: 'analyses',
|
|
186
|
+
crisis: 'crises',
|
|
187
|
+
thesis: 'theses',
|
|
188
|
+
datum: 'data',
|
|
189
|
+
medium: 'media',
|
|
190
|
+
criterion: 'criteria',
|
|
191
|
+
phenomenon: 'phenomena',
|
|
192
|
+
};
|
|
193
|
+
if (irregulars[lower]) {
|
|
194
|
+
return preserveCase(singular, irregulars[lower]);
|
|
195
|
+
}
|
|
196
|
+
// Rules for regular plurals
|
|
197
|
+
if (lower.endsWith('y') && !isVowel(lower[lower.length - 2])) {
|
|
198
|
+
return singular.slice(0, -1) + 'ies';
|
|
199
|
+
}
|
|
200
|
+
// Words ending in z that double: quiz → quizzes, fez → fezzes
|
|
201
|
+
if (lower.endsWith('z') && !lower.endsWith('zz')) {
|
|
202
|
+
return singular + 'zes';
|
|
203
|
+
}
|
|
204
|
+
if (lower.endsWith('s') || lower.endsWith('x') || lower.endsWith('zz') ||
|
|
205
|
+
lower.endsWith('ch') || lower.endsWith('sh')) {
|
|
206
|
+
return singular + 'es';
|
|
207
|
+
}
|
|
208
|
+
if (lower.endsWith('f')) {
|
|
209
|
+
return singular.slice(0, -1) + 'ves';
|
|
210
|
+
}
|
|
211
|
+
if (lower.endsWith('fe')) {
|
|
212
|
+
return singular.slice(0, -2) + 'ves';
|
|
213
|
+
}
|
|
214
|
+
return singular + 's';
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Auto-singularize a noun (reverse of pluralize)
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* singularize('posts') // => 'post'
|
|
222
|
+
* singularize('categories') // => 'category'
|
|
223
|
+
* singularize('people') // => 'person'
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
export function singularize(plural) {
|
|
227
|
+
const lower = plural.toLowerCase();
|
|
228
|
+
// Irregular singulars
|
|
229
|
+
const irregulars = {
|
|
230
|
+
people: 'person',
|
|
231
|
+
children: 'child',
|
|
232
|
+
men: 'man',
|
|
233
|
+
women: 'woman',
|
|
234
|
+
feet: 'foot',
|
|
235
|
+
teeth: 'tooth',
|
|
236
|
+
geese: 'goose',
|
|
237
|
+
mice: 'mouse',
|
|
238
|
+
oxen: 'ox',
|
|
239
|
+
leaves: 'leaf',
|
|
240
|
+
lives: 'life',
|
|
241
|
+
knives: 'knife',
|
|
242
|
+
wives: 'wife',
|
|
243
|
+
halves: 'half',
|
|
244
|
+
selves: 'self',
|
|
245
|
+
calves: 'calf',
|
|
246
|
+
analyses: 'analysis',
|
|
247
|
+
crises: 'crisis',
|
|
248
|
+
theses: 'thesis',
|
|
249
|
+
data: 'datum',
|
|
250
|
+
media: 'medium',
|
|
251
|
+
criteria: 'criterion',
|
|
252
|
+
phenomena: 'phenomenon',
|
|
253
|
+
};
|
|
254
|
+
if (irregulars[lower]) {
|
|
255
|
+
return preserveCase(plural, irregulars[lower]);
|
|
256
|
+
}
|
|
257
|
+
// Rules for regular singulars
|
|
258
|
+
if (lower.endsWith('ies')) {
|
|
259
|
+
return plural.slice(0, -3) + 'y';
|
|
260
|
+
}
|
|
261
|
+
if (lower.endsWith('ves')) {
|
|
262
|
+
return plural.slice(0, -3) + 'f';
|
|
263
|
+
}
|
|
264
|
+
if (lower.endsWith('es') && (lower.endsWith('sses') || lower.endsWith('xes') || lower.endsWith('zes') ||
|
|
265
|
+
lower.endsWith('ches') || lower.endsWith('shes'))) {
|
|
266
|
+
return plural.slice(0, -2);
|
|
267
|
+
}
|
|
268
|
+
if (lower.endsWith('s') && !lower.endsWith('ss')) {
|
|
269
|
+
return plural.slice(0, -1);
|
|
270
|
+
}
|
|
271
|
+
return plural;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Infer a complete Noun from just a type name
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* inferNoun('BlogPost')
|
|
279
|
+
* // => { singular: 'blog post', plural: 'blog posts', ... }
|
|
280
|
+
*
|
|
281
|
+
* inferNoun('Category')
|
|
282
|
+
* // => { singular: 'category', plural: 'categories', ... }
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
export function inferNoun(typeName) {
|
|
286
|
+
const words = splitCamelCase(typeName);
|
|
287
|
+
const singular = words.join(' ').toLowerCase();
|
|
288
|
+
const plural = words.slice(0, -1).concat(pluralize(words[words.length - 1])).join(' ').toLowerCase();
|
|
289
|
+
return {
|
|
290
|
+
singular,
|
|
291
|
+
plural,
|
|
292
|
+
actions: ['create', 'update', 'delete'],
|
|
293
|
+
events: ['created', 'updated', 'deleted'],
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Create TypeMeta from a type name - all linguistic forms auto-inferred
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* const meta = createTypeMeta('BlogPost')
|
|
302
|
+
* meta.singular // 'blog post'
|
|
303
|
+
* meta.plural // 'blog posts'
|
|
304
|
+
* meta.slug // 'blog-post'
|
|
305
|
+
* meta.created // 'BlogPost.created'
|
|
306
|
+
* meta.createdAt // 'createdAt'
|
|
307
|
+
* meta.creator // 'creator'
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
export function createTypeMeta(typeName) {
|
|
311
|
+
const noun = inferNoun(typeName);
|
|
312
|
+
const slug = noun.singular.replace(/\s+/g, '-');
|
|
313
|
+
const slugPlural = noun.plural.replace(/\s+/g, '-');
|
|
314
|
+
return {
|
|
315
|
+
name: typeName,
|
|
316
|
+
singular: noun.singular,
|
|
317
|
+
plural: noun.plural,
|
|
318
|
+
slug,
|
|
319
|
+
slugPlural,
|
|
320
|
+
// From Verbs.create
|
|
321
|
+
creator: 'creator',
|
|
322
|
+
createdAt: 'createdAt',
|
|
323
|
+
createdBy: 'createdBy',
|
|
324
|
+
updatedAt: 'updatedAt',
|
|
325
|
+
updatedBy: 'updatedBy',
|
|
326
|
+
// Event types
|
|
327
|
+
created: `${typeName}.created`,
|
|
328
|
+
updated: `${typeName}.updated`,
|
|
329
|
+
deleted: `${typeName}.deleted`,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/** Cache of TypeMeta by type name */
|
|
333
|
+
const typeMetaCache = new Map();
|
|
334
|
+
/**
|
|
335
|
+
* Get or create TypeMeta for a type name (cached)
|
|
336
|
+
*/
|
|
337
|
+
export function getTypeMeta(typeName) {
|
|
338
|
+
let meta = typeMetaCache.get(typeName);
|
|
339
|
+
if (!meta) {
|
|
340
|
+
meta = createTypeMeta(typeName);
|
|
341
|
+
typeMetaCache.set(typeName, meta);
|
|
342
|
+
}
|
|
343
|
+
return meta;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Type proxy - provides dynamic access to type metadata
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* const Post = Type('Post')
|
|
351
|
+
* Post.singular // 'post'
|
|
352
|
+
* Post.plural // 'posts'
|
|
353
|
+
* Post.created // 'Post.created'
|
|
354
|
+
*
|
|
355
|
+
* // In event handlers:
|
|
356
|
+
* on.create(thing => {
|
|
357
|
+
* console.log(thing.$type.plural) // 'posts'
|
|
358
|
+
* })
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export function Type(name) {
|
|
362
|
+
return getTypeMeta(name);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Get reverse property names for a verb action
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```ts
|
|
369
|
+
* getVerbFields('create')
|
|
370
|
+
* // => { at: 'createdAt', by: 'createdBy', in: 'createdIn', for: 'createdFor' }
|
|
371
|
+
*
|
|
372
|
+
* getVerbFields('publish')
|
|
373
|
+
* // => { at: 'publishedAt', by: 'publishedBy' }
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
export function getVerbFields(action) {
|
|
377
|
+
return Verbs[action]?.reverse ?? {};
|
|
378
|
+
}
|
|
379
|
+
//# sourceMappingURL=linguistic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linguistic.js","sourceRoot":"","sources":["../src/linguistic.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAuC,MAAM,YAAY,CAAA;AAEvE,gFAAgF;A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