@particle-academy/twilio-ui 0.0.0 → 0.1.0
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/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +102 -2
- package/art/fancified.svg +26 -0
- package/dist/index.cjs +274 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +120 -0
- package/dist/index.d.ts +120 -0
- package/dist/index.js +258 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/twilio-ui`, `@particle-academy/twilio-js`,
|
|
4
|
+
`particle-academy/twilio-php` and `fancy-twilio`.
|
|
5
|
+
|
|
6
|
+
The four packages share one version, because they are generated from one
|
|
7
|
+
`provider/` definition and a version that meant something different in each
|
|
8
|
+
would be a version nobody could reason about.
|
|
9
|
+
|
|
10
|
+
## [0.1.0] — 2026-11-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **First release.** `message_send` (an SMS from a Twilio number or a
|
|
15
|
+
Messaging Service) and `message_get` (status, segments, price and Twilio's
|
|
16
|
+
error code, e.g. 21610 when the recipient replied STOP).
|
|
17
|
+
- **Authentication:** HTTP basic with an API key SID and secret (recommended)
|
|
18
|
+
or the Account SID and Auth Token. The Account SID is its own credential
|
|
19
|
+
because it is also part of every URL.
|
|
20
|
+
- **Fake mode** answers from the faker, so tests send nothing.
|
|
21
|
+
- **A Laravel Notification channel**: `via(): ['twilio']` sends with
|
|
22
|
+
`message_send`. The recipient is the notifiable's `routeNotificationForTwilio()`;
|
|
23
|
+
`toTwilio($notifiable)` returns the body as a string, or `message_send`'s
|
|
24
|
+
config as an array. `config('connectors.twilio.notifications')` (from
|
|
25
|
+
`TWILIO_FROM`, `TWILIO_MESSAGINGSERVICESID`, `TWILIO_STATUSCALLBACK`) fills
|
|
26
|
+
what the message leaves out, typically the sender; the message wins. No route
|
|
27
|
+
means nothing is sent. `Twilio::fake()` covers notifications:
|
|
28
|
+
`Twilio::assertSent('message_send', ...)`.
|
|
29
|
+
- Plus the Laravel layer every connector has: the service provider, the
|
|
30
|
+
`Twilio` facade, `Twilio::fake()` with `assertSent`, and its own Pest suite.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Particle Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,103 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Twilio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://particle.academy)
|
|
4
|
+
|
|
5
|
+
Twilio for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
6
|
+
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
7
|
+
change.
|
|
8
|
+
|
|
9
|
+
[flow]: https://github.com/Particle-Academy/fancy-flow
|
|
10
|
+
|
|
11
|
+
| Runtime | Package | Install |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Authoring surface (every host) | `@particle-academy/twilio-ui` | `npm install @particle-academy/twilio-ui` |
|
|
14
|
+
| Node | `@particle-academy/twilio-js` | `npm install @particle-academy/twilio-js` |
|
|
15
|
+
| PHP 8.4+ | `particle-academy/twilio-php` | `composer require particle-academy/twilio-php` |
|
|
16
|
+
| Python 3.11+ | `fancy-twilio` | `pip install fancy-twilio` |
|
|
17
|
+
|
|
18
|
+
The `ui` package is the editor surface and is React on every host — a PHP or
|
|
19
|
+
Python project installs it *and* its own runtime package, and never the `js` one.
|
|
20
|
+
|
|
21
|
+
## What it costs you
|
|
22
|
+
|
|
23
|
+
One dependency: `@particle-academy/fancy-connector-core` (or
|
|
24
|
+
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
|
|
25
|
+
packages pull in themselves. The Python package has **zero** runtime
|
|
26
|
+
dependencies.
|
|
27
|
+
|
|
28
|
+
**No Twilio SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
|
|
29
|
+
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
30
|
+
dependencies nobody is tracking.
|
|
31
|
+
|
|
32
|
+
## Setting it up
|
|
33
|
+
|
|
34
|
+
Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
|
|
35
|
+
|
|
36
|
+
### Credentials
|
|
37
|
+
|
|
38
|
+
A Twilio connection holds 3 values.
|
|
39
|
+
|
|
40
|
+
Every value here is `account` scope: one per connected account, not one per installation.
|
|
41
|
+
|
|
42
|
+
| Field | Scope | Secret | Where it comes from |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| **Account SID** | per connected account | not secret | AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL. |
|
|
45
|
+
| **API key SID (or Account SID)** | per connected account | not secret | An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token. |
|
|
46
|
+
| **API key secret (or Auth Token)** | per connected account | **secret** | The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own. |
|
|
47
|
+
|
|
48
|
+
### The estate
|
|
49
|
+
|
|
50
|
+
**Twilio decides live-or-test by the KEY, not by the endpoint.** The same host serves both, and a live key pointed at a node marked “sandbox” reaches the real estate and SUCCEEDS. Nothing in the request distinguishes them, which is why credentials sit on the connection rather than on each node.
|
|
51
|
+
|
|
52
|
+
> Twilio's test estate is selected by the CREDENTIALS, not the URL: a separate test Account SID and test Auth Token (Console -> API keys & tokens), against the same api.twilio.com. A live key on a node marked sandbox texts a real phone and is billed. With test credentials only message_send works -- every other resource, including message_get, answers 403 -- nothing is sent or charged, no status callback fires, and From must be Twilio's magic +15005550006 (+15005550004 as To returns 21610, the STOP case). Test credentials are the test Account SID and Auth Token, not an API key.
|
|
53
|
+
|
|
54
|
+
## What it can do
|
|
55
|
+
|
|
56
|
+
### Actions
|
|
57
|
+
|
|
58
|
+
#### `message_get` — Twilio message
|
|
59
|
+
|
|
60
|
+
Read a message's current status, segments, price and error code.
|
|
61
|
+
|
|
62
|
+
`GET /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json` · reads only — safe to replay
|
|
63
|
+
|
|
64
|
+
| Input | Required | What it is |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `sid` | yes | From message_send's data.sid. |
|
|
67
|
+
|
|
68
|
+
#### `message_send` — Send an SMS with Twilio
|
|
69
|
+
|
|
70
|
+
Send a text message.
|
|
71
|
+
|
|
72
|
+
`POST /2010-04-01/Accounts/{AccountSid}/Messages.json` · **unsafe to replay** — a retried durable run does it TWICE
|
|
73
|
+
|
|
74
|
+
| Input | Required | What it is |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `to` | yes | The recipient in E.164, e.g. +14155550100. |
|
|
77
|
+
| `from` | no | A Twilio number you own, in E.164, or an alphanumeric sender ID where the destination allows one. Give this or a Messaging Service. |
|
|
78
|
+
| `messagingServiceSid` | no | MG... A Messaging Service picks the sender from its pool. Give this or From. |
|
|
79
|
+
| `body` | yes | The text. Up to 1,600 characters. A character outside GSM-7 makes the whole message UCS-2, which halves how much fits in each billed segment. |
|
|
80
|
+
| `statusCallback` | no | Optional. Twilio POSTs delivery status changes here. Verifying those requests arrives in 0.2.0. |
|
|
81
|
+
|
|
82
|
+
## Run it before you have credentials
|
|
83
|
+
|
|
84
|
+
Every operation ships a **faker**, whether or not Twilio has a sandbox. Set a
|
|
85
|
+
node's mode to `fake` and it returns the shape Twilio actually publishes — the
|
|
86
|
+
same field names, deterministically — so you can wire the downstream nodes before
|
|
87
|
+
touching an account, a key, or a network.
|
|
88
|
+
|
|
89
|
+
## This repository is generated
|
|
90
|
+
|
|
91
|
+
`provider/` is the source. Everything under `packages/` is emitted from it and
|
|
92
|
+
**must not be hand-edited** — CI regenerates and diffs on every push, and the
|
|
93
|
+
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
|
|
94
|
+
|
|
95
|
+
## Two namespaces, which do not match on purpose
|
|
96
|
+
|
|
97
|
+
The repo is `github.com/Fancy-Friends/twilio`; the packages publish under
|
|
98
|
+
`particle-academy`. Nothing derives one from the other — the names come from
|
|
99
|
+
weaver's `friends.json` and nowhere else.
|
|
100
|
+
|
|
101
|
+
## Licence
|
|
102
|
+
|
|
103
|
+
MIT.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="28" role="img" aria-label="Fancified — built with Fancy UI">
|
|
2
|
+
<title>Fancified · built with Fancy UI</title>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="fcdBg" x1="0" y1="0" x2="1" y2="1">
|
|
5
|
+
<stop offset="0" stop-color="#6d28d9"/>
|
|
6
|
+
<stop offset=".5" stop-color="#9333ea"/>
|
|
7
|
+
<stop offset="1" stop-color="#d946ef"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="fcdGloss" x1="0" y1="0" x2="0" y2="1">
|
|
10
|
+
<stop offset="0" stop-color="#ffffff" stop-opacity=".30"/>
|
|
11
|
+
<stop offset=".55" stop-color="#ffffff" stop-opacity="0"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<clipPath id="fcdClip"><rect width="128" height="28" rx="7"/></clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
<g clip-path="url(#fcdClip)">
|
|
16
|
+
<rect width="128" height="28" fill="url(#fcdBg)"/>
|
|
17
|
+
<rect width="34" height="28" fill="#3b0764" fill-opacity=".5"/>
|
|
18
|
+
<rect width="128" height="13" fill="url(#fcdGloss)"/>
|
|
19
|
+
<g fill="#fff">
|
|
20
|
+
<path transform="translate(17 14)" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
21
|
+
<path transform="translate(25.5 7.5) scale(.34)" fill-opacity=".85" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
<text x="81" y="18.5" fill="#ffffff" text-anchor="middle" font-family="'Segoe UI',Verdana,'DejaVu Sans',sans-serif" font-size="12" font-weight="700" letter-spacing=".3">Fancified</text>
|
|
24
|
+
</g>
|
|
25
|
+
<rect x=".5" y=".5" width="127" height="27" rx="6.5" fill="none" stroke="#ffffff" stroke-opacity=".22"/>
|
|
26
|
+
</svg>
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var connectors = require('@particle-academy/fancy-flow/connectors');
|
|
4
|
+
|
|
5
|
+
// src/service.ts
|
|
6
|
+
var CONNECTOR_API_VERSION = 1;
|
|
7
|
+
var TWILIO_SERVICE = {
|
|
8
|
+
service: "twilio",
|
|
9
|
+
serviceTitle: "Twilio",
|
|
10
|
+
domain: "messaging",
|
|
11
|
+
sandbox: "credential"
|
|
12
|
+
};
|
|
13
|
+
var TWILIO_CREDENTIALS = [
|
|
14
|
+
{
|
|
15
|
+
"key": "accountSid",
|
|
16
|
+
"label": "Account SID",
|
|
17
|
+
"scope": "account",
|
|
18
|
+
"secret": false,
|
|
19
|
+
"help": "AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"key": "username",
|
|
23
|
+
"label": "API key SID (or Account SID)",
|
|
24
|
+
"scope": "account",
|
|
25
|
+
"secret": false,
|
|
26
|
+
"help": "An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"key": "password",
|
|
30
|
+
"label": "API key secret (or Auth Token)",
|
|
31
|
+
"scope": "account",
|
|
32
|
+
"secret": true,
|
|
33
|
+
"help": "The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own."
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
function twilioMeta(role, operation, docs) {
|
|
37
|
+
return { ...TWILIO_SERVICE, role, operation, docs };
|
|
38
|
+
}
|
|
39
|
+
var TWILIO_MESSAGE_GET_KIND = "@particle-academy/twilio_message_get";
|
|
40
|
+
var TWILIO_MESSAGE_GET_OPERATION = "message_get";
|
|
41
|
+
var TWILIO_MESSAGE_GET_META = twilioMeta("action", "read a message", "https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource");
|
|
42
|
+
var TWILIO_MESSAGE_GET_OUTPUT = [
|
|
43
|
+
{
|
|
44
|
+
"path": "data.sid",
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "The message SID (SM... or MM...)."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "data.status",
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "data.to",
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "The recipient, E.164."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"path": "data.from",
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "The sender. Null while a Messaging Service is still choosing one."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"path": "data.body",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The text."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "data.num_segments",
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "data.messaging_service_sid",
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The Messaging Service used, if any."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"path": "data.error_code",
|
|
80
|
+
"type": "number",
|
|
81
|
+
"description": "Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "data.error_message",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "Twilio's description of the error. Null otherwise."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"path": "data.date_created",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "RFC 2822 date."
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "data.price",
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "The price, negative, once known. Null until then."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "data.price_unit",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "ISO 4217 currency of `price`."
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"path": "mode",
|
|
105
|
+
"type": "string",
|
|
106
|
+
"description": "Which estate this ran against: fake or live."
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
var twilioMessageGetKind = connectors.defineConnectorKind(TWILIO_MESSAGE_GET_META, {
|
|
110
|
+
name: TWILIO_MESSAGE_GET_KIND,
|
|
111
|
+
aliases: ["twilio_message_get"],
|
|
112
|
+
label: "Twilio message",
|
|
113
|
+
description: "Read a message's current status, segments, price and error code.",
|
|
114
|
+
inputs: [{ id: "in" }],
|
|
115
|
+
outputs: [{ id: "out" }],
|
|
116
|
+
sideEffects: "none",
|
|
117
|
+
outputShape: TWILIO_MESSAGE_GET_OUTPUT,
|
|
118
|
+
configSchema: [
|
|
119
|
+
{
|
|
120
|
+
"type": "text",
|
|
121
|
+
"key": "sid",
|
|
122
|
+
"label": "Message SID",
|
|
123
|
+
"required": true,
|
|
124
|
+
"description": "From message_send's data.sid."
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
defaultConfig: {
|
|
128
|
+
"mode": "auto"
|
|
129
|
+
},
|
|
130
|
+
renderBody: ({ config }) => connectors.summarize(TWILIO_MESSAGE_GET_META, config, "read a message")
|
|
131
|
+
});
|
|
132
|
+
var TWILIO_MESSAGE_SEND_KIND = "@particle-academy/twilio_message_send";
|
|
133
|
+
var TWILIO_MESSAGE_SEND_OPERATION = "message_send";
|
|
134
|
+
var TWILIO_MESSAGE_SEND_META = twilioMeta("action", "send an SMS", "https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource");
|
|
135
|
+
var TWILIO_MESSAGE_SEND_OUTPUT = [
|
|
136
|
+
{
|
|
137
|
+
"path": "data.sid",
|
|
138
|
+
"type": "string",
|
|
139
|
+
"description": "The message SID (SM... or MM...)."
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"path": "data.status",
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"path": "data.to",
|
|
148
|
+
"type": "string",
|
|
149
|
+
"description": "The recipient, E.164."
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"path": "data.from",
|
|
153
|
+
"type": "string",
|
|
154
|
+
"description": "The sender. Null while a Messaging Service is still choosing one."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"path": "data.body",
|
|
158
|
+
"type": "string",
|
|
159
|
+
"description": "The text."
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"path": "data.num_segments",
|
|
163
|
+
"type": "string",
|
|
164
|
+
"description": "How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"path": "data.messaging_service_sid",
|
|
168
|
+
"type": "string",
|
|
169
|
+
"description": "The Messaging Service used, if any."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"path": "data.error_code",
|
|
173
|
+
"type": "number",
|
|
174
|
+
"description": "Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise."
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"path": "data.error_message",
|
|
178
|
+
"type": "string",
|
|
179
|
+
"description": "Twilio's description of the error. Null otherwise."
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"path": "data.date_created",
|
|
183
|
+
"type": "string",
|
|
184
|
+
"description": "RFC 2822 date."
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"path": "data.price",
|
|
188
|
+
"type": "string",
|
|
189
|
+
"description": "The price, negative, once known. Null until then."
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"path": "data.price_unit",
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "ISO 4217 currency of `price`."
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"path": "mode",
|
|
198
|
+
"type": "string",
|
|
199
|
+
"description": "Which estate this ran against: fake or live."
|
|
200
|
+
}
|
|
201
|
+
];
|
|
202
|
+
var twilioMessageSendKind = connectors.defineConnectorKind(TWILIO_MESSAGE_SEND_META, {
|
|
203
|
+
name: TWILIO_MESSAGE_SEND_KIND,
|
|
204
|
+
aliases: ["twilio_message_send"],
|
|
205
|
+
label: "Send an SMS with Twilio",
|
|
206
|
+
description: "Send a text message.",
|
|
207
|
+
inputs: [{ id: "in" }],
|
|
208
|
+
outputs: [{ id: "out" }],
|
|
209
|
+
sideEffects: "unsafe-to-replay",
|
|
210
|
+
outputShape: TWILIO_MESSAGE_SEND_OUTPUT,
|
|
211
|
+
configSchema: [
|
|
212
|
+
{
|
|
213
|
+
"type": "expression",
|
|
214
|
+
"key": "to",
|
|
215
|
+
"label": "To",
|
|
216
|
+
"required": true,
|
|
217
|
+
"example": "{{ $json.phone }}",
|
|
218
|
+
"description": "The recipient in E.164, e.g. +14155550100."
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"type": "text",
|
|
222
|
+
"key": "from",
|
|
223
|
+
"label": "From",
|
|
224
|
+
"description": "A Twilio number you own, in E.164, or an alphanumeric sender ID where the destination allows one. Give this or a Messaging Service."
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"type": "text",
|
|
228
|
+
"key": "messagingServiceSid",
|
|
229
|
+
"label": "Messaging Service SID",
|
|
230
|
+
"description": "MG... A Messaging Service picks the sender from its pool. Give this or From."
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"type": "textarea",
|
|
234
|
+
"key": "body",
|
|
235
|
+
"label": "Body",
|
|
236
|
+
"required": true,
|
|
237
|
+
"description": "The text. Up to 1,600 characters. A character outside GSM-7 makes the whole message UCS-2, which halves how much fits in each billed segment."
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"type": "text",
|
|
241
|
+
"key": "statusCallback",
|
|
242
|
+
"label": "Status callback URL",
|
|
243
|
+
"description": "Optional. Twilio POSTs delivery status changes here. Verifying those requests arrives in 0.2.0."
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
defaultConfig: {
|
|
247
|
+
"mode": "auto"
|
|
248
|
+
},
|
|
249
|
+
renderBody: ({ config }) => connectors.summarize(TWILIO_MESSAGE_SEND_META, config, "send an SMS")
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// src/index.ts
|
|
253
|
+
var TWILIO_KINDS = [
|
|
254
|
+
twilioMessageGetKind,
|
|
255
|
+
twilioMessageSendKind
|
|
256
|
+
];
|
|
257
|
+
|
|
258
|
+
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
259
|
+
exports.TWILIO_CREDENTIALS = TWILIO_CREDENTIALS;
|
|
260
|
+
exports.TWILIO_KINDS = TWILIO_KINDS;
|
|
261
|
+
exports.TWILIO_MESSAGE_GET_KIND = TWILIO_MESSAGE_GET_KIND;
|
|
262
|
+
exports.TWILIO_MESSAGE_GET_META = TWILIO_MESSAGE_GET_META;
|
|
263
|
+
exports.TWILIO_MESSAGE_GET_OPERATION = TWILIO_MESSAGE_GET_OPERATION;
|
|
264
|
+
exports.TWILIO_MESSAGE_GET_OUTPUT = TWILIO_MESSAGE_GET_OUTPUT;
|
|
265
|
+
exports.TWILIO_MESSAGE_SEND_KIND = TWILIO_MESSAGE_SEND_KIND;
|
|
266
|
+
exports.TWILIO_MESSAGE_SEND_META = TWILIO_MESSAGE_SEND_META;
|
|
267
|
+
exports.TWILIO_MESSAGE_SEND_OPERATION = TWILIO_MESSAGE_SEND_OPERATION;
|
|
268
|
+
exports.TWILIO_MESSAGE_SEND_OUTPUT = TWILIO_MESSAGE_SEND_OUTPUT;
|
|
269
|
+
exports.TWILIO_SERVICE = TWILIO_SERVICE;
|
|
270
|
+
exports.twilioMessageGetKind = twilioMessageGetKind;
|
|
271
|
+
exports.twilioMessageSendKind = twilioMessageSendKind;
|
|
272
|
+
exports.twilioMeta = twilioMeta;
|
|
273
|
+
//# sourceMappingURL=index.cjs.map
|
|
274
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/message-get.ts","../src/kinds/message-send.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAsCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,cAAA,GAAiB;AAAA,EAC5B,OAAA,EAAS,QAAA;AAAA,EACT,YAAA,EAAc,QAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,kBAAA,GAAqB;AAAA,EAChC;AAAA,IACE,KAAA,EAAO,YAAA;AAAA,IACP,OAAA,EAAS,aAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,8BAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,gCAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ;AAGO,SAAS,UAAA,CACd,IAAA,EACA,SAAA,EACA,IAAA,EACe;AACf,EAAA,OAAO,EAAE,GAAG,cAAA,EAAgB,IAAA,EAAM,WAAW,IAAA,EAAK;AACpD;ACtFO,IAAM,uBAAA,GAA0B;AACh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GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAAA,CAAU,wBAAA,EAA0B,QAAmC,aAAa;AACxF,CAAC;;;AC7HM,IAAM,YAAA,GAAqC;AAAA,EAChD,oBAAA;AAAA,EACA;AACF","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Twilio's identity on the authoring surface, shared by every Twilio node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * Twilio's test estate is selected by the CREDENTIALS, not the URL: a separate\n * test Account SID and test Auth Token (Console -> API keys & tokens), against\n * the same api.twilio.com. A live key on a node marked sandbox texts a real\n * phone and is billed. With test credentials only message_send works -- every\n * other resource, including message_get, answers 403 -- nothing is sent or\n * charged, no status callback fires, and From must be Twilio's magic\n * +15005550006 (+15005550004 as To returns 21610, the STOP case). Test\n * credentials are the test Account SID and Auth Token, not an API key.\n */\n\nimport type { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported — an imported constant lets an upgrade rewrite the\n * very claim it exists to detect.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const TWILIO_SERVICE = {\n service: \"twilio\",\n serviceTitle: \"Twilio\",\n domain: \"messaging\",\n sandbox: \"credential\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Twilio connection holds. */\nexport const TWILIO_CREDENTIALS = [\n {\n \"key\": \"accountSid\",\n \"label\": \"Account SID\",\n \"scope\": \"account\",\n \"secret\": false,\n \"help\": \"AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL.\"\n },\n {\n \"key\": \"username\",\n \"label\": \"API key SID (or Account SID)\",\n \"scope\": \"account\",\n \"secret\": false,\n \"help\": \"An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token.\"\n },\n {\n \"key\": \"password\",\n \"label\": \"API key secret (or Auth Token)\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own.\"\n }\n] as const;\n\n/** Build a Twilio node's connector metadata from the operation it performs. */\nexport function twilioMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...TWILIO_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/message-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/message-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Twilio message — Read a message's current status, segments, price and error\n * code.\n *\n * https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { twilioMeta } from \"../service.js\";\n\nexport const TWILIO_MESSAGE_GET_KIND = \"@particle-academy/twilio_message_get\";\nexport const TWILIO_MESSAGE_GET_OPERATION = \"message_get\";\n\nexport const TWILIO_MESSAGE_GET_META = twilioMeta(\"action\", \"read a message\", \"https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const TWILIO_MESSAGE_GET_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.sid\",\n \"type\": \"string\",\n \"description\": \"The message SID (SM... or MM...).\"\n },\n {\n \"path\": \"data.status\",\n \"type\": \"string\",\n \"description\": \"queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later.\"\n },\n {\n \"path\": \"data.to\",\n \"type\": \"string\",\n \"description\": \"The recipient, E.164.\"\n },\n {\n \"path\": \"data.from\",\n \"type\": \"string\",\n \"description\": \"The sender. Null while a Messaging Service is still choosing one.\"\n },\n {\n \"path\": \"data.body\",\n \"type\": \"string\",\n \"description\": \"The text.\"\n },\n {\n \"path\": \"data.num_segments\",\n \"type\": \"string\",\n \"description\": \"How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema.\"\n },\n {\n \"path\": \"data.messaging_service_sid\",\n \"type\": \"string\",\n \"description\": \"The Messaging Service used, if any.\"\n },\n {\n \"path\": \"data.error_code\",\n \"type\": \"number\",\n \"description\": \"Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise.\"\n },\n {\n \"path\": \"data.error_message\",\n \"type\": \"string\",\n \"description\": \"Twilio's description of the error. Null otherwise.\"\n },\n {\n \"path\": \"data.date_created\",\n \"type\": \"string\",\n \"description\": \"RFC 2822 date.\"\n },\n {\n \"path\": \"data.price\",\n \"type\": \"string\",\n \"description\": \"The price, negative, once known. Null until then.\"\n },\n {\n \"path\": \"data.price_unit\",\n \"type\": \"string\",\n \"description\": \"ISO 4217 currency of `price`.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against: fake or live.\"\n }\n];\n\nexport const twilioMessageGetKind: NodeKindDefinition = defineConnectorKind(TWILIO_MESSAGE_GET_META, {\n name: TWILIO_MESSAGE_GET_KIND,\n aliases: [\"twilio_message_get\"],\n label: \"Twilio message\",\n description: \"Read a message's current status, segments, price and error code.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"none\",\n outputShape: TWILIO_MESSAGE_GET_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"sid\",\n \"label\": \"Message SID\",\n \"required\": true,\n \"description\": \"From message_send's data.sid.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(TWILIO_MESSAGE_GET_META, config as Record<string, unknown>, \"read a message\"),\n});\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/message-send.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/message-send.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Send an SMS with Twilio — Send a text message.\n *\n * https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { twilioMeta } from \"../service.js\";\n\nexport const TWILIO_MESSAGE_SEND_KIND = \"@particle-academy/twilio_message_send\";\nexport const TWILIO_MESSAGE_SEND_OPERATION = \"message_send\";\n\nexport const TWILIO_MESSAGE_SEND_META = twilioMeta(\"action\", \"send an SMS\", \"https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const TWILIO_MESSAGE_SEND_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.sid\",\n \"type\": \"string\",\n \"description\": \"The message SID (SM... or MM...).\"\n },\n {\n \"path\": \"data.status\",\n \"type\": \"string\",\n \"description\": \"queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later.\"\n },\n {\n \"path\": \"data.to\",\n \"type\": \"string\",\n \"description\": \"The recipient, E.164.\"\n },\n {\n \"path\": \"data.from\",\n \"type\": \"string\",\n \"description\": \"The sender. Null while a Messaging Service is still choosing one.\"\n },\n {\n \"path\": \"data.body\",\n \"type\": \"string\",\n \"description\": \"The text.\"\n },\n {\n \"path\": \"data.num_segments\",\n \"type\": \"string\",\n \"description\": \"How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema.\"\n },\n {\n \"path\": \"data.messaging_service_sid\",\n \"type\": \"string\",\n \"description\": \"The Messaging Service used, if any.\"\n },\n {\n \"path\": \"data.error_code\",\n \"type\": \"number\",\n \"description\": \"Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise.\"\n },\n {\n \"path\": \"data.error_message\",\n \"type\": \"string\",\n \"description\": \"Twilio's description of the error. Null otherwise.\"\n },\n {\n \"path\": \"data.date_created\",\n \"type\": \"string\",\n \"description\": \"RFC 2822 date.\"\n },\n {\n \"path\": \"data.price\",\n \"type\": \"string\",\n \"description\": \"The price, negative, once known. Null until then.\"\n },\n {\n \"path\": \"data.price_unit\",\n \"type\": \"string\",\n \"description\": \"ISO 4217 currency of `price`.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against: fake or live.\"\n }\n];\n\nexport const twilioMessageSendKind: NodeKindDefinition = defineConnectorKind(TWILIO_MESSAGE_SEND_META, {\n name: TWILIO_MESSAGE_SEND_KIND,\n aliases: [\"twilio_message_send\"],\n label: \"Send an SMS with Twilio\",\n description: \"Send a text message.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: TWILIO_MESSAGE_SEND_OUTPUT,\n configSchema: [\n {\n \"type\": \"expression\",\n \"key\": \"to\",\n \"label\": \"To\",\n \"required\": true,\n \"example\": \"{{ $json.phone }}\",\n \"description\": \"The recipient in E.164, e.g. +14155550100.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"from\",\n \"label\": \"From\",\n \"description\": \"A Twilio number you own, in E.164, or an alphanumeric sender ID where the destination allows one. Give this or a Messaging Service.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"messagingServiceSid\",\n \"label\": \"Messaging Service SID\",\n \"description\": \"MG... A Messaging Service picks the sender from its pool. Give this or From.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"body\",\n \"label\": \"Body\",\n \"required\": true,\n \"description\": \"The text. Up to 1,600 characters. A character outside GSM-7 makes the whole message UCS-2, which halves how much fits in each billed segment.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"statusCallback\",\n \"label\": \"Status callback URL\",\n \"description\": \"Optional. Twilio POSTs delivery status changes here. Verifying those requests arrives in 0.2.0.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(TWILIO_MESSAGE_SEND_META, config as Record<string, unknown>, \"send an SMS\"),\n});\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Twilio's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/message-get.js\";\nexport * from \"./kinds/message-send.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { twilioMessageGetKind } from \"./kinds/message-get.js\";\nimport { twilioMessageSendKind } from \"./kinds/message-send.js\";\n\n/** Every Twilio kind, for a host that registers the lot. */\nexport const TWILIO_KINDS: NodeKindDefinition[] = [\n twilioMessageGetKind,\n twilioMessageSendKind,\n];\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
|
|
3
|
+
import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GENERATED FILE — do not edit.
|
|
7
|
+
*
|
|
8
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
9
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
10
|
+
* being rejected, because it works until it silently does not. Fix
|
|
11
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
12
|
+
*
|
|
13
|
+
* npm run provider -- twilio
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Twilio's identity on the authoring surface, shared by every Twilio node.
|
|
17
|
+
*
|
|
18
|
+
* This file must import nothing from the js package: a PHP or Python project
|
|
19
|
+
* installs the ui package and never that one, and the import would be a
|
|
20
|
+
* dangling module the moment it did.
|
|
21
|
+
*
|
|
22
|
+
* ## The sandbox trap
|
|
23
|
+
*
|
|
24
|
+
* Twilio's test estate is selected by the CREDENTIALS, not the URL: a separate
|
|
25
|
+
* test Account SID and test Auth Token (Console -> API keys & tokens), against
|
|
26
|
+
* the same api.twilio.com. A live key on a node marked sandbox texts a real
|
|
27
|
+
* phone and is billed. With test credentials only message_send works -- every
|
|
28
|
+
* other resource, including message_get, answers 403 -- nothing is sent or
|
|
29
|
+
* charged, no status callback fires, and From must be Twilio's magic
|
|
30
|
+
* +15005550006 (+15005550004 as To returns 21610, the STOP case). Test
|
|
31
|
+
* credentials are the test Account SID and Auth Token, not an API key.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The connector API version this package was GENERATED against.
|
|
36
|
+
*
|
|
37
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
38
|
+
* very claim it exists to detect.
|
|
39
|
+
*/
|
|
40
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
41
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
42
|
+
declare const TWILIO_SERVICE: {
|
|
43
|
+
readonly service: "twilio";
|
|
44
|
+
readonly serviceTitle: "Twilio";
|
|
45
|
+
readonly domain: "messaging";
|
|
46
|
+
readonly sandbox: "credential";
|
|
47
|
+
};
|
|
48
|
+
/** The credentials a Twilio connection holds. */
|
|
49
|
+
declare const TWILIO_CREDENTIALS: readonly [{
|
|
50
|
+
readonly key: "accountSid";
|
|
51
|
+
readonly label: "Account SID";
|
|
52
|
+
readonly scope: "account";
|
|
53
|
+
readonly secret: false;
|
|
54
|
+
readonly help: "AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL.";
|
|
55
|
+
}, {
|
|
56
|
+
readonly key: "username";
|
|
57
|
+
readonly label: "API key SID (or Account SID)";
|
|
58
|
+
readonly scope: "account";
|
|
59
|
+
readonly secret: false;
|
|
60
|
+
readonly help: "An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token.";
|
|
61
|
+
}, {
|
|
62
|
+
readonly key: "password";
|
|
63
|
+
readonly label: "API key secret (or Auth Token)";
|
|
64
|
+
readonly scope: "account";
|
|
65
|
+
readonly secret: true;
|
|
66
|
+
readonly help: "The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own.";
|
|
67
|
+
}];
|
|
68
|
+
/** Build a Twilio node's connector metadata from the operation it performs. */
|
|
69
|
+
declare function twilioMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
70
|
+
|
|
71
|
+
declare const TWILIO_MESSAGE_GET_KIND = "@particle-academy/twilio_message_get";
|
|
72
|
+
declare const TWILIO_MESSAGE_GET_OPERATION = "message_get";
|
|
73
|
+
declare const TWILIO_MESSAGE_GET_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
74
|
+
/**
|
|
75
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
76
|
+
*
|
|
77
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
78
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
79
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
80
|
+
* and hoping.
|
|
81
|
+
*/
|
|
82
|
+
declare const TWILIO_MESSAGE_GET_OUTPUT: OutputField[];
|
|
83
|
+
declare const twilioMessageGetKind: NodeKindDefinition;
|
|
84
|
+
|
|
85
|
+
declare const TWILIO_MESSAGE_SEND_KIND = "@particle-academy/twilio_message_send";
|
|
86
|
+
declare const TWILIO_MESSAGE_SEND_OPERATION = "message_send";
|
|
87
|
+
declare const TWILIO_MESSAGE_SEND_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
88
|
+
/**
|
|
89
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
90
|
+
*
|
|
91
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
92
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
93
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
94
|
+
* and hoping.
|
|
95
|
+
*/
|
|
96
|
+
declare const TWILIO_MESSAGE_SEND_OUTPUT: OutputField[];
|
|
97
|
+
declare const twilioMessageSendKind: NodeKindDefinition;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* GENERATED FILE — do not edit.
|
|
101
|
+
*
|
|
102
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
103
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
104
|
+
* being rejected, because it works until it silently does not. Fix
|
|
105
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
106
|
+
*
|
|
107
|
+
* npm run provider -- twilio
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* Twilio's node kinds for fancy-flow.
|
|
111
|
+
*
|
|
112
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
113
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
114
|
+
* this.
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
/** Every Twilio kind, for a host that registers the lot. */
|
|
118
|
+
declare const TWILIO_KINDS: NodeKindDefinition[];
|
|
119
|
+
|
|
120
|
+
export { CONNECTOR_API_VERSION, TWILIO_CREDENTIALS, TWILIO_KINDS, TWILIO_MESSAGE_GET_KIND, TWILIO_MESSAGE_GET_META, TWILIO_MESSAGE_GET_OPERATION, TWILIO_MESSAGE_GET_OUTPUT, TWILIO_MESSAGE_SEND_KIND, TWILIO_MESSAGE_SEND_META, TWILIO_MESSAGE_SEND_OPERATION, TWILIO_MESSAGE_SEND_OUTPUT, TWILIO_SERVICE, twilioMessageGetKind, twilioMessageSendKind, twilioMeta };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
|
|
3
|
+
import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GENERATED FILE — do not edit.
|
|
7
|
+
*
|
|
8
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
9
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
10
|
+
* being rejected, because it works until it silently does not. Fix
|
|
11
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
12
|
+
*
|
|
13
|
+
* npm run provider -- twilio
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Twilio's identity on the authoring surface, shared by every Twilio node.
|
|
17
|
+
*
|
|
18
|
+
* This file must import nothing from the js package: a PHP or Python project
|
|
19
|
+
* installs the ui package and never that one, and the import would be a
|
|
20
|
+
* dangling module the moment it did.
|
|
21
|
+
*
|
|
22
|
+
* ## The sandbox trap
|
|
23
|
+
*
|
|
24
|
+
* Twilio's test estate is selected by the CREDENTIALS, not the URL: a separate
|
|
25
|
+
* test Account SID and test Auth Token (Console -> API keys & tokens), against
|
|
26
|
+
* the same api.twilio.com. A live key on a node marked sandbox texts a real
|
|
27
|
+
* phone and is billed. With test credentials only message_send works -- every
|
|
28
|
+
* other resource, including message_get, answers 403 -- nothing is sent or
|
|
29
|
+
* charged, no status callback fires, and From must be Twilio's magic
|
|
30
|
+
* +15005550006 (+15005550004 as To returns 21610, the STOP case). Test
|
|
31
|
+
* credentials are the test Account SID and Auth Token, not an API key.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The connector API version this package was GENERATED against.
|
|
36
|
+
*
|
|
37
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
38
|
+
* very claim it exists to detect.
|
|
39
|
+
*/
|
|
40
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
41
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
42
|
+
declare const TWILIO_SERVICE: {
|
|
43
|
+
readonly service: "twilio";
|
|
44
|
+
readonly serviceTitle: "Twilio";
|
|
45
|
+
readonly domain: "messaging";
|
|
46
|
+
readonly sandbox: "credential";
|
|
47
|
+
};
|
|
48
|
+
/** The credentials a Twilio connection holds. */
|
|
49
|
+
declare const TWILIO_CREDENTIALS: readonly [{
|
|
50
|
+
readonly key: "accountSid";
|
|
51
|
+
readonly label: "Account SID";
|
|
52
|
+
readonly scope: "account";
|
|
53
|
+
readonly secret: false;
|
|
54
|
+
readonly help: "AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL.";
|
|
55
|
+
}, {
|
|
56
|
+
readonly key: "username";
|
|
57
|
+
readonly label: "API key SID (or Account SID)";
|
|
58
|
+
readonly scope: "account";
|
|
59
|
+
readonly secret: false;
|
|
60
|
+
readonly help: "An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token.";
|
|
61
|
+
}, {
|
|
62
|
+
readonly key: "password";
|
|
63
|
+
readonly label: "API key secret (or Auth Token)";
|
|
64
|
+
readonly scope: "account";
|
|
65
|
+
readonly secret: true;
|
|
66
|
+
readonly help: "The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own.";
|
|
67
|
+
}];
|
|
68
|
+
/** Build a Twilio node's connector metadata from the operation it performs. */
|
|
69
|
+
declare function twilioMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
70
|
+
|
|
71
|
+
declare const TWILIO_MESSAGE_GET_KIND = "@particle-academy/twilio_message_get";
|
|
72
|
+
declare const TWILIO_MESSAGE_GET_OPERATION = "message_get";
|
|
73
|
+
declare const TWILIO_MESSAGE_GET_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
74
|
+
/**
|
|
75
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
76
|
+
*
|
|
77
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
78
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
79
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
80
|
+
* and hoping.
|
|
81
|
+
*/
|
|
82
|
+
declare const TWILIO_MESSAGE_GET_OUTPUT: OutputField[];
|
|
83
|
+
declare const twilioMessageGetKind: NodeKindDefinition;
|
|
84
|
+
|
|
85
|
+
declare const TWILIO_MESSAGE_SEND_KIND = "@particle-academy/twilio_message_send";
|
|
86
|
+
declare const TWILIO_MESSAGE_SEND_OPERATION = "message_send";
|
|
87
|
+
declare const TWILIO_MESSAGE_SEND_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
88
|
+
/**
|
|
89
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
90
|
+
*
|
|
91
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
92
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
93
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
94
|
+
* and hoping.
|
|
95
|
+
*/
|
|
96
|
+
declare const TWILIO_MESSAGE_SEND_OUTPUT: OutputField[];
|
|
97
|
+
declare const twilioMessageSendKind: NodeKindDefinition;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* GENERATED FILE — do not edit.
|
|
101
|
+
*
|
|
102
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
103
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
104
|
+
* being rejected, because it works until it silently does not. Fix
|
|
105
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
106
|
+
*
|
|
107
|
+
* npm run provider -- twilio
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* Twilio's node kinds for fancy-flow.
|
|
111
|
+
*
|
|
112
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
113
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
114
|
+
* this.
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
/** Every Twilio kind, for a host that registers the lot. */
|
|
118
|
+
declare const TWILIO_KINDS: NodeKindDefinition[];
|
|
119
|
+
|
|
120
|
+
export { CONNECTOR_API_VERSION, TWILIO_CREDENTIALS, TWILIO_KINDS, TWILIO_MESSAGE_GET_KIND, TWILIO_MESSAGE_GET_META, TWILIO_MESSAGE_GET_OPERATION, TWILIO_MESSAGE_GET_OUTPUT, TWILIO_MESSAGE_SEND_KIND, TWILIO_MESSAGE_SEND_META, TWILIO_MESSAGE_SEND_OPERATION, TWILIO_MESSAGE_SEND_OUTPUT, TWILIO_SERVICE, twilioMessageGetKind, twilioMessageSendKind, twilioMeta };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
|
|
3
|
+
// src/service.ts
|
|
4
|
+
var CONNECTOR_API_VERSION = 1;
|
|
5
|
+
var TWILIO_SERVICE = {
|
|
6
|
+
service: "twilio",
|
|
7
|
+
serviceTitle: "Twilio",
|
|
8
|
+
domain: "messaging",
|
|
9
|
+
sandbox: "credential"
|
|
10
|
+
};
|
|
11
|
+
var TWILIO_CREDENTIALS = [
|
|
12
|
+
{
|
|
13
|
+
"key": "accountSid",
|
|
14
|
+
"label": "Account SID",
|
|
15
|
+
"scope": "account",
|
|
16
|
+
"secret": false,
|
|
17
|
+
"help": "AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"key": "username",
|
|
21
|
+
"label": "API key SID (or Account SID)",
|
|
22
|
+
"scope": "account",
|
|
23
|
+
"secret": false,
|
|
24
|
+
"help": "An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"key": "password",
|
|
28
|
+
"label": "API key secret (or Auth Token)",
|
|
29
|
+
"scope": "account",
|
|
30
|
+
"secret": true,
|
|
31
|
+
"help": "The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own."
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
function twilioMeta(role, operation, docs) {
|
|
35
|
+
return { ...TWILIO_SERVICE, role, operation, docs };
|
|
36
|
+
}
|
|
37
|
+
var TWILIO_MESSAGE_GET_KIND = "@particle-academy/twilio_message_get";
|
|
38
|
+
var TWILIO_MESSAGE_GET_OPERATION = "message_get";
|
|
39
|
+
var TWILIO_MESSAGE_GET_META = twilioMeta("action", "read a message", "https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource");
|
|
40
|
+
var TWILIO_MESSAGE_GET_OUTPUT = [
|
|
41
|
+
{
|
|
42
|
+
"path": "data.sid",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "The message SID (SM... or MM...)."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"path": "data.status",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"path": "data.to",
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "The recipient, E.164."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "data.from",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "The sender. Null while a Messaging Service is still choosing one."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "data.body",
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The text."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "data.num_segments",
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "data.messaging_service_sid",
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "The Messaging Service used, if any."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "data.error_code",
|
|
78
|
+
"type": "number",
|
|
79
|
+
"description": "Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise."
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"path": "data.error_message",
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "Twilio's description of the error. Null otherwise."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"path": "data.date_created",
|
|
88
|
+
"type": "string",
|
|
89
|
+
"description": "RFC 2822 date."
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"path": "data.price",
|
|
93
|
+
"type": "string",
|
|
94
|
+
"description": "The price, negative, once known. Null until then."
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"path": "data.price_unit",
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "ISO 4217 currency of `price`."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"path": "mode",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"description": "Which estate this ran against: fake or live."
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
var twilioMessageGetKind = defineConnectorKind(TWILIO_MESSAGE_GET_META, {
|
|
108
|
+
name: TWILIO_MESSAGE_GET_KIND,
|
|
109
|
+
aliases: ["twilio_message_get"],
|
|
110
|
+
label: "Twilio message",
|
|
111
|
+
description: "Read a message's current status, segments, price and error code.",
|
|
112
|
+
inputs: [{ id: "in" }],
|
|
113
|
+
outputs: [{ id: "out" }],
|
|
114
|
+
sideEffects: "none",
|
|
115
|
+
outputShape: TWILIO_MESSAGE_GET_OUTPUT,
|
|
116
|
+
configSchema: [
|
|
117
|
+
{
|
|
118
|
+
"type": "text",
|
|
119
|
+
"key": "sid",
|
|
120
|
+
"label": "Message SID",
|
|
121
|
+
"required": true,
|
|
122
|
+
"description": "From message_send's data.sid."
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
defaultConfig: {
|
|
126
|
+
"mode": "auto"
|
|
127
|
+
},
|
|
128
|
+
renderBody: ({ config }) => summarize(TWILIO_MESSAGE_GET_META, config, "read a message")
|
|
129
|
+
});
|
|
130
|
+
var TWILIO_MESSAGE_SEND_KIND = "@particle-academy/twilio_message_send";
|
|
131
|
+
var TWILIO_MESSAGE_SEND_OPERATION = "message_send";
|
|
132
|
+
var TWILIO_MESSAGE_SEND_META = twilioMeta("action", "send an SMS", "https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource");
|
|
133
|
+
var TWILIO_MESSAGE_SEND_OUTPUT = [
|
|
134
|
+
{
|
|
135
|
+
"path": "data.sid",
|
|
136
|
+
"type": "string",
|
|
137
|
+
"description": "The message SID (SM... or MM...)."
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"path": "data.status",
|
|
141
|
+
"type": "string",
|
|
142
|
+
"description": "queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later."
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"path": "data.to",
|
|
146
|
+
"type": "string",
|
|
147
|
+
"description": "The recipient, E.164."
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"path": "data.from",
|
|
151
|
+
"type": "string",
|
|
152
|
+
"description": "The sender. Null while a Messaging Service is still choosing one."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"path": "data.body",
|
|
156
|
+
"type": "string",
|
|
157
|
+
"description": "The text."
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"path": "data.num_segments",
|
|
161
|
+
"type": "string",
|
|
162
|
+
"description": "How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema."
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"path": "data.messaging_service_sid",
|
|
166
|
+
"type": "string",
|
|
167
|
+
"description": "The Messaging Service used, if any."
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"path": "data.error_code",
|
|
171
|
+
"type": "number",
|
|
172
|
+
"description": "Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise."
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"path": "data.error_message",
|
|
176
|
+
"type": "string",
|
|
177
|
+
"description": "Twilio's description of the error. Null otherwise."
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"path": "data.date_created",
|
|
181
|
+
"type": "string",
|
|
182
|
+
"description": "RFC 2822 date."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"path": "data.price",
|
|
186
|
+
"type": "string",
|
|
187
|
+
"description": "The price, negative, once known. Null until then."
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"path": "data.price_unit",
|
|
191
|
+
"type": "string",
|
|
192
|
+
"description": "ISO 4217 currency of `price`."
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"path": "mode",
|
|
196
|
+
"type": "string",
|
|
197
|
+
"description": "Which estate this ran against: fake or live."
|
|
198
|
+
}
|
|
199
|
+
];
|
|
200
|
+
var twilioMessageSendKind = defineConnectorKind(TWILIO_MESSAGE_SEND_META, {
|
|
201
|
+
name: TWILIO_MESSAGE_SEND_KIND,
|
|
202
|
+
aliases: ["twilio_message_send"],
|
|
203
|
+
label: "Send an SMS with Twilio",
|
|
204
|
+
description: "Send a text message.",
|
|
205
|
+
inputs: [{ id: "in" }],
|
|
206
|
+
outputs: [{ id: "out" }],
|
|
207
|
+
sideEffects: "unsafe-to-replay",
|
|
208
|
+
outputShape: TWILIO_MESSAGE_SEND_OUTPUT,
|
|
209
|
+
configSchema: [
|
|
210
|
+
{
|
|
211
|
+
"type": "expression",
|
|
212
|
+
"key": "to",
|
|
213
|
+
"label": "To",
|
|
214
|
+
"required": true,
|
|
215
|
+
"example": "{{ $json.phone }}",
|
|
216
|
+
"description": "The recipient in E.164, e.g. +14155550100."
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"type": "text",
|
|
220
|
+
"key": "from",
|
|
221
|
+
"label": "From",
|
|
222
|
+
"description": "A Twilio number you own, in E.164, or an alphanumeric sender ID where the destination allows one. Give this or a Messaging Service."
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"type": "text",
|
|
226
|
+
"key": "messagingServiceSid",
|
|
227
|
+
"label": "Messaging Service SID",
|
|
228
|
+
"description": "MG... A Messaging Service picks the sender from its pool. Give this or From."
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"type": "textarea",
|
|
232
|
+
"key": "body",
|
|
233
|
+
"label": "Body",
|
|
234
|
+
"required": true,
|
|
235
|
+
"description": "The text. Up to 1,600 characters. A character outside GSM-7 makes the whole message UCS-2, which halves how much fits in each billed segment."
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"type": "text",
|
|
239
|
+
"key": "statusCallback",
|
|
240
|
+
"label": "Status callback URL",
|
|
241
|
+
"description": "Optional. Twilio POSTs delivery status changes here. Verifying those requests arrives in 0.2.0."
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
defaultConfig: {
|
|
245
|
+
"mode": "auto"
|
|
246
|
+
},
|
|
247
|
+
renderBody: ({ config }) => summarize(TWILIO_MESSAGE_SEND_META, config, "send an SMS")
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// src/index.ts
|
|
251
|
+
var TWILIO_KINDS = [
|
|
252
|
+
twilioMessageGetKind,
|
|
253
|
+
twilioMessageSendKind
|
|
254
|
+
];
|
|
255
|
+
|
|
256
|
+
export { CONNECTOR_API_VERSION, TWILIO_CREDENTIALS, TWILIO_KINDS, TWILIO_MESSAGE_GET_KIND, TWILIO_MESSAGE_GET_META, TWILIO_MESSAGE_GET_OPERATION, TWILIO_MESSAGE_GET_OUTPUT, TWILIO_MESSAGE_SEND_KIND, TWILIO_MESSAGE_SEND_META, TWILIO_MESSAGE_SEND_OPERATION, TWILIO_MESSAGE_SEND_OUTPUT, TWILIO_SERVICE, twilioMessageGetKind, twilioMessageSendKind, twilioMeta };
|
|
257
|
+
//# sourceMappingURL=index.js.map
|
|
258
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/message-get.ts","../src/kinds/message-send.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;AAsCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,cAAA,GAAiB;AAAA,EAC5B,OAAA,EAAS,QAAA;AAAA,EACT,YAAA,EAAc,QAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,kBAAA,GAAqB;AAAA,EAChC;AAAA,IACE,KAAA,EAAO,YAAA;AAAA,IACP,OAAA,EAAS,aAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,8BAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,gCAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ;AAGO,SAAS,UAAA,CACd,IAAA,EACA,SAAA,EACA,IAAA,EACe;AACf,EAAA,OAAO,EAAE,GAAG,cAAA,EAAgB,IAAA,EAAM,WAAW,IAAA,EAAK;AACpD;ACtFO,IAAM,uBAAA,GAA0B;AAChC,IAAM,4BAAA,GAA+B;AAErC,IAAM,uBAAA,GAA0B,UAAA,CAAW,QAAA,EAAU,gBAAA,EAAkB,qFAAqF;AAU5J,IAAM,yBAAA,GAA2C;AAAA,EACtD;AAAA,IACE,MAAA,EAAQ,UAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,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not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Twilio's identity on the authoring surface, shared by every Twilio node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * Twilio's test estate is selected by the CREDENTIALS, not the URL: a separate\n * test Account SID and test Auth Token (Console -> API keys & tokens), against\n * the same api.twilio.com. A live key on a node marked sandbox texts a real\n * phone and is billed. With test credentials only message_send works -- every\n * other resource, including message_get, answers 403 -- nothing is sent or\n * charged, no status callback fires, and From must be Twilio's magic\n * +15005550006 (+15005550004 as To returns 21610, the STOP case). Test\n * credentials are the test Account SID and Auth Token, not an API key.\n */\n\nimport type { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported — an imported constant lets an upgrade rewrite the\n * very claim it exists to detect.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const TWILIO_SERVICE = {\n service: \"twilio\",\n serviceTitle: \"Twilio\",\n domain: \"messaging\",\n sandbox: \"credential\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Twilio connection holds. */\nexport const TWILIO_CREDENTIALS = [\n {\n \"key\": \"accountSid\",\n \"label\": \"Account SID\",\n \"scope\": \"account\",\n \"secret\": false,\n \"help\": \"AC followed by 32 hex characters, from the Twilio Console. It is part of every request URL.\"\n },\n {\n \"key\": \"username\",\n \"label\": \"API key SID (or Account SID)\",\n \"scope\": \"account\",\n \"secret\": false,\n \"help\": \"An API key SID from the Twilio Console (API keys & tokens), recommended. Or the Account SID again, to authenticate with the Auth Token.\"\n },\n {\n \"key\": \"password\",\n \"label\": \"API key secret (or Auth Token)\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"The secret shown once when the API key was created, or the account's Auth Token. The Auth Token can do everything on the account; an API key can be revoked on its own.\"\n }\n] as const;\n\n/** Build a Twilio node's connector metadata from the operation it performs. */\nexport function twilioMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...TWILIO_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/message-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/message-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Twilio message — Read a message's current status, segments, price and error\n * code.\n *\n * https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { twilioMeta } from \"../service.js\";\n\nexport const TWILIO_MESSAGE_GET_KIND = \"@particle-academy/twilio_message_get\";\nexport const TWILIO_MESSAGE_GET_OPERATION = \"message_get\";\n\nexport const TWILIO_MESSAGE_GET_META = twilioMeta(\"action\", \"read a message\", \"https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const TWILIO_MESSAGE_GET_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.sid\",\n \"type\": \"string\",\n \"description\": \"The message SID (SM... or MM...).\"\n },\n {\n \"path\": \"data.status\",\n \"type\": \"string\",\n \"description\": \"queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later.\"\n },\n {\n \"path\": \"data.to\",\n \"type\": \"string\",\n \"description\": \"The recipient, E.164.\"\n },\n {\n \"path\": \"data.from\",\n \"type\": \"string\",\n \"description\": \"The sender. Null while a Messaging Service is still choosing one.\"\n },\n {\n \"path\": \"data.body\",\n \"type\": \"string\",\n \"description\": \"The text.\"\n },\n {\n \"path\": \"data.num_segments\",\n \"type\": \"string\",\n \"description\": \"How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema.\"\n },\n {\n \"path\": \"data.messaging_service_sid\",\n \"type\": \"string\",\n \"description\": \"The Messaging Service used, if any.\"\n },\n {\n \"path\": \"data.error_code\",\n \"type\": \"number\",\n \"description\": \"Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise.\"\n },\n {\n \"path\": \"data.error_message\",\n \"type\": \"string\",\n \"description\": \"Twilio's description of the error. Null otherwise.\"\n },\n {\n \"path\": \"data.date_created\",\n \"type\": \"string\",\n \"description\": \"RFC 2822 date.\"\n },\n {\n \"path\": \"data.price\",\n \"type\": \"string\",\n \"description\": \"The price, negative, once known. Null until then.\"\n },\n {\n \"path\": \"data.price_unit\",\n \"type\": \"string\",\n \"description\": \"ISO 4217 currency of `price`.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against: fake or live.\"\n }\n];\n\nexport const twilioMessageGetKind: NodeKindDefinition = defineConnectorKind(TWILIO_MESSAGE_GET_META, {\n name: TWILIO_MESSAGE_GET_KIND,\n aliases: [\"twilio_message_get\"],\n label: \"Twilio message\",\n description: \"Read a message's current status, segments, price and error code.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"none\",\n outputShape: TWILIO_MESSAGE_GET_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"sid\",\n \"label\": \"Message SID\",\n \"required\": true,\n \"description\": \"From message_send's data.sid.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(TWILIO_MESSAGE_GET_META, config as Record<string, unknown>, \"read a message\"),\n});\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/message-send.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/message-send.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Send an SMS with Twilio — Send a text message.\n *\n * https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { twilioMeta } from \"../service.js\";\n\nexport const TWILIO_MESSAGE_SEND_KIND = \"@particle-academy/twilio_message_send\";\nexport const TWILIO_MESSAGE_SEND_OPERATION = \"message_send\";\n\nexport const TWILIO_MESSAGE_SEND_META = twilioMeta(\"action\", \"send an SMS\", \"https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const TWILIO_MESSAGE_SEND_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.sid\",\n \"type\": \"string\",\n \"description\": \"The message SID (SM... or MM...).\"\n },\n {\n \"path\": \"data.status\",\n \"type\": \"string\",\n \"description\": \"queued, sending, sent, delivered, undelivered, failed, scheduled, canceled, and others. A send answers `queued` or `accepted`, not delivered: delivery is reported later.\"\n },\n {\n \"path\": \"data.to\",\n \"type\": \"string\",\n \"description\": \"The recipient, E.164.\"\n },\n {\n \"path\": \"data.from\",\n \"type\": \"string\",\n \"description\": \"The sender. Null while a Messaging Service is still choosing one.\"\n },\n {\n \"path\": \"data.body\",\n \"type\": \"string\",\n \"description\": \"The text.\"\n },\n {\n \"path\": \"data.num_segments\",\n \"type\": \"string\",\n \"description\": \"How many SMS segments Twilio billed or will bill. A STRING in Twilio's schema.\"\n },\n {\n \"path\": \"data.messaging_service_sid\",\n \"type\": \"string\",\n \"description\": \"The Messaging Service used, if any.\"\n },\n {\n \"path\": \"data.error_code\",\n \"type\": \"number\",\n \"description\": \"Twilio's error code when the message failed, e.g. 21610 (the recipient replied STOP). Null otherwise.\"\n },\n {\n \"path\": \"data.error_message\",\n \"type\": \"string\",\n \"description\": \"Twilio's description of the error. Null otherwise.\"\n },\n {\n \"path\": \"data.date_created\",\n \"type\": \"string\",\n \"description\": \"RFC 2822 date.\"\n },\n {\n \"path\": \"data.price\",\n \"type\": \"string\",\n \"description\": \"The price, negative, once known. Null until then.\"\n },\n {\n \"path\": \"data.price_unit\",\n \"type\": \"string\",\n \"description\": \"ISO 4217 currency of `price`.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against: fake or live.\"\n }\n];\n\nexport const twilioMessageSendKind: NodeKindDefinition = defineConnectorKind(TWILIO_MESSAGE_SEND_META, {\n name: TWILIO_MESSAGE_SEND_KIND,\n aliases: [\"twilio_message_send\"],\n label: \"Send an SMS with Twilio\",\n description: \"Send a text message.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: TWILIO_MESSAGE_SEND_OUTPUT,\n configSchema: [\n {\n \"type\": \"expression\",\n \"key\": \"to\",\n \"label\": \"To\",\n \"required\": true,\n \"example\": \"{{ $json.phone }}\",\n \"description\": \"The recipient in E.164, e.g. +14155550100.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"from\",\n \"label\": \"From\",\n \"description\": \"A Twilio number you own, in E.164, or an alphanumeric sender ID where the destination allows one. Give this or a Messaging Service.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"messagingServiceSid\",\n \"label\": \"Messaging Service SID\",\n \"description\": \"MG... A Messaging Service picks the sender from its pool. Give this or From.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"body\",\n \"label\": \"Body\",\n \"required\": true,\n \"description\": \"The text. Up to 1,600 characters. A character outside GSM-7 makes the whole message UCS-2, which halves how much fits in each billed segment.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"statusCallback\",\n \"label\": \"Status callback URL\",\n \"description\": \"Optional. Twilio POSTs delivery status changes here. Verifying those requests arrives in 0.2.0.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(TWILIO_MESSAGE_SEND_META, config as Record<string, unknown>, \"send an SMS\"),\n});\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- twilio\n */\n\n/**\n * Twilio's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/message-get.js\";\nexport * from \"./kinds/message-send.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { twilioMessageGetKind } from \"./kinds/message-get.js\";\nimport { twilioMessageSendKind } from \"./kinds/message-send.js\";\n\n/** Every Twilio kind, for a host that registers the lot. */\nexport const TWILIO_KINDS: NodeKindDefinition[] = [\n twilioMessageGetKind,\n twilioMessageSendKind,\n];\n"]}
|
package/package.json
CHANGED
|
@@ -1,18 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-academy/twilio-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Twilio's authoring surface for fancy-flow — the node kinds, their config schemas and their declared output shapes. React on every host; carries no executor.",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "git+https://github.com/Fancy-Friends/twilio.git",
|
|
9
8
|
"directory": "packages/ui"
|
|
10
9
|
},
|
|
11
10
|
"homepage": "https://github.com/Fancy-Friends/twilio#readme",
|
|
11
|
+
"bugs": "https://github.com/Fancy-Friends/twilio/issues",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./dist/index.d.cts",
|
|
24
|
+
"default": "./dist/index.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"art",
|
|
32
|
+
"README.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"lint": "tsc --noEmit",
|
|
39
|
+
"test": "node --import tsx --test tests/*.test.ts",
|
|
40
|
+
"prepublishOnly": "tsup"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@particle-academy/fancy-flow": ">=0.48.0 <2.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@particle-academy/fancy-flow": ">=0.48.0 <2.0",
|
|
48
|
+
"@types/node": "^26.2.0",
|
|
49
|
+
"tsup": "^8.5.0",
|
|
50
|
+
"tsx": "^4.19.0",
|
|
51
|
+
"typescript": "^5.8.0"
|
|
52
|
+
},
|
|
12
53
|
"publishConfig": {
|
|
13
54
|
"access": "public"
|
|
14
55
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
56
|
+
"keywords": [
|
|
57
|
+
"twilio",
|
|
58
|
+
"messaging",
|
|
59
|
+
"connector",
|
|
60
|
+
"fancy-flow",
|
|
61
|
+
"fancy-ui",
|
|
62
|
+
"particle-academy"
|
|
63
|
+
],
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"sideEffects": false,
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=22"
|
|
68
|
+
}
|
|
18
69
|
}
|