@happyvertical/smrt-core 0.47.2 → 0.49.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/agents/generators.md +12 -0
- package/agents/object-runtime.md +7 -0
- package/agents/schema-paths.md +62 -0
- package/agents/system-diagnostics.md +6 -1
- package/dist/cascade.d.ts.map +1 -1
- package/dist/cascade.js +9 -6
- package/dist/cascade.js.map +1 -1
- package/dist/collection.d.ts +0 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +35 -45
- package/dist/collection.js.map +1 -1
- package/dist/decorators/compatibility.d.ts +1 -1
- package/dist/decorators/compatibility.d.ts.map +1 -1
- package/dist/decorators/compatibility.js +2 -2
- package/dist/decorators/compatibility.js.map +1 -1
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js +33 -24
- package/dist/decorators/index.js.map +1 -1
- package/dist/interceptors.d.ts +3 -1
- package/dist/interceptors.d.ts.map +1 -1
- package/dist/interceptors.js +3 -2
- package/dist/interceptors.js.map +1 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/migrations/differ.d.ts +10 -4
- package/dist/migrations/differ.d.ts.map +1 -1
- package/dist/migrations/differ.js +173 -5
- package/dist/migrations/differ.js.map +1 -1
- package/dist/object.d.ts +1 -5
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +28 -37
- package/dist/object.js.map +1 -1
- package/dist/registry/class-registration.d.ts +2 -1
- package/dist/registry/class-registration.d.ts.map +1 -1
- package/dist/registry/class-registration.js +47 -16
- package/dist/registry/class-registration.js.map +1 -1
- package/dist/registry/name-resolver.d.ts.map +1 -1
- package/dist/registry/name-resolver.js +3 -3
- package/dist/registry/name-resolver.js.map +1 -1
- package/dist/registry/relationship-graph.d.ts +2 -0
- package/dist/registry/relationship-graph.d.ts.map +1 -1
- package/dist/registry/relationship-graph.js +60 -5
- package/dist/registry/relationship-graph.js.map +1 -1
- package/dist/registry/schema-builder.d.ts.map +1 -1
- package/dist/registry/schema-builder.js +4 -1
- package/dist/registry/schema-builder.js.map +1 -1
- package/dist/registry/shared-state.d.ts +18 -0
- package/dist/registry/shared-state.d.ts.map +1 -1
- package/dist/registry/shared-state.js +25 -1
- package/dist/registry/shared-state.js.map +1 -1
- package/dist/registry/types.d.ts +8 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry.d.ts +32 -5
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +120 -12
- package/dist/registry.js.map +1 -1
- package/dist/relationship-loader.d.ts +6 -0
- package/dist/relationship-loader.d.ts.map +1 -0
- package/dist/relationship-loader.js +35 -0
- package/dist/relationship-loader.js.map +1 -0
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +6 -3
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/schema/foreign-key-ddl.d.ts +8 -0
- package/dist/schema/foreign-key-ddl.d.ts.map +1 -1
- package/dist/schema/foreign-key-ddl.js +12 -1
- package/dist/schema/foreign-key-ddl.js.map +1 -1
- package/dist/schema/foreign-key-orphan-report.d.ts.map +1 -1
- package/dist/schema/foreign-key-orphan-report.js +18 -1
- package/dist/schema/foreign-key-orphan-report.js.map +1 -1
- package/dist/schema/generator.d.ts +2 -0
- package/dist/schema/generator.d.ts.map +1 -1
- package/dist/schema/generator.js +16 -9
- package/dist/schema/generator.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/live-parity.d.ts.map +1 -1
- package/dist/schema/live-parity.js +74 -0
- package/dist/schema/live-parity.js.map +1 -1
- package/dist/schema/text-cast-probe.d.ts +66 -0
- package/dist/schema/text-cast-probe.d.ts.map +1 -0
- package/dist/schema/text-cast-probe.js +142 -0
- package/dist/schema/text-cast-probe.js.map +1 -0
- package/dist/schema/types.d.ts +28 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/utils.d.ts.map +1 -1
- package/dist/schema/utils.js +2 -1
- package/dist/schema/utils.js.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/smrt-knowledge.json +11 -11
- package/dist/system/diagnostics.d.ts +22 -0
- package/dist/system/diagnostics.d.ts.map +1 -1
- package/dist/system/diagnostics.js +88 -31
- package/dist/system/diagnostics.js.map +1 -1
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/dist/vite-plugin/dev-plane-route.d.ts +5 -0
- package/dist/vite-plugin/dev-plane-route.d.ts.map +1 -0
- package/dist/vite-plugin/dev-plane-route.js +91 -0
- package/dist/vite-plugin/dev-plane-route.js.map +1 -0
- package/dist/vite-plugin/sveltekit-generator.d.ts +8 -0
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +2 -0
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/package.json +4 -4
|
@@ -55,6 +55,6 @@ export declare function applyPendingDecoratorRegistrations(target: Function, dec
|
|
|
55
55
|
* method keeps its identity and remains directly callable (#2686).
|
|
56
56
|
*/
|
|
57
57
|
export declare function registerCompatibleMethodDecorator<This, Value extends AnyMethodOf<This>>(targetOrValue: LegacyPropertyDecoratorTarget | Value | undefined, propertyKeyOrContext: CompatibleMethodDecoratorContext<This, Value>, registerMethodDecorator: (ctor: Function, methodName: string, isStatic: boolean) => void): void;
|
|
58
|
-
export declare function registerCompatibleFieldDecorator<This, Value>(targetOrValue: LegacyPropertyDecoratorTarget | undefined, propertyKeyOrContext: CompatiblePropertyDecoratorContext<This, Value>, registerFieldDecorator: (className: string, propertyKey: string) => void): void;
|
|
58
|
+
export declare function registerCompatibleFieldDecorator<This, Value>(targetOrValue: LegacyPropertyDecoratorTarget | undefined, propertyKeyOrContext: CompatiblePropertyDecoratorContext<This, Value>, registerFieldDecorator: (className: string, propertyKey: string, ctor?: Function) => void): void;
|
|
59
59
|
export {};
|
|
60
60
|
//# sourceMappingURL=compatibility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../src/decorators/compatibility.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,WAAW,CAAC,EAAE,QAAQ,GAAG;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,IAAI,EAAE,KAAK,IACtD,MAAM,GACN,MAAM,GACN,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAE5C,MAAM,WAAW,2BAA2B,CAAC,IAAI,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IAC1E,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrD,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;CAC5E;AAED;;;;;;;;;;GAUG;AACH;;;;;GAKG;AAEH,KAAK,WAAW,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;AAG3D,KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;AAElD,MAAM,MAAM,gCAAgC,CAC1C,IAAI,EACJ,KAAK,SAAS,WAAW,CAAC,IAAI,CAAC,IAC7B,MAAM,GAAG,MAAM,GAAG,2BAA2B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAE/D,MAAM,WAAW,yBAAyB,CACxC,IAAI,GAAG,OAAO,EACd,KAAK,SAAS,WAAW,CAAC,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;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iCAAiC,CAC/C,IAAI,EACJ,KAAK,SAAS,WAAW,CAAC,IAAI,CAAC,EAE/B,aAAa,EAAE,6BAA6B,GAAG,KAAK,GAAG,SAAS,EAChE,oBAAoB,EAAE,gCAAgC,CAAC,IAAI,EAAE,KAAK,CAAC,EACnE,uBAAuB,EAAE,CACvB,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,KACd,IAAI,GACR,IAAI,CA8CN;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,KAAK,EAC1D,aAAa,EAAE,6BAA6B,GAAG,SAAS,EACxD,oBAAoB,EAAE,kCAAkC,CAAC,IAAI,EAAE,KAAK,CAAC,EACrE,sBAAsB,EAAE,CACtB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,QAAQ,KACZ,IAAI,GACR,IAAI,CA0CN"}
|
|
@@ -94,13 +94,13 @@ function registerCompatibleMethodDecorator(targetOrValue, propertyKeyOrContext,
|
|
|
94
94
|
function registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, registerFieldDecorator) {
|
|
95
95
|
if (typeof propertyKeyOrContext === "string" || typeof propertyKeyOrContext === "symbol") {
|
|
96
96
|
const className = resolveDecoratorClassName(targetOrValue);
|
|
97
|
-
if (className) registerFieldDecorator(className, String(propertyKeyOrContext));
|
|
97
|
+
if (className) registerFieldDecorator(className, String(propertyKeyOrContext), getDecoratorConstructor(targetOrValue));
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const context = propertyKeyOrContext;
|
|
101
101
|
const propertyKey = String(context.name);
|
|
102
102
|
const register = (ctor) => {
|
|
103
|
-
if (ctor.name) registerFieldDecorator(ctor.name, propertyKey);
|
|
103
|
+
if (ctor.name) registerFieldDecorator(ctor.name, propertyKey, ctor);
|
|
104
104
|
};
|
|
105
105
|
const metadata = getDecoratorMetadata(context);
|
|
106
106
|
if (metadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatibility.js","names":[],"sources":["../../src/decorators/compatibility.ts"],"sourcesContent":["type DecoratorMetadataStore = Record<PropertyKey, unknown>;\n\nconst PENDING_FIELD_DECORATORS_KEY = Symbol.for(\n '@happyvertical/smrt-core/pending-field-decorators',\n);\nconst standardDecoratorRegistrations = new WeakMap<\n Function,\n WeakSet<(ctor: Function) => void>\n>();\n\ntype PendingDecoratorRegistration = {\n register: (ctor: Function) => void;\n};\n\nexport type LegacyPropertyDecoratorTarget = {\n constructor?: Function & {\n name?: string;\n };\n};\n\nexport type CompatiblePropertyDecoratorContext<This, Value> =\n | string\n | symbol\n | ClassFieldDecoratorContext<This, Value>;\n\nexport interface CompatiblePropertyDecorator<This = unknown, Value = unknown> {\n (target: object, propertyKey: string | symbol): void;\n (value: undefined, context: ClassFieldDecoratorContext<This, Value>): void;\n}\n\n/**\n * A method decorator that works under BOTH decorator implementations, the same\n * way {@link CompatiblePropertyDecorator} does for class fields.\n *\n * Legacy (TypeScript `experimentalDecorators`, and the Oxc legacy mode this\n * repo builds with) calls `(target, propertyKey, descriptor)`, where `target`\n * is the prototype for an instance method and the constructor for a static\n * one. TC39 standard decorators call `(value, context)`. Returning `void` from\n * either leaves the method untouched, which is all a metadata-only decorator\n * needs (#2686).\n */\n/**\n * The constraint `ClassMethodDecoratorContext<This, Value>` imposes on its\n * `Value`, restated so this module's own generics can satisfy it. Any narrower\n * spelling (`...args: never`, `unknown[]`) is rejected by the lib type, and a\n * method decorator has to accept every method signature anyway.\n */\n// biome-ignore lint/suspicious/noExplicitAny: mirrors the lib's own `ClassMethodDecoratorContext` constraint; a narrower type does not satisfy it. Same rationale as `SmrtObjectConstructor` in registry/types.ts. S4 #1579.\ntype AnyMethodOf<This> = (this: This, ...args: any) => any;\n\n// biome-ignore lint/suspicious/noExplicitAny: see AnyMethodOf above. S4 #1579.\ntype AnyMethod = (this: any, ...args: any) => any;\n\nexport type CompatibleMethodDecoratorContext<\n This,\n Value extends AnyMethodOf<This>,\n> = string | symbol | ClassMethodDecoratorContext<This, Value>;\n\nexport interface CompatibleMethodDecorator<\n This = unknown,\n Value extends AnyMethodOf<This> = AnyMethod,\n> {\n (\n target: object,\n propertyKey: string | symbol,\n descriptor?: PropertyDescriptor,\n ): void;\n (value: Value, context: ClassMethodDecoratorContext<This, Value>): void;\n}\n\nfunction getDecoratorConstructor(target: unknown): Function | undefined {\n if (typeof target === 'function') {\n return target;\n }\n\n if (target && typeof target === 'object') {\n return (target as LegacyPropertyDecoratorTarget).constructor;\n }\n\n return undefined;\n}\n\nfunction markStandardDecoratorRegistration(\n target: unknown,\n register: (ctor: Function) => void,\n): boolean {\n const ctor = getDecoratorConstructor(target);\n if (!ctor) {\n return false;\n }\n\n const registeredCallbacks =\n standardDecoratorRegistrations.get(ctor) ?? new WeakSet();\n if (registeredCallbacks.has(register)) {\n return false;\n }\n\n registeredCallbacks.add(register);\n standardDecoratorRegistrations.set(ctor, registeredCallbacks);\n return true;\n}\n\nfunction getDecoratorMetadata(\n contextOrMetadata:\n | ClassFieldDecoratorContext<unknown, unknown>\n | ClassMethodDecoratorContext<unknown, AnyMethod>\n | ClassDecoratorContext\n | DecoratorMetadataStore\n | undefined,\n): DecoratorMetadataStore | undefined {\n if (!contextOrMetadata || typeof contextOrMetadata !== 'object') {\n return undefined;\n }\n\n if ('metadata' in contextOrMetadata) {\n const { metadata } = contextOrMetadata as {\n metadata?: DecoratorMetadataStore;\n };\n return metadata && typeof metadata === 'object' ? metadata : undefined;\n }\n\n return contextOrMetadata;\n}\n\nfunction getClassDecoratorMetadata(\n target: Function,\n decoratorContext?: ClassDecoratorContext,\n): DecoratorMetadataStore | undefined {\n const metadataFromContext = getDecoratorMetadata(decoratorContext);\n if (metadataFromContext) {\n return metadataFromContext;\n }\n\n const metadataSymbol = (Symbol as typeof Symbol & { metadata?: symbol })\n .metadata;\n if (!metadataSymbol) {\n return undefined;\n }\n\n const metadata = (target as unknown as Record<PropertyKey, unknown>)[\n metadataSymbol\n ];\n return metadata && typeof metadata === 'object'\n ? (metadata as DecoratorMetadataStore)\n : undefined;\n}\n\nfunction queuePendingFieldDecorator(\n metadata: DecoratorMetadataStore,\n register: (ctor: Function) => void,\n): void {\n const pendingDecorators =\n (metadata[PENDING_FIELD_DECORATORS_KEY] as\n | PendingDecoratorRegistration[]\n | undefined) ?? [];\n\n pendingDecorators.push({ register });\n metadata[PENDING_FIELD_DECORATORS_KEY] = pendingDecorators;\n}\n\nexport function resolveDecoratorClassName(target: unknown): string | undefined {\n if (typeof target === 'function') {\n return target.name;\n }\n\n if (target && typeof target === 'object') {\n return (target as LegacyPropertyDecoratorTarget).constructor?.name;\n }\n\n return undefined;\n}\n\nexport function applyPendingDecoratorRegistrations(\n target: Function,\n decoratorContext?: ClassDecoratorContext,\n): void {\n const metadata = getClassDecoratorMetadata(target, decoratorContext);\n if (!metadata) {\n return;\n }\n\n const pendingDecorators = metadata[PENDING_FIELD_DECORATORS_KEY] as\n | PendingDecoratorRegistration[]\n | undefined;\n if (!pendingDecorators || pendingDecorators.length === 0) {\n return;\n }\n\n for (const { register } of pendingDecorators) {\n if (!markStandardDecoratorRegistration(target, register)) {\n continue;\n }\n\n register(target);\n }\n\n Reflect.deleteProperty(metadata, PENDING_FIELD_DECORATORS_KEY);\n}\n\n/**\n * Register a method decorator's metadata under the decorated class's name,\n * under whichever decorator implementation is running.\n *\n * The class-field twin below is the model, but the two cannot share one\n * function: their legacy signatures differ (a method decorator receives a\n * property descriptor as a third argument), and a static method's legacy\n * `target` is the CONSTRUCTOR while an instance method's is the prototype —\n * `getDecoratorConstructor` already handles both, which is why the receiver\n * resolution is shared even though the entry point is not.\n *\n * Registration is keyed by the CONSTRUCTOR, not by its name: two packages may\n * legitimately declare a class with the same simple name (`Account` exists in\n * both `smrt-ledgers` and `smrt-messages`), and the kernel forbids inferring\n * ownership from simple names. A name-keyed store would let one package's\n * `@method({ expose: false })` withhold the other's identically-named action.\n *\n * Metadata-only: nothing is wrapped and nothing is returned, so the decorated\n * method keeps its identity and remains directly callable (#2686).\n */\nexport function registerCompatibleMethodDecorator<\n This,\n Value extends AnyMethodOf<This>,\n>(\n targetOrValue: LegacyPropertyDecoratorTarget | Value | undefined,\n propertyKeyOrContext: CompatibleMethodDecoratorContext<This, Value>,\n registerMethodDecorator: (\n ctor: Function,\n methodName: string,\n isStatic: boolean,\n ) => void,\n): void {\n if (\n typeof propertyKeyOrContext === 'string' ||\n typeof propertyKeyOrContext === 'symbol'\n ) {\n // Legacy decorators hand a STATIC method its constructor and an instance\n // method its prototype. That distinction IS the method's receiver, and\n // nothing downstream can recover it in an unscanned runtime, so capture it\n // here (#2686).\n const ctor = getDecoratorConstructor(targetOrValue);\n if (ctor) {\n registerMethodDecorator(\n ctor,\n String(propertyKeyOrContext),\n typeof targetOrValue === 'function',\n );\n }\n return;\n }\n\n const context = propertyKeyOrContext;\n const methodName = String(context.name);\n // Standard decorators state the receiver outright.\n const isStatic = context.static === true;\n const register = (ctor: Function) =>\n registerMethodDecorator(ctor, methodName, isStatic);\n const metadata = getDecoratorMetadata(context);\n\n if (metadata) {\n queuePendingFieldDecorator(metadata, register);\n return;\n }\n\n context.addInitializer?.(function registerSmrtMethodDecorator(this: unknown) {\n // A static method's initializer runs with the constructor as `this`; an\n // instance method's runs with the instance. `getDecoratorConstructor`\n // reads the constructor in the latter case, so both land on the same class.\n if (!markStandardDecoratorRegistration(this, register)) {\n return;\n }\n\n const ctor = getDecoratorConstructor(this);\n if (ctor) {\n register(ctor);\n }\n });\n}\n\nexport function registerCompatibleFieldDecorator<This, Value>(\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<This, Value>,\n registerFieldDecorator: (className: string, propertyKey: string) => void,\n): void {\n if (\n typeof propertyKeyOrContext === 'string' ||\n typeof propertyKeyOrContext === 'symbol'\n ) {\n const className = resolveDecoratorClassName(targetOrValue);\n if (className) {\n registerFieldDecorator(className, String(propertyKeyOrContext));\n }\n return;\n }\n\n const context = propertyKeyOrContext;\n const propertyKey = String(context.name);\n // The shared queue passes the CONSTRUCTOR (the method arm needs an identity a\n // simple name cannot provide); field registration keeps its name-keyed store,\n // so it derives the name here.\n const register = (ctor: Function) => {\n if (ctor.name) registerFieldDecorator(ctor.name, propertyKey);\n };\n const metadata = getDecoratorMetadata(context);\n\n if (metadata) {\n queuePendingFieldDecorator(metadata, register);\n return;\n }\n\n context.addInitializer?.(function registerSmrtDecorator() {\n if (!markStandardDecoratorRegistration(this, register)) {\n return;\n }\n\n const ctor = getDecoratorConstructor(this);\n if (ctor) {\n register(ctor);\n }\n });\n}\n"],"mappings":";AAEA,IAAM,+BAA+B,OAAO,IAC1C,mDACF;AACA,IAAM,iDAAiC,IAAI,QAGzC;AA8DF,SAAS,wBAAwB,QAAuC;CACtE,IAAI,OAAO,WAAW,YACpB,OAAO;CAGT,IAAI,UAAU,OAAO,WAAW,UAC9B,OAAQ,OAAyC;AAIrD;AAEA,SAAS,kCACP,QACA,UACS;CACT,MAAM,OAAO,wBAAwB,MAAM;CAC3C,IAAI,CAAC,MACH,OAAO;CAGT,MAAM,sBACJ,+BAA+B,IAAI,IAAI,qBAAK,IAAI,QAAQ;CAC1D,IAAI,oBAAoB,IAAI,QAAQ,GAClC,OAAO;CAGT,oBAAoB,IAAI,QAAQ;CAChC,+BAA+B,IAAI,MAAM,mBAAmB;CAC5D,OAAO;AACT;AAEA,SAAS,qBACP,mBAMoC;CACpC,IAAI,CAAC,qBAAqB,OAAO,sBAAsB,UACrD;CAGF,IAAI,cAAc,mBAAmB;EACnC,MAAM,EAAE,aAAa;EAGrB,OAAO,YAAY,OAAO,aAAa,WAAW,WAAW,KAAA;CAC/D;CAEA,OAAO;AACT;AAEA,SAAS,0BACP,QACA,kBACoC;CACpC,MAAM,sBAAsB,qBAAqB,gBAAgB;CACjE,IAAI,qBACF,OAAO;CAGT,MAAM,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AAQ,GACnD;EAGF,MAAM,OAAO,wBAAwB,IAAI;EACzC,IAAI,MACF,SAAS,IAAI;CAEjB,CAAC;AACH;AAEA,SAAgB,iCACd,eACA,sBACA,wBACM;CACN,IACE,OAAO,yBAAyB,YAChC,OAAO,yBAAyB,UAChC;EACA,MAAM,YAAY,0BAA0B,aAAa;EACzD,IAAI,WACF,uBAAuB,WAAW,OAAO,oBAAoB,CAAC;EAEhE;CACF;CAEA,MAAM,UAAU;CAChB,MAAM,cAAc,OAAO,QAAQ,IAAI;CAIvC,MAAM,YAAY,SAAmB;EACnC,IAAI,KAAK,MAAM,uBAAuB,KAAK,MAAM,WAAW;CAC9D;CACA,MAAM,WAAW,qBAAqB,OAAO;CAE7C,IAAI,UAAU;EACZ,2BAA2B,UAAU,QAAQ;EAC7C;CACF;CAEA,QAAQ,iBAAiB,SAAS,wBAAwB;EACxD,IAAI,CAAC,kCAAkC,MAAM,QAAQ,GACnD;EAGF,MAAM,OAAO,wBAAwB,IAAI;EACzC,IAAI,MACF,SAAS,IAAI;CAEjB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"compatibility.js","names":[],"sources":["../../src/decorators/compatibility.ts"],"sourcesContent":["type DecoratorMetadataStore = Record<PropertyKey, unknown>;\n\nconst PENDING_FIELD_DECORATORS_KEY = Symbol.for(\n '@happyvertical/smrt-core/pending-field-decorators',\n);\nconst standardDecoratorRegistrations = new WeakMap<\n Function,\n WeakSet<(ctor: Function) => void>\n>();\n\ntype PendingDecoratorRegistration = {\n register: (ctor: Function) => void;\n};\n\nexport type LegacyPropertyDecoratorTarget = {\n constructor?: Function & {\n name?: string;\n };\n};\n\nexport type CompatiblePropertyDecoratorContext<This, Value> =\n | string\n | symbol\n | ClassFieldDecoratorContext<This, Value>;\n\nexport interface CompatiblePropertyDecorator<This = unknown, Value = unknown> {\n (target: object, propertyKey: string | symbol): void;\n (value: undefined, context: ClassFieldDecoratorContext<This, Value>): void;\n}\n\n/**\n * A method decorator that works under BOTH decorator implementations, the same\n * way {@link CompatiblePropertyDecorator} does for class fields.\n *\n * Legacy (TypeScript `experimentalDecorators`, and the Oxc legacy mode this\n * repo builds with) calls `(target, propertyKey, descriptor)`, where `target`\n * is the prototype for an instance method and the constructor for a static\n * one. TC39 standard decorators call `(value, context)`. Returning `void` from\n * either leaves the method untouched, which is all a metadata-only decorator\n * needs (#2686).\n */\n/**\n * The constraint `ClassMethodDecoratorContext<This, Value>` imposes on its\n * `Value`, restated so this module's own generics can satisfy it. Any narrower\n * spelling (`...args: never`, `unknown[]`) is rejected by the lib type, and a\n * method decorator has to accept every method signature anyway.\n */\n// biome-ignore lint/suspicious/noExplicitAny: mirrors the lib's own `ClassMethodDecoratorContext` constraint; a narrower type does not satisfy it. Same rationale as `SmrtObjectConstructor` in registry/types.ts. S4 #1579.\ntype AnyMethodOf<This> = (this: This, ...args: any) => any;\n\n// biome-ignore lint/suspicious/noExplicitAny: see AnyMethodOf above. S4 #1579.\ntype AnyMethod = (this: any, ...args: any) => any;\n\nexport type CompatibleMethodDecoratorContext<\n This,\n Value extends AnyMethodOf<This>,\n> = string | symbol | ClassMethodDecoratorContext<This, Value>;\n\nexport interface CompatibleMethodDecorator<\n This = unknown,\n Value extends AnyMethodOf<This> = AnyMethod,\n> {\n (\n target: object,\n propertyKey: string | symbol,\n descriptor?: PropertyDescriptor,\n ): void;\n (value: Value, context: ClassMethodDecoratorContext<This, Value>): void;\n}\n\nfunction getDecoratorConstructor(target: unknown): Function | undefined {\n if (typeof target === 'function') {\n return target;\n }\n\n if (target && typeof target === 'object') {\n return (target as LegacyPropertyDecoratorTarget).constructor;\n }\n\n return undefined;\n}\n\nfunction markStandardDecoratorRegistration(\n target: unknown,\n register: (ctor: Function) => void,\n): boolean {\n const ctor = getDecoratorConstructor(target);\n if (!ctor) {\n return false;\n }\n\n const registeredCallbacks =\n standardDecoratorRegistrations.get(ctor) ?? new WeakSet();\n if (registeredCallbacks.has(register)) {\n return false;\n }\n\n registeredCallbacks.add(register);\n standardDecoratorRegistrations.set(ctor, registeredCallbacks);\n return true;\n}\n\nfunction getDecoratorMetadata(\n contextOrMetadata:\n | ClassFieldDecoratorContext<unknown, unknown>\n | ClassMethodDecoratorContext<unknown, AnyMethod>\n | ClassDecoratorContext\n | DecoratorMetadataStore\n | undefined,\n): DecoratorMetadataStore | undefined {\n if (!contextOrMetadata || typeof contextOrMetadata !== 'object') {\n return undefined;\n }\n\n if ('metadata' in contextOrMetadata) {\n const { metadata } = contextOrMetadata as {\n metadata?: DecoratorMetadataStore;\n };\n return metadata && typeof metadata === 'object' ? metadata : undefined;\n }\n\n return contextOrMetadata;\n}\n\nfunction getClassDecoratorMetadata(\n target: Function,\n decoratorContext?: ClassDecoratorContext,\n): DecoratorMetadataStore | undefined {\n const metadataFromContext = getDecoratorMetadata(decoratorContext);\n if (metadataFromContext) {\n return metadataFromContext;\n }\n\n const metadataSymbol = (Symbol as typeof Symbol & { metadata?: symbol })\n .metadata;\n if (!metadataSymbol) {\n return undefined;\n }\n\n const metadata = (target as unknown as Record<PropertyKey, unknown>)[\n metadataSymbol\n ];\n return metadata && typeof metadata === 'object'\n ? (metadata as DecoratorMetadataStore)\n : undefined;\n}\n\nfunction queuePendingFieldDecorator(\n metadata: DecoratorMetadataStore,\n register: (ctor: Function) => void,\n): void {\n const pendingDecorators =\n (metadata[PENDING_FIELD_DECORATORS_KEY] as\n | PendingDecoratorRegistration[]\n | undefined) ?? [];\n\n pendingDecorators.push({ register });\n metadata[PENDING_FIELD_DECORATORS_KEY] = pendingDecorators;\n}\n\nexport function resolveDecoratorClassName(target: unknown): string | undefined {\n if (typeof target === 'function') {\n return target.name;\n }\n\n if (target && typeof target === 'object') {\n return (target as LegacyPropertyDecoratorTarget).constructor?.name;\n }\n\n return undefined;\n}\n\nexport function applyPendingDecoratorRegistrations(\n target: Function,\n decoratorContext?: ClassDecoratorContext,\n): void {\n const metadata = getClassDecoratorMetadata(target, decoratorContext);\n if (!metadata) {\n return;\n }\n\n const pendingDecorators = metadata[PENDING_FIELD_DECORATORS_KEY] as\n | PendingDecoratorRegistration[]\n | undefined;\n if (!pendingDecorators || pendingDecorators.length === 0) {\n return;\n }\n\n for (const { register } of pendingDecorators) {\n if (!markStandardDecoratorRegistration(target, register)) {\n continue;\n }\n\n register(target);\n }\n\n Reflect.deleteProperty(metadata, PENDING_FIELD_DECORATORS_KEY);\n}\n\n/**\n * Register a method decorator's metadata under the decorated class's name,\n * under whichever decorator implementation is running.\n *\n * The class-field twin below is the model, but the two cannot share one\n * function: their legacy signatures differ (a method decorator receives a\n * property descriptor as a third argument), and a static method's legacy\n * `target` is the CONSTRUCTOR while an instance method's is the prototype —\n * `getDecoratorConstructor` already handles both, which is why the receiver\n * resolution is shared even though the entry point is not.\n *\n * Registration is keyed by the CONSTRUCTOR, not by its name: two packages may\n * legitimately declare a class with the same simple name (`Account` exists in\n * both `smrt-ledgers` and `smrt-messages`), and the kernel forbids inferring\n * ownership from simple names. A name-keyed store would let one package's\n * `@method({ expose: false })` withhold the other's identically-named action.\n *\n * Metadata-only: nothing is wrapped and nothing is returned, so the decorated\n * method keeps its identity and remains directly callable (#2686).\n */\nexport function registerCompatibleMethodDecorator<\n This,\n Value extends AnyMethodOf<This>,\n>(\n targetOrValue: LegacyPropertyDecoratorTarget | Value | undefined,\n propertyKeyOrContext: CompatibleMethodDecoratorContext<This, Value>,\n registerMethodDecorator: (\n ctor: Function,\n methodName: string,\n isStatic: boolean,\n ) => void,\n): void {\n if (\n typeof propertyKeyOrContext === 'string' ||\n typeof propertyKeyOrContext === 'symbol'\n ) {\n // Legacy decorators hand a STATIC method its constructor and an instance\n // method its prototype. That distinction IS the method's receiver, and\n // nothing downstream can recover it in an unscanned runtime, so capture it\n // here (#2686).\n const ctor = getDecoratorConstructor(targetOrValue);\n if (ctor) {\n registerMethodDecorator(\n ctor,\n String(propertyKeyOrContext),\n typeof targetOrValue === 'function',\n );\n }\n return;\n }\n\n const context = propertyKeyOrContext;\n const methodName = String(context.name);\n // Standard decorators state the receiver outright.\n const isStatic = context.static === true;\n const register = (ctor: Function) =>\n registerMethodDecorator(ctor, methodName, isStatic);\n const metadata = getDecoratorMetadata(context);\n\n if (metadata) {\n queuePendingFieldDecorator(metadata, register);\n return;\n }\n\n context.addInitializer?.(function registerSmrtMethodDecorator(this: unknown) {\n // A static method's initializer runs with the constructor as `this`; an\n // instance method's runs with the instance. `getDecoratorConstructor`\n // reads the constructor in the latter case, so both land on the same class.\n if (!markStandardDecoratorRegistration(this, register)) {\n return;\n }\n\n const ctor = getDecoratorConstructor(this);\n if (ctor) {\n register(ctor);\n }\n });\n}\n\nexport function registerCompatibleFieldDecorator<This, Value>(\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<This, Value>,\n registerFieldDecorator: (\n className: string,\n propertyKey: string,\n ctor?: Function,\n ) => void,\n): void {\n if (\n typeof propertyKeyOrContext === 'string' ||\n typeof propertyKeyOrContext === 'symbol'\n ) {\n const className = resolveDecoratorClassName(targetOrValue);\n if (className) {\n registerFieldDecorator(\n className,\n String(propertyKeyOrContext),\n getDecoratorConstructor(targetOrValue),\n );\n }\n return;\n }\n\n const context = propertyKeyOrContext;\n const propertyKey = String(context.name);\n // The shared queue passes the CONSTRUCTOR (the method arm needs an identity a\n // simple name cannot provide). Keep that identity for field metadata too:\n // the legacy name-keyed store remains for compatibility, while consumers that\n // need constructor isolation can retain the exact owner.\n const register = (ctor: Function) => {\n if (ctor.name) registerFieldDecorator(ctor.name, propertyKey, ctor);\n };\n const metadata = getDecoratorMetadata(context);\n\n if (metadata) {\n queuePendingFieldDecorator(metadata, register);\n return;\n }\n\n context.addInitializer?.(function registerSmrtDecorator() {\n if (!markStandardDecoratorRegistration(this, register)) {\n return;\n }\n\n const ctor = getDecoratorConstructor(this);\n if (ctor) {\n register(ctor);\n }\n });\n}\n"],"mappings":";AAEA,IAAM,+BAA+B,OAAO,IAC1C,mDACF;AACA,IAAM,iDAAiC,IAAI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ACF;CAEA,QAAQ,iBAAiB,SAAS,wBAAwB;EACxD,IAAI,CAAC,kCAAkC,MAAM,QAAQ,GACnD;EAGF,MAAM,OAAO,wBAAwB,IAAI;EACzC,IAAI,MACF,SAAS,IAAI;CAEjB,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,KAAK,yBAAyB,EAE9B,KAAK,2BAA2B,EAKjC,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,KAAK,yBAAyB,EAE9B,KAAK,2BAA2B,EAKjC,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAgBxD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAExB;;GAEG;AAC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AC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAqB1C,yBAAyB,CAChC"}
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { registerCompatibleFieldDecorator, registerCompatibleMethodDecorator } from "./compatibility.js";
|
|
2
2
|
import { ObjectRegistry } from "../registry.js";
|
|
3
3
|
//#region src/decorators/index.ts
|
|
4
|
+
function registerFieldDecoratorForCompatibility(className, propertyKey, options, ctor) {
|
|
5
|
+
ObjectRegistry.registerFieldDecorator(className, propertyKey, options, ctor);
|
|
6
|
+
}
|
|
4
7
|
/**
|
|
5
8
|
* Resolve a relationship decorator's target argument to a class name.
|
|
6
9
|
*
|
|
@@ -32,18 +35,24 @@ function resolveRelatedClassName(decoratorName, relatedClass, className, propert
|
|
|
32
35
|
if (typeof relatedClass === "string") {
|
|
33
36
|
const name = relatedClass.trim();
|
|
34
37
|
if (!name) throw new Error(`${where}: target class name is empty. Pass a class, a class name, or a \`() => Target\` thunk.`);
|
|
35
|
-
return name;
|
|
38
|
+
return { related: name };
|
|
36
39
|
}
|
|
37
40
|
if (typeof relatedClass !== "function") throw new Error(`${where}: expected a class, a class name, or a \`() => Target\` thunk, received ${relatedClass === null ? "null" : typeof relatedClass}. ${remedy}`);
|
|
38
|
-
if (relatedClass.name && relatedClass.prototype !== void 0) return
|
|
41
|
+
if (relatedClass.name && relatedClass.prototype !== void 0) return {
|
|
42
|
+
related: relatedClass.name,
|
|
43
|
+
relatedConstructor: relatedClass
|
|
44
|
+
};
|
|
39
45
|
let resolved;
|
|
40
46
|
try {
|
|
41
47
|
resolved = relatedClass();
|
|
42
48
|
} catch (error) {
|
|
43
49
|
throw new Error(`${where}: the \`() => Target\` thunk threw while resolving its target (${error instanceof Error ? error.message : String(error)}). ${remedy}`, { cause: error });
|
|
44
50
|
}
|
|
45
|
-
if (typeof resolved === "function" && resolved.name) return
|
|
46
|
-
|
|
51
|
+
if (typeof resolved === "function" && resolved.name) return {
|
|
52
|
+
related: resolved.name,
|
|
53
|
+
relatedConstructor: resolved
|
|
54
|
+
};
|
|
55
|
+
if (typeof resolved === "string" && resolved.trim()) return { related: resolved.trim() };
|
|
47
56
|
throw new Error(`${where}: the \`() => Target\` thunk resolved to ${resolved === null ? "null" : typeof resolved} instead of a named class. ${remedy}`);
|
|
48
57
|
}
|
|
49
58
|
/**
|
|
@@ -87,8 +96,8 @@ function resolveRelatedClassName(decoratorName, relatedClass, className, propert
|
|
|
87
96
|
*/
|
|
88
97
|
function field(options = {}) {
|
|
89
98
|
return ((targetOrValue, propertyKeyOrContext) => {
|
|
90
|
-
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey) => {
|
|
91
|
-
|
|
99
|
+
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey, ctor) => {
|
|
100
|
+
registerFieldDecoratorForCompatibility(className, propertyKey, options, ctor);
|
|
92
101
|
});
|
|
93
102
|
});
|
|
94
103
|
}
|
|
@@ -171,12 +180,12 @@ function field(options = {}) {
|
|
|
171
180
|
*/
|
|
172
181
|
function foreignKey(relatedClass, options = {}) {
|
|
173
182
|
return ((targetOrValue, propertyKeyOrContext) => {
|
|
174
|
-
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey) => {
|
|
175
|
-
|
|
183
|
+
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey, ctor) => {
|
|
184
|
+
registerFieldDecoratorForCompatibility(className, propertyKey, {
|
|
176
185
|
...options,
|
|
177
186
|
type: "foreignKey",
|
|
178
|
-
|
|
179
|
-
});
|
|
187
|
+
...resolveRelatedClassName("foreignKey", relatedClass, className, propertyKey)
|
|
188
|
+
}, ctor);
|
|
180
189
|
});
|
|
181
190
|
});
|
|
182
191
|
}
|
|
@@ -228,12 +237,12 @@ function foreignKey(relatedClass, options = {}) {
|
|
|
228
237
|
*/
|
|
229
238
|
function crossPackageRef(qualifiedName, options = {}) {
|
|
230
239
|
return ((targetOrValue, propertyKeyOrContext) => {
|
|
231
|
-
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey) => {
|
|
232
|
-
|
|
240
|
+
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey, ctor) => {
|
|
241
|
+
registerFieldDecoratorForCompatibility(className, propertyKey, {
|
|
233
242
|
...options,
|
|
234
243
|
type: "crossPackageRef",
|
|
235
244
|
related: qualifiedName
|
|
236
|
-
});
|
|
245
|
+
}, ctor);
|
|
237
246
|
});
|
|
238
247
|
});
|
|
239
248
|
}
|
|
@@ -309,13 +318,13 @@ function crossPackageRef(qualifiedName, options = {}) {
|
|
|
309
318
|
*/
|
|
310
319
|
function oneToMany(relatedClass, options = {}) {
|
|
311
320
|
return ((targetOrValue, propertyKeyOrContext) => {
|
|
312
|
-
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey) => {
|
|
313
|
-
|
|
321
|
+
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey, ctor) => {
|
|
322
|
+
registerFieldDecoratorForCompatibility(className, propertyKey, {
|
|
314
323
|
...options,
|
|
315
324
|
type: "oneToMany",
|
|
316
|
-
|
|
325
|
+
...resolveRelatedClassName("oneToMany", relatedClass, className, propertyKey),
|
|
317
326
|
transient: true
|
|
318
|
-
});
|
|
327
|
+
}, ctor);
|
|
319
328
|
});
|
|
320
329
|
});
|
|
321
330
|
}
|
|
@@ -347,13 +356,13 @@ function oneToMany(relatedClass, options = {}) {
|
|
|
347
356
|
*/
|
|
348
357
|
function manyToMany(relatedClass, options = {}) {
|
|
349
358
|
return ((targetOrValue, propertyKeyOrContext) => {
|
|
350
|
-
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey) => {
|
|
351
|
-
|
|
359
|
+
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey, ctor) => {
|
|
360
|
+
registerFieldDecoratorForCompatibility(className, propertyKey, {
|
|
352
361
|
...options,
|
|
353
362
|
type: "manyToMany",
|
|
354
|
-
|
|
363
|
+
...resolveRelatedClassName("manyToMany", relatedClass, className, propertyKey),
|
|
355
364
|
transient: true
|
|
356
|
-
});
|
|
365
|
+
}, ctor);
|
|
357
366
|
});
|
|
358
367
|
});
|
|
359
368
|
}
|
|
@@ -393,11 +402,11 @@ function manyToMany(relatedClass, options = {}) {
|
|
|
393
402
|
*/
|
|
394
403
|
function meta(options = {}) {
|
|
395
404
|
return ((targetOrValue, propertyKeyOrContext) => {
|
|
396
|
-
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey) => {
|
|
397
|
-
|
|
405
|
+
registerCompatibleFieldDecorator(targetOrValue, propertyKeyOrContext, (className, propertyKey, ctor) => {
|
|
406
|
+
registerFieldDecoratorForCompatibility(className, propertyKey, {
|
|
398
407
|
...options,
|
|
399
408
|
type: "meta"
|
|
400
|
-
});
|
|
409
|
+
}, ctor);
|
|
401
410
|
});
|
|
402
411
|
});
|
|
403
412
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/decorators/index.ts"],"sourcesContent":["/**\n * Field decorators for SMRT objects\n *\n * Modern decorator-based API for defining SMRT object properties.\n * Properties are typed as primitives with decorator metadata.\n */\n\nimport type {\n CustomActionScope,\n ToolEffect,\n} from '../generators/custom-action.js';\nimport type { ApiHttpMethod } from '../registry/types.js';\nimport { ObjectRegistry } from '../registry.js';\nimport type { FieldUIHints } from '../scanner/types.js';\nimport type { SQLDataType } from '../schema/types.js';\nimport {\n type CompatibleMethodDecorator,\n type CompatibleMethodDecoratorContext,\n type CompatiblePropertyDecorator,\n type CompatiblePropertyDecoratorContext,\n type LegacyPropertyDecoratorTarget,\n registerCompatibleFieldDecorator,\n registerCompatibleMethodDecorator,\n} from './compatibility.js';\n\nexport type { FieldUIHints } from '../scanner/types.js';\n\n/**\n * Meta type wrapper for STI (Single Table Inheritance) meta fields\n *\n * Fields typed as Meta<T> are stored in the _meta_data JSONB column\n * rather than as direct table columns. Used for child-specific fields\n * in STI hierarchies.\n *\n * @example\n * ```typescript\n * @smrt({ tableStrategy: 'sti' })\n * class Event extends SmrtObject {\n * title: string = '';\n * }\n *\n * @smrt()\n * class Meeting extends Event {\n * // Stored in _meta_data JSONB column\n * roomNumber: Meta<string> = '';\n * attendees: Meta<string[]> = [];\n * }\n * ```\n */\nexport type Meta<T> = T;\n\n/**\n * Base field options\n */\nexport type PrimitiveFieldType =\n | 'text'\n | 'integer'\n | 'decimal'\n | 'boolean'\n | 'datetime'\n | 'json';\n\nexport type FieldType =\n | PrimitiveFieldType\n | 'meta'\n | 'foreignKey'\n | 'crossPackageRef'\n | 'oneToMany'\n | 'manyToMany';\n\nexport interface FieldOptions {\n /** Explicit field type for runtime-only registration paths */\n type?: FieldType;\n /** Explicit SQL storage type when runtime and persistence contracts differ */\n sqlType?: SQLDataType;\n /** Whether the field is required */\n required?: boolean;\n /** Default value for the field */\n default?: unknown;\n /** Whether the field is unique */\n unique?: boolean;\n /**\n * When `true`, the schema emits a database index targeting this field.\n *\n * For regular (column-backed) fields the index is a plain column index.\n * For `@meta()` fields stored inside `_meta_data` JSONB, the index targets\n * the JSON path — `json_extract(_meta_data, '$.fieldName')` on SQLite,\n * `(_meta_data->>'fieldName')` on Postgres.\n *\n * Note that `collection.list({ where })` cannot currently reach a JSON-path\n * index: dot-notation keys such as `_meta_data.fieldName` are rejected,\n * because nothing rewrites them into the matching extraction expression\n * (#2276, tracked in #2282). The index is still emitted and still serves\n * hand-written SQL that spells the expression out; it just has no\n * collection-level query to accelerate yet.\n */\n indexed?: boolean;\n /** Whether the field is nullable */\n nullable?: boolean;\n /** Whether the field should be excluded from database */\n transient?: boolean;\n /**\n * Marks the field as sensitive (e.g. API secrets, credentials, tax IDs).\n *\n * Sensitive fields are still persisted to the database, but the framework:\n * - excludes them from `toPublicJSON()` (the serializer used by generated\n * REST/MCP/SvelteKit routes), so they never appear in API responses; and\n * - rejects them as `where`-clause filter keys, closing the\n * `?secret[like]=...` value-probing oracle.\n *\n * Use this for any column that holds a secret value that must never be\n * read back over a generated network surface.\n */\n sensitive?: boolean;\n /**\n * Marks the field as read-only over generated write surfaces.\n *\n * Read-only fields are stripped from the request body before\n * `create`/`update` in generated REST/MCP/SvelteKit routes, so callers\n * cannot mass-assign them. Server-side code can still set them directly.\n */\n readonly?: boolean;\n /**\n * Permission slug required to include this field in public/read responses.\n *\n * Fields with a read permission are fail-closed: generated serializers omit\n * them unless the caller's resolved permission set contains this slug.\n * `sensitive: true` still wins and omits the field for every caller.\n */\n readPermission?: string;\n /** Field description */\n description?: string;\n /**\n * Static UI hints for the field-policy rail (#2046, epic #2045).\n *\n * A pure presentation seed — carried in the manifest under the field's\n * `_meta.ui`, readable at runtime via `getAllFields()` at `field._meta.ui`,\n * and emitted to the browser in generated web-collection definitions. Has no\n * schema, persistence, or security effect; `sensitive`/`readPermission`\n * remain the security rail.\n */\n ui?: FieldUIHints;\n /**\n * Controls whether the field is included in JSON exports.\n * - `true`: Always exported (unless site explicitly excludes it)\n * - `false`: Never exported (cannot be overridden by site config)\n * - `undefined`: Uses site's fieldExportDefault setting\n */\n exported?: boolean;\n}\n\n/**\n * Options for text fields\n */\nexport interface TextFieldOptions extends FieldOptions {\n /** Minimum length for text fields */\n minLength?: number;\n /** Maximum length for text fields */\n maxLength?: number;\n /** Regex pattern for validation */\n pattern?: RegExp | string;\n}\n\n/**\n * Options for numeric fields\n */\nexport interface NumericFieldOptions extends FieldOptions {\n /** Minimum value */\n min?: number;\n /** Maximum value */\n max?: number;\n}\n\n/**\n * Options for relationship fields\n */\nexport interface RelationshipFieldOptions extends FieldOptions {\n /** Related class name */\n related?: string;\n /** Foreign key field name */\n foreignKey?: string;\n /** Through table for many-to-many */\n through?: string;\n /** Relationship type */\n type?: 'foreignKey' | 'crossPackageRef' | 'oneToMany' | 'manyToMany';\n /**\n * What happens to this row when the referenced object is deleted (#2371).\n *\n * Same-package references emit this DB-level action and `SmrtObject.delete()`\n * enforces the same policy in the application layer:\n *\n * - `'CASCADE'` — this row is deleted with the target.\n * - `'SET NULL'` — this column is set to `NULL`. The field must be nullable;\n * declaring it on a `required` field throws `ConfigurationError`.\n * - `'RESTRICT'` — deleting the target throws `DatabaseError` while any row\n * still points at it.\n *\n * When omitted, a column that is part of this class's `conflictColumns`\n * (junction and association rows, which are *identified* by the reference)\n * defaults to `CASCADE`; every other same-package column defaults to\n * immediate `NO ACTION`.\n * `@tenantId()` fields are the one exception: `smrt-tenancy` leads a\n * tenant-scoped class's default `conflictColumns` with the tenant column,\n * but that column scopes ownership rather than identifying the row, so it\n * is never defaulted to `CASCADE` — deleting a `Tenant` must not cascade\n * through every tenant-scoped table.\n *\n * Cascaded rows are removed set-based: their `beforeDelete`/`afterDelete`\n * hooks and interceptors do not run and no change-feed entry is written, the\n * same as a database-level `ON DELETE CASCADE`.\n */\n onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';\n /**\n * Set to `false` only for an app-side relationship whose target identifier\n * must deliberately survive without a database parent row (for example an\n * immutable audit/event record retained after its parent is pruned).\n *\n * The field remains a typed `foreignKey` relationship for loading and\n * indexes, but no physical DDL constraint, schema dependency, or app-side\n * delete action is emitted. The stored identifier is deliberately preserved\n * after the parent is deleted. Ordinary same-package relationships must leave\n * this enabled (the default).\n */\n constraint?:\n | boolean\n | {\n /**\n * Database engines on which SMRT emits the physical constraint.\n *\n * Relationship loading, UUID storage, indexes, and application-side\n * delete enforcement remain active on every engine. Use this narrow\n * allowlist only when an engine cannot faithfully enforce a supported\n * relationship shape (for example a DuckDB self-reference).\n */\n engines: Array<'postgres' | 'sqlite' | 'duckdb' | 'json'>;\n };\n}\n\n/**\n * Options specific to cross-package references.\n */\nexport interface CrossPackageRefOptions\n extends Omit<RelationshipFieldOptions, 'related' | 'type'> {\n /**\n * Storage type for the referenced target id. Defaults to 'uuid'.\n *\n * Use 'text' only when the external target model declares\n * `@smrt({ idType: 'text' })`.\n */\n idType?: 'uuid' | 'text';\n\n /**\n * When `true`, the framework verifies the referenced object exists at save time.\n * Validation uses the target package's manifest (loaded on demand via\n * `ObjectRegistry.ensureManifestLoaded()`), so this requires the target manifest\n * to be discoverable at runtime.\n *\n * Empty/null values are always allowed (treated as \"no reference set\").\n *\n * Defaults to `false` — same behavior as a plain string field today.\n */\n validate?: boolean;\n}\n\n/**\n * Resolve a relationship decorator's target argument to a class name.\n *\n * Accepted target forms:\n * - `'Target'` — class name string; resolves lazily, immune to import cycles.\n * - `Target` — class constructor.\n * - `() => Target` — thunk (inline or a named `const`), invoked here to read\n * the name, so its target must already be initialized.\n *\n * A thunk's own `.name` is `''`, so reading `relatedClass.name` used to register\n * `related: ''` (issue #2379): the field kept `type: 'foreignKey'` but lost its\n * target, which silently dropped the relationship edge, `loadRelated()`, and any\n * FK-derived index. Thunks are therefore invoked at decoration time and an\n * unresolvable target throws with the string form as the remedy — an empty\n * `related` is never registered.\n *\n * Resolution runs inside the field-registration callback, which is the latest\n * point in the decorator lifecycle (after the class binding exists for legacy\n * decorators, and at `@smrt()` application time for standard decorators), so a\n * self-referential `() => Self` thunk resolves rather than hitting the TDZ.\n * A thunk pointing at a class declared LATER in the same module is still in\n * that class's temporal dead zone when the decorators of the earlier class run;\n * that now fails loudly, naming the string form, instead of silently\n * registering an empty target.\n */\nfunction resolveRelatedClassName(\n decoratorName: 'foreignKey' | 'oneToMany' | 'manyToMany',\n relatedClass: string | Function,\n className: string,\n propertyKey: string,\n): string {\n const where = `@${decoratorName}() on ${className}.${propertyKey}`;\n const remedy =\n `Pass the target class name as a string instead — ` +\n `\\`@${decoratorName}('Target')\\` resolves lazily and is immune to import cycles.`;\n\n if (typeof relatedClass === 'string') {\n const name = relatedClass.trim();\n if (!name) {\n throw new Error(\n `${where}: target class name is empty. Pass a class, a class name, or a \\`() => Target\\` thunk.`,\n );\n }\n return name;\n }\n\n if (typeof relatedClass !== 'function') {\n throw new Error(\n `${where}: expected a class, a class name, or a \\`() => Target\\` thunk, received ${relatedClass === null ? 'null' : typeof relatedClass}. ${remedy}`,\n );\n }\n\n // Class/function reference — the common `@foreignKey(Target)` form. Arrow\n // functions have no `prototype`, so a *named* thunk (`const lazyTarget = () =>\n // Target`) is still routed to the thunk branch below instead of registering\n // the variable name as the target class.\n if (relatedClass.name && relatedClass.prototype !== undefined) {\n return relatedClass.name;\n }\n\n // Thunk (`() => Target`, named or inline) — invoke it for the target.\n let resolved: unknown;\n try {\n resolved = (relatedClass as () => unknown)();\n } catch (error) {\n throw new Error(\n `${where}: the \\`() => Target\\` thunk threw while resolving its target (${\n error instanceof Error ? error.message : String(error)\n }). ${remedy}`,\n { cause: error },\n );\n }\n\n if (typeof resolved === 'function' && resolved.name) {\n return resolved.name;\n }\n if (typeof resolved === 'string' && resolved.trim()) {\n return resolved.trim();\n }\n\n throw new Error(\n `${where}: the \\`() => Target\\` thunk resolved to ${\n resolved === null ? 'null' : typeof resolved\n } instead of a named class. ${remedy}`,\n );\n}\n\n/**\n * Marks a class property with validation constraints and metadata options.\n *\n * Use `@field()` when you need options beyond what plain TypeScript initializers\n * express — required validation, numeric ranges, string length limits, uniqueness,\n * or transient (non-persisted) computed properties.\n *\n * For plain persisted fields with no constraints, no decorator is needed: just\n * declare the property with a TypeScript initializer and the framework will infer\n * the column type from the default value (`0` → INTEGER, `0.0` → DECIMAL, `''` → TEXT).\n *\n * @param options - Field configuration options\n * @param options.required - If `true`, `save()` throws `ValidationError` when empty/null\n * @param options.unique - Enforces a UNIQUE database constraint\n * @param options.nullable - If `true`, the column accepts NULL (default depends on type)\n * @param options.transient - If `true`, the property is not persisted to the database\n * @param options.default - Default value applied at the database level\n * @param options.description - Human-readable description used in generated API docs\n * @param options.exported - Controls JSON export visibility (see `FieldOptions`)\n * @returns A TypeScript property decorator\n *\n * @example\n * ```typescript\n * @smrt()\n * class Product extends SmrtObject {\n * @field({ required: true, maxLength: 100 })\n * name: string = '';\n *\n * @field({ min: 0 })\n * stock: number = 0;\n *\n * @field({ transient: true })\n * get displayPrice(): string { return `$${this.price.toFixed(2)}`; }\n * }\n * ```\n *\n * @see {@link meta} for STI child-specific fields stored in `_meta_data` JSON\n * @see {@link foreignKey} for typed relationship fields\n */\nexport function field(\n options: FieldOptions | NumericFieldOptions | TextFieldOptions = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, options);\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a many-to-one (foreign key) relationship to another `SmrtObject` class.\n *\n * The decorated property stores the UUID of the related object. At runtime, call\n * `instance.loadRelated('fieldName')` to lazy-load (and cache) the related object,\n * or pass `include: ['fieldName']` to `collection.list()` for batch eager loading.\n *\n * Cross-package rule: Use `@foreignKey()` only for same-package references.\n * Use `@crossPackageRef()` for cross-package relationships.\n *\n * A named database constraint is emitted on supported engines by default, and\n * the same action is enforced by `SmrtObject.delete()` before the engine sees\n * it. Exceptional archival/audit references that intentionally outlive their\n * parent may declare `{ constraint: false }`; they retain relationship loading\n * and indexing while deliberately preserving the identifier after parent\n * deletion and omitting physical DDL. The\n * decorator also enables `loadRelated()` and eager `include:` loading:\n *\n * ```typescript\n * @foreignKey(Order, { onDelete: 'CASCADE' }) // deleted with the order\n * orderId: string = '';\n *\n * @foreignKey(Customer, { onDelete: 'RESTRICT' }) // blocks the customer delete\n * customerId: string = '';\n * ```\n *\n * Without an `onDelete`, a column that is part of this class's\n * `conflictColumns` defaults to `CASCADE` (this is what cleans up junction\n * rows); any other column defaults to immediate `NO ACTION`.\n *\n * @param relatedClass - The target class constructor, its name as a string, or a\n * `() => Target` thunk. A thunk is **invoked at decoration time**, so its\n * target must already be initialized: a class from an already-evaluated module\n * or the decorated class itself. Use the string form for a class declared\n * later in the same module or reached through an import cycle — it is never\n * evaluated, so it cannot hit the temporal dead zone.\n * @param options - Optional field constraints (required, nullable, etc.)\n * @returns A TypeScript property decorator\n * @throws Error when the target cannot be resolved to a class name (an empty\n * string, a thunk that throws — including on an uninitialized target — or a\n * thunk returning an anonymous value)\n *\n * @example\n * ```typescript\n * @smrt()\n * class Order extends SmrtObject {\n * // Same-package FK — enables loadRelated() and eager loading\n * @foreignKey(Customer)\n * customerId: string = '';\n *\n * // Self-reference: the class binding exists when its decorators run\n * @foreignKey(() => Order)\n * parentOrderId: string = '';\n *\n * // Declared later in this module — name string, never evaluated\n * @foreignKey('Invoice')\n * invoiceId: string = '';\n *\n * // Physical constraint only where the engine can enforce this shape;\n * // relationship loading and app-side delete policy remain cross-engine.\n * @foreignKey('Order', {\n * constraint: { engines: ['postgres', 'sqlite'] },\n * })\n * hierarchyParentId: string | null = null;\n * }\n *\n * // Cross-package: runtime relationship, index, and loading; no physical FK\n * @smrt()\n * class Post extends SmrtObject {\n * @crossPackageRef('@happyvertical/smrt-users:User')\n * authorId: string = '';\n * }\n * ```\n *\n * @see {@link oneToMany} for the inverse (parent) side of the relationship\n * @see SmrtObject.loadRelated for lazy-loading the related object at runtime\n */\nexport function foreignKey(\n relatedClass: string | Function,\n options: Omit<RelationshipFieldOptions, 'related'> = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'foreignKey',\n related: resolveRelatedClassName(\n 'foreignKey',\n relatedClass,\n className,\n propertyKey,\n ),\n });\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a cross-package foreign key reference.\n *\n * Use this for relationships that point to a `SmrtObject` in a *different* package\n * (e.g. `Customer.profileId` pointing at `@happyvertical/smrt-profiles:Profile`).\n *\n * Unlike same-package `@foreignKey()`, this emits **no** DDL `FOREIGN KEY`\n * constraint, keeping package schemas independently installable. The property is a\n * `UUID` column on PostgreSQL/DuckDB and `TEXT` on SQLite, matching the target's\n * id type; pass `{ idType: 'text' }` when the target declares\n * `@smrt({ idType: 'text' })`.\n *\n * What you get over a plain string field:\n * - The relationship is registered with the `ObjectRegistry`, so `loadRelated()`\n * and `Collection.list({ include })` can resolve it once the target package's\n * manifest is loaded.\n * - No physical database constraint is emitted; package schemas remain\n * independently installable.\n * - Optional save-time validation (`validate: true`) confirms the referenced\n * object exists, catching typos and stale IDs before they hit the database.\n * - `onDelete` is honoured by `SmrtObject.delete()` when the target package's\n * manifest is loaded in the same runtime.\n *\n * The `qualifiedName` is a fully-qualified class identifier in the form\n * `@package/scope:ClassName` — for example `@happyvertical/smrt-profiles:Profile`.\n *\n * @param qualifiedName - Qualified name of the target class\n * @param options - Optional field constraints and `validate` flag\n * @returns A TypeScript property decorator\n *\n * @example\n * ```typescript\n * @smrt()\n * class Customer extends SmrtObject {\n * @crossPackageRef('@happyvertical/smrt-profiles:Profile')\n * profileId: string = '';\n *\n * // With save-time validation\n * @crossPackageRef('@happyvertical/smrt-profiles:Profile', { validate: true })\n * primaryContactId: string = '';\n * }\n * ```\n *\n * @see {@link foreignKey} for same-package relationships\n * @see SmrtObject.loadRelated for runtime resolution\n */\nexport function crossPackageRef(\n qualifiedName: string,\n options: CrossPackageRefOptions = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'crossPackageRef',\n related: qualifiedName,\n });\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a one-to-many relationship from this object to a collection of related objects.\n *\n * The decorated property is `transient` — it is not persisted as a database column.\n * At runtime, call `instance.loadRelatedMany('fieldName')` to load the related objects,\n * or pass `include: ['fieldName']` to `collection.list()` for batch eager loading (issues\n * a single batched query for all instances instead of N individual queries).\n *\n * The inverse side (`@foreignKey`) must exist on the `relatedClass` pointing back to this\n * class. The framework discovers it automatically via `ObjectRegistry.getInverseRelationships()`.\n *\n * **Generated accessor (R10):** registering the class installs a consistent\n * `get<FieldName>()` instance method (e.g. `items` → `order.getItems()`) that\n * delegates to `loadRelatedMany('items')`. Generation is additive — a\n * hand-rolled method of the same name is never overwritten.\n *\n * **Disambiguation:** when `relatedClass` declares more than one `@foreignKey`\n * back to this class, pass `{ foreignKey: '<inverseFieldName>' }` so both\n * `loadRelatedMany` and the generated accessor resolve the intended inverse\n * side. Without it the first matching foreign key is used.\n *\n * **Delete behaviour is declared on the child, not here.** `@oneToMany` is a\n * transient read-side accessor; to have children removed with their parent,\n * put `onDelete: 'CASCADE'` on the inverse `@foreignKey` (#2371):\n *\n * ```typescript\n * class OrderItem extends SmrtObject {\n * @foreignKey(Order, { onDelete: 'CASCADE' })\n * orderId: string = '';\n * }\n * ```\n *\n * @param relatedClass - The class constructor of the child/related objects\n * @param options - Optional relationship options. `foreignKey` selects the\n * inverse foreign-key field on `relatedClass` when it has more than one.\n * @returns A TypeScript property decorator (sets `transient: true` automatically)\n *\n * @example\n * ```typescript\n * @smrt()\n * class Order extends SmrtObject {\n * @oneToMany(OrderItem)\n * items: OrderItem[] = [];\n * }\n *\n * @smrt()\n * class OrderItem extends SmrtObject {\n * @foreignKey(Order)\n * orderId: string = '';\n * }\n *\n * const order = await orders.get({ id });\n * const items = await order.getItems(); // generated; === loadRelatedMany('items')\n * ```\n *\n * @example\n * ```typescript\n * // Multiple inverse foreign keys → disambiguate explicitly.\n * @smrt()\n * class Profile extends SmrtObject {\n * @oneToMany(ProfileRelationship, { foreignKey: 'fromProfileId' })\n * relationshipsFrom: ProfileRelationship[] = [];\n * @oneToMany(ProfileRelationship, { foreignKey: 'toProfileId' })\n * relationshipsTo: ProfileRelationship[] = [];\n * }\n * ```\n *\n * @see {@link foreignKey} for the many-to-one (child) side of the relationship\n * @see SmrtObject.loadRelatedMany for lazy-loading at runtime\n */\nexport function oneToMany(\n relatedClass: string | Function,\n options: Omit<RelationshipFieldOptions, 'related'> = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'oneToMany',\n related: resolveRelatedClassName(\n 'oneToMany',\n relatedClass,\n className,\n propertyKey,\n ),\n transient: true, // Relationship fields are not database columns\n });\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a many-to-many relationship between two `SmrtObject` classes via a join table.\n *\n * The decorated property is `transient` — it is not persisted as a database column.\n * The `through` option specifies the junction table name. The join table model must\n * be decorated with `@smrt({ conflictColumns: ['...', '...'] })` to use the natural\n * key columns for upsert operations.\n *\n * Runtime loading: call `instance.loadRelatedMany('field')` to lazy-load, or\n * pass `include: ['field']` to `collection.list()` for batched eager loading.\n *\n * @param relatedClass - The class constructor of the related objects\n * @param options - Relationship options; `through` specifies the junction table name\n * @returns A TypeScript property decorator (sets `transient: true` automatically)\n *\n * @example\n * ```typescript\n * @smrt()\n * class Product extends SmrtObject {\n * @manyToMany(Tag, { through: 'product_tags' })\n * tags: Tag[] = [];\n * }\n * ```\n *\n * @see {@link oneToMany} for one-to-many relationships\n */\nexport function manyToMany(\n relatedClass: string | Function,\n options: Omit<RelationshipFieldOptions, 'related'> = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'manyToMany',\n related: resolveRelatedClassName(\n 'manyToMany',\n relatedClass,\n className,\n propertyKey,\n ),\n transient: true, // Relationship fields are not database columns\n });\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Marks a field as a Single Table Inheritance (STI) meta field.\n *\n * Meta fields are stored in the `_meta_data` JSONB column on the shared STI\n * table rather than as dedicated table columns. Use this decorator for fields\n * that are specific to an STI child class and should not pollute the shared\n * table schema with child-specific columns.\n *\n * The `@smrt({ tableStrategy: 'sti' })` decorator must be set on the base class.\n * All child-specific fields should use `@meta()` (or the `Meta<T>` type alias).\n *\n * @param options - Standard field options (required, nullable, description, etc.)\n * @returns A TypeScript property decorator (registers field with `type: 'meta'`)\n *\n * @example\n * ```typescript\n * @smrt({ tableStrategy: 'sti' })\n * class Event extends SmrtObject {\n * title: string = ''; // shared column on events table\n * }\n *\n * @smrt()\n * class Meeting extends Event {\n * @meta()\n * roomNumber: string = ''; // stored in _meta_data JSON, not a column\n *\n * @meta({ required: true })\n * durationMinutes: number = 60;\n * }\n * ```\n *\n * @see {@link Meta} for the equivalent type alias approach\n * @see {@link field} for regular (non-STI) field declarations\n */\nexport function meta(options: FieldOptions = {}) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'meta', // Mark this field as a meta field for STI\n });\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Options for {@link method}.\n *\n * Every option is optional, and an omitted one falls back to the class-level\n * `api.routes[methodName]` entry (or `ai.descriptions[methodName]` for\n * `description`) when one exists. The merge is FIELD BY FIELD, so adding\n * `@method({ description })` to a class that already declares a route verb and\n * path does not reset them (#2686).\n */\nexport interface MethodOptions {\n /**\n * Override the default routing decision.\n *\n * Public methods are routed by default when they are WIRE-ABLE: every\n * parameter can be built from a JSON request body or query string. Set\n * `false` to withhold a method the heuristic accepted, `true` to expose one\n * it rejected.\n *\n * `true` bypasses the heuristic and NOTHING else. It cannot manufacture a\n * receiver, undo `api: false`, cross an `include`/`exclude` boundary, reach a\n * non-public method, claim a CRUD verb, or hydrate a value the transport\n * cannot build — a model-instance parameter still arrives as whatever JSON\n * the caller sent.\n */\n expose?: boolean;\n\n /**\n * Why the method is withheld. Recorded in the knowledge artifact so\n * `smrt doctor` and agents read an explanation instead of silence.\n */\n reason?: string;\n\n /**\n * HTTP verb for the generated route. Defaults to `POST`.\n *\n * Named `httpMethod`, not `method`: RFC 9110 calls this the request\n * \"method\", so the protocol word is exactly the one that collides with the\n * decorator's own name, and `@method({ method: 'POST' })` stutters.\n * `httpMethod` is also already this framework's name for it — `ApiHttpMethod`\n * is carried across the whole discovery/invoke path.\n *\n * Migrates from `api.routes[methodName].method`.\n */\n httpMethod?: ApiHttpMethod;\n\n /**\n * Route path segment(s), used verbatim and split on `/`.\n * Defaults to the method name. Migrates from `api.routes[methodName].path`.\n */\n path?: string;\n\n /**\n * Declared receiver scope. Migrates from `api.routes[methodName].scope`.\n *\n * A DECLARATION checked against the method's executable receiver, not a\n * relocation: an instance method is item-scoped and a static (or\n * collection-class) method is collection-scoped, and no config can change\n * that. A contradicting value is reported at build time and ignored.\n */\n scope?: CustomActionScope;\n\n /**\n * Agent-visible effect classification. Omitted actions are treated as\n * `destructive`, so missing metadata can never widen browser capability\n * exposure. Migrates from `api.routes[methodName].effect`.\n */\n effect?: ToolEffect;\n\n /** Whether repeating the action with the same arguments is safe. */\n idempotent?: boolean;\n\n /** Whether the action may interact outside the SMRT application. */\n openWorld?: boolean;\n\n /**\n * Description used by AI/tool surfaces, overriding the method's JSDoc.\n * Migrates from `ai.descriptions[methodName]`.\n */\n description?: string;\n}\n\n/**\n * Refines how a method is exposed on generated surfaces.\n *\n * The method counterpart of {@link field}, and symmetric with it: a manifest\n * records exactly two collections per object, `fields` and `methods`. Neither\n * decorator DECLARES its member — a property is a field because it is a\n * property, and a method is a candidate action because it is public — both\n * REFINE what the framework already inferred. `@field()` refines an inferred\n * column type and constraints; `@method()` refines inferred exposure, its\n * route shape, and its tool semantics.\n *\n * The name is `@method()` rather than `@action()` because of the negative\n * case: withholding a method has to read correctly, and\n * `@action({ expose: false })` contradicts itself — declaring something an\n * action in order to say it is not one. \"Action\" keeps its established meaning\n * in the generators (a non-CRUD method exposed on a surface); this decorator\n * is how a method BECOMES one.\n *\n * Metadata only: the decorated method is not wrapped and keeps its identity,\n * so it stays directly callable.\n *\n * @example Shape the generated route\n * ```typescript\n * @method({ httpMethod: 'POST', path: 'reviews', effect: 'write' })\n * async runReview(options?: RunContentReviewOptions) { … }\n * ```\n *\n * @example Withhold a method the heuristic would have routed\n * ```typescript\n * @method({ expose: false, reason: 'callback registration, not a wire operation' })\n * static registerValidator(validator: ValidatorFunction) { … }\n * ```\n *\n * @example Force a route the heuristic rejected\n * ```typescript\n * // `expose: true` bypasses the heuristic only — this method must still\n * // accept whatever JSON the caller sends for `asset`.\n * @method({ expose: true })\n * async addAsset(asset: Asset) { … }\n * ```\n *\n * @see {@link field} for the property-side refinement decorator\n */\nexport function method(options: MethodOptions = {}) {\n return ((\n targetOrValue: unknown,\n propertyKeyOrContext: CompatibleMethodDecoratorContext<\n unknown,\n // biome-ignore lint/suspicious/noExplicitAny: mirrors the lib's own `ClassMethodDecoratorContext` constraint; see `AnyMethodOf` in `compatibility.ts`. S4 #1579.\n (this: unknown, ...args: any) => any\n >,\n ) => {\n registerCompatibleMethodDecorator(\n targetOrValue as LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext,\n (ctor, methodName, isStatic) => {\n ObjectRegistry.registerMethodDecorator(\n ctor,\n methodName,\n options,\n isStatic,\n );\n },\n );\n }) as CompatibleMethodDecorator;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiSA,SAAS,wBACP,eACA,cACA,WACA,aACQ;CACR,MAAM,QAAQ,IAAI,cAAc,QAAQ,UAAU,GAAG;CACrD,MAAM,SACJ,uDACM,cAAc;CAEtB,IAAI,OAAO,iBAAiB,UAAU;EACpC,MAAM,OAAO,aAAa,KAAK;EAC/B,IAAI,CAAC,MACH,MAAM,IAAI,MACR,GAAG,MAAM,uFACX;EAEF,OAAO;CACT;CAEA,IAAI,OAAO,iBAAiB,YAC1B,MAAM,IAAI,MACR,GAAG,MAAM,0EAA0E,iBAAiB,OAAO,SAAS,OAAO,aAAa,IAAI,QAC9I;CAOF,IAAI,aAAa,QAAQ,aAAa,cAAc,KAAA,GAClD,OAAO,aAAa;CAItB,IAAI;CACJ,IAAI;EACF,WAAY,aAA+B;CAC7C,SAAS,OAAO;EACd,MAAM,IAAI,MACR,GAAG,MAAM,iEACP,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EACtD,KAAK,UACN,EAAE,OAAO,MAAM,CACjB;CACF;CAEA,IAAI,OAAO,aAAa,cAAc,SAAS,MAC7C,OAAO,SAAS;CAElB,IAAI,OAAO,aAAa,YAAY,SAAS,KAAK,GAChD,OAAO,SAAS,KAAK;CAGvB,MAAM,IAAI,MACR,GAAG,MAAM,2CACP,aAAa,OAAO,SAAS,OAAO,SACrC,6BAA6B,QAChC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,MACd,UAAiE,CAAC,GAClE;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa,OAAO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,KAAK,UAAwB,CAAC,GAAG;CAC/C,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa;IAC5D,GAAG;IACH,MAAM;GACR,CAAC;EACH,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HA,SAAgB,OAAO,UAAyB,CAAC,GAAG;CAClD,SACE,eACA,yBAKG;EACH,kCACE,eACA,uBACC,MAAM,YAAY,aAAa;GAC9B,eAAe,wBACb,MACA,YACA,SACA,QACF;EACF,CACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/decorators/index.ts"],"sourcesContent":["/**\n * Field decorators for SMRT objects\n *\n * Modern decorator-based API for defining SMRT object properties.\n * Properties are typed as primitives with decorator metadata.\n */\n\nimport type {\n CustomActionScope,\n ToolEffect,\n} from '../generators/custom-action.js';\nimport type { ApiHttpMethod } from '../registry/types.js';\nimport { ObjectRegistry } from '../registry.js';\nimport type { FieldUIHints } from '../scanner/types.js';\nimport type { SQLDataType } from '../schema/types.js';\nimport {\n type CompatibleMethodDecorator,\n type CompatibleMethodDecoratorContext,\n type CompatiblePropertyDecorator,\n type CompatiblePropertyDecoratorContext,\n type LegacyPropertyDecoratorTarget,\n registerCompatibleFieldDecorator,\n registerCompatibleMethodDecorator,\n} from './compatibility.js';\n\nexport type { FieldUIHints } from '../scanner/types.js';\n\ntype CompatibleFieldDecoratorOptions = FieldOptions & {\n related?: string;\n relatedConstructor?: Function;\n};\n\nfunction registerFieldDecoratorForCompatibility(\n className: string,\n propertyKey: string,\n options: CompatibleFieldDecoratorOptions,\n ctor?: Function,\n): void {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, options, ctor);\n}\n\n/**\n * Meta type wrapper for STI (Single Table Inheritance) meta fields\n *\n * Fields typed as Meta<T> are stored in the _meta_data JSONB column\n * rather than as direct table columns. Used for child-specific fields\n * in STI hierarchies.\n *\n * @example\n * ```typescript\n * @smrt({ tableStrategy: 'sti' })\n * class Event extends SmrtObject {\n * title: string = '';\n * }\n *\n * @smrt()\n * class Meeting extends Event {\n * // Stored in _meta_data JSONB column\n * roomNumber: Meta<string> = '';\n * attendees: Meta<string[]> = [];\n * }\n * ```\n */\nexport type Meta<T> = T;\n\n/**\n * Base field options\n */\nexport type PrimitiveFieldType =\n | 'text'\n | 'integer'\n | 'decimal'\n | 'boolean'\n | 'datetime'\n | 'json';\n\nexport type FieldType =\n | PrimitiveFieldType\n | 'meta'\n | 'foreignKey'\n | 'crossPackageRef'\n | 'oneToMany'\n | 'manyToMany';\n\nexport interface FieldOptions {\n /** Explicit field type for runtime-only registration paths */\n type?: FieldType;\n /** Explicit SQL storage type when runtime and persistence contracts differ */\n sqlType?: SQLDataType;\n /** Whether the field is required */\n required?: boolean;\n /** Default value for the field */\n default?: unknown;\n /** Whether the field is unique */\n unique?: boolean;\n /**\n * When `true`, the schema emits a database index targeting this field.\n *\n * For regular (column-backed) fields the index is a plain column index.\n * For `@meta()` fields stored inside `_meta_data` JSONB, the index targets\n * the JSON path — `json_extract(_meta_data, '$.fieldName')` on SQLite,\n * `(_meta_data->>'fieldName')` on Postgres.\n *\n * Note that `collection.list({ where })` cannot currently reach a JSON-path\n * index: dot-notation keys such as `_meta_data.fieldName` are rejected,\n * because nothing rewrites them into the matching extraction expression\n * (#2276, tracked in #2282). The index is still emitted and still serves\n * hand-written SQL that spells the expression out; it just has no\n * collection-level query to accelerate yet.\n */\n indexed?: boolean;\n /** Whether the field is nullable */\n nullable?: boolean;\n /** Whether the field should be excluded from database */\n transient?: boolean;\n /**\n * Marks the field as sensitive (e.g. API secrets, credentials, tax IDs).\n *\n * Sensitive fields are still persisted to the database, but the framework:\n * - excludes them from `toPublicJSON()` (the serializer used by generated\n * REST/MCP/SvelteKit routes), so they never appear in API responses; and\n * - rejects them as `where`-clause filter keys, closing the\n * `?secret[like]=...` value-probing oracle.\n *\n * Use this for any column that holds a secret value that must never be\n * read back over a generated network surface.\n */\n sensitive?: boolean;\n /**\n * Marks the field as read-only over generated write surfaces.\n *\n * Read-only fields are stripped from the request body before\n * `create`/`update` in generated REST/MCP/SvelteKit routes, so callers\n * cannot mass-assign them. Server-side code can still set them directly.\n */\n readonly?: boolean;\n /**\n * Permission slug required to include this field in public/read responses.\n *\n * Fields with a read permission are fail-closed: generated serializers omit\n * them unless the caller's resolved permission set contains this slug.\n * `sensitive: true` still wins and omits the field for every caller.\n */\n readPermission?: string;\n /** Field description */\n description?: string;\n /**\n * Static UI hints for the field-policy rail (#2046, epic #2045).\n *\n * A pure presentation seed — carried in the manifest under the field's\n * `_meta.ui`, readable at runtime via `getAllFields()` at `field._meta.ui`,\n * and emitted to the browser in generated web-collection definitions. Has no\n * schema, persistence, or security effect; `sensitive`/`readPermission`\n * remain the security rail.\n */\n ui?: FieldUIHints;\n /**\n * Controls whether the field is included in JSON exports.\n * - `true`: Always exported (unless site explicitly excludes it)\n * - `false`: Never exported (cannot be overridden by site config)\n * - `undefined`: Uses site's fieldExportDefault setting\n */\n exported?: boolean;\n}\n\n/**\n * Options for text fields\n */\nexport interface TextFieldOptions extends FieldOptions {\n /** Minimum length for text fields */\n minLength?: number;\n /** Maximum length for text fields */\n maxLength?: number;\n /** Regex pattern for validation */\n pattern?: RegExp | string;\n}\n\n/**\n * Options for numeric fields\n */\nexport interface NumericFieldOptions extends FieldOptions {\n /** Minimum value */\n min?: number;\n /** Maximum value */\n max?: number;\n}\n\n/**\n * Options for relationship fields\n */\nexport interface RelationshipFieldOptions extends FieldOptions {\n /** Related class name */\n related?: string;\n /** Foreign key field name */\n foreignKey?: string;\n /** Through table for many-to-many */\n through?: string;\n /** Relationship type */\n type?: 'foreignKey' | 'crossPackageRef' | 'oneToMany' | 'manyToMany';\n /**\n * What happens to this row when the referenced object is deleted (#2371).\n *\n * Same-package references emit this DB-level action and `SmrtObject.delete()`\n * enforces the same policy in the application layer:\n *\n * - `'CASCADE'` — this row is deleted with the target.\n * - `'SET NULL'` — this column is set to `NULL`. The field must be nullable;\n * declaring it on a `required` field throws `ConfigurationError`.\n * - `'RESTRICT'` — deleting the target throws `DatabaseError` while any row\n * still points at it.\n *\n * When omitted, a column that is part of this class's `conflictColumns`\n * (junction and association rows, which are *identified* by the reference)\n * defaults to `CASCADE`; every other same-package column defaults to\n * immediate `NO ACTION`.\n * `@tenantId()` fields are the one exception: `smrt-tenancy` leads a\n * tenant-scoped class's default `conflictColumns` with the tenant column,\n * but that column scopes ownership rather than identifying the row, so it\n * is never defaulted to `CASCADE` — deleting a `Tenant` must not cascade\n * through every tenant-scoped table.\n *\n * Cascaded rows are removed set-based: their `beforeDelete`/`afterDelete`\n * hooks and interceptors do not run and no change-feed entry is written, the\n * same as a database-level `ON DELETE CASCADE`.\n */\n onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';\n /**\n * Set to `false` only for an app-side relationship whose target identifier\n * must deliberately survive without a database parent row (for example an\n * immutable audit/event record retained after its parent is pruned).\n *\n * The field remains a typed `foreignKey` relationship for loading and\n * indexes, but no physical DDL constraint, schema dependency, or app-side\n * delete action is emitted. The stored identifier is deliberately preserved\n * after the parent is deleted. Ordinary same-package relationships must leave\n * this enabled (the default).\n */\n constraint?:\n | boolean\n | {\n /**\n * Database engines on which SMRT emits the physical constraint.\n *\n * Relationship loading, UUID storage, indexes, and application-side\n * delete enforcement remain active on every engine. Use this narrow\n * allowlist only when an engine cannot faithfully enforce a supported\n * relationship shape (for example a DuckDB self-reference).\n */\n engines: Array<'postgres' | 'sqlite' | 'duckdb' | 'json'>;\n };\n}\n\n/**\n * Options specific to cross-package references.\n */\nexport interface CrossPackageRefOptions\n extends Omit<RelationshipFieldOptions, 'related' | 'type'> {\n /**\n * Storage type for the referenced target id. Defaults to 'uuid'.\n *\n * Use 'text' only when the external target model declares\n * `@smrt({ idType: 'text' })`.\n */\n idType?: 'uuid' | 'text';\n\n /**\n * When `true`, the framework verifies the referenced object exists at save time.\n * Validation uses the target package's manifest (loaded on demand via\n * `ObjectRegistry.ensureManifestLoaded()`), so this requires the target manifest\n * to be discoverable at runtime.\n *\n * Empty/null values are always allowed (treated as \"no reference set\").\n *\n * Defaults to `false` — same behavior as a plain string field today.\n */\n validate?: boolean;\n}\n\n/**\n * Resolve a relationship decorator's target argument to a class name.\n *\n * Accepted target forms:\n * - `'Target'` — class name string; resolves lazily, immune to import cycles.\n * - `Target` — class constructor.\n * - `() => Target` — thunk (inline or a named `const`), invoked here to read\n * the name, so its target must already be initialized.\n *\n * A thunk's own `.name` is `''`, so reading `relatedClass.name` used to register\n * `related: ''` (issue #2379): the field kept `type: 'foreignKey'` but lost its\n * target, which silently dropped the relationship edge, `loadRelated()`, and any\n * FK-derived index. Thunks are therefore invoked at decoration time and an\n * unresolvable target throws with the string form as the remedy — an empty\n * `related` is never registered.\n *\n * Resolution runs inside the field-registration callback, which is the latest\n * point in the decorator lifecycle (after the class binding exists for legacy\n * decorators, and at `@smrt()` application time for standard decorators), so a\n * self-referential `() => Self` thunk resolves rather than hitting the TDZ.\n * A thunk pointing at a class declared LATER in the same module is still in\n * that class's temporal dead zone when the decorators of the earlier class run;\n * that now fails loudly, naming the string form, instead of silently\n * registering an empty target.\n */\nfunction resolveRelatedClassName(\n decoratorName: 'foreignKey' | 'oneToMany' | 'manyToMany',\n relatedClass: string | Function,\n className: string,\n propertyKey: string,\n): { related: string; relatedConstructor?: Function } {\n const where = `@${decoratorName}() on ${className}.${propertyKey}`;\n const remedy =\n `Pass the target class name as a string instead — ` +\n `\\`@${decoratorName}('Target')\\` resolves lazily and is immune to import cycles.`;\n\n if (typeof relatedClass === 'string') {\n const name = relatedClass.trim();\n if (!name) {\n throw new Error(\n `${where}: target class name is empty. Pass a class, a class name, or a \\`() => Target\\` thunk.`,\n );\n }\n return { related: name };\n }\n\n if (typeof relatedClass !== 'function') {\n throw new Error(\n `${where}: expected a class, a class name, or a \\`() => Target\\` thunk, received ${relatedClass === null ? 'null' : typeof relatedClass}. ${remedy}`,\n );\n }\n\n // Class/function reference — the common `@foreignKey(Target)` form. Arrow\n // functions have no `prototype`, so a *named* thunk (`const lazyTarget = () =>\n // Target`) is still routed to the thunk branch below instead of registering\n // the variable name as the target class.\n if (relatedClass.name && relatedClass.prototype !== undefined) {\n return { related: relatedClass.name, relatedConstructor: relatedClass };\n }\n\n // Thunk (`() => Target`, named or inline) — invoke it for the target.\n let resolved: unknown;\n try {\n resolved = (relatedClass as () => unknown)();\n } catch (error) {\n throw new Error(\n `${where}: the \\`() => Target\\` thunk threw while resolving its target (${\n error instanceof Error ? error.message : String(error)\n }). ${remedy}`,\n { cause: error },\n );\n }\n\n if (typeof resolved === 'function' && resolved.name) {\n return { related: resolved.name, relatedConstructor: resolved };\n }\n if (typeof resolved === 'string' && resolved.trim()) {\n return { related: resolved.trim() };\n }\n\n throw new Error(\n `${where}: the \\`() => Target\\` thunk resolved to ${\n resolved === null ? 'null' : typeof resolved\n } instead of a named class. ${remedy}`,\n );\n}\n\n/**\n * Marks a class property with validation constraints and metadata options.\n *\n * Use `@field()` when you need options beyond what plain TypeScript initializers\n * express — required validation, numeric ranges, string length limits, uniqueness,\n * or transient (non-persisted) computed properties.\n *\n * For plain persisted fields with no constraints, no decorator is needed: just\n * declare the property with a TypeScript initializer and the framework will infer\n * the column type from the default value (`0` → INTEGER, `0.0` → DECIMAL, `''` → TEXT).\n *\n * @param options - Field configuration options\n * @param options.required - If `true`, `save()` throws `ValidationError` when empty/null\n * @param options.unique - Enforces a UNIQUE database constraint\n * @param options.nullable - If `true`, the column accepts NULL (default depends on type)\n * @param options.transient - If `true`, the property is not persisted to the database\n * @param options.default - Default value applied at the database level\n * @param options.description - Human-readable description used in generated API docs\n * @param options.exported - Controls JSON export visibility (see `FieldOptions`)\n * @returns A TypeScript property decorator\n *\n * @example\n * ```typescript\n * @smrt()\n * class Product extends SmrtObject {\n * @field({ required: true, maxLength: 100 })\n * name: string = '';\n *\n * @field({ min: 0 })\n * stock: number = 0;\n *\n * @field({ transient: true })\n * get displayPrice(): string { return `$${this.price.toFixed(2)}`; }\n * }\n * ```\n *\n * @see {@link meta} for STI child-specific fields stored in `_meta_data` JSON\n * @see {@link foreignKey} for typed relationship fields\n */\nexport function field(\n options: FieldOptions | NumericFieldOptions | TextFieldOptions = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey, ctor) => {\n registerFieldDecoratorForCompatibility(\n className,\n propertyKey,\n options,\n ctor,\n );\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a many-to-one (foreign key) relationship to another `SmrtObject` class.\n *\n * The decorated property stores the UUID of the related object. At runtime, call\n * `instance.loadRelated('fieldName')` to lazy-load (and cache) the related object,\n * or pass `include: ['fieldName']` to `collection.list()` for batch eager loading.\n *\n * Cross-package rule: Use `@foreignKey()` only for same-package references.\n * Use `@crossPackageRef()` for cross-package relationships.\n *\n * A named database constraint is emitted on supported engines by default, and\n * the same action is enforced by `SmrtObject.delete()` before the engine sees\n * it. Exceptional archival/audit references that intentionally outlive their\n * parent may declare `{ constraint: false }`; they retain relationship loading\n * and indexing while deliberately preserving the identifier after parent\n * deletion and omitting physical DDL. The\n * decorator also enables `loadRelated()` and eager `include:` loading:\n *\n * ```typescript\n * @foreignKey(Order, { onDelete: 'CASCADE' }) // deleted with the order\n * orderId: string = '';\n *\n * @foreignKey(Customer, { onDelete: 'RESTRICT' }) // blocks the customer delete\n * customerId: string = '';\n * ```\n *\n * Without an `onDelete`, a column that is part of this class's\n * `conflictColumns` defaults to `CASCADE` (this is what cleans up junction\n * rows); any other column defaults to immediate `NO ACTION`.\n *\n * @param relatedClass - The target class constructor, its name as a string, or a\n * `() => Target` thunk. A thunk is **invoked at decoration time**, so its\n * target must already be initialized: a class from an already-evaluated module\n * or the decorated class itself. Use the string form for a class declared\n * later in the same module or reached through an import cycle — it is never\n * evaluated, so it cannot hit the temporal dead zone.\n * @param options - Optional field constraints (required, nullable, etc.)\n * @returns A TypeScript property decorator\n * @throws Error when the target cannot be resolved to a class name (an empty\n * string, a thunk that throws — including on an uninitialized target — or a\n * thunk returning an anonymous value)\n *\n * @example\n * ```typescript\n * @smrt()\n * class Order extends SmrtObject {\n * // Same-package FK — enables loadRelated() and eager loading\n * @foreignKey(Customer)\n * customerId: string = '';\n *\n * // Self-reference: the class binding exists when its decorators run\n * @foreignKey(() => Order)\n * parentOrderId: string = '';\n *\n * // Declared later in this module — name string, never evaluated\n * @foreignKey('Invoice')\n * invoiceId: string = '';\n *\n * // Physical constraint only where the engine can enforce this shape;\n * // relationship loading and app-side delete policy remain cross-engine.\n * @foreignKey('Order', {\n * constraint: { engines: ['postgres', 'sqlite'] },\n * })\n * hierarchyParentId: string | null = null;\n * }\n *\n * // Cross-package: runtime relationship, index, and loading; no physical FK\n * @smrt()\n * class Post extends SmrtObject {\n * @crossPackageRef('@happyvertical/smrt-users:User')\n * authorId: string = '';\n * }\n * ```\n *\n * @see {@link oneToMany} for the inverse (parent) side of the relationship\n * @see SmrtObject.loadRelated for lazy-loading the related object at runtime\n */\nexport function foreignKey(\n relatedClass: string | Function,\n options: Omit<RelationshipFieldOptions, 'related'> = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey, ctor) => {\n registerFieldDecoratorForCompatibility(\n className,\n propertyKey,\n {\n ...options,\n type: 'foreignKey',\n ...resolveRelatedClassName(\n 'foreignKey',\n relatedClass,\n className,\n propertyKey,\n ),\n },\n ctor,\n );\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a cross-package foreign key reference.\n *\n * Use this for relationships that point to a `SmrtObject` in a *different* package\n * (e.g. `Customer.profileId` pointing at `@happyvertical/smrt-profiles:Profile`).\n *\n * Unlike same-package `@foreignKey()`, this emits **no** DDL `FOREIGN KEY`\n * constraint, keeping package schemas independently installable. The property is a\n * `UUID` column on PostgreSQL/DuckDB and `TEXT` on SQLite, matching the target's\n * id type; pass `{ idType: 'text' }` when the target declares\n * `@smrt({ idType: 'text' })`.\n *\n * What you get over a plain string field:\n * - The relationship is registered with the `ObjectRegistry`, so `loadRelated()`\n * and `Collection.list({ include })` can resolve it once the target package's\n * manifest is loaded.\n * - No physical database constraint is emitted; package schemas remain\n * independently installable.\n * - Optional save-time validation (`validate: true`) confirms the referenced\n * object exists, catching typos and stale IDs before they hit the database.\n * - `onDelete` is honoured by `SmrtObject.delete()` when the target package's\n * manifest is loaded in the same runtime.\n *\n * The `qualifiedName` is a fully-qualified class identifier in the form\n * `@package/scope:ClassName` — for example `@happyvertical/smrt-profiles:Profile`.\n *\n * @param qualifiedName - Qualified name of the target class\n * @param options - Optional field constraints and `validate` flag\n * @returns A TypeScript property decorator\n *\n * @example\n * ```typescript\n * @smrt()\n * class Customer extends SmrtObject {\n * @crossPackageRef('@happyvertical/smrt-profiles:Profile')\n * profileId: string = '';\n *\n * // With save-time validation\n * @crossPackageRef('@happyvertical/smrt-profiles:Profile', { validate: true })\n * primaryContactId: string = '';\n * }\n * ```\n *\n * @see {@link foreignKey} for same-package relationships\n * @see SmrtObject.loadRelated for runtime resolution\n */\nexport function crossPackageRef(\n qualifiedName: string,\n options: CrossPackageRefOptions = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey, ctor) => {\n registerFieldDecoratorForCompatibility(\n className,\n propertyKey,\n {\n ...options,\n type: 'crossPackageRef',\n related: qualifiedName,\n },\n ctor,\n );\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a one-to-many relationship from this object to a collection of related objects.\n *\n * The decorated property is `transient` — it is not persisted as a database column.\n * At runtime, call `instance.loadRelatedMany('fieldName')` to load the related objects,\n * or pass `include: ['fieldName']` to `collection.list()` for batch eager loading (issues\n * a single batched query for all instances instead of N individual queries).\n *\n * The inverse side (`@foreignKey`) must exist on the `relatedClass` pointing back to this\n * class. The framework discovers it automatically via `ObjectRegistry.getInverseRelationships()`.\n *\n * **Generated accessor (R10):** registering the class installs a consistent\n * `get<FieldName>()` instance method (e.g. `items` → `order.getItems()`) that\n * delegates to `loadRelatedMany('items')`. Generation is additive — a\n * hand-rolled method of the same name is never overwritten.\n *\n * **Disambiguation:** when `relatedClass` declares more than one `@foreignKey`\n * back to this class, pass `{ foreignKey: '<inverseFieldName>' }` so both\n * `loadRelatedMany` and the generated accessor resolve the intended inverse\n * side. Without it the first matching foreign key is used.\n *\n * **Delete behaviour is declared on the child, not here.** `@oneToMany` is a\n * transient read-side accessor; to have children removed with their parent,\n * put `onDelete: 'CASCADE'` on the inverse `@foreignKey` (#2371):\n *\n * ```typescript\n * class OrderItem extends SmrtObject {\n * @foreignKey(Order, { onDelete: 'CASCADE' })\n * orderId: string = '';\n * }\n * ```\n *\n * @param relatedClass - The class constructor of the child/related objects\n * @param options - Optional relationship options. `foreignKey` selects the\n * inverse foreign-key field on `relatedClass` when it has more than one.\n * @returns A TypeScript property decorator (sets `transient: true` automatically)\n *\n * @example\n * ```typescript\n * @smrt()\n * class Order extends SmrtObject {\n * @oneToMany(OrderItem)\n * items: OrderItem[] = [];\n * }\n *\n * @smrt()\n * class OrderItem extends SmrtObject {\n * @foreignKey(Order)\n * orderId: string = '';\n * }\n *\n * const order = await orders.get({ id });\n * const items = await order.getItems(); // generated; === loadRelatedMany('items')\n * ```\n *\n * @example\n * ```typescript\n * // Multiple inverse foreign keys → disambiguate explicitly.\n * @smrt()\n * class Profile extends SmrtObject {\n * @oneToMany(ProfileRelationship, { foreignKey: 'fromProfileId' })\n * relationshipsFrom: ProfileRelationship[] = [];\n * @oneToMany(ProfileRelationship, { foreignKey: 'toProfileId' })\n * relationshipsTo: ProfileRelationship[] = [];\n * }\n * ```\n *\n * @see {@link foreignKey} for the many-to-one (child) side of the relationship\n * @see SmrtObject.loadRelatedMany for lazy-loading at runtime\n */\nexport function oneToMany(\n relatedClass: string | Function,\n options: Omit<RelationshipFieldOptions, 'related'> = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey, ctor) => {\n registerFieldDecoratorForCompatibility(\n className,\n propertyKey,\n {\n ...options,\n type: 'oneToMany',\n ...resolveRelatedClassName(\n 'oneToMany',\n relatedClass,\n className,\n propertyKey,\n ),\n transient: true, // Relationship fields are not database columns\n },\n ctor,\n );\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Declares a many-to-many relationship between two `SmrtObject` classes via a join table.\n *\n * The decorated property is `transient` — it is not persisted as a database column.\n * The `through` option specifies the junction table name. The join table model must\n * be decorated with `@smrt({ conflictColumns: ['...', '...'] })` to use the natural\n * key columns for upsert operations.\n *\n * Runtime loading: call `instance.loadRelatedMany('field')` to lazy-load, or\n * pass `include: ['field']` to `collection.list()` for batched eager loading.\n *\n * @param relatedClass - The class constructor of the related objects\n * @param options - Relationship options; `through` specifies the junction table name\n * @returns A TypeScript property decorator (sets `transient: true` automatically)\n *\n * @example\n * ```typescript\n * @smrt()\n * class Product extends SmrtObject {\n * @manyToMany(Tag, { through: 'product_tags' })\n * tags: Tag[] = [];\n * }\n * ```\n *\n * @see {@link oneToMany} for one-to-many relationships\n */\nexport function manyToMany(\n relatedClass: string | Function,\n options: Omit<RelationshipFieldOptions, 'related'> = {},\n) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey, ctor) => {\n registerFieldDecoratorForCompatibility(\n className,\n propertyKey,\n {\n ...options,\n type: 'manyToMany',\n ...resolveRelatedClassName(\n 'manyToMany',\n relatedClass,\n className,\n propertyKey,\n ),\n transient: true, // Relationship fields are not database columns\n },\n ctor,\n );\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Marks a field as a Single Table Inheritance (STI) meta field.\n *\n * Meta fields are stored in the `_meta_data` JSONB column on the shared STI\n * table rather than as dedicated table columns. Use this decorator for fields\n * that are specific to an STI child class and should not pollute the shared\n * table schema with child-specific columns.\n *\n * The `@smrt({ tableStrategy: 'sti' })` decorator must be set on the base class.\n * All child-specific fields should use `@meta()` (or the `Meta<T>` type alias).\n *\n * @param options - Standard field options (required, nullable, description, etc.)\n * @returns A TypeScript property decorator (registers field with `type: 'meta'`)\n *\n * @example\n * ```typescript\n * @smrt({ tableStrategy: 'sti' })\n * class Event extends SmrtObject {\n * title: string = ''; // shared column on events table\n * }\n *\n * @smrt()\n * class Meeting extends Event {\n * @meta()\n * roomNumber: string = ''; // stored in _meta_data JSON, not a column\n *\n * @meta({ required: true })\n * durationMinutes: number = 60;\n * }\n * ```\n *\n * @see {@link Meta} for the equivalent type alias approach\n * @see {@link field} for regular (non-STI) field declarations\n */\nexport function meta(options: FieldOptions = {}) {\n return ((\n targetOrValue: LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext: CompatiblePropertyDecoratorContext<unknown, unknown>,\n ) => {\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey, ctor) => {\n registerFieldDecoratorForCompatibility(\n className,\n propertyKey,\n {\n ...options,\n type: 'meta', // Mark this field as a meta field for STI\n },\n ctor,\n );\n },\n );\n }) as CompatiblePropertyDecorator;\n}\n\n/**\n * Options for {@link method}.\n *\n * Every option is optional, and an omitted one falls back to the class-level\n * `api.routes[methodName]` entry (or `ai.descriptions[methodName]` for\n * `description`) when one exists. The merge is FIELD BY FIELD, so adding\n * `@method({ description })` to a class that already declares a route verb and\n * path does not reset them (#2686).\n */\nexport interface MethodOptions {\n /**\n * Override the default routing decision.\n *\n * Public methods are routed by default when they are WIRE-ABLE: every\n * parameter can be built from a JSON request body or query string. Set\n * `false` to withhold a method the heuristic accepted, `true` to expose one\n * it rejected.\n *\n * `true` bypasses the heuristic and NOTHING else. It cannot manufacture a\n * receiver, undo `api: false`, cross an `include`/`exclude` boundary, reach a\n * non-public method, claim a CRUD verb, or hydrate a value the transport\n * cannot build — a model-instance parameter still arrives as whatever JSON\n * the caller sent.\n */\n expose?: boolean;\n\n /**\n * Why the method is withheld. Recorded in the knowledge artifact so\n * `smrt doctor` and agents read an explanation instead of silence.\n */\n reason?: string;\n\n /**\n * HTTP verb for the generated route. Defaults to `POST`.\n *\n * Named `httpMethod`, not `method`: RFC 9110 calls this the request\n * \"method\", so the protocol word is exactly the one that collides with the\n * decorator's own name, and `@method({ method: 'POST' })` stutters.\n * `httpMethod` is also already this framework's name for it — `ApiHttpMethod`\n * is carried across the whole discovery/invoke path.\n *\n * Migrates from `api.routes[methodName].method`.\n */\n httpMethod?: ApiHttpMethod;\n\n /**\n * Route path segment(s), used verbatim and split on `/`.\n * Defaults to the method name. Migrates from `api.routes[methodName].path`.\n */\n path?: string;\n\n /**\n * Declared receiver scope. Migrates from `api.routes[methodName].scope`.\n *\n * A DECLARATION checked against the method's executable receiver, not a\n * relocation: an instance method is item-scoped and a static (or\n * collection-class) method is collection-scoped, and no config can change\n * that. A contradicting value is reported at build time and ignored.\n */\n scope?: CustomActionScope;\n\n /**\n * Agent-visible effect classification. Omitted actions are treated as\n * `destructive`, so missing metadata can never widen browser capability\n * exposure. Migrates from `api.routes[methodName].effect`.\n */\n effect?: ToolEffect;\n\n /** Whether repeating the action with the same arguments is safe. */\n idempotent?: boolean;\n\n /** Whether the action may interact outside the SMRT application. */\n openWorld?: boolean;\n\n /**\n * Description used by AI/tool surfaces, overriding the method's JSDoc.\n * Migrates from `ai.descriptions[methodName]`.\n */\n description?: string;\n}\n\n/**\n * Refines how a method is exposed on generated surfaces.\n *\n * The method counterpart of {@link field}, and symmetric with it: a manifest\n * records exactly two collections per object, `fields` and `methods`. Neither\n * decorator DECLARES its member — a property is a field because it is a\n * property, and a method is a candidate action because it is public — both\n * REFINE what the framework already inferred. `@field()` refines an inferred\n * column type and constraints; `@method()` refines inferred exposure, its\n * route shape, and its tool semantics.\n *\n * The name is `@method()` rather than `@action()` because of the negative\n * case: withholding a method has to read correctly, and\n * `@action({ expose: false })` contradicts itself — declaring something an\n * action in order to say it is not one. \"Action\" keeps its established meaning\n * in the generators (a non-CRUD method exposed on a surface); this decorator\n * is how a method BECOMES one.\n *\n * Metadata only: the decorated method is not wrapped and keeps its identity,\n * so it stays directly callable.\n *\n * @example Shape the generated route\n * ```typescript\n * @method({ httpMethod: 'POST', path: 'reviews', effect: 'write' })\n * async runReview(options?: RunContentReviewOptions) { … }\n * ```\n *\n * @example Withhold a method the heuristic would have routed\n * ```typescript\n * @method({ expose: false, reason: 'callback registration, not a wire operation' })\n * static registerValidator(validator: ValidatorFunction) { … }\n * ```\n *\n * @example Force a route the heuristic rejected\n * ```typescript\n * // `expose: true` bypasses the heuristic only — this method must still\n * // accept whatever JSON the caller sends for `asset`.\n * @method({ expose: true })\n * async addAsset(asset: Asset) { … }\n * ```\n *\n * @see {@link field} for the property-side refinement decorator\n */\nexport function method(options: MethodOptions = {}) {\n return ((\n targetOrValue: unknown,\n propertyKeyOrContext: CompatibleMethodDecoratorContext<\n unknown,\n // biome-ignore lint/suspicious/noExplicitAny: mirrors the lib's own `ClassMethodDecoratorContext` constraint; see `AnyMethodOf` in `compatibility.ts`. S4 #1579.\n (this: unknown, ...args: any) => any\n >,\n ) => {\n registerCompatibleMethodDecorator(\n targetOrValue as LegacyPropertyDecoratorTarget | undefined,\n propertyKeyOrContext,\n (ctor, methodName, isStatic) => {\n ObjectRegistry.registerMethodDecorator(\n ctor,\n methodName,\n options,\n isStatic,\n );\n },\n );\n }) as CompatibleMethodDecorator;\n}\n"],"mappings":";;;AAgCA,SAAS,uCACP,WACA,aACA,SACA,MACM;CACN,eAAe,uBAAuB,WAAW,aAAa,SAAS,IAAI;AAC7E;;;;;;;;;;;;;;;;;;;;;;;;;;AAwQA,SAAS,wBACP,eACA,cACA,WACA,aACoD;CACpD,MAAM,QAAQ,IAAI,cAAc,QAAQ,UAAU,GAAG;CACrD,MAAM,SACJ,uDACM,cAAc;CAEtB,IAAI,OAAO,iBAAiB,UAAU;EACpC,MAAM,OAAO,aAAa,KAAK;EAC/B,IAAI,CAAC,MACH,MAAM,IAAI,MACR,GAAG,MAAM,uFACX;EAEF,OAAO,EAAE,SAAS,KAAK;CACzB;CAEA,IAAI,OAAO,iBAAiB,YAC1B,MAAM,IAAI,MACR,GAAG,MAAM,0EAA0E,iBAAiB,OAAO,SAAS,OAAO,aAAa,IAAI,QAC9I;CAOF,IAAI,aAAa,QAAQ,aAAa,cAAc,KAAA,GAClD,OAAO;EAAE,SAAS,aAAa;EAAM,oBAAoB;CAAa;CAIxE,IAAI;CACJ,IAAI;EACF,WAAY,aAA+B;CAC7C,SAAS,OAAO;EACd,MAAM,IAAI,MACR,GAAG,MAAM,iEACP,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EACtD,KAAK,UACN,EAAE,OAAO,MAAM,CACjB;CACF;CAEA,IAAI,OAAO,aAAa,cAAc,SAAS,MAC7C,OAAO;EAAE,SAAS,SAAS;EAAM,oBAAoB;CAAS;CAEhE,IAAI,OAAO,aAAa,YAAY,SAAS,KAAK,GAChD,OAAO,EAAE,SAAS,SAAS,KAAK,EAAE;CAGpC,MAAM,IAAI,MACR,GAAG,MAAM,2CACP,aAAa,OAAO,SAAS,OAAO,SACrC,6BAA6B,QAChC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,MACd,UAAiE,CAAC,GAClE;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,aAAa,SAAS;GAChC,uCACE,WACA,aACA,SACA,IACF;EACF,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,WACd,cACA,UAAqD,CAAC,GACtD;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,aAAa,SAAS;GAChC,uCACE,WACA,aACA;IACE,GAAG;IACH,MAAM;IACN,GAAG,wBACD,cACA,cACA,WACA,WACF;GACF,GACA,IACF;EACF,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,gBACd,eACA,UAAkC,CAAC,GACnC;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,aAAa,SAAS;GAChC,uCACE,WACA,aACA;IACE,GAAG;IACH,MAAM;IACN,SAAS;GACX,GACA,IACF;EACF,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,SAAgB,UACd,cACA,UAAqD,CAAC,GACtD;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,aAAa,SAAS;GAChC,uCACE,WACA,aACA;IACE,GAAG;IACH,MAAM;IACN,GAAG,wBACD,aACA,cACA,WACA,WACF;IACA,WAAW;GACb,GACA,IACF;EACF,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,WACd,cACA,UAAqD,CAAC,GACtD;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,aAAa,SAAS;GAChC,uCACE,WACA,aACA;IACE,GAAG;IACH,MAAM;IACN,GAAG,wBACD,cACA,cACA,WACA,WACF;IACA,WAAW;GACb,GACA,IACF;EACF,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,KAAK,UAAwB,CAAC,GAAG;CAC/C,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,aAAa,SAAS;GAChC,uCACE,WACA,aACA;IACE,GAAG;IACH,MAAM;GACR,GACA,IACF;EACF,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HA,SAAgB,OAAO,UAAyB,CAAC,GAAG;CAClD,SACE,eACA,yBAKG;EACH,kCACE,eACA,uBACC,MAAM,YAAY,aAAa;GAC9B,eAAe,wBACb,MACA,YACA,SACA,QACF;EACF,CACF;CACF;AACF"}
|
package/dist/interceptors.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { SmrtObject } from './object.js';
|
|
|
5
5
|
export interface InterceptorContext {
|
|
6
6
|
/** Name of the SMRT class being operated on */
|
|
7
7
|
className: string;
|
|
8
|
+
/** Exact registered identity when the simple class name is ambiguous. */
|
|
9
|
+
qualifiedClassName?: string;
|
|
8
10
|
/** Name of the collection (if applicable) */
|
|
9
11
|
collectionName?: string;
|
|
10
12
|
/** Timestamp of the operation */
|
|
@@ -270,5 +272,5 @@ export declare function resolveGetStringFilter(filter: string): {
|
|
|
270
272
|
* Helper function to create an interceptor context
|
|
271
273
|
* @internal
|
|
272
274
|
*/
|
|
273
|
-
export declare function createInterceptorContext(className: string, operation: InterceptorContext['operation'], collectionName?: string, metadata?: Record<string, unknown
|
|
275
|
+
export declare function createInterceptorContext(className: string, operation: InterceptorContext['operation'], collectionName?: string, metadata?: Record<string, unknown>, qualifiedClassName?: string): InterceptorContext;
|
|
274
276
|
//# sourceMappingURL=interceptors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptors.d.ts","sourceRoot":"","sources":["../src/interceptors.ts"],"names":[],"mappings":"AAAA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kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAQhB;;;OAGG;WACU,gBAAgB,CAC3B,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAQhB;;;OAGG;WACU,mBAAmB,CAC9B,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAQhB;;;OAGG;WACU,kBAAkB,CAC7B,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;CAOjB;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,GACb;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAIpD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,EAC1C,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,kBAAkB,CASpB"}
|
package/dist/interceptors.js
CHANGED
|
@@ -217,13 +217,14 @@ function resolveGetStringFilter(filter) {
|
|
|
217
217
|
* Helper function to create an interceptor context
|
|
218
218
|
* @internal
|
|
219
219
|
*/
|
|
220
|
-
function createInterceptorContext(className, operation, collectionName, metadata) {
|
|
220
|
+
function createInterceptorContext(className, operation, collectionName, metadata, qualifiedClassName) {
|
|
221
221
|
return {
|
|
222
222
|
className,
|
|
223
223
|
collectionName,
|
|
224
224
|
operation,
|
|
225
225
|
timestamp: /* @__PURE__ */ new Date(),
|
|
226
|
-
metadata
|
|
226
|
+
metadata,
|
|
227
|
+
qualifiedClassName
|
|
227
228
|
};
|
|
228
229
|
}
|
|
229
230
|
//#endregion
|