@doist/automations-cli 1.22.3 → 1.24.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.
package/dist/index.js CHANGED
@@ -6899,7 +6899,7 @@ import { fileURLToPath } from "node:url";
6899
6899
  // package.json
6900
6900
  var package_default = {
6901
6901
  name: "@doist/automations-cli",
6902
- version: "1.22.3",
6902
+ version: "1.24.0",
6903
6903
  description: "Command-line client for Todoist Automations",
6904
6904
  type: "module",
6905
6905
  bin: {
@@ -7082,7 +7082,9 @@ var AUTOMATION_RUN_STATUSES = [
7082
7082
  // ../../packages/core/dist/esm/constants/usage-billing.constants.js
7083
7083
  var USAGE_BILLING_DENIAL_CODES = [
7084
7084
  "usage_billing_insufficient_credit",
7085
- "usage_billing_no_billing_account"
7085
+ "usage_billing_no_billing_account",
7086
+ "usage_billing_plan_required",
7087
+ "usage_billing_billing_paused"
7086
7088
  ];
7087
7089
  var USAGE_BILLING_TEMPORARILY_UNAVAILABLE_CODE = "usage_billing_temporarily_unavailable";
7088
7090
  var USAGE_BILLING_UNAVAILABLE_CODE = "usage_billing_unavailable";
@@ -26970,6 +26972,8 @@ var admitUsersResponseSchema = external_exports.object({
26970
26972
  welcomeCredit: external_exports.object({
26971
26973
  granted: external_exports.number().int().nonnegative(),
26972
26974
  alreadyGranted: external_exports.number().int().nonnegative(),
26975
+ /** Users with no Stripe customer yet, who will get the credit when they first top-up. */
26976
+ pending: external_exports.number().int().nonnegative().default(0),
26973
26977
  /** Users who got no credit, with the reason to show the admin. */
26974
26978
  notGranted: external_exports.array(external_exports.object({ userId: external_exports.string(), reason: external_exports.string() }))
26975
26979
  })
@@ -26979,7 +26983,9 @@ var admitUsersResponseSchema = external_exports.object({
26979
26983
  var UsageBillingProductSchema = external_exports.literal("automations");
26980
26984
  var USAGE_BILLING_BLOCK_REASONS = [
26981
26985
  "insufficient_credit",
26982
- "temporarily_unavailable"
26986
+ "temporarily_unavailable",
26987
+ "plan_required",
26988
+ "billing_paused"
26983
26989
  ];
26984
26990
  var USAGE_BILLING_AUTHORIZATION_DENIAL_REASONS = [
26985
26991
  ...USAGE_BILLING_BLOCK_REASONS,
@@ -26987,6 +26993,7 @@ var USAGE_BILLING_AUTHORIZATION_DENIAL_REASONS = [
26987
26993
  ];
26988
26994
  var UsageBillingAuthorizationDenialReasonSchema = external_exports.enum(USAGE_BILLING_AUTHORIZATION_DENIAL_REASONS);
26989
26995
  var UsageBillingBlockReasonSchema = external_exports.enum(USAGE_BILLING_BLOCK_REASONS);
26996
+ var UsageBillingReasonFromTodoistSchema = external_exports.string().min(1);
26990
26997
  var UsageBillingAccountSchema = external_exports.object({
26991
26998
  id: external_exports.string().regex(/^[1-9]\d*$/),
26992
26999
  type: external_exports.literal("user")
@@ -27011,7 +27018,7 @@ var AuthorizeUsageResponseSchema = external_exports.discriminatedUnion("decision
27011
27018
  }),
27012
27019
  external_exports.object({
27013
27020
  decision: external_exports.literal("denied"),
27014
- reason: UsageBillingAuthorizationDenialReasonSchema,
27021
+ reason: UsageBillingReasonFromTodoistSchema,
27015
27022
  available_units: UsageBillingBalanceSchema
27016
27023
  })
27017
27024
  ]);
@@ -27065,7 +27072,7 @@ var ReadStateResponseSchema = external_exports.object({
27065
27072
  settled_units: UsageBillingBalanceSchema.optional(),
27066
27073
  settled_amount: UsageBillingBalanceSchema.optional(),
27067
27074
  is_settled_low_balance: external_exports.boolean().optional(),
27068
- usage_block_reason: UsageBillingBlockReasonSchema.nullable().optional()
27075
+ usage_block_reason: UsageBillingReasonFromTodoistSchema.nullable().optional()
27069
27076
  });
27070
27077
  var UsageBillingAmountSchema = UsageBillingUnitsSchema.nullable();
27071
27078
  var UsageBillingEntrySchema = external_exports.object({
@@ -27123,10 +27130,25 @@ var GrantWelcomeCreditRequestSchema = external_exports.object({
27123
27130
  account: UsageBillingAccountSchema,
27124
27131
  operator: external_exports.email().max(254)
27125
27132
  });
27126
- var GrantWelcomeCreditResponseSchema = external_exports.object({
27127
- status: external_exports.enum(["granted", "already_granted"]),
27128
- grant_id: external_exports.string().min(1)
27129
- });
27133
+ var GRANTED_WELCOME_CREDIT_STATUSES = ["granted", "already_granted"];
27134
+ var PENDING_WELCOME_CREDIT_STATUS = "pending";
27135
+ var WELCOME_CREDIT_STATUSES = [
27136
+ ...GRANTED_WELCOME_CREDIT_STATUSES,
27137
+ PENDING_WELCOME_CREDIT_STATUS
27138
+ ];
27139
+ function isKnownWelcomeCreditStatus(status) {
27140
+ return WELCOME_CREDIT_STATUSES.includes(status);
27141
+ }
27142
+ var GrantWelcomeCreditResponseSchema = external_exports.union([
27143
+ external_exports.object({
27144
+ status: external_exports.enum(GRANTED_WELCOME_CREDIT_STATUSES),
27145
+ grant_id: external_exports.string().min(1)
27146
+ }),
27147
+ external_exports.object({ status: external_exports.literal(PENDING_WELCOME_CREDIT_STATUS) }),
27148
+ external_exports.object({
27149
+ status: external_exports.string().min(1).refine((status) => !isKnownWelcomeCreditStatus(status))
27150
+ })
27151
+ ]);
27130
27152
 
27131
27153
  // ../../packages/core/dist/esm/types/failure-category.types.js
27132
27154
  var FAILURE_CATEGORIES = [
@@ -27229,7 +27251,7 @@ var AutomationRunDtoSchema = external_exports.discriminatedUnion("status", [
27229
27251
  ...automationRunDtoBaseShape,
27230
27252
  status: external_exports.literal("skipped"),
27231
27253
  skipReason: external_exports.string().nullish(),
27232
- skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish()
27254
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish().catch(null)
27233
27255
  })
27234
27256
  ]);
27235
27257
  var automationRunListResponseSchema = external_exports.object({
@@ -27331,7 +27353,7 @@ var AutomationRunDetailDtoSchema = external_exports.discriminatedUnion("status",
27331
27353
  ...automationRunDetailDtoBaseShape,
27332
27354
  status: external_exports.literal("skipped"),
27333
27355
  skipReason: external_exports.string().nullish(),
27334
- skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish()
27356
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish().catch(null)
27335
27357
  })
27336
27358
  ]);
27337
27359
  function summarizeToolCallArgumentKeys(args) {
@@ -29156,7 +29178,7 @@ var runStatusSchema = external_exports.discriminatedUnion("status", [
29156
29178
  status: external_exports.literal("skipped"),
29157
29179
  lastRun: external_exports.iso.datetime(),
29158
29180
  skipReason: external_exports.string().optional(),
29159
- skipCategory: external_exports.enum(SKIP_CATEGORIES).optional()
29181
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).optional().catch(void 0)
29160
29182
  })
29161
29183
  ]);
29162
29184
  var automationSchema = external_exports.object({
@@ -30079,7 +30101,7 @@ var DraftTestRunDetailDtoSchema = external_exports.discriminatedUnion("status",
30079
30101
  ...draftTestRunDetailDtoBaseShape,
30080
30102
  status: external_exports.literal("skipped"),
30081
30103
  skipReason: external_exports.string().nullish(),
30082
- skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish()
30104
+ skipCategory: external_exports.enum(SKIP_CATEGORIES).nullish().catch(null)
30083
30105
  })
30084
30106
  ]);
30085
30107
 
@@ -31770,7 +31792,8 @@ var workspaceAutomationsEndpoints = {
31770
31792
  visibility: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/visibility`,
31771
31793
  move: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/move`,
31772
31794
  trigger: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/trigger`,
31773
- draft: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/draft`
31795
+ draft: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/draft`,
31796
+ duplicate: (workspaceId, id) => `${root8(workspaceId)}/${encodeURIComponent(id)}/duplicate`
31774
31797
  };
31775
31798
  function root8(workspaceId) {
31776
31799
  return `/workspaces/${encodeURIComponent(workspaceId)}/automations`;
@@ -31883,6 +31906,15 @@ var WorkspaceAutomationsClient = class extends BaseClient {
31883
31906
  * Opens an edit draft seeded from the published manifest. Answers 409 when
31884
31907
  * one is already open; see `getOpenDraftConflictError`.
31885
31908
  */
31909
+ /** A draft copy of the automation, in the same workspace, for the caller to edit. */
31910
+ async duplicate(workspaceId, id, options) {
31911
+ const data = await this.request({
31912
+ method: "POST",
31913
+ path: workspaceAutomationsEndpoints.duplicate(IdSchema.parse(workspaceId), IdSchema.parse(id)),
31914
+ options
31915
+ });
31916
+ return automationDraftWithValidationSchema.parse(data);
31917
+ }
31886
31918
  async createDraft(workspaceId, id, options) {
31887
31919
  const data = await this.request({
31888
31920
  method: "POST",