@happyvertical/smrt-core 0.37.6 → 0.37.7

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 (52) hide show
  1. package/AGENTS.md +2 -0
  2. package/dist/collection.d.ts +7 -0
  3. package/dist/collection.d.ts.map +1 -1
  4. package/dist/collection.js +2 -0
  5. package/dist/collection.js.map +1 -1
  6. package/dist/consumer-plugin/index.js +26 -3
  7. package/dist/consumer-plugin/index.js.map +1 -1
  8. package/dist/generators/conditional-get.d.ts +108 -0
  9. package/dist/generators/conditional-get.d.ts.map +1 -0
  10. package/dist/generators/conditional-get.js +189 -0
  11. package/dist/generators/conditional-get.js.map +1 -0
  12. package/dist/generators/index.d.ts +1 -0
  13. package/dist/generators/index.d.ts.map +1 -1
  14. package/dist/generators/index.js +2 -1
  15. package/dist/generators/rest.d.ts +22 -0
  16. package/dist/generators/rest.d.ts.map +1 -1
  17. package/dist/generators/rest.js +86 -5
  18. package/dist/generators/rest.js.map +1 -1
  19. package/dist/generators.js +2 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +3 -1
  23. package/dist/manifest/static-manifest.d.ts.map +1 -1
  24. package/dist/manifest/static-manifest.js +10 -2
  25. package/dist/manifest/static-manifest.js.map +1 -1
  26. package/dist/manifest/store.js +1 -1
  27. package/dist/manifest/store.js.map +1 -1
  28. package/dist/manifest/test-manifest-stub.d.ts.map +1 -1
  29. package/dist/manifest/test-manifest-stub.js +1833 -223
  30. package/dist/manifest/test-manifest-stub.js.map +1 -1
  31. package/dist/manifest.json +10 -2
  32. package/dist/object.d.ts +19 -0
  33. package/dist/object.d.ts.map +1 -1
  34. package/dist/object.js +24 -2
  35. package/dist/object.js.map +1 -1
  36. package/dist/registry/index.d.ts +1 -1
  37. package/dist/registry/index.d.ts.map +1 -1
  38. package/dist/registry/types.d.ts +34 -0
  39. package/dist/registry/types.d.ts.map +1 -1
  40. package/dist/smrt-knowledge.json +7 -6
  41. package/dist/sync/apply.d.ts +234 -0
  42. package/dist/sync/apply.d.ts.map +1 -0
  43. package/dist/sync/apply.js +378 -0
  44. package/dist/sync/apply.js.map +1 -0
  45. package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
  46. package/dist/vite-plugin/sveltekit-generator.js +19 -10
  47. package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
  48. package/dist/vite-plugin/sync-apply-route.d.ts +40 -0
  49. package/dist/vite-plugin/sync-apply-route.d.ts.map +1 -0
  50. package/dist/vite-plugin/sync-apply-route.js +240 -0
  51. package/dist/vite-plugin/sync-apply-route.js.map +1 -0
  52. package/package.json +4 -4
@@ -8,6 +8,6 @@ export { getEmbeddingClasses, getEmbeddingConfig, getProjectEmbeddingConfig, has
8
8
  export { findClass, findClassesByName, findClassStrict, getAllClasses, getCanonicalClassName, getClass, getClassByConstructor, getClassByQualifiedName, getClassesByPackage, getClassesByVisibility, getClassInPackage, getClassNames, getPublicClasses, getQualifiedClassNames, hasClass, hasClassCaseInsensitive, qualifyExtendsName, resolveType, } from './name-resolver';
9
9
  export { getDependencyGraph, getRelationshipMap } from './relationship-graph';
10
10
  export { getClasses, getCollectionCache, getCollections, getCollectionTableNames, getConstructorIndex, getDbInstanceIds, getDiscoveryAttemptCache, getFieldDecorators, getInheritanceCache, getInheritanceConfig, getNextDbId, getSchemasInitialized, getSourceFileFromStack, getStiSiblingsLoaded, setNextDbId, VERBOSE_ENABLED, verboseLog, } from './shared-state';
11
- export type { ApiConfig, RegisteredClass, RelationshipMetadata, RelationshipType, SmartObjectConfig, SmrtObjectConstructor, ValidatorFunction, } from './types';
11
+ export type { ApiConfig, ApiHttpCacheConfig, RegisteredClass, RelationshipMetadata, RelationshipType, SmartObjectConfig, SmrtObjectConstructor, ValidatorFunction, } from './types';
12
12
  export { compileValidators } from './validator';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACb,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACb,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
@@ -128,6 +128,40 @@ export interface ApiConfig {
128
128
  * fields are always stripped to prevent mass-assignment.
129
129
  */
130
130
  writable?: string[];
131
+ /**
132
+ * HTTP cache policy for generated read (`list`/`get`) responses (#1757).
133
+ *
134
+ * Generated reads always carry a strong body-hash ETag and honor
135
+ * `If-None-Match` with `304 Not Modified`. By default they are served
136
+ * `Cache-Control: private, no-cache` — browsers may store them but must
137
+ * revalidate, and shared caches never store them.
138
+ *
139
+ * Distinct from the top-level `@smrt({ cache })` knob, which configures the
140
+ * server-side collection read-through cache (#1499).
141
+ */
142
+ cache?: ApiHttpCacheConfig;
143
+ }
144
+ /**
145
+ * HTTP caching knob for generated read routes (#1757).
146
+ */
147
+ export interface ApiHttpCacheConfig {
148
+ /**
149
+ * Opt-in shared-cache TTL, in seconds, for generated read responses:
150
+ * emits `Cache-Control: public, max-age=0, s-maxage=<n>` so CDNs/shared
151
+ * caches may serve reads for `n` seconds while browsers still revalidate.
152
+ *
153
+ * Only honored when the model's reads are public (`public: true` or
154
+ * `public: 'read'`); non-public models never emit shared-cache headers.
155
+ * Values that are not positive finite numbers are ignored.
156
+ *
157
+ * Tenant-scoped models (`@smrt({ tenantScoped })` or `@TenantScoped()`,
158
+ * ANY mode including `'optional'`) never emit shared-cache headers either:
159
+ * their response bodies vary with the session-cookie tenant context, which
160
+ * URL-keyed shared caches cannot see, so honoring `sMaxage` would serve one
161
+ * tenant's rows to other tenants or anonymous visitors. The knob is
162
+ * neutralized to `private, no-cache` with a one-time warning.
163
+ */
164
+ sMaxage?: number;
131
165
  }
132
166
  export interface ReportConfig {
133
167
  source: string | Function;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;GAGG;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO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IAAI,EAAE,UAAU,CAAC;QACjB,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACtC,CAAC;KACH,CAAC,CAAC;IACH,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,mFAAmF;IACnF,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC/C,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACjD,2DAA2D;IAC3D,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,OAAO,CAAC;QACpB,YAAY,EAAE,OAAO,CAAC;QACtB,qBAAqB,EAAE,OAAO,CAAC;KAChC,CAAC;IACF;;;;;OAKG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B"}
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-07-02T02:37:12.299Z",
3
+ "generatedAt": "2026-07-03T03:19:20.783Z",
4
4
  "packageName": "@happyvertical/smrt-core",
5
- "packageVersion": "0.37.6",
5
+ "packageVersion": "0.37.7",
6
6
  "sourceManifestPath": "dist/manifest.json",
7
7
  "agentDocPath": "AGENTS.md",
8
8
  "sourceHashes": {
9
- "manifest": "a248a5d611e1ce8c545863aa4b518ac797017c1c7fcc9a0f2fc374763f14d466",
10
- "packageJson": "e76b922f1df5d6d04e6b0601db5d1319ab0b60bb6dcde1ed38957178f0aad213",
11
- "agents": "0fa157a078aa44a0bc104540bd27f0b1e52e66549b7994cba751438a8d44c827"
9
+ "manifest": "2e61119f977c1eb4abfb1a09b7b13f8c4711b6feba80e539ac1f55b41adcd3e2",
10
+ "packageJson": "f23470e3d070e8985072849f5dedad47ba5c5eddddb30fe23ccf761ffb067011",
11
+ "agents": "77c66a0b0e98a9f219bb5d901fd226366df01ffe8bdac5ad23d8785d08dee7cd"
12
12
  },
13
13
  "exports": [
14
14
  ".",
@@ -252,6 +252,7 @@
252
252
  "recall",
253
253
  "recallAll",
254
254
  "remember",
255
+ "requireInsertOnSave",
255
256
  "save",
256
257
  "toJSON",
257
258
  "toPlainObject",
@@ -322,5 +323,5 @@
322
323
  "polymorphicAssociations": 1,
323
324
  "uuidColumns": 3
324
325
  },
325
- "agentDoc": "# @happyvertical/smrt-core\n\nORM, code generation, AI integration, and the DispatchBus. Everything else builds on this.\n\n## Key Classes\n\n| Class | File | Purpose |\n|-------|------|---------|\n| SmrtObject | `src/object.ts` | Base persistent object — save, delete, is(), do(), loadFromId/Slug |\n| SmrtCollection | `src/collection.ts` | CRUD collection — list, get, create, delete, getOrUpsert |\n| ObjectRegistry | `src/registry.ts` | Global singleton (globalThis) — class metadata, fields, STI chains, manifests |\n| DispatchBus | `src/dispatch/bus.ts` | Inter-agent messaging — emit, subscribe (persistent), process |\n| GlobalInterceptors | `src/interceptors.ts` | Plugin system — beforeList/Get/Save/Delete hooks (used by tenancy) |\n\n## SmrtObject Lifecycle\n\n`constructor(options)` → `initialize()` → ready for `save()`/`delete()`/`loadFromId()`\n\n- `initialize()`: loads field initializers, applies option values (options override initializers), loads from DB if id/slug provided\n- `save()`: upsert with STI validation, interceptor execution, auto-embeddings. Persisted objects (`isPersisted` — set by DB hydration and successful saves) upsert on `['id']` so natural-key edits (e.g. slug renames) update in place; new objects upsert on the natural-key conflict columns for ingestion-style dedup (#1472)\n- `is(criteria)` / `do(instructions)` / `describe()`: AI operations via function calling. They inject the object's own `toPublicJSON()` (sensitive fields stripped) as a \"content body\" so the model reasons over the instance. Options: `includeData: false` skips injection (for callers that already curate the relevant fields into the instruction); `maxDataLength` overrides the truncation budget. Neither key is forwarded to `ai.message()`. (#1567)\n- `getSlug()`: auto-generates from name → title → label → id\n- `loadRelated(fieldName)`: lazy-loads relationships (cached in `_loadedRelationships` Map)\n\n## SmrtCollection Query\n\n```typescript\nawait collection.list({\n where: { status: 'active', price: { op: '>', value: 10 } },\n limit: 50, offset: 0, orderBy: 'created_at DESC'\n});\n```\n\n**WHERE operators**: `=`, `>`, `<`, `>=`, `<=`, `!=`, `in`, `not in`, `like`, `is null`, `is not null`. Arrays auto-detect `IN`. Dot notation for JSON paths: `metadata.userId`.\n\nSTI child collections auto-filter by `_meta_type`.\n\n## @smrt() Decorator Options\n\nKey options: `tableName`, `tableStrategy` ('cti'|'sti'), `conflictColumns`, `api`/`mcp`/`cli` (generation config), `ai` (callable methods), `hooks` (beforeSave/afterSave/beforeDelete/afterDelete), `embeddings` (auto-generate), `tenantScoped`, `agent`.\n\nRegistration sets `SMRT_TABLE_NAME` static property (survives minification).\n\n## Domain Knowledge Artifacts\n\n`smrtPlugin()` writes runtime manifests and agent/developer knowledge artifacts:\n\n- local dev/build: `.smrt/manifest.json` and `.smrt/smrt-knowledge.json`\n- package build: `dist/manifest.json` and `dist/smrt-knowledge.json`\n\nKeep `manifest.json` runtime-focused. `smrt-knowledge.json` is the deterministic\nagent contract for downstream review and architecture tools.\n\nConfig precedence for knowledge is defaults → top-level `knowledge` in\n`smrt.config.ts` → `packages[packageName].knowledge` → plugin option →\nobject-level `@smrt({ knowledge })`.\n\nObject-level `knowledge: false` excludes an object from authored context only;\nit must not change runtime manifest registration. Use\n`knowledge: { tags, summary, risks }` for review-sensitive domain objects.\n\nHTTP knowledge routes are disabled by default. If `knowledge.api.enabled` is\ntrue, generated SvelteKit routes must stay GET-only and guarded by dev mode or\nadmin auth.\n\n## DispatchBus\n\n- `emit(signalType, payload, metadata)` → creates persistent Dispatch record\n- `on(pattern, handler)` → in-memory handler (immediate)\n- `subscribe({ signalType, subscriber })` → persistent subscription (survives restarts)\n- `process(subscriberName, handler)` → process pending dispatches\n- Wildcards: `campaign.*` matches `campaign.completed` (single segment only)\n- Tables: `_smrt_dispatch`, `_smrt_dispatch_subscriptions`\n- Status: `pending → processing → completed` (or `failed`)\n\n## Single Table Inheritance (STI)\n\n- Base: `@smrt({ tableStrategy: 'sti' })` — children inherit, share one table\n- Discriminator: `_meta_type` column with qualified names (`@happyvertical/smrt-content:Article`)\n- Child fields: `@meta()` decorator → stored in `_meta_data` JSONB (not as columns)\n- Polymorphic queries: collection loads `_meta_type`, creates correct subclass dynamically\n- Validation: fail-fast on save if `_meta_type` missing or mismatched\n\n## Code Generators\n\n| Generator | Location | Output |\n|-----------|----------|--------|\n| REST API | `src/generators/rest.ts` | OpenAPI-compliant CRUD endpoints |\n| CLI | `src/generators/cli.ts` | `objectname:action` admin commands — writable allowlist, exhaustive-include, `--from-file`, fail-closed tenant context |\n| MCP Server | `src/generators/mcp.ts` | Model Context Protocol tools |\n\n## Child Accessors (R10)\n\n`src/child-accessors.ts` installs a consistent `get<FieldName>()` instance method for every `@oneToMany` field at `@smrt()` registration time (e.g. `@oneToMany('OrderItem') items` → `order.getItems()`), delegating to `loadRelatedMany`. Two invariants:\n\n- **Additive** — never overwrites a hand-rolled method of the same name (checks the whole prototype chain). `Profile.getMetadata()` (key-value) and `ProfileRelationship.getTerms()` are preserved.\n- **Runtime-only** — attached to the prototype, invisible to the build-time manifest, so it never leaks into the REST/CLI/MCP surface.\n\nWhen the target declares multiple FKs back to the parent, annotate `@oneToMany(Target, { foreignKey: '<inverseField>' })`; `loadRelatedMany` and the eager `include:` loader both honor it (else first-match).\n\n## Vite Plugin\n\n```typescript\n// vite.config.ts — required for @smrt() decorators\nexport default defineConfig({\n esbuild: {\n tsconfigRaw: {\n compilerOptions: { experimentalDecorators: true, emitDecoratorMetadata: true }\n }\n }\n});\n```\n\n## Gotchas\n\n- **Never override toJSON()** — handles STI discriminator + meta field extraction. Use `transformJSON()`\n- **Property init order**: TypeScript initializers run first, then `initialize()` applies option values (options win)\n- **No runtime schema creation**: application tables must be prepared explicitly via migrations/tooling; runtime only verifies and fails clearly\n- **Retry logic**: `db.get()` (3 retries, 250ms) and `db.upsert()` (3 retries, 500ms) have built-in retry\n- **Field caching**: `_cachedFields` populated during `Collection.create()` — eliminates async `getFields()` per query\n- **Smart cloning**: arrays/objects shallow-cloned in property init to prevent aliasing (Issue #22)\n- **Table verification cache**: `isTableVerified(dbUrl, tableName)` avoids redundant `tableExists()` calls\n- **Manifest required**: build-time AST scanning creates manifest. Without vitest plugin → \"No field metadata\"\n- **Vite plugin loads scanner from `dist/` first**: `src/vite-plugin/import-build-aware.ts` prefers `dist/` when it exists on disk; it only falls back to `src/` on fresh clones. So if you edit `src/scanner/*.ts` or `src/schema/generator.ts` and want those edits reflected in consumer manifest generation, you must rebuild (`pnpm build` or have `pnpm dev` / `pnpm build:watch` running in core). This is intentional — sniffing `.ts` vs `.js` via `import.meta.url` was non-deterministic under tsx and broke 12–13 publishes (#1139).\n"
326
+ "agentDoc": "# @happyvertical/smrt-core\n\nORM, code generation, AI integration, and the DispatchBus. Everything else builds on this.\n\n## Key Classes\n\n| Class | File | Purpose |\n|-------|------|---------|\n| SmrtObject | `src/object.ts` | Base persistent object — save, delete, is(), do(), loadFromId/Slug |\n| SmrtCollection | `src/collection.ts` | CRUD collection — list, get, create, delete, getOrUpsert |\n| ObjectRegistry | `src/registry.ts` | Global singleton (globalThis) — class metadata, fields, STI chains, manifests |\n| DispatchBus | `src/dispatch/bus.ts` | Inter-agent messaging — emit, subscribe (persistent), process |\n| GlobalInterceptors | `src/interceptors.ts` | Plugin system — beforeList/Get/Save/Delete hooks (used by tenancy) |\n\n## SmrtObject Lifecycle\n\n`constructor(options)` → `initialize()` → ready for `save()`/`delete()`/`loadFromId()`\n\n- `initialize()`: loads field initializers, applies option values (options override initializers), loads from DB if id/slug provided\n- `save()`: upsert with STI validation, interceptor execution, auto-embeddings. Persisted objects (`isPersisted` — set by DB hydration and successful saves) upsert on `['id']` so natural-key edits (e.g. slug renames) update in place; new objects upsert on the natural-key conflict columns for ingestion-style dedup (#1472)\n- `is(criteria)` / `do(instructions)` / `describe()`: AI operations via function calling. They inject the object's own `toPublicJSON()` (sensitive fields stripped) as a \"content body\" so the model reasons over the instance. Options: `includeData: false` skips injection (for callers that already curate the relevant fields into the instruction); `maxDataLength` overrides the truncation budget. Neither key is forwarded to `ai.message()`. (#1567)\n- `getSlug()`: auto-generates from name → title → label → id\n- `loadRelated(fieldName)`: lazy-loads relationships (cached in `_loadedRelationships` Map)\n\n## SmrtCollection Query\n\n```typescript\nawait collection.list({\n where: { status: 'active', price: { op: '>', value: 10 } },\n limit: 50, offset: 0, orderBy: 'created_at DESC'\n});\n```\n\n**WHERE operators**: `=`, `>`, `<`, `>=`, `<=`, `!=`, `in`, `not in`, `like`, `is null`, `is not null`. Arrays auto-detect `IN`. Dot notation for JSON paths: `metadata.userId`.\n\nSTI child collections auto-filter by `_meta_type`.\n\n## @smrt() Decorator Options\n\nKey options: `tableName`, `tableStrategy` ('cti'|'sti'), `conflictColumns`, `api`/`mcp`/`cli` (generation config), `ai` (callable methods), `hooks` (beforeSave/afterSave/beforeDelete/afterDelete), `embeddings` (auto-generate), `tenantScoped`, `agent`.\n\nRegistration sets `SMRT_TABLE_NAME` static property (survives minification).\n\n## Domain Knowledge Artifacts\n\n`smrtPlugin()` writes runtime manifests and agent/developer knowledge artifacts:\n\n- local dev/build: `.smrt/manifest.json` and `.smrt/smrt-knowledge.json`\n- package build: `dist/manifest.json` and `dist/smrt-knowledge.json`\n\nKeep `manifest.json` runtime-focused. `smrt-knowledge.json` is the deterministic\nagent contract for downstream review and architecture tools.\n\nConfig precedence for knowledge is defaults → top-level `knowledge` in\n`smrt.config.ts` → `packages[packageName].knowledge` → plugin option →\nobject-level `@smrt({ knowledge })`.\n\nObject-level `knowledge: false` excludes an object from authored context only;\nit must not change runtime manifest registration. Use\n`knowledge: { tags, summary, risks }` for review-sensitive domain objects.\n\nHTTP knowledge routes are disabled by default. If `knowledge.api.enabled` is\ntrue, generated SvelteKit routes must stay GET-only and guarded by dev mode or\nadmin auth.\n\n## DispatchBus\n\n- `emit(signalType, payload, metadata)` → creates persistent Dispatch record\n- `on(pattern, handler)` → in-memory handler (immediate)\n- `subscribe({ signalType, subscriber })` → persistent subscription (survives restarts)\n- `process(subscriberName, handler)` → process pending dispatches\n- Wildcards: `campaign.*` matches `campaign.completed` (single segment only)\n- Tables: `_smrt_dispatch`, `_smrt_dispatch_subscriptions`\n- Status: `pending → processing → completed` (or `failed`)\n\n## Single Table Inheritance (STI)\n\n- Base: `@smrt({ tableStrategy: 'sti' })` — children inherit, share one table\n- Discriminator: `_meta_type` column with qualified names (`@happyvertical/smrt-content:Article`)\n- Child fields: `@meta()` decorator → stored in `_meta_data` JSONB (not as columns)\n- Polymorphic queries: collection loads `_meta_type`, creates correct subclass dynamically\n- Validation: fail-fast on save if `_meta_type` missing or mismatched\n\n## Code Generators\n\n| Generator | Location | Output |\n|-----------|----------|--------|\n| REST API | `src/generators/rest.ts` | OpenAPI-compliant CRUD endpoints |\n| CLI | `src/generators/cli.ts` | `objectname:action` admin commands — writable allowlist, exhaustive-include, `--from-file`, fail-closed tenant context |\n| MCP Server | `src/generators/mcp.ts` | Model Context Protocol tools |\n\nGenerated reads (`list`/`get`) on the REST and SvelteKit generators support conditional GET (#1757, helpers in `src/generators/conditional-get.ts`): strong body-hash ETag, `If-None-Match` → 304 with an empty body, `private, no-cache` by default. Public models may opt into shared caching via `@smrt({ api: { public: true | 'read', cache: { sMaxage } } })` → `public, max-age=0, s-maxage=<n>`; non-public models never emit shared-cache headers. Tenant-scoped models (any mode) never emit them either — bodies vary with session-cookie tenant context that URL-keyed shared caches cannot see; `sMaxage` is neutralized to `private, no-cache` with a one-time warning.\n\n## Child Accessors (R10)\n\n`src/child-accessors.ts` installs a consistent `get<FieldName>()` instance method for every `@oneToMany` field at `@smrt()` registration time (e.g. `@oneToMany('OrderItem') items` → `order.getItems()`), delegating to `loadRelatedMany`. Two invariants:\n\n- **Additive** — never overwrites a hand-rolled method of the same name (checks the whole prototype chain). `Profile.getMetadata()` (key-value) and `ProfileRelationship.getTerms()` are preserved.\n- **Runtime-only** — attached to the prototype, invisible to the build-time manifest, so it never leaks into the REST/CLI/MCP surface.\n\nWhen the target declares multiple FKs back to the parent, annotate `@oneToMany(Target, { foreignKey: '<inverseField>' })`; `loadRelatedMany` and the eager `include:` loader both honor it (else first-match).\n\n## Vite Plugin\n\n```typescript\n// vite.config.ts — required for @smrt() decorators\nexport default defineConfig({\n esbuild: {\n tsconfigRaw: {\n compilerOptions: { experimentalDecorators: true, emitDecoratorMetadata: true }\n }\n }\n});\n```\n\n## Gotchas\n\n- **Never override toJSON()** — handles STI discriminator + meta field extraction. Use `transformJSON()`\n- **Property init order**: TypeScript initializers run first, then `initialize()` applies option values (options win)\n- **No runtime schema creation**: application tables must be prepared explicitly via migrations/tooling; runtime only verifies and fails clearly\n- **Retry logic**: `db.get()` (3 retries, 250ms) and `db.upsert()` (3 retries, 500ms) have built-in retry\n- **Field caching**: `_cachedFields` populated during `Collection.create()` — eliminates async `getFields()` per query\n- **Smart cloning**: arrays/objects shallow-cloned in property init to prevent aliasing (Issue #22)\n- **Table verification cache**: `isTableVerified(dbUrl, tableName)` avoids redundant `tableExists()` calls\n- **Manifest required**: build-time AST scanning creates manifest. Without vitest plugin → \"No field metadata\"\n- **Vite plugin loads scanner from `dist/` first**: `src/vite-plugin/import-build-aware.ts` prefers `dist/` when it exists on disk; it only falls back to `src/` on fresh clones. So if you edit `src/scanner/*.ts` or `src/schema/generator.ts` and want those edits reflected in consumer manifest generation, you must rebuild (`pnpm build` or have `pnpm dev` / `pnpm build:watch` running in core). This is intentional — sniffing `.ts` vs `.js` via `import.meta.url` was non-deterministic under tsx and broke 12–13 publishes (#1139).\n"
326
327
  }
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Idempotent sync-apply batch processing (#1759).
3
+ *
4
+ * The single shared write contract for the web offline outbox (#1762) and the
5
+ * KMP mobile write queue (#1739): an ordered batch of client-authored
6
+ * mutations carrying client-generated row UUIDs, applied FIFO through the
7
+ * host's full stack (authentication, tenant isolation, interceptors, writable
8
+ * policy), returning per-item results (`applied` / `conflict` / `rejected`).
9
+ *
10
+ * This module is transport-agnostic: the runtime REST generator
11
+ * (`generators/rest.ts`) and the generated SvelteKit route
12
+ * (`vite-plugin/sync-apply-route.ts`) both delegate here, supplying a
13
+ * {@link SyncApplyHost} that adapts their own collection resolution,
14
+ * authorization, and writable-policy machinery. Keeping the logic here keeps
15
+ * the two generators byte-minimal and the contract single-sourced.
16
+ *
17
+ * Contract documentation: docs/content/architecture/sync-apply-contract.md
18
+ *
19
+ * ## Why replay is idempotent
20
+ *
21
+ * - Row identity is the client-generated UUID (validated server-side), and
22
+ * ONLY that UUID: creates persist via a strict INSERT
23
+ * (`_insertOnly`, never natural-key dedup-upsert), so a create can never
24
+ * adopt or overwrite a different row, and a re-delivered create finds its
25
+ * own row via the id pre-check instead of duplicating it.
26
+ * - Before writing, each create/update is compared against the current row;
27
+ * when the row already reflects the item's payload the write is skipped and
28
+ * reported `applied` (a no-op re-apply). This is what makes N replays of an
29
+ * identical batch yield byte-identical database state (no `updated_at`
30
+ * churn) AND identical per-item results, without a server-side idempotency
31
+ * ledger.
32
+ * - Deletes of rows that are already gone report `applied` consistently.
33
+ *
34
+ * ## Conflict policy v1 (server-authoritative LWW, updated-at guard)
35
+ *
36
+ * The stale guard applies to mutations that would actually change server
37
+ * state: an update/delete whose `baseUpdatedAt` is older than the server
38
+ * row's `updated_at` AND whose effect is not already present is the LOSING
39
+ * write — it is **skipped** (the newer server state wins) and the item is
40
+ * reported `conflict` with the server's current `updatedAt` so the client can
41
+ * rebase. Two deliberate precedences soften "stale ⇒ conflict":
42
+ * no-op detection runs first (a stale update whose payload already matches
43
+ * the row is an idempotent replay of an applied write → `applied`), and a
44
+ * delete of a row that is already gone is a no-op → `applied`. Skipping
45
+ * (rather than clobbering) was chosen because it never destroys newer data,
46
+ * and it is replay-stable: a replayed conflicting item reports `conflict`
47
+ * again against unchanged state. Field-level merge is explicitly out of
48
+ * scope for v1.
49
+ */
50
+ /**
51
+ * URL segments of the generated batch apply endpoint, relative to the API
52
+ * base path: `POST {basePath}/sync/apply`. The `sync` segment is reserved —
53
+ * a collection named `sync` cannot expose an item route named `apply`.
54
+ */
55
+ export declare const SYNC_APPLY_ROUTE_SEGMENTS: readonly ["sync", "apply"];
56
+ /** Maximum items accepted in one batch; larger batches are rejected (400). */
57
+ export declare const MAX_SYNC_APPLY_BATCH_SIZE = 1000;
58
+ /**
59
+ * Client-generated row ids must be well-formed UUIDs. Same shape the ORM
60
+ * accepts as an id filter in `SmrtCollection.get()`.
61
+ */
62
+ export declare const SYNC_APPLY_UUID_PATTERN: RegExp;
63
+ /** Mutation kinds accepted by the batch apply endpoint. */
64
+ export type SyncApplyOp = 'create' | 'update' | 'delete';
65
+ /** Per-item outcome status. */
66
+ export type SyncApplyStatus = 'applied' | 'conflict' | 'rejected';
67
+ /** Machine-readable reasons for `rejected` items. */
68
+ export type SyncApplyRejectionReason = 'invalid_item' | 'invalid_id' | 'invalid_payload' | 'unknown_object' | 'op_not_allowed' | 'auth_required' | 'forbidden' | 'not_found' | 'id_conflict' | 'write_failed';
69
+ /** Machine-readable reasons for `conflict` items. */
70
+ export type SyncApplyConflictReason = 'stale_write' | 'create_conflict';
71
+ export type SyncApplyReason = SyncApplyRejectionReason | SyncApplyConflictReason;
72
+ /**
73
+ * One client-authored mutation in a batch. See the contract doc for field
74
+ * semantics; briefly:
75
+ *
76
+ * - `itemId` — the client's idempotency/correlation handle (the durable queue
77
+ * row id). Echoed back verbatim; results are also positional.
78
+ * - `object` — the collection route segment the model's CRUD routes use
79
+ * (e.g. `products`).
80
+ * - `id` — the client-generated row UUID. This is the ONLY channel for a
81
+ * client-supplied id; payload `id` fields are stripped by the writable
82
+ * policy exactly as on plain CRUD routes (#1540).
83
+ * - `baseUpdatedAt` — the server `updated_at` the client last saw for this
84
+ * row; drives the conflict guard on update/delete. Omit to opt out.
85
+ */
86
+ export interface SyncApplyItem {
87
+ itemId: string;
88
+ object: string;
89
+ op: SyncApplyOp;
90
+ id: string;
91
+ payload?: Record<string, unknown>;
92
+ baseUpdatedAt?: string;
93
+ }
94
+ /** Request body of `POST …/sync/apply`. */
95
+ export interface SyncApplyBatchRequest {
96
+ items: SyncApplyItem[];
97
+ }
98
+ /**
99
+ * Per-item result. `results[i]` always corresponds to `items[i]` (positional);
100
+ * `itemId` is echoed for convenience (`null` when the incoming item was too
101
+ * malformed to carry one). `updatedAt` is the server row's `updated_at` after
102
+ * processing — present on applied creates/updates and on conflicts (so clients
103
+ * can rebase), absent on deletes and rejections.
104
+ */
105
+ export interface SyncApplyItemResult {
106
+ itemId: string | null;
107
+ id: string | null;
108
+ status: SyncApplyStatus;
109
+ reason?: SyncApplyReason;
110
+ updatedAt?: string;
111
+ }
112
+ /** Response body of `POST …/sync/apply` (HTTP 200). */
113
+ export interface SyncApplyBatchResponse {
114
+ results: SyncApplyItemResult[];
115
+ }
116
+ /** Batch-level error body (HTTP 400). */
117
+ export interface SyncApplyBatchError {
118
+ error: {
119
+ code: 'invalid_batch' | 'batch_too_large';
120
+ message: string;
121
+ };
122
+ }
123
+ /** Outcome of {@link processSyncApplyBatch}: HTTP status + JSON body. */
124
+ export type SyncApplyOutcome = {
125
+ status: 200;
126
+ body: SyncApplyBatchResponse;
127
+ } | {
128
+ status: 400;
129
+ body: SyncApplyBatchError;
130
+ };
131
+ /**
132
+ * Minimal structural view of a persisted row as the processor needs it.
133
+ * Matches `SmrtObject` structurally; kept structural so hosts and tests can
134
+ * exercise the processor without importing ORM classes.
135
+ */
136
+ export interface SyncApplyRowLike {
137
+ id?: string | null;
138
+ updated_at?: Date | string | null;
139
+ save(): Promise<unknown>;
140
+ delete(): Promise<unknown>;
141
+ }
142
+ /**
143
+ * Minimal structural view of a collection (matches `SmrtCollection`).
144
+ * `create()` must honor the `_insertOnly` option (strict INSERT — see
145
+ * `SmrtCreateInput`), which the processor sets on every sync create.
146
+ */
147
+ export interface SyncApplyCollectionLike {
148
+ get(id: string): Promise<SyncApplyRowLike | null>;
149
+ create(options: Record<string, unknown>): Promise<SyncApplyRowLike>;
150
+ }
151
+ /** Per-item authorization decision from the host. */
152
+ export type SyncApplyAuthzDecision = 'ok' | 'auth_required' | 'forbidden';
153
+ /**
154
+ * A resolved mutation target: everything the processor needs to apply one
155
+ * item through the host's full stack. Hosts build these from their existing
156
+ * machinery so sync items follow the exact same authorization, action-gating,
157
+ * and mass-assignment rules as the host's plain CRUD routes.
158
+ */
159
+ export interface SyncApplyTarget {
160
+ /** Registry/class name, for diagnostics. */
161
+ objectName: string;
162
+ /** Collection whose get/create/save/delete run the full interceptor stack. */
163
+ collection: SyncApplyCollectionLike;
164
+ /** Whether the object's API config exposes this op (mirrors CRUD gating). */
165
+ isOpAllowed(op: SyncApplyOp): boolean;
166
+ /** Per-item authorization (mutating semantics, fail-closed). */
167
+ authorize(op: SyncApplyOp): Promise<SyncApplyAuthzDecision> | SyncApplyAuthzDecision;
168
+ /**
169
+ * Mass-assignment guard (#1540): strip server-managed/readonly/disallowed
170
+ * fields from the item payload. The row UUID is injected from the validated
171
+ * envelope `id` AFTER this runs — never from the body.
172
+ */
173
+ prepare(payload: Record<string, unknown>): Record<string, unknown>;
174
+ }
175
+ /** Host adapter handed to {@link processSyncApplyBatch}. */
176
+ export interface SyncApplyHost {
177
+ /**
178
+ * Resolve an item's `object` segment to a target, or `null` when unknown.
179
+ * Called once per item so per-item auth context stays accurate.
180
+ */
181
+ resolveTarget(objectSegment: string): Promise<SyncApplyTarget | null> | SyncApplyTarget | null;
182
+ }
183
+ /**
184
+ * Writable-policy helper shared with the generated SvelteKit sync route: the
185
+ * same stripping rules as the generated CRUD handlers (#1540) — server-managed
186
+ * fields, `_`-prefixed keys, `@field({ readonly: true })` fields, and (when
187
+ * configured) intersection with the `api.writable` allowlist.
188
+ */
189
+ export declare function applySyncWritablePolicy(data: unknown, policy?: {
190
+ readonlyFields?: readonly string[];
191
+ writableAllowlist?: readonly string[] | null;
192
+ }): Record<string, unknown>;
193
+ /**
194
+ * Batch-level validation. Returns the raw items array or a 400-shaped error.
195
+ */
196
+ export declare function parseSyncApplyBatch(body: unknown): {
197
+ items: unknown[];
198
+ } | SyncApplyBatchError;
199
+ interface ValidatedItem {
200
+ ok: true;
201
+ item: SyncApplyItem;
202
+ }
203
+ interface InvalidItem {
204
+ ok: false;
205
+ result: SyncApplyItemResult;
206
+ }
207
+ /**
208
+ * Per-item shape validation. Never throws; malformed items become `rejected`
209
+ * results so one bad item cannot fail the batch.
210
+ */
211
+ export declare function validateSyncApplyItem(raw: unknown): ValidatedItem | InvalidItem;
212
+ /**
213
+ * Updated-at conflict guard: true when the client's base is strictly older
214
+ * than the server row's `updated_at`. No base (client opted out) or no
215
+ * comparable server timestamp → not stale.
216
+ */
217
+ export declare function isStaleWrite(baseUpdatedAt: string | undefined, serverUpdatedAt: Date | string | null | undefined): boolean;
218
+ /**
219
+ * No-op detection: true when the row already reflects every (policy-stripped)
220
+ * payload field. Payload keys that are not properties of the hydrated row are
221
+ * ignored — they would never persist, so they must not defeat idempotent
222
+ * replay. This check is what keeps replayed batches from churning
223
+ * `updated_at` (and keeps their per-item results identical).
224
+ */
225
+ export declare function payloadMatchesRow(payload: Record<string, unknown>, row: SyncApplyRowLike): boolean;
226
+ /**
227
+ * Process a sync-apply batch: validate the envelope, then apply items FIFO
228
+ * (strictly in order, awaiting each — items may depend on earlier items in
229
+ * the same batch). Always resolves; item-level failures surface as `rejected`
230
+ * results and only envelope-level problems produce a 400.
231
+ */
232
+ export declare function processSyncApplyBatch(body: unknown, host: SyncApplyHost): Promise<SyncApplyOutcome>;
233
+ export {};
234
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/sync/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAIH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,4BAA6B,CAAC;AAEpE,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAC+B,CAAC;AAEpE,2DAA2D;AAC3D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAIzD,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAElE,qDAAqD;AACrD,MAAM,MAAM,wBAAwB,GAChC,cAAc,GACd,YAAY,GACZ,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,WAAW,GACX,WAAW,GACX,aAAa,GACb,cAAc,CAAC;AAEnB,qDAAqD;AACrD,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAExE,MAAM,MAAM,eAAe,GACvB,wBAAwB,GACxB,uBAAuB,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,WAAW,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2CAA2C;AAC3C,MAAM,WAAW,qBAAqB;IACp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