@drawbridge/drawbridge-utils 0.0.3 → 0.0.5

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/index.js CHANGED
@@ -1,190 +1,185 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
1
+ // index.js
2
+ import { code, data } from "currency-codes";
3
+ import { customAlphabet } from "nanoid";
5
4
 
6
5
  // lib/constants.js
7
- var require_constants = __commonJS({
8
- "lib/constants.js"(exports2, module2) {
9
- var font = {
10
- family: "Roboto Flex",
11
- transform: "none",
12
- weight: "regular"
13
- };
14
- module2.exports = {
15
- action: {
16
- usage: {
17
- actions: 0
18
- }
19
- },
20
- brand: {
21
- style: {
22
- body: font,
23
- heading: font
24
- },
25
- totals: {
26
- campaigns: 0
27
- }
28
- },
29
- campaign: {
30
- agreements: {
31
- marketing: {
32
- enabled: false,
33
- label: "I agree to the marketing terms and conditions",
34
- link: null
35
- },
36
- terms: {
37
- enabled: false,
38
- label: "I agree to the terms and conditions",
39
- link: null
40
- }
41
- },
42
- defaults: {
43
- active: "Enter",
44
- confirmation: "Submission was successful",
45
- inactive: "Submissions are closed",
46
- email: "You were selected"
47
- },
48
- notifications: {
49
- draw: {
50
- subject: "You have been selected",
51
- body: "Thanks for being part of our giveaway"
52
- }
53
- },
54
- settings: {
55
- submissionLeadPrimaryKey: "email",
56
- submissionEntryMaximum: 1,
57
- submissionEntryFilter: "campaign",
58
- submissionEntryHighscore: false,
59
- submissionEntryLimit: 1
60
- },
61
- status: "drafted",
62
- totals: {
63
- advertisements: 0,
64
- affiliates: 0,
65
- draws: 0,
66
- exports: 0,
67
- entries: 0,
68
- fields: 2,
69
- integrations: 1,
70
- leads: 0,
71
- links: 0,
72
- pages: 0,
73
- prizes: 0,
74
- ranges: 0,
75
- submissions: 0
76
- },
77
- type: "giveaway"
6
+ var font = {
7
+ family: "Roboto Flex",
8
+ transform: "none",
9
+ weight: "regular"
10
+ };
11
+ var constants_default = {
12
+ action: {
13
+ usage: {
14
+ actions: 0
15
+ }
16
+ },
17
+ brand: {
18
+ style: {
19
+ body: font,
20
+ heading: font
21
+ },
22
+ totals: {
23
+ campaigns: 0
24
+ }
25
+ },
26
+ campaign: {
27
+ agreements: {
28
+ marketing: {
29
+ enabled: false,
30
+ label: "I agree to the marketing terms and conditions",
31
+ link: null
78
32
  },
33
+ terms: {
34
+ enabled: false,
35
+ label: "I agree to the terms and conditions",
36
+ link: null
37
+ }
38
+ },
39
+ defaults: {
40
+ active: "Enter",
41
+ confirmation: "Submission was successful",
42
+ inactive: "Submissions are closed",
43
+ email: "You were selected"
44
+ },
45
+ notifications: {
79
46
  draw: {
80
- status: "qualified",
81
- totals: {
82
- notifications: 0
83
- }
84
- },
85
- member: {
86
- status: "pending"
87
- },
88
- organization: {
89
- errors: [],
90
- totals: {
91
- affiliates: 0,
92
- brands: 0,
93
- campaigns: 0,
94
- leads: 0,
95
- draws: 0,
96
- entries: 0,
97
- invitations: 0,
98
- invoices: 0,
99
- members: 0,
100
- ranges: 0,
101
- pages: 0,
102
- prizes: 0,
103
- storage: 0,
104
- submissions: 0,
105
- subscriptions: 0,
106
- usage: 0
107
- }
108
- },
109
- page: {
110
- domains: [],
111
- status: "drafted",
112
- totals: {
113
- leads: 0,
114
- entries: 0,
115
- submissions: 0
116
- }
117
- },
118
- prize: {
119
- inventory: 0,
120
- remaining: 0,
121
- shipping: false,
122
- status: "drafted",
123
- totals: {
124
- draws: 0
125
- }
126
- },
127
- range: {
128
- totals: {
129
- leads: 0,
130
- entries: 0,
131
- submissions: 0
132
- }
133
- },
134
- referrer: {
135
- totals: {
136
- originizations: 0,
137
- subscriptions: 0,
138
- users: 0
139
- }
140
- },
141
- template: {
142
- page: {
143
- style: {
144
- body: font,
145
- heading: font
146
- }
147
- }
148
- },
149
- usage: {
150
- totals: {
151
- actions: 0,
152
- affiliates: 0,
153
- brands: 0,
154
- campaigns: 0,
155
- connections: 0,
156
- entries: 0,
157
- files: 0,
158
- members: 0,
159
- orders: 0,
160
- pages: 0,
161
- revenue: 0,
162
- storage: 0,
163
- submissions: 0,
164
- workflows: 0
165
- }
166
- },
167
- user: {
168
- access: {
169
- ai: false
170
- },
171
- image: null,
172
- totals: {
173
- inbox: 0,
174
- invitations: 0,
175
- messages: 0,
176
- methods: 0,
177
- organizations: 1,
178
- teams: 0
179
- }
47
+ subject: "You have been selected",
48
+ body: "Thanks for being part of our giveaway"
180
49
  }
181
- };
50
+ },
51
+ settings: {
52
+ submissionLeadPrimaryKey: "email",
53
+ submissionEntryMaximum: 1,
54
+ submissionEntryFilter: "campaign",
55
+ submissionEntryHighscore: false,
56
+ submissionEntryLimit: 1
57
+ },
58
+ status: "drafted",
59
+ totals: {
60
+ advertisements: 0,
61
+ affiliates: 0,
62
+ draws: 0,
63
+ exports: 0,
64
+ entries: 0,
65
+ fields: 2,
66
+ integrations: 1,
67
+ leads: 0,
68
+ links: 0,
69
+ pages: 0,
70
+ prizes: 0,
71
+ ranges: 0,
72
+ submissions: 0
73
+ },
74
+ type: "giveaway"
75
+ },
76
+ draw: {
77
+ status: "qualified",
78
+ totals: {
79
+ notifications: 0
80
+ }
81
+ },
82
+ member: {
83
+ status: "pending"
84
+ },
85
+ organization: {
86
+ errors: [],
87
+ totals: {
88
+ affiliates: 0,
89
+ brands: 0,
90
+ campaigns: 0,
91
+ leads: 0,
92
+ draws: 0,
93
+ entries: 0,
94
+ invitations: 0,
95
+ invoices: 0,
96
+ members: 0,
97
+ ranges: 0,
98
+ pages: 0,
99
+ prizes: 0,
100
+ storage: 0,
101
+ submissions: 0,
102
+ subscriptions: 0,
103
+ usage: 0
104
+ }
105
+ },
106
+ page: {
107
+ domains: [],
108
+ status: "drafted",
109
+ totals: {
110
+ leads: 0,
111
+ entries: 0,
112
+ submissions: 0
113
+ }
114
+ },
115
+ prize: {
116
+ inventory: 0,
117
+ remaining: 0,
118
+ shipping: false,
119
+ status: "drafted",
120
+ totals: {
121
+ draws: 0
122
+ }
123
+ },
124
+ range: {
125
+ totals: {
126
+ leads: 0,
127
+ entries: 0,
128
+ submissions: 0
129
+ }
130
+ },
131
+ referrer: {
132
+ totals: {
133
+ originizations: 0,
134
+ subscriptions: 0,
135
+ users: 0
136
+ }
137
+ },
138
+ template: {
139
+ page: {
140
+ style: {
141
+ body: font,
142
+ heading: font
143
+ }
144
+ }
145
+ },
146
+ usage: {
147
+ totals: {
148
+ actions: 0,
149
+ affiliates: 0,
150
+ brands: 0,
151
+ campaigns: 0,
152
+ connections: 0,
153
+ entries: 0,
154
+ files: 0,
155
+ members: 0,
156
+ orders: 0,
157
+ pages: 0,
158
+ revenue: 0,
159
+ storage: 0,
160
+ submissions: 0,
161
+ workflows: 0
162
+ }
163
+ },
164
+ user: {
165
+ access: {
166
+ ai: false
167
+ },
168
+ image: null,
169
+ totals: {
170
+ inbox: 0,
171
+ invitations: 0,
172
+ messages: 0,
173
+ methods: 0,
174
+ organizations: 1,
175
+ teams: 0
176
+ }
182
177
  }
183
- });
178
+ };
184
179
 
185
180
  // index.js
186
- var { code, data } = require("currency-codes");
187
- var constants = require_constants();
181
+ var nanoid = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 8);
182
+ var constants = constants_default;
188
183
  var infinite = 1e300;
189
184
  var isInfinite = (value) => value === infinite;
190
185
  var megabyte = 1024 * 1024;
@@ -347,7 +342,7 @@ var currencies = data.map((item) => ({
347
342
  value: item.code
348
343
  }));
349
344
  var currency = (val) => code(val);
350
- module.exports = {
345
+ export {
351
346
  bytesToGB,
352
347
  bytesToMB,
353
348
  capitalize,
@@ -363,6 +358,7 @@ module.exports = {
363
358
  infinite,
364
359
  isInfinite,
365
360
  megabyte,
361
+ nanoid,
366
362
  percentage,
367
363
  reducers,
368
364
  regex,
package/package.json CHANGED
@@ -1,27 +1,29 @@
1
1
  {
2
+ "type": "module",
2
3
  "dependencies": {
3
4
  "currency-codes": "2.2.0",
5
+ "nanoid": "3.3.8",
4
6
  "tsup": "8.5.1",
5
7
  "typescript": "5.9.3"
6
8
  },
7
9
  "exports": {
8
10
  ".": {
9
11
  "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
12
14
  },
13
15
  "./encrypt": {
14
16
  "types": "./dist/encrypt.d.ts",
15
- "import": "./dist/encrypt.mjs",
16
- "require": "./dist/encrypt.js"
17
+ "import": "./dist/encrypt.js",
18
+ "require": "./dist/encrypt.cjs"
17
19
  }
18
20
  },
19
21
  "files": [
20
22
  "dist"
21
23
  ],
22
24
  "license": "ISC",
23
- "main": "dist/index.js",
24
- "module": "dist/index.mjs",
25
+ "main": "dist/index.cjs",
26
+ "module": "dist/index.js",
25
27
  "name": "@drawbridge/drawbridge-utils",
26
28
  "publishConfig": {
27
29
  "access": "public"
@@ -30,5 +32,5 @@
30
32
  "build": "tsup && npm publish"
31
33
  },
32
34
  "types": "dist/index.d.ts",
33
- "version": "0.0.3"
35
+ "version": "0.0.5"
34
36
  }
@@ -1,15 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
- var __commonJS = (cb, mod) => function __require2() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
-
12
- export {
13
- __require,
14
- __commonJS
15
- };
package/dist/encrypt.mjs DELETED
@@ -1,43 +0,0 @@
1
- import {
2
- __commonJS,
3
- __require
4
- } from "./chunk-EBO3CZXG.mjs";
5
-
6
- // encrypt.js
7
- var require_encrypt = __commonJS({
8
- "encrypt.js"(exports, module) {
9
- var crypto = __require("crypto");
10
- var ALGORITHM = "aes-256-gcm";
11
- var getKey = () => Buffer.from(process.env.ENCRYPTION_KEY, "hex");
12
- var encrypt = (value) => {
13
- const iv = crypto.randomBytes(12);
14
- const cipher = crypto.createCipheriv(ALGORITHM, getKey(), iv);
15
- const data = Buffer.concat([
16
- cipher.update(JSON.stringify(value), "utf8"),
17
- cipher.final()
18
- ]);
19
- const tag = cipher.getAuthTag();
20
- return [iv, tag, data].map((b) => b.toString("hex")).join(":");
21
- };
22
- var decrypt = (value) => {
23
- if (typeof value !== "string") return value;
24
- const [ivHex, tagHex, dataHex] = value.split(":");
25
- const decipher = crypto.createDecipheriv(
26
- ALGORITHM,
27
- getKey(),
28
- Buffer.from(ivHex, "hex")
29
- );
30
- decipher.setAuthTag(Buffer.from(tagHex, "hex"));
31
- const result = Buffer.concat([
32
- decipher.update(Buffer.from(dataHex, "hex")),
33
- decipher.final()
34
- ]);
35
- return JSON.parse(result.toString("utf8"));
36
- };
37
- module.exports = {
38
- decrypt,
39
- encrypt
40
- };
41
- }
42
- });
43
- export default require_encrypt();