@zernio/node 0.2.1834 → 0.2.1836

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/index.js CHANGED
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
36
36
  // package.json
37
37
  var package_default = {
38
38
  name: "@zernio/node",
39
- version: "0.2.1834",
39
+ version: "0.2.1836",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@zernio/node",
8
- version: "0.2.1834",
8
+ version: "0.2.1836",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.1834",
3
+ "version": "0.2.1836",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -14913,6 +14913,10 @@ export const listAutomations = <ThrowOnError extends boolean = false>(options?:
14913
14913
  * - **Comment to DM**: a comment door in `trigger.type`, such as `comment.keyword`, with a `graph` of the shapes `/v1/comment-automations` holds. It is on unless `status` is `paused`, and needs what `/v1/comment-automations` needs. A post that already has an active automation is a 409.
14914
14914
  * - **Flow** (`kind` is `workflow`): a flow trigger such as `inbound_message` (or a `graph` whose trigger node names it) on one account, with the builder's `graph`. It is a draft unless `status` is `active`, which needs a complete graph; `paused` is refused. It needs the inbox add-on and a full-access key.
14915
14915
  *
14916
+ * An ad rule, event, scheduled automation or sequence can instead be sent as `name`, `status` and an automation `graph` (`AutomationGraph`, the one its response carries). The graph's trigger picks the kind, and it is saved exactly as its own shape would be.
14917
+ *
14918
+ * A comment to DM or flow sent as an automation graph is refused (`not_supported`).
14919
+ *
14916
14920
  * Everything an automation cannot hold is refused at once: the 400 lists every problem with its JSON path in `details.problems`.
14917
14921
  *
14918
14922
  */
@@ -4610,12 +4610,16 @@ export type adPersonalization = 'granted' | 'denied' | 'unspecified';
4610
4610
 
4611
4611
  export type Automation = (AdRuleAutomationDefinition & AutomationRecord & {
4612
4612
  kind?: "ad_rule";
4613
+ graph?: AutomationGraph;
4613
4614
  }) | (EventAutomationDefinition & AutomationRecord & {
4614
4615
  kind?: "event";
4616
+ graph?: AutomationGraph;
4615
4617
  }) | (ScheduledAutomationDefinition & AutomationRecord & {
4616
4618
  kind?: "scheduled";
4619
+ graph?: AutomationGraph;
4617
4620
  }) | (SequenceAutomationDefinition & AutomationRecord & {
4618
4621
  kind?: "sequence";
4622
+ graph?: AutomationGraph;
4619
4623
  /**
4620
4624
  * The account's platform. On `whatsapp` every step sends a template.
4621
4625
  */
@@ -5211,6 +5215,56 @@ export type AutomationFactResult = {
5211
5215
  met?: boolean;
5212
5216
  };
5213
5217
 
5218
+ /**
5219
+ * An automation's definition as one graph: the trigger that starts it, the nodes its runs walk from `entry` along `edges`, and its guardrails. Ad rules, event and scheduled automations and sequences run their nodes in one chain, a condition first where the kind has one.
5220
+ */
5221
+ export type AutomationGraph = {
5222
+ /**
5223
+ * One trigger. Its `type` is the kind's `trigger.type`; `config` holds the rest of the trigger, and `subjects` for a schedule.
5224
+ */
5225
+ triggers: Array<{
5226
+ type: string;
5227
+ config: {
5228
+ [key: string]: unknown;
5229
+ };
5230
+ entry?: Array<(string)>;
5231
+ }>;
5232
+ nodes: Array<{
5233
+ id: string;
5234
+ /**
5235
+ * A step type such as `notify.send`, `messages.send`, `delay` or `condition`.
5236
+ */
5237
+ type: string;
5238
+ config: {
5239
+ [key: string]: unknown;
5240
+ };
5241
+ position?: {
5242
+ x: number;
5243
+ y: number;
5244
+ };
5245
+ label?: string;
5246
+ }>;
5247
+ edges: Array<{
5248
+ id: string;
5249
+ source: string;
5250
+ target: string;
5251
+ /**
5252
+ * Null when followed whatever the step's outcome; `matched` after a condition.
5253
+ */
5254
+ sourceHandle: (string) | null;
5255
+ }>;
5256
+ /**
5257
+ * The node runs start at.
5258
+ */
5259
+ entry: Array<(string)>;
5260
+ limits: {
5261
+ cooldown?: string;
5262
+ maxChangesPerDay?: number;
5263
+ maxChangesPerObject?: number;
5264
+ stopOn?: Array<('reply' | 'unsubscribe')>;
5265
+ };
5266
+ };
5267
+
5214
5268
  /**
5215
5269
  * An ad rule's limits.
5216
5270
  */
@@ -15905,6 +15959,19 @@ export type GoogleTargetImpressionShare = {
15905
15959
 
15906
15960
  export type location = 'ANYWHERE_ON_PAGE' | 'TOP_OF_PAGE' | 'ABSOLUTE_TOP_OF_PAGE';
15907
15961
 
15962
+ /**
15963
+ * An ad rule, event or scheduled automation or sequence sent as an automation graph. It is saved as its own shape would be.
15964
+ */
15965
+ export type GraphAutomationDefinition = {
15966
+ name: string;
15967
+ /**
15968
+ * Sequences.
15969
+ */
15970
+ description?: string;
15971
+ status?: 'draft' | 'active' | 'paused';
15972
+ graph: AutomationGraph;
15973
+ };
15974
+
15908
15975
  export type HubSpotContactProperty = {
15909
15976
  /**
15910
15977
  * Internal property name.
@@ -29919,7 +29986,13 @@ export type WebhookPayloadMessageSent = {
29919
29986
  * Do not read these to name or update a contact: doing so on an echo
29920
29987
  * relabels the customer's record with your business name. The other
29921
29988
  * party is `conversation.participantId` / `participantName` /
29922
- * `participantUsername`, which are populated in both directions.
29989
+ * `participantUsername`.
29990
+ *
29991
+ * `participantId` is always set. On a thread the business started,
29992
+ * `participantUsername` and `participantName` can be empty on the
29993
+ * first events; Zernio fills them shortly after when Meta returns the
29994
+ * contact (`participantName` then holds the @username until the
29995
+ * contact writes and their profile is read).
29923
29996
  *
29924
29997
  */
29925
29998
  sender: {
@@ -68024,7 +68097,7 @@ export type ListAutomationsResponse = ({
68024
68097
  export type ListAutomationsError = (ErrorResponse);
68025
68098
 
68026
68099
  export type CreateAutomationData = {
68027
- body: AutomationDefinition;
68100
+ body: (AutomationDefinition | GraphAutomationDefinition);
68028
68101
  headers?: {
68029
68102
  /**
68030
68103
  * Optional client-generated unique key (e.g. a UUID) that makes retries safe.
@@ -68366,7 +68439,7 @@ export type UpdateAutomationData = {
68366
68439
  [key: string]: unknown;
68367
68440
  }>;
68368
68441
  /**
68369
- * Comment to DM and flows: the whole graph, as read.
68442
+ * Comment to DM and flows: the whole graph, as read. Ad rules, event and scheduled automations and sequences: an `AutomationGraph` that replaces the whole definition, sent without `trigger`, `subjects`, `filter`, `conditions`, `alert`, `steps` or `limits`.
68370
68443
  */
68371
68444
  graph?: {
68372
68445
  [key: string]: unknown;