@happyvertical/smrt-core 0.57.45 → 0.57.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -3
- package/agents/browser-entry.md +16 -0
- package/agents/build-knowledge.md +58 -14
- package/agents/change-feed.md +20 -0
- package/agents/generators.md +69 -3
- package/agents/schema-paths.md +82 -0
- package/dist/_virtual/_rolldown/runtime.js +22 -1
- package/dist/browser.d.ts +2 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +2 -2
- package/dist/cascade.d.ts +46 -0
- package/dist/cascade.d.ts.map +1 -1
- package/dist/cascade.js +96 -7
- package/dist/cascade.js.map +1 -1
- package/dist/change-feed.d.ts.map +1 -1
- package/dist/change-feed.js +7 -4
- package/dist/change-feed.js.map +1 -1
- package/dist/class.d.ts.map +1 -1
- package/dist/class.js +3 -3
- package/dist/class.js.map +1 -1
- package/dist/consumer-plugin/index.d.ts +13 -0
- package/dist/consumer-plugin/index.d.ts.map +1 -1
- package/dist/consumer-plugin/index.js +69 -13
- package/dist/consumer-plugin/index.js.map +1 -1
- package/dist/consumer-plugin.js +2 -2
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +3 -3
- package/dist/database.js.map +1 -1
- package/dist/dispatch/bus.d.ts.map +1 -1
- package/dist/dispatch/bus.js +1 -4
- package/dist/dispatch/bus.js.map +1 -1
- package/dist/dispatch/index.d.ts +1 -1
- package/dist/dispatch/index.d.ts.map +1 -1
- package/dist/dispatch/types.d.ts +22 -3
- package/dist/dispatch/types.d.ts.map +1 -1
- package/dist/generators/changes-route.d.ts.map +1 -1
- package/dist/generators/changes-route.js +2 -2
- package/dist/generators/changes-route.js.map +1 -1
- package/dist/generators/custom-action.d.ts +11 -0
- package/dist/generators/custom-action.d.ts.map +1 -1
- package/dist/generators/custom-action.js +23 -4
- package/dist/generators/custom-action.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/lazy-config.d.ts +120 -3
- package/dist/lazy-config.d.ts.map +1 -1
- package/dist/lazy-config.js +81 -10
- package/dist/lazy-config.js.map +1 -1
- package/dist/manifest/generator.d.ts +8 -2
- package/dist/manifest/generator.d.ts.map +1 -1
- package/dist/manifest/generator.js +6 -5
- package/dist/manifest/generator.js.map +1 -1
- package/dist/manifest/index.d.ts +1 -0
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +2 -1
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/local-manifest-reader.d.ts +13 -2
- package/dist/manifest/local-manifest-reader.d.ts.map +1 -1
- package/dist/manifest/local-manifest-reader.js +38 -6
- package/dist/manifest/local-manifest-reader.js.map +1 -1
- package/dist/manifest/manifest-loader.d.ts +9 -8
- package/dist/manifest/manifest-loader.d.ts.map +1 -1
- package/dist/manifest/manifest-loader.js +67 -27
- package/dist/manifest/manifest-loader.js.map +1 -1
- package/dist/manifest/object-declarations.d.ts +116 -0
- package/dist/manifest/object-declarations.d.ts.map +1 -0
- package/dist/manifest/object-declarations.js +161 -0
- package/dist/manifest/object-declarations.js.map +1 -0
- package/dist/manifest/static-manifest.d.ts.map +1 -1
- package/dist/manifest/static-manifest.js +5 -3
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.d.ts.map +1 -1
- package/dist/manifest/store.js +18 -2
- package/dist/manifest/store.js.map +1 -1
- package/dist/manifest/test-artifacts.d.ts +57 -0
- package/dist/manifest/test-artifacts.d.ts.map +1 -0
- package/dist/manifest/test-artifacts.js +111 -0
- package/dist/manifest/test-artifacts.js.map +1 -0
- package/dist/manifest.js +2 -1
- package/dist/manifest.json +5 -3
- package/dist/migrations/differ.d.ts.map +1 -1
- package/dist/migrations/differ.js +11 -3
- package/dist/migrations/differ.js.map +1 -1
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +3 -1
- package/dist/migrations/qualified-name-aliases.d.ts.map +1 -1
- package/dist/migrations/qualified-name-aliases.js +1 -1
- package/dist/migrations/qualified-name-aliases.js.map +1 -1
- package/dist/migrations.js +3 -1
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +2 -2
- package/dist/object.js.map +1 -1
- package/dist/postgres-permissions.d.ts.map +1 -1
- package/dist/postgres-permissions.js +4 -3
- package/dist/postgres-permissions.js.map +1 -1
- package/dist/postgres-timeouts.d.ts +30 -3
- package/dist/postgres-timeouts.d.ts.map +1 -1
- package/dist/postgres-timeouts.js +39 -2
- package/dist/postgres-timeouts.js.map +1 -1
- package/dist/prebuild/index.d.ts.map +1 -1
- package/dist/prebuild/index.js +14 -11
- package/dist/prebuild/index.js.map +1 -1
- package/dist/registry/class-registration.d.ts.map +1 -1
- package/dist/registry/class-registration.js +24 -2
- package/dist/registry/class-registration.js.map +1 -1
- package/dist/registry/collection-exposure.d.ts +27 -0
- package/dist/registry/collection-exposure.d.ts.map +1 -1
- package/dist/registry/collection-exposure.js +74 -1
- package/dist/registry/collection-exposure.js.map +1 -1
- package/dist/registry/collection-resolution.d.ts.map +1 -1
- package/dist/registry/collection-resolution.js +1 -0
- package/dist/registry/collection-resolution.js.map +1 -1
- package/dist/registry/framework-base-classes.d.ts.map +1 -1
- package/dist/registry/framework-base-classes.js +5 -0
- package/dist/registry/framework-base-classes.js.map +1 -1
- package/dist/registry/schema-builder.d.ts +8 -1
- package/dist/registry/schema-builder.d.ts.map +1 -1
- package/dist/registry/schema-builder.js +17 -4
- package/dist/registry/schema-builder.js.map +1 -1
- package/dist/registry/types.d.ts +12 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry.d.ts +2 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +30 -10
- package/dist/registry.js.map +1 -1
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +10 -8
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/scanner/types.d.ts +29 -0
- package/dist/scanner/types.d.ts.map +1 -1
- package/dist/scanner/types.js.map +1 -1
- package/dist/schema/generator.d.ts +32 -0
- package/dist/schema/generator.d.ts.map +1 -1
- package/dist/schema/generator.js +59 -0
- package/dist/schema/generator.js.map +1 -1
- package/dist/schema/live-parity.d.ts.map +1 -1
- package/dist/schema/live-parity.js +4 -2
- package/dist/schema/live-parity.js.map +1 -1
- package/dist/scripts/browser-unbundled-dev.mjs +90 -0
- package/dist/scripts/generate-test-manifest.js +9 -49
- package/dist/smrt-knowledge.json +16 -16
- package/dist/system/compatibility.d.ts.map +1 -1
- package/dist/system/compatibility.js +12 -4
- package/dist/system/compatibility.js.map +1 -1
- package/dist/system/schema.d.ts +70 -8
- package/dist/system/schema.d.ts.map +1 -1
- package/dist/system/schema.js +231 -24
- package/dist/system/schema.js.map +1 -1
- package/dist/testing/database.d.ts.map +1 -1
- package/dist/testing/database.js +14 -2
- package/dist/testing/database.js.map +1 -1
- package/dist/tools/tool-generator.d.ts.map +1 -1
- package/dist/tools/tool-generator.js +2 -2
- package/dist/tools/tool-generator.js.map +1 -1
- package/dist/utils/import-workspace-module.d.ts.map +1 -1
- package/dist/utils/import-workspace-module.js +23 -0
- package/dist/utils/import-workspace-module.js.map +1 -1
- package/dist/utils/naming.js +5 -3
- package/dist/utils/naming.js.map +1 -1
- package/dist/vendor/pluralize/pluralize.js +421 -0
- package/dist/vendor/pluralize/pluralize.js.map +1 -0
- package/dist/vite-plugin/api-client-entries.d.ts +5 -1
- package/dist/vite-plugin/api-client-entries.d.ts.map +1 -1
- package/dist/vite-plugin/api-client-entries.js +11 -6
- package/dist/vite-plugin/api-client-entries.js.map +1 -1
- package/dist/vite-plugin/consumer-import.d.ts +28 -0
- package/dist/vite-plugin/consumer-import.d.ts.map +1 -0
- package/dist/vite-plugin/consumer-import.js +42 -0
- package/dist/vite-plugin/consumer-import.js.map +1 -0
- package/dist/vite-plugin/dev-plane-route.d.ts +6 -1
- package/dist/vite-plugin/dev-plane-route.d.ts.map +1 -1
- package/dist/vite-plugin/dev-plane-route.js +8 -9
- package/dist/vite-plugin/dev-plane-route.js.map +1 -1
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +12 -9
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin/resources-route.d.ts.map +1 -1
- package/dist/vite-plugin/resources-route.js +3 -8
- package/dist/vite-plugin/resources-route.js.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +7 -11
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/dist/vite-plugin/sync-apply-route.d.ts +16 -0
- package/dist/vite-plugin/sync-apply-route.d.ts.map +1 -1
- package/dist/vite-plugin/sync-apply-route.js +48 -6
- package/dist/vite-plugin/sync-apply-route.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import "../scanner/types.js";
|
|
2
|
+
import { isTestArtifactManifest } from "../manifest/test-artifacts.js";
|
|
2
3
|
import { canonicalSvelteKitPath } from "../vite-plugin/sveltekit-path.js";
|
|
3
4
|
import { clearGeneratedSvelteKitRouteFiles, reconcileSvelteKitRouteGitignore, resolveApiActionSet } from "../vite-plugin/sveltekit-generator.js";
|
|
4
5
|
import { generateWebModule, isCollectionManifestClass, resolveCollectionItemObject } from "../vite-plugin/web-collections.js";
|
|
5
6
|
import { publishArtifactFiles } from "./artifact-publication.js";
|
|
6
7
|
import { resolveFileKnowledgeConfig } from "../knowledge-config.js";
|
|
7
8
|
import { buildDomainKnowledgeManifest } from "../knowledge.js";
|
|
9
|
+
import { selectObjectDeclarations } from "../manifest/object-declarations.js";
|
|
8
10
|
import { manifestExportCandidates } from "../manifest/package-manifest-exports.js";
|
|
9
11
|
import { loadVerifiedSmrtGenerationSnapshot, serializeSmrtGenerationSnapshot, sha256SmrtGenerationSnapshot } from "../generation-snapshot.js";
|
|
10
12
|
import { generateClientModule } from "../vite-plugin/generated-client.js";
|
|
@@ -12,7 +14,8 @@ import { activeProducerKnowledgeRoutePaths, activeSvelteKitRouteParticipants, as
|
|
|
12
14
|
import { generateDeclarations } from "../prebuild/index.js";
|
|
13
15
|
import { separateHostedStiCollections } from "./hosted-sti-collections.js";
|
|
14
16
|
import * as path$1 from "node:path";
|
|
15
|
-
import { pathToFileURL } from "node:url";
|
|
17
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
|
+
import { resolve as resolve$1 } from "import-meta-resolve";
|
|
16
19
|
import * as fs$1 from "node:fs";
|
|
17
20
|
//#region src/consumer-plugin/index.ts
|
|
18
21
|
/**
|
|
@@ -45,6 +48,27 @@ function readInstalledPackageJson(packageJsonPath) {
|
|
|
45
48
|
return;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
var TYPESCRIPT_SOURCE_PATTERN = /(?<!\.d)\.(?:[cm]?ts|tsx)$/;
|
|
52
|
+
/**
|
|
53
|
+
* Whether `specifier` resolves, under Node's ESM `import` conditions from
|
|
54
|
+
* `fromDir`, to a TypeScript source file (#3092). Workspace packages often
|
|
55
|
+
* publish `"import": "./src/index.ts"` for an app that only runs them through
|
|
56
|
+
* Vite. Plain Node cannot evaluate such a module as a SMRT provider: it does
|
|
57
|
+
* not rewrite `./x.js` specifiers to `./x.ts`, never strips types inside
|
|
58
|
+
* `node_modules`, and cannot strip `@smrt()` decorators at all. An
|
|
59
|
+
* unresolvable specifier answers `false`, leaving the existing import (and its
|
|
60
|
+
* existing failure mode) unchanged.
|
|
61
|
+
*
|
|
62
|
+
* @internal Exported for tests.
|
|
63
|
+
*/
|
|
64
|
+
function resolvesToTypeScriptSource(specifier, fromDir) {
|
|
65
|
+
try {
|
|
66
|
+
const target = resolve$1(specifier, pathToFileURL(path$1.join(fromDir, "package.json")).href);
|
|
67
|
+
return target.startsWith("file:") && TYPESCRIPT_SOURCE_PATTERN.test(fileURLToPath(target));
|
|
68
|
+
} catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
48
72
|
/**
|
|
49
73
|
* Whether an `exports` target (or any condition under it) needs Vite to
|
|
50
74
|
* compile it: a `.svelte`/`.css` file or a `svelte` resolution condition.
|
|
@@ -812,7 +836,7 @@ async function saveAggregatedManifest(manifest, projectRoot, resolveKnowledgeCon
|
|
|
812
836
|
let merged = manifest;
|
|
813
837
|
if (fs$1.existsSync(manifestPath)) try {
|
|
814
838
|
const existing = JSON.parse(fs$1.readFileSync(manifestPath, "utf-8"));
|
|
815
|
-
if (existing && typeof existing.objects === "object") merged = {
|
|
839
|
+
if (existing && typeof existing.objects === "object" && !isTestArtifactManifest(existing)) merged = {
|
|
816
840
|
...existing,
|
|
817
841
|
...manifest,
|
|
818
842
|
...existing.packageName ? { packageName: existing.packageName } : {},
|
|
@@ -865,6 +889,20 @@ async function generateRegistrationFile(manifest, projectRoot) {
|
|
|
865
889
|
const importBindings = /* @__PURE__ */ new Map();
|
|
866
890
|
const importsByPath = /* @__PURE__ */ new Map();
|
|
867
891
|
const transitiveNamespaces = /* @__PURE__ */ new Map();
|
|
892
|
+
const typeScriptSourceMemo = /* @__PURE__ */ new Map();
|
|
893
|
+
const isTypeScriptSource = (specifier, fromDir) => {
|
|
894
|
+
const key = `${fromDir}\0${specifier}`;
|
|
895
|
+
let answer = typeScriptSourceMemo.get(key);
|
|
896
|
+
if (answer === void 0) {
|
|
897
|
+
answer = resolvesToTypeScriptSource(specifier, fromDir);
|
|
898
|
+
typeScriptSourceMemo.set(key, answer);
|
|
899
|
+
}
|
|
900
|
+
return answer;
|
|
901
|
+
};
|
|
902
|
+
const viteOnlyImportPaths = /* @__PURE__ */ new Set();
|
|
903
|
+
const markViteOnlyImport = (importPath) => {
|
|
904
|
+
if (isTypeScriptSource(importPath, projectRoot)) viteOnlyImportPaths.add(importPath);
|
|
905
|
+
};
|
|
868
906
|
const transitiveBindings = /* @__PURE__ */ new Map();
|
|
869
907
|
const transitiveCollectionChecks = [];
|
|
870
908
|
let nextImportBinding = 0;
|
|
@@ -877,16 +915,19 @@ async function generateRegistrationFile(manifest, projectRoot) {
|
|
|
877
915
|
const specifiers = importsByPath.get(importPath) ?? /* @__PURE__ */ new Map();
|
|
878
916
|
specifiers.set(exportName, binding);
|
|
879
917
|
importsByPath.set(importPath, specifiers);
|
|
918
|
+
markViteOnlyImport(importPath);
|
|
880
919
|
return binding;
|
|
881
920
|
};
|
|
882
921
|
const getTransitiveBinding = (importPath, providerPackageName, exportName) => {
|
|
883
922
|
const namespaceKey = `${providerPackageName}\0${importPath}`;
|
|
884
923
|
let namespace = transitiveNamespaces.get(namespaceKey);
|
|
885
924
|
if (!namespace) {
|
|
925
|
+
const providerPackageJson = findInstalledPackageJson(providerPackageName, projectRoot);
|
|
886
926
|
namespace = {
|
|
887
927
|
binding: `__smrt_transitive_provider_${transitiveNamespaces.size}`,
|
|
888
928
|
providerPackageName,
|
|
889
|
-
importPath
|
|
929
|
+
importPath,
|
|
930
|
+
viteOnly: Boolean(providerPackageJson && isTypeScriptSource(importPath, path$1.dirname(providerPackageJson)))
|
|
890
931
|
};
|
|
891
932
|
transitiveNamespaces.set(namespaceKey, namespace);
|
|
892
933
|
}
|
|
@@ -978,7 +1019,8 @@ async function generateRegistrationFile(manifest, projectRoot) {
|
|
|
978
1019
|
const collectionBinding = hasCollection && collectionExportName ? appResolvable ? getImportBinding(importPath, collectionExportName) : getTransitiveBinding(importPath, providerPackageName, collectionExportName) : void 0;
|
|
979
1020
|
if (!appResolvable && collectionBinding) transitiveCollectionChecks.push({
|
|
980
1021
|
collectionBinding,
|
|
981
|
-
itemBinding: exportBinding
|
|
1022
|
+
itemBinding: exportBinding,
|
|
1023
|
+
viteOnly: transitiveNamespaces.get(`${providerPackageName}\0${importPath}`)?.viteOnly ?? false
|
|
982
1024
|
});
|
|
983
1025
|
importedEntryCount++;
|
|
984
1026
|
if (isCollectionClass(def)) {
|
|
@@ -1004,6 +1046,7 @@ async function generateRegistrationFile(manifest, projectRoot) {
|
|
|
1004
1046
|
const contextImport = resolveProviderContextImport(packageName, readInstalledPackageJson(findInstalledPackageJson(packageName, projectRoot)));
|
|
1005
1047
|
if (!contextImport || importsByPath.has(contextImport)) continue;
|
|
1006
1048
|
importsByPath.set(contextImport, /* @__PURE__ */ new Map());
|
|
1049
|
+
markViteOnlyImport(contextImport);
|
|
1007
1050
|
}
|
|
1008
1051
|
if (importedEntryCount === 0) {
|
|
1009
1052
|
console.log("[smrt:consumer] No external entries - skipping register.js");
|
|
@@ -1011,12 +1054,25 @@ async function generateRegistrationFile(manifest, projectRoot) {
|
|
|
1011
1054
|
}
|
|
1012
1055
|
const registeredObjectLabel = registeredObjectCount === 1 ? "object" : "objects";
|
|
1013
1056
|
const sortedImports = Array.from(importsByPath.entries()).sort(([left], [right]) => left.localeCompare(right));
|
|
1014
|
-
const imports = sortedImports.
|
|
1057
|
+
const imports = sortedImports.flatMap(([importPath], index) => viteOnlyImportPaths.has(importPath) ? [] : [`import * as __smrt_provider_${index} from '${importPath}';`]);
|
|
1058
|
+
const viteOnlyImports = sortedImports.flatMap(([importPath], index) => viteOnlyImportPaths.has(importPath) ? [`const __smrt_provider_${index} = SMRT_VITE_RUNTIME ? await import(${JSON.stringify(importPath)}) : {};`] : []);
|
|
1059
|
+
const viteOnlyModules = [...viteOnlyImportPaths, ...Array.from(transitiveNamespaces.values()).filter(({ viteOnly }) => viteOnly).map(({ importPath }) => importPath)].sort((left, right) => left.localeCompare(right));
|
|
1060
|
+
const uniqueViteOnlyModules = [...new Set(viteOnlyModules)];
|
|
1061
|
+
if (uniqueViteOnlyModules.length > 0) console.warn(`[smrt:consumer] ${uniqueViteOnlyModules.join(", ")} resolve${uniqueViteOnlyModules.length === 1 ? "s" : ""} to TypeScript source; .smrt/register.js imports ${uniqueViteOnlyModules.length === 1 ? "it" : "them"} only under Vite. Plain Node (smrt db:migrate, CLIs) keeps their manifests but does not register their constructors; the compiled worker artifact (.smrt/runtime/register.js) still imports them and cannot start under plain Node. Publish a compiled JavaScript export to register them outside Vite (#3092).`);
|
|
1062
|
+
const viteRuntimePrelude = uniqueViteOnlyModules.length > 0 ? `const SMRT_VITE_RUNTIME = Boolean(import.meta.env);
|
|
1063
|
+
if (!SMRT_VITE_RUNTIME) {
|
|
1064
|
+
console.warn(${JSON.stringify(`[smrt:register] Skipped TypeScript-source modules under plain Node: ${uniqueViteOnlyModules.join(", ")}. Their manifests remain available; their constructors are registered only under Vite (#3092).`)});
|
|
1065
|
+
}
|
|
1066
|
+
` : "";
|
|
1015
1067
|
const importDeclarations = sortedImports.flatMap(([, specifiers], index) => Array.from(specifiers.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([exportName, binding]) => `const ${binding} = getSmrtExport(__smrt_provider_${index}, ${JSON.stringify(exportName)});`));
|
|
1016
|
-
const transitiveNamespaceDeclarations = Array.from(transitiveNamespaces.values()).sort((left, right) => left.binding.localeCompare(right.binding)).map(({ binding, providerPackageName, importPath }) =>
|
|
1068
|
+
const transitiveNamespaceDeclarations = Array.from(transitiveNamespaces.values()).sort((left, right) => left.binding.localeCompare(right.binding)).map(({ binding, providerPackageName, importPath, viteOnly }) => {
|
|
1069
|
+
const load = `await importSmrtDependency(${JSON.stringify(importPath)}, ${JSON.stringify(providerPackageName)})`;
|
|
1070
|
+
return viteOnly ? `const ${binding} = SMRT_VITE_RUNTIME ? ${load} : {};` : `const ${binding} = ${load};`;
|
|
1071
|
+
});
|
|
1072
|
+
const viteOnlyNamespaceBindings = new Set(Array.from(transitiveNamespaces.values()).filter(({ viteOnly }) => viteOnly).map(({ binding }) => binding));
|
|
1017
1073
|
const transitiveDeclarations = Array.from(transitiveBindings.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([, { binding, namespaceBinding, exportName }]) => `const ${binding} = getSmrtExport(${namespaceBinding}, ${JSON.stringify(exportName)});
|
|
1018
|
-
if (!${binding}) throw new Error(${JSON.stringify(`[smrt:consumer] Provider-owned module did not export ${exportName}`)});`);
|
|
1019
|
-
const transitiveCollectionDeclarations = transitiveCollectionChecks.map(({ collectionBinding, itemBinding }) => `if (${collectionBinding}._itemClass !== ${itemBinding}) throw new Error('[smrt:consumer] Provider-owned collection does not match its item constructor');`);
|
|
1074
|
+
if (${viteOnlyNamespaceBindings.has(namespaceBinding) ? "SMRT_VITE_RUNTIME && " : ""}!${binding}) throw new Error(${JSON.stringify(`[smrt:consumer] Provider-owned module did not export ${exportName}`)});`);
|
|
1075
|
+
const transitiveCollectionDeclarations = transitiveCollectionChecks.map(({ collectionBinding, itemBinding, viteOnly }) => `if (${viteOnly ? "SMRT_VITE_RUNTIME && " : ""}${collectionBinding}._itemClass !== ${itemBinding}) throw new Error('[smrt:consumer] Provider-owned collection does not match its item constructor');`);
|
|
1020
1076
|
const registrationManifestLiteral = JSON.stringify(JSON.stringify(registrationManifests));
|
|
1021
1077
|
const content = `/**
|
|
1022
1078
|
* Auto-generated by @happyvertical/smrt-core/consumer-plugin
|
|
@@ -1058,6 +1114,7 @@ const importSmrtDependency = async (specifier, providerPackageName) => {
|
|
|
1058
1114
|
}
|
|
1059
1115
|
};
|
|
1060
1116
|
` : ""}
|
|
1117
|
+
${viteRuntimePrelude}${viteOnlyImports.join("\n")}
|
|
1061
1118
|
${transitiveNamespaceDeclarations.join("\n")}
|
|
1062
1119
|
${importDeclarations.join("\n")}
|
|
1063
1120
|
${transitiveDeclarations.join("\n")}
|
|
@@ -1142,10 +1199,9 @@ export default createMCPServer;
|
|
|
1142
1199
|
`;
|
|
1143
1200
|
}
|
|
1144
1201
|
function generateFallbackTypesModule(manifest) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
return `export interface ${obj.className}Data {
|
|
1202
|
+
if (Object.entries(manifest?.objects || {}).length === 0) return `// No types available`;
|
|
1203
|
+
return selectObjectDeclarations(manifest).map(({ interfaceName }) => {
|
|
1204
|
+
return `export interface ${interfaceName} {
|
|
1149
1205
|
id?: string;
|
|
1150
1206
|
created_at?: string;
|
|
1151
1207
|
updated_at?: string;
|
|
@@ -1161,6 +1217,6 @@ export default manifest;
|
|
|
1161
1217
|
`;
|
|
1162
1218
|
}
|
|
1163
1219
|
//#endregion
|
|
1164
|
-
export { isComponentBearingRoot, loadVerifiedSmrtGenerationSnapshot, resolveProviderContextImport, serializeSmrtGenerationSnapshot, sha256SmrtGenerationSnapshot, smrtConsumer };
|
|
1220
|
+
export { isComponentBearingRoot, loadVerifiedSmrtGenerationSnapshot, resolveProviderContextImport, resolvesToTypeScriptSource, serializeSmrtGenerationSnapshot, sha256SmrtGenerationSnapshot, smrtConsumer };
|
|
1165
1221
|
|
|
1166
1222
|
//# sourceMappingURL=index.js.map
|