@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.
@@ -524,7 +524,7 @@ var detectCountry = (value) => {
524
524
  }
525
525
  };
526
526
 
527
- // lib/connections/segment-rows.js
527
+ // lib/connections/segment.js
528
528
  import { randomUUID } from "crypto";
529
529
  var row = ({ connection: connection2, data: data2, manifest, row: described }) => {
530
530
  var _a, _b;
@@ -617,7 +617,7 @@ var driftEnqueues = async ({ applied, read, segment, workflow }) => {
617
617
  }];
618
618
  };
619
619
 
620
- // lib/connections/providers/attentive.js
620
+ // lib/connections/manifests/attentive.js
621
621
  var api = async (path, { fetcher = fetch, method = "GET", payload, token }) => {
622
622
  const response = await fetcher("https://api.attentivemobile.com" + path, {
623
623
  ...payload && { body: JSON.stringify(payload) },
@@ -956,26 +956,6 @@ var attentive_default2 = {
956
956
  webhook: false
957
957
  },
958
958
  icon: attentive_default,
959
- // DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
960
- // what an admin types on the provider screen, and the only declaration of it.
961
- // It lives beside `requires`, which names the same variables: the manifest
962
- // says what it needs and this says how someone supplies it, so a credential
963
- // cannot be required by a vendor that offers nowhere to enter it.
964
- //
965
- // `redact` marks a secret — never returned by the api, and blank on save means
966
- // keep the stored value. `required` drives the live check.
967
- provider: {
968
- vendors: {
969
- attentive: {
970
- fields: [
971
- { 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 },
972
- { 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 }
973
- ],
974
- icon: attentive_default,
975
- name: "Attentive"
976
- }
977
- }
978
- },
979
959
  requires: [
980
960
  "ATTENTIVE_OAUTH_CLIENT_ID",
981
961
  "ATTENTIVE_OAUTH_CLIENT_SECRET"
@@ -1066,6 +1046,11 @@ var attentive_default2 = {
1066
1046
  }
1067
1047
  ];
1068
1048
  },
1049
+ // THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
1050
+ // lib/connections/vendors/, and named here by whoever uses it — the block that
1051
+ // used to sit here declared them inline, so two manifests naming one vendor had
1052
+ // to be reconciled at import by mergeVendors().
1053
+ vendors: ["attentive"],
1069
1054
  title: "Attentive",
1070
1055
  // ATTENTIVE'S SEGMENTS INDEX. There is no documented per-segment url, and the
1071
1056
  // only identifier we hold is the API's externalId, which their UI may not
@@ -1083,7 +1068,7 @@ var attentive_default2 = {
1083
1068
  }
1084
1069
  };
1085
1070
 
1086
- // lib/connections/providers/drawbridge.js
1071
+ // lib/connections/manifests/drawbridge.js
1087
1072
  import { createHmac as createHmac2, timingSafeEqual as timingSafeEqual2 } from "crypto";
1088
1073
 
1089
1074
  // lib/connections/inbound.js
@@ -2020,7 +2005,7 @@ var MINIMUM_ACTION_CENTS = Math.round(
2020
2005
  sending.sms.segmentCostCents / channels.sms.actionsPerSegment * MARKUP * 1e3
2021
2006
  ) / 1e3;
2022
2007
 
2023
- // lib/connections/providers/drawbridge.js
2008
+ // lib/connections/manifests/drawbridge.js
2024
2009
  var STOP_KEYWORDS = ["STOP", "STOPALL", "UNSUBSCRIBE", "CANCEL", "END", "QUIT"];
2025
2010
  var START_KEYWORDS = ["START", "UNSTOP", "YES"];
2026
2011
  var sendgridInbound = {
@@ -2717,70 +2702,6 @@ var drawbridge_default2 = {
2717
2702
  },
2718
2703
  // PRIVATE: never in the catalog, always available to the builder.
2719
2704
  private: true,
2720
- // THE PLATFORM'S OWN SENDING CREDENTIALS — SendGrid, Twilio, and the internal
2721
- // HubSpot portal. No merchant ever sees these; they are what an admin types on
2722
- // the provider screen so that Drawbridge itself can send.
2723
- //
2724
- // They belong on THIS manifest because this is the connection that sends: the
2725
- // email, sms and segment hooks below are the only things that spend them, and
2726
- // a private connection is still where a vendor fact lives. They are THREE
2727
- // VENDORS, not one, and each is its own row and its own admin card — so
2728
- // SendGrid reads live on a deployment that never configured Twilio, instead
2729
- // of one card for all three that could only ever be as live as its weakest.
2730
- //
2731
- // UNLIKE every public vendor, none of these appear in `requires` — see the
2732
- // comment there. Availability and configuration are different questions, and a
2733
- // missing CRM token must not take every base workflow step away.
2734
- //
2735
- // ponytail: the field keys keep the names they had on the shared row
2736
- // (smsSid, hubspotToken) so the readers destructuring vendorSettings() did
2737
- // not move. Rename them to sid/token when those readers are next touched.
2738
- provider: {
2739
- vendors: {
2740
- sendgrid: {
2741
- fields: [
2742
- { input: "email", key: "accountSender", credential: "SENDGRID_FROM_ADDRESS", label: "Account sender", message: "Verification codes and security alerts send from here.", required: true },
2743
- { 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 },
2744
- // Optional: SENDGRID_SEND_FROM_ADDRESS is not boot-required in sync
2745
- // either. Unset, it degrades to the account sender rather than
2746
- // refusing to start.
2747
- // NOT redacted, because it is a PUBLIC key. Marking it secret would
2748
- // be theatre, and it would stop an operator reading back the value
2749
- // they need to compare against the SendGrid console.
2750
- //
2751
- // Optional: absent, the event webhook answers 500 on verify rather
2752
- // than accepting unverified deliveries, and nothing else notices.
2753
- { 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." },
2754
- { 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." }
2755
- ],
2756
- icon: sendgrid_default,
2757
- name: "SendGrid"
2758
- },
2759
- // Missing, SMS is LOCKED DOWN rather than broken: every send path
2760
- // refuses cleanly (queue/notification.js cancels, the otc stream skips
2761
- // and logs), the number-purchase routes deny, and identityDefaults.sms
2762
- // hides the org's SMS settings entirely. The card reads not live, which
2763
- // is the truth about Twilio and says nothing about email.
2764
- twilio: {
2765
- fields: [
2766
- { input: "text", key: "smsFrom", credential: "TWILIO_ACCOUNT_FROM", label: "SMS number", message: "Without Twilio credentials, SMS is disabled across the platform.", required: true },
2767
- { 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 },
2768
- { 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 }
2769
- ],
2770
- icon: twilio_default,
2771
- name: "Twilio"
2772
- },
2773
- // The CRM sync is best-effort internal tooling and no-ops without a
2774
- // token. Not live here costs nothing a merchant can see.
2775
- hubspot: {
2776
- fields: [
2777
- { 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 }
2778
- ],
2779
- icon: hubspot_default,
2780
- name: "HubSpot"
2781
- }
2782
- }
2783
- },
2784
2705
  // NOTHING, and HUBSPOT_ACCESS_TOKEN in particular must not be here.
2785
2706
  //
2786
2707
  // `requires` gates AVAILABILITY: a name in it that is unset removes the whole
@@ -2979,6 +2900,16 @@ var drawbridge_default2 = {
2979
2900
  }
2980
2901
  },
2981
2902
  tasks: () => [],
2903
+ // THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
2904
+ // lib/connections/vendors/, and named here by whoever uses it — the block that
2905
+ // used to sit here declared them inline, so two manifests naming one vendor had
2906
+ // to be reconciled at import by mergeVendors().
2907
+ //
2908
+ // THREE, and they have nothing to do with each other: drawbridge is the
2909
+ // platform's own sender and spends SendGrid for email, Twilio for SMS and
2910
+ // HubSpot for CRM. They were bundled under one manifest only because one
2911
+ // connection happens to use all three.
2912
+ vendors: ["sendgrid", "twilio", "hubspot"],
2982
2913
  title: "Drawbridge"
2983
2914
  };
2984
2915
 
@@ -2996,7 +2927,7 @@ var missingScopes = ({ granted, required }) => {
2996
2927
  return list(required).filter((scope) => !held.has(scope));
2997
2928
  };
2998
2929
 
2999
- // lib/connections/providers/klaviyo.js
2930
+ // lib/connections/manifests/klaviyo.js
3000
2931
  var api2 = async (path, { fetcher = fetch, method = "GET", payload, token }) => {
3001
2932
  const response = await fetcher("https://a.klaviyo.com/api" + path, {
3002
2933
  ...payload && { body: JSON.stringify(payload) },
@@ -3610,24 +3541,6 @@ var klaviyo_default2 = {
3610
3541
  webhook: false
3611
3542
  },
3612
3543
  icon: klaviyo_default,
3613
- // DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
3614
- // what an admin types on the provider screen. Declared here rather than in a
3615
- // table in lib/providers.js, so a vendor's credentials sit beside the
3616
- // `requires` that names the same variables. Keyed by the VENDOR that holds
3617
- // them — here the vendor and the connection are the same thing, which is not
3618
- // true of every manifest.
3619
- provider: {
3620
- vendors: {
3621
- klaviyo: {
3622
- fields: [
3623
- { 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 },
3624
- { 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 }
3625
- ],
3626
- icon: klaviyo_default,
3627
- name: "Klaviyo"
3628
- }
3629
- }
3630
- },
3631
3544
  requires: [
3632
3545
  "KLAVIYO_OAUTH_CLIENT_ID",
3633
3546
  "KLAVIYO_OAUTH_CLIENT_SECRET"
@@ -3766,6 +3679,11 @@ var klaviyo_default2 = {
3766
3679
  }]
3767
3680
  ];
3768
3681
  },
3682
+ // THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
3683
+ // lib/connections/vendors/, and named here by whoever uses it — the block that
3684
+ // used to sit here declared them inline, so two manifests naming one vendor had
3685
+ // to be reconciled at import by mergeVendors().
3686
+ vendors: ["klaviyo"],
3769
3687
  title: "Klaviyo",
3770
3688
  // KLAVIYO PUBLISHES NO DASHBOARD URLS in its API reference. What is on record
3771
3689
  // is its own help centre on a list: "you can find a list's ID in the URL in
@@ -3779,7 +3697,7 @@ var klaviyo_default2 = {
3779
3697
  }
3780
3698
  };
3781
3699
 
3782
- // lib/connections/providers/mailchimp.js
3700
+ // lib/connections/manifests/mailchimp.js
3783
3701
  import { createHash as createHash2 } from "crypto";
3784
3702
 
3785
3703
  // lib/connections/icons/mailchimp.js
@@ -3789,7 +3707,7 @@ var mailchimp_default = `<svg width="500" height="500" viewBox="0 0 500 500" fil
3789
3707
  <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"/>
3790
3708
  </svg>`;
3791
3709
 
3792
- // lib/connections/providers/mailchimp.js
3710
+ // lib/connections/manifests/mailchimp.js
3793
3711
  var base = (dc) => {
3794
3712
  if (!dc) throw new Error("This Mailchimp connection has no data centre stored, so there is no host to call");
3795
3713
  return "https://" + dc + ".api.mailchimp.com/3.0";
@@ -4187,21 +4105,6 @@ var mailchimp_default2 = {
4187
4105
  webhook: false
4188
4106
  },
4189
4107
  icon: mailchimp_default,
4190
- // DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
4191
- // what an admin types on the provider screen, beside the `requires` naming the
4192
- // same variables.
4193
- provider: {
4194
- vendors: {
4195
- mailchimp: {
4196
- fields: [
4197
- { 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 },
4198
- { 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 }
4199
- ],
4200
- icon: mailchimp_default,
4201
- name: "Mailchimp"
4202
- }
4203
- }
4204
- },
4205
4108
  // The OAuth client this deployment registered. Without both, the vendor drops
4206
4109
  // out of availableConnections rather than offering a Connect button that
4207
4110
  // cannot complete.
@@ -4304,6 +4207,11 @@ var mailchimp_default2 = {
4304
4207
  }
4305
4208
  ];
4306
4209
  },
4210
+ // THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
4211
+ // lib/connections/vendors/, and named here by whoever uses it — the block that
4212
+ // used to sit here declared them inline, so two manifests naming one vendor had
4213
+ // to be reconciled at import by mergeVendors().
4214
+ vendors: ["mailchimp"],
4307
4215
  title: "Mailchimp",
4308
4216
  // THE MERCHANT'S OWN ADMIN. Mailchimp's list schema states the shape outright:
4309
4217
  // the web_id field is "The ID used in the Mailchimp web application. View this
@@ -4323,7 +4231,7 @@ var mailchimp_default2 = {
4323
4231
  }
4324
4232
  };
4325
4233
 
4326
- // lib/connections/providers/shopify.js
4234
+ // lib/connections/manifests/shopify.js
4327
4235
  import { randomUUID as randomUUID2 } from "crypto";
4328
4236
  import { customAlphabet as customAlphabet2 } from "nanoid";
4329
4237
 
@@ -4386,7 +4294,7 @@ var slugify = (value, nochars = false) => {
4386
4294
  );
4387
4295
  };
4388
4296
 
4389
- // lib/connections/providers/shopify.js
4297
+ // lib/connections/manifests/shopify.js
4390
4298
  var toLine = ({
4391
4299
  price,
4392
4300
  product_id: productId,
@@ -5515,41 +5423,6 @@ var shopify_default2 = {
5515
5423
  },
5516
5424
  icon: shopify_default,
5517
5425
  inbound,
5518
- // DRAWBRIDGE'S OWN CREDENTIALS for this vendor, as opposed to a merchant's —
5519
- // what an admin types on the provider screen. The four names below are exactly
5520
- // what `requires` gates on, which is the point of declaring them together: a
5521
- // name required by the manifest and enterable nowhere is a vendor that can
5522
- // never go live from the admin screen.
5523
- provider: {
5524
- vendors: {
5525
- shopify: {
5526
- fields: [
5527
- { 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 },
5528
- { 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 },
5529
- { 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 },
5530
- { 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 },
5531
- // The usage meter's event handle, when the plan config's meter ever
5532
- // changes: stored value overrides the built-in default
5533
- // (events.order.handle) at the mint point, and `format : 'slug'`
5534
- // normalizes it on save — a handle can carry no spaces or capitals,
5535
- // and classification against it is case-sensitive. Optional: empty
5536
- // means the default, and the sender still refuses any handle that
5537
- // disagrees with the transaction it minted.
5538
- { 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 },
5539
- // The Partner API credential set — the ONE place meter billing is
5540
- // observable (CHARGE_USAGE accrual events). Org id and numeric app
5541
- // id come from the Partner Dashboard; the token from Settings →
5542
- // Partner API clients (Manage-apps permission). All optional: the
5543
- // accrual probe simply stays off until they exist.
5544
- { 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 },
5545
- { 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 },
5546
- { 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 }
5547
- ],
5548
- icon: shopify_default,
5549
- name: "Shopify"
5550
- }
5551
- }
5552
- },
5553
5426
  // A pre-launch integration: it only surfaces once the App Store listing
5554
5427
  // exists and the app is fully configured. Requiring all four means it can
5555
5428
  // never render half-configured — and absence of any one excludes the
@@ -5753,6 +5626,13 @@ var shopify_default2 = {
5753
5626
  ] : []
5754
5627
  ];
5755
5628
  },
5629
+ // THE VENDORS THIS CONNECTION SPENDS, by slug. Declared once in
5630
+ // lib/connections/vendors/shopify.js, and named here by whoever uses it.
5631
+ //
5632
+ // SHOPIFY_API_SECRET is spent by drawbridge-shopify-app and drawbridge-webhooks
5633
+ // too, which is the clearest case for why a vendor is not owned by whichever
5634
+ // connection happened to declare it first.
5635
+ vendors: ["shopify"],
5756
5636
  title: "Shopify",
5757
5637
  // THE VENDOR'S OWN ADMIN, one function per thing worth linking to. It lives
5758
5638
  // here rather than at the top level so a second link (a product, an order)
@@ -5779,7 +5659,7 @@ var shopify_default2 = {
5779
5659
  }
5780
5660
  };
5781
5661
 
5782
- // lib/connections/providers/webhook.js
5662
+ // lib/connections/manifests/webhook.js
5783
5663
  import crypto2 from "crypto";
5784
5664
 
5785
5665
  // lib/safe-http.js
@@ -5924,7 +5804,7 @@ var safeRequest = async ({
5924
5804
  }
5925
5805
  };
5926
5806
 
5927
- // lib/connections/providers/webhook.js
5807
+ // lib/connections/manifests/webhook.js
5928
5808
  var RESPONSE_LIMIT = 64 * 1024;
5929
5809
  var signature = ({ body, settings }) => {
5930
5810
  var _a;
@@ -6114,9 +5994,369 @@ var webhook_default = {
6114
5994
  title: "Webhook signing"
6115
5995
  }
6116
5996
  ],
5997
+ // THE VENDORS THIS CONNECTION SPENDS, by slug. Each is declared once in
5998
+ // lib/connections/vendors/, and named here by whoever uses it — the block that
5999
+ // used to sit here declared them inline, so two manifests naming one vendor had
6000
+ // to be reconciled at import by mergeVendors().
6001
+ //
6002
+ // Empty: webhook has no third party behind it — nothing to authenticate
6003
+ // against and nothing for an admin to type.
6004
+ vendors: [],
6117
6005
  title: "Webhooks"
6118
6006
  };
6119
6007
 
6008
+ // lib/connections/vendors/attentive.js
6009
+ var attentive_default3 = {
6010
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6011
+ // field falls back to, and is the only place that name is written now — it used
6012
+ // to appear three times per manifest.
6013
+ fields: [
6014
+ {
6015
+ credential: "ATTENTIVE_OAUTH_CLIENT_ID",
6016
+ input: "text",
6017
+ key: "clientId",
6018
+ label: "Client ID",
6019
+ message: "From our app's registration in the Attentive developer portal.",
6020
+ required: true
6021
+ },
6022
+ {
6023
+ credential: "ATTENTIVE_OAUTH_CLIENT_SECRET",
6024
+ input: "password",
6025
+ key: "clientSecret",
6026
+ label: "Client secret",
6027
+ message: "Beside the Client ID in the Attentive developer portal.",
6028
+ redact: true,
6029
+ required: true
6030
+ }
6031
+ ],
6032
+ // The same mark the connection carries. One vendor, one icon — mergeVendors
6033
+ // used to throw when two manifests disagreed about this.
6034
+ icon: attentive_default,
6035
+ name: "Attentive",
6036
+ slug: "attentive",
6037
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6038
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6039
+ // answered two of them with an object keyed by vendor while the other four
6040
+ // answered with a string — two incompatible shapes for one key, and the shape
6041
+ // was saying where the data belonged.
6042
+ urls: {
6043
+ api: "https://docs.attentive.com/reference/listsegments",
6044
+ dashboard: "https://docs.attentive.com/docs/segments",
6045
+ scopes: "https://docs.attentive.com/docs/authentication"
6046
+ }
6047
+ };
6048
+
6049
+ // lib/connections/vendors/hubspot.js
6050
+ var hubspot_default2 = {
6051
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6052
+ // field falls back to, and is the only place that name is written now — it used
6053
+ // to appear three times per manifest.
6054
+ fields: [
6055
+ {
6056
+ credential: "HUBSPOT_ACCESS_TOKEN",
6057
+ input: "password",
6058
+ key: "hubspotToken",
6059
+ label: "HubSpot access token",
6060
+ message: "Drawbridge's own CRM portal. Internal \u2014 no merchant sees this.",
6061
+ redact: true,
6062
+ required: true
6063
+ }
6064
+ ],
6065
+ // The vendor's own mark rather than the connection's: drawbridge fronts three
6066
+ // vendors and none of them is Drawbridge.
6067
+ icon: hubspot_default,
6068
+ name: "HubSpot",
6069
+ slug: "hubspot",
6070
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6071
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6072
+ // answered two of them with an object keyed by vendor while the other four
6073
+ // answered with a string — two incompatible shapes for one key, and the shape
6074
+ // was saying where the data belonged.
6075
+ urls: {
6076
+ api: "https://developers.hubspot.com/docs/reference/api/crm/objects/contacts",
6077
+ dashboard: "https://knowledge.hubspot.com/contacts/create-contacts",
6078
+ scopes: false
6079
+ }
6080
+ };
6081
+
6082
+ // lib/connections/vendors/klaviyo.js
6083
+ var klaviyo_default3 = {
6084
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6085
+ // field falls back to, and is the only place that name is written now — it used
6086
+ // to appear three times per manifest.
6087
+ fields: [
6088
+ {
6089
+ credential: "KLAVIYO_OAUTH_CLIENT_ID",
6090
+ input: "text",
6091
+ key: "clientId",
6092
+ label: "Client ID",
6093
+ message: "From our app in the Klaviyo developer portal (developers.klaviyo.com).",
6094
+ required: true
6095
+ },
6096
+ {
6097
+ credential: "KLAVIYO_OAUTH_CLIENT_SECRET",
6098
+ input: "password",
6099
+ key: "clientSecret",
6100
+ label: "Client secret",
6101
+ message: "Beside the Client ID on the Klaviyo app.",
6102
+ redact: true,
6103
+ required: true
6104
+ }
6105
+ ],
6106
+ // The same mark the connection carries. One vendor, one icon — mergeVendors
6107
+ // used to throw when two manifests disagreed about this.
6108
+ icon: klaviyo_default,
6109
+ name: "Klaviyo",
6110
+ slug: "klaviyo",
6111
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6112
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6113
+ // answered two of them with an object keyed by vendor while the other four
6114
+ // answered with a string — two incompatible shapes for one key, and the shape
6115
+ // was saying where the data belonged.
6116
+ urls: {
6117
+ api: "https://developers.klaviyo.com/en/reference/api_overview",
6118
+ dashboard: "https://help.klaviyo.com/hc/en-us/articles/115005078647",
6119
+ scopes: "https://developers.klaviyo.com/en/docs/authenticate_"
6120
+ }
6121
+ };
6122
+
6123
+ // lib/connections/vendors/mailchimp.js
6124
+ var mailchimp_default3 = {
6125
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6126
+ // field falls back to, and is the only place that name is written now — it used
6127
+ // to appear three times per manifest.
6128
+ fields: [
6129
+ {
6130
+ credential: "MAILCHIMP_OAUTH_CLIENT_ID",
6131
+ input: "text",
6132
+ key: "clientId",
6133
+ label: "Client ID",
6134
+ message: "From our registered app \u2014 Mailchimp account, Extras, Registered apps.",
6135
+ required: true
6136
+ },
6137
+ {
6138
+ credential: "MAILCHIMP_OAUTH_CLIENT_SECRET",
6139
+ input: "password",
6140
+ key: "clientSecret",
6141
+ label: "Client secret",
6142
+ message: "Beside the Client ID on the registered app.",
6143
+ redact: true,
6144
+ required: true
6145
+ }
6146
+ ],
6147
+ // The same mark the connection carries. One vendor, one icon — mergeVendors
6148
+ // used to throw when two manifests disagreed about this.
6149
+ icon: mailchimp_default,
6150
+ name: "Mailchimp",
6151
+ slug: "mailchimp",
6152
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6153
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6154
+ // answered two of them with an object keyed by vendor while the other four
6155
+ // answered with a string — two incompatible shapes for one key, and the shape
6156
+ // was saying where the data belonged.
6157
+ urls: {
6158
+ api: "https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/",
6159
+ dashboard: "https://mailchimp.com/help/manage-tags/",
6160
+ scopes: false
6161
+ }
6162
+ };
6163
+
6164
+ // lib/connections/vendors/sendgrid.js
6165
+ var sendgrid_default2 = {
6166
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6167
+ // field falls back to, and is the only place that name is written now — it used
6168
+ // to appear three times per manifest.
6169
+ fields: [
6170
+ {
6171
+ credential: "SENDGRID_FROM_ADDRESS",
6172
+ input: "email",
6173
+ key: "accountSender",
6174
+ label: "Account sender",
6175
+ message: "Verification codes and security alerts send from here.",
6176
+ required: true
6177
+ },
6178
+ {
6179
+ credential: "SENDGRID_API_KEY",
6180
+ input: "password",
6181
+ key: "apiKey",
6182
+ label: "SendGrid API key",
6183
+ message: "SendGrid dashboard, Settings, API Keys \u2014 full access for sends.",
6184
+ redact: true,
6185
+ required: true
6186
+ },
6187
+ {
6188
+ credential: "SENDGRID_EVENT_WEBHOOK_KEY",
6189
+ input: "text",
6190
+ key: "eventKey",
6191
+ label: "Event webhook key",
6192
+ message: "SendGrid, Settings, Mail Settings, Event Webhook \u2014 the verification key shown once signature verification is enabled. Public, not a secret."
6193
+ },
6194
+ {
6195
+ credential: "SENDGRID_SEND_FROM_ADDRESS",
6196
+ input: "email",
6197
+ key: "leadSender",
6198
+ label: "Lead sender",
6199
+ message: "The default for lead-facing mail when a merchant has not verified their own domain."
6200
+ }
6201
+ ],
6202
+ // The vendor's own mark rather than the connection's: drawbridge fronts three
6203
+ // vendors and none of them is Drawbridge.
6204
+ icon: sendgrid_default,
6205
+ name: "SendGrid",
6206
+ slug: "sendgrid",
6207
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6208
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6209
+ // answered two of them with an object keyed by vendor while the other four
6210
+ // answered with a string — two incompatible shapes for one key, and the shape
6211
+ // was saying where the data belonged.
6212
+ urls: {
6213
+ api: "https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send",
6214
+ dashboard: "https://www.twilio.com/docs/sendgrid/ui/analytics-and-reporting/email-activity-feed",
6215
+ scopes: false
6216
+ }
6217
+ };
6218
+
6219
+ // lib/connections/vendors/shopify.js
6220
+ var shopify_default3 = {
6221
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6222
+ // field falls back to, and is the only place that name is written now — it used
6223
+ // to appear three times per manifest.
6224
+ fields: [
6225
+ {
6226
+ credential: "SHOPIFY_API_KEY",
6227
+ input: "text",
6228
+ key: "apiKey",
6229
+ label: "API key",
6230
+ message: "The app's Client ID \u2014 Dev Dashboard, the app, Settings.",
6231
+ required: true
6232
+ },
6233
+ {
6234
+ credential: "SHOPIFY_API_SECRET",
6235
+ input: "password",
6236
+ key: "apiSecret",
6237
+ label: "API secret",
6238
+ message: "The app's Client secret, beside the Client ID in the app's settings.",
6239
+ redact: true,
6240
+ required: true
6241
+ },
6242
+ {
6243
+ credential: "SHOPIFY_APP_HANDLE",
6244
+ input: "text",
6245
+ key: "appHandle",
6246
+ label: "App handle",
6247
+ message: "The app's URL handle (for example drawbridge-development), from the app's configuration.",
6248
+ required: true
6249
+ },
6250
+ {
6251
+ credential: "SHOPIFY_APP_LISTING_URL",
6252
+ input: "text",
6253
+ key: "listingUrl",
6254
+ label: "App listing URL",
6255
+ message: 'Where "View on the Shopify App Store" sends merchants \u2014 the public listing, or the Dev Dashboard install link for the dev app.',
6256
+ required: true
6257
+ },
6258
+ {
6259
+ format: "slug",
6260
+ input: "text",
6261
+ key: "orderEventHandle",
6262
+ label: "Order event handle",
6263
+ message: "Must match the usage meter's Handle field on the plan exactly \u2014 lowercase and hyphens. Leave empty to use drawbridge-orders.",
6264
+ required: false,
6265
+ setting: true
6266
+ },
6267
+ {
6268
+ input: "text",
6269
+ key: "partnerOrgId",
6270
+ label: "Partner organization ID",
6271
+ 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.",
6272
+ required: false,
6273
+ setting: true
6274
+ },
6275
+ {
6276
+ input: "text",
6277
+ key: "partnerAppId",
6278
+ label: "Partner app ID (numeric)",
6279
+ message: "The numeric id in the app's Partner Dashboard URL \u2014 not the Client ID.",
6280
+ required: false,
6281
+ setting: true
6282
+ },
6283
+ {
6284
+ input: "password",
6285
+ key: "partnerToken",
6286
+ label: "Partner API token",
6287
+ message: "Partner Dashboard, Settings, Partner API clients \u2014 create one with Manage apps and paste the prtapi_ token.",
6288
+ redact: true,
6289
+ required: false,
6290
+ setting: true
6291
+ }
6292
+ ],
6293
+ // The same mark the connection carries. One vendor, one icon — mergeVendors
6294
+ // used to throw when two manifests disagreed about this.
6295
+ icon: shopify_default,
6296
+ name: "Shopify",
6297
+ slug: "shopify",
6298
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6299
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6300
+ // answered two of them with an object keyed by vendor while the other four
6301
+ // answered with a string — two incompatible shapes for one key, and the shape
6302
+ // was saying where the data belonged.
6303
+ urls: {
6304
+ api: "https://shopify.dev/docs/api/admin-graphql",
6305
+ dashboard: "https://help.shopify.com/en/manual/apps",
6306
+ scopes: "https://shopify.dev/docs/api/usage/access-scopes"
6307
+ }
6308
+ };
6309
+
6310
+ // lib/connections/vendors/twilio.js
6311
+ var twilio_default2 = {
6312
+ // WHAT AN ADMIN TYPES on the provider screen. `credential` names the env var a
6313
+ // field falls back to, and is the only place that name is written now — it used
6314
+ // to appear three times per manifest.
6315
+ fields: [
6316
+ {
6317
+ credential: "TWILIO_ACCOUNT_FROM",
6318
+ input: "text",
6319
+ key: "smsFrom",
6320
+ label: "SMS number",
6321
+ message: "Without Twilio credentials, SMS is disabled across the platform.",
6322
+ required: true
6323
+ },
6324
+ {
6325
+ credential: "TWILIO_ACCOUNT_SID",
6326
+ input: "password",
6327
+ key: "smsSid",
6328
+ label: "Twilio account SID",
6329
+ message: "Twilio console home \u2014 the AC\u2026 identifier on the account dashboard.",
6330
+ redact: true,
6331
+ required: true
6332
+ },
6333
+ {
6334
+ credential: "TWILIO_AUTH_TOKEN",
6335
+ input: "password",
6336
+ key: "smsToken",
6337
+ label: "Twilio auth token",
6338
+ message: "Beside the account SID on the Twilio console dashboard.",
6339
+ redact: true,
6340
+ required: true
6341
+ }
6342
+ ],
6343
+ // The vendor's own mark rather than the connection's: drawbridge fronts three
6344
+ // vendors and none of them is Drawbridge.
6345
+ icon: twilio_default,
6346
+ name: "Twilio",
6347
+ slug: "twilio",
6348
+ // WHERE THE FACTS CAME FROM. Was review.api / .dashboard / .scopes on the
6349
+ // manifest. They are per-vendor documentation, which is exactly why drawbridge
6350
+ // answered two of them with an object keyed by vendor while the other four
6351
+ // answered with a string — two incompatible shapes for one key, and the shape
6352
+ // was saying where the data belonged.
6353
+ urls: {
6354
+ api: "https://www.twilio.com/docs/messaging/api/message-resource",
6355
+ dashboard: "https://www.twilio.com/docs/messaging/guides/debugging-tools",
6356
+ scopes: false
6357
+ }
6358
+ };
6359
+
6120
6360
  // lib/connections/index.js
6121
6361
  var QUEUES = ["connection", "notification", "segment", "webhook"];
6122
6362
  var implemented = (hooks, path) => {
@@ -6137,8 +6377,35 @@ var checkIcon = (owner, icon) => {
6137
6377
  throw new Error(owner + " icon wraps a raster \u2014 re-export it as vector shapes");
6138
6378
  }
6139
6379
  };
6380
+ var vendors = Object.freeze(Object.fromEntries(
6381
+ [attentive_default3, hubspot_default2, klaviyo_default3, mailchimp_default3, sendgrid_default2, shopify_default3, twilio_default2].map((vendor) => [vendor.slug, vendor])
6382
+ ));
6383
+ var buildVendor = (vendor) => {
6384
+ if (!(vendor == null ? void 0 : vendor.slug)) throw new Error("A vendor needs a slug");
6385
+ if (!vendor.name) throw new Error("vendor " + vendor.slug + " has no name");
6386
+ checkIcon("vendor " + vendor.slug, vendor.icon);
6387
+ if (!Array.isArray(vendor.fields) || !vendor.fields.length) {
6388
+ throw new Error("vendor " + vendor.slug + " has no fields \u2014 a vendor nothing is typed into holds nothing");
6389
+ }
6390
+ for (const field2 of vendor.fields) {
6391
+ if (!(field2 == null ? void 0 : field2.key) || !(field2 == null ? void 0 : field2.label)) {
6392
+ throw new Error("vendor " + vendor.slug + " declares a field with no key or label");
6393
+ }
6394
+ if (!INPUTS.includes(field2.input)) {
6395
+ throw new Error(vendor.slug + "." + field2.key + " needs an input the admin form can render \u2014 one of " + INPUTS.join(", "));
6396
+ }
6397
+ if (field2.input === "password" && !field2.redact) {
6398
+ throw new Error(vendor.slug + "." + field2.key + " is a password and must declare redact : true \u2014 the api would hand the value back");
6399
+ }
6400
+ }
6401
+ return Object.freeze(vendor);
6402
+ };
6403
+ for (const [slug2, vendor] of Object.entries(vendors)) {
6404
+ if (vendor.slug !== slug2) throw new Error("vendor file " + slug2 + " declares slug " + vendor.slug);
6405
+ buildVendor(vendor);
6406
+ }
6140
6407
  var build = (manifest) => {
6141
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
6408
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
6142
6409
  if (!(manifest == null ? void 0 : manifest.slug)) throw new Error("A connection needs a slug");
6143
6410
  if (!(manifest == null ? void 0 : manifest.title)) throw new Error(manifest.slug + " needs a title");
6144
6411
  if (!(manifest == null ? void 0 : manifest.private) && !(manifest == null ? void 0 : manifest.feature)) throw new Error(manifest.slug + " needs a plan feature key");
@@ -6168,53 +6435,42 @@ var build = (manifest) => {
6168
6435
  }
6169
6436
  }
6170
6437
  }
6171
- if ((_c = manifest.provider) == null ? void 0 : _c.fields) {
6172
- throw new Error(manifest.slug + " declares provider.fields \u2014 fields live under provider.vendors.<vendor> now, keyed by the vendor that holds them");
6438
+ checkIcon(manifest.slug, manifest == null ? void 0 : manifest.icon);
6439
+ if (!Array.isArray(manifest.vendors)) {
6440
+ throw new Error(manifest.slug + " must declare vendors \u2014 an array of vendor slugs, empty when it spends none");
6173
6441
  }
6174
6442
  const declaredKeys = /* @__PURE__ */ new Set();
6175
- for (const [vendor, declared] of Object.entries(((_d = manifest.provider) == null ? void 0 : _d.vendors) || {})) {
6176
- if (!(declared == null ? void 0 : declared.name)) throw new Error(manifest.slug + " declares vendor " + vendor + " with no name");
6177
- checkIcon(manifest.slug + " vendor " + vendor, declared.icon);
6178
- if (!Array.isArray(declared.fields) || !declared.fields.length) {
6179
- throw new Error(manifest.slug + " declares vendor " + vendor + " with no fields \u2014 a vendor nothing is typed into holds nothing");
6443
+ for (const slug2 of manifest.vendors) {
6444
+ if (!Object.hasOwn(vendors, slug2)) {
6445
+ throw new Error(manifest.slug + " spends vendor " + slug2 + ", which has no file in lib/connections/vendors");
6180
6446
  }
6181
- for (const field2 of declared.fields) {
6182
- if (!(field2 == null ? void 0 : field2.key) || !(field2 == null ? void 0 : field2.label)) {
6183
- throw new Error(manifest.slug + " declares a provider field with no key or label");
6184
- }
6185
- if (!INPUTS.includes(field2.input)) {
6186
- throw new Error(manifest.slug + ".provider." + field2.key + " needs an input the admin form can render \u2014 one of " + INPUTS.join(", "));
6187
- }
6188
- if (field2.input === "password" && !field2.redact) {
6189
- throw new Error(manifest.slug + ".provider." + field2.key + " is a password and must declare redact : true \u2014 the api would hand the value back");
6190
- }
6447
+ for (const field2 of vendors[slug2].fields) {
6191
6448
  if (declaredKeys.has(field2.key)) {
6192
- throw new Error(manifest.slug + " declares " + field2.key + " under two vendors \u2014 vendorSettings() merges them and one would win");
6449
+ throw new Error(manifest.slug + " spends " + field2.key + " under two vendors \u2014 vendorSettings() merges them and one would win");
6193
6450
  }
6194
6451
  declaredKeys.add(field2.key);
6195
6452
  }
6196
6453
  }
6197
- checkIcon(manifest.slug, manifest == null ? void 0 : manifest.icon);
6198
6454
  if (!GROUPS.includes(manifest == null ? void 0 : manifest.group)) {
6199
6455
  throw new Error(manifest.slug + " needs a group \u2014 one of " + GROUPS.join(", "));
6200
6456
  }
6201
- if ((_e = manifest == null ? void 0 : manifest.connect) == null ? void 0 : _e.type) {
6457
+ if ((_c = manifest == null ? void 0 : manifest.connect) == null ? void 0 : _c.type) {
6202
6458
  throw new Error(manifest.slug + " declares connect.type \u2014 that is auth.type now");
6203
6459
  }
6204
- if (!AUTH_TYPES.includes((_f = manifest == null ? void 0 : manifest.auth) == null ? void 0 : _f.type)) {
6460
+ if (!AUTH_TYPES.includes((_d = manifest == null ? void 0 : manifest.auth) == null ? void 0 : _d.type)) {
6205
6461
  throw new Error(manifest.slug + " needs auth.type \u2014 one of " + AUTH_TYPES.join(", "));
6206
6462
  }
6207
6463
  if (manifest.auth.type === "oauth") {
6208
6464
  for (const field2 of OAUTH_FIELDS) {
6209
- if (!((_g = manifest.auth.oauth) == null ? void 0 : _g[field2])) {
6465
+ if (!((_e = manifest.auth.oauth) == null ? void 0 : _e[field2])) {
6210
6466
  throw new Error(manifest.slug + " is oauth and must declare auth.oauth." + field2);
6211
6467
  }
6212
6468
  }
6213
- if (typeof ((_i = (_h = manifest.hooks) == null ? void 0 : _h.auth) == null ? void 0 : _i.token) !== "function") {
6469
+ if (typeof ((_g = (_f = manifest.hooks) == null ? void 0 : _f.auth) == null ? void 0 : _g.token) !== "function") {
6214
6470
  throw new Error(manifest.slug + " is oauth and must implement hooks.auth.token \u2014 point it at authToken() or wrap it");
6215
6471
  }
6216
6472
  for (const url of OAUTH_URLS) {
6217
- if (!((_k = (_j = manifest.auth.oauth) == null ? void 0 : _j.urls) == null ? void 0 : _k[url])) {
6473
+ if (!((_i = (_h = manifest.auth.oauth) == null ? void 0 : _h.urls) == null ? void 0 : _i[url])) {
6218
6474
  throw new Error(manifest.slug + " is oauth and must declare auth.oauth.urls." + url);
6219
6475
  }
6220
6476
  }
@@ -6224,16 +6480,16 @@ var build = (manifest) => {
6224
6480
  );
6225
6481
  }
6226
6482
  }
6227
- if (implemented(manifest.hooks, "inbound.event") && typeof ((_m = (_l = manifest.hooks) == null ? void 0 : _l.inbound) == null ? void 0 : _m.event) !== "function" && !((_o = (_n = manifest.inbound) == null ? void 0 : _n.headers) == null ? void 0 : _o.event)) {
6483
+ 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)) {
6228
6484
  throw new Error(manifest.slug + " implements inbound.event but declares no inbound.headers.event");
6229
6485
  }
6230
- if (implemented(manifest.hooks, "inbound.verify") && !((_q = (_p = manifest.inbound) == null ? void 0 : _p.headers) == null ? void 0 : _q.signature)) {
6486
+ if (implemented(manifest.hooks, "inbound.verify") && !((_o = (_n = manifest.inbound) == null ? void 0 : _n.headers) == null ? void 0 : _o.signature)) {
6231
6487
  throw new Error(manifest.slug + " implements inbound.verify but declares no inbound.headers.signature");
6232
6488
  }
6233
6489
  if (typeof (manifest == null ? void 0 : manifest.status) !== "function") {
6234
6490
  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");
6235
6491
  }
6236
- if (!Array.isArray((_r = manifest == null ? void 0 : manifest.content) == null ? void 0 : _r.guide) || !manifest.content.guide.length) {
6492
+ if (!Array.isArray((_p = manifest == null ? void 0 : manifest.content) == null ? void 0 : _p.guide) || !manifest.content.guide.length) {
6237
6493
  throw new Error(manifest.slug + " needs content.guide \u2014 an array of steps for its page");
6238
6494
  }
6239
6495
  if (typeof (manifest == null ? void 0 : manifest.status) !== "function") {
@@ -6245,8 +6501,8 @@ var build = (manifest) => {
6245
6501
  }
6246
6502
  for (const [domain, verbs] of Object.entries(HOOKS)) {
6247
6503
  for (const verb of verbs) {
6248
- const hook = (_t = (_s = manifest.hooks) == null ? void 0 : _s[domain]) == null ? void 0 : _t[verb];
6249
- if (((_u = manifest.hooks) == null ? void 0 : _u[domain]) === false) continue;
6504
+ const hook = (_r = (_q = manifest.hooks) == null ? void 0 : _q[domain]) == null ? void 0 : _r[verb];
6505
+ if (((_s = manifest.hooks) == null ? void 0 : _s[domain]) === false) continue;
6250
6506
  if (hook !== false && !implemented({ [domain]: { [verb]: hook } }, domain + "." + verb)) {
6251
6507
  throw new Error(manifest.slug + " must answer hooks." + domain + "." + verb + " \u2014 false, a function, or {} if another repo implements it");
6252
6508
  }
@@ -6296,44 +6552,6 @@ var connections = Object.freeze({
6296
6552
  shopify: build(shopify_default2),
6297
6553
  webhook: build(webhook_default)
6298
6554
  });
6299
- var canonical = (field2) => JSON.stringify(Object.fromEntries(Object.entries(field2).sort()));
6300
- var mergeVendors = (catalog) => {
6301
- var _a;
6302
- const merged = {};
6303
- const claimed = /* @__PURE__ */ new Map();
6304
- for (const [slug2, manifest] of Object.entries(catalog)) {
6305
- for (const [vendor, declared] of Object.entries(((_a = manifest.provider) == null ? void 0 : _a.vendors) || {})) {
6306
- const held = merged[vendor] || (merged[vendor] = { fields: [], icon: declared.icon, name: declared.name });
6307
- if (held.name !== declared.name) {
6308
- throw new Error(slug2 + " names vendor " + vendor + ' "' + declared.name + '" but another manifest names it "' + held.name + '"');
6309
- }
6310
- if (held.icon !== declared.icon) {
6311
- throw new Error(slug2 + " declares a different icon for vendor " + vendor + " than another manifest \u2014 one vendor, one mark");
6312
- }
6313
- for (const field2 of declared.fields) {
6314
- const existing = held.fields.find((entry) => entry.key === field2.key);
6315
- if (existing) {
6316
- if (canonical(existing) !== canonical(field2)) {
6317
- throw new Error(slug2 + " declares " + vendor + "." + field2.key + " differently from another manifest \u2014 a field two connections spend is declared identically in both");
6318
- }
6319
- continue;
6320
- }
6321
- if (field2.credential) {
6322
- const owner = claimed.get(field2.credential);
6323
- if (owner) {
6324
- throw new Error(field2.credential + " is claimed by both " + owner + " and " + vendor + "." + field2.key + " \u2014 one would silently overwrite the other");
6325
- }
6326
- claimed.set(field2.credential, vendor + "." + field2.key);
6327
- }
6328
- held.fields.push(field2);
6329
- }
6330
- }
6331
- }
6332
- return Object.freeze(Object.fromEntries(
6333
- Object.entries(merged).map(([vendor, held]) => [vendor, Object.freeze({ ...held, fields: Object.freeze(held.fields) })])
6334
- ));
6335
- };
6336
- var vendors = mergeVendors(connections);
6337
6555
  (() => {
6338
6556
  var _a;
6339
6557
  const routes = {};
@@ -6459,12 +6677,6 @@ var publicConnectionKeys = Object.freeze([
6459
6677
  // excerpt, guide, and any vendor redirect copy.
6460
6678
  "content",
6461
6679
  "createdAt",
6462
- // THE MERCHANT'S OWN SWITCH. `enabled : false` is a connection the merchant
6463
- // paused — kept, configured, and not run — as distinct from a vendor the
6464
- // platform switched off (which the api overlays as an error). Absent means
6465
- // on; the dashboard renders Paused from it and the sync gates refuse a paused
6466
- // connection the way they refuse a missing one.
6467
- "enabled",
6468
6680
  // The connection DOCUMENT's own errors array — scope-drift entries written by
6469
6681
  // drawbridge-sync. NOT the manifest's error copy, which is content.errors:
6470
6682
  // the document is spread OVER the resolved manifest downstream, so the two
@@ -6530,6 +6742,7 @@ export {
6530
6742
  authToken,
6531
6743
  availableConnections,
6532
6744
  build,
6745
+ buildVendor,
6533
6746
  catalogConnections,
6534
6747
  connectFields,
6535
6748
  connectionSteps,
@@ -6539,7 +6752,6 @@ export {
6539
6752
  hookSupport,
6540
6753
  isStale,
6541
6754
  mergeSettings,
6542
- mergeVendors,
6543
6755
  pkcePair,
6544
6756
  projectConnection,
6545
6757
  publicConnectionKeys,