@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,189 @@
1
+ import { z } from "zod";
2
+ import { FlexibleTimestampSchema, IterableDateTimeSchema } from "./common.js";
3
+ /**
4
+ * User management schemas and types
5
+ */
6
+ export const UserProfileSchema = z.object({
7
+ email: z.email(),
8
+ userId: z.string().optional(),
9
+ dataFields: z.record(z.string(), z.any()).optional(),
10
+ preferUserId: z.boolean().optional(),
11
+ mergeNestedObjects: z.boolean().optional(),
12
+ });
13
+ export const UserResponseSchema = z.object({
14
+ user: z.object({
15
+ email: z.string(),
16
+ userId: z.string().optional(),
17
+ dataFields: z.record(z.string(), z.any()).optional(),
18
+ profileUpdatedAt: z.string().optional(),
19
+ }),
20
+ });
21
+ export const GetUserByEmailParamsSchema = z.object({
22
+ email: z.email().describe("Email address of the user to retrieve"),
23
+ });
24
+ export const UpdateUserParamsSchema = z
25
+ .object({
26
+ email: z.email().optional().describe("User email address"),
27
+ userId: z.string().optional().describe("User ID (alternative to email)"),
28
+ dataFields: z
29
+ .record(z.string(), z.any())
30
+ .optional()
31
+ .describe("User data fields to update"),
32
+ mergeNestedObjects: z
33
+ .boolean()
34
+ .optional()
35
+ .describe("Merge top-level objects instead of overwriting them"),
36
+ createNewFields: z
37
+ .boolean()
38
+ .optional()
39
+ .describe("Whether new fields should be ingested and added to the schema"),
40
+ preferUserId: z
41
+ .boolean()
42
+ .optional()
43
+ .describe("Whether to create new user if userId doesn't exist (email-based projects only)"),
44
+ })
45
+ .refine((data) => data.email || data.userId, "Either email or userId must be provided");
46
+ export const GetUserByIdParamsSchema = z.object({
47
+ userId: z.string().describe("User ID to retrieve"),
48
+ });
49
+ export const BulkUpdateUsersParamsSchema = z.object({
50
+ users: z
51
+ .array(z.object({
52
+ email: z.email().optional().describe("User email"),
53
+ userId: z
54
+ .string()
55
+ .optional()
56
+ .describe("User ID (alternative to email)"),
57
+ dataFields: z
58
+ .record(z.string(), z.any())
59
+ .optional()
60
+ .describe("User data fields to update"),
61
+ mergeNestedObjects: z
62
+ .boolean()
63
+ .optional()
64
+ .describe("Whether to merge nested objects"),
65
+ }))
66
+ .describe("Array of users to update"),
67
+ });
68
+ export const DeleteUserByEmailParamsSchema = z.object({
69
+ email: z.email().describe("Email address of the user to delete"),
70
+ });
71
+ export const DeleteUserByUserIdParamsSchema = z.object({
72
+ userId: z.string().describe("User ID of the user to delete"),
73
+ });
74
+ export const UserEventsResponseSchema = z.object({
75
+ events: z.array(z.record(z.string(), z.any())),
76
+ });
77
+ export const SentMessageSchema = z.object({
78
+ messageId: z.string(),
79
+ campaignId: z.number(),
80
+ templateId: z.number().optional(),
81
+ campaignName: z.string().optional(),
82
+ templateName: z.string().optional(),
83
+ messageMedium: z.enum(["Email", "Push", "InApp", "SMS"]),
84
+ status: z.string(),
85
+ sentAt: FlexibleTimestampSchema, // API returns various formats
86
+ createdAt: FlexibleTimestampSchema.optional(), // API returns various formats
87
+ updatedAt: FlexibleTimestampSchema.optional(), // API returns various formats
88
+ dataFields: z.record(z.string(), z.any()).optional(),
89
+ });
90
+ export const GetSentMessagesResponseSchema = z.object({
91
+ messages: z.array(SentMessageSchema),
92
+ totalCount: z.number().optional(),
93
+ });
94
+ export const GetSentMessagesParamsSchema = z
95
+ .object({
96
+ email: z.email().optional().describe("User email address"),
97
+ userId: z.string().optional().describe("User ID (alternative to email)"),
98
+ limit: z
99
+ .number()
100
+ .min(1)
101
+ .max(1000)
102
+ .optional()
103
+ .describe("Maximum number of messages to return (default: 10, max: 1000)"),
104
+ campaignIds: z
105
+ .array(z.number())
106
+ .optional()
107
+ .describe("Only include messages from these campaigns"),
108
+ startDateTime: IterableDateTimeSchema.optional().describe("Start date time (yyyy-MM-dd HH:mm:ss ZZ)"),
109
+ endDateTime: IterableDateTimeSchema.optional().describe("End date time (yyyy-MM-dd HH:mm:ss ZZ)"),
110
+ excludeBlastCampaigns: z
111
+ .boolean()
112
+ .optional()
113
+ .describe("Exclude results from blast campaigns"),
114
+ messageMedium: z
115
+ .enum(["Email", "Push", "InApp", "SMS"])
116
+ .optional()
117
+ .describe("Only include messages of this type"),
118
+ })
119
+ .refine((data) => data.email || data.userId, "Either email or userId must be provided")
120
+ .describe("Parameters for getting messages sent to a user");
121
+ export const GetUserFieldsResponseSchema = z
122
+ .object({
123
+ fields: z.record(z.string(), z.string()), // Field names map to field types as strings
124
+ })
125
+ .passthrough();
126
+ /**
127
+ * Schema for updating user email address
128
+ * Only use with email-based projects. For userId/hybrid projects, use updateUser instead.
129
+ */
130
+ export const UpdateEmailParamsSchema = z
131
+ .object({
132
+ currentEmail: z
133
+ .email()
134
+ .optional()
135
+ .describe("An email address that identifies a user profile in Iterable. Provide a currentEmail or a currentUserId (but not both), depending on how your project identifies users."),
136
+ currentUserId: z
137
+ .string()
138
+ .optional()
139
+ .describe("A user ID that identifies a user profile in Iterable. Provide a currentEmail or a currentUserId (but not both), depending on how your project identifies users."),
140
+ newEmail: z
141
+ .email()
142
+ .describe("The new email address to assign to the specified user."),
143
+ })
144
+ .refine((data) => data.currentEmail || data.currentUserId, "Either currentEmail or currentUserId must be provided");
145
+ /**
146
+ * Schema for updating user subscriptions
147
+ * IMPORTANT: This endpoint overwrites (does not merge) existing data for any non-null fields specified.
148
+ */
149
+ export const UpdateUserSubscriptionsParamsSchema = z
150
+ .object({
151
+ email: z
152
+ .email()
153
+ .optional()
154
+ .describe("An email address that identifies a user profile in Iterable. For each user in your request, provide an email or a userId (but not both), depending on how your project identifies users."),
155
+ userId: z
156
+ .string()
157
+ .optional()
158
+ .describe("A user ID that identifies a user profile in Iterable. For each user in your request, provide an email or a userId (but not both), depending on how your project identifies users."),
159
+ emailListIds: z
160
+ .array(z.number())
161
+ .optional()
162
+ .describe("Lists that a user is subscribed to"),
163
+ subscribedMessageTypeIds: z
164
+ .array(z.number())
165
+ .optional()
166
+ .describe("Individual message type IDs to subscribe (does not impact channel subscriptions). To set a value for this field, first have your CSM enable the opt-in message types feature. Otherwise, attempting to set this field causes an error."),
167
+ unsubscribedChannelIds: z
168
+ .array(z.number())
169
+ .optional()
170
+ .describe("Email channel ids to unsubscribe from"),
171
+ unsubscribedMessageTypeIds: z
172
+ .array(z.number())
173
+ .optional()
174
+ .describe("Individual message type IDs to unsubscribe (does not impact channel subscriptions)."),
175
+ campaignId: z
176
+ .number()
177
+ .optional()
178
+ .describe("Campaign to attribute unsubscribes"),
179
+ templateId: z
180
+ .number()
181
+ .optional()
182
+ .describe("Template to attribute unsubscribes"),
183
+ validateChannelAlignment: z
184
+ .boolean()
185
+ .optional()
186
+ .describe("Defaults to true (validation enabled). When false, allows subscribing users to message types that belong to unsubscribed channels. By default, Iterable validates that subscribed message types belong to subscribed channels. Setting this to false bypasses this validation, allowing you to save message type preferences even when the parent channel is unsubscribed. Users won't receive messages from these types while the channel remains unsubscribed, but their preferences are preserved for when the channel becomes subscribed."),
187
+ })
188
+ .refine((data) => data.email || data.userId, "Either email or userId must be provided");
189
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/types/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG9E;;GAEG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpD,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EA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CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,qFAAqF,CACtF;IACH,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oCAAoC,CAAC;IACjD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oCAAoC,CAAC;IACjD,wBAAwB,EAAE,CAAC;SACxB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,+gBAA+gB,CAChhB;CACJ,CAAC;KACD,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EACnC,yCAAyC,CAC1C,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Webhook management schemas and types
4
+ */
5
+ export declare const WebhookSchema: z.ZodObject<{
6
+ id: z.ZodNumber;
7
+ authType: z.ZodString;
8
+ blastSendEnabled: z.ZodBoolean;
9
+ enabled: z.ZodBoolean;
10
+ endpoint: z.ZodString;
11
+ triggeredSendEnabled: z.ZodBoolean;
12
+ channelIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
13
+ messageTypeIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
14
+ }, z.core.$strip>;
15
+ export type Webhook = z.infer<typeof WebhookSchema>;
16
+ export declare const GetWebhooksResponseSchema: z.ZodObject<{
17
+ webhooks: z.ZodArray<z.ZodObject<{
18
+ id: z.ZodNumber;
19
+ authType: z.ZodString;
20
+ blastSendEnabled: z.ZodBoolean;
21
+ enabled: z.ZodBoolean;
22
+ endpoint: z.ZodString;
23
+ triggeredSendEnabled: z.ZodBoolean;
24
+ channelIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
25
+ messageTypeIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
26
+ }, z.core.$strip>>;
27
+ }, z.core.$strip>;
28
+ export type GetWebhooksResponse = z.infer<typeof GetWebhooksResponseSchema>;
29
+ export type GetWebhooksParams = z.infer<typeof GetWebhooksParamsSchema>;
30
+ export type UpdateWebhookParams = z.infer<typeof UpdateWebhookParamsSchema>;
31
+ export declare const GetWebhooksParamsSchema: z.ZodObject<{
32
+ random_string: z.ZodString;
33
+ }, z.core.$strip>;
34
+ export declare const UpdateWebhookParamsSchema: z.ZodObject<{
35
+ webhookId: z.ZodNumber;
36
+ url: z.ZodOptional<z.ZodURL>;
37
+ events: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ active: z.ZodOptional<z.ZodBoolean>;
39
+ }, z.core.$strip>;
40
+ export declare const WebhooksResponseSchema: z.ZodObject<{
41
+ webhooks: z.ZodArray<z.ZodObject<{
42
+ id: z.ZodNumber;
43
+ authType: z.ZodString;
44
+ blastSendEnabled: z.ZodBoolean;
45
+ enabled: z.ZodBoolean;
46
+ endpoint: z.ZodString;
47
+ triggeredSendEnabled: z.ZodBoolean;
48
+ channelIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
49
+ messageTypeIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>;
52
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/types/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAGH,eAAO,MAAM,aAAa;;;;;;;;;iBASxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAGpD,eAAO,MAAM,yBAAyB;;;;;;;;;;;iBAEpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAEjC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Webhook management schemas and types
4
+ */
5
+ // API webhook response schema based on specification
6
+ export const WebhookSchema = z.object({
7
+ id: z.number(),
8
+ authType: z.string(),
9
+ blastSendEnabled: z.boolean(),
10
+ enabled: z.boolean(),
11
+ endpoint: z.string(),
12
+ triggeredSendEnabled: z.boolean(),
13
+ channelIds: z.array(z.number()).optional(),
14
+ messageTypeIds: z.array(z.number()).optional(),
15
+ });
16
+ // Response schemas
17
+ export const GetWebhooksResponseSchema = z.object({
18
+ webhooks: z.array(WebhookSchema),
19
+ });
20
+ export const GetWebhooksParamsSchema = z.object({
21
+ random_string: z.string().describe("Dummy parameter for no-parameter tools"),
22
+ });
23
+ export const UpdateWebhookParamsSchema = z.object({
24
+ webhookId: z.number().describe("Webhook ID to update"),
25
+ url: z.url().optional().describe("Webhook URL"),
26
+ events: z.array(z.string()).optional().describe("Events to subscribe to"),
27
+ active: z.boolean().optional().describe("Whether webhook is active"),
28
+ });
29
+ export const WebhooksResponseSchema = z.object({
30
+ webhooks: z.array(WebhookSchema),
31
+ });
32
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/types/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE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AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CACjC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@iterable/api",
3
+ "version": "0.0.1",
4
+ "description": "TypeScript client library for the Iterable API",
5
+ "keywords": [
6
+ "iterable",
7
+ "api",
8
+ "client",
9
+ "typescript"
10
+ ],
11
+ "author": "Greg Methvin",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/Iterable/api-client.git"
16
+ },
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "type": "module",
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18.0.0"
27
+ },
28
+ "packageManager": "pnpm@10.17.0",
29
+ "pnpm": {
30
+ "minimumReleaseAge": 4320,
31
+ "minimumReleaseAgeExclude": [
32
+ "@iterable/*"
33
+ ]
34
+ },
35
+ "scripts": {
36
+ "build": "pnpm lint:fix && tsc --project tsconfig.build.json",
37
+ "build:clean": "rm -rf dist && pnpm build",
38
+ "build:dev": "tsc --incremental",
39
+ "build:watch": "tsc --incremental --watch",
40
+ "check": "tsc --noEmit && eslint \"src/**/*.ts\" \"tests/**/*.ts\" --quiet",
41
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" --log-level=warn",
42
+ "lint:fix": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix --quiet",
43
+ "prepublishOnly": "pnpm build",
44
+ "pretest": "pnpm --silent build",
45
+ "test": "jest",
46
+ "test:integration": "jest --testPathPattern=integration",
47
+ "test:unit": "jest --testPathPattern=unit",
48
+ "test:watch": "jest --watch"
49
+ },
50
+ "dependencies": {
51
+ "@t3-oss/env-core": "0.13.8",
52
+ "axios": "1.12.2",
53
+ "csv-parse": "6.1.0",
54
+ "winston": "3.17.0",
55
+ "zod": "4.1.11"
56
+ },
57
+ "devDependencies": {
58
+ "@eslint/js": "9.36.0",
59
+ "@jest/globals": "30.1.2",
60
+ "@swc/core": "1.13.5",
61
+ "@swc/jest": "0.2.39",
62
+ "@types/jest": "29.5.14",
63
+ "@types/node": "24.5.2",
64
+ "@typescript-eslint/eslint-plugin": "8.44.1",
65
+ "@typescript-eslint/parser": "8.44.1",
66
+ "eslint": "9.36.0",
67
+ "eslint-plugin-simple-import-sort": "12.1.1",
68
+ "jest": "29.7.0",
69
+ "prettier": "3.6.2",
70
+ "typescript": "5.9.2"
71
+ },
72
+ "sideEffects": false
73
+ }