@happyvertical/smrt-core 0.40.61 → 0.40.63

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.
Files changed (51) hide show
  1. package/AGENTS.md +16 -3
  2. package/README.md +32 -1
  3. package/agents/generators.md +22 -0
  4. package/dist/collection.d.ts +12 -1
  5. package/dist/collection.d.ts.map +1 -1
  6. package/dist/collection.js +37 -5
  7. package/dist/collection.js.map +1 -1
  8. package/dist/decorators/index.d.ts +8 -2
  9. package/dist/decorators/index.d.ts.map +1 -1
  10. package/dist/decorators/index.js.map +1 -1
  11. package/dist/embeddings/types.d.ts +4 -1
  12. package/dist/embeddings/types.d.ts.map +1 -1
  13. package/dist/generators/mcp-emit.d.ts +72 -0
  14. package/dist/generators/mcp-emit.d.ts.map +1 -0
  15. package/dist/generators/mcp-emit.js +104 -0
  16. package/dist/generators/mcp-emit.js.map +1 -0
  17. package/dist/generators/mcp-runtime-template.d.ts +5 -0
  18. package/dist/generators/mcp-runtime-template.d.ts.map +1 -1
  19. package/dist/generators/mcp-runtime-template.js +236 -3
  20. package/dist/generators/mcp-runtime-template.js.map +1 -1
  21. package/dist/generators/mcp.d.ts +63 -3
  22. package/dist/generators/mcp.d.ts.map +1 -1
  23. package/dist/generators/mcp.js +145 -21
  24. package/dist/generators/mcp.js.map +1 -1
  25. package/dist/manifest/generator.d.ts +5 -0
  26. package/dist/manifest/generator.d.ts.map +1 -1
  27. package/dist/manifest/generator.js +10 -7
  28. package/dist/manifest/generator.js.map +1 -1
  29. package/dist/manifest/static-manifest.js +1 -1
  30. package/dist/manifest/static-manifest.js.map +1 -1
  31. package/dist/manifest/store.js +1 -1
  32. package/dist/manifest.json +1 -1
  33. package/dist/object.d.ts +11 -1
  34. package/dist/object.d.ts.map +1 -1
  35. package/dist/object.js +11 -1
  36. package/dist/object.js.map +1 -1
  37. package/dist/registry/types.d.ts +8 -0
  38. package/dist/registry/types.d.ts.map +1 -1
  39. package/dist/smrt-knowledge.json +7 -7
  40. package/dist/system/compatibility.d.ts.map +1 -1
  41. package/dist/system/compatibility.js +6 -0
  42. package/dist/system/compatibility.js.map +1 -1
  43. package/dist/system/types.d.ts +4 -1
  44. package/dist/system/types.d.ts.map +1 -1
  45. package/dist/utils/scanner-module.d.ts +7 -0
  46. package/dist/utils/scanner-module.d.ts.map +1 -1
  47. package/dist/vite-plugin/index.d.ts +7 -0
  48. package/dist/vite-plugin/index.d.ts.map +1 -1
  49. package/dist/vite-plugin/index.js +3 -2
  50. package/dist/vite-plugin/index.js.map +1 -1
  51. package/package.json +10 -12
@@ -47,8 +47,14 @@ export interface FieldOptions {
47
47
  * For regular (column-backed) fields the index is a plain column index.
48
48
  * For `@meta()` fields stored inside `_meta_data` JSONB, the index targets
49
49
  * the JSON path — `json_extract(_meta_data, '$.fieldName')` on SQLite,
50
- * `(_meta_data->>'fieldName')` on Postgres — giving WHERE clauses on that
51
- * meta key the same performance as a real column.
50
+ * `(_meta_data->>'fieldName')` on Postgres.
51
+ *
52
+ * Note that `collection.list({ where })` cannot currently reach a JSON-path
53
+ * index: dot-notation keys such as `_meta_data.fieldName` are rejected,
54
+ * because nothing rewrites them into the matching extraction expression
55
+ * (#2276, tracked in #2282). The index is still emitted and still serves
56
+ * hand-written SQL that spells the expression out; it just has no
57
+ * collection-level query to accelerate yet.
52
58
  */
53
59
  indexed?: boolean;
54
60
  /** Whether the field is nullable */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,KAAK,2BAA2B,EAIjC,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;G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;;;;;;;;;GAiCG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,YAAiB,GAevC,2BAA2B,CAClC"}
@@ -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 { ObjectRegistry } from '../registry.js';\nimport type { FieldUIHints } from '../scanner/types.js';\nimport type { SQLDataType } from '../schema/types.js';\nimport {\n type CompatiblePropertyDecorator,\n type CompatiblePropertyDecoratorContext,\n type LegacyPropertyDecoratorTarget,\n registerCompatibleFieldDecorator,\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 — giving WHERE clauses on that\n * meta key the same performance as a real column.\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\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 * 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 * For cross-package foreign keys, use a plain `string` property instead to avoid\n * circular dependencies between packages.\n *\n * @param relatedClass - The target class constructor (or class name string)\n * @param options - Optional field constraints (required, nullable, etc.)\n * @returns A TypeScript property decorator\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 *\n * // Cross-package: use a plain string instead\n * @smrt()\n * class Post extends SmrtObject {\n * authorId: string = ''; // plain string — no circular dep\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 const relatedClassName =\n typeof relatedClass === 'string' ? relatedClass : relatedClass.name;\n\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'foreignKey',\n related: relatedClassName,\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 * Unlike `@foreignKey()`, this decorator does **not** emit a DDL `FOREIGN KEY`\n * constraint — cross-package classes are not visible at schema-generation time and\n * adding a constraint would force a circular package dependency. The decorated\n * property remains a plain `TEXT` column at the database level.\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 * - Optional save-time validation (`validate: true`) confirms the referenced\n * object exists, catching typos and stale IDs before they hit the database.\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 (emits FK constraint)\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 * @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 const relatedClassName =\n typeof relatedClass === 'string' ? relatedClass : relatedClass.name;\n\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'oneToMany',\n related: relatedClassName,\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 const relatedClassName =\n typeof relatedClass === 'string' ? relatedClass : relatedClass.name;\n\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'manyToMany',\n related: relatedClassName,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8OA,SAAgB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;IAC5D,GAAG;IACH,MAAM;IACN,SAAS;IACT,WAAW;GACb,CAAC;EACH,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,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"}
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 { ObjectRegistry } from '../registry.js';\nimport type { FieldUIHints } from '../scanner/types.js';\nimport type { SQLDataType } from '../schema/types.js';\nimport {\n type CompatiblePropertyDecorator,\n type CompatiblePropertyDecoratorContext,\n type LegacyPropertyDecoratorTarget,\n registerCompatibleFieldDecorator,\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\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 * 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 * For cross-package foreign keys, use a plain `string` property instead to avoid\n * circular dependencies between packages.\n *\n * @param relatedClass - The target class constructor (or class name string)\n * @param options - Optional field constraints (required, nullable, etc.)\n * @returns A TypeScript property decorator\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 *\n * // Cross-package: use a plain string instead\n * @smrt()\n * class Post extends SmrtObject {\n * authorId: string = ''; // plain string — no circular dep\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 const relatedClassName =\n typeof relatedClass === 'string' ? relatedClass : relatedClass.name;\n\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'foreignKey',\n related: relatedClassName,\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 * Unlike `@foreignKey()`, this decorator does **not** emit a DDL `FOREIGN KEY`\n * constraint — cross-package classes are not visible at schema-generation time and\n * adding a constraint would force a circular package dependency. The decorated\n * property remains a plain `TEXT` column at the database level.\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 * - Optional save-time validation (`validate: true`) confirms the referenced\n * object exists, catching typos and stale IDs before they hit the database.\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 (emits FK constraint)\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 * @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 const relatedClassName =\n typeof relatedClass === 'string' ? relatedClass : relatedClass.name;\n\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'oneToMany',\n related: relatedClassName,\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 const relatedClassName =\n typeof relatedClass === 'string' ? relatedClass : relatedClass.name;\n\n registerCompatibleFieldDecorator(\n targetOrValue,\n propertyKeyOrContext,\n (className, propertyKey) => {\n ObjectRegistry.registerFieldDecorator(className, propertyKey, {\n ...options,\n type: 'manyToMany',\n related: relatedClassName,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoPA,SAAgB,MACd,UAAiE,CAAC,GAClE;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa,OAAO;EACvE,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,WACd,cACA,UAAqD,CAAC,GACtD;CACA,SACE,eACA,yBACG;EACH,MAAM,mBACJ,OAAO,iBAAiB,WAAW,eAAe,aAAa;EAEjE,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa;IAC5D,GAAG;IACH,MAAM;IACN,SAAS;GACX,CAAC;EACH,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,gBACd,eACA,UAAkC,CAAC,GACnC;CACA,SACE,eACA,yBACG;EACH,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa;IAC5D,GAAG;IACH,MAAM;IACN,SAAS;GACX,CAAC;EACH,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,UACd,cACA,UAAqD,CAAC,GACtD;CACA,SACE,eACA,yBACG;EACH,MAAM,mBACJ,OAAO,iBAAiB,WAAW,eAAe,aAAa;EAEjE,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa;IAC5D,GAAG;IACH,MAAM;IACN,SAAS;IACT,WAAW;GACb,CAAC;EACH,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,WACd,cACA,UAAqD,CAAC,GACtD;CACA,SACE,eACA,yBACG;EACH,MAAM,mBACJ,OAAO,iBAAiB,WAAW,eAAe,aAAa;EAEjE,iCACE,eACA,uBACC,WAAW,gBAAgB;GAC1B,eAAe,uBAAuB,WAAW,aAAa;IAC5D,GAAG;IACH,MAAM;IACN,SAAS;IACT,WAAW;GACb,CAAC;EACH,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,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"}
@@ -185,7 +185,10 @@ export interface GenerateEmbeddingsOptions {
185
185
  */
186
186
  export interface SemanticSearchOptions {
187
187
  /**
188
- * Field to search (default: combined field or first configured field)
188
+ * Field to search (default: first configured field)
189
+ *
190
+ * Accepts any field listed in `fields`, or the configured
191
+ * `combinedField.name` — `generateEmbeddings()` stores a vector for each.
189
192
  */
190
193
  field?: string;
191
194
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/embeddings/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,QAAQ,EAAE,qBAAqB,CAAC;IAEhC;;;O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QAAQ,EAAE;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,KAAK,IAAI,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Emit helpers for generated MCP server sources.
3
+ *
4
+ * The MCP generators build their output as TypeScript source: the runtime
5
+ * template carries type-only imports, type annotations, and generics. Whatever
6
+ * the caller asked for as `outputPath` decides how that source has to be
7
+ * written (#2279):
8
+ *
9
+ * - `.ts` / `.mts` — write the TypeScript verbatim. The consumer runs it
10
+ * through `tsx` or Node's type stripping, which is what the repository's own
11
+ * MCP conformance fixture does. The generated source therefore has to stay
12
+ * erasable-syntax-only.
13
+ * - `.cjs` / `.cts` — rejected. Generated servers are ES modules, so a
14
+ * CommonJS target cannot run in any language.
15
+ * - anything else (`.js` by default) — transpile to JavaScript first, so
16
+ * `node .smrt/mcp-server/index.js` runs instead of dying on
17
+ * `SyntaxError: Unexpected identifier 'CallToolRequest'`.
18
+ *
19
+ * Transpilation uses the `typescript` package that `@happyvertical/smrt-core`
20
+ * already depends on, imported lazily so that merely importing the generators
21
+ * does not pull the compiler into memory.
22
+ */
23
+ /** Language a generated file is written in, derived from its extension. */
24
+ export type GeneratedSourceLanguage = 'typescript' | 'javascript';
25
+ /** Extension a generated module may be written with. */
26
+ export type GeneratedSourceExtension = '.ts' | '.mts' | '.js' | '.mjs';
27
+ /**
28
+ * Decide how a generated file must be written from the path the caller asked
29
+ * for. Unknown extensions emit JavaScript: `node` is the documented way to run
30
+ * a generated server, so JavaScript is the safe default.
31
+ *
32
+ * @param outputPath - Path the generated file will be written to
33
+ * @returns The language the file contents must be written in
34
+ * @throws When the path asks for a CommonJS target
35
+ */
36
+ export declare function resolveGeneratedSourceLanguage(outputPath: string): GeneratedSourceLanguage;
37
+ /**
38
+ * Extension for modules emitted alongside a generated entry point, so the
39
+ * modular server's relative imports resolve to files that exist on disk *and*
40
+ * are loaded with the entry's own module semantics. An `.mjs` entry point in a
41
+ * CommonJS package needs `.mjs` siblings, not `.js` ones that Node would then
42
+ * parse as CommonJS.
43
+ *
44
+ * @param outputPath - Path of the generated entry point
45
+ * @returns The extension every sibling module is written with
46
+ * @throws When the path asks for a CommonJS target
47
+ */
48
+ export declare function generatedSiblingExtension(outputPath: string): GeneratedSourceExtension;
49
+ /**
50
+ * Transpile generated TypeScript to runnable ESM JavaScript.
51
+ *
52
+ * `verbatimModuleSyntax` keeps every value import the template emits (an
53
+ * unused-looking import must not be elided: the generated server relies on
54
+ * side effects and on imports whose only use is inside emitted switch cases),
55
+ * while type-only import specifiers are dropped.
56
+ *
57
+ * @param source - Generated TypeScript source
58
+ * @param label - Target path or name reported in transpile diagnostics
59
+ * @returns Equivalent JavaScript source
60
+ * @throws When the generated source is not valid TypeScript
61
+ */
62
+ export declare function transpileGeneratedSource(source: string, label?: string): Promise<string>;
63
+ /**
64
+ * Render generated TypeScript for the requested output language.
65
+ *
66
+ * @param source - Generated TypeScript source
67
+ * @param language - Language the file must be written in
68
+ * @param label - Target path or name reported in transpile diagnostics
69
+ * @returns Source ready to be written to disk
70
+ */
71
+ export declare function renderGeneratedSource(source: string, language: GeneratedSourceLanguage, label?: string): Promise<string>;
72
+ //# sourceMappingURL=mcp-emit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-emit.d.ts","sourceRoot":"","sources":["../../src/generators/mcp-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,YAAY,CAAC;AAElE,wDAAwD;AACxD,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAqBvE;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,GACjB,uBAAuB,CAQzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GACjB,wBAAwB,CAO1B;AAiBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,KAAK,SAAyB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,uBAAuB,EACjC,KAAK,SAAyB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAKjB"}
@@ -0,0 +1,104 @@
1
+ //#region src/generators/mcp-emit.ts
2
+ var TYPESCRIPT_EXTENSIONS = [".ts", ".mts"];
3
+ /**
4
+ * Generated servers are ES modules — they use `import` and `import.meta.url` —
5
+ * so a CommonJS target can never run whatever language it is written in.
6
+ */
7
+ var COMMONJS_EXTENSIONS = [".cjs", ".cts"];
8
+ function assertModuleTarget(outputPath, lowerCased) {
9
+ const commonJs = COMMONJS_EXTENSIONS.find((extension) => lowerCased.endsWith(extension));
10
+ if (commonJs) throw new Error(`Cannot generate an MCP server at '${outputPath}': the generated server is an ES module, so a ${commonJs} target cannot run. Use .js/.mjs for JavaScript or .ts/.mts for TypeScript.`);
11
+ }
12
+ /**
13
+ * Decide how a generated file must be written from the path the caller asked
14
+ * for. Unknown extensions emit JavaScript: `node` is the documented way to run
15
+ * a generated server, so JavaScript is the safe default.
16
+ *
17
+ * @param outputPath - Path the generated file will be written to
18
+ * @returns The language the file contents must be written in
19
+ * @throws When the path asks for a CommonJS target
20
+ */
21
+ function resolveGeneratedSourceLanguage(outputPath) {
22
+ const lowerCased = outputPath.toLowerCase();
23
+ assertModuleTarget(outputPath, lowerCased);
24
+ return TYPESCRIPT_EXTENSIONS.some((extension) => lowerCased.endsWith(extension)) ? "typescript" : "javascript";
25
+ }
26
+ /**
27
+ * Extension for modules emitted alongside a generated entry point, so the
28
+ * modular server's relative imports resolve to files that exist on disk *and*
29
+ * are loaded with the entry's own module semantics. An `.mjs` entry point in a
30
+ * CommonJS package needs `.mjs` siblings, not `.js` ones that Node would then
31
+ * parse as CommonJS.
32
+ *
33
+ * @param outputPath - Path of the generated entry point
34
+ * @returns The extension every sibling module is written with
35
+ * @throws When the path asks for a CommonJS target
36
+ */
37
+ function generatedSiblingExtension(outputPath) {
38
+ const lowerCased = outputPath.toLowerCase();
39
+ assertModuleTarget(outputPath, lowerCased);
40
+ if (lowerCased.endsWith(".mts")) return ".mts";
41
+ if (lowerCased.endsWith(".ts")) return ".ts";
42
+ if (lowerCased.endsWith(".mjs")) return ".mjs";
43
+ return ".js";
44
+ }
45
+ /**
46
+ * Load the TypeScript compiler API lazily.
47
+ *
48
+ * `typescript` is CommonJS: Node's ESM interop exposes the whole API on
49
+ * `default`, while bundlers hand back the namespace itself.
50
+ */
51
+ async function loadTypeScript() {
52
+ const imported = await import("typescript");
53
+ return imported.default ?? imported;
54
+ }
55
+ /**
56
+ * Transpile generated TypeScript to runnable ESM JavaScript.
57
+ *
58
+ * `verbatimModuleSyntax` keeps every value import the template emits (an
59
+ * unused-looking import must not be elided: the generated server relies on
60
+ * side effects and on imports whose only use is inside emitted switch cases),
61
+ * while type-only import specifiers are dropped.
62
+ *
63
+ * @param source - Generated TypeScript source
64
+ * @param label - Target path or name reported in transpile diagnostics
65
+ * @returns Equivalent JavaScript source
66
+ * @throws When the generated source is not valid TypeScript
67
+ */
68
+ async function transpileGeneratedSource(source, label = "generated MCP source") {
69
+ const ts = await loadTypeScript();
70
+ const { outputText, diagnostics } = ts.transpileModule(source, {
71
+ fileName: "smrt-generated-mcp-source.ts",
72
+ reportDiagnostics: true,
73
+ compilerOptions: {
74
+ target: ts.ScriptTarget.ESNext,
75
+ module: ts.ModuleKind.ESNext,
76
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
77
+ verbatimModuleSyntax: true,
78
+ removeComments: false,
79
+ newLine: ts.NewLineKind.LineFeed
80
+ }
81
+ });
82
+ const errors = (diagnostics ?? []).filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
83
+ if (errors.length > 0) {
84
+ const details = errors.map((diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, " ")).join("; ");
85
+ throw new Error(`Failed to transpile generated MCP source (${label}): ${details}`);
86
+ }
87
+ return outputText;
88
+ }
89
+ /**
90
+ * Render generated TypeScript for the requested output language.
91
+ *
92
+ * @param source - Generated TypeScript source
93
+ * @param language - Language the file must be written in
94
+ * @param label - Target path or name reported in transpile diagnostics
95
+ * @returns Source ready to be written to disk
96
+ */
97
+ async function renderGeneratedSource(source, language, label = "generated MCP source") {
98
+ if (language === "typescript") return source;
99
+ return transpileGeneratedSource(source, label);
100
+ }
101
+ //#endregion
102
+ export { generatedSiblingExtension, renderGeneratedSource, resolveGeneratedSourceLanguage, transpileGeneratedSource };
103
+
104
+ //# sourceMappingURL=mcp-emit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-emit.js","names":[],"sources":["../../src/generators/mcp-emit.ts"],"sourcesContent":["/**\n * Emit helpers for generated MCP server sources.\n *\n * The MCP generators build their output as TypeScript source: the runtime\n * template carries type-only imports, type annotations, and generics. Whatever\n * the caller asked for as `outputPath` decides how that source has to be\n * written (#2279):\n *\n * - `.ts` / `.mts` — write the TypeScript verbatim. The consumer runs it\n * through `tsx` or Node's type stripping, which is what the repository's own\n * MCP conformance fixture does. The generated source therefore has to stay\n * erasable-syntax-only.\n * - `.cjs` / `.cts` — rejected. Generated servers are ES modules, so a\n * CommonJS target cannot run in any language.\n * - anything else (`.js` by default) — transpile to JavaScript first, so\n * `node .smrt/mcp-server/index.js` runs instead of dying on\n * `SyntaxError: Unexpected identifier 'CallToolRequest'`.\n *\n * Transpilation uses the `typescript` package that `@happyvertical/smrt-core`\n * already depends on, imported lazily so that merely importing the generators\n * does not pull the compiler into memory.\n */\n\n/** Language a generated file is written in, derived from its extension. */\nexport type GeneratedSourceLanguage = 'typescript' | 'javascript';\n\n/** Extension a generated module may be written with. */\nexport type GeneratedSourceExtension = '.ts' | '.mts' | '.js' | '.mjs';\n\nconst TYPESCRIPT_EXTENSIONS = ['.ts', '.mts'];\n\n/**\n * Generated servers are ES modules — they use `import` and `import.meta.url` —\n * so a CommonJS target can never run whatever language it is written in.\n */\nconst COMMONJS_EXTENSIONS = ['.cjs', '.cts'];\n\nfunction assertModuleTarget(outputPath: string, lowerCased: string): void {\n const commonJs = COMMONJS_EXTENSIONS.find((extension) =>\n lowerCased.endsWith(extension),\n );\n if (commonJs) {\n throw new Error(\n `Cannot generate an MCP server at '${outputPath}': the generated server is an ES module, so a ${commonJs} target cannot run. Use .js/.mjs for JavaScript or .ts/.mts for TypeScript.`,\n );\n }\n}\n\n/**\n * Decide how a generated file must be written from the path the caller asked\n * for. Unknown extensions emit JavaScript: `node` is the documented way to run\n * a generated server, so JavaScript is the safe default.\n *\n * @param outputPath - Path the generated file will be written to\n * @returns The language the file contents must be written in\n * @throws When the path asks for a CommonJS target\n */\nexport function resolveGeneratedSourceLanguage(\n outputPath: string,\n): GeneratedSourceLanguage {\n const lowerCased = outputPath.toLowerCase();\n assertModuleTarget(outputPath, lowerCased);\n return TYPESCRIPT_EXTENSIONS.some((extension) =>\n lowerCased.endsWith(extension),\n )\n ? 'typescript'\n : 'javascript';\n}\n\n/**\n * Extension for modules emitted alongside a generated entry point, so the\n * modular server's relative imports resolve to files that exist on disk *and*\n * are loaded with the entry's own module semantics. An `.mjs` entry point in a\n * CommonJS package needs `.mjs` siblings, not `.js` ones that Node would then\n * parse as CommonJS.\n *\n * @param outputPath - Path of the generated entry point\n * @returns The extension every sibling module is written with\n * @throws When the path asks for a CommonJS target\n */\nexport function generatedSiblingExtension(\n outputPath: string,\n): GeneratedSourceExtension {\n const lowerCased = outputPath.toLowerCase();\n assertModuleTarget(outputPath, lowerCased);\n if (lowerCased.endsWith('.mts')) return '.mts';\n if (lowerCased.endsWith('.ts')) return '.ts';\n if (lowerCased.endsWith('.mjs')) return '.mjs';\n return '.js';\n}\n\ntype TypeScriptApi = typeof import('typescript');\n\n/**\n * Load the TypeScript compiler API lazily.\n *\n * `typescript` is CommonJS: Node's ESM interop exposes the whole API on\n * `default`, while bundlers hand back the namespace itself.\n */\nasync function loadTypeScript(): Promise<TypeScriptApi> {\n const imported = (await import('typescript')) as TypeScriptApi & {\n default?: TypeScriptApi;\n };\n return imported.default ?? imported;\n}\n\n/**\n * Transpile generated TypeScript to runnable ESM JavaScript.\n *\n * `verbatimModuleSyntax` keeps every value import the template emits (an\n * unused-looking import must not be elided: the generated server relies on\n * side effects and on imports whose only use is inside emitted switch cases),\n * while type-only import specifiers are dropped.\n *\n * @param source - Generated TypeScript source\n * @param label - Target path or name reported in transpile diagnostics\n * @returns Equivalent JavaScript source\n * @throws When the generated source is not valid TypeScript\n */\nexport async function transpileGeneratedSource(\n source: string,\n label = 'generated MCP source',\n): Promise<string> {\n const ts = await loadTypeScript();\n\n const { outputText, diagnostics } = ts.transpileModule(source, {\n // The input is always TypeScript regardless of where it will be written;\n // a `.js` file name here would make the compiler parse it as JavaScript.\n fileName: 'smrt-generated-mcp-source.ts',\n reportDiagnostics: true,\n compilerOptions: {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n verbatimModuleSyntax: true,\n removeComments: false,\n newLine: ts.NewLineKind.LineFeed,\n },\n });\n\n const errors = (diagnostics ?? []).filter(\n (diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error,\n );\n if (errors.length > 0) {\n const details = errors\n .map((diagnostic) =>\n ts.flattenDiagnosticMessageText(diagnostic.messageText, ' '),\n )\n .join('; ');\n throw new Error(\n `Failed to transpile generated MCP source (${label}): ${details}`,\n );\n }\n\n return outputText;\n}\n\n/**\n * Render generated TypeScript for the requested output language.\n *\n * @param source - Generated TypeScript source\n * @param language - Language the file must be written in\n * @param label - Target path or name reported in transpile diagnostics\n * @returns Source ready to be written to disk\n */\nexport async function renderGeneratedSource(\n source: string,\n language: GeneratedSourceLanguage,\n label = 'generated MCP source',\n): Promise<string> {\n if (language === 'typescript') {\n return source;\n }\n return transpileGeneratedSource(source, label);\n}\n"],"mappings":";AA6BA,IAAM,wBAAwB,CAAC,OAAO,MAAM;;;;;AAM5C,IAAM,sBAAsB,CAAC,QAAQ,MAAM;AAE3C,SAAS,mBAAmB,YAAoB,YAA0B;CACxE,MAAM,WAAW,oBAAoB,MAAM,cACzC,WAAW,SAAS,SAAS,CAC/B;CACA,IAAI,UACF,MAAM,IAAI,MACR,qCAAqC,WAAW,gDAAgD,SAAS,4EAC3G;AAEJ;;;;;;;;;;AAWA,SAAgB,+BACd,YACyB;CACzB,MAAM,aAAa,WAAW,YAAY;CAC1C,mBAAmB,YAAY,UAAU;CACzC,OAAO,sBAAsB,MAAM,cACjC,WAAW,SAAS,SAAS,CAC/B,IACI,eACA;AACN;;;;;;;;;;;;AAaA,SAAgB,0BACd,YAC0B;CAC1B,MAAM,aAAa,WAAW,YAAY;CAC1C,mBAAmB,YAAY,UAAU;CACzC,IAAI,WAAW,SAAS,MAAM,GAAG,OAAO;CACxC,IAAI,WAAW,SAAS,KAAK,GAAG,OAAO;CACvC,IAAI,WAAW,SAAS,MAAM,GAAG,OAAO;CACxC,OAAO;AACT;;;;;;;AAUA,eAAe,iBAAyC;CACtD,MAAM,WAAY,MAAM,OAAO;CAG/B,OAAO,SAAS,WAAW;AAC7B;;;;;;;;;;;;;;AAeA,eAAsB,yBACpB,QACA,QAAQ,wBACS;CACjB,MAAM,KAAK,MAAM,eAAe;CAEhC,MAAM,EAAE,YAAY,gBAAgB,GAAG,gBAAgB,QAAQ;EAG7D,UAAU;EACV,mBAAmB;EACnB,iBAAiB;GACf,QAAQ,GAAG,aAAa;GACxB,QAAQ,GAAG,WAAW;GACtB,kBAAkB,GAAG,qBAAqB;GAC1C,sBAAsB;GACtB,gBAAgB;GAChB,SAAS,GAAG,YAAY;EAC1B;CACF,CAAC;CAED,MAAM,UAAU,eAAe,CAAC,EAAA,CAAG,QAChC,eAAe,WAAW,aAAa,GAAG,mBAAmB,KAChE;CACA,IAAI,OAAO,SAAS,GAAG;EACrB,MAAM,UAAU,OACb,KAAK,eACJ,GAAG,6BAA6B,WAAW,aAAa,GAAG,CAC7D,CAAC,CACA,KAAK,IAAI;EACZ,MAAM,IAAI,MACR,6CAA6C,MAAM,KAAK,SAC1D;CACF;CAEA,OAAO;AACT;;;;;;;;;AAUA,eAAsB,sBACpB,QACA,UACA,QAAQ,wBACS;CACjB,IAAI,aAAa,cACf,OAAO;CAET,OAAO,yBAAyB,QAAQ,KAAK;AAC/C"}
@@ -35,6 +35,11 @@ export interface RuntimeOptions {
35
35
  optionsParameter?: boolean;
36
36
  legacyOptions: boolean;
37
37
  }>;
38
+ /** Task-enabled item custom actions. Never emitted in tools/list. */
39
+ taskActions?: Record<string, {
40
+ objectName: string;
41
+ objectType: string;
42
+ }>;
38
43
  /**
39
44
  * Lowercased simple names of objects that are `@TenantScoped` (#1554). When
40
45
  * non-empty, the generated server imports the tenancy fail-closed gate and
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-runtime-template.d.ts","sourceRoot":"","sources":["../../src/generators/mcp-runtime-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAStD,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,kCAAkC;IAClC,MAAM,CAAC,EAAE,SAAS,CAAC;IAE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