@getuserfeedback/protocol 0.7.2 → 0.8.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 (38) hide show
  1. package/dist/app-event.d.ts +147 -20
  2. package/dist/app-event.d.ts.map +1 -1
  3. package/dist/app-event.js +10 -0
  4. package/dist/flow-assignments.d.ts +7 -4
  5. package/dist/flow-assignments.d.ts.map +1 -1
  6. package/dist/flow-assignments.js +15 -5
  7. package/dist/host/external-id-argument-guards.d.ts +10 -0
  8. package/dist/host/external-id-argument-guards.d.ts.map +1 -0
  9. package/dist/host/external-id-argument-guards.js +27 -0
  10. package/dist/host/index.d.ts +1 -0
  11. package/dist/host/index.d.ts.map +1 -1
  12. package/dist/host/index.js +1 -0
  13. package/dist/host/sdk-types.d.ts +24 -4
  14. package/dist/host/sdk-types.d.ts.map +1 -1
  15. package/dist/identity-type.d.ts +2 -3
  16. package/dist/identity-type.d.ts.map +1 -1
  17. package/dist/identity-type.js +2 -4
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/widget-commands.d.ts +23 -1
  22. package/dist/widget-commands.d.ts.map +1 -1
  23. package/dist/widget-commands.js +6 -1
  24. package/dist/widget-config.d.ts +18 -0
  25. package/dist/widget-config.d.ts.map +1 -1
  26. package/dist/widget-config.js +2 -1
  27. package/package.json +1 -1
  28. package/src/app-event.ts +24 -0
  29. package/src/flow-assignments.test.ts +19 -0
  30. package/src/flow-assignments.ts +31 -5
  31. package/src/host/external-id-argument-guards.ts +57 -0
  32. package/src/host/index.ts +1 -0
  33. package/src/host/sdk-types.ts +27 -5
  34. package/src/identity-type.ts +3 -9
  35. package/src/index.ts +4 -1
  36. package/src/protocol-root.test.ts +109 -3
  37. package/src/widget-commands.ts +11 -1
  38. package/src/widget-config.ts +8 -1
@@ -1,7 +1,7 @@
1
1
  import * as z from "zod/mini";
2
2
  export { appEventIdentityTypeSchema } from "./identity-type.js";
3
3
  export declare const appEventIdentitySchema: z.ZodMiniObject<{
4
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
4
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
5
5
  value: z.ZodMiniString<string>;
6
6
  }, z.core.$strip>;
7
7
  type AppEventFlagValue = string | number | boolean | null | AppEventFlagValue[] | {
@@ -44,6 +44,13 @@ export declare const appEventCapabilitySchema: z.ZodMiniObject<{
44
44
  environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
45
45
  }, z.core.$strip>>;
46
46
  }, z.core.$strip>;
47
+ export declare const appEventExternalIdSchema: z.ZodMiniObject<{
48
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
49
+ type: z.ZodMiniString<string>;
50
+ collection: z.ZodMiniLiteral<"users">;
51
+ encoding: z.ZodMiniLiteral<"none">;
52
+ }, z.core.$strip>;
53
+ export type AppEventExternalId = z.output<typeof appEventExternalIdSchema>;
47
54
  export declare const appEventContextSchema: z.ZodMiniObject<{
48
55
  page: z.ZodMiniOptional<z.ZodMiniObject<{
49
56
  path: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -52,6 +59,12 @@ export declare const appEventContextSchema: z.ZodMiniObject<{
52
59
  }, z.core.$strip>>;
53
60
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
54
61
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
62
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
63
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
64
+ type: z.ZodMiniString<string>;
65
+ collection: z.ZodMiniLiteral<"users">;
66
+ encoding: z.ZodMiniLiteral<"none">;
67
+ }, z.core.$strip>>>;
55
68
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
56
69
  key: z.ZodMiniString<string>;
57
70
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -85,7 +98,7 @@ export declare const appEventContextSchema: z.ZodMiniObject<{
85
98
  export declare const appEventBaseSchema: z.ZodMiniObject<{
86
99
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
87
100
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
88
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
101
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
89
102
  value: z.ZodMiniString<string>;
90
103
  }, z.core.$strip>>>;
91
104
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -96,6 +109,12 @@ export declare const appEventBaseSchema: z.ZodMiniObject<{
96
109
  }, z.core.$strip>>;
97
110
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
98
111
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
112
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
113
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
114
+ type: z.ZodMiniString<string>;
115
+ collection: z.ZodMiniLiteral<"users">;
116
+ encoding: z.ZodMiniLiteral<"none">;
117
+ }, z.core.$strip>>>;
99
118
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
100
119
  key: z.ZodMiniString<string>;
101
120
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -133,7 +152,7 @@ export declare const reservedSystemAppEventNames: readonly ["Response Submitted"
133
152
  export declare const appEventSystemBaseSchema: z.ZodMiniObject<{
134
153
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
135
154
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
136
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
155
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
137
156
  value: z.ZodMiniString<string>;
138
157
  }, z.core.$strip>>>;
139
158
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -144,6 +163,12 @@ export declare const appEventSystemBaseSchema: z.ZodMiniObject<{
144
163
  }, z.core.$strip>>;
145
164
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
146
165
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
166
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
167
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
168
+ type: z.ZodMiniString<string>;
169
+ collection: z.ZodMiniLiteral<"users">;
170
+ encoding: z.ZodMiniLiteral<"none">;
171
+ }, z.core.$strip>>>;
147
172
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
148
173
  key: z.ZodMiniString<string>;
149
174
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -181,7 +206,7 @@ export declare const appEventSystemBaseSchema: z.ZodMiniObject<{
181
206
  export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
182
207
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
183
208
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
184
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
209
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
185
210
  value: z.ZodMiniString<string>;
186
211
  }, z.core.$strip>>>;
187
212
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -192,6 +217,12 @@ export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
192
217
  }, z.core.$strip>>;
193
218
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
194
219
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
220
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
221
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
222
+ type: z.ZodMiniString<string>;
223
+ collection: z.ZodMiniLiteral<"users">;
224
+ encoding: z.ZodMiniLiteral<"none">;
225
+ }, z.core.$strip>>>;
195
226
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
196
227
  key: z.ZodMiniString<string>;
197
228
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -236,7 +267,7 @@ export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
236
267
  };
237
268
  traits?: Record<string, unknown> | undefined;
238
269
  identities?: {
239
- type: import("./identity-type.js").IdentityTypeValue;
270
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
240
271
  value: string;
241
272
  }[] | undefined;
242
273
  context?: {
@@ -247,6 +278,12 @@ export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
247
278
  } | undefined;
248
279
  locale?: string | undefined;
249
280
  userAgent?: string | undefined;
281
+ externalIds?: {
282
+ id: string;
283
+ type: string;
284
+ collection: "users";
285
+ encoding: "none";
286
+ }[] | undefined;
250
287
  flags?: {
251
288
  key: string;
252
289
  value: AppEventFlagValue;
@@ -284,7 +321,7 @@ export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
284
321
  };
285
322
  traits?: Record<string, unknown> | undefined;
286
323
  identities?: {
287
- type: import("./identity-type.js").IdentityTypeValue;
324
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
288
325
  value: string;
289
326
  }[] | undefined;
290
327
  context?: {
@@ -295,6 +332,12 @@ export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
295
332
  } | undefined;
296
333
  locale?: string | undefined;
297
334
  userAgent?: string | undefined;
335
+ externalIds?: {
336
+ id: string;
337
+ type: string;
338
+ collection: "users";
339
+ encoding: "none";
340
+ }[] | undefined;
298
341
  flags?: {
299
342
  key: string;
300
343
  value: AppEventFlagValue;
@@ -327,7 +370,7 @@ export declare const appEventSurveyViewedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
327
370
  export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<{
328
371
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
329
372
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
330
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
373
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
331
374
  value: z.ZodMiniString<string>;
332
375
  }, z.core.$strip>>>;
333
376
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -338,6 +381,12 @@ export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<
338
381
  }, z.core.$strip>>;
339
382
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
340
383
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
384
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
385
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
386
+ type: z.ZodMiniString<string>;
387
+ collection: z.ZodMiniLiteral<"users">;
388
+ encoding: z.ZodMiniLiteral<"none">;
389
+ }, z.core.$strip>>>;
341
390
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
342
391
  key: z.ZodMiniString<string>;
343
392
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -382,7 +431,7 @@ export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<
382
431
  };
383
432
  traits?: Record<string, unknown> | undefined;
384
433
  identities?: {
385
- type: import("./identity-type.js").IdentityTypeValue;
434
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
386
435
  value: string;
387
436
  }[] | undefined;
388
437
  context?: {
@@ -393,6 +442,12 @@ export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<
393
442
  } | undefined;
394
443
  locale?: string | undefined;
395
444
  userAgent?: string | undefined;
445
+ externalIds?: {
446
+ id: string;
447
+ type: string;
448
+ collection: "users";
449
+ encoding: "none";
450
+ }[] | undefined;
396
451
  flags?: {
397
452
  key: string;
398
453
  value: AppEventFlagValue;
@@ -430,7 +485,7 @@ export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<
430
485
  };
431
486
  traits?: Record<string, unknown> | undefined;
432
487
  identities?: {
433
- type: import("./identity-type.js").IdentityTypeValue;
488
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
434
489
  value: string;
435
490
  }[] | undefined;
436
491
  context?: {
@@ -441,6 +496,12 @@ export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<
441
496
  } | undefined;
442
497
  locale?: string | undefined;
443
498
  userAgent?: string | undefined;
499
+ externalIds?: {
500
+ id: string;
501
+ type: string;
502
+ collection: "users";
503
+ encoding: "none";
504
+ }[] | undefined;
444
505
  flags?: {
445
506
  key: string;
446
507
  value: AppEventFlagValue;
@@ -473,7 +534,7 @@ export declare const appEventFlowDismissedSchema: z.ZodMiniPipe<z.ZodMiniObject<
473
534
  export declare const appEventSystemTrackSchema: z.ZodMiniObject<{
474
535
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
475
536
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
476
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
537
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
477
538
  value: z.ZodMiniString<string>;
478
539
  }, z.core.$strip>>>;
479
540
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -484,6 +545,12 @@ export declare const appEventSystemTrackSchema: z.ZodMiniObject<{
484
545
  }, z.core.$strip>>;
485
546
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
486
547
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
548
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
549
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
550
+ type: z.ZodMiniString<string>;
551
+ collection: z.ZodMiniLiteral<"users">;
552
+ encoding: z.ZodMiniLiteral<"none">;
553
+ }, z.core.$strip>>>;
487
554
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
488
555
  key: z.ZodMiniString<string>;
489
556
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -528,7 +595,7 @@ export declare const appEventSystemTrackSchema: z.ZodMiniObject<{
528
595
  export declare const appEventCustomerTrackSchema: z.ZodMiniObject<{
529
596
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
530
597
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
531
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
598
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
532
599
  value: z.ZodMiniString<string>;
533
600
  }, z.core.$strip>>>;
534
601
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -539,6 +606,12 @@ export declare const appEventCustomerTrackSchema: z.ZodMiniObject<{
539
606
  }, z.core.$strip>>;
540
607
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
541
608
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
609
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
610
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
611
+ type: z.ZodMiniString<string>;
612
+ collection: z.ZodMiniLiteral<"users">;
613
+ encoding: z.ZodMiniLiteral<"none">;
614
+ }, z.core.$strip>>>;
542
615
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
543
616
  key: z.ZodMiniString<string>;
544
617
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -578,7 +651,7 @@ export declare const appEventCustomerTrackSchema: z.ZodMiniObject<{
578
651
  export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniObject<{
579
652
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
580
653
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
581
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
654
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
582
655
  value: z.ZodMiniString<string>;
583
656
  }, z.core.$strip>>>;
584
657
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -589,6 +662,12 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
589
662
  }, z.core.$strip>>;
590
663
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
591
664
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
665
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
666
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
667
+ type: z.ZodMiniString<string>;
668
+ collection: z.ZodMiniLiteral<"users">;
669
+ encoding: z.ZodMiniLiteral<"none">;
670
+ }, z.core.$strip>>>;
592
671
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
593
672
  key: z.ZodMiniString<string>;
594
673
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -636,7 +715,7 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
636
715
  };
637
716
  traits?: Record<string, unknown> | undefined;
638
717
  identities?: {
639
- type: import("./identity-type.js").IdentityTypeValue;
718
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
640
719
  value: string;
641
720
  }[] | undefined;
642
721
  context?: {
@@ -647,6 +726,12 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
647
726
  } | undefined;
648
727
  locale?: string | undefined;
649
728
  userAgent?: string | undefined;
729
+ externalIds?: {
730
+ id: string;
731
+ type: string;
732
+ collection: "users";
733
+ encoding: "none";
734
+ }[] | undefined;
650
735
  flags?: {
651
736
  key: string;
652
737
  value: AppEventFlagValue;
@@ -684,7 +769,7 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
684
769
  };
685
770
  traits?: Record<string, unknown> | undefined;
686
771
  identities?: {
687
- type: import("./identity-type.js").IdentityTypeValue;
772
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
688
773
  value: string;
689
774
  }[] | undefined;
690
775
  context?: {
@@ -695,6 +780,12 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
695
780
  } | undefined;
696
781
  locale?: string | undefined;
697
782
  userAgent?: string | undefined;
783
+ externalIds?: {
784
+ id: string;
785
+ type: string;
786
+ collection: "users";
787
+ encoding: "none";
788
+ }[] | undefined;
698
789
  flags?: {
699
790
  key: string;
700
791
  value: AppEventFlagValue;
@@ -726,7 +817,7 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
726
817
  }>>, z.ZodMiniObject<{
727
818
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
728
819
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
729
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
820
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
730
821
  value: z.ZodMiniString<string>;
731
822
  }, z.core.$strip>>>;
732
823
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -737,6 +828,12 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
737
828
  }, z.core.$strip>>;
738
829
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
739
830
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
831
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
832
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
833
+ type: z.ZodMiniString<string>;
834
+ collection: z.ZodMiniLiteral<"users">;
835
+ encoding: z.ZodMiniLiteral<"none">;
836
+ }, z.core.$strip>>>;
740
837
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
741
838
  key: z.ZodMiniString<string>;
742
839
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -776,7 +873,7 @@ export declare const appEventTrackSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe
776
873
  export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniObject<{
777
874
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
778
875
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
779
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
876
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
780
877
  value: z.ZodMiniString<string>;
781
878
  }, z.core.$strip>>>;
782
879
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -787,6 +884,12 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
787
884
  }, z.core.$strip>>;
788
885
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
789
886
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
887
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
888
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
889
+ type: z.ZodMiniString<string>;
890
+ collection: z.ZodMiniLiteral<"users">;
891
+ encoding: z.ZodMiniLiteral<"none">;
892
+ }, z.core.$strip>>>;
790
893
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
791
894
  key: z.ZodMiniString<string>;
792
895
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -834,7 +937,7 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
834
937
  };
835
938
  traits?: Record<string, unknown> | undefined;
836
939
  identities?: {
837
- type: import("./identity-type.js").IdentityTypeValue;
940
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
838
941
  value: string;
839
942
  }[] | undefined;
840
943
  context?: {
@@ -845,6 +948,12 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
845
948
  } | undefined;
846
949
  locale?: string | undefined;
847
950
  userAgent?: string | undefined;
951
+ externalIds?: {
952
+ id: string;
953
+ type: string;
954
+ collection: "users";
955
+ encoding: "none";
956
+ }[] | undefined;
848
957
  flags?: {
849
958
  key: string;
850
959
  value: AppEventFlagValue;
@@ -882,7 +991,7 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
882
991
  };
883
992
  traits?: Record<string, unknown> | undefined;
884
993
  identities?: {
885
- type: import("./identity-type.js").IdentityTypeValue;
994
+ type: "anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token";
886
995
  value: string;
887
996
  }[] | undefined;
888
997
  context?: {
@@ -893,6 +1002,12 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
893
1002
  } | undefined;
894
1003
  locale?: string | undefined;
895
1004
  userAgent?: string | undefined;
1005
+ externalIds?: {
1006
+ id: string;
1007
+ type: string;
1008
+ collection: "users";
1009
+ encoding: "none";
1010
+ }[] | undefined;
896
1011
  flags?: {
897
1012
  key: string;
898
1013
  value: AppEventFlagValue;
@@ -924,7 +1039,7 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
924
1039
  }>>, z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
925
1040
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
926
1041
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
927
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
1042
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
928
1043
  value: z.ZodMiniString<string>;
929
1044
  }, z.core.$strip>>>;
930
1045
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -935,6 +1050,12 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
935
1050
  }, z.core.$strip>>;
936
1051
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
937
1052
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1053
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
1054
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
1055
+ type: z.ZodMiniString<string>;
1056
+ collection: z.ZodMiniLiteral<"users">;
1057
+ encoding: z.ZodMiniLiteral<"none">;
1058
+ }, z.core.$strip>>>;
938
1059
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
939
1060
  key: z.ZodMiniString<string>;
940
1061
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -978,7 +1099,7 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
978
1099
  }, z.core.$strip>, z.ZodMiniObject<{
979
1100
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
980
1101
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
981
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
1102
+ type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
982
1103
  value: z.ZodMiniString<string>;
983
1104
  }, z.core.$strip>>>;
984
1105
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -989,6 +1110,12 @@ export declare const appEventPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniPi
989
1110
  }, z.core.$strip>>;
990
1111
  locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
991
1112
  userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
1113
+ externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
1114
+ id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
1115
+ type: z.ZodMiniString<string>;
1116
+ collection: z.ZodMiniLiteral<"users">;
1117
+ encoding: z.ZodMiniLiteral<"none">;
1118
+ }, z.core.$strip>>>;
992
1119
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
993
1120
  key: z.ZodMiniString<string>;
994
1121
  target: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"app-event.d.ts","sourceRoot":"","sources":["../src/app-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,sBAAsB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA6DvC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/dist/app-event.js CHANGED
@@ -51,10 +51,20 @@ const appEventPageSchema = z.object({
51
51
  referrer: z.optional(z.string()),
52
52
  search: z.optional(z.string()),
53
53
  });
54
+ const externalIdTypeSchema = z.string().check(z.trim(), z.minLength(1), z.regex(/^[a-z0-9][a-z0-9_.-]*$/, {
55
+ message: "External ID type must start with a lowercase letter or number and may contain lowercase letters, numbers, underscores, dots, or hyphens.",
56
+ }));
57
+ export const appEventExternalIdSchema = z.object({
58
+ id: z.pipe(z.string().check(z.trim(), z.minLength(1)), z.transform((value) => value.trim())),
59
+ type: externalIdTypeSchema,
60
+ collection: z.literal("users"),
61
+ encoding: z.literal("none"),
62
+ });
54
63
  export const appEventContextSchema = z.object({
55
64
  page: z.optional(appEventPageSchema),
56
65
  locale: z.optional(z.string()),
57
66
  userAgent: z.optional(z.string()),
67
+ externalIds: z.optional(z.array(appEventExternalIdSchema).check(z.maxLength(20))),
58
68
  flags: z.optional(z.array(appEventFlagSchema)),
59
69
  capabilities: z.optional(z.array(appEventCapabilitySchema)),
60
70
  });
@@ -1,4 +1,7 @@
1
1
  import * as z from "zod/mini";
2
+ import type { IdentityTypeValue } from "./identity-type.js";
3
+ export type FlowAssignmentExternalIdIdentityTypeValue = `externalId.${string}`;
4
+ export type FlowAssignmentIdentityTypeValue = IdentityTypeValue | FlowAssignmentExternalIdIdentityTypeValue;
2
5
  export declare const flowAssignmentStatusSchema: z.ZodMiniEnum<{
3
6
  pending: "pending";
4
7
  held: "held";
@@ -91,7 +94,7 @@ export declare const flowAssignmentTargetingContextSchema: z.ZodMiniObject<{
91
94
  }, z.core.$strip>;
92
95
  export declare const flowAssignmentRecipientRequestSchema: z.ZodMiniObject<{
93
96
  identities: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniObject<{
94
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
97
+ type: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>, z.ZodMiniType<`externalId.${string}`, `externalId.${string}`, z.core.$ZodTypeInternals<`externalId.${string}`, `externalId.${string}`>>]>;
95
98
  value: z.ZodMiniString<string>;
96
99
  }, z.core.$strip>>>;
97
100
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -236,7 +239,7 @@ export declare const listPendingFlowAssignmentsResponseSchema: z.ZodMiniObject<{
236
239
  }, z.core.$strip>;
237
240
  export declare const claimPendingFlowAssignmentsRequestSchema: z.ZodMiniObject<{
238
241
  identities: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniObject<{
239
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
242
+ type: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>, z.ZodMiniType<`externalId.${string}`, `externalId.${string}`, z.core.$ZodTypeInternals<`externalId.${string}`, `externalId.${string}`>>]>;
240
243
  value: z.ZodMiniString<string>;
241
244
  }, z.core.$strip>>>;
242
245
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -355,7 +358,7 @@ export declare const claimPendingFlowAssignmentsResponseSchema: z.ZodMiniObject<
355
358
  }, z.core.$strip>;
356
359
  export declare const updateFlowAssignmentLifecycleRequestSchema: z.ZodMiniObject<{
357
360
  identities: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniObject<{
358
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
361
+ type: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>, z.ZodMiniType<`externalId.${string}`, `externalId.${string}`, z.core.$ZodTypeInternals<`externalId.${string}`, `externalId.${string}`>>]>;
359
362
  value: z.ZodMiniString<string>;
360
363
  }, z.core.$strip>>>;
361
364
  context: z.ZodMiniOptional<z.ZodMiniObject<{
@@ -444,7 +447,7 @@ export declare const updateFlowAssignmentLifecycleRequestSchema: z.ZodMiniObject
444
447
  }, z.core.$strip>;
445
448
  export declare const releaseFlowAssignmentClaimRequestSchema: z.ZodMiniObject<{
446
449
  identities: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniObject<{
447
- type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("./identity-type.js").IdentityTypeValue, string>>;
450
+ type: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>, z.ZodMiniType<`externalId.${string}`, `externalId.${string}`, z.core.$ZodTypeInternals<`externalId.${string}`, `externalId.${string}`>>]>;
448
451
  value: z.ZodMiniString<string>;
449
452
  }, z.core.$strip>>>;
450
453
  holdGroupToken: z.ZodMiniString<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"flow-assignments.d.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O,oCAAoC,CAC3C,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC/E,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CACxD,OAAO,wCAAwC,CAC/C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CACzD,OAAO,yCAAyC,CAChD,CAAC;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CACxD,OAAO,wCAAwC,CAC/C,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CACvD,OAAO,uCAAuC,CAC9C,CAAC;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CACxD,OAAO,wCAAwC,CAC/C,CAAC;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAC1D,OAAO,0CAA0C,CACjD,CAAC;AACF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,OAAO,2CAA2C,CAClD,CAAC"}
@@ -1,5 +1,15 @@
1
1
  import * as z from "zod/mini";
2
- import { appEventCapabilitySchema, appEventFlagSchema, appEventIdentitySchema, } from "./app-event.js";
2
+ import { appEventCapabilitySchema, appEventFlagSchema, appEventIdentityTypeSchema, } from "./app-event.js";
3
+ const flowAssignmentExternalIdIdentityTypeSchema = z.string().check(z.trim(), z.minLength(1), z.regex(/^externalId\.[a-z0-9][a-z0-9_.-]*$/, {
4
+ message: "External ID identity type must use externalId.<type> with a lowercase Segment external ID type.",
5
+ }));
6
+ const flowAssignmentIdentitySchema = z.object({
7
+ type: z.union([
8
+ appEventIdentityTypeSchema,
9
+ flowAssignmentExternalIdIdentityTypeSchema,
10
+ ]),
11
+ value: z.string().check(z.trim(), z.minLength(1)),
12
+ });
3
13
  export const flowAssignmentStatusSchema = z.enum([
4
14
  "pending",
5
15
  "held",
@@ -16,7 +26,7 @@ export const flowAssignmentTargetingContextSchema = z.object({
16
26
  capabilities: z.optional(z.array(appEventCapabilitySchema)),
17
27
  });
18
28
  export const flowAssignmentRecipientRequestSchema = z.object({
19
- identities: z._default(z.array(appEventIdentitySchema), []),
29
+ identities: z._default(z.array(flowAssignmentIdentitySchema), []),
20
30
  context: z.optional(flowAssignmentTargetingContextSchema),
21
31
  at: z.optional(z.number()),
22
32
  });
@@ -43,7 +53,7 @@ export const listPendingFlowAssignmentsResponseSchema = z.object({
43
53
  flowAssignments: z.array(flowAssignmentRecordSchema),
44
54
  });
45
55
  export const claimPendingFlowAssignmentsRequestSchema = z.object({
46
- identities: z._default(z.array(appEventIdentitySchema), []),
56
+ identities: z._default(z.array(flowAssignmentIdentitySchema), []),
47
57
  context: z.optional(flowAssignmentTargetingContextSchema),
48
58
  holdOwnerKey: z.string().check(z.trim(), z.minLength(1)),
49
59
  at: z.optional(z.number()),
@@ -54,7 +64,7 @@ export const claimPendingFlowAssignmentsResponseSchema = z.object({
54
64
  flowAssignments: z.array(flowAssignmentRecordSchema),
55
65
  });
56
66
  export const updateFlowAssignmentLifecycleRequestSchema = z.object({
57
- identities: z._default(z.array(appEventIdentitySchema), []),
67
+ identities: z._default(z.array(flowAssignmentIdentitySchema), []),
58
68
  context: z.optional(flowAssignmentTargetingContextSchema),
59
69
  flowAssignmentId: z.string().check(z.trim(), z.minLength(1)),
60
70
  flowVersionId: z.optional(z.string().check(z.trim(), z.minLength(1))),
@@ -62,7 +72,7 @@ export const updateFlowAssignmentLifecycleRequestSchema = z.object({
62
72
  at: z.optional(z.number()),
63
73
  });
64
74
  export const releaseFlowAssignmentClaimRequestSchema = z.object({
65
- identities: z._default(z.array(appEventIdentitySchema), []),
75
+ identities: z._default(z.array(flowAssignmentIdentitySchema), []),
66
76
  holdGroupToken: z.string().check(z.trim(), z.minLength(1)),
67
77
  holdOwnerKey: z.optional(z.string().check(z.trim(), z.minLength(1))),
68
78
  at: z.optional(z.number()),
@@ -0,0 +1,10 @@
1
+ type ExternalIdArgumentCommandName = "identify" | "track";
2
+ type ExternalIdArgumentValueName = "traits" | "properties";
3
+ export declare const assertNoAmbiguousExternalIdsArgument: ({ argument, options, commandName, valueArgumentName, }: {
4
+ argument: unknown;
5
+ options: unknown;
6
+ commandName: ExternalIdArgumentCommandName;
7
+ valueArgumentName: ExternalIdArgumentValueName;
8
+ }) => void;
9
+ export {};
10
+ //# sourceMappingURL=external-id-argument-guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-id-argument-guards.d.ts","sourceRoot":"","sources":["../../src/host/external-id-argument-guards.ts"],"names":[],"mappings":"AAAA,KAAK,6BAA6B,GAAG,UAAU,GAAG,OAAO,CAAC;AAC1D,KAAK,2BAA2B,GAAG,QAAQ,GAAG,YAAY,CAAC;AAqC3D,eAAO,MAAM,oCAAoC,GAAI,wDAKlD;IACF,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,6BAA6B,CAAC;IAC3C,iBAAiB,EAAE,2BAA2B,CAAC;CAC/C,KAAG,IAQH,CAAC"}
@@ -0,0 +1,27 @@
1
+ const isAmbiguousExternalIdsArgument = (value) => {
2
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
3
+ return false;
4
+ }
5
+ const entries = Object.entries(value);
6
+ const externalIds = entries[0]?.[1];
7
+ return (entries.length === 1 &&
8
+ entries[0]?.[0] === "externalIds" &&
9
+ Array.isArray(externalIds) &&
10
+ externalIds.length > 0 &&
11
+ externalIds.every(isSegmentExternalIdLike));
12
+ };
13
+ const isSegmentExternalIdLike = (value) => {
14
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
15
+ return false;
16
+ }
17
+ return (typeof Reflect.get(value, "id") === "string" &&
18
+ typeof Reflect.get(value, "type") === "string" &&
19
+ Reflect.get(value, "collection") === "users" &&
20
+ Reflect.get(value, "encoding") === "none");
21
+ };
22
+ export const assertNoAmbiguousExternalIdsArgument = ({ argument, options, commandName, valueArgumentName, }) => {
23
+ if (options !== undefined || !isAmbiguousExternalIdsArgument(argument)) {
24
+ return;
25
+ }
26
+ throw new Error(`${commandName} received externalIds in the ${valueArgumentName} argument. Pass undefined for ${valueArgumentName} and provide externalIds as options instead.`);
27
+ };