@iterable/api 0.0.1

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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -0
  3. package/dist/client/base.d.ts +33 -0
  4. package/dist/client/base.d.ts.map +1 -0
  5. package/dist/client/base.js +155 -0
  6. package/dist/client/base.js.map +1 -0
  7. package/dist/client/campaigns.d.ts +71 -0
  8. package/dist/client/campaigns.d.ts.map +1 -0
  9. package/dist/client/campaigns.js +125 -0
  10. package/dist/client/campaigns.js.map +1 -0
  11. package/dist/client/catalogs.d.ts +60 -0
  12. package/dist/client/catalogs.d.ts.map +1 -0
  13. package/dist/client/catalogs.js +138 -0
  14. package/dist/client/catalogs.js.map +1 -0
  15. package/dist/client/events.d.ts +38 -0
  16. package/dist/client/events.d.ts.map +1 -0
  17. package/dist/client/events.js +38 -0
  18. package/dist/client/events.js.map +1 -0
  19. package/dist/client/experiments.d.ts +24 -0
  20. package/dist/client/experiments.d.ts.map +1 -0
  21. package/dist/client/experiments.js +29 -0
  22. package/dist/client/experiments.js.map +1 -0
  23. package/dist/client/export.d.ts +27 -0
  24. package/dist/client/export.d.ts.map +1 -0
  25. package/dist/client/export.js +31 -0
  26. package/dist/client/export.js.map +1 -0
  27. package/dist/client/index.d.ts +315 -0
  28. package/dist/client/index.d.ts.map +1 -0
  29. package/dist/client/index.js +25 -0
  30. package/dist/client/index.js.map +1 -0
  31. package/dist/client/journeys.d.ts +26 -0
  32. package/dist/client/journeys.d.ts.map +1 -0
  33. package/dist/client/journeys.js +32 -0
  34. package/dist/client/journeys.js.map +1 -0
  35. package/dist/client/lists.d.ts +39 -0
  36. package/dist/client/lists.d.ts.map +1 -0
  37. package/dist/client/lists.js +80 -0
  38. package/dist/client/lists.js.map +1 -0
  39. package/dist/client/messaging.d.ts +39 -0
  40. package/dist/client/messaging.d.ts.map +1 -0
  41. package/dist/client/messaging.js +110 -0
  42. package/dist/client/messaging.js.map +1 -0
  43. package/dist/client/snippets.d.ts +37 -0
  44. package/dist/client/snippets.d.ts.map +1 -0
  45. package/dist/client/snippets.js +29 -0
  46. package/dist/client/snippets.js.map +1 -0
  47. package/dist/client/subscriptions.d.ts +26 -0
  48. package/dist/client/subscriptions.d.ts.map +1 -0
  49. package/dist/client/subscriptions.js +31 -0
  50. package/dist/client/subscriptions.js.map +1 -0
  51. package/dist/client/templates.d.ts +52 -0
  52. package/dist/client/templates.d.ts.map +1 -0
  53. package/dist/client/templates.js +132 -0
  54. package/dist/client/templates.js.map +1 -0
  55. package/dist/client/users.d.ts +76 -0
  56. package/dist/client/users.d.ts.map +1 -0
  57. package/dist/client/users.js +115 -0
  58. package/dist/client/users.js.map +1 -0
  59. package/dist/client/webhooks.d.ts +25 -0
  60. package/dist/client/webhooks.d.ts.map +1 -0
  61. package/dist/client/webhooks.js +17 -0
  62. package/dist/client/webhooks.js.map +1 -0
  63. package/dist/config.d.ts +26 -0
  64. package/dist/config.d.ts.map +1 -0
  65. package/dist/config.js +51 -0
  66. package/dist/config.js.map +1 -0
  67. package/dist/errors.d.ts +45 -0
  68. package/dist/errors.d.ts.map +1 -0
  69. package/dist/errors.js +144 -0
  70. package/dist/errors.js.map +1 -0
  71. package/dist/index.d.ts +21 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +25 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/logger.d.ts +3 -0
  76. package/dist/logger.d.ts.map +1 -0
  77. package/dist/logger.js +32 -0
  78. package/dist/logger.js.map +1 -0
  79. package/dist/types/campaigns.d.ts +307 -0
  80. package/dist/types/campaigns.d.ts.map +1 -0
  81. package/dist/types/campaigns.js +226 -0
  82. package/dist/types/campaigns.js.map +1 -0
  83. package/dist/types/catalogs.d.ts +138 -0
  84. package/dist/types/catalogs.d.ts.map +1 -0
  85. package/dist/types/catalogs.js +139 -0
  86. package/dist/types/catalogs.js.map +1 -0
  87. package/dist/types/common.d.ts +145 -0
  88. package/dist/types/common.d.ts.map +1 -0
  89. package/dist/types/common.js +110 -0
  90. package/dist/types/common.js.map +1 -0
  91. package/dist/types/events.d.ts +124 -0
  92. package/dist/types/events.d.ts.map +1 -0
  93. package/dist/types/events.js +118 -0
  94. package/dist/types/events.js.map +1 -0
  95. package/dist/types/experiments.d.ts +14 -0
  96. package/dist/types/experiments.d.ts.map +1 -0
  97. package/dist/types/experiments.js +24 -0
  98. package/dist/types/experiments.js.map +1 -0
  99. package/dist/types/export.d.ts +121 -0
  100. package/dist/types/export.d.ts.map +1 -0
  101. package/dist/types/export.js +105 -0
  102. package/dist/types/export.js.map +1 -0
  103. package/dist/types/journeys.d.ts +72 -0
  104. package/dist/types/journeys.d.ts.map +1 -0
  105. package/dist/types/journeys.js +65 -0
  106. package/dist/types/journeys.js.map +1 -0
  107. package/dist/types/lists.d.ts +149 -0
  108. package/dist/types/lists.d.ts.map +1 -0
  109. package/dist/types/lists.js +140 -0
  110. package/dist/types/lists.js.map +1 -0
  111. package/dist/types/messaging.d.ts +246 -0
  112. package/dist/types/messaging.d.ts.map +1 -0
  113. package/dist/types/messaging.js +323 -0
  114. package/dist/types/messaging.js.map +1 -0
  115. package/dist/types/snippets.d.ts +89 -0
  116. package/dist/types/snippets.d.ts.map +1 -0
  117. package/dist/types/snippets.js +85 -0
  118. package/dist/types/snippets.js.map +1 -0
  119. package/dist/types/subscriptions.d.ts +63 -0
  120. package/dist/types/subscriptions.d.ts.map +1 -0
  121. package/dist/types/subscriptions.js +40 -0
  122. package/dist/types/subscriptions.js.map +1 -0
  123. package/dist/types/templates.d.ts +315 -0
  124. package/dist/types/templates.d.ts.map +1 -0
  125. package/dist/types/templates.js +357 -0
  126. package/dist/types/templates.js.map +1 -0
  127. package/dist/types/users.d.ts +144 -0
  128. package/dist/types/users.d.ts.map +1 -0
  129. package/dist/types/users.js +189 -0
  130. package/dist/types/users.js.map +1 -0
  131. package/dist/types/webhooks.d.ts +52 -0
  132. package/dist/types/webhooks.d.ts.map +1 -0
  133. package/dist/types/webhooks.js +32 -0
  134. package/dist/types/webhooks.js.map +1 -0
  135. package/package.json +73 -0
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Catalog management schemas and types
4
+ */
5
+ export declare const CatalogItemSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ price: z.ZodOptional<z.ZodNumber>;
10
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ imageUrl: z.ZodOptional<z.ZodString>;
12
+ url: z.ZodOptional<z.ZodString>;
13
+ dataFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
14
+ }, z.core.$strip>;
15
+ export type CatalogItem = z.infer<typeof CatalogItemSchema>;
16
+ export type UpdateCatalogItemParams = z.infer<typeof UpdateCatalogItemParamsSchema>;
17
+ export type GetCatalogItemParams = z.infer<typeof GetCatalogItemParamsSchema>;
18
+ export type DeleteCatalogItemParams = z.infer<typeof DeleteCatalogItemParamsSchema>;
19
+ export declare const UpdateCatalogItemParamsSchema: z.ZodObject<{
20
+ catalogName: z.ZodString;
21
+ items: z.ZodArray<z.ZodObject<{
22
+ id: z.ZodString;
23
+ name: z.ZodString;
24
+ description: z.ZodOptional<z.ZodString>;
25
+ price: z.ZodOptional<z.ZodNumber>;
26
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
+ imageUrl: z.ZodOptional<z.ZodString>;
28
+ url: z.ZodOptional<z.ZodString>;
29
+ dataFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>;
32
+ export declare const GetCatalogItemParamsSchema: z.ZodObject<{
33
+ catalogName: z.ZodString;
34
+ itemId: z.ZodString;
35
+ }, z.core.$strip>;
36
+ export declare const DeleteCatalogItemParamsSchema: z.ZodObject<{
37
+ catalogName: z.ZodString;
38
+ itemId: z.ZodString;
39
+ }, z.core.$strip>;
40
+ export declare const CatalogNameSchema: z.ZodObject<{
41
+ name: z.ZodString;
42
+ }, z.core.$strip>;
43
+ export declare const CatalogSchema: z.ZodObject<{
44
+ catalogName: z.ZodString;
45
+ itemCount: z.ZodOptional<z.ZodNumber>;
46
+ }, z.core.$strip>;
47
+ export declare const GetCatalogsResponseSchema: z.ZodObject<{
48
+ catalogNames: z.ZodArray<z.ZodObject<{
49
+ name: z.ZodString;
50
+ }, z.core.$strip>>;
51
+ totalCatalogsCount: z.ZodNumber;
52
+ nextPageUrl: z.ZodOptional<z.ZodString>;
53
+ previousPageUrl: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>;
55
+ export declare const GetCatalogsParamsSchema: z.ZodObject<{
56
+ page: z.ZodOptional<z.ZodNumber>;
57
+ pageSize: z.ZodOptional<z.ZodNumber>;
58
+ }, z.core.$strip>;
59
+ export declare const CatalogFieldMappingSchema: z.ZodObject<{
60
+ fieldName: z.ZodString;
61
+ fieldType: z.ZodString;
62
+ }, z.core.$strip>;
63
+ export declare const CatalogFieldMappingsResponseSchema: z.ZodObject<{
64
+ definedMappings: z.ZodRecord<z.ZodString, z.ZodString>;
65
+ undefinedFields: z.ZodArray<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export declare const GetCatalogFieldMappingsParamsSchema: z.ZodObject<{
68
+ catalogName: z.ZodString;
69
+ }, z.core.$strip>;
70
+ export declare const CreateCatalogParamsSchema: z.ZodObject<{
71
+ catalogName: z.ZodString;
72
+ }, z.core.$strip>;
73
+ export type CatalogName = z.infer<typeof CatalogNameSchema>;
74
+ export type Catalog = z.infer<typeof CatalogSchema>;
75
+ export type GetCatalogsResponse = z.infer<typeof GetCatalogsResponseSchema>;
76
+ export type GetCatalogsParams = z.infer<typeof GetCatalogsParamsSchema>;
77
+ export type CatalogFieldMapping = z.infer<typeof CatalogFieldMappingSchema>;
78
+ export type CatalogFieldMappingsResponse = z.infer<typeof CatalogFieldMappingsResponseSchema>;
79
+ export type GetCatalogFieldMappingsParams = z.infer<typeof GetCatalogFieldMappingsParamsSchema>;
80
+ export type CreateCatalogParams = z.infer<typeof CreateCatalogParamsSchema>;
81
+ export declare const CatalogItemWithPropertiesSchema: z.ZodObject<{
82
+ catalogName: z.ZodString;
83
+ itemId: z.ZodString;
84
+ lastModified: z.ZodNumber;
85
+ size: z.ZodNumber;
86
+ value: z.ZodRecord<z.ZodString, z.ZodAny>;
87
+ }, z.core.$strip>;
88
+ export declare const GetCatalogItemsResponseSchema: z.ZodObject<{
89
+ catalogItemsWithProperties: z.ZodArray<z.ZodObject<{
90
+ catalogName: z.ZodString;
91
+ itemId: z.ZodString;
92
+ lastModified: z.ZodNumber;
93
+ size: z.ZodNumber;
94
+ value: z.ZodRecord<z.ZodString, z.ZodAny>;
95
+ }, z.core.$strip>>;
96
+ totalItemsCount: z.ZodNumber;
97
+ nextPageUrl: z.ZodOptional<z.ZodString>;
98
+ previousPageUrl: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strip>;
100
+ export declare const GetCatalogItemsParamsSchema: z.ZodObject<{
101
+ catalogName: z.ZodString;
102
+ page: z.ZodOptional<z.ZodNumber>;
103
+ pageSize: z.ZodOptional<z.ZodNumber>;
104
+ orderBy: z.ZodOptional<z.ZodString>;
105
+ sortAscending: z.ZodOptional<z.ZodBoolean>;
106
+ }, z.core.$strip>;
107
+ export type CatalogItemWithProperties = z.infer<typeof CatalogItemWithPropertiesSchema>;
108
+ export type GetCatalogItemsResponse = z.infer<typeof GetCatalogItemsResponseSchema>;
109
+ export type GetCatalogItemsParams = z.infer<typeof GetCatalogItemsParamsSchema>;
110
+ export declare const CatalogFieldDefinitionSchema: z.ZodType<CatalogFieldDefinition>;
111
+ export type CatalogFieldDefinition = {
112
+ fieldName: string;
113
+ fieldType: string;
114
+ children?: CatalogFieldDefinition[];
115
+ };
116
+ export declare const UpdateCatalogFieldMappingsParamsSchema: z.ZodObject<{
117
+ catalogName: z.ZodString;
118
+ mappingsUpdates: z.ZodArray<z.ZodType<CatalogFieldDefinition, unknown, z.core.$ZodTypeInternals<CatalogFieldDefinition, unknown>>>;
119
+ }, z.core.$strip>;
120
+ export type UpdateCatalogFieldMappingsParams = z.infer<typeof UpdateCatalogFieldMappingsParamsSchema>;
121
+ export declare const BulkDeleteCatalogItemsParamsSchema: z.ZodObject<{
122
+ catalogName: z.ZodString;
123
+ itemIds: z.ZodArray<z.ZodString>;
124
+ }, z.core.$strip>;
125
+ export type BulkDeleteCatalogItemsParams = z.infer<typeof BulkDeleteCatalogItemsParamsSchema>;
126
+ export declare const PartialUpdateCatalogItemParamsSchema: z.ZodObject<{
127
+ catalogName: z.ZodString;
128
+ itemId: z.ZodString;
129
+ update: z.ZodRecord<z.ZodString, z.ZodAny>;
130
+ }, z.core.$strip>;
131
+ export type PartialUpdateCatalogItemParams = z.infer<typeof PartialUpdateCatalogItemParamsSchema>;
132
+ export declare const ReplaceCatalogItemParamsSchema: z.ZodObject<{
133
+ catalogName: z.ZodString;
134
+ itemId: z.ZodString;
135
+ value: z.ZodRecord<z.ZodString, z.ZodAny>;
136
+ }, z.core.$strip>;
137
+ export type ReplaceCatalogItemParams = z.infer<typeof ReplaceCatalogItemParamsSchema>;
138
+ //# sourceMappingURL=catalogs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogs.d.ts","sourceRoot":"","sources":["../../src/types/catalogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;iBAS5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAA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*/
6
+ export const CatalogItemSchema = z.object({
7
+ id: z.string(),
8
+ name: z.string(),
9
+ description: z.string().optional(),
10
+ price: z.number().optional(),
11
+ categories: z.array(z.string()).optional(),
12
+ imageUrl: z.string().optional(),
13
+ url: z.string().optional(),
14
+ dataFields: z.record(z.string(), z.any()).optional(),
15
+ });
16
+ export const UpdateCatalogItemParamsSchema = z.object({
17
+ catalogName: z.string().describe("Name of the catalog"),
18
+ items: z.array(CatalogItemSchema).describe("Catalog items to update"),
19
+ });
20
+ export const GetCatalogItemParamsSchema = z.object({
21
+ catalogName: z.string().describe("Name of the catalog"),
22
+ itemId: z.string().describe("ID of the catalog item to retrieve"),
23
+ });
24
+ export const DeleteCatalogItemParamsSchema = z.object({
25
+ catalogName: z.string().describe("Name of the catalog"),
26
+ itemId: z.string().describe("ID of the catalog item to delete"),
27
+ });
28
+ export const CatalogNameSchema = z.object({
29
+ name: z.string(),
30
+ });
31
+ export const CatalogSchema = z.object({
32
+ catalogName: z.string(),
33
+ itemCount: z.number().optional(),
34
+ });
35
+ export const GetCatalogsResponseSchema = z.object({
36
+ catalogNames: z.array(CatalogNameSchema),
37
+ totalCatalogsCount: z.number(),
38
+ nextPageUrl: z.string().optional(),
39
+ previousPageUrl: z.string().optional(),
40
+ });
41
+ export const GetCatalogsParamsSchema = z
42
+ .object({
43
+ page: z.number().min(1).optional().describe("Page number (starting at 1)"),
44
+ pageSize: z
45
+ .number()
46
+ .min(1)
47
+ .max(100)
48
+ .optional()
49
+ .describe("Number of results per page (max 100)"),
50
+ })
51
+ .describe("Parameters for listing catalogs with optional pagination");
52
+ export const CatalogFieldMappingSchema = z.object({
53
+ fieldName: z.string(),
54
+ fieldType: z.string(),
55
+ });
56
+ export const CatalogFieldMappingsResponseSchema = z.object({
57
+ definedMappings: z.record(z.string(), z.string()),
58
+ undefinedFields: z.array(z.string()),
59
+ });
60
+ export const GetCatalogFieldMappingsParamsSchema = z
61
+ .object({
62
+ catalogName: z.string().describe("Name of the catalog"),
63
+ })
64
+ .describe("Parameters for getting catalog field mappings");
65
+ export const CreateCatalogParamsSchema = z
66
+ .object({
67
+ catalogName: z
68
+ .string()
69
+ .max(255)
70
+ .regex(/^[a-zA-Z0-9-]+$/)
71
+ .describe("Catalog name (alphanumeric and dashes only, max 255 chars)"),
72
+ })
73
+ .describe("Parameters for creating a catalog");
74
+ // Catalog items schemas
75
+ export const CatalogItemWithPropertiesSchema = z.object({
76
+ catalogName: z.string(),
77
+ itemId: z.string(),
78
+ lastModified: UnixTimestampSchema,
79
+ size: z.number(),
80
+ value: z.record(z.string(), z.any()), // JsObject - flexible object
81
+ });
82
+ // This is what the client returns (the params object directly)
83
+ export const GetCatalogItemsResponseSchema = z.object({
84
+ catalogItemsWithProperties: z.array(CatalogItemWithPropertiesSchema),
85
+ totalItemsCount: z.number(),
86
+ nextPageUrl: z.string().optional(),
87
+ previousPageUrl: z.string().optional(),
88
+ });
89
+ export const GetCatalogItemsParamsSchema = z
90
+ .object({
91
+ catalogName: z.string().describe("Name of the catalog"),
92
+ page: z.number().min(1).optional().describe("Page number (starting at 1)"),
93
+ pageSize: z
94
+ .number()
95
+ .min(1)
96
+ .max(1000)
97
+ .optional()
98
+ .describe("Number of results per page (defaults to 10, max 1000)"),
99
+ orderBy: z
100
+ .string()
101
+ .optional()
102
+ .describe("Field by which results should be ordered"),
103
+ sortAscending: z
104
+ .boolean()
105
+ .optional()
106
+ .describe("Sort results by ascending (defaults to false)"),
107
+ })
108
+ .describe("Parameters for getting catalog items");
109
+ // Catalog field definition for field mappings update
110
+ export const CatalogFieldDefinitionSchema = z.lazy(() => z.object({
111
+ fieldName: z.string(),
112
+ fieldType: z.string(),
113
+ children: z.array(CatalogFieldDefinitionSchema).optional(),
114
+ }));
115
+ // Update catalog field mappings
116
+ export const UpdateCatalogFieldMappingsParamsSchema = z.object({
117
+ catalogName: z.string().describe("Name of the catalog"),
118
+ mappingsUpdates: z
119
+ .array(CatalogFieldDefinitionSchema)
120
+ .describe("Field mappings to update"),
121
+ });
122
+ // Bulk delete catalog items
123
+ export const BulkDeleteCatalogItemsParamsSchema = z.object({
124
+ catalogName: z.string().describe("Name of the catalog"),
125
+ itemIds: z.array(z.string()).describe("Array of item IDs to delete"),
126
+ });
127
+ // Partial update catalog item (PATCH)
128
+ export const PartialUpdateCatalogItemParamsSchema = z.object({
129
+ catalogName: z.string().describe("Name of the catalog"),
130
+ itemId: z.string().describe("ID of the catalog item"),
131
+ update: z.record(z.string(), z.any()).describe("Fields to update"),
132
+ });
133
+ // Replace catalog item (PUT)
134
+ export const ReplaceCatalogItemParamsSchema = z.object({
135
+ catalogName: z.string().describe("Name of the catalog"),
136
+ itemId: z.string().describe("ID of the catalog item"),
137
+ value: z.record(z.string(), z.any()).describe("New value for the item"),
138
+ });
139
+ //# sourceMappingURL=catalogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogs.js","sourceRoot":"","sources":["../../src/types/catalogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM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IAC3D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACrD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;CACnE,CAAC,CAAC;AAMH,6BAA6B;AAC7B,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACrD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;CACxE,CAAC,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { z } from "zod";
2
+ /** Unix timestamp for event tracking (API expects int64) */
3
+ export declare const UnixTimestampSchema: z.ZodNumber;
4
+ /** ISO datetime string for scheduling (API expects ISO-8601) */
5
+ export declare const ISODateTimeSchema: z.ZodString;
6
+ /** Flexible timestamp for responses (API returns various formats) */
7
+ export declare const FlexibleTimestampSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
8
+ /** Accepts Date objects or date strings, converts to YYYY-MM-DD HH:MM:SS format for most Iterable endpoints */
9
+ export declare const IterableDateTimeSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<string, string | Date>>;
10
+ /** Accepts Date objects or date strings, converts to ISO-8601 format for scheduling endpoints */
11
+ export declare const IterableISODateTimeSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<string, string | Date>>;
12
+ export type UnixTimestamp = z.infer<typeof UnixTimestampSchema>;
13
+ export type ISODateTime = z.infer<typeof ISODateTimeSchema>;
14
+ export type FlexibleTimestamp = z.infer<typeof FlexibleTimestampSchema>;
15
+ export type IterableDateTime = z.infer<typeof IterableDateTimeSchema>;
16
+ export type IterableISODateTime = z.infer<typeof IterableISODateTimeSchema>;
17
+ export declare const IterableErrorResponseCodeSchema: z.ZodEnum<{
18
+ BadApiKey: "BadApiKey";
19
+ BadAuthorizationHeader: "BadAuthorizationHeader";
20
+ BadJsonBody: "BadJsonBody";
21
+ BadParams: "BadParams";
22
+ BatchTooLarge: "BatchTooLarge";
23
+ DatabaseError: "DatabaseError";
24
+ EmailAlreadyExists: "EmailAlreadyExists";
25
+ ExternalKeyConflict: "ExternalKeyConflict";
26
+ Forbidden: "Forbidden";
27
+ ForbiddenParamsError: "ForbiddenParamsError";
28
+ ForgottenUserError: "ForgottenUserError";
29
+ GenericError: "GenericError";
30
+ InvalidEmailAddressError: "InvalidEmailAddressError";
31
+ InvalidJwtPayload: "InvalidJwtPayload";
32
+ InvalidUserIdError: "InvalidUserIdError";
33
+ JwtUserIdentifiersMismatched: "JwtUserIdentifiersMismatched";
34
+ NotFound: "NotFound";
35
+ QueueEmailError: "QueueEmailError";
36
+ RateLimitExceeded: "RateLimitExceeded";
37
+ RequestFieldsTypesMismatched: "RequestFieldsTypesMismatched";
38
+ Unauthorized: "Unauthorized";
39
+ UniqueFieldsLimitExceeded: "UniqueFieldsLimitExceeded";
40
+ UnknownEmailError: "UnknownEmailError";
41
+ UnknownUserIdError: "UnknownUserIdError";
42
+ UserIdAlreadyExists: "UserIdAlreadyExists";
43
+ }>;
44
+ export type IterableErrorResponseCode = z.infer<typeof IterableErrorResponseCodeSchema>;
45
+ export declare const IterableResponseCodeSchema: z.ZodUnion<readonly [z.ZodLiteral<"Success">, z.ZodEnum<{
46
+ BadApiKey: "BadApiKey";
47
+ BadAuthorizationHeader: "BadAuthorizationHeader";
48
+ BadJsonBody: "BadJsonBody";
49
+ BadParams: "BadParams";
50
+ BatchTooLarge: "BatchTooLarge";
51
+ DatabaseError: "DatabaseError";
52
+ EmailAlreadyExists: "EmailAlreadyExists";
53
+ ExternalKeyConflict: "ExternalKeyConflict";
54
+ Forbidden: "Forbidden";
55
+ ForbiddenParamsError: "ForbiddenParamsError";
56
+ ForgottenUserError: "ForgottenUserError";
57
+ GenericError: "GenericError";
58
+ InvalidEmailAddressError: "InvalidEmailAddressError";
59
+ InvalidJwtPayload: "InvalidJwtPayload";
60
+ InvalidUserIdError: "InvalidUserIdError";
61
+ JwtUserIdentifiersMismatched: "JwtUserIdentifiersMismatched";
62
+ NotFound: "NotFound";
63
+ QueueEmailError: "QueueEmailError";
64
+ RateLimitExceeded: "RateLimitExceeded";
65
+ RequestFieldsTypesMismatched: "RequestFieldsTypesMismatched";
66
+ Unauthorized: "Unauthorized";
67
+ UniqueFieldsLimitExceeded: "UniqueFieldsLimitExceeded";
68
+ UnknownEmailError: "UnknownEmailError";
69
+ UnknownUserIdError: "UnknownUserIdError";
70
+ UserIdAlreadyExists: "UserIdAlreadyExists";
71
+ }>]>;
72
+ export type IterableResponseCode = z.infer<typeof IterableResponseCodeSchema>;
73
+ export declare const IterableSuccessResponseSchema: z.ZodObject<{
74
+ msg: z.ZodString;
75
+ code: z.ZodLiteral<"Success">;
76
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
77
+ }, z.core.$strip>;
78
+ export type IterableSuccessResponse = z.infer<typeof IterableSuccessResponseSchema>;
79
+ export declare const IterableErrorResponseSchema: z.ZodObject<{
80
+ msg: z.ZodString;
81
+ code: z.ZodUnion<readonly [z.ZodEnum<{
82
+ BadApiKey: "BadApiKey";
83
+ BadAuthorizationHeader: "BadAuthorizationHeader";
84
+ BadJsonBody: "BadJsonBody";
85
+ BadParams: "BadParams";
86
+ BatchTooLarge: "BatchTooLarge";
87
+ DatabaseError: "DatabaseError";
88
+ EmailAlreadyExists: "EmailAlreadyExists";
89
+ ExternalKeyConflict: "ExternalKeyConflict";
90
+ Forbidden: "Forbidden";
91
+ ForbiddenParamsError: "ForbiddenParamsError";
92
+ ForgottenUserError: "ForgottenUserError";
93
+ GenericError: "GenericError";
94
+ InvalidEmailAddressError: "InvalidEmailAddressError";
95
+ InvalidJwtPayload: "InvalidJwtPayload";
96
+ InvalidUserIdError: "InvalidUserIdError";
97
+ JwtUserIdentifiersMismatched: "JwtUserIdentifiersMismatched";
98
+ NotFound: "NotFound";
99
+ QueueEmailError: "QueueEmailError";
100
+ RateLimitExceeded: "RateLimitExceeded";
101
+ RequestFieldsTypesMismatched: "RequestFieldsTypesMismatched";
102
+ Unauthorized: "Unauthorized";
103
+ UniqueFieldsLimitExceeded: "UniqueFieldsLimitExceeded";
104
+ UnknownEmailError: "UnknownEmailError";
105
+ UnknownUserIdError: "UnknownUserIdError";
106
+ UserIdAlreadyExists: "UserIdAlreadyExists";
107
+ }>, z.ZodLiteral<"Success">]>;
108
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
109
+ }, z.core.$strip>;
110
+ export type IterableErrorResponse = z.infer<typeof IterableErrorResponseSchema>;
111
+ export declare const IterableConfigSchema: z.ZodObject<{
112
+ apiKey: z.ZodString;
113
+ baseUrl: z.ZodOptional<z.ZodString>;
114
+ timeout: z.ZodOptional<z.ZodNumber>;
115
+ debug: z.ZodOptional<z.ZodBoolean>;
116
+ debugVerbose: z.ZodOptional<z.ZodBoolean>;
117
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
118
+ }, z.core.$strip>;
119
+ export type IterableConfig = z.infer<typeof IterableConfigSchema>;
120
+ /**
121
+ * Sorting parameters for paginated endpoints
122
+ * @template TFields - Union of field names that can be sorted on
123
+ */
124
+ export type SortParam<TFields extends string> = {
125
+ field: TFields;
126
+ direction?: "asc" | "desc";
127
+ };
128
+ /**
129
+ * Creates a Zod schema for sort parameters
130
+ * @template TFields - Union of field names that can be sorted on
131
+ */
132
+ export declare function createSortParamSchema<TFields extends string>(fields: readonly TFields[]): z.ZodOptional<z.ZodObject<{
133
+ field: z.ZodEnum<{ [k_1 in TFields]: k_1; } extends infer T ? { [k in keyof T]: T[k]; } : never>;
134
+ direction: z.ZodOptional<z.ZodEnum<{
135
+ asc: "asc";
136
+ desc: "desc";
137
+ }>>;
138
+ }, z.core.$strip>>;
139
+ /**
140
+ * Formats a sort parameter object into the API's string format
141
+ * @param sort - Sort parameter object or undefined
142
+ * @returns Formatted sort string (e.g., "-createdAt", "+name", "id") or undefined
143
+ */
144
+ export declare function formatSortParam<TFields extends string>(sort: SortParam<TFields> | undefined): string | undefined;
145
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,aAAmB,CAAC;AAEpD,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,aAAwB,CAAC;AAEvD,qEAAqE;AACrE,eAAO,MAAM,uBAAuB,iDAGlC,CAAC;AAEH,+GAA+G;AAC/G,eAAO,MAAM,sBAAsB,iGAW/B,CAAC;AAEL,iGAAiG;AACjG,eAAO,MAAM,yBAAyB,iGAOnC,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAA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}
@@ -0,0 +1,110 @@
1
+ import { z } from "zod";
2
+ /** Unix timestamp for event tracking (API expects int64) */
3
+ export const UnixTimestampSchema = z.number().int();
4
+ /** ISO datetime string for scheduling (API expects ISO-8601) */
5
+ export const ISODateTimeSchema = z.string().datetime();
6
+ /** Flexible timestamp for responses (API returns various formats) */
7
+ export const FlexibleTimestampSchema = z.union([
8
+ z.string().min(1),
9
+ z.number().finite(),
10
+ ]);
11
+ /** Accepts Date objects or date strings, converts to YYYY-MM-DD HH:MM:SS format for most Iterable endpoints */
12
+ export const IterableDateTimeSchema = z
13
+ .union([
14
+ z.date(),
15
+ z.string().refine((str) => !isNaN(Date.parse(str)), "Invalid date string"),
16
+ ])
17
+ .transform((val) => {
18
+ const date = val instanceof Date ? val : new Date(val);
19
+ return date
20
+ .toISOString()
21
+ .replace("T", " ")
22
+ .replace(/\.\d{3}Z$/, "");
23
+ });
24
+ /** Accepts Date objects or date strings, converts to ISO-8601 format for scheduling endpoints */
25
+ export const IterableISODateTimeSchema = z
26
+ .union([
27
+ z.date(),
28
+ z.string().refine((str) => !isNaN(Date.parse(str)), "Invalid date string"),
29
+ ])
30
+ .transform((val) => (val instanceof Date ? val : new Date(val)).toISOString());
31
+ // Error response codes returned by Iterable API (from official API docs)
32
+ export const IterableErrorResponseCodeSchema = z.enum([
33
+ "BadApiKey",
34
+ "BadAuthorizationHeader",
35
+ "BadJsonBody",
36
+ "BadParams",
37
+ "BatchTooLarge",
38
+ "DatabaseError",
39
+ "EmailAlreadyExists",
40
+ "ExternalKeyConflict",
41
+ "Forbidden",
42
+ "ForbiddenParamsError",
43
+ "ForgottenUserError",
44
+ "GenericError",
45
+ "InvalidEmailAddressError",
46
+ "InvalidJwtPayload",
47
+ "InvalidUserIdError",
48
+ "JwtUserIdentifiersMismatched",
49
+ "NotFound",
50
+ "QueueEmailError",
51
+ "RateLimitExceeded",
52
+ "RequestFieldsTypesMismatched",
53
+ "Unauthorized",
54
+ "UniqueFieldsLimitExceeded",
55
+ "UnknownEmailError",
56
+ "UnknownUserIdError",
57
+ "UserIdAlreadyExists",
58
+ ]);
59
+ // All response codes (success + error codes)
60
+ export const IterableResponseCodeSchema = z.union([
61
+ z.literal("Success"),
62
+ IterableErrorResponseCodeSchema,
63
+ ]);
64
+ // Success response for operations that return only success confirmation (create, update, delete)
65
+ // HTTP errors are thrown as exceptions by the base client, so methods only return success responses
66
+ export const IterableSuccessResponseSchema = z.object({
67
+ msg: z.string(),
68
+ code: z.literal("Success"),
69
+ params: z.record(z.string(), z.unknown()).nullable().optional(),
70
+ });
71
+ // Error response structure (used for validation in error handling, not method return types)
72
+ // Note: Iterable sometimes returns "Success" code even for error responses
73
+ export const IterableErrorResponseSchema = z.object({
74
+ msg: z.string(),
75
+ code: z.union([IterableErrorResponseCodeSchema, z.literal("Success")]),
76
+ params: z.record(z.string(), z.unknown()).nullable().optional(),
77
+ });
78
+ export const IterableConfigSchema = z.object({
79
+ apiKey: z.string(),
80
+ baseUrl: z.string().optional(),
81
+ timeout: z.number().optional(),
82
+ debug: z.boolean().optional(),
83
+ debugVerbose: z.boolean().optional(),
84
+ customHeaders: z.record(z.string(), z.string()).optional(),
85
+ });
86
+ /**
87
+ * Creates a Zod schema for sort parameters
88
+ * @template TFields - Union of field names that can be sorted on
89
+ */
90
+ export function createSortParamSchema(fields) {
91
+ return z
92
+ .object({
93
+ field: z.enum(fields),
94
+ direction: z.enum(["asc", "desc"]).optional(),
95
+ })
96
+ .optional()
97
+ .describe("Sort field with optional direction");
98
+ }
99
+ /**
100
+ * Formats a sort parameter object into the API's string format
101
+ * @param sort - Sort parameter object or undefined
102
+ * @returns Formatted sort string (e.g., "-createdAt", "+name", "id") or undefined
103
+ */
104
+ export function formatSortParam(sort) {
105
+ if (!sort)
106
+ return undefined;
107
+ const prefix = sort.direction === "desc" ? "-" : "";
108
+ return `${prefix}${sort.field}`;
109
+ }
110
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","source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