@pattform/api-kit 2.6.6 → 2.6.7
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/FormComponent.d.ts +2 -0
- package/dist/FormComponent.js +14 -10
- package/package.json +1 -1
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,
|