@happyvertical/smrt-core 0.40.49 → 0.40.50

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 (80) hide show
  1. package/agents/generators.md +32 -0
  2. package/dist/generators/cli.d.ts +11 -3
  3. package/dist/generators/cli.d.ts.map +1 -1
  4. package/dist/generators/cli.js +54 -11
  5. package/dist/generators/cli.js.map +1 -1
  6. package/dist/generators/custom-action.d.ts +68 -0
  7. package/dist/generators/custom-action.d.ts.map +1 -0
  8. package/dist/generators/custom-action.js +128 -0
  9. package/dist/generators/custom-action.js.map +1 -0
  10. package/dist/generators/index.d.ts +1 -0
  11. package/dist/generators/index.d.ts.map +1 -1
  12. package/dist/generators/index.js +2 -1
  13. package/dist/generators/mcp-runtime-template.d.ts +11 -0
  14. package/dist/generators/mcp-runtime-template.d.ts.map +1 -1
  15. package/dist/generators/mcp-runtime-template.js +40 -12
  16. package/dist/generators/mcp-runtime-template.js.map +1 -1
  17. package/dist/generators/mcp.d.ts +6 -0
  18. package/dist/generators/mcp.d.ts.map +1 -1
  19. package/dist/generators/mcp.js +157 -67
  20. package/dist/generators/mcp.js.map +1 -1
  21. package/dist/generators/tool-schema.d.ts +3 -1
  22. package/dist/generators/tool-schema.d.ts.map +1 -1
  23. package/dist/generators/tool-schema.js +8 -17
  24. package/dist/generators/tool-schema.js.map +1 -1
  25. package/dist/generators.js +2 -1
  26. package/dist/index.js +2 -1
  27. package/dist/manifest/static-manifest.js +2 -2
  28. package/dist/manifest/static-manifest.js.map +1 -1
  29. package/dist/manifest/store.js +1 -1
  30. package/dist/manifest/test-manifest-stub.d.ts.map +1 -1
  31. package/dist/manifest/test-manifest-stub.js +405 -581
  32. package/dist/manifest/test-manifest-stub.js.map +1 -1
  33. package/dist/manifest.json +2 -2
  34. package/dist/scanner/manifest-generator.d.ts.map +1 -1
  35. package/dist/scanner/manifest-generator.js +10 -4
  36. package/dist/scanner/manifest-generator.js.map +1 -1
  37. package/dist/smrt-knowledge.json +6 -7
  38. package/dist/vite-plugin/api-client-entries.d.ts.map +1 -1
  39. package/dist/vite-plugin/api-client-entries.js +6 -7
  40. package/dist/vite-plugin/api-client-entries.js.map +1 -1
  41. package/dist/vite-plugin/index.d.ts +1 -1
  42. package/dist/vite-plugin/index.d.ts.map +1 -1
  43. package/dist/vite-plugin/index.js +2 -2
  44. package/dist/vite-plugin/index.js.map +1 -1
  45. package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
  46. package/dist/vite-plugin/sveltekit-generator.js +29 -5
  47. package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
  48. package/dist/vite-plugin/web-collections.d.ts.map +1 -1
  49. package/dist/vite-plugin/web-collections.js +7 -1
  50. package/dist/vite-plugin/web-collections.js.map +1 -1
  51. package/dist/vite-plugin.js +2 -2
  52. package/package.json +4 -5
  53. package/dist/__tests__/fixtures/advisor-test-classes.d.ts +0 -37
  54. package/dist/__tests__/fixtures/advisor-test-classes.d.ts.map +0 -1
  55. package/dist/mcp-advisor/index.d.ts +0 -499
  56. package/dist/mcp-advisor/index.d.ts.map +0 -1
  57. package/dist/mcp-advisor/tools/add-ai-methods.d.ts +0 -6
  58. package/dist/mcp-advisor/tools/add-ai-methods.d.ts.map +0 -1
  59. package/dist/mcp-advisor/tools/configure-decorators.d.ts +0 -6
  60. package/dist/mcp-advisor/tools/configure-decorators.d.ts.map +0 -1
  61. package/dist/mcp-advisor/tools/generate-collection.d.ts +0 -6
  62. package/dist/mcp-advisor/tools/generate-collection.d.ts.map +0 -1
  63. package/dist/mcp-advisor/tools/generate-field-definitions.d.ts +0 -6
  64. package/dist/mcp-advisor/tools/generate-field-definitions.d.ts.map +0 -1
  65. package/dist/mcp-advisor/tools/generate-smrt-class.d.ts +0 -6
  66. package/dist/mcp-advisor/tools/generate-smrt-class.d.ts.map +0 -1
  67. package/dist/mcp-advisor/tools/get-object-config.d.ts +0 -6
  68. package/dist/mcp-advisor/tools/get-object-config.d.ts.map +0 -1
  69. package/dist/mcp-advisor/tools/get-object-schema.d.ts +0 -10
  70. package/dist/mcp-advisor/tools/get-object-schema.d.ts.map +0 -1
  71. package/dist/mcp-advisor/tools/list-registered-objects.d.ts +0 -9
  72. package/dist/mcp-advisor/tools/list-registered-objects.d.ts.map +0 -1
  73. package/dist/mcp-advisor/tools/preview-api-endpoints.d.ts +0 -10
  74. package/dist/mcp-advisor/tools/preview-api-endpoints.d.ts.map +0 -1
  75. package/dist/mcp-advisor/tools/preview-mcp-tools.d.ts +0 -9
  76. package/dist/mcp-advisor/tools/preview-mcp-tools.d.ts.map +0 -1
  77. package/dist/mcp-advisor/tools/validate-smrt-object.d.ts +0 -6
  78. package/dist/mcp-advisor/tools/validate-smrt-object.d.ts.map +0 -1
  79. package/dist/mcp-advisor/types.d.ts +0 -213
  80. package/dist/mcp-advisor/types.d.ts.map +0 -1
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-08-03T22:36:37.821Z",
3
+ "generatedAt": "2026-08-04T02:20:27.930Z",
4
4
  "packageName": "@happyvertical/smrt-core",
5
- "packageVersion": "0.40.49",
5
+ "packageVersion": "0.40.50",
6
6
  "sourceManifestPath": "dist/manifest.json",
7
7
  "agentDocPath": "AGENTS.md",
8
8
  "sourceHashes": {
9
- "manifest": "ee070130eab70318b21dbaf088397d44c7483cdc31ec62d0a0a809823f4db690",
10
- "packageJson": "c798dca6bbcd42953c36cba0d0b781f62c968c75ecaa46f14bb40b3885400ce9",
9
+ "manifest": "e6ed1552eeeb106949d92a0a37356a22987264f66614468e7910afe249eece1c",
10
+ "packageJson": "c2058c0a6cff38b271cbe6ae0238e778c2c3fa04c7ad1afe306f4f912a5fac3a",
11
11
  "agents": "ab30f2e4beb8d45e210d596794be5e7d93c99c21a517876f09d08d9a3b5f13df",
12
12
  "moduleDoc:agents/change-feed.md": "5278797d6c049ea21071b011182a9fcd79d17f9d74e0f90a93caa4c05c25294f",
13
13
  "moduleDoc:agents/change-signals.md": "d9cb6a5541728ffea46607a6b1d4fa61d4621849f2b4ea86a0645fbb0af892e9",
14
- "moduleDoc:agents/generators.md": "71785704ac1150487bafd7b3c86ba9671516157cfa012af909f42779b2594eea"
14
+ "moduleDoc:agents/generators.md": "4bbf54393089b8931db7a02b28328aa442ae42a78d98c735dd089050d1a407ab"
15
15
  },
16
16
  "exports": [
17
17
  ".",
@@ -52,7 +52,6 @@
52
52
  "@happyvertical/smrt-types": "workspace:*",
53
53
  "@happyvertical/sql": "catalog:",
54
54
  "@happyvertical/utils": "catalog:",
55
- "@modelcontextprotocol/sdk": "^1.25.2",
56
55
  "@oxc-project/runtime": "^0.138.0",
57
56
  "cheerio": "^1.2.0",
58
57
  "fast-glob": "3.3.3",
@@ -343,7 +342,7 @@
343
342
  {
344
343
  "path": "agents/generators.md",
345
344
  "module": "generators",
346
- "content": "# smrt-core/code generators\n\nModule semantics for `src/generators/` + `src/vite-plugin/`. Package orientation, the cross-module\ninvariants, and the traps that apply before editing anything live in\n[../AGENTS.md](../AGENTS.md) — read that first.\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| Web collections | `src/vite-plugin/web-collections.ts` (selectors) + `generateWebModule` | `@happyvertical/smrt-virt-web` — one typed collection definition per API-exposed REST collection (#1761), consumed by `@happyvertical/smrt-web` |\n\nGenerated API clients share `selectApiClientEntries()` across the runtime Vite\nmodule, its ambient declaration, and physical prebuild declarations. When a\ncollection class and its populated model share an endpoint, the model owns the\ncanonical collection key and row payload schema; the collection class remains\navailable under a deterministic class-derived secondary key. Selection and\ncollision suffixes must not depend on manifest insertion order (#2027).\nFor aggregated manifests, inheritance and item-type references resolve exact\nqualified names first, then package-local simple names, then a stable identity\nfallback so duplicate class names across packages cannot reintroduce ordering.\n\nThe web module also emits a build-time **`manifestHash`** constant (#1764): `computeWebManifestHash(manifest)` is a deterministic, replica-stable digest of the emitted web-collection SHAPE (name/className/endpoint/idField/actions/fields/relationships), canonicalized (recursive key sort) before `sha256 → base64url`, truncated to 16 chars — so the same schema always hashes the same, and a field add/remove/type-change/edge-change changes it. A change means old persisted client rows may mis-hydrate, so smrt-web keys its durable persistence namespace on it and its `updateAvailable` contract signal compares against it. Four co-managed emission sites must not drift: the runtime value (`generateWebModule`), the `@happyvertical/smrt-virt-web` ambient d.ts (`vite-plugin/index.ts`), the physical `@smrt/web` d.ts (`prebuild/index.ts`), and the hand-written type mirror in `@happyvertical/smrt-web` (`packages/smrt-web/src/index.ts` — dependency-free, so textual sync only).\n\nPer-field web emission (#2046): `buildWebFieldDefinitions` carries `description` (from `@field({ description })`) and sanitized `ui` hints (from `@field({ ui: { basic, group, order, locked } })`, read off the manifest `_meta.ui` bag through per-key type guards) into each emitted field definition, and `buildWebToolDescriptors` threads the same `description` into browser MCP tool schemas. `sensitive`/`transient` fields are excluded from emission entirely, so their descriptions never ship. Both keys are conditional, so hint-less schemas emit byte-identical definitions (and hashes) as before; adding a description/ui hint changes the manifest hash — deliberate over-invalidation, harmless per the #1764 contract.\n\nGenerated reads (`list`/`get`) on the REST and SvelteKit generators support conditional GET (helpers in `src/generators/conditional-get.ts`). ETag v2 (#1765): the validator is the table's change-feed version (`getTableVersion`) keyed by the request representation, so a **concrete** `If-None-Match` short-circuits into a 304 with an empty body **before** the collection query runs — an unchanged table revalidates with zero table scan. A wildcard `If-None-Match: *` is deferred until the payload builds (existence confirmed), so a missing item still returns 404, not a false 304. Tenant-scoped reads fold the active tenant into the representation (`resolveTenantEtagDiscriminator`) so one tenant's cached validator never satisfies another's read of the same URL. Routes whose GET renders via a **custom serializer** (which can load related tables the base-table version can't observe) keep the v1 body-hash ETag (`#1757`, query-first but correct); the default `toPublicJSON` path — all REST reads and non-serializer SvelteKit reads — uses v2. v2 is weakly consistent by design (the cost of not reading the data): a revalidation in the sub-statement window between a committed write and its feed append can return a stale 304 that self-heals on the next revalidation. The other v2 window — a deploy that changes the response shape WITHOUT a table write — is closed by the **#1764 ETag salt**: `computeTableVersionEtag(version, representation, manifestHash?)` folds the build's web-collection shape digest into the digest, so a shape-only redeploy busts every read validator (`undefined` reproduces the pre-#1764 unsalted value byte-for-byte for direct helper callers). The generated SvelteKit route bakes the digest in as a `MANIFEST_HASH` constant (via `generateConditionalGetRouteHelper`'s `manifestHash` option, sourced from `computeWebManifestHash(manifest)`) — automatic for the SvelteKit transport. The runtime `APIGenerator` auto-populates the same salt from the runtime registry with `computeRuntimeWebManifestHash()` when `APIConfig.manifestHash` is omitted; explicit `APIConfig.manifestHash` still wins for custom setups. The digest scope is get-OR-list (`selectWebEtagSaltEntries`), so **get-only** routes are salted too. Strong consistency still requires the v1 body-hash path. Cache-Control policy (unchanged from #1757): `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"
345
+ "content": "# smrt-core/code generators\n\nModule semantics for `src/generators/` + `src/vite-plugin/`. Package orientation, the cross-module\ninvariants, and the traps that apply before editing anything live in\n[../AGENTS.md](../AGENTS.md) — read that first.\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| Web collections | `src/vite-plugin/web-collections.ts` (selectors) + `generateWebModule` | `@happyvertical/smrt-virt-web` — one typed collection definition per API-exposed REST collection (#1761), consumed by `@happyvertical/smrt-web` |\n\nGenerated API clients share `selectApiClientEntries()` across the runtime Vite\nmodule, its ambient declaration, and physical prebuild declarations. When a\ncollection class and its populated model share an endpoint, the model owns the\ncanonical collection key and row payload schema; the collection class remains\navailable under a deterministic class-derived secondary key. Selection and\ncollision suffixes must not depend on manifest insertion order (#2027).\nFor aggregated manifests, inheritance and item-type references resolve exact\nqualified names first, then package-local simple names, then a stable identity\nfallback so duplicate class names across packages cannot reintroduce ordering.\n\nThe web module also emits a build-time **`manifestHash`** constant (#1764): `computeWebManifestHash(manifest)` is a deterministic, replica-stable digest of the emitted web-collection SHAPE (name/className/endpoint/idField/actions/fields/relationships), canonicalized (recursive key sort) before `sha256 → base64url`, truncated to 16 chars — so the same schema always hashes the same, and a field add/remove/type-change/edge-change changes it. A change means old persisted client rows may mis-hydrate, so smrt-web keys its durable persistence namespace on it and its `updateAvailable` contract signal compares against it. Four co-managed emission sites must not drift: the runtime value (`generateWebModule`), the `@happyvertical/smrt-virt-web` ambient d.ts (`vite-plugin/index.ts`), the physical `@smrt/web` d.ts (`prebuild/index.ts`), and the hand-written type mirror in `@happyvertical/smrt-web` (`packages/smrt-web/src/index.ts` — dependency-free, so textual sync only).\n\nPer-field web emission (#2046): `buildWebFieldDefinitions` carries `description` (from `@field({ description })`) and sanitized `ui` hints (from `@field({ ui: { basic, group, order, locked } })`, read off the manifest `_meta.ui` bag through per-key type guards) into each emitted field definition, and `buildWebToolDescriptors` threads the same `description` into browser MCP tool schemas. `sensitive`/`transient` fields are excluded from emission entirely, so their descriptions never ship. Both keys are conditional, so hint-less schemas emit byte-identical definitions (and hashes) as before; adding a description/ui hint changes the manifest hash — deliberate over-invalidation, harmless per the #1764 contract.\n\n## Custom-action contract\n\n`resolveCustomActionMetadata()` is the common discovery and invocation contract\nfor generated REST routes and API clients, MCP, CLI, WebMCP, and simple\nREST-resource discovery. Receiver scope comes from the executable method, never a\nconfiguration-only `api.routes[name].scope` override: instance model methods\nare item-scoped and require `id`; static model methods and recognized\n`SmrtCollection` methods are collection-scoped and do not accept `id`. Route\nconfiguration may still choose its path and HTTP verb, but it cannot turn an\ninstance call into `ClassRef.action` or vice versa.\n\nWhen scanner method metadata exists, discovery projects each named parameter\nand its JSON-schema type, and invokers pass the values positionally in declared\norder. The legacy single `options` bag remains compatible when metadata is\nabsent (or the declared method takes `options`). Do not infer this from runtime\nfunction arity. An omitted typed `options` parameter remains `undefined`, so a\nmethod's JavaScript default initializer continues to apply; an explicit `null`\nremains `null`. Flat tool and CLI inputs reserve `id` for receiver parsing. If\nan action declares an `id` parameter, its flat MCP/WebMCP field is `actionId`\n(and CLI uses `--action-id`); REST keeps its independent path/body\nnamespaces. Typed CLI actions may use standard flag names such as `limit`,\n`offset`, `where`, and `format` without those values being stripped as CRUD\nflags.\n\nCustom actions may return an explicit, domain-neutral failure object with\n`ok: false`, `code`, and `message` plus optional `status`, `details`,\n`retryable`, and `correlationId`. `normalizeCustomActionFailure()` redacts it;\ngenerated REST returns `{ error: failure }` with the non-2xx status, while MCP\nreturns `isError: true` and `_meta['io.happyvertical/smrt']`. Opaque successful\nobjects (including `{ code, message }`) remain untouched; thrown exceptions are\nnot reclassified as domain failures.\n\nGenerated reads (`list`/`get`) on the REST and SvelteKit generators support conditional GET (helpers in `src/generators/conditional-get.ts`). ETag v2 (#1765): the validator is the table's change-feed version (`getTableVersion`) keyed by the request representation, so a **concrete** `If-None-Match` short-circuits into a 304 with an empty body **before** the collection query runs — an unchanged table revalidates with zero table scan. A wildcard `If-None-Match: *` is deferred until the payload builds (existence confirmed), so a missing item still returns 404, not a false 304. Tenant-scoped reads fold the active tenant into the representation (`resolveTenantEtagDiscriminator`) so one tenant's cached validator never satisfies another's read of the same URL. Routes whose GET renders via a **custom serializer** (which can load related tables the base-table version can't observe) keep the v1 body-hash ETag (`#1757`, query-first but correct); the default `toPublicJSON` path — all REST reads and non-serializer SvelteKit reads — uses v2. v2 is weakly consistent by design (the cost of not reading the data): a revalidation in the sub-statement window between a committed write and its feed append can return a stale 304 that self-heals on the next revalidation. The other v2 window — a deploy that changes the response shape WITHOUT a table write — is closed by the **#1764 ETag salt**: `computeTableVersionEtag(version, representation, manifestHash?)` folds the build's web-collection shape digest into the digest, so a shape-only redeploy busts every read validator (`undefined` reproduces the pre-#1764 unsalted value byte-for-byte for direct helper callers). The generated SvelteKit route bakes the digest in as a `MANIFEST_HASH` constant (via `generateConditionalGetRouteHelper`'s `manifestHash` option, sourced from `computeWebManifestHash(manifest)`) — automatic for the SvelteKit transport. The runtime `APIGenerator` auto-populates the same salt from the runtime registry with `computeRuntimeWebManifestHash()` when `APIConfig.manifestHash` is omitted; explicit `APIConfig.manifestHash` still wins for custom setups. The digest scope is get-OR-list (`selectWebEtagSaltEntries`), so **get-only** routes are salted too. Strong consistency still requires the v1 body-hash path. Cache-Control policy (unchanged from #1757): `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"
347
346
  }
348
347
  ]
349
348
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api-client-entries.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/api-client-entries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAQ7B,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,GAAG,EAAE,qBAAqB,CAAC;IAC3B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;I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B,CAAC;IAC3B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,sEAAsE;IACtE,aAAa,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;QAC7B,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,UAAU,EAAE,KAAK,CAAC;YAChB,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ;AAED,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,mBAAmB,EAAE,EAClC,iBAAiB,GAAE,MAAM,EAAO,GAC/B,MAAM,GAAG,SAAS,CAepB;AAED,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,EAC/C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAChC,MAAM,CAyCR;AA8SD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,mBAAmB,GAC5B,cAAc,EAAE,CAwElB"}
@@ -19,11 +19,12 @@ function renderApiClientCustomMethodParameters(method, mapType) {
19
19
  optionsType = requiredPathProperties ? `${directOptionsType} & { ${requiredPathProperties} }` : directOptionsType;
20
20
  } else {
21
21
  const parameterNames = new Set(params.map((param) => param.name));
22
- const properties = params.map((param) => `${param.name}${pathParamNames.has(param.name) ? "" : "?"}: ${mapType(param.type)}`);
22
+ const properties = params.map((param) => `${param.name}${pathParamNames.has(param.name) || !param.optional ? "" : "?"}: ${mapType(param.type)}`);
23
23
  for (const pathParamName of method.pathParamNames) if (!parameterNames.has(pathParamName)) properties.push(`${pathParamName}: string`);
24
24
  optionsType = properties.length > 0 ? `{ ${properties.join("; ")} }` : "Record<string, never>";
25
25
  }
26
- const optionsParameter = `${method.pathParamNames.length > 0 ? "options" : "options?"}: ${optionsType}`;
26
+ const hasRequiredOptions = hasSingleOptionsParameter ? !params[0]?.optional : params.some((param) => !pathParamNames.has(param.name) && !param.optional);
27
+ const optionsParameter = `${method.pathParamNames.length > 0 || hasRequiredOptions ? "options" : "options?"}: ${optionsType}`;
27
28
  return method.scope === "collection" ? optionsParameter : `id: string, ${optionsParameter}`;
28
29
  }
29
30
  function compareText(left, right) {
@@ -77,13 +78,11 @@ function resolveGeneratedClientCustomMethods(obj, manifest) {
77
78
  if (STANDARD_API_ACTION_SET.has(name) || !method.isPublic) return [];
78
79
  if (included && !included.includes(name)) return [];
79
80
  if (excluded?.includes(name)) return [];
80
- const scope = config?.routes?.[name]?.scope ?? (isCollection || method.isStatic ? "collection" : "item");
81
- if (isCollection && scope !== "collection") return [];
82
- if (!isCollection && scope === "collection" && !method.isStatic) return [];
81
+ const routeConfig = resolveApiActionRouteConfig(name, method, apiConfig, {}, isCollection ? "collection" : method.isStatic ? "collection" : "item");
83
82
  return [{
84
83
  name,
85
- scope,
86
- pathParamNames: resolveApiActionRouteConfig(name, method, apiConfig, {}, isCollection ? "collection" : method.isStatic ? "collection" : "item").pathParamNames,
84
+ scope: routeConfig.scope,
85
+ pathParamNames: routeConfig.pathParamNames,
87
86
  parameters: method.parameters ?? []
88
87
  }];
89
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"api-client-entries.js","names":[],"sources":["../../src/vite-plugin/api-client-entries.ts"],"sourcesContent":["/**\n * Manifest -> generated API-client entry selection.\n *\n * Runtime client values, Vite ambient declarations, and physical prebuild\n * declarations must agree on which manifest object owns a collection's\n * canonical endpoint. Collection classes describe access methods, not row\n * payloads, so a populated model always wins the shared collection key.\n */\n\nimport type {\n SmartObjectDefinition,\n SmartObjectManifest,\n} from '../scanner/types.js';\nimport { resolveApiActionRouteConfig } from './sveltekit-generator.js';\nimport {\n findManifestObjectByName,\n isCollectionManifestClass,\n resolveCollectionItemObject,\n} from './web-collections.js';\n\nexport type ApiClientCrudMethod =\n | 'list'\n | 'get'\n | 'create'\n | 'update'\n | 'delete'\n | 'search';\n\nexport interface ApiClientEntry {\n /** Original key in manifest.objects. */\n objectName: string;\n /** Object whose routes and custom methods this client entry exposes. */\n obj: SmartObjectDefinition;\n /** Canonical collection key or deterministic class-derived secondary key. */\n clientKey: string;\n /** Row-payload interface used by CRUD methods for this entry. */\n dataInterfaceName: string;\n /** Standard client operations whose server routes are actually emitted. */\n crudMethods: ApiClientCrudMethod[];\n /** Custom methods whose routes are actually emitted by the server. */\n customMethods: Array<{\n name: string;\n scope: 'item' | 'collection';\n pathParamNames: string[];\n parameters: Array<{\n name: string;\n type: string;\n optional?: boolean;\n default?: unknown;\n }>;\n }>;\n}\n\nexport function renderApiClientCrudType(\n dataInterfaceName: string,\n crudMethods: ApiClientCrudMethod[],\n overriddenMethods: string[] = [],\n): string | undefined {\n const overridden = new Set(overriddenMethods);\n const methods = crudMethods.filter((method) => !overridden.has(method));\n if (methods.length === 0) return undefined;\n if (\n methods.length === 6 &&\n methods.every(\n (method, index) => method === [...STANDARD_API_ACTIONS, 'search'][index],\n )\n ) {\n return `CrudOperations<${dataInterfaceName}>`;\n }\n return `Pick<CrudOperations<${dataInterfaceName}>, ${methods\n .map((method) => JSON.stringify(method))\n .join(' | ')}>`;\n}\n\nexport function renderApiClientCustomMethodParameters(\n method: ApiClientEntry['customMethods'][number],\n mapType: (type: string) => string,\n): string {\n const pathParamNames = new Set(method.pathParamNames);\n const params = method.parameters;\n const hasSingleOptionsParameter =\n params.length === 1 && params[0]?.name === 'options';\n const requiredPathProperties = method.pathParamNames\n .map((name) => `${name}: string`)\n .join('; ');\n let optionsType: string;\n\n if (hasSingleOptionsParameter) {\n const directOptionsType = mapType(params[0].type);\n optionsType = requiredPathProperties\n ? `${directOptionsType} & { ${requiredPathProperties} }`\n : directOptionsType;\n } else {\n const parameterNames = new Set(params.map((param) => param.name));\n const properties = params.map(\n (param) =>\n `${param.name}${pathParamNames.has(param.name) ? '' : '?'}: ${mapType(param.type)}`,\n );\n for (const pathParamName of method.pathParamNames) {\n if (!parameterNames.has(pathParamName)) {\n properties.push(`${pathParamName}: string`);\n }\n }\n optionsType =\n properties.length > 0\n ? `{ ${properties.join('; ')} }`\n : 'Record<string, never>';\n }\n\n const optionsParameter = `${method.pathParamNames.length > 0 ? 'options' : 'options?'}: ${optionsType}`;\n return method.scope === 'collection'\n ? optionsParameter\n : `id: string, ${optionsParameter}`;\n}\n\ninterface ManifestCandidate {\n objectName: string;\n obj: SmartObjectDefinition;\n}\n\nfunction compareText(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nfunction candidateIdentity(candidate: ManifestCandidate): string {\n return [\n candidate.obj.qualifiedName ?? '',\n candidate.obj.className,\n candidate.objectName,\n ].join('\\0');\n}\n\nfunction compareCandidateIdentity(\n left: ManifestCandidate,\n right: ManifestCandidate,\n): number {\n return compareText(candidateIdentity(left), candidateIdentity(right));\n}\n\nfunction lowerFirst(value: string): string {\n return value ? value[0].toLowerCase() + value.slice(1) : value;\n}\n\nfunction isAncestorOf(\n manifest: SmartObjectManifest,\n ancestor: SmartObjectDefinition,\n descendant: SmartObjectDefinition,\n): boolean {\n const seen = new Set<string>();\n let child = descendant;\n let parentName = child.extendsQualified || child.extends;\n\n while (parentName && !seen.has(parentName)) {\n seen.add(parentName);\n const parent = findManifestObjectByName(manifest, parentName, child);\n if (!parent) return false;\n if (parent === ancestor) return true;\n child = parent;\n parentName = parent.extendsQualified || parent.extends;\n }\n\n return false;\n}\n\nconst STANDARD_API_ACTIONS = [\n 'list',\n 'get',\n 'create',\n 'update',\n 'delete',\n] as const;\nconst STANDARD_API_ACTION_SET = new Set<string>(STANDARD_API_ACTIONS);\n\nfunction resolveGeneratedClientCustomMethods(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): ApiClientEntry['customMethods'] {\n const apiConfig = obj.decoratorConfig?.api;\n if (apiConfig === false) return [];\n\n const config =\n typeof apiConfig === 'object' && apiConfig !== null ? apiConfig : undefined;\n const included = Array.isArray(config?.include) ? config.include : undefined;\n const excluded = Array.isArray(config?.exclude) ? config.exclude : undefined;\n const isCollection = isCollectionManifestClass(manifest, obj);\n\n return Object.entries(obj.methods ?? {}).flatMap(([name, method]) => {\n if (STANDARD_API_ACTION_SET.has(name) || !method.isPublic) return [];\n if (included && !included.includes(name)) return [];\n if (excluded?.includes(name)) return [];\n\n const scope =\n config?.routes?.[name]?.scope ??\n (isCollection || method.isStatic ? 'collection' : 'item');\n if (isCollection && scope !== 'collection') return [];\n if (!isCollection && scope === 'collection' && !method.isStatic) return [];\n\n const routeConfig = resolveApiActionRouteConfig(\n name,\n method,\n apiConfig,\n {},\n isCollection ? 'collection' : method.isStatic ? 'collection' : 'item',\n );\n\n return [\n {\n name,\n scope,\n pathParamNames: routeConfig.pathParamNames,\n parameters: method.parameters ?? [],\n },\n ];\n });\n}\n\nfunction resolveCrudObject(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): SmartObjectDefinition | undefined {\n if (!isCollectionManifestClass(manifest, obj)) return obj;\n\n const itemObject = resolveCollectionItemObject(manifest, obj);\n if (itemObject) return itemObject;\n\n // A non-conventional collection can still share an endpoint with a model.\n return Object.values(manifest.objects)\n .filter(\n (candidate) =>\n candidate.collection === obj.collection &&\n !isCollectionManifestClass(manifest, candidate),\n )\n .sort((left, right) =>\n compareText(\n left.qualifiedName ?? left.className,\n right.qualifiedName ?? right.className,\n ),\n )[0];\n}\n\nfunction resolveGeneratedClientCrudMethods(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): ApiClientCrudMethod[] {\n const crudObject = resolveCrudObject(obj, manifest);\n const apiConfig = crudObject?.decoratorConfig?.api;\n if (!crudObject || apiConfig === false) return [];\n\n if (apiConfig === true || apiConfig === undefined) {\n return [...STANDARD_API_ACTIONS, 'search'];\n }\n if (typeof apiConfig !== 'object' || apiConfig === null) {\n return [...STANDARD_API_ACTIONS, 'search'];\n }\n\n const included = Array.isArray(apiConfig.include)\n ? apiConfig.include\n : undefined;\n const excluded = Array.isArray(apiConfig.exclude) ? apiConfig.exclude : [];\n const standardMethods = (\n included\n ? STANDARD_API_ACTIONS.filter((action) => included.includes(action))\n : [...STANDARD_API_ACTIONS]\n ).filter((action) => !excluded.includes(action));\n\n // Preserve the historical search convenience only for an unbounded API\n // config. Explicit include lists are fail-closed; a real custom search\n // method is carried separately by resolveGeneratedClientCustomMethods().\n const includeSearch = !included && !excluded.includes('search');\n return includeSearch ? [...standardMethods, 'search'] : standardMethods;\n}\n\n/**\n * Resolve the CRUD surface that the generated route files actually expose for\n * one shared collection endpoint.\n *\n * Route generation processes manifest objects in insertion order. Collection\n * and item handlers live in separate files, and the last model that emits each\n * file replaces the earlier file. Mirror that behavior here so every client\n * alias for a shared endpoint has the same, real action set.\n */\nfunction resolveGeneratedEndpointCrudMethods(\n collection: string,\n manifest: SmartObjectManifest,\n): ApiClientCrudMethod[] {\n let collectionMethods: ApiClientCrudMethod[] = [];\n let itemMethods: ApiClientCrudMethod[] = [];\n\n for (const obj of Object.values(manifest.objects)) {\n if (\n obj.collection !== collection ||\n isCollectionManifestClass(manifest, obj)\n ) {\n continue;\n }\n\n const methods = resolveGeneratedClientCrudMethods(obj, manifest);\n const emittedCollectionMethods = methods.filter((method) =>\n ['list', 'create', 'search'].includes(method),\n );\n const emittedItemMethods = methods.filter((method) =>\n ['get', 'update', 'delete'].includes(method),\n );\n\n // generateRoutesForObject only writes a route file when that file has at\n // least one standard handler. A custom-only object leaves an earlier CRUD\n // file intact rather than replacing it with an empty file.\n if (\n emittedCollectionMethods.some(\n (method) => method === 'list' || method === 'create',\n )\n ) {\n collectionMethods = emittedCollectionMethods;\n }\n if (emittedItemMethods.length > 0) {\n itemMethods = emittedItemMethods;\n }\n }\n\n const emitted = new Set([...collectionMethods, ...itemMethods]);\n const orderedMethods: ApiClientCrudMethod[] = [\n ...STANDARD_API_ACTIONS,\n 'search',\n ];\n return orderedMethods.filter((method) => emitted.has(method));\n}\n\nfunction exposesApiClientSurface(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): boolean {\n if (obj.decoratorConfig?.api === false) return false;\n if (resolveGeneratedClientCrudMethods(obj, manifest).length > 0) return true;\n\n // A disabled item has no CRUD routes. Keep its companion collection only\n // when the collection itself contributes a custom route that the SvelteKit\n // generator will actually emit.\n return resolveGeneratedClientCustomMethods(obj, manifest).length > 0;\n}\n\nfunction resolveDataInterfaceName(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): string {\n if (!isCollectionManifestClass(manifest, obj)) {\n return `${obj.className}Data`;\n }\n\n const itemObject = resolveCollectionItemObject(manifest, obj);\n return `${itemObject?.className || obj.className}Data`;\n}\n\nfunction sharedCollectionModelDepth(\n manifest: SmartObjectManifest,\n obj: SmartObjectDefinition,\n): number {\n const seen = new Set<string>();\n let depth = 0;\n let child = obj;\n let parentName = child.extendsQualified || child.extends;\n\n while (parentName && !seen.has(parentName)) {\n seen.add(parentName);\n const parent = findManifestObjectByName(manifest, parentName, child);\n if (!parent || parent.collection !== obj.collection) break;\n depth += 1;\n child = parent;\n parentName = parent.extendsQualified || parent.extends;\n }\n\n return depth;\n}\n\n/**\n * Select the owner of one canonical collection endpoint with a transitive rank.\n *\n * Models beat collection classes because CRUD payloads are rows. Among models,\n * shallower same-collection ancestry wins, then a root with more descendants\n * wins (the STI base over an unrelated endpoint collision), then qualified\n * identity resolves any remaining ambiguity. Numeric/lexical tuple ranks stay\n * transitive, unlike pairwise ancestry overrides inside Array.sort().\n */\nfunction selectCanonicalOwner(\n manifest: SmartObjectManifest,\n group: ManifestCandidate[],\n): ManifestCandidate | undefined {\n const models = group.filter(\n (candidate) => !isCollectionManifestClass(manifest, candidate.obj),\n );\n\n if (models.length > 0) {\n return [...models]\n .map((candidate) => ({\n candidate,\n depth: sharedCollectionModelDepth(manifest, candidate.obj),\n descendantCount: models.filter(\n (other) =>\n other !== candidate &&\n isAncestorOf(manifest, candidate.obj, other.obj),\n ).length,\n }))\n .sort(\n (left, right) =>\n left.depth - right.depth ||\n right.descendantCount - left.descendantCount ||\n compareCandidateIdentity(left.candidate, right.candidate),\n )[0]?.candidate;\n }\n\n return [...group].sort((left, right) => {\n const leftHasItem = resolveCollectionItemObject(manifest, left.obj);\n const rightHasItem = resolveCollectionItemObject(manifest, right.obj);\n if (Boolean(leftHasItem) !== Boolean(rightHasItem)) {\n return leftHasItem ? -1 : 1;\n }\n return compareCandidateIdentity(left, right);\n })[0];\n}\n\n/**\n * Select every generated client entry with deterministic endpoint keys and row\n * payload types. Exactly one entry owns each canonical collection key; other\n * API objects remain available under stable class-derived secondary keys.\n */\nexport function selectApiClientEntries(\n manifest: SmartObjectManifest,\n): ApiClientEntry[] {\n const candidates = Object.entries(manifest.objects)\n .filter(([, obj]) => exposesApiClientSurface(obj, manifest))\n .map(([objectName, obj]): ManifestCandidate => ({ objectName, obj }));\n const candidatesByCollection = new Map<string, ManifestCandidate[]>();\n\n for (const candidate of candidates) {\n const group = candidatesByCollection.get(candidate.obj.collection) ?? [];\n group.push(candidate);\n candidatesByCollection.set(candidate.obj.collection, group);\n }\n\n const canonicalOwners = new Map<string, ManifestCandidate>();\n for (const [collection, group] of candidatesByCollection) {\n const canonicalOwner = selectCanonicalOwner(manifest, group);\n if (canonicalOwner) canonicalOwners.set(collection, canonicalOwner);\n }\n\n // Canonical owners are emitted first within each collection. Sorting all\n // remaining candidates by identity makes numeric suffixes stable too.\n const orderedCandidates = [...candidates].sort((left, right) => {\n const collectionOrder = compareText(\n left.obj.collection,\n right.obj.collection,\n );\n if (collectionOrder !== 0) return collectionOrder;\n\n const leftIsCanonical = canonicalOwners.get(left.obj.collection) === left;\n const rightIsCanonical =\n canonicalOwners.get(right.obj.collection) === right;\n if (leftIsCanonical !== rightIsCanonical) {\n return leftIsCanonical ? -1 : 1;\n }\n\n return compareCandidateIdentity(left, right);\n });\n\n // A secondary key must never shadow any canonical endpoint, including a\n // later collection whose canonical owner has not been emitted yet.\n const reservedCanonicalKeys = new Set(canonicalOwners.keys());\n const usedKeys = new Set<string>();\n\n return orderedCandidates.map(({ objectName, obj }) => {\n const isCanonicalOwner =\n canonicalOwners.get(obj.collection)?.objectName === objectName;\n let clientKey = isCanonicalOwner\n ? obj.collection\n : lowerFirst(obj.className);\n const baseClientKey = clientKey;\n let suffix = 2;\n\n while (\n usedKeys.has(clientKey) ||\n (!isCanonicalOwner && reservedCanonicalKeys.has(clientKey))\n ) {\n clientKey = `${baseClientKey}${suffix}`;\n suffix += 1;\n }\n\n usedKeys.add(clientKey);\n return {\n objectName,\n obj,\n clientKey,\n dataInterfaceName: resolveDataInterfaceName(obj, manifest),\n crudMethods: resolveGeneratedEndpointCrudMethods(\n obj.collection,\n manifest,\n ),\n customMethods: resolveGeneratedClientCustomMethods(obj, manifest),\n };\n });\n}\n"],"mappings":";;;AAqDA,SAAgB,wBACd,mBACA,aACA,oBAA8B,CAAC,GACX;CACpB,MAAM,aAAa,IAAI,IAAI,iBAAiB;CAC5C,MAAM,UAAU,YAAY,QAAQ,WAAW,CAAC,WAAW,IAAI,MAAM,CAAC;CACtE,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;CACjC,IACE,QAAQ,WAAW,KACnB,QAAQ,OACL,QAAQ,UAAU,WAAW,CAAC,GAAG,sBAAsB,QAAQ,CAAC,CAAC,MACpE,GAEA,OAAO,kBAAkB,kBAAkB;CAE7C,OAAO,uBAAuB,kBAAkB,KAAK,QAClD,KAAK,WAAW,KAAK,UAAU,MAAM,CAAC,CAAC,CACvC,KAAK,KAAK,EAAE;AACjB;AAEA,SAAgB,sCACd,QACA,SACQ;CACR,MAAM,iBAAiB,IAAI,IAAI,OAAO,cAAc;CACpD,MAAM,SAAS,O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Q;GACzD,aAAa,oCACX,IAAI,YACJ,QACF;GACA,eAAe,oCAAoC,KAAK,QAAQ;EAClE;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"api-client-entries.js","names":[],"sources":["../../src/vite-plugin/api-client-entries.ts"],"sourcesContent":["/**\n * Manifest -> generated API-client entry selection.\n *\n * Runtime client values, Vite ambient declarations, and physical prebuild\n * declarations must agree on which manifest object owns a collection's\n * canonical endpoint. Collection classes describe access methods, not row\n * payloads, so a populated model always wins the shared collection key.\n */\n\nimport type {\n SmartObjectDefinition,\n SmartObjectManifest,\n} from '../scanner/types.js';\nimport { resolveApiActionRouteConfig } from './sveltekit-generator.js';\nimport {\n findManifestObjectByName,\n isCollectionManifestClass,\n resolveCollectionItemObject,\n} from './web-collections.js';\n\nexport type ApiClientCrudMethod =\n | 'list'\n | 'get'\n | 'create'\n | 'update'\n | 'delete'\n | 'search';\n\nexport interface ApiClientEntry {\n /** Original key in manifest.objects. */\n objectName: string;\n /** Object whose routes and custom methods this client entry exposes. */\n obj: SmartObjectDefinition;\n /** Canonical collection key or deterministic class-derived secondary key. */\n clientKey: string;\n /** Row-payload interface used by CRUD methods for this entry. */\n dataInterfaceName: string;\n /** Standard client operations whose server routes are actually emitted. */\n crudMethods: ApiClientCrudMethod[];\n /** Custom methods whose routes are actually emitted by the server. */\n customMethods: Array<{\n name: string;\n scope: 'item' | 'collection';\n pathParamNames: string[];\n parameters: Array<{\n name: string;\n type: string;\n optional?: boolean;\n default?: unknown;\n }>;\n }>;\n}\n\nexport function renderApiClientCrudType(\n dataInterfaceName: string,\n crudMethods: ApiClientCrudMethod[],\n overriddenMethods: string[] = [],\n): string | undefined {\n const overridden = new Set(overriddenMethods);\n const methods = crudMethods.filter((method) => !overridden.has(method));\n if (methods.length === 0) return undefined;\n if (\n methods.length === 6 &&\n methods.every(\n (method, index) => method === [...STANDARD_API_ACTIONS, 'search'][index],\n )\n ) {\n return `CrudOperations<${dataInterfaceName}>`;\n }\n return `Pick<CrudOperations<${dataInterfaceName}>, ${methods\n .map((method) => JSON.stringify(method))\n .join(' | ')}>`;\n}\n\nexport function renderApiClientCustomMethodParameters(\n method: ApiClientEntry['customMethods'][number],\n mapType: (type: string) => string,\n): string {\n const pathParamNames = new Set(method.pathParamNames);\n const params = method.parameters;\n const hasSingleOptionsParameter =\n params.length === 1 && params[0]?.name === 'options';\n const requiredPathProperties = method.pathParamNames\n .map((name) => `${name}: string`)\n .join('; ');\n let optionsType: string;\n\n if (hasSingleOptionsParameter) {\n const directOptionsType = mapType(params[0].type);\n optionsType = requiredPathProperties\n ? `${directOptionsType} & { ${requiredPathProperties} }`\n : directOptionsType;\n } else {\n const parameterNames = new Set(params.map((param) => param.name));\n const properties = params.map(\n (param) =>\n `${param.name}${pathParamNames.has(param.name) || !param.optional ? '' : '?'}: ${mapType(param.type)}`,\n );\n for (const pathParamName of method.pathParamNames) {\n if (!parameterNames.has(pathParamName)) {\n properties.push(`${pathParamName}: string`);\n }\n }\n optionsType =\n properties.length > 0\n ? `{ ${properties.join('; ')} }`\n : 'Record<string, never>';\n }\n\n const hasRequiredOptions = hasSingleOptionsParameter\n ? !params[0]?.optional\n : params.some(\n (param) => !pathParamNames.has(param.name) && !param.optional,\n );\n const optionsParameter = `${method.pathParamNames.length > 0 || hasRequiredOptions ? 'options' : 'options?'}: ${optionsType}`;\n return method.scope === 'collection'\n ? optionsParameter\n : `id: string, ${optionsParameter}`;\n}\n\ninterface ManifestCandidate {\n objectName: string;\n obj: SmartObjectDefinition;\n}\n\nfunction compareText(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nfunction candidateIdentity(candidate: ManifestCandidate): string {\n return [\n candidate.obj.qualifiedName ?? '',\n candidate.obj.className,\n candidate.objectName,\n ].join('\\0');\n}\n\nfunction compareCandidateIdentity(\n left: ManifestCandidate,\n right: ManifestCandidate,\n): number {\n return compareText(candidateIdentity(left), candidateIdentity(right));\n}\n\nfunction lowerFirst(value: string): string {\n return value ? value[0].toLowerCase() + value.slice(1) : value;\n}\n\nfunction isAncestorOf(\n manifest: SmartObjectManifest,\n ancestor: SmartObjectDefinition,\n descendant: SmartObjectDefinition,\n): boolean {\n const seen = new Set<string>();\n let child = descendant;\n let parentName = child.extendsQualified || child.extends;\n\n while (parentName && !seen.has(parentName)) {\n seen.add(parentName);\n const parent = findManifestObjectByName(manifest, parentName, child);\n if (!parent) return false;\n if (parent === ancestor) return true;\n child = parent;\n parentName = parent.extendsQualified || parent.extends;\n }\n\n return false;\n}\n\nconst STANDARD_API_ACTIONS = [\n 'list',\n 'get',\n 'create',\n 'update',\n 'delete',\n] as const;\nconst STANDARD_API_ACTION_SET = new Set<string>(STANDARD_API_ACTIONS);\n\nfunction resolveGeneratedClientCustomMethods(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): ApiClientEntry['customMethods'] {\n const apiConfig = obj.decoratorConfig?.api;\n if (apiConfig === false) return [];\n\n const config =\n typeof apiConfig === 'object' && apiConfig !== null ? apiConfig : undefined;\n const included = Array.isArray(config?.include) ? config.include : undefined;\n const excluded = Array.isArray(config?.exclude) ? config.exclude : undefined;\n const isCollection = isCollectionManifestClass(manifest, obj);\n\n return Object.entries(obj.methods ?? {}).flatMap(([name, method]) => {\n if (STANDARD_API_ACTION_SET.has(name) || !method.isPublic) return [];\n if (included && !included.includes(name)) return [];\n if (excluded?.includes(name)) return [];\n\n const routeConfig = resolveApiActionRouteConfig(\n name,\n method,\n apiConfig,\n {},\n isCollection ? 'collection' : method.isStatic ? 'collection' : 'item',\n );\n\n return [\n {\n name,\n scope: routeConfig.scope,\n pathParamNames: routeConfig.pathParamNames,\n parameters: method.parameters ?? [],\n },\n ];\n });\n}\n\nfunction resolveCrudObject(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): SmartObjectDefinition | undefined {\n if (!isCollectionManifestClass(manifest, obj)) return obj;\n\n const itemObject = resolveCollectionItemObject(manifest, obj);\n if (itemObject) return itemObject;\n\n // A non-conventional collection can still share an endpoint with a model.\n return Object.values(manifest.objects)\n .filter(\n (candidate) =>\n candidate.collection === obj.collection &&\n !isCollectionManifestClass(manifest, candidate),\n )\n .sort((left, right) =>\n compareText(\n left.qualifiedName ?? left.className,\n right.qualifiedName ?? right.className,\n ),\n )[0];\n}\n\nfunction resolveGeneratedClientCrudMethods(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): ApiClientCrudMethod[] {\n const crudObject = resolveCrudObject(obj, manifest);\n const apiConfig = crudObject?.decoratorConfig?.api;\n if (!crudObject || apiConfig === false) return [];\n\n if (apiConfig === true || apiConfig === undefined) {\n return [...STANDARD_API_ACTIONS, 'search'];\n }\n if (typeof apiConfig !== 'object' || apiConfig === null) {\n return [...STANDARD_API_ACTIONS, 'search'];\n }\n\n const included = Array.isArray(apiConfig.include)\n ? apiConfig.include\n : undefined;\n const excluded = Array.isArray(apiConfig.exclude) ? apiConfig.exclude : [];\n const standardMethods = (\n included\n ? STANDARD_API_ACTIONS.filter((action) => included.includes(action))\n : [...STANDARD_API_ACTIONS]\n ).filter((action) => !excluded.includes(action));\n\n // Preserve the historical search convenience only for an unbounded API\n // config. Explicit include lists are fail-closed; a real custom search\n // method is carried separately by resolveGeneratedClientCustomMethods().\n const includeSearch = !included && !excluded.includes('search');\n return includeSearch ? [...standardMethods, 'search'] : standardMethods;\n}\n\n/**\n * Resolve the CRUD surface that the generated route files actually expose for\n * one shared collection endpoint.\n *\n * Route generation processes manifest objects in insertion order. Collection\n * and item handlers live in separate files, and the last model that emits each\n * file replaces the earlier file. Mirror that behavior here so every client\n * alias for a shared endpoint has the same, real action set.\n */\nfunction resolveGeneratedEndpointCrudMethods(\n collection: string,\n manifest: SmartObjectManifest,\n): ApiClientCrudMethod[] {\n let collectionMethods: ApiClientCrudMethod[] = [];\n let itemMethods: ApiClientCrudMethod[] = [];\n\n for (const obj of Object.values(manifest.objects)) {\n if (\n obj.collection !== collection ||\n isCollectionManifestClass(manifest, obj)\n ) {\n continue;\n }\n\n const methods = resolveGeneratedClientCrudMethods(obj, manifest);\n const emittedCollectionMethods = methods.filter((method) =>\n ['list', 'create', 'search'].includes(method),\n );\n const emittedItemMethods = methods.filter((method) =>\n ['get', 'update', 'delete'].includes(method),\n );\n\n // generateRoutesForObject only writes a route file when that file has at\n // least one standard handler. A custom-only object leaves an earlier CRUD\n // file intact rather than replacing it with an empty file.\n if (\n emittedCollectionMethods.some(\n (method) => method === 'list' || method === 'create',\n )\n ) {\n collectionMethods = emittedCollectionMethods;\n }\n if (emittedItemMethods.length > 0) {\n itemMethods = emittedItemMethods;\n }\n }\n\n const emitted = new Set([...collectionMethods, ...itemMethods]);\n const orderedMethods: ApiClientCrudMethod[] = [\n ...STANDARD_API_ACTIONS,\n 'search',\n ];\n return orderedMethods.filter((method) => emitted.has(method));\n}\n\nfunction exposesApiClientSurface(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): boolean {\n if (obj.decoratorConfig?.api === false) return false;\n if (resolveGeneratedClientCrudMethods(obj, manifest).length > 0) return true;\n\n // A disabled item has no CRUD routes. Keep its companion collection only\n // when the collection itself contributes a custom route that the SvelteKit\n // generator will actually emit.\n return resolveGeneratedClientCustomMethods(obj, manifest).length > 0;\n}\n\nfunction resolveDataInterfaceName(\n obj: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): string {\n if (!isCollectionManifestClass(manifest, obj)) {\n return `${obj.className}Data`;\n }\n\n const itemObject = resolveCollectionItemObject(manifest, obj);\n return `${itemObject?.className || obj.className}Data`;\n}\n\nfunction sharedCollectionModelDepth(\n manifest: SmartObjectManifest,\n obj: SmartObjectDefinition,\n): number {\n const seen = new Set<string>();\n let depth = 0;\n let child = obj;\n let parentName = child.extendsQualified || child.extends;\n\n while (parentName && !seen.has(parentName)) {\n seen.add(parentName);\n const parent = findManifestObjectByName(manifest, parentName, child);\n if (!parent || parent.collection !== obj.collection) break;\n depth += 1;\n child = parent;\n parentName = parent.extendsQualified || parent.extends;\n }\n\n return depth;\n}\n\n/**\n * Select the owner of one canonical collection endpoint with a transitive rank.\n *\n * Models beat collection classes because CRUD payloads are rows. Among models,\n * shallower same-collection ancestry wins, then a root with more descendants\n * wins (the STI base over an unrelated endpoint collision), then qualified\n * identity resolves any remaining ambiguity. Numeric/lexical tuple ranks stay\n * transitive, unlike pairwise ancestry overrides inside Array.sort().\n */\nfunction selectCanonicalOwner(\n manifest: SmartObjectManifest,\n group: ManifestCandidate[],\n): ManifestCandidate | undefined {\n const models = group.filter(\n (candidate) => !isCollectionManifestClass(manifest, candidate.obj),\n );\n\n if (models.length > 0) {\n return [...models]\n .map((candidate) => ({\n candidate,\n depth: sharedCollectionModelDepth(manifest, candidate.obj),\n descendantCount: models.filter(\n (other) =>\n other !== candidate &&\n isAncestorOf(manifest, candidate.obj, other.obj),\n ).length,\n }))\n .sort(\n (left, right) =>\n left.depth - right.depth ||\n right.descendantCount - left.descendantCount ||\n compareCandidateIdentity(left.candidate, right.candidate),\n )[0]?.candidate;\n }\n\n return [...group].sort((left, right) => {\n const leftHasItem = resolveCollectionItemObject(manifest, left.obj);\n const rightHasItem = resolveCollectionItemObject(manifest, right.obj);\n if (Boolean(leftHasItem) !== Boolean(rightHasItem)) {\n return leftHasItem ? -1 : 1;\n }\n return compareCandidateIdentity(left, right);\n })[0];\n}\n\n/**\n * Select every generated client entry with deterministic endpoint keys and row\n * payload types. Exactly one entry owns each canonical collection key; other\n * API objects remain available under stable class-derived secondary keys.\n */\nexport function selectApiClientEntries(\n manifest: SmartObjectManifest,\n): ApiClientEntry[] {\n const candidates = Object.entries(manifest.objects)\n .filter(([, obj]) => exposesApiClientSurface(obj, manifest))\n .map(([objectName, obj]): ManifestCandidate => ({ objectName, obj }));\n const candidatesByCollection = new Map<string, ManifestCandidate[]>();\n\n for (const candidate of candidates) {\n const group = candidatesByCollection.get(candidate.obj.collection) ?? [];\n group.push(candidate);\n candidatesByCollection.set(candidate.obj.collection, group);\n }\n\n const canonicalOwners = new Map<string, ManifestCandidate>();\n for (const [collection, group] of candidatesByCollection) {\n const canonicalOwner = selectCanonicalOwner(manifest, group);\n if (canonicalOwner) canonicalOwners.set(collection, canonicalOwner);\n }\n\n // Canonical owners are emitted first within each collection. Sorting all\n // remaining candidates by identity makes numeric suffixes stable too.\n const orderedCandidates = [...candidates].sort((left, right) => {\n const collectionOrder = compareText(\n left.obj.collection,\n right.obj.collection,\n );\n if (collectionOrder !== 0) return collectionOrder;\n\n const leftIsCanonical = canonicalOwners.get(left.obj.collection) === left;\n const rightIsCanonical =\n canonicalOwners.get(right.obj.collection) === right;\n if (leftIsCanonical !== rightIsCanonical) {\n return leftIsCanonical ? -1 : 1;\n }\n\n return compareCandidateIdentity(left, right);\n });\n\n // A secondary key must never shadow any canonical endpoint, including a\n // later collection whose canonical owner has not been emitted yet.\n const reservedCanonicalKeys = new Set(canonicalOwners.keys());\n const usedKeys = new Set<string>();\n\n return orderedCandidates.map(({ objectName, obj }) => {\n const isCanonicalOwner =\n canonicalOwners.get(obj.collection)?.objectName === objectName;\n let clientKey = isCanonicalOwner\n ? obj.collection\n : lowerFirst(obj.className);\n const baseClientKey = clientKey;\n let suffix = 2;\n\n while (\n usedKeys.has(clientKey) ||\n (!isCanonicalOwner && reservedCanonicalKeys.has(clientKey))\n ) {\n clientKey = `${baseClientKey}${suffix}`;\n suffix += 1;\n }\n\n usedKeys.add(clientKey);\n return {\n objectName,\n obj,\n clientKey,\n dataInterfaceName: resolveDataInterfaceName(obj, manifest),\n crudMethods: resolveGeneratedEndpointCrudMethods(\n obj.collection,\n manifest,\n ),\n customMethods: resolveGeneratedClientCustomMethods(obj, manifest),\n };\n });\n}\n"],"mappings":";;;AAqDA,SAAgB,wBACd,mBACA,aACA,oBAA8B,CAAC,GACX;CACpB,MAAM,aAAa,IAAI,IAAI,iBAAiB;CAC5C,MAAM,UAAU,YAAY,QAAQ,WAAW,CAAC,WAAW,IAAI,MAAM,CAAC;CACtE,IAAI,QAAQ,WAAW,GAAG,OAAO,KAAA;C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,IAAI,UAAU,CAAC,EAAE,eAAe;EACtD,IAAI,YAAY,mBACZ,IAAI,aACJ,WAAW,IAAI,SAAS;EAC5B,MAAM,gBAAgB;EACtB,IAAI,SAAS;EAEb,OACE,SAAS,IAAI,SAAS,KACrB,CAAC,oBAAoB,sBAAsB,IAAI,SAAS,GACzD;GACA,YAAY,GAAG,gBAAgB;GAC/B,UAAU;EACZ;EAEA,SAAS,IAAI,SAAS;EACtB,OAAO;GACL;GACA;GACA;GACA,mBAAmB,yBAAyB,KAAK,QAAQ;GACzD,aAAa,oCACX,IAAI,YACJ,QACF;GACA,eAAe,oCAAoC,KAAK,QAAQ;EAClE;CACF,CAAC;AACH"}
@@ -2,7 +2,7 @@ import { DomainKnowledgeConfig } from '@happyvertical/smrt-types';
2
2
  import { Plugin } from 'vite';
3
3
  import { SmartObjectManifest } from '../scanner/types';
4
4
  export type { CliApiCoherenceViolation, SvelteKitOptions, } from './sveltekit-generator.js';
5
- export { findCliApiCoherenceViolations, generateSvelteKitRoutes, methodNameToKebab, resolveApiActionSet, validateCliIncludeAgainstApi, } from './sveltekit-generator.js';
5
+ export { findCliApiCoherenceViolations, generateSvelteKitRoutes, methodNameToKebab, resolveApiActionRouteConfig, resolveApiActionSet, validateCliIncludeAgainstApi, } from './sveltekit-generator.js';
6
6
  export interface SmrtPluginOptions {
7
7
  /** Glob patterns for SMRT source files */
8
8
  include?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAGlE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AA2B5D,YAAY,EACV,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,6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4B,CAC1C,QAAQ,EAAE,mBAAmB,GAC5B,MAAM,CAaR;AAED,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CA86BlE;AAwTD;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,QAAQ,EAAE,mBAAmB,EAC7B,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAAC,IAAI,CAAC,CAmZf"}
@@ -1,4 +1,4 @@
1
- import { findCliApiCoherenceViolations, generateSvelteKitRoutes, methodNameToKebab, resolveApiActionSet, validateCliIncludeAgainstApi } from "./sveltekit-generator.js";
1
+ import { findCliApiCoherenceViolations, generateSvelteKitRoutes, methodNameToKebab, resolveApiActionRouteConfig, resolveApiActionSet, validateCliIncludeAgainstApi } from "./sveltekit-generator.js";
2
2
  import { buildWebCollectionDefinition, buildWebToolDescriptors, computeWebManifestHash, selectWebCollectionEntries } from "./web-collections.js";
3
3
  import { buildDomainKnowledgeManifest } from "../knowledge.js";
4
4
  import { importWorkspaceModule } from "../utils/import-workspace-module.js";
@@ -1351,6 +1351,6 @@ export default {};`;
1351
1351
  }
1352
1352
  }
1353
1353
  //#endregion
1354
- export { findCliApiCoherenceViolations, generateInlineRegisterModule, generateSvelteKitRoutes, generateTypeDeclarationFile, isRegisterShimModuleId, methodNameToKebab, resolveApiActionSet, smrtPlugin, validateCliIncludeAgainstApi };
1354
+ export { findCliApiCoherenceViolations, generateInlineRegisterModule, generateSvelteKitRoutes, generateTypeDeclarationFile, isRegisterShimModuleId, methodNameToKebab, resolveApiActionRouteConfig, resolveApiActionSet, smrtPlugin, validateCliIncludeAgainstApi };
1355
1355
 
1356
1356
  //# sourceMappingURL=index.js.map