@go-labs-sg/bb 2.20.0 → 2.24.1
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/README.md +58 -27
- package/command-manifest.json +771 -0
- package/command-reference.md +25 -0
- package/dist/index.js +21162 -1995
- package/package.json +2 -2
- package/role-aware-agent-guide.md +2 -2
- package/dist/api-client.js +0 -93
- package/dist/cli-trace.js +0 -86
- package/dist/commands.js +0 -2299
- package/dist/filter-enums.js +0 -58
- package/dist/load-env.js +0 -6
- package/dist/parse-args.js +0 -55
- package/dist/parse-cli-enums.js +0 -336
- package/dist/parse-json-flag.js +0 -20
- package/dist/parse-mutation-payload.js +0 -363
- package/dist/prisma-enums.js +0 -81
- package/dist/registry/generate-command-artifacts.js +0 -36
- package/dist/registry/index.js +0 -645
- package/dist/rich-text.js +0 -34
- package/dist/runtime/confirmation.js +0 -76
- package/dist/runtime/error.js +0 -143
- package/dist/runtime/index.js +0 -6
- package/dist/runtime/output.js +0 -36
- package/dist/runtime/process-runtime.js +0 -28
- package/dist/runtime/sanitize.js +0 -50
- package/dist/runtime/session.js +0 -50
- package/dist/runtime/types.js +0 -1
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
import { normalizePlainTextRichTextField } from "./rich-text.js";
|
|
2
|
-
function requireObject(raw, label) {
|
|
3
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
4
|
-
throw new Error(`${label} must be a JSON object.`);
|
|
5
|
-
}
|
|
6
|
-
return raw;
|
|
7
|
-
}
|
|
8
|
-
function toDate(value, field) {
|
|
9
|
-
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
if (typeof value === "string") {
|
|
13
|
-
const d = new Date(value);
|
|
14
|
-
if (!Number.isNaN(d.getTime()))
|
|
15
|
-
return d;
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`${field} must be an ISO date/datetime string.`);
|
|
18
|
-
}
|
|
19
|
-
function optionalString(v) {
|
|
20
|
-
if (v === undefined || v === null)
|
|
21
|
-
return undefined;
|
|
22
|
-
const s = String(v);
|
|
23
|
-
return s === "" ? undefined : s;
|
|
24
|
-
}
|
|
25
|
-
/** Required string fields: rejects null/undefined, whitespace-only, and avoids String(undefined) → "undefined" passing Zod .min(1). */
|
|
26
|
-
function requiredString(value, fieldLabel) {
|
|
27
|
-
if (value === undefined || value === null) {
|
|
28
|
-
throw new Error(`${fieldLabel} is required.`);
|
|
29
|
-
}
|
|
30
|
-
const s = typeof value === "string" ? value : String(value);
|
|
31
|
-
const t = s.trim();
|
|
32
|
-
if (t === "") {
|
|
33
|
-
throw new Error(`${fieldLabel} is required.`);
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
}
|
|
37
|
-
const EMAIL_ADDRESS_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
38
|
-
const requiredEmail = (value, fieldLabel) => {
|
|
39
|
-
const email = requiredString(value, fieldLabel);
|
|
40
|
-
if (!EMAIL_ADDRESS_PATTERN.test(email)) {
|
|
41
|
-
throw new Error(`${fieldLabel} must be a valid email address.`);
|
|
42
|
-
}
|
|
43
|
-
return email;
|
|
44
|
-
};
|
|
45
|
-
const parseContactPersonEmailPayload = (input, commandName) => {
|
|
46
|
-
if (!Array.isArray(input.cc)) {
|
|
47
|
-
throw new Error(`${commandName} payload.cc must be an email array.`);
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
to: requiredEmail(input.to, `${commandName} payload.to`),
|
|
51
|
-
cc: input.cc.map((email, index) => requiredEmail(email, `${commandName} payload.cc[${index}]`)),
|
|
52
|
-
replyTo: requiredEmail(input.replyTo, `${commandName} payload.replyTo`),
|
|
53
|
-
subject: requiredString(input.subject, `${commandName} payload.subject`),
|
|
54
|
-
content: requiredString(input.content, `${commandName} payload.content`),
|
|
55
|
-
signature: requiredString(input.signature, `${commandName} payload.signature`),
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
/** Matches the web estimate composer (`email.sendEstimateToContactPerson`). */
|
|
59
|
-
export const parseSendEstimateToContactPersonPayload = (raw) => {
|
|
60
|
-
const input = requireObject(raw, "send-estimate-to-contact-person payload");
|
|
61
|
-
return {
|
|
62
|
-
...parseContactPersonEmailPayload(input, "send-estimate-to-contact-person"),
|
|
63
|
-
estimateId: requiredString(input.estimateId, "send-estimate-to-contact-person payload.estimateId"),
|
|
64
|
-
estimateDocNumber: optionalString(input.estimateDocNumber),
|
|
65
|
-
budgetId: requiredString(input.budgetId, "send-estimate-to-contact-person payload.budgetId"),
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
/** Matches the web customer-invoice email composer. */
|
|
69
|
-
export const parseSendCustomerInvoiceToContactPersonPayload = (raw) => {
|
|
70
|
-
const input = requireObject(raw, "send-customer-invoice-to-contact-person payload");
|
|
71
|
-
return {
|
|
72
|
-
...parseContactPersonEmailPayload(input, "send-customer-invoice-to-contact-person"),
|
|
73
|
-
invoiceId: requiredString(input.invoiceId, "send-customer-invoice-to-contact-person payload.invoiceId"),
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
/** Matches budget.createBudget — optional pipedriveDealId; Asana deal is project.asanaTaskId. */
|
|
77
|
-
export function parseCreateBudgetPayload(raw) {
|
|
78
|
-
const o = requireObject(raw, "create-budget payload");
|
|
79
|
-
if (o.unavailableItemReviewAcknowledged !== undefined &&
|
|
80
|
-
typeof o.unavailableItemReviewAcknowledged !== "boolean") {
|
|
81
|
-
throw new Error("create-budget payload.unavailableItemReviewAcknowledged must be a boolean when set.");
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
name: requiredString(o.name, "create-budget payload.name"),
|
|
85
|
-
budget: requiredString(o.budget, "create-budget payload.budget"),
|
|
86
|
-
paymentTerm: requiredString(o.paymentTerm, "create-budget payload.paymentTerm"),
|
|
87
|
-
categoryId: requiredString(o.categoryId, "create-budget payload.categoryId"),
|
|
88
|
-
projectId: requiredString(o.projectId, "create-budget payload.projectId"),
|
|
89
|
-
sourceBudgetId: optionalString(o.sourceBudgetId),
|
|
90
|
-
...(o.unavailableItemReviewAcknowledged !== undefined && {
|
|
91
|
-
unavailableItemReviewAcknowledged: o.unavailableItemReviewAcknowledged,
|
|
92
|
-
}),
|
|
93
|
-
pipedriveDealId: optionalString(o.pipedriveDealId),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/** Matches budget.updateBudget — same as create plus id. */
|
|
97
|
-
export function parseUpdateBudgetPayload(raw) {
|
|
98
|
-
const o = requireObject(raw, "update-budget payload");
|
|
99
|
-
const id = requiredString(o.id, "update-budget payload.id");
|
|
100
|
-
const base = parseCreateBudgetPayload(raw);
|
|
101
|
-
return { ...base, id };
|
|
102
|
-
}
|
|
103
|
-
export function parseUpdateBudgetCommissionPayload(raw) {
|
|
104
|
-
const o = requireObject(raw, "update-budget-commission payload");
|
|
105
|
-
return {
|
|
106
|
-
budgetId: requiredString(o.budgetId, "update-budget-commission payload.budgetId"),
|
|
107
|
-
name: requiredString(o.name, "update-budget-commission payload.name"),
|
|
108
|
-
percentage: requiredString(o.percentage, "update-budget-commission payload.percentage"),
|
|
109
|
-
totalSellingAfterDiscount: Number(o.totalSellingAfterDiscount),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
export function parseBudgetDiscountPayload(raw) {
|
|
113
|
-
const o = requireObject(raw, "update-budget-discount payload");
|
|
114
|
-
const type = o.type;
|
|
115
|
-
if (type !== "percentage" && type !== "amount") {
|
|
116
|
-
throw new Error('update-budget-discount payload.type must be "percentage" or "amount".');
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
budgetId: requiredString(o.budgetId, "update-budget-discount payload.budgetId"),
|
|
120
|
-
name: requiredString(o.name, "update-budget-discount payload.name"),
|
|
121
|
-
type,
|
|
122
|
-
value: requiredString(o.value, "update-budget-discount payload.value"),
|
|
123
|
-
totalSellingBeforeDiscount: Number(o.totalSellingBeforeDiscount),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
const billAttachment = (x, i, field = "attachments") => {
|
|
127
|
-
const label = `create-bill payload.${field}[${i}]`;
|
|
128
|
-
const a = requireObject(x, label);
|
|
129
|
-
return {
|
|
130
|
-
id: requiredString(a.id, `${label}.id`),
|
|
131
|
-
name: requiredString(a.name, `${label}.name`),
|
|
132
|
-
key: requiredString(a.key, `${label}.key`),
|
|
133
|
-
size: Number(a.size),
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
/** Matches bill.create — invoiceDate may be ISO string; attachments default to []. */
|
|
137
|
-
export function parseCreateBillPayload(raw) {
|
|
138
|
-
const o = requireObject(raw, "create-bill payload");
|
|
139
|
-
const isClaimable = o.isClaimable;
|
|
140
|
-
if (typeof isClaimable !== "boolean") {
|
|
141
|
-
throw new Error("create-bill payload.isClaimable must be boolean.");
|
|
142
|
-
}
|
|
143
|
-
const budgetItemIds = o.budgetItemIds;
|
|
144
|
-
if (!Array.isArray(budgetItemIds) || budgetItemIds.length === 0) {
|
|
145
|
-
throw new Error("create-bill payload.budgetItemIds must be a non-empty string array.");
|
|
146
|
-
}
|
|
147
|
-
const attachmentsRaw = o.attachments;
|
|
148
|
-
const attachments = Array.isArray(attachmentsRaw)
|
|
149
|
-
? attachmentsRaw.map((x, i) => billAttachment(x, i))
|
|
150
|
-
: [];
|
|
151
|
-
const alreadyPaidRaw = o.alreadyPaid;
|
|
152
|
-
if (alreadyPaidRaw !== undefined &&
|
|
153
|
-
alreadyPaidRaw !== null &&
|
|
154
|
-
typeof alreadyPaidRaw !== "boolean") {
|
|
155
|
-
throw new Error("create-bill payload.alreadyPaid must be boolean.");
|
|
156
|
-
}
|
|
157
|
-
const paymentProofAttachmentsRaw = o.paymentProofAttachments;
|
|
158
|
-
const paymentProofAttachments = Array.isArray(paymentProofAttachmentsRaw)
|
|
159
|
-
? paymentProofAttachmentsRaw.map((x, i) => billAttachment(x, i, "paymentProofAttachments"))
|
|
160
|
-
: [];
|
|
161
|
-
let verificationResults;
|
|
162
|
-
const vr = o.verificationResults;
|
|
163
|
-
if (vr !== undefined && vr !== null) {
|
|
164
|
-
const v = requireObject(vr, "verificationResults");
|
|
165
|
-
const verificationResultStatus = v.status;
|
|
166
|
-
if (verificationResultStatus !== "PENDING" &&
|
|
167
|
-
verificationResultStatus !== "PASS" &&
|
|
168
|
-
verificationResultStatus !== "FAIL" &&
|
|
169
|
-
verificationResultStatus !== "MANUAL_REVIEW") {
|
|
170
|
-
throw new Error("create-bill payload.verificationResults.status must be PENDING | PASS | FAIL | MANUAL_REVIEW.");
|
|
171
|
-
}
|
|
172
|
-
verificationResults = {
|
|
173
|
-
status: verificationResultStatus,
|
|
174
|
-
extractedAmount: v.extractedAmount === null || v.extractedAmount === undefined
|
|
175
|
-
? null
|
|
176
|
-
: Number(v.extractedAmount),
|
|
177
|
-
difference: v.difference === null || v.difference === undefined
|
|
178
|
-
? null
|
|
179
|
-
: Number(v.difference),
|
|
180
|
-
confidence: v.confidence === null || v.confidence === undefined
|
|
181
|
-
? null
|
|
182
|
-
: Number(v.confidence),
|
|
183
|
-
failureReason: v.failureReason === null || v.failureReason === undefined
|
|
184
|
-
? null
|
|
185
|
-
: String(v.failureReason),
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
const verificationStatus = o.verificationStatus;
|
|
189
|
-
let vs;
|
|
190
|
-
if (verificationStatus === "PENDING" ||
|
|
191
|
-
verificationStatus === "PASS" ||
|
|
192
|
-
verificationStatus === "FAIL" ||
|
|
193
|
-
verificationStatus === "MANUAL_REVIEW") {
|
|
194
|
-
vs = verificationStatus;
|
|
195
|
-
}
|
|
196
|
-
else if (verificationStatus !== undefined && verificationStatus !== null) {
|
|
197
|
-
throw new Error("create-bill payload.verificationStatus must be PENDING | PASS | FAIL | MANUAL_REVIEW.");
|
|
198
|
-
}
|
|
199
|
-
const amount = Number(o.amount);
|
|
200
|
-
if (!Number.isFinite(amount) || amount < 0) {
|
|
201
|
-
throw new Error("create-bill payload.amount must be a number >= 0.");
|
|
202
|
-
}
|
|
203
|
-
return {
|
|
204
|
-
budgetId: requiredString(o.budgetId, "create-bill payload.budgetId"),
|
|
205
|
-
projectId: requiredString(o.projectId, "create-bill payload.projectId"),
|
|
206
|
-
supplierId: requiredString(o.supplierId, "create-bill payload.supplierId"),
|
|
207
|
-
amount,
|
|
208
|
-
budgetItemIds: budgetItemIds.map((id, i) => requiredString(id, `create-bill payload.budgetItemIds[${i}]`)),
|
|
209
|
-
comment: optionalString(o.comment),
|
|
210
|
-
isClaimable,
|
|
211
|
-
attachments,
|
|
212
|
-
alreadyPaid: alreadyPaidRaw ?? undefined,
|
|
213
|
-
paymentReference: optionalString(o.paymentReference),
|
|
214
|
-
paymentProofAttachments,
|
|
215
|
-
extractedSupplierName: optionalString(o.extractedSupplierName),
|
|
216
|
-
extractedAmount: o.extractedAmount === undefined || o.extractedAmount === null
|
|
217
|
-
? undefined
|
|
218
|
-
: Number(o.extractedAmount),
|
|
219
|
-
invoiceNumber: o.invoiceNumber === undefined || o.invoiceNumber === null
|
|
220
|
-
? ""
|
|
221
|
-
: typeof o.invoiceNumber === "string"
|
|
222
|
-
? o.invoiceNumber
|
|
223
|
-
: String(o.invoiceNumber),
|
|
224
|
-
invoiceDate: o.invoiceDate === undefined || o.invoiceDate === null
|
|
225
|
-
? undefined
|
|
226
|
-
: toDate(o.invoiceDate, "invoiceDate"),
|
|
227
|
-
verificationStatus: vs,
|
|
228
|
-
verificationResults,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
/** Matches bill.update */
|
|
232
|
-
export function parseUpdateBillPayload(raw) {
|
|
233
|
-
const o = requireObject(raw, "update-bill payload");
|
|
234
|
-
return {
|
|
235
|
-
...parseCreateBillPayload(raw),
|
|
236
|
-
id: requiredString(o.id, "update-bill payload.id"),
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
/** Server performs the authoritative bill-selection and quotation-coverage checks. */
|
|
240
|
-
export function parseValidateBillSelectionPayload(raw) {
|
|
241
|
-
requireObject(raw, "validate-bill-selection payload");
|
|
242
|
-
return raw;
|
|
243
|
-
}
|
|
244
|
-
/** Matches bill.updatePaymentEvidence for already-paid supplier bills. */
|
|
245
|
-
export function parseUpdateBillPaymentEvidencePayload(raw) {
|
|
246
|
-
requireObject(raw, "update-bill-payment-evidence payload");
|
|
247
|
-
return raw;
|
|
248
|
-
}
|
|
249
|
-
/** Server validates quotation amounts, line items, and the single attachment. */
|
|
250
|
-
export function parseCreateQuotationPayload(raw) {
|
|
251
|
-
requireObject(raw, "create-quotation payload");
|
|
252
|
-
return raw;
|
|
253
|
-
}
|
|
254
|
-
export function parseUpdateQuotationPayload(raw) {
|
|
255
|
-
requireObject(raw, "update-quotation payload");
|
|
256
|
-
return raw;
|
|
257
|
-
}
|
|
258
|
-
export function parseCreateCustomerInvoicePayload(raw) {
|
|
259
|
-
const input = requireObject(raw, "create-customer-invoice payload");
|
|
260
|
-
if (!Array.isArray(input.splits) || input.splits.length === 0) {
|
|
261
|
-
throw new Error("create-customer-invoice payload.splits must be a non-empty array.");
|
|
262
|
-
}
|
|
263
|
-
return {
|
|
264
|
-
budgetId: requiredString(input.budgetId, "create-customer-invoice payload.budgetId"),
|
|
265
|
-
splits: input.splits.map((rawSplit, index) => {
|
|
266
|
-
const split = requireObject(rawSplit, `create-customer-invoice payload.splits[${index}]`);
|
|
267
|
-
return {
|
|
268
|
-
dueDate: toDate(split.dueDate, `create-customer-invoice payload.splits[${index}].dueDate`),
|
|
269
|
-
label: requiredString(split.label, `create-customer-invoice payload.splits[${index}].label`),
|
|
270
|
-
percentage: Number(split.percentage),
|
|
271
|
-
};
|
|
272
|
-
}),
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
/** Matches project.updateProject — dateRange.from/to may be ISO strings. */
|
|
276
|
-
export function parseUpdateProjectPayload(raw) {
|
|
277
|
-
const o = requireObject(raw, "update-project payload");
|
|
278
|
-
const dr = o.dateRange;
|
|
279
|
-
if (dr === null || typeof dr !== "object" || Array.isArray(dr)) {
|
|
280
|
-
throw new Error("update-project payload.dateRange must be an object.");
|
|
281
|
-
}
|
|
282
|
-
const range = dr;
|
|
283
|
-
const notification = o.requestQboAccountantNotification;
|
|
284
|
-
let requestQboAccountantNotification;
|
|
285
|
-
if (typeof notification === "boolean") {
|
|
286
|
-
requestQboAccountantNotification = notification;
|
|
287
|
-
}
|
|
288
|
-
else if (notification !== undefined && notification !== null) {
|
|
289
|
-
throw new Error("update-project payload.requestQboAccountantNotification must be a boolean when set.");
|
|
290
|
-
}
|
|
291
|
-
const slackChannelId = optionalString(o.slackChannelId);
|
|
292
|
-
const slackChannelUrl = optionalString(o.slackChannelUrl);
|
|
293
|
-
const slackChannelName = optionalString(o.slackChannelName);
|
|
294
|
-
const slackPatch = slackChannelId !== undefined &&
|
|
295
|
-
slackChannelUrl !== undefined &&
|
|
296
|
-
slackChannelName !== undefined
|
|
297
|
-
? {
|
|
298
|
-
slackChannelId,
|
|
299
|
-
slackChannelUrl,
|
|
300
|
-
slackChannelName,
|
|
301
|
-
}
|
|
302
|
-
: {};
|
|
303
|
-
return {
|
|
304
|
-
id: requiredString(o.id, "update-project payload.id"),
|
|
305
|
-
name: requiredString(o.name, "update-project payload.name"),
|
|
306
|
-
description: optionalString(o.description),
|
|
307
|
-
companyId: requiredString(o.companyId, "update-project payload.companyId"),
|
|
308
|
-
contactPersonId: requiredString(o.contactPersonId, "update-project payload.contactPersonId"),
|
|
309
|
-
asanaTaskId: requiredString(o.asanaTaskId, "update-project payload.asanaTaskId"),
|
|
310
|
-
insideSalesId: requiredString(o.insideSalesId, "update-project payload.insideSalesId"),
|
|
311
|
-
businessDevelopmentId: requiredString(o.businessDevelopmentId, "update-project payload.businessDevelopmentId"),
|
|
312
|
-
projectManagerId: optionalString(o.projectManagerId),
|
|
313
|
-
venue: requiredString(o.venue, "update-project payload.venue"),
|
|
314
|
-
pax: optionalString(o.pax),
|
|
315
|
-
dateRange: {
|
|
316
|
-
from: toDate(range.from, "dateRange.from"),
|
|
317
|
-
to: range.to === undefined || range.to === null
|
|
318
|
-
? undefined
|
|
319
|
-
: toDate(range.to, "dateRange.to"),
|
|
320
|
-
},
|
|
321
|
-
...slackPatch,
|
|
322
|
-
...(requestQboAccountantNotification !== undefined && {
|
|
323
|
-
requestQboAccountantNotification,
|
|
324
|
-
}),
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
/** Server validates with Zod; CLI only checks top-level shape is object. */
|
|
328
|
-
export function parseSupplierCreatePayload(raw) {
|
|
329
|
-
requireObject(raw, "create-supplier payload");
|
|
330
|
-
return raw;
|
|
331
|
-
}
|
|
332
|
-
export function parseSupplierUpdatePayload(raw) {
|
|
333
|
-
requireObject(raw, "update-supplier payload");
|
|
334
|
-
return raw;
|
|
335
|
-
}
|
|
336
|
-
export function parseItemCreatePayload(raw) {
|
|
337
|
-
const input = requireObject(raw, "create-item payload");
|
|
338
|
-
return normalizePlainTextRichTextField({
|
|
339
|
-
input,
|
|
340
|
-
textField: "description",
|
|
341
|
-
richTextField: "descriptionRichText",
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
export function parseItemUpdatePayload(raw) {
|
|
345
|
-
const input = requireObject(raw, "update-item payload");
|
|
346
|
-
return normalizePlainTextRichTextField({
|
|
347
|
-
input,
|
|
348
|
-
textField: "description",
|
|
349
|
-
richTextField: "descriptionRichText",
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
export function parseContactCreatePayload(raw) {
|
|
353
|
-
requireObject(raw, "create-contact-person payload");
|
|
354
|
-
return raw;
|
|
355
|
-
}
|
|
356
|
-
export function parseContactUpdatePayload(raw) {
|
|
357
|
-
requireObject(raw, "update-contact-person payload");
|
|
358
|
-
return raw;
|
|
359
|
-
}
|
|
360
|
-
export function parseCompanyUpdatePayload(raw) {
|
|
361
|
-
requireObject(raw, "update-company payload");
|
|
362
|
-
return raw;
|
|
363
|
-
}
|
package/dist/prisma-enums.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime Prisma enum values the CLI needs. Mirrors
|
|
3
|
-
* `packages/budget-builder/db/src/generated/prisma/enums.ts` — keep in sync when the schema changes.
|
|
4
|
-
*/
|
|
5
|
-
export const EstimationMode = {
|
|
6
|
-
MICRO: "MICRO",
|
|
7
|
-
MANPOWER_SPECIFIED: "MANPOWER_SPECIFIED",
|
|
8
|
-
};
|
|
9
|
-
export const ProjectStatus = {
|
|
10
|
-
PITCH: "PITCH",
|
|
11
|
-
WON: "WON",
|
|
12
|
-
COMPLETED: "COMPLETED",
|
|
13
|
-
RECONCILED: "RECONCILED",
|
|
14
|
-
LOST: "LOST",
|
|
15
|
-
};
|
|
16
|
-
export const SupplierQuotationStatus = {
|
|
17
|
-
DRAFT: "DRAFT",
|
|
18
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
19
|
-
APPROVED: "APPROVED",
|
|
20
|
-
REJECTED: "REJECTED",
|
|
21
|
-
SUPERSEDED: "SUPERSEDED",
|
|
22
|
-
};
|
|
23
|
-
export const CustomerInvoiceBatchStatus = {
|
|
24
|
-
CREATING: "CREATING",
|
|
25
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
26
|
-
APPROVED: "APPROVED",
|
|
27
|
-
REJECTED_VOIDED: "REJECTED_VOIDED",
|
|
28
|
-
EXPIRED_VOIDED: "EXPIRED_VOIDED",
|
|
29
|
-
PARTIAL_QBO_FAILURE: "PARTIAL_QBO_FAILURE",
|
|
30
|
-
};
|
|
31
|
-
export const BudgetStatus = {
|
|
32
|
-
DRAFT: "DRAFT",
|
|
33
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
34
|
-
APPROVED: "APPROVED",
|
|
35
|
-
REJECTED: "REJECTED",
|
|
36
|
-
ESTIMATE_CREATED: "ESTIMATE_CREATED",
|
|
37
|
-
ESTIMATE_SENT: "ESTIMATE_SENT",
|
|
38
|
-
ESTIMATE_ACCEPTED: "ESTIMATE_ACCEPTED",
|
|
39
|
-
ESTIMATE_REJECTED: "ESTIMATE_REJECTED",
|
|
40
|
-
ESTIMATE_CLOSED: "ESTIMATE_CLOSED",
|
|
41
|
-
};
|
|
42
|
-
export const ApprovalStatus = {
|
|
43
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
44
|
-
APPROVED: "APPROVED",
|
|
45
|
-
REJECTED: "REJECTED",
|
|
46
|
-
SUPERSEDED: "SUPERSEDED",
|
|
47
|
-
};
|
|
48
|
-
export const ApprovalType = {
|
|
49
|
-
BUDGET: "BUDGET",
|
|
50
|
-
SUPPLIER: "SUPPLIER",
|
|
51
|
-
BILL: "BILL",
|
|
52
|
-
CUSTOMER_INVOICE: "CUSTOMER_INVOICE",
|
|
53
|
-
QUOTATION: "QUOTATION",
|
|
54
|
-
};
|
|
55
|
-
export const UserRole = {
|
|
56
|
-
USER: "USER",
|
|
57
|
-
LEAD: "LEAD",
|
|
58
|
-
ADMIN: "ADMIN",
|
|
59
|
-
INSIDE_SALES: "INSIDE_SALES",
|
|
60
|
-
ACCOUNTING_TEAM: "ACCOUNTING_TEAM",
|
|
61
|
-
};
|
|
62
|
-
export const ErrorSeverity = {
|
|
63
|
-
LOW: "LOW",
|
|
64
|
-
MEDIUM: "MEDIUM",
|
|
65
|
-
HIGH: "HIGH",
|
|
66
|
-
CRITICAL: "CRITICAL",
|
|
67
|
-
};
|
|
68
|
-
export const ErrorStatus = {
|
|
69
|
-
UNRESOLVED: "UNRESOLVED",
|
|
70
|
-
INVESTIGATING: "INVESTIGATING",
|
|
71
|
-
RESOLVED: "RESOLVED",
|
|
72
|
-
IGNORED: "IGNORED",
|
|
73
|
-
};
|
|
74
|
-
export const BillStatus = {
|
|
75
|
-
DRAFT: "DRAFT",
|
|
76
|
-
PENDING_APPROVAL: "PENDING_APPROVAL",
|
|
77
|
-
CHECKED: "CHECKED",
|
|
78
|
-
APPROVED: "APPROVED",
|
|
79
|
-
PAID: "PAID",
|
|
80
|
-
REJECTED: "REJECTED",
|
|
81
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { writeFile } from "node:fs/promises";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { commandRegistry, createCommandManifest, globalCommandOptions, } from "./index.js";
|
|
5
|
-
const packageRoot = process.cwd();
|
|
6
|
-
const manifestPath = resolve(packageRoot, "command-manifest.json");
|
|
7
|
-
const reference = [
|
|
8
|
-
"# Budget Builder CLI command reference",
|
|
9
|
-
"",
|
|
10
|
-
"This file is generated from the typed command registry. Do not edit it manually.",
|
|
11
|
-
"This catalog is not filtered by the authenticated user's role. The Budget Builder API authorizes every request using the current database role plus applicable resource, workflow-state, and pending-approver checks.",
|
|
12
|
-
"Command-specific arguments currently pass through the compatibility dispatcher; use `bb help --legacy` for their detailed transition reference.",
|
|
13
|
-
"",
|
|
14
|
-
"## Global options",
|
|
15
|
-
"",
|
|
16
|
-
...globalCommandOptions.map((option) => `- \`${option.name}\`: ${option.description}`),
|
|
17
|
-
"",
|
|
18
|
-
...commandRegistry.flatMap((command) => [
|
|
19
|
-
`## \`bb ${command.path.join(" ")}\``,
|
|
20
|
-
"",
|
|
21
|
-
command.summary,
|
|
22
|
-
"",
|
|
23
|
-
`Legacy aliases: ${command.legacyAliases.map((alias) => `\`${alias}\``).join(", ")}.`,
|
|
24
|
-
"",
|
|
25
|
-
`Effects: ${command.effects.length > 0 ? command.effects.join(", ") : "none"}.`,
|
|
26
|
-
"",
|
|
27
|
-
]),
|
|
28
|
-
].join("\n");
|
|
29
|
-
await Promise.all([
|
|
30
|
-
writeFile(resolve(packageRoot, "command-reference.md"), reference),
|
|
31
|
-
writeFile(manifestPath, `${JSON.stringify(createCommandManifest(), null, "\t")}\n`),
|
|
32
|
-
]);
|
|
33
|
-
execFileSync(process.execPath, ["x", "biome", "format", "--write", manifestPath], {
|
|
34
|
-
cwd: packageRoot,
|
|
35
|
-
stdio: ["ignore", "ignore", "inherit"],
|
|
36
|
-
});
|