@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
|
@@ -48,6 +48,7 @@ __export(connections_exports, {
|
|
|
48
48
|
authToken: () => authToken,
|
|
49
49
|
availableConnections: () => availableConnections,
|
|
50
50
|
build: () => build,
|
|
51
|
+
buildVendor: () => buildVendor,
|
|
51
52
|
catalogConnections: () => catalogConnections,
|
|
52
53
|
connectFields: () => connectFields,
|
|
53
54
|
connectionSteps: () => connectionSteps,
|
|
@@ -57,7 +58,6 @@ __export(connections_exports, {
|
|
|
57
58
|
hookSupport: () => hookSupport,
|
|
58
59
|
isStale: () => isStale,
|
|
59
60
|
mergeSettings: () => mergeSettings,
|
|
60
|
-
mergeVendors: () => mergeVendors,
|
|
61
61
|
pkcePair: () => pkcePair,
|
|
62
62
|
projectConnection: () => projectConnection,
|
|
63
63
|
publicConnectionKeys: () => publicConnectionKeys,
|
|
@@ -600,7 +600,7 @@ var detectCountry = (value) => {
|
|
|
600
600
|
}
|
|
601
601
|
};
|
|
602
602
|
|
|
603
|
-
// lib/connections/segment
|
|
603
|
+
// lib/connections/segment.js
|
|
604
604
|
var import_node_crypto2 = require("crypto");
|
|
605
605
|
var row = ({ connection: connection2, data: data2, manifest, row: described }) => {
|
|
606
606
|
var _a, _b;
|
|
@@ -693,7 +693,7 @@ var driftEnqueues = async ({ applied, read, segment, workflow }) => {
|
|
|
693
693
|
}];
|
|
694
694
|
};
|
|
695
695
|
|
|
696
|
-
// lib/connections/
|
|
696
|
+
// lib/connections/manifests/attentive.js
|
|
697
697
|
var api = async (path, { fetcher = fetch, method = "GET", payload, token }) => {
|
|
698
698
|
const response = await fetcher("https://api.attentivemobile.com" + path, {
|
|
699
699
|
...payload && { body: JSON.stringify(payload) },
|
|
@@ -1032,26 +1032,6 @@ var attentive_default2 = {
|
|
|
1032
1032
|
webhook: false
|
|
1033
1033
|
},
|
|
1034
1034
|
icon: attentive_default,
|
|
1035
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
1036
|
-
// what an admin types on the provider screen, and the only declaration of it.
|
|
1037
|
-
// It lives beside `requires`, which names the same variables: the manifest
|
|
1038
|
-
// says what it needs and this says how someone supplies it, so a credential
|
|
1039
|
-
// cannot be required by a vendor that offers nowhere to enter it.
|
|
1040
|
-
//
|
|
1041
|
-
// `redact` marks a secret — never returned by the api, and blank on save means
|
|
1042
|
-
// keep the stored value. `required` drives the live check.
|
|
1043
|
-
provider: {
|
|
1044
|
-
vendors: {
|
|
1045
|
-
attentive: {
|
|
1046
|
-
fields: [
|
|
1047
|
-
{ 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 },
|
|
1048
|
-
{ 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 }
|
|
1049
|
-
],
|
|
1050
|
-
icon: attentive_default,
|
|
1051
|
-
name: "Attentive"
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
},
|
|
1055
1035
|
requires: [
|
|
1056
1036
|
"ATTENTIVE_OAUTH_CLIENT_ID",
|
|
1057
1037
|
"ATTENTIVE_OAUTH_CLIENT_SECRET"
|
|
@@ -1142,6 +1122,11 @@ var attentive_default2 = {
|
|
|
1142
1122
|
}
|
|
1143
1123
|
];
|
|
1144
1124
|
},
|
|
1125
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
1126
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
1127
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
1128
|
+
// to be reconciled at import by mergeVendors().
|
|
1129
|
+
vendors: ["attentive"],
|
|
1145
1130
|
title: "Attentive",
|
|
1146
1131
|
// ATTENTIVE'S SEGMENTS INDEX. There is no documented per-segment url, and the
|
|
1147
1132
|
// only identifier we hold is the API's externalId, which their UI may not
|
|
@@ -1159,7 +1144,7 @@ var attentive_default2 = {
|
|
|
1159
1144
|
}
|
|
1160
1145
|
};
|
|
1161
1146
|
|
|
1162
|
-
// lib/connections/
|
|
1147
|
+
// lib/connections/manifests/drawbridge.js
|
|
1163
1148
|
var import_node_crypto4 = require("crypto");
|
|
1164
1149
|
|
|
1165
1150
|
// lib/connections/inbound.js
|
|
@@ -2096,7 +2081,7 @@ var MINIMUM_ACTION_CENTS = Math.round(
|
|
|
2096
2081
|
sending.sms.segmentCostCents / channels.sms.actionsPerSegment * MARKUP * 1e3
|
|
2097
2082
|
) / 1e3;
|
|
2098
2083
|
|
|
2099
|
-
// lib/connections/
|
|
2084
|
+
// lib/connections/manifests/drawbridge.js
|
|
2100
2085
|
var STOP_KEYWORDS = ["STOP", "STOPALL", "UNSUBSCRIBE", "CANCEL", "END", "QUIT"];
|
|
2101
2086
|
var START_KEYWORDS = ["START", "UNSTOP", "YES"];
|
|
2102
2087
|
var sendgridInbound = {
|
|
@@ -2793,70 +2778,6 @@ var drawbridge_default2 = {
|
|
|
2793
2778
|
},
|
|
2794
2779
|
// PRIVATE: never in the catalog, always available to the builder.
|
|
2795
2780
|
private: true,
|
|
2796
|
-
// THE PLATFORM'S OWN SENDING CREDENTIALS — SendGrid, Twilio, and the internal
|
|
2797
|
-
// HubSpot portal. No merchant ever sees these; they are what an admin types on
|
|
2798
|
-
// the provider screen so that Drawbridge itself can send.
|
|
2799
|
-
//
|
|
2800
|
-
// They belong on THIS manifest because this is the connection that sends: the
|
|
2801
|
-
// email, sms and segment hooks below are the only things that spend them, and
|
|
2802
|
-
// a private connection is still where a vendor fact lives. They are THREE
|
|
2803
|
-
// VENDORS, not one, and each is its own row and its own admin card — so
|
|
2804
|
-
// SendGrid reads live on a deployment that never configured Twilio, instead
|
|
2805
|
-
// of one card for all three that could only ever be as live as its weakest.
|
|
2806
|
-
//
|
|
2807
|
-
// UNLIKE every public vendor, none of these appear in `requires` — see the
|
|
2808
|
-
// comment there. Availability and configuration are different questions, and a
|
|
2809
|
-
// missing CRM token must not take every base workflow step away.
|
|
2810
|
-
//
|
|
2811
|
-
// ponytail: the field keys keep the names they had on the shared row
|
|
2812
|
-
// (smsSid, hubspotToken) so the readers destructuring vendorSettings() did
|
|
2813
|
-
// not move. Rename them to sid/token when those readers are next touched.
|
|
2814
|
-
provider: {
|
|
2815
|
-
vendors: {
|
|
2816
|
-
sendgrid: {
|
|
2817
|
-
fields: [
|
|
2818
|
-
{ input: "email", key: "accountSender", credential: "SENDGRID_FROM_ADDRESS", label: "Account sender", message: "Verification codes and security alerts send from here.", required: true },
|
|
2819
|
-
{ 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 },
|
|
2820
|
-
// Optional: SENDGRID_SEND_FROM_ADDRESS is not boot-required in sync
|
|
2821
|
-
// either. Unset, it degrades to the account sender rather than
|
|
2822
|
-
// refusing to start.
|
|
2823
|
-
// NOT redacted, because it is a PUBLIC key. Marking it secret would
|
|
2824
|
-
// be theatre, and it would stop an operator reading back the value
|
|
2825
|
-
// they need to compare against the SendGrid console.
|
|
2826
|
-
//
|
|
2827
|
-
// Optional: absent, the event webhook answers 500 on verify rather
|
|
2828
|
-
// than accepting unverified deliveries, and nothing else notices.
|
|
2829
|
-
{ 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." },
|
|
2830
|
-
{ 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." }
|
|
2831
|
-
],
|
|
2832
|
-
icon: sendgrid_default,
|
|
2833
|
-
name: "SendGrid"
|
|
2834
|
-
},
|
|
2835
|
-
// Missing, SMS is LOCKED DOWN rather than broken: every send path
|
|
2836
|
-
// refuses cleanly (queue/notification.js cancels, the otc stream skips
|
|
2837
|
-
// and logs), the number-purchase routes deny, and identityDefaults.sms
|
|
2838
|
-
// hides the org's SMS settings entirely. The card reads not live, which
|
|
2839
|
-
// is the truth about Twilio and says nothing about email.
|
|
2840
|
-
twilio: {
|
|
2841
|
-
fields: [
|
|
2842
|
-
{ input: "text", key: "smsFrom", credential: "TWILIO_ACCOUNT_FROM", label: "SMS number", message: "Without Twilio credentials, SMS is disabled across the platform.", required: true },
|
|
2843
|
-
{ 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 },
|
|
2844
|
-
{ 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 }
|
|
2845
|
-
],
|
|
2846
|
-
icon: twilio_default,
|
|
2847
|
-
name: "Twilio"
|
|
2848
|
-
},
|
|
2849
|
-
// The CRM sync is best-effort internal tooling and no-ops without a
|
|
2850
|
-
// token. Not live here costs nothing a merchant can see.
|
|
2851
|
-
hubspot: {
|
|
2852
|
-
fields: [
|
|
2853
|
-
{ 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 }
|
|
2854
|
-
],
|
|
2855
|
-
icon: hubspot_default,
|
|
2856
|
-
name: "HubSpot"
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
},
|
|
2860
2781
|
// NOTHING, and HUBSPOT_ACCESS_TOKEN in particular must not be here.
|
|
2861
2782
|
//
|
|
2862
2783
|
// `requires` gates AVAILABILITY: a name in it that is unset removes the whole
|
|
@@ -3055,6 +2976,16 @@ var drawbridge_default2 = {
|
|
|
3055
2976
|
}
|
|
3056
2977
|
},
|
|
3057
2978
|
tasks: () => [],
|
|
2979
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
2980
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
2981
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
2982
|
+
// to be reconciled at import by mergeVendors().
|
|
2983
|
+
//
|
|
2984
|
+
// THREE, and they have nothing to do with each other: drawbridge is the
|
|
2985
|
+
// platform's own sender and spends SendGrid for email, Twilio for SMS and
|
|
2986
|
+
// HubSpot for CRM. They were bundled under one manifest only because one
|
|
2987
|
+
// connection happens to use all three.
|
|
2988
|
+
vendors: ["sendgrid", "twilio", "hubspot"],
|
|
3058
2989
|
title: "Drawbridge"
|
|
3059
2990
|
};
|
|
3060
2991
|
|
|
@@ -3072,7 +3003,7 @@ var missingScopes = ({ granted, required }) => {
|
|
|
3072
3003
|
return list(required).filter((scope) => !held.has(scope));
|
|
3073
3004
|
};
|
|
3074
3005
|
|
|
3075
|
-
// lib/connections/
|
|
3006
|
+
// lib/connections/manifests/klaviyo.js
|
|
3076
3007
|
var api2 = async (path, { fetcher = fetch, method = "GET", payload, token }) => {
|
|
3077
3008
|
const response = await fetcher("https://a.klaviyo.com/api" + path, {
|
|
3078
3009
|
...payload && { body: JSON.stringify(payload) },
|
|
@@ -3686,24 +3617,6 @@ var klaviyo_default2 = {
|
|
|
3686
3617
|
webhook: false
|
|
3687
3618
|
},
|
|
3688
3619
|
icon: klaviyo_default,
|
|
3689
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
3690
|
-
// what an admin types on the provider screen. Declared here rather than in a
|
|
3691
|
-
// table in lib/providers.js, so a vendor's credentials sit beside the
|
|
3692
|
-
// `requires` that names the same variables. Keyed by the VENDOR that holds
|
|
3693
|
-
// them — here the vendor and the connection are the same thing, which is not
|
|
3694
|
-
// true of every manifest.
|
|
3695
|
-
provider: {
|
|
3696
|
-
vendors: {
|
|
3697
|
-
klaviyo: {
|
|
3698
|
-
fields: [
|
|
3699
|
-
{ 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 },
|
|
3700
|
-
{ 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 }
|
|
3701
|
-
],
|
|
3702
|
-
icon: klaviyo_default,
|
|
3703
|
-
name: "Klaviyo"
|
|
3704
|
-
}
|
|
3705
|
-
}
|
|
3706
|
-
},
|
|
3707
3620
|
requires: [
|
|
3708
3621
|
"KLAVIYO_OAUTH_CLIENT_ID",
|
|
3709
3622
|
"KLAVIYO_OAUTH_CLIENT_SECRET"
|
|
@@ -3842,6 +3755,11 @@ var klaviyo_default2 = {
|
|
|
3842
3755
|
}]
|
|
3843
3756
|
];
|
|
3844
3757
|
},
|
|
3758
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
3759
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
3760
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
3761
|
+
// to be reconciled at import by mergeVendors().
|
|
3762
|
+
vendors: ["klaviyo"],
|
|
3845
3763
|
title: "Klaviyo",
|
|
3846
3764
|
// KLAVIYO PUBLISHES NO DASHBOARD URLS in its API reference. What is on record
|
|
3847
3765
|
// is its own help centre on a list: "you can find a list's ID in the URL in
|
|
@@ -3855,7 +3773,7 @@ var klaviyo_default2 = {
|
|
|
3855
3773
|
}
|
|
3856
3774
|
};
|
|
3857
3775
|
|
|
3858
|
-
// lib/connections/
|
|
3776
|
+
// lib/connections/manifests/mailchimp.js
|
|
3859
3777
|
var import_node_crypto5 = require("crypto");
|
|
3860
3778
|
|
|
3861
3779
|
// lib/connections/icons/mailchimp.js
|
|
@@ -3865,7 +3783,7 @@ var mailchimp_default = `<svg width="500" height="500" viewBox="0 0 500 500" fil
|
|
|
3865
3783
|
<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"/>
|
|
3866
3784
|
</svg>`;
|
|
3867
3785
|
|
|
3868
|
-
// lib/connections/
|
|
3786
|
+
// lib/connections/manifests/mailchimp.js
|
|
3869
3787
|
var base = (dc) => {
|
|
3870
3788
|
if (!dc) throw new Error("This Mailchimp connection has no data centre stored, so there is no host to call");
|
|
3871
3789
|
return "https://" + dc + ".api.mailchimp.com/3.0";
|
|
@@ -4263,21 +4181,6 @@ var mailchimp_default2 = {
|
|
|
4263
4181
|
webhook: false
|
|
4264
4182
|
},
|
|
4265
4183
|
icon: mailchimp_default,
|
|
4266
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
4267
|
-
// what an admin types on the provider screen, beside the `requires` naming the
|
|
4268
|
-
// same variables.
|
|
4269
|
-
provider: {
|
|
4270
|
-
vendors: {
|
|
4271
|
-
mailchimp: {
|
|
4272
|
-
fields: [
|
|
4273
|
-
{ 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 },
|
|
4274
|
-
{ 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 }
|
|
4275
|
-
],
|
|
4276
|
-
icon: mailchimp_default,
|
|
4277
|
-
name: "Mailchimp"
|
|
4278
|
-
}
|
|
4279
|
-
}
|
|
4280
|
-
},
|
|
4281
4184
|
// The OAuth client this deployment registered. Without both, the vendor drops
|
|
4282
4185
|
// out of availableConnections rather than offering a Connect button that
|
|
4283
4186
|
// cannot complete.
|
|
@@ -4380,6 +4283,11 @@ var mailchimp_default2 = {
|
|
|
4380
4283
|
}
|
|
4381
4284
|
];
|
|
4382
4285
|
},
|
|
4286
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
4287
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
4288
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
4289
|
+
// to be reconciled at import by mergeVendors().
|
|
4290
|
+
vendors: ["mailchimp"],
|
|
4383
4291
|
title: "Mailchimp",
|
|
4384
4292
|
// THE MERCHANT'S OWN ADMIN. Mailchimp's list schema states the shape outright:
|
|
4385
4293
|
// the web_id field is "The ID used in the Mailchimp web application. View this
|
|
@@ -4399,7 +4307,7 @@ var mailchimp_default2 = {
|
|
|
4399
4307
|
}
|
|
4400
4308
|
};
|
|
4401
4309
|
|
|
4402
|
-
// lib/connections/
|
|
4310
|
+
// lib/connections/manifests/shopify.js
|
|
4403
4311
|
var import_node_crypto6 = require("crypto");
|
|
4404
4312
|
var import_nanoid3 = require("nanoid");
|
|
4405
4313
|
|
|
@@ -4462,7 +4370,7 @@ var slugify = (value, nochars = false) => {
|
|
|
4462
4370
|
);
|
|
4463
4371
|
};
|
|
4464
4372
|
|
|
4465
|
-
// lib/connections/
|
|
4373
|
+
// lib/connections/manifests/shopify.js
|
|
4466
4374
|
var toLine = ({
|
|
4467
4375
|
price,
|
|
4468
4376
|
product_id: productId,
|
|
@@ -5591,41 +5499,6 @@ var shopify_default2 = {
|
|
|
5591
5499
|
},
|
|
5592
5500
|
icon: shopify_default,
|
|
5593
5501
|
inbound,
|
|
5594
|
-
// DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
|
|
5595
|
-
// what an admin types on the provider screen. The four names below are exactly
|
|
5596
|
-
// what `requires` gates on, which is the point of declaring them together: a
|
|
5597
|
-
// name required by the manifest and enterable nowhere is a vendor that can
|
|
5598
|
-
// never go live from the admin screen.
|
|
5599
|
-
provider: {
|
|
5600
|
-
vendors: {
|
|
5601
|
-
shopify: {
|
|
5602
|
-
fields: [
|
|
5603
|
-
{ 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 },
|
|
5604
|
-
{ 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 },
|
|
5605
|
-
{ 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 },
|
|
5606
|
-
{ 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 },
|
|
5607
|
-
// The usage meter's event handle, when the plan config's meter ever
|
|
5608
|
-
// changes: stored value overrides the built-in default
|
|
5609
|
-
// (events.order.handle) at the mint point, and `format : 'slug'`
|
|
5610
|
-
// normalizes it on save — a handle can carry no spaces or capitals,
|
|
5611
|
-
// and classification against it is case-sensitive. Optional: empty
|
|
5612
|
-
// means the default, and the sender still refuses any handle that
|
|
5613
|
-
// disagrees with the transaction it minted.
|
|
5614
|
-
{ 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 },
|
|
5615
|
-
// The Partner API credential set — the ONE place meter billing is
|
|
5616
|
-
// observable (CHARGE_USAGE accrual events). Org id and numeric app
|
|
5617
|
-
// id come from the Partner Dashboard; the token from Settings →
|
|
5618
|
-
// Partner API clients (Manage-apps permission). All optional: the
|
|
5619
|
-
// accrual probe simply stays off until they exist.
|
|
5620
|
-
{ 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 },
|
|
5621
|
-
{ 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 },
|
|
5622
|
-
{ 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 }
|
|
5623
|
-
],
|
|
5624
|
-
icon: shopify_default,
|
|
5625
|
-
name: "Shopify"
|
|
5626
|
-
}
|
|
5627
|
-
}
|
|
5628
|
-
},
|
|
5629
5502
|
// A pre-launch integration: it only surfaces once the App Store listing
|
|
5630
5503
|
// exists and the app is fully configured. Requiring all four means it can
|
|
5631
5504
|
// never render half-configured — and absence of any one excludes the
|
|
@@ -5829,6 +5702,13 @@ var shopify_default2 = {
|
|
|
5829
5702
|
] : []
|
|
5830
5703
|
];
|
|
5831
5704
|
},
|
|
5705
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Declared once in
|
|
5706
|
+
// lib/connections/vendors/shopify.js, and named here by whoever uses it.
|
|
5707
|
+
//
|
|
5708
|
+
// SHOPIFY_API_SECRET is spent by drawbridge-shopify-app and drawbridge-webhooks
|
|
5709
|
+
// too, which is the clearest case for why a vendor is not owned by whichever
|
|
5710
|
+
// connection happened to declare it first.
|
|
5711
|
+
vendors: ["shopify"],
|
|
5832
5712
|
title: "Shopify",
|
|
5833
5713
|
// THE VENDOR'S OWN ADMIN, one function per thing worth linking to. It lives
|
|
5834
5714
|
// here rather than at the top level so a second link (a product, an order)
|
|
@@ -5855,7 +5735,7 @@ var shopify_default2 = {
|
|
|
5855
5735
|
}
|
|
5856
5736
|
};
|
|
5857
5737
|
|
|
5858
|
-
// lib/connections/
|
|
5738
|
+
// lib/connections/manifests/webhook.js
|
|
5859
5739
|
var import_node_crypto7 = __toESM(require("crypto"), 1);
|
|
5860
5740
|
|
|
5861
5741
|
// lib/safe-http.js
|
|
@@ -6000,7 +5880,7 @@ var safeRequest = async ({
|
|
|
6000
5880
|
}
|
|
6001
5881
|
};
|
|
6002
5882
|
|
|
6003
|
-
// lib/connections/
|
|
5883
|
+
// lib/connections/manifests/webhook.js
|
|
6004
5884
|
var RESPONSE_LIMIT = 64 * 1024;
|
|
6005
5885
|
var signature = ({ body, settings }) => {
|
|
6006
5886
|
var _a;
|
|
@@ -6190,9 +6070,369 @@ var webhook_default = {
|
|
|
6190
6070
|
title: "Webhook signing"
|
|
6191
6071
|
}
|
|
6192
6072
|
],
|
|
6073
|
+
// THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
|
|
6074
|
+
// lib/connections/vendors/, and named here by whoever uses it — the block that
|
|
6075
|
+
// used to sit here declared them inline, so two manifests naming one vendor had
|
|
6076
|
+
// to be reconciled at import by mergeVendors().
|
|
6077
|
+
//
|
|
6078
|
+
// Empty: webhook has no third party behind it — nothing to authenticate
|
|
6079
|
+
// against and nothing for an admin to type.
|
|
6080
|
+
vendors: [],
|
|
6193
6081
|
title: "Webhooks"
|
|
6194
6082
|
};
|
|
6195
6083
|
|
|
6084
|
+
// lib/connections/vendors/attentive.js
|
|
6085
|
+
var attentive_default3 = {
|
|
6086
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6087
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6088
|
+
// to appear three times per manifest.
|
|
6089
|
+
fields: [
|
|
6090
|
+
{
|
|
6091
|
+
credential: "ATTENTIVE_OAUTH_CLIENT_ID",
|
|
6092
|
+
input: "text",
|
|
6093
|
+
key: "clientId",
|
|
6094
|
+
label: "Client ID",
|
|
6095
|
+
message: "From our app's registration in the Attentive developer portal.",
|
|
6096
|
+
required: true
|
|
6097
|
+
},
|
|
6098
|
+
{
|
|
6099
|
+
credential: "ATTENTIVE_OAUTH_CLIENT_SECRET",
|
|
6100
|
+
input: "password",
|
|
6101
|
+
key: "clientSecret",
|
|
6102
|
+
label: "Client secret",
|
|
6103
|
+
message: "Beside the Client ID in the Attentive developer portal.",
|
|
6104
|
+
redact: true,
|
|
6105
|
+
required: true
|
|
6106
|
+
}
|
|
6107
|
+
],
|
|
6108
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6109
|
+
// used to throw when two manifests disagreed about this.
|
|
6110
|
+
icon: attentive_default,
|
|
6111
|
+
name: "Attentive",
|
|
6112
|
+
slug: "attentive",
|
|
6113
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6114
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6115
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6116
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6117
|
+
// was saying where the data belonged.
|
|
6118
|
+
urls: {
|
|
6119
|
+
api: "https://docs.attentive.com/reference/listsegments",
|
|
6120
|
+
dashboard: "https://docs.attentive.com/docs/segments",
|
|
6121
|
+
scopes: "https://docs.attentive.com/docs/authentication"
|
|
6122
|
+
}
|
|
6123
|
+
};
|
|
6124
|
+
|
|
6125
|
+
// lib/connections/vendors/hubspot.js
|
|
6126
|
+
var hubspot_default2 = {
|
|
6127
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6128
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6129
|
+
// to appear three times per manifest.
|
|
6130
|
+
fields: [
|
|
6131
|
+
{
|
|
6132
|
+
credential: "HUBSPOT_ACCESS_TOKEN",
|
|
6133
|
+
input: "password",
|
|
6134
|
+
key: "hubspotToken",
|
|
6135
|
+
label: "HubSpot access token",
|
|
6136
|
+
message: "Drawbridge's own CRM portal. Internal \u2014 no merchant sees this.",
|
|
6137
|
+
redact: true,
|
|
6138
|
+
required: true
|
|
6139
|
+
}
|
|
6140
|
+
],
|
|
6141
|
+
// The vendor's own mark rather than the connection's: drawbridge fronts three
|
|
6142
|
+
// vendors and none of them is Drawbridge.
|
|
6143
|
+
icon: hubspot_default,
|
|
6144
|
+
name: "HubSpot",
|
|
6145
|
+
slug: "hubspot",
|
|
6146
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6147
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6148
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6149
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6150
|
+
// was saying where the data belonged.
|
|
6151
|
+
urls: {
|
|
6152
|
+
api: "https://developers.hubspot.com/docs/reference/api/crm/objects/contacts",
|
|
6153
|
+
dashboard: "https://knowledge.hubspot.com/contacts/create-contacts",
|
|
6154
|
+
scopes: false
|
|
6155
|
+
}
|
|
6156
|
+
};
|
|
6157
|
+
|
|
6158
|
+
// lib/connections/vendors/klaviyo.js
|
|
6159
|
+
var klaviyo_default3 = {
|
|
6160
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6161
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6162
|
+
// to appear three times per manifest.
|
|
6163
|
+
fields: [
|
|
6164
|
+
{
|
|
6165
|
+
credential: "KLAVIYO_OAUTH_CLIENT_ID",
|
|
6166
|
+
input: "text",
|
|
6167
|
+
key: "clientId",
|
|
6168
|
+
label: "Client ID",
|
|
6169
|
+
message: "From our app in the Klaviyo developer portal (developers.klaviyo.com).",
|
|
6170
|
+
required: true
|
|
6171
|
+
},
|
|
6172
|
+
{
|
|
6173
|
+
credential: "KLAVIYO_OAUTH_CLIENT_SECRET",
|
|
6174
|
+
input: "password",
|
|
6175
|
+
key: "clientSecret",
|
|
6176
|
+
label: "Client secret",
|
|
6177
|
+
message: "Beside the Client ID on the Klaviyo app.",
|
|
6178
|
+
redact: true,
|
|
6179
|
+
required: true
|
|
6180
|
+
}
|
|
6181
|
+
],
|
|
6182
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6183
|
+
// used to throw when two manifests disagreed about this.
|
|
6184
|
+
icon: klaviyo_default,
|
|
6185
|
+
name: "Klaviyo",
|
|
6186
|
+
slug: "klaviyo",
|
|
6187
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6188
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6189
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6190
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6191
|
+
// was saying where the data belonged.
|
|
6192
|
+
urls: {
|
|
6193
|
+
api: "https://developers.klaviyo.com/en/reference/api_overview",
|
|
6194
|
+
dashboard: "https://help.klaviyo.com/hc/en-us/articles/115005078647",
|
|
6195
|
+
scopes: "https://developers.klaviyo.com/en/docs/authenticate_"
|
|
6196
|
+
}
|
|
6197
|
+
};
|
|
6198
|
+
|
|
6199
|
+
// lib/connections/vendors/mailchimp.js
|
|
6200
|
+
var mailchimp_default3 = {
|
|
6201
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6202
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6203
|
+
// to appear three times per manifest.
|
|
6204
|
+
fields: [
|
|
6205
|
+
{
|
|
6206
|
+
credential: "MAILCHIMP_OAUTH_CLIENT_ID",
|
|
6207
|
+
input: "text",
|
|
6208
|
+
key: "clientId",
|
|
6209
|
+
label: "Client ID",
|
|
6210
|
+
message: "From our registered app \u2014 Mailchimp account, Extras, Registered apps.",
|
|
6211
|
+
required: true
|
|
6212
|
+
},
|
|
6213
|
+
{
|
|
6214
|
+
credential: "MAILCHIMP_OAUTH_CLIENT_SECRET",
|
|
6215
|
+
input: "password",
|
|
6216
|
+
key: "clientSecret",
|
|
6217
|
+
label: "Client secret",
|
|
6218
|
+
message: "Beside the Client ID on the registered app.",
|
|
6219
|
+
redact: true,
|
|
6220
|
+
required: true
|
|
6221
|
+
}
|
|
6222
|
+
],
|
|
6223
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6224
|
+
// used to throw when two manifests disagreed about this.
|
|
6225
|
+
icon: mailchimp_default,
|
|
6226
|
+
name: "Mailchimp",
|
|
6227
|
+
slug: "mailchimp",
|
|
6228
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6229
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6230
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6231
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6232
|
+
// was saying where the data belonged.
|
|
6233
|
+
urls: {
|
|
6234
|
+
api: "https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/",
|
|
6235
|
+
dashboard: "https://mailchimp.com/help/manage-tags/",
|
|
6236
|
+
scopes: false
|
|
6237
|
+
}
|
|
6238
|
+
};
|
|
6239
|
+
|
|
6240
|
+
// lib/connections/vendors/sendgrid.js
|
|
6241
|
+
var sendgrid_default2 = {
|
|
6242
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6243
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6244
|
+
// to appear three times per manifest.
|
|
6245
|
+
fields: [
|
|
6246
|
+
{
|
|
6247
|
+
credential: "SENDGRID_FROM_ADDRESS",
|
|
6248
|
+
input: "email",
|
|
6249
|
+
key: "accountSender",
|
|
6250
|
+
label: "Account sender",
|
|
6251
|
+
message: "Verification codes and security alerts send from here.",
|
|
6252
|
+
required: true
|
|
6253
|
+
},
|
|
6254
|
+
{
|
|
6255
|
+
credential: "SENDGRID_API_KEY",
|
|
6256
|
+
input: "password",
|
|
6257
|
+
key: "apiKey",
|
|
6258
|
+
label: "SendGrid API key",
|
|
6259
|
+
message: "SendGrid dashboard, Settings, API Keys \u2014 full access for sends.",
|
|
6260
|
+
redact: true,
|
|
6261
|
+
required: true
|
|
6262
|
+
},
|
|
6263
|
+
{
|
|
6264
|
+
credential: "SENDGRID_EVENT_WEBHOOK_KEY",
|
|
6265
|
+
input: "text",
|
|
6266
|
+
key: "eventKey",
|
|
6267
|
+
label: "Event webhook key",
|
|
6268
|
+
message: "SendGrid, Settings, Mail Settings, Event Webhook \u2014 the verification key shown once signature verification is enabled. Public, not a secret."
|
|
6269
|
+
},
|
|
6270
|
+
{
|
|
6271
|
+
credential: "SENDGRID_SEND_FROM_ADDRESS",
|
|
6272
|
+
input: "email",
|
|
6273
|
+
key: "leadSender",
|
|
6274
|
+
label: "Lead sender",
|
|
6275
|
+
message: "The default for lead-facing mail when a merchant has not verified their own domain."
|
|
6276
|
+
}
|
|
6277
|
+
],
|
|
6278
|
+
// The vendor's own mark rather than the connection's: drawbridge fronts three
|
|
6279
|
+
// vendors and none of them is Drawbridge.
|
|
6280
|
+
icon: sendgrid_default,
|
|
6281
|
+
name: "SendGrid",
|
|
6282
|
+
slug: "sendgrid",
|
|
6283
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6284
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6285
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6286
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6287
|
+
// was saying where the data belonged.
|
|
6288
|
+
urls: {
|
|
6289
|
+
api: "https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send",
|
|
6290
|
+
dashboard: "https://www.twilio.com/docs/sendgrid/ui/analytics-and-reporting/email-activity-feed",
|
|
6291
|
+
scopes: false
|
|
6292
|
+
}
|
|
6293
|
+
};
|
|
6294
|
+
|
|
6295
|
+
// lib/connections/vendors/shopify.js
|
|
6296
|
+
var shopify_default3 = {
|
|
6297
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6298
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6299
|
+
// to appear three times per manifest.
|
|
6300
|
+
fields: [
|
|
6301
|
+
{
|
|
6302
|
+
credential: "SHOPIFY_API_KEY",
|
|
6303
|
+
input: "text",
|
|
6304
|
+
key: "apiKey",
|
|
6305
|
+
label: "API key",
|
|
6306
|
+
message: "The app's Client ID \u2014 Dev Dashboard, the app, Settings.",
|
|
6307
|
+
required: true
|
|
6308
|
+
},
|
|
6309
|
+
{
|
|
6310
|
+
credential: "SHOPIFY_API_SECRET",
|
|
6311
|
+
input: "password",
|
|
6312
|
+
key: "apiSecret",
|
|
6313
|
+
label: "API secret",
|
|
6314
|
+
message: "The app's Client secret, beside the Client ID in the app's settings.",
|
|
6315
|
+
redact: true,
|
|
6316
|
+
required: true
|
|
6317
|
+
},
|
|
6318
|
+
{
|
|
6319
|
+
credential: "SHOPIFY_APP_HANDLE",
|
|
6320
|
+
input: "text",
|
|
6321
|
+
key: "appHandle",
|
|
6322
|
+
label: "App handle",
|
|
6323
|
+
message: "The app's URL handle (for example drawbridge-development), from the app's configuration.",
|
|
6324
|
+
required: true
|
|
6325
|
+
},
|
|
6326
|
+
{
|
|
6327
|
+
credential: "SHOPIFY_APP_LISTING_URL",
|
|
6328
|
+
input: "text",
|
|
6329
|
+
key: "listingUrl",
|
|
6330
|
+
label: "App listing URL",
|
|
6331
|
+
message: 'Where "View on the Shopify App Store" sends merchants \u2014 the public listing, or the Dev Dashboard install link for the dev app.',
|
|
6332
|
+
required: true
|
|
6333
|
+
},
|
|
6334
|
+
{
|
|
6335
|
+
format: "slug",
|
|
6336
|
+
input: "text",
|
|
6337
|
+
key: "orderEventHandle",
|
|
6338
|
+
label: "Order event handle",
|
|
6339
|
+
message: "Must match the usage meter's Handle field on the plan exactly \u2014 lowercase and hyphens. Leave empty to use drawbridge-orders.",
|
|
6340
|
+
required: false,
|
|
6341
|
+
setting: true
|
|
6342
|
+
},
|
|
6343
|
+
{
|
|
6344
|
+
input: "text",
|
|
6345
|
+
key: "partnerOrgId",
|
|
6346
|
+
label: "Partner organization ID",
|
|
6347
|
+
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.",
|
|
6348
|
+
required: false,
|
|
6349
|
+
setting: true
|
|
6350
|
+
},
|
|
6351
|
+
{
|
|
6352
|
+
input: "text",
|
|
6353
|
+
key: "partnerAppId",
|
|
6354
|
+
label: "Partner app ID (numeric)",
|
|
6355
|
+
message: "The numeric id in the app's Partner Dashboard URL \u2014 not the Client ID.",
|
|
6356
|
+
required: false,
|
|
6357
|
+
setting: true
|
|
6358
|
+
},
|
|
6359
|
+
{
|
|
6360
|
+
input: "password",
|
|
6361
|
+
key: "partnerToken",
|
|
6362
|
+
label: "Partner API token",
|
|
6363
|
+
message: "Partner Dashboard, Settings, Partner API clients \u2014 create one with Manage apps and paste the prtapi_ token.",
|
|
6364
|
+
redact: true,
|
|
6365
|
+
required: false,
|
|
6366
|
+
setting: true
|
|
6367
|
+
}
|
|
6368
|
+
],
|
|
6369
|
+
// The same mark the connection carries. One vendor, one icon — mergeVendors
|
|
6370
|
+
// used to throw when two manifests disagreed about this.
|
|
6371
|
+
icon: shopify_default,
|
|
6372
|
+
name: "Shopify",
|
|
6373
|
+
slug: "shopify",
|
|
6374
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6375
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6376
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6377
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6378
|
+
// was saying where the data belonged.
|
|
6379
|
+
urls: {
|
|
6380
|
+
api: "https://shopify.dev/docs/api/admin-graphql",
|
|
6381
|
+
dashboard: "https://help.shopify.com/en/manual/apps",
|
|
6382
|
+
scopes: "https://shopify.dev/docs/api/usage/access-scopes"
|
|
6383
|
+
}
|
|
6384
|
+
};
|
|
6385
|
+
|
|
6386
|
+
// lib/connections/vendors/twilio.js
|
|
6387
|
+
var twilio_default2 = {
|
|
6388
|
+
// WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
|
|
6389
|
+
// field falls back to, and is the only place that name is written now — it used
|
|
6390
|
+
// to appear three times per manifest.
|
|
6391
|
+
fields: [
|
|
6392
|
+
{
|
|
6393
|
+
credential: "TWILIO_ACCOUNT_FROM",
|
|
6394
|
+
input: "text",
|
|
6395
|
+
key: "smsFrom",
|
|
6396
|
+
label: "SMS number",
|
|
6397
|
+
message: "Without Twilio credentials, SMS is disabled across the platform.",
|
|
6398
|
+
required: true
|
|
6399
|
+
},
|
|
6400
|
+
{
|
|
6401
|
+
credential: "TWILIO_ACCOUNT_SID",
|
|
6402
|
+
input: "password",
|
|
6403
|
+
key: "smsSid",
|
|
6404
|
+
label: "Twilio account SID",
|
|
6405
|
+
message: "Twilio console home \u2014 the AC\u2026 identifier on the account dashboard.",
|
|
6406
|
+
redact: true,
|
|
6407
|
+
required: true
|
|
6408
|
+
},
|
|
6409
|
+
{
|
|
6410
|
+
credential: "TWILIO_AUTH_TOKEN",
|
|
6411
|
+
input: "password",
|
|
6412
|
+
key: "smsToken",
|
|
6413
|
+
label: "Twilio auth token",
|
|
6414
|
+
message: "Beside the account SID on the Twilio console dashboard.",
|
|
6415
|
+
redact: true,
|
|
6416
|
+
required: true
|
|
6417
|
+
}
|
|
6418
|
+
],
|
|
6419
|
+
// The vendor's own mark rather than the connection's: drawbridge fronts three
|
|
6420
|
+
// vendors and none of them is Drawbridge.
|
|
6421
|
+
icon: twilio_default,
|
|
6422
|
+
name: "Twilio",
|
|
6423
|
+
slug: "twilio",
|
|
6424
|
+
// WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
|
|
6425
|
+
// manifest. They are per-vendor documentation, which is exactly why drawbridge
|
|
6426
|
+
// answered two of them with an object keyed by vendor while the other four
|
|
6427
|
+
// answered with a string — two incompatible shapes for one key, and the shape
|
|
6428
|
+
// was saying where the data belonged.
|
|
6429
|
+
urls: {
|
|
6430
|
+
api: "https://www.twilio.com/docs/messaging/api/message-resource",
|
|
6431
|
+
dashboard: "https://www.twilio.com/docs/messaging/guides/debugging-tools",
|
|
6432
|
+
scopes: false
|
|
6433
|
+
}
|
|
6434
|
+
};
|
|
6435
|
+
|
|
6196
6436
|
// lib/connections/index.js
|
|
6197
6437
|
var QUEUES = ["connection", "notification", "segment", "webhook"];
|
|
6198
6438
|
var implemented = (hooks, path) => {
|
|
@@ -6213,8 +6453,35 @@ var checkIcon = (owner, icon) => {
|
|
|
6213
6453
|
throw new Error(owner + " icon wraps a raster \u2014 re-export it as vector shapes");
|
|
6214
6454
|
}
|
|
6215
6455
|
};
|
|
6456
|
+
var vendors = Object.freeze(Object.fromEntries(
|
|
6457
|
+
[attentive_default3, hubspot_default2, klaviyo_default3, mailchimp_default3, sendgrid_default2, shopify_default3, twilio_default2].map((vendor) => [vendor.slug, vendor])
|
|
6458
|
+
));
|
|
6459
|
+
var buildVendor = (vendor) => {
|
|
6460
|
+
if (!(vendor == null ? void 0 : vendor.slug)) throw new Error("A vendor needs a slug");
|
|
6461
|
+
if (!vendor.name) throw new Error("vendor " + vendor.slug + " has no name");
|
|
6462
|
+
checkIcon("vendor " + vendor.slug, vendor.icon);
|
|
6463
|
+
if (!Array.isArray(vendor.fields) || !vendor.fields.length) {
|
|
6464
|
+
throw new Error("vendor " + vendor.slug + " has no fields \u2014 a vendor nothing is typed into holds nothing");
|
|
6465
|
+
}
|
|
6466
|
+
for (const field2 of vendor.fields) {
|
|
6467
|
+
if (!(field2 == null ? void 0 : field2.key) || !(field2 == null ? void 0 : field2.label)) {
|
|
6468
|
+
throw new Error("vendor " + vendor.slug + " declares a field with no key or label");
|
|
6469
|
+
}
|
|
6470
|
+
if (!INPUTS.includes(field2.input)) {
|
|
6471
|
+
throw new Error(vendor.slug + "." + field2.key + " needs an input the admin form can render \u2014 one of " + INPUTS.join(", "));
|
|
6472
|
+
}
|
|
6473
|
+
if (field2.input === "password" && !field2.redact) {
|
|
6474
|
+
throw new Error(vendor.slug + "." + field2.key + " is a password and must declare redact : true \u2014 the api would hand the value back");
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
return Object.freeze(vendor);
|
|
6478
|
+
};
|
|
6479
|
+
for (const [slug2, vendor] of Object.entries(vendors)) {
|
|
6480
|
+
if (vendor.slug !== slug2) throw new Error("vendor file " + slug2 + " declares slug " + vendor.slug);
|
|
6481
|
+
buildVendor(vendor);
|
|
6482
|
+
}
|
|
6216
6483
|
var build = (manifest) => {
|
|
6217
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s
|
|
6484
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
6218
6485
|
if (!(manifest == null ? void 0 : manifest.slug)) throw new Error("A connection needs a slug");
|
|
6219
6486
|
if (!(manifest == null ? void 0 : manifest.title)) throw new Error(manifest.slug + " needs a title");
|
|
6220
6487
|
if (!(manifest == null ? void 0 : manifest.private) && !(manifest == null ? void 0 : manifest.feature)) throw new Error(manifest.slug + " needs a plan feature key");
|
|
@@ -6244,53 +6511,42 @@ var build = (manifest) => {
|
|
|
6244
6511
|
}
|
|
6245
6512
|
}
|
|
6246
6513
|
}
|
|
6247
|
-
|
|
6248
|
-
|
|
6514
|
+
checkIcon(manifest.slug, manifest == null ? void 0 : manifest.icon);
|
|
6515
|
+
if (!Array.isArray(manifest.vendors)) {
|
|
6516
|
+
throw new Error(manifest.slug + " must declare vendors \u2014 an array of vendor slugs, empty when it spends none");
|
|
6249
6517
|
}
|
|
6250
6518
|
const declaredKeys = /* @__PURE__ */ new Set();
|
|
6251
|
-
for (const
|
|
6252
|
-
if (!(
|
|
6253
|
-
|
|
6254
|
-
if (!Array.isArray(declared.fields) || !declared.fields.length) {
|
|
6255
|
-
throw new Error(manifest.slug + " declares vendor " + vendor + " with no fields \u2014 a vendor nothing is typed into holds nothing");
|
|
6519
|
+
for (const slug2 of manifest.vendors) {
|
|
6520
|
+
if (!Object.hasOwn(vendors, slug2)) {
|
|
6521
|
+
throw new Error(manifest.slug + " spends vendor " + slug2 + ", which has no file in lib/connections/vendors");
|
|
6256
6522
|
}
|
|
6257
|
-
for (const field2 of
|
|
6258
|
-
if (!(field2 == null ? void 0 : field2.key) || !(field2 == null ? void 0 : field2.label)) {
|
|
6259
|
-
throw new Error(manifest.slug + " declares a provider field with no key or label");
|
|
6260
|
-
}
|
|
6261
|
-
if (!INPUTS.includes(field2.input)) {
|
|
6262
|
-
throw new Error(manifest.slug + ".provider." + field2.key + " needs an input the admin form can render \u2014 one of " + INPUTS.join(", "));
|
|
6263
|
-
}
|
|
6264
|
-
if (field2.input === "password" && !field2.redact) {
|
|
6265
|
-
throw new Error(manifest.slug + ".provider." + field2.key + " is a password and must declare redact : true \u2014 the api would hand the value back");
|
|
6266
|
-
}
|
|
6523
|
+
for (const field2 of vendors[slug2].fields) {
|
|
6267
6524
|
if (declaredKeys.has(field2.key)) {
|
|
6268
|
-
throw new Error(manifest.slug + "
|
|
6525
|
+
throw new Error(manifest.slug + " spends " + field2.key + " under two vendors \u2014 vendorSettings() merges them and one would win");
|
|
6269
6526
|
}
|
|
6270
6527
|
declaredKeys.add(field2.key);
|
|
6271
6528
|
}
|
|
6272
6529
|
}
|
|
6273
|
-
checkIcon(manifest.slug, manifest == null ? void 0 : manifest.icon);
|
|
6274
6530
|
if (!GROUPS.includes(manifest == null ? void 0 : manifest.group)) {
|
|
6275
6531
|
throw new Error(manifest.slug + " needs a group \u2014 one of " + GROUPS.join(", "));
|
|
6276
6532
|
}
|
|
6277
|
-
if ((
|
|
6533
|
+
if ((_c = manifest == null ? void 0 : manifest.connect) == null ? void 0 : _c.type) {
|
|
6278
6534
|
throw new Error(manifest.slug + " declares connect.type \u2014 that is auth.type now");
|
|
6279
6535
|
}
|
|
6280
|
-
if (!AUTH_TYPES.includes((
|
|
6536
|
+
if (!AUTH_TYPES.includes((_d = manifest == null ? void 0 : manifest.auth) == null ? void 0 : _d.type)) {
|
|
6281
6537
|
throw new Error(manifest.slug + " needs auth.type \u2014 one of " + AUTH_TYPES.join(", "));
|
|
6282
6538
|
}
|
|
6283
6539
|
if (manifest.auth.type === "oauth") {
|
|
6284
6540
|
for (const field2 of OAUTH_FIELDS) {
|
|
6285
|
-
if (!((
|
|
6541
|
+
if (!((_e = manifest.auth.oauth) == null ? void 0 : _e[field2])) {
|
|
6286
6542
|
throw new Error(manifest.slug + " is oauth and must declare auth.oauth." + field2);
|
|
6287
6543
|
}
|
|
6288
6544
|
}
|
|
6289
|
-
if (typeof ((
|
|
6545
|
+
if (typeof ((_g = (_f = manifest.hooks) == null ? void 0 : _f.auth) == null ? void 0 : _g.token) !== "function") {
|
|
6290
6546
|
throw new Error(manifest.slug + " is oauth and must implement hooks.auth.token \u2014 point it at authToken() or wrap it");
|
|
6291
6547
|
}
|
|
6292
6548
|
for (const url of OAUTH_URLS) {
|
|
6293
|
-
if (!((
|
|
6549
|
+
if (!((_i = (_h = manifest.auth.oauth) == null ? void 0 : _h.urls) == null ? void 0 : _i[url])) {
|
|
6294
6550
|
throw new Error(manifest.slug + " is oauth and must declare auth.oauth.urls." + url);
|
|
6295
6551
|
}
|
|
6296
6552
|
}
|
|
@@ -6300,16 +6556,16 @@ var build = (manifest) => {
|
|
|
6300
6556
|
);
|
|
6301
6557
|
}
|
|
6302
6558
|
}
|
|
6303
|
-
if (implemented(manifest.hooks, "inbound.event") && typeof ((
|
|
6559
|
+
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)) {
|
|
6304
6560
|
throw new Error(manifest.slug + " implements inbound.event but declares no inbound.headers.event");
|
|
6305
6561
|
}
|
|
6306
|
-
if (implemented(manifest.hooks, "inbound.verify") && !((
|
|
6562
|
+
if (implemented(manifest.hooks, "inbound.verify") && !((_o = (_n = manifest.inbound) == null ? void 0 : _n.headers) == null ? void 0 : _o.signature)) {
|
|
6307
6563
|
throw new Error(manifest.slug + " implements inbound.verify but declares no inbound.headers.signature");
|
|
6308
6564
|
}
|
|
6309
6565
|
if (typeof (manifest == null ? void 0 : manifest.status) !== "function") {
|
|
6310
6566
|
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");
|
|
6311
6567
|
}
|
|
6312
|
-
if (!Array.isArray((
|
|
6568
|
+
if (!Array.isArray((_p = manifest == null ? void 0 : manifest.content) == null ? void 0 : _p.guide) || !manifest.content.guide.length) {
|
|
6313
6569
|
throw new Error(manifest.slug + " needs content.guide \u2014 an array of steps for its page");
|
|
6314
6570
|
}
|
|
6315
6571
|
if (typeof (manifest == null ? void 0 : manifest.status) !== "function") {
|
|
@@ -6321,8 +6577,8 @@ var build = (manifest) => {
|
|
|
6321
6577
|
}
|
|
6322
6578
|
for (const [domain, verbs] of Object.entries(HOOKS)) {
|
|
6323
6579
|
for (const verb of verbs) {
|
|
6324
|
-
const hook = (
|
|
6325
|
-
if (((
|
|
6580
|
+
const hook = (_r = (_q = manifest.hooks) == null ? void 0 : _q[domain]) == null ? void 0 : _r[verb];
|
|
6581
|
+
if (((_s = manifest.hooks) == null ? void 0 : _s[domain]) === false) continue;
|
|
6326
6582
|
if (hook !== false && !implemented({ [domain]: { [verb]: hook } }, domain + "." + verb)) {
|
|
6327
6583
|
throw new Error(manifest.slug + " must answer hooks." + domain + "." + verb + " \u2014 false, a function, or {} if another repo implements it");
|
|
6328
6584
|
}
|
|
@@ -6372,44 +6628,6 @@ var connections = Object.freeze({
|
|
|
6372
6628
|
shopify: build(shopify_default2),
|
|
6373
6629
|
webhook: build(webhook_default)
|
|
6374
6630
|
});
|
|
6375
|
-
var canonical = (field2) => JSON.stringify(Object.fromEntries(Object.entries(field2).sort()));
|
|
6376
|
-
var mergeVendors = (catalog) => {
|
|
6377
|
-
var _a;
|
|
6378
|
-
const merged = {};
|
|
6379
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
6380
|
-
for (const [slug2, manifest] of Object.entries(catalog)) {
|
|
6381
|
-
for (const [vendor, declared] of Object.entries(((_a = manifest.provider) == null ? void 0 : _a.vendors) || {})) {
|
|
6382
|
-
const held = merged[vendor] || (merged[vendor] = { fields: [], icon: declared.icon, name: declared.name });
|
|
6383
|
-
if (held.name !== declared.name) {
|
|
6384
|
-
throw new Error(slug2 + " names vendor " + vendor + ' "' + declared.name + '" but another manifest names it "' + held.name + '"');
|
|
6385
|
-
}
|
|
6386
|
-
if (held.icon !== declared.icon) {
|
|
6387
|
-
throw new Error(slug2 + " declares a different icon for vendor " + vendor + " than another manifest \u2014 one vendor, one mark");
|
|
6388
|
-
}
|
|
6389
|
-
for (const field2 of declared.fields) {
|
|
6390
|
-
const existing = held.fields.find((entry) => entry.key === field2.key);
|
|
6391
|
-
if (existing) {
|
|
6392
|
-
if (canonical(existing) !== canonical(field2)) {
|
|
6393
|
-
throw new Error(slug2 + " declares " + vendor + "." + field2.key + " differently from another manifest \u2014 a field two connections spend is declared identically in both");
|
|
6394
|
-
}
|
|
6395
|
-
continue;
|
|
6396
|
-
}
|
|
6397
|
-
if (field2.credential) {
|
|
6398
|
-
const owner = claimed.get(field2.credential);
|
|
6399
|
-
if (owner) {
|
|
6400
|
-
throw new Error(field2.credential + " is claimed by both " + owner + " and " + vendor + "." + field2.key + " \u2014 one would silently overwrite the other");
|
|
6401
|
-
}
|
|
6402
|
-
claimed.set(field2.credential, vendor + "." + field2.key);
|
|
6403
|
-
}
|
|
6404
|
-
held.fields.push(field2);
|
|
6405
|
-
}
|
|
6406
|
-
}
|
|
6407
|
-
}
|
|
6408
|
-
return Object.freeze(Object.fromEntries(
|
|
6409
|
-
Object.entries(merged).map(([vendor, held]) => [vendor, Object.freeze({ ...held, fields: Object.freeze(held.fields) })])
|
|
6410
|
-
));
|
|
6411
|
-
};
|
|
6412
|
-
var vendors = mergeVendors(connections);
|
|
6413
6631
|
(() => {
|
|
6414
6632
|
var _a;
|
|
6415
6633
|
const routes = {};
|
|
@@ -6535,12 +6753,6 @@ var publicConnectionKeys = Object.freeze([
|
|
|
6535
6753
|
// excerpt, guide, and any vendor redirect copy.
|
|
6536
6754
|
"content",
|
|
6537
6755
|
"createdAt",
|
|
6538
|
-
// THE MERCHANT'S OWN SWITCH. `enabled : false` is a connection the merchant
|
|
6539
|
-
// paused — kept, configured, and not run — as distinct from a vendor the
|
|
6540
|
-
// platform switched off (which the api overlays as an error). Absent means
|
|
6541
|
-
// on; the dashboard renders Paused from it and the sync gates refuse a paused
|
|
6542
|
-
// connection the way they refuse a missing one.
|
|
6543
|
-
"enabled",
|
|
6544
6756
|
// The connection DOCUMENT's own errors array — scope-drift entries written by
|
|
6545
6757
|
// drawbridge-sync. NOT the manifest's error copy, which is content.errors:
|
|
6546
6758
|
// the document is spread OVER the resolved manifest downstream, so the two
|
|
@@ -6607,6 +6819,7 @@ var resolveConnection = (item, data2, env = {}) => {
|
|
|
6607
6819
|
authToken,
|
|
6608
6820
|
availableConnections,
|
|
6609
6821
|
build,
|
|
6822
|
+
buildVendor,
|
|
6610
6823
|
catalogConnections,
|
|
6611
6824
|
connectFields,
|
|
6612
6825
|
connectionSteps,
|
|
@@ -6616,7 +6829,6 @@ var resolveConnection = (item, data2, env = {}) => {
|
|
|
6616
6829
|
hookSupport,
|
|
6617
6830
|
isStale,
|
|
6618
6831
|
mergeSettings,
|
|
6619
|
-
mergeVendors,
|
|
6620
6832
|
pkcePair,
|
|
6621
6833
|
projectConnection,
|
|
6622
6834
|
publicConnectionKeys,
|