@splendidlabz/third-party 1.5.4 → 1.6.1
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/package.json +8 -3
- package/CHANGELOG.md +0 -253
- package/eslint.config.js +0 -2
- package/lib/buttondown.spec.js +0 -123
- package/lib/postmark.js +0 -32
- package/vitest.config.js +0 -23
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splendidlabz/third-party",
|
|
3
3
|
"prettier": "@splendidlabz/prettier-config",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
"./*": "./lib/*.js"
|
|
10
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"lib",
|
|
13
|
+
"!**/__tests__",
|
|
14
|
+
"!**/*.spec.js",
|
|
15
|
+
"!**/*.test.js"
|
|
16
|
+
],
|
|
11
17
|
"scripts": {
|
|
12
18
|
"lint": "eslint . --fix",
|
|
13
19
|
"test": "vitest",
|
|
@@ -15,12 +21,11 @@
|
|
|
15
21
|
},
|
|
16
22
|
"author": "Zell Liew <zellwk@gmail.com>",
|
|
17
23
|
"dependencies": {
|
|
18
|
-
"@splendidlabz/utils": "1.
|
|
24
|
+
"@splendidlabz/utils": "1.15.0",
|
|
19
25
|
"dotenv": "^17.4.2",
|
|
20
26
|
"googleapis": "^171.4.0",
|
|
21
27
|
"pino": "^10.3.1",
|
|
22
28
|
"pino-pretty": "^13.1.3",
|
|
23
|
-
"postmark": "^4.0.7",
|
|
24
29
|
"zl-fetch": "^6.3.1"
|
|
25
30
|
},
|
|
26
31
|
"devDependencies": {
|
package/CHANGELOG.md
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
# @splendidlabz/third-party
|
|
2
|
-
|
|
3
|
-
## 1.5.4
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [9401a41]
|
|
8
|
-
- Updated dependencies [ca23ef9]
|
|
9
|
-
- @splendidlabz/utils@1.13.0
|
|
10
|
-
|
|
11
|
-
## 1.5.3
|
|
12
|
-
|
|
13
|
-
### Patch Changes
|
|
14
|
-
|
|
15
|
-
- aece0fb: `http-errors` and `vitest` are no longer dependencies. `http-errors` belongs to `@splendidlabz/tracking`, and `vitest` is a test runner that was shipping to every consumer — it is now a devDependency. Neither is imported by shipped code, so this package works exactly as before and installs get smaller. If your own code imports either directly, declare it in your own `package.json`.
|
|
16
|
-
|
|
17
|
-
Add the missing `dotenv` dependency. `lib/buttondown.js` imports `dotenv/config`, but `dotenv` was never declared and was not installed at all, so importing `@splendidlabz/third-party/buttondown` failed outright.
|
|
18
|
-
|
|
19
|
-
Remove the dead `main` field. This package is subpath-only and exposes no root export, so `main` pointed at a file that does not exist and `exports` already took precedence.
|
|
20
|
-
|
|
21
|
-
## 1.5.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- Updated dependencies [34fc1c5]
|
|
26
|
-
- @splendidlabz/utils@1.12.1
|
|
27
|
-
|
|
28
|
-
## 1.5.1
|
|
29
|
-
|
|
30
|
-
### Patch Changes
|
|
31
|
-
|
|
32
|
-
- Updated dependencies [19f0f57]
|
|
33
|
-
- @splendidlabz/utils@1.12.0
|
|
34
|
-
|
|
35
|
-
## 1.5.0
|
|
36
|
-
|
|
37
|
-
### Minor Changes
|
|
38
|
-
|
|
39
|
-
- 3cc70d5: Add social media automation library — format and post content to Twitter, Threads, and Instagram from a single content object. Supports threads, dry-run mode, and cross-platform orchestration.
|
|
40
|
-
|
|
41
|
-
## 1.4.0
|
|
42
|
-
|
|
43
|
-
### Minor Changes
|
|
44
|
-
|
|
45
|
-
- Add social media automation library — format and post content to Twitter, Threads, and Instagram from a single content object. Supports threads, dry-run mode, and cross-platform orchestration.
|
|
46
|
-
|
|
47
|
-
## 1.3.18
|
|
48
|
-
|
|
49
|
-
### Patch Changes
|
|
50
|
-
|
|
51
|
-
- Updated dependencies [42cd5a2]
|
|
52
|
-
- @splendidlabz/utils@1.11.6
|
|
53
|
-
|
|
54
|
-
## 1.3.17
|
|
55
|
-
|
|
56
|
-
### Patch Changes
|
|
57
|
-
|
|
58
|
-
- c054af3: Bump production dependencies to latest compatible versions
|
|
59
|
-
- Updated dependencies [c054af3]
|
|
60
|
-
- @splendidlabz/utils@1.11.5
|
|
61
|
-
|
|
62
|
-
## 1.3.16
|
|
63
|
-
|
|
64
|
-
### Patch Changes
|
|
65
|
-
|
|
66
|
-
- Updated dependencies [ae250ef]
|
|
67
|
-
- @splendidlabz/utils@1.11.4
|
|
68
|
-
|
|
69
|
-
## 1.3.15
|
|
70
|
-
|
|
71
|
-
### Patch Changes
|
|
72
|
-
|
|
73
|
-
- Updated dependencies [7b9b628]
|
|
74
|
-
- @splendidlabz/utils@1.11.3
|
|
75
|
-
|
|
76
|
-
## 1.3.14
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- Updated dependencies
|
|
81
|
-
- @splendidlabz/utils@1.11.2
|
|
82
|
-
|
|
83
|
-
## 1.3.13
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- Updated dependencies
|
|
88
|
-
- @splendidlabz/utils@1.11.1
|
|
89
|
-
|
|
90
|
-
## 1.3.12
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- Updated dependencies
|
|
95
|
-
- @splendidlabz/utils@1.11.0
|
|
96
|
-
|
|
97
|
-
## 1.3.11
|
|
98
|
-
|
|
99
|
-
### Patch Changes
|
|
100
|
-
|
|
101
|
-
- Updated dependencies
|
|
102
|
-
- @splendidlabz/utils@1.10.7
|
|
103
|
-
|
|
104
|
-
## 1.3.10
|
|
105
|
-
|
|
106
|
-
### Patch Changes
|
|
107
|
-
|
|
108
|
-
- Prettify logger code
|
|
109
|
-
- Updated dependencies
|
|
110
|
-
- @splendidlabz/utils@1.10.6
|
|
111
|
-
|
|
112
|
-
## 1.3.11
|
|
113
|
-
|
|
114
|
-
### Patch Changes
|
|
115
|
-
|
|
116
|
-
- Updated dependencies
|
|
117
|
-
- @splendidlabz/utils@1.10.5
|
|
118
|
-
|
|
119
|
-
## 1.3.10
|
|
120
|
-
|
|
121
|
-
### Patch Changes
|
|
122
|
-
|
|
123
|
-
- Updated dependencies
|
|
124
|
-
- @splendidlabz/utils@1.10.4
|
|
125
|
-
|
|
126
|
-
## 1.3.9
|
|
127
|
-
|
|
128
|
-
### Patch Changes
|
|
129
|
-
|
|
130
|
-
- Updated dependencies
|
|
131
|
-
- @splendidlabz/utils@1.10.3
|
|
132
|
-
|
|
133
|
-
## 1.3.8
|
|
134
|
-
|
|
135
|
-
### Patch Changes
|
|
136
|
-
|
|
137
|
-
- Updated dependencies
|
|
138
|
-
- @splendidlabz/utils@1.10.2
|
|
139
|
-
|
|
140
|
-
## 1.3.7
|
|
141
|
-
|
|
142
|
-
### Patch Changes
|
|
143
|
-
|
|
144
|
-
- Updated dependencies
|
|
145
|
-
- @splendidlabz/utils@1.10.1
|
|
146
|
-
|
|
147
|
-
## 1.3.6
|
|
148
|
-
|
|
149
|
-
### Patch Changes
|
|
150
|
-
|
|
151
|
-
- 96c92cc: Some cleanup and typo fixes
|
|
152
|
-
- Updated dependencies [4efacb3]
|
|
153
|
-
- @splendidlabz/utils@1.10.0
|
|
154
|
-
|
|
155
|
-
## 1.3.5
|
|
156
|
-
|
|
157
|
-
### Patch Changes
|
|
158
|
-
|
|
159
|
-
- Updated dependencies
|
|
160
|
-
- @splendidlabz/utils@1.9.1
|
|
161
|
-
|
|
162
|
-
## 1.3.4
|
|
163
|
-
|
|
164
|
-
### Patch Changes
|
|
165
|
-
|
|
166
|
-
- Updated dependencies [8f2cb34]
|
|
167
|
-
- @splendidlabz/utils@1.9.0
|
|
168
|
-
|
|
169
|
-
## 1.3.3
|
|
170
|
-
|
|
171
|
-
### Patch Changes
|
|
172
|
-
|
|
173
|
-
- Updated dependencies
|
|
174
|
-
- @splendidlabz/utils@1.8.2
|
|
175
|
-
|
|
176
|
-
## 1.3.2
|
|
177
|
-
|
|
178
|
-
### Patch Changes
|
|
179
|
-
|
|
180
|
-
- Updated dependencies
|
|
181
|
-
- @splendidlabz/utils@1.8.1
|
|
182
|
-
|
|
183
|
-
## 1.3.0
|
|
184
|
-
|
|
185
|
-
### Minor Changes
|
|
186
|
-
|
|
187
|
-
- Many changes! Woo
|
|
188
|
-
|
|
189
|
-
### Patch Changes
|
|
190
|
-
|
|
191
|
-
- 5114274: Sendy: Include prettyName option
|
|
192
|
-
- Updated dependencies [2c149fc]
|
|
193
|
-
- Updated dependencies
|
|
194
|
-
- @splendidlabz/utils@1.7.0
|
|
195
|
-
|
|
196
|
-
## 1.2.0
|
|
197
|
-
|
|
198
|
-
### Minor Changes
|
|
199
|
-
|
|
200
|
-
- Many many upgrades which I didn't document properly 😅. The details are in Github history, but too many details to talk about now.
|
|
201
|
-
|
|
202
|
-
### Patch Changes
|
|
203
|
-
|
|
204
|
-
- Updated dependencies
|
|
205
|
-
- @splendidlabz/utils@1.6.0
|
|
206
|
-
|
|
207
|
-
## 1.1.1
|
|
208
|
-
|
|
209
|
-
### Patch Changes
|
|
210
|
-
|
|
211
|
-
- Updated dependencies
|
|
212
|
-
- @splendidlabz/utils@1.5.1
|
|
213
|
-
|
|
214
|
-
## 1.1.0
|
|
215
|
-
|
|
216
|
-
### Minor Changes
|
|
217
|
-
|
|
218
|
-
- 8b17adc: Ready for next release
|
|
219
|
-
|
|
220
|
-
### Patch Changes
|
|
221
|
-
|
|
222
|
-
- Updated dependencies [df4f2d6]
|
|
223
|
-
- Updated dependencies [859a2b0]
|
|
224
|
-
- Updated dependencies [acf9faf]
|
|
225
|
-
- Updated dependencies [8b17adc]
|
|
226
|
-
- Updated dependencies [5fe7c51]
|
|
227
|
-
- Updated dependencies
|
|
228
|
-
- Updated dependencies [bb06596]
|
|
229
|
-
- @splendidlabz/utils@1.5.0
|
|
230
|
-
|
|
231
|
-
## 1.1.0-beta.1
|
|
232
|
-
|
|
233
|
-
### Patch Changes
|
|
234
|
-
|
|
235
|
-
- Updated dependencies
|
|
236
|
-
- @splendidlabz/utils@1.5.0-beta.6
|
|
237
|
-
|
|
238
|
-
## 1.1.0-beta.0
|
|
239
|
-
|
|
240
|
-
### Minor Changes
|
|
241
|
-
|
|
242
|
-
- Ready for next release
|
|
243
|
-
|
|
244
|
-
### Patch Changes
|
|
245
|
-
|
|
246
|
-
- Updated dependencies
|
|
247
|
-
- @splendidlabz/utils@1.5.0-beta.5
|
|
248
|
-
|
|
249
|
-
## 1.0.0
|
|
250
|
-
|
|
251
|
-
### Major Changes
|
|
252
|
-
|
|
253
|
-
- Added a couple of improvements
|
package/eslint.config.js
DELETED
package/lib/buttondown.spec.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import 'dotenv/config'
|
|
2
|
-
import { test as base, describe, expect } from 'vitest'
|
|
3
|
-
import {
|
|
4
|
-
createSubscriber,
|
|
5
|
-
deleteSubscriber,
|
|
6
|
-
deleteTags,
|
|
7
|
-
getSubscriber,
|
|
8
|
-
removeTagsFromSubscriber,
|
|
9
|
-
updateSubscriber,
|
|
10
|
-
} from './buttondown.js'
|
|
11
|
-
|
|
12
|
-
// Test email that we'll use for all tests
|
|
13
|
-
if (!import.meta.env.BUTTONDOWN_KEY)
|
|
14
|
-
throw new Error('BUTTONDOWN_KEY environment variable is required')
|
|
15
|
-
|
|
16
|
-
const DEFAULT_DATA = {
|
|
17
|
-
tags: ['test', 'test2'],
|
|
18
|
-
metadata: { first_name: 'Name' },
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Create test with custom fixtures
|
|
22
|
-
const test = base.extend({
|
|
23
|
-
// eslint-disable-next-line no-empty-pattern
|
|
24
|
-
email: async ({}, use) => {
|
|
25
|
-
const email = `test-user-${Date.now()}@example.com`
|
|
26
|
-
await use(email)
|
|
27
|
-
// Cleanup after test
|
|
28
|
-
await deleteSubscriber(email)
|
|
29
|
-
await deleteTags([...DEFAULT_DATA.tags, 'test3'])
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
describe('Create Subscriber', () => {
|
|
34
|
-
test('Creates a new subscriber', async ({ email }) => {
|
|
35
|
-
const result = await createSubscriber(email, DEFAULT_DATA)
|
|
36
|
-
|
|
37
|
-
expect(result.email_address).toBe(email)
|
|
38
|
-
expect(result.metadata.first_name).toBe(DEFAULT_DATA.metadata.first_name)
|
|
39
|
-
expect(result.tags).toContain(DEFAULT_DATA.tags[0])
|
|
40
|
-
expect(result.tags).toContain(DEFAULT_DATA.tags[1])
|
|
41
|
-
expect(result.type).toBe('unactivated')
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
test('Bypasses double-opt-in', async ({ email }) => {
|
|
45
|
-
const result = await createSubscriber(email, DEFAULT_DATA, {
|
|
46
|
-
double_opt_in: true,
|
|
47
|
-
})
|
|
48
|
-
expect(result.type).toBe('regular')
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
describe('Get Subscriber', () => {
|
|
53
|
-
test('Gets a subscriber', async ({ email }) => {
|
|
54
|
-
await createSubscriber(email, DEFAULT_DATA)
|
|
55
|
-
const result = await getSubscriber(email)
|
|
56
|
-
expect(result.email_address).toBe(email)
|
|
57
|
-
expect(result.metadata.first_name).toBe(DEFAULT_DATA.metadata.first_name)
|
|
58
|
-
expect(result.tags).toContain(DEFAULT_DATA.tags[0])
|
|
59
|
-
expect(result.tags).toContain(DEFAULT_DATA.tags[1])
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test('Null if no subscriber', async () => {
|
|
63
|
-
const result = await getSubscriber('nonexistent@example.com')
|
|
64
|
-
expect(result).toBeNull()
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
describe('Update Subscriber', () => {
|
|
69
|
-
test('updates subscriber tags and metadata', async ({ email }) => {
|
|
70
|
-
await createSubscriber(email, DEFAULT_DATA)
|
|
71
|
-
|
|
72
|
-
const result = await updateSubscriber(email, {
|
|
73
|
-
tags: ['test3'],
|
|
74
|
-
metadata: { last_name: 'Last' },
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
expect(result.tags).toContain('test')
|
|
78
|
-
expect(result.tags).toContain('test2')
|
|
79
|
-
expect(result.tags).toContain('test3')
|
|
80
|
-
expect(result.metadata.last_name).toBe('Last')
|
|
81
|
-
expect(result.metadata.first_name).toBe(DEFAULT_DATA.metadata.first_name)
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
test('Overwrites tags', async ({ email }) => {
|
|
85
|
-
await createSubscriber(email, DEFAULT_DATA)
|
|
86
|
-
const result = await updateSubscriber(
|
|
87
|
-
email,
|
|
88
|
-
{ tags: ['test3'] },
|
|
89
|
-
{ overwrite: true },
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
expect(result.tags).toContain('test3')
|
|
93
|
-
expect(result.tags).not.toContain('test')
|
|
94
|
-
expect(result.tags).not.toContain('test2')
|
|
95
|
-
expect(result.metadata.first_name).toBe(DEFAULT_DATA.metadata.first_name)
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
test('Overwrites metadata', async ({ email }) => {
|
|
99
|
-
await createSubscriber(email, DEFAULT_DATA)
|
|
100
|
-
const result = await updateSubscriber(
|
|
101
|
-
email,
|
|
102
|
-
{ metadata: { last_name: 'Last' } },
|
|
103
|
-
{ overwrite: true },
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
expect(result.tags).toContain('test')
|
|
107
|
-
expect(result.tags).toContain('test2')
|
|
108
|
-
expect(result.metadata.first_name).not.toBe(
|
|
109
|
-
DEFAULT_DATA.metadata.first_name,
|
|
110
|
-
)
|
|
111
|
-
expect(result.metadata.last_name).toBe('Last')
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
describe('Remove Tags from Subscriber', () => {
|
|
116
|
-
test('Retains other tags', async ({ email }) => {
|
|
117
|
-
await createSubscriber(email, DEFAULT_DATA)
|
|
118
|
-
const result = await removeTagsFromSubscriber(email, ['test2'])
|
|
119
|
-
|
|
120
|
-
expect(result.tags).toContain('test')
|
|
121
|
-
expect(result.tags).not.toContain('test2')
|
|
122
|
-
})
|
|
123
|
-
})
|
package/lib/postmark.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import postmark from 'postmark'
|
|
2
|
-
|
|
3
|
-
const DEFAULT_OPTIONS = {
|
|
4
|
-
MessageStream: 'outbound', // outbound | broadcast
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default function Postmark(API_KEY, options) {
|
|
8
|
-
const POSTMARK_KEY = API_KEY || process.env.POSTMARK_KEY
|
|
9
|
-
const client = new postmark.ServerClient(POSTMARK_KEY)
|
|
10
|
-
const baseOpts = Object.assign({}, DEFAULT_OPTIONS, options)
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
constructEmailAddress(name, email) {
|
|
14
|
-
return `${name} <${email}>`
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
sendEmail(options) {
|
|
18
|
-
const opts = Object.assign({}, baseOpts, options)
|
|
19
|
-
const { from, to, replyTo, subject, html, text, ...rest } = opts
|
|
20
|
-
|
|
21
|
-
return client.sendEmail({
|
|
22
|
-
From: from,
|
|
23
|
-
To: to,
|
|
24
|
-
ReplyTo: replyTo,
|
|
25
|
-
Subject: subject,
|
|
26
|
-
HTMLBody: html,
|
|
27
|
-
TextBody: text,
|
|
28
|
-
...rest,
|
|
29
|
-
})
|
|
30
|
-
},
|
|
31
|
-
}
|
|
32
|
-
}
|
package/vitest.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
test: {
|
|
5
|
-
// Increase timeout for API tests
|
|
6
|
-
testTimeout: 10000,
|
|
7
|
-
|
|
8
|
-
// Better error output
|
|
9
|
-
onConsoleLog(log, type) {
|
|
10
|
-
console.log(`[${type}] ${log}`)
|
|
11
|
-
return false
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
// Show test progress
|
|
15
|
-
progress: true,
|
|
16
|
-
|
|
17
|
-
// Better diff output
|
|
18
|
-
diffLimit: 1000,
|
|
19
|
-
|
|
20
|
-
// Show test location in output
|
|
21
|
-
location: true,
|
|
22
|
-
},
|
|
23
|
-
})
|