@happyvertical/smrt-core 0.40.31 → 0.40.32
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/dist/browser.js +2 -2
- package/dist/consumer-plugin/index.d.ts +5 -0
- package/dist/consumer-plugin/index.d.ts.map +1 -1
- package/dist/consumer-plugin/index.js +6 -38
- package/dist/consumer-plugin/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/manifest/static-manifest.js +2 -2
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest/test-manifest-stub.js +2 -2
- package/dist/manifest/test-manifest-stub.js.map +1 -1
- package/dist/manifest.json +2 -2
- package/dist/prebuild/index.d.ts.map +1 -1
- package/dist/prebuild/index.js +10 -4
- package/dist/prebuild/index.js.map +1 -1
- package/dist/smrt-knowledge.json +4 -4
- package/dist/system/compatibility.d.ts +12 -0
- package/dist/system/compatibility.d.ts.map +1 -1
- package/dist/system/compatibility.js +51 -2
- package/dist/system/compatibility.js.map +1 -1
- package/dist/system/index.js +2 -2
- package/dist/vite-plugin/api-client-entries.d.ts +17 -0
- package/dist/vite-plugin/api-client-entries.d.ts.map +1 -1
- package/dist/vite-plugin/api-client-entries.js +116 -23
- package/dist/vite-plugin/api-client-entries.js.map +1 -1
- package/dist/vite-plugin/generated-client.d.ts +7 -0
- package/dist/vite-plugin/generated-client.d.ts.map +1 -0
- package/dist/vite-plugin/generated-client.js +134 -0
- package/dist/vite-plugin/generated-client.js.map +1 -0
- package/dist/vite-plugin/index.d.ts +5 -0
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +19 -151
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.d.ts +1 -1
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +12 -12
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/dist/vite-plugin/sync-apply-route.d.ts.map +1 -1
- package/dist/vite-plugin/sync-apply-route.js +2 -5
- package/dist/vite-plugin/sync-apply-route.js.map +1 -1
- package/dist/vite-plugin/web-collections.d.ts +2 -0
- package/dist/vite-plugin/web-collections.d.ts.map +1 -1
- package/dist/vite-plugin/web-collections.js +62 -3
- package/dist/vite-plugin/web-collections.js.map +1 -1
- package/dist/vite-plugin.js +2 -2
- package/package.json +4 -4
|
@@ -3,7 +3,7 @@ import { AUTO_GENERATED_ROUTE_HEADER } from "./route-header.js";
|
|
|
3
3
|
import { generateChangesRoute } from "./changes-route.js";
|
|
4
4
|
import { generateEventsRoute } from "./events-route.js";
|
|
5
5
|
import { generateSyncApplyRoute } from "./sync-apply-route.js";
|
|
6
|
-
import { computeWebManifestHash } from "./web-collections.js";
|
|
6
|
+
import { computeWebManifestHash, isCollectionManifestClass, resolveCollectionItemObject, resolveCollectionItemTypeName } from "./web-collections.js";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { join, relative } from "node:path";
|
|
9
9
|
//#region src/vite-plugin/sveltekit-generator.ts
|
|
@@ -611,9 +611,9 @@ function buildScopedOptionsForTenantRead(actionDef, routeConfig, tenantScoped) {
|
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
function findItemClassRegistryKey(className, objectDef, manifest) {
|
|
614
|
-
const
|
|
615
|
-
if (!
|
|
616
|
-
return Object.entries(manifest.objects).find(([
|
|
614
|
+
const itemObject = resolveCollectionItemObject(manifest, objectDef);
|
|
615
|
+
if (!itemObject) return resolveCollectionItemTypeName(manifest, objectDef) || className;
|
|
616
|
+
return Object.entries(manifest.objects).find(([, manifestObject]) => manifestObject === itemObject)?.[0] || itemObject.className;
|
|
617
617
|
}
|
|
618
618
|
function groupCustomActionRoutes(actionSpecs) {
|
|
619
619
|
const groupedRoutes = /* @__PURE__ */ new Map();
|
|
@@ -638,7 +638,7 @@ async function generateSvelteKitRoutes(projectRoot, manifest, options) {
|
|
|
638
638
|
let generatedCount = 0;
|
|
639
639
|
let skippedCollections = 0;
|
|
640
640
|
for (const [className, objectDef] of Object.entries(manifest.objects)) {
|
|
641
|
-
if (
|
|
641
|
+
if (isCollectionManifestClass(manifest, objectDef)) {
|
|
642
642
|
if (await generateCollectionRoutesForObject(projectRoot, className, objectDef, manifest, options)) generatedCount++;
|
|
643
643
|
else {
|
|
644
644
|
console.log(`[smrt] Skipping ${className} - no collection API routes to generate`);
|
|
@@ -715,7 +715,7 @@ async function generateRegistrationFile(projectRoot, manifest, options) {
|
|
|
715
715
|
classNames: [],
|
|
716
716
|
hasCollectionImport: false
|
|
717
717
|
};
|
|
718
|
-
if (
|
|
718
|
+
if (isCollectionManifestClass(manifest, objectDef)) packageEntry.hasCollectionImport = true;
|
|
719
719
|
else packageEntry.classNames.push(className);
|
|
720
720
|
packageObjects.set(objectDef.packageName, packageEntry);
|
|
721
721
|
} else localObjects.push([className, objectDef]);
|
|
@@ -728,7 +728,7 @@ async function generateRegistrationFile(projectRoot, manifest, options) {
|
|
|
728
728
|
const normalized = relative(configDir, objectDef.filePath).replace(/\\/g, "/").replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
729
729
|
importPath = normalized.startsWith(".") ? normalized : `./${normalized}`;
|
|
730
730
|
} else importPath = getSvelteKitImportPath(projectRoot, void 0, options.objectsDir, simpleClassName);
|
|
731
|
-
if (
|
|
731
|
+
if (isCollectionManifestClass(manifest, objectDef)) {
|
|
732
732
|
localSideEffectImports.add(importPath);
|
|
733
733
|
continue;
|
|
734
734
|
}
|
|
@@ -762,7 +762,7 @@ ${[Array.from(packageObjects.entries()).sort(([left], [right]) => left.localeCom
|
|
|
762
762
|
|
|
763
763
|
// Re-register imported objects with explicit package names for bundled runtimes
|
|
764
764
|
${Object.entries(manifest.objects).map(([className, objectDef]) => {
|
|
765
|
-
if (
|
|
765
|
+
if (isCollectionManifestClass(manifest, objectDef)) return null;
|
|
766
766
|
const simpleClassName = extractSimpleClassName(className);
|
|
767
767
|
const packageName = getRegistrationPackageName(manifest, objectDef, isLocalObject(projectRoot, objectDef));
|
|
768
768
|
if (!packageName) return null;
|
|
@@ -1052,11 +1052,11 @@ function shouldIncludeInApi(actionName, apiConfig) {
|
|
|
1052
1052
|
* to drive route generation, exposed so coherence checks (e.g. CLI vs API)
|
|
1053
1053
|
* can ask "what does the API expose?" without re-implementing the logic.
|
|
1054
1054
|
*/
|
|
1055
|
-
function resolveApiActionSet(objectDef) {
|
|
1055
|
+
function resolveApiActionSet(objectDef, manifest) {
|
|
1056
1056
|
const apiConfig = objectDef.decoratorConfig?.api;
|
|
1057
1057
|
if (apiConfig === false) return /* @__PURE__ */ new Set();
|
|
1058
|
-
const
|
|
1059
|
-
const
|
|
1058
|
+
const objectIsCollectionClass = manifest ? isCollectionManifestClass(manifest, objectDef) : isCollectionClass(objectDef);
|
|
1059
|
+
const actions = objectIsCollectionClass ? /* @__PURE__ */ new Set() : new Set(resolveStandardCrudActions(apiConfig));
|
|
1060
1060
|
const config = getApiConfigObject(apiConfig);
|
|
1061
1061
|
for (const [name, method] of Object.entries(objectDef.methods || {})) {
|
|
1062
1062
|
if (STANDARD_API_ACTIONS.includes(name)) continue;
|
|
@@ -1090,7 +1090,7 @@ function findCliApiCoherenceViolations(manifest) {
|
|
|
1090
1090
|
const cliExclude = Array.isArray(cliConfig.exclude) ? cliConfig.exclude : [];
|
|
1091
1091
|
const effectiveCliCommands = cliConfig.include.filter((cmd) => !cliExclude.includes(cmd));
|
|
1092
1092
|
if (effectiveCliCommands.length === 0) continue;
|
|
1093
|
-
const apiActionSet = resolveApiActionSet(objectDef);
|
|
1093
|
+
const apiActionSet = resolveApiActionSet(objectDef, manifest);
|
|
1094
1094
|
const unreachable = effectiveCliCommands.filter((action) => !apiActionSet.has(action));
|
|
1095
1095
|
if (unreachable.length > 0) violations.push({
|
|
1096
1096
|
className,
|