@drawbridge/drawbridge-utils 0.0.174 → 0.0.175
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/connections/index.cjs +451 -239
- package/dist/connections/index.d.cts +613 -316
- package/dist/connections/index.d.ts +613 -316
- package/dist/connections/index.js +450 -238
- package/dist/providers.cjs +451 -241
- package/dist/providers.d.cts +6 -6
- package/dist/providers.d.ts +6 -6
- package/dist/providers.js +451 -241
- package/package.json +1 -1
package/dist/providers.js
CHANGED
|
@@ -460,7 +460,7 @@ var detectCountry = (value) => {
|
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
462
|
|
|
463
|
-
// lib/connections/segment
|
|
463
|
+
// lib/connections/segment.js
|
|
464
464
|
import { randomUUID } from "crypto";
|
|
465
465
|
var row = ({ connection: connection2, data: data2, manifest, row: described }) => {
|
|
466
466
|
var _a, _b;
|
|
@@ -553,7 +553,7 @@ var driftEnqueues = async ({ applied, read, segment, workflow }) => {
|
|
|
553
553
|
}];
|
|
554
554
|
};
|
|
555
555
|
|
|
556
|
-
// lib/connections/
|
|
556
|
+
// lib/connections/manifests/attentive.js
|
|
557
557
|
var api = async (path, { fetcher = fetch, method = "GET", payload, token }) => {
|
|
558
558
|
const response = await fetcher("https://api.attentivemobile.com" + path, {
|
|
559
559
|
...payload && { body: JSON.stringify(payload) },
|
|
@@ -892,26 +892,6 @@ var attentive_default2 = {
|
|
|
892
892
|
webhook: false
|
|
893
893
|
},
|
|
894
894
|
icon: attentive_default,
|
|
895
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
896
|
-
// what an admin types on the provider screen, and the only declaration of it.
|
|
897
|
-
// It lives beside `requires`, which names the same variables: the manifest
|
|
898
|
-
// says what it needs and this says how someone supplies it, so a credential
|
|
899
|
-
// cannot be required by a vendor that offers nowhere to enter it.
|
|
900
|
-
//
|
|
901
|
-
// `redact` marks a secret — never returned by the api, and blank on save means
|
|
902
|
-
// keep the stored value. `required` drives the live check.
|
|
903
|
-
provider: {
|
|
904
|
-
vendors: {
|
|
905
|
-
attentive: {
|
|
906
|
-
fields: [
|
|
907
|
-
{ input: "text", key: "clientId", credential: "ATTENTIVE_OAUTH_CLIENT_ID", label: "Client ID", message: "From our app's registration in the Attentive developer portal.", required: true },
|
|
908
|
-
{ input: "password", key: "clientSecret", credential: "ATTENTIVE_OAUTH_CLIENT_SECRET", label: "Client secret", message: "Beside the Client ID in the Attentive developer portal.", redact: true, required: true }
|
|
909
|
-
],
|
|
910
|
-
icon: attentive_default,
|
|
911
|
-
name: "Attentive"
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
},
|
|
915
895
|
requires: [
|
|
916
896
|
"ATTENTIVE_OAUTH_CLIENT_ID",
|
|
917
897
|
"ATTENTIVE_OAUTH_CLIENT_SECRET"
|
|
@@ -1002,6 +982,11 @@ var attentive_default2 = {
|
|
|
1002
982
|
}
|
|
1003
983
|
];
|
|
1004
984
|
},
|
|
985
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
986
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
987
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
988
|
+
// to be reconciled at import by mergeVendors().
|
|
989
|
+
vendors: ["attentive"],
|
|
1005
990
|
title: "Attentive",
|
|
1006
991
|
// ATTENTIVE'S SEGMENTS INDEX. There is no documented per-segment url, and the
|
|
1007
992
|
// only identifier we hold is the API's externalId, which their UI may not
|
|
@@ -1019,7 +1004,7 @@ var attentive_default2 = {
|
|
|
1019
1004
|
}
|
|
1020
1005
|
};
|
|
1021
1006
|
|
|
1022
|
-
// lib/connections/
|
|
1007
|
+
// lib/connections/manifests/drawbridge.js
|
|
1023
1008
|
import { createHmac as createHmac2, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
1024
1009
|
|
|
1025
1010
|
// lib/connections/inbound.js
|
|
@@ -1956,7 +1941,7 @@ var MINIMUM_ACTION_CENTS = Math.round(
|
|
|
1956
1941
|
sending.sms.segmentCostCents / channels.sms.actionsPerSegment * MARKUP * 1e3
|
|
1957
1942
|
) / 1e3;
|
|
1958
1943
|
|
|
1959
|
-
// lib/connections/
|
|
1944
|
+
// lib/connections/manifests/drawbridge.js
|
|
1960
1945
|
var STOP_KEYWORDS = ["STOP", "STOPALL", "UNSUBSCRIBE", "CANCEL", "END", "QUIT"];
|
|
1961
1946
|
var START_KEYWORDS = ["START", "UNSTOP", "YES"];
|
|
1962
1947
|
var sendgridInbound = {
|
|
@@ -2653,70 +2638,6 @@ var drawbridge_default2 = {
|
|
|
2653
2638
|
},
|
|
2654
2639
|
// PRIVATE: never in the catalog, always available to the builder.
|
|
2655
2640
|
private: true,
|
|
2656
|
-
// THE PLATFORM'S OWN SENDING CREDENTIALS — SendGrid, Twilio, and the internal
|
|
2657
|
-
// HubSpot portal. No merchant ever sees these; they are what an admin types on
|
|
2658
|
-
// the provider screen so that Drawbridge itself can send.
|
|
2659
|
-
//
|
|
2660
|
-
// They belong on THIS manifest because this is the connection that sends: the
|
|
2661
|
-
// email, sms and segment hooks below are the only things that spend them, and
|
|
2662
|
-
// a private connection is still where a vendor fact lives. They are THREE
|
|
2663
|
-
// VENDORS, not one, and each is its own row and its own admin card — so
|
|
2664
|
-
// SendGrid reads live on a deployment that never configured Twilio, instead
|
|
2665
|
-
// of one card for all three that could only ever be as live as its weakest.
|
|
2666
|
-
//
|
|
2667
|
-
// UNLIKE every public vendor, none of these appear in `requires` — see the
|
|
2668
|
-
// comment there. Availability and configuration are different questions, and a
|
|
2669
|
-
// missing CRM token must not take every base workflow step away.
|
|
2670
|
-
//
|
|
2671
|
-
// ponytail: the field keys keep the names they had on the shared row
|
|
2672
|
-
// (smsSid, hubspotToken) so the readers destructuring vendorSettings() did
|
|
2673
|
-
// not move. Rename them to sid/token when those readers are next touched.
|
|
2674
|
-
provider: {
|
|
2675
|
-
vendors: {
|
|
2676
|
-
sendgrid: {
|
|
2677
|
-
fields: [
|
|
2678
|
-
{ input: "email", key: "accountSender", credential: "SENDGRID_FROM_ADDRESS", label: "Account sender", message: "Verification codes and security alerts send from here.", required: true },
|
|
2679
|
-
{ input: "password", key: "apiKey", credential: "SENDGRID_API_KEY", label: "SendGrid API key", message: "SendGrid dashboard, Settings, API Keys \u2014 full access for sends.", redact: true, required: true },
|
|
2680
|
-
// Optional: SENDGRID_SEND_FROM_ADDRESS is not boot-required in sync
|
|
2681
|
-
// either. Unset, it degrades to the account sender rather than
|
|
2682
|
-
// refusing to start.
|
|
2683
|
-
// NOT redacted, because it is a PUBLIC key. Marking it secret would
|
|
2684
|
-
// be theatre, and it would stop an operator reading back the value
|
|
2685
|
-
// they need to compare against the SendGrid console.
|
|
2686
|
-
//
|
|
2687
|
-
// Optional: absent, the event webhook answers 500 on verify rather
|
|
2688
|
-
// than accepting unverified deliveries, and nothing else notices.
|
|
2689
|
-
{ input: "text", key: "eventKey", credential: "SENDGRID_EVENT_WEBHOOK_KEY", label: "Event webhook key", message: "SendGrid, Settings, Mail Settings, Event Webhook \u2014 the verification key shown once signature verification is enabled. Public, not a secret." },
|
|
2690
|
-
{ input: "email", key: "leadSender", credential: "SENDGRID_SEND_FROM_ADDRESS", label: "Lead sender", message: "The default for lead-facing mail when a merchant has not verified their own domain." }
|
|
2691
|
-
],
|
|
2692
|
-
icon: sendgrid_default,
|
|
2693
|
-
name: "SendGrid"
|
|
2694
|
-
},
|
|
2695
|
-
// Missing, SMS is LOCKED DOWN rather than broken: every send path
|
|
2696
|
-
// refuses cleanly (queue/notification.js cancels, the otc stream skips
|
|
2697
|
-
// and logs), the number-purchase routes deny, and identityDefaults.sms
|
|
2698
|
-
// hides the org's SMS settings entirely. The card reads not live, which
|
|
2699
|
-
// is the truth about Twilio and says nothing about email.
|
|
2700
|
-
twilio: {
|
|
2701
|
-
fields: [
|
|
2702
|
-
{ input: "text", key: "smsFrom", credential: "TWILIO_ACCOUNT_FROM", label: "SMS number", message: "Without Twilio credentials, SMS is disabled across the platform.", required: true },
|
|
2703
|
-
{ input: "password", key: "smsSid", credential: "TWILIO_ACCOUNT_SID", label: "Twilio account SID", message: "Twilio console home \u2014 the AC\u2026 identifier on the account dashboard.", redact: true, required: true },
|
|
2704
|
-
{ input: "password", key: "smsToken", credential: "TWILIO_AUTH_TOKEN", label: "Twilio auth token", message: "Beside the account SID on the Twilio console dashboard.", redact: true, required: true }
|
|
2705
|
-
],
|
|
2706
|
-
icon: twilio_default,
|
|
2707
|
-
name: "Twilio"
|
|
2708
|
-
},
|
|
2709
|
-
// The CRM sync is best-effort internal tooling and no-ops without a
|
|
2710
|
-
// token. Not live here costs nothing a merchant can see.
|
|
2711
|
-
hubspot: {
|
|
2712
|
-
fields: [
|
|
2713
|
-
{ input: "password", key: "hubspotToken", credential: "HUBSPOT_ACCESS_TOKEN", label: "HubSpot access token", message: "Drawbridge's own CRM portal. Internal \u2014 no merchant sees this.", redact: true, required: true }
|
|
2714
|
-
],
|
|
2715
|
-
icon: hubspot_default,
|
|
2716
|
-
name: "HubSpot"
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
},
|
|
2720
2641
|
// NOTHING, and HUBSPOT_ACCESS_TOKEN in particular must not be here.
|
|
2721
2642
|
//
|
|
2722
2643
|
// `requires` gates AVAILABILITY: a name in it that is unset removes the whole
|
|
@@ -2915,6 +2836,16 @@ var drawbridge_default2 = {
|
|
|
2915
2836
|
}
|
|
2916
2837
|
},
|
|
2917
2838
|
tasks: () => [],
|
|
2839
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
2840
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
2841
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
2842
|
+
// to be reconciled at import by mergeVendors().
|
|
2843
|
+
//
|
|
2844
|
+
// THREE, and they have nothing to do with each other: drawbridge is the
|
|
2845
|
+
// platform's own sender and spends SendGrid for email, Twilio for SMS and
|
|
2846
|
+
// HubSpot for CRM. They were bundled under one manifest only because one
|
|
2847
|
+
// connection happens to use all three.
|
|
2848
|
+
vendors: ["sendgrid", "twilio", "hubspot"],
|
|
2918
2849
|
title: "Drawbridge"
|
|
2919
2850
|
};
|
|
2920
2851
|
|
|
@@ -2932,7 +2863,7 @@ var missingScopes = ({ granted, required }) => {
|
|
|
2932
2863
|
return list(required).filter((scope) => !held.has(scope));
|
|
2933
2864
|
};
|
|
2934
2865
|
|
|
2935
|
-
// lib/connections/
|
|
2866
|
+
// lib/connections/manifests/klaviyo.js
|
|
2936
2867
|
var api2 = async (path, { fetcher = fetch, method = "GET", payload, token }) => {
|
|
2937
2868
|
const response = await fetcher("https://a.klaviyo.com/api" + path, {
|
|
2938
2869
|
...payload && { body: JSON.stringify(payload) },
|
|
@@ -3546,24 +3477,6 @@ var klaviyo_default2 = {
|
|
|
3546
3477
|
webhook: false
|
|
3547
3478
|
},
|
|
3548
3479
|
icon: klaviyo_default,
|
|
3549
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
3550
|
-
// what an admin types on the provider screen. Declared here rather than in a
|
|
3551
|
-
// table in lib/providers.js, so a vendor's credentials sit beside the
|
|
3552
|
-
// `requires` that names the same variables. Keyed by the VENDOR that holds
|
|
3553
|
-
// them — here the vendor and the connection are the same thing, which is not
|
|
3554
|
-
// true of every manifest.
|
|
3555
|
-
provider: {
|
|
3556
|
-
vendors: {
|
|
3557
|
-
klaviyo: {
|
|
3558
|
-
fields: [
|
|
3559
|
-
{ input: "text", key: "clientId", credential: "KLAVIYO_OAUTH_CLIENT_ID", label: "Client ID", message: "From our app in the Klaviyo developer portal (developers.klaviyo.com).", required: true },
|
|
3560
|
-
{ input: "password", key: "clientSecret", credential: "KLAVIYO_OAUTH_CLIENT_SECRET", label: "Client secret", message: "Beside the Client ID on the Klaviyo app.", redact: true, required: true }
|
|
3561
|
-
],
|
|
3562
|
-
icon: klaviyo_default,
|
|
3563
|
-
name: "Klaviyo"
|
|
3564
|
-
}
|
|
3565
|
-
}
|
|
3566
|
-
},
|
|
3567
3480
|
requires: [
|
|
3568
3481
|
"KLAVIYO_OAUTH_CLIENT_ID",
|
|
3569
3482
|
"KLAVIYO_OAUTH_CLIENT_SECRET"
|
|
@@ -3702,6 +3615,11 @@ var klaviyo_default2 = {
|
|
|
3702
3615
|
}]
|
|
3703
3616
|
];
|
|
3704
3617
|
},
|
|
3618
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
3619
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
3620
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
3621
|
+
// to be reconciled at import by mergeVendors().
|
|
3622
|
+
vendors: ["klaviyo"],
|
|
3705
3623
|
title: "Klaviyo",
|
|
3706
3624
|
// KLAVIYO PUBLISHES NO DASHBOARD URLS in its API reference. What is on record
|
|
3707
3625
|
// is its own help centre on a list: "you can find a list's ID in the URL in
|
|
@@ -3715,7 +3633,7 @@ var klaviyo_default2 = {
|
|
|
3715
3633
|
}
|
|
3716
3634
|
};
|
|
3717
3635
|
|
|
3718
|
-
// lib/connections/
|
|
3636
|
+
// lib/connections/manifests/mailchimp.js
|
|
3719
3637
|
import { createHash as createHash2 } from "crypto";
|
|
3720
3638
|
|
|
3721
3639
|
// lib/connections/icons/mailchimp.js
|
|
@@ -3725,7 +3643,7 @@ var mailchimp_default = `<svg width="500" height="500" viewBox="0 0 500 500" fil
|
|
|
3725
3643
|
<path d="M360.476 284.243C360.35 283.835 359.618 281.204 358.647 278.052L356.621 272.648C360.575 266.696 360.645 261.405 360.124 258.393C359.531 254.519 357.693 250.944 354.89 248.205C351.766 244.94 345.363 241.563 336.385 239.044L331.671 237.736C331.643 237.524 331.418 226.619 331.235 221.933C331.08 218.555 330.798 213.264 329.152 208.058C327.182 200.993 323.791 194.858 319.527 190.876C331.277 178.717 338.594 165.307 338.58 153.81C338.538 131.703 311.379 124.976 277.902 138.851L270.824 141.863C270.795 141.835 258.004 129.283 257.821 129.128C219.63 95.8334 100.327 228.476 138.49 260.687L146.835 267.737C144.581 273.775 143.781 280.259 144.499 286.664C145.414 295.543 149.973 304.029 157.375 310.6C164.411 316.82 173.684 320.788 182.648 320.774C197.494 354.998 231.408 375.965 271.175 377.161C313.842 378.427 349.641 358.403 364.67 322.435C365.641 319.916 369.806 308.546 369.806 298.513C369.792 288.409 364.093 284.229 360.476 284.243ZM185.913 311.149C184.613 311.381 183.293 311.48 181.973 311.445C169.083 311.079 155.166 299.483 153.787 285.735C152.253 270.537 160.02 258.829 173.783 256.071C175.415 255.72 177.414 255.537 179.552 255.635C187.264 256.085 198.606 261.996 201.209 278.784C203.517 293.63 199.858 308.785 185.913 311.149ZM171.545 246.953C163.179 248.499 155.744 253.244 150.817 260.18C148.045 257.873 142.909 253.426 142.008 251.681C134.635 237.693 150.043 210.478 160.823 195.111C187.405 157.145 229.086 128.424 248.393 133.603C251.517 134.503 261.902 146.563 261.902 146.563C261.902 146.563 242.623 157.244 224.724 172.16C200.646 190.735 182.423 217.697 171.545 246.953ZM306.792 305.464C306.937 305.403 307.057 305.295 307.134 305.157C307.211 305.019 307.239 304.86 307.214 304.704C307.205 304.61 307.178 304.519 307.133 304.436C307.088 304.353 307.027 304.28 306.954 304.221C306.88 304.162 306.796 304.118 306.705 304.092C306.614 304.066 306.519 304.059 306.426 304.071C306.426 304.071 286.246 307.054 267.179 300.089C269.247 293.348 274.792 295.754 283.137 296.444C296.108 297.209 309.116 295.802 321.623 292.279C330.25 289.788 341.592 284.905 350.401 277.953C353.384 284.497 354.425 291.674 354.425 291.674C354.425 291.674 356.719 291.265 358.647 292.447C360.476 293.573 361.799 295.895 360.898 301.89C359.027 313.119 354.271 322.224 346.235 330.611C341.236 336.036 335.277 340.492 328.659 343.754C324.983 345.691 321.151 347.32 317.205 348.623C286.964 358.487 256.006 347.638 246.029 324.321C245.224 322.535 244.556 320.691 244.03 318.804C239.781 303.438 243.383 285.032 254.655 273.408C255.372 272.676 256.09 271.804 256.09 270.706C256.09 269.806 255.499 268.835 255.007 268.131C251.066 262.418 237.374 252.666 240.132 233.795C242.088 220.23 253.951 210.689 265.012 211.252L267.826 211.421C272.611 211.702 276.79 212.307 280.73 212.49C287.344 212.758 293.268 211.801 300.304 205.947C302.683 203.949 304.582 202.246 307.791 201.711C308.128 201.627 308.973 201.359 310.647 201.416C312.365 201.485 314.032 202.015 315.474 202.949C321.103 206.693 321.905 215.783 322.214 222.439C322.383 226.225 322.848 235.414 322.988 238.031C323.354 244.054 324.944 244.912 328.125 245.954C329.94 246.573 331.615 246.995 334.077 247.713C341.521 249.781 345.968 251.934 348.754 254.65C350.198 256.049 351.13 257.893 351.4 259.885C352.315 266.316 346.432 274.252 330.925 281.457C313.954 289.324 293.367 291.322 279.154 289.732L274.173 289.169C262.774 287.649 256.315 302.34 263.14 312.402C267.545 318.889 279.52 323.11 291.523 323.11C319.006 323.139 340.142 311.402 348.023 301.242L348.642 300.356C349.008 299.765 348.712 299.469 348.22 299.779C341.817 304.169 313.279 321.619 282.771 316.384C282.771 316.384 279.056 315.765 275.678 314.442C273.005 313.429 267.362 310.811 266.686 305.042C291.27 312.683 306.792 305.478 306.792 305.464ZM220.671 194.971C230.127 184.051 241.765 174.538 252.206 169.219C252.558 169.022 252.938 169.43 252.741 169.754C251.46 172 250.476 174.403 249.814 176.902C249.73 177.282 250.138 177.592 250.461 177.353C256.963 172.934 268.248 168.192 278.155 167.601C278.251 167.584 278.351 167.601 278.436 167.65C278.521 167.698 278.586 167.775 278.621 167.866C278.656 167.957 278.658 168.058 278.627 168.151C278.596 168.244 278.533 168.323 278.451 168.375C276.809 169.634 275.342 171.105 274.088 172.751C273.891 173.032 274.074 173.44 274.426 173.44C281.378 173.483 291.186 175.903 297.56 179.491C297.982 179.745 297.673 180.575 297.209 180.462C287.527 178.253 271.724 176.564 255.288 180.575C240.597 184.149 229.396 189.666 221.248 195.618C220.826 195.899 220.333 195.351 220.671 194.971Z" fill="#231E15"/>
|
|
3726
3644
|
</svg>`;
|
|
3727
3645
|
|
|
3728
|
-
// lib/connections/
|
|
3646
|
+
// lib/connections/manifests/mailchimp.js
|
|
3729
3647
|
var base = (dc) => {
|
|
3730
3648
|
if (!dc) throw new Error("This Mailchimp connection has no data centre stored, so there is no host to call");
|
|
3731
3649
|
return "https://" + dc + ".api.mailchimp.com/3.0";
|
|
@@ -4123,21 +4041,6 @@ var mailchimp_default2 = {
|
|
|
4123
4041
|
webhook: false
|
|
4124
4042
|
},
|
|
4125
4043
|
icon: mailchimp_default,
|
|
4126
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
4127
|
-
// what an admin types on the provider screen, beside the `requires` naming the
|
|
4128
|
-
// same variables.
|
|
4129
|
-
provider: {
|
|
4130
|
-
vendors: {
|
|
4131
|
-
mailchimp: {
|
|
4132
|
-
fields: [
|
|
4133
|
-
{ input: "text", key: "clientId", credential: "MAILCHIMP_OAUTH_CLIENT_ID", label: "Client ID", message: "From our registered app \u2014 Mailchimp account, Extras, Registered apps.", required: true },
|
|
4134
|
-
{ input: "password", key: "clientSecret", credential: "MAILCHIMP_OAUTH_CLIENT_SECRET", label: "Client secret", message: "Beside the Client ID on the registered app.", redact: true, required: true }
|
|
4135
|
-
],
|
|
4136
|
-
icon: mailchimp_default,
|
|
4137
|
-
name: "Mailchimp"
|
|
4138
|
-
}
|
|
4139
|
-
}
|
|
4140
|
-
},
|
|
4141
4044
|
// The OAuth client this deployment registered. Without both, the vendor drops
|
|
4142
4045
|
// out of availableConnections rather than offering a Connect button that
|
|
4143
4046
|
// cannot complete.
|
|
@@ -4240,6 +4143,11 @@ var mailchimp_default2 = {
|
|
|
4240
4143
|
}
|
|
4241
4144
|
];
|
|
4242
4145
|
},
|
|
4146
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
4147
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
4148
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
4149
|
+
// to be reconciled at import by mergeVendors().
|
|
4150
|
+
vendors: ["mailchimp"],
|
|
4243
4151
|
title: "Mailchimp",
|
|
4244
4152
|
// THE MERCHANT'S OWN ADMIN. Mailchimp's list schema states the shape outright:
|
|
4245
4153
|
// the web_id field is "The ID used in the Mailchimp web application. View this
|
|
@@ -4259,7 +4167,7 @@ var mailchimp_default2 = {
|
|
|
4259
4167
|
}
|
|
4260
4168
|
};
|
|
4261
4169
|
|
|
4262
|
-
// lib/connections/
|
|
4170
|
+
// lib/connections/manifests/shopify.js
|
|
4263
4171
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
4264
4172
|
import { customAlphabet as customAlphabet2 } from "nanoid";
|
|
4265
4173
|
|
|
@@ -4341,7 +4249,7 @@ var slugify = (value, nochars = false) => {
|
|
|
4341
4249
|
);
|
|
4342
4250
|
};
|
|
4343
4251
|
|
|
4344
|
-
// lib/connections/
|
|
4252
|
+
// lib/connections/manifests/shopify.js
|
|
4345
4253
|
var toLine = ({
|
|
4346
4254
|
price,
|
|
4347
4255
|
product_id: productId,
|
|
@@ -5470,41 +5378,6 @@ var shopify_default2 = {
|
|
|
5470
5378
|
},
|
|
5471
5379
|
icon: shopify_default,
|
|
5472
5380
|
inbound,
|
|
5473
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
5474
|
-
// what an admin types on the provider screen. The four names below are exactly
|
|
5475
|
-
// what `requires` gates on, which is the point of declaring them together: a
|
|
5476
|
-
// name required by the manifest and enterable nowhere is a vendor that can
|
|
5477
|
-
// never go live from the admin screen.
|
|
5478
|
-
provider: {
|
|
5479
|
-
vendors: {
|
|
5480
|
-
shopify: {
|
|
5481
|
-
fields: [
|
|
5482
|
-
{ input: "text", key: "apiKey", credential: "SHOPIFY_API_KEY", label: "API key", message: "The app's Client ID \u2014 Dev Dashboard, the app, Settings.", required: true },
|
|
5483
|
-
{ input: "password", key: "apiSecret", credential: "SHOPIFY_API_SECRET", label: "API secret", message: "The app's Client secret, beside the Client ID in the app's settings.", redact: true, required: true },
|
|
5484
|
-
{ input: "text", key: "appHandle", credential: "SHOPIFY_APP_HANDLE", label: "App handle", message: "The app's URL handle (for example drawbridge-development), from the app's configuration.", required: true },
|
|
5485
|
-
{ input: "text", key: "listingUrl", credential: "SHOPIFY_APP_LISTING_URL", label: "App listing URL", message: 'Where "View on the Shopify App Store" sends merchants \u2014 the public listing, or the Dev Dashboard install link for the dev app.', required: true },
|
|
5486
|
-
// The usage meter's event handle, when the plan config's meter ever
|
|
5487
|
-
// changes: stored value overrides the built-in default
|
|
5488
|
-
// (events.order.handle) at the mint point, and `format : 'slug'`
|
|
5489
|
-
// normalizes it on save — a handle can carry no spaces or capitals,
|
|
5490
|
-
// and classification against it is case-sensitive. Optional: empty
|
|
5491
|
-
// means the default, and the sender still refuses any handle that
|
|
5492
|
-
// disagrees with the transaction it minted.
|
|
5493
|
-
{ format: "slug", input: "text", key: "orderEventHandle", label: "Order event handle", message: "Must match the usage meter's Handle field on the plan exactly \u2014 lowercase and hyphens. Leave empty to use drawbridge-orders.", required: false, setting: true },
|
|
5494
|
-
// The Partner API credential set — the ONE place meter billing is
|
|
5495
|
-
// observable (CHARGE_USAGE accrual events). Org id and numeric app
|
|
5496
|
-
// id come from the Partner Dashboard; the token from Settings →
|
|
5497
|
-
// Partner API clients (Manage-apps permission). All optional: the
|
|
5498
|
-
// accrual probe simply stays off until they exist.
|
|
5499
|
-
{ input: "text", key: "partnerOrgId", label: "Partner organization ID", message: "The number in the Partner Dashboard URL \u2014 partners.shopify.com/<this number>/\u2026 \u2014 NOT the admin organization_id from the app listing link.", required: false, setting: true },
|
|
5500
|
-
{ input: "text", key: "partnerAppId", label: "Partner app ID (numeric)", message: "The numeric id in the app's Partner Dashboard URL \u2014 not the Client ID.", required: false, setting: true },
|
|
5501
|
-
{ input: "password", key: "partnerToken", label: "Partner API token", message: "Partner Dashboard, Settings, Partner API clients \u2014 create one with Manage apps and paste the prtapi_ token.", redact: true, required: false, setting: true }
|
|
5502
|
-
],
|
|
5503
|
-
icon: shopify_default,
|
|
5504
|
-
name: "Shopify"
|
|
5505
|
-
}
|
|
5506
|
-
}
|
|
5507
|
-
},
|
|
5508
5381
|
// A pre-launch integration: it only surfaces once the App Store listing
|
|
5509
5382
|
// exists and the app is fully configured. Requiring all four means it can
|
|
5510
5383
|
// never render half-configured — and absence of any one excludes the
|
|
@@ -5708,6 +5581,13 @@ var shopify_default2 = {
|
|
|
5708
5581
|
] : []
|
|
5709
5582
|
];
|
|
5710
5583
|
},
|
|
5584
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Declared once in
|
|
5585
|
+
// lib/connections/vendors/shopify.js, and named here by whoever uses it.
|
|
5586
|
+
//
|
|
5587
|
+
// SHOPIFY_API_SECRET is spent by drawbridge-shopify-app and drawbridge-webhooks
|
|
5588
|
+
// too, which is the clearest case for why a vendor is not owned by whichever
|
|
5589
|
+
// connection happened to declare it first.
|
|
5590
|
+
vendors: ["shopify"],
|
|
5711
5591
|
title: "Shopify",
|
|
5712
5592
|
// THE VENDOR'S OWN ADMIN, one function per thing worth linking to. It lives
|
|
5713
5593
|
// here rather than at the top level so a second link (a product, an order)
|
|
@@ -5734,7 +5614,7 @@ var shopify_default2 = {
|
|
|
5734
5614
|
}
|
|
5735
5615
|
};
|
|
5736
5616
|
|
|
5737
|
-
// lib/connections/
|
|
5617
|
+
// lib/connections/manifests/webhook.js
|
|
5738
5618
|
import crypto3 from "crypto";
|
|
5739
5619
|
|
|
5740
5620
|
// lib/safe-http.js
|
|
@@ -5879,7 +5759,7 @@ var safeRequest = async ({
|
|
|
5879
5759
|
}
|
|
5880
5760
|
};
|
|
5881
5761
|
|
|
5882
|
-
// lib/connections/
|
|
5762
|
+
// lib/connections/manifests/webhook.js
|
|
5883
5763
|
var RESPONSE_LIMIT = 64 * 1024;
|
|
5884
5764
|
var signature = ({ body, settings }) => {
|
|
5885
5765
|
var _a;
|
|
@@ -6069,9 +5949,369 @@ var webhook_default = {
|
|
|
6069
5949
|
title: "Webhook signing"
|
|
6070
5950
|
}
|
|
6071
5951
|
],
|
|
5952
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
5953
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
5954
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
5955
|
+
// to be reconciled at import by mergeVendors().
|
|
5956
|
+
//
|
|
5957
|
+
// Empty: webhook has no third party behind it — nothing to authenticate
|
|
5958
|
+
// against and nothing for an admin to type.
|
|
5959
|
+
vendors: [],
|
|
6072
5960
|
title: "Webhooks"
|
|
6073
5961
|
};
|
|
6074
5962
|
|
|
5963
|
+
// lib/connections/vendors/attentive.js
|
|
5964
|
+
var attentive_default3 = {
|
|
5965
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
5966
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
5967
|
+
// to appear three times per manifest.
|
|
5968
|
+
fields: [
|
|
5969
|
+
{
|
|
5970
|
+
credential: "ATTENTIVE_OAUTH_CLIENT_ID",
|
|
5971
|
+
input: "text",
|
|
5972
|
+
key: "clientId",
|
|
5973
|
+
label: "Client ID",
|
|
5974
|
+
message: "From our app's registration in the Attentive developer portal.",
|
|
5975
|
+
required: true
|
|
5976
|
+
},
|
|
5977
|
+
{
|
|
5978
|
+
credential: "ATTENTIVE_OAUTH_CLIENT_SECRET",
|
|
5979
|
+
input: "password",
|
|
5980
|
+
key: "clientSecret",
|
|
5981
|
+
label: "Client secret",
|
|
5982
|
+
message: "Beside the Client ID in the Attentive developer portal.",
|
|
5983
|
+
redact: true,
|
|
5984
|
+
required: true
|
|
5985
|
+
}
|
|
5986
|
+
],
|
|
5987
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
5988
|
+
// used to throw when two manifests disagreed about this.
|
|
5989
|
+
icon: attentive_default,
|
|
5990
|
+
name: "Attentive",
|
|
5991
|
+
slug: "attentive",
|
|
5992
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
5993
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
5994
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
5995
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
5996
|
+
// was saying where the data belonged.
|
|
5997
|
+
urls: {
|
|
5998
|
+
api: "https://docs.attentive.com/reference/listsegments",
|
|
5999
|
+
dashboard: "https://docs.attentive.com/docs/segments",
|
|
6000
|
+
scopes: "https://docs.attentive.com/docs/authentication"
|
|
6001
|
+
}
|
|
6002
|
+
};
|
|
6003
|
+
|
|
6004
|
+
// lib/connections/vendors/hubspot.js
|
|
6005
|
+
var hubspot_default2 = {
|
|
6006
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6007
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6008
|
+
// to appear three times per manifest.
|
|
6009
|
+
fields: [
|
|
6010
|
+
{
|
|
6011
|
+
credential: "HUBSPOT_ACCESS_TOKEN",
|
|
6012
|
+
input: "password",
|
|
6013
|
+
key: "hubspotToken",
|
|
6014
|
+
label: "HubSpot access token",
|
|
6015
|
+
message: "Drawbridge's own CRM portal. Internal \u2014 no merchant sees this.",
|
|
6016
|
+
redact: true,
|
|
6017
|
+
required: true
|
|
6018
|
+
}
|
|
6019
|
+
],
|
|
6020
|
+
// The vendor's own mark rather than the connection's: drawbridge fronts three
|
|
6021
|
+
// vendors and none of them is Drawbridge.
|
|
6022
|
+
icon: hubspot_default,
|
|
6023
|
+
name: "HubSpot",
|
|
6024
|
+
slug: "hubspot",
|
|
6025
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6026
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6027
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6028
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6029
|
+
// was saying where the data belonged.
|
|
6030
|
+
urls: {
|
|
6031
|
+
api: "https://developers.hubspot.com/docs/reference/api/crm/objects/contacts",
|
|
6032
|
+
dashboard: "https://knowledge.hubspot.com/contacts/create-contacts",
|
|
6033
|
+
scopes: false
|
|
6034
|
+
}
|
|
6035
|
+
};
|
|
6036
|
+
|
|
6037
|
+
// lib/connections/vendors/klaviyo.js
|
|
6038
|
+
var klaviyo_default3 = {
|
|
6039
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6040
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6041
|
+
// to appear three times per manifest.
|
|
6042
|
+
fields: [
|
|
6043
|
+
{
|
|
6044
|
+
credential: "KLAVIYO_OAUTH_CLIENT_ID",
|
|
6045
|
+
input: "text",
|
|
6046
|
+
key: "clientId",
|
|
6047
|
+
label: "Client ID",
|
|
6048
|
+
message: "From our app in the Klaviyo developer portal (developers.klaviyo.com).",
|
|
6049
|
+
required: true
|
|
6050
|
+
},
|
|
6051
|
+
{
|
|
6052
|
+
credential: "KLAVIYO_OAUTH_CLIENT_SECRET",
|
|
6053
|
+
input: "password",
|
|
6054
|
+
key: "clientSecret",
|
|
6055
|
+
label: "Client secret",
|
|
6056
|
+
message: "Beside the Client ID on the Klaviyo app.",
|
|
6057
|
+
redact: true,
|
|
6058
|
+
required: true
|
|
6059
|
+
}
|
|
6060
|
+
],
|
|
6061
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6062
|
+
// used to throw when two manifests disagreed about this.
|
|
6063
|
+
icon: klaviyo_default,
|
|
6064
|
+
name: "Klaviyo",
|
|
6065
|
+
slug: "klaviyo",
|
|
6066
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6067
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6068
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6069
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6070
|
+
// was saying where the data belonged.
|
|
6071
|
+
urls: {
|
|
6072
|
+
api: "https://developers.klaviyo.com/en/reference/api_overview",
|
|
6073
|
+
dashboard: "https://help.klaviyo.com/hc/en-us/articles/115005078647",
|
|
6074
|
+
scopes: "https://developers.klaviyo.com/en/docs/authenticate_"
|
|
6075
|
+
}
|
|
6076
|
+
};
|
|
6077
|
+
|
|
6078
|
+
// lib/connections/vendors/mailchimp.js
|
|
6079
|
+
var mailchimp_default3 = {
|
|
6080
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6081
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6082
|
+
// to appear three times per manifest.
|
|
6083
|
+
fields: [
|
|
6084
|
+
{
|
|
6085
|
+
credential: "MAILCHIMP_OAUTH_CLIENT_ID",
|
|
6086
|
+
input: "text",
|
|
6087
|
+
key: "clientId",
|
|
6088
|
+
label: "Client ID",
|
|
6089
|
+
message: "From our registered app \u2014 Mailchimp account, Extras, Registered apps.",
|
|
6090
|
+
required: true
|
|
6091
|
+
},
|
|
6092
|
+
{
|
|
6093
|
+
credential: "MAILCHIMP_OAUTH_CLIENT_SECRET",
|
|
6094
|
+
input: "password",
|
|
6095
|
+
key: "clientSecret",
|
|
6096
|
+
label: "Client secret",
|
|
6097
|
+
message: "Beside the Client ID on the registered app.",
|
|
6098
|
+
redact: true,
|
|
6099
|
+
required: true
|
|
6100
|
+
}
|
|
6101
|
+
],
|
|
6102
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6103
|
+
// used to throw when two manifests disagreed about this.
|
|
6104
|
+
icon: mailchimp_default,
|
|
6105
|
+
name: "Mailchimp",
|
|
6106
|
+
slug: "mailchimp",
|
|
6107
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6108
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6109
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6110
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6111
|
+
// was saying where the data belonged.
|
|
6112
|
+
urls: {
|
|
6113
|
+
api: "https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/",
|
|
6114
|
+
dashboard: "https://mailchimp.com/help/manage-tags/",
|
|
6115
|
+
scopes: false
|
|
6116
|
+
}
|
|
6117
|
+
};
|
|
6118
|
+
|
|
6119
|
+
// lib/connections/vendors/sendgrid.js
|
|
6120
|
+
var sendgrid_default2 = {
|
|
6121
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6122
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6123
|
+
// to appear three times per manifest.
|
|
6124
|
+
fields: [
|
|
6125
|
+
{
|
|
6126
|
+
credential: "SENDGRID_FROM_ADDRESS",
|
|
6127
|
+
input: "email",
|
|
6128
|
+
key: "accountSender",
|
|
6129
|
+
label: "Account sender",
|
|
6130
|
+
message: "Verification codes and security alerts send from here.",
|
|
6131
|
+
required: true
|
|
6132
|
+
},
|
|
6133
|
+
{
|
|
6134
|
+
credential: "SENDGRID_API_KEY",
|
|
6135
|
+
input: "password",
|
|
6136
|
+
key: "apiKey",
|
|
6137
|
+
label: "SendGrid API key",
|
|
6138
|
+
message: "SendGrid dashboard, Settings, API Keys \u2014 full access for sends.",
|
|
6139
|
+
redact: true,
|
|
6140
|
+
required: true
|
|
6141
|
+
},
|
|
6142
|
+
{
|
|
6143
|
+
credential: "SENDGRID_EVENT_WEBHOOK_KEY",
|
|
6144
|
+
input: "text",
|
|
6145
|
+
key: "eventKey",
|
|
6146
|
+
label: "Event webhook key",
|
|
6147
|
+
message: "SendGrid, Settings, Mail Settings, Event Webhook \u2014 the verification key shown once signature verification is enabled. Public, not a secret."
|
|
6148
|
+
},
|
|
6149
|
+
{
|
|
6150
|
+
credential: "SENDGRID_SEND_FROM_ADDRESS",
|
|
6151
|
+
input: "email",
|
|
6152
|
+
key: "leadSender",
|
|
6153
|
+
label: "Lead sender",
|
|
6154
|
+
message: "The default for lead-facing mail when a merchant has not verified their own domain."
|
|
6155
|
+
}
|
|
6156
|
+
],
|
|
6157
|
+
// The vendor's own mark rather than the connection's: drawbridge fronts three
|
|
6158
|
+
// vendors and none of them is Drawbridge.
|
|
6159
|
+
icon: sendgrid_default,
|
|
6160
|
+
name: "SendGrid",
|
|
6161
|
+
slug: "sendgrid",
|
|
6162
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6163
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6164
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6165
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6166
|
+
// was saying where the data belonged.
|
|
6167
|
+
urls: {
|
|
6168
|
+
api: "https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send",
|
|
6169
|
+
dashboard: "https://www.twilio.com/docs/sendgrid/ui/analytics-and-reporting/email-activity-feed",
|
|
6170
|
+
scopes: false
|
|
6171
|
+
}
|
|
6172
|
+
};
|
|
6173
|
+
|
|
6174
|
+
// lib/connections/vendors/shopify.js
|
|
6175
|
+
var shopify_default3 = {
|
|
6176
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6177
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6178
|
+
// to appear three times per manifest.
|
|
6179
|
+
fields: [
|
|
6180
|
+
{
|
|
6181
|
+
credential: "SHOPIFY_API_KEY",
|
|
6182
|
+
input: "text",
|
|
6183
|
+
key: "apiKey",
|
|
6184
|
+
label: "API key",
|
|
6185
|
+
message: "The app's Client ID \u2014 Dev Dashboard, the app, Settings.",
|
|
6186
|
+
required: true
|
|
6187
|
+
},
|
|
6188
|
+
{
|
|
6189
|
+
credential: "SHOPIFY_API_SECRET",
|
|
6190
|
+
input: "password",
|
|
6191
|
+
key: "apiSecret",
|
|
6192
|
+
label: "API secret",
|
|
6193
|
+
message: "The app's Client secret, beside the Client ID in the app's settings.",
|
|
6194
|
+
redact: true,
|
|
6195
|
+
required: true
|
|
6196
|
+
},
|
|
6197
|
+
{
|
|
6198
|
+
credential: "SHOPIFY_APP_HANDLE",
|
|
6199
|
+
input: "text",
|
|
6200
|
+
key: "appHandle",
|
|
6201
|
+
label: "App handle",
|
|
6202
|
+
message: "The app's URL handle (for example drawbridge-development), from the app's configuration.",
|
|
6203
|
+
required: true
|
|
6204
|
+
},
|
|
6205
|
+
{
|
|
6206
|
+
credential: "SHOPIFY_APP_LISTING_URL",
|
|
6207
|
+
input: "text",
|
|
6208
|
+
key: "listingUrl",
|
|
6209
|
+
label: "App listing URL",
|
|
6210
|
+
message: 'Where "View on the Shopify App Store" sends merchants \u2014 the public listing, or the Dev Dashboard install link for the dev app.',
|
|
6211
|
+
required: true
|
|
6212
|
+
},
|
|
6213
|
+
{
|
|
6214
|
+
format: "slug",
|
|
6215
|
+
input: "text",
|
|
6216
|
+
key: "orderEventHandle",
|
|
6217
|
+
label: "Order event handle",
|
|
6218
|
+
message: "Must match the usage meter's Handle field on the plan exactly \u2014 lowercase and hyphens. Leave empty to use drawbridge-orders.",
|
|
6219
|
+
required: false,
|
|
6220
|
+
setting: true
|
|
6221
|
+
},
|
|
6222
|
+
{
|
|
6223
|
+
input: "text",
|
|
6224
|
+
key: "partnerOrgId",
|
|
6225
|
+
label: "Partner organization ID",
|
|
6226
|
+
message: "The number in the Partner Dashboard URL \u2014 partners.shopify.com/<this number>/\u2026 \u2014 NOT the admin organization_id from the app listing link.",
|
|
6227
|
+
required: false,
|
|
6228
|
+
setting: true
|
|
6229
|
+
},
|
|
6230
|
+
{
|
|
6231
|
+
input: "text",
|
|
6232
|
+
key: "partnerAppId",
|
|
6233
|
+
label: "Partner app ID (numeric)",
|
|
6234
|
+
message: "The numeric id in the app's Partner Dashboard URL \u2014 not the Client ID.",
|
|
6235
|
+
required: false,
|
|
6236
|
+
setting: true
|
|
6237
|
+
},
|
|
6238
|
+
{
|
|
6239
|
+
input: "password",
|
|
6240
|
+
key: "partnerToken",
|
|
6241
|
+
label: "Partner API token",
|
|
6242
|
+
message: "Partner Dashboard, Settings, Partner API clients \u2014 create one with Manage apps and paste the prtapi_ token.",
|
|
6243
|
+
redact: true,
|
|
6244
|
+
required: false,
|
|
6245
|
+
setting: true
|
|
6246
|
+
}
|
|
6247
|
+
],
|
|
6248
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6249
|
+
// used to throw when two manifests disagreed about this.
|
|
6250
|
+
icon: shopify_default,
|
|
6251
|
+
name: "Shopify",
|
|
6252
|
+
slug: "shopify",
|
|
6253
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6254
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6255
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6256
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6257
|
+
// was saying where the data belonged.
|
|
6258
|
+
urls: {
|
|
6259
|
+
api: "https://shopify.dev/docs/api/admin-graphql",
|
|
6260
|
+
dashboard: "https://help.shopify.com/en/manual/apps",
|
|
6261
|
+
scopes: "https://shopify.dev/docs/api/usage/access-scopes"
|
|
6262
|
+
}
|
|
6263
|
+
};
|
|
6264
|
+
|
|
6265
|
+
// lib/connections/vendors/twilio.js
|
|
6266
|
+
var twilio_default2 = {
|
|
6267
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6268
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6269
|
+
// to appear three times per manifest.
|
|
6270
|
+
fields: [
|
|
6271
|
+
{
|
|
6272
|
+
credential: "TWILIO_ACCOUNT_FROM",
|
|
6273
|
+
input: "text",
|
|
6274
|
+
key: "smsFrom",
|
|
6275
|
+
label: "SMS number",
|
|
6276
|
+
message: "Without Twilio credentials, SMS is disabled across the platform.",
|
|
6277
|
+
required: true
|
|
6278
|
+
},
|
|
6279
|
+
{
|
|
6280
|
+
credential: "TWILIO_ACCOUNT_SID",
|
|
6281
|
+
input: "password",
|
|
6282
|
+
key: "smsSid",
|
|
6283
|
+
label: "Twilio account SID",
|
|
6284
|
+
message: "Twilio console home \u2014 the AC\u2026 identifier on the account dashboard.",
|
|
6285
|
+
redact: true,
|
|
6286
|
+
required: true
|
|
6287
|
+
},
|
|
6288
|
+
{
|
|
6289
|
+
credential: "TWILIO_AUTH_TOKEN",
|
|
6290
|
+
input: "password",
|
|
6291
|
+
key: "smsToken",
|
|
6292
|
+
label: "Twilio auth token",
|
|
6293
|
+
message: "Beside the account SID on the Twilio console dashboard.",
|
|
6294
|
+
redact: true,
|
|
6295
|
+
required: true
|
|
6296
|
+
}
|
|
6297
|
+
],
|
|
6298
|
+
// The vendor's own mark rather than the connection's: drawbridge fronts three
|
|
6299
|
+
// vendors and none of them is Drawbridge.
|
|
6300
|
+
icon: twilio_default,
|
|
6301
|
+
name: "Twilio",
|
|
6302
|
+
slug: "twilio",
|
|
6303
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6304
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6305
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6306
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6307
|
+
// was saying where the data belonged.
|
|
6308
|
+
urls: {
|
|
6309
|
+
api: "https://www.twilio.com/docs/messaging/api/message-resource",
|
|
6310
|
+
dashboard: "https://www.twilio.com/docs/messaging/guides/debugging-tools",
|
|
6311
|
+
scopes: false
|
|
6312
|
+
}
|
|
6313
|
+
};
|
|
6314
|
+
|
|
6075
6315
|
// lib/connections/index.js
|
|
6076
6316
|
var QUEUES = ["connection", "notification", "segment", "webhook"];
|
|
6077
6317
|
var implemented = (hooks, path) => {
|
|
@@ -6092,8 +6332,35 @@ var checkIcon = (owner, icon) => {
|
|
|
6092
6332
|
throw new Error(owner + " icon wraps a raster \u2014 re-export it as vector shapes");
|
|
6093
6333
|
}
|
|
6094
6334
|
};
|
|
6335
|
+
var vendors = Object.freeze(Object.fromEntries(
|
|
6336
|
+
[attentive_default3, hubspot_default2, klaviyo_default3, mailchimp_default3, sendgrid_default2, shopify_default3, twilio_default2].map((vendor) => [vendor.slug, vendor])
|
|
6337
|
+
));
|
|
6338
|
+
var buildVendor = (vendor) => {
|
|
6339
|
+
if (!(vendor == null ? void 0 : vendor.slug)) throw new Error("A vendor needs a slug");
|
|
6340
|
+
if (!vendor.name) throw new Error("vendor " + vendor.slug + " has no name");
|
|
6341
|
+
checkIcon("vendor " + vendor.slug, vendor.icon);
|
|
6342
|
+
if (!Array.isArray(vendor.fields) || !vendor.fields.length) {
|
|
6343
|
+
throw new Error("vendor " + vendor.slug + " has no fields \u2014 a vendor nothing is typed into holds nothing");
|
|
6344
|
+
}
|
|
6345
|
+
for (const field2 of vendor.fields) {
|
|
6346
|
+
if (!(field2 == null ? void 0 : field2.key) || !(field2 == null ? void 0 : field2.label)) {
|
|
6347
|
+
throw new Error("vendor " + vendor.slug + " declares a field with no key or label");
|
|
6348
|
+
}
|
|
6349
|
+
if (!INPUTS.includes(field2.input)) {
|
|
6350
|
+
throw new Error(vendor.slug + "." + field2.key + " needs an input the admin form can render \u2014 one of " + INPUTS.join(", "));
|
|
6351
|
+
}
|
|
6352
|
+
if (field2.input === "password" && !field2.redact) {
|
|
6353
|
+
throw new Error(vendor.slug + "." + field2.key + " is a password and must declare redact : true \u2014 the api would hand the value back");
|
|
6354
|
+
}
|
|
6355
|
+
}
|
|
6356
|
+
return Object.freeze(vendor);
|
|
6357
|
+
};
|
|
6358
|
+
for (const [slug2, vendor] of Object.entries(vendors)) {
|
|
6359
|
+
if (vendor.slug !== slug2) throw new Error("vendor file " + slug2 + " declares slug " + vendor.slug);
|
|
6360
|
+
buildVendor(vendor);
|
|
6361
|
+
}
|
|
6095
6362
|
var build = (manifest) => {
|
|
6096
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s
|
|
6363
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
6097
6364
|
if (!(manifest == null ? void 0 : manifest.slug)) throw new Error("A connection needs a slug");
|
|
6098
6365
|
if (!(manifest == null ? void 0 : manifest.title)) throw new Error(manifest.slug + " needs a title");
|
|
6099
6366
|
if (!(manifest == null ? void 0 : manifest.private) && !(manifest == null ? void 0 : manifest.feature)) throw new Error(manifest.slug + " needs a plan feature key");
|
|
@@ -6123,53 +6390,42 @@ var build = (manifest) => {
|
|
|
6123
6390
|
}
|
|
6124
6391
|
}
|
|
6125
6392
|
}
|
|
6126
|
-
|
|
6127
|
-
|
|
6393
|
+
checkIcon(manifest.slug, manifest == null ? void 0 : manifest.icon);
|
|
6394
|
+
if (!Array.isArray(manifest.vendors)) {
|
|
6395
|
+
throw new Error(manifest.slug + " must declare vendors \u2014 an array of vendor slugs, empty when it spends none");
|
|
6128
6396
|
}
|
|
6129
6397
|
const declaredKeys = /* @__PURE__ */ new Set();
|
|
6130
|
-
for (const
|
|
6131
|
-
if (!(
|
|
6132
|
-
|
|
6133
|
-
if (!Array.isArray(declared.fields) || !declared.fields.length) {
|
|
6134
|
-
throw new Error(manifest.slug + " declares vendor " + vendor + " with no fields \u2014 a vendor nothing is typed into holds nothing");
|
|
6398
|
+
for (const slug2 of manifest.vendors) {
|
|
6399
|
+
if (!Object.hasOwn(vendors, slug2)) {
|
|
6400
|
+
throw new Error(manifest.slug + " spends vendor " + slug2 + ", which has no file in lib/connections/vendors");
|
|
6135
6401
|
}
|
|
6136
|
-
for (const field2 of
|
|
6137
|
-
if (!(field2 == null ? void 0 : field2.key) || !(field2 == null ? void 0 : field2.label)) {
|
|
6138
|
-
throw new Error(manifest.slug + " declares a provider field with no key or label");
|
|
6139
|
-
}
|
|
6140
|
-
if (!INPUTS.includes(field2.input)) {
|
|
6141
|
-
throw new Error(manifest.slug + ".provider." + field2.key + " needs an input the admin form can render \u2014 one of " + INPUTS.join(", "));
|
|
6142
|
-
}
|
|
6143
|
-
if (field2.input === "password" && !field2.redact) {
|
|
6144
|
-
throw new Error(manifest.slug + ".provider." + field2.key + " is a password and must declare redact : true \u2014 the api would hand the value back");
|
|
6145
|
-
}
|
|
6402
|
+
for (const field2 of vendors[slug2].fields) {
|
|
6146
6403
|
if (declaredKeys.has(field2.key)) {
|
|
6147
|
-
throw new Error(manifest.slug + "
|
|
6404
|
+
throw new Error(manifest.slug + " spends " + field2.key + " under two vendors \u2014 vendorSettings() merges them and one would win");
|
|
6148
6405
|
}
|
|
6149
6406
|
declaredKeys.add(field2.key);
|
|
6150
6407
|
}
|
|
6151
6408
|
}
|
|
6152
|
-
checkIcon(manifest.slug, manifest == null ? void 0 : manifest.icon);
|
|
6153
6409
|
if (!GROUPS.includes(manifest == null ? void 0 : manifest.group)) {
|
|
6154
6410
|
throw new Error(manifest.slug + " needs a group \u2014 one of " + GROUPS.join(", "));
|
|
6155
6411
|
}
|
|
6156
|
-
if ((
|
|
6412
|
+
if ((_c = manifest == null ? void 0 : manifest.connect) == null ? void 0 : _c.type) {
|
|
6157
6413
|
throw new Error(manifest.slug + " declares connect.type \u2014 that is auth.type now");
|
|
6158
6414
|
}
|
|
6159
|
-
if (!AUTH_TYPES.includes((
|
|
6415
|
+
if (!AUTH_TYPES.includes((_d = manifest == null ? void 0 : manifest.auth) == null ? void 0 : _d.type)) {
|
|
6160
6416
|
throw new Error(manifest.slug + " needs auth.type \u2014 one of " + AUTH_TYPES.join(", "));
|
|
6161
6417
|
}
|
|
6162
6418
|
if (manifest.auth.type === "oauth") {
|
|
6163
6419
|
for (const field2 of OAUTH_FIELDS) {
|
|
6164
|
-
if (!((
|
|
6420
|
+
if (!((_e = manifest.auth.oauth) == null ? void 0 : _e[field2])) {
|
|
6165
6421
|
throw new Error(manifest.slug + " is oauth and must declare auth.oauth." + field2);
|
|
6166
6422
|
}
|
|
6167
6423
|
}
|
|
6168
|
-
if (typeof ((
|
|
6424
|
+
if (typeof ((_g = (_f = manifest.hooks) == null ? void 0 : _f.auth) == null ? void 0 : _g.token) !== "function") {
|
|
6169
6425
|
throw new Error(manifest.slug + " is oauth and must implement hooks.auth.token \u2014 point it at authToken() or wrap it");
|
|
6170
6426
|
}
|
|
6171
6427
|
for (const url of OAUTH_URLS) {
|
|
6172
|
-
if (!((
|
|
6428
|
+
if (!((_i = (_h = manifest.auth.oauth) == null ? void 0 : _h.urls) == null ? void 0 : _i[url])) {
|
|
6173
6429
|
throw new Error(manifest.slug + " is oauth and must declare auth.oauth.urls." + url);
|
|
6174
6430
|
}
|
|
6175
6431
|
}
|
|
@@ -6179,16 +6435,16 @@ var build = (manifest) => {
|
|
|
6179
6435
|
);
|
|
6180
6436
|
}
|
|
6181
6437
|
}
|
|
6182
|
-
if (implemented(manifest.hooks, "inbound.event") && typeof ((
|
|
6438
|
+
if (implemented(manifest.hooks, "inbound.event") && typeof ((_k = (_j = manifest.hooks) == null ? void 0 : _j.inbound) == null ? void 0 : _k.event) !== "function" && !((_m = (_l = manifest.inbound) == null ? void 0 : _l.headers) == null ? void 0 : _m.event)) {
|
|
6183
6439
|
throw new Error(manifest.slug + " implements inbound.event but declares no inbound.headers.event");
|
|
6184
6440
|
}
|
|
6185
|
-
if (implemented(manifest.hooks, "inbound.verify") && !((
|
|
6441
|
+
if (implemented(manifest.hooks, "inbound.verify") && !((_o = (_n = manifest.inbound) == null ? void 0 : _n.headers) == null ? void 0 : _o.signature)) {
|
|
6186
6442
|
throw new Error(manifest.slug + " implements inbound.verify but declares no inbound.headers.signature");
|
|
6187
6443
|
}
|
|
6188
6444
|
if (typeof (manifest == null ? void 0 : manifest.status) !== "function") {
|
|
6189
6445
|
throw new Error(manifest.slug + " must declare status( data ) \u2014 return null to accept the connection's own status, or { message, status } to override it");
|
|
6190
6446
|
}
|
|
6191
|
-
if (!Array.isArray((
|
|
6447
|
+
if (!Array.isArray((_p = manifest == null ? void 0 : manifest.content) == null ? void 0 : _p.guide) || !manifest.content.guide.length) {
|
|
6192
6448
|
throw new Error(manifest.slug + " needs content.guide \u2014 an array of steps for its page");
|
|
6193
6449
|
}
|
|
6194
6450
|
if (typeof (manifest == null ? void 0 : manifest.status) !== "function") {
|
|
@@ -6200,8 +6456,8 @@ var build = (manifest) => {
|
|
|
6200
6456
|
}
|
|
6201
6457
|
for (const [domain, verbs] of Object.entries(HOOKS)) {
|
|
6202
6458
|
for (const verb of verbs) {
|
|
6203
|
-
const hook = (
|
|
6204
|
-
if (((
|
|
6459
|
+
const hook = (_r = (_q = manifest.hooks) == null ? void 0 : _q[domain]) == null ? void 0 : _r[verb];
|
|
6460
|
+
if (((_s = manifest.hooks) == null ? void 0 : _s[domain]) === false) continue;
|
|
6205
6461
|
if (hook !== false && !implemented({ [domain]: { [verb]: hook } }, domain + "." + verb)) {
|
|
6206
6462
|
throw new Error(manifest.slug + " must answer hooks." + domain + "." + verb + " \u2014 false, a function, or {} if another repo implements it");
|
|
6207
6463
|
}
|
|
@@ -6246,44 +6502,6 @@ var connections = Object.freeze({
|
|
|
6246
6502
|
shopify: build(shopify_default2),
|
|
6247
6503
|
webhook: build(webhook_default)
|
|
6248
6504
|
});
|
|
6249
|
-
var canonical = (field2) => JSON.stringify(Object.fromEntries(Object.entries(field2).sort()));
|
|
6250
|
-
var mergeVendors = (catalog) => {
|
|
6251
|
-
var _a;
|
|
6252
|
-
const merged = {};
|
|
6253
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
6254
|
-
for (const [slug2, manifest] of Object.entries(catalog)) {
|
|
6255
|
-
for (const [vendor, declared] of Object.entries(((_a = manifest.provider) == null ? void 0 : _a.vendors) || {})) {
|
|
6256
|
-
const held = merged[vendor] || (merged[vendor] = { fields: [], icon: declared.icon, name: declared.name });
|
|
6257
|
-
if (held.name !== declared.name) {
|
|
6258
|
-
throw new Error(slug2 + " names vendor " + vendor + ' "' + declared.name + '" but another manifest names it "' + held.name + '"');
|
|
6259
|
-
}
|
|
6260
|
-
if (held.icon !== declared.icon) {
|
|
6261
|
-
throw new Error(slug2 + " declares a different icon for vendor " + vendor + " than another manifest \u2014 one vendor, one mark");
|
|
6262
|
-
}
|
|
6263
|
-
for (const field2 of declared.fields) {
|
|
6264
|
-
const existing = held.fields.find((entry) => entry.key === field2.key);
|
|
6265
|
-
if (existing) {
|
|
6266
|
-
if (canonical(existing) !== canonical(field2)) {
|
|
6267
|
-
throw new Error(slug2 + " declares " + vendor + "." + field2.key + " differently from another manifest \u2014 a field two connections spend is declared identically in both");
|
|
6268
|
-
}
|
|
6269
|
-
continue;
|
|
6270
|
-
}
|
|
6271
|
-
if (field2.credential) {
|
|
6272
|
-
const owner = claimed.get(field2.credential);
|
|
6273
|
-
if (owner) {
|
|
6274
|
-
throw new Error(field2.credential + " is claimed by both " + owner + " and " + vendor + "." + field2.key + " \u2014 one would silently overwrite the other");
|
|
6275
|
-
}
|
|
6276
|
-
claimed.set(field2.credential, vendor + "." + field2.key);
|
|
6277
|
-
}
|
|
6278
|
-
held.fields.push(field2);
|
|
6279
|
-
}
|
|
6280
|
-
}
|
|
6281
|
-
}
|
|
6282
|
-
return Object.freeze(Object.fromEntries(
|
|
6283
|
-
Object.entries(merged).map(([vendor, held]) => [vendor, Object.freeze({ ...held, fields: Object.freeze(held.fields) })])
|
|
6284
|
-
));
|
|
6285
|
-
};
|
|
6286
|
-
var vendors = mergeVendors(connections);
|
|
6287
6505
|
(() => {
|
|
6288
6506
|
var _a;
|
|
6289
6507
|
const routes = {};
|
|
@@ -6331,12 +6549,6 @@ var publicConnectionKeys = Object.freeze([
|
|
|
6331
6549
|
// excerpt, guide, and any vendor redirect copy.
|
|
6332
6550
|
"content",
|
|
6333
6551
|
"createdAt",
|
|
6334
|
-
// THE MERCHANT'S OWN SWITCH. `enabled : false` is a connection the merchant
|
|
6335
|
-
// paused — kept, configured, and not run — as distinct from a vendor the
|
|
6336
|
-
// platform switched off (which the api overlays as an error). Absent means
|
|
6337
|
-
// on; the dashboard renders Paused from it and the sync gates refuse a paused
|
|
6338
|
-
// connection the way they refuse a missing one.
|
|
6339
|
-
"enabled",
|
|
6340
6552
|
// The connection DOCUMENT's own errors array — scope-drift entries written by
|
|
6341
6553
|
// drawbridge-sync. NOT the manifest's error copy, which is content.errors:
|
|
6342
6554
|
// the document is spread OVER the resolved manifest downstream, so the two
|
|
@@ -6397,8 +6609,7 @@ var providerSettings = async ({ controller, includeDisabled = false, slug: slug2
|
|
|
6397
6609
|
};
|
|
6398
6610
|
var vendorEnabled = async ({ controller, vendor }) => (await providerRow({ controller, slug: vendor })).enabled;
|
|
6399
6611
|
var vendorSettings = async ({ controller, slug: slug2 }) => {
|
|
6400
|
-
|
|
6401
|
-
const declared = Object.hasOwn(connections, slug2) ? Object.keys(((_a = connections[slug2].provider) == null ? void 0 : _a.vendors) || {}) : [];
|
|
6612
|
+
const declared = Object.hasOwn(connections, slug2) ? connections[slug2].vendors || [] : [];
|
|
6402
6613
|
let merged = {};
|
|
6403
6614
|
for (const vendor of declared) {
|
|
6404
6615
|
merged = { ...merged, ...await providerSettings({ controller, slug: vendor }) };
|
|
@@ -6406,8 +6617,7 @@ var vendorSettings = async ({ controller, slug: slug2 }) => {
|
|
|
6406
6617
|
return merged;
|
|
6407
6618
|
};
|
|
6408
6619
|
var vendorsEnabled = async ({ controller, slug: slug2 }) => {
|
|
6409
|
-
|
|
6410
|
-
const declared = Object.hasOwn(connections, slug2) ? Object.keys(((_a = connections[slug2].provider) == null ? void 0 : _a.vendors) || {}) : [];
|
|
6620
|
+
const declared = Object.hasOwn(connections, slug2) ? connections[slug2].vendors || [] : [];
|
|
6411
6621
|
for (const vendor of declared) {
|
|
6412
6622
|
if (!await vendorEnabled({ controller, vendor })) return false;
|
|
6413
6623
|
}
|