@superdurable/connector-twilio-messaging 0.0.0-stage → 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/dist/mock.js ADDED
@@ -0,0 +1,137 @@
1
+ import {
2
+ ConnectorID,
3
+ GetMessageDefinition,
4
+ GetMessageInputSchema,
5
+ MessageSchema,
6
+ ProviderID,
7
+ SendMessageDefinition,
8
+ SendMessageInputSchema,
9
+ newConnectionWithOperations
10
+ } from "./chunk-RO6VVVPT.js";
11
+
12
+ // src/generated/mock.ts
13
+ import { branchCase, retryCase, uncertainCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
14
+ var emptySendMessageInput = SendMessageInputSchema.parse({
15
+ "to": ""
16
+ });
17
+ var emptyMessage = MessageSchema.parse({
18
+ "accountSid": "",
19
+ "to": "",
20
+ "createdAt": "0001-01-01T00:00:00Z",
21
+ "sentAt": "0001-01-01T00:00:00Z",
22
+ "updatedAt": "0001-01-01T00:00:00Z"
23
+ });
24
+ var emptyGetMessageInput = GetMessageInputSchema.parse({
25
+ "messageSid": ""
26
+ });
27
+ function sendMessageAccepted(value, failure) {
28
+ return branchCase("accepted", value, failure);
29
+ }
30
+ function sendMessageProviderRejected(value, failure) {
31
+ return branchCase("providerRejected", value, failure);
32
+ }
33
+ function sendMessageDefect(value, failure) {
34
+ return branchCase("defect", value, failure);
35
+ }
36
+ function sendMessageRetry(failure, retryAfterMs = 0) {
37
+ return retryCase(failure, retryAfterMs);
38
+ }
39
+ function sendMessageUncertain(value, failure) {
40
+ return uncertainCase(value, failure);
41
+ }
42
+ function sendMessageQueuedText() {
43
+ const value = MessageSchema.parse({ "accountSid": "ACmockAccount", "createdAt": "2026-09-30T17:04:05Z", "direction": "outbound-api", "from": "+14155550100", "segmentCount": 1, "sentAt": "0001-01-01T00:00:00Z", "sid": "SMfedcba9876543210fedcba9876543210", "status": "queued", "to": "+14155550123", "updatedAt": "0001-01-01T00:00:00Z" });
44
+ return branchCase("accepted", value);
45
+ }
46
+ function sendMessageDefault() {
47
+ return sendMessageQueuedText();
48
+ }
49
+ function sendMessageTrialRecipientRejected() {
50
+ const value = MessageSchema.parse({ "accountSid": "ACmockAccount", "createdAt": "0001-01-01T00:00:00Z", "errorCode": 21608, "from": "+14155550100", "sentAt": "0001-01-01T00:00:00Z", "to": "+14155550123", "updatedAt": "0001-01-01T00:00:00Z" });
51
+ return branchCase("providerRejected", value, { kind: "PROVIDER_REJECTION", provider: ConnectorID, operation: "sendMessage", message: "Twilio rejected the message with error 21608" });
52
+ }
53
+ function getMessageFound(value, failure) {
54
+ return branchCase("found", value, failure);
55
+ }
56
+ function getMessageNotFound(value, failure) {
57
+ return branchCase("notFound", value, failure);
58
+ }
59
+ function getMessageProviderRejected(value, failure) {
60
+ return branchCase("providerRejected", value, failure);
61
+ }
62
+ function getMessageInvalidResponse(value, failure) {
63
+ return branchCase("invalidResponse", value, failure);
64
+ }
65
+ function getMessageDefect(value, failure) {
66
+ return branchCase("defect", value, failure);
67
+ }
68
+ function getMessageRetry(failure, retryAfterMs = 0) {
69
+ return retryCase(failure, retryAfterMs);
70
+ }
71
+ function getMessageDeliveredText() {
72
+ const value = MessageSchema.parse({ "accountSid": "ACmockAccount", "createdAt": "2026-09-30T17:04:05Z", "direction": "outbound-api", "from": "+14155550100", "segmentCount": 1, "sentAt": "2026-09-30T17:04:06Z", "sid": "SMfedcba9876543210fedcba9876543210", "status": "delivered", "to": "+14155550123", "updatedAt": "0001-01-01T00:00:00Z" });
73
+ return branchCase("found", value);
74
+ }
75
+ function getMessageDefault() {
76
+ return getMessageDeliveredText();
77
+ }
78
+ function getMessageMessageMissing() {
79
+ const value = emptyMessage;
80
+ return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getMessage", message: "Twilio has no message with that SID." });
81
+ }
82
+ function getMessageMessageReadRejected() {
83
+ const value = emptyMessage;
84
+ return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "getMessage", message: "Twilio rejected the message query." });
85
+ }
86
+ function getMessageInvalidMessageResponse() {
87
+ const value = emptyMessage;
88
+ return branchCase("invalidResponse", value, { kind: "PROTOCOL", provider: ConnectorID, operation: "getMessage", message: "Twilio returned an invalid message." });
89
+ }
90
+ var GeneratedMock = class {
91
+ #sendMessage;
92
+ #getMessage;
93
+ #connection;
94
+ constructor(connectionName) {
95
+ this.#sendMessage = newMutation(SendMessageDefinition).default(sendMessageDefault());
96
+ this.#getMessage = newQuery(GetMessageDefinition).default(getMessageDefault());
97
+ this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
98
+ }
99
+ connection() {
100
+ return this.#connection;
101
+ }
102
+ sendMessage() {
103
+ return this.#sendMessage;
104
+ }
105
+ getMessage() {
106
+ return this.#getMessage;
107
+ }
108
+ assertNoFailures() {
109
+ this.#sendMessage.assertNoFailures();
110
+ this.#getMessage.assertNoFailures();
111
+ }
112
+ };
113
+ export {
114
+ GeneratedMock,
115
+ emptyGetMessageInput,
116
+ emptyMessage,
117
+ emptySendMessageInput,
118
+ getMessageDefault,
119
+ getMessageDefect,
120
+ getMessageDeliveredText,
121
+ getMessageFound,
122
+ getMessageInvalidMessageResponse,
123
+ getMessageInvalidResponse,
124
+ getMessageMessageMissing,
125
+ getMessageMessageReadRejected,
126
+ getMessageNotFound,
127
+ getMessageProviderRejected,
128
+ getMessageRetry,
129
+ sendMessageAccepted,
130
+ sendMessageDefault,
131
+ sendMessageDefect,
132
+ sendMessageProviderRejected,
133
+ sendMessageQueuedText,
134
+ sendMessageRetry,
135
+ sendMessageTrialRecipientRejected,
136
+ sendMessageUncertain
137
+ };
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@superdurable/connector-twilio-messaging",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "Twilio Messaging connector for Dex TypeScript applications",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/superdurable/dex-connectors-library.git",
9
+ "directory": "connectors/twilio/messaging/typescript"
10
+ },
11
+ "type": "module",
12
+ "engines": {
13
+ "node": "^22.0.0 || ^24.0.0"
14
+ },
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./mock": {
23
+ "types": "./dist/mock.d.ts",
24
+ "import": "./dist/mock.js"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "README.md",
30
+ "LICENSE",
31
+ "dex-connector.json"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
35
+ "typecheck": "tsc --noEmit",
36
+ "lint": "eslint src test examples",
37
+ "test": "vitest run --exclude test/integration/**",
38
+ "check": "npm run typecheck && npm run lint && npm test && npm run build",
39
+ "example:run": "npm run build && tsx examples/text-message-delivery/main.ts",
40
+ "example:integration": "npm run build && tsx examples/text-message-delivery/integration.ts"
41
+ },
42
+ "dependencies": {
43
+ "@superdurable/connectors-sdk": "0.1.0",
44
+ "@superdurable/dex": ">=1.28.0",
45
+ "zod": "^4.1.0"
46
+ },
47
+ "devDependencies": {
48
+ "@eslint/js": "^9.0.0",
49
+ "@types/node": "^22.0.0",
50
+ "eslint": "^9.0.0",
51
+ "tsup": "^8.0.0",
52
+ "tsx": "^4.23.15",
53
+ "typescript": "^5.9.0",
54
+ "typescript-eslint": "^8.0.0",
55
+ "vitest": "^3.0.0",
56
+ "yaml": "^2.9.1"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public",
60
+ "registry": "https://registry.npmjs.org"
61
+ }
62
+ }