codify-plugin-lib 1.0.136 → 1.0.137

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.
@@ -172,6 +172,15 @@ export interface DefaultParameterSetting {
172
172
  * 2. AWS profile secret keys that can be updated without the re-installation of AWS CLI
173
173
  */
174
174
  canModify?: boolean;
175
+ /**
176
+ * This option allows the plan to skip this parameter entirely as it is used for setting purposes only. The value
177
+ * of this parameter is used to configure the resource or other parameters.
178
+ *
179
+ * Examples:
180
+ * 1. homebrew.onlyPlanUserInstalled option will tell homebrew to filter by --installed-on-request. But the value,
181
+ * of the parameter itself (true or false) does not have an impact on the plan
182
+ */
183
+ setting?: boolean;
175
184
  }
176
185
  /**
177
186
  * Array type specific settings. See {@link DefaultParameterSetting } for a full list of options.
@@ -7,10 +7,13 @@ const ParameterEqualsDefaults = {
7
7
  'number': (a, b) => Number(a) === Number(b),
8
8
  'string': (a, b) => String(a) === String(b),
9
9
  'version': (desired, current) => String(current).includes(String(desired)),
10
- 'setting': () => true,
11
10
  'object': isObjectsEqual,
12
11
  };
13
12
  export function resolveEqualsFn(parameter) {
13
+ // Setting parameters do not impact the plan
14
+ if (parameter.setting) {
15
+ return () => true;
16
+ }
14
17
  const isEqual = resolveFnFromEqualsFnOrString(parameter.isEqual);
15
18
  if (parameter.type === 'array') {
16
19
  return isEqual ?? areArraysEqual.bind(areArraysEqual, resolveElementEqualsFn(parameter));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-plugin-lib",
3
- "version": "1.0.136",
3
+ "version": "1.0.137",
4
4
  "description": "Library plugin library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -20,7 +20,10 @@ describe('Resource tests', () => {
20
20
  id: 'type',
21
21
  dependencies: ['homebrew', 'python'],
22
22
  parameterSettings: {
23
- propA: { canModify: true, transformation: { to: (input) => untildify(input), from: (input) => tildify(input) } },
23
+ propA: {
24
+ canModify: true,
25
+ transformation: { to: (input) => untildify(input), from: (input) => tildify(input) }
26
+ },
24
27
  },
25
28
  }
26
29
  }
@@ -696,7 +696,7 @@ describe('Resource parameter tests', () => {
696
696
  return {
697
697
  id: 'resourceType',
698
698
  parameterSettings: {
699
- propA: { type: 'setting' },
699
+ propA: { type: 'string', setting: true },
700
700
  propB: { type: 'number' }
701
701
  }
702
702
  }
@@ -212,6 +212,16 @@ export interface DefaultParameterSetting {
212
212
  * 2. AWS profile secret keys that can be updated without the re-installation of AWS CLI
213
213
  */
214
214
  canModify?: boolean
215
+
216
+ /**
217
+ * This option allows the plan to skip this parameter entirely as it is used for setting purposes only. The value
218
+ * of this parameter is used to configure the resource or other parameters.
219
+ *
220
+ * Examples:
221
+ * 1. homebrew.onlyPlanUserInstalled option will tell homebrew to filter by --installed-on-request. But the value,
222
+ * of the parameter itself (true or false) does not have an impact on the plan
223
+ */
224
+ setting?: boolean
215
225
  }
216
226
 
217
227
  /**
@@ -289,11 +299,15 @@ const ParameterEqualsDefaults: Partial<Record<ParameterSettingType, (a: unknown,
289
299
  'number': (a: unknown, b: unknown) => Number(a) === Number(b),
290
300
  'string': (a: unknown, b: unknown) => String(a) === String(b),
291
301
  'version': (desired: unknown, current: unknown) => String(current).includes(String(desired)),
292
- 'setting': () => true,
293
302
  'object': isObjectsEqual,
294
303
  }
295
304
 
296
305
  export function resolveEqualsFn(parameter: ParameterSetting): (desired: unknown, current: unknown) => boolean {
306
+ // Setting parameters do not impact the plan
307
+ if (parameter.setting) {
308
+ return () => true;
309
+ }
310
+
297
311
  const isEqual = resolveFnFromEqualsFnOrString(parameter.isEqual);
298
312
 
299
313
  if (parameter.type === 'array') {