@zintrust/core 0.4.11 → 0.4.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/core",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "Production-grade TypeScript backend framework for JavaScript",
5
5
  "homepage": "https://zintrust.com",
6
6
  "repository": {
@@ -1 +1 @@
1
- {"version":3,"file":"registerRoute.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/registerRoute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAW3D,eAAO,MAAM,kBAAkB,QAAO,OAKrC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,CAAC,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAMpF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,CAAC,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAOrF,CAAC;AA0FF,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,MAAM,EACxB,QAAQ,OAAO,KACd,OAAO,CAAC,IAAI,CAoBd,CAAC"}
1
+ {"version":3,"file":"registerRoute.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/registerRoute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAW3D,eAAO,MAAM,kBAAkB,QAAO,OAKrC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,CAAC,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAMpF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,CAAC,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAOrF,CAAC;AA4FF,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,MAAM,EACxB,QAAQ,OAAO,KACd,OAAO,CAAC,IAAI,CAoBd,CAAC"}
@@ -64,6 +64,7 @@ const registerAppRoutes = async (resolvedBasePath, router) => {
64
64
  }
65
65
  };
66
66
  const registerManifestRoutes = async (router) => {
67
+ await ProjectRuntime.tryLoadNodeRuntime();
67
68
  const serviceManifest = ProjectRuntime.getServiceManifest();
68
69
  if (serviceManifest.length === 0)
69
70
  return;
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @zintrust/core v0.4.11
2
+ * @zintrust/core v0.4.12
3
3
  *
4
4
  * ZinTrust Framework - Production-Grade TypeScript Backend
5
5
  * Built for performance, type safety, and exceptional developer experience
6
6
  *
7
7
  * Build Information:
8
- * Built: 2026-03-23T13:29:47.237Z
8
+ * Built: 2026-03-23T13:57:31.438Z
9
9
  * Node: >=20.0.0
10
10
  * License: MIT
11
11
  *
@@ -21,7 +21,7 @@
21
21
  * Available at runtime for debugging and health checks
22
22
  */
23
23
  export const ZINTRUST_VERSION = '0.1.41';
24
- export const ZINTRUST_BUILD_DATE = '2026-03-23T13:29:47.153Z'; // Replaced during build
24
+ export const ZINTRUST_BUILD_DATE = '2026-03-23T13:57:31.366Z'; // Replaced during build
25
25
  export { Application } from './boot/Application.js';
26
26
  export { AwsSigV4 } from './common/index.js';
27
27
  export { SignedRequest } from './security/SignedRequest.js';
@@ -1 +1 @@
1
- {"version":3,"file":"PluginAutoImports.d.ts","sourceRoot":"","sources":["../../../src/runtime/PluginAutoImports.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,KAAK,YAAY,GACb;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAChC;IACE,EAAE,EAAE,KAAK,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,eAAe,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAuJN,eAAO,MAAM,iBAAiB;uCACY,uBAAuB,GAAY,OAAO,CAAC,YAAY,CAAC;IAkBhG;;;;;;OAMG;mCACkC,OAAO,CAAC,YAAY,CAAC;qCAkEnB,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;EAavE,CAAC"}
1
+ {"version":3,"file":"PluginAutoImports.d.ts","sourceRoot":"","sources":["../../../src/runtime/PluginAutoImports.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,KAAK,YAAY,GACb;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAChC;IACE,EAAE,EAAE,KAAK,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,eAAe,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AA6MN,eAAO,MAAM,iBAAiB;uCACY,uBAAuB,GAAY,OAAO,CAAC,YAAY,CAAC;IAkBhG;;;;;;OAMG;mCACkC,OAAO,CAAC,YAAY,CAAC;qCAkEnB,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;EAavE,CAAC"}
@@ -94,6 +94,47 @@ const resolveLocalPackageSpecifier = (specifier) => {
94
94
  return null;
95
95
  return pathToFileURL(resolved).href;
96
96
  };
97
+ const isMissingPackageImport = (error, specifier) => {
98
+ if (specifier.startsWith('.'))
99
+ return false;
100
+ if (error === null || typeof error !== 'object')
101
+ return false;
102
+ const maybe = error;
103
+ const message = typeof maybe.message === 'string' ? maybe.message : '';
104
+ if (maybe.code === 'ERR_MODULE_NOT_FOUND' && message.length === 0)
105
+ return true;
106
+ if (maybe.code === 'ERR_MODULE_NOT_FOUND' && message.includes(specifier))
107
+ return true;
108
+ return (message.includes(`Cannot find package '${specifier}'`) ||
109
+ message.includes(`Cannot find module '${specifier}'`));
110
+ };
111
+ const getMissingPackageStatus = (error, specifier) => {
112
+ if (isMissingPackageImport(error, specifier)) {
113
+ Logger.debug('[plugins] Optional auto-import package not installed', {
114
+ specifier,
115
+ });
116
+ return 'missing';
117
+ }
118
+ return 'failed';
119
+ };
120
+ const importFromLocalFallback = async (specifier, fallback) => {
121
+ try {
122
+ await import(fallback);
123
+ Logger.debug('[plugins] Loaded auto-import specifier from local fallback', {
124
+ specifier,
125
+ fallback,
126
+ });
127
+ return 'loaded';
128
+ }
129
+ catch (fallbackError) {
130
+ Logger.debug('[plugins] Failed auto-import local fallback', {
131
+ specifier,
132
+ fallback,
133
+ error: fallbackError instanceof Error ? fallbackError.message : String(fallbackError),
134
+ });
135
+ return getMissingPackageStatus(fallbackError, specifier);
136
+ }
137
+ };
97
138
  const importSingleSpecifier = async (entry) => {
98
139
  const target = entry.specifier.startsWith('.')
99
140
  ? resolveRelativeSpecifier(entry)
@@ -101,52 +142,48 @@ const importSingleSpecifier = async (entry) => {
101
142
  try {
102
143
  await import(target);
103
144
  Logger.debug('[plugins] Loaded auto-import specifier', { specifier: entry.specifier });
104
- return true;
145
+ return 'loaded';
105
146
  }
106
- catch {
147
+ catch (error) {
107
148
  const fallback = resolveLocalPackageSpecifier(entry.specifier);
108
- if (fallback !== null) {
109
- try {
110
- await import(fallback);
111
- Logger.debug('[plugins] Loaded auto-import specifier from local fallback', {
112
- specifier: entry.specifier,
113
- fallback,
114
- });
115
- return true;
116
- }
117
- catch (fallbackError) {
118
- Logger.debug('[plugins] Failed auto-import local fallback', {
119
- specifier: entry.specifier,
120
- fallback,
121
- error: fallbackError instanceof Error ? fallbackError.message : String(fallbackError),
122
- });
123
- }
124
- }
125
- return false;
149
+ if (fallback !== null)
150
+ return importFromLocalFallback(entry.specifier, fallback);
151
+ return getMissingPackageStatus(error, entry.specifier);
126
152
  }
127
153
  };
128
154
  const importSpecifiers = async (specifiers) => {
129
155
  // Import all specifiers in parallel
130
156
  const importPromises = Array.from(specifiers).map(async (entry) => {
131
- const success = await importSingleSpecifier(entry);
132
- return { specifier: entry.specifier, success };
157
+ const status = await importSingleSpecifier(entry);
158
+ return { specifier: entry.specifier, status };
133
159
  });
134
160
  const results = await Promise.allSettled(importPromises);
135
- // Count successful imports
136
- return results.filter((result) => result.status === 'fulfilled' && result.value.success).length;
161
+ return results.reduce((summary, result) => {
162
+ if (result.status !== 'fulfilled') {
163
+ summary.failed += 1;
164
+ return summary;
165
+ }
166
+ if (result.value.status === 'loaded')
167
+ summary.loaded += 1;
168
+ else if (result.value.status === 'missing')
169
+ summary.missing += 1;
170
+ else
171
+ summary.failed += 1;
172
+ return summary;
173
+ }, { loaded: 0, missing: 0, failed: 0 });
137
174
  };
138
175
  export const PluginAutoImports = Object.freeze({
139
176
  async tryImportRuntimeAutoImports(mode = 'base') {
140
177
  const specifiers = OfficialPlugins.getAutoImports(mode);
141
- const loaded = await importSpecifiers(specifiers.map((specifier) => ({ specifier, filePath: `official:${mode}` })));
142
- if (loaded === specifiers.length) {
178
+ const summary = await importSpecifiers(specifiers.map((specifier) => ({ specifier, filePath: `official:${mode}` })));
179
+ if (summary.failed === 0) {
143
180
  return { ok: true, loadedPath: `official:${mode}` };
144
181
  }
145
182
  return {
146
183
  ok: false,
147
184
  loadedPath: `official:${mode}`,
148
185
  reason: 'import-failed',
149
- errorMessage: `Loaded ${loaded}/${specifiers.length} official plugin imports`,
186
+ errorMessage: `Loaded ${summary.loaded}/${specifiers.length} official plugin imports`,
150
187
  };
151
188
  },
152
189
  /**
@@ -209,8 +246,8 @@ export const PluginAutoImports = Object.freeze({
209
246
  if (specifiers.length === 0) {
210
247
  return { ok: false, reason: 'import-failed', errorMessage: 'No import specifiers found' };
211
248
  }
212
- const loaded = await importSpecifiers(specifiers);
213
- if (loaded > 0) {
249
+ const summary = await importSpecifiers(specifiers);
250
+ if (summary.loaded > 0) {
214
251
  return { ok: true, loadedPath: 'manual-imports' };
215
252
  }
216
253
  return { ok: false, reason: 'import-failed', errorMessage: 'All specifier imports failed' };