@betternotify/zapier 0.0.3-alpha.0 → 1.0.0-beta.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/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @betternotify/zapier
2
+
3
+ Zapier channel and email transport for [Better-Notify](https://github.com/better-notify/better-notify). Provides `zapierChannel()` for sending structured events to Zapier webhooks, plus `zapierTransport()` as an email transport that forwards rendered emails to Zapier for downstream processing.
4
+
5
+ <p>
6
+ <a href="https://better-notify.com">Website</a> ·
7
+ <a href="https://better-notify.com/docs">Docs</a> ·
8
+ <a href="https://github.com/better-notify/better-notify">GitHub</a> ·
9
+ <a href="https://x.com/better_notify">X</a>
10
+ </p>
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ npm install @betternotify/zapier @betternotify/core
16
+ ```
17
+
18
+ ## Usage (channel)
19
+
20
+ ```ts
21
+ import { createNotify, createClient } from '@betternotify/core';
22
+ import { zapierChannel, mockZapierTransport } from '@betternotify/zapier';
23
+ import { z } from 'zod';
24
+
25
+ const zapier = zapierChannel();
26
+ const rpc = createNotify({ channels: { zapier } });
27
+
28
+ const catalog = rpc.catalog({
29
+ newSignup: rpc
30
+ .zapier()
31
+ .input(z.object({ email: z.string(), plan: z.string() }))
32
+ .event('user.signup')
33
+ .data(({ input }) => ({ email: input.email, plan: input.plan })),
34
+ });
35
+
36
+ const notify = createClient({
37
+ catalog,
38
+ channels: { zapier },
39
+ transportsByChannel: { zapier: mockZapierTransport() },
40
+ });
41
+
42
+ await notify.newSignup.send({
43
+ to: 'https://hooks.zapier.com/hooks/catch/...',
44
+ input: { email: 'user@example.com', plan: 'pro' },
45
+ });
46
+ ```
47
+
48
+ ## Builder slots
49
+
50
+ | Slot | Required | Type |
51
+ | ------- | -------- | ----------------------------------------------------------------- |
52
+ | `event` | yes | `string \| ({input}) => string` |
53
+ | `data` | no | `Record<string, unknown> \| ({input}) => Record<string, unknown>` |
54
+ | `meta` | no | `Record<string, unknown> \| ({input}) => Record<string, unknown>` |
55
+
56
+ Plus `.input(schema)` and `.use(mw)`.
57
+
58
+ ## Send args
59
+
60
+ ```ts
61
+ notify.newSignup.send({
62
+ to: string, // Zapier webhook URL
63
+ input: TInput,
64
+ });
65
+ ```
66
+
67
+ ## Usage (email transport)
68
+
69
+ `zapierTransport()` wraps a Zapier webhook as an email transport, forwarding rendered email payloads:
70
+
71
+ ```ts
72
+ import { emailChannel } from '@betternotify/email';
73
+ import { zapierTransport } from '@betternotify/zapier';
74
+
75
+ const mail = createClient({
76
+ catalog,
77
+ channels: { email },
78
+ transportsByChannel: {
79
+ email: zapierTransport({ webhookUrl: 'https://hooks.zapier.com/hooks/catch/...' }),
80
+ },
81
+ });
82
+ ```
83
+
84
+ ## Transports
85
+
86
+ ```ts
87
+ import { zapierChannelTransport, zapierTransport, mockZapierTransport } from '@betternotify/zapier';
88
+ ```
89
+
90
+ - `mockZapierTransport()` — records sent messages for tests.
91
+ - `zapierChannelTransport()` — posts channel events to Zapier webhook URLs.
92
+ - `zapierTransport({ webhookUrl })` — email transport that forwards to a Zapier webhook.
93
+
94
+ ## License
95
+
96
+ MIT
package/dist/index.js CHANGED
@@ -1795,7 +1795,6 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
1795
1795
  const neverProcessor = (_schema, _ctx, json, _params) => {
1796
1796
  json.not = {};
1797
1797
  };
1798
- const unknownProcessor = (_schema, _ctx, _json, _params) => {};
1799
1798
  const enumProcessor = (schema, _ctx, json, _params) => {
1800
1799
  const def = schema._zod.def;
1801
1800
  const values = getEnumValues(def.entries);
@@ -2065,7 +2064,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2065
2064
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2066
2065
  $ZodUnknown.init(inst, def);
2067
2066
  ZodType.init(inst, def);
2068
- inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
2067
+ inst._zod.processJSONSchema = (ctx, json, params) => void 0;
2069
2068
  });
2070
2069
  function unknown() {
2071
2070
  return /* @__PURE__ */ _unknown(ZodUnknown);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betternotify/zapier",
3
- "version": "0.0.3-alpha.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "Zapier channel and email transport for betternotify.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,16 +24,16 @@
24
24
  "dependencies": {
25
25
  "@standard-schema/spec": "1.1.0",
26
26
  "zod": "4.3.6",
27
- "@betternotify/core": "0.0.5-alpha.0",
28
- "@betternotify/email": "0.0.5-alpha.0"
27
+ "@betternotify/core": "1.0.0-beta.1",
28
+ "@betternotify/email": "1.0.0-beta.1"
29
29
  },
30
30
  "devDependencies": {
31
- "rolldown": "1.0.0-rc.17",
31
+ "rolldown": "1.0.0",
32
32
  "tsx": "4.21.0",
33
33
  "typescript": "6.0.3",
34
34
  "vitest": "2.1.9",
35
- "@internal/rolldown-config": "0.0.0",
36
- "@internal/tsconfig": "0.0.0"
35
+ "@internal/tsconfig": "0.0.0",
36
+ "@internal/rolldown-config": "0.0.0"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"