@postonus/cli 0.1.20 → 0.1.22

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
@@ -7882,6 +7882,21 @@ var notificationsContract = {
7882
7882
  };
7883
7883
 
7884
7884
  // ../../packages/api-contract/src/posts.ts
7885
+ var POST_SOURCE_VALUES = ["app", "mcp", "api", "cli"];
7886
+ var PostSourceSchema = _enum(POST_SOURCE_VALUES);
7887
+ var PostProvenanceSchema = object({
7888
+ created: object({
7889
+ source: PostSourceSchema,
7890
+ clientLabel: string2().nullable(),
7891
+ at: Timestamp
7892
+ }),
7893
+ lastEdit: object({
7894
+ source: PostSourceSchema,
7895
+ clientLabel: string2().nullable(),
7896
+ by: object({ id: string2(), name: string2() }).nullable(),
7897
+ at: Timestamp
7898
+ }).nullable()
7899
+ });
7885
7900
  var MEDIA_PROVIDER_VALUES = ["GIPHY", "S3", "DROPBOX", "GOOGLE_PHOTOS", "ONEDRIVE", "UNSPLASH", "CANVA"];
7886
7901
  var THUMBNAIL_SOURCE_VALUES = ["FRAME_CAPTURE", "UPLOADED"];
7887
7902
  var INTEGRATION_TOKEN_STATUS_VALUES = ["VALID", "EXPIRED", "UNKNOWN"];
@@ -7981,7 +7996,8 @@ var ListPostsInputSchema = object({
7981
7996
  platform: array(PlatformSchema).optional(),
7982
7997
  dateFrom: string2().optional(),
7983
7998
  dateTo: string2().optional(),
7984
- tagIds: array(Uuid).optional()
7999
+ tagIds: array(Uuid).optional(),
8000
+ sources: array(PostSourceSchema).optional()
7985
8001
  });
7986
8002
  var CountPostsInputSchema = ListPostsInputSchema.omit({ status: true, page: true, limit: true });
7987
8003
  var CountPostsOutputSchema = record(_enum(SCHEDULE_STATUS_VALUES), coerce_exports.number().int());
@@ -8096,7 +8112,8 @@ var PostWithRelationsSchema = object({
8096
8112
  collab: PostCollabSchema,
8097
8113
  tags: array(object({ id: string2(), name: string2(), slug: string2() })),
8098
8114
  schedules: array(PostScheduleSchema.extend({ integration: IntegrationSummarySchema })),
8099
- user: object({ id: string2(), name: string2(), email: string2() })
8115
+ user: object({ id: string2(), name: string2(), email: string2() }),
8116
+ provenance: PostProvenanceSchema.optional()
8100
8117
  });
8101
8118
  var PostsListOutputSchema = object({
8102
8119
  items: array(PostWithRelationsSchema),
@@ -8488,6 +8505,9 @@ var quotaErrors = {
8488
8505
  }
8489
8506
  };
8490
8507
  var badRequest = { BAD_REQUEST: { message: "Bad request." } };
8508
+ var stateConflict = {
8509
+ CONFLICT: { status: 409, message: "The workflow is not in a state that allows this." }
8510
+ };
8491
8511
  var MediaAttachmentSchema = object({
8492
8512
  id: Uuid,
8493
8513
  url: string2(),
@@ -8609,9 +8629,7 @@ var WorkflowSettingsSchema = object({
8609
8629
  });
8610
8630
  var UpdateWorkflowInputSchema = object({
8611
8631
  id: Uuid,
8612
- data: WorkflowSettingsSchema.partial().extend({
8613
- status: _enum(["DRAFT", "RUNNING", "PAUSED", "COMPLETED", "FAILED"]).optional()
8614
- })
8632
+ data: WorkflowSettingsSchema.partial()
8615
8633
  });
8616
8634
  var CapturedPostSchema = object({
8617
8635
  remoteId: string2().min(1),
@@ -8800,8 +8818,8 @@ var workflowsContract = {
8800
8818
  list: tagged13.route({ method: "GET", path: "/repurpose/workflows", summary: "List growth workflows" }).errors(orgErrors).output(array(GrowthWorkflowSchema)),
8801
8819
  get: tagged13.route({ method: "GET", path: "/repurpose/workflows/{id}", summary: "Get a growth workflow" }).errors(orgErrors).input(IdPathParam).output(GrowthWorkflowSchema),
8802
8820
  update: tagged13.route({ method: "PATCH", path: "/repurpose/workflows/{id}", summary: "Update a growth workflow" }).errors({ ...publishErrors, ...quotaErrors }).input(UpdateWorkflowInputSchema).output(GrowthWorkflowSchema),
8803
- pause: tagged13.route({ method: "POST", path: "/repurpose/workflows/{id}/pause", summary: "Pause a growth workflow" }).errors(writableErrors).input(object({ id: Uuid, reason: string2().optional() })).output(GrowthWorkflowSchema),
8804
- resume: tagged13.route({ method: "POST", path: "/repurpose/workflows/{id}/resume", summary: "Resume a paused growth workflow" }).errors({ ...publishErrors, ...quotaErrors }).input(object({ id: Uuid, resumeFromCursor: _enum(["old", "now"]) })).output(GrowthWorkflowSchema),
8821
+ pause: tagged13.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),
8822
+ resume: tagged13.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),
8805
8823
  delete: tagged13.route({ method: "DELETE", path: "/repurpose/workflows/{id}", summary: "Delete a growth workflow" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema),
8806
8824
  runNow: tagged13.route({
8807
8825
  method: "POST",
@@ -8868,6 +8886,7 @@ var ReviewSchema = object({
8868
8886
  });
8869
8887
  var ApprovalSettingsSchema = object({
8870
8888
  required: boolean2(),
8889
+ agentPostsRequireReview: boolean2().default(false),
8871
8890
  approverRoles: array(string2()),
8872
8891
  minApprovers: number2().int()
8873
8892
  });
@@ -8909,7 +8928,6 @@ var reviewsContract = {
8909
8928
  };
8910
8929
 
8911
8930
  // ../../packages/api-contract/src/schedules.ts
8912
- var APPROVAL_STATUS_VALUES2 = ["pending_review", "changes_requested", "approved", "rejected"];
8913
8931
  var ScheduleListCursorInputSchema = object({ scheduledAt: DateInput, id: Uuid });
8914
8932
  var ScheduleListCursorOutputSchema = object({ scheduledAt: Timestamp, id: string2() });
8915
8933
  var ListSchedulesInputSchema = object({
@@ -8927,7 +8945,8 @@ var ListSchedulesInputSchema = object({
8927
8945
  integrationIds: array(string2()).optional(),
8928
8946
  search: string2().trim().min(1).max(200).optional(),
8929
8947
  tagIds: array(Uuid).optional(),
8930
- approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES2)).optional()
8948
+ approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional(),
8949
+ sources: array(PostSourceSchema).optional()
8931
8950
  });
8932
8951
  var CountSchedulesInputSchema = object({
8933
8952
  startDate: string2().optional(),
@@ -8936,7 +8955,8 @@ var CountSchedulesInputSchema = object({
8936
8955
  integrationIds: array(string2()).optional(),
8937
8956
  search: string2().trim().min(1).max(200).optional(),
8938
8957
  tagIds: array(Uuid).optional(),
8939
- approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES2)).optional()
8958
+ approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional(),
8959
+ sources: array(PostSourceSchema).optional()
8940
8960
  });
8941
8961
  var GetScheduleByIdInputSchema = object({ id: Uuid, postId: Uuid });
8942
8962
  var DeleteScheduleInputSchema = object({
@@ -8966,7 +8986,7 @@ var ScheduleListItemSchema = object({
8966
8986
  lastAttempt: Timestamp.nullable(),
8967
8987
  createdAt: Timestamp,
8968
8988
  updatedAt: Timestamp,
8969
- approvalStatus: _enum(APPROVAL_STATUS_VALUES2).nullable(),
8989
+ approvalStatus: _enum(APPROVAL_STATUS_VALUES).nullable(),
8970
8990
  approvalRequestedAt: Timestamp.nullable(),
8971
8991
  approvalCompletedAt: Timestamp.nullable(),
8972
8992
  /**
@@ -8991,7 +9011,8 @@ var ScheduleListItemSchema = object({
8991
9011
  width: number2().nullable(),
8992
9012
  height: number2().nullable()
8993
9013
  }).nullable(),
8994
- attachmentCount: number2()
9014
+ attachmentCount: number2(),
9015
+ provenance: PostProvenanceSchema.optional()
8995
9016
  }),
8996
9017
  integration: object({ id: string2(), platform: PlatformSchema, name: string2(), image: string2().nullable() })
8997
9018
  });
@@ -9009,7 +9030,7 @@ var PostRowSchema = object({
9009
9030
  originSourcePostId: string2().nullable(),
9010
9031
  isEvergreen: boolean2(),
9011
9032
  lastRecycledAt: Timestamp.nullable(),
9012
- approvalStatus: _enum(APPROVAL_STATUS_VALUES2).nullable(),
9033
+ approvalStatus: _enum(APPROVAL_STATUS_VALUES).nullable(),
9013
9034
  approvalRequestedAt: Timestamp.nullable(),
9014
9035
  approvalCompletedAt: Timestamp.nullable(),
9015
9036
  requiredApproverIds: array(string2()).nullable(),
@@ -9034,7 +9055,7 @@ var ScheduleWithIntegrationSchema = object({
9034
9055
  lastAttempt: Timestamp.nullable(),
9035
9056
  createdAt: Timestamp,
9036
9057
  updatedAt: Timestamp,
9037
- approvalStatus: _enum(APPROVAL_STATUS_VALUES2).nullable(),
9058
+ approvalStatus: _enum(APPROVAL_STATUS_VALUES).nullable(),
9038
9059
  approvalRequestedAt: Timestamp.nullable(),
9039
9060
  approvalCompletedAt: Timestamp.nullable(),
9040
9061
  /** 0 on the root and on a plain schedule; 1..N down a thread. */
@@ -9098,7 +9119,10 @@ var CreateMessageInputSchema = object({
9098
9119
  var GetTicketInputSchema = object({ ticketId: TicketId });
9099
9120
  var ADMIN_TICKET_FILTER_VALUES = ["needs_response", "waiting", "stale", "resolved", "all"];
9100
9121
  var GetAdminTicketsInputSchema = object({ filter: _enum(ADMIN_TICKET_FILTER_VALUES).optional() });
9101
- var UpdateTicketStatusInputSchema = object({ ticketId: TicketId, status: SupportTicketStatusSchema });
9122
+ var UpdateTicketStatusInputSchema = object({
9123
+ ticketId: TicketId,
9124
+ status: _enum(["waiting_on_user", "resolved"])
9125
+ });
9102
9126
  var ticketErrors = { ...authedErrors, NOT_FOUND: { message: "Ticket not found." } };
9103
9127
  var internal5 = base.route({ tags: ["Support"] }).meta({ internal: true });
9104
9128
  var supportContract = {
@@ -9116,7 +9140,7 @@ var supportContract = {
9116
9140
  method: "PATCH",
9117
9141
  path: "/internal/support/admin/tickets/{ticketId}/status",
9118
9142
  summary: "Update a ticket\u2019s status"
9119
- }).errors(authedErrors).input(UpdateTicketStatusInputSchema).output(SupportTicketSchema)
9143
+ }).errors({ ...authedErrors, CONFLICT: { status: 409, message: "The ticket cannot move to that status." } }).input(UpdateTicketStatusInputSchema).output(SupportTicketSchema)
9120
9144
  };
9121
9145
 
9122
9146
  // ../../packages/api-contract/src/tags.ts
@@ -9384,6 +9408,7 @@ var TransferOwnershipInputSchema = object({
9384
9408
  });
9385
9409
  var ApprovalSettingsInputSchema = object({
9386
9410
  required: boolean2(),
9411
+ agentPostsRequireReview: boolean2().default(false),
9387
9412
  approverRoles: array(_enum(["owner", "admin", "member"])),
9388
9413
  minApprovers: number2().int().min(1).max(5)
9389
9414
  });
@@ -12104,7 +12129,7 @@ function formatTable(headers, rows) {
12104
12129
  }
12105
12130
 
12106
12131
  // src/version.ts
12107
- var CLI_VERSION = "0.1.20";
12132
+ var CLI_VERSION = "0.1.22";
12108
12133
 
12109
12134
  // src/client.ts
12110
12135
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -12174,6 +12199,7 @@ function buildClient(apiUrl, auth) {
12174
12199
  url: `${apiUrl}/api/v1`,
12175
12200
  headers: () => ({
12176
12201
  [CLI_VERSION_HEADER]: CLI_VERSION,
12202
+ "x-postonus-client": "cli",
12177
12203
  ...auth.kind === "api-key" ? { "x-api-key": auth.apiKey } : { authorization: `Bearer ${oauth?.accessToken}` }
12178
12204
  }),
12179
12205
  fetch: oauth ? createOAuthFetch(apiUrl, oauth, persistRefreshedTokens(apiUrl, oauth)) : (request, init) => fetch(request, init)