codify-plugin-lib 1.0.176 → 1.0.177

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.
@@ -140,7 +140,7 @@ export class Plugin {
140
140
  // Validate using desired/desired. If the apply was successful, no changes should be reported back.
141
141
  // Default back desired back to current if it is not defined (for destroys only)
142
142
  const validationPlan = await ptyLocalStorage.run(new BackgroundPty(), async () => {
143
- const result = await resource.plan(plan.coreParameters, plan.desiredConfig, plan.desiredConfig ?? plan.currentConfig, plan.isStateful);
143
+ const result = await resource.plan(plan.coreParameters, plan.desiredConfig, plan.desiredConfig ?? plan.currentConfig, plan.isStateful, 'validationPlan');
144
144
  await getPty().kill();
145
145
  return result;
146
146
  });
@@ -16,7 +16,7 @@ export declare class ResourceController<T extends StringIndexedObject> {
16
16
  initialize(): Promise<void>;
17
17
  validate(core: ResourceConfig, parameters: Partial<T>): Promise<ValidateResponseData['resourceValidations'][0]>;
18
18
  match(resource: ResourceJson, array: Array<ResourceJson>): Promise<ResourceJson | undefined>;
19
- plan(core: ResourceConfig, desired: Partial<T> | null, state: Partial<T> | null, isStateful?: boolean): Promise<Plan<T>>;
19
+ plan(core: ResourceConfig, desired: Partial<T> | null, state: Partial<T> | null, isStateful?: boolean, commandType?: string): Promise<Plan<T>>;
20
20
  planDestroy(core: ResourceConfig, parameters: Partial<T>): Promise<Plan<T>>;
21
21
  apply(plan: Plan<T>): Promise<void>;
22
22
  import(core: ResourceConfig, parameters: Partial<T>, autoSearchAll?: boolean): Promise<Array<ResourceJson> | null>;
@@ -39,7 +39,14 @@ export class ResourceController {
39
39
  // Schema validator uses pre transformation parameters
40
40
  const isValid = this.schemaValidator(
41
41
  // @ts-expect-error Non esm package
42
- cleanDeep(originalParameters, { nullValues: true, undefinedValues: true, emptyArrays: false, emptyStrings: false, emptyObjects: false, NaNValues: false }));
42
+ cleanDeep(originalParameters, {
43
+ nullValues: true,
44
+ undefinedValues: true,
45
+ emptyArrays: false,
46
+ emptyStrings: false,
47
+ emptyObjects: false,
48
+ NaNValues: false
49
+ }));
43
50
  if (!isValid) {
44
51
  return {
45
52
  isValid: false,
@@ -105,10 +112,10 @@ export class ResourceController {
105
112
  }
106
113
  }
107
114
  }
108
- async plan(core, desired, state, isStateful = false) {
115
+ async plan(core, desired, state, isStateful = false, commandType = 'plan') {
109
116
  this.validatePlanInputs(core, desired, state, isStateful);
110
117
  const context = {
111
- commandType: 'plan',
118
+ commandType: commandType,
112
119
  isStateful,
113
120
  originalDesiredConfig: structuredClone(desired),
114
121
  };
@@ -4,7 +4,7 @@ import { CreatePlan, DestroyPlan, ModifyPlan } from '../plan/plan-types.js';
4
4
  import { ResourceSettings } from './resource-settings.js';
5
5
  export interface RefreshContext<T extends StringIndexedObject> {
6
6
  isStateful: boolean;
7
- commandType: 'destroy' | 'import' | 'plan';
7
+ commandType: 'destroy' | 'import' | 'plan' | 'validationPlan';
8
8
  originalDesiredConfig: Partial<T> | null;
9
9
  }
10
10
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-plugin-lib",
3
- "version": "1.0.176",
3
+ "version": "1.0.177",
4
4
  "description": "Library plugin library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -215,7 +215,8 @@ export class Plugin {
215
215
  plan.coreParameters,
216
216
  plan.desiredConfig,
217
217
  plan.desiredConfig ?? plan.currentConfig,
218
- plan.isStateful
218
+ plan.isStateful,
219
+ 'validationPlan'
219
220
  );
220
221
 
221
222
  await getPty().kill();
@@ -66,7 +66,14 @@ export class ResourceController<T extends StringIndexedObject> {
66
66
  // Schema validator uses pre transformation parameters
67
67
  const isValid = this.schemaValidator(
68
68
  // @ts-expect-error Non esm package
69
- cleanDeep(originalParameters, { nullValues: true, undefinedValues: true, emptyArrays: false, emptyStrings: false, emptyObjects: false, NaNValues: false })
69
+ cleanDeep(originalParameters, {
70
+ nullValues: true,
71
+ undefinedValues: true,
72
+ emptyArrays: false,
73
+ emptyStrings: false,
74
+ emptyObjects: false,
75
+ NaNValues: false
76
+ })
70
77
  );
71
78
 
72
79
  if (!isValid) {
@@ -153,10 +160,11 @@ export class ResourceController<T extends StringIndexedObject> {
153
160
  desired: Partial<T> | null,
154
161
  state: Partial<T> | null,
155
162
  isStateful = false,
163
+ commandType = 'plan',
156
164
  ): Promise<Plan<T>> {
157
165
  this.validatePlanInputs(core, desired, state, isStateful);
158
166
  const context: RefreshContext<T> = {
159
- commandType: 'plan',
167
+ commandType: commandType as 'plan' | 'validationPlan',
160
168
  isStateful,
161
169
  originalDesiredConfig: structuredClone(desired),
162
170
  };
@@ -6,7 +6,7 @@ import { ResourceSettings } from './resource-settings.js';
6
6
 
7
7
  export interface RefreshContext<T extends StringIndexedObject> {
8
8
  isStateful: boolean;
9
- commandType: 'destroy' | 'import' | 'plan';
9
+ commandType: 'destroy' | 'import' | 'plan' | 'validationPlan';
10
10
  originalDesiredConfig: Partial<T> | null;
11
11
  }
12
12