@pattform/api-kit 2.6.6 → 2.6.8
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/AppComponent.d.ts +1 -0
- package/dist/AppComponent.js +5 -2
- package/dist/FormComponent.d.ts +2 -0
- package/dist/FormComponent.js +14 -10
- package/package.json +1 -1
package/dist/AppComponent.d.ts
CHANGED
package/dist/AppComponent.js
CHANGED
|
@@ -7,7 +7,7 @@ const cloudflare = require("@pulumi/cloudflare");
|
|
|
7
7
|
const pattformHelper_1 = require("./pattformHelper");
|
|
8
8
|
class AppComponent extends pulumi.ComponentResource {
|
|
9
9
|
constructor(name, args, opts) {
|
|
10
|
-
var _a, _b, _c, _d;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
11
|
super("custom:pattform:AppComponent", name, args, opts);
|
|
12
12
|
const awsConfig = new pulumi.Config("aws");
|
|
13
13
|
const awsRegion = awsConfig.require("region");
|
|
@@ -104,6 +104,9 @@ class AppComponent extends pulumi.ComponentResource {
|
|
|
104
104
|
phases:
|
|
105
105
|
preBuild:
|
|
106
106
|
commands:
|
|
107
|
+
- nvm install ${(_d = args.nodeVersion) !== null && _d !== void 0 ? _d : "22"}
|
|
108
|
+
- nvm use ${(_e = args.nodeVersion) !== null && _e !== void 0 ? _e : "22"}
|
|
109
|
+
- node -v
|
|
107
110
|
- npm install
|
|
108
111
|
build:
|
|
109
112
|
commands:
|
|
@@ -154,7 +157,7 @@ class AppComponent extends pulumi.ComponentResource {
|
|
|
154
157
|
// stack already manages the apex (e.g. the apex/www site while this
|
|
155
158
|
// is a subdomain app), set manageValidationRecord: false to reuse it
|
|
156
159
|
// instead of colliding on an identical record.
|
|
157
|
-
if ((
|
|
160
|
+
if ((_f = args.manageValidationRecord) !== null && _f !== void 0 ? _f : true) {
|
|
158
161
|
this.validationRecord = new cloudflare.Record(`${appName}-cloudflareValidateRecord-${env}`, {
|
|
159
162
|
zoneId: cloudflareZone.id,
|
|
160
163
|
name: this.domainAssociation.certificateVerificationDnsRecord.apply(record => record.split(' ')[0]),
|
package/dist/FormComponent.d.ts
CHANGED
|
@@ -46,5 +46,7 @@ export interface FormComponentArgs {
|
|
|
46
46
|
brevoApiKey?: pulumi.Input<string>;
|
|
47
47
|
turnstileSiteKey?: pulumi.Input<string>;
|
|
48
48
|
turnstileSecret?: pulumi.Input<string>;
|
|
49
|
+
cloudflareApiToken?: pulumi.Input<string>;
|
|
50
|
+
cloudflareAccountId?: pulumi.Input<string>;
|
|
49
51
|
reservedConcurrency?: number;
|
|
50
52
|
}
|
package/dist/FormComponent.js
CHANGED
|
@@ -15,7 +15,7 @@ const pattformHelper_1 = require("./pattformHelper");
|
|
|
15
15
|
*/
|
|
16
16
|
class FormComponent extends pulumi.ComponentResource {
|
|
17
17
|
constructor(name, args, opts) {
|
|
18
|
-
var _a, _b;
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
19
|
super("custom:pattform:FormComponent", name, args, opts);
|
|
20
20
|
const awsConfig = new pulumi.Config("aws");
|
|
21
21
|
const awsRegion = awsConfig.require("region");
|
|
@@ -37,10 +37,13 @@ class FormComponent extends pulumi.ComponentResource {
|
|
|
37
37
|
sessionName: `pattform-form-${appName}-${env}`,
|
|
38
38
|
},
|
|
39
39
|
} : {})));
|
|
40
|
-
// Turnstile widgets are account-level in Cloudflare (not zone-bound),
|
|
41
|
-
//
|
|
42
|
-
// the
|
|
43
|
-
//
|
|
40
|
+
// Turnstile widgets are account-level in Cloudflare (not zone-bound), so
|
|
41
|
+
// the widget can live in whichever account the caller points at — by
|
|
42
|
+
// default the one in `cloudflare:*` config (the same token AppComponent
|
|
43
|
+
// uses for DNS). When a client's DNS token and Turnstile token differ
|
|
44
|
+
// (per-client Cloudflare accounts, or narrowly scoped tokens), pass
|
|
45
|
+
// cloudflareApiToken/cloudflareAccountId to override just this widget.
|
|
46
|
+
// Pass turnstileSiteKey/turnstileSecret to reuse an existing widget.
|
|
44
47
|
let turnstileSiteKey;
|
|
45
48
|
let turnstileSecret;
|
|
46
49
|
if (args.turnstileSiteKey && args.turnstileSecret) {
|
|
@@ -49,12 +52,13 @@ class FormComponent extends pulumi.ComponentResource {
|
|
|
49
52
|
}
|
|
50
53
|
else {
|
|
51
54
|
const cloudFlareConfig = new pulumi.Config("cloudflare");
|
|
52
|
-
const cloudFlareToken = cloudFlareConfig.getSecret("apiToken");
|
|
53
|
-
const cloudFlareAccountId = cloudFlareConfig.get("accountId");
|
|
55
|
+
const cloudFlareToken = (_c = args.cloudflareApiToken) !== null && _c !== void 0 ? _c : cloudFlareConfig.getSecret("apiToken");
|
|
56
|
+
const cloudFlareAccountId = (_d = args.cloudflareAccountId) !== null && _d !== void 0 ? _d : cloudFlareConfig.get("accountId");
|
|
54
57
|
if (!cloudFlareToken || !cloudFlareAccountId) {
|
|
55
|
-
throw new Error(`${appName}: creating a Turnstile widget needs
|
|
56
|
-
`permission
|
|
57
|
-
`
|
|
58
|
+
throw new Error(`${appName}: creating a Turnstile widget needs a Cloudflare token with Turnstile edit ` +
|
|
59
|
+
`permission and an account id — from cloudflare:apiToken + cloudflare:accountId config, ` +
|
|
60
|
+
`or the cloudflareApiToken/cloudflareAccountId args. Alternatively pass an existing ` +
|
|
61
|
+
`widget's turnstileSiteKey and turnstileSecret.`);
|
|
58
62
|
}
|
|
59
63
|
const cloudFlareProvider = new cloudflare.Provider(`pattform-form-cloudflare-${baseName}-${env}`, {
|
|
60
64
|
apiToken: cloudFlareToken,
|