@drawbridge/drawbridge-utils 0.0.159 → 0.0.161

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.
@@ -1356,7 +1356,6 @@ var organization = {
1356
1356
 
1357
1357
  // index.js
1358
1358
  var import_currency_codes = require("currency-codes");
1359
- var import_nanoid = require("nanoid");
1360
1359
 
1361
1360
  // lib/color.js
1362
1361
  var import_tinycolor2 = __toESM(require("tinycolor2"), 1);
@@ -1419,8 +1418,11 @@ var style = {
1419
1418
  }
1420
1419
  };
1421
1420
 
1421
+ // lib/nanoid.js
1422
+ var import_nanoid = require("nanoid");
1423
+ var generate = (0, import_nanoid.customAlphabet)("0123456789abcdefghijklmnopqrstuvwxyz", 8);
1424
+
1422
1425
  // index.js
1423
- var nanoid = (0, import_nanoid.customAlphabet)("0123456789abcdefghijklmnopqrstuvwxyz", 8);
1424
1426
  var infinite = 1e300;
1425
1427
  var megabyte = 1024 * 1024;
1426
1428
  var gigabyte = megabyte * 1024;
@@ -2570,8 +2572,8 @@ var drawbridge_default2 = {
2570
2572
  // owner is not a member document, so a solo merchant has nothing to
2571
2573
  // pick and could never save the step.
2572
2574
  members: { of: "string", type: "array" },
2573
- message: { required: true, type: "string" },
2574
- subject: { required: true, type: "string" }
2575
+ message: { max: 2e3, required: true, type: "string" },
2576
+ subject: { max: 150, required: true, type: "string" }
2575
2577
  },
2576
2578
  triggers: ["schedule.day", "schedule.week", "schedule.month"],
2577
2579
  usage: { actions: 0 }
@@ -2594,8 +2596,8 @@ var drawbridge_default2 = {
2594
2596
  queue: "notification",
2595
2597
  settings: {
2596
2598
  members: { of: "string", type: "array" },
2597
- message: { type: "string" },
2598
- subject: { type: "string" }
2599
+ message: { max: 2e3, type: "string" },
2600
+ subject: { max: 150, type: "string" }
2599
2601
  },
2600
2602
  triggers: ["lead.insert"],
2601
2603
  // Zero is a PRICE, and a deliberate one. Declared rather than omitted
@@ -2609,8 +2611,8 @@ var drawbridge_default2 = {
2609
2611
  key: "Email \u2014 Send email",
2610
2612
  queue: "notification",
2611
2613
  settings: {
2612
- message: { required: true, type: "string" },
2613
- subject: { required: true, type: "string" }
2614
+ message: { max: 2e3, required: true, type: "string" },
2615
+ subject: { max: 150, required: true, type: "string" }
2614
2616
  },
2615
2617
  triggers: ["lead.insert"],
2616
2618
  // ONE SOURCE FOR THE PRICE. lib/pricing.js is the index of every
@@ -2639,8 +2641,8 @@ var drawbridge_default2 = {
2639
2641
  key: "Send an SMS",
2640
2642
  queue: "notification",
2641
2643
  settings: {
2642
- message: { required: true, type: "string" },
2643
- subject: { required: true, type: "string" }
2644
+ message: { max: 1600, required: true, type: "string" },
2645
+ subject: { max: 150, required: true, type: "string" }
2644
2646
  },
2645
2647
  // Priced per SEGMENT and billed from the first, which the send
2646
2648
  // resolves from the message length. This is the floor.
@@ -3603,7 +3605,7 @@ var mailchimp_default2 = {
3603
3605
 
3604
3606
  // lib/connections/providers/shopify.js
3605
3607
  var import_node_crypto5 = require("crypto");
3606
- var import_nanoid2 = require("nanoid");
3608
+ var import_nanoid3 = require("nanoid");
3607
3609
 
3608
3610
  // lib/connections/icons/shopify.js
3609
3611
  var shopify_default = `<svg width="500" height="500" viewBox="0 0 500 500" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -3633,7 +3635,7 @@ var import_crypto2 = __toESM(require("crypto"), 1);
3633
3635
 
3634
3636
  // lib/token.js
3635
3637
  var import_crypto = __toESM(require("crypto"), 1);
3636
- var generate = (bytes = 32, encoding = "base64url") => {
3638
+ var generate2 = (bytes = 32, encoding = "base64url") => {
3637
3639
  const buf = import_crypto.default.randomBytes(bytes);
3638
3640
  return encoding ? buf.toString(encoding) : buf;
3639
3641
  };
@@ -3642,7 +3644,7 @@ var generate = (bytes = 32, encoding = "base64url") => {
3642
3644
  var ALGORITHM = "aes-256-gcm";
3643
3645
  var getKey = () => Buffer.from(process.env.ENCRYPT_CONNECTION_SECRET, "hex");
3644
3646
  var encrypt = (value) => {
3645
- const iv = generate(12, null);
3647
+ const iv = generate2(12, null);
3646
3648
  const cipher = import_crypto2.default.createCipheriv(ALGORITHM, getKey(), iv);
3647
3649
  const data2 = Buffer.concat([
3648
3650
  cipher.update(JSON.stringify(value), "utf8"),
@@ -3717,7 +3719,7 @@ var attributeLineItems = (lineItems = []) => lineItems.reduce(
3717
3719
  },
3718
3720
  { attrMap: {}, attributedGross: 0, attributedLines: [] }
3719
3721
  );
3720
- var generateDiscountCode = (0, import_nanoid2.customAlphabet)("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 8);
3722
+ var generateDiscountCode = (0, import_nanoid3.customAlphabet)("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 8);
3721
3723
  var ORDER_EVENT_HANDLE = slugify("drawbridge-orders");
3722
3724
  var REFRESH_TOKEN_FRESHNESS_BUFFER_MS = 5 * 24 * 60 * 60 * 1e3;
3723
3725
  var OAUTH_ERROR_SOURCE = "oauth";
@@ -15,9 +15,10 @@ import './plans.cjs';
15
15
  import './features.cjs';
16
16
  import './index.cjs';
17
17
  import 'currency-codes';
18
- import 'nanoid';
19
18
  import './color.cjs';
20
19
  import 'tinycolor2';
20
+ import './nanoid.cjs';
21
+ import 'nanoid';
21
22
  import './email.cjs';
22
23
  import './safe-http.cjs';
23
24
  import 'dns';
@@ -15,9 +15,10 @@ import './plans.js';
15
15
  import './features.js';
16
16
  import './index.js';
17
17
  import 'currency-codes';
18
- import 'nanoid';
19
18
  import './color.js';
20
19
  import 'tinycolor2';
20
+ import './nanoid.js';
21
+ import 'nanoid';
21
22
  import './email.js';
22
23
  import './safe-http.js';
23
24
  import 'dns';
package/dist/providers.js CHANGED
@@ -1310,7 +1310,6 @@ var organization = {
1310
1310
 
1311
1311
  // index.js
1312
1312
  import { code, data } from "currency-codes";
1313
- import { customAlphabet } from "nanoid";
1314
1313
 
1315
1314
  // lib/color.js
1316
1315
  import tinycolor from "tinycolor2";
@@ -1373,8 +1372,11 @@ var style = {
1373
1372
  }
1374
1373
  };
1375
1374
 
1375
+ // lib/nanoid.js
1376
+ import { customAlphabet } from "nanoid";
1377
+ var generate = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 8);
1378
+
1376
1379
  // index.js
1377
- var nanoid = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 8);
1378
1380
  var infinite = 1e300;
1379
1381
  var megabyte = 1024 * 1024;
1380
1382
  var gigabyte = megabyte * 1024;
@@ -2524,8 +2526,8 @@ var drawbridge_default2 = {
2524
2526
  // owner is not a member document, so a solo merchant has nothing to
2525
2527
  // pick and could never save the step.
2526
2528
  members: { of: "string", type: "array" },
2527
- message: { required: true, type: "string" },
2528
- subject: { required: true, type: "string" }
2529
+ message: { max: 2e3, required: true, type: "string" },
2530
+ subject: { max: 150, required: true, type: "string" }
2529
2531
  },
2530
2532
  triggers: ["schedule.day", "schedule.week", "schedule.month"],
2531
2533
  usage: { actions: 0 }
@@ -2548,8 +2550,8 @@ var drawbridge_default2 = {
2548
2550
  queue: "notification",
2549
2551
  settings: {
2550
2552
  members: { of: "string", type: "array" },
2551
- message: { type: "string" },
2552
- subject: { type: "string" }
2553
+ message: { max: 2e3, type: "string" },
2554
+ subject: { max: 150, type: "string" }
2553
2555
  },
2554
2556
  triggers: ["lead.insert"],
2555
2557
  // Zero is a PRICE, and a deliberate one. Declared rather than omitted
@@ -2563,8 +2565,8 @@ var drawbridge_default2 = {
2563
2565
  key: "Email \u2014 Send email",
2564
2566
  queue: "notification",
2565
2567
  settings: {
2566
- message: { required: true, type: "string" },
2567
- subject: { required: true, type: "string" }
2568
+ message: { max: 2e3, required: true, type: "string" },
2569
+ subject: { max: 150, required: true, type: "string" }
2568
2570
  },
2569
2571
  triggers: ["lead.insert"],
2570
2572
  // ONE SOURCE FOR THE PRICE. lib/pricing.js is the index of every
@@ -2593,8 +2595,8 @@ var drawbridge_default2 = {
2593
2595
  key: "Send an SMS",
2594
2596
  queue: "notification",
2595
2597
  settings: {
2596
- message: { required: true, type: "string" },
2597
- subject: { required: true, type: "string" }
2598
+ message: { max: 1600, required: true, type: "string" },
2599
+ subject: { max: 150, required: true, type: "string" }
2598
2600
  },
2599
2601
  // Priced per SEGMENT and billed from the first, which the send
2600
2602
  // resolves from the message length. This is the floor.
@@ -3587,7 +3589,7 @@ import crypto2 from "crypto";
3587
3589
 
3588
3590
  // lib/token.js
3589
3591
  import crypto from "crypto";
3590
- var generate = (bytes = 32, encoding = "base64url") => {
3592
+ var generate2 = (bytes = 32, encoding = "base64url") => {
3591
3593
  const buf = crypto.randomBytes(bytes);
3592
3594
  return encoding ? buf.toString(encoding) : buf;
3593
3595
  };
@@ -3596,7 +3598,7 @@ var generate = (bytes = 32, encoding = "base64url") => {
3596
3598
  var ALGORITHM = "aes-256-gcm";
3597
3599
  var getKey = () => Buffer.from(process.env.ENCRYPT_CONNECTION_SECRET, "hex");
3598
3600
  var encrypt = (value) => {
3599
- const iv = generate(12, null);
3601
+ const iv = generate2(12, null);
3600
3602
  const cipher = crypto2.createCipheriv(ALGORITHM, getKey(), iv);
3601
3603
  const data2 = Buffer.concat([
3602
3604
  cipher.update(JSON.stringify(value), "utf8"),
package/package.json CHANGED
@@ -88,6 +88,11 @@
88
88
  "import": "./dist/nanoid.js",
89
89
  "require": "./dist/nanoid.cjs"
90
90
  },
91
+ "./notification": {
92
+ "types": "./dist/notification.d.ts",
93
+ "import": "./dist/notification.js",
94
+ "require": "./dist/notification.cjs"
95
+ },
91
96
  "./oauth": {
92
97
  "types": "./dist/oauth/index.d.ts",
93
98
  "import": "./dist/oauth/index.js",
@@ -143,6 +148,11 @@
143
148
  "import": "./dist/twilio.js",
144
149
  "require": "./dist/twilio.cjs"
145
150
  },
151
+ "./html": {
152
+ "types": "./dist/html.d.ts",
153
+ "import": "./dist/html.js",
154
+ "require": "./dist/html.cjs"
155
+ },
146
156
  "./http": {
147
157
  "types": "./dist/http.d.ts",
148
158
  "import": "./dist/http.js",
@@ -216,5 +226,5 @@
216
226
  "prepublishOnly": ". \"$HOME/.nvm/nvm.sh\" && nvm use && tsup && node --test"
217
227
  },
218
228
  "types": "dist/index.d.ts",
219
- "version": "0.0.159"
229
+ "version": "0.0.161"
220
230
  }