Skip to content

Commit 1952d09

Browse files
committed
feat: Added validation plan
1 parent b29599c commit 1952d09

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-lib",
3-
"version": "1.0.175",
3+
"version": "1.0.177",
44
"description": "Library plugin library",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/plugin/plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ export class Plugin {
215215
plan.coreParameters,
216216
plan.desiredConfig,
217217
plan.desiredConfig ?? plan.currentConfig,
218-
plan.isStateful
218+
plan.isStateful,
219+
'validationPlan'
219220
);
220221

221222
await getPty().kill();

src/resource/resource-controller.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,14 @@ export class ResourceController<T extends StringIndexedObject> {
6666
// Schema validator uses pre transformation parameters
6767
const isValid = this.schemaValidator(
6868
// @ts-expect-error Non esm package
69-
cleanDeep(originalParameters, { nullValues: true })
69+
cleanDeep(originalParameters, {
70+
nullValues: true,
71+
undefinedValues: true,
72+
emptyArrays: false,
73+
emptyStrings: false,
74+
emptyObjects: false,
75+
NaNValues: false
76+
})
7077
);
7178

7279
if (!isValid) {
@@ -153,10 +160,11 @@ export class ResourceController<T extends StringIndexedObject> {
153160
desired: Partial<T> | null,
154161
state: Partial<T> | null,
155162
isStateful = false,
163+
commandType = 'plan',
156164
): Promise<Plan<T>> {
157165
this.validatePlanInputs(core, desired, state, isStateful);
158166
const context: RefreshContext<T> = {
159-
commandType: 'plan',
167+
commandType: commandType as 'plan' | 'validationPlan',
160168
isStateful,
161169
originalDesiredConfig: structuredClone(desired),
162170
};

src/resource/resource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ResourceSettings } from './resource-settings.js';
66

77
export interface RefreshContext<T extends StringIndexedObject> {
88
isStateful: boolean;
9-
commandType: 'destroy' | 'import' | 'plan';
9+
commandType: 'destroy' | 'import' | 'plan' | 'validationPlan';
1010
originalDesiredConfig: Partial<T> | null;
1111
}
1212

0 commit comments

Comments
 (0)