@onlineapps/conn-orch-validator 3.2.0 → 3.2.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.
- package/package.json +1 -1
- package/src/CookbookTestRunner.js +18 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/conn-orch-validator",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Validation orchestrator for OA Drive microservices - coordinates validation across all layers (base, infra, orch, business)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -185,11 +185,17 @@ class CookbookTestRunner {
|
|
|
185
185
|
// { modulePath, exportName } (v3 handler dispatch is the only mode).
|
|
186
186
|
const spec = await this.resolveOperation(step.service, step.operation);
|
|
187
187
|
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
if (!
|
|
188
|
+
const rawTenantId = process.env.OA_VALIDATION_TENANT_ID;
|
|
189
|
+
const rawWorkspaceId = process.env.OA_VALIDATION_WORKSPACE_ID;
|
|
190
|
+
if (!rawTenantId || !rawWorkspaceId) {
|
|
191
191
|
throw new Error('[CookbookTestRunner] Missing required environment variables OA_VALIDATION_TENANT_ID and/or OA_VALIDATION_WORKSPACE_ID');
|
|
192
192
|
}
|
|
193
|
+
// Coerce numeric env vars to integers so ctx matches production
|
|
194
|
+
// ContextBuilder (which receives already-typed values from the MQ envelope).
|
|
195
|
+
// Handlers that check `Number.isInteger(ctx.tenant_id)` would otherwise
|
|
196
|
+
// reject the string form and every workspace-scoped cookbook would fail.
|
|
197
|
+
const validationTenantId = /^\d+$/.test(rawTenantId) ? parseInt(rawTenantId, 10) : rawTenantId;
|
|
198
|
+
const validationWorkspaceId = /^\d+$/.test(rawWorkspaceId) ? parseInt(rawWorkspaceId, 10) : rawWorkspaceId;
|
|
193
199
|
|
|
194
200
|
await this._dispatchViaHandler({
|
|
195
201
|
step,
|
|
@@ -404,9 +410,16 @@ class CookbookTestRunner {
|
|
|
404
410
|
continue;
|
|
405
411
|
}
|
|
406
412
|
|
|
407
|
-
// Type check
|
|
413
|
+
// Type check — recognise arrays as 'array' (not 'object') and null as 'null'.
|
|
408
414
|
if (expectation.type) {
|
|
409
|
-
|
|
415
|
+
let actualType;
|
|
416
|
+
if (Array.isArray(actualValue)) {
|
|
417
|
+
actualType = 'array';
|
|
418
|
+
} else if (actualValue === null) {
|
|
419
|
+
actualType = 'null';
|
|
420
|
+
} else {
|
|
421
|
+
actualType = typeof actualValue;
|
|
422
|
+
}
|
|
410
423
|
if (actualType !== expectation.type) {
|
|
411
424
|
errors.push(`Field ${field}: expected type ${expectation.type}, got ${actualType}`);
|
|
412
425
|
}
|