@go-labs-sg/bb 3.25.1 → 3.25.2
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 +868 -975
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3967,40 +3967,11 @@ function tap(observer) {
|
|
|
3967
3967
|
}
|
|
3968
3968
|
__name(tap, "tap"), __name2(tap, "tap");
|
|
3969
3969
|
var distinctUnsetMarker = /* @__PURE__ */ Symbol();
|
|
3970
|
-
function callObserver(callback) {
|
|
3971
|
-
try {
|
|
3972
|
-
callback();
|
|
3973
|
-
} catch (error2) {
|
|
3974
|
-
setTimeout(() => {
|
|
3975
|
-
throw error2;
|
|
3976
|
-
});
|
|
3977
|
-
}
|
|
3978
|
-
}
|
|
3979
|
-
__name(callObserver, "callObserver"), __name2(callObserver, "callObserver");
|
|
3980
|
-
function behaviorSubject(initialValue) {
|
|
3981
|
-
let value = initialValue;
|
|
3982
|
-
const observerList = /* @__PURE__ */ new Set(), addObserver = __name2((observer) => {
|
|
3983
|
-
value !== void 0 && observer.next(value), observerList.add(observer);
|
|
3984
|
-
}, "addObserver"), removeObserver = __name2((observer) => {
|
|
3985
|
-
observerList.delete(observer);
|
|
3986
|
-
}, "removeObserver"), obs = observable((observer) => (addObserver(observer), () => {
|
|
3987
|
-
removeObserver(observer);
|
|
3988
|
-
}));
|
|
3989
|
-
return obs.next = (nextValue) => {
|
|
3990
|
-
if (value !== nextValue) {
|
|
3991
|
-
value = nextValue;
|
|
3992
|
-
for (const observer of [...observerList]) observerList.has(observer) && callObserver(() => observer.next(nextValue));
|
|
3993
|
-
}
|
|
3994
|
-
}, obs.get = () => value, obs;
|
|
3995
|
-
}
|
|
3996
|
-
__name(behaviorSubject, "behaviorSubject"), __name2(behaviorSubject, "behaviorSubject");
|
|
3997
3970
|
function createChain(opts) {
|
|
3998
3971
|
return observable((observer) => {
|
|
3999
3972
|
function execute(index = 0, op = opts.op) {
|
|
4000
3973
|
const next = opts.links[index];
|
|
4001
|
-
if (!next) throw new Error(
|
|
4002
|
-
"No more links to execute - did you forget to add an ending link?"
|
|
4003
|
-
);
|
|
3974
|
+
if (!next) throw new Error("No more links to execute - did you forget to add an ending link?");
|
|
4004
3975
|
return next({ op, next(nextOp) {
|
|
4005
3976
|
return execute(index + 1, nextOp);
|
|
4006
3977
|
} });
|
|
@@ -4024,7 +3995,9 @@ function toPrimitive(t, e) {
|
|
|
4024
3995
|
if (typeof Symbol < "u" && (r = t[Symbol.toPrimitive]) !== void 0) {
|
|
4025
3996
|
var i = r.call(t, e || "default");
|
|
4026
3997
|
if (_typeof(i) != "object") return i;
|
|
4027
|
-
throw new TypeError(
|
|
3998
|
+
throw new TypeError(
|
|
3999
|
+
"@@toPrimitive must return a primitive value."
|
|
4000
|
+
);
|
|
4028
4001
|
}
|
|
4029
4002
|
return (e === "string" ? String : Number)(t);
|
|
4030
4003
|
}
|
|
@@ -4054,9 +4027,11 @@ function _objectSpread2(e) {
|
|
|
4054
4027
|
var t = arguments[r] != null ? arguments[r] : {};
|
|
4055
4028
|
r % 2 ? ownKeys(Object(t), !0).forEach(function(r2) {
|
|
4056
4029
|
_defineProperty(e, r2, t[r2]);
|
|
4057
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(
|
|
4058
|
-
|
|
4059
|
-
|
|
4030
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(
|
|
4031
|
+
function(r2) {
|
|
4032
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4033
|
+
}
|
|
4034
|
+
);
|
|
4060
4035
|
}
|
|
4061
4036
|
return e;
|
|
4062
4037
|
}
|
|
@@ -4086,7 +4061,10 @@ function createInnerProxy(callback, path2, memo2) {
|
|
|
4086
4061
|
} })), memo2[cacheKey];
|
|
4087
4062
|
}
|
|
4088
4063
|
__name(createInnerProxy, "createInnerProxy"), __name2(createInnerProxy, "createInnerProxy");
|
|
4089
|
-
var createRecursiveProxy = __name2(
|
|
4064
|
+
var createRecursiveProxy = __name2(
|
|
4065
|
+
(callback) => createInnerProxy(callback, [], emptyObject()),
|
|
4066
|
+
"createRecursiveProxy"
|
|
4067
|
+
), createFlatProxy = __name2((callback) => new Proxy(noop, { get(_obj, name) {
|
|
4090
4068
|
if (name !== "then") return callback(name);
|
|
4091
4069
|
} }), "createFlatProxy"), formattedShapeSymbol = /* @__PURE__ */ Symbol("trpc_formattedErrorShape");
|
|
4092
4070
|
function _typeof2(o) {
|
|
@@ -4113,7 +4091,10 @@ function toPropertyKey2(t) {
|
|
|
4113
4091
|
var i = toPrimitive2(t, "string");
|
|
4114
4092
|
return _typeof2(i) == "symbol" ? i : i + "";
|
|
4115
4093
|
}
|
|
4116
|
-
__name(toPropertyKey2, "toPropertyKey2"), __name2(
|
|
4094
|
+
__name(toPropertyKey2, "toPropertyKey2"), __name2(
|
|
4095
|
+
toPropertyKey2,
|
|
4096
|
+
"toPropertyKey2"
|
|
4097
|
+
);
|
|
4117
4098
|
function _defineProperty2(e, r, t) {
|
|
4118
4099
|
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;
|
|
4119
4100
|
}
|
|
@@ -4175,7 +4156,10 @@ __name(transformResult, "transformResult"), __name2(transformResult, "transformR
|
|
|
4175
4156
|
function resolvePathSeparator(value) {
|
|
4176
4157
|
return value ?? ".";
|
|
4177
4158
|
}
|
|
4178
|
-
__name(resolvePathSeparator, "resolvePathSeparator"), __name2(
|
|
4159
|
+
__name(resolvePathSeparator, "resolvePathSeparator"), __name2(
|
|
4160
|
+
resolvePathSeparator,
|
|
4161
|
+
"resolvePathSeparator"
|
|
4162
|
+
);
|
|
4179
4163
|
function procedurePathToURLPath(path2, separator) {
|
|
4180
4164
|
return separator === "." ? path2 : path2.split(".").join(separator);
|
|
4181
4165
|
}
|
|
@@ -4183,10 +4167,7 @@ __name(procedurePathToURLPath, "procedurePathToURLPath"), __name2(procedurePathT
|
|
|
4183
4167
|
function _OverloadYield(e, d) {
|
|
4184
4168
|
this.v = e, this.k = d;
|
|
4185
4169
|
}
|
|
4186
|
-
__name(_OverloadYield, "_OverloadYield"), __name2(
|
|
4187
|
-
_OverloadYield,
|
|
4188
|
-
"_OverloadYield"
|
|
4189
|
-
);
|
|
4170
|
+
__name(_OverloadYield, "_OverloadYield"), __name2(_OverloadYield, "_OverloadYield");
|
|
4190
4171
|
function AsyncGenerator(e) {
|
|
4191
4172
|
var t, n;
|
|
4192
4173
|
function resume(t2, n2) {
|
|
@@ -4222,10 +4203,7 @@ __name(AsyncGenerator, "AsyncGenerator"), __name2(AsyncGenerator, "AsyncGenerato
|
|
|
4222
4203
|
}, AsyncGenerator.prototype.next = function(e) {
|
|
4223
4204
|
return this._invoke("next", e);
|
|
4224
4205
|
}, AsyncGenerator.prototype.throw = function(e) {
|
|
4225
|
-
return this._invoke(
|
|
4226
|
-
"throw",
|
|
4227
|
-
e
|
|
4228
|
-
);
|
|
4206
|
+
return this._invoke("throw", e);
|
|
4229
4207
|
}, AsyncGenerator.prototype.return = function(e) {
|
|
4230
4208
|
return this._invoke("return", e);
|
|
4231
4209
|
};
|
|
@@ -4256,15 +4234,15 @@ var TRPCClientError = class TRPCClientError2 extends Error {
|
|
|
4256
4234
|
}
|
|
4257
4235
|
static from(_cause, opts = {}) {
|
|
4258
4236
|
const cause = _cause;
|
|
4259
|
-
return isTRPCClientError(cause) ? (opts.meta && (cause.meta = _objectSpread2(_objectSpread2({}, cause.meta), opts.meta)), cause) : isTRPCErrorResponse(cause) ? new TRPCClientError2(cause.error.message, _objectSpread2(_objectSpread2({}, opts), {}, { result: cause, cause: opts.cause })) : new TRPCClientError2(getMessageFromUnknownError(cause, "Unknown error"), _objectSpread2(_objectSpread2(
|
|
4237
|
+
return isTRPCClientError(cause) ? (opts.meta && (cause.meta = _objectSpread2(_objectSpread2({}, cause.meta), opts.meta)), cause) : isTRPCErrorResponse(cause) ? new TRPCClientError2(cause.error.message, _objectSpread2(_objectSpread2({}, opts), {}, { result: cause, cause: opts.cause })) : new TRPCClientError2(getMessageFromUnknownError(cause, "Unknown error"), _objectSpread2(_objectSpread2(
|
|
4238
|
+
{},
|
|
4239
|
+
opts
|
|
4240
|
+
), {}, { cause }));
|
|
4260
4241
|
}
|
|
4261
4242
|
};
|
|
4262
4243
|
function getTransformer(transformer) {
|
|
4263
4244
|
const _transformer = transformer;
|
|
4264
|
-
return _transformer ? "input" in _transformer ? _transformer : { input: _transformer, output: _transformer } : { input: { serialize: __name2((data) => data, "serialize"), deserialize: __name2(
|
|
4265
|
-
(data) => data,
|
|
4266
|
-
"deserialize"
|
|
4267
|
-
) }, output: { serialize: __name2((data) => data, "serialize"), deserialize: __name2((data) => data, "deserialize") } };
|
|
4245
|
+
return _transformer ? "input" in _transformer ? _transformer : { input: _transformer, output: _transformer } : { input: { serialize: __name2((data) => data, "serialize"), deserialize: __name2((data) => data, "deserialize") }, output: { serialize: __name2((data) => data, "serialize"), deserialize: __name2((data) => data, "deserialize") } };
|
|
4268
4246
|
}
|
|
4269
4247
|
__name(getTransformer, "getTransformer"), __name2(getTransformer, "getTransformer");
|
|
4270
4248
|
var isFunction2 = __name2((fn) => typeof fn == "function", "isFunction2");
|
|
@@ -4281,14 +4259,14 @@ function allAbortSignals(...signals) {
|
|
|
4281
4259
|
const onAbort = __name2(() => {
|
|
4282
4260
|
++abortedCount === count && ac.abort();
|
|
4283
4261
|
}, "onAbort");
|
|
4284
|
-
for (const signal of signals)
|
|
4262
|
+
for (const signal of signals)
|
|
4263
|
+
signal?.aborted ? onAbort() : signal?.addEventListener("abort", onAbort, { once: !0 });
|
|
4285
4264
|
return ac.signal;
|
|
4286
4265
|
}
|
|
4287
4266
|
__name(allAbortSignals, "allAbortSignals"), __name2(allAbortSignals, "allAbortSignals");
|
|
4288
4267
|
function raceAbortSignalsWithCleanup(...signals) {
|
|
4289
4268
|
const ac = new AbortController(), cleanup = __name2(() => {
|
|
4290
|
-
for (const signal of signals)
|
|
4291
|
-
signal?.removeEventListener("abort", onAbort);
|
|
4269
|
+
for (const signal of signals) signal?.removeEventListener("abort", onAbort);
|
|
4292
4270
|
}, "cleanup"), onAbort = __name2(() => {
|
|
4293
4271
|
cleanup(), ac.abort();
|
|
4294
4272
|
}, "onAbort");
|
|
@@ -4460,12 +4438,7 @@ function httpBatchLink(opts) {
|
|
|
4460
4438
|
if (maxURLLength === 1 / 0 && maxItems === 1 / 0) return !0;
|
|
4461
4439
|
if (batchOps.length > maxItems) return !1;
|
|
4462
4440
|
const path2 = batchOps.map((op) => op.path).join(","), inputs = batchOps.map((op) => op.input);
|
|
4463
|
-
return getUrl(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, {
|
|
4464
|
-
type,
|
|
4465
|
-
path: path2,
|
|
4466
|
-
inputs,
|
|
4467
|
-
signal: null
|
|
4468
|
-
})).length <= maxURLLength;
|
|
4441
|
+
return getUrl(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, { type, path: path2, inputs, signal: null })).length <= maxURLLength;
|
|
4469
4442
|
}, async fetch(batchOps) {
|
|
4470
4443
|
const path2 = batchOps.map((op) => op.path).join(","), inputs = batchOps.map((op) => op.input), signal = allAbortSignals(...batchOps.map((op) => op.signal)), res = await jsonHttpRequester(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, { path: path2, inputs, type, headers() {
|
|
4471
4444
|
return opts.headers ? typeof opts.headers == "function" ? opts.headers({ opList: batchOps }) : opts.headers : {};
|
|
@@ -4497,7 +4470,10 @@ function isFormData(value) {
|
|
|
4497
4470
|
return typeof FormData > "u" ? !1 : value instanceof FormData;
|
|
4498
4471
|
}
|
|
4499
4472
|
__name(isFormData, "isFormData"), __name2(isFormData, "isFormData");
|
|
4500
|
-
var palettes = { css: { query: ["72e3ff", "3fb0d8"], mutation: ["c5a3fc", "904dfc"], subscription: ["ff49e1", "d83fbe"] }, ansi: { regular: { query: ["\x1B[30;46m", "\x1B[97;46m"], mutation: [
|
|
4473
|
+
var palettes = { css: { query: ["72e3ff", "3fb0d8"], mutation: ["c5a3fc", "904dfc"], subscription: ["ff49e1", "d83fbe"] }, ansi: { regular: { query: ["\x1B[30;46m", "\x1B[97;46m"], mutation: [
|
|
4474
|
+
"\x1B[30;45m",
|
|
4475
|
+
"\x1B[97;45m"
|
|
4476
|
+
], subscription: ["\x1B[30;42m", "\x1B[97;42m"] }, bold: { query: ["\x1B[1;30;46m", "\x1B[1;97;46m"], mutation: ["\x1B[1;30;45m", "\x1B[1;97;45m"], subscription: ["\x1B[1;30;42m", "\x1B[1;97;42m"] } } };
|
|
4501
4477
|
function constructPartsAndArgs(opts) {
|
|
4502
4478
|
const { direction, type, withContext, path: path2, id, input } = opts, parts = [], args = [];
|
|
4503
4479
|
if (opts.colorMode === "none") parts.push(direction === "up" ? ">>" : "<<", type, "#".concat(id), path2);
|
|
@@ -4508,10 +4484,7 @@ function constructPartsAndArgs(opts) {
|
|
|
4508
4484
|
const [light, dark] = palettes.css[type], css = "\n background-color: #".concat(direction === "up" ? light : dark, ";\n color: ").concat(direction === "up" ? "black" : "white", ";\n padding: 2px;\n ");
|
|
4509
4485
|
parts.push("%c", direction === "up" ? ">>" : "<<", type, "#".concat(id), "%c".concat(path2, "%c"), "%O"), args.push(css, "".concat(css, "; font-weight: bold;"), "".concat(css, "; font-weight: normal;"));
|
|
4510
4486
|
}
|
|
4511
|
-
return direction === "up" ? args.push(withContext ? { input, context: opts.context } : { input }) : args.push(_objectSpread2(
|
|
4512
|
-
{ input, result: opts.result, elapsedMs: opts.elapsedMs },
|
|
4513
|
-
withContext && { context: opts.context }
|
|
4514
|
-
)), { parts, args };
|
|
4487
|
+
return direction === "up" ? args.push(withContext ? { input, context: opts.context } : { input }) : args.push(_objectSpread2({ input, result: opts.result, elapsedMs: opts.elapsedMs }, withContext && { context: opts.context })), { parts, args };
|
|
4515
4488
|
}
|
|
4516
4489
|
__name(constructPartsAndArgs, "constructPartsAndArgs"), __name2(constructPartsAndArgs, "constructPartsAndArgs");
|
|
4517
4490
|
var defaultLogger = __name2(({ c = console, colorMode = "css", withContext }) => (props) => {
|
|
@@ -4536,123 +4509,6 @@ function loggerLink(opts = {}) {
|
|
|
4536
4509
|
});
|
|
4537
4510
|
}
|
|
4538
4511
|
__name(loggerLink, "loggerLink"), __name2(loggerLink, "loggerLink");
|
|
4539
|
-
var resultOf = __name2((value, ...args) => typeof value == "function" ? value(...args) : value, "resultOf");
|
|
4540
|
-
function withResolvers() {
|
|
4541
|
-
let resolve, reject;
|
|
4542
|
-
return { promise: new Promise((res, rej) => {
|
|
4543
|
-
resolve = res, reject = rej;
|
|
4544
|
-
}), resolve, reject };
|
|
4545
|
-
}
|
|
4546
|
-
__name(withResolvers, "withResolvers"), __name2(withResolvers, "withResolvers");
|
|
4547
|
-
async function prepareUrl(urlOptions) {
|
|
4548
|
-
const url = await resultOf(urlOptions.url);
|
|
4549
|
-
return urlOptions.connectionParams ? url + "".concat(url.includes("?") ? "&" : "?", "connectionParams=1") : url;
|
|
4550
|
-
}
|
|
4551
|
-
__name(prepareUrl, "prepareUrl"), __name2(prepareUrl, "prepareUrl");
|
|
4552
|
-
async function buildConnectionMessage(connectionParams, encoder) {
|
|
4553
|
-
const message = { method: "connectionParams", data: await resultOf(connectionParams) };
|
|
4554
|
-
return encoder.encode(message);
|
|
4555
|
-
}
|
|
4556
|
-
__name(buildConnectionMessage, "buildConnectionMessage"), __name2(buildConnectionMessage, "buildConnectionMessage");
|
|
4557
|
-
function asyncWsOpen(ws) {
|
|
4558
|
-
const { promise, resolve, reject } = withResolvers();
|
|
4559
|
-
return ws.addEventListener("open", () => {
|
|
4560
|
-
ws.removeEventListener("error", reject), resolve();
|
|
4561
|
-
}), ws.addEventListener("error", reject), promise;
|
|
4562
|
-
}
|
|
4563
|
-
__name(asyncWsOpen, "asyncWsOpen"), __name2(asyncWsOpen, "asyncWsOpen");
|
|
4564
|
-
var pongCallbacks = /* @__PURE__ */ new WeakMap();
|
|
4565
|
-
function sendPing(ws, onPong) {
|
|
4566
|
-
let callbacks = pongCallbacks.get(ws);
|
|
4567
|
-
if (!callbacks) {
|
|
4568
|
-
const queue = [];
|
|
4569
|
-
callbacks = queue, pongCallbacks.set(ws, queue), ws.addEventListener("message", ({ data }) => {
|
|
4570
|
-
var _queue$shift;
|
|
4571
|
-
data === "PONG" && ((_queue$shift = queue.shift()) === null || _queue$shift === void 0 || _queue$shift());
|
|
4572
|
-
});
|
|
4573
|
-
}
|
|
4574
|
-
callbacks.push(onPong), ws.send("PING");
|
|
4575
|
-
}
|
|
4576
|
-
__name(sendPing, "sendPing"), __name2(sendPing, "sendPing");
|
|
4577
|
-
function setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {
|
|
4578
|
-
let pingTimeout, pongTimeout;
|
|
4579
|
-
function start() {
|
|
4580
|
-
pingTimeout = setTimeout(() => {
|
|
4581
|
-
sendPing(ws, null), pongTimeout = setTimeout(() => {
|
|
4582
|
-
ws.close();
|
|
4583
|
-
}, pongTimeoutMs);
|
|
4584
|
-
}, intervalMs);
|
|
4585
|
-
}
|
|
4586
|
-
__name(start, "start"), __name2(start, "start");
|
|
4587
|
-
function reset() {
|
|
4588
|
-
clearTimeout(pingTimeout), start();
|
|
4589
|
-
}
|
|
4590
|
-
__name(reset, "reset"), __name2(reset, "reset");
|
|
4591
|
-
function pong() {
|
|
4592
|
-
clearTimeout(pongTimeout), reset();
|
|
4593
|
-
}
|
|
4594
|
-
__name(pong, "pong"), __name2(pong, "pong"), ws.addEventListener("open", start), ws.addEventListener("message", ({ data }) => {
|
|
4595
|
-
clearTimeout(pingTimeout), start(), data === "PONG" && pong();
|
|
4596
|
-
}), ws.addEventListener("close", () => {
|
|
4597
|
-
clearTimeout(pingTimeout), clearTimeout(pongTimeout);
|
|
4598
|
-
});
|
|
4599
|
-
}
|
|
4600
|
-
__name(setupPingInterval, "setupPingInterval"), __name2(setupPingInterval, "setupPingInterval");
|
|
4601
|
-
var WsConnection = class WsConnection2 {
|
|
4602
|
-
static {
|
|
4603
|
-
__name(this, "WsConnection2");
|
|
4604
|
-
}
|
|
4605
|
-
static {
|
|
4606
|
-
__name2(this, "WsConnection");
|
|
4607
|
-
}
|
|
4608
|
-
constructor(opts) {
|
|
4609
|
-
var _opts$WebSocketPonyfi;
|
|
4610
|
-
if (_defineProperty(this, "id", ++WsConnection2.connectCount), _defineProperty(this, "WebSocketPonyfill", void 0), _defineProperty(this, "urlOptions", void 0), _defineProperty(this, "keepAliveOpts", void 0), _defineProperty(this, "encoder", void 0), _defineProperty(this, "wsObservable", behaviorSubject(null)), _defineProperty(
|
|
4611
|
-
this,
|
|
4612
|
-
"openPromise",
|
|
4613
|
-
null
|
|
4614
|
-
), this.WebSocketPonyfill = (_opts$WebSocketPonyfi = opts.WebSocketPonyfill) !== null && _opts$WebSocketPonyfi !== void 0 ? _opts$WebSocketPonyfi : WebSocket, !this.WebSocketPonyfill) throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
|
|
4615
|
-
this.urlOptions = opts.urlOptions, this.keepAliveOpts = opts.keepAlive, this.encoder = opts.encoder;
|
|
4616
|
-
}
|
|
4617
|
-
get ws() {
|
|
4618
|
-
return this.wsObservable.get();
|
|
4619
|
-
}
|
|
4620
|
-
set ws(ws) {
|
|
4621
|
-
this.wsObservable.next(ws);
|
|
4622
|
-
}
|
|
4623
|
-
isOpen() {
|
|
4624
|
-
return !!this.ws && this.ws.readyState === this.WebSocketPonyfill.OPEN && !this.openPromise;
|
|
4625
|
-
}
|
|
4626
|
-
isClosed() {
|
|
4627
|
-
return !!this.ws && (this.ws.readyState === this.WebSocketPonyfill.CLOSING || this.ws.readyState === this.WebSocketPonyfill.CLOSED);
|
|
4628
|
-
}
|
|
4629
|
-
async open() {
|
|
4630
|
-
if (this.openPromise) return this.openPromise;
|
|
4631
|
-
this.id = ++WsConnection2.connectCount;
|
|
4632
|
-
const wsPromise = prepareUrl(this.urlOptions).then((url) => new this.WebSocketPonyfill(url));
|
|
4633
|
-
this.openPromise = wsPromise.then(async (ws) => {
|
|
4634
|
-
this.ws = ws, ws.binaryType = "arraybuffer", ws.addEventListener("message", function({ data }) {
|
|
4635
|
-
data === "PING" && this.send("PONG");
|
|
4636
|
-
}), this.keepAliveOpts.enabled && setupPingInterval(ws, this.keepAliveOpts), ws.addEventListener("close", () => {
|
|
4637
|
-
this.ws === ws && (this.ws = null);
|
|
4638
|
-
}), await asyncWsOpen(ws), this.urlOptions.connectionParams && ws.send(await buildConnectionMessage(this.urlOptions.connectionParams, this.encoder));
|
|
4639
|
-
});
|
|
4640
|
-
try {
|
|
4641
|
-
await this.openPromise;
|
|
4642
|
-
} finally {
|
|
4643
|
-
this.openPromise = null;
|
|
4644
|
-
}
|
|
4645
|
-
}
|
|
4646
|
-
async close() {
|
|
4647
|
-
try {
|
|
4648
|
-
await this.openPromise;
|
|
4649
|
-
} finally {
|
|
4650
|
-
var _this$ws;
|
|
4651
|
-
(_this$ws = this.ws) === null || _this$ws === void 0 || _this$ws.close();
|
|
4652
|
-
}
|
|
4653
|
-
}
|
|
4654
|
-
};
|
|
4655
|
-
_defineProperty(WsConnection, "connectCount", 0);
|
|
4656
4512
|
var observerKeys = ["onStarted", "onData", "onError", "onStopped", "onComplete", "onConnectionStateChange"], TRPCUntypedClient = class {
|
|
4657
4513
|
static {
|
|
4658
4514
|
__name(this, "TRPCUntypedClient");
|
|
@@ -4784,10 +4640,10 @@ function getAuthHeader() {
|
|
|
4784
4640
|
return key?.trim() ? "Bearer ".concat(key.trim()) : interactiveAccessToken ? "Bearer ".concat(interactiveAccessToken) : void 0;
|
|
4785
4641
|
}
|
|
4786
4642
|
__name(getAuthHeader, "getAuthHeader"), __name2(getAuthHeader, "getAuthHeader");
|
|
4787
|
-
var containsRawApiKey = __name2(
|
|
4788
|
-
nestedValue,
|
|
4789
|
-
|
|
4790
|
-
)
|
|
4643
|
+
var containsRawApiKey = __name2(
|
|
4644
|
+
(value, seen = /* @__PURE__ */ new WeakSet()) => typeof value != "object" || value === null || seen.has(value) ? !1 : (seen.add(value), Object.entries(value).some(([key, nestedValue]) => key.toLowerCase() === "apikey" && typeof nestedValue == "string" || containsRawApiKey(nestedValue, seen))),
|
|
4645
|
+
"containsRawApiKey"
|
|
4646
|
+
), createBudgetBuilderClient = __name2((apiBaseUrl = BUDGET_BUILDER_API_BASE_URL) => createTRPCClient({ links: [loggerLink({ enabled: __name2((opts) => shouldLogCliActions() && !(opts.direction === "down" && containsRawApiKey(opts.result)), "enabled"), colorMode: "ansi", withContext: !1, console: { log: __name2((...args) => console.error(...args.map((arg) => sanitizeValueForTrace(arg))), "log"), error: __name2((...args) => console.error(...args.map((arg) => sanitizeValueForTrace(arg))), "error") } }), httpBatchLink({ url: "".concat(apiBaseUrl, "/api/trpc"), transformer: SuperJSON, headers: __name2(() => {
|
|
4791
4647
|
const headers = { "x-trpc-source": "bb-cli" }, auth = getAuthHeader();
|
|
4792
4648
|
return auth && (headers.Authorization = auth), headers;
|
|
4793
4649
|
}, "headers") })] }), "createBudgetBuilderClient"), activeClient = createBudgetBuilderClient(), configureBudgetBuilderApiBaseUrl = __name2((value) => {
|
|
@@ -4839,8 +4695,7 @@ var isRecord = __name2((value) => typeof value == "object" && value !== null &&
|
|
|
4839
4695
|
return Object.keys(details).length > 0 ? details : void 0;
|
|
4840
4696
|
}, "asDetails"), isJsonValue = __name2((value) => value === null || typeof value == "string" || typeof value == "boolean" || typeof value == "number" ? !0 : Array.isArray(value) ? value.every(isJsonValue) : isRecord(value) && Object.values(value).every(isJsonValue), "isJsonValue"), mapErrorCode = __name2((value) => {
|
|
4841
4697
|
if (typeof value == "string") {
|
|
4842
|
-
if (cliErrorCodes.has(value))
|
|
4843
|
-
return value;
|
|
4698
|
+
if (cliErrorCodes.has(value)) return value;
|
|
4844
4699
|
if (value in trpcCodeMap) return trpcCodeMap[value];
|
|
4845
4700
|
}
|
|
4846
4701
|
}, "mapErrorCode"), networkMessagePattern = new __cliRegExp("\\b(fetch failed|network error|unable to connect|econnrefused|econnreset|enotfound|etimedout|socket hang up)\\b", "i"), isNetworkError = __name2((error2, depth = 0) => {
|
|
@@ -4849,35 +4704,23 @@ var isRecord = __name2((value) => typeof value == "object" && value !== null &&
|
|
|
4849
4704
|
if (message !== void 0 && networkMessagePattern.test(message)) return !0;
|
|
4850
4705
|
const code = asNonEmptyString(error2.code);
|
|
4851
4706
|
return code !== void 0 && networkMessagePattern.test(code) ? !0 : isNetworkError(error2.cause, depth + 1);
|
|
4852
|
-
}, "isNetworkError"), normalizeRuntimeError = __name2((error2) => ({ code: error2.code, message: error2.message, ...error2.details === void 0 ? {} : { details: error2.details }, ...error2.requestId === void 0 ? {} : { requestId: error2.requestId } }), "normalizeRuntimeError"), normalizeNetworkError = __name2((error2) => ({ code: "NETWORK", message: error2 instanceof Error ? error2.message : "The Budget Builder API could not be reached." }), "normalizeNetworkError"), normalizeRecordError = __name2(
|
|
4853
|
-
(error2)
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
},
|
|
4859
|
-
"normalizeRecordError"
|
|
4860
|
-
), normalizeCliError = __name2((error2) => getCliStorageError(error2) || (error2 instanceof CliRuntimeError ? normalizeRuntimeError(error2) : isNetworkError(error2) ? normalizeNetworkError(error2) : isRecord(error2) ? normalizeRecordError(error2) : error2 instanceof Error ? { code: "INTERNAL", message: error2.message } : { code: "INTERNAL", message: "An unexpected CLI error occurred." }), "normalizeCliError"), exitCodeForCliError = __name2((error2) => error2.code === "INTERRUPTED" ? 130 : invocationErrorCodes.has(error2.code) ? 2 : 1, "exitCodeForCliError"), isP2028Error = __name2((value, depth = 0) => {
|
|
4707
|
+
}, "isNetworkError"), normalizeRuntimeError = __name2((error2) => ({ code: error2.code, message: error2.message, ...error2.details === void 0 ? {} : { details: error2.details }, ...error2.requestId === void 0 ? {} : { requestId: error2.requestId } }), "normalizeRuntimeError"), normalizeNetworkError = __name2((error2) => ({ code: "NETWORK", message: error2 instanceof Error ? error2.message : "The Budget Builder API could not be reached." }), "normalizeNetworkError"), normalizeRecordError = __name2((error2) => {
|
|
4708
|
+
const data = isRecord(error2.data) ? error2.data : void 0, transportCode = mapErrorCode(data?.code ?? error2.code);
|
|
4709
|
+
if (error2 instanceof Error && data === void 0 && transportCode === void 0) return { code: "INTERNAL", message: error2.message };
|
|
4710
|
+
const code = transportCode ?? "API", rawMessage = asNonEmptyString(error2.message) ?? "The Budget Builder API request failed.", message = code === "VALIDATION" ? formatValidationMessage(rawMessage, data) : rawMessage, requestId = asNonEmptyString(data?.requestId) ?? asNonEmptyString(data?.requestID) ?? asNonEmptyString(error2.requestId), details = asDetails(data?.details ?? error2.details);
|
|
4711
|
+
return { code, message, ...details === void 0 ? {} : { details }, ...requestId === void 0 ? {} : { requestId } };
|
|
4712
|
+
}, "normalizeRecordError"), normalizeCliError = __name2((error2) => getCliStorageError(error2) || (error2 instanceof CliRuntimeError ? normalizeRuntimeError(error2) : isNetworkError(error2) ? normalizeNetworkError(error2) : isRecord(error2) ? normalizeRecordError(error2) : error2 instanceof Error ? { code: "INTERNAL", message: error2.message } : { code: "INTERNAL", message: "An unexpected CLI error occurred." }), "normalizeCliError"), exitCodeForCliError = __name2((error2) => error2.code === "INTERRUPTED" ? 130 : invocationErrorCodes.has(error2.code) ? 2 : 1, "exitCodeForCliError"), isP2028Error = __name2((value, depth = 0) => {
|
|
4861
4713
|
if (depth > 3 || typeof value != "object" || value === null) return !1;
|
|
4862
4714
|
const error2 = value;
|
|
4863
4715
|
return error2.code === "P2028" || typeof error2.message == "string" && new __cliRegExp("\\bP2028\\b", "").test(error2.message) || isP2028Error(error2.cause, depth + 1) || isP2028Error(error2.data, depth + 1) || isP2028Error(error2.error, depth + 1);
|
|
4864
4716
|
}, "isP2028Error"), budgetCreateUncertainError = __name2((error2, input) => {
|
|
4865
|
-
const message = error2 instanceof Error ? error2.message : String(error2), normalized = normalizeCliError(
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
...Object.values(CustomerInvoiceBatchStatus),
|
|
4873
|
-
"PARTIALLY_SENT",
|
|
4874
|
-
CustomerInvoiceStatus.SENT,
|
|
4875
|
-
"PARTIALLY_PAID",
|
|
4876
|
-
CustomerInvoiceStatus.PAID,
|
|
4877
|
-
CustomerInvoiceStatus.VOIDED
|
|
4878
|
-
], BUDGET_STATUS_VALUES = new Set(Object.values(BudgetStatus2)), BILL_STATUS_VALUES = new Set(Object.values(BillStatus2)), PROJECT_STATUS_VALUES = new Set(Object.values(ProjectStatus2)), SUPPLIER_QUOTATION_STATUS_VALUES = new Set(Object.values(SupplierQuotationStatus)), CUSTOMER_INVOICE_LIFECYCLE_STATUS_VALUES = new Set(customerInvoiceLifecycleStatuses), USER_ROLE_VALUES = new Set(Object.values(UserRole)), EXTENDED_PROJECT_STATUS_VALUES = new Set(Object.values(ExtendedProjectStatus)), DASHBOARD_ROLE_VALUES = /* @__PURE__ */ new Set(["BD", "CREATOR", "INSIDE_SALES", "ALL"]), DEALS_VALUES = new Set(Object.values(Deals)), TIME_FRAME_VALUES = new Set(Object.values(TimeFrame)), BUDGET_ROLE_VALUES = new Set(Object.values(BudgetRole)), SUPPLIER_ANALYTICS_TF = /* @__PURE__ */ new Set(["ALL", "LAST_YEAR", "LAST_6_MONTHS", "LAST_3_MONTHS", "CUSTOM"]), SUPPLIER_APPROVAL_STATUS_VALUES = new Set(Object.values(ExtendedApprovalStatus)), EXT_ERROR_SEVERITY_VALUES = new Set(
|
|
4879
|
-
Object.values(ExtendedErrorSeverity)
|
|
4880
|
-
), EXT_ERROR_STATUS_VALUES = new Set(Object.values(ExtendedErrorStatus)), INTEGRATION_OPERATION_STATUS_VALUES = /* @__PURE__ */ new Set(["PENDING", "PROCESSING", "FAILED", "COMPLETED"]);
|
|
4717
|
+
const message = error2 instanceof Error ? error2.message : String(error2), normalized = normalizeCliError(
|
|
4718
|
+
error2
|
|
4719
|
+
);
|
|
4720
|
+
if (!(!isP2028Error(error2) && normalized.code !== "NETWORK")) return new CliRuntimeError(normalized.code === "NETWORK" ? "NETWORK" : "API", "Budget creation outcome is uncertain (the write may have committed). Run list-budgets --projectId ".concat(input.projectId, " and check for ").concat(JSON.stringify(input.name), " before retrying; matching names alone may be ambiguous. Original error: ").concat(message));
|
|
4721
|
+
}, "budgetCreateUncertainError"), invoiceSplitSetupNextAction = __name2((budgetId) => ({ prompt: "Review the uninvoiced balance, choose all or part of the remaining percentage, then supply invoice and due dates, billing address, and customer message. Non-admin creation requests admin approval; admin creation auto-approves. Sending remains separate.", reviewCommand: "bb customer-invoice readiness check ".concat(budgetId), amountPreviewCommand: "bb customer-invoice amount preview ".concat(budgetId, " <percentage-of-estimate>"), createCommand: "bb customer-invoice create --payload '<budgetId-requestId-invoiceDate-details-and-splits-json>'" }), "invoiceSplitSetupNextAction"), CUSTOMER_INVOICE_APPROVAL_WINDOW_MS = 4320 * 60 * 1e3, CUSTOMER_INVOICE_APPROVAL_REMINDER_LEAD_MS = 14400 * 1e3, customerInvoiceLifecycleStatuses = ["EXPIRED", ...Object.values(CustomerInvoiceBatchStatus), "PARTIALLY_SENT", CustomerInvoiceStatus.SENT, "PARTIALLY_PAID", CustomerInvoiceStatus.PAID, CustomerInvoiceStatus.
|
|
4722
|
+
VOIDED], BUDGET_STATUS_VALUES = new Set(Object.values(BudgetStatus2)), BILL_STATUS_VALUES = new Set(Object.values(BillStatus2)), PROJECT_STATUS_VALUES = new Set(Object.values(ProjectStatus2)), SUPPLIER_QUOTATION_STATUS_VALUES = new Set(Object.values(SupplierQuotationStatus)), CUSTOMER_INVOICE_LIFECYCLE_STATUS_VALUES = new Set(customerInvoiceLifecycleStatuses), USER_ROLE_VALUES = new Set(Object.values(UserRole)), EXTENDED_PROJECT_STATUS_VALUES = new Set(Object.values(ExtendedProjectStatus)), DASHBOARD_ROLE_VALUES = /* @__PURE__ */ new Set(["BD", "CREATOR", "INSIDE_SALES", "ALL"]), DEALS_VALUES = new Set(Object.values(Deals)), TIME_FRAME_VALUES = new Set(Object.values(TimeFrame)), BUDGET_ROLE_VALUES = new Set(Object.values(BudgetRole)), SUPPLIER_ANALYTICS_TF = /* @__PURE__ */ new Set(["ALL", "LAST_YEAR", "LAST_6_MONTHS", "LAST_3_MONTHS", "CUSTOM"]), SUPPLIER_APPROVAL_STATUS_VALUES = new Set(Object.values(ExtendedApprovalStatus)), EXT_ERROR_SEVERITY_VALUES = new Set(Object.values(ExtendedErrorSeverity)),
|
|
4723
|
+
EXT_ERROR_STATUS_VALUES = new Set(Object.values(ExtendedErrorStatus)), INTEGRATION_OPERATION_STATUS_VALUES = /* @__PURE__ */ new Set(["PENDING", "PROCESSING", "FAILED", "COMPLETED"]);
|
|
4881
4724
|
function isBudgetStatusListToken(s) {
|
|
4882
4725
|
return s === "ALL" ? !0 : BUDGET_STATUS_VALUES.has(s);
|
|
4883
4726
|
}
|
|
@@ -4891,7 +4734,10 @@ function isBudgetStatusUpdate(s) {
|
|
|
4891
4734
|
}
|
|
4892
4735
|
__name(isBudgetStatusUpdate, "isBudgetStatusUpdate"), __name2(isBudgetStatusUpdate, "isBudgetStatusUpdate");
|
|
4893
4736
|
function parseBillStatusForUpdate(raw) {
|
|
4894
|
-
if (!BILL_STATUS_VALUES.has(raw)) throw new Error('Invalid bill status "'.concat(raw, '". Use one of: ').concat(
|
|
4737
|
+
if (!BILL_STATUS_VALUES.has(raw)) throw new Error('Invalid bill status "'.concat(raw, '". Use one of: ').concat(
|
|
4738
|
+
[...BILL_STATUS_VALUES].join(", "),
|
|
4739
|
+
"."
|
|
4740
|
+
));
|
|
4895
4741
|
if (raw === BillStatus2.PENDING_APPROVAL) throw new Error("Cannot set PENDING_APPROVAL via update-bill-status. Use create-bill-approval <billId> instead.");
|
|
4896
4742
|
return raw;
|
|
4897
4743
|
}
|
|
@@ -4910,7 +4756,8 @@ function parseUserRole(raw) {
|
|
|
4910
4756
|
__name(parseUserRole, "parseUserRole"), __name2(parseUserRole, "parseUserRole");
|
|
4911
4757
|
function parseOptionalExtendedProjectStatus(raw) {
|
|
4912
4758
|
if (!(raw === void 0 || raw === "")) {
|
|
4913
|
-
if (!EXTENDED_PROJECT_STATUS_VALUES.has(raw))
|
|
4759
|
+
if (!EXTENDED_PROJECT_STATUS_VALUES.has(raw))
|
|
4760
|
+
throw new Error('Invalid project list status "'.concat(raw, '". Use one of: ').concat([...EXTENDED_PROJECT_STATUS_VALUES].join(", "), "."));
|
|
4914
4761
|
return raw;
|
|
4915
4762
|
}
|
|
4916
4763
|
}
|
|
@@ -4931,10 +4778,7 @@ function parseOptionalIsoDateFlag(raw, flagName, { endOfDay = !1 } = {}) {
|
|
|
4931
4778
|
if (Number.isNaN(parsed.getTime())) throw new Error("".concat(flagName, " must be an ISO date (YYYY-MM-DD) or ISO datetime."));
|
|
4932
4779
|
return parsed;
|
|
4933
4780
|
}
|
|
4934
|
-
__name(parseOptionalIsoDateFlag, "parseOptionalIsoDateFlag"), __name2(
|
|
4935
|
-
parseOptionalIsoDateFlag,
|
|
4936
|
-
"parseOptionalIsoDateFlag"
|
|
4937
|
-
);
|
|
4781
|
+
__name(parseOptionalIsoDateFlag, "parseOptionalIsoDateFlag"), __name2(parseOptionalIsoDateFlag, "parseOptionalIsoDateFlag");
|
|
4938
4782
|
function parseOptionalProjectHubSortBy(raw) {
|
|
4939
4783
|
if (!(raw === void 0 || raw === "")) {
|
|
4940
4784
|
if (!PROJECT_HUB_SORT_FIELDS.has(raw)) throw new Error('Invalid --sortBy "'.concat(raw, '". Use one of: ').concat([...PROJECT_HUB_SORT_FIELDS].join(", "), "."));
|
|
@@ -4999,7 +4843,9 @@ function parseCommaSeparatedIds(raw) {
|
|
|
4999
4843
|
__name(parseCommaSeparatedIds, "parseCommaSeparatedIds"), __name2(parseCommaSeparatedIds, "parseCommaSeparatedIds");
|
|
5000
4844
|
function parseCommaSeparatedIntegrationOperationStatuses(raw) {
|
|
5001
4845
|
if (raw === void 0) return;
|
|
5002
|
-
const statuses = raw.split(
|
|
4846
|
+
const statuses = raw.split(
|
|
4847
|
+
","
|
|
4848
|
+
).map((value) => value.trim().toUpperCase()).filter(Boolean);
|
|
5003
4849
|
if (statuses.length !== 0) {
|
|
5004
4850
|
for (const status of statuses) if (!INTEGRATION_OPERATION_STATUS_VALUES.has(status)) throw new Error('Invalid integration operation status "'.concat(status, '". Use one or more of: ').concat([...INTEGRATION_OPERATION_STATUS_VALUES].join(", "), "."));
|
|
5005
4851
|
return statuses;
|
|
@@ -5020,7 +4866,9 @@ function parseCommaSeparatedBudgetStatuses(raw) {
|
|
|
5020
4866
|
__name(parseCommaSeparatedBudgetStatuses, "parseCommaSeparatedBudgetStatuses"), __name2(parseCommaSeparatedBudgetStatuses, "parseCommaSeparatedBudgetStatuses");
|
|
5021
4867
|
function parseCommaSeparatedSupplierStatuses(raw) {
|
|
5022
4868
|
if (raw === void 0) return;
|
|
5023
|
-
const parts = raw.split(
|
|
4869
|
+
const parts = raw.split(
|
|
4870
|
+
","
|
|
4871
|
+
).map((x) => x.trim()).filter(Boolean);
|
|
5024
4872
|
if (parts.length === 0) return;
|
|
5025
4873
|
const out2 = [];
|
|
5026
4874
|
for (const p of parts) {
|
|
@@ -5089,16 +4937,23 @@ function parseApprovalTypeFlag(raw) {
|
|
|
5089
4937
|
if (raw === void 0) return;
|
|
5090
4938
|
const u = raw.trim().toUpperCase();
|
|
5091
4939
|
if (u === "ALL") return "ALL";
|
|
5092
|
-
if (!isPendingRequestType(u)) throw new Error(
|
|
4940
|
+
if (!isPendingRequestType(u)) throw new Error(
|
|
4941
|
+
'Invalid --type "'.concat(raw, '". Use budget, supplier, bill, quotation, customer_invoice, or all.')
|
|
4942
|
+
);
|
|
5093
4943
|
return u;
|
|
5094
4944
|
}
|
|
5095
4945
|
__name(parseApprovalTypeFlag, "parseApprovalTypeFlag"), __name2(parseApprovalTypeFlag, "parseApprovalTypeFlag");
|
|
5096
|
-
var budgetStatusesForHelp = Object.values(BudgetStatus2), billStatusesForHelp = Object.values(BillStatus2), billStatusesForUpdateHelp = Object.values(BillStatus2).filter((s) => s !== BillStatus2.PENDING_APPROVAL), projectStatusesForHelp = Object.values(ProjectStatus2), userRolesForHelp = Object.values(UserRole), QUICKBOOKS_NAME_VALIDATION_MESSAGE = "Name cannot contain colons, tabs or line breaks (QuickBooks rule)", quickBooksNameSchema = string2().trim().min(1, { error: "Name is required" }).max(100, { error: "Name cannot be longer than 100 characters" }).regex(new __cliRegExp("^[^:\\t\\n]+$", ""), { error: QUICKBOOKS_NAME_VALIDATION_MESSAGE }), escapeHtml = __name2((text) => text.replace(new __cliRegExp("&", "g"), "&").replace(new __cliRegExp("<", "g"), "<").replace(new __cliRegExp(">", "g"), ">").replace(new __cliRegExp('"', "g"), """).replace(new __cliRegExp(
|
|
4946
|
+
var budgetStatusesForHelp = Object.values(BudgetStatus2), billStatusesForHelp = Object.values(BillStatus2), billStatusesForUpdateHelp = Object.values(BillStatus2).filter((s) => s !== BillStatus2.PENDING_APPROVAL), projectStatusesForHelp = Object.values(ProjectStatus2), userRolesForHelp = Object.values(UserRole), QUICKBOOKS_NAME_VALIDATION_MESSAGE = "Name cannot contain colons, tabs or line breaks (QuickBooks rule)", quickBooksNameSchema = string2().trim().min(1, { error: "Name is required" }).max(100, { error: "Name cannot be longer than 100 characters" }).regex(new __cliRegExp("^[^:\\t\\n]+$", ""), { error: QUICKBOOKS_NAME_VALIDATION_MESSAGE }), escapeHtml = __name2((text) => text.replace(new __cliRegExp("&", "g"), "&").replace(new __cliRegExp("<", "g"), "<").replace(new __cliRegExp(">", "g"), ">").replace(new __cliRegExp('"', "g"), """).replace(new __cliRegExp(
|
|
4947
|
+
"'",
|
|
4948
|
+
"g"
|
|
4949
|
+
), "'"), "escapeHtml"), createRichTextFromPlainText = __name2((text) => {
|
|
5097
4950
|
const lines = text?.split(new __cliRegExp("\\r?\\n", "")) ?? [], paragraphs = lines.length ? lines : [""];
|
|
5098
4951
|
return { json: { type: "doc", content: paragraphs.map((line) => ({ type: "paragraph", ...line ? { content: [{ type: "text", text: line }] } : {} })) }, html: paragraphs.map((line) => "<p>".concat(escapeHtml(line), "</p>")).join("") };
|
|
5099
4952
|
}, "createRichTextFromPlainText"), isRichTextJson = __name2((value) => !!(value && typeof value == "object" && "json" in value && "html" in value && typeof value.html == "string"), "isRichTextJson"), normalizePlainTextRichTextField = __name2(({ input, textField, richTextField }) => isRichTextJson(input[richTextField]) || input[textField] === void 0 ? input : { ...input, [richTextField]: createRichTextFromPlainText(String(input[textField] ?? "")) }, "normalizePlainTextRichTextField"), validationError = __name2((message) => new CliRuntimeError("VALIDATION", message), "validationError");
|
|
5100
4953
|
function requireObject(raw, label) {
|
|
5101
|
-
if (raw === null || typeof raw != "object" || Array.isArray(raw)) throw validationError(
|
|
4954
|
+
if (raw === null || typeof raw != "object" || Array.isArray(raw)) throw validationError(
|
|
4955
|
+
"".concat(label, " must be a JSON object.")
|
|
4956
|
+
);
|
|
5102
4957
|
return raw;
|
|
5103
4958
|
}
|
|
5104
4959
|
__name(requireObject, "requireObject"), __name2(requireObject, "requireObject");
|
|
@@ -5108,10 +4963,7 @@ function toDate(value, field) {
|
|
|
5108
4963
|
const d = new Date(value);
|
|
5109
4964
|
if (!Number.isNaN(d.getTime())) return d;
|
|
5110
4965
|
}
|
|
5111
|
-
throw validationError("".concat(
|
|
5112
|
-
field,
|
|
5113
|
-
" must be an ISO date/datetime string."
|
|
5114
|
-
));
|
|
4966
|
+
throw validationError("".concat(field, " must be an ISO date/datetime string."));
|
|
5115
4967
|
}
|
|
5116
4968
|
__name(toDate, "toDate"), __name2(toDate, "toDate");
|
|
5117
4969
|
function optionalString(v) {
|
|
@@ -5129,10 +4981,7 @@ var requireDollarAmount = __name2((source, label) => {
|
|
|
5129
4981
|
if (rawAllocations == null) return;
|
|
5130
4982
|
if (!Array.isArray(rawAllocations) || rawAllocations.length === 0) throw validationError("".concat(commandName, " payload.quotationAllocations must be a non-empty array."));
|
|
5131
4983
|
const quotationAllocations = rawAllocations.map((raw, index) => {
|
|
5132
|
-
const label = "".concat(commandName, " payload.quotationAllocations[").concat(index, "]"), allocation = requireObject(raw, label), amount = requireDollarAmount(
|
|
5133
|
-
allocation,
|
|
5134
|
-
label
|
|
5135
|
-
);
|
|
4984
|
+
const label = "".concat(commandName, " payload.quotationAllocations[").concat(index, "]"), allocation = requireObject(raw, label), amount = requireDollarAmount(allocation, label);
|
|
5136
4985
|
return { budgetItemId: requiredString(allocation.budgetItemId, "".concat(label, ".budgetItemId")), quotationId: requiredString(allocation.quotationId, "".concat(label, ".quotationId")), amount };
|
|
5137
4986
|
}), keys = quotationAllocations.map((allocation) => "".concat(allocation.budgetItemId, "\0").concat(allocation.quotationId));
|
|
5138
4987
|
if (new Set(keys).size !== keys.length) throw validationError("".concat(commandName, " payload.quotationAllocations must not repeat a budget-item/quotation pair."));
|
|
@@ -5140,7 +4989,9 @@ var requireDollarAmount = __name2((source, label) => {
|
|
|
5140
4989
|
}, "parseQuotationAllocations"), parseQuotationIdList = __name2((input, commandName) => {
|
|
5141
4990
|
const rawQuotationIds = input.quotationIds;
|
|
5142
4991
|
if (rawQuotationIds == null) return;
|
|
5143
|
-
if (!Array.isArray(
|
|
4992
|
+
if (!Array.isArray(
|
|
4993
|
+
rawQuotationIds
|
|
4994
|
+
)) throw validationError("".concat(commandName, " payload.quotationIds must be a string array."));
|
|
5144
4995
|
const quotationIds = rawQuotationIds.map((id, index) => requiredString(id, "".concat(commandName, " payload.quotationIds[").concat(index, "]")));
|
|
5145
4996
|
if (new Set(quotationIds).size !== quotationIds.length) throw validationError("".concat(commandName, " payload.quotationIds must not contain duplicates."));
|
|
5146
4997
|
return quotationIds;
|
|
@@ -5162,9 +5013,7 @@ var requireDollarAmount = __name2((source, label) => {
|
|
|
5162
5013
|
if (new Set(lineAmounts.map((line) => line.budgetItemId)).size !== lineAmounts.length) throw validationError("".concat(commandName, " payload.lineAmounts must contain each budget item once."));
|
|
5163
5014
|
return lineAmounts;
|
|
5164
5015
|
}, "parseBillLineAmounts"), cents = __name2((amount) => Math.round(amount * 100), "cents"), assertLineAmountsMatchSelection = __name2(({ amount, budgetItemIds, commandName, lineAmounts }) => {
|
|
5165
|
-
const selected = new Set(
|
|
5166
|
-
budgetItemIds
|
|
5167
|
-
);
|
|
5016
|
+
const selected = new Set(budgetItemIds);
|
|
5168
5017
|
if (lineAmounts.length !== selected.size || lineAmounts.some((line) => !selected.has(line.budgetItemId))) throw validationError("".concat(commandName, " payload.lineAmounts must contain each selected budget item exactly once."));
|
|
5169
5018
|
if (lineAmounts.reduce((sum, line) => sum + cents(line.amount), 0) !== cents(amount)) throw validationError("".concat(commandName, " payload.lineAmounts must sum to payload.amount."));
|
|
5170
5019
|
}, "assertLineAmountsMatchSelection"), assertQuotationAllocationsFitLines = __name2(({ budgetItemIds, commandName, lineAmounts, quotationAllocations }) => {
|
|
@@ -5192,11 +5041,15 @@ var EMAIL_ADDRESS_PATTERN = new __cliRegExp("^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$", ""
|
|
|
5192
5041
|
if (!EMAIL_ADDRESS_PATTERN.test(email2)) throw validationError("".concat(fieldLabel, " must be a valid email address."));
|
|
5193
5042
|
return email2;
|
|
5194
5043
|
}, "requiredEmail"), parseContactPersonEmailPayload = __name2((input, commandName) => {
|
|
5195
|
-
if (!Array.isArray(input.cc))
|
|
5044
|
+
if (!Array.isArray(input.cc))
|
|
5045
|
+
throw validationError("".concat(commandName, " payload.cc must be an email array."));
|
|
5196
5046
|
return { to: requiredEmail(input.to, "".concat(commandName, " payload.to")), cc: input.cc.map((email2, index) => requiredEmail(email2, "".concat(commandName, " payload.cc[").concat(index, "]"))), replyTo: requiredEmail(input.replyTo, "".concat(commandName, " payload.replyTo")), subject: requiredString(input.subject, "".concat(commandName, " payload.subject")), content: requiredString(input.content, "".concat(commandName, " payload.content")), signature: requiredString(input.signature, "".concat(commandName, " payload.signature")) };
|
|
5197
5047
|
}, "parseContactPersonEmailPayload"), parseSendEstimateToContactPersonPayload = __name2((raw) => {
|
|
5198
5048
|
const input = requireObject(raw, "send-estimate-to-contact-person payload");
|
|
5199
|
-
return { ...parseContactPersonEmailPayload(input, "send-estimate-to-contact-person"), estimateId: requiredString(input.estimateId, "send-estimate-to-contact-person payload.estimateId"), estimateDocNumber: optionalString(input.estimateDocNumber), budgetId: requiredString(
|
|
5049
|
+
return { ...parseContactPersonEmailPayload(input, "send-estimate-to-contact-person"), estimateId: requiredString(input.estimateId, "send-estimate-to-contact-person payload.estimateId"), estimateDocNumber: optionalString(input.estimateDocNumber), budgetId: requiredString(
|
|
5050
|
+
input.budgetId,
|
|
5051
|
+
"send-estimate-to-contact-person payload.budgetId"
|
|
5052
|
+
) };
|
|
5200
5053
|
}, "parseSendEstimateToContactPersonPayload"), parseSendCustomerInvoiceToContactPersonPayload = __name2((raw) => {
|
|
5201
5054
|
const input = requireObject(raw, "send-customer-invoice-to-contact-person payload"), { cc, ...email2 } = parseContactPersonEmailPayload({ ...input, cc: input.cc === void 0 ? [] : input.cc }, "send-customer-invoice-to-contact-person");
|
|
5202
5055
|
return { ...email2, ...input.cc === void 0 ? {} : { cc }, invoiceId: requiredString(input.invoiceId, "send-customer-invoice-to-contact-person payload.invoiceId") };
|
|
@@ -5214,7 +5067,10 @@ function parseUpdateBudgetPayload(raw) {
|
|
|
5214
5067
|
__name(parseUpdateBudgetPayload, "parseUpdateBudgetPayload"), __name2(parseUpdateBudgetPayload, "parseUpdateBudgetPayload");
|
|
5215
5068
|
function parseUpdateBudgetCommissionPayload(raw) {
|
|
5216
5069
|
const o = requireObject(raw, "update-budget-commission payload");
|
|
5217
|
-
return { budgetId: requiredString(o.budgetId, "update-budget-commission payload.budgetId"), name: requiredString(o.name, "update-budget-commission payload.name"), percentage: requiredString(
|
|
5070
|
+
return { budgetId: requiredString(o.budgetId, "update-budget-commission payload.budgetId"), name: requiredString(o.name, "update-budget-commission payload.name"), percentage: requiredString(
|
|
5071
|
+
o.percentage,
|
|
5072
|
+
"update-budget-commission payload.percentage"
|
|
5073
|
+
), totalSellingAfterDiscount: Number(o.totalSellingAfterDiscount) };
|
|
5218
5074
|
}
|
|
5219
5075
|
__name(parseUpdateBudgetCommissionPayload, "parseUpdateBudgetCommissionPayload"), __name2(parseUpdateBudgetCommissionPayload, "parseUpdateBudgetCommissionPayload");
|
|
5220
5076
|
function parseBudgetDiscountPayload(raw) {
|
|
@@ -5233,17 +5089,18 @@ var billAttachment = __name2((x, i, field = "attachments") => {
|
|
|
5233
5089
|
return draftOnlyFlag ?? draftOnlyRaw;
|
|
5234
5090
|
}, "parseCreateBillDraftOnly"), parseCreateBillAlreadyPaid = __name2((o, draftOnly) => {
|
|
5235
5091
|
const alreadyPaidRaw = o.alreadyPaid;
|
|
5236
|
-
if (draftOnly && alreadyPaidRaw === !0) throw validationError(
|
|
5092
|
+
if (draftOnly && alreadyPaidRaw === !0) throw validationError(
|
|
5093
|
+
"Draft-only creation cannot be combined with alreadyPaid: true."
|
|
5094
|
+
);
|
|
5237
5095
|
if (alreadyPaidRaw != null && typeof alreadyPaidRaw != "boolean") throw validationError("create-bill payload.alreadyPaid must be boolean.");
|
|
5238
5096
|
return alreadyPaidRaw;
|
|
5239
5097
|
}, "parseCreateBillAlreadyPaid"), parseCreateBillVerificationResults = __name2((vr) => {
|
|
5240
5098
|
if (vr == null) return;
|
|
5241
|
-
const v = requireObject(
|
|
5242
|
-
vr,
|
|
5243
|
-
"verificationResults"
|
|
5244
|
-
), verificationResultStatus = v.status;
|
|
5099
|
+
const v = requireObject(vr, "verificationResults"), verificationResultStatus = v.status;
|
|
5245
5100
|
if (verificationResultStatus !== BillVerificationStatus.PENDING && verificationResultStatus !== BillVerificationStatus.PASS && verificationResultStatus !== BillVerificationStatus.FAIL && verificationResultStatus !== BillVerificationStatus.MANUAL_REVIEW) throw validationError("create-bill payload.verificationResults.status must be PENDING | PASS | FAIL | MANUAL_REVIEW.");
|
|
5246
|
-
return { status: verificationResultStatus, extractedAmount: nullableNumber(v.extractedAmount), difference: nullableNumber(v.difference), confidence: nullableNumber(v.confidence), failureReason: v.failureReason === null || v.failureReason === void 0 ? null : String(
|
|
5101
|
+
return { status: verificationResultStatus, extractedAmount: nullableNumber(v.extractedAmount), difference: nullableNumber(v.difference), confidence: nullableNumber(v.confidence), failureReason: v.failureReason === null || v.failureReason === void 0 ? null : String(
|
|
5102
|
+
v.failureReason
|
|
5103
|
+
) };
|
|
5247
5104
|
}, "parseCreateBillVerificationResults"), parseCreateBillVerificationStatus = __name2((verificationStatus) => {
|
|
5248
5105
|
if (verificationStatus === BillVerificationStatus.PENDING || verificationStatus === BillVerificationStatus.PASS || verificationStatus === BillVerificationStatus.FAIL || verificationStatus === BillVerificationStatus.MANUAL_REVIEW) return verificationStatus;
|
|
5249
5106
|
if (verificationStatus != null) throw validationError("create-bill payload.verificationStatus must be PENDING | PASS | FAIL | MANUAL_REVIEW.");
|
|
@@ -5258,45 +5115,22 @@ function parseCreateBillPayload(raw, draftOnlyFlag, quotationExempt = !1, requir
|
|
|
5258
5115
|
const o = requireObject(raw, "create-bill payload"), isClaimable = o.isClaimable;
|
|
5259
5116
|
if (typeof isClaimable != "boolean") throw validationError("create-bill payload.isClaimable must be boolean.");
|
|
5260
5117
|
const budgetItemIds = o.budgetItemIds;
|
|
5261
|
-
if (!Array.isArray(budgetItemIds) || budgetItemIds.length === 0) throw validationError(
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
), vs = parseCreateBillVerificationStatus(o.verificationStatus), amount = Number(o.amount);
|
|
5118
|
+
if (!Array.isArray(budgetItemIds) || budgetItemIds.length === 0) throw validationError(
|
|
5119
|
+
"create-bill payload.budgetItemIds must be a non-empty string array."
|
|
5120
|
+
);
|
|
5121
|
+
const attachments = billAttachmentList(o.attachments), draftOnly = parseCreateBillDraftOnly(o, draftOnlyFlag), alreadyPaidRaw = parseCreateBillAlreadyPaid(o, draftOnly), paymentProofAttachments = billAttachmentList(o.paymentProofAttachments, "paymentProofAttachments"), verificationResults = parseCreateBillVerificationResults(o.verificationResults), vs = parseCreateBillVerificationStatus(o.verificationStatus), amount = Number(o.amount);
|
|
5265
5122
|
if (!Number.isFinite(amount) || amount < 0) throw validationError("create-bill payload.amount must be a number >= 0.");
|
|
5266
5123
|
const quotationReferences = parseQuotationReferences(o, "create-bill"), parsedBudgetItemIds = budgetItemIds.map((id, i) => requiredString(id, "create-bill payload.budgetItemIds[".concat(i, "]"))), lineAmounts = parseBillLineAmounts(o, "create-bill");
|
|
5267
|
-
return validateExplicitBillAllocations({ amount, budgetItemIds: parsedBudgetItemIds, commandName: "create-bill", lineAmounts, quotationAllocations: quotationReferences.quotationAllocations }), assertCreateBillQuotationSourceRules({ isClaimable, quotationExempt, quotationReferences, requireSupplierQuotation }), {
|
|
5268
|
-
|
|
5269
|
-
projectId: requiredString(o.projectId, "create-bill payload.projectId"),
|
|
5270
|
-
supplierId: requiredString(o.supplierId, "create-bill payload.supplierId"),
|
|
5271
|
-
...quotationReferences,
|
|
5272
|
-
amount,
|
|
5273
|
-
budgetItemIds: parsedBudgetItemIds,
|
|
5274
|
-
...lineAmounts ? { lineAmounts } : {},
|
|
5275
|
-
comment: optionalString(o.comment),
|
|
5276
|
-
isClaimable,
|
|
5277
|
-
attachments,
|
|
5278
|
-
alreadyPaid: alreadyPaidRaw ?? void 0,
|
|
5279
|
-
draftOnly,
|
|
5280
|
-
paymentReference: optionalString(o.paymentReference),
|
|
5281
|
-
paymentProofAttachments,
|
|
5282
|
-
extractedSupplierName: optionalString(o.extractedSupplierName),
|
|
5283
|
-
extractedAmount: optionalNumber(o.extractedAmount),
|
|
5284
|
-
invoiceNumber: parseInvoiceNumber(o.invoiceNumber),
|
|
5285
|
-
invoiceDate: o.invoiceDate === void 0 || o.invoiceDate === null ? void 0 : toDate(o.invoiceDate, "invoiceDate"),
|
|
5286
|
-
verificationStatus: vs,
|
|
5287
|
-
verificationResults
|
|
5288
|
-
};
|
|
5124
|
+
return validateExplicitBillAllocations({ amount, budgetItemIds: parsedBudgetItemIds, commandName: "create-bill", lineAmounts, quotationAllocations: quotationReferences.quotationAllocations }), assertCreateBillQuotationSourceRules({ isClaimable, quotationExempt, quotationReferences, requireSupplierQuotation }), { budgetId: requiredString(o.budgetId, "create-bill payload.budgetId"), projectId: requiredString(o.projectId, "create-bill payload.projectId"), supplierId: requiredString(o.supplierId, "create-bill payload.supplierId"), ...quotationReferences, amount, budgetItemIds: parsedBudgetItemIds, ...lineAmounts ? { lineAmounts } : {}, comment: optionalString(o.comment), isClaimable, attachments, alreadyPaid: alreadyPaidRaw ?? void 0, draftOnly, paymentReference: optionalString(o.paymentReference), paymentProofAttachments, extractedSupplierName: optionalString(o.extractedSupplierName), extractedAmount: optionalNumber(o.extractedAmount), invoiceNumber: parseInvoiceNumber(o.invoiceNumber),
|
|
5125
|
+
invoiceDate: o.invoiceDate === void 0 || o.invoiceDate === null ? void 0 : toDate(o.invoiceDate, "invoiceDate"), verificationStatus: vs, verificationResults };
|
|
5289
5126
|
}
|
|
5290
5127
|
__name(parseCreateBillPayload, "parseCreateBillPayload"), __name2(parseCreateBillPayload, "parseCreateBillPayload");
|
|
5291
|
-
var UPDATE_BILL_KNOWN_FIELDS = /* @__PURE__ */ new Set(["id", "budgetId", "projectId", "supplierId", "quotationId", "quotationIds", "quotationAllocations", "overBudgetOverrideReason", "amount", "budgetItemIds", "lineAmounts", "comment", "isClaimable", "attachments", "alreadyPaid", "paymentReference", "paymentProofAttachments", "extractedSupplierName", "extractedAmount", "invoiceNumber", "invoiceDate", "verificationStatus", "verificationResults"]), assignUpdateBillStrings = __name2(
|
|
5292
|
-
(
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
},
|
|
5298
|
-
"assignUpdateBillStrings"
|
|
5299
|
-
), assignUpdateBillAmountsAndFlags = __name2((o, input) => {
|
|
5128
|
+
var UPDATE_BILL_KNOWN_FIELDS = /* @__PURE__ */ new Set(["id", "budgetId", "projectId", "supplierId", "quotationId", "quotationIds", "quotationAllocations", "overBudgetOverrideReason", "amount", "budgetItemIds", "lineAmounts", "comment", "isClaimable", "attachments", "alreadyPaid", "paymentReference", "paymentProofAttachments", "extractedSupplierName", "extractedAmount", "invoiceNumber", "invoiceDate", "verificationStatus", "verificationResults"]), assignUpdateBillStrings = __name2((o, input) => {
|
|
5129
|
+
for (const key of ["budgetId", "projectId", "supplierId", "comment", "paymentReference", "extractedSupplierName", "invoiceNumber", "overBudgetOverrideReason"]) if (o[key] !== void 0) {
|
|
5130
|
+
if (typeof o[key] != "string") throw validationError("update-bill payload.".concat(key, " must be a string."));
|
|
5131
|
+
input[key] = o[key];
|
|
5132
|
+
}
|
|
5133
|
+
}, "assignUpdateBillStrings"), assignUpdateBillAmountsAndFlags = __name2((o, input) => {
|
|
5300
5134
|
for (const key of ["amount", "extractedAmount"]) {
|
|
5301
5135
|
if (o[key] === void 0) continue;
|
|
5302
5136
|
const amount = Number(o[key]);
|
|
@@ -5335,37 +5169,34 @@ function parseUpdateBillPayload(raw) {
|
|
|
5335
5169
|
if (o.draftOnly !== void 0) throw validationError("draftOnly is only supported when creating a bill.");
|
|
5336
5170
|
const input = { id: requiredString(o.id, "update-bill payload.id") };
|
|
5337
5171
|
for (const key of Object.keys(o)) if (!UPDATE_BILL_KNOWN_FIELDS.has(key)) throw validationError("Unknown update-bill payload field: ".concat(key));
|
|
5338
|
-
if (assignUpdateBillStrings(o, input), assignUpdateBillAmountsAndFlags(o, input), assignUpdateBillAttachmentsAndItems(
|
|
5339
|
-
o,
|
|
5340
|
-
input
|
|
5341
|
-
), Object.assign(input, parseQuotationReferences(o, "update-bill")), o.lineAmounts !== void 0 && (input.lineAmounts = parseBillLineAmounts(o, "update-bill")), o.invoiceDate !== void 0 && (input.invoiceDate = toDate(o.invoiceDate, "invoiceDate")), assignUpdateBillVerification(o, input), Object.keys(input).length === 1) throw validationError("Supply at least one field to update.");
|
|
5172
|
+
if (assignUpdateBillStrings(o, input), assignUpdateBillAmountsAndFlags(o, input), assignUpdateBillAttachmentsAndItems(o, input), Object.assign(input, parseQuotationReferences(o, "update-bill")), o.lineAmounts !== void 0 && (input.lineAmounts = parseBillLineAmounts(o, "update-bill")), o.invoiceDate !== void 0 && (input.invoiceDate = toDate(o.invoiceDate, "invoiceDate")), assignUpdateBillVerification(o, input), Object.keys(input).length === 1) throw validationError("Supply at least one field to update.");
|
|
5342
5173
|
return input;
|
|
5343
5174
|
}
|
|
5344
5175
|
__name(parseUpdateBillPayload, "parseUpdateBillPayload"), __name2(parseUpdateBillPayload, "parseUpdateBillPayload");
|
|
5345
5176
|
var quotationIdsFromReferences = __name2((references) => references.quotationIds ?? (references.quotationId ? [references.quotationId] : void 0), "quotationIdsFromReferences"), assertSelectionQuotationFlagsMatchPayload = __name2((payloadReferences, flagReferences) => {
|
|
5346
5177
|
const payloadIds = quotationIdsFromReferences(payloadReferences), flagIds = quotationIdsFromReferences(flagReferences);
|
|
5347
5178
|
if (payloadIds && flagIds && payloadIds.join("\0") !== flagIds.join("\0")) throw validationError("validate-bill-selection quotation flags conflict with the payload quotation IDs.");
|
|
5348
|
-
}, "assertSelectionQuotationFlagsMatchPayload"), parseSelectionIsClaimable = __name2(
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5179
|
+
}, "assertSelectionQuotationFlagsMatchPayload"), parseSelectionIsClaimable = __name2(
|
|
5180
|
+
(input, payloadReferences, flagReferences) => {
|
|
5181
|
+
const isClaimable = input.isClaimable;
|
|
5182
|
+
if (isClaimable !== void 0 && typeof isClaimable != "boolean") throw validationError("validate-bill-selection payload.isClaimable must be boolean.");
|
|
5183
|
+
if (isClaimable === !0 && (payloadReferences.quotationId || (payloadReferences.quotationIds?.length ?? 0) > 0 || (payloadReferences.quotationAllocations?.length ?? 0) > 0 || flagReferences.quotationId || (flagReferences.quotationIds?.length ?? 0) > 0)) throw validationError("Employee claims cannot include quotation source inputs.");
|
|
5184
|
+
return isClaimable;
|
|
5185
|
+
},
|
|
5186
|
+
"parseSelectionIsClaimable"
|
|
5187
|
+
), assertSelectionExplicitAllocations = __name2(({ amount, budgetItemIds, lineAmounts, quotationAllocations }) => {
|
|
5354
5188
|
if (!(!lineAmounts && !quotationAllocations)) {
|
|
5355
5189
|
if (amount === void 0 || !Number.isFinite(amount) || budgetItemIds.length === 0) throw validationError("validate-bill-selection explicit allocations require payload.amount and payload.budgetItemIds.");
|
|
5356
|
-
validateExplicitBillAllocations({
|
|
5357
|
-
amount,
|
|
5358
|
-
budgetItemIds,
|
|
5359
|
-
commandName: "validate-bill-selection",
|
|
5360
|
-
lineAmounts,
|
|
5361
|
-
quotationAllocations
|
|
5362
|
-
});
|
|
5190
|
+
validateExplicitBillAllocations({ amount, budgetItemIds, commandName: "validate-bill-selection", lineAmounts, quotationAllocations });
|
|
5363
5191
|
}
|
|
5364
5192
|
}, "assertSelectionExplicitAllocations");
|
|
5365
5193
|
function parseValidateBillSelectionPayload(raw, quotationFlags = {}) {
|
|
5366
5194
|
const input = requireObject(raw, "validate-bill-selection payload"), payloadReferences = parseQuotationReferences(input, "validate-bill-selection"), flagReferences = parseQuotationReferences({ ...quotationFlags }, "validate-bill-selection flags");
|
|
5367
5195
|
assertSelectionQuotationFlagsMatchPayload(payloadReferences, flagReferences);
|
|
5368
|
-
const isClaimable = parseSelectionIsClaimable(input, payloadReferences, flagReferences), lineAmounts = parseBillLineAmounts(
|
|
5196
|
+
const isClaimable = parseSelectionIsClaimable(input, payloadReferences, flagReferences), lineAmounts = parseBillLineAmounts(
|
|
5197
|
+
input,
|
|
5198
|
+
"validate-bill-selection"
|
|
5199
|
+
), budgetItemIds = Array.isArray(input.budgetItemIds) ? input.budgetItemIds.map((id, index) => requiredString(id, "validate-bill-selection payload.budgetItemIds[".concat(index, "]"))) : [], amount = optionalNumber(input.amount);
|
|
5369
5200
|
return assertSelectionExplicitAllocations({ amount, budgetItemIds, lineAmounts, quotationAllocations: payloadReferences.quotationAllocations }), { ...input, ...amount !== void 0 ? { amount } : {}, ...isClaimable !== void 0 ? { isClaimable } : {}, ...lineAmounts ? { lineAmounts } : {}, ...payloadReferences, ...flagReferences };
|
|
5370
5201
|
}
|
|
5371
5202
|
__name(parseValidateBillSelectionPayload, "parseValidateBillSelectionPayload"), __name2(parseValidateBillSelectionPayload, "parseValidateBillSelectionPayload");
|
|
@@ -5425,16 +5256,20 @@ var parseCreateCustomerInvoicePayload = __name2((raw) => {
|
|
|
5425
5256
|
const input = requireObject(raw, "create-customer-invoice payload");
|
|
5426
5257
|
if (!Array.isArray(input.splits) || input.splits.length !== 1) throw validationError("create-customer-invoice payload.splits must contain exactly one invoice.");
|
|
5427
5258
|
if (input.isCustomPercentage !== void 0 && typeof input.isCustomPercentage != "boolean") throw validationError("create-customer-invoice payload.isCustomPercentage must be a boolean.");
|
|
5428
|
-
const details = input.details === void 0 ? void 0 : requireObject(
|
|
5429
|
-
input.details,
|
|
5430
|
-
"invoice details"
|
|
5431
|
-
);
|
|
5259
|
+
const details = input.details === void 0 ? void 0 : requireObject(input.details, "invoice details");
|
|
5432
5260
|
if (details && typeof details.billingAddress != "string") throw validationError("invoice details.billingAddress must be a string.");
|
|
5433
|
-
return {
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5261
|
+
return {
|
|
5262
|
+
...input.requestId === void 0 ? {} : { requestId: requiredString(input.requestId, "requestId") },
|
|
5263
|
+
...input.invoiceDate === void 0 ? {} : { invoiceDate: toDate(input.invoiceDate, "invoiceDate") },
|
|
5264
|
+
isCustomPercentage: input.isCustomPercentage ?? !0,
|
|
5265
|
+
...details ? { details: { billingAddress: String(details.billingAddress), customerMemo: requiredString(details.customerMemo, "customerMemo") } } : {},
|
|
5266
|
+
budgetId: requiredString(input.budgetId, "create-customer-invoice payload.budgetId"),
|
|
5267
|
+
splits: input.splits.map((rawSplit, index) => {
|
|
5268
|
+
const split = requireObject(rawSplit, "create-customer-invoice payload.splits[".concat(index, "]")), percentage = Number(split.percentage);
|
|
5269
|
+
if (!Number.isFinite(percentage) || percentage <= 0 || percentage > 100 || Math.round(percentage * 100) !== percentage * 100) throw validationError("create-customer-invoice payload.splits[".concat(index, "].percentage must be between 0.01 and 100 with at most two decimal places."));
|
|
5270
|
+
return { dueDate: toDate(split.dueDate, "create-customer-invoice payload.splits[".concat(index, "].dueDate")), label: requiredString(split.label, "create-customer-invoice payload.splits[".concat(index, "].label")), percentage };
|
|
5271
|
+
})
|
|
5272
|
+
};
|
|
5438
5273
|
}, "parseCreateCustomerInvoicePayload");
|
|
5439
5274
|
function parseUpdateProjectPayload(raw) {
|
|
5440
5275
|
const o = requireObject(raw, "update-project payload"), dr = o.dateRange;
|
|
@@ -5447,22 +5282,10 @@ function parseUpdateProjectPayload(raw) {
|
|
|
5447
5282
|
let confirmEstimateInvalidation;
|
|
5448
5283
|
if (typeof estimateInvalidation == "boolean") confirmEstimateInvalidation = estimateInvalidation;
|
|
5449
5284
|
else if (estimateInvalidation != null) throw validationError("update-project payload.confirmEstimateInvalidation must be a boolean when set.");
|
|
5450
|
-
return {
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
companyId: requiredString(o.companyId, "update-project payload.companyId"),
|
|
5455
|
-
contactPersonId: requiredString(o.contactPersonId, "update-project payload.contactPersonId"),
|
|
5456
|
-
asanaTaskId: requiredString(o.asanaTaskId, "update-project payload.asanaTaskId"),
|
|
5457
|
-
insideSalesId: requiredString(o.insideSalesId, "update-project payload.insideSalesId"),
|
|
5458
|
-
businessDevelopmentId: requiredString(o.businessDevelopmentId, "update-project payload.businessDevelopmentId"),
|
|
5459
|
-
projectManagerId: optionalString(o.projectManagerId),
|
|
5460
|
-
venue: requiredString(o.venue, "update-project payload.venue"),
|
|
5461
|
-
pax: optionalString(o.pax),
|
|
5462
|
-
dateRange: { from: toDate(range.from, "dateRange.from"), to: range.to === void 0 || range.to === null ? void 0 : toDate(range.to, "dateRange.to") },
|
|
5463
|
-
...requestQboAccountantNotification !== void 0 && { requestQboAccountantNotification },
|
|
5464
|
-
...confirmEstimateInvalidation !== void 0 && { confirmEstimateInvalidation }
|
|
5465
|
-
};
|
|
5285
|
+
return { id: requiredString(o.id, "update-project payload.id"), name: parseQuickBooksName(o.name), description: optionalString(o.description), companyId: requiredString(o.companyId, "update-project payload.companyId"), contactPersonId: requiredString(o.contactPersonId, "update-project payload.contactPersonId"), asanaTaskId: requiredString(o.asanaTaskId, "update-project payload.asanaTaskId"), insideSalesId: requiredString(o.insideSalesId, "update-project payload.insideSalesId"), businessDevelopmentId: requiredString(
|
|
5286
|
+
o.businessDevelopmentId,
|
|
5287
|
+
"update-project payload.businessDevelopmentId"
|
|
5288
|
+
), projectManagerId: optionalString(o.projectManagerId), venue: requiredString(o.venue, "update-project payload.venue"), pax: optionalString(o.pax), dateRange: { from: toDate(range.from, "dateRange.from"), to: range.to === void 0 || range.to === null ? void 0 : toDate(range.to, "dateRange.to") }, ...requestQboAccountantNotification !== void 0 && { requestQboAccountantNotification }, ...confirmEstimateInvalidation !== void 0 && { confirmEstimateInvalidation } };
|
|
5466
5289
|
}
|
|
5467
5290
|
__name(parseUpdateProjectPayload, "parseUpdateProjectPayload"), __name2(parseUpdateProjectPayload, "parseUpdateProjectPayload");
|
|
5468
5291
|
var parseQuickBooksName = __name2((value) => {
|
|
@@ -5493,7 +5316,10 @@ function parseItemUpdatePayload(raw) {
|
|
|
5493
5316
|
}
|
|
5494
5317
|
__name(parseItemUpdatePayload, "parseItemUpdatePayload"), __name2(parseItemUpdatePayload, "parseItemUpdatePayload");
|
|
5495
5318
|
function parseContactCreatePayload(raw) {
|
|
5496
|
-
return requireObject(
|
|
5319
|
+
return requireObject(
|
|
5320
|
+
raw,
|
|
5321
|
+
"create-contact-person payload"
|
|
5322
|
+
), raw;
|
|
5497
5323
|
}
|
|
5498
5324
|
__name(parseContactCreatePayload, "parseContactCreatePayload"), __name2(parseContactCreatePayload, "parseContactCreatePayload");
|
|
5499
5325
|
function parseContactUpdatePayload(raw) {
|
|
@@ -5501,10 +5327,7 @@ function parseContactUpdatePayload(raw) {
|
|
|
5501
5327
|
}
|
|
5502
5328
|
__name(parseContactUpdatePayload, "parseContactUpdatePayload"), __name2(parseContactUpdatePayload, "parseContactUpdatePayload");
|
|
5503
5329
|
function parseCompanyUpdatePayload(raw) {
|
|
5504
|
-
const input = requireObject(
|
|
5505
|
-
raw,
|
|
5506
|
-
"update-company payload"
|
|
5507
|
-
), billingEmails = parseCompanyBillingEmails(input.billingEmails);
|
|
5330
|
+
const input = requireObject(raw, "update-company payload"), billingEmails = parseCompanyBillingEmails(input.billingEmails);
|
|
5508
5331
|
if (input.confirmDistinct !== void 0 && typeof input.confirmDistinct != "boolean") throw validationError("confirmDistinct must be a boolean.");
|
|
5509
5332
|
return { id: requiredString(input.id, "id"), name: parseQuickBooksName(input.name), website: requiredString(input.website, "website"), ...input.confirmDistinct === void 0 ? {} : { confirmDistinct: input.confirmDistinct }, ...billingEmails === void 0 ? {} : { billingEmails } };
|
|
5510
5333
|
}
|
|
@@ -5530,7 +5353,10 @@ var parseCompanyBillingEmails = __name2((raw) => {
|
|
|
5530
5353
|
case "financial-write":
|
|
5531
5354
|
return permissions.allowFinancialWrite === !0;
|
|
5532
5355
|
}
|
|
5533
|
-
}, "isEffectAllowed"), uniqueEffects = __name2((effects) => [...new Set(effects)], "uniqueEffects"), getRequiredEffectPermissions = __name2(
|
|
5356
|
+
}, "isEffectAllowed"), uniqueEffects = __name2((effects) => [...new Set(effects)], "uniqueEffects"), getRequiredEffectPermissions = __name2(
|
|
5357
|
+
(effects, permissions) => uniqueEffects(effects).filter((effect) => !isEffectAllowed(effect, permissions)),
|
|
5358
|
+
"getRequiredEffectPermissions"
|
|
5359
|
+
), formatConfirmationPreview = __name2((request) => ["Budget Builder workflow preview", "Action: ".concat(request.action), "Target: ".concat(request.target?.trim() || "not specified"), "Effects: ".concat(uniqueEffects(request.effects).map((effect) => effectLabels[effect]).join("; ") || "none"), ...request.details === void 0 ? [] : ["Details: ".concat(request.details)]].join("\n"), "formatConfirmationPreview"), confirmSensitiveCommand = __name2(async (runtime, request) => {
|
|
5534
5360
|
const requiredPermissions = getRequiredEffectPermissions(request.effects, request.permissions);
|
|
5535
5361
|
if (request.effects.length === 0) return { confirmed: !0, requiredPermissions };
|
|
5536
5362
|
const target = request.target?.trim();
|
|
@@ -5545,10 +5371,7 @@ var parseCompanyBillingEmails = __name2((raw) => {
|
|
|
5545
5371
|
if (runtime.stderr.write("".concat(preview, "\n")), runtime.prompt === void 0) throw new CliRuntimeError("CONFIRMATION_REQUIRED", "This command needs an interactive confirmation prompt.");
|
|
5546
5372
|
if (await runtime.prompt("Type CONFIRM to continue: ") !== "CONFIRM") throw new CliRuntimeError("ABORTED", "Command aborted by user.");
|
|
5547
5373
|
return { confirmed: !0, preview, requiredPermissions };
|
|
5548
|
-
}, "confirmSensitiveCommand"), sensitiveKeys = /* @__PURE__ */ new Set(["apikey", "authorization", "bb_api_key", "password", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "payload", "proof", "receipt", "secret", "token"]), serialize = __name2((value) => "".concat(JSON.stringify(value, null, 2), "\n"), "serialize"), createSuccessEnvelope = __name2((data, invocation) => ({ ok: !0, data, meta: { command: invocation.command, cliVersion: invocation.cliVersion, apiBaseUrl: invocation.apiBaseUrl } }), "createSuccessEnvelope"), emitCliSuccess = __name2(
|
|
5549
|
-
(runtime, invocation, data) => (runtime.stdout.write(serialize(invocation.legacy ? data : createSuccessEnvelope(data, invocation))), 0),
|
|
5550
|
-
"emitCliSuccess"
|
|
5551
|
-
), emitCliError = __name2((runtime, invocation, error2) => {
|
|
5374
|
+
}, "confirmSensitiveCommand"), sensitiveKeys = /* @__PURE__ */ new Set(["apikey", "authorization", "bb_api_key", "password", "paymentproof", "paymentproofattachments", "paymentproofpath", "paymentreference", "payload", "proof", "receipt", "secret", "token"]), serialize = __name2((value) => "".concat(JSON.stringify(value, null, 2), "\n"), "serialize"), createSuccessEnvelope = __name2((data, invocation) => ({ ok: !0, data, meta: { command: invocation.command, cliVersion: invocation.cliVersion, apiBaseUrl: invocation.apiBaseUrl } }), "createSuccessEnvelope"), emitCliSuccess = __name2((runtime, invocation, data) => (runtime.stdout.write(serialize(invocation.legacy ? data : createSuccessEnvelope(data, invocation))), 0), "emitCliSuccess"), emitCliError = __name2((runtime, invocation, error2) => {
|
|
5552
5375
|
const normalized = normalizeCliError(error2);
|
|
5553
5376
|
if (invocation.legacy) runtime.stderr.write(serialize({ error: normalized.message }));
|
|
5554
5377
|
else {
|
|
@@ -5585,16 +5408,13 @@ var createProcessRuntime = __name2(() => ({ stdout: { write: __name2((value) =>
|
|
|
5585
5408
|
}, "emitCommandResult"), emitCommandError = __name2((error2) => {
|
|
5586
5409
|
const session = requireSession();
|
|
5587
5410
|
return emitCliError(session.runtime, session.invocation, error2);
|
|
5588
|
-
}, "emitCommandError"), confirmCurrentCommand = __name2(
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
},
|
|
5596
|
-
"confirmCurrentCommand"
|
|
5597
|
-
);
|
|
5411
|
+
}, "emitCommandError"), confirmCurrentCommand = __name2(async (input) => {
|
|
5412
|
+
const session = requireSession(), unconfirmedEffects = (input.effects ?? session.effects).filter((effect) => !session.confirmedEffects.has(effect));
|
|
5413
|
+
if (unconfirmedEffects.length !== 0) {
|
|
5414
|
+
await confirmSensitiveCommand(session.runtime, { action: input.action, target: input.target, details: input.details, effects: unconfirmedEffects, permissions: session.permissions });
|
|
5415
|
+
for (const effect of unconfirmedEffects) session.confirmedEffects.add(effect);
|
|
5416
|
+
}
|
|
5417
|
+
}, "confirmCurrentCommand");
|
|
5598
5418
|
import { contentType } from "mime-types";
|
|
5599
5419
|
var BUDGET = ApprovalType2.BUDGET, BILL = ApprovalType2.BILL, SUPPLIER = ApprovalType2.SUPPLIER, QUOTATION = ApprovalType2.QUOTATION, CUSTOMER_INVOICE = ApprovalType2.CUSTOMER_INVOICE, ASANA_WON_LOST_SECTION_GIDS = /* @__PURE__ */ new Set(["1211678338364908", "1211678338364907"]), MAX_ASANA_LEAD_CANDIDATES = 5, ASANA_SEARCH_DETAIL_LIMIT = 15, getAllPendingApprovals = __name2(async () => {
|
|
5600
5420
|
const approvals = [];
|
|
@@ -5610,17 +5430,17 @@ var BUDGET = ApprovalType2.BUDGET, BILL = ApprovalType2.BILL, SUPPLIER = Approva
|
|
|
5610
5430
|
if (!delivery) return { queued: !1, sent: !1, count: 0, queuedCount: 0, sentCount: 0, skippedCount: 0, error: "No approval email delivery was queued" };
|
|
5611
5431
|
const { queuedCount, sentCount, skippedCount, message, operationIds } = delivery;
|
|
5612
5432
|
return { queued: queuedCount > 0, sent: !1, count: queuedCount, queuedCount, sentCount, skippedCount, operationIds, message };
|
|
5613
|
-
}, "createApprovalEmailDeliveryReport"), createApprovalEmailDeliveryFailure = __name2(
|
|
5433
|
+
}, "createApprovalEmailDeliveryReport"), createApprovalEmailDeliveryFailure = __name2(
|
|
5434
|
+
(error2) => ({ queued: !1, sent: !1, count: 0, queuedCount: 0, sentCount: 0, skippedCount: 0, error: error2 }),
|
|
5435
|
+
"createApprovalEmailDeliveryFailure"
|
|
5436
|
+
);
|
|
5614
5437
|
function isPendingRequest(n) {
|
|
5615
5438
|
return n.notificationType === "request" && n.status === ApprovalStatus2.PENDING_APPROVAL;
|
|
5616
5439
|
}
|
|
5617
5440
|
__name(isPendingRequest, "isPendingRequest"), __name2(isPendingRequest, "isPendingRequest");
|
|
5618
5441
|
var out = __name2((data) => {
|
|
5619
5442
|
emitCommandResult(data);
|
|
5620
|
-
}, "out"), isRecord2 = __name2(
|
|
5621
|
-
(value) => typeof value == "object" && value !== null && !Array.isArray(value),
|
|
5622
|
-
"isRecord2"
|
|
5623
|
-
), stringField = __name2((record, key) => {
|
|
5443
|
+
}, "out"), isRecord2 = __name2((value) => typeof value == "object" && value !== null && !Array.isArray(value), "isRecord2"), stringField = __name2((record, key) => {
|
|
5624
5444
|
const value = record[key];
|
|
5625
5445
|
return typeof value == "string" && value.trim() ? value.trim() : void 0;
|
|
5626
5446
|
}, "stringField"), asanaSectionsForTask = __name2((task) => !isRecord2(task) || !Array.isArray(task.memberships) ? [] : task.memberships.flatMap((membership) => !isRecord2(membership) || !isRecord2(membership.section) ? [] : [{ gid: stringField(membership.section, "gid"), name: stringField(membership.section, "name") }]), "asanaSectionsForTask"), isWonOrLostAsanaTask = __name2((task) => asanaSectionsForTask(task).some((section) => {
|
|
@@ -5670,9 +5490,7 @@ var out = __name2((data) => {
|
|
|
5670
5490
|
try {
|
|
5671
5491
|
for (; ; ) {
|
|
5672
5492
|
const trimmed = (await rl.question("Choose 1-".concat(candidates.length, ", or q to abort: "))).trim().toLowerCase();
|
|
5673
|
-
if (trimmed === "q" || trimmed === "quit") throw new Error(
|
|
5674
|
-
"Aborted."
|
|
5675
|
-
);
|
|
5493
|
+
if (trimmed === "q" || trimmed === "quit") throw new Error("Aborted.");
|
|
5676
5494
|
const selected = Number.parseInt(trimmed, 10);
|
|
5677
5495
|
if (Number.isInteger(selected) && selected >= 1 && selected <= candidates.length) {
|
|
5678
5496
|
const candidate = candidates[selected - 1];
|
|
@@ -5694,17 +5512,16 @@ var out = __name2((data) => {
|
|
|
5694
5512
|
if (supportedContentType) return supportedContentType;
|
|
5695
5513
|
throw new Error("Unsupported attachment type: ".concat(fileName));
|
|
5696
5514
|
}, "attachmentContentTypeForFileName"), billAttachmentContentTypeForFileName = __name2((fileName) => {
|
|
5697
|
-
const resolvedContentType = attachmentContentTypeForFileName(
|
|
5515
|
+
const resolvedContentType = attachmentContentTypeForFileName(
|
|
5516
|
+
fileName
|
|
5517
|
+
);
|
|
5698
5518
|
if (resolvedContentType === "image/webp") throw new Error("Unsupported QuickBooks bill attachment type: ".concat(fileName, ". Use PDF, GIF, JPEG, or PNG."));
|
|
5699
5519
|
return resolvedContentType;
|
|
5700
|
-
}, "billAttachmentContentTypeForFileName"), PAYMENT_PROOF_MAX_SIZE = 20 * 1024 * 1024, QUOTATION_ATTACHMENT_MAX_SIZE = 20 * 1024 * 1024, quotationAttachmentContentTypeForFileName = __name2(
|
|
5701
|
-
(fileName)
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
},
|
|
5706
|
-
"quotationAttachmentContentTypeForFileName"
|
|
5707
|
-
), LOCKED_BUDGET_STATUSES_REQUIRING_CONFIRMATION = /* @__PURE__ */ new Set([BudgetStatus2.ESTIMATE_CREATED, BudgetStatus2.ESTIMATE_SENT, BudgetStatus2.ESTIMATE_ACCEPTED, BudgetStatus2.ESTIMATE_REJECTED, BudgetStatus2.ESTIMATE_CLOSED]), lockedBudgetStatusLabels = { ESTIMATE_CREATED: "Estimate Created", ESTIMATE_SENT: "Estimate Sent", ESTIMATE_ACCEPTED: "Estimate Accepted", ESTIMATE_REJECTED: "Estimate Rejected", ESTIMATE_CLOSED: "Estimate Closed" }, lockedBudgetStatusLabel = __name2((status) => status in lockedBudgetStatusLabels ? lockedBudgetStatusLabels[status] : status, "lockedBudgetStatusLabel"), buildSensitiveWorkflowPreview = __name2(({ action, entity, details }) => {
|
|
5520
|
+
}, "billAttachmentContentTypeForFileName"), PAYMENT_PROOF_MAX_SIZE = 20 * 1024 * 1024, QUOTATION_ATTACHMENT_MAX_SIZE = 20 * 1024 * 1024, quotationAttachmentContentTypeForFileName = __name2((fileName) => {
|
|
5521
|
+
const resolvedContentType = contentTypeHeaderForFileName(fileName);
|
|
5522
|
+
if (resolvedContentType === "application/pdf" || resolvedContentType === "image/jpeg" || resolvedContentType === "image/png") return resolvedContentType;
|
|
5523
|
+
throw new Error("Unsupported quotation attachment type: ".concat(fileName, ". Use PDF, JPEG, or PNG."));
|
|
5524
|
+
}, "quotationAttachmentContentTypeForFileName"), LOCKED_BUDGET_STATUSES_REQUIRING_CONFIRMATION = /* @__PURE__ */ new Set([BudgetStatus2.ESTIMATE_CREATED, BudgetStatus2.ESTIMATE_SENT, BudgetStatus2.ESTIMATE_ACCEPTED, BudgetStatus2.ESTIMATE_REJECTED, BudgetStatus2.ESTIMATE_CLOSED]), lockedBudgetStatusLabels = { ESTIMATE_CREATED: "Estimate Created", ESTIMATE_SENT: "Estimate Sent", ESTIMATE_ACCEPTED: "Estimate Accepted", ESTIMATE_REJECTED: "Estimate Rejected", ESTIMATE_CLOSED: "Estimate Closed" }, lockedBudgetStatusLabel = __name2((status) => status in lockedBudgetStatusLabels ? lockedBudgetStatusLabels[status] : status, "lockedBudgetStatusLabel"), buildSensitiveWorkflowPreview = __name2(({ action, entity, details }) => {
|
|
5708
5525
|
const effects = details ?? "may change workflow state or send notifications";
|
|
5709
5526
|
return ["Budget Builder workflow preview", "Action: ".concat(action), "Target: ".concat(entity), "Effects: ".concat(effects)].join("\n");
|
|
5710
5527
|
}, "buildSensitiveWorkflowPreview"), assertSensitiveWorkflowConfirmed = __name2(async (input) => {
|
|
@@ -5739,7 +5556,9 @@ var out = __name2((data) => {
|
|
|
5739
5556
|
await assertLockedBudgetChangeConfirmed({ budget: { id: budget.id, name: budget.name, status: budget.status }, action });
|
|
5740
5557
|
}, "confirmLockedBudgetChangeByBudgetId"), confirmLockedBudgetChangeByBudgetItemId = __name2(async (budgetItemId, action) => {
|
|
5741
5558
|
const { budget } = await api2.budgetItem.getBudgetItemContext.query({ budgetItemId });
|
|
5742
|
-
await assertLockedBudgetChangeConfirmed(
|
|
5559
|
+
await assertLockedBudgetChangeConfirmed(
|
|
5560
|
+
{ budget, action }
|
|
5561
|
+
);
|
|
5743
5562
|
}, "confirmLockedBudgetChangeByBudgetItemId"), updateProjectWithEstimateInvalidationConfirmation = __name2(async (input) => {
|
|
5744
5563
|
try {
|
|
5745
5564
|
return await api2.project.updateProject.mutate(input);
|
|
@@ -5753,7 +5572,11 @@ var out = __name2((data) => {
|
|
|
5753
5572
|
out(await api2.budget.getCounts.query(input));
|
|
5754
5573
|
}, "countBudgets");
|
|
5755
5574
|
async function getBudget(id, opts) {
|
|
5756
|
-
const includeInactive = opts?.includeInactive ?? !1, [budget, items, totals] = await Promise.all([
|
|
5575
|
+
const includeInactive = opts?.includeInactive ?? !1, [budget, items, totals] = await Promise.all([
|
|
5576
|
+
api2.budget.getBudget.query({ id, includeInactive }),
|
|
5577
|
+
api2.budget.getBudgetItems.query({ budgetId: id, includeInactive }),
|
|
5578
|
+
api2.budget.getBudgetItemTotals.query({ budgetId: id, includeInactive })
|
|
5579
|
+
]);
|
|
5757
5580
|
out({ budget, items: { ...items, totals } });
|
|
5758
5581
|
}
|
|
5759
5582
|
__name(getBudget, "getBudget"), __name2(getBudget, "getBudget");
|
|
@@ -5772,7 +5595,9 @@ var assertBudgetActionReadiness = __name2(async ({ budgetId, requireQuickbooksPr
|
|
|
5772
5595
|
if (requireQuickbooksProject && !budget.project.quickbooksProjectId) throw new Error("Cannot create estimate: project is not linked to QuickBooks yet.");
|
|
5773
5596
|
}, "assertBudgetActionReadiness"), runBudgetPreflight = __name2(async (budgetId, preflight) => {
|
|
5774
5597
|
if (preflight && (preflight.company && await api2.company.updateCompany.mutate(preflight.company), preflight.contactPerson && await api2.contactPerson.updateContactPerson.mutate(preflight.contactPerson), preflight.eventDetails)) {
|
|
5775
|
-
const budget = await api2.budget.getBudget.query({ id: budgetId }), project = await api2.project.getProjectById.query({ id: budget.projectId }), day = new Date(preflight.eventDetails.date), start = new Date(preflight.eventDetails.startTime), end = new Date(preflight.eventDetails.endTime), payload = { id: project.id, name: project.name, description: project.description ?? void 0, dateRange: { from: combineDateAndTime(day, start), to: combineDateAndTime(day, end) }, companyId: project.companyId, contactPersonId: project.contactPersonId, asanaTaskId: project.asanaTaskId ?? "", insideSalesId: project.insideSalesId ?? "", businessDevelopmentId: project.businessDevelopmentId ?? "", venue: project.venue ?? "", pax: formatOptionalProjectPaxInput(
|
|
5598
|
+
const budget = await api2.budget.getBudget.query({ id: budgetId }), project = await api2.project.getProjectById.query({ id: budget.projectId }), day = new Date(preflight.eventDetails.date), start = new Date(preflight.eventDetails.startTime), end = new Date(preflight.eventDetails.endTime), payload = { id: project.id, name: project.name, description: project.description ?? void 0, dateRange: { from: combineDateAndTime(day, start), to: combineDateAndTime(day, end) }, companyId: project.companyId, contactPersonId: project.contactPersonId, asanaTaskId: project.asanaTaskId ?? "", insideSalesId: project.insideSalesId ?? "", businessDevelopmentId: project.businessDevelopmentId ?? "", venue: project.venue ?? "", pax: formatOptionalProjectPaxInput(
|
|
5599
|
+
project.pax
|
|
5600
|
+
) };
|
|
5776
5601
|
await updateProjectWithEstimateInvalidationConfirmation(payload);
|
|
5777
5602
|
}
|
|
5778
5603
|
}, "runBudgetPreflight"), listBills = __name2(async (input) => {
|
|
@@ -5794,9 +5619,7 @@ async function approveBill(billId, overBudgetOverrideReason) {
|
|
|
5794
5619
|
const delivery = result.emailDelivery;
|
|
5795
5620
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
5796
5621
|
} catch (error2) {
|
|
5797
|
-
email2 = createApprovalEmailDeliveryFailure(
|
|
5798
|
-
error2 instanceof Error ? error2.message : String(error2)
|
|
5799
|
-
);
|
|
5622
|
+
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
|
|
5800
5623
|
}
|
|
5801
5624
|
out({ ...result, email: email2 });
|
|
5802
5625
|
}
|
|
@@ -5816,7 +5639,11 @@ var listSuppliers = __name2(async (opts) => {
|
|
|
5816
5639
|
out(await api2.supplier.getSummary.query(opts));
|
|
5817
5640
|
}, "countSuppliers");
|
|
5818
5641
|
async function createBillApproval(billId) {
|
|
5819
|
-
await assertSensitiveWorkflowConfirmed({
|
|
5642
|
+
await assertSensitiveWorkflowConfirmed({
|
|
5643
|
+
action: "Create bill approval request",
|
|
5644
|
+
entity: "bill ".concat(billId),
|
|
5645
|
+
details: "and send approval request emails"
|
|
5646
|
+
});
|
|
5820
5647
|
const result = await api2.bill.createApproval.mutate({ billId }), approvalIds = (result.results ?? []).map((item) => ({ id: item.id }));
|
|
5821
5648
|
let email2;
|
|
5822
5649
|
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure("No approval ids returned");
|
|
@@ -5879,10 +5706,7 @@ var listExternalBillPaymentAccounts = __name2(async () => {
|
|
|
5879
5706
|
}, "listExternalBillPaymentAccounts"), refreshExternalBillPaymentAccounts = __name2(async () => {
|
|
5880
5707
|
await confirmCurrentCommand({ action: "refresh QuickBooks payment accounts", target: "the cached external payment-account list", effects: ["state-change"], details: "Queue a read of QuickBooks bank and credit-card accounts; nothing is written to QuickBooks." }), out(await api2.bill.refreshExternalPaymentAccounts.mutate());
|
|
5881
5708
|
}, "refreshExternalBillPaymentAccounts"), recordExternalBillPayment = __name2(async (opts) => {
|
|
5882
|
-
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp(
|
|
5883
|
-
"^\\d{4}-\\d{2}-\\d{2}$",
|
|
5884
|
-
""
|
|
5885
|
-
).test(opts.paymentDate) || new Date("".concat(opts.paymentDate, "T00:00:00Z")).toISOString().slice(0, 10) !== opts.paymentDate) throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
|
|
5709
|
+
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !new __cliRegExp("^\\d{4}-\\d{2}-\\d{2}$", "").test(opts.paymentDate) || new Date("".concat(opts.paymentDate, "T00:00:00Z")).toISOString().slice(0, 10) !== opts.paymentDate) throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
|
|
5886
5710
|
await assertSensitiveWorkflowConfirmed({ action: "Record external payment (no email)", entity: "bill ".concat(opts.id), details: "already paid on ".concat(opts.paymentDate, "; reference ").concat(opts.paymentReference, "; QBO account ").concat(opts.paymentAccount, ". No money is transferred.") });
|
|
5887
5711
|
const bill = await api2.bill.getPayment.query({ id: opts.id }), proof = !bill.externalPayment && opts.paymentProofPath ? await stageBillPaymentProof(bill.projectId, opts.paymentProofPath) : void 0;
|
|
5888
5712
|
try {
|
|
@@ -5942,16 +5766,18 @@ __name(uploadBillAttachmentFromPath, "uploadBillAttachmentFromPath"), __name2(up
|
|
|
5942
5766
|
var uploadSingleBillAttachmentFromPath = __name2(async (billId, filePath, type = AttachmentType.BILL) => {
|
|
5943
5767
|
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = billAttachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBillAttachmentUpload.mutate({ billId, contentType: attachmentContentType, fileName, size }), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
|
|
5944
5768
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5945
|
-
return await api2.attachment.confirmBillAttachment.mutate({
|
|
5769
|
+
return await api2.attachment.confirmBillAttachment.mutate({
|
|
5770
|
+
billId,
|
|
5771
|
+
key,
|
|
5772
|
+
name: fileName,
|
|
5773
|
+
size,
|
|
5774
|
+
type
|
|
5775
|
+
});
|
|
5946
5776
|
}, "uploadSingleBillAttachmentFromPath");
|
|
5947
5777
|
async function uploadBillAttachmentsFromPaths(billId, filePaths, type = AttachmentType.BILL) {
|
|
5948
5778
|
if (filePaths.length === 0) throw new Error("At least one bill attachment file path is required");
|
|
5949
5779
|
const results = [];
|
|
5950
|
-
for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(
|
|
5951
|
-
billId,
|
|
5952
|
-
filePath,
|
|
5953
|
-
type
|
|
5954
|
-
));
|
|
5780
|
+
for (const filePath of filePaths) results.push(await uploadSingleBillAttachmentFromPath(billId, filePath, type));
|
|
5955
5781
|
out({ success: !0, billId, type, count: results.length, attachments: results.map((result) => result.attachment), results });
|
|
5956
5782
|
}
|
|
5957
5783
|
__name(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths"), __name2(uploadBillAttachmentsFromPaths, "uploadBillAttachmentsFromPaths");
|
|
@@ -5961,16 +5787,15 @@ async function uploadBillDocumentsFromPaths({ billId, invoicePaths = [], payment
|
|
|
5961
5787
|
for (const filePath of invoicePaths) invoiceResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL));
|
|
5962
5788
|
const paymentProofResults = [];
|
|
5963
5789
|
for (const filePath of paymentProofPaths) paymentProofResults.push(await uploadSingleBillAttachmentFromPath(billId, filePath, AttachmentType.BILL_PAYMENT_PROOF));
|
|
5964
|
-
out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [
|
|
5965
|
-
...invoiceResults,
|
|
5966
|
-
...paymentProofResults
|
|
5967
|
-
] });
|
|
5790
|
+
out({ success: !0, billId, count: invoiceResults.length + paymentProofResults.length, invoiceAttachments: invoiceResults.map((result) => result.attachment), paymentProofAttachments: paymentProofResults.map((result) => result.attachment), results: [...invoiceResults, ...paymentProofResults] });
|
|
5968
5791
|
}
|
|
5969
5792
|
__name(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths"), __name2(uploadBillDocumentsFromPaths, "uploadBillDocumentsFromPaths");
|
|
5970
5793
|
async function uploadQuotationAttachmentFromPath(projectId, filePath) {
|
|
5971
5794
|
const buf = await readFile2(filePath), fileName = basename(filePath);
|
|
5972
5795
|
if (buf.byteLength > QUOTATION_ATTACHMENT_MAX_SIZE) throw new Error("Quotation attachment must be 20MB or smaller.");
|
|
5973
|
-
const attachmentContentType = quotationAttachmentContentTypeForFileName(fileName), ext = fileName.split(".").pop()?.toLowerCase().replace(new __cliRegExp("[^a-z0-9]", "g"), ""), key = "quotations/".concat(projectId, "/").concat(randomUUID2(), ".").concat(ext || "pdf"), uploadUrl = await api2.attachment.getPresignedUrlToUpload.mutate(
|
|
5796
|
+
const attachmentContentType = quotationAttachmentContentTypeForFileName(fileName), ext = fileName.split(".").pop()?.toLowerCase().replace(new __cliRegExp("[^a-z0-9]", "g"), ""), key = "quotations/".concat(projectId, "/").concat(randomUUID2(), ".").concat(ext || "pdf"), uploadUrl = await api2.attachment.getPresignedUrlToUpload.mutate(
|
|
5797
|
+
{ key, size: buf.byteLength, contentType: attachmentContentType }
|
|
5798
|
+
), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
|
|
5974
5799
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5975
5800
|
out({ id: randomUUID2(), name: fileName, key, size: buf.byteLength });
|
|
5976
5801
|
}
|
|
@@ -5981,24 +5806,27 @@ var cleanupStagedQuotationAttachments = __name2(async (projectId, keys) => {
|
|
|
5981
5806
|
}, "cleanupStagedQuotationAttachments");
|
|
5982
5807
|
async function uploadBudgetAttachmentFromPath(budgetId, filePath) {
|
|
5983
5808
|
await confirmLockedBudgetChangeByBudgetId(budgetId, "Upload budget attachment");
|
|
5984
|
-
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetAttachmentUpload.mutate({
|
|
5809
|
+
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetAttachmentUpload.mutate({
|
|
5810
|
+
budgetId,
|
|
5811
|
+
contentType: attachmentContentType,
|
|
5812
|
+
fileName,
|
|
5813
|
+
size
|
|
5814
|
+
}), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
|
|
5985
5815
|
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5986
|
-
const confirmed = await api2.attachment.confirmBudgetAttachment.mutate(
|
|
5987
|
-
{ budgetId, key, name: fileName, size }
|
|
5988
|
-
);
|
|
5816
|
+
const confirmed = await api2.attachment.confirmBudgetAttachment.mutate({ budgetId, key, name: fileName, size });
|
|
5989
5817
|
out(confirmed);
|
|
5990
5818
|
}
|
|
5991
5819
|
__name(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath"), __name2(uploadBudgetAttachmentFromPath, "uploadBudgetAttachmentFromPath");
|
|
5992
5820
|
async function uploadBudgetWinProofFromPath(budgetId, filePath, opts) {
|
|
5993
5821
|
await assertSensitiveWorkflowConfirmed({ action: "Mark budget won", entity: "budget ".concat(budgetId), details: "by uploading proof and setting status to ESTIMATE_ACCEPTED" }), await confirmLockedBudgetChangeByBudgetId(budgetId, "Mark budget won");
|
|
5994
|
-
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetWinProofUpload.mutate({
|
|
5995
|
-
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5996
|
-
await api2.attachment.confirmBudgetWinProofAttachment.mutate({
|
|
5822
|
+
const buf = await readFile2(filePath), fileName = basename(filePath), size = buf.byteLength, attachmentContentType = attachmentContentTypeForFileName(fileName), { uploadUrl, key } = await api2.attachment.requestBudgetWinProofUpload.mutate({
|
|
5997
5823
|
budgetId,
|
|
5998
|
-
|
|
5999
|
-
|
|
5824
|
+
contentType: attachmentContentType,
|
|
5825
|
+
fileName,
|
|
6000
5826
|
size
|
|
6001
|
-
});
|
|
5827
|
+
}), res = await fetch(uploadUrl, { method: "PUT", body: buf, headers: { "Content-Type": attachmentContentType } });
|
|
5828
|
+
if (!res.ok) throw new Error("S3 upload failed: HTTP ".concat(res.status, " ").concat((await res.text()).slice(0, 500)));
|
|
5829
|
+
await api2.attachment.confirmBudgetWinProofAttachment.mutate({ budgetId, key, name: fileName, size });
|
|
6002
5830
|
const result = await api2.budget.updateBudgetStatus.mutate({ id: budgetId, status: BudgetStatus2.ESTIMATE_ACCEPTED, ...opts?.projectManagerId !== void 0 && { projectManagerId: opts.projectManagerId }, ...opts?.markProjectWon !== void 0 && { markProjectWon: opts.markProjectWon }, ...opts?.projectInvoiceSettings !== void 0 && { projectInvoiceSettings: opts.projectInvoiceSettings } });
|
|
6003
5831
|
out({ ...result, invoiceSetup: result.hasQuickbooksEstimate ? invoiceSplitSetupNextAction(budgetId) : null });
|
|
6004
5832
|
}
|
|
@@ -6025,15 +5853,14 @@ async function addBudgetItems(opts) {
|
|
|
6025
5853
|
__name(addBudgetItems, "addBudgetItems"), __name2(addBudgetItems, "addBudgetItems");
|
|
6026
5854
|
async function updateBudgetItem(input) {
|
|
6027
5855
|
await confirmLockedBudgetChangeByBudgetItemId(input.id, "Update budget item");
|
|
6028
|
-
const result = await api2.budgetItem.updateBudgetItem.mutate({ ...input, ...input.description !== void 0 && input.descriptionRichText === void 0 && { descriptionRichText: createRichTextFromPlainText(
|
|
5856
|
+
const result = await api2.budgetItem.updateBudgetItem.mutate({ ...input, ...input.description !== void 0 && input.descriptionRichText === void 0 && { descriptionRichText: createRichTextFromPlainText(
|
|
5857
|
+
input.description
|
|
5858
|
+
) }, ...input.note !== void 0 && input.noteRichText === void 0 && { noteRichText: createRichTextFromPlainText(input.note) } });
|
|
6029
5859
|
out(result);
|
|
6030
5860
|
}
|
|
6031
5861
|
__name(updateBudgetItem, "updateBudgetItem"), __name2(updateBudgetItem, "updateBudgetItem");
|
|
6032
5862
|
async function removeBudgetItem(budgetItemId) {
|
|
6033
|
-
await confirmLockedBudgetChangeByBudgetItemId(
|
|
6034
|
-
budgetItemId,
|
|
6035
|
-
"Remove budget item"
|
|
6036
|
-
);
|
|
5863
|
+
await confirmLockedBudgetChangeByBudgetItemId(budgetItemId, "Remove budget item");
|
|
6037
5864
|
const result = await api2.budgetItem.removeBudgetItem.mutate({ budgetItemId });
|
|
6038
5865
|
out(result);
|
|
6039
5866
|
}
|
|
@@ -6046,9 +5873,12 @@ var replaceBudgetItem = __name2(async (input) => {
|
|
|
6046
5873
|
await confirmLockedBudgetChangeByBudgetItemId(input.budgetItemId, "Approve unavailable item exception");
|
|
6047
5874
|
const result = await api2.budgetItem.approveUnavailableItemException.mutate(input);
|
|
6048
5875
|
out(result);
|
|
6049
|
-
}, "approveUnavailableItemException"), getBudgetCategories = __name2(
|
|
6050
|
-
|
|
6051
|
-
|
|
5876
|
+
}, "approveUnavailableItemException"), getBudgetCategories = __name2(
|
|
5877
|
+
async (input) => {
|
|
5878
|
+
out(await api2.budget.searchBudgetCategories.query(input));
|
|
5879
|
+
},
|
|
5880
|
+
"getBudgetCategories"
|
|
5881
|
+
), getBudgetVersions = __name2(async (budgetId, options = {}) => {
|
|
6052
5882
|
if (options.all && options.cursor !== void 0) throw new CliRuntimeError("USAGE", "--all cannot be combined with --cursor.");
|
|
6053
5883
|
const versions = [], seenCursors = /* @__PURE__ */ new Set();
|
|
6054
5884
|
let cursor = options.cursor;
|
|
@@ -6061,7 +5891,10 @@ var replaceBudgetItem = __name2(async (input) => {
|
|
|
6061
5891
|
out({ versions, nextCursor: cursor ?? null });
|
|
6062
5892
|
}, "getBudgetVersions");
|
|
6063
5893
|
async function createBudgetApproval(budgetId, preflight) {
|
|
6064
|
-
await assertSensitiveWorkflowConfirmed({ action: "Create budget approval request", entity: "budget ".concat(budgetId), details: "and send approval request emails" }), await confirmLockedBudgetChangeByBudgetId(
|
|
5894
|
+
await assertSensitiveWorkflowConfirmed({ action: "Create budget approval request", entity: "budget ".concat(budgetId), details: "and send approval request emails" }), await confirmLockedBudgetChangeByBudgetId(
|
|
5895
|
+
budgetId,
|
|
5896
|
+
"Create budget approval"
|
|
5897
|
+
), await runBudgetPreflight(budgetId, preflight), await assertBudgetActionReadiness({ budgetId, requireQuickbooksProject: !1, actionLabel: "request approval" });
|
|
6065
5898
|
const result = await api2.budget.createBudgetApproval.mutate({ budgetId }), approvalIds = (result.results ?? []).map((item) => ({ id: item.id }));
|
|
6066
5899
|
let email2;
|
|
6067
5900
|
if (approvalIds.length === 0) email2 = createApprovalEmailDeliveryFailure("No approval ids returned");
|
|
@@ -6097,10 +5930,7 @@ async function createBudgetFromPayload(raw) {
|
|
|
6097
5930
|
try {
|
|
6098
5931
|
result = await api2.budget.createBudget.mutate(input);
|
|
6099
5932
|
} catch (error2) {
|
|
6100
|
-
throw budgetCreateUncertainError(
|
|
6101
|
-
error2,
|
|
6102
|
-
input
|
|
6103
|
-
) || error2;
|
|
5933
|
+
throw budgetCreateUncertainError(error2, input) || error2;
|
|
6104
5934
|
}
|
|
6105
5935
|
out(result);
|
|
6106
5936
|
}
|
|
@@ -6169,11 +5999,14 @@ async function updateBudgetDiscountFromPayload(raw) {
|
|
|
6169
5999
|
out(result);
|
|
6170
6000
|
}
|
|
6171
6001
|
__name(updateBudgetDiscountFromPayload, "updateBudgetDiscountFromPayload"), __name2(updateBudgetDiscountFromPayload, "updateBudgetDiscountFromPayload");
|
|
6172
|
-
var deleteBudgetDiscount = __name2(
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6002
|
+
var deleteBudgetDiscount = __name2(
|
|
6003
|
+
async (budgetId) => {
|
|
6004
|
+
await assertSensitiveWorkflowConfirmed({ action: "Remove budget discount", entity: "budget ".concat(budgetId), details: "and return the budget to DRAFT" });
|
|
6005
|
+
const result = await api2.budget.deleteBudgetDiscount.mutate({ budgetId });
|
|
6006
|
+
out(result);
|
|
6007
|
+
},
|
|
6008
|
+
"deleteBudgetDiscount"
|
|
6009
|
+
), deleteBudgetCommission = __name2(async (budgetId) => {
|
|
6177
6010
|
await assertSensitiveWorkflowConfirmed({ action: "Remove budget commission", entity: "budget ".concat(budgetId), details: "and return the budget to DRAFT" });
|
|
6178
6011
|
const result = await api2.budget.deleteBudgetCommission.mutate({ budgetId });
|
|
6179
6012
|
out(result);
|
|
@@ -6247,7 +6080,10 @@ async function deleteItemCategoriesByIds(ids) {
|
|
|
6247
6080
|
const result = await api2.itemCategory.deleteItemCategories.mutate({ ids });
|
|
6248
6081
|
out(result);
|
|
6249
6082
|
}
|
|
6250
|
-
__name(deleteItemCategoriesByIds, "deleteItemCategoriesByIds"), __name2(
|
|
6083
|
+
__name(deleteItemCategoriesByIds, "deleteItemCategoriesByIds"), __name2(
|
|
6084
|
+
deleteItemCategoriesByIds,
|
|
6085
|
+
"deleteItemCategoriesByIds"
|
|
6086
|
+
);
|
|
6251
6087
|
async function createBillFromPayload(raw, draftOnlyFlag, quotationExempt = !1) {
|
|
6252
6088
|
const input = parseCreateBillPayload(raw, draftOnlyFlag, quotationExempt);
|
|
6253
6089
|
await confirmCurrentCommand({ action: input.draftOnly ? "bill create (draft only)" : "bill create", target: "project ".concat(input.projectId, ", supplier ").concat(input.supplierId), effects: ["state-change", "financial-write", ...input.draftOnly ? [] : ["external-write"], ...input.alreadyPaid ? ["email"] : []], details: input.draftOnly ? "Create a DRAFT bill without approval, email, or QuickBooks writes." : "Uses the caller's normal bill creation workflow; Accounting auto-checks and Admin auto-approves unpaid bills and queues their QuickBooks bill." });
|
|
@@ -6264,10 +6100,7 @@ async function getQuotationDetails(id) {
|
|
|
6264
6100
|
const result = await api2.quotation.getById.query({ id });
|
|
6265
6101
|
out(result);
|
|
6266
6102
|
}
|
|
6267
|
-
__name(getQuotationDetails, "getQuotationDetails"), __name2(
|
|
6268
|
-
getQuotationDetails,
|
|
6269
|
-
"getQuotationDetails"
|
|
6270
|
-
);
|
|
6103
|
+
__name(getQuotationDetails, "getQuotationDetails"), __name2(getQuotationDetails, "getQuotationDetails");
|
|
6271
6104
|
var getQuotationLineItems = __name2(async (input) => {
|
|
6272
6105
|
out(await api2.quotation.getLineItems.query(input));
|
|
6273
6106
|
}, "getQuotationLineItems");
|
|
@@ -6288,10 +6121,7 @@ async function submitQuotation(id, overBudgetOverrideReason) {
|
|
|
6288
6121
|
const result = await api2.quotation.submitForApproval.mutate({ id, overBudgetOverrideReason });
|
|
6289
6122
|
out(result);
|
|
6290
6123
|
}
|
|
6291
|
-
__name(submitQuotation, "submitQuotation"), __name2(
|
|
6292
|
-
submitQuotation,
|
|
6293
|
-
"submitQuotation"
|
|
6294
|
-
);
|
|
6124
|
+
__name(submitQuotation, "submitQuotation"), __name2(submitQuotation, "submitQuotation");
|
|
6295
6125
|
async function downloadQuotationPdf(id, fileRole) {
|
|
6296
6126
|
const result = await api2.quotation.getSignedDownloadUrl.query({ id, fileRole });
|
|
6297
6127
|
out(result);
|
|
@@ -6320,9 +6150,12 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6320
6150
|
out(await api2.customerInvoice.getInvoices.query({ batchId }));
|
|
6321
6151
|
}, "getCustomerInvoiceInvoices"), getCustomerInvoiceLines = __name2(async (input) => {
|
|
6322
6152
|
out(await api2.customerInvoice.getInvoiceLines.query(input));
|
|
6323
|
-
}, "getCustomerInvoiceLines"), getCustomerInvoiceApprovals = __name2(
|
|
6324
|
-
|
|
6325
|
-
|
|
6153
|
+
}, "getCustomerInvoiceLines"), getCustomerInvoiceApprovals = __name2(
|
|
6154
|
+
async (input) => {
|
|
6155
|
+
out(await api2.customerInvoice.getApprovals.query(input));
|
|
6156
|
+
},
|
|
6157
|
+
"getCustomerInvoiceApprovals"
|
|
6158
|
+
), getCustomerInvoiceHistory = __name2(async (input) => {
|
|
6326
6159
|
out(await api2.customerInvoice.getHistory.query(input));
|
|
6327
6160
|
}, "getCustomerInvoiceHistory"), getCustomerInvoicePayments = __name2(async (invoiceId) => {
|
|
6328
6161
|
out(await api2.customerInvoice.getPayments.query({ invoiceId }));
|
|
@@ -6334,9 +6167,7 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6334
6167
|
out(result);
|
|
6335
6168
|
}, "previewQboCustomerInvoice"), importQboCustomerInvoice = __name2(async (input) => {
|
|
6336
6169
|
await confirmCurrentCommand({ action: "Link existing QuickBooks invoice", target: "QuickBooks invoice ".concat(input.qboInvoiceId, " to budget ").concat(input.budgetId), details: "records the reviewed invoice in Budget Builder only; QuickBooks access is read-only; preserves original evidence and revalidates the preview token".concat(input.confirmEstimateLineage ? "; you confirm this invoice, which has no QuickBooks estimate link, belongs to this budget's estimate" : "") });
|
|
6337
|
-
const result = await api2.customerInvoice.linkExistingInvoice.mutate(
|
|
6338
|
-
input
|
|
6339
|
-
);
|
|
6170
|
+
const result = await api2.customerInvoice.linkExistingInvoice.mutate(input);
|
|
6340
6171
|
out(result);
|
|
6341
6172
|
}, "importQboCustomerInvoice"), createCustomerInvoice = __name2(async (raw) => {
|
|
6342
6173
|
const input = parseCreateCustomerInvoicePayload(raw), readiness = await api2.customerInvoice.getInvoiceReadiness.query({ budgetId: input.budgetId, includePreview: !0 });
|
|
@@ -6351,9 +6182,7 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6351
6182
|
const result = await api2.customerInvoice.discardCreatingInvoiceBatch.mutate({ batchId });
|
|
6352
6183
|
out(result);
|
|
6353
6184
|
}, "discardCreatingCustomerInvoice"), deleteCustomerInvoice = __name2(async (batchId) => {
|
|
6354
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6355
|
-
{ action: "Delete customer invoice", entity: "invoice batch ".concat(batchId), details: "queues deletion of its invoices in QuickBooks; the local batch is removed once QuickBooks confirms; paid invoices are blocked until their QBO payments are reversed; removing approved coverage may reopen the estimate" }
|
|
6356
|
-
);
|
|
6185
|
+
await assertSensitiveWorkflowConfirmed({ action: "Delete customer invoice", entity: "invoice batch ".concat(batchId), details: "queues deletion of its invoices in QuickBooks; the local batch is removed once QuickBooks confirms; paid invoices are blocked until their QBO payments are reversed; removing approved coverage may reopen the estimate" });
|
|
6357
6186
|
const result = await api2.customerInvoice.deleteInvoiceBatch.mutate({ batchId });
|
|
6358
6187
|
out(result);
|
|
6359
6188
|
}, "deleteCustomerInvoice"), voidCustomerInvoice = __name2(async (batchId) => {
|
|
@@ -6375,18 +6204,23 @@ var checkCustomerInvoiceReadiness = __name2(async (budgetId) => {
|
|
|
6375
6204
|
await assertSensitiveWorkflowConfirmed({ action: "Sync customer invoice from QuickBooks", entity: "invoice ".concat(invoiceId), details: "refreshes local status, QuickBooks metadata, balance, and history; QBO Paid or a zero balance becomes PAID, a reversed payment restores the delivery or approval status, and a QBO void becomes VOIDED" });
|
|
6376
6205
|
const result = await api2.customerInvoice.syncInvoiceStatus.mutate({ invoiceId });
|
|
6377
6206
|
out(result);
|
|
6378
|
-
}, "syncCustomerInvoice"), updateCustomerInvoiceDetails = __name2(
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6207
|
+
}, "syncCustomerInvoice"), updateCustomerInvoiceDetails = __name2(
|
|
6208
|
+
async ({ billingAddress, customerMemo, invoiceId, requestId = randomUUID2() }) => {
|
|
6209
|
+
await assertSensitiveWorkflowConfirmed({ action: "Update customer invoice billing details", entity: "invoice ".concat(invoiceId), details: "saves the bill-to address and memo in BB, then queues a QuickBooks invoice update (external write); the bill email is managed in QuickBooks and is not changed; retry a lost response with --requestId ".concat(requestId) });
|
|
6210
|
+
const result = await api2.customerInvoice.updateInvoiceDetails.mutate({ billingAddress, customerMemo, invoiceId, requestId });
|
|
6211
|
+
out({ invoices: result.batch.invoices.filter((invoice) => invoice.id === invoiceId), operation: result.operation });
|
|
6212
|
+
},
|
|
6213
|
+
"updateCustomerInvoiceDetails"
|
|
6214
|
+
), updateCustomerInvoiceQboDrift = __name2(async ({ invoiceId, requestId, resolution }) => {
|
|
6383
6215
|
const keepRequestId = resolution === "KEEP_BB" ? requestId ?? randomUUID2() : void 0;
|
|
6384
6216
|
await assertSensitiveWorkflowConfirmed({ action: resolution === "ACCEPT_QBO" ? "Accept QuickBooks invoice changes into BB" : "Keep BB invoice values over QuickBooks changes", entity: "invoice ".concat(invoiceId), details: resolution === "ACCEPT_QBO" ? "copies the held QuickBooks bill-to address, memo, bill email and total into BB; QuickBooks is not changed" : "keeps BB's values; queues BB's bill-to address and memo to QuickBooks (external write); bill email and total are not changed in QuickBooks; retry a lost response with --requestId ".concat(keepRequestId) });
|
|
6385
6217
|
const result = await api2.customerInvoice.resolveQboDrift.mutate({ invoiceId, resolution, ...keepRequestId ? { requestId: keepRequestId } : {} });
|
|
6386
6218
|
out(result);
|
|
6387
6219
|
}, "updateCustomerInvoiceQboDrift"), markCustomerInvoiceSentExternally = __name2(async (input) => {
|
|
6388
6220
|
await assertSensitiveWorkflowConfirmed({ action: "Record customer invoice as sent externally", entity: "invoice ".concat(input.invoiceId), details: "records the invoice as SENT (source EXTERNAL) at ".concat(input.sentAt, " for ").concat(input.recipients.join(", "), "; sends no email and does not write to QuickBooks") });
|
|
6389
|
-
const result = await api2.customerInvoice.markSentExternally.mutate(
|
|
6221
|
+
const result = await api2.customerInvoice.markSentExternally.mutate(
|
|
6222
|
+
input
|
|
6223
|
+
);
|
|
6390
6224
|
out(result);
|
|
6391
6225
|
}, "markCustomerInvoiceSentExternally"), describeCustomerInvoiceEmailConfirmation = __name2((input) => "emails the QBO invoice PDF to ".concat(input.to, " and saves that address as the project's billing email; requested CC ").concat(input.cc === void 0 ? "company billing defaults" : input.cc.length > 0 ? input.cc.join(", ") : "none (company billing defaults removed)", "; reply-to ").concat(input.replyTo, '; subject "').concat(input.subject, '"; server-required admin, creator, business-development, and inside-sales CC recipients are added; success marks the invoice SENT; do not retry blindly after an ambiguous delivery failure'), "describeCustomerInvoiceEmailConfirmation"), sendCustomerInvoiceToContactPersonFromPayload = __name2(async (raw) => {
|
|
6392
6226
|
const input = parseSendCustomerInvoiceToContactPersonPayload(raw);
|
|
@@ -6416,9 +6250,7 @@ async function deleteBillById(id) {
|
|
|
6416
6250
|
__name(deleteBillById, "deleteBillById"), __name2(deleteBillById, "deleteBillById");
|
|
6417
6251
|
async function createSupplierFromPayload(raw) {
|
|
6418
6252
|
const input = parseSupplierCreatePayload(raw);
|
|
6419
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6420
|
-
{ action: "Create supplier and request approval if required", entity: "supplier ".concat(input.name), details: "creates the supplier first; pending-approval suppliers also request approval and send emails" }
|
|
6421
|
-
);
|
|
6253
|
+
await assertSensitiveWorkflowConfirmed({ action: "Create supplier and request approval if required", entity: "supplier ".concat(input.name), details: "creates the supplier first; pending-approval suppliers also request approval and send emails" });
|
|
6422
6254
|
let created;
|
|
6423
6255
|
try {
|
|
6424
6256
|
created = await api2.supplier.createSupplier.mutate(input);
|
|
@@ -6446,11 +6278,7 @@ async function createSupplierFromPayload(raw) {
|
|
|
6446
6278
|
} catch (error2) {
|
|
6447
6279
|
emailResult = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(error2));
|
|
6448
6280
|
}
|
|
6449
|
-
out({ ...created, supplierApproval: {
|
|
6450
|
-
requested: !0,
|
|
6451
|
-
approvalCount: approvalIds.length,
|
|
6452
|
-
email: emailResult
|
|
6453
|
-
} });
|
|
6281
|
+
out({ ...created, supplierApproval: { requested: !0, approvalCount: approvalIds.length, email: emailResult } });
|
|
6454
6282
|
}
|
|
6455
6283
|
__name(createSupplierFromPayload, "createSupplierFromPayload"), __name2(createSupplierFromPayload, "createSupplierFromPayload");
|
|
6456
6284
|
async function updateSupplierFromPayload(raw) {
|
|
@@ -6466,14 +6294,14 @@ async function createItemFromPayload(raw) {
|
|
|
6466
6294
|
}
|
|
6467
6295
|
__name(createItemFromPayload, "createItemFromPayload"), __name2(createItemFromPayload, "createItemFromPayload");
|
|
6468
6296
|
async function updateItemFromPayload(raw) {
|
|
6469
|
-
const input = parseItemUpdatePayload(
|
|
6297
|
+
const input = parseItemUpdatePayload(
|
|
6298
|
+
raw
|
|
6299
|
+
), result = await api2.item.updateItem.mutate(input);
|
|
6470
6300
|
out(result);
|
|
6471
6301
|
}
|
|
6472
6302
|
__name(updateItemFromPayload, "updateItemFromPayload"), __name2(updateItemFromPayload, "updateItemFromPayload");
|
|
6473
6303
|
async function createContactPersonFromPayload(raw) {
|
|
6474
|
-
const input = parseContactCreatePayload(
|
|
6475
|
-
raw
|
|
6476
|
-
), result = await api2.contactPerson.createContactPerson.mutate(input);
|
|
6304
|
+
const input = parseContactCreatePayload(raw), result = await api2.contactPerson.createContactPerson.mutate(input);
|
|
6477
6305
|
out(result);
|
|
6478
6306
|
}
|
|
6479
6307
|
__name(createContactPersonFromPayload, "createContactPersonFromPayload"), __name2(createContactPersonFromPayload, "createContactPersonFromPayload");
|
|
@@ -6506,15 +6334,15 @@ async function approveBudget(budgetId) {
|
|
|
6506
6334
|
const delivery = result.emailDelivery;
|
|
6507
6335
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
6508
6336
|
} catch (error2) {
|
|
6509
|
-
email2 = createApprovalEmailDeliveryFailure(
|
|
6337
|
+
email2 = createApprovalEmailDeliveryFailure(
|
|
6338
|
+
error2 instanceof Error ? error2.message : String(error2)
|
|
6339
|
+
);
|
|
6510
6340
|
}
|
|
6511
6341
|
out({ ...result, email: email2 });
|
|
6512
6342
|
}
|
|
6513
6343
|
__name(approveBudget, "approveBudget"), __name2(approveBudget, "approveBudget");
|
|
6514
6344
|
async function rejectBudget(budgetId, reason) {
|
|
6515
|
-
await assertSensitiveWorkflowConfirmed(
|
|
6516
|
-
{ action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(reason, '" and send requester reply email') }
|
|
6517
|
-
);
|
|
6345
|
+
await assertSensitiveWorkflowConfirmed({ action: "Reject budget", entity: "budget ".concat(budgetId), details: 'with reason "'.concat(reason, '" and send requester reply email') });
|
|
6518
6346
|
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.BUDGET && (n.budgetId === budgetId || n.budget?.id === budgetId))[0];
|
|
6519
6347
|
if (!approval) throw new Error("No pending budget approval found for this budget and approver.");
|
|
6520
6348
|
const result = await api2.budget.updateBudgetApproval.mutate({ budgetApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
@@ -6541,7 +6369,9 @@ async function getSupplierItems(supplierId) {
|
|
|
6541
6369
|
}
|
|
6542
6370
|
__name(getSupplierItems, "getSupplierItems"), __name2(getSupplierItems, "getSupplierItems");
|
|
6543
6371
|
async function getSupplierDetails(supplierId) {
|
|
6544
|
-
const supplier = await api2.supplier.getSupplierById.query({ id: supplierId }), respondedStatuses = /* @__PURE__ */ new Set([ExtendedApprovalStatus.APPROVED, ExtendedApprovalStatus.REJECTED]), latestRespondedApproval = [...supplier.approvals.filter((approval) => respondedStatuses.has(approval.status))].sort((a, b) => new Date(b.respondedAt ?? b.updatedAt).getTime() - new Date(a.respondedAt ?? a.updatedAt).getTime() || new Date(
|
|
6372
|
+
const supplier = await api2.supplier.getSupplierById.query({ id: supplierId }), respondedStatuses = /* @__PURE__ */ new Set([ExtendedApprovalStatus.APPROVED, ExtendedApprovalStatus.REJECTED]), latestRespondedApproval = [...supplier.approvals.filter((approval) => respondedStatuses.has(approval.status))].sort((a, b) => new Date(b.respondedAt ?? b.updatedAt).getTime() - new Date(a.respondedAt ?? a.updatedAt).getTime() || new Date(
|
|
6373
|
+
b.createdAt
|
|
6374
|
+
).getTime() - new Date(a.createdAt).getTime())[0], pendingApprovals = supplier.approvals.filter((approval) => approval.status === ExtendedApprovalStatus.PENDING_APPROVAL), supersededApprovals = supplier.approvals.filter((approval) => approval.status === ExtendedApprovalStatus.SUPERSEDED), respondedByApproval = latestRespondedApproval ?? null, responseUser = respondedByApproval ? respondedByApproval.responder ?? respondedByApproval.approver : null;
|
|
6545
6375
|
out({ ...supplier, supplierApprovalSummary: { pendingApprovalCount: pendingApprovals.length, pendingApprovers: pendingApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, createdAt: approval.createdAt, updatedAt: approval.updatedAt })), supersededApprovalCount: supersededApprovals.length, supersededApprovers: supersededApprovals.map((approval) => ({ approvalId: approval.id, approverId: approval.approverId, name: approval.approver.name, email: approval.approver.email, respondedAt: approval.respondedAt, responder: approval.responder ? { id: approval.responder.id, name: approval.responder.name, email: approval.responder.email } : null })), respondedBy: respondedByApproval && responseUser ? { approvalId: respondedByApproval.id, status: respondedByApproval.status, approverId: respondedByApproval.approverId, responderId: respondedByApproval.responderId, name: responseUser.name, email: responseUser.
|
|
6546
6376
|
email, respondedAt: respondedByApproval.respondedAt, updatedAt: respondedByApproval.updatedAt } : null } });
|
|
6547
6377
|
}
|
|
@@ -6567,11 +6397,7 @@ async function approveSupplier(supplierId) {
|
|
|
6567
6397
|
}
|
|
6568
6398
|
__name(approveSupplier, "approveSupplier"), __name2(approveSupplier, "approveSupplier");
|
|
6569
6399
|
async function rejectSupplier(supplierId, reason) {
|
|
6570
|
-
await assertSensitiveWorkflowConfirmed({
|
|
6571
|
-
action: "Reject supplier",
|
|
6572
|
-
entity: "supplier ".concat(supplierId),
|
|
6573
|
-
details: 'with reason "'.concat(reason, '" and send requester reply email')
|
|
6574
|
-
});
|
|
6400
|
+
await assertSensitiveWorkflowConfirmed({ action: "Reject supplier", entity: "supplier ".concat(supplierId), details: 'with reason "'.concat(reason, '" and send requester reply email') });
|
|
6575
6401
|
const approval = (await getAllPendingApprovals()).filter((n) => n.notificationType === "request" && n.status === ExtendedApprovalStatus.PENDING_APPROVAL && n.type === ExtendedApprovalType.SUPPLIER && (n.supplierId === supplierId || n.supplier?.id === supplierId))[0];
|
|
6576
6402
|
if (!approval) throw new Error("No pending supplier approval found.");
|
|
6577
6403
|
const result = await api2.supplier.updateSupplierApproval.mutate({ supplierApprovalId: approval.id, status: ExtendedApprovalStatus.REJECTED, rejectionReason: reason });
|
|
@@ -6580,7 +6406,9 @@ async function rejectSupplier(supplierId, reason) {
|
|
|
6580
6406
|
const delivery = result.emailDelivery;
|
|
6581
6407
|
email2 = createApprovalEmailDeliveryReport(delivery);
|
|
6582
6408
|
} catch (error2) {
|
|
6583
|
-
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(
|
|
6409
|
+
email2 = createApprovalEmailDeliveryFailure(error2 instanceof Error ? error2.message : String(
|
|
6410
|
+
error2
|
|
6411
|
+
));
|
|
6584
6412
|
}
|
|
6585
6413
|
out({ ...result, email: email2 });
|
|
6586
6414
|
}
|
|
@@ -6620,13 +6448,10 @@ async function rejectQuotation(quotationId, reason) {
|
|
|
6620
6448
|
out(result);
|
|
6621
6449
|
}
|
|
6622
6450
|
__name(rejectQuotation, "rejectQuotation"), __name2(rejectQuotation, "rejectQuotation");
|
|
6623
|
-
var listCompanies = __name2(
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
},
|
|
6628
|
-
"listCompanies"
|
|
6629
|
-
), countCompanies = __name2(async (input) => {
|
|
6451
|
+
var listCompanies = __name2(async (input) => {
|
|
6452
|
+
const result = await api2.company.getCompanies.query(input);
|
|
6453
|
+
out(result);
|
|
6454
|
+
}, "listCompanies"), countCompanies = __name2(async (input) => {
|
|
6630
6455
|
const result = await api2.company.getCompanyCounts.query(input);
|
|
6631
6456
|
out(result);
|
|
6632
6457
|
}, "countCompanies");
|
|
@@ -6673,9 +6498,7 @@ var getProjectHubStatus = __name2(async (projectId) => {
|
|
|
6673
6498
|
out(result);
|
|
6674
6499
|
}, "syncProjectHubCommercialDocuments");
|
|
6675
6500
|
async function createProject(opts) {
|
|
6676
|
-
const name = parseQuickBooksName(opts.name), asanaTaskId = await resolveCreateProjectAsanaTaskId({ name, asanaTaskId: opts.asanaTaskId, asanaSearch: opts.asanaSearch }), result = await api2.project.createProject.mutate({ name, description: opts.description, companyId: opts.companyId, contactPersonId: opts.contactPersonId, insideSalesId: opts.insideSalesId, businessDevelopmentId: opts.businessDevelopmentId, projectManagerId: opts.projectManagerId, venue: opts.venue, pax: opts.pax, asanaTaskId, dateRange: { from: new Date(
|
|
6677
|
-
opts.startDate
|
|
6678
|
-
), to: opts.endDate ? new Date(opts.endDate) : void 0 } });
|
|
6501
|
+
const name = parseQuickBooksName(opts.name), asanaTaskId = await resolveCreateProjectAsanaTaskId({ name, asanaTaskId: opts.asanaTaskId, asanaSearch: opts.asanaSearch }), result = await api2.project.createProject.mutate({ name, description: opts.description, companyId: opts.companyId, contactPersonId: opts.contactPersonId, insideSalesId: opts.insideSalesId, businessDevelopmentId: opts.businessDevelopmentId, projectManagerId: opts.projectManagerId, venue: opts.venue, pax: opts.pax, asanaTaskId, dateRange: { from: new Date(opts.startDate), to: opts.endDate ? new Date(opts.endDate) : void 0 } });
|
|
6679
6502
|
out(result);
|
|
6680
6503
|
}
|
|
6681
6504
|
__name(createProject, "createProject"), __name2(createProject, "createProject");
|
|
@@ -6730,7 +6553,9 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6730
6553
|
const result = await api2.integration.listOperations.query(input);
|
|
6731
6554
|
out(result);
|
|
6732
6555
|
}, "listIntegrationOperations"), getIntegrationOperation = __name2(async (operationId) => {
|
|
6733
|
-
const result = await api2.integration.getOperation.query(
|
|
6556
|
+
const result = await api2.integration.getOperation.query(
|
|
6557
|
+
{ operationId }
|
|
6558
|
+
);
|
|
6734
6559
|
out(result);
|
|
6735
6560
|
}, "getIntegrationOperation"), countIntegrationOperations = __name2(async (input) => {
|
|
6736
6561
|
out(await api2.integration.getCounts.query(input));
|
|
@@ -6739,11 +6564,7 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6739
6564
|
const result = await api2.integration.retryOperation.mutate({ operationId, confirmExternalStateReconciled, outboundEmailResolution, providerMessageId });
|
|
6740
6565
|
out(result);
|
|
6741
6566
|
}, "retryIntegrationOperation"), reconcileResourceOperation = __name2(async (operationId) => {
|
|
6742
|
-
await assertSensitiveWorkflowConfirmed({
|
|
6743
|
-
action: "Verify QuickBooks resource outcome",
|
|
6744
|
-
entity: "operation ".concat(operationId),
|
|
6745
|
-
details: "verify the saved receipt or read QuickBooks when the attempt is uncertain, then queue local update/archive/reactivation finalization without repeating the provider mutation"
|
|
6746
|
-
});
|
|
6567
|
+
await assertSensitiveWorkflowConfirmed({ action: "Verify QuickBooks resource outcome", entity: "operation ".concat(operationId), details: "verify the saved receipt or read QuickBooks when the attempt is uncertain, then queue local update/archive/reactivation finalization without repeating the provider mutation" });
|
|
6747
6568
|
const result = await api2.integration.reconcileResourceOperation.mutate({ operationId });
|
|
6748
6569
|
out(result);
|
|
6749
6570
|
}, "reconcileResourceOperation"), listInboundSources = __name2(async (input) => {
|
|
@@ -6752,10 +6573,13 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6752
6573
|
}, "listInboundSources"), countInboundSources = __name2(async (input) => {
|
|
6753
6574
|
const result = await api2.inbound.countSources.query(input);
|
|
6754
6575
|
out(result);
|
|
6755
|
-
}, "countInboundSources"), createInboundSource = __name2(
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6576
|
+
}, "countInboundSources"), createInboundSource = __name2(
|
|
6577
|
+
async (input) => {
|
|
6578
|
+
const result = await api2.inbound.createSource.mutate(input);
|
|
6579
|
+
out(result);
|
|
6580
|
+
},
|
|
6581
|
+
"createInboundSource"
|
|
6582
|
+
), getInboundSource = __name2(async (sourceId) => {
|
|
6759
6583
|
const result = await api2.inbound.getSource.query({ sourceId });
|
|
6760
6584
|
out(result);
|
|
6761
6585
|
}, "getInboundSource"), updateInboundSource = __name2(async (sourceId, name) => {
|
|
@@ -6769,19 +6593,19 @@ var checkProjectReconciliation = __name2(async (projectId) => {
|
|
|
6769
6593
|
}, "countInboundSubmissions"), getInboundSubmission = __name2(async (submissionId) => {
|
|
6770
6594
|
const result = await api2.inbound.getSubmission.query({ submissionId });
|
|
6771
6595
|
out(result);
|
|
6772
|
-
}, "getInboundSubmission"), saveInboundMappingVersion = __name2(
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
}, "saveInboundMappingVersion"), saveInboundAutomationConfig = __name2(async (input) => {
|
|
6776
|
-
const result = await api2.inbound.saveAutomationConfig.mutate(input);
|
|
6777
|
-
out(result);
|
|
6778
|
-
}, "saveInboundAutomationConfig"), updateInboundProcessing = __name2(
|
|
6779
|
-
async (input) => {
|
|
6780
|
-
const result = await api2.inbound.updateProcessing.mutate(input);
|
|
6596
|
+
}, "getInboundSubmission"), saveInboundMappingVersion = __name2(
|
|
6597
|
+
async (sourceId, mappings) => {
|
|
6598
|
+
const source = await api2.inbound.getSource.query({ sourceId }), result = await api2.inbound.saveMappingVersion.mutate({ expectedActiveMappingVersion: source.activeMappingVersion, mappings, sourceId });
|
|
6781
6599
|
out(result);
|
|
6782
6600
|
},
|
|
6783
|
-
"
|
|
6784
|
-
)
|
|
6601
|
+
"saveInboundMappingVersion"
|
|
6602
|
+
), saveInboundAutomationConfig = __name2(async (input) => {
|
|
6603
|
+
const result = await api2.inbound.saveAutomationConfig.mutate(input);
|
|
6604
|
+
out(result);
|
|
6605
|
+
}, "saveInboundAutomationConfig"), updateInboundProcessing = __name2(async (input) => {
|
|
6606
|
+
const result = await api2.inbound.updateProcessing.mutate(input);
|
|
6607
|
+
out(result);
|
|
6608
|
+
}, "updateInboundProcessing");
|
|
6785
6609
|
async function listContacts(companyId) {
|
|
6786
6610
|
const contacts = await api2.contactPerson.getContactPersonByCompanyId.query({ companyId });
|
|
6787
6611
|
out(contacts);
|
|
@@ -6800,14 +6624,15 @@ __name(getItem, "getItem"), __name2(getItem, "getItem");
|
|
|
6800
6624
|
var getItemQuickBooksSyncStatus = __name2(async (itemId) => {
|
|
6801
6625
|
const result = await api2.item.getQuickBooksSyncStatus.query({ id: itemId });
|
|
6802
6626
|
out(result);
|
|
6803
|
-
}, "getItemQuickBooksSyncStatus"), listItemCategories = __name2(
|
|
6804
|
-
|
|
6805
|
-
|
|
6627
|
+
}, "getItemQuickBooksSyncStatus"), listItemCategories = __name2(
|
|
6628
|
+
async (input) => {
|
|
6629
|
+
out(await api2.itemCategory.getItemCategories.query(input));
|
|
6630
|
+
},
|
|
6631
|
+
"listItemCategories"
|
|
6632
|
+
), countItemCategories = __name2(async (input) => {
|
|
6806
6633
|
out(await api2.itemCategory.getCounts.query(input));
|
|
6807
6634
|
}, "countItemCategories"), getSupplierAnalytics = __name2(async (input) => {
|
|
6808
|
-
out(await api2.dashboard.getSupplierTableData.query(
|
|
6809
|
-
input
|
|
6810
|
-
));
|
|
6635
|
+
out(await api2.dashboard.getSupplierTableData.query(input));
|
|
6811
6636
|
}, "getSupplierAnalytics"), countSupplierAnalytics = __name2(async (input) => {
|
|
6812
6637
|
out(await api2.dashboard.getSupplierTableCounts.query(input));
|
|
6813
6638
|
}, "countSupplierAnalytics");
|
|
@@ -6827,7 +6652,9 @@ async function listApiKeysForUser(input) {
|
|
|
6827
6652
|
}
|
|
6828
6653
|
__name(listApiKeysForUser, "listApiKeysForUser"), __name2(listApiKeysForUser, "listApiKeysForUser");
|
|
6829
6654
|
async function revokeApiKeyForUser(input) {
|
|
6830
|
-
const result = await api2.mcpApiKey.revoke.mutate(
|
|
6655
|
+
const result = await api2.mcpApiKey.revoke.mutate(
|
|
6656
|
+
input
|
|
6657
|
+
);
|
|
6831
6658
|
out(result);
|
|
6832
6659
|
}
|
|
6833
6660
|
__name(revokeApiKeyForUser, "revokeApiKeyForUser"), __name2(revokeApiKeyForUser, "revokeApiKeyForUser");
|
|
@@ -6875,12 +6702,9 @@ var getRecentErrors = __name2(async (input) => {
|
|
|
6875
6702
|
out(await api2.errorLog.getRecentErrors.query(input));
|
|
6876
6703
|
}, "getRecentErrors"), getError = __name2(async (errorId) => {
|
|
6877
6704
|
out(await api2.errorLog.getErrorById.query({ errorId }));
|
|
6878
|
-
}, "getError"), countErrors = __name2(
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
},
|
|
6882
|
-
"countErrors"
|
|
6883
|
-
);
|
|
6705
|
+
}, "getError"), countErrors = __name2(async (input) => {
|
|
6706
|
+
out(await api2.errorLog.countErrors.query(input));
|
|
6707
|
+
}, "countErrors");
|
|
6884
6708
|
async function getErrorMetrics() {
|
|
6885
6709
|
const result = await api2.errorLog.getErrorMetrics.query({});
|
|
6886
6710
|
out(result);
|
|
@@ -6991,96 +6815,194 @@ mitted", example: '[{"canonicalField":"CONTACT_FIRST_NAME","typeformFieldId":"<t
|
|
|
6991
6815
|
tionId":"<asana-won-id>","asanaLostSectionId":"<asana-lost-id>","googleCalendarId":"team@example.com","googleCalendarTimeZone":"Asia/Singapore","goshBriefBaseUrl":"https://example.com/brief"}' } }, formatPayloadHelp = __name2((command) => {
|
|
6992
6816
|
const help = payloadHelp[command];
|
|
6993
6817
|
return help ? ["Payload fields (--payload JSON)", " Required: ".concat(help.required), " Optional: ".concat(help.optional), " Example: bb ".concat(command).concat(command === "link-bill-quotations" ? " <billId>" : command.startsWith("save-inbound-") ? " <sourceId>" : "", " --payload '").concat(help.example, "'"), ""] : [];
|
|
6994
|
-
}, "formatPayloadHelp"), globalCommandOptions = [{ name: "--help", description: "Show help for this command." }, { name: "--quiet", description: "Suppress non-error diagnostics." }, { name: "--debug", description: "Emit sanitized diagnostic traces." }, { name: "--api-url", description: "Override the Budget Builder API base URL." }, { name: "--no-browser", description: "Print the authorization URL without opening a browser." }, { name: "--allow-state-change", description: "Allow a Budget Builder state change in non-interactive use." }, { name: "--allow-email", description: "Allow sending email in non-interactive use." }, { name: "--allow-external-write", description: "Allow writes to external systems in non-interactive use." }, { name: "--allow-delete", description: "Allow deleting data in non-interactive use." }, { name: "--allow-financial-write", description: "Allow financial-record changes in non-interactive use." }], mutationPrefixes = [
|
|
6995
|
-
|
|
6996
|
-
"
|
|
6818
|
+
}, "formatPayloadHelp"), globalCommandOptions = [{ name: "--help", description: "Show help for this command." }, { name: "--quiet", description: "Suppress non-error diagnostics." }, { name: "--debug", description: "Emit sanitized diagnostic traces." }, { name: "--api-url", description: "Override the Budget Builder API base URL." }, { name: "--no-browser", description: "Print the authorization URL without opening a browser." }, { name: "--allow-state-change", description: "Allow a Budget Builder state change in non-interactive use." }, { name: "--allow-email", description: "Allow sending email in non-interactive use." }, { name: "--allow-external-write", description: "Allow writes to external systems in non-interactive use." }, { name: "--allow-delete", description: "Allow deleting data in non-interactive use." }, { name: "--allow-financial-write", description: "Allow financial-record changes in non-interactive use." }], mutationPrefixes = [
|
|
6819
|
+
"add-",
|
|
6820
|
+
"approve-",
|
|
6821
|
+
"archive-",
|
|
6822
|
+
"attach-",
|
|
6823
|
+
"cleanup-",
|
|
6824
|
+
"complete-",
|
|
6825
|
+
"create-",
|
|
6826
|
+
"delete-",
|
|
6827
|
+
"discard-",
|
|
6828
|
+
"import-",
|
|
6829
|
+
"link-",
|
|
6830
|
+
"mark-",
|
|
6831
|
+
"patch-",
|
|
6832
|
+
"reactivate-",
|
|
6833
|
+
"reconcile-",
|
|
6834
|
+
"record-",
|
|
6835
|
+
"refresh-",
|
|
6836
|
+
"reject-",
|
|
6837
|
+
"remove-",
|
|
6838
|
+
"replace-",
|
|
6839
|
+
"rename-",
|
|
6840
|
+
"reorder-",
|
|
6841
|
+
"restore-",
|
|
6842
|
+
"retry-",
|
|
6843
|
+
"revoke-",
|
|
6844
|
+
"save-",
|
|
6845
|
+
"send-",
|
|
6846
|
+
"stage-",
|
|
6847
|
+
"setup-",
|
|
6848
|
+
"submit-",
|
|
6849
|
+
"sync-",
|
|
6850
|
+
"update-",
|
|
6851
|
+
"use-existing-",
|
|
6852
|
+
"upload-",
|
|
6853
|
+
"void-"
|
|
6854
|
+
], emailTargets = /* @__PURE__ */ new Set(["approve-bill", "approve-budget", "approve-customer-invoice", "approve-supplier", "create-bill", "create-bill-approval", "create-budget-approval", "create-customer-invoice", "create-supplier", "reject-bill", "reject-budget", "reject-customer-invoice", "reject-supplier", "send-estimate-email", "send-estimate-to-contact-person", "send-customer-invoice-to-contact-person", "update-bill-status", "update-supplier"]), externalWriteTargets = /* @__PURE__ */ new Set(["update-customer-invoice-details", "update-customer-invoice-qbo-drift", "record-external-bill-payment", "approve-bill", "approve-customer-invoice", "approve-supplier", "complete-project", "create-bill", "create-company", "use-existing-company", "create-estimate", "create-placeholder-bill", "create-customer-invoice", "create-item", "create-item-category", "create-project", "create-supplier", "delete-bill", "delete-budget", "delete-company", "delete-customer-invoice", "delete-item", "delete-\
|
|
6855
|
+
project", "delete-suppliers", "discard-customer-invoice", "import-qbo-project", "mark-budget-items-not-utilized", "mark-budget-won", "reconcile-project", "reject-customer-invoice", "reactivate-suppliers", "restore-budget-item", "restore-budget-version", "retry-integration-operation", "setup-project-hub", "sync-project-hub-commercial-documents", "sync-customer-invoice", "update-bill", "update-budget-status", "update-company", "update-item", "update-item-category", "update-project", "update-project-status", "update-supplier", "void-customer-invoice"]), financialWriteTargets = /* @__PURE__ */ new Set([
|
|
6997
6856
|
"update-customer-invoice-qbo-drift",
|
|
6998
6857
|
"record-external-bill-payment",
|
|
6858
|
+
"import-qbo-customer-invoice",
|
|
6859
|
+
"link-bill-quotations",
|
|
6999
6860
|
"approve-bill",
|
|
7000
6861
|
"approve-customer-invoice",
|
|
7001
|
-
"approve-supplier",
|
|
7002
6862
|
"complete-project",
|
|
7003
6863
|
"create-bill",
|
|
7004
|
-
"create-
|
|
7005
|
-
"use-existing-company",
|
|
6864
|
+
"create-customer-invoice",
|
|
7006
6865
|
"create-estimate",
|
|
7007
6866
|
"create-placeholder-bill",
|
|
7008
|
-
"
|
|
7009
|
-
"
|
|
7010
|
-
"create-item-category",
|
|
7011
|
-
"create-project",
|
|
7012
|
-
"create-supplier",
|
|
6867
|
+
"delete-budget-commission",
|
|
6868
|
+
"delete-budget-discount",
|
|
7013
6869
|
"delete-bill",
|
|
7014
6870
|
"delete-budget",
|
|
7015
|
-
"delete-company",
|
|
7016
6871
|
"delete-customer-invoice",
|
|
7017
|
-
"delete-item",
|
|
7018
|
-
"delete-project",
|
|
7019
|
-
"delete-suppliers",
|
|
7020
|
-
"discard-customer-invoice",
|
|
7021
|
-
"import-qbo-project",
|
|
7022
6872
|
"mark-budget-items-not-utilized",
|
|
7023
6873
|
"mark-budget-won",
|
|
7024
|
-
"
|
|
6874
|
+
"mark-customer-invoice-sent-externally",
|
|
6875
|
+
"patch-bill-payment",
|
|
7025
6876
|
"reject-customer-invoice",
|
|
7026
|
-
"reactivate-suppliers",
|
|
7027
6877
|
"restore-budget-item",
|
|
7028
6878
|
"restore-budget-version",
|
|
7029
|
-
"
|
|
7030
|
-
"setup-project-hub",
|
|
7031
|
-
"sync-project-hub-commercial-documents",
|
|
6879
|
+
"replace-budget-item",
|
|
7032
6880
|
"sync-customer-invoice",
|
|
7033
6881
|
"update-bill",
|
|
6882
|
+
"update-bill-payment-evidence",
|
|
6883
|
+
"update-bill-status",
|
|
6884
|
+
"update-budget-commission",
|
|
6885
|
+
"update-budget-discount",
|
|
7034
6886
|
"update-budget-status",
|
|
7035
|
-
"update-company",
|
|
7036
|
-
"update-item",
|
|
7037
|
-
"update-item-category",
|
|
7038
|
-
"update-project",
|
|
7039
6887
|
"update-project-status",
|
|
7040
|
-
"update-supplier",
|
|
7041
6888
|
"void-customer-invoice"
|
|
7042
|
-
]),
|
|
7043
|
-
|
|
6889
|
+
]), deleteTargets = /* @__PURE__ */ new Set(["cleanup-staged-bill-attachments", "delete-webhook-endpoint", "cleanup-staged-quotation-attachments", "discard-customer-invoice", "complete-project", "mark-budget-items-not-utilized", "remove-budget-item", "restore-budget-version", "update-project-status"]), explicitEffects = { "resubmit-customer-invoice": [
|
|
6890
|
+
"state-change",
|
|
6891
|
+
"external-write",
|
|
6892
|
+
"financial-write",
|
|
6893
|
+
"email"
|
|
6894
|
+
], "request-bill-review": ["state-change", "external-write"], "rotate-webhook-secret": ["state-change"], "replay-webhook-delivery": ["state-change", "external-write"] }, effectsFor = __name2((legacyTarget) => {
|
|
7044
6895
|
const explicit = explicitEffects[legacyTarget];
|
|
7045
6896
|
if (explicit) return explicit;
|
|
7046
6897
|
const effects = /* @__PURE__ */ new Set();
|
|
7047
|
-
return mutationPrefixes.some((prefix) => legacyTarget.startsWith(
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
"
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
["
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
"
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
6898
|
+
return mutationPrefixes.some((prefix) => legacyTarget.startsWith(prefix)) && effects.add("state-change"), (legacyTarget.startsWith("delete-") || deleteTargets.has(legacyTarget)) && effects.add("delete"), emailTargets.has(legacyTarget) && effects.add("email"), externalWriteTargets.has(legacyTarget) && effects.add("external-write"), financialWriteTargets.has(legacyTarget) && effects.add("financial-write"), [...effects];
|
|
6899
|
+
}, "effectsFor"), titleCase = __name2((value) => value.split("-").map((word) => "".concat(word.slice(0, 1).toUpperCase()).concat(word.slice(1))).join(" "), "titleCase"), SUMMARIES = /* @__PURE__ */ new Map([
|
|
6900
|
+
["update-budget-status", "Update budget status. APPROVED requires a current Lead/Admin role; budget management permission alone is insufficient. Ordinary users must request approval. Status changes invalidate old pending requests."],
|
|
6901
|
+
["approve-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."],
|
|
6902
|
+
["reject-budget", "Decide your assigned pending budget approval as a current Lead/Admin. Material edits supersede old requests; inspect the latest content and use a fresh request after edits."],
|
|
6903
|
+
["create-budget-approval", "Request budget approval for the current content, superseding older pending requests. Existing Lead/Admin autoapproval remains available."],
|
|
6904
|
+
["update-budget-item-supplier", "Change a budget item's eligible supplier/GST snapshot as a material financial edit. Supersede pending approvals and apply the standard budget-to-DRAFT reset policy; inspect and request approval again. An unchanged supplier is a no-op."],
|
|
6905
|
+
["submit-quotation", "Submit a quotation for signing and approval. Claim the captured revision and exact allocation selection; concurrent edits, budget-item deletion or restore cascades conflict instead of attaching old signed PDFs. Refresh and resubmit the current content. The signed PDF is stamped by a queued job (pdfProcessing: PROCESSING until linked); a file whose PDF conversion failed must be uploaded again first. The result includes gstMismatch (null, or the basis, expected GST, saved GST and their difference; see create-quotation); it is a warning only and the approval email shows it to approvers."],
|
|
6906
|
+
["approve-quotation", "Approve your assigned pending quotation as a current Admin. Claim the captured revision and exact allocation selection after signing; concurrent changes conflict and roll back the decision, signed-PDF job and email/outbox. Refresh and review the current content before retrying. The final signed PDF is stamped by a queued job (pdfProcessing); a stopped earlier PDF step blocks approval until it is retried."],
|
|
6907
|
+
["approve-supplier", "Approve a pending supplier request and send a requester reply email, or directly re-approve a rejected supplier as Admin/Lead without a pending request or email. The QuickBooks vendor is created, linked or updated by a queued job (quickBooksSyncQueued, operationId); the supplier stays PENDING_APPROVAL until QuickBooks confirms, and archived suppliers remain archived. Argument: <supplierId>."],
|
|
6908
|
+
["list-approvals", "List one page of requests currently assigned to you and pending approval, oldest first. Returns { items, pageInfo }; follow nextCursor with unchanged --type. --page/--perPage are rejected."],
|
|
6909
|
+
["get-pending-approval", "Read one request still pending your approval, or null if it is no longer pending/assigned. Argument: <approvalId>."],
|
|
6910
|
+
["get-bill-review", "Read current advisory AI bill review and evidence. Passive; no provider calls. Argument: <billId>."],
|
|
6911
|
+
["request-bill-review", "Queue an advisory AI review of a bill pending your approval. No financial decision is made. <billId> [--requestId <id>]"],
|
|
6912
|
+
["get-bill-details", "Get a bill's summary as shown in the web app: status, amounts, people, payment and line totals. Use get-bill-line-items, get-bill-approvals, get-bill-attachments or get-bill-payment for more detail. Argument: <billId>."],
|
|
6913
|
+
["get-bill-line-items", "List a bill's line items with budget-item and quotation-allocation detail. <billId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6914
|
+
["get-bill-approvals", "List a bill's approval requests with approver, requester and responder. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6915
|
+
["get-bill-payment", "Get a bill's payment status, reference, date, tracking URL, QuickBooks link and external payment. Argument: <billId>."],
|
|
6916
|
+
["get-quotation", "Get a quotation as shown in the web app: status, documentOnly (true for a $0 supplier document that is never a bill quotation source and does not count as coverage), amounts, people, line totals, files and approvals. pdfProcessing is { status: PROCESSING | FAILED, step: NORMALIZE | STAMP, operationId, error } while a queued PDF conversion or signing step has not linked its PDF, else null. gstMismatch is null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when the saved GST is non-zero and more than $0.05 away from the expected GST (TAXABLE_LINES: the bill calculation for the quoted lines; FULL_SUBTOTAL: 9% of the subtotal); check it before approving. Use get-quotation-line-items for budget-item detail. Argument: <quotationId>."],
|
|
6917
|
+
["get-customer-invoice", "Get an invoice batch as shown in the web app: status, totals, people, approvals and invoice summaries. Use get-customer-invoice-invoices, get-customer-invoice-lines, get-customer-invoice-approvals or get-customer-invoice-history for more detail. Argument: <batchId>."],
|
|
6918
|
+
["get-customer-invoice-invoices", "List a batch's invoices with QuickBooks id/doc number, issue/due dates, amounts, sync state and sender. Argument: <batchId>."],
|
|
6919
|
+
["get-customer-invoice-lines", "List one invoice's lines (name, description, QuickBooks item/tax code, quantity, amounts). <invoiceId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6920
|
+
["get-customer-invoice-approvals", "List an invoice batch's approval requests with approver, requester and responder. <batchId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6921
|
+
["get-customer-invoice-history", "List an invoice batch's status history (batch/invoice status changes, source, note, actor). <batchId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6922
|
+
["get-customer-invoice-payments", "List the payments QuickBooks applied to one invoice: payment id, date, reference, amount applied, total and attachment names. Argument: <invoiceId> (from get-customer-invoice-invoices). Live QuickBooks read."],
|
|
6923
|
+
["get-quotation-line-items", "List a quotation's line items with budget-item, supplier and budget detail. <quotationId> [--limit 1-100] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6924
|
+
["get-bill-attachments", "List bill attachments with cursor pagination. <billId> [--limit 1-50] [--cursor <token>] Newest first. Returns { items, pageInfo }; follow nextCursor."],
|
|
6925
|
+
["get-budget-categories", "List budget categories with cursor pagination. [--q] [--limit 1-100] [--cursor <token>] Active categories, name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q."],
|
|
6926
|
+
["get-supplier-overview", "Get a supplier's profile, approvals, pending update, attachments and tab counts (usageCount, _count.items). Skips usage rows, spending and items; use get-supplier-usage or get-supplier-items for those."],
|
|
6927
|
+
["get-supplier-usage", "Get a supplier's usage rows (accepted/closed budget lines and lines with its actual spending) plus spending, actualSpending and estimatedSpending."],
|
|
6928
|
+
[
|
|
6929
|
+
"get-supplier-items",
|
|
6930
|
+
"Get the inventory items catalogued under a supplier."
|
|
6931
|
+
],
|
|
6932
|
+
["get-supplier-analytics", "List supplier analytics rows with cursor pagination. [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected."],
|
|
6933
|
+
["list-api-keys", "List API keys with cursor pagination. [--userId <userId>] [--limit 1-100] [--cursor <token>] (newest first, { items, pageInfo }; defaults to the caller; admin required for another user)"],
|
|
6934
|
+
["list-claims", "List reimbursable claims with cursor pagination. Same flags as list-bills (--limit 1-100, --cursor, --direction forward|backward); ignores --isClaimable. Returns { items, pageInfo }."],
|
|
6935
|
+
["list-bills", "List bills with cursor pagination. [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--sortBy createdAt|amount|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; pass nextCursor with --direction forward or previousCursor with --direction backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected."],
|
|
6936
|
+
["list-customer-invoices", "List customer invoice batches with cursor pagination. [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected. No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds."],
|
|
6937
|
+
["list-quotations", "List quotations with cursor pagination. [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward] Newest first; returns { items, pageInfo }; each row carries documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy."],
|
|
6938
|
+
["list-users", "List users with cursor pagination. [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>] Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager. --page/--perPage are rejected."],
|
|
6939
|
+
["list-companies", "List companies with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."],
|
|
6940
|
+
["count-companies", "Count companies independently from list pagination. Returns { totalCount, counts: { active: { true, false } } }; accepts filters only and rejects pagination/sorting flags."],
|
|
6941
|
+
["list-projects", "List projects with cursor pagination. Returns { items, pageInfo }; default sort is createdAt descending with limit 20. Supports legacy --status plus optional --statuses, WON-date filters (--wonFrom, --wonTo, --wonWithinDays) and --sortBy wonAt; pass nextCursor forward or previousCursor backward unchanged. Legacy page/perPage flags are rejected."],
|
|
6942
|
+
["count-projects", "Count projects independently from list pagination. Returns { totalCount, counts: { status, active: { true, false } } }; accepts project filters only and rejects pagination/sorting flags."],
|
|
6943
|
+
["search-existing-companies", "Search BB and QuickBooks companies without writes. --query <name> [--limit 1-50] [--cursor <token>]. Returns { items, totalCount, pageInfo }; follow pageInfo.nextCursor with the same --query. Legacy --page is rejected."],
|
|
6944
|
+
["use-existing-company", "Reuse a company in BB and QuickBooks, creating only its missing counterpart. Supply --companyId <bbId> and/or --quickbooksId <qboId>; both explicitly connect records with different names. Importing a QuickBooks-only company also needs --name <QuickBooks name from search-existing-companies>. --website <url> fills a missing QBO import website only. --confirmDistinct true confirms no similar record represents this entity. BB saves the company now; its QuickBooks customer is checked, found or created and linked by a queued job (quickBooksSyncQueued, operationId). Estimates, invoices and QuickBooks projects wait for that link."],
|
|
6945
|
+
["create-company", "Create or reuse a company in BB and QuickBooks. --name <name> --website <url> [--billingEmails '<json-array>'] (up to 50 invoice Cc defaults, stored in BB only for new companies; reused company defaults are preserved). Similar names require --confirmDistinct true; inactive companies are never reactivated. BB saves the company now; its QuickBooks customer is found or created by a queued job (quickBooksSyncQueued, operationId), which stops if similar QuickBooks customers exist without --confirmDistinct."],
|
|
6946
|
+
["create-project", "Create a project linked to an existing Asana Deals lead task. Supply --asanaTaskId in non-interactive use; interactive use searches for and selects a lead task (optionally --asanaSearch). For a new direct client, create the lead task using the website form first."],
|
|
6947
|
+
["create-supplier", "Create a supplier using --payload JSON; pending-approval suppliers also request approval and send emails. Reusing an archived name requires Admin; normal users and Leads must ask an Admin to reactivate it before editing. Recreation preserves the existing approval status and creator. Lead/Admin-created suppliers (and archived-name revivals) queue their QuickBooks vendor create or link (quickBooksSyncQueued, operationId) and become usable once QuickBooks confirms; the request makes no QuickBooks call."],
|
|
6948
|
+
["preview-qbo-customer-invoice", "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId> [--confirmEstimateLineage true]. Use --confirmEstimateLineage only after confirming an invoice with no QuickBooks estimate link belongs to this budget's estimate."],
|
|
6949
|
+
["preview-customer-invoice-amount", "Preview amount before GST, GST, and total for a percentage of an accepted estimate. Arguments: <budgetId> <percentage-of-estimate>."],
|
|
6950
|
+
["list-available-qbo-customer-invoices", "List unlinked QuickBooks invoices available for an accepted or closed estimate. Argument: <budgetId>."],
|
|
6951
|
+
["resubmit-customer-invoice", "Resubmit a confirmed expired-and-voided BB invoice as its original requester. Argument: <batchId>. Queues one replacement using the current estimate, original percentage, due date and details; retries return the same replacement. No customer email."],
|
|
6952
|
+
["create-customer-invoice", "Create one invoice from an eligible budget using --payload JSON with invoice date, due date, billing address, customer memo, and a percentage of the original estimate that does not exceed its remaining coverage."],
|
|
6953
|
+
["import-qbo-customer-invoice", "Link an existing QuickBooks invoice in BB only after reviewing preview-qbo. Arguments: <budgetId> <qboInvoiceId> --token <previewToken> [--confirmEstimateLineage true] (repeat the preview's flag). Supports closed estimates; no QBO writes or emails."],
|
|
6954
|
+
["whoami", "Show the active API-key identity."],
|
|
6955
|
+
["list-budgets", "List one cursor page of budgets ({ items, pageInfo }; --limit/--cursor/--direction). Omit --active for active budgets only; use --active false or --active all for Admin-only historical reads."],
|
|
6956
|
+
["list-items", "List one cursor page of catalogue items ({ items, pageInfo }; --limit/--cursor/--direction, optional --sortBy/--sortDir). --page/--perPage are rejected."],
|
|
6957
|
+
["list-item-categories", "List one cursor page of active item categories ({ items, pageInfo }; --limit/--cursor/--direction, optional --name/--sortBy/--sortDir). --page/--perPage are rejected."],
|
|
6958
|
+
["create-item-category", "Admin only. Create (or reactivate) an item category. Budget Builder saves it now and a queued job creates or links the QuickBooks category (quickBooksSyncQueued, operationId); the request makes no QuickBooks call."],
|
|
6959
|
+
["update-item-category", "Rename an item category. Budget Builder saves the name immediately; a category linked to QuickBooks is renamed there by a queued job (quickBooksSyncQueued: true, operationId), never during the request."],
|
|
6960
|
+
["count-item-categories", "Count active item categories matching --name: { totalCount }."],
|
|
6961
|
+
["list-webhook-deliveries", "Admin-only: list webhook deliveries newest first. Returns { items, pageInfo }; follow pageInfo.nextCursor (or previousCursor with --direction backward). Cursors are opaque and filter-bound; raw delivery ids are rejected."],
|
|
6962
|
+
["list-integration-operations", "List one cursor page of integration operations, newest first ({ items, pageInfo }; --limit/--cursor/--direction). --page/--perPage are rejected. Admin only."],
|
|
6963
|
+
["count-integration-operations", "Provider filter options for integration operations: { filterOptions }. No total; filter flags are accepted but do not change the result. Admin only."],
|
|
6964
|
+
["count-items", "Count catalogue items matching filters: total plus category and supplier facets (each ignores its own filter)."],
|
|
6965
|
+
["count-budgets", "Count budgets matching filters: totalCount plus status and active facets. Omit --active for active budgets only."],
|
|
6966
|
+
["get-budget", "Get a budget by ID. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
|
|
6967
|
+
["get-budget-items", "Get line items for a budget. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
|
|
6968
|
+
["get-budget-details", "Get budget details. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read."],
|
|
6969
|
+
["create-bill", "Create a bill or claim with an approved supplier. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. --draft-only guarantees DRAFT without email or external writes; otherwise unpaid creation skips email permission but keeps external-write permission. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. It is a warning only and the write still succeeds. An Admin's unpaid bill is approved\
|
|
6970
|
+
on creation and its QuickBooks bill is created by a queued job: the result has quickBooksSyncQueued: true and operationId; follow it with list-integration-operations. The request itself never writes to QuickBooks. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
|
|
6971
|
+
["record-external-bill-payment", "Record an already-made payment on an APPROVED bill or claim, with no email and no money transfer. Requires <billId> --paymentReference --paymentDate YYYY-MM-DD --paymentAccount <QBO account ID> [--paymentProof receipt.pdf]. The account must be in the cached list (list-external-payment-accounts); the request makes no QuickBooks call. An inactive account (inactiveAccounts) only links the bill's existing QuickBooks payment when the bill is already settled; if there is none, the job is refused before anything is created and the bill goes back to APPROVED. Reuses settled QBO payment links or queues one dated payment from the selected account; the queued job re-checks the account in QuickBooks and stops in the Integration Queue if it is not active. Exact retries are safe; do not pay again while reconciliation is pending."],
|
|
6972
|
+
["mark-customer-invoice-sent-externally", "Admin only. Record an APPROVED customer invoice as SENT (source EXTERNAL) because it was emailed to the customer outside Budget Builder. Sends no email and writes nothing to QuickBooks. Requires <invoiceId> --sentAt <ISO datetime, not in the future, not before approval> --recipients a@x.com,b@y.com [--note <message reference>]."],
|
|
6973
|
+
["list-external-payment-accounts", "List active QuickBooks bank and credit-card account IDs for recording external payments (admin only), from Budget Builder's cached list: { accounts, cacheState, inactiveAccounts, refreshedAt, refresh }. inactiveAccounts can only link an already-settled bill's existing payment. No QuickBooks call. The worker refreshes the list automatically every day and after a QuickBooks company change; cacheState is READY, NOT_LOADED (first load pending), REALM_CHANGED (refreshing after a company change; no accounts served and external payments refused until it lands) or DISCONNECTED."],
|
|
6974
|
+
["refresh-external-payment-accounts", "Admin only. Queue a refresh of the cached QuickBooks payment-account list ({ operationId, status: QUEUED }); a refresh already waiting is reused. Optional: the worker already refreshes the list every day and after a QuickBooks company change. Check refreshedAt with list-external-payment-accounts."],
|
|
6975
|
+
["update-bill", "Update a bill or claim with a partial payload including id; omitted fields are preserved. Comment-only updates are allowed on approved/paid bills without altering financial data or QuickBooks. All amount fields exclude GST: amount is the portion billed; extractedAmount is the full invoice subtotal; lineAmounts and quotationAllocations also exclude GST. Example: 1800 + 162 GST = 1962 total requires amount=1800 and extractedAmount=1800 for a full bill. The CLI does not strip GST from input. If the selected quotations cannot split the bill amount across every selected line (a line without a quoted amount that cannot be derived from the quotation total), pass lineAmounts; updates that keep the same amount and lines reuse the existing line amounts. Re-read and verify both amount fields and allocations after correcting a gross/net mistake. The result includes quotationOverBillingWarnings; a non-empty list means linked non-rejected bills exceed a quotation's quoted amount. \
|
|
6976
|
+
It is a warning only and the write still succeeds. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by one still counts as unquoted."],
|
|
6977
|
+
["validate-bill-selection", "Validate the approved supplier and selected bill line items. Supplier bills need approved quotation sources (quotationIds, legacy quotationId, or quotationAllocations with lineAmounts) for every line that is not quotation-exempt (Go Internal lines, or projects/budgets created before the quotation cutoff). With billId, lines already on the bill keep their stored sources unless new sources are supplied. Exemption is decided by the server, so there is no --quotation-exempt flag here. Amounts (amount, lineAmounts, quotationAllocations) are ex-GST dollars with at most 2 decimal places. Returns { success, quotationOverBillingWarnings }: a non-empty warning list means the selection would bill a quotation above its quoted amount (counting other non-rejected bills); this is a warning only and does not fail validation. Quotations with documentOnly: true (a $0 supplier document) are never valid bill quotation sources and are rejected; a budget line covered only by o\
|
|
6978
|
+
ne still counts as unquoted."],
|
|
6979
|
+
["create-quotation", 'Create a quotation with an approved supplier using --payload JSON. Include projectId, budgetId, supplierId, budgetItemIds, amountWithoutGst, gstAmount, and one uploaded attachment in attachments. Multiple budget items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every selected budget-item ID exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. Example: amountWithoutGst: 1200 with line amounts 750 and 450. The upload is checked and converted to PDF by a queued job (pdfProcessing in the result and in get-quotation). The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); \
|
|
6980
|
+
FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Document-only quotation (a $0 supplier document, for example a supplier contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and every lineAmounts amount 0 (lineAmounts may be omitted; the API fills zeros). It uses the normal draft, submit, sign and Admin approve flow with the attachment, appears in list/get output with documentOnly: true, counts in quotation lists and approval queues, but does not count as quotation coverage: a budget line covered only by it still counts as unquoted, and it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API). Without documentOnly (default false), amountWithoutGst must be positive.'],
|
|
6981
|
+
["cleanup-staged-quotation-attachments", "Queue independent cleanup operations for unattached staged quotation uploads; returns operation IDs and queued/skipped counts, not deletion confirmation. Arguments: <projectId> --keys <csv>."],
|
|
6982
|
+
["update-quotation", 'Update a DRAFT or REJECTED quotation using --payload JSON with id and the complete creation payload. Multiple budget items require lineAmounts: [{"budgetItemId":"<first-id>","amount":750},{"budgetItemId":"<second-id>","amount":450}], covering every budgetItemIds entry exactly once and summing to amountWithoutGst. Amounts exclude GST; use gstAmount: 0 for no GST. The result includes gstMismatch: null, or { basis, expectedGstAmount, enteredGstAmount, difference, message } when gstAmount is non-zero and more than $0.05 away from the expected GST. basis TAXABLE_LINES uses the bill calculation for the quoted lines (9% of each in-scope line, rounded per line; none for a non-GST-registered supplier); FULL_SUBTOTAL is 9% of amountWithoutGst, used when line amounts are unknown. It is a warning only (GST 0 is always accepted) and the write still succeeds. Update is a full replace: send documentOnly: true again when updating a document-only quotation (documentOnly: true wi\
|
|
6983
|
+
th amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts; default false requires a positive amountWithoutGst), or it is treated as a priced quotation. Document-only quotations are never valid bill quotation sources and do not count as quotation coverage.'],
|
|
6984
|
+
["download-customer-invoice-pdf", "Download a customer invoice PDF when permitted."],
|
|
6985
|
+
["send-customer-invoice-to-contact-person", "Send a customer invoice and update the project billing email. Omit payload cc to use company billing defaults; an explicit list replaces them and [] removes them. Required internal Cc still applies."],
|
|
6986
|
+
["update-company", "Save company fields in BB and queue independent QuickBooks name/website synchronization; returns operation ID, not provider completion. Optional payload billingEmails: email string array (max 50), omit to preserve defaults or [] to clear. Billing emails stay in BB; estimates are unchanged."],
|
|
6987
|
+
["get-company-quickbooks-sync-status", "Read saved company synchronization status without provider calls or polling; use companyId."],
|
|
6988
|
+
["get-item-quickbooks-sync-status", "Read saved item QuickBooks synchronization status without provider calls or polling; use itemId."],
|
|
6989
|
+
["create-webhook-endpoint", "Admin-only: subscribe an HTTPS endpoint to BB events. --name --url --events <type|prefix.*|*,...>. Prints the whsec_ signing secret once; deliveries use Standard Webhooks headers."],
|
|
6990
|
+
["rotate-webhook-secret", "Admin-only: issue a new signing secret; older secrets keep signing for --previousSecretTtlHours (default 24). Prints the new secret once. Argument: <endpointId>."],
|
|
6991
|
+
["send-webhook-test-event", "Admin-only: send a signed webhook.test event to one endpoint. Argument: <endpointId>."],
|
|
6992
|
+
["replay-webhook-delivery", "Admin-only: resend a finished webhook delivery with the same eventId on a fresh attempt chain. Argument: <deliveryId>."],
|
|
6993
|
+
["get-error", "Admin-only: one error log with full diagnostics (stack, cause, request details, metadata, AI summary, resolution). Argument: <errorId>. error recent list returns table columns only."],
|
|
6994
|
+
["get-webhook-delivery", "Admin-only: one webhook delivery with payload and attempts (status codes, errors, durations). Argument: <deliveryId>."],
|
|
6995
|
+
["list-webhook-event-types", "List the outbound webhook event catalogue with group and live/planned status."],
|
|
6996
|
+
["reconcile-resource-operation", "Admin-only check of a saved QuickBooks invoice/company/item job outcome; reads the provider only when uncertain. Applied changes are finished locally without repeating the provider mutation; provably unapplied ones are queued again. Argument: <operationId>."],
|
|
6997
|
+
["get-integration-operation", "Admin-only read of one integration job: who queued it, the records it is for with app links, saved QuickBooks progress, admin actions and Retry state. No provider calls. Argument: <operationId>."],
|
|
6998
|
+
["retry-integration-operation", "Admin-only retry of a failed integration job. QuickBooks jobs with a saved attempt check QuickBooks first: applied changes finish without resending, provably unapplied ones are sent again, unprovable ones stay stopped with the reason. Argument: <operationId>."]
|
|
6999
|
+
]), summaryFor = __name2((legacyTarget) => {
|
|
7080
7000
|
const summary = SUMMARIES.get(legacyTarget);
|
|
7081
7001
|
return summary !== void 0 ? summary : legacyTarget.startsWith("list-") ? "List ".concat(legacyTarget.slice(5).replaceAll("-", " "), ".") : legacyTarget.startsWith("get-") ? "Get ".concat(legacyTarget.slice(4).replaceAll("-", " "), ".") : "".concat(titleCase(legacyTarget), ".");
|
|
7082
|
-
}, "summaryFor"), aliasesFor = __name2((legacyTarget, aliases) => [...new Set([legacyTarget, ...aliases].flatMap((alias) => [alias, alias.replaceAll("-", "_")]))], "aliasesFor"), legacyCommand = __name2((legacyTarget, path2, aliases = [], commandOptions = []) => ({ path: path2, legacyAliases: aliasesFor(legacyTarget, aliases), summary: summaryFor(legacyTarget), options: [
|
|
7083
|
-
|
|
7002
|
+
}, "summaryFor"), aliasesFor = __name2((legacyTarget, aliases) => [...new Set([legacyTarget, ...aliases].flatMap((alias) => [alias, alias.replaceAll("-", "_")]))], "aliasesFor"), legacyCommand = __name2((legacyTarget, path2, aliases = [], commandOptions = []) => ({ path: path2, legacyAliases: aliasesFor(legacyTarget, aliases), summary: summaryFor(legacyTarget), options: [
|
|
7003
|
+
...globalCommandOptions,
|
|
7004
|
+
...commandOptions
|
|
7005
|
+
], effects: effectsFor(legacyTarget), legacyTarget }), "legacyCommand"), budgetPreflightOptions = [{ name: "--companyPayload <json>", description: "Company update JSON object with id, name, and website fields." }, { name: "--contactPayload <json>", description: "Contact update JSON object with companyId, title, firstName, lastName, email, and mobile fields." }, { name: "--eventPayload <json>", description: "Event timing JSON object with date, startTime, and endTime fields." }], authCommand = __name2((action, summary) => ({ path: ["auth", action], legacyAliases: [], summary, options: globalCommandOptions, effects: [], load: __name2(async () => async () => ({}), "load") }), "authCommand"), registry2 = [
|
|
7084
7006
|
authCommand("login", "Authorize this device through Budget Builder in your browser."),
|
|
7085
7007
|
authCommand("status", "Show the active CLI authentication method and session status."),
|
|
7086
7008
|
authCommand("logout", "Revoke the interactive CLI session and remove its local credential."),
|
|
@@ -7088,14 +7010,15 @@ effects: [], load: __name2(async () => async () => ({}), "load") }), "authComman
|
|
|
7088
7010
|
{ path: ["mobile-push", "status"], legacyAliases: [], summary: "Show push availability and your active Android push registrations.", options: globalCommandOptions, effects: [], legacyTarget: "mobile-push-status" },
|
|
7089
7011
|
{ path: ["mobile-push", "unregister"], legacyAliases: [], summary: "Unregister notifications for one of your active Android devices. Argument: <sessionId>.", options: globalCommandOptions, effects: ["state-change"], legacyTarget: "mobile-push-unregister" },
|
|
7090
7012
|
legacyCommand("list-budgets", ["budget", "list"], [], [{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7091
|
-
legacyCommand(
|
|
7013
|
+
legacyCommand(
|
|
7014
|
+
"count-budgets",
|
|
7015
|
+
["budget", "count"],
|
|
7016
|
+
[],
|
|
7017
|
+
[{ name: "--active <true|false|all>", description: "Omit for active budgets only; false or all requires Admin access." }]
|
|
7018
|
+
),
|
|
7092
7019
|
legacyCommand("get-budget", ["budget", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
|
|
7093
7020
|
legacyCommand("upload-budget-attachment", ["budget", "attachment", "upload"]),
|
|
7094
|
-
legacyCommand("mark-budget-won", [
|
|
7095
|
-
"budget",
|
|
7096
|
-
"won",
|
|
7097
|
-
"mark"
|
|
7098
|
-
]),
|
|
7021
|
+
legacyCommand("mark-budget-won", ["budget", "won", "mark"]),
|
|
7099
7022
|
legacyCommand("get-budget-items", ["budget", "item", "list"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
|
|
7100
7023
|
legacyCommand("get-budget-details", ["budget", "detail", "get"], [], [{ name: "--includeInactive", description: "Include inactive historical budgets; Admin only." }]),
|
|
7101
7024
|
legacyCommand("get-budget-categories", ["budget", "category", "list"], [], [{ name: "--q <text>", description: "Search active category names (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
@@ -7105,7 +7028,11 @@ effects: [], load: __name2(async () => async () => ({}), "load") }), "authComman
|
|
|
7105
7028
|
legacyCommand("update-budget-status", ["budget", "status", "update"]),
|
|
7106
7029
|
legacyCommand("create-budget-approval", ["budget", "approval", "create"], [], budgetPreflightOptions),
|
|
7107
7030
|
legacyCommand("create-estimate", ["budget", "estimate", "create"], [], budgetPreflightOptions),
|
|
7108
|
-
legacyCommand("send-estimate-to-contact-person", [
|
|
7031
|
+
legacyCommand("send-estimate-to-contact-person", [
|
|
7032
|
+
"budget",
|
|
7033
|
+
"estimate",
|
|
7034
|
+
"send"
|
|
7035
|
+
], ["send-estimate-email"]),
|
|
7109
7036
|
legacyCommand("create-budget", ["budget", "create"]),
|
|
7110
7037
|
legacyCommand("update-budget", ["budget", "update"]),
|
|
7111
7038
|
legacyCommand("delete-budget", ["budget", "delete"]),
|
|
@@ -7127,13 +7054,13 @@ effects: [], load: __name2(async () => async () => ({}), "load") }), "authComman
|
|
|
7127
7054
|
legacyCommand("restore-budget-item", ["budget", "item", "restore"]),
|
|
7128
7055
|
legacyCommand("create-placeholder-bill", ["budget", "item", "placeholder-bill", "create"]),
|
|
7129
7056
|
legacyCommand("list-bills", ["bill", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7130
|
-
legacyCommand("list-claims", ["claim", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, {
|
|
7057
|
+
legacyCommand("list-claims", ["claim", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, {
|
|
7058
|
+
name: "--cursor <token>",
|
|
7059
|
+
description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort."
|
|
7060
|
+
}, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7131
7061
|
legacyCommand("count-bills", ["bill", "count"]),
|
|
7132
7062
|
legacyCommand("count-claims", ["claim", "count"]),
|
|
7133
|
-
legacyCommand(
|
|
7134
|
-
"create-bill-approval",
|
|
7135
|
-
["bill", "approval", "create"]
|
|
7136
|
-
),
|
|
7063
|
+
legacyCommand("create-bill-approval", ["bill", "approval", "create"]),
|
|
7137
7064
|
legacyCommand("create-bill", ["bill", "create"], [], [{ name: "--draft-only", description: "Create a draft for every role; no approval, email, or QuickBooks writes. Conflicts with alreadyPaid: true." }, { name: "--quotation-exempt", description: "Explicitly request an eligible server-validated supplier-bill quotation exemption. Cannot be combined with quotation IDs." }]),
|
|
7138
7065
|
legacyCommand("validate-bill-selection", ["bill", "selection", "validate"], [], [{ name: "--quotationIds <csv>", description: "Approved quotation IDs for a supplier bill. Each selected budget item must be covered once." }, { name: "--quotationId <id>", description: "Legacy syntax for selecting one approved quotation." }]),
|
|
7139
7066
|
legacyCommand("link-bill-quotations", ["bill", "quotation", "link"], ["billId"], [{ name: "--payload <json>", description: "Explicit quotationAllocations for split source coverage on the bill's stored line amounts; documentOnly quotations are rejected." }, { name: "--quotationIds <csv>", description: "Approved quotation IDs to link across the bill's disjoint line coverage; documentOnly quotations are rejected." }]),
|
|
@@ -7191,7 +7118,10 @@ effects: [], load: __name2(async () => async () => ({}), "load") }), "authComman
|
|
|
7191
7118
|
legacyCommand("discard-customer-invoice", ["customer-invoice", "discard"]),
|
|
7192
7119
|
legacyCommand("delete-customer-invoice", ["customer-invoice", "delete"]),
|
|
7193
7120
|
legacyCommand("void-customer-invoice", ["customer-invoice", "void"]),
|
|
7194
|
-
legacyCommand(
|
|
7121
|
+
legacyCommand(
|
|
7122
|
+
"approve-customer-invoice",
|
|
7123
|
+
["customer-invoice", "approve"]
|
|
7124
|
+
),
|
|
7195
7125
|
legacyCommand("reject-customer-invoice", ["customer-invoice", "reject"]),
|
|
7196
7126
|
legacyCommand("send-customer-invoice-to-contact-person", ["customer-invoice", "send"]),
|
|
7197
7127
|
legacyCommand("download-customer-invoice-pdf", ["customer-invoice", "pdf", "download"]),
|
|
@@ -7206,10 +7136,7 @@ effects: [], load: __name2(async () => async () => ({}), "load") }), "authComman
|
|
|
7206
7136
|
legacyCommand("approve-budget", ["budget", "approve"]),
|
|
7207
7137
|
legacyCommand("reject-budget", ["budget", "reject"]),
|
|
7208
7138
|
legacyCommand("approve-supplier", ["supplier", "approve"]),
|
|
7209
|
-
legacyCommand(
|
|
7210
|
-
"reject-supplier",
|
|
7211
|
-
["supplier", "reject"]
|
|
7212
|
-
),
|
|
7139
|
+
legacyCommand("reject-supplier", ["supplier", "reject"]),
|
|
7213
7140
|
legacyCommand("get-supplier-details", ["supplier", "detail", "get"]),
|
|
7214
7141
|
legacyCommand("get-supplier-overview", ["supplier", "overview", "get"]),
|
|
7215
7142
|
legacyCommand("get-supplier-usage", ["supplier", "usage", "get"]),
|
|
@@ -7225,7 +7152,10 @@ effects: [], load: __name2(async () => async () => ({}), "load") }), "authComman
|
|
|
7225
7152
|
legacyCommand("delete-company", ["company", "delete"]),
|
|
7226
7153
|
legacyCommand("list-projects", ["project", "list"], [], [{ name: "--companyId <id>", description: "Filter by company ID." }, { name: "--name <text>", description: "Filter by project name substring." }, { name: "--status <status|ALL>", description: "Legacy single-status filter; use --statuses for multiple statuses." }, { name: "--statuses <csv>", description: "Filter by a comma-separated project status list." }, { name: "--active <true|false>", description: "Filter by active status; omit to include both states." }, { name: "--wonFrom <iso>", description: "Only projects marked WON on or after this ISO date or datetime (UTC)." }, { name: "--wonTo <iso>", description: "Only projects marked WON on or before this ISO date (inclusive) or datetime (UTC)." }, { name: "--wonWithinDays <1-3650>", description: "Only projects marked WON in the last N days." }, { name: "--limit <1-100>", description: "Bounded page size (default 20)." }, { name: "--cursor <token>", description: "Opaque pageInfo cur\
|
|
7227
7154
|
sor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "--direction <forward|backward>", description: "Use forward by default; backward requires --cursor." }, { name: "--sortBy <name|createdAt|status|companyName|wonAt>", description: "Sort field (default createdAt); wonAt puts unwon projects last." }, { name: "--sortDir <asc|desc>", description: "Sort direction (default desc)." }]),
|
|
7228
|
-
legacyCommand("count-projects", ["project", "count"], [], [{ name: "--companyId <id>", description: "Filter by company ID." }, { name: "--name <text>", description: "Filter by project name substring." }, { name: "--status <status|ALL>", description: "Legacy single-status filter." }, {
|
|
7155
|
+
legacyCommand("count-projects", ["project", "count"], [], [{ name: "--companyId <id>", description: "Filter by company ID." }, { name: "--name <text>", description: "Filter by project name substring." }, { name: "--status <status|ALL>", description: "Legacy single-status filter." }, {
|
|
7156
|
+
name: "--statuses <csv>",
|
|
7157
|
+
description: "Filter by a comma-separated project status list."
|
|
7158
|
+
}, { name: "--active <true|false>", description: "Filter by active status; facets exclude this self-filter." }, { name: "--wonFrom <iso>", description: "Only projects marked WON on or after this ISO date or datetime (UTC)." }, { name: "--wonTo <iso>", description: "Only projects marked WON on or before this ISO date (inclusive) or datetime (UTC)." }, { name: "--wonWithinDays <1-3650>", description: "Only projects marked WON in the last N days." }]),
|
|
7229
7159
|
legacyCommand("list-project-hubs", ["project", "hub", "list"], [], [{ name: "--q", description: "Search project and company names." }, { name: "--status", description: "Filter by comma-separated project statuses." }, { name: "--limit", description: "Page size, 1-100 (default 20)." }, { name: "--cursor", description: "Opaque nextCursor/previousCursor from the last page." }, { name: "--direction", description: "forward (default) or backward; backward needs --cursor." }, { name: "--sortBy", description: "Sort by startDate, name, companyName, or status." }, { name: "--sortDir", description: "Sort in asc or desc order." }]),
|
|
7230
7160
|
legacyCommand("count-project-hubs", ["project", "hub", "count"], [], [{ name: "--q", description: "Search project and company names." }, { name: "--status", description: "Filter by comma-separated project statuses." }]),
|
|
7231
7161
|
legacyCommand("get-project", ["project", "get"]),
|
|
@@ -7245,12 +7175,7 @@ sor; pass nextCursor forward or previousCursor backward unchanged." }, { name: "
|
|
|
7245
7175
|
legacyCommand("update-contact-person", ["contact", "update"]),
|
|
7246
7176
|
legacyCommand("list-suppliers", ["supplier", "list"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses; ALL means no status filter." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived." }, { name: "--limit <1-100>", description: "Bounded page size (default 10). Retired page/perPage flags are rejected." }, { name: "--cursor <token>", description: "Opaque nextCursor or previousCursor from items/pageInfo." }, { name: "--direction <forward|backward>", description: "Forward by default; backward requires a cursor." }, { name: "--sortBy <field>", description: "name, email, phone, gstRegistered, status, active, createdAt or updated\
|
|
7247
7177
|
At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by default." }, { name: "--sort <json>", description: "Ordered {id,desc} array for multi-column sorting; cannot combine with sortBy/sortDir." }]),
|
|
7248
|
-
legacyCommand(
|
|
7249
|
-
"count-suppliers",
|
|
7250
|
-
["supplier", "count"],
|
|
7251
|
-
[],
|
|
7252
|
-
[{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived. No pagination/sort flags." }]
|
|
7253
|
-
),
|
|
7178
|
+
legacyCommand("count-suppliers", ["supplier", "count"], [], [{ name: "--name <text>", description: "Filter supplier name or email." }, { name: "--createdBy <csv>", description: "Filter by creator IDs." }, { name: "--gstRegistered <true|false>", description: "Filter GST registration." }, { name: "--status <csv>", description: "Filter approval statuses." }, { name: "--supplierTags <csv>", description: "Filter by supplier tag IDs." }, { name: "--active <true|false>", description: "Active by default; false selects archived. No pagination/sort flags." }]),
|
|
7254
7179
|
legacyCommand("create-supplier", ["supplier", "create"]),
|
|
7255
7180
|
legacyCommand("update-supplier", ["supplier", "update"]),
|
|
7256
7181
|
legacyCommand("delete-suppliers", ["supplier", "delete"]),
|
|
@@ -7264,10 +7189,7 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7264
7189
|
legacyCommand("list-items", ["item", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor (or previousCursor with --direction backward) from the last page, unchanged; keep the same filters and sort." }, { name: "--direction <forward|backward>", description: "forward (default) or backward; backward needs --cursor." }]),
|
|
7265
7190
|
legacyCommand("count-items", ["item", "count"]),
|
|
7266
7191
|
legacyCommand("get-item", ["item", "get"]),
|
|
7267
|
-
legacyCommand(
|
|
7268
|
-
"get-item-quickbooks-sync-status",
|
|
7269
|
-
["item", "sync", "status"]
|
|
7270
|
-
),
|
|
7192
|
+
legacyCommand("get-item-quickbooks-sync-status", ["item", "sync", "status"]),
|
|
7271
7193
|
legacyCommand("create-item", ["item", "create"]),
|
|
7272
7194
|
legacyCommand("update-item", ["item", "update"]),
|
|
7273
7195
|
legacyCommand("archive-items", ["item", "archive"]),
|
|
@@ -7277,14 +7199,12 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7277
7199
|
legacyCommand("create-item-category", ["item", "category", "create"]),
|
|
7278
7200
|
legacyCommand("update-item-category", ["item", "category", "update"]),
|
|
7279
7201
|
legacyCommand("delete-item-categories", ["item", "category", "delete"]),
|
|
7280
|
-
legacyCommand(
|
|
7281
|
-
"list-users",
|
|
7282
|
-
["user", "list"],
|
|
7283
|
-
[],
|
|
7284
|
-
[{ name: "--q <text>", description: "Search user names and emails (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--projectTeamOnly <true|false>", description: "true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]
|
|
7285
|
-
),
|
|
7202
|
+
legacyCommand("list-users", ["user", "list"], [], [{ name: "--q <text>", description: "Search user names and emails (name A\u2013Z). A bare --q is rejected; use -q/--quiet to hide logs." }, { name: "--projectTeamOnly <true|false>", description: "true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager." }, { name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
7286
7203
|
legacyCommand("count-users", ["user", "count"]),
|
|
7287
|
-
legacyCommand("create-user", [
|
|
7204
|
+
legacyCommand("create-user", [
|
|
7205
|
+
"user",
|
|
7206
|
+
"create"
|
|
7207
|
+
]),
|
|
7288
7208
|
legacyCommand("create-api-key", ["user", "api-key", "create"]),
|
|
7289
7209
|
legacyCommand("list-api-keys", ["user", "api-key", "list"], [], [{ name: "--limit <1-100>", description: "Rows per page. Output is { items, pageInfo }." }, { name: "--cursor <token>", description: "pageInfo.nextCursor from the last page, unchanged; pages forward only." }]),
|
|
7290
7210
|
legacyCommand("revoke-api-key", ["user", "api-key", "revoke"]),
|
|
@@ -7313,7 +7233,11 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7313
7233
|
legacyCommand("send-webhook-test-event", ["webhook", "endpoint", "test"]),
|
|
7314
7234
|
legacyCommand("list-webhook-deliveries", ["webhook", "delivery", "list"], [], [{ name: "--endpointId <id>", description: "Only deliveries to this endpoint." }, { name: "--status <PENDING|SUCCEEDED|FAILED,...>", description: "Comma-separated delivery statuses." }, { name: "--eventType <type>", description: "Exact event type, e.g. bill.approved." }, { name: "--limit <n>", description: "Rows per cursor page (1..100; default 20)." }, { name: "--cursor <token>", description: "Opaque token from pageInfo.nextCursor or pageInfo.previousCursor; bound to the same filters." }, { name: "--direction <value>", description: "forward or backward (default forward; backward requires cursor)." }]),
|
|
7315
7235
|
legacyCommand("get-webhook-delivery", ["webhook", "delivery", "get"]),
|
|
7316
|
-
legacyCommand("replay-webhook-delivery", [
|
|
7236
|
+
legacyCommand("replay-webhook-delivery", [
|
|
7237
|
+
"webhook",
|
|
7238
|
+
"delivery",
|
|
7239
|
+
"replay"
|
|
7240
|
+
]),
|
|
7317
7241
|
legacyCommand("list-inbound-sources", ["inbound", "source", "list"], [], [{ name: "--limit <n>", description: "Rows per cursor page (1..100; default 25)." }, { name: "--cursor <token>", description: "Opaque source continuation token returned by pageInfo." }, { name: "--direction <value>", description: "forward or backward (default forward; backward requires cursor)." }, { name: "--search <text>", description: "Search source name or Typeform form ID." }, { name: "--processingEnabled <boolean>", description: "Filter processing enabled state." }, { name: "--processingMode <mode>", description: "ACTIVE, COLLECT_ONLY or SHADOW." }]),
|
|
7318
7242
|
legacyCommand("count-inbound-sources", ["inbound", "source", "count"], [], [{ name: "--search <text>", description: "Search source name or Typeform form ID." }, { name: "--processingEnabled <boolean>", description: "Filter processing enabled state." }, { name: "--processingMode <mode>", description: "ACTIVE, COLLECT_ONLY or SHADOW." }]),
|
|
7319
7243
|
legacyCommand("create-inbound-source", ["inbound", "source", "create"]),
|
|
@@ -7347,61 +7271,39 @@ At." }, { name: "--sortDir <asc|desc>", description: "Descending createdAt by de
|
|
|
7347
7271
|
}, "assertRegistry");
|
|
7348
7272
|
assertRegistry(registry2);
|
|
7349
7273
|
var commandRegistry = registry2, resolveCommand = __name2((argv) => {
|
|
7350
|
-
const normalizedArgv = argv.map(normalizeToken), canonical = [...commandRegistry].sort((left, right) => right.path.length - left.path.length).find((command) => normalizedPath(
|
|
7351
|
-
command.path
|
|
7352
|
-
).every((segment, index) => normalizedArgv[index] === segment));
|
|
7274
|
+
const normalizedArgv = argv.map(normalizeToken), canonical = [...commandRegistry].sort((left, right) => right.path.length - left.path.length).find((command) => normalizedPath(command.path).every((segment, index) => normalizedArgv[index] === segment));
|
|
7353
7275
|
if (canonical) return { command: canonical, argv: argv.slice(canonical.path.length), invokedAs: argv.slice(0, canonical.path.length), isLegacyAlias: !1 };
|
|
7354
7276
|
const rawAlias = argv[0];
|
|
7355
7277
|
if (!rawAlias) return;
|
|
7356
7278
|
const normalizedAlias = normalizeToken(rawAlias), legacy = commandRegistry.find((command) => command.legacyAliases.some((alias) => normalizeToken(alias) === normalizedAlias));
|
|
7357
7279
|
if (legacy) return { command: legacy, argv: argv.slice(1), invokedAs: [rawAlias], isLegacyAlias: !0 };
|
|
7358
7280
|
}, "resolveCommand"), updateBeforeUse = "First step before each task: update to the latest published release with 'bun add --global @go-labs-sg/bb@latest', then run 'bb version' and 'bb --help' before using commands. Update once per task. If updating fails, stop and report it. Preserve an explicitly requested pinned or development/staging version.", createHumanHelp = __name2((command) => {
|
|
7359
|
-
if (command) return [
|
|
7360
|
-
updateBeforeUse,
|
|
7361
|
-
"",
|
|
7362
|
-
"Usage: bb ".concat(command.path.join(" "), " [options] [args]"),
|
|
7363
|
-
"",
|
|
7364
|
-
command.summary,
|
|
7365
|
-
"",
|
|
7366
|
-
"Legacy aliases: ".concat(command.legacyAliases.join(", ")),
|
|
7367
|
-
"",
|
|
7368
|
-
"Options",
|
|
7369
|
-
...command.options.map((option) => " ".concat(option.name, "\n ").concat(option.description)),
|
|
7370
|
-
"",
|
|
7371
|
-
...formatPayloadHelp(command.legacyTarget ?? ""),
|
|
7372
|
-
"Use `bb help --legacy` for additional command arguments."
|
|
7373
|
-
].join("\n");
|
|
7281
|
+
if (command) return [updateBeforeUse, "", "Usage: bb ".concat(command.path.join(" "), " [options] [args]"), "", command.summary, "", "Legacy aliases: ".concat(command.legacyAliases.join(", ")), "", "Options", ...command.options.map((option) => " ".concat(option.name, "\n ").concat(option.description)), "", ...formatPayloadHelp(command.legacyTarget ?? ""), "Use `bb help --legacy` for additional command arguments."].join("\n");
|
|
7374
7282
|
const lines = commandRegistry.map((command2) => {
|
|
7375
7283
|
const canonical = "bb ".concat(command2.path.join(" ")), aliases = command2.legacyAliases.filter((alias) => alias.includes("-")).map((alias) => "bb ".concat(alias)).join(", ");
|
|
7376
7284
|
return " ".concat(canonical, "\n ").concat(command2.summary).concat(aliases ? " Legacy: ".concat(aliases, ".") : "");
|
|
7377
7285
|
});
|
|
7378
7286
|
return ["bb \u2014 Budget Builder CLI", "", updateBeforeUse, "", "Usage: bb <resource> <operation> [options] [args]", "", "Global options", ...globalCommandOptions.map((option) => " ".concat(option.name, "\n ").concat(option.description)), "", "Canonical commands", ...lines, "", "Use `bb completion <shell>` to generate shell completion scripts."].join("\n");
|
|
7379
|
-
}, "createHumanHelp"), completionWords = __name2(
|
|
7380
|
-
()
|
|
7381
|
-
|
|
7382
|
-
for (const
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
(
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
case "powershell":
|
|
7400
|
-
return "Register-ArgumentCompleter -Native -CommandName bb -ScriptBlock {\n param($wordToComplete)\n '".concat(words, "'.Split(' ') | Where-Object { $_ -like \"$wordToComplete*\" }\n}\n");
|
|
7401
|
-
}
|
|
7402
|
-
},
|
|
7403
|
-
"createCompletionScript"
|
|
7404
|
-
), SUPPLIER_ANALYTICS_SORT_IDS = ["name", "gstRegistered", "status", "phone", "email", "updatedAt", "createdAt"];
|
|
7287
|
+
}, "createHumanHelp"), completionWords = __name2(() => {
|
|
7288
|
+
const words = /* @__PURE__ */ new Set();
|
|
7289
|
+
for (const command of commandRegistry) {
|
|
7290
|
+
for (const segment of command.path) words.add(segment);
|
|
7291
|
+
for (const alias of command.legacyAliases) words.add(alias);
|
|
7292
|
+
}
|
|
7293
|
+
return words.add("help"), words.add("version"), words.add("completion"), [...words].sort();
|
|
7294
|
+
}, "completionWords"), createCompletionScript = __name2((shell) => {
|
|
7295
|
+
const words = completionWords().join(" ");
|
|
7296
|
+
switch (shell) {
|
|
7297
|
+
case "bash":
|
|
7298
|
+
return "# bash completion for bb\n_bb() {\n COMPREPLY=( $(compgen -W '".concat(words, '\' -- "${COMP_WORDS[COMP_CWORD]}") )\n}\ncomplete -F _bb bb\n');
|
|
7299
|
+
case "zsh":
|
|
7300
|
+
return "#compdef bb\n_bb() {\n local -a commands\n commands=(".concat(words, ")\n _describe 'bb command' commands\n}\ncompdef _bb bb\n");
|
|
7301
|
+
case "fish":
|
|
7302
|
+
return completionWords().map((word) => "complete -c bb -f -a '".concat(word, "'")).join("\n").concat("\n");
|
|
7303
|
+
case "powershell":
|
|
7304
|
+
return "Register-ArgumentCompleter -Native -CommandName bb -ScriptBlock {\n param($wordToComplete)\n '".concat(words, "'.Split(' ') | Where-Object { $_ -like \"$wordToComplete*\" }\n}\n");
|
|
7305
|
+
}
|
|
7306
|
+
}, "createCompletionScript"), SUPPLIER_ANALYTICS_SORT_IDS = ["name", "gstRegistered", "status", "phone", "email", "updatedAt", "createdAt"];
|
|
7405
7307
|
function parsePositiveIntFlag(value, flagName) {
|
|
7406
7308
|
if (value === void 0) return;
|
|
7407
7309
|
const parsed = Number.parseInt(String(value), 10);
|
|
@@ -7430,23 +7332,26 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
|
|
|
7430
7332
|
if (value === void 0) return "forward";
|
|
7431
7333
|
if (value !== "forward" && value !== "backward") throw new Error('--direction must be "forward" or "backward".');
|
|
7432
7334
|
return value;
|
|
7433
|
-
}, "parseCompanyDirection"), parseCompanyListFlags = __name2(
|
|
7434
|
-
(flags)
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
},
|
|
7442
|
-
"parseCompanyListFlags"
|
|
7443
|
-
), parseCompanyCountFlags = __name2((flags) => {
|
|
7335
|
+
}, "parseCompanyDirection"), parseCompanyListFlags = __name2((flags) => {
|
|
7336
|
+
rejectCompanyPageFlags(flags, "list");
|
|
7337
|
+
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7338
|
+
const cursor = getFlag(flags, "cursor"), direction = parseCompanyDirection(getFlag(flags, "direction"));
|
|
7339
|
+
if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
|
|
7340
|
+
if (cursor === "") throw new Error("--cursor requires a non-empty token.");
|
|
7341
|
+
return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active"), limit: parseCompanyLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCompanySortBy(getFlag(flags, "sortBy")), sortDir: parseCompanySortDir(getFlag(flags, "sortDir")) };
|
|
7342
|
+
}, "parseCompanyListFlags"), parseCompanyCountFlags = __name2((flags) => {
|
|
7444
7343
|
rejectCompanyPageFlags(flags, "count");
|
|
7445
7344
|
for (const key of ["name", "createdBy", "createdByIds", "active", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7446
7345
|
if (flags.limit !== void 0 || flags.cursor !== void 0 || flags.direction !== void 0) throw new Error("company count does not accept list pagination flags.");
|
|
7447
7346
|
if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("company count does not accept list sorting flags.");
|
|
7448
7347
|
return { name: getFlag(flags, "name"), createdBy: getFlag(flags, "createdBy"), createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")), active: parseOptionalBoolFlag(flags, "active") };
|
|
7449
|
-
}, "parseCompanyCountFlags"), PROJECT_SORT_FIELDS = [
|
|
7348
|
+
}, "parseCompanyCountFlags"), PROJECT_SORT_FIELDS = [
|
|
7349
|
+
"name",
|
|
7350
|
+
"createdAt",
|
|
7351
|
+
"status",
|
|
7352
|
+
"companyName",
|
|
7353
|
+
"wonAt"
|
|
7354
|
+
], PROJECT_SORT_DIRECTIONS = ["asc", "desc"], PROJECT_PAGE_FLAGS = ["page", "perPage", "pageSize", "page-size", "per-page", "page_size", "per_page"], rejectProjectPageFlags = __name2((flags, command) => {
|
|
7450
7355
|
for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is not supported by project ").concat(command, "; use --limit and --cursor for list or project count for totals."));
|
|
7451
7356
|
}, "rejectProjectPageFlags"), parseProjectLimit = __name2((value) => {
|
|
7452
7357
|
if (value === void 0) return 20;
|
|
@@ -7461,15 +7366,12 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
|
|
|
7461
7366
|
if (value === void 0) return "desc";
|
|
7462
7367
|
if (!PROJECT_SORT_DIRECTIONS.includes(value)) throw new Error('Invalid --sortDir "'.concat(value, '". Use one of: ').concat(PROJECT_SORT_DIRECTIONS.join(", "), "."));
|
|
7463
7368
|
return value;
|
|
7464
|
-
}, "parseProjectSortDir"), parseProjectWonWithinDays = __name2(
|
|
7465
|
-
(value)
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
},
|
|
7471
|
-
"parseProjectWonWithinDays"
|
|
7472
|
-
), parseProjectDirection = __name2((value) => {
|
|
7369
|
+
}, "parseProjectSortDir"), parseProjectWonWithinDays = __name2((value) => {
|
|
7370
|
+
if (value === void 0) return;
|
|
7371
|
+
const parsed = Number(value);
|
|
7372
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 3650) throw new Error("--wonWithinDays must be an integer from 1 to 3650.");
|
|
7373
|
+
return parsed;
|
|
7374
|
+
}, "parseProjectWonWithinDays"), parseProjectDirection = __name2((value) => {
|
|
7473
7375
|
if (value === void 0) return "forward";
|
|
7474
7376
|
if (value !== "forward" && value !== "backward") throw new Error('--direction must be "forward" or "backward".');
|
|
7475
7377
|
return value;
|
|
@@ -7479,25 +7381,20 @@ var COMPANY_SORT_FIELDS = ["name", "createdAt"], COMPANY_SORT_DIRECTIONS = ["asc
|
|
|
7479
7381
|
const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7480
7382
|
if (direction === "backward" && cursor === void 0) throw new Error("--direction backward requires --cursor <token>.");
|
|
7481
7383
|
if (cursor === "") throw new Error("--cursor requires a non-empty token.");
|
|
7482
|
-
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(
|
|
7483
|
-
flags,
|
|
7484
|
-
"active"
|
|
7485
|
-
), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(getFlag(flags, "wonTo"), "--wonTo", { endOfDay: !0 }), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseProjectSortBy(getFlag(flags, "sortBy")), sortDir: parseProjectSortDir(getFlag(flags, "sortDir")) };
|
|
7384
|
+
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(flags, "active"), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(getFlag(flags, "wonTo"), "--wonTo", { endOfDay: !0 }), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseProjectSortBy(getFlag(flags, "sortBy")), sortDir: parseProjectSortDir(getFlag(flags, "sortDir")) };
|
|
7486
7385
|
}, "parseProjectListFlags"), parseProjectCountFlags = __name2((flags) => {
|
|
7487
7386
|
rejectProjectPageFlags(flags, "count");
|
|
7488
7387
|
for (const key of ["companyId", "name", "status", "statuses", "active", "wonFrom", "wonTo", "wonWithinDays", "limit", "cursor", "direction", "sortBy", "sortDir"]) rejectBareFlag(flags, key);
|
|
7489
7388
|
if (flags.limit !== void 0 || flags.cursor !== void 0 || flags.direction !== void 0) throw new Error("project count does not accept list pagination flags.");
|
|
7490
7389
|
if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("project count does not accept list sorting flags.");
|
|
7491
|
-
return { companyId: getFlag(flags, "companyId"), name: getFlag(
|
|
7492
|
-
flags,
|
|
7493
|
-
"name"
|
|
7494
|
-
), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(flags, "active"), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(getFlag(flags, "wonTo"), "--wonTo", { endOfDay: !0 }), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")) };
|
|
7390
|
+
return { companyId: getFlag(flags, "companyId"), name: getFlag(flags, "name"), status: parseOptionalExtendedProjectStatus(getFlag(flags, "status")), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "statuses")), active: parseOptionalBoolFlag(flags, "active"), wonFrom: parseOptionalIsoDateFlag(getFlag(flags, "wonFrom"), "--wonFrom"), wonTo: parseOptionalIsoDateFlag(getFlag(flags, "wonTo"), "--wonTo", { endOfDay: !0 }), wonWithinDays: parseProjectWonWithinDays(getFlag(flags, "wonWithinDays")) };
|
|
7495
7391
|
}, "parseProjectCountFlags");
|
|
7496
7392
|
function parseOptionalBoolFlag(flags, key) {
|
|
7497
7393
|
const v = flags[key];
|
|
7498
7394
|
if (v === void 0 || v === !0) return;
|
|
7499
7395
|
const s = String(v).toLowerCase();
|
|
7500
|
-
if (s === "true" || s === "1")
|
|
7396
|
+
if (s === "true" || s === "1")
|
|
7397
|
+
return !0;
|
|
7501
7398
|
if (s === "false" || s === "0") return !1;
|
|
7502
7399
|
throw new Error("--".concat(key, " must be true or false."));
|
|
7503
7400
|
}
|
|
@@ -7508,8 +7405,7 @@ function parseBudgetActiveFlag(flags) {
|
|
|
7508
7405
|
if (raw === !0) throw new Error("--active requires true, false, or all.");
|
|
7509
7406
|
const value = String(raw).toLowerCase();
|
|
7510
7407
|
if (value === "all") return "all";
|
|
7511
|
-
if (value === "true" || value === "1")
|
|
7512
|
-
return !0;
|
|
7408
|
+
if (value === "true" || value === "1") return !0;
|
|
7513
7409
|
if (value === "false" || value === "0") return !1;
|
|
7514
7410
|
throw new Error("--active must be true, false, or all.");
|
|
7515
7411
|
}
|
|
@@ -7536,7 +7432,10 @@ var rejectRetiredPageFlags = __name2((flags) => {
|
|
|
7536
7432
|
const id = positional[0];
|
|
7537
7433
|
if (!id) throw new Error("".concat(command, " requires ").concat(idLabel));
|
|
7538
7434
|
rejectRetiredPageFlags(flags);
|
|
7539
|
-
for (const key of ["limit", "cursor"]) rejectBareFlag(
|
|
7435
|
+
for (const key of ["limit", "cursor"]) rejectBareFlag(
|
|
7436
|
+
flags,
|
|
7437
|
+
key
|
|
7438
|
+
);
|
|
7540
7439
|
if (flags.direction !== void 0) throw new Error("".concat(command, " pages forward only; follow pageInfo.nextCursor with --cursor."));
|
|
7541
7440
|
const cursor = getFlag(flags, "cursor");
|
|
7542
7441
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
@@ -7545,12 +7444,13 @@ var rejectRetiredPageFlags = __name2((flags) => {
|
|
|
7545
7444
|
return { id, limit, cursor };
|
|
7546
7445
|
}, "parseDetailFeedPage"), parseBillFilterFlags = __name2((flags) => {
|
|
7547
7446
|
const statusRaw = getFlag(flags, "status"), createdByIdsRaw = getFlag(flags, "createdByIds"), searchRaw = getFlag(flags, "search");
|
|
7548
|
-
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), statuses: parseCommaSeparatedBillStatuses(statusRaw !== void 0 ? String(statusRaw) : void 0), search: searchRaw !== void 0 ? String(searchRaw) : void 0, isClaimable: parseOptionalBoolFlag(
|
|
7447
|
+
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), statuses: parseCommaSeparatedBillStatuses(statusRaw !== void 0 ? String(statusRaw) : void 0), search: searchRaw !== void 0 ? String(searchRaw) : void 0, isClaimable: parseOptionalBoolFlag(
|
|
7448
|
+
flags,
|
|
7449
|
+
"isClaimable"
|
|
7450
|
+
), createdByIds: parseCommaSeparatedIds(createdByIdsRaw !== void 0 ? String(createdByIdsRaw) : void 0) };
|
|
7549
7451
|
}, "parseBillFilterFlags"), parseQuotationFilterFlags = __name2((flags) => {
|
|
7550
7452
|
const createdByRaw = getFlag(flags, "createdBy") ?? getFlag(flags, "requesterIds"), searchRaw = getFlag(flags, "search");
|
|
7551
|
-
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), supplierId: getFlag(flags, "supplierId"), status: parseCommaSeparatedQuotationStatuses(
|
|
7552
|
-
getFlag(flags, "status")
|
|
7553
|
-
), createdBy: parseCommaSeparatedIds(createdByRaw), search: searchRaw !== void 0 && String(searchRaw).trim() || void 0 };
|
|
7453
|
+
return { projectId: getFlag(flags, "projectId"), budgetId: getFlag(flags, "budgetId"), supplierId: getFlag(flags, "supplierId"), status: parseCommaSeparatedQuotationStatuses(getFlag(flags, "status")), createdBy: parseCommaSeparatedIds(createdByRaw), search: searchRaw !== void 0 && String(searchRaw).trim() || void 0 };
|
|
7554
7454
|
}, "parseQuotationFilterFlags");
|
|
7555
7455
|
function parseListBillsFlags(flags) {
|
|
7556
7456
|
rejectRetiredPageFlags(flags);
|
|
@@ -7561,10 +7461,7 @@ function parseListBillsFlags(flags) {
|
|
|
7561
7461
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7562
7462
|
return { ...parseBillFilterFlags(flags), sortBy: parseOptionalBillListSortBy(sortByRaw !== void 0 ? String(sortByRaw) : void 0), sortDir: parseOptionalBillListSortDir(sortDirRaw !== void 0 ? String(sortDirRaw) : void 0), limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction };
|
|
7563
7463
|
}
|
|
7564
|
-
__name(parseListBillsFlags, "parseListBillsFlags"), __name2(
|
|
7565
|
-
parseListBillsFlags,
|
|
7566
|
-
"parseListBillsFlags"
|
|
7567
|
-
);
|
|
7464
|
+
__name(parseListBillsFlags, "parseListBillsFlags"), __name2(parseListBillsFlags, "parseListBillsFlags");
|
|
7568
7465
|
function parseCountBillsFlags(flags) {
|
|
7569
7466
|
rejectRetiredPageFlags(flags);
|
|
7570
7467
|
for (const key of ["limit", "cursor", "direction", "sortBy", "sortDir"]) if (flags[key] !== void 0) throw new Error("bill count does not accept --".concat(key, "; totals use filters only."));
|
|
@@ -7580,10 +7477,7 @@ function parseOptionalSupplierSortBy(raw) {
|
|
|
7580
7477
|
}
|
|
7581
7478
|
__name(parseOptionalSupplierSortBy, "parseOptionalSupplierSortBy"), __name2(parseOptionalSupplierSortBy, "parseOptionalSupplierSortBy");
|
|
7582
7479
|
var parseSupplierFilters = __name2((flags) => {
|
|
7583
|
-
for (const key of ["name", "createdBy", "gstRegistered", "status", "supplierTags", "active"]) rejectBareFlag(
|
|
7584
|
-
flags,
|
|
7585
|
-
key
|
|
7586
|
-
);
|
|
7480
|
+
for (const key of ["name", "createdBy", "gstRegistered", "status", "supplierTags", "active"]) rejectBareFlag(flags, key);
|
|
7587
7481
|
return { name: getFlag(flags, "name"), createdBy: parseCommaSeparatedIds(getFlag(flags, "createdBy")), gstRegistered: parseOptionalBoolFlag(flags, "gstRegistered") ?? null, status: parseCommaSeparatedSupplierStatuses(getFlag(flags, "status")), supplierTags: parseCommaSeparatedIds(getFlag(flags, "supplierTags")), active: parseOptionalBoolFlag(flags, "active") ?? !0 };
|
|
7588
7482
|
}, "parseSupplierFilters"), rejectSupplierPageFlags = __name2((flags) => {
|
|
7589
7483
|
for (const key of PROJECT_PAGE_FLAGS) if (flags[key] !== void 0) throw new Error("--".concat(key, " is retired for suppliers; use --limit/--cursor or supplier count for totals."));
|
|
@@ -7602,7 +7496,10 @@ var parseSupplierFilters = __name2((flags) => {
|
|
|
7602
7496
|
if (flags.sortBy !== void 0 || flags.sortDir !== void 0) throw new Error("Use --sort or --sortBy/--sortDir, not both.");
|
|
7603
7497
|
return parseSupplierListSortEntries(sortRaw);
|
|
7604
7498
|
}
|
|
7605
|
-
const sortBy = parseOptionalSupplierSortBy(getFlag(
|
|
7499
|
+
const sortBy = parseOptionalSupplierSortBy(getFlag(
|
|
7500
|
+
flags,
|
|
7501
|
+
"sortBy"
|
|
7502
|
+
)), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
|
|
7606
7503
|
return [{ id: sortBy ?? "createdAt", desc: (sortDir ?? "desc") === "desc" }];
|
|
7607
7504
|
}, "parseSupplierListSort"), parseListSuppliersFlags = __name2((flags) => {
|
|
7608
7505
|
rejectSupplierPageFlags(flags);
|
|
@@ -7620,9 +7517,7 @@ var parseSupplierFilters = __name2((flags) => {
|
|
|
7620
7517
|
}, "parseCountSuppliersFlags");
|
|
7621
7518
|
function parseDashboardQueryFlags(flags) {
|
|
7622
7519
|
const roleRaw = getFlag(flags, "role"), timeFrameRaw = getFlag(flags, "timeFrame");
|
|
7623
|
-
return { userId: getFlag(flags, "userId"), role: parseOptionalDashboardRole(roleRaw !== void 0 ? String(roleRaw) : void 0), deals: parseOptionalDeals(
|
|
7624
|
-
getFlag(flags, "deals")
|
|
7625
|
-
), timeFrame: parseOptionalTimeFrame(timeFrameRaw !== void 0 ? String(timeFrameRaw) : void 0), startDate: getFlag(flags, "startDate"), endDate: getFlag(flags, "endDate") };
|
|
7520
|
+
return { userId: getFlag(flags, "userId"), role: parseOptionalDashboardRole(roleRaw !== void 0 ? String(roleRaw) : void 0), deals: parseOptionalDeals(getFlag(flags, "deals")), timeFrame: parseOptionalTimeFrame(timeFrameRaw !== void 0 ? String(timeFrameRaw) : void 0), startDate: getFlag(flags, "startDate"), endDate: getFlag(flags, "endDate") };
|
|
7626
7521
|
}
|
|
7627
7522
|
__name(parseDashboardQueryFlags, "parseDashboardQueryFlags"), __name2(parseDashboardQueryFlags, "parseDashboardQueryFlags");
|
|
7628
7523
|
function printLegacyHelp(runtime) {
|
|
@@ -7636,33 +7531,35 @@ sion <budgetId> Remove commission and return the budget to DRAFT.\n delete-bu
|
|
|
7636
7531
|
on backward, keeping the same filters and sort. --page/--pageSize/--perPage are rejected.\n list-claims same flags as list-bills; only reimbursable claims (ignores --isClaimable)\n count-bills [--projectId] [--budgetId] [--status CSV] [--search <text>] [--isClaimable true|false] [--createdByIds <csv>] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics; no pagination/sort flags\n count-claims same flags as count-bills; only reimbursable claims\n Both lists return summaries; use get-bill-details <billId> for full detail.\n isClaimable differentiates the shared bill/claim records: false = bill, true = claim.\n Create supplier bills from approved quotations from the same supplier and project. Use quotationAllocations plus lineAmounts when quotations split one bill line. Eligible exemptions require explicit --quotation-exempt intent; claims do not consume or link quot\
|
|
7637
7532
|
ations. Document-only quotations (documentOnly: true, $0) are never valid bill sources; create-bill, update-bill, validate-bill-selection and link-bill-quotations reject them, and a line covered only by one still counts as unquoted.\n Amounts for create/update (including drafts) exclude GST: amount = portion billed; extractedAmount = full invoice subtotal; lineAmounts[].amount and quotationAllocations[].amount also exclude GST. The CLI does not strip GST from input.\n Example: invoice subtotal 1800 + GST 162 = total 1962 -> amount: 1800, extractedAmount: 1800, allocations totaling 1800. BB calculates applicable GST separately. Re-read and verify both amount fields after writing.\n create-bill-approval <billId> (also queues approval request emails)\n create-bill --payload '<json>' [--draft-only] [--quotation-exempt] (bill.create; supplier bills use payload.quotationAllocations for split sources or quotationIds for disjoint coverage; explicit allocations require lin\
|
|
7638
7533
|
eAmounts; claims reject quotation sources; an Admin's unpaid bill queues its QuickBooks bill: quickBooksSyncQueued, operationId)\n validate-bill-selection --payload '<json>' [--quotationIds <csv> | --quotationId <id>] Validate an approved supplier and approved quotation coverage for each supplier-bill line. --quotationId is legacy single-quotation syntax.\n link-bill-quotations <billId> (--payload '<json>' | --quotationIds <csv>) Admin-only source-link repair; payload.quotationAllocations supports same-line splits.\n stage-bill-attachment <projectId> <filePath...> [--file <path>] [--files <csv>] Upload files before create-bill; returns attachment JSON for attachments/paymentProofAttachments\n cleanup-staged-bill-attachments <projectId> --keys <csv> Queue cleanup of unattached staged uploads; returns operation IDs.\n update-bill --payload '<json>' (bill.update; must include id)\n update-bill-payment-evidence --payload '<json>' Replace paymentReference/pay\
|
|
7639
|
-
mentProofAttachments for an already-paid bill.\n delete-bill <billId>\n update-bill-status <id> <status> [--rejectionReason] [--paymentTrackingUrl] [--paymentReference] [--paymentProof <receipt.pdf>] [--overBudgetOverrideReason <text>]\n status (").concat(
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
<
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
first
|
|
7665
|
-
|
|
7534
|
+
mentProofAttachments for an already-paid bill.\n delete-bill <billId>\n update-bill-status <id> <status> [--rejectionReason] [--paymentTrackingUrl] [--paymentReference] [--paymentProof <receipt.pdf>] [--overBudgetOverrideReason <text>]\n status (").concat(
|
|
7535
|
+
billStatusesForUpdateHelp.join(", "),
|
|
7536
|
+
') \u2014 not PENDING_APPROVAL; use create-bill-approval\n PAID requires --paymentReference and a payment-proof PDF. Use --paymentProof to stage and submit the PDF atomically, or omit it only when BB already has a BILL_PAYMENT_PROOF attachment.\n Moving a bill or claim to PAID runs the server\'s paid-bill notification workflow.\n patch-bill-payment <billId> [--paymentTrackingUrl] [--paymentReference] [--quickbooksBillId] [--paymentDate <ISO>]\n Clear a field: --clearPaymentTrackingUrl true | --clearPaymentReference true | --clearQuickbooksBillId true | --clearPaymentDate true\n patch-bill-invoice-number <billId> <invoiceNumber>\n get-bill-attachments <billId> [--limit 1-50] [--cursor <token>]\n Newest first. Returns { items, pageInfo }; follow nextCursor.\n upload-bill-attachment <billId> <filePath...> [--file <path>] [--files <csv>] Attach invoice/supporting files as BILL attachments to any bill status, including PAID bills\n attach-bill-payment-receipt <billId> <filePath...> \
|
|
7537
|
+
[--file <path>] [--files <csv>] Attach Wise/payment-proof PDFs as BILL_PAYMENT_PROOF attachments\n attach-bill-documents <billId> [--invoice <path>] [--invoices <csv>] [--paymentProof|--payment-proof|--proof <path>] [--paymentProofs|--payment-proofs|--proofs <csv>] Attach invoice and/or payment proof files with separate BB attachment types\n get-bill-review <billId> Read advisory AI review and evidence (passive)\n request-bill-review <billId> [--requestId <id>] Queue AI review; never approves or pays\n get-bill-details <billId> Bill summary as shown in the web app (status, amounts, people, payment, line totals)\n get-bill-line-items <billId> [--limit 1-100] [--cursor <token>] Line items with budget-item/quotation detail; { items, pageInfo }\n get-bill-approvals <billId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }\n get-bill-payment <billId> Payment status, reference, date, tracking URL, QuickBooks link and ex\
|
|
7538
|
+
ternal payment\n\nQuotations\n list-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Newest first; returns { items, pageInfo }; rows carry documentOnly (document-only $0 quotations are listed and counted like any other). Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy.\n count-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics\n get-quotation <quotationId> Quotation as shown in the web app (status, documentOnly, amounts, people, line totals, files, approvals; pdfProcessing is PROCESSING or FAILED until queued PDF conversion/signing links the PDF; gstMismatch warns when GST differs from the expected GST)\n \
|
|
7539
|
+
get-quotation-line-items <quotationId> [--limit 1-100] [--cursor <token>] Line items with budget-item detail; { items, pageInfo }\n upload-quotation-attachment <projectId> <filePath> Upload one PDF, JPEG, or PNG up to 20MB; returns attachment JSON for a quotation payload.\n cleanup-staged-quotation-attachments <projectId> --keys <csv> Queue cleanup of unattached quotation uploads; returns operation IDs.\n create-quotation --payload \'<json>\' (quotation.createDraft; requires amountWithoutGst, gstAmount, and lineAmounts [{budgetItemId, amount}] for multiple budgetItemIds; amounts before GST must sum to amountWithoutGst; result gstMismatch warns when gstAmount is not 0 or the expected GST)\n Document-only ($0 supplier document, e.g. a contract or proposal with no price): set documentOnly: true with amountWithoutGst: 0, gstAmount: 0 and zero lineAmounts (lineAmounts may be omitted). It goes through submit/sign/approve like any quotation and shows documentOnly: true in lis\
|
|
7540
|
+
t/get output, but it is never a valid bill quotation source (create-bill, update-bill, validate-bill-selection and link-bill-quotations are rejected by the API) and does not count as quotation coverage: a budget line covered only by it still counts as unquoted. Without documentOnly (default false), amountWithoutGst must be positive.\n Example: --payload \'{"projectId":"<id>","budgetId":"<id>","supplierId":"<id>","budgetItemIds":["<id>"],"amountWithoutGst":0,"gstAmount":0,"documentOnly":true,"attachments":[<uploaded attachment>]}\'\n update-quotation --payload \'<json>\' Update a DRAFT or REJECTED quotation; same allocation payload plus id; use lineAmounts [{budgetItemId, amount}] for every selected item. Result gstMismatch warns when gstAmount is not 0 or the expected GST. Update is a full replace: send documentOnly: true again when updating a document-only quotation, or it is treated as a priced quotation and needs a positive amountWithoutGst.\n delete-quotation <quotationId>\
|
|
7541
|
+
\n submit-quotation <quotationId> [--overBudgetOverrideReason <text>] (signed PDF is made by a queued job: pdfProcessing; gstMismatch warns when GST is not 0 or the expected GST)\n approve-quotation <quotationId> [--overBudgetOverrideReason <text>] (assigned pending request/current Admin; concurrent revision or allocation changes conflict; final signed PDF is queued: pdfProcessing)\n reject-quotation <quotationId> --reason <text>\n download-quotation-pdf <quotationId> [original|staff|final] (refused with "still processing" until the queued PDF step links it)\n\nCustomer invoices\n check-customer-invoice-readiness <budgetId> Readiness plus the full remaining-balance amount preview and live QuickBooks validation.\n list-eligible-customer-invoice-budgets <projectId> Accepted budgets that are ready and still have invoice coverage remaining, including estimate total, invoiced/remaining percentages, and available amount.\n preview-customer-invoice-amount <budgetId> <percentage-o\
|
|
7542
|
+
f-estimate> Preview amount before GST, GST, and total for a percentage of the original estimate. The percentage cannot exceed the budget\'s remaining coverage.\n list-available-qbo-customer-invoices <budgetId> List unlinked QuickBooks invoices available for this accepted or closed estimate before previewing and importing one.\n list-customer-invoices [budgetId] [--projectId <id>] [--companyIds CSV] [--projectIds CSV] [--budgetIds CSV] [--createdByIds CSV] [--status CSV] [--search] [--sortBy createdAt|status|totalInvoiceAmount|approvalExpiresAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n No scope flag lists invoices globally. --projectId uses the project scope. A positional budgetId is a backward-compatible shortcut for --budgetIds.\n count-customer-invoices [budgetId] [same filter flags as list-customer-in\
|
|
7543
|
+
voices] totalCount, lifecycle status facets (ignore --status) and amount metrics; no paging or sort flags\n get-customer-invoice <batchId> Batch as shown in the web app: status, totals, people, approvals and invoice summaries\n get-customer-invoice-invoices <batchId> Invoices with QuickBooks identity, dates, sync state, bill email (from QuickBooks) and held QuickBooks changes (qboDetailsDrift)\n get-customer-invoice-lines <invoiceId> [--limit 1-100] [--cursor <token>] One invoice\'s lines; { items, pageInfo }\n get-customer-invoice-approvals <batchId> [--limit 1-50] [--cursor <token>] Approval requests with approver/requester/responder; { items, pageInfo }\n get-customer-invoice-history <batchId> [--limit 1-100] [--cursor <token>] Status history; { items, pageInfo }\n get-customer-invoice-payments <invoiceId> Payments QuickBooks applied to one invoice (date, reference, amount applied, attachment names). Live QuickBooks read.\n get-custo\
|
|
7544
|
+
mer-invoice-email-context <batchId> Contact, required CC, budget, and project context for composing an invoice email.\n preview-qbo-customer-invoice <budgetId> <qboInvoiceId> Preview an invoice selected from list-available-qbo-customer-invoices; works on accepted/closed estimates.\n import-qbo-customer-invoice <budgetId> <qboInvoiceId> --token <previewToken> Confirm the reviewed BB-only link; requires --allow-state-change --allow-financial-write in automation.\n create-customer-invoice --payload \'<json>\' Create one invoice from an eligible budget. Include budgetId, a recommended UUID requestId, invoiceDate, details {billingAddress, customerMemo}, and exactly one split {label, percentage, dueDate}. Percentage is of the original estimate and cannot exceed the remaining coverage. Never sends.\n discard-customer-invoice <batchId> Discard a reserved CREATING batch with no created QBO invoices.\n delete-customer-invoice <batchId> Delete QBO invoices and the \
|
|
7545
|
+
local batch.\n void-customer-invoice <batchId> Void the invoice batch in QuickBooks.\n resubmit-customer-invoice <batchId> Original requester only. Queues one replacement after confirmed expiry voiding; retries return the same replacement. Never sends to the customer.\n approve-customer-invoice <batchId> Admin approval; rejects voided invoices, notifies the creator, and closes the estimate at cumulative 100% coverage.\n reject-customer-invoice <batchId> --reason <text> Admin rejection; voids QBO invoices and notifies the creator.\n send-customer-invoice-to-contact-person --payload \'<json>\' Queues same composer workflow as web; requires invoiceId, to, cc, replyTo, subject, HTML content, and HTML signature.\n download-customer-invoice-pdf <invoiceId> [--output <path>]\n mark-customer-invoice-sent-externally <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>] Admin only. Record an APPROVED invoice as SENT because it was em\
|
|
7546
|
+
ailed outside Budget Builder; sends no email.\n sync-customer-invoice <invoiceId> Refresh local status and balance from QuickBooks; paid invoices become PAID, reversals restore delivery/approval, and QBO voids can reopen an estimate. QuickBooks edits to bill-to address, memo, bill email or total are not applied: they are flagged as qboDetailsDrift and admins are emailed.\n update-customer-invoice-details <invoiceId> --billingAddress <text> --customerMemo <text> [--requestId <uuid>]\n Save bill-to address and memo in BB and queue the QuickBooks update (external write). Bill email is managed in QuickBooks.\n update-customer-invoice-qbo-drift <invoiceId> --resolution ACCEPT_QBO|KEEP_BB [--requestId <uuid>]\n Admin: resolve flagged QuickBooks changes. ACCEPT_QBO copies them into BB only; KEEP_BB queues BB\'s address and memo to QuickBooks.\n\nApprovals\n list-approvals | get-pending-approva\
|
|
7547
|
+
ls [--type budget|supplier|bill|quotation|customer_invoice|all] [--limit 1-100] [--cursor token] [--direction forward|backward]\n get-pending-approval <approvalId> Read one request still pending your approval.\n approve-bill <billId> [--overBudgetOverrideReason <text>] (also sends requester reply email)\n reject-bill <billId> --reason <text> (also sends requester reply email)\n approve-budget <budgetId> (also sends requester reply email)\n reject-budget <budgetId> --reason <text> (also sends requester reply email)\n approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier; QuickBooks vendor sync is queued)\n reject-supplier <supplierId> --reason <text> (also sends requester reply email)\n\nCompanies & projects\n list-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false] [--sortBy name|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor] [--direction forward|backward]\n Returns { \
|
|
7548
|
+
items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Omit --cursor to restart.\n count-companies [--name] [--createdBy] [--createdByIds CSV] [--active true|false]\n Returns independent { totalCount, counts: { active: { true, false } } }; no pagination or sorting flags.\n get-company <id>\n search-existing-companies --query <name> [--limit 1-50] [--cursor <token>] (BB + QuickBooks, read-only; follow pageInfo.nextCursor)\n use-existing-company --companyId <bbId> and/or --quickbooksId <qboId> [--name <qboName>] [--website <url>] [--confirmDistinct true]\n Supply both IDs to explicitly connect existing records with different names.\n Reuses both records, creating only the missing counterpart. A QBO-only import needs --name (from search-existing-companies);\n website is needed only for a QBO import without one. The QuickBooks link is queued (quickBooksSyncQueued, operationId).\n create-company --name --webs\
|
|
7549
|
+
ite <url> [--confirmDistinct true] [--billingEmails \'<json-array>\'] (QuickBooks customer queued)\n Exact existing companies are reused. Similar names require explicit separate-entity confirmation.\n update-company --payload \'<json>\' (optional billingEmails: omit to preserve, [] to clear; returns queued QBO operation ID, not completion)\n get-company-quickbooks-sync-status <companyId> (saved status only; no provider call or polling)\n delete-company <id>\n list-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N] [--limit 1-100] [--cursor] [--direction forward|backward] [--sortBy name|createdAt|status|companyName|wonAt] [--sortDir asc|desc]\n Returns { items, pageInfo }; pass nextCursor with direction forward or previousCursor with direction backward. Legacy --page/--perPage are rejected.\n --sortBy wonAt orders by when the project was marked WON (unwon projects last). Each pro\
|
|
7550
|
+
ject includes wonAt, wonBy { id, name } and wonAtEstimated (true for backfilled dates).\n count-projects [--companyId] [--name] [--status|--statuses CSV] [--active true|false] [--wonFrom ISO] [--wonTo ISO] [--wonWithinDays N]\n Returns independent { totalCount, counts: { status, active: { true, false } } }; no pagination or sorting flags.\n list-project-hubs [--q] [--status CSV] [--sortBy startDate|name|companyName|status] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-project-hubs [--q] [--status CSV] totalCount plus status facet\n List active projects that have a Project Hub integration.\n get-project <id>\n Budget overview totalRevenue includes Estimate Accepted and Estimate Closed budgets only.\n create-project --name --companyId --contactPersonId --insideSale\
|
|
7551
|
+
sId --businessDevelopmentId --venue --startDate <ISO> [--projectManagerId <userId>] [--asanaTaskId] [--asanaSearch <text>] [--pax] [--endDate <ISO>] [--description]\n update-project --payload \'<json>\' (project.updateProject; warns before estimate-affecting changes reject linked estimates; a companyId change (with a contactPersonId from that company) does not itself reject estimates or touch invoices, but date/pax/venue changes in the same save still do; optional projectManagerId and requestQboAccountantNotification)\n delete-project <id>\n check-project-reconciliation <id> Run the same live reconciliation review as the web app without changing status.\n reconcile-project <id> Rerun all checks transactionally and mark an eligible WON project RECONCILED.\n complete-project <id> Rerun reconciliation validation, mark a RECONCILED project COMPLETED, and queue QBO placeholder cleanup.\n import-qbo-project <projectId> --url <quickBooksProjectUrl>\n up\
|
|
7552
|
+
date-project-status <id> <status> [--projectManagerId <userId>] [--projectManagerEmail <email>]\n PITCH \u2192 WON requires an accepted/closed estimate. To win a pitch, accept its estimate with mark-budget-won <budgetId> <signed-quote.pdf>, which moves the project to WON.\n Required when moving PITCH \u2192 WON: supply --projectManagerId or --projectManagerEmail.\n The project manager must be an active @getout.sg user; list eligible users with list-users --projectTeamOnly true.\n status: '
|
|
7553
|
+
).concat(projectStatusesForHelp.join(", "), "\n\nContacts\n list-contacts <companyId>\n create-contact-person --payload '<json>' (contactPerson.createContactPerson; title MR|MRS|MS|DR)\n update-contact-person --payload '<json>' (contactPerson.updateContactPerson; must include id)\n\nSuppliers & items\n list-suppliers [--name] [--limit 1-100] [--cursor <token>] [--direction forward|backward] [--sortBy createdAt|updatedAt|name|email|phone|gstRegistered|status|active] [--sortDir asc|desc | --sort JSON] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false]\n count-suppliers [--name] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false] (independent totals/facets; no pagination/sort flags)\n Defaults: --active true, --limit 10, --sortBy createdAt, --sortDir desc (same as the web list); pass --active false for archived suppliers.\n create-supplier \
|
|
7554
|
+
--payload '<json>' (supplier.createSupplier; archived-name recreation is Admin-only; auto-requests approval + emails when status is PENDING_APPROVAL; Lead/Admin creates queue the QuickBooks vendor: quickBooksSyncQueued, operationId)\n update-supplier --payload '<json>' (authenticated; normal-user edits require server-enforced approval; Lead/Admin edits of a linked supplier queue the QuickBooks sync)\n delete-suppliers --ids <csv> (supplier.deleteSuppliers; admin; archives/deactivates supplier items)\n reactivate-suppliers --ids <csv> (supplier.reactivateSuppliers; admin; queues QuickBooks vendor reactivation, then the suppliers and their items become active: queuedSuppliers, operations)\n create-certification --name (supplier.createCertification)\n create-payment-method --name (supplier.createPaymentMethod)\n create-supplier-role --name (supplier.createSupplierRole)\n create-supplier-tag --name (supplier.createSupplie\
|
|
7555
|
+
rTag)\n create-item --payload '<json>' (item.createItem; saves the item and queues its QuickBooks create: quickBooksSyncQueued, operationId)\n update-item --payload '<json>' (item.updateItem; must include id)\n archive-items --ids <csv> (item.archiveItems; Budget Builder only; max 100; users can archive their own items, leads/admins any item; open estimates retain snapshot lines and require resolution before send/acceptance)\n delete-item <id> (item.deleteItem; admin; archives in Budget Builder and makes the item inactive in QuickBooks; blocked while used by an open estimate)\n get-supplier-details <supplierId>\n get-supplier-overview <supplierId> (supplier.getSupplierOverview; profile, approvals, attachments and tab counts; no usage or items)\n get-supplier-usage <supplierId> (supplier.getSupplierUsage; usage rows and spending)\n get-supplier-items <supplierId> (supplier.getSupplierItems; inventory items)\n get-suppli\
|
|
7556
|
+
er-analytics [--name] [--status CSV] [--gstRegistered true|false] [--createdBy <text>] [--timeFrame ALL|LAST_YEAR|LAST_6_MONTHS|LAST_3_MONTHS|CUSTOM] [--startDate <ISO> --endDate <ISO>] [--sortBy name|gstRegistered|status|phone|email|updatedAt|createdAt] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Admin. Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-supplier-analytics [--name] [--status] [--gstRegistered] [--createdBy] [--timeFrame] [--startDate --endDate] Admin. totalCount for the same filters\n list-items [--name] [--includeQuickBooksDeactivationPending true] [--sortBy createdAt|updatedAt|name|cost|itemCategory|supplier] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Returns { items, pageInfo }; follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejec\
|
|
7557
|
+
ted.\n count-items [same filter flags as list-items] total plus category and supplier facets\n get-item <id>\n get-item-quickbooks-sync-status <itemId> (saved status only; no provider call or polling)\n list-item-categories [--name] [--sortBy createdAt|name|itemCount|createdBy] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Active categories only; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.\n count-item-categories [--name] totalCount of active categories\n create-item-category --name (admin; saves the category and queues its QuickBooks create: quickBooksSyncQueued, operationId)\n update-item-category --id --name (authenticated; renames in BB now and queues the QuickBooks rename: quickBooksSyncQueued, operationId)\n delete-item-categories --ids <csv> (itemCategory.deleteItemCategories; admin; empty categories only)\
|
|
7558
|
+
\n\nDashboard & users\n whoami Show the user identity and role for the active API key.\n list-users [--q] [--projectTeamOnly true|false] [--limit 1-100] [--cursor <token>]\n Name A\u2013Z. Returns { items, pageInfo }; follow nextCursor with the same --q and --projectTeamOnly. --page/--perPage are rejected.\n --projectTeamOnly true lists only active @getout.sg users, the only accounts accepted as Inside Sales, Business Development or Project Manager.\n count-users [--q] [--projectTeamOnly true|false] totalCount for the same search\n create-user --email <email> [--name <name>] [--role ").concat(userRolesForHelp.join("|"), '] (admin; API-only service identity with no Google sign-in)\n create-api-key --name <label> [--userId <userId>] (defaults to the caller; admin required for another user; raw key is shown once)\n list-api-keys [--userId <userId>] [--limit 1-100] [--cursor <token>] (n\
|
|
7559
|
+
ewest first, { items, pageInfo }; defaults to the caller; admin required for another user)\n revoke-api-key <apiKeyId> [--userId <userId>] (defaults to the caller; admin required for another user)\n get-user-performance [--userId] (admin)\n get-dashboard [--userId] [--role BD|CREATOR|INSIDE_SALES|ALL] [--deals ALL|SUCCESSFUL|LOST] [--timeFrame] [--startDate] [--endDate] (admin)\n get-monthly-metrics [same optional flags as get-dashboard] (admin; dashboard.getMonthlyMetrics)\n get-system-overview [same optional flags as get-dashboard] (admin; dashboard.getSystemOverview)\n get-estimate-performance [same optional flags as get-dashboard] (admin; dashboard.getEstimatePerformance)\n get-financial-overview [same optional flags as dashboard; role uses BudgetRole enum] (admin)\n\nErrors\n get-recent-errors [--cursor] [--direction forward|backward] [--limit] [--severity] [--status] [--timeFrame] (admin)\n count-errors [--severi\
|
|
7560
|
+
ty] [--status] [--timeFrame] (admin)\n get-error <errorId> Full diagnostics: stack, cause, request, metadata (admin)\n get-error-metrics (admin)\n\nAutomation (admin)\n list-integration-operations [--search] [--destination <provider,...>] [--status <PENDING|PROCESSING|FAILED|COMPLETED,...>] [--limit 1-100] [--cursor <token>] [--direction forward|backward]\n Newest first; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters. --page/--perPage are rejected.\n count-integration-operations [same filter flags] provider filter options only (no total; filters do not change the result)\n get-integration-operation <operationId> (one job: who queued it, what it is for, saved progress, Retry state)\n retry-integration-operation <operationId> [--confirmExternalStateReconciled true|false] [--outboundEmailResolution ACCEPTED|NOT_ACCEPTED_RETRY] [--providerMessageId <id>] (QuickBooks jobs with a saved attempt check QuickBooks first: applied changes \
|
|
7561
|
+
finish without resending, unapplied ones are sent again)\n reconcile-resource-operation <operationId> (admin: check a QuickBooks invoice/company/item job outcome without retrying; same check Retry runs first)\n\nWebhooks (admin)\n list-webhook-event-types (event catalogue: type, group, live|planned)\n list-webhook-endpoints\n get-webhook-endpoint <endpointId>\n create-webhook-endpoint --name <name> --url <https-url> --events <type|prefix.*|*,...> [--enabled true|false] (prints the signing secret once)\n update-webhook-endpoint <endpointId> [--name] [--url] [--events <...>] [--enabled true|false]\n delete-webhook-endpoint <endpointId>\n rotate-webhook-secret <endpointId> [--previousSecretTtlHours <0-168>] (prints the new secret once)\n send-webhook-test-event <endpointId>\n list-webhook-deliveries [--endpointId] [--status <PENDING|SUCCEEDED|FAILED,...>] [--eventType] [--limit 1-100] [--cursor <token>] [--direction forward|backward] (newest first; prints items + pageInfo)\n get-webho\
|
|
7562
|
+
ok-delivery <deliveryId> (attempts with response codes)\n replay-webhook-delivery <deliveryId> (same eventId, new attempt chain)\n\nHistorical / benchmarks\n get-approved-budgets [--projectId] [--limit] [--minRevenue] [--maxRevenue]\n get-budget-category-benchmarks <categoryId> [--limit]\n get-item-pricing-history [--itemName] [--categoryId] [--supplierId] [--limit]\n get-supplier-pricing-history <supplierId> [--itemCategoryId] [--limit]\n\nOutput: JSON to stdout. Errors to stderr; exit 1 on failure.\n\nMCP parity: every MCP tool maps to one command above. The CLI also exposes\n reorder-budget-items and update-budget-item-supplier (web UI\u2013oriented tRPC).\n You may use MCP-style snake_case (e.g. bb list_bills) \u2014 normalized to kebab-case.\n\nNote: MCP also exposes a Prisma schema resource; the CLI has no equivalent.\n\nNot covered vs MCP get_budget: "get-budget" also fetches line items in one call.\n').trim();
|
|
7666
7563
|
runtime.stdout.write("".concat(help, "\n"));
|
|
7667
7564
|
}
|
|
7668
7565
|
__name(printLegacyHelp, "printLegacyHelp"), __name2(printLegacyHelp, "printLegacyHelp");
|
|
@@ -7687,7 +7584,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7687
7584
|
return !1;
|
|
7688
7585
|
}, "isEnabledFlag"), runtimeOnlyFlags = ["--allow-state-change", "--allow-email", "--allow-external-write", "--allow-delete", "--allow-financial-write", "--debug", "--quiet", "--api-url", "--no-browser"], isRuntimeOnlyArgument = __name2((value) => runtimeOnlyFlags.some((flag) => value === flag || value.startsWith("".concat(flag, "="))) || value === "-q", "isRuntimeOnlyArgument"), readApiUrlArgumentValue = __name2((argv, index) => {
|
|
7689
7586
|
const next = argv[index + 1];
|
|
7690
|
-
if (next === void 0 || next.startsWith("-")) throw new CliRuntimeError(
|
|
7587
|
+
if (next === void 0 || next.startsWith("-")) throw new CliRuntimeError(
|
|
7588
|
+
"USAGE",
|
|
7589
|
+
"--api-url requires a URL."
|
|
7590
|
+
);
|
|
7691
7591
|
return next;
|
|
7692
7592
|
}, "readApiUrlArgumentValue"), parseRootArguments = __name2((argv) => {
|
|
7693
7593
|
const commandArgv = [];
|
|
@@ -7704,9 +7604,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7704
7604
|
continue;
|
|
7705
7605
|
}
|
|
7706
7606
|
if (isRuntimeOnlyArgument(value)) {
|
|
7707
|
-
booleanFlagValues.has(
|
|
7708
|
-
argv[index + 1] ?? ""
|
|
7709
|
-
) && index++;
|
|
7607
|
+
booleanFlagValues.has(argv[index + 1] ?? "") && index++;
|
|
7710
7608
|
continue;
|
|
7711
7609
|
}
|
|
7712
7610
|
commandArgv.push(value);
|
|
@@ -7717,26 +7615,20 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7717
7615
|
const legacyTarget = resolvedCommand.command.legacyTarget;
|
|
7718
7616
|
if (legacyTarget === void 0) throw new CliRuntimeError("INTERNAL", "Command ".concat(resolvedCommand.command.path.join(" "), " has no dispatcher target."));
|
|
7719
7617
|
return [argv[0] ?? "node", argv[1] ?? "bb", legacyTarget, ...resolvedCommand.argv.filter((value) => !isRuntimeOnlyArgument(value))];
|
|
7720
|
-
}, "legacyArgvForCommand"), normalizeDispatcherError = __name2(
|
|
7721
|
-
(error2) => error2 instanceof Error && new __cliRegExp("\\brequires\\b|\\bmust be\\b|\\bmust include\\b|^Invalid\\b|^Missing\\b|^--", "").test(error2.message) ? new CliRuntimeError("VALIDATION", error2.message) : error2,
|
|
7722
|
-
"normalizeDispatcherError"
|
|
7723
|
-
), commandConfirmationTarget = __name2((resolvedCommand) => {
|
|
7618
|
+
}, "legacyArgvForCommand"), normalizeDispatcherError = __name2((error2) => error2 instanceof Error && new __cliRegExp("\\brequires\\b|\\bmust be\\b|\\bmust include\\b|^Invalid\\b|^Missing\\b|^--", "").test(error2.message) ? new CliRuntimeError("VALIDATION", error2.message) : error2, "normalizeDispatcherError"), commandConfirmationTarget = __name2((resolvedCommand) => {
|
|
7724
7619
|
const positionalTarget = resolvedCommand.argv.find((value) => value !== "--" && !value.startsWith("-"));
|
|
7725
7620
|
return positionalTarget !== void 0 && !positionalTarget.startsWith("{") && !positionalTarget.startsWith("[") ? positionalTarget : resolvedCommand.command.path.join(" ");
|
|
7726
7621
|
}, "commandConfirmationTarget"), PAGING_FLAG_KEYS = ["limit", "cursor", "direction", "sortBy", "sortDir"], rejectCountPagingFlags = __name2((flags, commandName) => {
|
|
7727
7622
|
for (const key of PAGING_FLAG_KEYS) if (flags[key] !== void 0) throw new Error("".concat(commandName, " does not accept --").concat(key, "; totals use filters only."));
|
|
7728
7623
|
}, "rejectCountPagingFlags"), rejectBarePagingFlags = __name2((flags) => {
|
|
7729
7624
|
for (const key of PAGING_FLAG_KEYS) rejectBareFlag(flags, key);
|
|
7730
|
-
}, "rejectBarePagingFlags"), parseCursorAndDirection = __name2(
|
|
7731
|
-
(flags)
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
},
|
|
7738
|
-
"parseCursorAndDirection"
|
|
7739
|
-
), parseAscDescSortDir = __name2((flags) => {
|
|
7625
|
+
}, "rejectBarePagingFlags"), parseCursorAndDirection = __name2((flags) => {
|
|
7626
|
+
const cursor = getFlag(flags, "cursor");
|
|
7627
|
+
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
7628
|
+
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7629
|
+
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7630
|
+
return { cursor, direction };
|
|
7631
|
+
}, "parseCursorAndDirection"), parseAscDescSortDir = __name2((flags) => {
|
|
7740
7632
|
const sortDir = getFlag(flags, "sortDir");
|
|
7741
7633
|
if (sortDir !== void 0 && sortDir !== "asc" && sortDir !== "desc") throw new Error('--sortDir must be "asc" or "desc".');
|
|
7742
7634
|
return sortDir;
|
|
@@ -7754,10 +7646,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7754
7646
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
7755
7647
|
const direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
7756
7648
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
7757
|
-
await listBudgets({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: getFlag(flags, "sortBy"), sortDir: getFlag(flags, "sortDir"), includeDetails: flags.summary === !0 ? !1 : parseOptionalBoolFlag(
|
|
7758
|
-
flags,
|
|
7759
|
-
"includeDetails"
|
|
7760
|
-
) ?? !0 });
|
|
7649
|
+
await listBudgets({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: getFlag(flags, "sortBy"), sortDir: getFlag(flags, "sortDir"), includeDetails: flags.summary === !0 ? !1 : parseOptionalBoolFlag(flags, "includeDetails") ?? !0 });
|
|
7761
7650
|
}, "commandListBudgets"), commandGetBudget = __name2(async ({ flags, positional }) => {
|
|
7762
7651
|
const id = positional[0];
|
|
7763
7652
|
if (!id) throw new Error("get-budget requires <id>");
|
|
@@ -7769,15 +7658,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7769
7658
|
}, "commandUploadBudgetAttachment"), commandMarkBudgetWon = __name2(async ({ flags, positional }) => {
|
|
7770
7659
|
const [budgetId, filePath] = positional;
|
|
7771
7660
|
if (!budgetId || !filePath) throw new Error("mark-budget-won requires <budgetId> <filePath>");
|
|
7772
|
-
await markBudgetWonWithProof(budgetId, filePath, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectInvoiceSettings: getFlag(
|
|
7773
|
-
flags,
|
|
7774
|
-
"invoiceSettings"
|
|
7775
|
-
) !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
|
|
7661
|
+
await markBudgetWonWithProof(budgetId, filePath, { projectManagerId: getFlag(flags, "projectManagerId") !== void 0 ? String(getFlag(flags, "projectManagerId")) : void 0, markProjectWon: parseOptionalBoolFlag(flags, "markProjectWon"), projectInvoiceSettings: getFlag(flags, "invoiceSettings") !== void 0 ? parseJsonFlag(String(getFlag(flags, "invoiceSettings")), "--invoiceSettings") : void 0 });
|
|
7776
7662
|
}, "commandMarkBudgetWon"), commandGetBudgetItems = __name2(async ({ flags, positional }) => {
|
|
7777
7663
|
const id = positional[0];
|
|
7778
7664
|
if (!id) throw new Error("get-budget-items requires <budgetId>");
|
|
7779
7665
|
await getBudgetItemsOnly(id, { includeInactive: flags.includeInactive === !0 ? !0 : parseOptionalBoolFlag(flags, "includeInactive") ?? !1 });
|
|
7780
|
-
}, "commandGetBudgetItems"), commandGetBudgetDetails = __name2(async ({
|
|
7666
|
+
}, "commandGetBudgetItems"), commandGetBudgetDetails = __name2(async ({
|
|
7667
|
+
flags,
|
|
7668
|
+
positional
|
|
7669
|
+
}) => {
|
|
7781
7670
|
const id = positional[0];
|
|
7782
7671
|
if (!id) throw new Error("get-budget-details requires <budgetId>");
|
|
7783
7672
|
await getBudgetDetails(id, { includeInactive: flags.includeInactive === !0 ? !0 : parseOptionalBoolFlag(flags, "includeInactive") ?? !1 });
|
|
@@ -7795,18 +7684,18 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7795
7684
|
if (flags.limit === !0 || limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new CliRuntimeError("USAGE", "--limit must be an integer from 1 to 50.");
|
|
7796
7685
|
if (flags.cursor === !0 || flags.cursor === "") throw new CliRuntimeError("USAGE", "--cursor requires the nextCursor token from the previous page.");
|
|
7797
7686
|
await getBudgetVersions(id, { limit, cursor: flags.cursor, all: flags.all === !0 || (parseOptionalBoolFlag(flags, "all") ?? !1) });
|
|
7798
|
-
}, "commandGetBudgetVersions"), commandRenameBudgetVersion = __name2(
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7687
|
+
}, "commandGetBudgetVersions"), commandRenameBudgetVersion = __name2(async ({ flags, positional }) => {
|
|
7688
|
+
const versionId = positional[0], newName = getFlag(flags, "name");
|
|
7689
|
+
if (!versionId || newName === void 0) throw new Error("rename-budget-version requires <versionId> --name <text>");
|
|
7690
|
+
await renameBudgetVersion(versionId, String(newName));
|
|
7691
|
+
}, "commandRenameBudgetVersion"), commandRestoreBudgetVersion = __name2(
|
|
7692
|
+
async ({ positional }) => {
|
|
7693
|
+
const versionId = positional[0];
|
|
7694
|
+
if (!versionId) throw new Error("restore-budget-version requires <versionId>");
|
|
7695
|
+
await restoreBudgetVersion(versionId);
|
|
7803
7696
|
},
|
|
7804
|
-
"
|
|
7805
|
-
),
|
|
7806
|
-
const versionId = positional[0];
|
|
7807
|
-
if (!versionId) throw new Error("restore-budget-version requires <versionId>");
|
|
7808
|
-
await restoreBudgetVersion(versionId);
|
|
7809
|
-
}, "commandRestoreBudgetVersion"), commandUpdateBudgetStatus = __name2(async ({ flags, positional }) => {
|
|
7697
|
+
"commandRestoreBudgetVersion"
|
|
7698
|
+
), commandUpdateBudgetStatus = __name2(async ({ flags, positional }) => {
|
|
7810
7699
|
const [id, status] = positional;
|
|
7811
7700
|
if (!id || !status) throw new Error("update-budget-status requires <id> <status>");
|
|
7812
7701
|
if (!isBudgetStatusUpdate(status)) throw new Error("Invalid status. Use one of: ".concat(budgetStatusesForHelp.join(", ")));
|
|
@@ -7814,24 +7703,26 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7814
7703
|
}, "commandUpdateBudgetStatus"), commandCreateBudgetApproval = __name2(async ({ flags, positional }) => {
|
|
7815
7704
|
const id = positional[0];
|
|
7816
7705
|
if (!id) throw new Error("create-budget-approval requires <budgetId>");
|
|
7817
|
-
const companyPayloadRaw = getFlag(flags, "companyPayload"), contactPayloadRaw = getFlag(
|
|
7706
|
+
const companyPayloadRaw = getFlag(flags, "companyPayload"), contactPayloadRaw = getFlag(
|
|
7707
|
+
flags,
|
|
7708
|
+
"contactPayload"
|
|
7709
|
+
), eventPayloadRaw = getFlag(flags, "eventPayload");
|
|
7818
7710
|
await createBudgetApproval(id, { company: companyPayloadRaw !== void 0 ? parseJsonObjectFlag(String(companyPayloadRaw), "--companyPayload") : void 0, contactPerson: contactPayloadRaw !== void 0 ? parseJsonObjectFlag(String(contactPayloadRaw), "--contactPayload") : void 0, eventDetails: eventPayloadRaw !== void 0 ? parseJsonObjectFlag(String(eventPayloadRaw), "--eventPayload") : void 0 });
|
|
7819
|
-
}, "commandCreateBudgetApproval"), commandCreateEstimate = __name2(
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7711
|
+
}, "commandCreateBudgetApproval"), commandCreateEstimate = __name2(async ({ flags, positional }) => {
|
|
7712
|
+
const id = positional[0];
|
|
7713
|
+
if (!id) throw new Error("create-estimate requires <budgetId>");
|
|
7714
|
+
const companyPayloadRaw = getFlag(flags, "companyPayload"), contactPayloadRaw = getFlag(flags, "contactPayload"), eventPayloadRaw = getFlag(flags, "eventPayload");
|
|
7715
|
+
await createEstimate(id, {
|
|
7716
|
+
company: companyPayloadRaw !== void 0 ? parseJsonObjectFlag(String(companyPayloadRaw), "--companyPayload") : void 0,
|
|
7717
|
+
contactPerson: contactPayloadRaw !== void 0 ? parseJsonObjectFlag(String(contactPayloadRaw), "--contactPayload") : void 0,
|
|
7718
|
+
eventDetails: eventPayloadRaw !== void 0 ? parseJsonObjectFlag(String(eventPayloadRaw), "--eventPayload") : void 0
|
|
7719
|
+
});
|
|
7720
|
+
}, "commandCreateEstimate"), commandSendEstimateEmail = __name2(async ({ flags }) => {
|
|
7828
7721
|
const payloadRaw = getFlag(flags, "payload");
|
|
7829
7722
|
if (!payloadRaw) throw new Error("send-estimate-to-contact-person requires --payload '<json>'");
|
|
7830
7723
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7831
7724
|
await sendEstimateToContactPersonFromPayload(raw);
|
|
7832
|
-
}, "commandSendEstimateEmail"), commandCreateBudget = __name2(async ({
|
|
7833
|
-
flags
|
|
7834
|
-
}) => {
|
|
7725
|
+
}, "commandSendEstimateEmail"), commandCreateBudget = __name2(async ({ flags }) => {
|
|
7835
7726
|
const payloadRaw = getFlag(flags, "payload");
|
|
7836
7727
|
if (!payloadRaw) throw new Error("create-budget requires --payload '<json>'");
|
|
7837
7728
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
@@ -7853,34 +7744,45 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7853
7744
|
}, "commandAddBudgetItems"), commandUpdateBudgetItem = __name2(async ({ flags }) => {
|
|
7854
7745
|
const id = getFlag(flags, "id");
|
|
7855
7746
|
if (!id) throw new Error("update-budget-item requires --id");
|
|
7856
|
-
await updateBudgetItem({
|
|
7747
|
+
await updateBudgetItem({
|
|
7748
|
+
id: String(id),
|
|
7749
|
+
description: getFlag(flags, "description"),
|
|
7750
|
+
note: getFlag(flags, "note"),
|
|
7751
|
+
quantity: parseOptionalNumber(getFlag(flags, "quantity"), "--quantity"),
|
|
7752
|
+
markup: parseOptionalNumber(getFlag(flags, "markup"), "--markup"),
|
|
7753
|
+
cost: parseOptionalNumber(getFlag(flags, "cost"), "--cost"),
|
|
7754
|
+
unitPrice: parseOptionalNumber(getFlag(flags, "unitPrice"), "--unitPrice"),
|
|
7755
|
+
isFreeOfCharge: parseOptionalBoolFlag(flags, "isFreeOfCharge"),
|
|
7756
|
+
gstInclusive: parseOptionalBoolFlag(flags, "gstInclusive"),
|
|
7757
|
+
gstOutOfScope: parseOptionalBoolFlag(flags, "gstOutOfScope")
|
|
7758
|
+
});
|
|
7857
7759
|
}, "commandUpdateBudgetItem"), commandRemoveBudgetItem = __name2(async ({ positional }) => {
|
|
7858
7760
|
const id = positional[0];
|
|
7859
7761
|
if (!id) throw new Error("remove-budget-item requires <budgetItemId>");
|
|
7860
7762
|
await removeBudgetItem(id);
|
|
7861
7763
|
}, "commandRemoveBudgetItem"), commandReplaceBudgetItem = __name2(async ({ flags }) => {
|
|
7862
|
-
const budgetItemId = getFlag(
|
|
7863
|
-
flags,
|
|
7864
|
-
"budgetItemId"
|
|
7865
|
-
), replacementItemId = getFlag(flags, "replacementItemId");
|
|
7764
|
+
const budgetItemId = getFlag(flags, "budgetItemId"), replacementItemId = getFlag(flags, "replacementItemId");
|
|
7866
7765
|
if (!budgetItemId || !replacementItemId) throw new Error("replace-budget-item requires --budgetItemId and --replacementItemId");
|
|
7867
7766
|
await replaceBudgetItem({ budgetItemId: String(budgetItemId), replacementItemId: String(replacementItemId) });
|
|
7868
7767
|
}, "commandReplaceBudgetItem"), commandApproveUnavailableItemException = __name2(async ({ flags }) => {
|
|
7869
7768
|
const budgetItemId = getFlag(flags, "budgetItemId"), reason = getFlag(flags, "reason");
|
|
7870
|
-
if (!budgetItemId || !reason) throw new Error(
|
|
7769
|
+
if (!budgetItemId || !reason) throw new Error(
|
|
7770
|
+
"approve-unavailable-item-exception requires --budgetItemId and --reason"
|
|
7771
|
+
);
|
|
7871
7772
|
await approveUnavailableItemException({ budgetItemId: String(budgetItemId), reason: String(reason) });
|
|
7872
7773
|
}, "commandApproveUnavailableItemException"), commandReorderBudgetItems = __name2(async ({ flags, positional }) => {
|
|
7873
7774
|
const budgetId = positional[0], itemIdsRaw = getFlag(flags, "itemIds");
|
|
7874
7775
|
if (!budgetId || itemIdsRaw === void 0) throw new Error("reorder-budget-items requires <budgetId> --itemIds <csv>");
|
|
7875
|
-
const itemIds = parseCommaSeparatedIds(
|
|
7876
|
-
String(itemIdsRaw)
|
|
7877
|
-
);
|
|
7776
|
+
const itemIds = parseCommaSeparatedIds(String(itemIdsRaw));
|
|
7878
7777
|
if (!itemIds?.length) throw new Error("reorder-budget-items requires non-empty --itemIds <csv>");
|
|
7879
7778
|
await reorderBudgetItemsCli({ budgetId, itemIds });
|
|
7880
7779
|
}, "commandReorderBudgetItems"), commandUpdateBudgetItemSupplier = __name2(async ({ flags }) => {
|
|
7881
7780
|
const budgetItemId = getFlag(flags, "budgetItemId"), supplierId = getFlag(flags, "supplierId");
|
|
7882
7781
|
if (!budgetItemId || !supplierId) throw new Error("update-budget-item-supplier requires --budgetItemId and --supplierId");
|
|
7883
|
-
await updateBudgetItemSupplierCli({
|
|
7782
|
+
await updateBudgetItemSupplierCli({
|
|
7783
|
+
budgetItemId: String(budgetItemId),
|
|
7784
|
+
supplierId: String(supplierId)
|
|
7785
|
+
});
|
|
7884
7786
|
}, "commandUpdateBudgetItemSupplier"), commandCreateBudgetCategory = __name2(async ({ flags }) => {
|
|
7885
7787
|
const name = getFlag(flags, "name");
|
|
7886
7788
|
if (!name) throw new Error("create-budget-category requires --name");
|
|
@@ -7896,7 +7798,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7896
7798
|
}, "commandDeleteBudgetCategory"), commandUpdateBudgetCommission = __name2(async ({ flags }) => {
|
|
7897
7799
|
const payloadRaw = getFlag(flags, "payload");
|
|
7898
7800
|
if (!payloadRaw) throw new Error("update-budget-commission requires --payload '<json>'");
|
|
7899
|
-
const raw = parseJsonFlag(
|
|
7801
|
+
const raw = parseJsonFlag(
|
|
7802
|
+
String(payloadRaw),
|
|
7803
|
+
"--payload"
|
|
7804
|
+
);
|
|
7900
7805
|
await updateBudgetCommissionFromPayload(raw);
|
|
7901
7806
|
}, "commandUpdateBudgetCommission"), commandUpdateBudgetDiscount = __name2(async ({ flags }) => {
|
|
7902
7807
|
const payloadRaw = getFlag(flags, "payload");
|
|
@@ -7947,19 +7852,17 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7947
7852
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
7948
7853
|
if (flags.quotationIds === !0 || flags.quotationId === !0) throw new Error("--quotationIds requires a CSV value and --quotationId requires an ID value.");
|
|
7949
7854
|
const quotationIds = parseCommaSeparatedIds(getFlag(flags, "quotationIds")), quotationId = getFlag(flags, "quotationId")?.trim() || void 0;
|
|
7950
|
-
if (quotationId && quotationIds && (quotationIds.length !== 1 || quotationIds[0] !== quotationId))
|
|
7951
|
-
throw new Error("--quotationId conflicts with --quotationIds.");
|
|
7855
|
+
if (quotationId && quotationIds && (quotationIds.length !== 1 || quotationIds[0] !== quotationId)) throw new Error("--quotationId conflicts with --quotationIds.");
|
|
7952
7856
|
if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
|
|
7953
7857
|
await validateBillSelectionFromPayload(raw, { ...quotationId ? { quotationId } : {}, ...quotationIds ? { quotationIds } : {} });
|
|
7954
7858
|
}, "commandValidateBillSelection"), commandLinkBillQuotations = __name2(async ({ flags, positional }) => {
|
|
7955
|
-
const billId = positional[0], payloadRaw = getFlag(flags, "payload"), quotationIds = parseCommaSeparatedIds(
|
|
7859
|
+
const billId = positional[0], payloadRaw = getFlag(flags, "payload"), quotationIds = parseCommaSeparatedIds(
|
|
7860
|
+
getFlag(flags, "quotationIds")
|
|
7861
|
+
);
|
|
7956
7862
|
if (!billId || !payloadRaw && (!quotationIds || quotationIds.length === 0)) throw new Error("link-bill-quotations requires <billId> and either --payload '<json>' or --quotationIds <csv>");
|
|
7957
7863
|
if (payloadRaw && quotationIds) throw new Error("--payload cannot be combined with --quotationIds.");
|
|
7958
7864
|
if (quotationIds && new Set(quotationIds).size !== quotationIds.length) throw new Error("--quotationIds must not contain duplicates.");
|
|
7959
|
-
await linkBillQuotations(billId, payloadRaw ? parseJsonFlag(
|
|
7960
|
-
String(payloadRaw),
|
|
7961
|
-
"--payload"
|
|
7962
|
-
) : { quotationIds });
|
|
7865
|
+
await linkBillQuotations(billId, payloadRaw ? parseJsonFlag(String(payloadRaw), "--payload") : { quotationIds });
|
|
7963
7866
|
}, "commandLinkBillQuotations"), commandUpdateBill = __name2(async ({ flags }) => {
|
|
7964
7867
|
const payloadRaw = getFlag(flags, "payload");
|
|
7965
7868
|
if (!payloadRaw) throw new Error("update-bill requires --payload '<json>'");
|
|
@@ -7986,12 +7889,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
7986
7889
|
}, "commandListExternalPaymentAccounts"), commandRefreshExternalPaymentAccounts = __name2(async () => {
|
|
7987
7890
|
await refreshExternalBillPaymentAccounts();
|
|
7988
7891
|
}, "commandRefreshExternalPaymentAccounts"), commandRecordExternalBillPayment = __name2(async ({ flags, positional }) => {
|
|
7989
|
-
const id = positional[0], paymentReference = getFlag(
|
|
7990
|
-
flags,
|
|
7991
|
-
"paymentReference"
|
|
7992
|
-
), paymentDate = getFlag(flags, "paymentDate"), paymentAccount = getFlag(flags, "paymentAccount"), paymentProofPath = getFlag(flags, "paymentProof");
|
|
7892
|
+
const id = positional[0], paymentReference = getFlag(flags, "paymentReference"), paymentDate = getFlag(flags, "paymentDate"), paymentAccount = getFlag(flags, "paymentAccount"), paymentProofPath = getFlag(flags, "paymentProof");
|
|
7993
7893
|
if (!id || !paymentReference || !paymentDate || !paymentAccount) throw new Error("record-external-bill-payment requires <billId> --paymentReference --paymentDate YYYY-MM-DD --paymentAccount <QBO account ID> [--paymentProof receipt.pdf]");
|
|
7994
|
-
await recordExternalBillPayment({
|
|
7894
|
+
await recordExternalBillPayment({
|
|
7895
|
+
id,
|
|
7896
|
+
paymentReference,
|
|
7897
|
+
paymentDate,
|
|
7898
|
+
paymentAccount,
|
|
7899
|
+
paymentProofPath
|
|
7900
|
+
});
|
|
7995
7901
|
}, "commandRecordExternalBillPayment"), commandPatchBillPayment = __name2(async ({ flags, positional }) => {
|
|
7996
7902
|
const id = positional[0];
|
|
7997
7903
|
if (!id) throw new Error("patch-bill-payment requires <billId>");
|
|
@@ -8007,7 +7913,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8007
7913
|
if (raw !== void 0) return String(raw);
|
|
8008
7914
|
})(), quickbooksBillId = (() => {
|
|
8009
7915
|
const clear = parseOptionalBoolFlag(flags, "clearQuickbooksBillId"), raw = getFlag(flags, "quickbooksBillId");
|
|
8010
|
-
if (clear === !0 && raw !== void 0) throw new Error(
|
|
7916
|
+
if (clear === !0 && raw !== void 0) throw new Error(
|
|
7917
|
+
"Use either --quickbooksBillId or --clearQuickbooksBillId true, not both"
|
|
7918
|
+
);
|
|
8011
7919
|
if (clear === !0) return null;
|
|
8012
7920
|
if (raw !== void 0) return String(raw);
|
|
8013
7921
|
})(), paymentDate = (() => {
|
|
@@ -8033,9 +7941,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8033
7941
|
}, "commandGetBillLineItems"), commandGetBillPayment = __name2(async ({ positional }) => {
|
|
8034
7942
|
const id = positional[0];
|
|
8035
7943
|
if (!id) throw new Error("get-bill-payment requires <billId>");
|
|
8036
|
-
await getBillPayment(
|
|
8037
|
-
id
|
|
8038
|
-
);
|
|
7944
|
+
await getBillPayment(id);
|
|
8039
7945
|
}, "commandGetBillPayment"), commandStageBillAttachment = __name2(async ({ flags, positional }) => {
|
|
8040
7946
|
const [projectId, ...positionalFilePaths] = positional, fileFlag = getFlag(flags, "file"), filesFlag = getFlag(flags, "files"), filePaths = [...positionalFilePaths, ...fileFlag !== void 0 ? [String(fileFlag)] : [], ...filesFlag !== void 0 ? String(filesFlag).split(",").map((value) => value.trim()).filter(Boolean) : []];
|
|
8041
7947
|
if (!projectId || filePaths.length === 0) throw new Error("stage-bill-attachment requires <projectId> <filePath...> or --file/--files");
|
|
@@ -8054,10 +7960,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8054
7960
|
if (!billId) throw new Error("attach-bill-documents requires <billId>");
|
|
8055
7961
|
const getFlagAlias = __name2((...flagNames) => {
|
|
8056
7962
|
for (const flagName of flagNames) {
|
|
8057
|
-
const value = getFlag(
|
|
8058
|
-
flags,
|
|
8059
|
-
flagName
|
|
8060
|
-
);
|
|
7963
|
+
const value = getFlag(flags, flagName);
|
|
8061
7964
|
if (value !== void 0) return value;
|
|
8062
7965
|
}
|
|
8063
7966
|
}, "getFlagAlias"), parseFilesFlag = __name2((...flagNames) => {
|
|
@@ -8089,11 +7992,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8089
7992
|
rejectRetiredPageFlags(flags);
|
|
8090
7993
|
for (const key of ["limit", "cursor", "direction"]) if (flags[key] !== void 0) throw new Error("count-quotations does not accept --".concat(key, "; totals use filters only."));
|
|
8091
7994
|
await countQuotations({ ...parseQuotationFilterFlags(flags), includeMetrics: parseOptionalBoolFlag(flags, "includeMetrics") ?? !1 });
|
|
8092
|
-
}, "commandCountQuotations"), commandGetQuotation = __name2(
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
7995
|
+
}, "commandCountQuotations"), commandGetQuotation = __name2(
|
|
7996
|
+
async ({ positional }) => {
|
|
7997
|
+
const id = positional[0];
|
|
7998
|
+
if (!id) throw new Error("get-quotation requires <quotationId>");
|
|
7999
|
+
await getQuotationDetails(id);
|
|
8000
|
+
},
|
|
8001
|
+
"commandGetQuotation"
|
|
8002
|
+
), commandGetQuotationLineItems = __name2(async ({ flags, positional }) => {
|
|
8097
8003
|
const page = parseDetailFeedPage("get-quotation-line-items", "<quotationId>", positional, flags, 100);
|
|
8098
8004
|
await getQuotationLineItems(page);
|
|
8099
8005
|
}, "commandGetQuotationLineItems"), commandUploadQuotationAttachment = __name2(async ({ positional }) => {
|
|
@@ -8103,7 +8009,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8103
8009
|
}, "commandUploadQuotationAttachment"), commandCleanupStagedQuotationAttachments = __name2(async ({ flags, positional }) => {
|
|
8104
8010
|
const projectId = positional[0], keys = parseCommaSeparatedIds(getFlag(flags, "keys"));
|
|
8105
8011
|
if (!projectId || !keys) throw new Error("cleanup-staged-quotation-attachments requires <projectId> --keys <csv>");
|
|
8106
|
-
await cleanupStagedQuotationAttachments(
|
|
8012
|
+
await cleanupStagedQuotationAttachments(
|
|
8013
|
+
projectId,
|
|
8014
|
+
keys
|
|
8015
|
+
);
|
|
8107
8016
|
}, "commandCleanupStagedQuotationAttachments"), commandCreateQuotation = __name2(async ({ flags }) => {
|
|
8108
8017
|
const payloadRaw = getFlag(flags, "payload");
|
|
8109
8018
|
if (!payloadRaw) throw new Error("create-quotation requires --payload '<json>'");
|
|
@@ -8113,9 +8022,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8113
8022
|
const payloadRaw = getFlag(flags, "payload");
|
|
8114
8023
|
if (!payloadRaw) throw new Error("update-quotation requires --payload '<json>'");
|
|
8115
8024
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8116
|
-
await updateQuotationFromPayload(
|
|
8117
|
-
raw
|
|
8118
|
-
);
|
|
8025
|
+
await updateQuotationFromPayload(raw);
|
|
8119
8026
|
}, "commandUpdateQuotation"), commandDeleteQuotation = __name2(async ({ positional }) => {
|
|
8120
8027
|
const id = positional[0];
|
|
8121
8028
|
if (!id) throw new Error("delete-quotation requires <quotationId>");
|
|
@@ -8123,7 +8030,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8123
8030
|
}, "commandDeleteQuotation"), commandSubmitQuotation = __name2(async ({ flags, positional }) => {
|
|
8124
8031
|
const id = positional[0];
|
|
8125
8032
|
if (!id) throw new Error("submit-quotation requires <quotationId>");
|
|
8126
|
-
await submitQuotation(id, getFlag(
|
|
8033
|
+
await submitQuotation(id, getFlag(
|
|
8034
|
+
flags,
|
|
8035
|
+
"overBudgetOverrideReason"
|
|
8036
|
+
));
|
|
8127
8037
|
}, "commandSubmitQuotation"), commandApproveQuotation = __name2(async ({ flags, positional }) => {
|
|
8128
8038
|
const id = positional[0];
|
|
8129
8039
|
if (!id) throw new Error("approve-quotation requires <quotationId>");
|
|
@@ -8132,16 +8042,14 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8132
8042
|
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8133
8043
|
if (!id || reason === void 0) throw new Error("reject-quotation requires <quotationId> --reason <text>");
|
|
8134
8044
|
await rejectQuotation(id, reason);
|
|
8135
|
-
}, "commandRejectQuotation"), commandDownloadQuotationPdf = __name2(
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
"commandDownloadQuotationPdf"
|
|
8144
|
-
), commandCheckCustomerInvoiceReadiness = __name2(async ({ positional }) => {
|
|
8045
|
+
}, "commandRejectQuotation"), commandDownloadQuotationPdf = __name2(async ({ positional }) => {
|
|
8046
|
+
const id = positional[0];
|
|
8047
|
+
if (!id) throw new Error("download-quotation-pdf requires <quotationId> [original|staff|final]");
|
|
8048
|
+
const roleRaw = (positional[1] ?? "final").toLowerCase(), fileRole = roleRaw === "original" ? SupplierQuotationFileRole.ORIGINAL : roleRaw === "staff" ? SupplierQuotationFileRole.STAFF_SIGNED : roleRaw === "final" ? SupplierQuotationFileRole.FINAL_SIGNED : null;
|
|
8049
|
+
if (!fileRole)
|
|
8050
|
+
throw new Error("download-quotation-pdf role must be original, staff, or final");
|
|
8051
|
+
await downloadQuotationPdf(id, fileRole);
|
|
8052
|
+
}, "commandDownloadQuotationPdf"), commandCheckCustomerInvoiceReadiness = __name2(async ({ positional }) => {
|
|
8145
8053
|
const budgetId = positional[0];
|
|
8146
8054
|
if (!budgetId) throw new Error("check-customer-invoice-readiness requires <budgetId>");
|
|
8147
8055
|
await checkCustomerInvoiceReadiness(budgetId);
|
|
@@ -8158,10 +8066,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8158
8066
|
if (!budgetId || positional.length !== 1) throw new Error("list-available-qbo-customer-invoices requires <budgetId>");
|
|
8159
8067
|
await listAvailableQboCustomerInvoices(budgetId);
|
|
8160
8068
|
}, "commandListAvailableQboCustomerInvoices"), customerInvoiceFiltersFromFlags = __name2((flags, positionalBudgetId) => {
|
|
8161
|
-
const projectId = getFlag(
|
|
8162
|
-
flags,
|
|
8163
|
-
"projectId"
|
|
8164
|
-
), projectIds = parseCommaSeparatedIds(getFlag(flags, "projectIds"));
|
|
8069
|
+
const projectId = getFlag(flags, "projectId"), projectIds = parseCommaSeparatedIds(getFlag(flags, "projectIds"));
|
|
8165
8070
|
if (projectId && projectIds) throw new Error("Use either --projectId for project scope or --projectIds for a global filter, not both.");
|
|
8166
8071
|
const budgetIds = [...positionalBudgetId ? [positionalBudgetId] : [], ...parseCommaSeparatedIds(getFlag(flags, "budgetIds")) ?? []], statusRaw = getFlag(flags, "status");
|
|
8167
8072
|
return { scope: projectId ? { type: "project", projectId } : { type: "global" }, q: getFlag(flags, "search") ?? "", statuses: parseCommaSeparatedCustomerInvoiceStatuses(statusRaw !== void 0 ? String(statusRaw) : void 0), companyIds: parseCommaSeparatedIds(getFlag(flags, "companyIds")), projectIds, budgetIds: budgetIds.length > 0 ? [...new Set(budgetIds)] : void 0, createdByIds: parseCommaSeparatedIds(getFlag(flags, "createdByIds")) };
|
|
@@ -8173,7 +8078,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8173
8078
|
}
|
|
8174
8079
|
rejectBarePagingFlags(flags);
|
|
8175
8080
|
const { cursor, direction } = parseCursorAndDirection(flags), sortDir = parseOptionalBillListSortDir(getFlag(flags, "sortDir"));
|
|
8176
|
-
await listCustomerInvoices({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCustomerInvoiceSortBy(getFlag(
|
|
8081
|
+
await listCustomerInvoices({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: parseCustomerInvoiceSortBy(getFlag(
|
|
8082
|
+
flags,
|
|
8083
|
+
"sortBy"
|
|
8084
|
+
)), sortDir: sortDir ?? "desc" });
|
|
8177
8085
|
}, "commandListCustomerInvoices"), commandGetCustomerInvoice = __name2(async ({ positional }) => {
|
|
8178
8086
|
const batchId = positional[0];
|
|
8179
8087
|
if (!batchId) throw new Error("get-customer-invoice requires <batchId>");
|
|
@@ -8213,7 +8121,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8213
8121
|
}, "commandPreviewQboCustomerInvoice"), commandCreateCustomerInvoice = __name2(async ({ flags }) => {
|
|
8214
8122
|
const payloadRaw = getFlag(flags, "payload");
|
|
8215
8123
|
if (!payloadRaw) throw new Error("create-customer-invoice requires --payload '<json>'");
|
|
8216
|
-
await createCustomerInvoice(parseJsonFlag(String(
|
|
8124
|
+
await createCustomerInvoice(parseJsonFlag(String(
|
|
8125
|
+
payloadRaw
|
|
8126
|
+
), "--payload"));
|
|
8217
8127
|
}, "commandCreateCustomerInvoice"), commandResubmitCustomerInvoice = __name2(async ({ positional }) => {
|
|
8218
8128
|
const batchId = positional[0];
|
|
8219
8129
|
if (!batchId) throw new Error("resubmit-customer-invoice requires <batchId>");
|
|
@@ -8230,19 +8140,19 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8230
8140
|
const batchId = positional[0];
|
|
8231
8141
|
if (!batchId) throw new Error("void-customer-invoice requires <batchId>");
|
|
8232
8142
|
await voidCustomerInvoice(batchId);
|
|
8233
|
-
}, "commandVoidCustomerInvoice"), commandApproveCustomerInvoice = __name2(
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8143
|
+
}, "commandVoidCustomerInvoice"), commandApproveCustomerInvoice = __name2(
|
|
8144
|
+
async ({ positional }) => {
|
|
8145
|
+
const batchId = positional[0];
|
|
8146
|
+
if (!batchId) throw new Error("approve-customer-invoice requires <batchId>");
|
|
8147
|
+
await approveCustomerInvoice(batchId);
|
|
8148
|
+
},
|
|
8149
|
+
"commandApproveCustomerInvoice"
|
|
8150
|
+
), commandRejectCustomerInvoice = __name2(async ({ flags, positional }) => {
|
|
8238
8151
|
const batchId = positional[0], reason = getFlag(flags, "reason");
|
|
8239
8152
|
if (!batchId || reason === void 0) throw new Error("reject-customer-invoice requires <batchId> --reason <text>");
|
|
8240
8153
|
await rejectCustomerInvoice(batchId, String(reason));
|
|
8241
8154
|
}, "commandRejectCustomerInvoice"), commandSendCustomerInvoiceToContactPerson = __name2(async ({ flags }) => {
|
|
8242
|
-
const payloadRaw = getFlag(
|
|
8243
|
-
flags,
|
|
8244
|
-
"payload"
|
|
8245
|
-
);
|
|
8155
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8246
8156
|
if (!payloadRaw) throw new Error("send-customer-invoice-to-contact-person requires --payload '<json>'");
|
|
8247
8157
|
await sendCustomerInvoiceToContactPersonFromPayload(parseJsonFlag(String(payloadRaw), "--payload"));
|
|
8248
8158
|
}, "commandSendCustomerInvoiceToContactPerson"), commandDownloadCustomerInvoicePdf = __name2(async ({ flags, positional }) => {
|
|
@@ -8255,15 +8165,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8255
8165
|
const requestId = getFlag(flags, "requestId");
|
|
8256
8166
|
await updateCustomerInvoiceDetails({ billingAddress: billingAddress.replaceAll("\\n", "\n"), customerMemo, invoiceId, ...typeof requestId == "string" ? { requestId } : {} });
|
|
8257
8167
|
}, "commandUpdateCustomerInvoiceDetails"), commandUpdateCustomerInvoiceQboDrift = __name2(async ({ flags, positional }) => {
|
|
8258
|
-
const invoiceId = positional[0], resolution = getFlag(
|
|
8168
|
+
const invoiceId = positional[0], resolution = getFlag(
|
|
8169
|
+
flags,
|
|
8170
|
+
"resolution"
|
|
8171
|
+
);
|
|
8259
8172
|
if (!invoiceId || resolution !== "ACCEPT_QBO" && resolution !== "KEEP_BB") throw new Error("update-customer-invoice-qbo-drift requires <invoiceId> --resolution ACCEPT_QBO|KEEP_BB");
|
|
8260
8173
|
const requestId = getFlag(flags, "requestId");
|
|
8261
8174
|
await updateCustomerInvoiceQboDrift({ invoiceId, resolution, ...typeof requestId == "string" ? { requestId } : {} });
|
|
8262
8175
|
}, "commandUpdateCustomerInvoiceQboDrift"), commandMarkCustomerInvoiceSentExternally = __name2(async ({ flags, positional }) => {
|
|
8263
8176
|
const invoiceId = positional[0], sentAt = getFlag(flags, "sentAt"), recipients = getFlag(flags, "recipients");
|
|
8264
|
-
if (!invoiceId || !sentAt || !recipients) throw new Error(
|
|
8265
|
-
"mark-customer-invoice-sent-externally requires <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>]"
|
|
8266
|
-
);
|
|
8177
|
+
if (!invoiceId || !sentAt || !recipients) throw new Error("mark-customer-invoice-sent-externally requires <invoiceId> --sentAt <ISO datetime> --recipients a@x.com,b@y.com [--note <text>]");
|
|
8267
8178
|
await markCustomerInvoiceSentExternally({ invoiceId, sentAt, recipients: recipients.split(",").map((recipient) => recipient.trim()).filter(Boolean), note: getFlag(flags, "note") });
|
|
8268
8179
|
}, "commandMarkCustomerInvoiceSentExternally"), commandSyncCustomerInvoice = __name2(async ({ positional }) => {
|
|
8269
8180
|
const invoiceId = positional[0];
|
|
@@ -8290,17 +8201,18 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8290
8201
|
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8291
8202
|
if (!id || reason === void 0) throw new Error("reject-budget requires <budgetId> --reason <text>");
|
|
8292
8203
|
await rejectBudget(id, reason);
|
|
8293
|
-
}, "commandRejectBudget"), commandApproveSupplier = __name2(async ({
|
|
8294
|
-
positional
|
|
8295
|
-
}) => {
|
|
8204
|
+
}, "commandRejectBudget"), commandApproveSupplier = __name2(async ({ positional }) => {
|
|
8296
8205
|
const id = positional[0];
|
|
8297
8206
|
if (!id) throw new Error("approve-supplier requires <supplierId>");
|
|
8298
8207
|
await approveSupplier(id);
|
|
8299
|
-
}, "commandApproveSupplier"), commandRejectSupplier = __name2(
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8208
|
+
}, "commandApproveSupplier"), commandRejectSupplier = __name2(
|
|
8209
|
+
async ({ flags, positional }) => {
|
|
8210
|
+
const id = positional[0], reason = getFlag(flags, "reason");
|
|
8211
|
+
if (!id || reason === void 0) throw new Error("reject-supplier requires <supplierId> --reason <text>");
|
|
8212
|
+
await rejectSupplier(id, reason);
|
|
8213
|
+
},
|
|
8214
|
+
"commandRejectSupplier"
|
|
8215
|
+
), commandGetSupplierDetails = __name2(async ({ positional }) => {
|
|
8304
8216
|
const id = positional[0];
|
|
8305
8217
|
if (!id) throw new Error("get-supplier-details requires <supplierId>");
|
|
8306
8218
|
await getSupplierDetails(id);
|
|
@@ -8311,9 +8223,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8311
8223
|
}, "commandGetSupplierOverview"), commandGetSupplierUsage = __name2(async ({ positional }) => {
|
|
8312
8224
|
const id = positional[0];
|
|
8313
8225
|
if (!id) throw new Error("get-supplier-usage requires <supplierId>");
|
|
8314
|
-
await getSupplierUsage(
|
|
8315
|
-
id
|
|
8316
|
-
);
|
|
8226
|
+
await getSupplierUsage(id);
|
|
8317
8227
|
}, "commandGetSupplierUsage"), commandGetSupplierItems = __name2(async ({ positional }) => {
|
|
8318
8228
|
const id = positional[0];
|
|
8319
8229
|
if (!id) throw new Error("get-supplier-items requires <supplierId>");
|
|
@@ -8334,7 +8244,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8334
8244
|
}, "commandCreateCompany"), commandSearchExistingCompanies = __name2(async ({ flags }) => {
|
|
8335
8245
|
const query = getFlag(flags, "query");
|
|
8336
8246
|
if (!query) throw new Error("search-existing-companies requires --query <name>");
|
|
8337
|
-
rejectRetiredPageFlags(
|
|
8247
|
+
rejectRetiredPageFlags(
|
|
8248
|
+
flags
|
|
8249
|
+
);
|
|
8338
8250
|
for (const key of ["limit", "cursor"]) rejectBareFlag(flags, key);
|
|
8339
8251
|
const cursor = getFlag(flags, "cursor");
|
|
8340
8252
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
@@ -8342,12 +8254,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8342
8254
|
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 50)) throw new Error("--limit must be an integer from 1 to 50.");
|
|
8343
8255
|
await searchExistingCompanies({ query, limit, cursor });
|
|
8344
8256
|
}, "commandSearchExistingCompanies"), commandUseExistingCompany = __name2(async ({ flags }) => {
|
|
8345
|
-
const companyId = getFlag(
|
|
8346
|
-
flags,
|
|
8347
|
-
"companyId"
|
|
8348
|
-
), quickbooksId = getFlag(flags, "quickbooksId");
|
|
8257
|
+
const companyId = getFlag(flags, "companyId"), quickbooksId = getFlag(flags, "quickbooksId");
|
|
8349
8258
|
if (!companyId && !quickbooksId) throw new Error("Supply --companyId and/or --quickbooksId");
|
|
8350
|
-
companyId ? await reuseExistingCompany({ source: "bb", companyId, quickbooksId, confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") }) : quickbooksId && await reuseExistingCompany({ source: "qbo", quickbooksId, name: getFlag(flags, "name"), website: getFlag(
|
|
8259
|
+
companyId ? await reuseExistingCompany({ source: "bb", companyId, quickbooksId, confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") }) : quickbooksId && await reuseExistingCompany({ source: "qbo", quickbooksId, name: getFlag(flags, "name"), website: getFlag(
|
|
8260
|
+
flags,
|
|
8261
|
+
"website"
|
|
8262
|
+
), confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct") });
|
|
8351
8263
|
}, "commandUseExistingCompany"), commandUpdateCompany = __name2(async ({ flags }) => {
|
|
8352
8264
|
const payloadRaw = getFlag(flags, "payload");
|
|
8353
8265
|
if (!payloadRaw) throw new Error("update-company requires --payload '<json>'");
|
|
@@ -8356,9 +8268,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8356
8268
|
}, "commandUpdateCompany"), commandGetCompanyQuickbooksSyncStatus = __name2(async ({ positional }) => {
|
|
8357
8269
|
const id = positional[0];
|
|
8358
8270
|
if (!id) throw new Error("get-company-quickbooks-sync-status requires <companyId>");
|
|
8359
|
-
await getCompanyQuickBooksSyncStatus(
|
|
8360
|
-
id
|
|
8361
|
-
);
|
|
8271
|
+
await getCompanyQuickBooksSyncStatus(id);
|
|
8362
8272
|
}, "commandGetCompanyQuickbooksSyncStatus"), commandDeleteCompany = __name2(async ({ positional }) => {
|
|
8363
8273
|
const id = positional[0];
|
|
8364
8274
|
if (!id) throw new Error("delete-company requires <id>");
|
|
@@ -8366,7 +8276,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8366
8276
|
}, "commandDeleteCompany"), commandListProjects = __name2(async ({ flags }) => {
|
|
8367
8277
|
await listProjects(parseProjectListFlags(flags));
|
|
8368
8278
|
}, "commandListProjects"), commandCountProjects = __name2(async ({ flags }) => {
|
|
8369
|
-
await countProjects(
|
|
8279
|
+
await countProjects(
|
|
8280
|
+
parseProjectCountFlags(flags)
|
|
8281
|
+
);
|
|
8370
8282
|
}, "commandCountProjects"), commandListProjectHubs = __name2(async ({ cmd, flags }) => {
|
|
8371
8283
|
rejectRetiredPageFlags(flags);
|
|
8372
8284
|
const filters = { q: getFlag(flags, "q"), statuses: parseCommaSeparatedProjectStatuses(getFlag(flags, "status")) };
|
|
@@ -8389,17 +8301,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8389
8301
|
const projectId = positional[0];
|
|
8390
8302
|
if (!projectId) throw new Error("get-project-hub-status requires <projectId>");
|
|
8391
8303
|
await getProjectHubStatus(projectId);
|
|
8392
|
-
}, "commandGetProjectHubStatus"), commandSetupProjectHub = __name2(
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
},
|
|
8398
|
-
"commandSetupProjectHub"
|
|
8399
|
-
), commandSyncProjectHubCommercialDocuments = __name2(async ({ positional }) => {
|
|
8304
|
+
}, "commandGetProjectHubStatus"), commandSetupProjectHub = __name2(async ({ positional }) => {
|
|
8305
|
+
const projectId = positional[0];
|
|
8306
|
+
if (!projectId) throw new Error("setup-project-hub requires <projectId>");
|
|
8307
|
+
await setupProjectHub(projectId);
|
|
8308
|
+
}, "commandSetupProjectHub"), commandSyncProjectHubCommercialDocuments = __name2(async ({ positional }) => {
|
|
8400
8309
|
const projectId = positional[0];
|
|
8401
8310
|
if (!projectId) throw new Error("sync-project-hub-commercial-documents requires <projectId>");
|
|
8402
|
-
await syncProjectHubCommercialDocuments(
|
|
8311
|
+
await syncProjectHubCommercialDocuments(
|
|
8312
|
+
projectId
|
|
8313
|
+
);
|
|
8403
8314
|
}, "commandSyncProjectHubCommercialDocuments"), commandCreateProject = __name2(async ({ flags }) => {
|
|
8404
8315
|
const name = getFlag(flags, "name"), companyId = getFlag(flags, "companyId"), contactPersonId = getFlag(flags, "contactPersonId"), insideSalesId = getFlag(flags, "insideSalesId"), businessDevelopmentId = getFlag(flags, "businessDevelopmentId"), projectManagerId = getFlag(flags, "projectManagerId"), venue = getFlag(flags, "venue"), pax = getFlag(flags, "pax"), asanaTaskId = getFlag(flags, "asanaTaskId"), asanaSearch = getFlag(flags, "asanaSearch"), startDate = getFlag(flags, "startDate");
|
|
8405
8316
|
if (getFlag(flags, "requestQboAccountantNotification") !== void 0) throw new Error("create-project does not allow --requestQboAccountantNotification; CLI project creation always requests the QuickBooks project import like the web app.");
|
|
@@ -8408,10 +8319,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8408
8319
|
}, "commandCreateProject"), commandUpdateProject = __name2(async ({ flags }) => {
|
|
8409
8320
|
const payloadRaw = getFlag(flags, "payload");
|
|
8410
8321
|
if (!payloadRaw) throw new Error("update-project requires --payload '<json>'");
|
|
8411
|
-
const raw = parseJsonFlag(
|
|
8412
|
-
String(payloadRaw),
|
|
8413
|
-
"--payload"
|
|
8414
|
-
);
|
|
8322
|
+
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8415
8323
|
await updateProjectFromPayload(raw);
|
|
8416
8324
|
}, "commandUpdateProject"), commandDeleteProject = __name2(async ({ positional }) => {
|
|
8417
8325
|
const id = positional[0];
|
|
@@ -8451,7 +8359,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8451
8359
|
const payloadRaw = getFlag(flags, "payload");
|
|
8452
8360
|
if (!payloadRaw) throw new Error("update-contact-person requires --payload '<json>'");
|
|
8453
8361
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8454
|
-
await updateContactPersonFromPayload(
|
|
8362
|
+
await updateContactPersonFromPayload(
|
|
8363
|
+
raw
|
|
8364
|
+
);
|
|
8455
8365
|
}, "commandUpdateContactPerson"), commandCountSuppliers = __name2(async ({ flags }) => {
|
|
8456
8366
|
await countSuppliers(parseCountSuppliersFlags(flags));
|
|
8457
8367
|
}, "commandCountSuppliers"), commandListSuppliers = __name2(async ({ flags }) => {
|
|
@@ -8461,15 +8371,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8461
8371
|
if (!payloadRaw) throw new Error("create-supplier requires --payload '<json>'");
|
|
8462
8372
|
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8463
8373
|
await createSupplierFromPayload(raw);
|
|
8464
|
-
}, "commandCreateSupplier"), commandUpdateSupplier = __name2(
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
},
|
|
8471
|
-
"commandUpdateSupplier"
|
|
8472
|
-
), commandDeleteSuppliers = __name2(async ({ flags }) => {
|
|
8374
|
+
}, "commandCreateSupplier"), commandUpdateSupplier = __name2(async ({ flags }) => {
|
|
8375
|
+
const payloadRaw = getFlag(flags, "payload");
|
|
8376
|
+
if (!payloadRaw) throw new Error("update-supplier requires --payload '<json>'");
|
|
8377
|
+
const raw = parseJsonFlag(String(payloadRaw), "--payload");
|
|
8378
|
+
await updateSupplierFromPayload(raw);
|
|
8379
|
+
}, "commandUpdateSupplier"), commandDeleteSuppliers = __name2(async ({ flags }) => {
|
|
8473
8380
|
const idsRaw = getFlag(flags, "ids");
|
|
8474
8381
|
if (idsRaw === void 0) throw new Error("delete-suppliers requires --ids <csv>");
|
|
8475
8382
|
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
@@ -8481,9 +8388,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8481
8388
|
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8482
8389
|
if (!ids?.length) throw new Error("reactivate-suppliers requires non-empty --ids");
|
|
8483
8390
|
await reactivateSuppliersByIds(ids);
|
|
8484
|
-
}, "commandReactivateSuppliers"), commandCreateCertification = __name2(async ({
|
|
8485
|
-
flags
|
|
8486
|
-
}) => {
|
|
8391
|
+
}, "commandReactivateSuppliers"), commandCreateCertification = __name2(async ({ flags }) => {
|
|
8487
8392
|
const name = getFlag(flags, "name");
|
|
8488
8393
|
if (!name) throw new Error("create-certification requires --name");
|
|
8489
8394
|
await createSupplierCertification(String(name));
|
|
@@ -8502,15 +8407,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8502
8407
|
}, "commandCreateSupplierTag"), supplierAnalyticsFiltersFromFlags = __name2((flags) => {
|
|
8503
8408
|
rejectRetiredPageFlags(flags);
|
|
8504
8409
|
const tfRaw = getFlag(flags, "timeFrame");
|
|
8505
|
-
for (const key of [
|
|
8506
|
-
"name",
|
|
8507
|
-
"status",
|
|
8508
|
-
"gstRegistered",
|
|
8509
|
-
"createdBy",
|
|
8510
|
-
"startDate",
|
|
8511
|
-
"endDate",
|
|
8512
|
-
"timeFrame"
|
|
8513
|
-
]) rejectBareFlag(flags, key);
|
|
8410
|
+
for (const key of ["name", "status", "gstRegistered", "createdBy", "startDate", "endDate", "timeFrame"]) rejectBareFlag(flags, key);
|
|
8514
8411
|
const timeFrame = parseOptionalSupplierAnalyticsTimeFrame(tfRaw !== void 0 ? String(tfRaw) : void 0), startDate = getFlag(flags, "startDate"), endDate = getFlag(flags, "endDate");
|
|
8515
8412
|
if ((startDate || endDate) && timeFrame !== "CUSTOM") throw new Error("--startDate/--endDate need --timeFrame CUSTOM; other time frames ignore them.");
|
|
8516
8413
|
const status = getFlag(flags, "status")?.split(",").map((value) => value.trim()).filter(Boolean), badStatus = status?.find((value) => !Object.values(ApprovalStatus2).some((s) => s === value));
|
|
@@ -8525,7 +8422,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8525
8422
|
return;
|
|
8526
8423
|
}
|
|
8527
8424
|
rejectBarePagingFlags(flags);
|
|
8528
|
-
const { cursor, direction } = parseCursorAndDirection(
|
|
8425
|
+
const { cursor, direction } = parseCursorAndDirection(
|
|
8426
|
+
flags
|
|
8427
|
+
), sortBy = getFlag(flags, "sortBy");
|
|
8529
8428
|
if (sortBy !== void 0 && !SUPPLIER_ANALYTICS_SORT_IDS.some((id) => id === sortBy)) throw new Error("--sortBy must be one of: ".concat(SUPPLIER_ANALYTICS_SORT_IDS.join(", "), "."));
|
|
8530
8429
|
await getSupplierAnalytics({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy: SUPPLIER_ANALYTICS_SORT_IDS.find((id) => id === sortBy), sortDir: parseOptionalBillListSortDir(getFlag(flags, "sortDir")) });
|
|
8531
8430
|
}, "commandGetSupplierAnalytics"), commandListItems = __name2(async ({ cmd, flags }) => {
|
|
@@ -8546,8 +8445,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8546
8445
|
await getItem(id);
|
|
8547
8446
|
}, "commandGetItem"), commandGetItemQuickbooksSyncStatus = __name2(async ({ positional }) => {
|
|
8548
8447
|
const id = positional[0];
|
|
8549
|
-
if (!id)
|
|
8550
|
-
throw new Error("get-item-quickbooks-sync-status requires <itemId>");
|
|
8448
|
+
if (!id) throw new Error("get-item-quickbooks-sync-status requires <itemId>");
|
|
8551
8449
|
await getItemQuickBooksSyncStatus(id);
|
|
8552
8450
|
}, "commandGetItemQuickbooksSyncStatus"), commandCreateItem = __name2(async ({ flags }) => {
|
|
8553
8451
|
const payloadRaw = getFlag(flags, "payload");
|
|
@@ -8566,16 +8464,16 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8566
8464
|
}, "commandDeleteItem"), commandArchiveItems = __name2(async ({ flags }) => {
|
|
8567
8465
|
const idsRaw = getFlag(flags, "ids");
|
|
8568
8466
|
if (!idsRaw) throw new Error("archive-items requires --ids <csv>");
|
|
8569
|
-
const ids = parseCommaSeparatedIds(
|
|
8570
|
-
String(idsRaw)
|
|
8571
|
-
);
|
|
8467
|
+
const ids = parseCommaSeparatedIds(String(idsRaw));
|
|
8572
8468
|
if (!ids?.length) throw new Error("archive-items requires non-empty --ids");
|
|
8573
8469
|
await archiveItemsByIds(ids);
|
|
8574
8470
|
}, "commandArchiveItems"), commandListItemCategories = __name2(async ({ cmd, flags }) => {
|
|
8575
8471
|
rejectRetiredPageFlags(flags);
|
|
8576
8472
|
const filters = { name: getFlag(flags, "name") };
|
|
8577
8473
|
if (cmd === "count-item-categories") {
|
|
8578
|
-
rejectCountPagingFlags(flags, "count-item-categories"), await countItemCategories(
|
|
8474
|
+
rejectCountPagingFlags(flags, "count-item-categories"), await countItemCategories(
|
|
8475
|
+
filters
|
|
8476
|
+
);
|
|
8579
8477
|
return;
|
|
8580
8478
|
}
|
|
8581
8479
|
rejectBarePagingFlags(flags);
|
|
@@ -8585,8 +8483,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8585
8483
|
await listItemCategories({ ...filters, limit: parseProjectLimit(getFlag(flags, "limit")), cursor, direction, sortBy, sortDir });
|
|
8586
8484
|
}, "commandListItemCategories"), commandCreateItemCategory = __name2(async ({ flags }) => {
|
|
8587
8485
|
const name = getFlag(flags, "name");
|
|
8588
|
-
if (!name)
|
|
8589
|
-
throw new Error("create-item-category requires --name");
|
|
8486
|
+
if (!name) throw new Error("create-item-category requires --name");
|
|
8590
8487
|
await createItemCategory(String(name));
|
|
8591
8488
|
}, "commandCreateItemCategory"), commandUpdateItemCategory = __name2(async ({ flags }) => {
|
|
8592
8489
|
const id = getFlag(flags, "id"), name = getFlag(flags, "name");
|
|
@@ -8623,7 +8520,8 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8623
8520
|
await createApiKeyForUser({ userId, name });
|
|
8624
8521
|
}, "commandCreateApiKey"), commandListApiKeys = __name2(async ({ flags }) => {
|
|
8625
8522
|
rejectRetiredPageFlags(flags);
|
|
8626
|
-
for (const key of ["limit", "cursor"])
|
|
8523
|
+
for (const key of ["limit", "cursor"])
|
|
8524
|
+
rejectBareFlag(flags, key);
|
|
8627
8525
|
if (flags.direction !== void 0) throw new Error("list-api-keys pages forward only; follow pageInfo.nextCursor with --cursor.");
|
|
8628
8526
|
const cursor = getFlag(flags, "cursor");
|
|
8629
8527
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
@@ -8645,9 +8543,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8645
8543
|
}, "commandGetSystemOverview"), commandGetEstimatePerformance = __name2(async ({ flags }) => {
|
|
8646
8544
|
await getEstimatePerformance(parseDashboardQueryFlags(flags));
|
|
8647
8545
|
}, "commandGetEstimatePerformance"), commandGetFinancialOverview = __name2(async ({ flags }) => {
|
|
8648
|
-
await getFinancialOverview(
|
|
8649
|
-
{ userId: getFlag(flags, "userId"), role: parseOptionalFinancialRole(getFlag(flags, "role")), deals: parseOptionalDeals(getFlag(flags, "deals")), timeFrame: parseOptionalTimeFrame(getFlag(flags, "timeFrame")), startDate: getFlag(flags, "startDate"), endDate: getFlag(flags, "endDate") }
|
|
8650
|
-
);
|
|
8546
|
+
await getFinancialOverview({ userId: getFlag(flags, "userId"), role: parseOptionalFinancialRole(getFlag(flags, "role")), deals: parseOptionalDeals(getFlag(flags, "deals")), timeFrame: parseOptionalTimeFrame(getFlag(flags, "timeFrame")), startDate: getFlag(flags, "startDate"), endDate: getFlag(flags, "endDate") });
|
|
8651
8547
|
}, "commandGetFinancialOverview"), commandGetRecentErrors = __name2(async ({ cmd, flags }) => {
|
|
8652
8548
|
if (getFlag(flags, "page") !== void 0 || getFlag(flags, "perPage") !== void 0) throw new Error("Error logs now use --cursor and --limit; --page/--perPage are no longer supported.");
|
|
8653
8549
|
const rawTimeFrame = getFlag(flags, "timeFrame"), timeFrame = Object.values(ChartTimeFrame).find((value) => value === rawTimeFrame);
|
|
@@ -8655,10 +8551,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8655
8551
|
const filters = { severity: parseOptionalErrorSeverity(getFlag(flags, "severity")), status: parseOptionalErrorStatus(getFlag(flags, "status")), timeFrame };
|
|
8656
8552
|
if (cmd === "count-errors") await countErrors(filters);
|
|
8657
8553
|
else {
|
|
8658
|
-
const direction = getFlag(
|
|
8659
|
-
flags,
|
|
8660
|
-
"direction"
|
|
8661
|
-
);
|
|
8554
|
+
const direction = getFlag(flags, "direction");
|
|
8662
8555
|
if (direction !== void 0 && direction !== "forward" && direction !== "backward") throw new Error("--direction must be forward or backward.");
|
|
8663
8556
|
await getRecentErrors({ ...filters, cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit"), direction });
|
|
8664
8557
|
}
|
|
@@ -8679,7 +8572,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8679
8572
|
for (const key of ["limit", "cursor", "direction"]) rejectBareFlag(flags, key);
|
|
8680
8573
|
const cursor = getFlag(flags, "cursor");
|
|
8681
8574
|
if (cursor === "" || (cursor?.length ?? 0) > 8192) throw new Error("--cursor must be a non-empty opaque token of at most 8192 characters.");
|
|
8682
|
-
const direction = parseProjectDirection(
|
|
8575
|
+
const direction = parseProjectDirection(
|
|
8576
|
+
getFlag(flags, "direction")
|
|
8577
|
+
);
|
|
8683
8578
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
8684
8579
|
const limitRaw = getFlag(flags, "limit");
|
|
8685
8580
|
await listIntegrationOperations({ ...filters, limit: limitRaw === void 0 ? 25 : parseProjectLimit(limitRaw), cursor, direction });
|
|
@@ -8687,16 +8582,13 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8687
8582
|
const operationId = positional[0];
|
|
8688
8583
|
if (!operationId) throw new Error("get-integration-operation requires <operationId>");
|
|
8689
8584
|
await getIntegrationOperation(operationId);
|
|
8690
|
-
}, "commandGetIntegrationOperation"), commandRetryIntegrationOperation = __name2(
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
},
|
|
8698
|
-
"commandRetryIntegrationOperation"
|
|
8699
|
-
), commandMobilePushStatus = __name2(async ({ positional }) => {
|
|
8585
|
+
}, "commandGetIntegrationOperation"), commandRetryIntegrationOperation = __name2(async ({ flags, positional }) => {
|
|
8586
|
+
const operationId = positional[0];
|
|
8587
|
+
if (!operationId) throw new Error("retry-integration-operation requires <operationId>");
|
|
8588
|
+
const outboundEmailResolution = getFlag(flags, "outboundEmailResolution");
|
|
8589
|
+
if (outboundEmailResolution && outboundEmailResolution !== "ACCEPTED" && outboundEmailResolution !== "NOT_ACCEPTED_RETRY") throw new Error("--outboundEmailResolution must be ACCEPTED or NOT_ACCEPTED_RETRY");
|
|
8590
|
+
await retryIntegrationOperation(operationId, parseOptionalBoolFlag(flags, "confirmExternalStateReconciled") ?? !1, outboundEmailResolution, getFlag(flags, "providerMessageId"));
|
|
8591
|
+
}, "commandRetryIntegrationOperation"), commandMobilePushStatus = __name2(async ({ positional }) => {
|
|
8700
8592
|
if (positional.length !== 0) throw new CliRuntimeError("USAGE", "mobile-push status accepts no positional arguments.");
|
|
8701
8593
|
await listMobilePushDevices();
|
|
8702
8594
|
}, "commandMobilePushStatus"), commandMobilePushUnregister = __name2(async ({ positional }) => {
|
|
@@ -8707,7 +8599,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8707
8599
|
await listWebhookEventTypes();
|
|
8708
8600
|
}, "commandListWebhookEventTypes"), commandListWebhookEndpoints = __name2(async () => {
|
|
8709
8601
|
await listWebhookEndpoints();
|
|
8710
|
-
}, "commandListWebhookEndpoints"), commandGetWebhookEndpoint = __name2(async ({
|
|
8602
|
+
}, "commandListWebhookEndpoints"), commandGetWebhookEndpoint = __name2(async ({
|
|
8603
|
+
positional
|
|
8604
|
+
}) => {
|
|
8711
8605
|
const id = positional[0];
|
|
8712
8606
|
if (!id) throw new Error("get-webhook-endpoint requires <id>");
|
|
8713
8607
|
await getWebhookEndpoint(id);
|
|
@@ -8715,15 +8609,12 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8715
8609
|
const name = getFlag(flags, "name"), url = getFlag(flags, "url"), events = parseCommaSeparatedIds(getFlag(flags, "events"));
|
|
8716
8610
|
if (!name || !url || !events?.length) throw new Error("create-webhook-endpoint requires --name, --url and --events");
|
|
8717
8611
|
await createWebhookEndpoint({ name, url, eventPatterns: events, enabled: parseOptionalBoolFlag(flags, "enabled") ?? !0 });
|
|
8718
|
-
}, "commandCreateWebhookEndpoint"), commandUpdateWebhookEndpoint = __name2(
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
},
|
|
8725
|
-
"commandUpdateWebhookEndpoint"
|
|
8726
|
-
), commandDeleteWebhookEndpoint = __name2(async ({ positional }) => {
|
|
8612
|
+
}, "commandCreateWebhookEndpoint"), commandUpdateWebhookEndpoint = __name2(async ({ flags, positional }) => {
|
|
8613
|
+
const id = positional[0];
|
|
8614
|
+
if (!id) throw new Error("update-webhook-endpoint requires <id>");
|
|
8615
|
+
const events = parseCommaSeparatedIds(getFlag(flags, "events"));
|
|
8616
|
+
await updateWebhookEndpoint({ id, name: getFlag(flags, "name"), url: getFlag(flags, "url"), eventPatterns: events?.length ? events : void 0, enabled: parseOptionalBoolFlag(flags, "enabled") });
|
|
8617
|
+
}, "commandUpdateWebhookEndpoint"), commandDeleteWebhookEndpoint = __name2(async ({ positional }) => {
|
|
8727
8618
|
const id = positional[0];
|
|
8728
8619
|
if (!id) throw new Error("delete-webhook-endpoint requires <id>");
|
|
8729
8620
|
await deleteWebhookEndpoint(id);
|
|
@@ -8738,15 +8629,15 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8738
8629
|
await sendWebhookTestEvent(id);
|
|
8739
8630
|
}, "commandSendWebhookTestEvent"), commandListWebhookDeliveries = __name2(async ({ flags }) => {
|
|
8740
8631
|
const statuses = (getFlag(flags, "status") ?? "").split(",").map((value) => value.trim()).filter(Boolean);
|
|
8741
|
-
for (const status of statuses) if (status !== "PENDING" && status !== "SUCCEEDED" && status !== "FAILED") throw new Error(
|
|
8632
|
+
for (const status of statuses) if (status !== "PENDING" && status !== "SUCCEEDED" && status !== "FAILED") throw new Error(
|
|
8633
|
+
"--status must be PENDING, SUCCEEDED or FAILED (comma-separated)"
|
|
8634
|
+
);
|
|
8742
8635
|
const cursor = getFlag(flags, "cursor"), direction = parseProjectDirection(getFlag(flags, "direction"));
|
|
8743
8636
|
if (direction === "backward" && !cursor) throw new Error("--direction backward requires --cursor <token>.");
|
|
8744
8637
|
await listWebhookDeliveries({ endpointId: getFlag(flags, "endpointId"), ...statuses.length ? { status: statuses } : {}, eventType: getFlag(flags, "eventType"), cursor, direction, limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8745
8638
|
}, "commandListWebhookDeliveries"), commandGetWebhookDelivery = __name2(async ({ positional }) => {
|
|
8746
8639
|
const id = positional[0];
|
|
8747
|
-
if (!id) throw new Error(
|
|
8748
|
-
"get-webhook-delivery requires <id>"
|
|
8749
|
-
);
|
|
8640
|
+
if (!id) throw new Error("get-webhook-delivery requires <id>");
|
|
8750
8641
|
await getWebhookDelivery(id);
|
|
8751
8642
|
}, "commandGetWebhookDelivery"), commandReplayWebhookDelivery = __name2(async ({ positional }) => {
|
|
8752
8643
|
const id = positional[0];
|
|
@@ -8787,27 +8678,25 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8787
8678
|
await createInboundSource({ externalSourceId, name });
|
|
8788
8679
|
}, "commandCreateInboundSource"), commandGetInboundSource = __name2(async ({ positional }) => {
|
|
8789
8680
|
const sourceId = positional[0];
|
|
8790
|
-
if (!sourceId) throw new Error(
|
|
8791
|
-
"get-inbound-source requires <sourceId>"
|
|
8792
|
-
);
|
|
8681
|
+
if (!sourceId) throw new Error("get-inbound-source requires <sourceId>");
|
|
8793
8682
|
await getInboundSource(sourceId);
|
|
8794
8683
|
}, "commandGetInboundSource"), commandUpdateInboundSource = __name2(async ({ flags, positional }) => {
|
|
8795
8684
|
const sourceId = positional[0], name = getFlag(flags, "name");
|
|
8796
8685
|
if (!sourceId || !name) throw new Error("update-inbound-source requires <sourceId> --name <name>");
|
|
8797
8686
|
await updateInboundSource(sourceId, name);
|
|
8798
|
-
}, "commandUpdateInboundSource"), commandListInboundSubmissions = __name2(
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
await countInboundSubmissions({ sourceId: getFlag(flags, "sourceId") });
|
|
8803
|
-
}, "commandCountInboundSubmissions"), commandGetInboundSubmission = __name2(
|
|
8804
|
-
async ({ positional }) => {
|
|
8805
|
-
const submissionId = positional[0];
|
|
8806
|
-
if (!submissionId) throw new Error("get-inbound-submission requires <submissionId>");
|
|
8807
|
-
await getInboundSubmission(submissionId);
|
|
8687
|
+
}, "commandUpdateInboundSource"), commandListInboundSubmissions = __name2(
|
|
8688
|
+
async ({ flags }) => {
|
|
8689
|
+
if (getFlag(flags, "page") !== void 0 || getFlag(flags, "perPage") !== void 0) throw new Error("Inbound submissions now use --limit and --cursor; --page/--perPage are no longer supported.");
|
|
8690
|
+
await listInboundSubmissions({ cursor: getFlag(flags, "cursor"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") ?? 25, sourceId: getFlag(flags, "sourceId") });
|
|
8808
8691
|
},
|
|
8809
|
-
"
|
|
8810
|
-
),
|
|
8692
|
+
"commandListInboundSubmissions"
|
|
8693
|
+
), commandCountInboundSubmissions = __name2(async ({ flags }) => {
|
|
8694
|
+
await countInboundSubmissions({ sourceId: getFlag(flags, "sourceId") });
|
|
8695
|
+
}, "commandCountInboundSubmissions"), commandGetInboundSubmission = __name2(async ({ positional }) => {
|
|
8696
|
+
const submissionId = positional[0];
|
|
8697
|
+
if (!submissionId) throw new Error("get-inbound-submission requires <submissionId>");
|
|
8698
|
+
await getInboundSubmission(submissionId);
|
|
8699
|
+
}, "commandGetInboundSubmission"), commandSaveInboundMapping = __name2(async ({ flags, positional }) => {
|
|
8811
8700
|
const sourceId = positional[0], payloadRaw = getFlag(flags, "payload");
|
|
8812
8701
|
if (!sourceId || payloadRaw === void 0) throw new Error("save-inbound-mapping requires <sourceId> --payload <JSON array>");
|
|
8813
8702
|
const mappings = parseJsonFlag(String(payloadRaw), "--payload");
|
|
@@ -8820,17 +8709,20 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8820
8709
|
}, "commandSaveInboundAutomationConfig"), commandUpdateInboundProcessing = __name2(async ({ flags, positional }) => {
|
|
8821
8710
|
const sourceId = positional[0], mode = getFlag(flags, "mode"), enabled = parseOptionalBoolFlag(flags, "enabled");
|
|
8822
8711
|
if (!sourceId || !mode || enabled === void 0 || !Object.values(InboundProcessingMode).includes(String(mode))) throw new Error("update-inbound-processing requires <sourceId> --mode COLLECT_ONLY|SHADOW|ACTIVE --enabled true|false");
|
|
8823
|
-
await updateInboundProcessing(
|
|
8712
|
+
await updateInboundProcessing(
|
|
8713
|
+
{ processingEnabled: enabled, processingMode: String(mode), sourceId }
|
|
8714
|
+
);
|
|
8824
8715
|
}, "commandUpdateInboundProcessing"), commandGetApprovedBudgets = __name2(async ({ flags }) => {
|
|
8825
8716
|
await getApprovedBudgets({ projectId: getFlag(flags, "projectId"), limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit"), minRevenue: parseOptionalNumber(getFlag(flags, "minRevenue"), "--minRevenue"), maxRevenue: parseOptionalNumber(getFlag(flags, "maxRevenue"), "--maxRevenue") });
|
|
8826
8717
|
}, "commandGetApprovedBudgets"), commandGetBudgetCategoryBenchmarks = __name2(async ({ flags, positional }) => {
|
|
8827
8718
|
const id = positional[0];
|
|
8828
|
-
if (!id) throw new Error(
|
|
8829
|
-
"get-budget-category-benchmarks requires <categoryId> [--limit]"
|
|
8830
|
-
);
|
|
8719
|
+
if (!id) throw new Error("get-budget-category-benchmarks requires <categoryId> [--limit]");
|
|
8831
8720
|
await getBudgetCategoryBenchmarks({ categoryId: id, limit: parsePositiveIntFlag(getFlag(flags, "limit"), "--limit") });
|
|
8832
8721
|
}, "commandGetBudgetCategoryBenchmarks"), commandGetItemPricingHistory = __name2(async ({ flags }) => {
|
|
8833
|
-
await getItemPricingHistory({ itemName: getFlag(flags, "itemName"), categoryId: getFlag(flags, "categoryId"), supplierId: getFlag(flags, "supplierId"), limit: parsePositiveIntFlag(
|
|
8722
|
+
await getItemPricingHistory({ itemName: getFlag(flags, "itemName"), categoryId: getFlag(flags, "categoryId"), supplierId: getFlag(flags, "supplierId"), limit: parsePositiveIntFlag(
|
|
8723
|
+
getFlag(flags, "limit"),
|
|
8724
|
+
"--limit"
|
|
8725
|
+
) });
|
|
8834
8726
|
}, "commandGetItemPricingHistory"), commandGetSupplierPricingHistory = __name2(async ({ flags, positional }) => {
|
|
8835
8727
|
const id = positional[0];
|
|
8836
8728
|
if (!id) throw new Error("get-supplier-pricing-history requires <supplierId> [--itemCategoryId] [--limit]");
|
|
@@ -8867,7 +8759,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8867
8759
|
["update-budget-category", commandUpdateBudgetCategory],
|
|
8868
8760
|
["delete-budget-category", commandDeleteBudgetCategory],
|
|
8869
8761
|
["update-budget-commission", commandUpdateBudgetCommission],
|
|
8870
|
-
[
|
|
8762
|
+
[
|
|
8763
|
+
"update-budget-discount",
|
|
8764
|
+
commandUpdateBudgetDiscount
|
|
8765
|
+
],
|
|
8871
8766
|
["delete-budget-commission", commandDeleteBudgetCommission],
|
|
8872
8767
|
["delete-budget-discount", commandDeleteBudgetDiscount],
|
|
8873
8768
|
["mark-budget-items-not-utilized", commandMarkBudgetItemsNotUtilized],
|
|
@@ -8907,7 +8802,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
8907
8802
|
["count-quotations", commandCountQuotations],
|
|
8908
8803
|
["get-quotation", commandGetQuotation],
|
|
8909
8804
|
["get-quotation-line-items", commandGetQuotationLineItems],
|
|
8910
|
-
[
|
|
8805
|
+
[
|
|
8806
|
+
"upload-quotation-attachment",
|
|
8807
|
+
commandUploadQuotationAttachment
|
|
8808
|
+
],
|
|
8911
8809
|
["cleanup-staged-quotation-attachments", commandCleanupStagedQuotationAttachments],
|
|
8912
8810
|
["create-quotation", commandCreateQuotation],
|
|
8913
8811
|
["update-quotation", commandUpdateQuotation],
|
|
@@ -9071,9 +8969,7 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9071
8969
|
setActiveCliSession({ runtime: context.runtime, invocation: { command, cliVersion: context.version, apiBaseUrl: BUDGET_BUILDER_API_BASE_URL, quiet: context.quiet, debug: context.debug }, effects: [], permissions: {} });
|
|
9072
8970
|
}, "startCliSession"), failCliSession = __name2((context, command, error2) => {
|
|
9073
8971
|
startCliSession(context, command);
|
|
9074
|
-
const exitCode = emitCommandError(
|
|
9075
|
-
error2
|
|
9076
|
-
);
|
|
8972
|
+
const exitCode = emitCommandError(error2);
|
|
9077
8973
|
return clearActiveCliSession(), exitCode;
|
|
9078
8974
|
}, "failCliSession"), resolveRootArguments = __name2((rawArgv, runtime) => {
|
|
9079
8975
|
const rootArguments = parseRootArguments(rawArgv), apiBaseUrl = rootArguments.apiBaseUrl ?? runtime.env.BB_API_URL?.trim();
|
|
@@ -9085,13 +8981,10 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9085
8981
|
}
|
|
9086
8982
|
const helpArgv = commandArgv.filter((argument, index) => argument !== "-h" && argument !== "--help" && !argument.startsWith("--help=") && !(commandArgv[index - 1] === "--help" && booleanFlagValues.has(argument))), helpCommand = resolveCommand(helpArgv[0] === "help" ? helpArgv.slice(1) : helpArgv)?.command;
|
|
9087
8983
|
runtime.stdout.write("".concat(createHumanHelp(helpCommand), "\n"));
|
|
9088
|
-
}, "printCliHelp"), runCompletionCommand = __name2(
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
},
|
|
9093
|
-
"runCompletionCommand"
|
|
9094
|
-
), isVersionRequest = __name2((commandArgv) => commandArgv[0] === "version" || isEnabledFlag(commandArgv, "--version") || commandArgv.includes("-v"), "isVersionRequest"), runVersionCommand = __name2((context) => (startCliSession(context, "version"), emitCommandResult(getVersionData()), clearActiveCliSession(), 0), "runVersionCommand"), createDefaultCredentialStore = __name2((runtime) => createBunCredentialStore({ account: resolveCliCredentialAccount(runtime.env), product: "budget-builder" }), "createDefaultCredentialStore"), authStatusResult = __name2(async (runtime, store) => {
|
|
8984
|
+
}, "printCliHelp"), runCompletionCommand = __name2((context, commandArgv) => {
|
|
8985
|
+
const shell = commandArgv[1];
|
|
8986
|
+
return shell === void 0 || !isCompletionShell(shell) ? failCliSession(context, "completion", new CliRuntimeError("USAGE", "completion requires bash, zsh, fish, or powershell.")) : (context.runtime.stdout.write(createCompletionScript(shell)), 0);
|
|
8987
|
+
}, "runCompletionCommand"), isVersionRequest = __name2((commandArgv) => commandArgv[0] === "version" || isEnabledFlag(commandArgv, "--version") || commandArgv.includes("-v"), "isVersionRequest"), runVersionCommand = __name2((context) => (startCliSession(context, "version"), emitCommandResult(getVersionData()), clearActiveCliSession(), 0), "runVersionCommand"), createDefaultCredentialStore = __name2((runtime) => createBunCredentialStore({ account: resolveCliCredentialAccount(runtime.env), product: "budget-builder" }), "createDefaultCredentialStore"), authStatusResult = __name2(async (runtime, store) => {
|
|
9095
8988
|
const apiKeyActive = !!runtime.env.BB_API_KEY?.trim(), credentials = apiKeyActive ? null : await store.get();
|
|
9096
8989
|
return apiKeyActive ? { authenticated: !0, method: "api-key", storage: "environment" } : credentials && isCliCredentialForIssuer(credentials, BUDGET_BUILDER_API_BASE_URL) ? { authenticated: !0, method: "browser-session", accessTokenExpiresAt: credentials.accessTokenExpiresAt, refreshTokenExpiresAt: credentials.refreshTokenExpiresAt, session: credentials.session, storage: "Bun.secrets" } : { authenticated: !1, method: null, storage: "Bun.secrets" };
|
|
9097
8990
|
}, "authStatusResult"), runAuthAction = __name2(async (context, authAction, rawArgv, store) => {
|
|
@@ -9135,7 +9028,9 @@ var booleanFlagValues = /* @__PURE__ */ new Set(["true", "false", "1", "0"]), is
|
|
|
9135
9028
|
shouldLogCliActions() && logCliAction({ event: "cli.command", phase: "start", command: cmd, positional, flags: sanitizeFlagsForTrace(flags) });
|
|
9136
9029
|
try {
|
|
9137
9030
|
if (flags.q === !0) throw new CliRuntimeError("USAGE", "--q needs a search value (--q <text> or --q=<text>). Use -q or --quiet to hide logs.");
|
|
9138
|
-
return await configureCliAuthentication(runtime, credentialStore, configureAccessToken), await confirmCanonicalMutation(resolvedCommand, cmd), await dispatchCliCommand(
|
|
9031
|
+
return await configureCliAuthentication(runtime, credentialStore, configureAccessToken), await confirmCanonicalMutation(resolvedCommand, cmd), await dispatchCliCommand(
|
|
9032
|
+
{ cmd, flags, positional }
|
|
9033
|
+
), shouldLogCliActions() && logCliAction({ event: "cli.command", phase: "ok", command: cmd, durationMs: Date.now() - t0 }), clearActiveCliSession(), 0;
|
|
9139
9034
|
} catch (err) {
|
|
9140
9035
|
const message = err instanceof Error ? err.message : String(err);
|
|
9141
9036
|
shouldLogCliActions() && logCliAction({ event: "cli.command", phase: "error", command: cmd, durationMs: Date.now() - t0, error: message });
|
|
@@ -9158,9 +9053,7 @@ async function runCli(argv = process.argv, runtime = createProcessRuntime(), cre
|
|
|
9158
9053
|
if (isVersionRequest(commandArgv)) return runVersionCommand(context);
|
|
9159
9054
|
const authAction = authActionFromArgv(commandArgv);
|
|
9160
9055
|
if (authAction !== void 0) return await runAuthCommand(context, authAction, commandArgv, rawArgv, credentialStore);
|
|
9161
|
-
const resolvedCommand = resolveCommand(
|
|
9162
|
-
commandArgv
|
|
9163
|
-
);
|
|
9056
|
+
const resolvedCommand = resolveCommand(commandArgv);
|
|
9164
9057
|
return resolvedCommand === void 0 ? failCliSession(context, commandArgv[0] ?? "unknown", new CliRuntimeError("USAGE", "Unknown command: ".concat(commandArgv.join(" "), ". Run 'bb help'."))) : await runResolvedCommand(context, argv, rawArgv, resolvedCommand, credentialStore, configureAccessToken);
|
|
9165
9058
|
}
|
|
9166
9059
|
__name(runCli, "runCli"), __name2(runCli, "runCli"), import.meta.main && (assertBunRuntime(), process.exitCode = await runCli());
|