codify-plugin-lib 1.0.149 → 1.0.151

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.
@@ -121,12 +121,7 @@ export class Plugin {
121
121
  return !controller.parsedSettings.allowMultiple && v > 1;
122
122
  });
123
123
  if (invalidMultipleConfigs.length > 0) {
124
- validationResults.push(...invalidMultipleConfigs.map(([k, v]) => ({
125
- resourceType: k,
126
- schemaValidationErrors: [],
127
- customValidationErrorMessage: `Multiple of resource type: ${k} found in configs. Only allowed 1.`,
128
- isValid: false,
129
- })));
124
+ throw new Error(`Multiples of the following configs were found but only 1 is allowed. [${invalidMultipleConfigs.map(([k, v]) => `${v}x ${k}`).join(', ')}] found.`);
130
125
  }
131
126
  await this.crossValidateResources(data.configs);
132
127
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-plugin-lib",
3
- "version": "1.0.149",
3
+ "version": "1.0.151",
4
4
  "description": "Library plugin library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -482,13 +482,12 @@ describe('Plugin tests', () => {
482
482
 
483
483
  const testPlugin = Plugin.create('testPlugin', [resource as any]);
484
484
 
485
- const validate1 = await testPlugin.validate({
486
- configs: [{ core: { type: 'ssh-config' }, parameters: { propA: 'a' } }, {
487
- core: { type: 'ssh-config' },
488
- parameters: { propB: 'b' }
489
- }]
490
- })
491
-
492
- expect(validate1.resourceValidations.every((r) => r.isValid)).to.be.false;
485
+ await expect(() => testPlugin.validate({
486
+ configs: [{ core: { type: 'ssh-config' }, parameters: { propA: 'a' } }, {
487
+ core: { type: 'ssh-config' },
488
+ parameters: { propB: 'b' }
489
+ }]
490
+ })
491
+ ).rejects.toThrowError();
493
492
  })
494
493
  });
@@ -178,12 +178,8 @@ export class Plugin {
178
178
  });
179
179
 
180
180
  if (invalidMultipleConfigs.length > 0) {
181
- validationResults.push(...invalidMultipleConfigs.map(([k, v]) => ({
182
- resourceType: k,
183
- schemaValidationErrors: [],
184
- customValidationErrorMessage: `Multiple of resource type: ${k} found in configs. Only allowed 1.`,
185
- isValid: false,
186
- })));
181
+ throw new Error(
182
+ `Multiples of the following configs were found but only 1 is allowed. [${invalidMultipleConfigs.map(([k, v]) => `${v}x ${k}`).join(', ')}] found.`)
187
183
  }
188
184
 
189
185
  await this.crossValidateResources(data.configs);