cabloy 5.1.219 → 5.1.221
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/.cabloy-version +1 -1
- package/.github/workflows/agent-governance.yml +2 -2
- package/.github/workflows/create-cabloy.yml +3 -3
- package/.github/workflows/docs-pages.yml +2 -2
- package/.github/workflows/playwright-e2e.yml +4 -4
- package/.github/workflows/vona-cov-pg.yml +2 -2
- package/.github/workflows/vona-test-crud.yml +2 -2
- package/.github/workflows/vona-test-mysql.yml +2 -2
- package/.github/workflows/vona-test-pg.yml +2 -2
- package/.github/workflows/vona-test-sqlite3.yml +2 -2
- package/.github/workflows/vona-tsc.yml +2 -2
- package/.github/workflows/zova-ui.yml +2 -2
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/package.json +4 -3
- package/repo-docs/frontend/openapi-sdk-guide.md +2 -0
- package/repo-docs/fullstack/quickstart.md +3 -3
- package/repo-docs/reference/repo-scripts.md +16 -0
- package/scripts/generateOpenapiIsolated.test.ts +25 -0
- package/scripts/generateOpenapiIsolated.ts +46 -12
- package/scripts/runIsolatedTest.test.ts +165 -45
- package/scripts/runIsolatedTest.ts +111 -24
- package/scripts/strictGenerationDiagnostics.test.ts +1009 -0
- package/scripts/strictGenerationDiagnostics.ts +61 -0
- package/scripts/strictGenerationStartup.test.ts +212 -0
- package/vona/package.original.json +3 -2
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.bin.dev.ts +14 -4
- package/vona/packages-cli/cli-set-api/src/lib/bean/toolsBin/generateEntryFiles.ts +6 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/toolsBin/generateVonaMeta.ts +2 -10
- package/vona/packages-cli/cli-set-api/src/lib/bean/toolsBin/validateGenerationPaths.ts +27 -0
- package/vona/packages-cli/cli-set-api/test/binDevLifecycle.test.ts +1 -1
- package/vona/packages-cli/cli-set-api/test/strictGenerationPrivacy.test.ts +439 -0
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-core/src/lib/bean/beanBase.ts +4 -0
- package/vona/packages-vona/vona-core/src/lib/core/asyncLocalStorage.ts +84 -12
- package/vona/packages-vona/vona-core/src/lib/core/index.ts +14 -0
- package/vona/packages-vona/vona-core/src/lib/core/logger/appLogger.ts +19 -3
- package/vona/packages-vona/vona-core/src/lib/core/logger/diagnosticLogger.test.ts +346 -0
- package/vona/packages-vona/vona-core/src/lib/core/logger/diagnosticLogger.ts +138 -0
- package/vona/packages-vona/vona-core/src/lib/core/logger/index.ts +1 -0
- package/vona/packages-vona/vona-core/src/lib/core/logger/utils.ts +25 -5
- package/vona/packages-vona/vona-core/src/lib/core/requestBoundary.ts +89 -0
- package/vona/packages-vona/vona-core/src/lib/core/testFreshness.test.ts +379 -0
- package/vona/packages-vona/vona-core/src/lib/core/testFreshness.ts +232 -0
- package/vona/packages-vona/vona-core/src/lib/core/testStrictMode.ts +9 -0
- package/vona/packages-vona/vona-core/src/lib/framework/start.test.ts +4 -3
- package/vona/packages-vona/vona-core/src/lib/framework/start.ts +2 -0
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +691 -356
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-executor/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-executor/src/bean/bean.executor.ts +111 -60
- package/vona/src/suite-vendor/a-vona/modules/a-executor/src/service/executor.ts +6 -6
- package/vona/src/suite-vendor/a-vona/modules/a-executor/src/types/executor.ts +13 -1
- package/vona/src/suite-vendor/a-vona/modules/a-jwt/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-jwt/src/lib/jwtClientLogging.test.ts +182 -0
- package/vona/src/suite-vendor/a-vona/modules/a-jwt/src/service/jwtClient.ts +2 -8
- package/vona/src/suite-vendor/a-vona/modules/a-logger/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-logger/src/bean/aopMethod.log.ts +4 -1
- package/vona/src/suite-vendor/a-vona/modules/a-logger/src/bean/bean.logger.ts +9 -0
- package/vona/src/suite-vendor/a-vona/modules/a-logger/src/bean/middlewareSystem.httpLog.ts +27 -14
- package/vona/src/suite-vendor/a-vona/modules/a-logger/src/lib/redactHttpLog.test.ts +207 -0
- package/vona/src/suite-vendor/a-vona/modules/a-logger/src/lib/redactHttpLog.ts +30 -0
- package/vona/src/suite-vendor/a-vona/modules/a-logger/test/middlewareSystem.httpLog.test.ts +33 -1
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/src/index.ts +11 -0
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/src/lib/protectedSqliteRegistry.ts +356 -0
- package/vona/src/suite-vendor/a-vona/modules/a-startup/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-startup/src/service/startup.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-startup/test/devSeed.test.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-telemetry/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-telemetry/src/bean/bean.telemetry.ts +8 -1
- package/vona/src/suite-vendor/a-vona/modules/a-telemetry/src/bean/middlewareSystem.trace.ts +9 -14
- package/vona/src/suite-vendor/a-vona/modules/a-telemetry/src/lib/spanDiagnostics.ts +70 -0
- package/vona/src/suite-vendor/a-vona/modules/a-telemetry/src/service/telemetry.ts +37 -23
- package/vona/src/suite-vendor/a-vona/modules/a-version/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-version/src/service/database.ts +31 -4
- package/vona/src/suite-vendor/a-vona/package.json +2 -2
- package/zova/package.original.json +3 -2
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/package.json +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.bin.buildRest.ts +11 -101
- package/zova/packages-cli/cli-set-front/src/lib/common/restDependencies.ts +78 -0
- package/zova/packages-cli/cli-set-front/src/lib/common/restDependencyVersions.ts +252 -0
- package/zova/packages-cli/cli-set-front/test/restDependencies.test.ts +568 -0
- package/zova/pnpm-lock.yaml +442 -564
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import fse from 'fs-extra';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import yaml from 'yaml';
|
|
4
|
+
|
|
5
|
+
const dependencySections = ['dependencies', 'devDependencies', 'optionalDependencies'] as const;
|
|
6
|
+
|
|
7
|
+
type ImporterDependency = {
|
|
8
|
+
specifier?: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type Importer = Partial<
|
|
13
|
+
Record<(typeof dependencySections)[number], Record<string, ImporterDependency>>
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
type ParsedLockfile = {
|
|
17
|
+
importers?: Record<string, Importer>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type ModuleCandidate = {
|
|
21
|
+
range: string;
|
|
22
|
+
moduleRoot: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export async function extractRestDependencyVersions(
|
|
26
|
+
projectPath: string,
|
|
27
|
+
deps: string[],
|
|
28
|
+
moduleRoots: string[] = [],
|
|
29
|
+
): Promise<Record<string, string>> {
|
|
30
|
+
const lockfilePath = path.join(projectPath, 'pnpm-lock.yaml');
|
|
31
|
+
const lockfileContent = await fse.readFile(lockfilePath, 'utf8');
|
|
32
|
+
const parsedLockfile = parseWorkspaceLockfile(lockfileContent);
|
|
33
|
+
const depsVersion: Record<string, string> = {};
|
|
34
|
+
|
|
35
|
+
for (const dep of deps) {
|
|
36
|
+
const rootRange = getPackageDependencyRangeFromLock(parsedLockfile, dep);
|
|
37
|
+
if (rootRange) {
|
|
38
|
+
depsVersion[dep] = rootRange;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const moduleCandidates = await getModuleCandidates(
|
|
43
|
+
projectPath,
|
|
44
|
+
parsedLockfile,
|
|
45
|
+
dep,
|
|
46
|
+
moduleRoots,
|
|
47
|
+
);
|
|
48
|
+
const distinctCandidates = getDistinctCandidates(moduleCandidates);
|
|
49
|
+
if (distinctCandidates.length > 1) {
|
|
50
|
+
throw createConflictingCandidatesError(dep, distinctCandidates);
|
|
51
|
+
}
|
|
52
|
+
if (distinctCandidates.length === 1) {
|
|
53
|
+
depsVersion[dep] = distinctCandidates[0].range;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const rootVersion = await getPackageVersionFromNodeModules(projectPath, dep);
|
|
58
|
+
if (rootVersion) {
|
|
59
|
+
depsVersion[dep] = `^${rootVersion}`;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
throw createUnresolvedDependencyError(projectPath, dep, moduleRoots);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return depsVersion;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function parseWorkspaceLockfile(content: string): ParsedLockfile {
|
|
70
|
+
const documents = yaml.parseAllDocuments(content);
|
|
71
|
+
for (const document of documents) {
|
|
72
|
+
if (document.errors.length) throw document.errors[0];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// pnpm 12 places the workspace lock after its package-manager/config dependency lock.
|
|
76
|
+
const document = documents.findLast(({ contents }) => {
|
|
77
|
+
return (
|
|
78
|
+
contents !== null &&
|
|
79
|
+
!(yaml.isScalar(contents) && contents.value === null && contents.source === '')
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
if (!document || !yaml.isMap(document.contents) || !yaml.isMap(document.get('importers', true))) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
'Invalid pnpm-lock.yaml: expected a workspace document with an importers mapping.',
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return document.toJS() as ParsedLockfile;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function getPackageDependencyRangeFromLock(
|
|
91
|
+
parsedLockfile: ParsedLockfile,
|
|
92
|
+
packageName: string,
|
|
93
|
+
): string | null {
|
|
94
|
+
const importer = parsedLockfile.importers?.['.'];
|
|
95
|
+
return getImporterDependencyRange(importer, packageName);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getImporterDependencyRange(
|
|
99
|
+
importer: Importer | undefined,
|
|
100
|
+
packageName: string,
|
|
101
|
+
): string | null {
|
|
102
|
+
if (!importer) return null;
|
|
103
|
+
|
|
104
|
+
for (const section of dependencySections) {
|
|
105
|
+
const dependencyRange = normalizeImporterDependency(importer[section]?.[packageName]);
|
|
106
|
+
if (dependencyRange) return dependencyRange;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function normalizeImporterDependency(
|
|
112
|
+
importerDependency: ImporterDependency | undefined,
|
|
113
|
+
): string | null {
|
|
114
|
+
if (!importerDependency) return null;
|
|
115
|
+
|
|
116
|
+
const specifier = importerDependency.specifier;
|
|
117
|
+
if (specifier?.startsWith('npm:')) return specifier;
|
|
118
|
+
|
|
119
|
+
const version = normalizeLockfileVersion(importerDependency.version);
|
|
120
|
+
if (!version) return null;
|
|
121
|
+
return `^${version}`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function normalizeLockfileVersion(version: string | undefined): string | null {
|
|
125
|
+
if (!version) return null;
|
|
126
|
+
if (version.startsWith('link:') || version.startsWith('file:')) return null;
|
|
127
|
+
|
|
128
|
+
const versionWithoutPeers = version.split('(')[0];
|
|
129
|
+
if (!versionWithoutPeers) return null;
|
|
130
|
+
if (/^\d/.test(versionWithoutPeers)) return versionWithoutPeers;
|
|
131
|
+
|
|
132
|
+
const aliasSeparator = versionWithoutPeers.lastIndexOf('@');
|
|
133
|
+
if (aliasSeparator === -1) return null;
|
|
134
|
+
|
|
135
|
+
const aliasedVersion = versionWithoutPeers.slice(aliasSeparator + 1);
|
|
136
|
+
if (!aliasedVersion || !/^\d/.test(aliasedVersion)) return null;
|
|
137
|
+
return aliasedVersion;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function getModuleCandidates(
|
|
141
|
+
projectPath: string,
|
|
142
|
+
parsedLockfile: ParsedLockfile,
|
|
143
|
+
packageName: string,
|
|
144
|
+
moduleRoots: string[],
|
|
145
|
+
): Promise<ModuleCandidate[]> {
|
|
146
|
+
const candidates: ModuleCandidate[] = [];
|
|
147
|
+
for (const moduleRoot of moduleRoots) {
|
|
148
|
+
const absoluteModuleRoot = path.resolve(projectPath, moduleRoot);
|
|
149
|
+
if (absoluteModuleRoot === path.resolve(projectPath)) continue;
|
|
150
|
+
|
|
151
|
+
const importerKey = getImporterKey(projectPath, absoluteModuleRoot);
|
|
152
|
+
const importerRange = getImporterDependencyRange(
|
|
153
|
+
parsedLockfile.importers?.[importerKey],
|
|
154
|
+
packageName,
|
|
155
|
+
);
|
|
156
|
+
if (importerRange) {
|
|
157
|
+
candidates.push({ range: importerRange, moduleRoot: importerKey });
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const manifestSpecifier = await getManifestDependencySpecifier(absoluteModuleRoot, packageName);
|
|
162
|
+
if (!manifestSpecifier) continue;
|
|
163
|
+
|
|
164
|
+
const installedVersion = await getPackageVersionFromNodeModules(
|
|
165
|
+
absoluteModuleRoot,
|
|
166
|
+
packageName,
|
|
167
|
+
);
|
|
168
|
+
if (!installedVersion) continue;
|
|
169
|
+
candidates.push({
|
|
170
|
+
range: manifestSpecifier.startsWith('npm:') ? manifestSpecifier : `^${installedVersion}`,
|
|
171
|
+
moduleRoot: importerKey,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return candidates;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async function getManifestDependencySpecifier(
|
|
178
|
+
moduleRoot: string,
|
|
179
|
+
packageName: string,
|
|
180
|
+
): Promise<string | null> {
|
|
181
|
+
const manifestPath = path.join(moduleRoot, 'package.json');
|
|
182
|
+
if (!fse.existsSync(manifestPath)) return null;
|
|
183
|
+
|
|
184
|
+
const manifest = (await fse.readJson(manifestPath)) as Record<string, unknown>;
|
|
185
|
+
for (const section of dependencySections) {
|
|
186
|
+
const sectionDependencies = manifest[section];
|
|
187
|
+
if (!sectionDependencies || typeof sectionDependencies !== 'object') continue;
|
|
188
|
+
const specifier = (sectionDependencies as Record<string, unknown>)[packageName];
|
|
189
|
+
if (typeof specifier === 'string') return specifier;
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function getDistinctCandidates(candidates: ModuleCandidate[]): ModuleCandidate[] {
|
|
195
|
+
const distinctCandidates = new Map<string, ModuleCandidate>();
|
|
196
|
+
for (const candidate of candidates) {
|
|
197
|
+
if (!distinctCandidates.has(candidate.range)) {
|
|
198
|
+
distinctCandidates.set(candidate.range, candidate);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return Array.from(distinctCandidates.values());
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function getPackageVersionFromNodeModules(
|
|
205
|
+
packageRoot: string,
|
|
206
|
+
packageName: string,
|
|
207
|
+
): Promise<string | null> {
|
|
208
|
+
const pkgFile = path.join(packageRoot, 'node_modules', packageName, 'package.json');
|
|
209
|
+
if (!fse.existsSync(pkgFile)) return null;
|
|
210
|
+
const pkgContent = (await fse.readJson(pkgFile)) as Record<string, unknown>;
|
|
211
|
+
return typeof pkgContent.version === 'string' && pkgContent.version ? pkgContent.version : null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function getImporterKey(projectPath: string, moduleRoot: string): string {
|
|
215
|
+
const relativePath = path.relative(projectPath, moduleRoot);
|
|
216
|
+
return relativePath.replaceAll(path.sep, '/') || '.';
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function getRepoRelativePath(projectPath: string, filePath: string): string {
|
|
220
|
+
const relativePath = path.relative(projectPath, filePath).replaceAll(path.sep, '/');
|
|
221
|
+
return relativePath || '.';
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function createConflictingCandidatesError(
|
|
225
|
+
packageName: string,
|
|
226
|
+
candidates: ModuleCandidate[],
|
|
227
|
+
): Error {
|
|
228
|
+
const details = candidates
|
|
229
|
+
.map(candidate => `${candidate.moduleRoot} (${candidate.range})`)
|
|
230
|
+
.join(', ');
|
|
231
|
+
return new Error(
|
|
232
|
+
`Conflicting REST dependency versions for ${packageName} in module importers: ${details}. ` +
|
|
233
|
+
`Align the dependency versions or declare ${packageName} in the project root package.json ` +
|
|
234
|
+
'(pnpm-lock.yaml).',
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function createUnresolvedDependencyError(
|
|
239
|
+
projectPath: string,
|
|
240
|
+
packageName: string,
|
|
241
|
+
moduleRoots: string[],
|
|
242
|
+
): Error {
|
|
243
|
+
const checkedModuleRoots = moduleRoots.length
|
|
244
|
+
? moduleRoots
|
|
245
|
+
.map(moduleRoot => getRepoRelativePath(projectPath, path.resolve(projectPath, moduleRoot)))
|
|
246
|
+
.join(', ')
|
|
247
|
+
: '(none)';
|
|
248
|
+
return new Error(
|
|
249
|
+
`Unable to resolve REST dependency version for ${packageName}. Add it to the project or an owning ` +
|
|
250
|
+
`module and install it; checked module roots: ${checkedModuleRoots}; lockfile: pnpm-lock.yaml.`,
|
|
251
|
+
);
|
|
252
|
+
}
|