@effect/chat-whatsapp 0.0.0-stage → 4.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/AGENTS.md +434 -0
  2. package/CLAUDE.md +434 -0
  3. package/LICENSE +21 -0
  4. package/README.md +60 -2
  5. package/ai-docs/README.md +44 -0
  6. package/ai-docs/package.json +36 -0
  7. package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
  8. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
  9. package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
  10. package/ai-docs/src/01_effect/01_basics/index.md +7 -0
  11. package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
  12. package/ai-docs/src/01_effect/02_schema/index.md +7 -0
  13. package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
  14. package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
  15. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
  16. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
  17. package/ai-docs/src/01_effect/03_services/index.md +5 -0
  18. package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
  19. package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
  20. package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
  21. package/ai-docs/src/01_effect/04_errors/index.md +1 -0
  22. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
  23. package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
  24. package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
  25. package/ai-docs/src/01_effect/05_resources/index.md +3 -0
  26. package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
  27. package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
  28. package/ai-docs/src/01_effect/06_running/index.md +1 -0
  29. package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
  30. package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
  31. package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
  32. package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
  33. package/ai-docs/src/03_stream/30_encoding.ts +163 -0
  34. package/ai-docs/src/03_stream/index.md +4 -0
  35. package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
  36. package/ai-docs/src/04_integration/index.md +5 -0
  37. package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
  38. package/ai-docs/src/05_batching/index.md +3 -0
  39. package/ai-docs/src/06_schedule/10_schedules.ts +111 -0
  40. package/ai-docs/src/06_schedule/index.md +3 -0
  41. package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
  42. package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
  43. package/ai-docs/src/07_datetime/index.md +5 -0
  44. package/ai-docs/src/08_observability/10_logging.ts +66 -0
  45. package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
  46. package/ai-docs/src/08_observability/index.md +7 -0
  47. package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
  48. package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
  49. package/ai-docs/src/09_testing/index.md +1 -0
  50. package/ai-docs/src/10_predicate/01_basics.ts +14 -0
  51. package/ai-docs/src/10_predicate/index.md +9 -0
  52. package/ai-docs/src/40_sql/10_basics.ts +175 -0
  53. package/ai-docs/src/40_sql/index.md +6 -0
  54. package/ai-docs/src/50_http-client/10_basics.ts +102 -0
  55. package/ai-docs/src/50_http-client/index.md +3 -0
  56. package/ai-docs/src/51_http-server/10_basics.ts +118 -0
  57. package/ai-docs/src/51_http-server/20_testing.ts +100 -0
  58. package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
  59. package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
  60. package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
  61. package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
  62. package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
  63. package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
  64. package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
  65. package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
  66. package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
  67. package/ai-docs/src/51_http-server/index.md +3 -0
  68. package/ai-docs/src/52_graphql/10_basics.ts +117 -0
  69. package/ai-docs/src/52_graphql/20_testing.ts +45 -0
  70. package/ai-docs/src/52_graphql/30_batching.ts +118 -0
  71. package/ai-docs/src/52_graphql/40_aliased-batching.ts +124 -0
  72. package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
  73. package/ai-docs/src/52_graphql/index.md +6 -0
  74. package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
  75. package/ai-docs/src/60_child-process/index.md +3 -0
  76. package/ai-docs/src/70_cli/10_basics.ts +162 -0
  77. package/ai-docs/src/70_cli/index.md +5 -0
  78. package/ai-docs/src/71_ai/10_language-model.ts +156 -0
  79. package/ai-docs/src/71_ai/20_tools.ts +226 -0
  80. package/ai-docs/src/71_ai/30_chat.ts +158 -0
  81. package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
  82. package/ai-docs/src/71_ai/index.md +5 -0
  83. package/ai-docs/src/80_cluster/10_entities.ts +97 -0
  84. package/ai-docs/src/80_cluster/index.md +4 -0
  85. package/ai-docs/src/index.md +10 -0
  86. package/ai-docs/tsconfig.json +28 -0
  87. package/dist/WhatsAppChat.d.ts +373 -0
  88. package/dist/WhatsAppChat.d.ts.map +1 -0
  89. package/dist/WhatsAppChat.js +388 -0
  90. package/dist/WhatsAppChat.js.map +1 -0
  91. package/dist/WhatsAppGraphApi.d.ts +90 -0
  92. package/dist/WhatsAppGraphApi.d.ts.map +1 -0
  93. package/dist/WhatsAppGraphApi.js +97 -0
  94. package/dist/WhatsAppGraphApi.js.map +1 -0
  95. package/dist/WhatsAppUpdate.d.ts +168 -0
  96. package/dist/WhatsAppUpdate.d.ts.map +1 -0
  97. package/dist/WhatsAppUpdate.js +103 -0
  98. package/dist/WhatsAppUpdate.js.map +1 -0
  99. package/dist/index.d.ts +20 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +21 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/internal/actions.d.ts +2 -0
  104. package/dist/internal/actions.d.ts.map +1 -0
  105. package/dist/internal/actions.js +224 -0
  106. package/dist/internal/actions.js.map +1 -0
  107. package/dist/internal/adapter.d.ts +2 -0
  108. package/dist/internal/adapter.d.ts.map +1 -0
  109. package/dist/internal/adapter.js +330 -0
  110. package/dist/internal/adapter.js.map +1 -0
  111. package/dist/internal/address.d.ts +2 -0
  112. package/dist/internal/address.d.ts.map +1 -0
  113. package/dist/internal/address.js +36 -0
  114. package/dist/internal/address.js.map +1 -0
  115. package/dist/internal/errors.d.ts +2 -0
  116. package/dist/internal/errors.d.ts.map +1 -0
  117. package/dist/internal/errors.js +93 -0
  118. package/dist/internal/errors.js.map +1 -0
  119. package/dist/internal/normalize.d.ts +2 -0
  120. package/dist/internal/normalize.d.ts.map +1 -0
  121. package/dist/internal/normalize.js +292 -0
  122. package/dist/internal/normalize.js.map +1 -0
  123. package/dist/internal/options.d.ts +2 -0
  124. package/dist/internal/options.d.ts.map +1 -0
  125. package/dist/internal/options.js +10 -0
  126. package/dist/internal/options.js.map +1 -0
  127. package/dist/internal/text.d.ts +11 -0
  128. package/dist/internal/text.d.ts.map +1 -0
  129. package/dist/internal/text.js +485 -0
  130. package/dist/internal/text.js.map +1 -0
  131. package/dist/internal/webhook.d.ts +2 -0
  132. package/dist/internal/webhook.d.ts.map +1 -0
  133. package/dist/internal/webhook.js +150 -0
  134. package/dist/internal/webhook.js.map +1 -0
  135. package/package.json +58 -3
  136. package/src/WhatsAppChat.ts +505 -0
  137. package/src/WhatsAppGraphApi.ts +147 -0
  138. package/src/WhatsAppUpdate.ts +142 -0
  139. package/src/index.ts +24 -0
  140. package/src/internal/actions.ts +220 -0
  141. package/src/internal/adapter.ts +284 -0
  142. package/src/internal/address.ts +41 -0
  143. package/src/internal/errors.ts +102 -0
  144. package/src/internal/normalize.ts +250 -0
  145. package/src/internal/options.ts +13 -0
  146. package/src/internal/text.ts +495 -0
  147. package/src/internal/webhook.ts +216 -0
@@ -0,0 +1,168 @@
1
+ import * as Schema from "effect/Schema";
2
+ /**
3
+ * Schema for the status of a message the business sent.
4
+ *
5
+ * **Details**
6
+ *
7
+ * - `thread` is the recipient's address, with the business-scoped user id
8
+ * when the status carries one and the phone number when it does not.
9
+ * - `messageId` is the id `post` gave. A `failed` status has the
10
+ * `reason` for Meta's error, mapped as a refused call is.
11
+ * - `phone` and `userId` are the recipient's phone number and
12
+ * business-scoped user id, each when the status carries it.
13
+ * - `raw` is the change's `metadata` and the one status.
14
+ *
15
+ * @stability unstable
16
+ * @category schemas
17
+ * @since 4.1.5
18
+ */
19
+ export declare const Status: Schema.TaggedStruct<"Status", {
20
+ readonly thread: Schema.Struct<{
21
+ readonly platform: Schema.String;
22
+ readonly id: Schema.String;
23
+ }>;
24
+ readonly messageId: Schema.String;
25
+ readonly status: Schema.Literals<readonly ["sent", "delivered", "read", "failed"]>;
26
+ readonly timestamp: Schema.optionalKey<Schema.DateTimeUtc>;
27
+ readonly reason: Schema.optionalKey<Schema.Union<[typeof import("effect/chat/ChatError").RateLimited, typeof import("effect/chat/ChatError").Unsupported, typeof import("effect/chat/ChatError").Transport, typeof import("effect/chat/ChatError").PlatformUnavailable, typeof import("effect/chat/ChatError").NoAdapter, typeof import("effect/chat/ChatError").Unauthenticated, typeof import("effect/chat/ChatError").Forbidden, typeof import("effect/chat/ChatError").NotFound, typeof import("effect/chat/ChatError").TooLarge, typeof import("effect/chat/ChatError").InvalidRequest, typeof import("effect/chat/ChatError").InvalidResponse, typeof import("effect/chat/ChatError").Unknown]>>;
28
+ readonly phone: Schema.optionalKey<Schema.String>;
29
+ readonly userId: Schema.optionalKey<Schema.String>;
30
+ readonly raw: Schema.Codec<Schema.Json, Schema.Json, never, never>;
31
+ }>;
32
+ /**
33
+ * The status of a message the business sent.
34
+ *
35
+ * @stability unstable
36
+ * @category models
37
+ * @since 4.1.5
38
+ */
39
+ export type Status = typeof Status.Type;
40
+ /**
41
+ * Schema for a user's changed phone number or business-scoped user id, from
42
+ * a `system` message.
43
+ *
44
+ * **Details**
45
+ *
46
+ * - `thread` is the user's new address. A thread kept under the old one no
47
+ * longer receives messages from the user.
48
+ * - `id` is the system message's id. `change` is Meta's `type`:
49
+ * `user_changed_number` or `user_changed_user_id`.
50
+ * - `userId`, `previousUserId` and `phone` are there when Meta sends
51
+ * them. `previousPhone` is the system message's `from`.
52
+ *
53
+ * @stability unstable
54
+ * @category schemas
55
+ * @since 4.1.5
56
+ */
57
+ export declare const UserIdChanged: Schema.TaggedStruct<"UserIdChanged", {
58
+ readonly thread: Schema.Struct<{
59
+ readonly platform: Schema.String;
60
+ readonly id: Schema.String;
61
+ }>;
62
+ readonly id: Schema.String;
63
+ readonly change: Schema.Literals<readonly ["user_changed_number", "user_changed_user_id"]>;
64
+ readonly userId: Schema.optionalKey<Schema.String>;
65
+ readonly previousUserId: Schema.optionalKey<Schema.String>;
66
+ readonly phone: Schema.optionalKey<Schema.String>;
67
+ readonly previousPhone: Schema.optionalKey<Schema.String>;
68
+ readonly timestamp: Schema.optionalKey<Schema.DateTimeUtc>;
69
+ readonly raw: Schema.Codec<Schema.Json, Schema.Json, never, never>;
70
+ }>;
71
+ /**
72
+ * A user's changed phone number or business-scoped user id.
73
+ *
74
+ * @stability unstable
75
+ * @category models
76
+ * @since 4.1.5
77
+ */
78
+ export type UserIdChanged = typeof UserIdChanged.Type;
79
+ /**
80
+ * Schema for a phone number and a business-scoped user id that name one
81
+ * user.
82
+ *
83
+ * **Details**
84
+ *
85
+ * - Given for every `sent`, `delivered` or `read` status that carries
86
+ * both, beside the `Status`. Nothing is remembered between batches, so the
87
+ * same pair comes again and again.
88
+ * - A message posted to a phone number address reports back with the
89
+ * user's business-scoped id, which is how a consumer learns that the
90
+ * inbound address (`thread`, always the business-scoped form) and the
91
+ * phone number address are one user. The adapter never rewrites an
92
+ * address.
93
+ *
94
+ * @stability unstable
95
+ * @category schemas
96
+ * @since 4.1.5
97
+ */
98
+ export declare const Alias: Schema.TaggedStruct<"Alias", {
99
+ readonly thread: Schema.Struct<{
100
+ readonly platform: Schema.String;
101
+ readonly id: Schema.String;
102
+ }>;
103
+ readonly phone: Schema.String;
104
+ readonly userId: Schema.String;
105
+ readonly messageId: Schema.String;
106
+ readonly status: Schema.Literals<readonly ["sent", "delivered", "read"]>;
107
+ readonly raw: Schema.Codec<Schema.Json, Schema.Json, never, never>;
108
+ }>;
109
+ /**
110
+ * A phone number and a business-scoped user id that name one user.
111
+ *
112
+ * @stability unstable
113
+ * @category models
114
+ * @since 4.1.5
115
+ */
116
+ export type Alias = typeof Alias.Type;
117
+ /**
118
+ * Schema for any update.
119
+ *
120
+ * @stability unstable
121
+ * @category schemas
122
+ * @since 4.1.5
123
+ */
124
+ export declare const WhatsAppUpdate: Schema.Union<readonly [Schema.TaggedStruct<"Status", {
125
+ readonly thread: Schema.Struct<{
126
+ readonly platform: Schema.String;
127
+ readonly id: Schema.String;
128
+ }>;
129
+ readonly messageId: Schema.String;
130
+ readonly status: Schema.Literals<readonly ["sent", "delivered", "read", "failed"]>;
131
+ readonly timestamp: Schema.optionalKey<Schema.DateTimeUtc>;
132
+ readonly reason: Schema.optionalKey<Schema.Union<[typeof import("effect/chat/ChatError").RateLimited, typeof import("effect/chat/ChatError").Unsupported, typeof import("effect/chat/ChatError").Transport, typeof import("effect/chat/ChatError").PlatformUnavailable, typeof import("effect/chat/ChatError").NoAdapter, typeof import("effect/chat/ChatError").Unauthenticated, typeof import("effect/chat/ChatError").Forbidden, typeof import("effect/chat/ChatError").NotFound, typeof import("effect/chat/ChatError").TooLarge, typeof import("effect/chat/ChatError").InvalidRequest, typeof import("effect/chat/ChatError").InvalidResponse, typeof import("effect/chat/ChatError").Unknown]>>;
133
+ readonly phone: Schema.optionalKey<Schema.String>;
134
+ readonly userId: Schema.optionalKey<Schema.String>;
135
+ readonly raw: Schema.Codec<Schema.Json, Schema.Json, never, never>;
136
+ }>, Schema.TaggedStruct<"UserIdChanged", {
137
+ readonly thread: Schema.Struct<{
138
+ readonly platform: Schema.String;
139
+ readonly id: Schema.String;
140
+ }>;
141
+ readonly id: Schema.String;
142
+ readonly change: Schema.Literals<readonly ["user_changed_number", "user_changed_user_id"]>;
143
+ readonly userId: Schema.optionalKey<Schema.String>;
144
+ readonly previousUserId: Schema.optionalKey<Schema.String>;
145
+ readonly phone: Schema.optionalKey<Schema.String>;
146
+ readonly previousPhone: Schema.optionalKey<Schema.String>;
147
+ readonly timestamp: Schema.optionalKey<Schema.DateTimeUtc>;
148
+ readonly raw: Schema.Codec<Schema.Json, Schema.Json, never, never>;
149
+ }>, Schema.TaggedStruct<"Alias", {
150
+ readonly thread: Schema.Struct<{
151
+ readonly platform: Schema.String;
152
+ readonly id: Schema.String;
153
+ }>;
154
+ readonly phone: Schema.String;
155
+ readonly userId: Schema.String;
156
+ readonly messageId: Schema.String;
157
+ readonly status: Schema.Literals<readonly ["sent", "delivered", "read"]>;
158
+ readonly raw: Schema.Codec<Schema.Json, Schema.Json, never, never>;
159
+ }>]>;
160
+ /**
161
+ * Any update.
162
+ *
163
+ * @stability unstable
164
+ * @category models
165
+ * @since 4.1.5
166
+ */
167
+ export type WhatsAppUpdate = typeof WhatsAppUpdate.Type;
168
+ //# sourceMappingURL=WhatsAppUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WhatsAppUpdate.d.ts","sourceRoot":"","sources":["../src/WhatsAppUpdate.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;EASjB,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;EAUxB,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;EAOhB,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA+C,CAAA;AAE1E;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * What WhatsApp reports beside messages: delivery statuses, a user's changed
3
+ * id, and the link between a phone number and a business-scoped user id.
4
+ * They go to the `onUpdate` of `WhatsAppChat.layerWebhook` and
5
+ * `WhatsAppChat.receive`, not to the `ChatHandler`.
6
+ *
7
+ * @stability unstable
8
+ * @since 4.1.5
9
+ */
10
+ import { ChatErrorReason } from "effect/chat/ChatError";
11
+ import { ChatThread } from "effect/chat/ChatThread";
12
+ import * as Schema from "effect/Schema";
13
+ /**
14
+ * Schema for the status of a message the business sent.
15
+ *
16
+ * **Details**
17
+ *
18
+ * - `thread` is the recipient's address, with the business-scoped user id
19
+ * when the status carries one and the phone number when it does not.
20
+ * - `messageId` is the id `post` gave. A `failed` status has the
21
+ * `reason` for Meta's error, mapped as a refused call is.
22
+ * - `phone` and `userId` are the recipient's phone number and
23
+ * business-scoped user id, each when the status carries it.
24
+ * - `raw` is the change's `metadata` and the one status.
25
+ *
26
+ * @stability unstable
27
+ * @category schemas
28
+ * @since 4.1.5
29
+ */
30
+ export const Status = /*#__PURE__*/Schema.TaggedStruct("Status", {
31
+ thread: ChatThread,
32
+ messageId: Schema.String,
33
+ status: /*#__PURE__*/Schema.Literals(["sent", "delivered", "read", "failed"]),
34
+ timestamp: /*#__PURE__*/Schema.optionalKey(Schema.DateTimeUtc),
35
+ reason: /*#__PURE__*/Schema.optionalKey(ChatErrorReason),
36
+ phone: /*#__PURE__*/Schema.optionalKey(Schema.String),
37
+ userId: /*#__PURE__*/Schema.optionalKey(Schema.String),
38
+ raw: Schema.Json
39
+ });
40
+ /**
41
+ * Schema for a user's changed phone number or business-scoped user id, from
42
+ * a `system` message.
43
+ *
44
+ * **Details**
45
+ *
46
+ * - `thread` is the user's new address. A thread kept under the old one no
47
+ * longer receives messages from the user.
48
+ * - `id` is the system message's id. `change` is Meta's `type`:
49
+ * `user_changed_number` or `user_changed_user_id`.
50
+ * - `userId`, `previousUserId` and `phone` are there when Meta sends
51
+ * them. `previousPhone` is the system message's `from`.
52
+ *
53
+ * @stability unstable
54
+ * @category schemas
55
+ * @since 4.1.5
56
+ */
57
+ export const UserIdChanged = /*#__PURE__*/Schema.TaggedStruct("UserIdChanged", {
58
+ thread: ChatThread,
59
+ id: Schema.String,
60
+ change: /*#__PURE__*/Schema.Literals(["user_changed_number", "user_changed_user_id"]),
61
+ userId: /*#__PURE__*/Schema.optionalKey(Schema.String),
62
+ previousUserId: /*#__PURE__*/Schema.optionalKey(Schema.String),
63
+ phone: /*#__PURE__*/Schema.optionalKey(Schema.String),
64
+ previousPhone: /*#__PURE__*/Schema.optionalKey(Schema.String),
65
+ timestamp: /*#__PURE__*/Schema.optionalKey(Schema.DateTimeUtc),
66
+ raw: Schema.Json
67
+ });
68
+ /**
69
+ * Schema for a phone number and a business-scoped user id that name one
70
+ * user.
71
+ *
72
+ * **Details**
73
+ *
74
+ * - Given for every `sent`, `delivered` or `read` status that carries
75
+ * both, beside the `Status`. Nothing is remembered between batches, so the
76
+ * same pair comes again and again.
77
+ * - A message posted to a phone number address reports back with the
78
+ * user's business-scoped id, which is how a consumer learns that the
79
+ * inbound address (`thread`, always the business-scoped form) and the
80
+ * phone number address are one user. The adapter never rewrites an
81
+ * address.
82
+ *
83
+ * @stability unstable
84
+ * @category schemas
85
+ * @since 4.1.5
86
+ */
87
+ export const Alias = /*#__PURE__*/Schema.TaggedStruct("Alias", {
88
+ thread: ChatThread,
89
+ phone: Schema.String,
90
+ userId: Schema.String,
91
+ messageId: Schema.String,
92
+ status: /*#__PURE__*/Schema.Literals(["sent", "delivered", "read"]),
93
+ raw: Schema.Json
94
+ });
95
+ /**
96
+ * Schema for any update.
97
+ *
98
+ * @stability unstable
99
+ * @category schemas
100
+ * @since 4.1.5
101
+ */
102
+ export const WhatsAppUpdate = /*#__PURE__*/Schema.Union([Status, UserIdChanged, Alias]);
103
+ //# sourceMappingURL=WhatsAppUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WhatsAppUpdate.js","names":[],"sources":["../src/WhatsAppUpdate.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,SAAS,eAAe,QAAQ,uBAAuB;AACvD,SAAS,UAAU,QAAQ,wBAAwB;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe;AAEvC;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAM,MAAM,gBAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE;EAClD,MAAM,EAAE,UAAU;EAClB,SAAS,EAAE,MAAM,CAAC,MAAM;EACxB,MAAM,eAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;EAChE,SAAS,eAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;EACjD,MAAM,eAAE,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC;EAC3C,KAAK,eAAE,MAAM,CAAC,WAAW,CAA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
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @stability unstable
3
+ * @since 4.1.5
4
+ */
5
+ /**
6
+ * @stability unstable
7
+ * @since 4.1.5
8
+ */
9
+ export * as WhatsAppChat from "./WhatsAppChat.ts";
10
+ /**
11
+ * @stability unstable
12
+ * @since 4.1.5
13
+ */
14
+ export * as WhatsAppGraphApi from "./WhatsAppGraphApi.ts";
15
+ /**
16
+ * @stability unstable
17
+ * @since 4.1.5
18
+ */
19
+ export * as WhatsAppUpdate from "./WhatsAppUpdate.ts";
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;GAGG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD;;;GAGG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @stability unstable
3
+ * @since 4.1.5
4
+ */
5
+ // @barrel: Auto-generated exports. Do not edit manually.
6
+ /**
7
+ * @stability unstable
8
+ * @since 4.1.5
9
+ */
10
+ export * as WhatsAppChat from "./WhatsAppChat.js";
11
+ /**
12
+ * @stability unstable
13
+ * @since 4.1.5
14
+ */
15
+ export * as WhatsAppGraphApi from "./WhatsAppGraphApi.js";
16
+ /**
17
+ * @stability unstable
18
+ * @since 4.1.5
19
+ */
20
+ export * as WhatsAppUpdate from "./WhatsAppUpdate.js";
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAKA;AAEA;;;;AAIA,OAAO,KAAK,YAAY,MAAM,mBAAmB;AAEjD;;;;AAIA,OAAO,KAAK,gBAAgB,MAAM,uBAAuB;AAEzD;;;;AAIA,OAAO,KAAK,cAAc,MAAM,qBAAqB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/internal/actions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,224 @@
1
+ import { InvalidRequest, TooLarge } from "effect/chat/ChatError";
2
+ import { defaultButtonsSection, defaultListButton } from "./options.js";
3
+ import { shortBodyLength, utf8Bytes } from "./text.js";
4
+ /** Between an element's id and its value in a wire id. @internal */
5
+ export const join = "\u241F";
6
+ /** @internal */
7
+ export const limits = {
8
+ actionsPerMessage: 10,
9
+ actionDataLength: 198
10
+ };
11
+ /** Meta counts a reply button's id in UTF-8 bytes, unlike every other limit. */
12
+ const replyIdBytes = 256;
13
+ const replyLabelLength = 20;
14
+ const rowTitleLength = 24;
15
+ const listButtonLength = 20;
16
+ const sectionTitleLength = 24;
17
+ const maxRows = 10;
18
+ /** What the measure adds for a layout whose body is held to 1,024 rather than 4,096. @internal */
19
+ export const shortBodyOffset = 4096 - shortBodyLength;
20
+ /** The layout of a message's actions, which depends on the actions alone. @internal */
21
+ export const shape = actions => {
22
+ const buttons = actions.filter(action => action._tag === "Button");
23
+ const links = actions.filter(action => action._tag === "LinkButton");
24
+ const selects = actions.filter(action => action._tag === "Select");
25
+ if (buttons.length === 0 && selects.length === 0) {
26
+ return links.length === 1 && links[0].label.length <= replyLabelLength ? {
27
+ kind: "cta",
28
+ appended: []
29
+ } : {
30
+ kind: "none",
31
+ appended: links
32
+ };
33
+ }
34
+ const reply = selects.length === 0 && buttons.length <= 3 && buttons.every(button => button.label.length <= replyLabelLength);
35
+ return {
36
+ kind: reply ? "reply" : "list",
37
+ appended: links
38
+ };
39
+ };
40
+ /** The body of a post with actions and no Markdown: the labels joined by ", ". @internal */
41
+ export const generatedBody = actions => actions.map(action => action._tag === "Select" ? action.placeholder ?? action.options.map(option => option.label).join(", ") : action.label).join(", ");
42
+ /** @internal */
43
+ export const linkLines = links => links.map(link => link.label + ": " + link.url).join("\n");
44
+ /**
45
+ * What a message's actions add to the measure of its Markdown: the offset of
46
+ * a 1,024 body, the appended link lines with their separator, and the
47
+ * generated body, which is always counted.
48
+ *
49
+ * @internal
50
+ */
51
+ export const measure = actions => {
52
+ if (actions.length === 0) return 0;
53
+ const {
54
+ appended,
55
+ kind
56
+ } = shape(actions);
57
+ return (kind === "reply" || kind === "cta" ? shortBodyOffset : 0) + generatedBody(actions).length + (appended.length === 0 ? 0 : 2 + linkLines(appended).length);
58
+ };
59
+ /** The body as sent: the rendered Markdown, or the generated body, then the link lines. @internal */
60
+ export const body = (rendered, actions) => {
61
+ const {
62
+ appended,
63
+ kind
64
+ } = shape(actions);
65
+ const base = rendered.trim() !== "" ? rendered : kind === "none" ? "" : generatedBody(actions);
66
+ const lines = linkLines(appended);
67
+ return base === "" ? lines : lines === "" ? base : base + "\n\n" + lines;
68
+ };
69
+ /** @internal */
70
+ export const buttonWireId = button => "b" + button.id + (button.value === undefined ? "" : join + button.value);
71
+ /** @internal */
72
+ export const optionWireId = (select, value) => "s" + select.id + join + value;
73
+ /** A wire id read back: the tag, then the id and value split at the first U+241F. @internal */
74
+ export const parseWireId = wire => {
75
+ const rest = wire.slice(1);
76
+ const at = rest.indexOf(join);
77
+ if (wire[0] === "b") {
78
+ return at < 0 ? {
79
+ kind: "button",
80
+ id: rest
81
+ } : {
82
+ kind: "button",
83
+ id: rest.slice(0, at),
84
+ value: rest.slice(at + 1)
85
+ };
86
+ }
87
+ if (wire[0] === "s" && at >= 0) return {
88
+ kind: "select",
89
+ id: rest.slice(0, at),
90
+ value: rest.slice(at + 1)
91
+ };
92
+ return undefined;
93
+ };
94
+ const tooLarge = detail => new TooLarge({
95
+ detail
96
+ });
97
+ const invalid = detail => new InvalidRequest({
98
+ detail
99
+ });
100
+ /**
101
+ * Checks a message's actions and builds their `interactive` object. Every
102
+ * refusal is found here, before any call.
103
+ *
104
+ * @internal
105
+ */
106
+ export const plan = (actions, options) => {
107
+ if (actions.length === 0) return {
108
+ kind: "none"
109
+ };
110
+ if (actions.length > limits.actionsPerMessage) return tooLarge("too_many_actions");
111
+ for (const action of actions) {
112
+ if (action._tag === "LinkButton") {
113
+ if (action.label.length > rowTitleLength) return tooLarge("label_too_long");
114
+ continue;
115
+ }
116
+ if (action.id.includes(join)) return invalid("invalid_action_id");
117
+ if (action._tag === "Button") {
118
+ if (action.id.length + (action.value?.length ?? 0) > limits.actionDataLength) {
119
+ return tooLarge("action_data_too_long");
120
+ }
121
+ } else {
122
+ if (action.options.length === 0) return invalid("empty_select");
123
+ for (const option of action.options) {
124
+ if (action.id.length + option.value.length > limits.actionDataLength) return tooLarge("action_data_too_long");
125
+ }
126
+ }
127
+ }
128
+ const {
129
+ kind
130
+ } = shape(actions);
131
+ const buttons = actions.filter(action => action._tag === "Button");
132
+ const selects = actions.filter(action => action._tag === "Select");
133
+ const unique = ids => new Set(ids).size === ids.length;
134
+ switch (kind) {
135
+ case "none":
136
+ return {
137
+ kind
138
+ };
139
+ case "cta":
140
+ {
141
+ const link = actions.find(action => action._tag === "LinkButton");
142
+ return {
143
+ kind,
144
+ interactive: {
145
+ type: "cta_url",
146
+ action: {
147
+ name: "cta_url",
148
+ parameters: {
149
+ display_text: link.label,
150
+ url: link.url
151
+ }
152
+ }
153
+ }
154
+ };
155
+ }
156
+ case "reply":
157
+ {
158
+ const ids = buttons.map(buttonWireId);
159
+ if (!unique(buttons.map(button => button.label))) return invalid("duplicate_label");
160
+ if (!unique(ids)) return invalid("duplicate_id");
161
+ if (ids.some(id => utf8Bytes(id) > replyIdBytes)) return tooLarge("action_data_too_long");
162
+ return {
163
+ kind,
164
+ interactive: {
165
+ type: "button",
166
+ action: {
167
+ buttons: buttons.map((button, i) => ({
168
+ type: "reply",
169
+ reply: {
170
+ id: ids[i],
171
+ title: button.label
172
+ }
173
+ }))
174
+ }
175
+ }
176
+ };
177
+ }
178
+ case "list":
179
+ {
180
+ const sections = [];
181
+ const listButton = options.listButton ?? defaultListButton;
182
+ if (buttons.length > 0) {
183
+ sections.push({
184
+ title: options.buttonsSection ?? defaultButtonsSection,
185
+ rows: buttons.map(button => ({
186
+ id: buttonWireId(button),
187
+ title: button.label
188
+ }))
189
+ });
190
+ }
191
+ for (const select of selects) {
192
+ sections.push({
193
+ title: select.placeholder ?? listButton,
194
+ rows: select.options.map(option => ({
195
+ id: optionWireId(select, option.value),
196
+ title: option.label
197
+ }))
198
+ });
199
+ }
200
+ const rows = sections.flatMap(section => section.rows);
201
+ if (rows.length > maxRows) return tooLarge("list_rows");
202
+ if (rows.some(row => row.title.length > rowTitleLength)) return tooLarge("label_too_long");
203
+ if (!unique(rows.map(row => row.id))) return invalid("duplicate_id");
204
+ const opener = selects.find(select => select.placeholder !== undefined)?.placeholder ?? listButton;
205
+ if (opener.length > listButtonLength) return tooLarge("label_too_long");
206
+ if (sections.length > 1 && sections.some(section => section.title.length > sectionTitleLength)) {
207
+ return tooLarge("label_too_long");
208
+ }
209
+ return {
210
+ kind,
211
+ interactive: {
212
+ type: "list",
213
+ action: {
214
+ button: opener,
215
+ sections: sections.map(section => sections.length > 1 ? section : {
216
+ rows: section.rows
217
+ })
218
+ }
219
+ }
220
+ };
221
+ }
222
+ }
223
+ };
224
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","names":[],"sources":["../../src/internal/actions.ts"],"sourcesContent":[null],"mappings":"AAAA,SAA+B,cAAc,EAAE,QAAQ,QAAQ,uBAAuB;AAGtF,SAAS,qBAAqB,EAAE,iBAAiB,QAAQ,cAAc;AACvE,SAAS,eAAe,EAAE,SAAS,QAAQ,WAAW;AAEtD;AACA,OAAO,MAAM,IAAI,GAAG,QAAQ;AAE5B;AACA,OAAO,MAAM,MAAM,GAAG;EAAE,iBAAiB,EAAE,EAAE;EAAE,gBAAgB,EAAE;AAAG,CAAW;AAE/E;AACA,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