shred-api-client 2.0.9 → 2.0.10-rc.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 (127) hide show
  1. package/dist/index.d.mts +2596 -0
  2. package/dist/index.d.ts +2596 -15
  3. package/dist/index.js +1788 -40
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +1747 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +6 -5
  8. package/dist/api/AppConfig.api.d.ts +0 -9
  9. package/dist/api/AppConfig.api.js +0 -42
  10. package/dist/api/Email.api.d.ts +0 -10
  11. package/dist/api/Email.api.js +0 -42
  12. package/dist/api/Goal.api.d.ts +0 -10
  13. package/dist/api/Goal.api.js +0 -42
  14. package/dist/api/Note.api.d.ts +0 -13
  15. package/dist/api/Note.api.js +0 -60
  16. package/dist/api/Notification.api.d.ts +0 -18
  17. package/dist/api/Notification.api.js +0 -80
  18. package/dist/api/Project.api.d.ts +0 -26
  19. package/dist/api/Project.api.js +0 -122
  20. package/dist/api/Prompt.api.d.ts +0 -14
  21. package/dist/api/Prompt.api.js +0 -41
  22. package/dist/api/Subscription.api.d.ts +0 -18
  23. package/dist/api/Subscription.api.js +0 -69
  24. package/dist/api/Tenant.api.d.ts +0 -14
  25. package/dist/api/Tenant.api.js +0 -47
  26. package/dist/api/Track.api.d.ts +0 -9
  27. package/dist/api/Track.api.js +0 -19
  28. package/dist/api/User.api.d.ts +0 -25
  29. package/dist/api/User.api.js +0 -98
  30. package/dist/model/Api.d.ts +0 -26
  31. package/dist/model/Api.js +0 -33
  32. package/dist/model/Context.d.ts +0 -5
  33. package/dist/model/Context.js +0 -2
  34. package/dist/model/Env.d.ts +0 -2
  35. package/dist/model/Env.js +0 -2
  36. package/dist/model/app-config/AppConfig.api.d.ts +0 -9
  37. package/dist/model/app-config/AppConfig.api.js +0 -9
  38. package/dist/model/app-config/index.d.ts +0 -1
  39. package/dist/model/app-config/index.js +0 -17
  40. package/dist/model/asset/Asset.schema.d.ts +0 -43
  41. package/dist/model/asset/Asset.schema.js +0 -19
  42. package/dist/model/asset/index.d.ts +0 -2
  43. package/dist/model/asset/index.js +0 -5
  44. package/dist/model/core/APIResponse.d.ts +0 -6
  45. package/dist/model/core/APIResponse.js +0 -2
  46. package/dist/model/core/Query.d.ts +0 -15
  47. package/dist/model/core/Query.js +0 -2
  48. package/dist/model/core/index.d.ts +0 -2
  49. package/dist/model/core/index.js +0 -18
  50. package/dist/model/email/Email.api.d.ts +0 -11
  51. package/dist/model/email/Email.api.js +0 -9
  52. package/dist/model/email/Email.schema.d.ts +0 -15
  53. package/dist/model/email/Email.schema.js +0 -9
  54. package/dist/model/email/index.d.ts +0 -3
  55. package/dist/model/email/index.js +0 -20
  56. package/dist/model/exceptions/ConflictException.d.ts +0 -4
  57. package/dist/model/exceptions/ConflictException.js +0 -13
  58. package/dist/model/exceptions/ForbiddenException.d.ts +0 -4
  59. package/dist/model/exceptions/ForbiddenException.js +0 -13
  60. package/dist/model/exceptions/InvalidArgumentException.d.ts +0 -4
  61. package/dist/model/exceptions/InvalidArgumentException.js +0 -13
  62. package/dist/model/exceptions/ResourceNotFoundException.d.ts +0 -4
  63. package/dist/model/exceptions/ResourceNotFoundException.js +0 -13
  64. package/dist/model/exceptions/ShredException.d.ts +0 -4
  65. package/dist/model/exceptions/ShredException.js +0 -10
  66. package/dist/model/exceptions/UnauthorizedException.d.ts +0 -4
  67. package/dist/model/exceptions/UnauthorizedException.js +0 -13
  68. package/dist/model/exceptions/index.d.ts +0 -16
  69. package/dist/model/exceptions/index.js +0 -20
  70. package/dist/model/goal/Goal.api.d.ts +0 -11
  71. package/dist/model/goal/Goal.api.js +0 -6
  72. package/dist/model/goal/Goal.schema.d.ts +0 -154
  73. package/dist/model/goal/Goal.schema.js +0 -26
  74. package/dist/model/goal/index.d.ts +0 -3
  75. package/dist/model/goal/index.js +0 -22
  76. package/dist/model/note/Note.api.d.ts +0 -26
  77. package/dist/model/note/Note.api.js +0 -21
  78. package/dist/model/note/Note.schema.d.ts +0 -141
  79. package/dist/model/note/Note.schema.js +0 -30
  80. package/dist/model/note/index.d.ts +0 -3
  81. package/dist/model/note/index.js +0 -21
  82. package/dist/model/notification/Notification.api.d.ts +0 -47
  83. package/dist/model/notification/Notification.api.js +0 -13
  84. package/dist/model/notification/Notification.schema.d.ts +0 -454
  85. package/dist/model/notification/Notification.schema.js +0 -111
  86. package/dist/model/notification/index.d.ts +0 -3
  87. package/dist/model/notification/index.js +0 -30
  88. package/dist/model/project/Project.api.d.ts +0 -83
  89. package/dist/model/project/Project.api.js +0 -26
  90. package/dist/model/project/Project.schema.d.ts +0 -209
  91. package/dist/model/project/Project.schema.js +0 -60
  92. package/dist/model/project/index.d.ts +0 -3
  93. package/dist/model/project/index.js +0 -24
  94. package/dist/model/prompt/Prompt.api.d.ts +0 -31
  95. package/dist/model/prompt/Prompt.api.js +0 -25
  96. package/dist/model/prompt/Prompt.schema.d.ts +0 -165
  97. package/dist/model/prompt/Prompt.schema.js +0 -24
  98. package/dist/model/prompt/index.d.ts +0 -3
  99. package/dist/model/prompt/index.js +0 -22
  100. package/dist/model/subscription/Subscription.api.d.ts +0 -59
  101. package/dist/model/subscription/Subscription.api.js +0 -49
  102. package/dist/model/subscription/Subscription.schema.d.ts +0 -314
  103. package/dist/model/subscription/Subscription.schema.js +0 -53
  104. package/dist/model/subscription/index.d.ts +0 -3
  105. package/dist/model/subscription/index.js +0 -25
  106. package/dist/model/tenant/Tenant.api.d.ts +0 -35
  107. package/dist/model/tenant/Tenant.api.js +0 -29
  108. package/dist/model/tenant/Tenant.schema.d.ts +0 -342
  109. package/dist/model/tenant/Tenant.schema.js +0 -29
  110. package/dist/model/tenant/index.d.ts +0 -3
  111. package/dist/model/tenant/index.js +0 -21
  112. package/dist/model/track/Track.api.d.ts +0 -10
  113. package/dist/model/track/Track.api.js +0 -9
  114. package/dist/model/track/Track.schema.d.ts +0 -44
  115. package/dist/model/track/Track.schema.js +0 -14
  116. package/dist/model/track/index.d.ts +0 -3
  117. package/dist/model/track/index.js +0 -21
  118. package/dist/model/user/User.api.d.ts +0 -86
  119. package/dist/model/user/User.api.js +0 -21
  120. package/dist/model/user/User.schema.d.ts +0 -117
  121. package/dist/model/user/User.schema.js +0 -42
  122. package/dist/model/user/index.d.ts +0 -3
  123. package/dist/model/user/index.js +0 -23
  124. package/dist/util/HTTPClient.d.ts +0 -5
  125. package/dist/util/HTTPClient.js +0 -71
  126. package/dist/util/parseQuery.d.ts +0 -2
  127. package/dist/util/parseQuery.js +0 -25
package/dist/index.js CHANGED
@@ -1,42 +1,1790 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Asset: () => asset_exports,
34
+ Core: () => core_exports,
35
+ Email: () => email_exports,
36
+ Exceptions: () => exceptions_exports,
37
+ Goal: () => goal_exports,
38
+ Note: () => note_exports,
39
+ Notification: () => notification_exports,
40
+ Project: () => project_exports,
41
+ Prompt: () => prompt_exports,
42
+ Subscription: () => subscription_exports,
43
+ Tenant: () => tenant_exports,
44
+ Track: () => track_exports,
45
+ User: () => user_exports,
46
+ default: () => index_default
47
+ });
48
+ module.exports = __toCommonJS(index_exports);
49
+
50
+ // src/util/HTTPClient.ts
51
+ var import_cross_fetch = __toESM(require("cross-fetch"));
52
+ var HOSTS = {
53
+ prod: "https://api.shreditapp.com",
54
+ staging: "https://api.staging.shreditapp.com",
55
+ local: "https://api.staging.shreditapp.com"
56
+ };
57
+ var OLD_HOSTS = {
58
+ prod: "https://api.shredmedia.co",
59
+ staging: "https://api-staging.shredmedia.co",
60
+ local: "https://api-staging.shredmedia.co"
61
+ };
62
+ var HTTPClient = class {
63
+ async makeRequest(env, uri, method, data, context, useLegacyApi) {
64
+ const hostDict = useLegacyApi ? OLD_HOSTS : HOSTS;
65
+ const host = hostDict[env] || hostDict.staging;
66
+ const url = host + uri;
67
+ const headers = {
68
+ "Content-Type": useLegacyApi ? "application/x-www-form-urlencoded" : "application/json"
69
+ };
70
+ if (context?.token) {
71
+ headers["Authorization"] = `Bearer ${context.token}`;
72
+ }
73
+ if (context?.requestId) {
74
+ headers["X-Request-ID"] = context.requestId;
75
+ }
76
+ const fetchOptions = {
77
+ method,
78
+ headers
79
+ };
80
+ if (method !== "GET" && data) {
81
+ fetchOptions.body = useLegacyApi ? new URLSearchParams(data).toString() : JSON.stringify(data);
82
+ }
83
+ try {
84
+ const response = await (0, import_cross_fetch.default)(url, fetchOptions);
85
+ if (!response.ok) {
86
+ const errorText = await response.text();
87
+ throw {
88
+ status: response.status,
89
+ statusText: response.statusText,
90
+ body: errorText
91
+ };
92
+ }
93
+ try {
94
+ return await response.json();
95
+ } catch {
96
+ return await response.text();
97
+ }
98
+ } catch (error) {
99
+ throw {
100
+ message: "Network error",
101
+ original: error
102
+ };
103
+ }
104
+ }
105
+ };
106
+
107
+ // src/model/notification/index.ts
108
+ var notification_exports = {};
109
+ __export(notification_exports, {
110
+ CriteriaSchema: () => CriteriaSchema,
111
+ CriteriaType: () => CriteriaType,
112
+ Endpoints: () => Endpoints,
113
+ Frequency: () => Frequency,
114
+ HistorySchema: () => HistorySchema,
115
+ NotificationDetailSchema: () => NotificationDetailSchema,
116
+ NotificationItemSchema: () => NotificationItemSchema,
117
+ RecurrenceRuleSchema: () => RecurrenceRuleSchema,
118
+ Status: () => Status,
119
+ TransportType: () => TransportType,
120
+ TriggerSchema: () => TriggerSchema,
121
+ WeekDay: () => WeekDay
122
+ });
123
+
124
+ // src/model/notification/Notification.schema.ts
125
+ var import_zod = require("zod");
126
+ var Frequency = /* @__PURE__ */ ((Frequency2) => {
127
+ Frequency2["DAILY"] = "daily";
128
+ Frequency2["WEEKLY"] = "weekly";
129
+ Frequency2["MONTHLY"] = "monthly";
130
+ return Frequency2;
131
+ })(Frequency || {});
132
+ var WeekDay = /* @__PURE__ */ ((WeekDay2) => {
133
+ WeekDay2[WeekDay2["MONDAY"] = 1] = "MONDAY";
134
+ WeekDay2[WeekDay2["TUESDAY"] = 2] = "TUESDAY";
135
+ WeekDay2[WeekDay2["WEDNESDAY"] = 3] = "WEDNESDAY";
136
+ WeekDay2[WeekDay2["THURSDAY"] = 4] = "THURSDAY";
137
+ WeekDay2[WeekDay2["FRIDAY"] = 5] = "FRIDAY";
138
+ WeekDay2[WeekDay2["SATURDAY"] = 6] = "SATURDAY";
139
+ WeekDay2[WeekDay2["SUNDAY"] = 7] = "SUNDAY";
140
+ return WeekDay2;
141
+ })(WeekDay || {});
142
+ var CriteriaType = /* @__PURE__ */ ((CriteriaType2) => {
143
+ CriteriaType2["AllUsers"] = "allUsers";
144
+ CriteriaType2["NoProjects"] = "noProjects";
145
+ CriteriaType2["NoSubscription"] = "noSubscription";
146
+ CriteriaType2["UsersFromTier"] = "usersFromTier";
147
+ return CriteriaType2;
148
+ })(CriteriaType || {});
149
+ var TransportType = /* @__PURE__ */ ((TransportType2) => {
150
+ TransportType2["Push"] = "push";
151
+ TransportType2["Email"] = "email";
152
+ return TransportType2;
153
+ })(TransportType || {});
154
+ var Status = /* @__PURE__ */ ((Status3) => {
155
+ Status3["SCHEDULED"] = "scheduled";
156
+ Status3["RUNNING"] = "running";
157
+ Status3["COMPLETED"] = "completed";
158
+ Status3["FAILED"] = "failed";
159
+ Status3["PAUSED"] = "paused";
160
+ Status3["CANCELLED"] = "cancelled";
161
+ Status3["ACTIVE"] = "active";
162
+ Status3["EXPIRED"] = "expired";
163
+ return Status3;
164
+ })(Status || {});
165
+ var NotificationItemSchema = import_zod.z.object({
166
+ id: import_zod.z.string(),
167
+ userId: import_zod.z.string(),
168
+ triggerId: import_zod.z.string().optional(),
169
+ title: import_zod.z.string(),
170
+ body: import_zod.z.string(),
171
+ status: import_zod.z.enum(["failed", "delivered", "deleted"]),
172
+ deliveredAt: import_zod.z.number(),
173
+ openedAt: import_zod.z.number().optional(),
174
+ deletedAt: import_zod.z.number().optional(),
175
+ cta: import_zod.z.object({ label: import_zod.z.string(), url: import_zod.z.string().url() }).optional(),
176
+ metadata: import_zod.z.record(import_zod.z.union([import_zod.z.string(), import_zod.z.number()])),
177
+ error: import_zod.z.string().optional()
178
+ });
179
+ var NotificationDetailSchema = NotificationItemSchema.pick({
180
+ title: true,
181
+ body: true,
182
+ userId: true,
183
+ metadata: true
184
+ });
185
+ var CriteriaSchema = import_zod.z.object({
186
+ type: import_zod.z.nativeEnum(CriteriaType),
187
+ params: import_zod.z.record(import_zod.z.any())
188
+ });
189
+ var HistorySchema = import_zod.z.object({
190
+ batchId: import_zod.z.string(),
191
+ executedAt: import_zod.z.number(),
192
+ timezone: import_zod.z.string(),
193
+ status: import_zod.z.enum(["success", "failed", "info", "warn"]),
194
+ users: import_zod.z.object({
195
+ total: import_zod.z.number(),
196
+ success: import_zod.z.number(),
197
+ error: import_zod.z.number()
198
+ }),
199
+ errorList: import_zod.z.array(
200
+ import_zod.z.object({
201
+ token: import_zod.z.string(),
202
+ error: import_zod.z.string()
203
+ })
204
+ ).optional(),
205
+ executionTimeDuration: import_zod.z.number().optional()
206
+ });
207
+ var RecurrenceRuleSchema = import_zod.z.object({
208
+ frequency: import_zod.z.nativeEnum(Frequency),
209
+ interval: import_zod.z.number(),
210
+ weekDays: import_zod.z.array(import_zod.z.nativeEnum(WeekDay)).optional(),
211
+ dayOfMonth: import_zod.z.number().optional(),
212
+ endDate: import_zod.z.string().optional(),
213
+ ocurrences: import_zod.z.number().optional()
214
+ });
215
+ var TriggerSchema = import_zod.z.object({
216
+ id: import_zod.z.string(),
217
+ title: import_zod.z.string(),
218
+ description: import_zod.z.string(),
219
+ transportType: import_zod.z.array(import_zod.z.nativeEnum(TransportType)),
220
+ notification: NotificationDetailSchema,
221
+ history: import_zod.z.array(HistorySchema).optional(),
222
+ status: import_zod.z.nativeEnum(Status),
223
+ recurrence: RecurrenceRuleSchema.optional(),
224
+ timezone: import_zod.z.string().nullable().optional(),
225
+ tenantIds: import_zod.z.array(import_zod.z.string()).optional(),
226
+ executionDate: import_zod.z.string().optional(),
227
+ timeOfDay: import_zod.z.string(),
228
+ criteria: CriteriaSchema,
229
+ nextExecution: import_zod.z.number().optional(),
230
+ createdAt: import_zod.z.number().optional(),
231
+ modified: import_zod.z.number().optional()
232
+ });
233
+
234
+ // src/model/notification/Notification.api.ts
235
+ var Endpoints = {
236
+ Create: { uri: "/notifications/trigger/", method: "POST" },
237
+ List: { uri: "/notifications/trigger/list/", method: "GET" },
238
+ Update: { uri: "/notifications/trigger/:id/", method: "PUT" },
239
+ Delete: { uri: "/notifications/trigger/:id/", method: "DELETE" },
240
+ Push: { uri: "/notifications/push/", method: "POST" },
241
+ ListNotifications: { uri: "/notifications/list/", method: "GET" },
242
+ MarkAsRead: { uri: "/notifications/:id/read/", method: "PUT" },
243
+ ClearNotifications: { uri: "/notifications/clear/", method: "DELETE" }
244
+ };
245
+
246
+ // src/api/Notification.api.ts
247
+ var NotificationAPI = class {
248
+ constructor(env) {
249
+ this.env = env;
250
+ this.clientHTTP = new HTTPClient();
251
+ }
252
+ async clearNotifications(ctx) {
253
+ const endpointData = Endpoints.ClearNotifications;
254
+ const data = await this.clientHTTP.makeRequest(
255
+ this.env,
256
+ endpointData.uri,
257
+ endpointData.method,
258
+ null,
259
+ ctx
260
+ );
261
+ return data;
262
+ }
263
+ async markAsRead(ctx, id) {
264
+ const endpointData = Endpoints.MarkAsRead;
265
+ const endpoint = endpointData.uri.replace(":id", id);
266
+ const data = await this.clientHTTP.makeRequest(
267
+ this.env,
268
+ endpoint,
269
+ endpointData.method,
270
+ null,
271
+ ctx
272
+ );
273
+ return data;
274
+ }
275
+ async getNotifications(ctx) {
276
+ const endpointData = Endpoints.ListNotifications;
277
+ const data = await this.clientHTTP.makeRequest(
278
+ this.env,
279
+ endpointData.uri,
280
+ endpointData.method,
281
+ null,
282
+ ctx
283
+ );
284
+ return data;
285
+ }
286
+ async deleteTrigger(ctx, triggerId) {
287
+ const endpointData = Endpoints.Delete;
288
+ const endpoint = endpointData.uri.replace(":id", triggerId);
289
+ const data = await this.clientHTTP.makeRequest(
290
+ this.env,
291
+ endpoint,
292
+ endpointData.method,
293
+ null,
294
+ ctx
295
+ );
296
+ return data;
297
+ }
298
+ async updateTrigger(ctx, triggerId, t) {
299
+ const endpointData = Endpoints.Update;
300
+ const endpoint = endpointData.uri.replace(":id", triggerId);
301
+ const data = await this.clientHTTP.makeRequest(
302
+ this.env,
303
+ endpoint,
304
+ endpointData.method,
305
+ t,
306
+ ctx
307
+ );
308
+ return data;
309
+ }
310
+ async createTrigger(ctx, t) {
311
+ const endpointData = Endpoints.Create;
312
+ const data = await this.clientHTTP.makeRequest(
313
+ this.env,
314
+ endpointData.uri,
315
+ endpointData.method,
316
+ t,
317
+ ctx
318
+ );
319
+ return data;
320
+ }
321
+ async getTriggers(ctx) {
322
+ const endpointInfo = Endpoints.List;
323
+ const data = await this.clientHTTP.makeRequest(
324
+ this.env,
325
+ endpointInfo.uri,
326
+ endpointInfo.method,
327
+ null,
328
+ ctx
329
+ );
330
+ return data;
331
+ }
332
+ async push(ctx, notification) {
333
+ const endpointInfo = Endpoints.Push;
334
+ const data = await this.clientHTTP.makeRequest(
335
+ this.env,
336
+ endpointInfo.uri,
337
+ endpointInfo.method,
338
+ notification,
339
+ ctx
340
+ );
341
+ return data.success;
342
+ }
343
+ };
344
+ var Notification_api_default = NotificationAPI;
345
+
346
+ // src/api/Prompt.api.ts
347
+ var PromptAPI = class {
348
+ constructor(env) {
349
+ this.env = env;
350
+ this.clientHTTP = new HTTPClient();
351
+ }
352
+ async getPrompt(context) {
353
+ const endpointInfo = prompt_exports.Endpoints.GetPrompt;
354
+ const data = await this.clientHTTP.makeRequest(
355
+ this.env,
356
+ endpointInfo.uri,
357
+ endpointInfo.method,
358
+ null,
359
+ context
360
+ );
361
+ return data;
362
+ }
363
+ async getScripts(context) {
364
+ const endpointInfo = prompt_exports.Endpoints.ListScript;
365
+ const data = await this.clientHTTP.makeRequest(
366
+ this.env,
367
+ endpointInfo.uri,
368
+ endpointInfo.method,
369
+ null,
370
+ context
371
+ );
372
+ return data;
373
+ }
374
+ async updateScript(c, id, script) {
375
+ const endpointData = prompt_exports.Endpoints.UpdateScript;
376
+ const endpoint = endpointData.uri.replace(":id", id);
377
+ const data = await this.clientHTTP.makeRequest(
378
+ this.env,
379
+ endpoint,
380
+ endpointData.method,
381
+ { ...script },
382
+ c
383
+ );
384
+ return data;
385
+ }
386
+ async addScript(c, script) {
387
+ const endpointInfo = prompt_exports.Endpoints.AddScript;
388
+ const data = await this.clientHTTP.makeRequest(
389
+ this.env,
390
+ endpointInfo.uri,
391
+ endpointInfo.method,
392
+ { ...script },
393
+ c
394
+ );
395
+ return data;
396
+ }
397
+ async deleteScript(c, id) {
398
+ const endpointData = prompt_exports.Endpoints.DeleteScript;
399
+ const endpoint = endpointData.uri.replace(":id", id);
400
+ const data = await this.clientHTTP.makeRequest(
401
+ this.env,
402
+ endpoint,
403
+ endpointData.method,
404
+ null,
405
+ c
406
+ );
407
+ return data;
408
+ }
409
+ };
410
+ var Prompt_api_default = PromptAPI;
411
+
412
+ // src/api/Subscription.api.ts
413
+ var SubscriptionAPI = class {
414
+ constructor(env) {
415
+ this.env = env;
416
+ this.clientHTTP = new HTTPClient();
417
+ }
418
+ async updatePlan(ctx, planId) {
419
+ const endpointInfo = subscription_exports.Endpoints.UpdatePlan;
420
+ const data = await this.clientHTTP.makeRequest(
421
+ this.env,
422
+ endpointInfo.uri,
423
+ endpointInfo.method,
424
+ { planId },
425
+ ctx
426
+ );
427
+ return data;
428
+ }
429
+ async getProduct(id, context) {
430
+ const endpointInfo = subscription_exports.Endpoints.GetProduct;
431
+ const data = await this.clientHTTP.makeRequest(
432
+ this.env,
433
+ `${endpointInfo.uri}/${id}`,
434
+ endpointInfo.method,
435
+ null,
436
+ context
437
+ );
438
+ return data;
439
+ }
440
+ async getCharges(ctx) {
441
+ const endpointInfo = subscription_exports.Endpoints.GetCharges;
442
+ const data = await this.clientHTTP.makeRequest(
443
+ this.env,
444
+ `${endpointInfo.uri}`,
445
+ endpointInfo.method,
446
+ null,
447
+ ctx
448
+ );
449
+ return data;
450
+ }
451
+ async getSubscription(context, userId) {
452
+ const endpointInfo = subscription_exports.Endpoints.GetActiveSubscription;
453
+ let uri = endpointInfo.uri;
454
+ let method = endpointInfo.method;
455
+ if (userId) {
456
+ const endpointData = subscription_exports.Endpoints.GetUserActiveSubscription;
457
+ const endpoint = endpointData.uri.replace(":userId", userId);
458
+ uri = endpoint;
459
+ method = endpointData.method;
460
+ }
461
+ const data = await this.clientHTTP.makeRequest(
462
+ this.env,
463
+ uri,
464
+ method,
465
+ null,
466
+ context
467
+ );
468
+ return data;
469
+ }
470
+ async charge(ctx) {
471
+ const endpointInfo = subscription_exports.Endpoints.Charge;
472
+ const data = await this.clientHTTP.makeRequest(
473
+ this.env,
474
+ endpointInfo.uri,
475
+ endpointInfo.method,
476
+ null,
477
+ ctx
478
+ );
479
+ return data.success;
480
+ }
481
+ async pause(ctx) {
482
+ const endpointInfo = subscription_exports.Endpoints.Pause;
483
+ const data = await this.clientHTTP.makeRequest(
484
+ this.env,
485
+ endpointInfo.uri,
486
+ endpointInfo.method,
487
+ null,
488
+ ctx
489
+ );
490
+ return data;
491
+ }
492
+ async resume(ctx) {
493
+ const endpointInfo = subscription_exports.Endpoints.Resume;
494
+ const data = await this.clientHTTP.makeRequest(
495
+ this.env,
496
+ endpointInfo.uri,
497
+ endpointInfo.method,
498
+ null,
499
+ ctx
500
+ );
501
+ return data;
502
+ }
503
+ async getProducts(ctx) {
504
+ const endpointInfo = ctx ? subscription_exports.Endpoints.GetProductsByUser : subscription_exports.Endpoints.GetProducts;
505
+ const data = await this.clientHTTP.makeRequest(
506
+ this.env,
507
+ endpointInfo.uri,
508
+ endpointInfo.method,
509
+ null,
510
+ ctx
511
+ );
512
+ return data;
513
+ }
514
+ async createCheckout(planId, ctx) {
515
+ const endpointInfo = subscription_exports.Endpoints.Checkout;
516
+ const data = await this.clientHTTP.makeRequest(
517
+ this.env,
518
+ endpointInfo.uri,
519
+ endpointInfo.method,
520
+ { planId },
521
+ ctx
522
+ );
523
+ return data.url;
524
+ }
525
+ };
526
+ var Subscription_api_default = SubscriptionAPI;
527
+
528
+ // src/api/Tenant.api.ts
529
+ var TenantAPI = class {
530
+ constructor(env) {
531
+ this.env = env;
532
+ this.clientHTTP = new HTTPClient();
533
+ }
534
+ async getByInviteCode(inviteCode, context) {
535
+ const endpointInfo = tenant_exports.Endpoints.GetByInviteCode;
536
+ const data = await this.clientHTTP.makeRequest(
537
+ this.env,
538
+ `${endpointInfo.uri}/${inviteCode}`,
539
+ endpointInfo.method,
540
+ null,
541
+ context
542
+ );
543
+ return data;
544
+ }
545
+ async getTenant(context, tenantId) {
546
+ const endpointInfo = tenant_exports.Endpoints.GetTenant;
547
+ let uri = endpointInfo.uri;
548
+ let method = endpointInfo.method;
549
+ if (tenantId) {
550
+ const endpointData = tenant_exports.Endpoints.GetTenantById;
551
+ const endpoint = endpointData.uri.replace(":tenantId", tenantId);
552
+ uri = endpoint;
553
+ method = endpointData.method;
7
554
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Note = exports.Notification = exports.Goal = exports.Project = exports.Core = exports.Email = exports.Track = exports.Subscription = exports.User = exports.Tenant = exports.Asset = exports.Prompt = exports.Exceptions = void 0;
27
- const Api_1 = require("./model/Api");
28
- //V2
29
- exports.Exceptions = __importStar(require("./model/exceptions"));
30
- exports.Prompt = __importStar(require("./model/prompt"));
31
- exports.Asset = __importStar(require("./model/asset"));
32
- exports.Tenant = __importStar(require("./model/tenant"));
33
- exports.User = __importStar(require("./model/user"));
34
- exports.Subscription = __importStar(require("./model/subscription"));
35
- exports.Track = __importStar(require("./model/track"));
36
- exports.Email = __importStar(require("./model/email"));
37
- exports.Core = __importStar(require("./model/core"));
38
- exports.Project = __importStar(require("./model/project"));
39
- exports.Goal = __importStar(require("./model/goal"));
40
- exports.Notification = __importStar(require("./model/notification"));
41
- exports.Note = __importStar(require("./model/note"));
42
- exports.default = Api_1.ShredAPI;
555
+ const data = await this.clientHTTP.makeRequest(
556
+ this.env,
557
+ uri,
558
+ method,
559
+ null,
560
+ context
561
+ );
562
+ return data;
563
+ }
564
+ async create(t, context) {
565
+ const endpointInfo = tenant_exports.Endpoints.CreateTenant;
566
+ const data = await this.clientHTTP.makeRequest(
567
+ this.env,
568
+ `${endpointInfo.uri}`,
569
+ endpointInfo.method,
570
+ { ...t },
571
+ context
572
+ );
573
+ return data;
574
+ }
575
+ async list(context) {
576
+ const endpointInfo = tenant_exports.Endpoints.ListAll;
577
+ const data = await this.clientHTTP.makeRequest(
578
+ this.env,
579
+ `${endpointInfo.uri}`,
580
+ endpointInfo.method,
581
+ null,
582
+ context
583
+ );
584
+ return data;
585
+ }
586
+ async update(tenantId, updateData, context) {
587
+ const endpointInfo = tenant_exports.Endpoints.UpdateTenant;
588
+ const data = await this.clientHTTP.makeRequest(
589
+ this.env,
590
+ `${endpointInfo.uri}`,
591
+ endpointInfo.method,
592
+ { tenantId, data: updateData },
593
+ context
594
+ );
595
+ return data;
596
+ }
597
+ };
598
+ var Tenant_api_default = TenantAPI;
599
+
600
+ // src/util/parseQuery.ts
601
+ var buildQueryString = (query) => {
602
+ const params = {};
603
+ if (query.perPage) {
604
+ params["perPage"] = [String(query.perPage)];
605
+ }
606
+ if (query.cursor !== void 0 && query.cursor !== null) {
607
+ params["cursor"] = [String(query.cursor)];
608
+ }
609
+ if (query.orderBy) {
610
+ params["orderBy"] = [
611
+ `${String(query.orderBy.field)}:${query.orderBy.direction}`
612
+ ];
613
+ }
614
+ if (query.wheres && query.wheres.length > 0) {
615
+ params["wheres"] = query.wheres.map(
616
+ (w) => `${String(w.field)}:${String(w.operation)}:${String(w.value)}`
617
+ );
618
+ }
619
+ const queryString = Object.entries(params).flatMap(
620
+ ([key, values]) => values.map((value) => `${key}=${encodeURIComponent(value)}`)
621
+ ).join("&");
622
+ return queryString ? `?${queryString}` : "";
623
+ };
624
+
625
+ // src/api/User.api.ts
626
+ var UserAPI = class {
627
+ constructor(env) {
628
+ this.env = env;
629
+ this.clientHTTP = new HTTPClient();
630
+ }
631
+ async search(ctx, query) {
632
+ const endpointData = user_exports.Endpoints.Search;
633
+ const qs = buildQueryString(query);
634
+ const data = await this.clientHTTP.makeRequest(
635
+ this.env,
636
+ `${endpointData.uri}${qs}`,
637
+ endpointData.method,
638
+ null,
639
+ ctx
640
+ );
641
+ return data;
642
+ }
643
+ async deleteAccount(ctx) {
644
+ const endpointData = user_exports.Endpoints.DeleteAccount;
645
+ const data = await this.clientHTTP.makeRequest(
646
+ this.env,
647
+ endpointData.uri,
648
+ endpointData.method,
649
+ null,
650
+ ctx
651
+ );
652
+ return data.success;
653
+ }
654
+ async createIntegrationToken(ctx) {
655
+ const endpointData = user_exports.Endpoints.CreateToken;
656
+ const data = await this.clientHTTP.makeRequest(
657
+ this.env,
658
+ `${endpointData.uri}`,
659
+ endpointData.method,
660
+ null,
661
+ ctx
662
+ );
663
+ return data.token;
664
+ }
665
+ async getIntegrationToken(ctx) {
666
+ const endpointData = user_exports.Endpoints.GetIntegrationToken;
667
+ const data = await this.clientHTTP.makeRequest(
668
+ this.env,
669
+ `${endpointData.uri}`,
670
+ endpointData.method,
671
+ null,
672
+ ctx
673
+ );
674
+ return data.token;
675
+ }
676
+ async sendValidationCode(email) {
677
+ const endpointData = user_exports.Endpoints.SendValidationCode;
678
+ const data = await this.clientHTTP.makeRequest(
679
+ this.env,
680
+ `${endpointData.uri}?email=${email}`,
681
+ endpointData.method
682
+ );
683
+ return data.success;
684
+ }
685
+ async changePassword(email, pass, passConfirm, code) {
686
+ const endpointData = user_exports.Endpoints.ChangePassword;
687
+ const data = await this.clientHTTP.makeRequest(
688
+ this.env,
689
+ endpointData.uri,
690
+ endpointData.method,
691
+ { email, pass, passConfirm, code }
692
+ );
693
+ return data.success;
694
+ }
695
+ async changeEmail(ctx, email, code) {
696
+ const endpointData = user_exports.Endpoints.ChangeEmail;
697
+ const data = await this.clientHTTP.makeRequest(
698
+ this.env,
699
+ endpointData.uri,
700
+ endpointData.method,
701
+ { email, code },
702
+ ctx
703
+ );
704
+ return data.success;
705
+ }
706
+ async confirmCode(email, code, keepCode) {
707
+ const endpointData = user_exports.Endpoints.ConfirmCode;
708
+ const data = await this.clientHTTP.makeRequest(
709
+ this.env,
710
+ `${endpointData.uri}?email=${email}&code=${code}&keepCode=${keepCode}`,
711
+ endpointData.method
712
+ );
713
+ return data.success;
714
+ }
715
+ async isEmailAvaliable(email) {
716
+ const endpointData = user_exports.Endpoints.IsEmailAvaliable;
717
+ const data = await this.clientHTTP.makeRequest(
718
+ this.env,
719
+ `${endpointData.uri}?email=${email}`,
720
+ endpointData.method
721
+ );
722
+ return data.isValid;
723
+ }
724
+ async update(context, update) {
725
+ const endpointData = user_exports.Endpoints.UpdateUser;
726
+ const data = await this.clientHTTP.makeRequest(
727
+ this.env,
728
+ `${endpointData.uri}`,
729
+ endpointData.method,
730
+ { ...update },
731
+ context
732
+ );
733
+ return data.isValid;
734
+ }
735
+ async getBindedUsers(context) {
736
+ const endpointData = user_exports.Endpoints.GetBindedUsers;
737
+ const data = await this.clientHTTP.makeRequest(
738
+ this.env,
739
+ `${endpointData.uri}`,
740
+ endpointData.method,
741
+ null,
742
+ context
743
+ );
744
+ return data;
745
+ }
746
+ async setup(context) {
747
+ const endpointData = user_exports.Endpoints.Setup;
748
+ const data = await this.clientHTTP.makeRequest(
749
+ this.env,
750
+ `${endpointData.uri}`,
751
+ endpointData.method,
752
+ null,
753
+ context
754
+ );
755
+ return data.success;
756
+ }
757
+ async authenticate(email, password, system) {
758
+ const endpointData = user_exports.Endpoints.Authenticate;
759
+ const data = await this.clientHTTP.makeRequest(
760
+ this.env,
761
+ `${endpointData.uri}`,
762
+ endpointData.method,
763
+ { system, email, password }
764
+ );
765
+ return data.token;
766
+ }
767
+ async createUser(email, name, password, passwordConfirmation, profession, invitationCode) {
768
+ const endpointData = user_exports.Endpoints.CreateUser;
769
+ const data = await this.clientHTTP.makeRequest(
770
+ this.env,
771
+ endpointData.uri,
772
+ endpointData.method,
773
+ {
774
+ email,
775
+ name,
776
+ password,
777
+ passwordConfirmation,
778
+ profession,
779
+ invitationCode
780
+ },
781
+ null
782
+ );
783
+ return data;
784
+ }
785
+ async getUserInfo(context) {
786
+ const endpointData = user_exports.Endpoints.GetUserInfo;
787
+ const data = await this.clientHTTP.makeRequest(
788
+ this.env,
789
+ endpointData.uri,
790
+ endpointData.method,
791
+ null,
792
+ context
793
+ );
794
+ return data;
795
+ }
796
+ };
797
+ var User_api_default = UserAPI;
798
+
799
+ // src/api/Track.api.ts
800
+ var TrackAPI = class {
801
+ constructor(env) {
802
+ this.env = env;
803
+ this.clientHTTP = new HTTPClient();
804
+ }
805
+ async send(t) {
806
+ const endpointInfo = track_exports.Endpoints.Track;
807
+ const data = await this.clientHTTP.makeRequest(
808
+ this.env,
809
+ `${endpointInfo.uri}`,
810
+ endpointInfo.method,
811
+ t
812
+ );
813
+ return data;
814
+ }
815
+ };
816
+ var Track_api_default = TrackAPI;
817
+
818
+ // src/model/email/index.ts
819
+ var email_exports = {};
820
+ __export(email_exports, {
821
+ EmailSchema: () => EmailSchema,
822
+ Endpoints: () => Endpoints2
823
+ });
824
+
825
+ // src/model/email/Email.schema.ts
826
+ var import_zod2 = require("zod");
827
+ var EmailSchema = import_zod2.z.object({
828
+ to: import_zod2.z.string().email().optional(),
829
+ subject: import_zod2.z.string(),
830
+ body: import_zod2.z.string()
831
+ });
832
+
833
+ // src/model/email/Email.api.ts
834
+ var Endpoints2 = {
835
+ SendEmail: {
836
+ uri: "/emails/public/send",
837
+ method: "POST"
838
+ }
839
+ };
840
+
841
+ // src/api/Email.api.ts
842
+ var EmailAPI = class {
843
+ constructor(env) {
844
+ this.env = env;
845
+ this.clientHTTP = new HTTPClient();
846
+ }
847
+ async send(email, ctx) {
848
+ const endpointInfo = Endpoints2.SendEmail;
849
+ const data = await this.clientHTTP.makeRequest(
850
+ this.env,
851
+ endpointInfo.uri,
852
+ endpointInfo.method,
853
+ email,
854
+ ctx
855
+ );
856
+ return data.result;
857
+ }
858
+ };
859
+ var Email_api_default = EmailAPI;
860
+
861
+ // src/model/project/index.ts
862
+ var project_exports = {};
863
+ __export(project_exports, {
864
+ CaptionStyle: () => CaptionStyle,
865
+ Endpoints: () => Endpoints3,
866
+ ProjectSchema: () => ProjectSchema,
867
+ Status: () => Status2,
868
+ Styles: () => Styles,
869
+ TimelineItemSchema: () => TimelineItemSchema
870
+ });
871
+
872
+ // src/model/project/Project.schema.ts
873
+ var import_zod4 = require("zod");
874
+
875
+ // src/model/asset/index.ts
876
+ var asset_exports = {};
877
+ __export(asset_exports, {
878
+ AssetSchema: () => AssetSchema
879
+ });
880
+
881
+ // src/model/asset/Asset.schema.ts
882
+ var import_zod3 = require("zod");
883
+ var AssetSchema = import_zod3.z.object({
884
+ assetId: import_zod3.z.string(),
885
+ fileName: import_zod3.z.string(),
886
+ extension: import_zod3.z.string(),
887
+ fileSize: import_zod3.z.number(),
888
+ assetUrl: import_zod3.z.string().url(),
889
+ thumbnailUrl: import_zod3.z.string().url(),
890
+ type: import_zod3.z.string(),
891
+ duration: import_zod3.z.number().optional(),
892
+ progress: import_zod3.z.number().optional(),
893
+ error: import_zod3.z.string().optional(),
894
+ authorId: import_zod3.z.string(),
895
+ uploadedAt: import_zod3.z.number()
896
+ });
897
+
898
+ // src/model/project/Project.schema.ts
899
+ var Status2 = /* @__PURE__ */ ((Status3) => {
900
+ Status3[Status3["SUBMITTED"] = 0] = "SUBMITTED";
901
+ Status3[Status3["EDITING"] = 1] = "EDITING";
902
+ Status3[Status3["COMPLETED"] = 2] = "COMPLETED";
903
+ Status3[Status3["WAITING_APPROVE"] = 3] = "WAITING_APPROVE";
904
+ Status3[Status3["DENIED"] = 4] = "DENIED";
905
+ Status3[Status3["REVISIONING"] = 5] = "REVISIONING";
906
+ Status3[Status3["CANCELLED"] = 6] = "CANCELLED";
907
+ Status3[Status3["SCHEDULED"] = 7] = "SCHEDULED";
908
+ return Status3;
909
+ })(Status2 || {});
910
+ var CaptionStyle = /* @__PURE__ */ ((CaptionStyle2) => {
911
+ CaptionStyle2[CaptionStyle2["ONE_LINE"] = 1] = "ONE_LINE";
912
+ CaptionStyle2[CaptionStyle2["ONE_LINE_EMOJIS"] = 2] = "ONE_LINE_EMOJIS";
913
+ CaptionStyle2[CaptionStyle2["TWO_LINES"] = 5] = "TWO_LINES";
914
+ CaptionStyle2[CaptionStyle2["TWO_LINES_EMOJIS"] = 3] = "TWO_LINES_EMOJIS";
915
+ CaptionStyle2[CaptionStyle2["HOME_HIGHLIGHT"] = 4] = "HOME_HIGHLIGHT";
916
+ return CaptionStyle2;
917
+ })(CaptionStyle || {});
918
+ var StatusSchema = import_zod4.z.nativeEnum(Status2);
919
+ var CaptionStyleStatus = import_zod4.z.nativeEnum(CaptionStyle);
920
+ var Styles = [
921
+ { value: 1 /* ONE_LINE */, label: "One Line" },
922
+ { value: 2 /* ONE_LINE_EMOJIS */, label: "One Line + Emojis" },
923
+ { value: 5 /* TWO_LINES */, label: "Two Lines" },
924
+ { value: 3 /* TWO_LINES_EMOJIS */, label: "Two Lines + Emojis" },
925
+ { value: 4 /* HOME_HIGHLIGHT */, label: "Home Tour" }
926
+ ];
927
+ var TimelineItemSchema = import_zod4.z.object({
928
+ status: import_zod4.z.nativeEnum(Status2),
929
+ title: import_zod4.z.string(),
930
+ description: import_zod4.z.string(),
931
+ timestamp: import_zod4.z.number(),
932
+ metadata: import_zod4.z.record(import_zod4.z.any())
933
+ });
934
+ var ProjectSchema = import_zod4.z.object({
935
+ id: import_zod4.z.string(),
936
+ title: import_zod4.z.string(),
937
+ instructions: import_zod4.z.string(),
938
+ submitMonth: import_zod4.z.string(),
939
+ captionStyle: import_zod4.z.nativeEnum(CaptionStyle),
940
+ finalVideoId: import_zod4.z.string().optional(),
941
+ thumbnailUrl: import_zod4.z.string().optional(),
942
+ modified: import_zod4.z.number(),
943
+ captionSuggestion: import_zod4.z.string().optional(),
944
+ editorId: import_zod4.z.string(),
945
+ userId: import_zod4.z.string(),
946
+ assets: import_zod4.z.array(AssetSchema).optional(),
947
+ expirationTimestamp: import_zod4.z.number(),
948
+ isFree: import_zod4.z.boolean().optional(),
949
+ timeline: import_zod4.z.array(TimelineItemSchema),
950
+ submitTimestamp: import_zod4.z.number(),
951
+ tenantId: import_zod4.z.string().optional(),
952
+ status: import_zod4.z.nativeEnum(Status2)
953
+ });
954
+
955
+ // src/model/project/Project.api.ts
956
+ var Endpoints3 = {
957
+ List: { uri: "/projects/list", method: "GET" },
958
+ GetNext: { uri: "/projects/:userId/next", method: "GET" },
959
+ CreateProject: { uri: "/projects/create", method: "POST" },
960
+ FindOne: { uri: `/projects/:projectId/`, method: "GET" },
961
+ GetGoals: { uri: `/projects/goals/list/`, method: "GET" },
962
+ Review: { uri: "/projects/:projectId/review/", method: "POST" },
963
+ Cancel: { uri: "/projects/:projectId/cancel/", method: "DELETE" },
964
+ StartEdition: { uri: "/projects/:projectId/start/", method: "PUT" },
965
+ SendToApproval: {
966
+ uri: "/projects/:projectId/sendToApproval/",
967
+ method: "PUT"
968
+ },
969
+ IsEligibleForFreeProject: {
970
+ uri: "/projects/free/allowed/",
971
+ method: "GET"
972
+ },
973
+ Approve: { uri: "/projects/:projectId/approve/", method: "POST" },
974
+ Unschedule: { uri: "/projects/:projectId/unschedule/", method: "POST" },
975
+ Rollback: { uri: "/projects/:projectId/rollback/", method: "POST" },
976
+ Deny: { uri: "/projects/:projectId/deny/", method: "POST" },
977
+ GetUserHistory: { uri: "/projects/user/:userId/history/", method: "GET" }
978
+ };
979
+
980
+ // src/api/Project.api.ts
981
+ var ProjectAPI = class {
982
+ constructor(env) {
983
+ this.permissions = {
984
+ isEligibleForFreeProject: async (ctx) => {
985
+ const endpointData = Endpoints3.IsEligibleForFreeProject;
986
+ const data = await this.clientHTTP.makeRequest(
987
+ this.env,
988
+ endpointData.uri,
989
+ endpointData.method,
990
+ null,
991
+ ctx
992
+ );
993
+ return data.canCreate;
994
+ }
995
+ };
996
+ this.env = env;
997
+ this.clientHTTP = new HTTPClient();
998
+ }
999
+ async getNext(ctx, userId) {
1000
+ const endpointData = Endpoints3.GetNext;
1001
+ const endpoint = endpointData.uri.replace(":userId", userId);
1002
+ const data = await this.clientHTTP.makeRequest(
1003
+ this.env,
1004
+ endpoint,
1005
+ endpointData.method,
1006
+ null,
1007
+ ctx
1008
+ );
1009
+ return data;
1010
+ }
1011
+ async getUserHistory(context, userId) {
1012
+ const endpointData = Endpoints3.GetUserHistory;
1013
+ const endpoint = endpointData.uri.replace(":userId", userId);
1014
+ const data = await this.clientHTTP.makeRequest(
1015
+ this.env,
1016
+ endpoint,
1017
+ endpointData.method,
1018
+ null,
1019
+ context
1020
+ );
1021
+ return data;
1022
+ }
1023
+ async find(context, projectId) {
1024
+ const endpointData = Endpoints3.FindOne;
1025
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
1026
+ const data = await this.clientHTTP.makeRequest(
1027
+ this.env,
1028
+ endpoint,
1029
+ endpointData.method,
1030
+ null,
1031
+ context
1032
+ );
1033
+ return data;
1034
+ }
1035
+ async create(context, createData) {
1036
+ const endpointData = Endpoints3.CreateProject;
1037
+ const data = await this.clientHTTP.makeRequest(
1038
+ this.env,
1039
+ endpointData.uri,
1040
+ endpointData.method,
1041
+ createData,
1042
+ context
1043
+ );
1044
+ return data;
1045
+ }
1046
+ async review(ctx, pId, revision) {
1047
+ const endpointData = Endpoints3.Review;
1048
+ const endpoint = endpointData.uri.replace(":projectId", pId);
1049
+ const data = await this.clientHTTP.makeRequest(
1050
+ this.env,
1051
+ endpoint,
1052
+ endpointData.method,
1053
+ { revision },
1054
+ ctx
1055
+ );
1056
+ return data.success;
1057
+ }
1058
+ async cancel(ctx, projectId) {
1059
+ const endpointData = Endpoints3.Cancel;
1060
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
1061
+ const data = await this.clientHTTP.makeRequest(
1062
+ this.env,
1063
+ endpoint,
1064
+ endpointData.method,
1065
+ null,
1066
+ ctx
1067
+ );
1068
+ return data.success;
1069
+ }
1070
+ async list(context, query) {
1071
+ const endpointData = Endpoints3.List;
1072
+ const qs = buildQueryString(query);
1073
+ const data = await this.clientHTTP.makeRequest(
1074
+ this.env,
1075
+ `${endpointData.uri}${qs}`,
1076
+ endpointData.method,
1077
+ null,
1078
+ context
1079
+ );
1080
+ return data;
1081
+ }
1082
+ async deny(ctx, pId, denyFB, categories) {
1083
+ const endpointData = Endpoints3.Deny;
1084
+ const endpoint = endpointData.uri.replace(":projectId", pId);
1085
+ const data = await this.clientHTTP.makeRequest(
1086
+ this.env,
1087
+ endpoint,
1088
+ endpointData.method,
1089
+ { denyFeedback: denyFB, categories: categories || [] },
1090
+ ctx
1091
+ );
1092
+ return data.success;
1093
+ }
1094
+ async unschedule(context, projectId) {
1095
+ const endpointData = Endpoints3.Unschedule;
1096
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
1097
+ const data = await this.clientHTTP.makeRequest(
1098
+ this.env,
1099
+ endpoint,
1100
+ endpointData.method,
1101
+ null,
1102
+ context
1103
+ );
1104
+ return data.success;
1105
+ }
1106
+ async rollback(context, projectId) {
1107
+ const endpointData = Endpoints3.Rollback;
1108
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
1109
+ const data = await this.clientHTTP.makeRequest(
1110
+ this.env,
1111
+ endpoint,
1112
+ endpointData.method,
1113
+ null,
1114
+ context
1115
+ );
1116
+ return data.success;
1117
+ }
1118
+ async start(context, projectId) {
1119
+ const endpointData = Endpoints3.StartEdition;
1120
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
1121
+ const data = await this.clientHTTP.makeRequest(
1122
+ this.env,
1123
+ endpoint,
1124
+ endpointData.method,
1125
+ null,
1126
+ context
1127
+ );
1128
+ return data.success;
1129
+ }
1130
+ async approve(ctx, pId, approve) {
1131
+ const endpointData = Endpoints3.Approve;
1132
+ const endpoint = endpointData.uri.replace(":projectId", pId);
1133
+ const data = await this.clientHTTP.makeRequest(
1134
+ this.env,
1135
+ endpoint,
1136
+ endpointData.method,
1137
+ approve,
1138
+ ctx
1139
+ );
1140
+ return data.success;
1141
+ }
1142
+ async sendToApproval(context, projectId, approval) {
1143
+ const endpointData = Endpoints3.SendToApproval;
1144
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
1145
+ const data = await this.clientHTTP.makeRequest(
1146
+ this.env,
1147
+ endpoint,
1148
+ endpointData.method,
1149
+ approval,
1150
+ context
1151
+ );
1152
+ return data.success;
1153
+ }
1154
+ };
1155
+ var Project_api_default = ProjectAPI;
1156
+
1157
+ // src/model/goal/index.ts
1158
+ var goal_exports = {};
1159
+ __export(goal_exports, {
1160
+ DailyMilestoneSchema: () => DailyMilestoneSchema,
1161
+ Endpoints: () => Endpoints4,
1162
+ GoalSchema: () => GoalSchema,
1163
+ WeeklyMilestoneSchema: () => WeeklyMilestoneSchema
1164
+ });
1165
+
1166
+ // src/model/goal/Goal.schema.ts
1167
+ var import_zod5 = require("zod");
1168
+ var DailyMilestoneSchema = import_zod5.z.object({
1169
+ id: import_zod5.z.string(),
1170
+ date: import_zod5.z.string(),
1171
+ target: import_zod5.z.number(),
1172
+ progress: import_zod5.z.number()
1173
+ });
1174
+ var WeeklyMilestoneSchema = import_zod5.z.object({
1175
+ id: import_zod5.z.string(),
1176
+ week: import_zod5.z.string(),
1177
+ target: import_zod5.z.number(),
1178
+ progress: import_zod5.z.number(),
1179
+ dailyMilestones: import_zod5.z.array(DailyMilestoneSchema)
1180
+ });
1181
+ var GoalSchema = import_zod5.z.object({
1182
+ id: import_zod5.z.string(),
1183
+ editorId: import_zod5.z.string(),
1184
+ month: import_zod5.z.string(),
1185
+ // ex: "2024-04"
1186
+ target: import_zod5.z.number(),
1187
+ progress: import_zod5.z.number(),
1188
+ createdAt: import_zod5.z.number(),
1189
+ weeklyMilestones: import_zod5.z.array(WeeklyMilestoneSchema)
1190
+ });
1191
+
1192
+ // src/model/goal/Goal.api.ts
1193
+ var Endpoints4 = {
1194
+ GetGoals: { uri: `/projects/goals/list/`, method: "GET" }
1195
+ };
1196
+
1197
+ // src/api/Goal.api.ts
1198
+ var GoalAPI = class {
1199
+ constructor(env) {
1200
+ this.env = env;
1201
+ this.clientHTTP = new HTTPClient();
1202
+ }
1203
+ async getGoals(context) {
1204
+ const endpointData = Endpoints4.GetGoals;
1205
+ const data = await this.clientHTTP.makeRequest(
1206
+ this.env,
1207
+ endpointData.uri,
1208
+ endpointData.method,
1209
+ null,
1210
+ context
1211
+ );
1212
+ return data;
1213
+ }
1214
+ };
1215
+ var Goal_api_default = GoalAPI;
1216
+
1217
+ // src/model/app-config/AppConfig.api.ts
1218
+ var Endpoints5 = {
1219
+ Version: {
1220
+ uri: "/app-config/public/version/latest",
1221
+ method: "GET"
1222
+ }
1223
+ };
1224
+
1225
+ // src/api/AppConfig.api.ts
1226
+ var AppConfigAPI = class {
1227
+ constructor(env) {
1228
+ this.env = env;
1229
+ this.clientHTTP = new HTTPClient();
1230
+ }
1231
+ async version() {
1232
+ const endpointInfo = Endpoints5.Version;
1233
+ const data = await this.clientHTTP.makeRequest(
1234
+ this.env,
1235
+ endpointInfo.uri,
1236
+ endpointInfo.method
1237
+ );
1238
+ return data.version;
1239
+ }
1240
+ };
1241
+ var AppConfig_api_default = AppConfigAPI;
1242
+
1243
+ // src/model/note/index.ts
1244
+ var note_exports = {};
1245
+ __export(note_exports, {
1246
+ Endpoints: () => Endpoints6,
1247
+ NoteHistorySchema: () => NoteHistorySchema,
1248
+ NoteSchema: () => NoteSchema
1249
+ });
1250
+
1251
+ // src/model/note/Note.schema.ts
1252
+ var import_zod6 = require("zod");
1253
+ var NoteHistorySchema = import_zod6.z.object({
1254
+ type: import_zod6.z.enum([
1255
+ "created",
1256
+ "updated",
1257
+ "deleted",
1258
+ "asset-added",
1259
+ "asset-removed"
1260
+ ]),
1261
+ actorEmail: import_zod6.z.string().email(),
1262
+ timestamp: import_zod6.z.number(),
1263
+ details: import_zod6.z.string().optional()
1264
+ });
1265
+ var NoteSchema = import_zod6.z.object({
1266
+ id: import_zod6.z.string(),
1267
+ userId: import_zod6.z.string(),
1268
+ authorEmail: import_zod6.z.string().email(),
1269
+ assets: import_zod6.z.array(AssetSchema),
1270
+ title: import_zod6.z.string(),
1271
+ content: import_zod6.z.string(),
1272
+ createdAt: import_zod6.z.number(),
1273
+ modified: import_zod6.z.number(),
1274
+ history: import_zod6.z.array(NoteHistorySchema).optional()
1275
+ });
1276
+
1277
+ // src/model/note/Note.api.ts
1278
+ var Endpoints6 = {
1279
+ GetNotes: {
1280
+ uri: "/user-context/notes/user/:userId/",
1281
+ method: "GET"
1282
+ },
1283
+ AddNote: {
1284
+ uri: "/user-context/notes/",
1285
+ method: "PUT"
1286
+ },
1287
+ DeleteNote: {
1288
+ uri: "/user-context/notes/:id/",
1289
+ method: "DELETE"
1290
+ },
1291
+ UpdateNote: {
1292
+ uri: "/user-context/notes/:id/",
1293
+ method: "POST"
1294
+ }
1295
+ };
1296
+
1297
+ // src/api/Note.api.ts
1298
+ var NoteAPI = class {
1299
+ constructor(env) {
1300
+ this.env = env;
1301
+ this.clientHTTP = new HTTPClient();
1302
+ }
1303
+ async list(c, userId) {
1304
+ const endpointData = Endpoints6.GetNotes;
1305
+ const endpoint = endpointData.uri.replace(":userId", userId);
1306
+ const data = await this.clientHTTP.makeRequest(
1307
+ this.env,
1308
+ endpoint,
1309
+ endpointData.method,
1310
+ null,
1311
+ c
1312
+ );
1313
+ return data;
1314
+ }
1315
+ async add(c, note) {
1316
+ const endpointData = Endpoints6.AddNote;
1317
+ const data = await this.clientHTTP.makeRequest(
1318
+ this.env,
1319
+ endpointData.uri,
1320
+ endpointData.method,
1321
+ note,
1322
+ c
1323
+ );
1324
+ return data;
1325
+ }
1326
+ async update(c, id, toUpdate) {
1327
+ const endpointData = Endpoints6.UpdateNote;
1328
+ const endpoint = endpointData.uri.replace(":id", id);
1329
+ const data = await this.clientHTTP.makeRequest(
1330
+ this.env,
1331
+ endpoint,
1332
+ endpointData.method,
1333
+ toUpdate,
1334
+ c
1335
+ );
1336
+ return data;
1337
+ }
1338
+ async delete(c, id) {
1339
+ const endpointData = Endpoints6.DeleteNote;
1340
+ const endpoint = endpointData.uri.replace(":id", id);
1341
+ const data = await this.clientHTTP.makeRequest(
1342
+ this.env,
1343
+ endpoint,
1344
+ endpointData.method,
1345
+ null,
1346
+ c
1347
+ );
1348
+ return data;
1349
+ }
1350
+ };
1351
+ var Note_api_default = NoteAPI;
1352
+
1353
+ // src/model/Api.ts
1354
+ var ShredAPI = class {
1355
+ constructor(env) {
1356
+ this.user = new User_api_default(env);
1357
+ this.goal = new Goal_api_default(env);
1358
+ this.prompt = new Prompt_api_default(env);
1359
+ this.subscription = new Subscription_api_default(env);
1360
+ this.pushNotification = new Notification_api_default(env);
1361
+ this.email = new Email_api_default(env);
1362
+ this.tenant = new Tenant_api_default(env);
1363
+ this.project = new Project_api_default(env);
1364
+ this.app = new AppConfig_api_default(env);
1365
+ this.track = new Track_api_default(env);
1366
+ this.note = new Note_api_default(env);
1367
+ }
1368
+ };
1369
+
1370
+ // src/model/exceptions/index.ts
1371
+ var exceptions_exports = {};
1372
+ __export(exceptions_exports, {
1373
+ default: () => exceptions_default
1374
+ });
1375
+
1376
+ // src/model/exceptions/ShredException.ts
1377
+ var ShredException = class extends Error {
1378
+ constructor(message, status) {
1379
+ super(message);
1380
+ this.name = "ShredException";
1381
+ this.status = status;
1382
+ }
1383
+ };
1384
+
1385
+ // src/model/exceptions/ConflictException.ts
1386
+ var ConflictException = class extends ShredException {
1387
+ constructor(message) {
1388
+ super(message, 409);
1389
+ this.name = "ConflictException";
1390
+ }
1391
+ };
1392
+
1393
+ // src/model/exceptions/InvalidArgumentException.ts
1394
+ var InvalidArgumentException = class extends ShredException {
1395
+ constructor(message) {
1396
+ super(message, 400);
1397
+ this.name = "InvalidArgumentException";
1398
+ }
1399
+ };
1400
+
1401
+ // src/model/exceptions/ResourceNotFoundException.ts
1402
+ var ResourceNotFoundException = class extends ShredException {
1403
+ constructor(message) {
1404
+ super(message, 404);
1405
+ this.name = "ResourceNotFoundException";
1406
+ }
1407
+ };
1408
+
1409
+ // src/model/exceptions/UnauthorizedException.ts
1410
+ var UnauthorizedException = class extends ShredException {
1411
+ constructor(message) {
1412
+ super(message, 401);
1413
+ this.name = "UnauthorizedException";
1414
+ }
1415
+ };
1416
+
1417
+ // src/model/exceptions/ForbiddenException.ts
1418
+ var ForbiddenException = class extends ShredException {
1419
+ constructor(message) {
1420
+ super(message, 403);
1421
+ this.name = "ForbiddenException";
1422
+ }
1423
+ };
1424
+
1425
+ // src/model/exceptions/index.ts
1426
+ var Exceptions = {
1427
+ ConflictException,
1428
+ InvalidArgumentException,
1429
+ ResourceNotFoundException,
1430
+ ShredException,
1431
+ UnauthorizedException,
1432
+ ForbiddenException
1433
+ };
1434
+ var exceptions_default = Exceptions;
1435
+
1436
+ // src/model/prompt/index.ts
1437
+ var prompt_exports = {};
1438
+ __export(prompt_exports, {
1439
+ CategorySchema: () => CategorySchema,
1440
+ Endpoints: () => Endpoints7,
1441
+ PromptSchema: () => PromptSchema,
1442
+ ScriptSchema: () => ScriptSchema
1443
+ });
1444
+
1445
+ // src/model/prompt/Prompt.schema.ts
1446
+ var import_zod7 = require("zod");
1447
+ var ScriptSchema = import_zod7.z.object({
1448
+ id: import_zod7.z.string(),
1449
+ title: import_zod7.z.string(),
1450
+ content: import_zod7.z.string(),
1451
+ tags: import_zod7.z.array(import_zod7.z.string()).optional(),
1452
+ userId: import_zod7.z.string().optional()
1453
+ });
1454
+ var CategorySchema = import_zod7.z.object({
1455
+ id: import_zod7.z.string(),
1456
+ title: import_zod7.z.string(),
1457
+ pictureUrl: import_zod7.z.string().url(),
1458
+ backgroundColor: import_zod7.z.string(),
1459
+ active: import_zod7.z.boolean(),
1460
+ scripts: import_zod7.z.array(ScriptSchema)
1461
+ });
1462
+ var PromptSchema = import_zod7.z.object({
1463
+ id: import_zod7.z.string(),
1464
+ tenantId: import_zod7.z.string(),
1465
+ categories: import_zod7.z.array(CategorySchema)
1466
+ });
1467
+
1468
+ // src/model/prompt/Prompt.api.ts
1469
+ var Endpoints7 = {
1470
+ GetPrompt: {
1471
+ uri: "/prompts/getPrompt",
1472
+ method: "GET"
1473
+ },
1474
+ AddScript: {
1475
+ uri: "/prompts/script/new/",
1476
+ method: "POST"
1477
+ },
1478
+ DeleteScript: {
1479
+ uri: "/prompts/script/:id/delete/",
1480
+ method: "DELETE"
1481
+ },
1482
+ ListScript: {
1483
+ uri: "/prompts/script/list/",
1484
+ method: "GET"
1485
+ },
1486
+ UpdateScript: {
1487
+ uri: "/prompts/script/:id/update/",
1488
+ method: "PUT"
1489
+ }
1490
+ };
1491
+
1492
+ // src/model/tenant/index.ts
1493
+ var tenant_exports = {};
1494
+ __export(tenant_exports, {
1495
+ Endpoints: () => Endpoints8,
1496
+ PreferencesSchema: () => PreferencesSchema,
1497
+ TenantSchema: () => TenantSchema
1498
+ });
1499
+
1500
+ // src/model/tenant/Tenant.schema.ts
1501
+ var import_zod9 = require("zod");
1502
+
1503
+ // src/model/subscription/Subscription.schema.ts
1504
+ var import_zod8 = require("zod");
1505
+ var Type = /* @__PURE__ */ ((Type2) => {
1506
+ Type2[Type2["CUSTOMER_SUBSCRIPTION"] = 0] = "CUSTOMER_SUBSCRIPTION";
1507
+ Type2[Type2["TENANT_SUBSCRIPTION"] = 1] = "TENANT_SUBSCRIPTION";
1508
+ return Type2;
1509
+ })(Type || {});
1510
+ var SubscriptionTypeSchema = import_zod8.z.nativeEnum(Type);
1511
+ var PlanSchema = import_zod8.z.object({
1512
+ id: import_zod8.z.string(),
1513
+ currency: import_zod8.z.string(),
1514
+ price: import_zod8.z.string(),
1515
+ interval: import_zod8.z.string(),
1516
+ metadata: import_zod8.z.record(import_zod8.z.string()),
1517
+ subscriptionItemId: import_zod8.z.string()
1518
+ });
1519
+ var DescriptionSchema = import_zod8.z.object({
1520
+ description: import_zod8.z.string(),
1521
+ subtitle: import_zod8.z.string()
1522
+ });
1523
+ var ProductSchema = import_zod8.z.object({
1524
+ id: import_zod8.z.string(),
1525
+ name: import_zod8.z.string(),
1526
+ descriptions: import_zod8.z.array(DescriptionSchema),
1527
+ metadata: import_zod8.z.any(),
1528
+ plans: import_zod8.z.array(PlanSchema)
1529
+ });
1530
+ var ChargeSchema = import_zod8.z.object({
1531
+ id: import_zod8.z.number(),
1532
+ created: import_zod8.z.number(),
1533
+ paid: import_zod8.z.boolean(),
1534
+ receiptUrl: import_zod8.z.string(),
1535
+ status: import_zod8.z.string(),
1536
+ price: import_zod8.z.string(),
1537
+ paymentType: import_zod8.z.string(),
1538
+ last4: import_zod8.z.string().optional(),
1539
+ brand: import_zod8.z.string().optional()
1540
+ });
1541
+ var SubscriptionSchema = import_zod8.z.object({
1542
+ id: import_zod8.z.string(),
1543
+ status: import_zod8.z.string(),
1544
+ startDate: import_zod8.z.number().optional(),
1545
+ daysUntilDue: import_zod8.z.number().optional(),
1546
+ renewAutomatically: import_zod8.z.boolean().optional(),
1547
+ currentPeriodStart: import_zod8.z.number().optional(),
1548
+ currentPeriodEnd: import_zod8.z.number().optional(),
1549
+ paymentMethodId: import_zod8.z.string().optional(),
1550
+ product: ProductSchema,
1551
+ type: import_zod8.z.nativeEnum(Type).optional(),
1552
+ plan: PlanSchema.optional()
1553
+ });
1554
+
1555
+ // src/model/tenant/Tenant.schema.ts
1556
+ var PreferencesSchema = import_zod9.z.object({
1557
+ iconUrl: import_zod9.z.string().url(),
1558
+ logoUrl: import_zod9.z.string().url(),
1559
+ primaryColor: import_zod9.z.string(),
1560
+ secondaryColor: import_zod9.z.string(),
1561
+ guidelinesUrl: import_zod9.z.string().url().optional()
1562
+ });
1563
+ var TenantSchema = import_zod9.z.object({
1564
+ id: import_zod9.z.string(),
1565
+ name: import_zod9.z.string(),
1566
+ isActive: import_zod9.z.boolean(),
1567
+ isSubscriptionActive: import_zod9.z.boolean(),
1568
+ preferences: PreferencesSchema,
1569
+ inviteCode: import_zod9.z.string(),
1570
+ totalUsersAllowed: import_zod9.z.number(),
1571
+ currentUsersSize: import_zod9.z.number().optional(),
1572
+ chargeByEmail: import_zod9.z.boolean(),
1573
+ defaultProductId: import_zod9.z.string().optional(),
1574
+ defaultPlanId: import_zod9.z.string().optional(),
1575
+ defaultCoupomCode: import_zod9.z.string().optional(),
1576
+ allowedProducts: import_zod9.z.array(import_zod9.z.string()).optional(),
1577
+ useOwnScripts: import_zod9.z.boolean().optional(),
1578
+ subscription: import_zod9.z.optional(import_zod9.z.lazy(() => SubscriptionSchema))
1579
+ });
1580
+
1581
+ // src/model/tenant/Tenant.api.ts
1582
+ var Endpoints8 = {
1583
+ GetByInviteCode: {
1584
+ uri: "/tenants/public/invitation/",
1585
+ method: "GET"
1586
+ },
1587
+ CreateTenant: {
1588
+ uri: "/tenants/create",
1589
+ method: "PUT"
1590
+ },
1591
+ GetTenant: {
1592
+ uri: "/tenants/me",
1593
+ method: "GET"
1594
+ },
1595
+ GetTenantById: {
1596
+ uri: "/tenants/:tenantId/find",
1597
+ method: "GET"
1598
+ },
1599
+ UpdateTenant: {
1600
+ uri: "/tenants/update",
1601
+ method: "POST"
1602
+ },
1603
+ ListAll: {
1604
+ uri: "/tenants/list",
1605
+ method: "GET"
1606
+ }
1607
+ };
1608
+
1609
+ // src/model/user/index.ts
1610
+ var user_exports = {};
1611
+ __export(user_exports, {
1612
+ Endpoints: () => Endpoints9,
1613
+ PreferencesSchema: () => PreferencesSchema2,
1614
+ Role: () => Role,
1615
+ System: () => System,
1616
+ UserSchema: () => UserSchema
1617
+ });
1618
+
1619
+ // src/model/user/User.schema.ts
1620
+ var import_zod10 = require("zod");
1621
+ var Role = /* @__PURE__ */ ((Role2) => {
1622
+ Role2["USER"] = "User";
1623
+ Role2["EDITOR"] = "Editor";
1624
+ Role2["QA"] = "QA";
1625
+ Role2["ADMIN"] = "ADMIN";
1626
+ Role2["SYSTEM"] = "SYSTEM";
1627
+ return Role2;
1628
+ })(Role || {});
1629
+ var System = /* @__PURE__ */ ((System2) => {
1630
+ System2["APP"] = "APP";
1631
+ System2["EDITOR"] = "EDITOR";
1632
+ System2["QA"] = "QA";
1633
+ System2["ADMIN"] = "ADMIN";
1634
+ return System2;
1635
+ })(System || {});
1636
+ var PreferencesSchema2 = import_zod10.z.object({
1637
+ primaryColor: import_zod10.z.string().optional(),
1638
+ secondaryColor: import_zod10.z.string().optional(),
1639
+ facebookLink: import_zod10.z.string().optional(),
1640
+ instagramLink: import_zod10.z.string().optional(),
1641
+ bRoll: import_zod10.z.boolean().optional(),
1642
+ logo: import_zod10.z.string().optional()
1643
+ });
1644
+ var UserSchema = import_zod10.z.object({
1645
+ id: import_zod10.z.string(),
1646
+ name: import_zod10.z.string(),
1647
+ email: import_zod10.z.string().email(),
1648
+ fcmToken: import_zod10.z.string().optional(),
1649
+ profession: import_zod10.z.string().optional(),
1650
+ photoUrl: import_zod10.z.string().optional(),
1651
+ preferences: PreferencesSchema2.optional(),
1652
+ tenantId: import_zod10.z.string().optional(),
1653
+ editorId: import_zod10.z.string().optional(),
1654
+ timezone: import_zod10.z.string().optional(),
1655
+ experienceId: import_zod10.z.string().optional(),
1656
+ customerId: import_zod10.z.string(),
1657
+ role: import_zod10.z.nativeEnum(Role)
1658
+ });
1659
+
1660
+ // src/model/user/User.api.ts
1661
+ var Endpoints9 = {
1662
+ ChangeEmail: { uri: "/accounts/user/changeEmail", method: "PUT" },
1663
+ GetUserInfo: { uri: "/accounts/user/info", method: "GET" },
1664
+ GetBindedUsers: { uri: "/accounts/binded/list", method: "GET" },
1665
+ EnableUser: { uri: "/api/user/register", method: "POST" },
1666
+ ChangePassword: { uri: "/accounts/public/changePassword/", method: "POST" },
1667
+ IsEmailAvaliable: { uri: "/accounts/public/email/avaliable", method: "GET" },
1668
+ GetIntegrationToken: { uri: "/accounts/user/getToken/", method: "GET" },
1669
+ CreateToken: { uri: "/accounts/user/createToken/", method: "POST" },
1670
+ ConfirmCode: { uri: "/accounts/public/email/validate", method: "POST" },
1671
+ DeleteAccount: { uri: "/accounts/user/delete/", method: "DELETE" },
1672
+ SendValidationCode: { uri: "/accounts/public/email/send", method: "POST" },
1673
+ Authenticate: { uri: "/accounts/public/login", method: "POST" },
1674
+ CreateUser: { uri: "/accounts/public/create", method: "POST" },
1675
+ UpdateUser: { uri: "/accounts/user/update", method: "PUT" },
1676
+ Setup: { uri: "/accounts/user/setup/", method: "POST" },
1677
+ Search: { uri: "/accounts/users/search/", method: "GET" }
1678
+ };
1679
+
1680
+ // src/model/subscription/index.ts
1681
+ var subscription_exports = {};
1682
+ __export(subscription_exports, {
1683
+ ChargeSchema: () => ChargeSchema,
1684
+ Endpoints: () => Endpoints10,
1685
+ PlanSchema: () => PlanSchema,
1686
+ ProductSchema: () => ProductSchema,
1687
+ SubscriptionSchema: () => SubscriptionSchema,
1688
+ SubscriptionTypeSchema: () => SubscriptionTypeSchema,
1689
+ Type: () => Type
1690
+ });
1691
+
1692
+ // src/model/subscription/Subscription.api.ts
1693
+ var Endpoints10 = {
1694
+ GetProduct: {
1695
+ uri: "/subscriptions/products/public/retrieve/",
1696
+ method: "GET"
1697
+ },
1698
+ GetActiveSubscription: {
1699
+ uri: "/subscriptions/active/",
1700
+ method: "GET"
1701
+ },
1702
+ GetCharges: {
1703
+ uri: "/subscriptions/payment/charge/list/",
1704
+ method: "GET"
1705
+ },
1706
+ GetUserActiveSubscription: {
1707
+ uri: "/subscriptions/:userId/find/",
1708
+ method: "GET"
1709
+ },
1710
+ GetProducts: {
1711
+ uri: "/subscriptions/products/public/list/",
1712
+ method: "GET"
1713
+ },
1714
+ GetProductsByUser: {
1715
+ uri: "/subscriptions/products/list/",
1716
+ method: "GET"
1717
+ },
1718
+ Checkout: {
1719
+ uri: "/subscriptions/payment/checkout/",
1720
+ method: "POST"
1721
+ },
1722
+ Charge: {
1723
+ uri: "/subscriptions/payment/charge/",
1724
+ method: "POST"
1725
+ },
1726
+ Pause: {
1727
+ uri: "/subscriptions/pause/",
1728
+ method: "PUT"
1729
+ },
1730
+ Resume: {
1731
+ uri: "/subscriptions/resume/",
1732
+ method: "PUT"
1733
+ },
1734
+ UpdatePlan: {
1735
+ uri: "/subscriptions/plan/update/",
1736
+ method: "PUT"
1737
+ }
1738
+ };
1739
+
1740
+ // src/model/track/index.ts
1741
+ var track_exports = {};
1742
+ __export(track_exports, {
1743
+ Endpoints: () => Endpoints11,
1744
+ TrackParamSchema: () => TrackParamSchema,
1745
+ TrackSchema: () => TrackSchema
1746
+ });
1747
+
1748
+ // src/model/track/Track.schema.ts
1749
+ var import_zod11 = require("zod");
1750
+ var TrackParamSchema = import_zod11.z.object({
1751
+ name: import_zod11.z.string(),
1752
+ value: import_zod11.z.union([import_zod11.z.string(), import_zod11.z.number()])
1753
+ });
1754
+ var TrackSchema = import_zod11.z.object({
1755
+ category: import_zod11.z.string(),
1756
+ label: import_zod11.z.string(),
1757
+ action: import_zod11.z.string(),
1758
+ params: import_zod11.z.array(TrackParamSchema).optional()
1759
+ });
1760
+
1761
+ // src/model/track/Track.api.ts
1762
+ var Endpoints11 = {
1763
+ Track: {
1764
+ uri: "/track/public/send/",
1765
+ method: "POST"
1766
+ }
1767
+ };
1768
+
1769
+ // src/model/core/index.ts
1770
+ var core_exports = {};
1771
+
1772
+ // src/index.ts
1773
+ var index_default = ShredAPI;
1774
+ // Annotate the CommonJS export names for ESM import in node:
1775
+ 0 && (module.exports = {
1776
+ Asset,
1777
+ Core,
1778
+ Email,
1779
+ Exceptions,
1780
+ Goal,
1781
+ Note,
1782
+ Notification,
1783
+ Project,
1784
+ Prompt,
1785
+ Subscription,
1786
+ Tenant,
1787
+ Track,
1788
+ User
1789
+ });
1790
+ //# sourceMappingURL=index.js.map