@futdevpro/nts-dynamo 1.15.133 → 1.15.134
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/.dynamo/logs/cicd-pipeline/output.log +1960 -1864
- package/.dynamo/logs/cicd-pipeline/status.json +27 -27
- package/build/_modules/usage/usage.controller.d.ts.map +1 -1
- package/build/_modules/usage/usage.controller.js +14 -4
- package/build/_modules/usage/usage.controller.js.map +1 -1
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +4 -1
- package/build/_services/base/data.service.js.map +1 -1
- package/package.json +2 -2
- package/src/_modules/usage/usage.controller.spec.ts +25 -0
- package/src/_modules/usage/usage.controller.ts +37 -23
- package/src/_services/base/data.service.spec.ts +55 -0
- package/src/_services/base/data.service.ts +4 -1
|
@@ -725,5 +725,60 @@ describe('| DyNTS_DataService', () => {
|
|
|
725
725
|
expect(r.changedFields).toEqual(['email']);
|
|
726
726
|
});
|
|
727
727
|
});
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* BFR-FDPTOKENSERVICE-011 — a validátor tömb-ága: egy OPCIONÁLIS `X[]`+`subObjectParams` mező
|
|
731
|
+
* `undefined` értéke (a normál „még nincs elem" eset) NEM szállhat el `forEach`-TypeError-ral.
|
|
732
|
+
* A required-hiányt a VP8-ág fogja — az `Array.isArray` őr nem gyengít semmit.
|
|
733
|
+
*/
|
|
734
|
+
describe('| validateForSave — opcionális tömb-mező subObjectParams-szal (BFR-FDPTOKENSERVICE-011)', (): void => {
|
|
735
|
+
class WithOptArr extends DyFM_Metadata {
|
|
736
|
+
name?: string;
|
|
737
|
+
invoices?: { num?: string }[];
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const buildParams = (required: boolean): DyFM_DataModel_Params<WithOptArr> =>
|
|
741
|
+
new DyFM_DataModel_Params<WithOptArr>({
|
|
742
|
+
dataName: 'with_opt_arr',
|
|
743
|
+
properties: {
|
|
744
|
+
invoices: {
|
|
745
|
+
key: 'invoices',
|
|
746
|
+
type: DyFM_BasicProperty_Type.array,
|
|
747
|
+
required: required,
|
|
748
|
+
subObjectParams: {
|
|
749
|
+
num: { key: 'num', type: DyFM_BasicProperty_Type.string, required: true },
|
|
750
|
+
},
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
it('| undefined opcionális tömb → NEM dob (a mentés nem bukhat a hiányzó elemeken)', async (): Promise<void> => {
|
|
756
|
+
const optSvc = new DyNTS_DataService<WithOptArr>(
|
|
757
|
+
Object.assign(new WithOptArr(), { name: 'x' }), buildParams(false), 'test-issuer',
|
|
758
|
+
);
|
|
759
|
+
await expectAsync(optSvc.validateForSave()).toBeResolved();
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
it('| tényleges tömbnél a sub-validáció VÁLTOZATLANUL fut (required sub-mező hiánya → 400)', async (): Promise<void> => {
|
|
763
|
+
const optSvc = new DyNTS_DataService<WithOptArr>(
|
|
764
|
+
Object.assign(new WithOptArr(), { name: 'x', invoices: [ {} ] }), buildParams(false), 'test-issuer',
|
|
765
|
+
);
|
|
766
|
+
let thrown: any = null;
|
|
767
|
+
try { await optSvc.validateForSave(); } catch (e) { thrown = e; }
|
|
768
|
+
expect(thrown).not.toBeNull();
|
|
769
|
+
expect(DyFM_Error.getErrorStatus(thrown)).toBe(400);
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
it('| required tömb hiánya továbbra is validációs 400 (az őr nem gyengít; hiányra a VP1 required-ág fut)', async (): Promise<void> => {
|
|
773
|
+
const reqSvc = new DyNTS_DataService<WithOptArr>(
|
|
774
|
+
Object.assign(new WithOptArr(), { name: 'x' }), buildParams(true), 'test-issuer',
|
|
775
|
+
);
|
|
776
|
+
let thrown: any = null;
|
|
777
|
+
try { await reqSvc.validateForSave(); } catch (e) { thrown = e; }
|
|
778
|
+
expect(thrown).not.toBeNull();
|
|
779
|
+
expect(DyFM_Error.getErrorStatus(thrown)).toBe(400);
|
|
780
|
+
expect(DyFM_Error.getErrorCode(thrown)).toContain('DyNTS-DS0-VP');
|
|
781
|
+
});
|
|
782
|
+
});
|
|
728
783
|
});
|
|
729
784
|
|
|
@@ -1695,7 +1695,10 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1695
1695
|
});
|
|
1696
1696
|
}
|
|
1697
1697
|
|
|
1698
|
-
|
|
1698
|
+
// BFR-FDPTOKENSERVICE-011: csak TÉNYLEGES tömbnél szállunk le a sub-objektumokba — egy
|
|
1699
|
+
// OPCIONÁLIS `X[]` mező `undefined` értéke (a normál „még nincs elem" eset) nem dönthet
|
|
1700
|
+
// `forEach`-TypeError-ba; a required-hiányt a fenti VP8-ág fogja, ez az őr nem gyengít.
|
|
1701
|
+
if (propertyParams.subObjectParams && Array.isArray(propertyValue)) {
|
|
1699
1702
|
propertyValue.forEach((item: any): void => {
|
|
1700
1703
|
this.validateDataByPropertyParams(item, propertyParams.subObjectParams, propertyParams);
|
|
1701
1704
|
});
|