@hermeticacomms/sdk-node 0.1.0 → 0.4.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.
Files changed (43) hide show
  1. package/dist/contracts/auth.d.ts +10 -6
  2. package/dist/contracts/auth.js +14 -5
  3. package/dist/contracts/billing.d.ts +2 -0
  4. package/dist/contracts/billing.js +2 -1
  5. package/dist/contracts/campaigns.d.ts +6 -9
  6. package/dist/contracts/campaigns.js +9 -2
  7. package/dist/contracts/consent.d.ts +24 -0
  8. package/dist/contracts/consent.js +15 -1
  9. package/dist/contracts/content-blocks.d.ts +1 -0
  10. package/dist/contracts/content-blocks.js +5 -3
  11. package/dist/contracts/content-library.d.ts +8 -0
  12. package/dist/contracts/content-library.js +3 -1
  13. package/dist/contracts/content.d.ts +6 -0
  14. package/dist/contracts/content.js +5 -3
  15. package/dist/contracts/delivery.d.ts +3 -0
  16. package/dist/contracts/delivery.js +6 -0
  17. package/dist/contracts/events.d.ts +2 -1
  18. package/dist/contracts/events.js +4 -2
  19. package/dist/contracts/experiments.d.ts +4 -2
  20. package/dist/contracts/experiments.js +7 -3
  21. package/dist/contracts/identity.d.ts +6 -1
  22. package/dist/contracts/identity.js +5 -4
  23. package/dist/contracts/integrations.d.ts +66 -2
  24. package/dist/contracts/integrations.js +32 -5
  25. package/dist/contracts/metrics.d.ts +6 -1
  26. package/dist/contracts/metrics.js +8 -2
  27. package/dist/contracts/outbound.d.ts +25 -0
  28. package/dist/contracts/outbound.js +14 -5
  29. package/dist/contracts/pickers.d.ts +1 -1
  30. package/dist/contracts/pickers.js +1 -1
  31. package/dist/contracts/platform-admin.d.ts +14 -0
  32. package/dist/contracts/platform-admin.js +7 -0
  33. package/dist/contracts/segments.d.ts +5 -0
  34. package/dist/contracts/segments.js +8 -3
  35. package/dist/contracts/workflow-nodes.d.ts +12 -0
  36. package/dist/contracts/workflow-nodes.js +5 -0
  37. package/dist/contracts/workflows.d.ts +398 -0
  38. package/dist/contracts/workflows.js +11 -2
  39. package/dist/index.d.ts +126 -2
  40. package/dist/resources.d.ts +20 -0
  41. package/dist/x10.d.ts +1 -0
  42. package/dist/z10.d.ts +5 -0
  43. package/package.json +1 -1
@@ -63,6 +63,13 @@ export const OAuthTokenBody = z.object({
63
63
  export const OAuthTokenResult = z.object({
64
64
  access_token: z.string(), token_type: z.literal('Bearer'), expires_in: z.number().int(), refresh_token: z.string(), scope: z.string(),
65
65
  });
66
+ /** RFC 8414 authorization server metadata (`/.well-known/oauth-authorization-server`). */
67
+ export const OAuthServerMetadata = z.object({
68
+ issuer: z.string(), authorization_endpoint: z.string(), token_endpoint: z.string(), revocation_endpoint: z.string(),
69
+ scopes_supported: z.array(z.string()), response_types_supported: z.array(z.string()), grant_types_supported: z.array(z.string()),
70
+ code_challenge_methods_supported: z.array(z.string()), token_endpoint_auth_methods_supported: z.array(z.string()),
71
+ revocation_endpoint_auth_methods_supported: z.array(z.string()), service_documentation: z.string(),
72
+ });
66
73
  export const OAuthRevokeBody = z.object({ token: z.string().min(1).max(200), client_id: z.string().min(1).max(100), client_secret: z.string().max(200).optional() });
67
74
  export const AuthorizedAppDto = z.object({
68
75
  clientId: z.string(), name: z.string(), scopes: z.array(z.string()), grantedBy: Id, grantedAt: Timestamp, lastUsedAt: Timestamp.nullable(),
@@ -2866,6 +2866,7 @@ export declare const SegmentDto: z.ZodObject<{
2866
2866
  version: z.ZodNumber;
2867
2867
  subject: z.ZodString;
2868
2868
  starred: z.ZodBoolean;
2869
+ app: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2869
2870
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
2870
2871
  createdAt: z.ZodISODateTime;
2871
2872
  updatedAt: z.ZodISODateTime;
@@ -2892,6 +2893,7 @@ export declare const SegmentPage: z.ZodObject<{
2892
2893
  version: z.ZodNumber;
2893
2894
  subject: z.ZodString;
2894
2895
  starred: z.ZodBoolean;
2896
+ app: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2895
2897
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
2896
2898
  createdAt: z.ZodISODateTime;
2897
2899
  updatedAt: z.ZodISODateTime;
@@ -2908,6 +2910,7 @@ export declare const CreateSegmentBody: z.ZodObject<{
2908
2910
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
2909
2911
  subject: z.ZodOptional<z.ZodString>;
2910
2912
  starred: z.ZodOptional<z.ZodBoolean>;
2913
+ app: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2911
2914
  }, z.core.$strip>;
2912
2915
  export declare const UpdateSegmentBody: z.ZodObject<{
2913
2916
  name: z.ZodOptional<z.ZodString>;
@@ -2919,6 +2922,7 @@ export declare const UpdateSegmentBody: z.ZodObject<{
2919
2922
  archived: "archived";
2920
2923
  }>>;
2921
2924
  starred: z.ZodOptional<z.ZodBoolean>;
2925
+ app: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2922
2926
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
2923
2927
  }, z.core.$strip>;
2924
2928
  export declare const SegmentPreviewBody: z.ZodObject<{
@@ -3018,6 +3022,7 @@ export declare const SegmentListQuery: z.ZodObject<{
3018
3022
  false: "false";
3019
3023
  true: "true";
3020
3024
  }>, z.ZodTransform<boolean, "false" | "true">>>;
3025
+ app: z.ZodOptional<z.ZodString>;
3021
3026
  sort: z.ZodOptional<z.ZodEnum<{
3022
3027
  "-created_at": "-created_at";
3023
3028
  "-member_count": "-member_count";
@@ -293,7 +293,8 @@ export const SegmentCondition = z.discriminatedUnion('type', [
293
293
  ]);
294
294
  /** Conditions that test an object instead of a person; only object segments use them, and object segments use only them. */
295
295
  export const OBJECT_CONDITIONS = ['object_property', 'object_linked_profiles'];
296
- const SegmentNodeSchema = z.lazy(() => z.union([SegmentGroupSchema, SegmentCondition]));
296
+ // Recursive schemas carry an `id`: each becomes one OpenAPI component instead of a dangling `$ref`.
297
+ const SegmentNodeSchema = z.lazy(() => z.union([SegmentGroupSchema, SegmentCondition])).meta({ id: 'SegmentNode' });
297
298
  const SegmentGroupSchema = z.lazy(() => z.object({ type: z.literal('group'), op: z.enum(['and', 'or']), negate: z.boolean().optional(), children: z.array(SegmentNodeSchema).max(MAX_SEGMENT_CONDITIONS) }));
298
299
  export const walkConditions = (n, fn) => n.type === 'group' ? n.children.forEach((c) => walkConditions(c, fn)) : fn(n);
299
300
  const depthOf = (n) => (n.type === 'group' ? 1 + Math.max(0, ...n.children.map(depthOf)) : 0);
@@ -322,6 +323,7 @@ export const SegmentDto = z.object({
322
323
  /** `profile`, or the custom object type key the segment selects (an object segment). */
323
324
  subject: z.string(),
324
325
  starred: z.boolean(),
326
+ app: z.string().nullable().optional(),
325
327
  tags: z.array(z.string()).optional(),
326
328
  createdAt: Timestamp,
327
329
  updatedAt: Timestamp,
@@ -332,6 +334,8 @@ export const SegmentSubject = z.string().regex(/^(profile|[a-z][a-z0-9_]{0,62})$
332
334
  export const CreateSegmentBody = z.object({
333
335
  name: z.string().trim().min(1).max(200), description: z.string().max(2000).nullish(), folder: z.string().trim().min(1).max(80).nullish(), definition: SegmentDefinition,
334
336
  tags: z.array(z.string().trim().min(1).max(64)).max(50).optional(), subject: SegmentSubject.optional(), starred: z.boolean().optional(),
337
+ /** Product that owns the segment (null = shared), a label and filter only. */
338
+ app: AppSlug.nullish(),
335
339
  });
336
340
  export const UpdateSegmentBody = z.object({
337
341
  name: z.string().min(1).max(200).optional(),
@@ -340,6 +344,7 @@ export const UpdateSegmentBody = z.object({
340
344
  definition: SegmentDefinition.optional(),
341
345
  status: z.enum(['active', 'archived']).optional(),
342
346
  starred: z.boolean().optional(),
347
+ app: AppSlug.nullish(),
343
348
  tags: z.array(z.string().trim().min(1).max(64)).max(50).optional(),
344
349
  });
345
350
  export const SegmentPreviewBody = z.object({ definition: SegmentDefinition, subject: SegmentSubject.optional() });
@@ -364,7 +369,7 @@ export const MembersQuery = PageQuery.extend({
364
369
  export const SegmentListQuery = PageQuery.extend({
365
370
  q: z.string().max(200).optional(), ids: Csv(100).optional(),
366
371
  createdFrom: Timestamp.optional(), createdTo: Timestamp.optional(), updatedFrom: Timestamp.optional(), updatedTo: Timestamp.optional(),
367
- active: Bool.optional(), starred: Bool.optional(), sort: z.enum(SEGMENT_SORTS).optional(),
372
+ active: Bool.optional(), starred: Bool.optional(), app: AppSlug.optional(), sort: z.enum(SEGMENT_SORTS).optional(),
368
373
  });
369
374
  export const EvaluateResult = z.object({ queued: z.literal(true) });
370
375
  export const SegmentDiffQuery = z.object({ from: z.iso.datetime({ offset: true }).or(z.iso.date()), to: z.iso.datetime({ offset: true }).or(z.iso.date()) });
@@ -375,7 +380,7 @@ const DiffSide = z.object({
375
380
  export const SegmentDiff = z.object({ segmentId: Id, from: Timestamp, to: Timestamp, joined: DiffSide, left: DiffSide });
376
381
  // ---- explain match ------------------------------------------------------------------------------------------------
377
382
  export const SegmentExplainMatchBody = z.object({ definition: SegmentDefinition, profileId: Id });
378
- const SegmentMatchNodeSchema = z.lazy(() => z.object({ kind: z.enum(['group', 'condition']), label: z.string(), matched: z.boolean(), op: z.enum(['and', 'or']).optional(), negated: z.boolean().optional(), children: z.array(SegmentMatchNodeSchema).optional() }));
383
+ const SegmentMatchNodeSchema = z.lazy(() => z.object({ kind: z.enum(['group', 'condition']), label: z.string(), matched: z.boolean(), op: z.enum(['and', 'or']).optional(), negated: z.boolean().optional(), children: z.array(SegmentMatchNodeSchema).optional() })).meta({ id: 'SegmentMatchNode' });
379
384
  export const SegmentExplainMatch = z.object({ segmentId: Id.nullable(), profileId: Id, matched: z.boolean(), member: z.boolean().nullable(), tree: SegmentMatchNodeSchema, evaluatedAt: Timestamp });
380
385
  // ---- builder helpers: suggestions, export -------------------------------------------------------------------------
381
386
  export const SegmentSuggestQuery = z.object({
@@ -2094,6 +2094,18 @@ export declare const WorkflowNode: z.ZodDiscriminatedUnion<[z.ZodObject<{
2094
2094
  y: z.ZodNumber;
2095
2095
  }, z.core.$strip>>;
2096
2096
  name: z.ZodOptional<z.ZodString>;
2097
+ }, z.core.$strip>, z.ZodObject<{
2098
+ id: z.ZodString;
2099
+ type: z.ZodLiteral<"send_social_dm">;
2100
+ config: z.ZodObject<{
2101
+ accountId: z.ZodOptional<z.ZodUUID>;
2102
+ text: z.ZodString;
2103
+ }, z.core.$strip>;
2104
+ position: z.ZodOptional<z.ZodObject<{
2105
+ x: z.ZodNumber;
2106
+ y: z.ZodNumber;
2107
+ }, z.core.$strip>>;
2108
+ name: z.ZodOptional<z.ZodString>;
2097
2109
  }, z.core.$strip>, z.ZodObject<{
2098
2110
  id: z.ZodString;
2099
2111
  type: z.ZodLiteral<"ad_audience">;
@@ -336,6 +336,11 @@ export const WorkflowNode = z.discriminatedUnion('type', [
336
336
  componentKey: z.string().regex(/^[a-z][a-z0-9_]{0,63}$/), fields: z.record(z.string(), z.string().max(2000)).default({}),
337
337
  events: z.array(z.string().regex(/^[a-z][a-z0-9_]{0,63}$/)).min(1).max(10), timeout: Duration.default({ amount: 7, unit: 'days' }),
338
338
  })),
339
+ /**
340
+ * Instagram / Facebook DM into the conversation the contact started (no account = their latest one). Meta allows it only within 24 hours of
341
+ * their last message; outside it, or after they sent STOP, the step is skipped and the journey moves on. Text is liquid.
342
+ */
343
+ node('send_social_dm', z.object({ accountId: refId('social_account').optional(), text: z.string().min(1).max(1000) })),
339
344
  /** Add the contact to, or remove them from, an ad platform custom audience. Contacts who opted out of ads are never added. */
340
345
  node('ad_audience', z.object({ adAccountId: refId('ad_account'), audienceId: z.string().min(1).max(200), op: z.enum(['add', 'remove']).default('add') })),
341
346
  ]);