@codifycli/plugin-core 1.1.0-beta15 → 1.1.0-beta16

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.
@@ -28,7 +28,7 @@ export class ParsedResourceSettings {
28
28
  if (ctx.path.length === 0) {
29
29
  ctx.jsonSchema.title = settings.id;
30
30
  ctx.jsonSchema.description = schema.description ?? settings.description ?? `${settings.id} resource. Can be used to manage ${settings.id}`;
31
- ctx.jsonSchema.$comment = schema.meta().$comment;
31
+ ctx.jsonSchema.$comment = schema.meta()?.$comment;
32
32
  }
33
33
  }
34
34
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codifycli/plugin-core",
3
- "version": "1.1.0-beta15",
3
+ "version": "1.1.0-beta16",
4
4
  "description": "TypeScript library for building Codify plugins to manage system resources (applications, CLI tools, settings) through infrastructure-as-code",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  "lodash.isequal": "^4.5.0",
44
44
  "nanoid": "^5.0.9",
45
45
  "strip-ansi": "^7.1.0",
46
- "uuid": "^10.0.0",
46
+ "uuid": "^14.0.0",
47
47
  "zod": "4.1.13"
48
48
  },
49
49
  "devDependencies": {
@@ -107,6 +107,7 @@ describe('Change set tests', () => {
107
107
 
108
108
  const parameterSettings = new ParsedResourceSettings({
109
109
  id: 'type',
110
+ operatingSystems: [],
110
111
  parameterSettings: {
111
112
  propA: { type: 'array' }
112
113
  }
@@ -129,6 +130,7 @@ describe('Change set tests', () => {
129
130
 
130
131
  const parameterSettings = new ParsedResourceSettings({
131
132
  id: 'type',
133
+ operatingSystems: [],
132
134
  parameterSettings: {
133
135
  propA: { type: 'array' }
134
136
  }
@@ -152,6 +154,7 @@ describe('Change set tests', () => {
152
154
 
153
155
  const parameterSettings = new ParsedResourceSettings({
154
156
  id: 'type',
157
+ operatingSystems: [],
155
158
  parameterSettings: {
156
159
  propA: { canModify: true }
157
160
  }
@@ -176,6 +179,7 @@ describe('Change set tests', () => {
176
179
 
177
180
  const parameterSettings = new ParsedResourceSettings({
178
181
  id: 'type',
182
+ operatingSystems: [],
179
183
  parameterSettings: {
180
184
  propA: { canModify: true },
181
185
  propB: { canModify: true }
@@ -196,6 +200,7 @@ describe('Change set tests', () => {
196
200
 
197
201
  const parameterSettings = new ParsedResourceSettings({
198
202
  id: 'type',
203
+ operatingSystems: [],
199
204
  parameterSettings: {
200
205
  propA: { type: 'array' }
201
206
  },
@@ -213,6 +218,7 @@ describe('Change set tests', () => {
213
218
 
214
219
  const parameterSettings = new ParsedResourceSettings({
215
220
  id: 'type',
221
+ operatingSystems: [],
216
222
  parameterSettings: {
217
223
  propA: { type: 'array' }
218
224
  },
@@ -229,6 +235,7 @@ describe('Change set tests', () => {
229
235
 
230
236
  const parameterSettings = new ParsedResourceSettings({
231
237
  id: 'type',
238
+ operatingSystems: [],
232
239
  parameterSettings: {
233
240
  propA: { type: 'array' }
234
241
  },
@@ -245,6 +252,7 @@ describe('Change set tests', () => {
245
252
 
246
253
  const parameterSettings = new ParsedResourceSettings({
247
254
  id: 'type',
255
+ operatingSystems: [],
248
256
  parameterSettings: {
249
257
  propA: {
250
258
  type: 'array',
@@ -259,12 +267,50 @@ describe('Change set tests', () => {
259
267
  expect(result.parameterChanges[0].operation).to.eq(ParameterOperation.MODIFY);
260
268
  })
261
269
 
270
+ it('excludes setting parameters from destroy change set', () => {
271
+ const settings = {
272
+ id: 'type',
273
+ operatingSystems: [],
274
+ parameterSettings: {
275
+ propA: {},
276
+ propB: { setting: true },
277
+ },
278
+ };
279
+
280
+ const cs = ChangeSet.destroy({ propA: 'val', propB: true }, settings as any);
281
+ expect(cs.parameterChanges.length).to.eq(1);
282
+ expect(cs.parameterChanges[0].name).to.eq('propA');
283
+ expect(cs.parameterChanges[0].operation).to.eq(ParameterOperation.REMOVE);
284
+ expect(cs.operation).to.eq(ResourceOperation.DESTROY);
285
+ })
286
+
287
+ it('excludes multiple setting parameters from destroy change set', () => {
288
+ const settings = {
289
+ id: 'type',
290
+ operatingSystems: [],
291
+ parameterSettings: {
292
+ skipAlreadyInstalledCasks: { type: 'boolean', default: true, setting: true },
293
+ onlyPlanUserInstalled: { type: 'boolean', default: true, setting: true },
294
+ directory: { type: 'directory' },
295
+ },
296
+ };
297
+
298
+ const cs = ChangeSet.destroy(
299
+ { skipAlreadyInstalledCasks: true, onlyPlanUserInstalled: true, directory: '/opt/homebrew' },
300
+ settings as any
301
+ );
302
+ expect(cs.parameterChanges.length).to.eq(1);
303
+ expect(cs.parameterChanges[0].name).to.eq('directory');
304
+ expect(cs.operation).to.eq(ResourceOperation.DESTROY);
305
+ })
306
+
262
307
  it('correctly determines array equality 5', () => {
263
308
  const arrA = [{ key1: 'b' }, { key1: 'a' }, { key1: 'a' }];
264
309
  const arrB = [{ key1: 'a' }, { key1: 'a' }, { key1: 'b' }];
265
310
 
266
311
  const parameterSettings = new ParsedResourceSettings({
267
312
  id: 'type',
313
+ operatingSystems: [],
268
314
  parameterSettings: {
269
315
  propA: {
270
316
  type: 'array',
@@ -76,7 +76,7 @@ export class ParsedResourceSettings<T extends StringIndexedObject> implements Re
76
76
  if (ctx.path.length === 0) {
77
77
  ctx.jsonSchema.title = settings.id;
78
78
  ctx.jsonSchema.description = schema.description ?? settings.description ?? `${settings.id} resource. Can be used to manage ${settings.id}`;
79
- ctx.jsonSchema.$comment = (schema.meta() as Record<string, string | undefined>).$comment;
79
+ ctx.jsonSchema.$comment = (schema.meta() as Record<string, string | undefined> | undefined)?.$comment;
80
80
  }
81
81
  }
82
82
  }) as JSONSchemaType<T>