@postonus/cli 0.1.59 → 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 +166 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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) {
|
|
@@ -6965,6 +6968,124 @@ var activityContract = {
|
|
|
6965
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))
|
|
6966
6969
|
};
|
|
6967
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
|
+
|
|
6968
7089
|
// ../../packages/api-contract/src/admin-outreach.ts
|
|
6969
7090
|
var internal = base.route({ tags: ["Admin", "Outreach"] }).meta({ internal: true });
|
|
6970
7091
|
var mcpAdmin = internal.meta({ internal: true, mcpAdmin: true });
|
|
@@ -6988,14 +7109,19 @@ var ImportProspectsInputSchema = object({
|
|
|
6988
7109
|
})
|
|
6989
7110
|
).min(1).max(500)
|
|
6990
7111
|
});
|
|
6991
|
-
var
|
|
7112
|
+
var ProspectFilterFields = {
|
|
6992
7113
|
needs: _enum(["persona", "drafts"]).optional(),
|
|
6993
|
-
persona: string2().trim().optional(),
|
|
6994
|
-
verifyStatus: _enum(["all", ...OUTREACH_VERIFY_STATUS_VALUES]).optional().default("all"),
|
|
6995
|
-
enrollmentStatus: _enum(["all", "none", ...OUTREACH_ENROLLMENT_STATUS_VALUES]).optional().default("all"),
|
|
6996
|
-
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,
|
|
6997
7121
|
limit: coerce_exports.number().int().min(1).max(100).default(25),
|
|
6998
7122
|
offset: coerce_exports.number().int().min(0).default(0)
|
|
7123
|
+
}).extend({
|
|
7124
|
+
where: filterWhere(ProspectFilterFields).optional()
|
|
6999
7125
|
});
|
|
7000
7126
|
var OutreachProspectItemSchema = object({
|
|
7001
7127
|
id: string2(),
|
|
@@ -7373,6 +7499,17 @@ var WorkspaceDeveloperUsageSchema = object({
|
|
|
7373
7499
|
lastCallDay: iso_exports.date()
|
|
7374
7500
|
});
|
|
7375
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
|
+
});
|
|
7376
7513
|
var DeveloperUsageSchema = object({
|
|
7377
7514
|
callers: array(DeveloperCallerSchema),
|
|
7378
7515
|
workspaces: array(WorkspaceDeveloperUsageSchema)
|
|
@@ -7410,14 +7547,7 @@ var adminContract = {
|
|
|
7410
7547
|
path: "/internal/admin/channel-revenue",
|
|
7411
7548
|
summary: "Channel revenue attribution (admin only)"
|
|
7412
7549
|
}).errors(authedErrors).output(array(ChannelRevenueSchema)),
|
|
7413
|
-
listUsers: internal2.route({ method: "GET", path: "/internal/admin/users", summary: "List users with activity (admin only)" }).errors(authedErrors).input(
|
|
7414
|
-
object({
|
|
7415
|
-
search: string2().trim().max(200).optional(),
|
|
7416
|
-
audience: AdminAudienceSchema,
|
|
7417
|
-
limit: coerce_exports.number().int().min(1).max(100).default(25),
|
|
7418
|
-
offset: coerce_exports.number().int().min(0).default(0)
|
|
7419
|
-
})
|
|
7420
|
-
).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),
|
|
7421
7551
|
getDeveloperUsage: internal2.route({
|
|
7422
7552
|
method: "GET",
|
|
7423
7553
|
path: "/internal/admin/developer-usage",
|
|
@@ -9425,29 +9555,27 @@ var reviewsContract = {
|
|
|
9425
9555
|
// ../../packages/api-contract/src/schedules.ts
|
|
9426
9556
|
var ScheduleListCursorInputSchema = object({ scheduledAt: DateInput, id: Uuid });
|
|
9427
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
|
+
};
|
|
9428
9569
|
var ListSchedulesInputSchema = object({
|
|
9429
|
-
startDate: string2().optional(),
|
|
9430
|
-
endDate: string2().optional(),
|
|
9431
9570
|
limit: coerce_exports.number().int().min(1).max(100).default(20),
|
|
9432
9571
|
cursor: ScheduleListCursorInputSchema.optional(),
|
|
9433
9572
|
direction: _enum(["forward", "backward"]).default("forward"),
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
search: string2().trim().min(1).max(200).optional(),
|
|
9438
|
-
tagIds: array(Uuid).optional(),
|
|
9439
|
-
approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional(),
|
|
9440
|
-
sources: array(PostSourceSchema).optional()
|
|
9573
|
+
...ScheduleFilterFields
|
|
9574
|
+
}).extend({
|
|
9575
|
+
where: filterWhere(ScheduleFilterFields).optional()
|
|
9441
9576
|
});
|
|
9442
|
-
var CountSchedulesInputSchema = object({
|
|
9443
|
-
|
|
9444
|
-
endDate: string2().optional(),
|
|
9445
|
-
platforms: array(PlatformSchema).optional(),
|
|
9446
|
-
integrationIds: array(string2()).optional(),
|
|
9447
|
-
search: string2().trim().min(1).max(200).optional(),
|
|
9448
|
-
tagIds: array(Uuid).optional(),
|
|
9449
|
-
approvalStatuses: array(_enum(APPROVAL_STATUS_VALUES)).optional(),
|
|
9450
|
-
sources: array(PostSourceSchema).optional()
|
|
9577
|
+
var CountSchedulesInputSchema = object(ScheduleFilterFields).extend({
|
|
9578
|
+
where: filterWhere(ScheduleFilterFields).optional()
|
|
9451
9579
|
});
|
|
9452
9580
|
var GetScheduleByIdInputSchema = object({ id: Uuid, postId: Uuid });
|
|
9453
9581
|
var DeleteScheduleInputSchema = object({
|
|
@@ -9617,7 +9745,12 @@ var CreateMessageInputSchema = object({
|
|
|
9617
9745
|
});
|
|
9618
9746
|
var GetTicketInputSchema = object({ ticketId: TicketId });
|
|
9619
9747
|
var ADMIN_TICKET_FILTER_VALUES = ["needs_response", "waiting", "stale", "resolved", "all"];
|
|
9620
|
-
var
|
|
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
|
+
});
|
|
9621
9754
|
var UpdateTicketStatusInputSchema = object({
|
|
9622
9755
|
ticketId: TicketId,
|
|
9623
9756
|
status: _enum(["waiting_on_user", "resolved"])
|
|
@@ -12771,7 +12904,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
|
|
|
12771
12904
|
}
|
|
12772
12905
|
|
|
12773
12906
|
// src/version.ts
|
|
12774
|
-
var CLI_VERSION = "0.1.
|
|
12907
|
+
var CLI_VERSION = "0.1.60";
|
|
12775
12908
|
|
|
12776
12909
|
// src/client.ts
|
|
12777
12910
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|