@segmentstream/ontology 0.139.0 → 0.139.2

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.139.2
4
+
5
+ A webhook, the guests' bot check or a workspace channel that moves from a workspace secret to a
6
+ verification value of its connection keeps its value: the deploy that makes the change moves the
7
+ secret's value into the connection without reading it, so nobody pastes it again. `check`'s
8
+ `named-secret-deprecated` warning says so, and the guests' `botCheck.secret` now works until
9
+ 2027-01-19, like every other form that names a workspace secret. `segmentstream deploy` and
10
+ `segmentstream secret list` print `notice[named_secret]` for each place the production deployment
11
+ still reads a workspace secret by name, with the change to make.
12
+
13
+ Action required: a webhook's `signature.secret` or `verification.verifyToken`, the guests'
14
+ `botCheck.secret` and a workspace channel's `channels.<name>.secret` stop working after
15
+ 2027-01-19. Make the change each `notice[named_secret]` names: declare the value on the
16
+ connection (`verification={...}`, or `TurnstileConnection(key="turnstile")` for the bot check),
17
+ name it with `input`, change every place that names the same secret in one commit, and deploy.
18
+ That deploy moves the value; do not ask anyone to paste it, and do not delete the workspace secret.
19
+
20
+ ## 0.139.1
21
+
22
+ A WhatsApp message Meta accepts and later reports it could not deliver, in a `failed` delivery
23
+ status, now reads `failed`: a replay of its idempotency key fails with `keyConsumed` and the
24
+ `refusal` Meta's code names, and the chat's history shows the message failed. The platform reads
25
+ these statuses; this release shares the ontology's WhatsApp refusal codes with it.
26
+
3
27
  ## 0.139.0
4
28
 
5
29
  The inbox takes `attribution`: `inbox: { roles: [client], attribution: "none" }` sends a member's
package/README.md CHANGED
@@ -1585,8 +1585,9 @@ renders it. The body is at most 4096 characters, and `reply_to` is refused. Meta
1585
1585
  free-form text only inside the 24-hour customer-service window: a post outside it fails with
1586
1586
  Meta's code 131047 and consumes the key. Any Meta refusal with an error code does the same; a
1587
1587
  timeout, a 5xx or an answer naming no message is `uncertain`. The receipt's `message_id` is the
1588
- `wamid…` Meta accepted; it has no URL, and a failure Meta reports later in delivery statuses does
1589
- not change it.
1588
+ `wamid…` Meta accepted; it has no URL. A failure Meta reports later in delivery statuses makes the
1589
+ receipt read `failed`: a replay of the key then fails with `keyConsumed` and the `refusal` Meta's
1590
+ code names.
1590
1591
 
1591
1592
  `chat` names the agent's channels as its `channels` does. A channel not named after its kind,
1592
1593
  such as a second number, says its kind: `chat: { sales_whatsapp: { kind: "whatsapp", connection:
package/dist/analyze.js CHANGED
@@ -770,7 +770,13 @@ function resolveWorkflows(input) {
770
770
  /** @legacy ontology.webhook-named-secrets: the last day a webhook reads a workspace secret. */
771
771
  const WEBHOOK_NAMED_SECRETS_END = "2027-01-19";
772
772
  /** @legacy ontology.guest-bot-check-secret: the last day the bot check reads a workspace secret. */
773
- const GUEST_BOT_CHECK_SECRET_ENDS = "2026-12-21";
773
+ const GUEST_BOT_CHECK_SECRET_ENDS = "2027-01-19";
774
+ /**
775
+ * @legacy ontology.webhook-named-secrets: the deploy that replaces a named secret with a connection
776
+ * value moves the secret's value into it.
777
+ */
778
+ const MOVED_AT_DEPLOY = "The deploy that makes this change moves the secret's value into the connection, so nobody " +
779
+ "enters it again: change every place that names the secret in that deploy.";
774
780
  let deliveryJsonSchema;
775
781
  /**
776
782
  * The JSON Schema of `webhookDelivery`, the input every webhook-started workflow declares, as the
@@ -841,7 +847,8 @@ function resolveWebhookTrigger(trigger, at, scope) {
841
847
  for (const path of named) {
842
848
  report("named-secret-deprecated", path, `a workspace secret works for a webhook only until ${WEBHOOK_NAMED_SECRETS_END}: declare ` +
843
849
  "it as a verification value of the webhook's connection, " +
844
- 'verification={"webhook_signing_secret": Secret(...)}, and name it with input.', "warning");
850
+ 'verification={"webhook_signing_secret": Secret(...)}, and name it with input. ' +
851
+ MOVED_AT_DEPLOY, "warning");
845
852
  }
846
853
  }
847
854
  const headers = trigger.headers;
@@ -1893,7 +1900,8 @@ function guestBotCheck(value, report, connections) {
1893
1900
  valid = false;
1894
1901
  }
1895
1902
  if (valid) {
1896
- report("named-secret-deprecated", "guest.botCheck.secret", `a workspace secret works as the bot check's secret key only until ${GUEST_BOT_CHECK_SECRET_ENDS}. ${shape}`, "warning");
1903
+ report("named-secret-deprecated", "guest.botCheck.secret", `a workspace secret works as the bot check's secret key only until ` +
1904
+ `${GUEST_BOT_CHECK_SECRET_ENDS}. ${shape} ${MOVED_AT_DEPLOY}`, "warning");
1897
1905
  }
1898
1906
  return valid && typeof secret === "string"
1899
1907
  ? { scheme: scheme, secret }
@@ -0,0 +1,10 @@
1
+ import type { ChatRefusal } from "./provider.js";
2
+ /**
3
+ * Meta's refusals that code acts on: 131047, the person last wrote more than 24 hours ago, so only a
4
+ * template reaches them; 131026, the message cannot be delivered to the number; 131050, the person
5
+ * stopped marketing messages. Meta answers them when it refuses a message, or reports them later in
6
+ * a `failed` delivery status of a message it accepted.
7
+ */
8
+ export declare const REFUSALS: Readonly<Record<number, ChatRefusal>>;
9
+ /** The id Meta gives an accepted message, which its delivery statuses name. */
10
+ export declare const WAMID: RegExp;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Meta's refusals that code acts on: 131047, the person last wrote more than 24 hours ago, so only a
3
+ * template reaches them; 131026, the message cannot be delivered to the number; 131050, the person
4
+ * stopped marketing messages. Meta answers them when it refuses a message, or reports them later in
5
+ * a `failed` delivery status of a message it accepted.
6
+ */
7
+ export const REFUSALS = {
8
+ 131047: "outside_reply_window",
9
+ 131026: "recipient_unreachable",
10
+ 131050: "recipient_opted_out",
11
+ };
12
+ /** The id Meta gives an accepted message, which its delivery statuses name. */
13
+ export const WAMID = /^wamid\.[A-Za-z0-9+/=_-]{1,512}$/;
@@ -1,21 +1,10 @@
1
1
  import { Effect } from "effect";
2
2
  import { renderWhatsApp, WHATSAPP_MESSAGE_LIMIT } from "../../../whatsapp.js";
3
3
  import { whatsappTemplate } from "./whatsapp-template.js";
4
+ import { REFUSALS, WAMID } from "./whatsapp-refusals.js";
4
5
  import { record, transportFailure, } from "./provider.js";
5
6
  /** A WhatsApp id: the member's number, digits only. */
6
7
  const WA_ID = /^[1-9][0-9]{5,19}$/;
7
- /**
8
- * Meta's refusals that code acts on: 131047, the person last wrote more than 24 hours ago, so only a
9
- * template reaches them; 131026, the message cannot be delivered to the number; 131050, the person
10
- * stopped marketing messages.
11
- */
12
- const REFUSALS = {
13
- 131047: "outside_reply_window",
14
- 131026: "recipient_unreachable",
15
- 131050: "recipient_opted_out",
16
- };
17
- /** The id Meta gives an accepted message. */
18
- const WAMID = /^wamid\.[A-Za-z0-9+/=_-]{1,512}$/;
19
8
  /**
20
9
  * One text message from the workspace's number, `POST /phone/messages` on the connection's
21
10
  * `graph` API, never retried. A Graph refusal with an error code, such as 131047 outside the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.139.0",
3
+ "version": "0.139.2",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",