@happyvertical/smrt-core 0.45.0 → 0.45.2

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 (37) hide show
  1. package/AGENTS.md +81 -289
  2. package/agents/build-knowledge.md +92 -0
  3. package/agents/memory.md +4 -0
  4. package/agents/object-runtime.md +83 -0
  5. package/agents/schema-paths.md +186 -476
  6. package/dist/generators/mcp.d.ts.map +1 -1
  7. package/dist/generators/mcp.js +25 -7
  8. package/dist/generators/mcp.js.map +1 -1
  9. package/dist/index.js +2 -1
  10. package/dist/knowledge-discovery.d.ts +26 -0
  11. package/dist/knowledge-discovery.d.ts.map +1 -0
  12. package/dist/knowledge-discovery.js +54 -0
  13. package/dist/knowledge-discovery.js.map +1 -0
  14. package/dist/knowledge.d.ts +1 -0
  15. package/dist/knowledge.d.ts.map +1 -1
  16. package/dist/knowledge.js +30 -12
  17. package/dist/knowledge.js.map +1 -1
  18. package/dist/manifest/static-manifest.js +1 -1
  19. package/dist/manifest/static-manifest.js.map +1 -1
  20. package/dist/manifest/store.js +1 -1
  21. package/dist/manifest.json +1 -1
  22. package/dist/registry/types.d.ts +11 -6
  23. package/dist/registry/types.d.ts.map +1 -1
  24. package/dist/smrt-knowledge.json +47 -35
  25. package/dist/vite-plugin/index.d.ts +10 -0
  26. package/dist/vite-plugin/index.d.ts.map +1 -1
  27. package/dist/vite-plugin/index.js +4 -0
  28. package/dist/vite-plugin/index.js.map +1 -1
  29. package/dist/vite-plugin/resources-route.d.ts +18 -0
  30. package/dist/vite-plugin/resources-route.d.ts.map +1 -0
  31. package/dist/vite-plugin/resources-route.js +154 -0
  32. package/dist/vite-plugin/resources-route.js.map +1 -0
  33. package/dist/vite-plugin/sveltekit-generator.d.ts +10 -0
  34. package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
  35. package/dist/vite-plugin/sveltekit-generator.js +2 -0
  36. package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
  37. package/package.json +4 -4
@@ -0,0 +1,154 @@
1
+ import { AUTO_GENERATED_ROUTE_HEADER } from "./route-header.js";
2
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import { join } from "node:path";
5
+ import { pathToFileURL } from "node:url";
6
+ //#region src/vite-plugin/resources-route.ts
7
+ /**
8
+ * SvelteKit `_resources` route generation — CLI discovery endpoint (#2663;
9
+ * parent epic #2655).
10
+ *
11
+ * Emits `{routesDir}/_resources/+server.ts`: `GET /api/_resources`, the
12
+ * endpoint the distributable CLI (`@happyvertical/smrt-app-cli`) reads to
13
+ * learn which resources and commands it can invoke. Every other generated
14
+ * route lives in `sveltekit-generator.ts` or a sibling emitter; this one is
15
+ * kept in its own module for the same reason `changes-route.ts` and
16
+ * `events-route.ts` are — a one-line registration hook in the shared
17
+ * generator file.
18
+ *
19
+ * ## The dependency constraint
20
+ *
21
+ * The handler this route delegates to, `createResourceListHandler`, lives in
22
+ * `@happyvertical/smrt-users` — and `smrt-users` depends on `smrt-core`, not
23
+ * the reverse, so core cannot import it directly. That is not a problem for
24
+ * *emitting* the import: the generated file is written into the consumer's
25
+ * own `src/routes/`, where `@happyvertical/smrt-users` resolves through the
26
+ * consumer's own dependency graph, exactly like the `@happyvertical/smrt-tenancy`
27
+ * import `sveltekit-generator.ts`'s `generateTenantContextHelper` already
28
+ * emits into tenant-scoped routes (see the comment above that function). The
29
+ * only question is *when* it is safe to emit — a consumer that never took a
30
+ * dependency on `smrt-users` must never receive a route whose import cannot
31
+ * resolve, or a working build turns red.
32
+ *
33
+ * ## Detection mechanism
34
+ *
35
+ * Unlike the tenancy guard — which reads a semantic signal already present in
36
+ * the manifest (whether any object is `@TenantScoped`, which itself implies
37
+ * the app depends on `smrt-tenancy`) — nothing in the manifest indicates
38
+ * whether a consumer has taken on `smrt-users`. Objects don't declare an
39
+ * auth dependency; the app does, at the package level.
40
+ *
41
+ * So this route uses a **resolvable-dependency check**: does the exact
42
+ * subpath the generated file imports — `@happyvertical/smrt-users/sveltekit`
43
+ * — resolve from the consumer's `projectRoot`, via a `createRequire` rooted
44
+ * at the consumer's own `package.json`? That is stronger than reading
45
+ * `package.json`'s `dependencies` block (which can list a package that was
46
+ * never installed) and, unlike a single hardcoded
47
+ * `node_modules/@happyvertical/smrt-users/package.json` path, it uses
48
+ * Node's real module resolution — so it also finds the package when a
49
+ * workspace hoists shared dependencies to an ancestor `node_modules` (npm/
50
+ * yarn workspaces, or pnpm with `node-linker=hoisted`) rather than
51
+ * installing them directly under the consumer's own `projectRoot`.
52
+ * Resolving the `/sveltekit` subpath specifically, rather than the
53
+ * package's bare `package.json`, matters too: `smrt-users`'s `exports` map
54
+ * does not list `./package.json`, so resolving that path would throw
55
+ * `ERR_PACKAGE_PATH_NOT_EXPORTED` even when the package is genuinely
56
+ * installed — resolving the subpath the route actually imports sidesteps
57
+ * that and checks precisely the thing that must succeed at build time.
58
+ *
59
+ * An explicit `sveltekit: { resourcesRoute: { enabled: false } }` escape
60
+ * hatch is also available, matching `changesRoute`/`eventsRoute`, for a
61
+ * consumer that has `smrt-users` installed but wants to keep hand-writing
62
+ * (or omit) `_resources`.
63
+ *
64
+ * ## Preserving a hand-written route
65
+ *
66
+ * Every consumer today hand-writes this route (the reference implementation
67
+ * in the issue). `clearGeneratedRouteFiles` (in `sveltekit-generator.ts`)
68
+ * already only deletes `+server.ts` files that start with
69
+ * {@link AUTO_GENERATED_ROUTE_HEADER}, so a hand-written `_resources` route —
70
+ * which never carries that header — survives the pre-generation sweep
71
+ * untouched. This emitter additionally checks `existsSync` on the target
72
+ * path before writing: by the time it runs, anything still there is
73
+ * necessarily hand-written (a generator-owned copy would already have been
74
+ * swept), so its mere presence is sufficient to skip generation and leave it
75
+ * alone.
76
+ *
77
+ * Once a consumer's `_resources` route IS generator-owned (no hand-written
78
+ * file present, `smrt-users` resolvable), its path is generator-owned for
79
+ * `.gitignore` purposes too — it is included in `generatedRoutePaths` like
80
+ * any other emitted route, so `updateGitignore` puts it in the managed
81
+ * block. A project that migrated from a hand-written route to a fully
82
+ * generated one may still carry a stale `# Application-owned rule` comment
83
+ * above the same literal path from before the migration; `updateGitignore`
84
+ * only ever touches its own managed block, so that stale comment is left as
85
+ * project history for the consumer to clean up — the same way any other
86
+ * manual `.gitignore` edit outside the managed block is preserved.
87
+ */
88
+ /**
89
+ * Whether `@happyvertical/smrt-users/sveltekit` — the exact subpath the
90
+ * generated route imports — is resolvable from the consumer at
91
+ * `projectRoot`. See the module doc for why this check (rather than reading
92
+ * `package.json`'s declared `dependencies`, or checking one hardcoded
93
+ * physical path) is the chosen signal.
94
+ */
95
+ function consumerHasSmrtUsers(projectRoot) {
96
+ try {
97
+ createRequire(pathToFileURL(join(projectRoot, "package.json")).href).resolve("@happyvertical/smrt-users/sveltekit");
98
+ return true;
99
+ } catch {
100
+ return false;
101
+ }
102
+ }
103
+ /**
104
+ * Generate the `_resources/+server.ts` route. Returns true when a route was
105
+ * written. Disabled with `sveltekit: { resourcesRoute: { enabled: false } }`;
106
+ * skipped (with a log line) when `@happyvertical/smrt-users` is not
107
+ * resolvable from the consumer, or when a hand-written route already
108
+ * occupies the path.
109
+ */
110
+ function generateResourcesRoute(projectRoot, options) {
111
+ if (options.resourcesRoute?.enabled === false) return false;
112
+ if (!consumerHasSmrtUsers(projectRoot)) {
113
+ console.log("[smrt] Skipping _resources route - @happyvertical/smrt-users is not resolvable; createResourceListHandler would not resolve in the consumer build");
114
+ return false;
115
+ }
116
+ const routeDir = join(projectRoot, options.routesDir, "_resources");
117
+ const filePath = join(routeDir, "+server.ts");
118
+ const existingServerFile = ["+server.ts", "+server.js"].find((name) => existsSync(join(routeDir, name)));
119
+ if (existingServerFile) {
120
+ console.log(`[smrt] Preserving hand-written _resources route (${existingServerFile}, not generator-owned)`);
121
+ return false;
122
+ }
123
+ if (!existsSync(routeDir)) mkdirSync(routeDir, { recursive: true });
124
+ writeFileSync(filePath, generateResourcesRouteTemplate(options), "utf-8");
125
+ console.log(`[smrt] Generated: ${filePath}`);
126
+ return true;
127
+ }
128
+ function generateResourcesRouteTemplate(options) {
129
+ return `${AUTO_GENERATED_ROUTE_HEADER}
130
+ // DO NOT EDIT - changes will be overwritten
131
+ //
132
+ // GET /api/_resources — CLI discovery endpoint (#2663). Returns the auth-aware
133
+ // list of resources and commands the distributable CLI
134
+ // (@happyvertical/smrt-app-cli) can invoke, derived from ObjectRegistry by
135
+ // createResourceListHandler. Subsumes the route every consumer previously
136
+ // hand-wrote (see the issue for the reference implementation this replaces).
137
+
138
+ import { createResourceListHandler } from '@happyvertical/smrt-users/sveltekit';
139
+ // Side effect: registers @smrt() classes in ObjectRegistry before the
140
+ // handler walks it (mirrors the generated CRUD/changes/events routes'
141
+ // $lib/server/smrt import).
142
+ import '$lib/server/smrt';
143
+
144
+ export const GET = createResourceListHandler({
145
+ ensureRegistry: async () => {
146
+ await import('$lib/server/smrt');
147
+ },${options.kebabRoutes ? "\n kebabRoutes: true," : ""}
148
+ });
149
+ `;
150
+ }
151
+ //#endregion
152
+ export { consumerHasSmrtUsers, generateResourcesRoute };
153
+
154
+ //# sourceMappingURL=resources-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources-route.js","names":[],"sources":["../../src/vite-plugin/resources-route.ts"],"sourcesContent":["/**\n * SvelteKit `_resources` route generation — CLI discovery endpoint (#2663;\n * parent epic #2655).\n *\n * Emits `{routesDir}/_resources/+server.ts`: `GET /api/_resources`, the\n * endpoint the distributable CLI (`@happyvertical/smrt-app-cli`) reads to\n * learn which resources and commands it can invoke. Every other generated\n * route lives in `sveltekit-generator.ts` or a sibling emitter; this one is\n * kept in its own module for the same reason `changes-route.ts` and\n * `events-route.ts` are — a one-line registration hook in the shared\n * generator file.\n *\n * ## The dependency constraint\n *\n * The handler this route delegates to, `createResourceListHandler`, lives in\n * `@happyvertical/smrt-users` — and `smrt-users` depends on `smrt-core`, not\n * the reverse, so core cannot import it directly. That is not a problem for\n * *emitting* the import: the generated file is written into the consumer's\n * own `src/routes/`, where `@happyvertical/smrt-users` resolves through the\n * consumer's own dependency graph, exactly like the `@happyvertical/smrt-tenancy`\n * import `sveltekit-generator.ts`'s `generateTenantContextHelper` already\n * emits into tenant-scoped routes (see the comment above that function). The\n * only question is *when* it is safe to emit — a consumer that never took a\n * dependency on `smrt-users` must never receive a route whose import cannot\n * resolve, or a working build turns red.\n *\n * ## Detection mechanism\n *\n * Unlike the tenancy guard — which reads a semantic signal already present in\n * the manifest (whether any object is `@TenantScoped`, which itself implies\n * the app depends on `smrt-tenancy`) — nothing in the manifest indicates\n * whether a consumer has taken on `smrt-users`. Objects don't declare an\n * auth dependency; the app does, at the package level.\n *\n * So this route uses a **resolvable-dependency check**: does the exact\n * subpath the generated file imports — `@happyvertical/smrt-users/sveltekit`\n * — resolve from the consumer's `projectRoot`, via a `createRequire` rooted\n * at the consumer's own `package.json`? That is stronger than reading\n * `package.json`'s `dependencies` block (which can list a package that was\n * never installed) and, unlike a single hardcoded\n * `node_modules/@happyvertical/smrt-users/package.json` path, it uses\n * Node's real module resolution — so it also finds the package when a\n * workspace hoists shared dependencies to an ancestor `node_modules` (npm/\n * yarn workspaces, or pnpm with `node-linker=hoisted`) rather than\n * installing them directly under the consumer's own `projectRoot`.\n * Resolving the `/sveltekit` subpath specifically, rather than the\n * package's bare `package.json`, matters too: `smrt-users`'s `exports` map\n * does not list `./package.json`, so resolving that path would throw\n * `ERR_PACKAGE_PATH_NOT_EXPORTED` even when the package is genuinely\n * installed — resolving the subpath the route actually imports sidesteps\n * that and checks precisely the thing that must succeed at build time.\n *\n * An explicit `sveltekit: { resourcesRoute: { enabled: false } }` escape\n * hatch is also available, matching `changesRoute`/`eventsRoute`, for a\n * consumer that has `smrt-users` installed but wants to keep hand-writing\n * (or omit) `_resources`.\n *\n * ## Preserving a hand-written route\n *\n * Every consumer today hand-writes this route (the reference implementation\n * in the issue). `clearGeneratedRouteFiles` (in `sveltekit-generator.ts`)\n * already only deletes `+server.ts` files that start with\n * {@link AUTO_GENERATED_ROUTE_HEADER}, so a hand-written `_resources` route —\n * which never carries that header — survives the pre-generation sweep\n * untouched. This emitter additionally checks `existsSync` on the target\n * path before writing: by the time it runs, anything still there is\n * necessarily hand-written (a generator-owned copy would already have been\n * swept), so its mere presence is sufficient to skip generation and leave it\n * alone.\n *\n * Once a consumer's `_resources` route IS generator-owned (no hand-written\n * file present, `smrt-users` resolvable), its path is generator-owned for\n * `.gitignore` purposes too — it is included in `generatedRoutePaths` like\n * any other emitted route, so `updateGitignore` puts it in the managed\n * block. A project that migrated from a hand-written route to a fully\n * generated one may still carry a stale `# Application-owned rule` comment\n * above the same literal path from before the migration; `updateGitignore`\n * only ever touches its own managed block, so that stale comment is left as\n * project history for the consumer to clean up — the same way any other\n * manual `.gitignore` edit outside the managed block is preserved.\n */\n\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { AUTO_GENERATED_ROUTE_HEADER } from './route-header.js';\nimport type { SvelteKitOptions } from './sveltekit-generator.js';\n\n/**\n * Whether `@happyvertical/smrt-users/sveltekit` — the exact subpath the\n * generated route imports — is resolvable from the consumer at\n * `projectRoot`. See the module doc for why this check (rather than reading\n * `package.json`'s declared `dependencies`, or checking one hardcoded\n * physical path) is the chosen signal.\n */\nexport function consumerHasSmrtUsers(projectRoot: string): boolean {\n try {\n const consumerRequire = createRequire(\n pathToFileURL(join(projectRoot, 'package.json')).href,\n );\n consumerRequire.resolve('@happyvertical/smrt-users/sveltekit');\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Generate the `_resources/+server.ts` route. Returns true when a route was\n * written. Disabled with `sveltekit: { resourcesRoute: { enabled: false } }`;\n * skipped (with a log line) when `@happyvertical/smrt-users` is not\n * resolvable from the consumer, or when a hand-written route already\n * occupies the path.\n */\nexport function generateResourcesRoute(\n projectRoot: string,\n options: SvelteKitOptions,\n): boolean {\n if (options.resourcesRoute?.enabled === false) {\n return false;\n }\n\n if (!consumerHasSmrtUsers(projectRoot)) {\n console.log(\n '[smrt] Skipping _resources route - @happyvertical/smrt-users is not ' +\n 'resolvable; createResourceListHandler would not resolve in the ' +\n 'consumer build',\n );\n return false;\n }\n\n const routeDir = join(projectRoot, options.routesDir, '_resources');\n const filePath = join(routeDir, '+server.ts');\n\n // By this point in generation, clearGeneratedRouteFiles has already swept\n // any previously generator-owned copy at this path — anything still here\n // is necessarily hand-written. Preserve it rather than clobbering a\n // consumer's customized discovery route. Check every server-module\n // extension SvelteKit resolves by default (`.js` and `.ts` — see\n // https://svelte.dev/docs/kit/configuration#moduleExtensions), not only\n // `.ts`: a hand-written `+server.js` is invisible to a `.ts`-only check,\n // so the generator would write `+server.ts` alongside it and SvelteKit\n // would then refuse the route with \"Multiple endpoint files found\".\n const existingServerFile = ['+server.ts', '+server.js'].find((name) =>\n existsSync(join(routeDir, name)),\n );\n if (existingServerFile) {\n console.log(\n `[smrt] Preserving hand-written _resources route (${existingServerFile}, not generator-owned)`,\n );\n return false;\n }\n\n if (!existsSync(routeDir)) {\n mkdirSync(routeDir, { recursive: true });\n }\n writeFileSync(filePath, generateResourcesRouteTemplate(options), 'utf-8');\n console.log(`[smrt] Generated: ${filePath}`);\n return true;\n}\n\nfunction generateResourcesRouteTemplate(options: SvelteKitOptions): string {\n const kebabRoutesOption = options.kebabRoutes ? '\\n kebabRoutes: true,' : '';\n\n return `${AUTO_GENERATED_ROUTE_HEADER}\n// DO NOT EDIT - changes will be overwritten\n//\n// GET /api/_resources — CLI discovery endpoint (#2663). Returns the auth-aware\n// list of resources and commands the distributable CLI\n// (@happyvertical/smrt-app-cli) can invoke, derived from ObjectRegistry by\n// createResourceListHandler. Subsumes the route every consumer previously\n// hand-wrote (see the issue for the reference implementation this replaces).\n\nimport { createResourceListHandler } from '@happyvertical/smrt-users/sveltekit';\n// Side effect: registers @smrt() classes in ObjectRegistry before the\n// handler walks it (mirrors the generated CRUD/changes/events routes'\n// $lib/server/smrt import).\nimport '$lib/server/smrt';\n\nexport const GET = createResourceListHandler({\n ensureRegistry: async () => {\n await import('$lib/server/smrt');\n },${kebabRoutesOption}\n});\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA,SAAgB,qBAAqB,aAA8B;CACjE,IAAI;EAIF,cAFE,cAAc,KAAK,aAAa,cAAc,CAAC,CAAC,CAAC,IAEnD,CAAA,CAAgB,QAAQ,qCAAqC;EAC7D,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;AASA,SAAgB,uBACd,aACA,SACS;CACT,IAAI,QAAQ,gBAAgB,YAAY,OACtC,OAAO;CAGT,IAAI,CAAC,qBAAqB,WAAW,GAAG;EACtC,QAAQ,IACN,mJAGF;EACA,OAAO;CACT;CAEA,MAAM,WAAW,KAAK,aAAa,QAAQ,WAAW,YAAY;CAClE,MAAM,WAAW,KAAK,UAAU,YAAY;CAW5C,MAAM,qBAAqB,CAAC,cAAc,YAAY,CAAC,CAAC,MAAM,SAC5D,WAAW,KAAK,UAAU,IAAI,CAAC,CACjC;CACA,IAAI,oBAAoB;EACtB,QAAQ,IACN,oDAAoD,mBAAmB,uBACzE;EACA,OAAO;CACT;CAEA,IAAI,CAAC,WAAW,QAAQ,GACtB,UAAU,UAAU,EAAE,WAAW,KAAK,CAAC;CAEzC,cAAc,UAAU,+BAA+B,OAAO,GAAG,OAAO;CACxE,QAAQ,IAAI,qBAAqB,UAAU;CAC3C,OAAO;AACT;AAEA,SAAS,+BAA+B,SAAmC;CAGzE,OAAO,GAAG,4BAA4B;;;;;;;;;;;;;;;;;;MAFZ,QAAQ,cAAc,2BAA2B,GAoBrD;;;AAGxB"}
@@ -43,6 +43,16 @@ export interface SvelteKitOptions {
43
43
  allowedOrigins?: string[];
44
44
  allowCredentials?: boolean;
45
45
  };
46
+ /**
47
+ * CLI discovery `_resources` route generation (#2663). Enabled by default,
48
+ * but only ever emitted when `@happyvertical/smrt-users` is resolvable
49
+ * from the consumer (see `resources-route.ts` for the detection
50
+ * mechanism) — set `enabled: false` to opt out even when it is present. A
51
+ * pre-existing hand-written `_resources` route is always preserved.
52
+ */
53
+ resourcesRoute?: {
54
+ enabled?: boolean;
55
+ };
46
56
  }
47
57
  export interface ResolvedApiActionRouteConfig {
48
58
  scope: 'item' | 'collection';
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-generator.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/sveltekit-generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAYvE,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAY1B,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACrC;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,EAAE;QACZ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;CACH;AAYD,MAAM,WAAW,4BAA4B;IAC3C,K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C,EAAE,OAAO,CAAA;CAAE,EACjC,SAAS,EAAE,OAAO,EAClB,YAAY,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,EAC5C,YAAY,GAAE,MAAM,GAAG,YAEb,GACT,4BAA4B,CAwB9B;AAiUD;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAqGf;AAy0BD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,qBAAqB,EAChC,QAAQ,CAAC,EAAE,mBAAmB,GAC7B,GAAG,CAAC,MAAM,CAAC,CA6Cb;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAuDD;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,mBAAmB,GAC5B,wBAAwB,EAAE,CAsB5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,mBAAmB,GAC5B,IAAI,CA2BN"}
@@ -5,6 +5,7 @@ import { generateConditionalGetRouteHelper } from "../generators/conditional-get
5
5
  import { AUTO_GENERATED_ROUTE_HEADER } from "./route-header.js";
6
6
  import { generateChangesRoute } from "./changes-route.js";
7
7
  import { generateEventsRoute } from "./events-route.js";
8
+ import { generateResourcesRoute } from "./resources-route.js";
8
9
  import { generateSyncApplyRoute } from "./sync-apply-route.js";
9
10
  import { computeWebManifestHash, isCollectionManifestClass, resolveCollectionItemObject, resolveCollectionItemTypeName } from "./web-collections.js";
10
11
  import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
@@ -783,6 +784,7 @@ async function generateSvelteKitRoutes(projectRoot, manifest, options) {
783
784
  if (generateSyncApplyRoute(projectRoot, manifest, options)) generatedRoutePaths.push(join(projectRoot, options.routesDir, "sync", "apply", "+server.ts"));
784
785
  if (generateChangesRoute(projectRoot, manifest, options)) generatedRoutePaths.push(join(projectRoot, options.routesDir, "_changes", "+server.ts"));
785
786
  if (generateEventsRoute(projectRoot, manifest, options, computeWebManifestHash(manifest))) generatedRoutePaths.push(join(projectRoot, options.routesDir, "_events", "+server.ts"));
787
+ if (generateResourcesRoute(projectRoot, options)) generatedRoutePaths.push(join(projectRoot, options.routesDir, "_resources", "+server.ts"));
786
788
  updateGitignore(projectRoot, generatedRoutePaths);
787
789
  const skippedMsg = skippedCollections > 0 ? ` (skipped ${skippedCollections} collection classes)` : "";
788
790
  console.log(`[smrt] Generated routes for ${generatedCount} SMRT objects${skippedMsg}`);