@postonus/cli 0.1.58 → 0.1.60

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
@@ -1136,6 +1136,9 @@ function constantCatch(value2) {
1136
1136
 
1137
1137
  // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js
1138
1138
  var _a;
1139
+ var NEVER = /* @__PURE__ */ Object.freeze({
1140
+ status: "aborted"
1141
+ });
1139
1142
  var _zodDesc = { value: void 0, enumerable: false };
1140
1143
  var _E = "captureStackTrace" in Error ? Error : null;
1141
1144
  function newError(Definition) {
@@ -6919,7 +6922,6 @@ var orgErrors = {
6919
6922
  NOT_FOUND: { message: "Not found." },
6920
6923
  FORBIDDEN: { message: "This action is not allowed." }
6921
6924
  };
6922
- var writableErrors = orgErrors;
6923
6925
  var publishErrors = {
6924
6926
  ...orgErrors,
6925
6927
  PAYMENT_REQUIRED: {
@@ -6966,6 +6968,124 @@ var activityContract = {
6966
6968
  list: tagged.route({ method: "GET", path: "/posts/{postId}/activity", summary: "List a post's activity feed" }).errors(orgErrors).input(object({ postId: Uuid })).output(array(ActivityEventSchema))
6967
6969
  };
6968
6970
 
6971
+ // ../../packages/api-contract/src/filters.ts
6972
+ function unwrapField(schema) {
6973
+ let current = schema;
6974
+ while (current) {
6975
+ const inner = current.def?.innerType ?? current.def?.schema;
6976
+ if (inner) {
6977
+ current = inner;
6978
+ } else {
6979
+ break;
6980
+ }
6981
+ }
6982
+ return current ?? schema;
6983
+ }
6984
+ function countRulesAndDepth(node2, depth = 1) {
6985
+ if (depth > 3) {
6986
+ return { ok: false, count: 0, error: "Filter depth cannot exceed 3" };
6987
+ }
6988
+ const childNodes = "rules" in node2 && Array.isArray(node2.rules) ? node2.rules : "children" in node2 && Array.isArray(node2.children) ? node2.children : void 0;
6989
+ if (childNodes) {
6990
+ let sum = 0;
6991
+ for (const child of childNodes) {
6992
+ const res = countRulesAndDepth(child, depth + 1);
6993
+ if (!res.ok) {
6994
+ return res;
6995
+ }
6996
+ sum += res.count;
6997
+ }
6998
+ return { ok: true, count: sum };
6999
+ }
7000
+ return { ok: true, count: 1 };
7001
+ }
7002
+ function filterWhere(targetDefinitions) {
7003
+ const definitions = "shape" in targetDefinitions ? targetDefinitions.shape : targetDefinitions;
7004
+ const ruleSchemas = [];
7005
+ for (const [key, fieldSchema] of Object.entries(definitions)) {
7006
+ const carrier = fieldSchema;
7007
+ const filterMeta = carrier.meta?.()?.filter;
7008
+ if (!filterMeta) {
7009
+ continue;
7010
+ }
7011
+ const unwrapped = unwrapField(carrier);
7012
+ const typeName = unwrapped.def?.type;
7013
+ let operatorSchema;
7014
+ let valueSchema;
7015
+ if (typeName === "array") {
7016
+ operatorSchema = _enum(["is_any_of", "is_none_of"]);
7017
+ valueSchema = array(string2()).min(1);
7018
+ } else if (typeName === "enum") {
7019
+ operatorSchema = _enum(["is_any_of", "is_none_of", "equals", "not_equals"]);
7020
+ valueSchema = union([string2(), array(string2()).min(1)]);
7021
+ } else if (key.toLowerCase().includes("date") || filterMeta.type === "date") {
7022
+ operatorSchema = _enum(["before", "after", "between"]);
7023
+ valueSchema = union([string2(), array(string2()).length(2)]);
7024
+ } else {
7025
+ operatorSchema = _enum(["contains", "equals"]);
7026
+ valueSchema = string2();
7027
+ }
7028
+ ruleSchemas.push(
7029
+ object({
7030
+ type: literal("rule").optional(),
7031
+ id: string2().optional(),
7032
+ field: literal(key),
7033
+ operator: operatorSchema,
7034
+ value: valueSchema,
7035
+ negated: boolean2().optional()
7036
+ })
7037
+ );
7038
+ }
7039
+ const firstRule = ruleSchemas[0];
7040
+ if (!firstRule) {
7041
+ return never().optional();
7042
+ }
7043
+ const [, second, ...rest] = ruleSchemas;
7044
+ const RuleUnion = second ? union([firstRule, second, ...rest]) : firstRule;
7045
+ const NodeSchema = lazy(
7046
+ () => union([
7047
+ RuleUnion,
7048
+ object({
7049
+ type: literal("group").optional(),
7050
+ id: string2().optional(),
7051
+ combinator: _enum(["and", "or"]).optional(),
7052
+ operator: _enum(["and", "or"]).optional(),
7053
+ rules: array(NodeSchema).optional(),
7054
+ children: array(NodeSchema).optional()
7055
+ }).superRefine((data, ctx) => {
7056
+ if (!data.combinator && !data.operator) {
7057
+ ctx.addIssue({ code: "custom", message: "Group requires combinator or operator" });
7058
+ }
7059
+ }).transform((data) => ({
7060
+ type: "group",
7061
+ id: data.id,
7062
+ combinator: data.combinator ?? data.operator ?? "and",
7063
+ rules: data.rules ?? data.children ?? []
7064
+ }))
7065
+ ])
7066
+ );
7067
+ const RefinedNode = NodeSchema.superRefine((data, ctx) => {
7068
+ const check = countRulesAndDepth(data);
7069
+ if (!check.ok && check.error) {
7070
+ ctx.addIssue({ code: "custom", message: check.error });
7071
+ } else if (check.count > 50) {
7072
+ ctx.addIssue({ code: "custom", message: "Filter rules cannot exceed 50" });
7073
+ }
7074
+ });
7075
+ const CoercedWhere = union([
7076
+ RefinedNode,
7077
+ string2().transform((raw, ctx) => {
7078
+ try {
7079
+ return JSON.parse(raw);
7080
+ } catch {
7081
+ ctx.addIssue({ code: "custom", message: "Invalid JSON for where filter" });
7082
+ return NEVER;
7083
+ }
7084
+ }).pipe(RefinedNode)
7085
+ ]);
7086
+ return CoercedWhere.optional();
7087
+ }
7088
+
6969
7089
  // ../../packages/api-contract/src/admin-outreach.ts
6970
7090
  var internal = base.route({ tags: ["Admin", "Outreach"] }).meta({ internal: true });
6971
7091
  var mcpAdmin = internal.meta({ internal: true, mcpAdmin: true });
@@ -6989,14 +7109,19 @@ var ImportProspectsInputSchema = object({
6989
7109
  })
6990
7110
  ).min(1).max(500)
6991
7111
  });
6992
- var ListProspectsInputSchema = object({
7112
+ var ProspectFilterFields = {
6993
7113
  needs: _enum(["persona", "drafts"]).optional(),
6994
- persona: string2().trim().optional(),
6995
- verifyStatus: _enum(["all", ...OUTREACH_VERIFY_STATUS_VALUES]).optional().default("all"),
6996
- enrollmentStatus: _enum(["all", "none", ...OUTREACH_ENROLLMENT_STATUS_VALUES]).optional().default("all"),
6997
- search: string2().trim().max(200).optional(),
7114
+ persona: string2().trim().optional().meta({ filter: { label: "Persona", options: "personas" } }),
7115
+ verifyStatus: _enum(["all", ...OUTREACH_VERIFY_STATUS_VALUES]).optional().default("all").meta({ filter: { label: "Verification status", sticky: true, pill: true, options: "verifyStatuses" } }),
7116
+ enrollmentStatus: _enum(["all", "none", ...OUTREACH_ENROLLMENT_STATUS_VALUES]).optional().default("all").meta({ filter: { label: "Enrollment status", sticky: true, pill: true, options: "enrollmentStatuses" } }),
7117
+ search: string2().trim().max(200).optional().meta({ filter: { label: "Search" } })
7118
+ };
7119
+ var ListProspectsInputSchema = object({
7120
+ ...ProspectFilterFields,
6998
7121
  limit: coerce_exports.number().int().min(1).max(100).default(25),
6999
7122
  offset: coerce_exports.number().int().min(0).default(0)
7123
+ }).extend({
7124
+ where: filterWhere(ProspectFilterFields).optional()
7000
7125
  });
7001
7126
  var OutreachProspectItemSchema = object({
7002
7127
  id: string2(),
@@ -7374,6 +7499,17 @@ var WorkspaceDeveloperUsageSchema = object({
7374
7499
  lastCallDay: iso_exports.date()
7375
7500
  });
7376
7501
  var AdminUserListSchema = object({ users: array(AdminUserSchema), total: AggregateCount });
7502
+ var AdminUserFilterFields = {
7503
+ search: string2().trim().max(200).optional().meta({ filter: { label: "Search", sticky: true } }),
7504
+ audience: AdminAudienceSchema.meta({ filter: { label: "Audience", options: "audiences" } })
7505
+ };
7506
+ var ListAdminUsersInputSchema = object({
7507
+ ...AdminUserFilterFields,
7508
+ limit: coerce_exports.number().int().min(1).max(100).default(25),
7509
+ offset: coerce_exports.number().int().min(0).default(0)
7510
+ }).extend({
7511
+ where: filterWhere(AdminUserFilterFields).optional()
7512
+ });
7377
7513
  var DeveloperUsageSchema = object({
7378
7514
  callers: array(DeveloperCallerSchema),
7379
7515
  workspaces: array(WorkspaceDeveloperUsageSchema)
@@ -7411,14 +7547,7 @@ var adminContract = {
7411
7547
  path: "/internal/admin/channel-revenue",
7412
7548
  summary: "Channel revenue attribution (admin only)"
7413
7549
  }).errors(authedErrors).output(array(ChannelRevenueSchema)),
7414
- listUsers: internal2.route({ method: "GET", path: "/internal/admin/users", summary: "List users with activity (admin only)" }).errors(authedErrors).input(
7415
- object({
7416
- search: string2().trim().max(200).optional(),
7417
- audience: AdminAudienceSchema,
7418
- limit: coerce_exports.number().int().min(1).max(100).default(25),
7419
- offset: coerce_exports.number().int().min(0).default(0)
7420
- })
7421
- ).output(AdminUserListSchema),
7550
+ listUsers: internal2.route({ method: "GET", path: "/internal/admin/users", summary: "List users with activity (admin only)" }).errors(authedErrors).input(ListAdminUsersInputSchema).output(AdminUserListSchema),
7422
7551
  getDeveloperUsage: internal2.route({
7423
7552
  method: "GET",
7424
7553
  path: "/internal/admin/developer-usage",
@@ -7504,7 +7633,7 @@ var TrackEventOutputSchema = object({
7504
7633
  var publicTagged = base.route({ tags: ["Analytics"] });
7505
7634
  var internal3 = publicTagged.meta({ internal: true });
7506
7635
  var analyticsTakeawayErrors = {
7507
- ...writableErrors,
7636
+ ...orgErrors,
7508
7637
  AI_CREDITS_EXHAUSTED: {
7509
7638
  status: 402,
7510
7639
  message: "AI credits exhausted. Upgrade your plan or wait for your credits to renew."
@@ -7555,7 +7684,7 @@ var tagged2 = base.route({ tags: ["ApiKeys"] }).meta({ internal: true });
7555
7684
  var apiKeysContract = {
7556
7685
  list: tagged2.route({ method: "GET", path: "/api-keys", summary: "List the caller\u2019s API keys" }).errors(orgErrors).output(array(ApiKeySchema)),
7557
7686
  usage: tagged2.route({ method: "GET", path: "/api-keys/usage", summary: "Get the org-wide API key cap usage" }).errors(orgErrors).output(ApiKeyUsageSchema),
7558
- create: tagged2.route({ method: "POST", path: "/api-keys", summary: "Create an API key", successStatus: 201 }).errors(writableErrors).input(CreateApiKeyInputSchema).output(CreatedApiKeySchema),
7687
+ create: tagged2.route({ method: "POST", path: "/api-keys", summary: "Create an API key", successStatus: 201 }).errors(orgErrors).input(CreateApiKeyInputSchema).output(CreatedApiKeySchema),
7559
7688
  revoke: tagged2.route({ method: "DELETE", path: "/api-keys/{id}", summary: "Revoke an API key" }).errors(orgErrors).input(IdPathParam).output(object({ id: string2() }))
7560
7689
  };
7561
7690
 
@@ -7833,7 +7962,7 @@ var ListClipsOutputSchema = object({
7833
7962
  items: array(ClipJobSchema)
7834
7963
  });
7835
7964
  var clipErrors = {
7836
- ...writableErrors,
7965
+ ...orgErrors,
7837
7966
  CONFLICT: { status: 409, message: "A clip job is already running for this workspace." },
7838
7967
  AI_CREDITS_EXHAUSTED: {
7839
7968
  status: 403,
@@ -7879,19 +8008,19 @@ var tagged6 = base.route({ tags: ["Comments"] }).meta({ internal: true });
7879
8008
  var commentsContract = {
7880
8009
  list: tagged6.route({ method: "GET", path: "/posts/{postId}/comments", summary: "List a post's comments" }).errors(orgErrors).input(object({ postId: Uuid, postScheduleId: CommentScheduleFilter })).output(array(CommentWithAuthorSchema)),
7881
8010
  listPublic: tagged6.route({ method: "GET", path: "/share/{token}/comments", summary: "List a shared post's comments" }).errors(shareErrors).input(object({ token: string2(), postScheduleId: CommentScheduleFilter })).output(array(CommentWithAuthorSchema)),
7882
- create: tagged6.route({ method: "POST", path: "/posts/{postId}/comments", summary: "Add a comment", successStatus: 201 }).errors(writableErrors).input(object({ postId: Uuid, postScheduleId: Uuid.nullable().optional(), content: ContentInput })).output(CommentWithAuthorSchema),
8011
+ create: tagged6.route({ method: "POST", path: "/posts/{postId}/comments", summary: "Add a comment", successStatus: 201 }).errors(orgErrors).input(object({ postId: Uuid, postScheduleId: Uuid.nullable().optional(), content: ContentInput })).output(CommentWithAuthorSchema),
7883
8012
  createPublic: tagged6.route({
7884
8013
  method: "POST",
7885
8014
  path: "/share/{token}/comments",
7886
8015
  summary: "Add a comment on a shared post",
7887
8016
  successStatus: 201
7888
8017
  }).errors(shareAuthedErrors).input(object({ token: string2(), postScheduleId: Uuid.nullable().optional(), content: ContentInput })).output(CommentWithAuthorSchema),
7889
- update: tagged6.route({ method: "PATCH", path: "/comments/{id}", summary: "Edit a comment" }).errors(writableErrors).input(object({ id: Uuid, content: ContentInput })).output(CommentSchema),
8018
+ update: tagged6.route({ method: "PATCH", path: "/comments/{id}", summary: "Edit a comment" }).errors(orgErrors).input(object({ id: Uuid, content: ContentInput })).output(CommentSchema),
7890
8019
  updatePublic: tagged6.route({ method: "PATCH", path: "/share/{token}/comments/{id}", summary: "Edit a comment on a shared post" }).errors(shareAuthedErrors).input(object({ token: string2(), id: Uuid, content: ContentInput })).output(CommentSchema),
7891
8020
  delete: tagged6.route({ method: "DELETE", path: "/comments/{id}", summary: "Delete a comment" }).errors(orgErrors).input(object({ id: Uuid })).output(DeletedSchema),
7892
8021
  deletePublic: tagged6.route({ method: "DELETE", path: "/share/{token}/comments/{id}", summary: "Delete a comment on a shared post" }).errors(shareAuthedErrors).input(object({ token: string2(), id: Uuid })).output(DeletedSchema),
7893
- resolve: tagged6.route({ method: "POST", path: "/comments/{id}/resolve", summary: "Resolve or reopen a comment" }).errors(writableErrors).input(object({ id: Uuid, resolved: boolean2() })).output(CommentSchema),
7894
- resolveMany: tagged6.route({ method: "POST", path: "/comments/resolve-many", summary: "Resolve multiple comments in bulk" }).errors(writableErrors).input(object({ ids: array(Uuid).min(1), resolved: boolean2().default(true) })).output(object({ resolvedCount: number2() }))
8022
+ resolve: tagged6.route({ method: "POST", path: "/comments/{id}/resolve", summary: "Resolve or reopen a comment" }).errors(orgErrors).input(object({ id: Uuid, resolved: boolean2() })).output(CommentSchema),
8023
+ resolveMany: tagged6.route({ method: "POST", path: "/comments/resolve-many", summary: "Resolve multiple comments in bulk" }).errors(orgErrors).input(object({ ids: array(Uuid).min(1), resolved: boolean2().default(true) })).output(object({ resolvedCount: number2() }))
7895
8024
  };
7896
8025
 
7897
8026
  // ../../packages/api-contract/src/platforms.ts
@@ -8060,18 +8189,18 @@ var integrationsContract = {
8060
8189
  summary: "Scheduled posts whose channel cannot currently publish"
8061
8190
  }).errors(orgErrors).output(array(AtRiskScheduleSchema)),
8062
8191
  listPendingSelection: internal5.route({ method: "GET", path: "/integrations/pending-selection", summary: "Channels stuck at the account picker" }).errors(orgErrors).output(array(PendingSelectionIntegrationSchema)),
8063
- connectIntegration: tagged8.route({ method: "POST", path: "/integrations/connect", summary: "Start an OAuth connect" }).errors(writableErrors).input(ConnectIntegrationInputSchema).output(object({ redirectUrl: string2() })),
8192
+ connectIntegration: tagged8.route({ method: "POST", path: "/integrations/connect", summary: "Start an OAuth connect" }).errors(orgErrors).input(ConnectIntegrationInputSchema).output(object({ redirectUrl: string2() })),
8064
8193
  connectCredentialIntegration: internal5.route({
8065
8194
  method: "POST",
8066
8195
  path: "/integrations/connect-with-credentials",
8067
8196
  summary: "Connect a platform with an app password or bot token"
8068
- }).errors(writableErrors).input(ConnectCredentialIntegrationInputSchema).output(ConnectCredentialResultSchema),
8197
+ }).errors(orgErrors).input(ConnectCredentialIntegrationInputSchema).output(ConnectCredentialResultSchema),
8069
8198
  listConnectAccounts: internal5.route({ method: "GET", path: "/integrations/{id}/accounts", summary: "Accounts a pending connect may select" }).errors(orgErrors).input(IdPathParam).output(array(SelectableAccountSchema)),
8070
- finalizeConnect: internal5.route({ method: "POST", path: "/integrations/{id}/select", summary: "Finalize a picked account" }).errors(writableErrors).input(FinalizeConnectInputSchema).output(FinalizeConnectResultSchema),
8199
+ finalizeConnect: internal5.route({ method: "POST", path: "/integrations/{id}/select", summary: "Finalize a picked account" }).errors(orgErrors).input(FinalizeConnectInputSchema).output(FinalizeConnectResultSchema),
8071
8200
  disconnectIntegration: internal5.route({ method: "DELETE", path: "/integrations/{id}", summary: "Disconnect an integration" }).errors(orgErrors).input(IdPathParam).output(DisconnectResultSchema),
8072
8201
  disconnectImpact: internal5.route({ method: "GET", path: "/integrations/{id}/disconnect-impact", summary: "What a disconnect would cost" }).errors(orgErrors).input(IdPathParam).output(DisconnectImpactSchema),
8073
- cancelPendingSelection: internal5.route({ method: "POST", path: "/integrations/{id}/cancel-selection", summary: "Abandon a half-finished connect" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema),
8074
- refreshIntegration: internal5.route({ method: "POST", path: "/integrations/{id}/refresh", summary: "Manually refresh a credential" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema)
8202
+ cancelPendingSelection: internal5.route({ method: "POST", path: "/integrations/{id}/cancel-selection", summary: "Abandon a half-finished connect" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema),
8203
+ refreshIntegration: internal5.route({ method: "POST", path: "/integrations/{id}/refresh", summary: "Manually refresh a credential" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema)
8075
8204
  };
8076
8205
 
8077
8206
  // ../../packages/api-contract/src/upload.ts
@@ -8093,7 +8222,7 @@ var MediaVariantsSchema = object({
8093
8222
  var MediaVariantsStatusSchema = _enum(["pending", "processing", "ready", "failed", "not_applicable"]);
8094
8223
  var MediaTypeSchema = _enum(["IMAGE", "GIF", "VIDEO"]);
8095
8224
  var uploadErrors = {
8096
- ...writableErrors,
8225
+ ...orgErrors,
8097
8226
  CONFLICT: { message: "Upload is not in a state that allows this operation." },
8098
8227
  PAYLOAD_TOO_LARGE: { status: 413, message: "File is too large." }
8099
8228
  };
@@ -8242,19 +8371,19 @@ var DeleteMediaOutputSchema = object({
8242
8371
  var tagged10 = base.route({ tags: ["Media library"] });
8243
8372
  var internal6 = tagged10.meta({ internal: true });
8244
8373
  var folderErrors = {
8245
- ...writableErrors,
8374
+ ...orgErrors,
8246
8375
  FOLDER_CYCLE: { status: 422, message: "A folder cannot be moved inside itself." }
8247
8376
  };
8248
8377
  var mediaContract = {
8249
8378
  list: internal6.route({ method: "GET", path: "/media", summary: "List library media" }).errors(orgErrors).input(ListMediaInputSchema).output(ListMediaOutputSchema),
8250
8379
  listFolders: internal6.route({ method: "GET", path: "/media/folders", summary: "List media folders with counts" }).errors(orgErrors).output(ListMediaFoldersOutputSchema),
8251
- createFolder: internal6.route({ method: "POST", path: "/media/folders", summary: "Create a media folder", successStatus: 201 }).errors({ ...writableErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(CreateMediaFolderInputSchema).output(MediaFolderSchema),
8380
+ createFolder: internal6.route({ method: "POST", path: "/media/folders", summary: "Create a media folder", successStatus: 201 }).errors({ ...orgErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(CreateMediaFolderInputSchema).output(MediaFolderSchema),
8252
8381
  updateFolder: internal6.route({ method: "PATCH", path: "/media/folders/{id}", summary: "Rename or move a media folder" }).errors({ ...folderErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(UpdateMediaFolderInputSchema).output(MediaFolderSchema),
8253
- deleteFolder: internal6.route({ method: "DELETE", path: "/media/folders/{id}", summary: "Delete a media folder" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema),
8382
+ deleteFolder: internal6.route({ method: "DELETE", path: "/media/folders/{id}", summary: "Delete a media folder" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema),
8254
8383
  getById: internal6.route({ method: "GET", path: "/media/{id}", summary: "Get a library asset" }).errors(orgErrors).input(IdPathParam).output(LibraryMediaSchema),
8255
- update: internal6.route({ method: "PATCH", path: "/media/{id}", summary: "Rename or refile a library asset" }).errors(writableErrors).input(UpdateMediaInputSchema).output(LibraryMediaSchema),
8256
- move: internal6.route({ method: "POST", path: "/media/move", summary: "File assets into a folder" }).errors(writableErrors).input(MoveMediaInputSchema).output(object({ movedIds: array(Uuid) })),
8257
- delete: internal6.route({ method: "POST", path: "/media/delete", summary: "Delete library assets" }).errors(writableErrors).input(DeleteMediaInputSchema).output(DeleteMediaOutputSchema)
8384
+ update: internal6.route({ method: "PATCH", path: "/media/{id}", summary: "Rename or refile a library asset" }).errors(orgErrors).input(UpdateMediaInputSchema).output(LibraryMediaSchema),
8385
+ move: internal6.route({ method: "POST", path: "/media/move", summary: "File assets into a folder" }).errors(orgErrors).input(MoveMediaInputSchema).output(object({ movedIds: array(Uuid) })),
8386
+ delete: internal6.route({ method: "POST", path: "/media/delete", summary: "Delete library assets" }).errors(orgErrors).input(DeleteMediaInputSchema).output(DeleteMediaOutputSchema)
8258
8387
  };
8259
8388
 
8260
8389
  // ../../packages/api-contract/src/media-sources.ts
@@ -8319,7 +8448,7 @@ var unsplashErrors = {
8319
8448
  NOT_CONFIGURED: { status: 412, message: "Unsplash integration is not configured on the server." }
8320
8449
  };
8321
8450
  var enableSourceErrors = {
8322
- ...writableErrors,
8451
+ ...orgErrors,
8323
8452
  NOT_CONFIGURED: { status: 412, message: "Source is not configured on this deployment." }
8324
8453
  };
8325
8454
  var tagged11 = base.route({ tags: ["Media sources"] }).meta({ internal: true });
@@ -8330,9 +8459,9 @@ var mediaSourcesContract = {
8330
8459
  method: "POST",
8331
8460
  path: "/media-sources/{sourceId}/disable",
8332
8461
  summary: "Disable a media source for this org"
8333
- }).errors(writableErrors).input(SourceIdInputSchema).output(DeletedSchema),
8462
+ }).errors(orgErrors).input(SourceIdInputSchema).output(DeletedSchema),
8334
8463
  suggestSource: tagged11.route({ method: "POST", path: "/media-sources/suggestions", summary: "Suggest a media source not yet supported" }).errors(orgErrors).input(SuggestSourceInputSchema).output(DeletedSchema),
8335
- importAsset: tagged11.route({ method: "POST", path: "/media-sources/import", summary: "Import an asset picked from a media source" }).errors(writableErrors).input(ImportAssetInputSchema).output(ImportAssetOutputSchema),
8464
+ importAsset: tagged11.route({ method: "POST", path: "/media-sources/import", summary: "Import an asset picked from a media source" }).errors(orgErrors).input(ImportAssetInputSchema).output(ImportAssetOutputSchema),
8336
8465
  unsplashTrending: tagged11.route({ method: "GET", path: "/media-sources/unsplash/trending", summary: "Unsplash curated/trending photos" }).errors(unsplashErrors).input(UnsplashPageInputSchema).output(UnsplashTrendingOutputSchema),
8337
8466
  unsplashSearch: tagged11.route({ method: "GET", path: "/media-sources/unsplash/search", summary: "Search Unsplash photos" }).errors(unsplashErrors).input(UnsplashSearchInputSchema).output(UnsplashSearchOutputSchema)
8338
8467
  };
@@ -8740,26 +8869,26 @@ var postsContract = {
8740
8869
  counts: internal7.route({ method: "GET", path: "/posts/counts", summary: "Count posts per status" }).errors(orgErrors).input(CountPostsInputSchema).output(CountPostsOutputSchema),
8741
8870
  getById: tagged13.route({ method: "GET", path: "/posts/{id}", summary: "Get a post" }).errors(orgErrors).input(IdPathParam).output(PostWithRelationsSchema),
8742
8871
  mediaById: internal7.route({ method: "GET", path: "/posts/media/{id}", summary: "Get post media metadata" }).errors(orgErrors).input(IdPathParam).output(MediaMetadataSchema),
8743
- create: idempotent.route({ method: "POST", path: "/posts", summary: "Create posts in bulk", successStatus: 201 }).errors({ ...writableErrors, ...postDomainErrors }).input(CreatePostsInputSchema).output(CreatePostsOutputSchema),
8744
- update: idempotent.route({ method: "PATCH", path: "/posts/{id}", summary: "Update a post" }).errors({ ...writableErrors, ...postDomainErrors }).input(UpdatePostInputSchema).output(PostStateSchema),
8745
- scheduleDraft: idempotent.route({ method: "POST", path: "/posts/{id}/schedule", summary: "Schedule a draft" }).errors({ ...writableErrors, ...postDomainErrors }).input(ScheduleDraftInputSchema).output(PostStateSchema),
8746
- delete: idempotent.route({ method: "DELETE", path: "/posts/{id}", summary: "Delete a post" }).errors({ ...writableErrors, ...postDomainErrors }).input(DeletePostInputSchema).output(DeletePostOutputSchema),
8872
+ create: idempotent.route({ method: "POST", path: "/posts", summary: "Create posts in bulk", successStatus: 201 }).errors({ ...orgErrors, ...postDomainErrors }).input(CreatePostsInputSchema).output(CreatePostsOutputSchema),
8873
+ update: idempotent.route({ method: "PATCH", path: "/posts/{id}", summary: "Update a post" }).errors({ ...orgErrors, ...postDomainErrors }).input(UpdatePostInputSchema).output(PostStateSchema),
8874
+ scheduleDraft: idempotent.route({ method: "POST", path: "/posts/{id}/schedule", summary: "Schedule a draft" }).errors({ ...orgErrors, ...postDomainErrors }).input(ScheduleDraftInputSchema).output(PostStateSchema),
8875
+ delete: idempotent.route({ method: "DELETE", path: "/posts/{id}", summary: "Delete a post" }).errors({ ...orgErrors, ...postDomainErrors }).input(DeletePostInputSchema).output(DeletePostOutputSchema),
8747
8876
  retrySchedule: idempotent.route({ method: "POST", path: "/posts/schedules/{scheduleId}/retry", summary: "Retry a failed schedule" }).errors({ ...publishErrors, ...postDomainErrors }).input(RetryScheduleInputSchema).output(PostStateSchema),
8748
8877
  rescheduleSchedule: idempotent.route({
8749
8878
  method: "POST",
8750
8879
  path: "/posts/schedules/{scheduleId}/reschedule",
8751
8880
  summary: "Move a schedule to a new time"
8752
- }).errors({ ...writableErrors, ...postDomainErrors }).input(RescheduleInputSchema).output(PostStateSchema),
8881
+ }).errors({ ...orgErrors, ...postDomainErrors }).input(RescheduleInputSchema).output(PostStateSchema),
8753
8882
  markPosted: idempotent.route({
8754
8883
  method: "POST",
8755
8884
  path: "/posts/schedules/{scheduleId}/mark-posted",
8756
8885
  summary: "Mark a ready schedule as posted"
8757
- }).errors({ ...writableErrors, ...postDomainErrors }).input(object({ scheduleId: Uuid })).output(PostStateSchema),
8886
+ }).errors({ ...orgErrors, ...postDomainErrors }).input(object({ scheduleId: Uuid })).output(PostStateSchema),
8758
8887
  bulkScheduleInWindows: internal7.route({
8759
8888
  method: "POST",
8760
8889
  path: "/posts/schedules/bulk-schedule-windows",
8761
8890
  summary: "Spread schedules across optimal windows"
8762
- }).errors({ ...writableErrors, ...postDomainErrors }).input(BulkScheduleInWindowsInputSchema).output(BulkScheduleInWindowsOutputSchema),
8891
+ }).errors({ ...orgErrors, ...postDomainErrors }).input(BulkScheduleInWindowsInputSchema).output(BulkScheduleInWindowsOutputSchema),
8763
8892
  addChannels: internal7.route({
8764
8893
  method: "POST",
8765
8894
  path: "/posts/{id}/channels",
@@ -8769,7 +8898,7 @@ var postsContract = {
8769
8898
  method: "POST",
8770
8899
  path: "/posts/{id}/apply-review-comments",
8771
8900
  summary: "Rewrite post or variant from unresolved review and client comments"
8772
- }).errors({ ...writableErrors, ...postDomainErrors }).input(ApplyReviewCommentsInputSchema).output(ApplyReviewCommentsOutputSchema)
8901
+ }).errors({ ...orgErrors, ...postDomainErrors }).input(ApplyReviewCommentsInputSchema).output(ApplyReviewCommentsOutputSchema)
8773
8902
  };
8774
8903
 
8775
8904
  // ../../packages/api-contract/src/public-calendar.ts
@@ -9206,20 +9335,20 @@ var sourcesContract = {
9206
9335
  })
9207
9336
  ),
9208
9337
  delete: tagged14.route({ method: "DELETE", path: "/repurpose/sources/{id}", summary: "Delete a source post" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema),
9209
- update: tagged14.route({ method: "PATCH", path: "/repurpose/sources/{id}", summary: "Edit a source post's raw content" }).errors(writableErrors).input(object({ id: Uuid, rawContent: string2().min(1) })).output(object({ success: literal(true), id: Uuid })),
9338
+ update: tagged14.route({ method: "PATCH", path: "/repurpose/sources/{id}", summary: "Edit a source post's raw content" }).errors(orgErrors).input(object({ id: Uuid, rawContent: string2().min(1) })).output(object({ success: literal(true), id: Uuid })),
9210
9339
  createDraft: tagged14.route({
9211
9340
  method: "POST",
9212
9341
  path: "/repurpose/sources/{id}/draft",
9213
9342
  summary: "Create a draft post from a source post, unadapted",
9214
9343
  successStatus: 201
9215
- }).errors(writableErrors).input(IdPathParam).output(object({ success: literal(true), postId: Uuid }))
9344
+ }).errors(orgErrors).input(IdPathParam).output(object({ success: literal(true), postId: Uuid }))
9216
9345
  };
9217
9346
  var adaptContract = {
9218
9347
  preview: tagged14.route({
9219
9348
  method: "POST",
9220
9349
  path: "/repurpose/adapt/preview",
9221
9350
  summary: "Adapt a source post for a target platform synchronously and create a draft"
9222
- }).errors(writableErrors).input(object({ sourcePostId: Uuid, targetPlatform: PlatformSchema })).output(
9351
+ }).errors(orgErrors).input(object({ sourcePostId: Uuid, targetPlatform: PlatformSchema })).output(
9223
9352
  object({
9224
9353
  postId: Uuid,
9225
9354
  content: string2(),
@@ -9321,7 +9450,7 @@ var workflowsContract = {
9321
9450
  list: tagged14.route({ method: "GET", path: "/repurpose/workflows", summary: "List growth workflows" }).errors(orgErrors).output(array(GrowthWorkflowSchema)),
9322
9451
  get: tagged14.route({ method: "GET", path: "/repurpose/workflows/{id}", summary: "Get a growth workflow" }).errors(orgErrors).input(IdPathParam).output(GrowthWorkflowSchema),
9323
9452
  update: tagged14.route({ method: "PATCH", path: "/repurpose/workflows/{id}", summary: "Update a growth workflow" }).errors({ ...publishErrors, ...quotaErrors }).input(UpdateWorkflowInputSchema).output(GrowthWorkflowSchema),
9324
- pause: tagged14.route({ method: "POST", path: "/repurpose/workflows/{id}/pause", summary: "Pause a growth workflow" }).errors({ ...writableErrors, ...stateConflict }).input(object({ id: Uuid, reason: string2().optional() })).output(GrowthWorkflowSchema),
9453
+ pause: tagged14.route({ method: "POST", path: "/repurpose/workflows/{id}/pause", summary: "Pause a growth workflow" }).errors({ ...orgErrors, ...stateConflict }).input(object({ id: Uuid, reason: string2().optional() })).output(GrowthWorkflowSchema),
9325
9454
  resume: tagged14.route({ method: "POST", path: "/repurpose/workflows/{id}/resume", summary: "Resume a paused growth workflow" }).errors({ ...publishErrors, ...quotaErrors, ...stateConflict }).input(object({ id: Uuid, resumeFromCursor: _enum(["old", "now"]) })).output(GrowthWorkflowSchema),
9326
9455
  delete: tagged14.route({ method: "DELETE", path: "/repurpose/workflows/{id}", summary: "Delete a growth workflow" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema),
9327
9456
  runNow: tagged14.route({
@@ -9412,7 +9541,7 @@ var reviewsContract = {
9412
9541
  requiredApproverIds: array(string2()).optional()
9413
9542
  })
9414
9543
  ).output(SuccessSchema),
9415
- submitDecision: tagged15.route({ method: "POST", path: "/posts/{postId}/reviews/decision", summary: "Approve, reject, or request changes" }).errors(writableErrors).input(
9544
+ submitDecision: tagged15.route({ method: "POST", path: "/posts/{postId}/reviews/decision", summary: "Approve, reject, or request changes" }).errors(orgErrors).input(
9416
9545
  object({
9417
9546
  postId: Uuid,
9418
9547
  postScheduleId: Uuid.nullable().optional(),
@@ -9420,35 +9549,33 @@ var reviewsContract = {
9420
9549
  comment: string2().trim().max(2e3).optional()
9421
9550
  })
9422
9551
  ).output(SuccessSchema),
9423
- cancelReview: tagged15.route({ method: "POST", path: "/posts/{postId}/reviews/cancel", summary: "Cancel a pending review" }).errors(writableErrors).input(object({ postId: Uuid })).output(SuccessSchema)
9552
+ cancelReview: tagged15.route({ method: "POST", path: "/posts/{postId}/reviews/cancel", summary: "Cancel a pending review" }).errors(orgErrors).input(object({ postId: Uuid })).output(SuccessSchema)
9424
9553
  };
9425
9554
 
9426
9555
  // ../../packages/api-contract/src/schedules.ts
9427
9556
  var ScheduleListCursorInputSchema = object({ scheduledAt: DateInput, id: Uuid });
9428
9557
  var ScheduleListCursorOutputSchema = object({ scheduledAt: Timestamp, id: string2() });
9558
+ var ScheduleFilterFields = {
9559
+ startDate: string2().optional().meta({ filter: { label: "Start date", type: "date" } }),
9560
+ endDate: string2().optional().meta({ filter: { label: "End date", type: "date" } }),
9561
+ platforms: array(PlatformSchema).optional().meta({ filter: { label: "Platform", options: "platforms" } }),
9562
+ statuses: array(_enum(SCHEDULE_STATUS_VALUES)).optional().meta({ filter: { label: "Status", sticky: true, pill: true, options: "statuses" } }),
9563
+ integrationIds: array(string2()).optional().meta({ filter: { label: "Channel", options: "integrations" } }),
9564
+ search: string2().trim().min(1).max(200).optional().meta({ filter: { label: "Search", sticky: true } }),
9565
+ tagIds: array(Uuid).optional().meta({ filter: { label: "Tags", options: "tags" } }),
9566
+ approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional().meta({ filter: { label: "Approval status", options: "approvalStatuses" } }),
9567
+ sources: array(PostSourceSchema).optional().meta({ filter: { label: "Source", options: "sources" } })
9568
+ };
9429
9569
  var ListSchedulesInputSchema = object({
9430
- startDate: string2().optional(),
9431
- endDate: string2().optional(),
9432
9570
  limit: coerce_exports.number().int().min(1).max(100).default(20),
9433
9571
  cursor: ScheduleListCursorInputSchema.optional(),
9434
9572
  direction: _enum(["forward", "backward"]).default("forward"),
9435
- platforms: array(PlatformSchema).optional(),
9436
- statuses: array(_enum(SCHEDULE_STATUS_VALUES)).optional(),
9437
- integrationIds: array(string2()).optional(),
9438
- search: string2().trim().min(1).max(200).optional(),
9439
- tagIds: array(Uuid).optional(),
9440
- approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional(),
9441
- sources: array(PostSourceSchema).optional()
9573
+ ...ScheduleFilterFields
9574
+ }).extend({
9575
+ where: filterWhere(ScheduleFilterFields).optional()
9442
9576
  });
9443
- var CountSchedulesInputSchema = object({
9444
- startDate: string2().optional(),
9445
- endDate: string2().optional(),
9446
- platforms: array(PlatformSchema).optional(),
9447
- integrationIds: array(string2()).optional(),
9448
- search: string2().trim().min(1).max(200).optional(),
9449
- tagIds: array(Uuid).optional(),
9450
- approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional(),
9451
- sources: array(PostSourceSchema).optional()
9577
+ var CountSchedulesInputSchema = object(ScheduleFilterFields).extend({
9578
+ where: filterWhere(ScheduleFilterFields).optional()
9452
9579
  });
9453
9580
  var GetScheduleByIdInputSchema = object({ id: Uuid, postId: Uuid });
9454
9581
  var DeleteScheduleInputSchema = object({
@@ -9546,7 +9673,7 @@ var schedulesContract = {
9546
9673
  list: tagged16.route({ method: "GET", path: "/schedules", summary: "List schedules (calendar view)" }).errors(orgErrors).input(ListSchedulesInputSchema).output(ListSchedulesOutputSchema),
9547
9674
  counts: tagged16.route({ method: "GET", path: "/schedules/counts", summary: "Count schedules per status" }).meta({ internal: true }).errors(orgErrors).input(CountSchedulesInputSchema).output(CountSchedulesOutputSchema),
9548
9675
  getById: tagged16.route({ method: "GET", path: "/schedules/{id}", summary: "Get a schedule" }).errors(orgErrors).input(GetScheduleByIdInputSchema).output(ScheduleWithPostSchema),
9549
- delete: tagged16.route({ method: "DELETE", path: "/schedules/{id}", summary: "Delete a schedule" }).errors({ ...writableErrors, ...postDomainErrors }).input(DeleteScheduleInputSchema).output(DeletedSchema)
9676
+ delete: tagged16.route({ method: "DELETE", path: "/schedules/{id}", summary: "Delete a schedule" }).errors({ ...orgErrors, ...postDomainErrors }).input(DeleteScheduleInputSchema).output(DeletedSchema)
9550
9677
  };
9551
9678
 
9552
9679
  // ../../packages/api-contract/src/snippets.ts
@@ -9573,8 +9700,8 @@ var internal8 = publicTagged3.meta({ internal: true });
9573
9700
  var snippetsContract = {
9574
9701
  list: publicTagged3.route({ method: "GET", path: "/snippets", summary: "List saved snippets and hashtag groups" }).errors(orgErrors).output(array(SnippetSchema)),
9575
9702
  getById: publicTagged3.route({ method: "GET", path: "/snippets/{id}", summary: "Get a snippet" }).errors(orgErrors).input(IdPathParam).output(SnippetSchema),
9576
- create: internal8.route({ method: "POST", path: "/snippets", summary: "Create a snippet", successStatus: 201 }).errors(writableErrors).input(CreateSnippetInputSchema).output(SnippetSchema),
9577
- delete: internal8.route({ method: "DELETE", path: "/snippets/{id}", summary: "Delete a snippet" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema)
9703
+ create: internal8.route({ method: "POST", path: "/snippets", summary: "Create a snippet", successStatus: 201 }).errors(orgErrors).input(CreateSnippetInputSchema).output(SnippetSchema),
9704
+ delete: internal8.route({ method: "DELETE", path: "/snippets/{id}", summary: "Delete a snippet" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema)
9578
9705
  };
9579
9706
 
9580
9707
  // ../../packages/api-contract/src/support.ts
@@ -9618,7 +9745,12 @@ var CreateMessageInputSchema = object({
9618
9745
  });
9619
9746
  var GetTicketInputSchema = object({ ticketId: TicketId });
9620
9747
  var ADMIN_TICKET_FILTER_VALUES = ["needs_response", "waiting", "stale", "resolved", "all"];
9621
- var GetAdminTicketsInputSchema = object({ filter: _enum(ADMIN_TICKET_FILTER_VALUES).optional() });
9748
+ var AdminTicketFilterFields = {
9749
+ filter: _enum(ADMIN_TICKET_FILTER_VALUES).optional().meta({ filter: { label: "Ticket filter", sticky: true, pill: true, options: "ticketFilters" } })
9750
+ };
9751
+ var GetAdminTicketsInputSchema = object(AdminTicketFilterFields).extend({
9752
+ where: filterWhere(AdminTicketFilterFields).optional()
9753
+ });
9622
9754
  var UpdateTicketStatusInputSchema = object({
9623
9755
  ticketId: TicketId,
9624
9756
  status: _enum(["waiting_on_user", "resolved"])
@@ -9663,8 +9795,8 @@ var tagsContract = {
9663
9795
  list: tagged17.route({ method: "GET", path: "/tags", summary: "List tags" }).errors(orgErrors).output(array(TagSchema)),
9664
9796
  getUsageCounts: internal10.route({ method: "GET", path: "/tags/usage-counts", summary: "Count posts per tag" }).errors(orgErrors).output(array(TagUsageCountSchema)),
9665
9797
  getById: tagged17.route({ method: "GET", path: "/tags/{id}", summary: "Get a tag" }).errors(orgErrors).input(IdPathParam).output(TagSchema),
9666
- create: internal10.route({ method: "POST", path: "/tags", summary: "Create a tag", successStatus: 201 }).errors({ ...writableErrors, CONFLICT: { message: "A tag with that name already exists." } }).input(CreateTagInputSchema).output(TagSchema),
9667
- update: internal10.route({ method: "PATCH", path: "/tags/{id}", summary: "Rename a tag" }).errors(writableErrors).input(UpdateTagInputSchema).output(TagSchema),
9798
+ create: internal10.route({ method: "POST", path: "/tags", summary: "Create a tag", successStatus: 201 }).errors({ ...orgErrors, CONFLICT: { message: "A tag with that name already exists." } }).input(CreateTagInputSchema).output(TagSchema),
9799
+ update: internal10.route({ method: "PATCH", path: "/tags/{id}", summary: "Rename a tag" }).errors(orgErrors).input(UpdateTagInputSchema).output(TagSchema),
9668
9800
  delete: internal10.route({ method: "DELETE", path: "/tags/{id}", summary: "Delete a tag" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema)
9669
9801
  };
9670
9802
 
@@ -12772,7 +12904,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
12772
12904
  }
12773
12905
 
12774
12906
  // src/version.ts
12775
- var CLI_VERSION = "0.1.58";
12907
+ var CLI_VERSION = "0.1.60";
12776
12908
 
12777
12909
  // src/client.ts
12778
12910
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";