codify-plugin-lib 1.0.45 → 1.0.46
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/dist/entities/plugin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Plan } from './plan.js';
|
|
2
|
+
import { splitUserConfig } from '../utils/utils.js';
|
|
2
3
|
export class Plugin {
|
|
3
4
|
resources;
|
|
4
5
|
planStorage;
|
|
@@ -24,7 +25,8 @@ export class Plugin {
|
|
|
24
25
|
if (!this.resources.has(config.type)) {
|
|
25
26
|
throw new Error(`Resource type not found: ${config.type}`);
|
|
26
27
|
}
|
|
27
|
-
const
|
|
28
|
+
const { parameters } = splitUserConfig(config);
|
|
29
|
+
const validateResult = await this.resources.get(config.type).validate(parameters);
|
|
28
30
|
validationResults.push({
|
|
29
31
|
...validateResult,
|
|
30
32
|
resourceType: config.type,
|
|
@@ -19,7 +19,7 @@ export declare abstract class Resource<T extends StringIndexedObject> {
|
|
|
19
19
|
private generateParameterConfigurations;
|
|
20
20
|
private validateResourceConfiguration;
|
|
21
21
|
private validateRefreshResults;
|
|
22
|
-
abstract validate(
|
|
22
|
+
abstract validate(parameters: unknown): Promise<ValidationResult>;
|
|
23
23
|
abstract refresh(keys: Set<keyof T>): Promise<Partial<T> | null>;
|
|
24
24
|
abstract applyCreate(plan: Plan<T>): Promise<void>;
|
|
25
25
|
applyModify(parameterName: keyof T, newValue: unknown, previousValue: unknown, allowDeletes: boolean, plan: Plan<T>): Promise<void>;
|
package/package.json
CHANGED
package/src/entities/plugin.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ValidateResponseData
|
|
10
10
|
} from 'codify-schemas';
|
|
11
11
|
import { Plan } from './plan.js';
|
|
12
|
+
import { splitUserConfig } from '../utils/utils.js';
|
|
12
13
|
|
|
13
14
|
export class Plugin {
|
|
14
15
|
planStorage: Map<string, Plan<ResourceConfig>>;
|
|
@@ -40,7 +41,8 @@ export class Plugin {
|
|
|
40
41
|
throw new Error(`Resource type not found: ${config.type}`);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
const
|
|
44
|
+
const { parameters } = splitUserConfig(config);
|
|
45
|
+
const validateResult = await this.resources.get(config.type)!.validate(parameters);
|
|
44
46
|
|
|
45
47
|
validationResults.push({
|
|
46
48
|
...validateResult,
|
package/src/entities/resource.ts
CHANGED
|
@@ -241,7 +241,7 @@ Additional: ${[...refreshKeys].filter(k => !desiredKeys.has(k))};`
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
abstract validate(
|
|
244
|
+
abstract validate(parameters: unknown): Promise<ValidationResult>;
|
|
245
245
|
|
|
246
246
|
abstract refresh(keys: Set<keyof T>): Promise<Partial<T> | null>;
|
|
247
247
|
|