codify-plugin-lib 1.0.23 → 1.0.24
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/resource.js +3 -1
- package/dist/utils/utils.d.ts +3 -1
- package/dist/utils/utils.js +11 -5
- package/package.json +1 -1
- package/src/entities/resource.ts +3 -1
- package/src/utils/utils.ts +11 -5
|
@@ -29,7 +29,9 @@ class Resource {
|
|
|
29
29
|
const resourceOperation = parameterChangeSet
|
|
30
30
|
.filter((change) => change.operation !== codify_schemas_1.ParameterOperation.NOOP)
|
|
31
31
|
.reduce((operation, curr) => {
|
|
32
|
-
const newOperation = this.
|
|
32
|
+
const newOperation = !this.statefulParameters.has(curr.name)
|
|
33
|
+
? this.calculateOperation(curr)
|
|
34
|
+
: codify_schemas_1.ResourceOperation.MODIFY;
|
|
33
35
|
return change_set_1.ChangeSet.combineResourceOperations(operation, newOperation);
|
|
34
36
|
}, codify_schemas_1.ResourceOperation.NOOP);
|
|
35
37
|
return plan_1.Plan.create(new change_set_1.ChangeSet(resourceOperation, parameterChangeSet), desiredConfig);
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ type CodifySpawnOptions = {
|
|
|
12
12
|
cwd?: string;
|
|
13
13
|
stdioString?: boolean;
|
|
14
14
|
} & SpawnOptions;
|
|
15
|
-
export declare function codifySpawn(cmd: string, args?: string[], opts?: Omit<CodifySpawnOptions, 'stdio' | 'stdioString' | 'shell'
|
|
15
|
+
export declare function codifySpawn(cmd: string, args?: string[], opts?: Omit<CodifySpawnOptions, 'stdio' | 'stdioString' | 'shell'> & {
|
|
16
|
+
throws?: boolean;
|
|
17
|
+
}, extras?: Record<any, any>): Promise<SpawnResult>;
|
|
16
18
|
export declare function isDebug(): boolean;
|
|
17
19
|
export {};
|
package/dist/utils/utils.js
CHANGED
|
@@ -25,11 +25,17 @@ async function codifySpawn(cmd, args, opts, extras) {
|
|
|
25
25
|
data: status === SpawnStatus.SUCCESS ? result.stdout : result.stderr
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
catch (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (opts?.throws) {
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.error(`CodifySpawn Error for command ${cmd} ${args}`, error);
|
|
34
|
+
return {
|
|
35
|
+
status: SpawnStatus.ERROR,
|
|
36
|
+
data: error,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
exports.codifySpawn = codifySpawn;
|
package/package.json
CHANGED
package/src/entities/resource.ts
CHANGED
|
@@ -45,7 +45,9 @@ export abstract class Resource<T extends ResourceConfig> {
|
|
|
45
45
|
const resourceOperation = parameterChangeSet
|
|
46
46
|
.filter((change) => change.operation !== ParameterOperation.NOOP)
|
|
47
47
|
.reduce((operation: ResourceOperation, curr: ParameterChange) => {
|
|
48
|
-
const newOperation = this.
|
|
48
|
+
const newOperation = !this.statefulParameters.has(curr.name)
|
|
49
|
+
? this.calculateOperation(curr)
|
|
50
|
+
: ResourceOperation.MODIFY; // All stateful parameters are modify only
|
|
49
51
|
return ChangeSet.combineResourceOperations(operation, newOperation);
|
|
50
52
|
}, ResourceOperation.NOOP);
|
|
51
53
|
|
package/src/utils/utils.ts
CHANGED
|
@@ -19,7 +19,7 @@ type CodifySpawnOptions = {
|
|
|
19
19
|
export async function codifySpawn(
|
|
20
20
|
cmd: string,
|
|
21
21
|
args?: string[],
|
|
22
|
-
opts?: Omit<CodifySpawnOptions, 'stdio' | 'stdioString' | 'shell'
|
|
22
|
+
opts?: Omit<CodifySpawnOptions, 'stdio' | 'stdioString' | 'shell'> & { throws?: boolean },
|
|
23
23
|
extras?: Record<any, any>,
|
|
24
24
|
): Promise<SpawnResult> {
|
|
25
25
|
try {
|
|
@@ -43,10 +43,16 @@ export async function codifySpawn(
|
|
|
43
43
|
status,
|
|
44
44
|
data: status === SpawnStatus.SUCCESS ? result.stdout : result.stderr
|
|
45
45
|
}
|
|
46
|
-
} catch (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (opts?.throws) {
|
|
48
|
+
throw error;
|
|
49
|
+
} else {
|
|
50
|
+
console.error(`CodifySpawn Error for command ${cmd} ${args}`, error);
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
status: SpawnStatus.ERROR,
|
|
54
|
+
data: error as string,
|
|
55
|
+
}
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
}
|