codify-plugin-lib 1.0.14 → 1.0.15

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.
@@ -8,8 +8,8 @@ export declare abstract class Resource<T extends ResourceConfig> {
8
8
  onInitialize(): Promise<void>;
9
9
  plan(desiredConfig: T): Promise<Plan<T>>;
10
10
  apply(plan: Plan<T>): Promise<void>;
11
- abstract validate(config: ResourceConfig): Promise<boolean>;
12
- abstract getCurrentConfig(): Promise<T | null>;
11
+ abstract validate(config: unknown): Promise<boolean>;
12
+ abstract getCurrentConfig(desiredConfig: T): Promise<T | null>;
13
13
  abstract calculateOperation(change: ParameterChange): ResourceOperation.MODIFY | ResourceOperation.RECREATE;
14
14
  abstract applyCreate(plan: Plan<T>): Promise<void>;
15
15
  abstract applyModify(plan: Plan<T>): Promise<void>;
@@ -12,7 +12,7 @@ class Resource {
12
12
  async onInitialize() { }
13
13
  async plan(desiredConfig) {
14
14
  await this.validate(desiredConfig);
15
- const currentConfig = await this.getCurrentConfig();
15
+ const currentConfig = await this.getCurrentConfig(desiredConfig);
16
16
  if (!currentConfig) {
17
17
  return plan_1.Plan.create(change_set_1.ChangeSet.createForNullCurrentConfig(desiredConfig), desiredConfig);
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-plugin-lib",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -7,19 +7,19 @@ import { expect } from 'chai';
7
7
  import { Plan } from './plan';
8
8
 
9
9
  class TestResource extends Resource<TestConfig> {
10
- applyCreate(plan: Plan): Promise<void> {
10
+ applyCreate(plan: Plan<TestConfig>): Promise<void> {
11
11
  return Promise.resolve(undefined);
12
12
  }
13
13
 
14
- applyDestroy(plan: Plan): Promise<void> {
14
+ applyDestroy(plan: Plan<TestConfig>): Promise<void> {
15
15
  return Promise.resolve(undefined);
16
16
  }
17
17
 
18
- applyModify(plan: Plan): Promise<void> {
18
+ applyModify(plan: Plan<TestConfig>): Promise<void> {
19
19
  return Promise.resolve(undefined);
20
20
  }
21
21
 
22
- applyRecreate(plan: Plan): Promise<void> {
22
+ applyRecreate(plan: Plan<TestConfig>): Promise<void> {
23
23
  return Promise.resolve(undefined);
24
24
  }
25
25
 
@@ -156,7 +156,7 @@ describe('Resource tests', () => {
156
156
  const result = await resourceSpy.apply(
157
157
  Plan.create(
158
158
  new ChangeSet(ResourceOperation.CREATE, []),
159
- { type: 'resource' }
159
+ { type: 'resource', propA: 'a', propB: 0 }
160
160
  )
161
161
  )
162
162
 
@@ -174,7 +174,7 @@ describe('Resource tests', () => {
174
174
  const result = await resourceSpy.apply(
175
175
  Plan.create(
176
176
  new ChangeSet(ResourceOperation.DESTROY, []),
177
- { type: 'resource' }
177
+ { type: 'resource', propA: 'a', propB: 0 }
178
178
  )
179
179
  )
180
180
 
@@ -17,7 +17,7 @@ export abstract class Resource<T extends ResourceConfig> {
17
17
  async plan(desiredConfig: T): Promise<Plan<T>> {
18
18
  await this.validate(desiredConfig);
19
19
 
20
- const currentConfig = await this.getCurrentConfig();
20
+ const currentConfig = await this.getCurrentConfig(desiredConfig);
21
21
  if (!currentConfig) {
22
22
  return Plan.create(ChangeSet.createForNullCurrentConfig(desiredConfig), desiredConfig);
23
23
  }
@@ -55,9 +55,9 @@ export abstract class Resource<T extends ResourceConfig> {
55
55
  }
56
56
  }
57
57
 
58
- abstract validate(config: ResourceConfig): Promise<boolean>;
58
+ abstract validate(config: unknown): Promise<boolean>;
59
59
 
60
- abstract getCurrentConfig(): Promise<T | null>;
60
+ abstract getCurrentConfig(desiredConfig: T): Promise<T | null>;
61
61
 
62
62
  abstract calculateOperation(change: ParameterChange): ResourceOperation.MODIFY | ResourceOperation.RECREATE;
63
63