@go-labs-sg/bb 3.10.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/command-manifest.json +70 -13
- package/command-reference.md +22 -14
- package/dist/index.js +1453 -41
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -6995,12 +6995,1393 @@ var normalizeApiBaseUrl = (value) => {
|
|
|
6995
6995
|
return url.toString().replace(/\/$/, "");
|
|
6996
6996
|
};
|
|
6997
6997
|
|
|
6998
|
+
// ../../../node_modules/.bun/@trpc+server@11.24.0+aec250ebf9e68690/node_modules/@trpc/server/dist/observable-CdPmrXKY.mjs
|
|
6999
|
+
function observable(subscribe) {
|
|
7000
|
+
const self = {
|
|
7001
|
+
subscribe(observer) {
|
|
7002
|
+
let teardownRef = null;
|
|
7003
|
+
let isDone = false;
|
|
7004
|
+
let unsubscribed = false;
|
|
7005
|
+
let teardownImmediately = false;
|
|
7006
|
+
function unsubscribe() {
|
|
7007
|
+
if (teardownRef === null) {
|
|
7008
|
+
teardownImmediately = true;
|
|
7009
|
+
return;
|
|
7010
|
+
}
|
|
7011
|
+
if (unsubscribed)
|
|
7012
|
+
return;
|
|
7013
|
+
unsubscribed = true;
|
|
7014
|
+
if (typeof teardownRef === "function")
|
|
7015
|
+
teardownRef();
|
|
7016
|
+
else if (teardownRef)
|
|
7017
|
+
teardownRef.unsubscribe();
|
|
7018
|
+
}
|
|
7019
|
+
teardownRef = subscribe({
|
|
7020
|
+
next(value) {
|
|
7021
|
+
var _observer$next;
|
|
7022
|
+
if (isDone)
|
|
7023
|
+
return;
|
|
7024
|
+
(_observer$next = observer.next) === null || _observer$next === undefined || _observer$next.call(observer, value);
|
|
7025
|
+
},
|
|
7026
|
+
error(err) {
|
|
7027
|
+
var _observer$error;
|
|
7028
|
+
if (isDone)
|
|
7029
|
+
return;
|
|
7030
|
+
isDone = true;
|
|
7031
|
+
(_observer$error = observer.error) === null || _observer$error === undefined || _observer$error.call(observer, err);
|
|
7032
|
+
unsubscribe();
|
|
7033
|
+
},
|
|
7034
|
+
complete() {
|
|
7035
|
+
var _observer$complete;
|
|
7036
|
+
if (isDone)
|
|
7037
|
+
return;
|
|
7038
|
+
isDone = true;
|
|
7039
|
+
(_observer$complete = observer.complete) === null || _observer$complete === undefined || _observer$complete.call(observer);
|
|
7040
|
+
unsubscribe();
|
|
7041
|
+
}
|
|
7042
|
+
});
|
|
7043
|
+
if (teardownImmediately)
|
|
7044
|
+
unsubscribe();
|
|
7045
|
+
return { unsubscribe };
|
|
7046
|
+
},
|
|
7047
|
+
pipe(...operations) {
|
|
7048
|
+
return operations.reduce(pipeReducer, self);
|
|
7049
|
+
}
|
|
7050
|
+
};
|
|
7051
|
+
return self;
|
|
7052
|
+
}
|
|
7053
|
+
function pipeReducer(prev, fn) {
|
|
7054
|
+
return fn(prev);
|
|
7055
|
+
}
|
|
7056
|
+
function observableToPromise(observable) {
|
|
7057
|
+
const ac = new AbortController;
|
|
7058
|
+
return new Promise((resolve, reject) => {
|
|
7059
|
+
let isDone = false;
|
|
7060
|
+
function onDone() {
|
|
7061
|
+
if (isDone)
|
|
7062
|
+
return;
|
|
7063
|
+
isDone = true;
|
|
7064
|
+
obs$.unsubscribe();
|
|
7065
|
+
}
|
|
7066
|
+
ac.signal.addEventListener("abort", () => {
|
|
7067
|
+
reject(ac.signal.reason);
|
|
7068
|
+
});
|
|
7069
|
+
const obs$ = observable.subscribe({
|
|
7070
|
+
next(data) {
|
|
7071
|
+
isDone = true;
|
|
7072
|
+
resolve(data);
|
|
7073
|
+
onDone();
|
|
7074
|
+
},
|
|
7075
|
+
error(data) {
|
|
7076
|
+
reject(data);
|
|
7077
|
+
},
|
|
7078
|
+
complete() {
|
|
7079
|
+
ac.abort();
|
|
7080
|
+
onDone();
|
|
7081
|
+
}
|
|
7082
|
+
});
|
|
7083
|
+
});
|
|
7084
|
+
}
|
|
7085
|
+
|
|
7086
|
+
// ../../../node_modules/.bun/@trpc+server@11.24.0+aec250ebf9e68690/node_modules/@trpc/server/dist/observable-DMA7fHJ6.mjs
|
|
7087
|
+
function share(_opts) {
|
|
7088
|
+
return (source) => {
|
|
7089
|
+
let refCount = 0;
|
|
7090
|
+
let subscription = null;
|
|
7091
|
+
let isConnecting = false;
|
|
7092
|
+
let observers = /* @__PURE__ */ new Set;
|
|
7093
|
+
function startIfNeeded() {
|
|
7094
|
+
if (subscription || isConnecting)
|
|
7095
|
+
return;
|
|
7096
|
+
isConnecting = true;
|
|
7097
|
+
let isDone = false;
|
|
7098
|
+
let sourceSubscription;
|
|
7099
|
+
try {
|
|
7100
|
+
sourceSubscription = source.subscribe({
|
|
7101
|
+
next(value) {
|
|
7102
|
+
notify(observers, (observer) => {
|
|
7103
|
+
var _observer$next;
|
|
7104
|
+
return (_observer$next = observer.next) === null || _observer$next === undefined ? undefined : _observer$next.call(observer, value);
|
|
7105
|
+
});
|
|
7106
|
+
},
|
|
7107
|
+
error(error) {
|
|
7108
|
+
isDone = true;
|
|
7109
|
+
terminate((observer) => {
|
|
7110
|
+
var _observer$error;
|
|
7111
|
+
return (_observer$error = observer.error) === null || _observer$error === undefined ? undefined : _observer$error.call(observer, error);
|
|
7112
|
+
});
|
|
7113
|
+
},
|
|
7114
|
+
complete() {
|
|
7115
|
+
isDone = true;
|
|
7116
|
+
terminate((observer) => {
|
|
7117
|
+
var _observer$complete;
|
|
7118
|
+
return (_observer$complete = observer.complete) === null || _observer$complete === undefined ? undefined : _observer$complete.call(observer);
|
|
7119
|
+
});
|
|
7120
|
+
}
|
|
7121
|
+
});
|
|
7122
|
+
} finally {
|
|
7123
|
+
isConnecting = false;
|
|
7124
|
+
}
|
|
7125
|
+
if (isDone)
|
|
7126
|
+
sourceSubscription.unsubscribe();
|
|
7127
|
+
else
|
|
7128
|
+
subscription = sourceSubscription;
|
|
7129
|
+
}
|
|
7130
|
+
function notify(targets, callback) {
|
|
7131
|
+
for (const observer of [...targets])
|
|
7132
|
+
if (targets.has(observer))
|
|
7133
|
+
callback(observer);
|
|
7134
|
+
}
|
|
7135
|
+
function terminate(callback) {
|
|
7136
|
+
const _sub = subscription;
|
|
7137
|
+
const terminatedObservers = observers;
|
|
7138
|
+
subscription = null;
|
|
7139
|
+
observers = /* @__PURE__ */ new Set;
|
|
7140
|
+
isConnecting = false;
|
|
7141
|
+
try {
|
|
7142
|
+
notify(terminatedObservers, callback);
|
|
7143
|
+
} finally {
|
|
7144
|
+
_sub === null || _sub === undefined || _sub.unsubscribe();
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
function resetSource() {
|
|
7148
|
+
const _sub = subscription;
|
|
7149
|
+
subscription = null;
|
|
7150
|
+
_sub === null || _sub === undefined || _sub.unsubscribe();
|
|
7151
|
+
}
|
|
7152
|
+
function resetIfNeeded() {
|
|
7153
|
+
if (refCount === 0 && subscription)
|
|
7154
|
+
resetSource();
|
|
7155
|
+
}
|
|
7156
|
+
return observable((subscriber) => {
|
|
7157
|
+
refCount++;
|
|
7158
|
+
const subscriberObservers = observers;
|
|
7159
|
+
subscriberObservers.add(subscriber);
|
|
7160
|
+
startIfNeeded();
|
|
7161
|
+
return { unsubscribe() {
|
|
7162
|
+
refCount--;
|
|
7163
|
+
resetIfNeeded();
|
|
7164
|
+
subscriberObservers.delete(subscriber);
|
|
7165
|
+
} };
|
|
7166
|
+
});
|
|
7167
|
+
};
|
|
7168
|
+
}
|
|
7169
|
+
function tap(observer) {
|
|
7170
|
+
return (source) => {
|
|
7171
|
+
return observable((destination) => {
|
|
7172
|
+
return source.subscribe({
|
|
7173
|
+
next(value) {
|
|
7174
|
+
var _observer$next2;
|
|
7175
|
+
(_observer$next2 = observer.next) === null || _observer$next2 === undefined || _observer$next2.call(observer, value);
|
|
7176
|
+
destination.next(value);
|
|
7177
|
+
},
|
|
7178
|
+
error(error) {
|
|
7179
|
+
var _observer$error2;
|
|
7180
|
+
(_observer$error2 = observer.error) === null || _observer$error2 === undefined || _observer$error2.call(observer, error);
|
|
7181
|
+
destination.error(error);
|
|
7182
|
+
},
|
|
7183
|
+
complete() {
|
|
7184
|
+
var _observer$complete2;
|
|
7185
|
+
(_observer$complete2 = observer.complete) === null || _observer$complete2 === undefined || _observer$complete2.call(observer);
|
|
7186
|
+
destination.complete();
|
|
7187
|
+
}
|
|
7188
|
+
});
|
|
7189
|
+
});
|
|
7190
|
+
};
|
|
7191
|
+
}
|
|
7192
|
+
var distinctUnsetMarker = Symbol();
|
|
7193
|
+
function behaviorSubject(initialValue) {
|
|
7194
|
+
let value = initialValue;
|
|
7195
|
+
const observerList = /* @__PURE__ */ new Set;
|
|
7196
|
+
const addObserver = (observer) => {
|
|
7197
|
+
if (value !== undefined)
|
|
7198
|
+
observer.next(value);
|
|
7199
|
+
observerList.add(observer);
|
|
7200
|
+
};
|
|
7201
|
+
const removeObserver = (observer) => {
|
|
7202
|
+
observerList.delete(observer);
|
|
7203
|
+
};
|
|
7204
|
+
const obs = observable((observer) => {
|
|
7205
|
+
addObserver(observer);
|
|
7206
|
+
return () => {
|
|
7207
|
+
removeObserver(observer);
|
|
7208
|
+
};
|
|
7209
|
+
});
|
|
7210
|
+
obs.next = (nextValue) => {
|
|
7211
|
+
if (value === nextValue)
|
|
7212
|
+
return;
|
|
7213
|
+
value = nextValue;
|
|
7214
|
+
for (const observer of [...observerList])
|
|
7215
|
+
if (observerList.has(observer))
|
|
7216
|
+
observer.next(nextValue);
|
|
7217
|
+
};
|
|
7218
|
+
obs.get = () => value;
|
|
7219
|
+
return obs;
|
|
7220
|
+
}
|
|
7221
|
+
|
|
7222
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/splitLink-DcpFI5s5.mjs
|
|
7223
|
+
function createChain(opts) {
|
|
7224
|
+
return observable((observer) => {
|
|
7225
|
+
function execute(index = 0, op = opts.op) {
|
|
7226
|
+
const next = opts.links[index];
|
|
7227
|
+
if (!next)
|
|
7228
|
+
throw new Error("No more links to execute - did you forget to add an ending link?");
|
|
7229
|
+
return next({
|
|
7230
|
+
op,
|
|
7231
|
+
next(nextOp) {
|
|
7232
|
+
return execute(index + 1, nextOp);
|
|
7233
|
+
}
|
|
7234
|
+
});
|
|
7235
|
+
}
|
|
7236
|
+
return execute().subscribe(observer);
|
|
7237
|
+
});
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/objectSpread2-weooBxVk.mjs
|
|
7241
|
+
function _typeof(o) {
|
|
7242
|
+
"@babel/helpers - typeof";
|
|
7243
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
7244
|
+
return typeof o;
|
|
7245
|
+
} : function(o) {
|
|
7246
|
+
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7247
|
+
}, _typeof(o);
|
|
7248
|
+
}
|
|
7249
|
+
function toPrimitive(t, r) {
|
|
7250
|
+
if (_typeof(t) != "object" || !t)
|
|
7251
|
+
return t;
|
|
7252
|
+
var e = t[Symbol.toPrimitive];
|
|
7253
|
+
if (e !== undefined) {
|
|
7254
|
+
var i = e.call(t, r || "default");
|
|
7255
|
+
if (_typeof(i) != "object")
|
|
7256
|
+
return i;
|
|
7257
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7258
|
+
}
|
|
7259
|
+
return (r === "string" ? String : Number)(t);
|
|
7260
|
+
}
|
|
7261
|
+
function toPropertyKey(t) {
|
|
7262
|
+
var i = toPrimitive(t, "string");
|
|
7263
|
+
return _typeof(i) == "symbol" ? i : i + "";
|
|
7264
|
+
}
|
|
7265
|
+
function _defineProperty(e, r, t) {
|
|
7266
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
7267
|
+
value: t,
|
|
7268
|
+
enumerable: true,
|
|
7269
|
+
configurable: true,
|
|
7270
|
+
writable: true
|
|
7271
|
+
}) : e[r] = t, e;
|
|
7272
|
+
}
|
|
7273
|
+
function ownKeys(e, r) {
|
|
7274
|
+
var t = Object.keys(e);
|
|
7275
|
+
if (Object.getOwnPropertySymbols) {
|
|
7276
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7277
|
+
r && (o = o.filter(function(r) {
|
|
7278
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
7279
|
+
})), t.push.apply(t, o);
|
|
7280
|
+
}
|
|
7281
|
+
return t;
|
|
7282
|
+
}
|
|
7283
|
+
function _objectSpread2(e) {
|
|
7284
|
+
for (var r = 1;r < arguments.length; r++) {
|
|
7285
|
+
var t = arguments[r] != null ? arguments[r] : {};
|
|
7286
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r) {
|
|
7287
|
+
_defineProperty(e, r, t[r]);
|
|
7288
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
7289
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7292
|
+
return e;
|
|
7293
|
+
}
|
|
7294
|
+
|
|
7295
|
+
// ../../../node_modules/.bun/@trpc+server@11.24.0+aec250ebf9e68690/node_modules/@trpc/server/dist/codes-nbrm_zWY.mjs
|
|
7296
|
+
function isObject2(value) {
|
|
7297
|
+
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
7298
|
+
}
|
|
7299
|
+
function emptyObject() {
|
|
7300
|
+
return Object.create(null);
|
|
7301
|
+
}
|
|
7302
|
+
var TRPC_ERROR_CODES_BY_KEY = {
|
|
7303
|
+
PARSE_ERROR: -32700,
|
|
7304
|
+
BAD_REQUEST: -32600,
|
|
7305
|
+
INTERNAL_SERVER_ERROR: -32603,
|
|
7306
|
+
NOT_IMPLEMENTED: -32603,
|
|
7307
|
+
BAD_GATEWAY: -32603,
|
|
7308
|
+
SERVICE_UNAVAILABLE: -32603,
|
|
7309
|
+
GATEWAY_TIMEOUT: -32603,
|
|
7310
|
+
UNAUTHORIZED: -32001,
|
|
7311
|
+
PAYMENT_REQUIRED: -32002,
|
|
7312
|
+
FORBIDDEN: -32003,
|
|
7313
|
+
NOT_FOUND: -32004,
|
|
7314
|
+
METHOD_NOT_SUPPORTED: -32005,
|
|
7315
|
+
TIMEOUT: -32008,
|
|
7316
|
+
CONFLICT: -32009,
|
|
7317
|
+
PRECONDITION_FAILED: -32012,
|
|
7318
|
+
PAYLOAD_TOO_LARGE: -32013,
|
|
7319
|
+
UNSUPPORTED_MEDIA_TYPE: -32015,
|
|
7320
|
+
UNPROCESSABLE_CONTENT: -32022,
|
|
7321
|
+
PRECONDITION_REQUIRED: -32028,
|
|
7322
|
+
TOO_MANY_REQUESTS: -32029,
|
|
7323
|
+
CLIENT_CLOSED_REQUEST: -32099
|
|
7324
|
+
};
|
|
7325
|
+
var retryableRpcCodes = [
|
|
7326
|
+
TRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,
|
|
7327
|
+
TRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,
|
|
7328
|
+
TRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,
|
|
7329
|
+
TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
|
|
7330
|
+
];
|
|
7331
|
+
|
|
7332
|
+
// ../../../node_modules/.bun/@trpc+server@11.24.0+aec250ebf9e68690/node_modules/@trpc/server/dist/getErrorShape-B5jPKHJ3.mjs
|
|
7333
|
+
var noop = () => {};
|
|
7334
|
+
var freezeIfAvailable = (obj) => {
|
|
7335
|
+
if (Object.freeze)
|
|
7336
|
+
Object.freeze(obj);
|
|
7337
|
+
};
|
|
7338
|
+
function createInnerProxy(callback, path, memo) {
|
|
7339
|
+
var _memo$cacheKey;
|
|
7340
|
+
const cacheKey = path.join(".");
|
|
7341
|
+
(_memo$cacheKey = memo[cacheKey]) !== null && _memo$cacheKey !== undefined || (memo[cacheKey] = new Proxy(noop, {
|
|
7342
|
+
get(_obj, key) {
|
|
7343
|
+
if (typeof key !== "string" || key === "then")
|
|
7344
|
+
return;
|
|
7345
|
+
return createInnerProxy(callback, [...path, key], memo);
|
|
7346
|
+
},
|
|
7347
|
+
apply(_1, _2, args) {
|
|
7348
|
+
const lastOfPath = path[path.length - 1];
|
|
7349
|
+
if (lastOfPath === "valueOf" || lastOfPath === "toString" || lastOfPath === "toJSON")
|
|
7350
|
+
return `tRPC.proxy(${path.slice(0, -1).join(".")})`;
|
|
7351
|
+
let opts = {
|
|
7352
|
+
args,
|
|
7353
|
+
path
|
|
7354
|
+
};
|
|
7355
|
+
if (lastOfPath === "call")
|
|
7356
|
+
opts = {
|
|
7357
|
+
args: args.length >= 2 ? [args[1]] : [],
|
|
7358
|
+
path: path.slice(0, -1)
|
|
7359
|
+
};
|
|
7360
|
+
else if (lastOfPath === "apply")
|
|
7361
|
+
opts = {
|
|
7362
|
+
args: args.length >= 2 ? args[1] : [],
|
|
7363
|
+
path: path.slice(0, -1)
|
|
7364
|
+
};
|
|
7365
|
+
freezeIfAvailable(opts.args);
|
|
7366
|
+
freezeIfAvailable(opts.path);
|
|
7367
|
+
return callback(opts);
|
|
7368
|
+
}
|
|
7369
|
+
}));
|
|
7370
|
+
return memo[cacheKey];
|
|
7371
|
+
}
|
|
7372
|
+
var createRecursiveProxy = (callback) => createInnerProxy(callback, [], emptyObject());
|
|
7373
|
+
var createFlatProxy = (callback) => {
|
|
7374
|
+
return new Proxy(noop, { get(_obj, name) {
|
|
7375
|
+
if (name === "then")
|
|
7376
|
+
return;
|
|
7377
|
+
return callback(name);
|
|
7378
|
+
} });
|
|
7379
|
+
};
|
|
7380
|
+
var formattedShapeSymbol = Symbol("trpc_formattedErrorShape");
|
|
7381
|
+
function _typeof2(o) {
|
|
7382
|
+
"@babel/helpers - typeof";
|
|
7383
|
+
return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
7384
|
+
return typeof o;
|
|
7385
|
+
} : function(o) {
|
|
7386
|
+
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7387
|
+
}, _typeof2(o);
|
|
7388
|
+
}
|
|
7389
|
+
function toPrimitive2(t, r) {
|
|
7390
|
+
if (_typeof2(t) != "object" || !t)
|
|
7391
|
+
return t;
|
|
7392
|
+
var e = t[Symbol.toPrimitive];
|
|
7393
|
+
if (e !== undefined) {
|
|
7394
|
+
var i = e.call(t, r || "default");
|
|
7395
|
+
if (_typeof2(i) != "object")
|
|
7396
|
+
return i;
|
|
7397
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7398
|
+
}
|
|
7399
|
+
return (r === "string" ? String : Number)(t);
|
|
7400
|
+
}
|
|
7401
|
+
function toPropertyKey2(t) {
|
|
7402
|
+
var i = toPrimitive2(t, "string");
|
|
7403
|
+
return _typeof2(i) == "symbol" ? i : i + "";
|
|
7404
|
+
}
|
|
7405
|
+
function _defineProperty2(e, r, t) {
|
|
7406
|
+
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
|
|
7407
|
+
value: t,
|
|
7408
|
+
enumerable: true,
|
|
7409
|
+
configurable: true,
|
|
7410
|
+
writable: true
|
|
7411
|
+
}) : e[r] = t, e;
|
|
7412
|
+
}
|
|
7413
|
+
function ownKeys2(e, r) {
|
|
7414
|
+
var t = Object.keys(e);
|
|
7415
|
+
if (Object.getOwnPropertySymbols) {
|
|
7416
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7417
|
+
r && (o = o.filter(function(r) {
|
|
7418
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
7419
|
+
})), t.push.apply(t, o);
|
|
7420
|
+
}
|
|
7421
|
+
return t;
|
|
7422
|
+
}
|
|
7423
|
+
function _objectSpread22(e) {
|
|
7424
|
+
for (var r = 1;r < arguments.length; r++) {
|
|
7425
|
+
var t = arguments[r] != null ? arguments[r] : {};
|
|
7426
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r) {
|
|
7427
|
+
_defineProperty2(e, r, t[r]);
|
|
7428
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r) {
|
|
7429
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
7430
|
+
});
|
|
7431
|
+
}
|
|
7432
|
+
return e;
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7435
|
+
// ../../../node_modules/.bun/@trpc+server@11.24.0+aec250ebf9e68690/node_modules/@trpc/server/dist/asyncGeneratorDelegate-JWx0LJUD.mjs
|
|
7436
|
+
function transformResultInner(response, transformer) {
|
|
7437
|
+
if ("error" in response) {
|
|
7438
|
+
const error = transformer.deserialize(response.error);
|
|
7439
|
+
return {
|
|
7440
|
+
ok: false,
|
|
7441
|
+
error: _objectSpread22(_objectSpread22({}, response), {}, { error })
|
|
7442
|
+
};
|
|
7443
|
+
}
|
|
7444
|
+
return {
|
|
7445
|
+
ok: true,
|
|
7446
|
+
result: _objectSpread22(_objectSpread22({}, response.result), (!response.result.type || response.result.type === "data") && {
|
|
7447
|
+
type: "data",
|
|
7448
|
+
data: transformer.deserialize(response.result.data)
|
|
7449
|
+
})
|
|
7450
|
+
};
|
|
7451
|
+
}
|
|
7452
|
+
var TransformResultError = class extends Error {
|
|
7453
|
+
constructor() {
|
|
7454
|
+
super("Unable to transform response from server");
|
|
7455
|
+
}
|
|
7456
|
+
};
|
|
7457
|
+
function transformResult(response, transformer) {
|
|
7458
|
+
let result;
|
|
7459
|
+
try {
|
|
7460
|
+
result = transformResultInner(response, transformer);
|
|
7461
|
+
} catch (_unused) {
|
|
7462
|
+
throw new TransformResultError;
|
|
7463
|
+
}
|
|
7464
|
+
if (!result.ok && (!isObject2(result.error.error) || typeof result.error.error["code"] !== "number"))
|
|
7465
|
+
throw new TransformResultError;
|
|
7466
|
+
if (result.ok && !isObject2(result.result))
|
|
7467
|
+
throw new TransformResultError;
|
|
7468
|
+
return result;
|
|
7469
|
+
}
|
|
7470
|
+
function resolvePathSeparator(value) {
|
|
7471
|
+
return value !== null && value !== undefined ? value : ".";
|
|
7472
|
+
}
|
|
7473
|
+
function procedurePathToURLPath(path, separator) {
|
|
7474
|
+
if (separator === ".")
|
|
7475
|
+
return path;
|
|
7476
|
+
return path.split(".").join(separator);
|
|
7477
|
+
}
|
|
7478
|
+
function _OverloadYield(e, d) {
|
|
7479
|
+
this.v = e, this.k = d;
|
|
7480
|
+
}
|
|
7481
|
+
function AsyncGenerator(e) {
|
|
7482
|
+
var r, t;
|
|
7483
|
+
function resume(r, t) {
|
|
7484
|
+
try {
|
|
7485
|
+
var n = e[r](t), o = n.value, u = o instanceof _OverloadYield;
|
|
7486
|
+
Promise.resolve(u ? o.v : o).then(function(t) {
|
|
7487
|
+
if (u) {
|
|
7488
|
+
var i = r === "return" ? "return" : "next";
|
|
7489
|
+
if (!o.k || t.done)
|
|
7490
|
+
return resume(i, t);
|
|
7491
|
+
t = e[i](t).value;
|
|
7492
|
+
}
|
|
7493
|
+
settle(n.done ? "return" : "normal", t);
|
|
7494
|
+
}, function(e) {
|
|
7495
|
+
resume("throw", e);
|
|
7496
|
+
});
|
|
7497
|
+
} catch (e) {
|
|
7498
|
+
settle("throw", e);
|
|
7499
|
+
}
|
|
7500
|
+
}
|
|
7501
|
+
function settle(e, n) {
|
|
7502
|
+
switch (e) {
|
|
7503
|
+
case "return":
|
|
7504
|
+
r.resolve({
|
|
7505
|
+
value: n,
|
|
7506
|
+
done: true
|
|
7507
|
+
});
|
|
7508
|
+
break;
|
|
7509
|
+
case "throw":
|
|
7510
|
+
r.reject(n);
|
|
7511
|
+
break;
|
|
7512
|
+
default:
|
|
7513
|
+
r.resolve({
|
|
7514
|
+
value: n,
|
|
7515
|
+
done: false
|
|
7516
|
+
});
|
|
7517
|
+
}
|
|
7518
|
+
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
7519
|
+
}
|
|
7520
|
+
this._invoke = function(e, n) {
|
|
7521
|
+
return new Promise(function(o, u) {
|
|
7522
|
+
var i = {
|
|
7523
|
+
key: e,
|
|
7524
|
+
arg: n,
|
|
7525
|
+
resolve: o,
|
|
7526
|
+
reject: u,
|
|
7527
|
+
next: null
|
|
7528
|
+
};
|
|
7529
|
+
t ? t = t.next = i : (r = t = i, resume(e, n));
|
|
7530
|
+
});
|
|
7531
|
+
}, typeof e["return"] != "function" && (this["return"] = undefined);
|
|
7532
|
+
}
|
|
7533
|
+
AsyncGenerator.prototype[typeof Symbol == "function" && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
7534
|
+
return this;
|
|
7535
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
7536
|
+
return this._invoke("next", e);
|
|
7537
|
+
}, AsyncGenerator.prototype["throw"] = function(e) {
|
|
7538
|
+
return this._invoke("throw", e);
|
|
7539
|
+
}, AsyncGenerator.prototype["return"] = function(e) {
|
|
7540
|
+
return this._invoke("return", e);
|
|
7541
|
+
};
|
|
7542
|
+
var trackedSymbol = Symbol();
|
|
7543
|
+
|
|
7544
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/TRPCClientError-Byo7P4QG.mjs
|
|
7545
|
+
function isTRPCClientError(cause) {
|
|
7546
|
+
return cause instanceof TRPCClientError;
|
|
7547
|
+
}
|
|
7548
|
+
function isTRPCErrorResponse(obj) {
|
|
7549
|
+
return isObject2(obj) && isObject2(obj["error"]) && typeof obj["error"]["code"] === "number" && typeof obj["error"]["message"] === "string";
|
|
7550
|
+
}
|
|
7551
|
+
function getMessageFromUnknownError(err, fallback) {
|
|
7552
|
+
if (typeof err === "string")
|
|
7553
|
+
return err;
|
|
7554
|
+
if (isObject2(err) && typeof err["message"] === "string")
|
|
7555
|
+
return err["message"];
|
|
7556
|
+
return fallback;
|
|
7557
|
+
}
|
|
7558
|
+
var TRPCClientError = class TRPCClientError extends Error {
|
|
7559
|
+
constructor(message, opts) {
|
|
7560
|
+
var _opts$result, _opts$result2;
|
|
7561
|
+
const cause = opts === null || opts === undefined ? undefined : opts.cause;
|
|
7562
|
+
super(message, { cause });
|
|
7563
|
+
_defineProperty(this, "cause", undefined);
|
|
7564
|
+
_defineProperty(this, "shape", undefined);
|
|
7565
|
+
_defineProperty(this, "data", undefined);
|
|
7566
|
+
_defineProperty(this, "meta", undefined);
|
|
7567
|
+
this.meta = opts === null || opts === undefined ? undefined : opts.meta;
|
|
7568
|
+
this.cause = cause;
|
|
7569
|
+
this.shape = opts === null || opts === undefined || (_opts$result = opts.result) === null || _opts$result === undefined ? undefined : _opts$result.error;
|
|
7570
|
+
this.data = opts === null || opts === undefined || (_opts$result2 = opts.result) === null || _opts$result2 === undefined ? undefined : _opts$result2.error.data;
|
|
7571
|
+
this.name = "TRPCClientError";
|
|
7572
|
+
Object.setPrototypeOf(this, TRPCClientError.prototype);
|
|
7573
|
+
}
|
|
7574
|
+
static from(_cause, opts = {}) {
|
|
7575
|
+
const cause = _cause;
|
|
7576
|
+
if (isTRPCClientError(cause)) {
|
|
7577
|
+
if (opts.meta)
|
|
7578
|
+
cause.meta = _objectSpread2(_objectSpread2({}, cause.meta), opts.meta);
|
|
7579
|
+
return cause;
|
|
7580
|
+
}
|
|
7581
|
+
if (isTRPCErrorResponse(cause))
|
|
7582
|
+
return new TRPCClientError(cause.error.message, _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
7583
|
+
result: cause,
|
|
7584
|
+
cause: opts.cause
|
|
7585
|
+
}));
|
|
7586
|
+
return new TRPCClientError(getMessageFromUnknownError(cause, "Unknown error"), _objectSpread2(_objectSpread2({}, opts), {}, { cause }));
|
|
7587
|
+
}
|
|
7588
|
+
};
|
|
7589
|
+
|
|
7590
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/unstable-internals.mjs
|
|
7591
|
+
function getTransformer(transformer) {
|
|
7592
|
+
const _transformer = transformer;
|
|
7593
|
+
if (!_transformer)
|
|
7594
|
+
return {
|
|
7595
|
+
input: {
|
|
7596
|
+
serialize: (data) => data,
|
|
7597
|
+
deserialize: (data) => data
|
|
7598
|
+
},
|
|
7599
|
+
output: {
|
|
7600
|
+
serialize: (data) => data,
|
|
7601
|
+
deserialize: (data) => data
|
|
7602
|
+
}
|
|
7603
|
+
};
|
|
7604
|
+
if ("input" in _transformer)
|
|
7605
|
+
return _transformer;
|
|
7606
|
+
return {
|
|
7607
|
+
input: _transformer,
|
|
7608
|
+
output: _transformer
|
|
7609
|
+
};
|
|
7610
|
+
}
|
|
7611
|
+
|
|
7612
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/httpUtils-5Hmhcy-z.mjs
|
|
7613
|
+
var isFunction2 = (fn) => typeof fn === "function";
|
|
7614
|
+
function getFetch(customFetchImpl) {
|
|
7615
|
+
if (customFetchImpl)
|
|
7616
|
+
return customFetchImpl;
|
|
7617
|
+
if (typeof window !== "undefined" && isFunction2(window.fetch))
|
|
7618
|
+
return window.fetch.bind(window);
|
|
7619
|
+
if (typeof globalThis !== "undefined" && isFunction2(globalThis.fetch))
|
|
7620
|
+
return globalThis.fetch;
|
|
7621
|
+
throw new Error("No fetch implementation found");
|
|
7622
|
+
}
|
|
7623
|
+
function allAbortSignals(...signals) {
|
|
7624
|
+
const ac = new AbortController;
|
|
7625
|
+
const count = signals.length;
|
|
7626
|
+
let abortedCount = 0;
|
|
7627
|
+
const onAbort = () => {
|
|
7628
|
+
if (++abortedCount === count)
|
|
7629
|
+
ac.abort();
|
|
7630
|
+
};
|
|
7631
|
+
for (const signal of signals)
|
|
7632
|
+
if (signal === null || signal === undefined ? undefined : signal.aborted)
|
|
7633
|
+
onAbort();
|
|
7634
|
+
else
|
|
7635
|
+
signal === null || signal === undefined || signal.addEventListener("abort", onAbort, { once: true });
|
|
7636
|
+
return ac.signal;
|
|
7637
|
+
}
|
|
7638
|
+
function raceAbortSignalsWithCleanup(...signals) {
|
|
7639
|
+
const ac = new AbortController;
|
|
7640
|
+
const cleanup = () => {
|
|
7641
|
+
for (const signal of signals)
|
|
7642
|
+
signal === null || signal === undefined || signal.removeEventListener("abort", onAbort);
|
|
7643
|
+
};
|
|
7644
|
+
const onAbort = () => {
|
|
7645
|
+
cleanup();
|
|
7646
|
+
ac.abort();
|
|
7647
|
+
};
|
|
7648
|
+
for (const signal of signals) {
|
|
7649
|
+
if (signal === null || signal === undefined ? undefined : signal.aborted) {
|
|
7650
|
+
onAbort();
|
|
7651
|
+
break;
|
|
7652
|
+
}
|
|
7653
|
+
signal === null || signal === undefined || signal.addEventListener("abort", onAbort, { once: true });
|
|
7654
|
+
}
|
|
7655
|
+
return {
|
|
7656
|
+
signal: ac.signal,
|
|
7657
|
+
cleanup
|
|
7658
|
+
};
|
|
7659
|
+
}
|
|
7660
|
+
function resolveHTTPLinkOptions(opts) {
|
|
7661
|
+
return {
|
|
7662
|
+
url: opts.url.toString(),
|
|
7663
|
+
fetch: opts.fetch,
|
|
7664
|
+
transformer: getTransformer(opts.transformer),
|
|
7665
|
+
methodOverride: opts.methodOverride,
|
|
7666
|
+
pathSeparator: resolvePathSeparator(opts.pathSeparator)
|
|
7667
|
+
};
|
|
7668
|
+
}
|
|
7669
|
+
function arrayToDict(array) {
|
|
7670
|
+
const dict = {};
|
|
7671
|
+
for (let index = 0;index < array.length; index++) {
|
|
7672
|
+
const element = array[index];
|
|
7673
|
+
dict[index] = element;
|
|
7674
|
+
}
|
|
7675
|
+
return dict;
|
|
7676
|
+
}
|
|
7677
|
+
var METHOD = {
|
|
7678
|
+
query: "GET",
|
|
7679
|
+
mutation: "POST",
|
|
7680
|
+
subscription: "PATCH"
|
|
7681
|
+
};
|
|
7682
|
+
function getInput(opts) {
|
|
7683
|
+
return "input" in opts ? opts.transformer.input.serialize(opts.input) : arrayToDict(opts.inputs.map((_input) => opts.transformer.input.serialize(_input)));
|
|
7684
|
+
}
|
|
7685
|
+
var getUrl = (opts) => {
|
|
7686
|
+
const parts = opts.url.split("?");
|
|
7687
|
+
let url = parts[0].replace(/\/$/, "") + "/" + procedurePathToURLPath(opts.path, opts.pathSeparator);
|
|
7688
|
+
const queryParts = [];
|
|
7689
|
+
if (parts[1])
|
|
7690
|
+
queryParts.push(parts[1]);
|
|
7691
|
+
if ("inputs" in opts)
|
|
7692
|
+
queryParts.push("batch=1");
|
|
7693
|
+
if (opts.type === "query" || opts.type === "subscription") {
|
|
7694
|
+
const input = getInput(opts);
|
|
7695
|
+
if (input !== undefined && opts.methodOverride !== "POST")
|
|
7696
|
+
queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);
|
|
7697
|
+
}
|
|
7698
|
+
if (queryParts.length)
|
|
7699
|
+
url += "?" + queryParts.join("&");
|
|
7700
|
+
return url;
|
|
7701
|
+
};
|
|
7702
|
+
var getBody = (opts) => {
|
|
7703
|
+
if (opts.type === "query" && opts.methodOverride !== "POST")
|
|
7704
|
+
return;
|
|
7705
|
+
const input = getInput(opts);
|
|
7706
|
+
return input !== undefined ? JSON.stringify(input) : undefined;
|
|
7707
|
+
};
|
|
7708
|
+
var jsonHttpRequester = (opts) => {
|
|
7709
|
+
return httpRequest(_objectSpread2(_objectSpread2({}, opts), {}, {
|
|
7710
|
+
contentTypeHeader: "application/json",
|
|
7711
|
+
getUrl,
|
|
7712
|
+
getBody
|
|
7713
|
+
}));
|
|
7714
|
+
};
|
|
7715
|
+
var AbortError = class extends Error {
|
|
7716
|
+
constructor() {
|
|
7717
|
+
const name = "AbortError";
|
|
7718
|
+
super(name);
|
|
7719
|
+
this.name = name;
|
|
7720
|
+
this.message = name;
|
|
7721
|
+
}
|
|
7722
|
+
};
|
|
7723
|
+
var throwIfAborted = (signal) => {
|
|
7724
|
+
var _signal$throwIfAborte;
|
|
7725
|
+
if (!(signal === null || signal === undefined ? undefined : signal.aborted))
|
|
7726
|
+
return;
|
|
7727
|
+
(_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === undefined || _signal$throwIfAborte.call(signal);
|
|
7728
|
+
if (typeof DOMException !== "undefined")
|
|
7729
|
+
throw new DOMException("AbortError", "AbortError");
|
|
7730
|
+
throw new AbortError;
|
|
7731
|
+
};
|
|
7732
|
+
async function fetchHTTPResponse(opts) {
|
|
7733
|
+
var _opts$methodOverride, _opts$trpcAcceptHeade;
|
|
7734
|
+
throwIfAborted(opts.signal);
|
|
7735
|
+
const url = opts.getUrl(opts);
|
|
7736
|
+
const body = opts.getBody(opts);
|
|
7737
|
+
const method = (_opts$methodOverride = opts.methodOverride) !== null && _opts$methodOverride !== undefined ? _opts$methodOverride : METHOD[opts.type];
|
|
7738
|
+
const resolvedHeaders = await (async () => {
|
|
7739
|
+
const heads = await opts.headers();
|
|
7740
|
+
if (Symbol.iterator in heads)
|
|
7741
|
+
return Object.fromEntries(heads);
|
|
7742
|
+
return heads;
|
|
7743
|
+
})();
|
|
7744
|
+
const hasContentType = Object.keys(resolvedHeaders).some((key) => key.toLowerCase() === "content-type");
|
|
7745
|
+
const headers = _objectSpread2(_objectSpread2(_objectSpread2({}, opts.contentTypeHeader && method !== "GET" && !hasContentType ? { "content-type": opts.contentTypeHeader } : {}), opts.trpcAcceptHeader ? { [(_opts$trpcAcceptHeade = opts.trpcAcceptHeaderKey) !== null && _opts$trpcAcceptHeade !== undefined ? _opts$trpcAcceptHeade : "trpc-accept"]: opts.trpcAcceptHeader } : undefined), resolvedHeaders);
|
|
7746
|
+
return getFetch(opts.fetch)(url, {
|
|
7747
|
+
method,
|
|
7748
|
+
signal: opts.signal,
|
|
7749
|
+
body,
|
|
7750
|
+
headers
|
|
7751
|
+
});
|
|
7752
|
+
}
|
|
7753
|
+
async function httpRequest(opts) {
|
|
7754
|
+
const meta = {};
|
|
7755
|
+
const res = await fetchHTTPResponse(opts);
|
|
7756
|
+
meta.response = res;
|
|
7757
|
+
const json = await res.json();
|
|
7758
|
+
meta.responseJSON = json;
|
|
7759
|
+
return {
|
|
7760
|
+
json,
|
|
7761
|
+
meta
|
|
7762
|
+
};
|
|
7763
|
+
}
|
|
7764
|
+
|
|
7765
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/httpBatchLink-aPx7u_sr.mjs
|
|
7766
|
+
var throwFatalError = () => {
|
|
7767
|
+
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
7768
|
+
};
|
|
7769
|
+
function dataLoader(batchLoader) {
|
|
7770
|
+
let pendingItems = null;
|
|
7771
|
+
let dispatchTimer = null;
|
|
7772
|
+
const destroyTimerAndPendingItems = () => {
|
|
7773
|
+
clearTimeout(dispatchTimer);
|
|
7774
|
+
dispatchTimer = null;
|
|
7775
|
+
pendingItems = null;
|
|
7776
|
+
};
|
|
7777
|
+
function groupItems(items) {
|
|
7778
|
+
const groupedItems = [[]];
|
|
7779
|
+
let index = 0;
|
|
7780
|
+
while (true) {
|
|
7781
|
+
const item = items[index];
|
|
7782
|
+
if (!item)
|
|
7783
|
+
break;
|
|
7784
|
+
const lastGroup = groupedItems[groupedItems.length - 1];
|
|
7785
|
+
if (item.aborted) {
|
|
7786
|
+
var _item$reject;
|
|
7787
|
+
(_item$reject = item.reject) === null || _item$reject === undefined || _item$reject.call(item, /* @__PURE__ */ new Error("Aborted"));
|
|
7788
|
+
index++;
|
|
7789
|
+
continue;
|
|
7790
|
+
}
|
|
7791
|
+
let isValid;
|
|
7792
|
+
try {
|
|
7793
|
+
isValid = batchLoader.validate(lastGroup.concat(item).map((it) => it.key));
|
|
7794
|
+
} catch (cause) {
|
|
7795
|
+
var _item$reject2;
|
|
7796
|
+
(_item$reject2 = item.reject) === null || _item$reject2 === undefined || _item$reject2.call(item, cause);
|
|
7797
|
+
index++;
|
|
7798
|
+
continue;
|
|
7799
|
+
}
|
|
7800
|
+
if (isValid) {
|
|
7801
|
+
lastGroup.push(item);
|
|
7802
|
+
index++;
|
|
7803
|
+
continue;
|
|
7804
|
+
}
|
|
7805
|
+
if (lastGroup.length === 0) {
|
|
7806
|
+
var _item$reject3;
|
|
7807
|
+
(_item$reject3 = item.reject) === null || _item$reject3 === undefined || _item$reject3.call(item, /* @__PURE__ */ new Error("Input is too big for a single dispatch"));
|
|
7808
|
+
index++;
|
|
7809
|
+
continue;
|
|
7810
|
+
}
|
|
7811
|
+
groupedItems.push([]);
|
|
7812
|
+
}
|
|
7813
|
+
return groupedItems;
|
|
7814
|
+
}
|
|
7815
|
+
function dispatch() {
|
|
7816
|
+
const groupedItems = groupItems(pendingItems);
|
|
7817
|
+
destroyTimerAndPendingItems();
|
|
7818
|
+
for (const items of groupedItems) {
|
|
7819
|
+
if (!items.length)
|
|
7820
|
+
continue;
|
|
7821
|
+
const batch = { items };
|
|
7822
|
+
for (const item of items)
|
|
7823
|
+
item.batch = batch;
|
|
7824
|
+
batchLoader.fetch(batch.items.map((_item) => _item.key)).then(async (result) => {
|
|
7825
|
+
await Promise.all(result.map(async (valueOrPromise, index) => {
|
|
7826
|
+
const item = batch.items[index];
|
|
7827
|
+
try {
|
|
7828
|
+
var _item$resolve;
|
|
7829
|
+
const value = await Promise.resolve(valueOrPromise);
|
|
7830
|
+
(_item$resolve = item.resolve) === null || _item$resolve === undefined || _item$resolve.call(item, value);
|
|
7831
|
+
} catch (cause) {
|
|
7832
|
+
var _item$reject4;
|
|
7833
|
+
(_item$reject4 = item.reject) === null || _item$reject4 === undefined || _item$reject4.call(item, cause);
|
|
7834
|
+
}
|
|
7835
|
+
item.batch = null;
|
|
7836
|
+
item.reject = null;
|
|
7837
|
+
item.resolve = null;
|
|
7838
|
+
}));
|
|
7839
|
+
for (const item of batch.items) {
|
|
7840
|
+
var _item$reject5;
|
|
7841
|
+
(_item$reject5 = item.reject) === null || _item$reject5 === undefined || _item$reject5.call(item, /* @__PURE__ */ new Error("Missing result"));
|
|
7842
|
+
item.batch = null;
|
|
7843
|
+
}
|
|
7844
|
+
}).catch((cause) => {
|
|
7845
|
+
for (const item of batch.items) {
|
|
7846
|
+
var _item$reject6;
|
|
7847
|
+
(_item$reject6 = item.reject) === null || _item$reject6 === undefined || _item$reject6.call(item, cause);
|
|
7848
|
+
item.batch = null;
|
|
7849
|
+
}
|
|
7850
|
+
});
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
function load(key) {
|
|
7854
|
+
var _dispatchTimer;
|
|
7855
|
+
const item = {
|
|
7856
|
+
aborted: false,
|
|
7857
|
+
key,
|
|
7858
|
+
batch: null,
|
|
7859
|
+
resolve: throwFatalError,
|
|
7860
|
+
reject: throwFatalError
|
|
7861
|
+
};
|
|
7862
|
+
const promise = new Promise((resolve, reject) => {
|
|
7863
|
+
var _pendingItems;
|
|
7864
|
+
item.reject = reject;
|
|
7865
|
+
item.resolve = resolve;
|
|
7866
|
+
(_pendingItems = pendingItems) !== null && _pendingItems !== undefined || (pendingItems = []);
|
|
7867
|
+
pendingItems.push(item);
|
|
7868
|
+
});
|
|
7869
|
+
(_dispatchTimer = dispatchTimer) !== null && _dispatchTimer !== undefined || (dispatchTimer = setTimeout(dispatch));
|
|
7870
|
+
return promise;
|
|
7871
|
+
}
|
|
7872
|
+
return { load };
|
|
7873
|
+
}
|
|
7874
|
+
function httpBatchLink(opts) {
|
|
7875
|
+
var _opts$maxURLLength, _opts$maxItems;
|
|
7876
|
+
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
7877
|
+
const maxURLLength = (_opts$maxURLLength = opts.maxURLLength) !== null && _opts$maxURLLength !== undefined ? _opts$maxURLLength : Infinity;
|
|
7878
|
+
const maxItems = (_opts$maxItems = opts.maxItems) !== null && _opts$maxItems !== undefined ? _opts$maxItems : Infinity;
|
|
7879
|
+
return () => {
|
|
7880
|
+
const batchLoader = (type) => {
|
|
7881
|
+
return {
|
|
7882
|
+
validate(batchOps) {
|
|
7883
|
+
if (maxURLLength === Infinity && maxItems === Infinity)
|
|
7884
|
+
return true;
|
|
7885
|
+
if (batchOps.length > maxItems)
|
|
7886
|
+
return false;
|
|
7887
|
+
const path = batchOps.map((op) => op.path).join(",");
|
|
7888
|
+
const inputs = batchOps.map((op) => op.input);
|
|
7889
|
+
return getUrl(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, {
|
|
7890
|
+
type,
|
|
7891
|
+
path,
|
|
7892
|
+
inputs,
|
|
7893
|
+
signal: null
|
|
7894
|
+
})).length <= maxURLLength;
|
|
7895
|
+
},
|
|
7896
|
+
async fetch(batchOps) {
|
|
7897
|
+
const path = batchOps.map((op) => op.path).join(",");
|
|
7898
|
+
const inputs = batchOps.map((op) => op.input);
|
|
7899
|
+
const signal = allAbortSignals(...batchOps.map((op) => op.signal));
|
|
7900
|
+
const res = await jsonHttpRequester(_objectSpread2(_objectSpread2({}, resolvedOpts), {}, {
|
|
7901
|
+
path,
|
|
7902
|
+
inputs,
|
|
7903
|
+
type,
|
|
7904
|
+
headers() {
|
|
7905
|
+
if (!opts.headers)
|
|
7906
|
+
return {};
|
|
7907
|
+
if (typeof opts.headers === "function")
|
|
7908
|
+
return opts.headers({ opList: batchOps });
|
|
7909
|
+
return opts.headers;
|
|
7910
|
+
},
|
|
7911
|
+
signal
|
|
7912
|
+
}));
|
|
7913
|
+
return (Array.isArray(res.json) ? res.json : batchOps.map(() => res.json)).map((item) => ({
|
|
7914
|
+
meta: res.meta,
|
|
7915
|
+
json: item
|
|
7916
|
+
}));
|
|
7917
|
+
}
|
|
7918
|
+
};
|
|
7919
|
+
};
|
|
7920
|
+
const loaders = {
|
|
7921
|
+
query: dataLoader(batchLoader("query")),
|
|
7922
|
+
mutation: dataLoader(batchLoader("mutation"))
|
|
7923
|
+
};
|
|
7924
|
+
return ({ op }) => {
|
|
7925
|
+
return observable((observer) => {
|
|
7926
|
+
if (op.type === "subscription")
|
|
7927
|
+
throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");
|
|
7928
|
+
const ac = new AbortController;
|
|
7929
|
+
const { signal, cleanup } = raceAbortSignalsWithCleanup(op.signal, ac.signal);
|
|
7930
|
+
const promise = loaders[op.type].load(_objectSpread2(_objectSpread2({}, op), {}, { signal }));
|
|
7931
|
+
let isDone = false;
|
|
7932
|
+
let _res = undefined;
|
|
7933
|
+
promise.then((res) => {
|
|
7934
|
+
isDone = true;
|
|
7935
|
+
_res = res;
|
|
7936
|
+
const transformed = transformResult(res.json, resolvedOpts.transformer.output);
|
|
7937
|
+
if (!transformed.ok) {
|
|
7938
|
+
observer.error(TRPCClientError.from(transformed.error, { meta: res.meta }));
|
|
7939
|
+
return;
|
|
7940
|
+
}
|
|
7941
|
+
observer.next({
|
|
7942
|
+
context: res.meta,
|
|
7943
|
+
result: transformed.result
|
|
7944
|
+
});
|
|
7945
|
+
observer.complete();
|
|
7946
|
+
}).catch((err) => {
|
|
7947
|
+
isDone = true;
|
|
7948
|
+
observer.error(TRPCClientError.from(err, { meta: _res === null || _res === undefined ? undefined : _res.meta }));
|
|
7949
|
+
});
|
|
7950
|
+
return () => {
|
|
7951
|
+
if (!isDone)
|
|
7952
|
+
ac.abort();
|
|
7953
|
+
cleanup();
|
|
7954
|
+
};
|
|
7955
|
+
});
|
|
7956
|
+
};
|
|
7957
|
+
};
|
|
7958
|
+
}
|
|
7959
|
+
|
|
7960
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/links/loggerLink.mjs
|
|
7961
|
+
function isFormData(value) {
|
|
7962
|
+
if (typeof FormData === "undefined")
|
|
7963
|
+
return false;
|
|
7964
|
+
return value instanceof FormData;
|
|
7965
|
+
}
|
|
7966
|
+
var palettes = {
|
|
7967
|
+
css: {
|
|
7968
|
+
query: ["72e3ff", "3fb0d8"],
|
|
7969
|
+
mutation: ["c5a3fc", "904dfc"],
|
|
7970
|
+
subscription: ["ff49e1", "d83fbe"]
|
|
7971
|
+
},
|
|
7972
|
+
ansi: {
|
|
7973
|
+
regular: {
|
|
7974
|
+
query: ["\x1B[30;46m", "\x1B[97;46m"],
|
|
7975
|
+
mutation: ["\x1B[30;45m", "\x1B[97;45m"],
|
|
7976
|
+
subscription: ["\x1B[30;42m", "\x1B[97;42m"]
|
|
7977
|
+
},
|
|
7978
|
+
bold: {
|
|
7979
|
+
query: ["\x1B[1;30;46m", "\x1B[1;97;46m"],
|
|
7980
|
+
mutation: ["\x1B[1;30;45m", "\x1B[1;97;45m"],
|
|
7981
|
+
subscription: ["\x1B[1;30;42m", "\x1B[1;97;42m"]
|
|
7982
|
+
}
|
|
7983
|
+
}
|
|
7984
|
+
};
|
|
7985
|
+
function constructPartsAndArgs(opts) {
|
|
7986
|
+
const { direction, type, withContext, path, id, input } = opts;
|
|
7987
|
+
const parts = [];
|
|
7988
|
+
const args = [];
|
|
7989
|
+
if (opts.colorMode === "none")
|
|
7990
|
+
parts.push(direction === "up" ? ">>" : "<<", type, `#${id}`, path);
|
|
7991
|
+
else if (opts.colorMode === "ansi") {
|
|
7992
|
+
const [lightRegular, darkRegular] = palettes.ansi.regular[type];
|
|
7993
|
+
const [lightBold, darkBold] = palettes.ansi.bold[type];
|
|
7994
|
+
parts.push(direction === "up" ? lightRegular : darkRegular, direction === "up" ? ">>" : "<<", type, direction === "up" ? lightBold : darkBold, `#${id}`, path, "\x1B[0m");
|
|
7995
|
+
} else {
|
|
7996
|
+
const [light, dark] = palettes.css[type];
|
|
7997
|
+
const css = `
|
|
7998
|
+
background-color: #${direction === "up" ? light : dark};
|
|
7999
|
+
color: ${direction === "up" ? "black" : "white"};
|
|
8000
|
+
padding: 2px;
|
|
8001
|
+
`;
|
|
8002
|
+
parts.push("%c", direction === "up" ? ">>" : "<<", type, `#${id}`, `%c${path}%c`, "%O");
|
|
8003
|
+
args.push(css, `${css}; font-weight: bold;`, `${css}; font-weight: normal;`);
|
|
8004
|
+
}
|
|
8005
|
+
if (direction === "up")
|
|
8006
|
+
args.push(withContext ? {
|
|
8007
|
+
input,
|
|
8008
|
+
context: opts.context
|
|
8009
|
+
} : { input });
|
|
8010
|
+
else
|
|
8011
|
+
args.push(_objectSpread2({
|
|
8012
|
+
input,
|
|
8013
|
+
result: opts.result,
|
|
8014
|
+
elapsedMs: opts.elapsedMs
|
|
8015
|
+
}, withContext && { context: opts.context }));
|
|
8016
|
+
return {
|
|
8017
|
+
parts,
|
|
8018
|
+
args
|
|
8019
|
+
};
|
|
8020
|
+
}
|
|
8021
|
+
var defaultLogger = ({ c = console, colorMode = "css", withContext }) => (props) => {
|
|
8022
|
+
const rawInput = props.input;
|
|
8023
|
+
const input = isFormData(rawInput) ? Object.fromEntries(rawInput) : rawInput;
|
|
8024
|
+
const { parts, args } = constructPartsAndArgs(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
8025
|
+
colorMode,
|
|
8026
|
+
input,
|
|
8027
|
+
withContext
|
|
8028
|
+
}));
|
|
8029
|
+
c[props.direction === "down" && props.result && (props.result instanceof Error || ("error" in props.result.result) && props.result.result.error) ? "error" : "log"].apply(null, [parts.join(" ")].concat(args));
|
|
8030
|
+
};
|
|
8031
|
+
function loggerLink(opts = {}) {
|
|
8032
|
+
var _opts$colorMode, _opts$withContext;
|
|
8033
|
+
const { enabled = () => true } = opts;
|
|
8034
|
+
const colorMode = (_opts$colorMode = opts.colorMode) !== null && _opts$colorMode !== undefined ? _opts$colorMode : typeof window === "undefined" ? "ansi" : "css";
|
|
8035
|
+
const withContext = (_opts$withContext = opts.withContext) !== null && _opts$withContext !== undefined ? _opts$withContext : colorMode === "css";
|
|
8036
|
+
const { logger = defaultLogger({
|
|
8037
|
+
c: opts.console,
|
|
8038
|
+
colorMode,
|
|
8039
|
+
withContext
|
|
8040
|
+
}) } = opts;
|
|
8041
|
+
return () => {
|
|
8042
|
+
return ({ op, next }) => {
|
|
8043
|
+
return observable((observer) => {
|
|
8044
|
+
if (enabled(_objectSpread2(_objectSpread2({}, op), {}, { direction: "up" })))
|
|
8045
|
+
logger(_objectSpread2(_objectSpread2({}, op), {}, { direction: "up" }));
|
|
8046
|
+
const requestStartTime = Date.now();
|
|
8047
|
+
function logResult(result) {
|
|
8048
|
+
const elapsedMs = Date.now() - requestStartTime;
|
|
8049
|
+
if (enabled(_objectSpread2(_objectSpread2({}, op), {}, {
|
|
8050
|
+
direction: "down",
|
|
8051
|
+
result
|
|
8052
|
+
})))
|
|
8053
|
+
logger(_objectSpread2(_objectSpread2({}, op), {}, {
|
|
8054
|
+
direction: "down",
|
|
8055
|
+
elapsedMs,
|
|
8056
|
+
result
|
|
8057
|
+
}));
|
|
8058
|
+
}
|
|
8059
|
+
return next(op).pipe(tap({
|
|
8060
|
+
next(result) {
|
|
8061
|
+
logResult(result);
|
|
8062
|
+
},
|
|
8063
|
+
error(result) {
|
|
8064
|
+
logResult(result);
|
|
8065
|
+
}
|
|
8066
|
+
})).subscribe(observer);
|
|
8067
|
+
});
|
|
8068
|
+
};
|
|
8069
|
+
};
|
|
8070
|
+
}
|
|
8071
|
+
|
|
8072
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/wsLink-BTxcQ23Z.mjs
|
|
8073
|
+
var resultOf = (value, ...args) => {
|
|
8074
|
+
return typeof value === "function" ? value(...args) : value;
|
|
8075
|
+
};
|
|
8076
|
+
function withResolvers() {
|
|
8077
|
+
let resolve;
|
|
8078
|
+
let reject;
|
|
8079
|
+
return {
|
|
8080
|
+
promise: new Promise((res, rej) => {
|
|
8081
|
+
resolve = res;
|
|
8082
|
+
reject = rej;
|
|
8083
|
+
}),
|
|
8084
|
+
resolve,
|
|
8085
|
+
reject
|
|
8086
|
+
};
|
|
8087
|
+
}
|
|
8088
|
+
async function prepareUrl(urlOptions) {
|
|
8089
|
+
const url = await resultOf(urlOptions.url);
|
|
8090
|
+
if (!urlOptions.connectionParams)
|
|
8091
|
+
return url;
|
|
8092
|
+
return url + `${url.includes("?") ? "&" : "?"}connectionParams=1`;
|
|
8093
|
+
}
|
|
8094
|
+
async function buildConnectionMessage(connectionParams, encoder) {
|
|
8095
|
+
const message = {
|
|
8096
|
+
method: "connectionParams",
|
|
8097
|
+
data: await resultOf(connectionParams)
|
|
8098
|
+
};
|
|
8099
|
+
return encoder.encode(message);
|
|
8100
|
+
}
|
|
8101
|
+
function asyncWsOpen(ws) {
|
|
8102
|
+
const { promise, resolve, reject } = withResolvers();
|
|
8103
|
+
ws.addEventListener("open", () => {
|
|
8104
|
+
ws.removeEventListener("error", reject);
|
|
8105
|
+
resolve();
|
|
8106
|
+
});
|
|
8107
|
+
ws.addEventListener("error", reject);
|
|
8108
|
+
return promise;
|
|
8109
|
+
}
|
|
8110
|
+
function setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {
|
|
8111
|
+
let pingTimeout;
|
|
8112
|
+
let pongTimeout;
|
|
8113
|
+
function start() {
|
|
8114
|
+
pingTimeout = setTimeout(() => {
|
|
8115
|
+
ws.send("PING");
|
|
8116
|
+
pongTimeout = setTimeout(() => {
|
|
8117
|
+
ws.close();
|
|
8118
|
+
}, pongTimeoutMs);
|
|
8119
|
+
}, intervalMs);
|
|
8120
|
+
}
|
|
8121
|
+
function reset() {
|
|
8122
|
+
clearTimeout(pingTimeout);
|
|
8123
|
+
start();
|
|
8124
|
+
}
|
|
8125
|
+
function pong() {
|
|
8126
|
+
clearTimeout(pongTimeout);
|
|
8127
|
+
reset();
|
|
8128
|
+
}
|
|
8129
|
+
ws.addEventListener("open", start);
|
|
8130
|
+
ws.addEventListener("message", ({ data }) => {
|
|
8131
|
+
clearTimeout(pingTimeout);
|
|
8132
|
+
start();
|
|
8133
|
+
if (data === "PONG")
|
|
8134
|
+
pong();
|
|
8135
|
+
});
|
|
8136
|
+
ws.addEventListener("close", () => {
|
|
8137
|
+
clearTimeout(pingTimeout);
|
|
8138
|
+
clearTimeout(pongTimeout);
|
|
8139
|
+
});
|
|
8140
|
+
}
|
|
8141
|
+
var WsConnection = class WsConnection {
|
|
8142
|
+
constructor(opts) {
|
|
8143
|
+
var _opts$WebSocketPonyfi;
|
|
8144
|
+
_defineProperty(this, "id", ++WsConnection.connectCount);
|
|
8145
|
+
_defineProperty(this, "WebSocketPonyfill", undefined);
|
|
8146
|
+
_defineProperty(this, "urlOptions", undefined);
|
|
8147
|
+
_defineProperty(this, "keepAliveOpts", undefined);
|
|
8148
|
+
_defineProperty(this, "encoder", undefined);
|
|
8149
|
+
_defineProperty(this, "wsObservable", behaviorSubject(null));
|
|
8150
|
+
_defineProperty(this, "openPromise", null);
|
|
8151
|
+
this.WebSocketPonyfill = (_opts$WebSocketPonyfi = opts.WebSocketPonyfill) !== null && _opts$WebSocketPonyfi !== undefined ? _opts$WebSocketPonyfi : WebSocket;
|
|
8152
|
+
if (!this.WebSocketPonyfill)
|
|
8153
|
+
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");
|
|
8154
|
+
this.urlOptions = opts.urlOptions;
|
|
8155
|
+
this.keepAliveOpts = opts.keepAlive;
|
|
8156
|
+
this.encoder = opts.encoder;
|
|
8157
|
+
}
|
|
8158
|
+
get ws() {
|
|
8159
|
+
return this.wsObservable.get();
|
|
8160
|
+
}
|
|
8161
|
+
set ws(ws) {
|
|
8162
|
+
this.wsObservable.next(ws);
|
|
8163
|
+
}
|
|
8164
|
+
isOpen() {
|
|
8165
|
+
return !!this.ws && this.ws.readyState === this.WebSocketPonyfill.OPEN && !this.openPromise;
|
|
8166
|
+
}
|
|
8167
|
+
isClosed() {
|
|
8168
|
+
return !!this.ws && (this.ws.readyState === this.WebSocketPonyfill.CLOSING || this.ws.readyState === this.WebSocketPonyfill.CLOSED);
|
|
8169
|
+
}
|
|
8170
|
+
async open() {
|
|
8171
|
+
if (this.openPromise)
|
|
8172
|
+
return this.openPromise;
|
|
8173
|
+
this.id = ++WsConnection.connectCount;
|
|
8174
|
+
const wsPromise = prepareUrl(this.urlOptions).then((url) => new this.WebSocketPonyfill(url));
|
|
8175
|
+
this.openPromise = wsPromise.then(async (ws) => {
|
|
8176
|
+
this.ws = ws;
|
|
8177
|
+
ws.binaryType = "arraybuffer";
|
|
8178
|
+
ws.addEventListener("message", function({ data }) {
|
|
8179
|
+
if (data === "PING")
|
|
8180
|
+
this.send("PONG");
|
|
8181
|
+
});
|
|
8182
|
+
if (this.keepAliveOpts.enabled)
|
|
8183
|
+
setupPingInterval(ws, this.keepAliveOpts);
|
|
8184
|
+
ws.addEventListener("close", () => {
|
|
8185
|
+
if (this.ws === ws)
|
|
8186
|
+
this.ws = null;
|
|
8187
|
+
});
|
|
8188
|
+
await asyncWsOpen(ws);
|
|
8189
|
+
if (this.urlOptions.connectionParams)
|
|
8190
|
+
ws.send(await buildConnectionMessage(this.urlOptions.connectionParams, this.encoder));
|
|
8191
|
+
});
|
|
8192
|
+
try {
|
|
8193
|
+
await this.openPromise;
|
|
8194
|
+
} finally {
|
|
8195
|
+
this.openPromise = null;
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
async close() {
|
|
8199
|
+
try {
|
|
8200
|
+
await this.openPromise;
|
|
8201
|
+
} finally {
|
|
8202
|
+
var _this$ws;
|
|
8203
|
+
(_this$ws = this.ws) === null || _this$ws === undefined || _this$ws.close();
|
|
8204
|
+
}
|
|
8205
|
+
}
|
|
8206
|
+
};
|
|
8207
|
+
_defineProperty(WsConnection, "connectCount", 0);
|
|
8208
|
+
|
|
8209
|
+
// ../../../node_modules/.bun/@trpc+client@11.24.0+1bcc723bc4c4f345/node_modules/@trpc/client/dist/index.mjs
|
|
8210
|
+
var TRPCUntypedClient = class {
|
|
8211
|
+
constructor(opts) {
|
|
8212
|
+
_defineProperty(this, "links", undefined);
|
|
8213
|
+
_defineProperty(this, "runtime", undefined);
|
|
8214
|
+
_defineProperty(this, "requestId", undefined);
|
|
8215
|
+
this.requestId = 0;
|
|
8216
|
+
this.runtime = {};
|
|
8217
|
+
this.links = opts.links.map((link) => link(this.runtime));
|
|
8218
|
+
}
|
|
8219
|
+
$request(opts) {
|
|
8220
|
+
var _opts$context;
|
|
8221
|
+
return createChain({
|
|
8222
|
+
links: this.links,
|
|
8223
|
+
op: _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
8224
|
+
context: (_opts$context = opts.context) !== null && _opts$context !== undefined ? _opts$context : {},
|
|
8225
|
+
id: ++this.requestId
|
|
8226
|
+
})
|
|
8227
|
+
}).pipe(share());
|
|
8228
|
+
}
|
|
8229
|
+
async requestAsPromise(opts) {
|
|
8230
|
+
try {
|
|
8231
|
+
const req$ = this.$request(opts);
|
|
8232
|
+
return (await observableToPromise(req$)).result.data;
|
|
8233
|
+
} catch (err) {
|
|
8234
|
+
throw TRPCClientError.from(err);
|
|
8235
|
+
}
|
|
8236
|
+
}
|
|
8237
|
+
query(path, input, opts) {
|
|
8238
|
+
return this.requestAsPromise({
|
|
8239
|
+
type: "query",
|
|
8240
|
+
path,
|
|
8241
|
+
input,
|
|
8242
|
+
context: opts === null || opts === undefined ? undefined : opts.context,
|
|
8243
|
+
signal: opts === null || opts === undefined ? undefined : opts.signal
|
|
8244
|
+
});
|
|
8245
|
+
}
|
|
8246
|
+
mutation(path, input, opts) {
|
|
8247
|
+
return this.requestAsPromise({
|
|
8248
|
+
type: "mutation",
|
|
8249
|
+
path,
|
|
8250
|
+
input,
|
|
8251
|
+
context: opts === null || opts === undefined ? undefined : opts.context,
|
|
8252
|
+
signal: opts === null || opts === undefined ? undefined : opts.signal
|
|
8253
|
+
});
|
|
8254
|
+
}
|
|
8255
|
+
subscription(path, input, opts) {
|
|
8256
|
+
return this.$request({
|
|
8257
|
+
type: "subscription",
|
|
8258
|
+
path,
|
|
8259
|
+
input,
|
|
8260
|
+
context: opts.context,
|
|
8261
|
+
signal: opts.signal
|
|
8262
|
+
}).subscribe({
|
|
8263
|
+
next(envelope) {
|
|
8264
|
+
switch (envelope.result.type) {
|
|
8265
|
+
case "state":
|
|
8266
|
+
var _opts$onConnectionSta;
|
|
8267
|
+
(_opts$onConnectionSta = opts.onConnectionStateChange) === null || _opts$onConnectionSta === undefined || _opts$onConnectionSta.call(opts, envelope.result);
|
|
8268
|
+
break;
|
|
8269
|
+
case "started":
|
|
8270
|
+
var _opts$onStarted;
|
|
8271
|
+
(_opts$onStarted = opts.onStarted) === null || _opts$onStarted === undefined || _opts$onStarted.call(opts, { context: envelope.context });
|
|
8272
|
+
break;
|
|
8273
|
+
case "stopped":
|
|
8274
|
+
var _opts$onStopped;
|
|
8275
|
+
(_opts$onStopped = opts.onStopped) === null || _opts$onStopped === undefined || _opts$onStopped.call(opts);
|
|
8276
|
+
break;
|
|
8277
|
+
case "data":
|
|
8278
|
+
case undefined:
|
|
8279
|
+
var _opts$onData;
|
|
8280
|
+
(_opts$onData = opts.onData) === null || _opts$onData === undefined || _opts$onData.call(opts, envelope.result.data);
|
|
8281
|
+
}
|
|
8282
|
+
},
|
|
8283
|
+
error(err) {
|
|
8284
|
+
var _opts$onError;
|
|
8285
|
+
(_opts$onError = opts.onError) === null || _opts$onError === undefined || _opts$onError.call(opts, err);
|
|
8286
|
+
},
|
|
8287
|
+
complete() {
|
|
8288
|
+
var _opts$onComplete;
|
|
8289
|
+
(_opts$onComplete = opts.onComplete) === null || _opts$onComplete === undefined || _opts$onComplete.call(opts);
|
|
8290
|
+
}
|
|
8291
|
+
});
|
|
8292
|
+
}
|
|
8293
|
+
};
|
|
8294
|
+
var untypedClientSymbol = Symbol.for("trpc_untypedClient");
|
|
8295
|
+
var clientCallTypeMap = {
|
|
8296
|
+
query: "query",
|
|
8297
|
+
mutate: "mutation",
|
|
8298
|
+
subscribe: "subscription"
|
|
8299
|
+
};
|
|
8300
|
+
var clientCallTypeToProcedureType = (clientCallType) => {
|
|
8301
|
+
return clientCallTypeMap[clientCallType];
|
|
8302
|
+
};
|
|
8303
|
+
function createTRPCClientProxy(client) {
|
|
8304
|
+
const proxy = createRecursiveProxy(({ path, args }) => {
|
|
8305
|
+
const pathCopy = [...path];
|
|
8306
|
+
const procedureType = clientCallTypeToProcedureType(pathCopy.pop());
|
|
8307
|
+
const fullPath = pathCopy.join(".");
|
|
8308
|
+
return client[procedureType](fullPath, ...args);
|
|
8309
|
+
});
|
|
8310
|
+
return createFlatProxy((key) => {
|
|
8311
|
+
if (key === untypedClientSymbol)
|
|
8312
|
+
return client;
|
|
8313
|
+
return proxy[key];
|
|
8314
|
+
});
|
|
8315
|
+
}
|
|
8316
|
+
function createTRPCClient(opts) {
|
|
8317
|
+
return createTRPCClientProxy(new TRPCUntypedClient(opts));
|
|
8318
|
+
}
|
|
8319
|
+
function _OverloadYield2(e, d) {
|
|
8320
|
+
this.v = e, this.k = d;
|
|
8321
|
+
}
|
|
8322
|
+
function AsyncGenerator2(e) {
|
|
8323
|
+
var r, t;
|
|
8324
|
+
function resume(r, t) {
|
|
8325
|
+
try {
|
|
8326
|
+
var n = e[r](t), o = n.value, u = o instanceof _OverloadYield2;
|
|
8327
|
+
Promise.resolve(u ? o.v : o).then(function(t) {
|
|
8328
|
+
if (u) {
|
|
8329
|
+
var i = r === "return" ? "return" : "next";
|
|
8330
|
+
if (!o.k || t.done)
|
|
8331
|
+
return resume(i, t);
|
|
8332
|
+
t = e[i](t).value;
|
|
8333
|
+
}
|
|
8334
|
+
settle(n.done ? "return" : "normal", t);
|
|
8335
|
+
}, function(e) {
|
|
8336
|
+
resume("throw", e);
|
|
8337
|
+
});
|
|
8338
|
+
} catch (e) {
|
|
8339
|
+
settle("throw", e);
|
|
8340
|
+
}
|
|
8341
|
+
}
|
|
8342
|
+
function settle(e, n) {
|
|
8343
|
+
switch (e) {
|
|
8344
|
+
case "return":
|
|
8345
|
+
r.resolve({
|
|
8346
|
+
value: n,
|
|
8347
|
+
done: true
|
|
8348
|
+
});
|
|
8349
|
+
break;
|
|
8350
|
+
case "throw":
|
|
8351
|
+
r.reject(n);
|
|
8352
|
+
break;
|
|
8353
|
+
default:
|
|
8354
|
+
r.resolve({
|
|
8355
|
+
value: n,
|
|
8356
|
+
done: false
|
|
8357
|
+
});
|
|
8358
|
+
}
|
|
8359
|
+
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
8360
|
+
}
|
|
8361
|
+
this._invoke = function(e, n) {
|
|
8362
|
+
return new Promise(function(o, u) {
|
|
8363
|
+
var i = {
|
|
8364
|
+
key: e,
|
|
8365
|
+
arg: n,
|
|
8366
|
+
resolve: o,
|
|
8367
|
+
reject: u,
|
|
8368
|
+
next: null
|
|
8369
|
+
};
|
|
8370
|
+
t ? t = t.next = i : (r = t = i, resume(e, n));
|
|
8371
|
+
});
|
|
8372
|
+
}, typeof e["return"] != "function" && (this["return"] = undefined);
|
|
8373
|
+
}
|
|
8374
|
+
AsyncGenerator2.prototype[typeof Symbol == "function" && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
8375
|
+
return this;
|
|
8376
|
+
}, AsyncGenerator2.prototype.next = function(e) {
|
|
8377
|
+
return this._invoke("next", e);
|
|
8378
|
+
}, AsyncGenerator2.prototype["throw"] = function(e) {
|
|
8379
|
+
return this._invoke("throw", e);
|
|
8380
|
+
}, AsyncGenerator2.prototype["return"] = function(e) {
|
|
8381
|
+
return this._invoke("return", e);
|
|
8382
|
+
};
|
|
8383
|
+
|
|
6998
8384
|
// src/api-client.ts
|
|
6999
|
-
import {
|
|
7000
|
-
createTRPCProxyClient,
|
|
7001
|
-
httpBatchLink,
|
|
7002
|
-
loggerLink
|
|
7003
|
-
} from "@trpc/client";
|
|
7004
8385
|
import SuperJSON from "superjson";
|
|
7005
8386
|
var BUDGET_BUILDER_API_BASE_URL = DEFAULT_BUDGET_BUILDER_API_BASE_URL;
|
|
7006
8387
|
var interactiveAccessToken;
|
|
@@ -7018,7 +8399,7 @@ var containsRawApiKey = (value, seen = new WeakSet) => {
|
|
|
7018
8399
|
seen.add(value);
|
|
7019
8400
|
return Object.entries(value).some(([key, nestedValue]) => key.toLowerCase() === "apikey" && typeof nestedValue === "string" || containsRawApiKey(nestedValue, seen));
|
|
7020
8401
|
};
|
|
7021
|
-
var createBudgetBuilderClient = (apiBaseUrl = BUDGET_BUILDER_API_BASE_URL) =>
|
|
8402
|
+
var createBudgetBuilderClient = (apiBaseUrl = BUDGET_BUILDER_API_BASE_URL) => createTRPCClient({
|
|
7022
8403
|
links: [
|
|
7023
8404
|
loggerLink({
|
|
7024
8405
|
enabled: (opts) => shouldLogCliActions() && !(opts.direction === "down" && containsRawApiKey(opts.result)),
|
|
@@ -9326,6 +10707,15 @@ async function updateBillStatus(opts) {
|
|
|
9326
10707
|
var listExternalBillPaymentAccounts = async () => {
|
|
9327
10708
|
out(await api2.bill.getExternalPaymentAccounts.query());
|
|
9328
10709
|
};
|
|
10710
|
+
var refreshExternalBillPaymentAccounts = async () => {
|
|
10711
|
+
await confirmCurrentCommand({
|
|
10712
|
+
action: "refresh QuickBooks payment accounts",
|
|
10713
|
+
target: "the cached external payment-account list",
|
|
10714
|
+
effects: ["state-change"],
|
|
10715
|
+
details: "Queue a read of QuickBooks bank and credit-card accounts; nothing is written to QuickBooks."
|
|
10716
|
+
});
|
|
10717
|
+
out(await api2.bill.refreshExternalPaymentAccounts.mutate());
|
|
10718
|
+
};
|
|
9329
10719
|
var recordExternalBillPayment = async (opts) => {
|
|
9330
10720
|
if (!opts.paymentReference.trim() || !opts.paymentAccount.trim() || !/^\d{4}-\d{2}-\d{2}$/.test(opts.paymentDate) || new Date(`${opts.paymentDate}T00:00:00Z`).toISOString().slice(0, 10) !== opts.paymentDate)
|
|
9331
10721
|
throw new Error("Supply --paymentReference, --paymentDate YYYY-MM-DD, and --paymentAccount <QBO account ID>.");
|
|
@@ -9840,7 +11230,7 @@ var setBudgetItemsNotUtilized = async (budgetItemIds, notUtilized) => {
|
|
|
9840
11230
|
await assertSensitiveWorkflowConfirmed({
|
|
9841
11231
|
action: notUtilized ? "Mark budget lines Not Utilized" : "Restore budget line",
|
|
9842
11232
|
entity: `budget item${budgetItemIds.length === 1 ? "" : "s"} ${budgetItemIds.join(", ")}`,
|
|
9843
|
-
details: notUtilized ? "and
|
|
11233
|
+
details: notUtilized ? "and queue removal of linked QuickBooks placeholder expenses" : "and queue restoring its QuickBooks placeholder expense when required"
|
|
9844
11234
|
});
|
|
9845
11235
|
const result = await api2.budget.setBudgetItemsNotUtilized.mutate({
|
|
9846
11236
|
budgetItemIds,
|
|
@@ -9850,7 +11240,7 @@ var setBudgetItemsNotUtilized = async (budgetItemIds, notUtilized) => {
|
|
|
9850
11240
|
};
|
|
9851
11241
|
var createPlaceholderBillForBudgetItem = async (budgetItemId) => {
|
|
9852
11242
|
await assertSensitiveWorkflowConfirmed({
|
|
9853
|
-
action: "
|
|
11243
|
+
action: "Queue QuickBooks placeholder bill",
|
|
9854
11244
|
entity: `budget item ${budgetItemId}`
|
|
9855
11245
|
});
|
|
9856
11246
|
const result = await api2.budget.createPlaceholderBillForBudgetItem.mutate({
|
|
@@ -9936,7 +11326,7 @@ async function createBillFromPayload(raw, draftOnlyFlag, quotationExempt = false
|
|
|
9936
11326
|
...input.draftOnly ? [] : ["external-write"],
|
|
9937
11327
|
...input.alreadyPaid ? ["email"] : []
|
|
9938
11328
|
],
|
|
9939
|
-
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."
|
|
11329
|
+
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."
|
|
9940
11330
|
});
|
|
9941
11331
|
const result = input.draftOnly ? await api2.bill.createDraft.mutate({
|
|
9942
11332
|
...input,
|
|
@@ -10264,7 +11654,7 @@ async function createSupplierFromPayload(raw) {
|
|
|
10264
11654
|
throw new CliRuntimeError(normalized.code, `Supplier creation outcome is uncertain for ${JSON.stringify(input.name)}. Run list-suppliers and inspect matching supplier details before retrying; names may not be unique, so do not retry create-supplier until you can verify that no supplier was created. Original error: ${normalized.message}`);
|
|
10265
11655
|
}
|
|
10266
11656
|
const supplier = created.result;
|
|
10267
|
-
if (supplier.status !== ApprovalStatus2.PENDING_APPROVAL) {
|
|
11657
|
+
if (supplier.status !== ApprovalStatus2.PENDING_APPROVAL || "quickBooksSyncQueued" in created && created.quickBooksSyncQueued) {
|
|
10268
11658
|
out(created);
|
|
10269
11659
|
return;
|
|
10270
11660
|
}
|
|
@@ -10468,7 +11858,7 @@ async function approveSupplier(supplierId) {
|
|
|
10468
11858
|
action: "Re-approve supplier",
|
|
10469
11859
|
entity: `supplier ${supplierId}`,
|
|
10470
11860
|
effects: ["state-change", "external-write"],
|
|
10471
|
-
details: supplier.active ? "and
|
|
11861
|
+
details: supplier.active ? "and queue its QuickBooks vendor sync (it is usable once QuickBooks confirms); append a new approval and retain earlier history; no requester reply email is sent" : "and queue its QuickBooks vendor sync; append a new approval and retain earlier history; it remains archived and no requester reply email is sent"
|
|
10472
11862
|
});
|
|
10473
11863
|
out(await api2.supplier.reapproveSupplier.mutate({ supplierId }));
|
|
10474
11864
|
return;
|
|
@@ -11271,7 +12661,7 @@ var payloadHelp = {
|
|
|
11271
12661
|
},
|
|
11272
12662
|
"save-inbound-automation-config": {
|
|
11273
12663
|
required: "positional <sourceId>; asanaCustomFields: object; asanaDefaultAssigneeId: string|null; asanaDefaultAssigneeName: string|null; asanaFollowerIds: string[]; asanaProjectId: string; asanaSectionId: string; asanaWonSectionId: string; asanaLostSectionId: string; googleCalendarId: string; googleCalendarTimeZone: string; goshBriefBaseUrl: URL; slackDefaultAssigneeId: string|null; slackInboundChannelId: string; slackInviteUserIds: string[]; slackPitchChannelPrefix: string",
|
|
11274
|
-
optional: "asanaDiscussionSectionId, asanaFirstContactSectionId, asanaFirstProposalSentSectionId, asanaProposalWipSectionId: string|null; asanaCustomFields.*: mapped IDs",
|
|
12664
|
+
optional: "asanaDiscussionSectionId, asanaFirstContactSectionId, asanaFirstProposalSentSectionId, asanaProposalWipSectionId: string|null; googlePitchCalendarId: string|null (PITCH project events; must differ from googleCalendarId; null keeps them in googleCalendarId); asanaCustomFields.*: mapped IDs",
|
|
11275
12665
|
example: '{"asanaCustomFields":{},"asanaDefaultAssigneeId":null,"asanaDefaultAssigneeName":null,"asanaFollowerIds":[],"asanaProjectId":"<asana-project-id>","asanaSectionId":"<asana-section-id>","asanaWonSectionId":"<asana-won-id>","asanaLostSectionId":"<asana-lost-id>","googleCalendarId":"team@example.com","googleCalendarTimeZone":"Asia/Singapore","goshBriefBaseUrl":"https://example.com/brief","slackDefaultAssigneeId":null,"slackInboundChannelId":"<slack-channel-id>","slackInviteUserIds":[],"slackPitchChannelPrefix":"pitch"}'
|
|
11276
12666
|
}
|
|
11277
12667
|
};
|
|
@@ -11339,6 +12729,7 @@ var mutationPrefixes = [
|
|
|
11339
12729
|
"reactivate-",
|
|
11340
12730
|
"reconcile-",
|
|
11341
12731
|
"record-",
|
|
12732
|
+
"refresh-",
|
|
11342
12733
|
"reject-",
|
|
11343
12734
|
"remove-",
|
|
11344
12735
|
"replace-",
|
|
@@ -11512,11 +12903,11 @@ var summaryFor = (legacyTarget) => {
|
|
|
11512
12903
|
if (legacyTarget === "update-budget-item-supplier")
|
|
11513
12904
|
return "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.";
|
|
11514
12905
|
if (legacyTarget === "submit-quotation")
|
|
11515
|
-
return "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.";
|
|
12906
|
+
return "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.";
|
|
11516
12907
|
if (legacyTarget === "approve-quotation")
|
|
11517
|
-
return "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
|
|
12908
|
+
return "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.";
|
|
11518
12909
|
if (legacyTarget === "approve-supplier")
|
|
11519
|
-
return "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. QuickBooks is
|
|
12910
|
+
return "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>.";
|
|
11520
12911
|
if (legacyTarget === "get-bill-details")
|
|
11521
12912
|
return "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>.";
|
|
11522
12913
|
if (legacyTarget === "get-bill-line-items")
|
|
@@ -11526,7 +12917,7 @@ var summaryFor = (legacyTarget) => {
|
|
|
11526
12917
|
if (legacyTarget === "get-bill-payment")
|
|
11527
12918
|
return "Get a bill's payment status, reference, date, tracking URL, QuickBooks link and external payment. Argument: <billId>.";
|
|
11528
12919
|
if (legacyTarget === "get-quotation")
|
|
11529
|
-
return "Get a quotation as shown in the web app: status, amounts, people, line totals, files and approvals. Use get-quotation-line-items for budget-item detail. Argument: <quotationId>.";
|
|
12920
|
+
return "Get a quotation as shown in the web app: status, 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. Use get-quotation-line-items for budget-item detail. Argument: <quotationId>.";
|
|
11530
12921
|
if (legacyTarget === "get-customer-invoice")
|
|
11531
12922
|
return "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>.";
|
|
11532
12923
|
if (legacyTarget === "get-customer-invoice-invoices")
|
|
@@ -11576,13 +12967,13 @@ var summaryFor = (legacyTarget) => {
|
|
|
11576
12967
|
if (legacyTarget === "search-existing-companies")
|
|
11577
12968
|
return "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.";
|
|
11578
12969
|
if (legacyTarget === "use-existing-company")
|
|
11579
|
-
return "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. --website <url> fills a missing QBO import website only. --confirmDistinct true confirms no similar record represents this entity.";
|
|
12970
|
+
return "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.";
|
|
11580
12971
|
if (legacyTarget === "create-company")
|
|
11581
|
-
return "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.";
|
|
12972
|
+
return "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.";
|
|
11582
12973
|
if (legacyTarget === "create-project")
|
|
11583
12974
|
return "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). The Slack channel is resolved from the selected Asana task unless all three Slack channel flags are supplied. For a new direct client, create the lead task using the website form first.";
|
|
11584
12975
|
if (legacyTarget === "create-supplier")
|
|
11585
|
-
return "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.";
|
|
12976
|
+
return "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.";
|
|
11586
12977
|
if (legacyTarget === "preview-qbo-customer-invoice") {
|
|
11587
12978
|
return "Preview an available QuickBooks invoice selected for a BB budget using read-only QBO access. Arguments: <budgetId> <qboInvoiceId>.";
|
|
11588
12979
|
}
|
|
@@ -11606,6 +12997,10 @@ var summaryFor = (legacyTarget) => {
|
|
|
11606
12997
|
return "List one cursor page of catalogue items ({ items, pageInfo }; --limit/--cursor/--direction, optional --sortBy/--sortDir). --page/--perPage are rejected.";
|
|
11607
12998
|
if (legacyTarget === "list-item-categories")
|
|
11608
12999
|
return "List one cursor page of active item categories ({ items, pageInfo }; --limit/--cursor/--direction, optional --name/--sortBy/--sortDir). --page/--perPage are rejected.";
|
|
13000
|
+
if (legacyTarget === "create-item-category")
|
|
13001
|
+
return "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.";
|
|
13002
|
+
if (legacyTarget === "update-item-category")
|
|
13003
|
+
return "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.";
|
|
11609
13004
|
if (legacyTarget === "count-item-categories")
|
|
11610
13005
|
return "Count active item categories matching --name: { totalCount }.";
|
|
11611
13006
|
if (legacyTarget === "list-webhook-deliveries")
|
|
@@ -11628,14 +13023,16 @@ var summaryFor = (legacyTarget) => {
|
|
|
11628
13023
|
return "Get budget details. Omit --includeInactive for active budgets only; --includeInactive is an Admin-only historical read.";
|
|
11629
13024
|
}
|
|
11630
13025
|
if (legacyTarget === "create-bill") {
|
|
11631
|
-
return "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.";
|
|
13026
|
+
return "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 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.";
|
|
11632
13027
|
}
|
|
11633
13028
|
if (legacyTarget === "record-external-bill-payment")
|
|
11634
|
-
return "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]. Reuses settled QBO payment links or queues one dated payment from the selected account. Exact retries are safe; do not pay again while reconciliation is pending.";
|
|
13029
|
+
return "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.";
|
|
11635
13030
|
if (legacyTarget === "mark-customer-invoice-sent-externally")
|
|
11636
13031
|
return "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>].";
|
|
11637
13032
|
if (legacyTarget === "list-external-payment-accounts")
|
|
11638
|
-
return "List active QuickBooks bank and credit-card account IDs for recording external payments (admin only).";
|
|
13033
|
+
return "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.";
|
|
13034
|
+
if (legacyTarget === "refresh-external-payment-accounts")
|
|
13035
|
+
return "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.";
|
|
11639
13036
|
if (legacyTarget === "update-bill") {
|
|
11640
13037
|
return "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. It is a warning only and the write still succeeds.";
|
|
11641
13038
|
}
|
|
@@ -11643,7 +13040,7 @@ var summaryFor = (legacyTarget) => {
|
|
|
11643
13040
|
return "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.";
|
|
11644
13041
|
}
|
|
11645
13042
|
if (legacyTarget === "create-quotation") {
|
|
11646
|
-
return '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.';
|
|
13043
|
+
return '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).';
|
|
11647
13044
|
}
|
|
11648
13045
|
if (legacyTarget === "cleanup-staged-quotation-attachments")
|
|
11649
13046
|
return "Queue independent cleanup operations for unattached staged quotation uploads; returns operation IDs and queued/skipped counts, not deletion confirmation. Arguments: <projectId> --keys <csv>.";
|
|
@@ -11927,6 +13324,11 @@ var registry2 = [
|
|
|
11927
13324
|
"payment",
|
|
11928
13325
|
"accounts"
|
|
11929
13326
|
]),
|
|
13327
|
+
legacyCommand("refresh-external-payment-accounts", [
|
|
13328
|
+
"bill",
|
|
13329
|
+
"payment",
|
|
13330
|
+
"accounts-refresh"
|
|
13331
|
+
]),
|
|
11930
13332
|
legacyCommand("patch-bill-payment", ["bill", "payment", "patch"]),
|
|
11931
13333
|
legacyCommand("patch-bill-invoice-number", [
|
|
11932
13334
|
"bill",
|
|
@@ -12246,6 +13648,10 @@ var registry2 = [
|
|
|
12246
13648
|
name: "--quickbooksId",
|
|
12247
13649
|
description: "Existing QBO customer ID; alone imports or reuses its BB company."
|
|
12248
13650
|
},
|
|
13651
|
+
{
|
|
13652
|
+
name: "--name",
|
|
13653
|
+
description: "QuickBooks company name (from search-existing-companies); required for a QBO-only import."
|
|
13654
|
+
},
|
|
12249
13655
|
{
|
|
12250
13656
|
name: "--website",
|
|
12251
13657
|
description: "Website only when missing from a QBO-only import."
|
|
@@ -13531,9 +14937,9 @@ Budgets
|
|
|
13531
14937
|
update-budget-discount --payload '<json>' (budget.updateBudgetDiscount; type percentage|amount)
|
|
13532
14938
|
delete-budget-commission <budgetId> Remove commission and return the budget to DRAFT.
|
|
13533
14939
|
delete-budget-discount <budgetId> Remove discount and return the budget to DRAFT.
|
|
13534
|
-
mark-budget-items-not-utilized --ids <csv> Remove unused lines from reconciliation and
|
|
13535
|
-
restore-budget-item <budgetItemId> Restore one Not Utilized line and its QBO placeholder when required.
|
|
13536
|
-
create-placeholder-bill <budgetItemId> Admin-only placeholder recovery.
|
|
14940
|
+
mark-budget-items-not-utilized --ids <csv> Remove unused lines from reconciliation and queue clearing their QBO placeholders.
|
|
14941
|
+
restore-budget-item <budgetItemId> Restore one Not Utilized line and queue its QBO placeholder when required.
|
|
14942
|
+
create-placeholder-bill <budgetItemId> Admin-only placeholder recovery; queues the QBO placeholder (operationId, status QUEUED).
|
|
13537
14943
|
upload-budget-attachment <budgetId> <filePath> Presigned S3 upload + confirm
|
|
13538
14944
|
|
|
13539
14945
|
Bills
|
|
@@ -13548,7 +14954,7 @@ Bills
|
|
|
13548
14954
|
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.
|
|
13549
14955
|
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.
|
|
13550
14956
|
create-bill-approval <billId> (also queues approval request emails)
|
|
13551
|
-
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 lineAmounts; claims reject quotation sources)
|
|
14957
|
+
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 lineAmounts; claims reject quotation sources; an Admin's unpaid bill queues its QuickBooks bill: quickBooksSyncQueued, operationId)
|
|
13552
14958
|
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.
|
|
13553
14959
|
link-bill-quotations <billId> (--payload '<json>' | --quotationIds <csv>) Admin-only source-link repair; payload.quotationAllocations supports same-line splits.
|
|
13554
14960
|
stage-bill-attachment <projectId> <filePath...> [--file <path>] [--files <csv>] Upload files before create-bill; returns attachment JSON for attachments/paymentProofAttachments
|
|
@@ -13577,17 +14983,17 @@ Quotations
|
|
|
13577
14983
|
list-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
|
|
13578
14984
|
Newest first; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters. --page/--pageSize/--perPage are rejected; --requesterIds remains an alias for --createdBy.
|
|
13579
14985
|
count-quotations [--projectId] [--budgetId] [--supplierId] [--status CSV] [--createdBy CSV] [--search] [--includeMetrics true|false] totalCount, status facets (ignore --status) and optional amount metrics
|
|
13580
|
-
get-quotation <quotationId> Quotation as shown in the web app (status, amounts, people, line totals, files, approvals)
|
|
14986
|
+
get-quotation <quotationId> Quotation as shown in the web app (status, amounts, people, line totals, files, approvals; pdfProcessing is PROCESSING or FAILED until queued PDF conversion/signing links the PDF)
|
|
13581
14987
|
get-quotation-line-items <quotationId> [--limit 1-100] [--cursor <token>] Line items with budget-item detail; { items, pageInfo }
|
|
13582
14988
|
upload-quotation-attachment <projectId> <filePath> Upload one PDF, JPEG, or PNG up to 20MB; returns attachment JSON for a quotation payload.
|
|
13583
14989
|
cleanup-staged-quotation-attachments <projectId> --keys <csv> Queue cleanup of unattached quotation uploads; returns operation IDs.
|
|
13584
14990
|
create-quotation --payload '<json>' (quotation.createDraft; requires amountWithoutGst, gstAmount, and lineAmounts [{budgetItemId, amount}] for multiple budgetItemIds; amounts before GST must sum to amountWithoutGst)
|
|
13585
14991
|
update-quotation --payload '<json>' Update a DRAFT or REJECTED quotation; same allocation payload plus id; use lineAmounts [{budgetItemId, amount}] for every selected item.
|
|
13586
14992
|
delete-quotation <quotationId>
|
|
13587
|
-
submit-quotation <quotationId> [--overBudgetOverrideReason <text>]
|
|
13588
|
-
approve-quotation <quotationId> [--overBudgetOverrideReason <text>] (assigned pending request/current Admin; concurrent revision or allocation changes conflict)
|
|
14993
|
+
submit-quotation <quotationId> [--overBudgetOverrideReason <text>] (signed PDF is made by a queued job: pdfProcessing)
|
|
14994
|
+
approve-quotation <quotationId> [--overBudgetOverrideReason <text>] (assigned pending request/current Admin; concurrent revision or allocation changes conflict; final signed PDF is queued: pdfProcessing)
|
|
13589
14995
|
reject-quotation <quotationId> --reason <text>
|
|
13590
|
-
download-quotation-pdf <quotationId> [original|staff|final]
|
|
14996
|
+
download-quotation-pdf <quotationId> [original|staff|final] (refused with "still processing" until the queued PDF step links it)
|
|
13591
14997
|
|
|
13592
14998
|
Customer invoices
|
|
13593
14999
|
check-customer-invoice-readiness <budgetId> Readiness plus the full remaining-balance amount preview and live QuickBooks validation.
|
|
@@ -13629,7 +15035,7 @@ Approvals
|
|
|
13629
15035
|
reject-bill <billId> --reason <text> (also sends requester reply email)
|
|
13630
15036
|
approve-budget <budgetId> (also sends requester reply email)
|
|
13631
15037
|
reject-budget <budgetId> --reason <text> (also sends requester reply email)
|
|
13632
|
-
approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier)
|
|
15038
|
+
approve-supplier <supplierId> (approve a pending request, or Admin/Lead re-approve a rejected supplier; QuickBooks vendor sync is queued)
|
|
13633
15039
|
reject-supplier <supplierId> --reason <text> (also sends requester reply email)
|
|
13634
15040
|
|
|
13635
15041
|
Companies & projects
|
|
@@ -13639,10 +15045,11 @@ Companies & projects
|
|
|
13639
15045
|
Returns independent { totalCount, counts: { active: { true, false } } }; no pagination or sorting flags.
|
|
13640
15046
|
get-company <id>
|
|
13641
15047
|
search-existing-companies --query <name> [--limit 1-50] [--cursor <token>] (BB + QuickBooks, read-only; follow pageInfo.nextCursor)
|
|
13642
|
-
use-existing-company --companyId <bbId> and/or --quickbooksId <qboId> [--website <url>] [--confirmDistinct true]
|
|
15048
|
+
use-existing-company --companyId <bbId> and/or --quickbooksId <qboId> [--name <qboName>] [--website <url>] [--confirmDistinct true]
|
|
13643
15049
|
Supply both IDs to explicitly connect existing records with different names.
|
|
13644
|
-
Reuses both records, creating only the missing counterpart.
|
|
13645
|
-
|
|
15050
|
+
Reuses both records, creating only the missing counterpart. A QBO-only import needs --name (from search-existing-companies);
|
|
15051
|
+
website is needed only for a QBO import without one. The QuickBooks link is queued (quickBooksSyncQueued, operationId).
|
|
15052
|
+
create-company --name --website <url> [--confirmDistinct true] [--billingEmails '<json-array>'] (QuickBooks customer queued)
|
|
13646
15053
|
Exact existing companies are reused. Similar names require explicit separate-entity confirmation.
|
|
13647
15054
|
update-company --payload '<json>' (optional billingEmails: omit to preserve, [] to clear; returns queued QBO operation ID, not completion)
|
|
13648
15055
|
get-company-quickbooks-sync-status <companyId> (saved status only; no provider call or polling)
|
|
@@ -13680,15 +15087,15 @@ Suppliers & items
|
|
|
13680
15087
|
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]
|
|
13681
15088
|
count-suppliers [--name] [--createdBy <csv>] [--gstRegistered true|false] [--status CSV] [--supplierTags <csv>] [--active true|false] (independent totals/facets; no pagination/sort flags)
|
|
13682
15089
|
Defaults: --active true, --limit 10, --sortBy createdAt, --sortDir desc (same as the web list); pass --active false for archived suppliers.
|
|
13683
|
-
create-supplier --payload '<json>' (supplier.createSupplier; archived-name recreation is Admin-only; auto-requests approval + emails when status is PENDING_APPROVAL)
|
|
13684
|
-
update-supplier --payload '<json>' (authenticated; normal-user edits require server-enforced approval)
|
|
15090
|
+
create-supplier --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)
|
|
15091
|
+
update-supplier --payload '<json>' (authenticated; normal-user edits require server-enforced approval; Lead/Admin edits of a linked supplier queue the QuickBooks sync)
|
|
13685
15092
|
delete-suppliers --ids <csv> (supplier.deleteSuppliers; admin; archives/deactivates supplier items)
|
|
13686
|
-
reactivate-suppliers --ids <csv> (supplier.reactivateSuppliers; admin;
|
|
15093
|
+
reactivate-suppliers --ids <csv> (supplier.reactivateSuppliers; admin; queues QuickBooks vendor reactivation, then the suppliers and their items become active: queuedSuppliers, operations)
|
|
13687
15094
|
create-certification --name (supplier.createCertification)
|
|
13688
15095
|
create-payment-method --name (supplier.createPaymentMethod)
|
|
13689
15096
|
create-supplier-role --name (supplier.createSupplierRole)
|
|
13690
15097
|
create-supplier-tag --name (supplier.createSupplierTag)
|
|
13691
|
-
create-item --payload '<json>' (item.createItem)
|
|
15098
|
+
create-item --payload '<json>' (item.createItem; saves the item and queues its QuickBooks create: quickBooksSyncQueued, operationId)
|
|
13692
15099
|
update-item --payload '<json>' (item.updateItem; must include id)
|
|
13693
15100
|
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)
|
|
13694
15101
|
delete-item <id> (item.deleteItem; admin; archives in Budget Builder and makes the item inactive in QuickBooks; blocked while used by an open estimate)
|
|
@@ -13707,8 +15114,8 @@ Suppliers & items
|
|
|
13707
15114
|
list-item-categories [--name] [--sortBy createdAt|name|itemCount|createdBy] [--sortDir asc|desc] [--limit 1-100] [--cursor <token>] [--direction forward|backward]
|
|
13708
15115
|
Active categories only; returns { items, pageInfo }. Follow nextCursor/previousCursor with the same filters and sort. --page/--perPage are rejected.
|
|
13709
15116
|
count-item-categories [--name] totalCount of active categories
|
|
13710
|
-
create-item-category --name (admin)
|
|
13711
|
-
update-item-category --id --name (authenticated;
|
|
15117
|
+
create-item-category --name (admin; saves the category and queues its QuickBooks create: quickBooksSyncQueued, operationId)
|
|
15118
|
+
update-item-category --id --name (authenticated; renames in BB now and queues the QuickBooks rename: quickBooksSyncQueued, operationId)
|
|
13712
15119
|
delete-item-categories --ids <csv> (itemCategory.deleteItemCategories; admin; empty categories only)
|
|
13713
15120
|
|
|
13714
15121
|
Dashboard & users
|
|
@@ -14646,6 +16053,10 @@ Waiting for approval\u2026
|
|
|
14646
16053
|
await listExternalBillPaymentAccounts();
|
|
14647
16054
|
break;
|
|
14648
16055
|
}
|
|
16056
|
+
case "refresh-external-payment-accounts": {
|
|
16057
|
+
await refreshExternalBillPaymentAccounts();
|
|
16058
|
+
break;
|
|
16059
|
+
}
|
|
14649
16060
|
case "record-external-bill-payment": {
|
|
14650
16061
|
const id = positional[0];
|
|
14651
16062
|
const paymentReference = getFlag(flags, "paymentReference");
|
|
@@ -15393,6 +16804,7 @@ Waiting for approval\u2026
|
|
|
15393
16804
|
await reuseExistingCompany({
|
|
15394
16805
|
source: "qbo",
|
|
15395
16806
|
quickbooksId,
|
|
16807
|
+
name: getFlag(flags, "name"),
|
|
15396
16808
|
website: getFlag(flags, "website"),
|
|
15397
16809
|
confirmDistinct: parseOptionalBoolFlag(flags, "confirmDistinct")
|
|
15398
16810
|
});
|