@doist/todoist-sdk 14.2.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/esm/utils/index.js +1 -1
  2. package/dist/esm/utils/url-helpers.js +151 -23
  3. package/dist/types/utils/index.d.ts +2 -1
  4. package/dist/types/utils/url-helpers.d.ts +88 -0
  5. package/package.json +5 -10
  6. package/dist/cjs/authentication.js +0 -317
  7. package/dist/cjs/clients/activity-client.js +0 -63
  8. package/dist/cjs/clients/app-client.js +0 -345
  9. package/dist/cjs/clients/backup-client.js +0 -47
  10. package/dist/cjs/clients/base-client.js +0 -31
  11. package/dist/cjs/clients/billing-client.js +0 -152
  12. package/dist/cjs/clients/comment-client.js +0 -91
  13. package/dist/cjs/clients/email-client.js +0 -43
  14. package/dist/cjs/clients/folder-client.js +0 -79
  15. package/dist/cjs/clients/id-mapping-client.js +0 -39
  16. package/dist/cjs/clients/insights-client.js +0 -87
  17. package/dist/cjs/clients/label-client.js +0 -126
  18. package/dist/cjs/clients/productivity-client.js +0 -27
  19. package/dist/cjs/clients/project-client.js +0 -235
  20. package/dist/cjs/clients/reminder-client.js +0 -198
  21. package/dist/cjs/clients/section-client.js +0 -117
  22. package/dist/cjs/clients/task-client.js +0 -254
  23. package/dist/cjs/clients/template-client.js +0 -88
  24. package/dist/cjs/clients/ui-extension-client.js +0 -107
  25. package/dist/cjs/clients/upload-client.js +0 -155
  26. package/dist/cjs/clients/view-options-client.js +0 -25
  27. package/dist/cjs/clients/workspace-client.js +0 -366
  28. package/dist/cjs/consts/endpoints.js +0 -224
  29. package/dist/cjs/index.js +0 -24
  30. package/dist/cjs/package.json +0 -1
  31. package/dist/cjs/test-utils/asserts.js +0 -11
  32. package/dist/cjs/test-utils/msw-setup.js +0 -97
  33. package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -54
  34. package/dist/cjs/test-utils/test-defaults.js +0 -371
  35. package/dist/cjs/test-utils/transport-seam.js +0 -17
  36. package/dist/cjs/test-utils/webhook-fixtures.js +0 -32
  37. package/dist/cjs/todoist-api.js +0 -1711
  38. package/dist/cjs/transport/fetch-with-retry.js +0 -219
  39. package/dist/cjs/transport/http-client.js +0 -134
  40. package/dist/cjs/transport/http-dispatcher.js +0 -198
  41. package/dist/cjs/transport/sync-request.js +0 -83
  42. package/dist/cjs/types/activity/index.js +0 -18
  43. package/dist/cjs/types/activity/requests.js +0 -2
  44. package/dist/cjs/types/activity/types.js +0 -28
  45. package/dist/cjs/types/apps/index.js +0 -18
  46. package/dist/cjs/types/apps/requests.js +0 -2
  47. package/dist/cjs/types/apps/types.js +0 -254
  48. package/dist/cjs/types/backups/index.js +0 -18
  49. package/dist/cjs/types/backups/requests.js +0 -2
  50. package/dist/cjs/types/backups/types.js +0 -8
  51. package/dist/cjs/types/billing/index.js +0 -18
  52. package/dist/cjs/types/billing/requests.js +0 -2
  53. package/dist/cjs/types/billing/types.js +0 -92
  54. package/dist/cjs/types/comments/index.js +0 -18
  55. package/dist/cjs/types/comments/requests.js +0 -2
  56. package/dist/cjs/types/comments/types.js +0 -60
  57. package/dist/cjs/types/common.js +0 -10
  58. package/dist/cjs/types/emails/index.js +0 -17
  59. package/dist/cjs/types/emails/requests.js +0 -5
  60. package/dist/cjs/types/errors.js +0 -29
  61. package/dist/cjs/types/folders/index.js +0 -17
  62. package/dist/cjs/types/folders/requests.js +0 -2
  63. package/dist/cjs/types/http.js +0 -24
  64. package/dist/cjs/types/id-mappings/index.js +0 -18
  65. package/dist/cjs/types/id-mappings/requests.js +0 -20
  66. package/dist/cjs/types/id-mappings/types.js +0 -12
  67. package/dist/cjs/types/index.js +0 -40
  68. package/dist/cjs/types/insights/index.js +0 -18
  69. package/dist/cjs/types/insights/requests.js +0 -2
  70. package/dist/cjs/types/insights/types.js +0 -80
  71. package/dist/cjs/types/labels/index.js +0 -18
  72. package/dist/cjs/types/labels/requests.js +0 -2
  73. package/dist/cjs/types/labels/types.js +0 -11
  74. package/dist/cjs/types/productivity/index.js +0 -17
  75. package/dist/cjs/types/productivity/types.js +0 -68
  76. package/dist/cjs/types/projects/index.js +0 -18
  77. package/dist/cjs/types/projects/requests.js +0 -2
  78. package/dist/cjs/types/projects/types.js +0 -66
  79. package/dist/cjs/types/reminders/index.js +0 -17
  80. package/dist/cjs/types/reminders/requests.js +0 -95
  81. package/dist/cjs/types/sections/index.js +0 -18
  82. package/dist/cjs/types/sections/requests.js +0 -2
  83. package/dist/cjs/types/sections/types.js +0 -25
  84. package/dist/cjs/types/sync/commands/calendars.js +0 -2
  85. package/dist/cjs/types/sync/commands/filters.js +0 -2
  86. package/dist/cjs/types/sync/commands/folders.js +0 -2
  87. package/dist/cjs/types/sync/commands/index.js +0 -34
  88. package/dist/cjs/types/sync/commands/labels.js +0 -5
  89. package/dist/cjs/types/sync/commands/notes.js +0 -2
  90. package/dist/cjs/types/sync/commands/notifications.js +0 -2
  91. package/dist/cjs/types/sync/commands/others.js +0 -2
  92. package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
  93. package/dist/cjs/types/sync/commands/projects.js +0 -2
  94. package/dist/cjs/types/sync/commands/reminders.js +0 -2
  95. package/dist/cjs/types/sync/commands/sections.js +0 -2
  96. package/dist/cjs/types/sync/commands/shared.js +0 -20
  97. package/dist/cjs/types/sync/commands/sharing.js +0 -2
  98. package/dist/cjs/types/sync/commands/tasks.js +0 -2
  99. package/dist/cjs/types/sync/commands/view-options.js +0 -2
  100. package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
  101. package/dist/cjs/types/sync/commands/workspaces.js +0 -2
  102. package/dist/cjs/types/sync/index.js +0 -22
  103. package/dist/cjs/types/sync/request.js +0 -2
  104. package/dist/cjs/types/sync/resource-types.js +0 -39
  105. package/dist/cjs/types/sync/resources/calendars.js +0 -27
  106. package/dist/cjs/types/sync/resources/collaborators.js +0 -21
  107. package/dist/cjs/types/sync/resources/completed-info.js +0 -24
  108. package/dist/cjs/types/sync/resources/filters.js +0 -14
  109. package/dist/cjs/types/sync/resources/folders.js +0 -12
  110. package/dist/cjs/types/sync/resources/index.js +0 -32
  111. package/dist/cjs/types/sync/resources/live-notifications.js +0 -38
  112. package/dist/cjs/types/sync/resources/notes.js +0 -21
  113. package/dist/cjs/types/sync/resources/reminders.js +0 -50
  114. package/dist/cjs/types/sync/resources/suggestions.js +0 -36
  115. package/dist/cjs/types/sync/resources/tooltips.js +0 -8
  116. package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -20
  117. package/dist/cjs/types/sync/resources/user-settings.js +0 -40
  118. package/dist/cjs/types/sync/resources/user.js +0 -110
  119. package/dist/cjs/types/sync/resources/view-options.js +0 -86
  120. package/dist/cjs/types/sync/resources/workspace-filters.js +0 -19
  121. package/dist/cjs/types/sync/resources/workspaces.js +0 -72
  122. package/dist/cjs/types/sync/response.js +0 -54
  123. package/dist/cjs/types/sync/user-preferences.js +0 -71
  124. package/dist/cjs/types/tasks/index.js +0 -18
  125. package/dist/cjs/types/tasks/requests.js +0 -2
  126. package/dist/cjs/types/tasks/types.js +0 -59
  127. package/dist/cjs/types/templates/index.js +0 -17
  128. package/dist/cjs/types/templates/requests.js +0 -2
  129. package/dist/cjs/types/ui-extensions/index.js +0 -18
  130. package/dist/cjs/types/ui-extensions/requests.js +0 -2
  131. package/dist/cjs/types/ui-extensions/types.js +0 -77
  132. package/dist/cjs/types/uploads/index.js +0 -17
  133. package/dist/cjs/types/uploads/requests.js +0 -2
  134. package/dist/cjs/types/users/index.js +0 -17
  135. package/dist/cjs/types/users/types.js +0 -51
  136. package/dist/cjs/types/webhooks/comments.js +0 -96
  137. package/dist/cjs/types/webhooks/envelope.js +0 -26
  138. package/dist/cjs/types/webhooks/filters.js +0 -30
  139. package/dist/cjs/types/webhooks/index.js +0 -25
  140. package/dist/cjs/types/webhooks/labels.js +0 -54
  141. package/dist/cjs/types/webhooks/projects.js +0 -36
  142. package/dist/cjs/types/webhooks/reminders.js +0 -35
  143. package/dist/cjs/types/webhooks/sections.js +0 -53
  144. package/dist/cjs/types/webhooks/tasks.js +0 -68
  145. package/dist/cjs/types/webhooks/types.js +0 -55
  146. package/dist/cjs/types/workspaces/index.js +0 -18
  147. package/dist/cjs/types/workspaces/requests.js +0 -2
  148. package/dist/cjs/types/workspaces/types.js +0 -154
  149. package/dist/cjs/utils/activity-helpers.js +0 -58
  150. package/dist/cjs/utils/case-conversion.js +0 -69
  151. package/dist/cjs/utils/colors.js +0 -143
  152. package/dist/cjs/utils/file-response.js +0 -32
  153. package/dist/cjs/utils/headers.js +0 -16
  154. package/dist/cjs/utils/index.js +0 -31
  155. package/dist/cjs/utils/multipart-upload.js +0 -293
  156. package/dist/cjs/utils/processing-helpers.js +0 -18
  157. package/dist/cjs/utils/project-helpers.js +0 -20
  158. package/dist/cjs/utils/request-helpers.js +0 -21
  159. package/dist/cjs/utils/sanitization.js +0 -116
  160. package/dist/cjs/utils/sync-helpers.js +0 -22
  161. package/dist/cjs/utils/task-sorting.js +0 -281
  162. package/dist/cjs/utils/uncompletable-helpers.js +0 -60
  163. package/dist/cjs/utils/url-helpers.js +0 -74
  164. package/dist/cjs/utils/validators.js +0 -108
  165. package/dist/cjs/utils/view-options.js +0 -19
  166. package/dist/cjs/utils/webhook-parser.js +0 -60
@@ -1,154 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.WorkspaceUserTaskSchema = exports.MemberActivityInfoSchema = exports.WorkspaceSchema = exports.WorkspacePropertiesSchema = exports.WorkspaceLimitsSchema = exports.WorkspacePlanSchema = exports.WORKSPACE_PLANS = exports.JoinWorkspaceResultSchema = exports.WorkspacePlanDetailsSchema = exports.WORKSPACE_PLAN_STATUSES = exports.WORKSPACE_CURRENT_PLANS = exports.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.COLLABORATOR_ROLES = void 0;
15
- const zod_1 = require("zod");
16
- const common_1 = require("../common");
17
- const types_1 = require("../tasks/types");
18
- /** Available project collaborator roles. */
19
- exports.COLLABORATOR_ROLES = [
20
- 'CREATOR',
21
- 'ADMIN',
22
- 'READ_WRITE',
23
- 'EDIT_ONLY',
24
- 'COMPLETE_ONLY',
25
- ];
26
- /**
27
- * Available workspace roles.
28
- */
29
- exports.WORKSPACE_ROLES = ['ADMIN', 'MEMBER', 'GUEST'];
30
- exports.WorkspaceRoleSchema = zod_1.z.enum(exports.WORKSPACE_ROLES);
31
- exports.WorkspaceUserSchema = zod_1.z.object({
32
- userId: zod_1.z.string(),
33
- workspaceId: zod_1.z.string(),
34
- userEmail: zod_1.z.string(),
35
- fullName: zod_1.z.string(),
36
- timezone: zod_1.z.string(),
37
- role: exports.WorkspaceRoleSchema,
38
- imageId: zod_1.z.string().nullable(),
39
- isDeleted: zod_1.z.boolean().default(false),
40
- });
41
- exports.WorkspaceInvitationSchema = zod_1.z.object({
42
- id: zod_1.z.string().default('0'),
43
- inviterId: zod_1.z.string(),
44
- userEmail: zod_1.z.string(),
45
- workspaceId: zod_1.z.string(),
46
- role: exports.WorkspaceRoleSchema,
47
- });
48
- exports.PlanPriceSchema = zod_1.z.object({
49
- currency: zod_1.z.string(),
50
- amount: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
51
- interval: zod_1.z.string().optional(),
52
- });
53
- exports.FormattedPriceListingSchema = zod_1.z.object({
54
- currency: zod_1.z.string().optional(),
55
- amount: zod_1.z.number().optional(),
56
- interval: zod_1.z.string().optional(),
57
- formatted: zod_1.z.string().optional(),
58
- });
59
- /** Available workspace plan names. */
60
- exports.WORKSPACE_CURRENT_PLANS = ['Business', 'Starter'];
61
- /** Available workspace plan statuses. */
62
- exports.WORKSPACE_PLAN_STATUSES = [
63
- 'Active',
64
- 'Downgraded',
65
- 'Cancelled',
66
- 'NeverSubscribed',
67
- ];
68
- exports.WorkspacePlanDetailsSchema = zod_1.z.object({
69
- currentMemberCount: zod_1.z.number(),
70
- currentPlan: zod_1.z.enum(exports.WORKSPACE_CURRENT_PLANS),
71
- currentPlanStatus: zod_1.z.enum(exports.WORKSPACE_PLAN_STATUSES),
72
- downgradeAt: zod_1.z.string().nullable(),
73
- currentActiveProjects: zod_1.z.number(),
74
- maximumActiveProjects: zod_1.z.number(),
75
- priceList: zod_1.z.array(exports.FormattedPriceListingSchema),
76
- workspaceId: common_1.StringOrNumberSchema,
77
- isTrialing: zod_1.z.boolean(),
78
- trialEndsAt: zod_1.z.string().nullable(),
79
- cancelAtPeriodEnd: zod_1.z.boolean(),
80
- hasTrialed: zod_1.z.boolean(),
81
- planPrice: exports.PlanPriceSchema.nullable(),
82
- hasBillingPortal: zod_1.z.boolean(),
83
- hasBillingPortalSwitchToAnnual: zod_1.z.boolean(),
84
- });
85
- exports.JoinWorkspaceResultSchema = zod_1.z.object({
86
- customSortingApplied: zod_1.z.boolean(),
87
- projectSortPreference: zod_1.z.string(),
88
- role: exports.WorkspaceRoleSchema,
89
- userId: zod_1.z.string(),
90
- workspaceId: zod_1.z.string(),
91
- });
92
- /**
93
- * Available workspace plans.
94
- */
95
- exports.WORKSPACE_PLANS = ['STARTER', 'BUSINESS'];
96
- exports.WorkspacePlanSchema = zod_1.z.enum(exports.WORKSPACE_PLANS);
97
- /**
98
- * Workspace resource limits.
99
- */
100
- exports.WorkspaceLimitsSchema = zod_1.z
101
- .object({
102
- current: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable(),
103
- next: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable(),
104
- })
105
- .catchall(zod_1.z.any());
106
- /**
107
- * Workspace properties (flexible object for unknown fields).
108
- */
109
- exports.WorkspacePropertiesSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
110
- /**
111
- * Represents a workspace in Todoist.
112
- */
113
- exports.WorkspaceSchema = zod_1.z
114
- .object({
115
- id: common_1.StringOrNumberSchema,
116
- name: zod_1.z.string(),
117
- plan: exports.WorkspacePlanSchema,
118
- role: exports.WorkspaceRoleSchema.optional(),
119
- inviteCode: zod_1.z.string(),
120
- isLinkSharingEnabled: zod_1.z.boolean(),
121
- isGuestAllowed: zod_1.z.boolean(),
122
- limits: exports.WorkspaceLimitsSchema.optional(),
123
- logoBig: zod_1.z.string().nullish(),
124
- logoMedium: zod_1.z.string().nullish(),
125
- logoSmall: zod_1.z.string().nullish(),
126
- logoS640: zod_1.z.string().nullish(),
127
- createdAt: zod_1.z.coerce.date().optional(),
128
- dateCreated: zod_1.z.coerce.date().optional(),
129
- creatorId: common_1.StringOrNumberSchema,
130
- properties: exports.WorkspacePropertiesSchema,
131
- })
132
- .transform((_a) => {
133
- var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
134
- return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
135
- });
136
- exports.MemberActivityInfoSchema = zod_1.z.object({
137
- userId: zod_1.z.string(),
138
- tasksAssigned: zod_1.z.number().int(),
139
- tasksOverdue: zod_1.z.number().int(),
140
- });
141
- exports.WorkspaceUserTaskSchema = zod_1.z.object({
142
- id: zod_1.z.string(),
143
- content: zod_1.z.string(),
144
- responsibleUid: zod_1.z.string().nullable(),
145
- due: types_1.DueDateSchema.nullable(),
146
- deadline: types_1.DeadlineSchema.nullable(),
147
- labels: zod_1.z.array(zod_1.z.string()),
148
- notesCount: zod_1.z.number().int(),
149
- projectId: zod_1.z.string(),
150
- projectName: zod_1.z.string(),
151
- priority: zod_1.z.number().int(),
152
- description: zod_1.z.string(),
153
- isOverdue: zod_1.z.boolean(),
154
- });
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeObjectTypeForApi = normalizeObjectTypeForApi;
4
- exports.denormalizeObjectTypeFromApi = denormalizeObjectTypeFromApi;
5
- exports.normalizeObjectEventTypeForApi = normalizeObjectEventTypeForApi;
6
- /**
7
- * Converts modern SDK object type naming to legacy API naming.
8
- * Maps 'task' -> 'item' and 'comment' -> 'note' for API requests.
9
- * Other values pass through unchanged.
10
- *
11
- * @internal
12
- * @param objectType The object type using modern naming.
13
- * @returns The object type using legacy API naming.
14
- */
15
- function normalizeObjectTypeForApi(objectType) {
16
- if (!objectType)
17
- return objectType;
18
- if (objectType === 'task')
19
- return 'item';
20
- if (objectType === 'comment')
21
- return 'note';
22
- return objectType;
23
- }
24
- /**
25
- * Converts legacy API object type naming to modern SDK naming.
26
- * Maps 'item' -> 'task' and 'note' -> 'comment' for SDK responses.
27
- * Other values pass through unchanged.
28
- *
29
- * @internal
30
- * @param objectType The object type using legacy API naming.
31
- * @returns The object type using modern SDK naming.
32
- */
33
- function denormalizeObjectTypeFromApi(objectType) {
34
- if (!objectType)
35
- return objectType;
36
- if (objectType === 'item')
37
- return 'task';
38
- if (objectType === 'note')
39
- return 'comment';
40
- return objectType;
41
- }
42
- /**
43
- * Normalizes an `ActivityObjectEventType` filter string for the API,
44
- * converting modern object type names to legacy API names.
45
- * e.g. 'task:added' -> 'item:added', 'comment:' -> 'note:', ':deleted' -> ':deleted'
46
- *
47
- * @internal
48
- */
49
- function normalizeObjectEventTypeForApi(filter) {
50
- var _a, _b;
51
- const colonIndex = filter.indexOf(':');
52
- if (colonIndex === -1) {
53
- return (_a = normalizeObjectTypeForApi(filter)) !== null && _a !== void 0 ? _a : filter;
54
- }
55
- const objectPart = filter.slice(0, colonIndex);
56
- const eventPart = filter.slice(colonIndex); // includes the colon
57
- return `${(_b = normalizeObjectTypeForApi(objectPart)) !== null && _b !== void 0 ? _b : objectPart}${eventPart}`;
58
- }
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.customCamelCase = customCamelCase;
7
- exports.camelCaseKeys = camelCaseKeys;
8
- exports.snakeCaseKeys = snakeCaseKeys;
9
- const camelcase_1 = __importDefault(require("camelcase"));
10
- const emoji_regex_1 = __importDefault(require("emoji-regex"));
11
- /**
12
- * Checks if a string is a solitary emoji
13
- */
14
- function isEmojiKey(input) {
15
- const regex = (0, emoji_regex_1.default)();
16
- const match = input.match(regex);
17
- return match !== null && match.join('') === input;
18
- }
19
- /**
20
- * Custom camelCase function that preserves emoji strings
21
- */
22
- function customCamelCase(input) {
23
- // If the value is a solitary emoji string, return the key as-is
24
- if (isEmojiKey(input)) {
25
- return input;
26
- }
27
- return (0, camelcase_1.default)(input);
28
- }
29
- /**
30
- * Converts object keys from snake_case to camelCase recursively
31
- */
32
- function camelCaseKeys(obj) {
33
- if (obj === null || obj === undefined) {
34
- return obj;
35
- }
36
- if (Array.isArray(obj)) {
37
- return obj.map((item) => camelCaseKeys(item));
38
- }
39
- if (typeof obj === 'object' && obj.constructor === Object) {
40
- const converted = {};
41
- for (const [key, value] of Object.entries(obj)) {
42
- const camelKey = customCamelCase(key);
43
- converted[camelKey] = camelCaseKeys(value);
44
- }
45
- return converted;
46
- }
47
- return obj;
48
- }
49
- /**
50
- * Converts object keys from camelCase to snake_case recursively
51
- */
52
- function snakeCaseKeys(obj) {
53
- if (obj === null || obj === undefined) {
54
- return obj;
55
- }
56
- if (Array.isArray(obj)) {
57
- return obj.map((item) => snakeCaseKeys(item));
58
- }
59
- if (typeof obj === 'object' && obj.constructor === Object) {
60
- const converted = {};
61
- for (const [key, value] of Object.entries(obj)) {
62
- // Convert camelCase to snake_case
63
- const snakeKey = key.replace(/([A-Z])/g, '_$1').toLowerCase();
64
- converted[snakeKey] = snakeCaseKeys(value);
65
- }
66
- return converted;
67
- }
68
- return obj;
69
- }
@@ -1,143 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultColor = exports.colors = exports.taupe = exports.grey = exports.charcoal = exports.salmon = exports.magenta = exports.lavender = exports.violet = exports.grape = exports.blue = exports.lightBlue = exports.skyBlue = exports.teal = exports.mintGreen = exports.green = exports.limeGreen = exports.oliveGreen = exports.yellow = exports.orange = exports.red = exports.berryRed = void 0;
4
- exports.getColorByKey = getColorByKey;
5
- exports.berryRed = {
6
- key: 'berry_red',
7
- displayName: 'Berry Red',
8
- hexValue: '#b8255f',
9
- };
10
- exports.red = {
11
- key: 'red',
12
- displayName: 'Red',
13
- hexValue: '#db4035',
14
- };
15
- exports.orange = {
16
- key: 'orange',
17
- displayName: 'Orange',
18
- hexValue: '#ff9933',
19
- };
20
- exports.yellow = {
21
- key: 'yellow',
22
- displayName: 'Yellow',
23
- hexValue: '#fad000',
24
- };
25
- exports.oliveGreen = {
26
- key: 'olive_green',
27
- displayName: 'Olive Green',
28
- hexValue: '#afb83b',
29
- };
30
- exports.limeGreen = {
31
- key: 'lime_green',
32
- displayName: 'Lime Green',
33
- hexValue: '#7ecc49',
34
- };
35
- exports.green = {
36
- key: 'green',
37
- displayName: 'Green',
38
- hexValue: '#299438',
39
- };
40
- exports.mintGreen = {
41
- key: 'mint_green',
42
- displayName: 'Mint Green',
43
- hexValue: '#6accbc',
44
- };
45
- exports.teal = {
46
- key: 'teal',
47
- displayName: 'Teal',
48
- hexValue: '#158fad',
49
- };
50
- exports.skyBlue = {
51
- key: 'sky_blue',
52
- displayName: 'Sky Blue',
53
- hexValue: '#14aaf5',
54
- };
55
- exports.lightBlue = {
56
- key: 'light_blue',
57
- displayName: 'Light Blue',
58
- hexValue: '#96c3eb',
59
- };
60
- exports.blue = {
61
- key: 'blue',
62
- displayName: 'Blue',
63
- hexValue: '#4073ff',
64
- };
65
- exports.grape = {
66
- key: 'grape',
67
- displayName: 'Grape',
68
- hexValue: '#884dff',
69
- };
70
- exports.violet = {
71
- key: 'violet',
72
- displayName: 'Violet',
73
- hexValue: '#af38eb',
74
- };
75
- exports.lavender = {
76
- key: 'lavender',
77
- displayName: 'Lavender',
78
- hexValue: '#eb96eb',
79
- };
80
- exports.magenta = {
81
- key: 'magenta',
82
- displayName: 'Magenta',
83
- hexValue: '#e05194',
84
- };
85
- exports.salmon = {
86
- key: 'salmon',
87
- displayName: 'Salmon',
88
- hexValue: '#ff8d85',
89
- };
90
- exports.charcoal = {
91
- key: 'charcoal',
92
- displayName: 'Charcoal',
93
- hexValue: '#808080',
94
- };
95
- exports.grey = {
96
- key: 'grey',
97
- displayName: 'Grey',
98
- hexValue: '#b8b8b8',
99
- };
100
- exports.taupe = {
101
- key: 'taupe',
102
- displayName: 'Taupe',
103
- hexValue: '#ccac93',
104
- };
105
- exports.colors = [
106
- exports.berryRed,
107
- exports.red,
108
- exports.orange,
109
- exports.yellow,
110
- exports.oliveGreen,
111
- exports.limeGreen,
112
- exports.green,
113
- exports.mintGreen,
114
- exports.teal,
115
- exports.skyBlue,
116
- exports.lightBlue,
117
- exports.blue,
118
- exports.grape,
119
- exports.violet,
120
- exports.lavender,
121
- exports.magenta,
122
- exports.salmon,
123
- exports.charcoal,
124
- exports.grey,
125
- exports.taupe,
126
- ];
127
- exports.defaultColor = exports.charcoal;
128
- /**
129
- * Retrieves a {@link Color} object by its key identifier.
130
- *
131
- * @param colorKey - The unique key identifier of the color to find (e.g., 'berry_red', 'sky_blue')
132
- * @returns The matching Color object if found, otherwise returns the default color (charcoal)
133
- *
134
- * @example
135
- * ```typescript
136
- * const color = getColorByKey('berry_red');
137
- * console.log(color.hexValue); // '#b8255f'
138
- * ```
139
- */
140
- function getColorByKey(colorKey) {
141
- const color = exports.colors.find((color) => color.key === colorKey);
142
- return color !== null && color !== void 0 ? color : exports.defaultColor;
143
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapAsFileResponse = wrapAsFileResponse;
4
- const headers_1 = require("./headers");
5
- /**
6
- * Wraps either a native `Response` or a `CustomFetchResponse` into the SDK's
7
- * `FileResponse` shape (binary endpoints: `viewAttachment`, `downloadBackup`).
8
- *
9
- * `arrayBuffer()` is resolved lazily. A customFetch implementation that omits
10
- * `arrayBuffer()` is still valid for callers that only read `text()`/`json()`;
11
- * the descriptive error is thrown only if the caller actually requests binary
12
- * bytes. This avoids the lossy `text()` → `TextEncoder` round-trip that
13
- * corrupts non-UTF-8 bytes (every `0x80`-`0xFF` byte not part of a valid UTF-8
14
- * sequence is replaced with `U+FFFD`).
15
- */
16
- function wrapAsFileResponse(response, context) {
17
- const headers = response.headers instanceof Headers ? (0, headers_1.headersToRecord)(response.headers) : response.headers;
18
- return {
19
- ok: response.ok,
20
- status: response.status,
21
- statusText: response.statusText,
22
- headers,
23
- text: () => response.text(),
24
- json: () => response.json(),
25
- arrayBuffer: () => {
26
- if (typeof response.arrayBuffer !== 'function') {
27
- throw new Error(`customFetch response must implement arrayBuffer() for ${context} (binary endpoint); reading the body via text() corrupts non-UTF-8 bytes`);
28
- }
29
- return response.arrayBuffer();
30
- },
31
- };
32
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.headersToRecord = headersToRecord;
4
- /**
5
- * Converts a native Fetch `Headers` object into a plain `Record<string, string>`.
6
- * Used when wrapping a native `fetch` response into the SDK's `FileResponse`
7
- * shape (which expects headers as a plain record for symmetry with
8
- * `CustomFetchResponse`).
9
- */
10
- function headersToRecord(headers) {
11
- const result = {};
12
- headers.forEach((value, key) => {
13
- result[key] = value;
14
- });
15
- return result;
16
- }
@@ -1,31 +0,0 @@
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]; } };
7
- }
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.verifyWebhookSignature = exports.parseWebhookPayload = exports.createCommand = exports.getSectionUrl = exports.getProjectUrl = exports.getTaskUrl = void 0;
18
- __exportStar(require("./colors"), exports);
19
- __exportStar(require("./sanitization"), exports);
20
- var url_helpers_1 = require("./url-helpers");
21
- Object.defineProperty(exports, "getTaskUrl", { enumerable: true, get: function () { return url_helpers_1.getTaskUrl; } });
22
- Object.defineProperty(exports, "getProjectUrl", { enumerable: true, get: function () { return url_helpers_1.getProjectUrl; } });
23
- Object.defineProperty(exports, "getSectionUrl", { enumerable: true, get: function () { return url_helpers_1.getSectionUrl; } });
24
- var sync_helpers_1 = require("./sync-helpers");
25
- Object.defineProperty(exports, "createCommand", { enumerable: true, get: function () { return sync_helpers_1.createCommand; } });
26
- __exportStar(require("./project-helpers"), exports);
27
- __exportStar(require("./task-sorting"), exports);
28
- __exportStar(require("./view-options"), exports);
29
- var webhook_parser_1 = require("./webhook-parser");
30
- Object.defineProperty(exports, "parseWebhookPayload", { enumerable: true, get: function () { return webhook_parser_1.parseWebhookPayload; } });
31
- Object.defineProperty(exports, "verifyWebhookSignature", { enumerable: true, get: function () { return webhook_parser_1.verifyWebhookSignature; } });