@gradientedge/cdk-utils 10.2.0 → 10.4.0

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.
Files changed (33) hide show
  1. package/README.md +11 -11
  2. package/dist/src/lib/azure/index.d.ts +0 -1
  3. package/dist/src/lib/azure/index.js +0 -1
  4. package/dist/src/lib/cloudflare/services/access/main.js +23 -23
  5. package/dist/src/lib/cloudflare/services/api-shield/main.js +11 -11
  6. package/dist/src/lib/cloudflare/services/argo/main.js +5 -5
  7. package/dist/src/lib/cloudflare/services/filter/main.js +3 -3
  8. package/dist/src/lib/cloudflare/services/firewall/main.js +3 -3
  9. package/dist/src/lib/cloudflare/services/page/main.js +7 -7
  10. package/dist/src/lib/cloudflare/services/record/main.js +3 -3
  11. package/dist/src/lib/cloudflare/services/rule-set/main.d.ts +1 -1
  12. package/dist/src/lib/cloudflare/services/rule-set/main.js +4 -5
  13. package/dist/src/lib/cloudflare/services/worker/main.js +13 -13
  14. package/dist/src/lib/cloudflare/services/zone/main.js +18 -18
  15. package/dist/src/lib/common/stack.d.ts +3 -3
  16. package/package.json +10 -18
  17. package/src/lib/azure/index.ts +0 -1
  18. package/src/lib/cloudflare/services/access/main.ts +114 -58
  19. package/src/lib/cloudflare/services/api-shield/main.ts +48 -22
  20. package/src/lib/cloudflare/services/argo/main.ts +17 -9
  21. package/src/lib/cloudflare/services/filter/main.ts +9 -5
  22. package/src/lib/cloudflare/services/firewall/main.ts +9 -5
  23. package/src/lib/cloudflare/services/page/main.ts +27 -15
  24. package/src/lib/cloudflare/services/record/main.ts +9 -5
  25. package/src/lib/cloudflare/services/rule-set/main.ts +10 -8
  26. package/src/lib/cloudflare/services/worker/main.ts +60 -29
  27. package/src/lib/cloudflare/services/zone/main.ts +75 -35
  28. package/src/lib/common/stack.ts +3 -3
  29. package/vitest.config.ts +0 -1
  30. package/dist/src/lib/azure/utils/index.d.ts +0 -19
  31. package/dist/src/lib/azure/utils/index.js +0 -19
  32. package/setup.js +0 -3
  33. package/src/lib/azure/utils/index.ts +0 -21
@@ -1,4 +1,4 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import { PageRule, PagesDomain, PagesProject } from '@pulumi/cloudflare'
2
2
  import { local } from '@pulumi/command'
3
3
  import { CommonCloudflareConstruct } from '../../common/index.js'
4
4
  import { PageRuleProps, PagesDomainProps, PagesProjectDeployProps, PagesProjectProps } from './types.js'
@@ -31,11 +31,15 @@ export class CloudflarePageManager {
31
31
  public createPagesProject(id: string, scope: CommonCloudflareConstruct, props: PagesProjectProps) {
32
32
  if (!props) throw `Props undefined for ${id}`
33
33
 
34
- return new cloudflare.PagesProject(`${id}`, {
35
- ...props,
36
- accountId: props.accountId ?? scope.props.accountId,
37
- name: `${props.name}-${scope.props.stage}`,
38
- })
34
+ return new PagesProject(
35
+ `${id}`,
36
+ {
37
+ ...props,
38
+ accountId: props.accountId ?? scope.props.accountId,
39
+ name: `${props.name}-${scope.props.stage}`,
40
+ },
41
+ { parent: scope }
42
+ )
39
43
  }
40
44
 
41
45
  /**
@@ -48,11 +52,15 @@ export class CloudflarePageManager {
48
52
  public createPagesDomain(id: string, scope: CommonCloudflareConstruct, props: PagesDomainProps) {
49
53
  if (!props) throw `Props undefined for ${id}`
50
54
 
51
- return new cloudflare.PagesDomain(`${id}`, {
52
- ...props,
53
- accountId: props.accountId ?? scope.props.accountId,
54
- name: props.name ?? scope.props.domainName,
55
- })
55
+ return new PagesDomain(
56
+ `${id}`,
57
+ {
58
+ ...props,
59
+ accountId: props.accountId ?? scope.props.accountId,
60
+ name: props.name ?? scope.props.domainName,
61
+ },
62
+ { parent: scope }
63
+ )
56
64
  }
57
65
 
58
66
  /**
@@ -68,10 +76,14 @@ export class CloudflarePageManager {
68
76
  const zoneId = props.zoneId
69
77
  ? props.zoneId
70
78
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
71
- return new cloudflare.PageRule(`${id}`, {
72
- ...props,
73
- zoneId,
74
- })
79
+ return new PageRule(
80
+ `${id}`,
81
+ {
82
+ ...props,
83
+ zoneId,
84
+ },
85
+ { parent: scope }
86
+ )
75
87
  }
76
88
 
77
89
  public deployPagesProject(id: string, scope: CommonCloudflareConstruct, props: PagesProjectDeployProps) {
@@ -1,4 +1,4 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import { DnsRecord } from '@pulumi/cloudflare'
2
2
  import { CommonCloudflareConstruct } from '../../common/index.js'
3
3
  import { DnsRecordProps } from './types.js'
4
4
 
@@ -33,9 +33,13 @@ export class CloudflareRecordManager {
33
33
  const zoneId = props.zoneId
34
34
  ? props.zoneId
35
35
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
36
- return new cloudflare.DnsRecord(id, {
37
- ...props,
38
- zoneId,
39
- })
36
+ return new DnsRecord(
37
+ id,
38
+ {
39
+ ...props,
40
+ zoneId,
41
+ },
42
+ { parent: scope }
43
+ )
40
44
  }
41
45
  }
@@ -1,4 +1,4 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import { Ruleset } from '@pulumi/cloudflare'
2
2
  import { CommonCloudflareConstruct } from '../../common/index.js'
3
3
  import { RulesetProps } from './types.js'
4
4
 
@@ -25,7 +25,7 @@ export class CloudflareRuleSetManager {
25
25
  * @param id scoped id of the resource
26
26
  * @param scope scope in which this resource is defined
27
27
  * @param props rule set properties
28
- * @see [Pulumi Cloudflare Ruleset]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/ruleset/}
28
+ * @see [Pulumi Cloudflare Ruleset]{@link https://www.pulumi.com/registry/packages//api-docs/ruleset/}
29
29
  */
30
30
  public createRuleSet(id: string, scope: CommonCloudflareConstruct, props: RulesetProps) {
31
31
  if (!props) throw `Props undefined for ${id}`
@@ -33,11 +33,13 @@ export class CloudflareRuleSetManager {
33
33
  const zoneId = props.zoneId
34
34
  ? props.zoneId
35
35
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
36
- const ruleSet = new cloudflare.Ruleset(`${id}`, {
37
- ...props,
38
- zoneId,
39
- })
40
-
41
- return ruleSet
36
+ return new Ruleset(
37
+ `${id}`,
38
+ {
39
+ ...props,
40
+ zoneId,
41
+ },
42
+ { parent: scope }
43
+ )
42
44
  }
43
45
  }
@@ -1,4 +1,11 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import {
2
+ WorkersCronTrigger,
3
+ WorkersCustomDomain,
4
+ WorkersKv,
5
+ WorkersKvNamespace,
6
+ WorkersRoute,
7
+ WorkersScript,
8
+ } from '@pulumi/cloudflare'
2
9
  import { CommonCloudflareConstruct } from '../../common/index.js'
3
10
  import {
4
11
  WorkerCronTriggerProps,
@@ -40,11 +47,15 @@ export class CloudflareWorkerManager {
40
47
  const zoneId = props.zoneId
41
48
  ? props.zoneId
42
49
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
43
- return new cloudflare.WorkersCustomDomain(id, {
44
- ...props,
45
- accountId: props.accountId ?? scope.props.accountId,
46
- zoneId,
47
- })
50
+ return new WorkersCustomDomain(
51
+ id,
52
+ {
53
+ ...props,
54
+ accountId: props.accountId ?? scope.props.accountId,
55
+ zoneId,
56
+ },
57
+ { parent: scope }
58
+ )
48
59
  }
49
60
 
50
61
  /**
@@ -61,11 +72,15 @@ export class CloudflareWorkerManager {
61
72
  ? props.zoneId
62
73
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
63
74
 
64
- return new cloudflare.WorkersRoute(id, {
65
- ...props,
66
- script: `${props.script}-${scope.props.stage}`,
67
- zoneId,
68
- })
75
+ return new WorkersRoute(
76
+ id,
77
+ {
78
+ ...props,
79
+ script: `${props.script}-${scope.props.stage}`,
80
+ zoneId,
81
+ },
82
+ { parent: scope }
83
+ )
69
84
  }
70
85
 
71
86
  /**
@@ -78,11 +93,15 @@ export class CloudflareWorkerManager {
78
93
  public createWorkerScript(id: string, scope: CommonCloudflareConstruct, props: WorkerScriptProps) {
79
94
  if (!props) throw `Props undefined for ${id}`
80
95
 
81
- return new cloudflare.WorkersScript(id, {
82
- ...props,
83
- accountId: props.accountId ?? scope.props.accountId,
84
- scriptName: `${props.scriptName}-${scope.props.stage}`,
85
- })
96
+ return new WorkersScript(
97
+ id,
98
+ {
99
+ ...props,
100
+ accountId: props.accountId ?? scope.props.accountId,
101
+ scriptName: `${props.scriptName}-${scope.props.stage}`,
102
+ },
103
+ { parent: scope }
104
+ )
86
105
  }
87
106
 
88
107
  /**
@@ -95,11 +114,15 @@ export class CloudflareWorkerManager {
95
114
  public createWorkersKvNamespace(id: string, scope: CommonCloudflareConstruct, props: WorkersKvNamespaceProps) {
96
115
  if (!props) throw `Props undefined for ${id}`
97
116
 
98
- return new cloudflare.WorkersKvNamespace(id, {
99
- ...props,
100
- accountId: props.accountId ?? scope.props.accountId,
101
- title: scope.isProductionStage() ? props.title : `${props.title}-${scope.props.stage}`,
102
- })
117
+ return new WorkersKvNamespace(
118
+ id,
119
+ {
120
+ ...props,
121
+ accountId: props.accountId ?? scope.props.accountId,
122
+ title: scope.isProductionStage() ? props.title : `${props.title}-${scope.props.stage}`,
123
+ },
124
+ { parent: scope }
125
+ )
103
126
  }
104
127
 
105
128
  /**
@@ -112,10 +135,14 @@ export class CloudflareWorkerManager {
112
135
  public createWorkersKv(id: string, scope: CommonCloudflareConstruct, props: WorkersKvProps) {
113
136
  if (!props) throw `Props undefined for ${id}`
114
137
 
115
- return new cloudflare.WorkersKv(id, {
116
- ...props,
117
- accountId: props.accountId ?? scope.props.accountId,
118
- })
138
+ return new WorkersKv(
139
+ id,
140
+ {
141
+ ...props,
142
+ accountId: props.accountId ?? scope.props.accountId,
143
+ },
144
+ { parent: scope }
145
+ )
119
146
  }
120
147
 
121
148
  /**
@@ -128,9 +155,13 @@ export class CloudflareWorkerManager {
128
155
  public createWorkerCronTrigger(id: string, scope: CommonCloudflareConstruct, props: WorkerCronTriggerProps) {
129
156
  if (!props) throw `Props undefined for ${id}`
130
157
 
131
- return new cloudflare.WorkersCronTrigger(id, {
132
- ...props,
133
- accountId: props.accountId ?? scope.props.accountId,
134
- })
158
+ return new WorkersCronTrigger(
159
+ id,
160
+ {
161
+ ...props,
162
+ accountId: props.accountId ?? scope.props.accountId,
163
+ },
164
+ { parent: scope }
165
+ )
135
166
  }
136
167
  }
@@ -1,4 +1,12 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import {
2
+ Zone,
3
+ ZoneCacheReserve,
4
+ ZoneCacheVariants,
5
+ ZoneDnssec,
6
+ ZoneHold,
7
+ ZoneLockdown,
8
+ ZoneSetting,
9
+ } from '@pulumi/cloudflare'
2
10
  import * as pulumi from '@pulumi/pulumi'
3
11
  import { CommonCloudflareConstruct } from '../../common/index.js'
4
12
  import {
@@ -39,16 +47,20 @@ export class CloudflareZoneManager {
39
47
  public createZone(id: string, scope: CommonCloudflareConstruct, props: ZoneProps) {
40
48
  if (!props) throw `Props undefined for ${id}`
41
49
 
42
- return new cloudflare.Zone(id, {
43
- ...props,
44
- account: props.account ?? scope.props.accountId,
45
- name: scope.props.domainName,
46
- })
50
+ return new Zone(
51
+ id,
52
+ {
53
+ ...props,
54
+ account: props.account ?? scope.props.accountId,
55
+ name: scope.props.domainName,
56
+ },
57
+ { parent: scope }
58
+ )
47
59
  }
48
60
 
49
61
  public resolveZone(id: string, scope: CommonCloudflareConstruct, options?: GetZoneProps) {
50
62
  const name = options?.filter?.name ?? scope.props.domainName
51
- return cloudflare.Zone.get(name, id)
63
+ return Zone.get(name, id)
52
64
  }
53
65
 
54
66
  /**
@@ -63,10 +75,14 @@ export class CloudflareZoneManager {
63
75
  const zoneId =
64
76
  props.zoneId ??
65
77
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
66
- return new cloudflare.ZoneCacheReserve(id, {
67
- ...props,
68
- zoneId,
69
- })
78
+ return new ZoneCacheReserve(
79
+ id,
80
+ {
81
+ ...props,
82
+ zoneId,
83
+ },
84
+ { parent: scope }
85
+ )
70
86
  }
71
87
 
72
88
  /**
@@ -81,10 +97,14 @@ export class CloudflareZoneManager {
81
97
  const zoneId =
82
98
  props.zoneId ??
83
99
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
84
- return new cloudflare.ZoneCacheVariants(id, {
85
- ...props,
86
- zoneId,
87
- })
100
+ return new ZoneCacheVariants(
101
+ id,
102
+ {
103
+ ...props,
104
+ zoneId,
105
+ },
106
+ { parent: scope }
107
+ )
88
108
  }
89
109
 
90
110
  /**
@@ -99,10 +119,14 @@ export class CloudflareZoneManager {
99
119
  const zoneId =
100
120
  props.zoneId ??
101
121
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
102
- return new cloudflare.ZoneDnssec(id, {
103
- ...props,
104
- zoneId,
105
- })
122
+ return new ZoneDnssec(
123
+ id,
124
+ {
125
+ ...props,
126
+ zoneId,
127
+ },
128
+ { parent: scope }
129
+ )
106
130
  }
107
131
 
108
132
  /**
@@ -117,10 +141,14 @@ export class CloudflareZoneManager {
117
141
  const zoneId =
118
142
  props.zoneId ??
119
143
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
120
- return new cloudflare.ZoneHold(id, {
121
- ...props,
122
- zoneId,
123
- })
144
+ return new ZoneHold(
145
+ id,
146
+ {
147
+ ...props,
148
+ zoneId,
149
+ },
150
+ { parent: scope }
151
+ )
124
152
  }
125
153
 
126
154
  /**
@@ -135,10 +163,14 @@ export class CloudflareZoneManager {
135
163
  const zoneId =
136
164
  props.zoneId ??
137
165
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
138
- return new cloudflare.ZoneLockdown(id, {
139
- ...props,
140
- zoneId,
141
- })
166
+ return new ZoneLockdown(
167
+ id,
168
+ {
169
+ ...props,
170
+ zoneId,
171
+ },
172
+ { parent: scope }
173
+ )
142
174
  }
143
175
 
144
176
  /**
@@ -153,10 +185,14 @@ export class CloudflareZoneManager {
153
185
  const zoneId =
154
186
  props.zoneId ??
155
187
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
156
- const zoneDnsSettings = new cloudflare.ZoneSetting(id, {
157
- ...props,
158
- zoneId,
159
- })
188
+ const zoneDnsSettings = new ZoneSetting(
189
+ id,
190
+ {
191
+ ...props,
192
+ zoneId,
193
+ },
194
+ { parent: scope }
195
+ )
160
196
 
161
197
  return zoneDnsSettings
162
198
  }
@@ -173,9 +209,13 @@ export class CloudflareZoneManager {
173
209
  const zoneId =
174
210
  props.zoneId ??
175
211
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
176
- return new cloudflare.ZoneSetting(id, {
177
- ...props,
178
- zoneId,
179
- })
212
+ return new ZoneSetting(
213
+ id,
214
+ {
215
+ ...props,
216
+ zoneId,
217
+ },
218
+ { parent: scope }
219
+ )
180
220
  }
181
221
  }
@@ -5,17 +5,17 @@ export abstract class BaseStack extends Construct {
5
5
  props: BaseProps
6
6
 
7
7
  /**
8
- * @summary Method to determine the core CDK construct properties injected via context cdktf.json
8
+ * @summary Method to determine the core CDK construct properties injected via context json
9
9
  */
10
10
  protected abstract determineConstructProps(props: BaseProps): void
11
11
 
12
12
  /**
13
- * @summary Method to determine extra cdk contexts apart from the main cdktf.json
13
+ * @summary Method to determine extra cdk contexts apart from the main json
14
14
  */
15
15
  public abstract determineExtraContexts(): void
16
16
 
17
17
  /**
18
- * @summary Method to determine extra cdk stage contexts apart from the main cdktf.json
18
+ * @summary Method to determine extra cdk stage contexts apart from the main json
19
19
  */
20
20
  public abstract determineStageContexts(): void
21
21
 
package/vitest.config.ts CHANGED
@@ -4,7 +4,6 @@ export default defineConfig({
4
4
  test: {
5
5
  globals: true,
6
6
  environment: 'node',
7
- setupFiles: ['./setup.js'],
8
7
  include: ['**/?(*.)+(spec|test).[t]s?(x)'],
9
8
  coverage: {
10
9
  provider: 'v8',
@@ -1,19 +0,0 @@
1
- /**
2
- * @fileoverview Azure utility functions for Pulumi
3
- *
4
- * Note: Pulumi automatically exposes resource properties as outputs.
5
- * Unlike CDKTF, explicit output creation is not required.
6
- * Resource properties are already pulumi.Output<T> types and can be
7
- * exported directly or used with .apply() for transformations.
8
- *
9
- * @example
10
- * ```typescript
11
- * // In CDKTF (old):
12
- * createAzureTfOutput('resourceGroupName', scope, resourceGroup.name)
13
- *
14
- * // In Pulumi (new):
15
- * // No explicit output creation needed - resourceGroup.name is already an output
16
- * export const resourceGroupName = resourceGroup.name
17
- * ```
18
- */
19
- export {};
@@ -1,19 +0,0 @@
1
- /**
2
- * @fileoverview Azure utility functions for Pulumi
3
- *
4
- * Note: Pulumi automatically exposes resource properties as outputs.
5
- * Unlike CDKTF, explicit output creation is not required.
6
- * Resource properties are already pulumi.Output<T> types and can be
7
- * exported directly or used with .apply() for transformations.
8
- *
9
- * @example
10
- * ```typescript
11
- * // In CDKTF (old):
12
- * createAzureTfOutput('resourceGroupName', scope, resourceGroup.name)
13
- *
14
- * // In Pulumi (new):
15
- * // No explicit output creation needed - resourceGroup.name is already an output
16
- * export const resourceGroupName = resourceGroup.name
17
- * ```
18
- */
19
- export {};
package/setup.js DELETED
@@ -1,3 +0,0 @@
1
- // CDKTF Testing setup for Vitest
2
- const { Testing } = require('cdktf')
3
- Testing.setupJest()
@@ -1,21 +0,0 @@
1
- /**
2
- * @fileoverview Azure utility functions for Pulumi
3
- *
4
- * Note: Pulumi automatically exposes resource properties as outputs.
5
- * Unlike CDKTF, explicit output creation is not required.
6
- * Resource properties are already pulumi.Output<T> types and can be
7
- * exported directly or used with .apply() for transformations.
8
- *
9
- * @example
10
- * ```typescript
11
- * // In CDKTF (old):
12
- * createAzureTfOutput('resourceGroupName', scope, resourceGroup.name)
13
- *
14
- * // In Pulumi (new):
15
- * // No explicit output creation needed - resourceGroup.name is already an output
16
- * export const resourceGroupName = resourceGroup.name
17
- * ```
18
- */
19
-
20
- // Utility functions can be added here as needed for Pulumi Azure operations
21
- export {}