@lazehq/cli 0.1.54 → 0.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/laze.mjs +1383 -663
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -96,9 +96,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
96
96
|
var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
|
|
97
97
|
if (debug) return debug;
|
|
98
98
|
}
|
|
99
|
-
var prebuild =
|
|
99
|
+
var prebuild = resolve21(dir);
|
|
100
100
|
if (prebuild) return prebuild;
|
|
101
|
-
var nearby =
|
|
101
|
+
var nearby = resolve21(path.dirname(process.execPath));
|
|
102
102
|
if (nearby) return nearby;
|
|
103
103
|
var target = [
|
|
104
104
|
"platform=" + platform,
|
|
@@ -114,7 +114,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
114
114
|
// eslint-disable-line
|
|
115
115
|
].filter(Boolean).join(" ");
|
|
116
116
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
117
|
-
function
|
|
117
|
+
function resolve21(dir2) {
|
|
118
118
|
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
119
119
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
120
120
|
if (!tuple2) return;
|
|
@@ -5823,7 +5823,7 @@ var require_diagnostics = __commonJS({
|
|
|
5823
5823
|
var undiciDebugLog = util.debuglog("undici");
|
|
5824
5824
|
var fetchDebuglog = util.debuglog("fetch");
|
|
5825
5825
|
var websocketDebuglog = util.debuglog("websocket");
|
|
5826
|
-
var
|
|
5826
|
+
var channels3 = {
|
|
5827
5827
|
// Client
|
|
5828
5828
|
beforeConnect: diagnosticsChannel.channel("undici:client:beforeConnect"),
|
|
5829
5829
|
connected: diagnosticsChannel.channel("undici:client:connected"),
|
|
@@ -5851,7 +5851,7 @@ var require_diagnostics = __commonJS({
|
|
|
5851
5851
|
if (isTrackingClientEvents) {
|
|
5852
5852
|
return;
|
|
5853
5853
|
}
|
|
5854
|
-
if (
|
|
5854
|
+
if (channels3.beforeConnect.hasSubscribers || channels3.connected.hasSubscribers || channels3.connectError.hasSubscribers || channels3.sendHeaders.hasSubscribers) {
|
|
5855
5855
|
isTrackingClientEvents = true;
|
|
5856
5856
|
return;
|
|
5857
5857
|
}
|
|
@@ -5918,7 +5918,7 @@ var require_diagnostics = __commonJS({
|
|
|
5918
5918
|
if (isTrackingRequestEvents) {
|
|
5919
5919
|
return;
|
|
5920
5920
|
}
|
|
5921
|
-
if (
|
|
5921
|
+
if (channels3.headers.hasSubscribers || channels3.trailers.hasSubscribers || channels3.error.hasSubscribers) {
|
|
5922
5922
|
isTrackingRequestEvents = true;
|
|
5923
5923
|
return;
|
|
5924
5924
|
}
|
|
@@ -5970,7 +5970,7 @@ var require_diagnostics = __commonJS({
|
|
|
5970
5970
|
if (isTrackingWebSocketEvents) {
|
|
5971
5971
|
return;
|
|
5972
5972
|
}
|
|
5973
|
-
if (
|
|
5973
|
+
if (channels3.open.hasSubscribers || channels3.close.hasSubscribers || channels3.socketError.hasSubscribers || channels3.ping.hasSubscribers || channels3.pong.hasSubscribers) {
|
|
5974
5974
|
isTrackingWebSocketEvents = true;
|
|
5975
5975
|
return;
|
|
5976
5976
|
}
|
|
@@ -6026,7 +6026,7 @@ var require_diagnostics = __commonJS({
|
|
|
6026
6026
|
trackWebSocketEvents(websocketDebuglog);
|
|
6027
6027
|
}
|
|
6028
6028
|
module.exports = {
|
|
6029
|
-
channels:
|
|
6029
|
+
channels: channels3
|
|
6030
6030
|
};
|
|
6031
6031
|
}
|
|
6032
6032
|
});
|
|
@@ -6057,7 +6057,7 @@ var require_request = __commonJS({
|
|
|
6057
6057
|
normalizedMethodRecords,
|
|
6058
6058
|
getProtocolFromUrlString
|
|
6059
6059
|
} = require_util();
|
|
6060
|
-
var { channels:
|
|
6060
|
+
var { channels: channels3 } = require_diagnostics();
|
|
6061
6061
|
var { headerNameLowerCasedRecord } = require_constants2();
|
|
6062
6062
|
var invalidPathRegex = /[^\u0021-\u00ff]/;
|
|
6063
6063
|
function isValidContentLengthHeaderValue(val) {
|
|
@@ -6248,13 +6248,13 @@ var require_request = __commonJS({
|
|
|
6248
6248
|
assertRequestHandler(handler, method, upgrade2);
|
|
6249
6249
|
this.servername = servername || getServerName(this.host) || null;
|
|
6250
6250
|
this[kHandler] = handler;
|
|
6251
|
-
if (
|
|
6252
|
-
|
|
6251
|
+
if (channels3.create.hasSubscribers) {
|
|
6252
|
+
channels3.create.publish({ request: this });
|
|
6253
6253
|
}
|
|
6254
6254
|
}
|
|
6255
6255
|
onBodySent(chunk) {
|
|
6256
|
-
if (
|
|
6257
|
-
|
|
6256
|
+
if (channels3.bodyChunkSent.hasSubscribers) {
|
|
6257
|
+
channels3.bodyChunkSent.publish({ request: this, chunk });
|
|
6258
6258
|
}
|
|
6259
6259
|
if (this[kHandler].onBodySent) {
|
|
6260
6260
|
try {
|
|
@@ -6265,8 +6265,8 @@ var require_request = __commonJS({
|
|
|
6265
6265
|
}
|
|
6266
6266
|
}
|
|
6267
6267
|
onRequestSent() {
|
|
6268
|
-
if (
|
|
6269
|
-
|
|
6268
|
+
if (channels3.bodySent.hasSubscribers) {
|
|
6269
|
+
channels3.bodySent.publish({ request: this });
|
|
6270
6270
|
}
|
|
6271
6271
|
if (this[kHandler].onRequestSent) {
|
|
6272
6272
|
try {
|
|
@@ -6293,8 +6293,8 @@ var require_request = __commonJS({
|
|
|
6293
6293
|
onResponseStart(statusCode, headers, resume, statusText) {
|
|
6294
6294
|
assert2(!this.aborted);
|
|
6295
6295
|
assert2(!this.completed);
|
|
6296
|
-
if (
|
|
6297
|
-
|
|
6296
|
+
if (channels3.headers.hasSubscribers) {
|
|
6297
|
+
channels3.headers.publish({ request: this, response: { statusCode, headers, statusText } });
|
|
6298
6298
|
}
|
|
6299
6299
|
const controller = this[kController];
|
|
6300
6300
|
if (controller) {
|
|
@@ -6313,8 +6313,8 @@ var require_request = __commonJS({
|
|
|
6313
6313
|
onResponseData(chunk) {
|
|
6314
6314
|
assert2(!this.aborted);
|
|
6315
6315
|
assert2(!this.completed);
|
|
6316
|
-
if (
|
|
6317
|
-
|
|
6316
|
+
if (channels3.bodyChunkReceived.hasSubscribers) {
|
|
6317
|
+
channels3.bodyChunkReceived.publish({ request: this, chunk });
|
|
6318
6318
|
}
|
|
6319
6319
|
const controller = this[kController];
|
|
6320
6320
|
try {
|
|
@@ -6340,8 +6340,8 @@ var require_request = __commonJS({
|
|
|
6340
6340
|
assert2(!this.aborted);
|
|
6341
6341
|
assert2(!this.completed);
|
|
6342
6342
|
this.completed = true;
|
|
6343
|
-
if (
|
|
6344
|
-
|
|
6343
|
+
if (channels3.trailers.hasSubscribers) {
|
|
6344
|
+
channels3.trailers.publish({ request: this, trailers });
|
|
6345
6345
|
}
|
|
6346
6346
|
const controller = this[kController];
|
|
6347
6347
|
if (controller) {
|
|
@@ -6356,8 +6356,8 @@ var require_request = __commonJS({
|
|
|
6356
6356
|
}
|
|
6357
6357
|
onResponseError(error62) {
|
|
6358
6358
|
this.onFinally();
|
|
6359
|
-
if (
|
|
6360
|
-
|
|
6359
|
+
if (channels3.error.hasSubscribers) {
|
|
6360
|
+
channels3.error.publish({ request: this, error: error62 });
|
|
6361
6361
|
}
|
|
6362
6362
|
if (this.aborted) {
|
|
6363
6363
|
return;
|
|
@@ -6561,9 +6561,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
6561
6561
|
}
|
|
6562
6562
|
close(callback) {
|
|
6563
6563
|
if (callback === void 0) {
|
|
6564
|
-
return new Promise((
|
|
6564
|
+
return new Promise((resolve21, reject) => {
|
|
6565
6565
|
this.close((err, data) => {
|
|
6566
|
-
return err ? reject(err) :
|
|
6566
|
+
return err ? reject(err) : resolve21(data);
|
|
6567
6567
|
});
|
|
6568
6568
|
});
|
|
6569
6569
|
}
|
|
@@ -6601,9 +6601,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
6601
6601
|
err = null;
|
|
6602
6602
|
}
|
|
6603
6603
|
if (callback === void 0) {
|
|
6604
|
-
return new Promise((
|
|
6604
|
+
return new Promise((resolve21, reject) => {
|
|
6605
6605
|
this.destroy(err, (err2, data) => {
|
|
6606
|
-
return err2 ? reject(err2) :
|
|
6606
|
+
return err2 ? reject(err2) : resolve21(data);
|
|
6607
6607
|
});
|
|
6608
6608
|
});
|
|
6609
6609
|
}
|
|
@@ -10417,7 +10417,7 @@ var require_client_h1 = __commonJS({
|
|
|
10417
10417
|
"use strict";
|
|
10418
10418
|
var assert2 = __require("node:assert");
|
|
10419
10419
|
var util = require_util();
|
|
10420
|
-
var { channels:
|
|
10420
|
+
var { channels: channels3 } = require_diagnostics();
|
|
10421
10421
|
var timers = require_timers();
|
|
10422
10422
|
var {
|
|
10423
10423
|
RequestContentLengthMismatchError,
|
|
@@ -11404,8 +11404,8 @@ upgrade: ${upgrade2}\r
|
|
|
11404
11404
|
}
|
|
11405
11405
|
}
|
|
11406
11406
|
}
|
|
11407
|
-
if (
|
|
11408
|
-
|
|
11407
|
+
if (channels3.sendHeaders.hasSubscribers) {
|
|
11408
|
+
channels3.sendHeaders.publish({ request: request2, headers: header, socket });
|
|
11409
11409
|
}
|
|
11410
11410
|
if (!body || bodyLength === 0) {
|
|
11411
11411
|
writeBuffer(abort, null, client, request2, socket, contentLength, header, expectsPayload);
|
|
@@ -11558,12 +11558,12 @@ upgrade: ${upgrade2}\r
|
|
|
11558
11558
|
cb();
|
|
11559
11559
|
}
|
|
11560
11560
|
}
|
|
11561
|
-
const waitForDrain = () => new Promise((
|
|
11561
|
+
const waitForDrain = () => new Promise((resolve21, reject) => {
|
|
11562
11562
|
assert2(callback === null);
|
|
11563
11563
|
if (socket[kError]) {
|
|
11564
11564
|
reject(socket[kError]);
|
|
11565
11565
|
} else {
|
|
11566
|
-
callback =
|
|
11566
|
+
callback = resolve21;
|
|
11567
11567
|
}
|
|
11568
11568
|
});
|
|
11569
11569
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -11762,7 +11762,7 @@ var require_client_h2 = __commonJS({
|
|
|
11762
11762
|
kHTTP2SessionState,
|
|
11763
11763
|
kHTTP2Options
|
|
11764
11764
|
} = require_symbols();
|
|
11765
|
-
var { channels:
|
|
11765
|
+
var { channels: channels3 } = require_diagnostics();
|
|
11766
11766
|
var kOpenStreams = /* @__PURE__ */ Symbol("open streams");
|
|
11767
11767
|
var kRequestStreamId = /* @__PURE__ */ Symbol("request stream id");
|
|
11768
11768
|
var kRequestStream = /* @__PURE__ */ Symbol("request stream");
|
|
@@ -12571,13 +12571,13 @@ var require_client_h2 = __commonJS({
|
|
|
12571
12571
|
headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`;
|
|
12572
12572
|
}
|
|
12573
12573
|
refH2Session(session);
|
|
12574
|
-
if (
|
|
12574
|
+
if (channels3.sendHeaders.hasSubscribers) {
|
|
12575
12575
|
let header = "";
|
|
12576
12576
|
for (const key in headers) {
|
|
12577
12577
|
header += `${key}: ${headers[key]}\r
|
|
12578
12578
|
`;
|
|
12579
12579
|
}
|
|
12580
|
-
|
|
12580
|
+
channels3.sendHeaders.publish({ request: request2, headers: header, socket: session[kSocket] });
|
|
12581
12581
|
}
|
|
12582
12582
|
const shouldEndStream = body === null || contentLength === 0;
|
|
12583
12583
|
state.body = body;
|
|
@@ -12921,12 +12921,12 @@ var require_client_h2 = __commonJS({
|
|
|
12921
12921
|
cb();
|
|
12922
12922
|
}
|
|
12923
12923
|
}
|
|
12924
|
-
const waitForDrain = () => new Promise((
|
|
12924
|
+
const waitForDrain = () => new Promise((resolve21, reject) => {
|
|
12925
12925
|
assert2(callback === null);
|
|
12926
12926
|
if (socket[kError]) {
|
|
12927
12927
|
reject(socket[kError]);
|
|
12928
12928
|
} else {
|
|
12929
|
-
callback =
|
|
12929
|
+
callback = resolve21;
|
|
12930
12930
|
}
|
|
12931
12931
|
});
|
|
12932
12932
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -12966,7 +12966,7 @@ var require_client = __commonJS({
|
|
|
12966
12966
|
var http = __require("node:http");
|
|
12967
12967
|
var util = require_util();
|
|
12968
12968
|
var { ClientStats } = require_stats();
|
|
12969
|
-
var { channels:
|
|
12969
|
+
var { channels: channels3 } = require_diagnostics();
|
|
12970
12970
|
var Request = require_request();
|
|
12971
12971
|
var DispatcherBase = require_dispatcher_base();
|
|
12972
12972
|
var {
|
|
@@ -13294,16 +13294,16 @@ var require_client = __commonJS({
|
|
|
13294
13294
|
return this[kNeedDrain] < 2;
|
|
13295
13295
|
}
|
|
13296
13296
|
[kClose]() {
|
|
13297
|
-
return new Promise((
|
|
13297
|
+
return new Promise((resolve21) => {
|
|
13298
13298
|
if (this[kSize]) {
|
|
13299
|
-
this[kClosedResolve] =
|
|
13299
|
+
this[kClosedResolve] = resolve21;
|
|
13300
13300
|
} else {
|
|
13301
|
-
|
|
13301
|
+
resolve21(null);
|
|
13302
13302
|
}
|
|
13303
13303
|
});
|
|
13304
13304
|
}
|
|
13305
13305
|
[kDestroy](err) {
|
|
13306
|
-
return new Promise((
|
|
13306
|
+
return new Promise((resolve21) => {
|
|
13307
13307
|
const requests2 = this[kQueue].splice(this[kPendingIdx]);
|
|
13308
13308
|
for (let i = 0; i < requests2.length; i++) {
|
|
13309
13309
|
const request2 = requests2[i];
|
|
@@ -13316,7 +13316,7 @@ var require_client = __commonJS({
|
|
|
13316
13316
|
this[kClosedResolve]();
|
|
13317
13317
|
this[kClosedResolve] = null;
|
|
13318
13318
|
}
|
|
13319
|
-
|
|
13319
|
+
resolve21(null);
|
|
13320
13320
|
};
|
|
13321
13321
|
if (this[kHTTPContext]) {
|
|
13322
13322
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -13353,8 +13353,8 @@ var require_client = __commonJS({
|
|
|
13353
13353
|
hostname6 = ip2;
|
|
13354
13354
|
}
|
|
13355
13355
|
client[kConnecting] = true;
|
|
13356
|
-
if (
|
|
13357
|
-
|
|
13356
|
+
if (channels3.beforeConnect.hasSubscribers) {
|
|
13357
|
+
channels3.beforeConnect.publish({
|
|
13358
13358
|
connectParams: {
|
|
13359
13359
|
host: host2,
|
|
13360
13360
|
hostname: hostname6,
|
|
@@ -13400,8 +13400,8 @@ var require_client = __commonJS({
|
|
|
13400
13400
|
socket[kMaxRequests] = client[kMaxRequests];
|
|
13401
13401
|
socket[kClient] = client;
|
|
13402
13402
|
socket[kError] = null;
|
|
13403
|
-
if (
|
|
13404
|
-
|
|
13403
|
+
if (channels3.connected.hasSubscribers) {
|
|
13404
|
+
channels3.connected.publish({
|
|
13405
13405
|
connectParams: {
|
|
13406
13406
|
host: host2,
|
|
13407
13407
|
hostname: hostname6,
|
|
@@ -13428,8 +13428,8 @@ var require_client = __commonJS({
|
|
|
13428
13428
|
return;
|
|
13429
13429
|
}
|
|
13430
13430
|
client[kConnecting] = false;
|
|
13431
|
-
if (
|
|
13432
|
-
|
|
13431
|
+
if (channels3.connectError.hasSubscribers) {
|
|
13432
|
+
channels3.connectError.publish({
|
|
13433
13433
|
connectParams: {
|
|
13434
13434
|
host: host2,
|
|
13435
13435
|
hostname: hostname6,
|
|
@@ -13729,8 +13729,8 @@ var require_pool_base = __commonJS({
|
|
|
13729
13729
|
}
|
|
13730
13730
|
return Promise.all(closeAll);
|
|
13731
13731
|
} else {
|
|
13732
|
-
return new Promise((
|
|
13733
|
-
this[kClosedResolve] =
|
|
13732
|
+
return new Promise((resolve21) => {
|
|
13733
|
+
this[kClosedResolve] = resolve21;
|
|
13734
13734
|
});
|
|
13735
13735
|
}
|
|
13736
13736
|
}
|
|
@@ -15151,7 +15151,7 @@ var require_proxy_agent = __commonJS({
|
|
|
15151
15151
|
var { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError, ProxyConnectionError } = require_errors();
|
|
15152
15152
|
var buildConnector = require_connect();
|
|
15153
15153
|
var Client = require_client();
|
|
15154
|
-
var { channels:
|
|
15154
|
+
var { channels: channels3 } = require_diagnostics();
|
|
15155
15155
|
var Socks5ProxyAgent = require_socks5_proxy_agent();
|
|
15156
15156
|
var kAgent = /* @__PURE__ */ Symbol("proxy agent");
|
|
15157
15157
|
var kClient = /* @__PURE__ */ Symbol("proxy client");
|
|
@@ -15329,8 +15329,8 @@ var require_proxy_agent = __commonJS({
|
|
|
15329
15329
|
callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`));
|
|
15330
15330
|
return;
|
|
15331
15331
|
}
|
|
15332
|
-
if (
|
|
15333
|
-
|
|
15332
|
+
if (channels3.proxyConnected.hasSubscribers) {
|
|
15333
|
+
channels3.proxyConnected.publish({
|
|
15334
15334
|
socket,
|
|
15335
15335
|
connectParams
|
|
15336
15336
|
});
|
|
@@ -16241,7 +16241,7 @@ var require_readable = __commonJS({
|
|
|
16241
16241
|
if (this._readableState.closeEmitted) {
|
|
16242
16242
|
return Promise.resolve(null);
|
|
16243
16243
|
}
|
|
16244
|
-
return new Promise((
|
|
16244
|
+
return new Promise((resolve21, reject) => {
|
|
16245
16245
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
16246
16246
|
this.destroy(new AbortError());
|
|
16247
16247
|
}
|
|
@@ -16255,11 +16255,11 @@ var require_readable = __commonJS({
|
|
|
16255
16255
|
if (signal.aborted) {
|
|
16256
16256
|
reject(signal.reason ?? new AbortError());
|
|
16257
16257
|
} else {
|
|
16258
|
-
|
|
16258
|
+
resolve21(null);
|
|
16259
16259
|
}
|
|
16260
16260
|
});
|
|
16261
16261
|
} else {
|
|
16262
|
-
this.on("close",
|
|
16262
|
+
this.on("close", resolve21);
|
|
16263
16263
|
}
|
|
16264
16264
|
this.on("error", noop2).on("data", () => {
|
|
16265
16265
|
if (this[kBytesRead] > limit) {
|
|
@@ -16287,7 +16287,7 @@ var require_readable = __commonJS({
|
|
|
16287
16287
|
}
|
|
16288
16288
|
function consume(stream, type) {
|
|
16289
16289
|
assert2(!stream[kConsume]);
|
|
16290
|
-
return new Promise((
|
|
16290
|
+
return new Promise((resolve21, reject) => {
|
|
16291
16291
|
if (isUnusable(stream)) {
|
|
16292
16292
|
const rState = stream._readableState;
|
|
16293
16293
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -16302,7 +16302,7 @@ var require_readable = __commonJS({
|
|
|
16302
16302
|
stream[kConsume] = {
|
|
16303
16303
|
type,
|
|
16304
16304
|
stream,
|
|
16305
|
-
resolve:
|
|
16305
|
+
resolve: resolve21,
|
|
16306
16306
|
reject,
|
|
16307
16307
|
length: 0,
|
|
16308
16308
|
body: []
|
|
@@ -16380,18 +16380,18 @@ var require_readable = __commonJS({
|
|
|
16380
16380
|
return buffer;
|
|
16381
16381
|
}
|
|
16382
16382
|
function consumeEnd(consume2, encoding) {
|
|
16383
|
-
const { type, body, resolve:
|
|
16383
|
+
const { type, body, resolve: resolve21, stream, length } = consume2;
|
|
16384
16384
|
try {
|
|
16385
16385
|
if (type === "text") {
|
|
16386
|
-
|
|
16386
|
+
resolve21(chunksDecode(body, length, encoding));
|
|
16387
16387
|
} else if (type === "json") {
|
|
16388
|
-
|
|
16388
|
+
resolve21(JSON.parse(chunksDecode(body, length, encoding)));
|
|
16389
16389
|
} else if (type === "arrayBuffer") {
|
|
16390
|
-
|
|
16390
|
+
resolve21(chunksConcat(body, length).buffer);
|
|
16391
16391
|
} else if (type === "blob") {
|
|
16392
|
-
|
|
16392
|
+
resolve21(new Blob(body, { type: stream[kContentType] }));
|
|
16393
16393
|
} else if (type === "bytes") {
|
|
16394
|
-
|
|
16394
|
+
resolve21(chunksConcat(body, length));
|
|
16395
16395
|
}
|
|
16396
16396
|
consumeFinish(consume2);
|
|
16397
16397
|
} catch (err) {
|
|
@@ -16610,9 +16610,9 @@ var require_api_request = __commonJS({
|
|
|
16610
16610
|
};
|
|
16611
16611
|
function request2(opts, callback) {
|
|
16612
16612
|
if (callback === void 0) {
|
|
16613
|
-
return new Promise((
|
|
16613
|
+
return new Promise((resolve21, reject) => {
|
|
16614
16614
|
request2.call(this, opts, (err, data) => {
|
|
16615
|
-
return err ? reject(err) :
|
|
16615
|
+
return err ? reject(err) : resolve21(data);
|
|
16616
16616
|
});
|
|
16617
16617
|
});
|
|
16618
16618
|
}
|
|
@@ -16873,9 +16873,9 @@ var require_api_stream = __commonJS({
|
|
|
16873
16873
|
};
|
|
16874
16874
|
function stream(opts, factory, callback) {
|
|
16875
16875
|
if (callback === void 0) {
|
|
16876
|
-
return new Promise((
|
|
16876
|
+
return new Promise((resolve21, reject) => {
|
|
16877
16877
|
stream.call(this, opts, factory, (err, data) => {
|
|
16878
|
-
return err ? reject(err) :
|
|
16878
|
+
return err ? reject(err) : resolve21(data);
|
|
16879
16879
|
});
|
|
16880
16880
|
});
|
|
16881
16881
|
}
|
|
@@ -17175,9 +17175,9 @@ var require_api_upgrade = __commonJS({
|
|
|
17175
17175
|
};
|
|
17176
17176
|
function upgrade2(opts, callback) {
|
|
17177
17177
|
if (callback === void 0) {
|
|
17178
|
-
return new Promise((
|
|
17178
|
+
return new Promise((resolve21, reject) => {
|
|
17179
17179
|
upgrade2.call(this, opts, (err, data) => {
|
|
17180
|
-
return err ? reject(err) :
|
|
17180
|
+
return err ? reject(err) : resolve21(data);
|
|
17181
17181
|
});
|
|
17182
17182
|
});
|
|
17183
17183
|
}
|
|
@@ -17271,9 +17271,9 @@ var require_api_connect = __commonJS({
|
|
|
17271
17271
|
};
|
|
17272
17272
|
function connect6(opts, callback) {
|
|
17273
17273
|
if (callback === void 0) {
|
|
17274
|
-
return new Promise((
|
|
17274
|
+
return new Promise((resolve21, reject) => {
|
|
17275
17275
|
connect6.call(this, opts, (err, data) => {
|
|
17276
|
-
return err ? reject(err) :
|
|
17276
|
+
return err ? reject(err) : resolve21(data);
|
|
17277
17277
|
});
|
|
17278
17278
|
});
|
|
17279
17279
|
}
|
|
@@ -18733,8 +18733,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
18733
18733
|
var require_snapshot_recorder = __commonJS({
|
|
18734
18734
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
18735
18735
|
"use strict";
|
|
18736
|
-
var { writeFile: writeFile24, readFile:
|
|
18737
|
-
var { dirname: dirname24, resolve:
|
|
18736
|
+
var { writeFile: writeFile24, readFile: readFile43, mkdir: mkdir23 } = __require("node:fs/promises");
|
|
18737
|
+
var { dirname: dirname24, resolve: resolve21 } = __require("node:path");
|
|
18738
18738
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
18739
18739
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
18740
18740
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -18950,7 +18950,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18950
18950
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18951
18951
|
}
|
|
18952
18952
|
try {
|
|
18953
|
-
const data = await
|
|
18953
|
+
const data = await readFile43(resolve21(path), "utf8");
|
|
18954
18954
|
const parsed = JSON.parse(data);
|
|
18955
18955
|
if (Array.isArray(parsed)) {
|
|
18956
18956
|
this.#snapshots.clear();
|
|
@@ -18979,7 +18979,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18979
18979
|
if (!path) {
|
|
18980
18980
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18981
18981
|
}
|
|
18982
|
-
const resolvedPath =
|
|
18982
|
+
const resolvedPath = resolve21(path);
|
|
18983
18983
|
await mkdir23(dirname24(resolvedPath), { recursive: true });
|
|
18984
18984
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
18985
18985
|
hash: hash2,
|
|
@@ -26477,7 +26477,7 @@ var require_fetch = __commonJS({
|
|
|
26477
26477
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
26478
26478
|
return dispatchWithProtocolPreference(body);
|
|
26479
26479
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
26480
|
-
return new Promise((
|
|
26480
|
+
return new Promise((resolve21, reject) => agent2.dispatch(
|
|
26481
26481
|
{
|
|
26482
26482
|
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
26483
26483
|
origin: url2.origin,
|
|
@@ -26560,7 +26560,7 @@ var require_fetch = __commonJS({
|
|
|
26560
26560
|
}
|
|
26561
26561
|
}
|
|
26562
26562
|
const onError = (err) => this.onResponseError(controller, err);
|
|
26563
|
-
|
|
26563
|
+
resolve21({
|
|
26564
26564
|
status: status9,
|
|
26565
26565
|
statusText,
|
|
26566
26566
|
headersList,
|
|
@@ -26593,7 +26593,7 @@ var require_fetch = __commonJS({
|
|
|
26593
26593
|
fetchParams.controller.off("terminated", this.abort);
|
|
26594
26594
|
}
|
|
26595
26595
|
if (request2.mode === "websocket" && allowH2 !== false && error62?.code === "UND_ERR_INFO" && error62?.message === "HTTP/2: Extended CONNECT protocol not supported by server") {
|
|
26596
|
-
|
|
26596
|
+
resolve21(dispatchWithProtocolPreference(body2, false));
|
|
26597
26597
|
return;
|
|
26598
26598
|
}
|
|
26599
26599
|
this.body?.destroy(error62);
|
|
@@ -26607,7 +26607,7 @@ var require_fetch = __commonJS({
|
|
|
26607
26607
|
const rawHeaders = controller?.rawHeaders ?? [];
|
|
26608
26608
|
const headersList = new HeadersList();
|
|
26609
26609
|
appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
|
|
26610
|
-
|
|
26610
|
+
resolve21({
|
|
26611
26611
|
status: status9,
|
|
26612
26612
|
statusText: STATUS_CODES[status9],
|
|
26613
26613
|
headersList,
|
|
@@ -29122,7 +29122,7 @@ var require_websocket2 = __commonJS({
|
|
|
29122
29122
|
var { ErrorEvent, CloseEvent, createFastMessageEvent } = require_events();
|
|
29123
29123
|
var { SendQueue } = require_sender2();
|
|
29124
29124
|
var { WebsocketFrameSend } = require_frame();
|
|
29125
|
-
var { channels:
|
|
29125
|
+
var { channels: channels3 } = require_diagnostics();
|
|
29126
29126
|
var kRef = /* @__PURE__ */ Symbol.for("nodejs.ref");
|
|
29127
29127
|
var kUnref = /* @__PURE__ */ Symbol.for("nodejs.unref");
|
|
29128
29128
|
function getSocketAddress(socket) {
|
|
@@ -29160,23 +29160,23 @@ var require_websocket2 = __commonJS({
|
|
|
29160
29160
|
},
|
|
29161
29161
|
onSocketError: (err) => {
|
|
29162
29162
|
this.#handler.readyState = states.CLOSING;
|
|
29163
|
-
if (
|
|
29164
|
-
|
|
29163
|
+
if (channels3.socketError.hasSubscribers) {
|
|
29164
|
+
channels3.socketError.publish(err);
|
|
29165
29165
|
}
|
|
29166
29166
|
this.#handler.socket.destroy();
|
|
29167
29167
|
},
|
|
29168
29168
|
onSocketClose: () => this.#onSocketClose(),
|
|
29169
29169
|
onPing: (body) => {
|
|
29170
|
-
if (
|
|
29171
|
-
|
|
29170
|
+
if (channels3.ping.hasSubscribers) {
|
|
29171
|
+
channels3.ping.publish({
|
|
29172
29172
|
payload: body,
|
|
29173
29173
|
websocket: this
|
|
29174
29174
|
});
|
|
29175
29175
|
}
|
|
29176
29176
|
},
|
|
29177
29177
|
onPong: (body) => {
|
|
29178
|
-
if (
|
|
29179
|
-
|
|
29178
|
+
if (channels3.pong.hasSubscribers) {
|
|
29179
|
+
channels3.pong.publish({
|
|
29180
29180
|
payload: body,
|
|
29181
29181
|
websocket: this
|
|
29182
29182
|
});
|
|
@@ -29421,9 +29421,9 @@ var require_websocket2 = __commonJS({
|
|
|
29421
29421
|
this.#protocol = protocol;
|
|
29422
29422
|
}
|
|
29423
29423
|
fireEvent("open", this);
|
|
29424
|
-
if (
|
|
29424
|
+
if (channels3.open.hasSubscribers) {
|
|
29425
29425
|
const headers = response.headersList.entries;
|
|
29426
|
-
|
|
29426
|
+
channels3.open.publish({
|
|
29427
29427
|
address: getSocketAddress(response.socket),
|
|
29428
29428
|
protocol: this.#protocol,
|
|
29429
29429
|
extensions: this.#extensions,
|
|
@@ -29488,8 +29488,8 @@ var require_websocket2 = __commonJS({
|
|
|
29488
29488
|
code,
|
|
29489
29489
|
reason
|
|
29490
29490
|
});
|
|
29491
|
-
if (
|
|
29492
|
-
|
|
29491
|
+
if (channels3.close.hasSubscribers) {
|
|
29492
|
+
channels3.close.publish({
|
|
29493
29493
|
websocket: this,
|
|
29494
29494
|
code,
|
|
29495
29495
|
reason
|
|
@@ -29690,7 +29690,7 @@ var require_websocketstream = __commonJS({
|
|
|
29690
29690
|
var { webidl } = require_webidl();
|
|
29691
29691
|
var { getURLRecord, isValidSubprotocol, isEstablished, utf8Decode } = require_util5();
|
|
29692
29692
|
var { establishWebSocketConnection, failWebsocketConnection, closeWebSocketConnection } = require_connection();
|
|
29693
|
-
var { channels:
|
|
29693
|
+
var { channels: channels3 } = require_diagnostics();
|
|
29694
29694
|
var { WebsocketFrameSend } = require_frame();
|
|
29695
29695
|
var { ByteParser } = require_receiver2();
|
|
29696
29696
|
var { WebSocketError, createUnvalidatedWebSocketError } = require_websocketerror();
|
|
@@ -29731,8 +29731,8 @@ var require_websocketstream = __commonJS({
|
|
|
29731
29731
|
},
|
|
29732
29732
|
onSocketError: (err) => {
|
|
29733
29733
|
this.#handler.readyState = states.CLOSING;
|
|
29734
|
-
if (
|
|
29735
|
-
|
|
29734
|
+
if (channels3.socketError.hasSubscribers) {
|
|
29735
|
+
channels3.socketError.publish(err);
|
|
29736
29736
|
}
|
|
29737
29737
|
this.#handler.socket.destroy();
|
|
29738
29738
|
},
|
|
@@ -31644,7 +31644,7 @@ function runRedacted({
|
|
|
31644
31644
|
redact
|
|
31645
31645
|
}) {
|
|
31646
31646
|
const values = redact ?? Object.values(env);
|
|
31647
|
-
return new Promise((
|
|
31647
|
+
return new Promise((resolve21, reject) => {
|
|
31648
31648
|
const [file3, ...args] = command;
|
|
31649
31649
|
const child = spawn(file3, args, {
|
|
31650
31650
|
env: { ...baseEnv, ...env },
|
|
@@ -31670,7 +31670,7 @@ function runRedacted({
|
|
|
31670
31670
|
child.on("error", reject);
|
|
31671
31671
|
child.on("close", (code, ended) => {
|
|
31672
31672
|
signal?.removeEventListener("abort", killGroup);
|
|
31673
|
-
void drained.then(() =>
|
|
31673
|
+
void drained.then(() => resolve21(code ?? (ended ? 128 + signalNumber(ended) : 1)));
|
|
31674
31674
|
});
|
|
31675
31675
|
});
|
|
31676
31676
|
}
|
|
@@ -35777,7 +35777,7 @@ function flagText({
|
|
|
35777
35777
|
}
|
|
35778
35778
|
|
|
35779
35779
|
// src/rules/cli-version.rules.ts
|
|
35780
|
-
var STAMPED = "0.1.
|
|
35780
|
+
var STAMPED = "0.1.55";
|
|
35781
35781
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35782
35782
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35783
35783
|
}
|
|
@@ -40816,7 +40816,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
40816
40816
|
var NONE = 0;
|
|
40817
40817
|
var ASSUMED = 1;
|
|
40818
40818
|
var PROVEN = 2;
|
|
40819
|
-
function isRecursive(inst, stack,
|
|
40819
|
+
function isRecursive(inst, stack, resolve21) {
|
|
40820
40820
|
const cached2 = recursive.get(inst);
|
|
40821
40821
|
if (cached2 !== void 0)
|
|
40822
40822
|
return cached2 ? PROVEN : NONE;
|
|
@@ -40826,7 +40826,7 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
40826
40826
|
let result = NONE;
|
|
40827
40827
|
const check3 = (child) => {
|
|
40828
40828
|
if (result !== PROVEN && child?._zod) {
|
|
40829
|
-
const answer5 = isRecursive(child, stack,
|
|
40829
|
+
const answer5 = isRecursive(child, stack, resolve21);
|
|
40830
40830
|
if (answer5 > result)
|
|
40831
40831
|
result = answer5;
|
|
40832
40832
|
}
|
|
@@ -40837,7 +40837,7 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
40837
40837
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
40838
40838
|
if (spread && !desc.enumerable)
|
|
40839
40839
|
continue;
|
|
40840
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
40840
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve21) : NONE;
|
|
40841
40841
|
if (child > answer5)
|
|
40842
40842
|
answer5 = child;
|
|
40843
40843
|
}
|
|
@@ -40901,7 +40901,7 @@ function isRecursive(inst, stack, resolve19) {
|
|
|
40901
40901
|
break;
|
|
40902
40902
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
40903
40903
|
case "lazy": {
|
|
40904
|
-
const inner = def._cachedInner ?? (
|
|
40904
|
+
const inner = def._cachedInner ?? (resolve21 ? inst._zod.innerType : void 0);
|
|
40905
40905
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
40906
40906
|
break;
|
|
40907
40907
|
}
|
|
@@ -51388,13 +51388,13 @@ function initializeContext(params) {
|
|
|
51388
51388
|
external: params?.external ?? void 0
|
|
51389
51389
|
};
|
|
51390
51390
|
}
|
|
51391
|
-
function handleUnrepresentable(schema, ctx,
|
|
51391
|
+
function handleUnrepresentable(schema, ctx, json7, params, message2) {
|
|
51392
51392
|
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message2 }) : ctx.unrepresentable;
|
|
51393
51393
|
if (result === "any")
|
|
51394
51394
|
return false;
|
|
51395
51395
|
if (result === void 0 || result === "throw")
|
|
51396
51396
|
throw new Error(message2);
|
|
51397
|
-
Object.assign(
|
|
51397
|
+
Object.assign(json7, result);
|
|
51398
51398
|
return true;
|
|
51399
51399
|
}
|
|
51400
51400
|
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
@@ -51630,12 +51630,12 @@ function foldObjects(members3) {
|
|
|
51630
51630
|
}
|
|
51631
51631
|
return folded;
|
|
51632
51632
|
}
|
|
51633
|
-
function foldIntersection(
|
|
51634
|
-
const allOf =
|
|
51633
|
+
function foldIntersection(json7) {
|
|
51634
|
+
const allOf = json7.allOf;
|
|
51635
51635
|
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
51636
51636
|
return;
|
|
51637
51637
|
for (const key of FOLDABLE_KEYS)
|
|
51638
|
-
if (key in
|
|
51638
|
+
if (key in json7)
|
|
51639
51639
|
return;
|
|
51640
51640
|
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
51641
51641
|
let folded = null;
|
|
@@ -51654,8 +51654,8 @@ function foldIntersection(json6) {
|
|
|
51654
51654
|
}
|
|
51655
51655
|
if (!folded)
|
|
51656
51656
|
return;
|
|
51657
|
-
delete
|
|
51658
|
-
assignProps(
|
|
51657
|
+
delete json7.allOf;
|
|
51658
|
+
assignProps(json7, folded);
|
|
51659
51659
|
}
|
|
51660
51660
|
function finalize(ctx, schema) {
|
|
51661
51661
|
const root = ctx.seen.get(schema);
|
|
@@ -51737,20 +51737,20 @@ function finalize(ctx, schema) {
|
|
|
51737
51737
|
if (ctx.intersections.length) {
|
|
51738
51738
|
const carriers = /* @__PURE__ */ new Map();
|
|
51739
51739
|
for (const seen of ctx.seen.values()) {
|
|
51740
|
-
for (const
|
|
51741
|
-
const allOf =
|
|
51740
|
+
for (const json7 of [seen.schema, seen.def]) {
|
|
51741
|
+
const allOf = json7?.allOf;
|
|
51742
51742
|
if (!Array.isArray(allOf))
|
|
51743
51743
|
continue;
|
|
51744
51744
|
const existing = carriers.get(allOf);
|
|
51745
51745
|
if (existing)
|
|
51746
|
-
existing.push(
|
|
51746
|
+
existing.push(json7);
|
|
51747
51747
|
else
|
|
51748
|
-
carriers.set(allOf, [
|
|
51748
|
+
carriers.set(allOf, [json7]);
|
|
51749
51749
|
}
|
|
51750
51750
|
}
|
|
51751
51751
|
for (const allOf of ctx.intersections) {
|
|
51752
|
-
for (const
|
|
51753
|
-
foldIntersection(
|
|
51752
|
+
for (const json7 of carriers.get(allOf) ?? [])
|
|
51753
|
+
foldIntersection(json7);
|
|
51754
51754
|
}
|
|
51755
51755
|
}
|
|
51756
51756
|
}
|
|
@@ -51985,29 +51985,29 @@ var exactPatterns = /* @__PURE__ */ new Map([
|
|
|
51985
51985
|
]);
|
|
51986
51986
|
var exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
51987
51987
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
51988
|
-
const
|
|
51989
|
-
|
|
51988
|
+
const json7 = _json;
|
|
51989
|
+
json7.type = "string";
|
|
51990
51990
|
const { minimum, maximum, format: format2, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
51991
51991
|
if (typeof minimum === "number")
|
|
51992
|
-
|
|
51992
|
+
json7.minLength = minimum;
|
|
51993
51993
|
if (typeof maximum === "number")
|
|
51994
|
-
|
|
51994
|
+
json7.maxLength = maximum;
|
|
51995
51995
|
if (format2) {
|
|
51996
|
-
|
|
51997
|
-
if (
|
|
51998
|
-
delete
|
|
51996
|
+
json7.format = formatMap[format2] ?? format2;
|
|
51997
|
+
if (json7.format === "")
|
|
51998
|
+
delete json7.format;
|
|
51999
51999
|
if (format2 === "time" || laxFormat) {
|
|
52000
|
-
delete
|
|
52000
|
+
delete json7.format;
|
|
52001
52001
|
}
|
|
52002
52002
|
}
|
|
52003
52003
|
if (contentEncoding)
|
|
52004
|
-
|
|
52004
|
+
json7.contentEncoding = contentEncoding;
|
|
52005
52005
|
if (patterns && patterns.size > 0) {
|
|
52006
52006
|
const patternList = [...patterns].map(exactPattern);
|
|
52007
52007
|
if (patternList.length === 1)
|
|
52008
|
-
|
|
52008
|
+
json7.pattern = patternList[0].source;
|
|
52009
52009
|
else if (patternList.length > 1) {
|
|
52010
|
-
|
|
52010
|
+
json7.allOf = [
|
|
52011
52011
|
...patternList.map((regex) => ({
|
|
52012
52012
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
52013
52013
|
pattern: regex.source
|
|
@@ -52017,31 +52017,31 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
52017
52017
|
}
|
|
52018
52018
|
};
|
|
52019
52019
|
var numberProcessor = (schema, ctx, _json, params) => {
|
|
52020
|
-
const
|
|
52020
|
+
const json7 = _json;
|
|
52021
52021
|
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
52022
|
-
|
|
52022
|
+
json7.type = isInt ? "integer" : "number";
|
|
52023
52023
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
52024
52024
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
52025
52025
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
52026
52026
|
if (exMin) {
|
|
52027
52027
|
if (legacy) {
|
|
52028
|
-
|
|
52029
|
-
|
|
52028
|
+
json7.minimum = exclusiveMinimum;
|
|
52029
|
+
json7.exclusiveMinimum = true;
|
|
52030
52030
|
} else {
|
|
52031
|
-
|
|
52031
|
+
json7.exclusiveMinimum = exclusiveMinimum;
|
|
52032
52032
|
}
|
|
52033
52033
|
} else if (typeof minimum === "number") {
|
|
52034
|
-
|
|
52034
|
+
json7.minimum = minimum;
|
|
52035
52035
|
}
|
|
52036
52036
|
if (exMax) {
|
|
52037
52037
|
if (legacy) {
|
|
52038
|
-
|
|
52039
|
-
|
|
52038
|
+
json7.maximum = exclusiveMaximum;
|
|
52039
|
+
json7.exclusiveMaximum = true;
|
|
52040
52040
|
} else {
|
|
52041
|
-
|
|
52041
|
+
json7.exclusiveMaximum = exclusiveMaximum;
|
|
52042
52042
|
}
|
|
52043
52043
|
} else if (typeof maximum === "number") {
|
|
52044
|
-
|
|
52044
|
+
json7.maximum = maximum;
|
|
52045
52045
|
}
|
|
52046
52046
|
if (multipleOf) {
|
|
52047
52047
|
const divisors = /* @__PURE__ */ new Set();
|
|
@@ -52049,75 +52049,75 @@ var numberProcessor = (schema, ctx, _json, params) => {
|
|
|
52049
52049
|
if (Number.isFinite(divisor) && divisor !== 0)
|
|
52050
52050
|
divisors.add(Math.abs(divisor));
|
|
52051
52051
|
else
|
|
52052
|
-
handleUnrepresentable(schema, ctx,
|
|
52052
|
+
handleUnrepresentable(schema, ctx, json7, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
52053
52053
|
}
|
|
52054
52054
|
const [first, ...rest] = divisors;
|
|
52055
52055
|
if (first !== void 0)
|
|
52056
|
-
|
|
52056
|
+
json7.multipleOf = first;
|
|
52057
52057
|
if (rest.length)
|
|
52058
|
-
|
|
52058
|
+
json7.allOf = [...json7.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
52059
52059
|
}
|
|
52060
52060
|
};
|
|
52061
|
-
var booleanProcessor = (_schema, _ctx,
|
|
52062
|
-
|
|
52061
|
+
var booleanProcessor = (_schema, _ctx, json7, _params) => {
|
|
52062
|
+
json7.type = "boolean";
|
|
52063
52063
|
};
|
|
52064
|
-
var bigintProcessor = (schema, ctx,
|
|
52065
|
-
handleUnrepresentable(schema, ctx,
|
|
52064
|
+
var bigintProcessor = (schema, ctx, json7, params) => {
|
|
52065
|
+
handleUnrepresentable(schema, ctx, json7, params, "BigInt cannot be represented in JSON Schema");
|
|
52066
52066
|
};
|
|
52067
|
-
var symbolProcessor = (schema, ctx,
|
|
52068
|
-
handleUnrepresentable(schema, ctx,
|
|
52067
|
+
var symbolProcessor = (schema, ctx, json7, params) => {
|
|
52068
|
+
handleUnrepresentable(schema, ctx, json7, params, "Symbols cannot be represented in JSON Schema");
|
|
52069
52069
|
};
|
|
52070
|
-
var nullProcessor = (_schema, ctx,
|
|
52070
|
+
var nullProcessor = (_schema, ctx, json7, _params) => {
|
|
52071
52071
|
if (ctx.target === "openapi-3.0") {
|
|
52072
|
-
|
|
52073
|
-
|
|
52074
|
-
|
|
52072
|
+
json7.type = "string";
|
|
52073
|
+
json7.nullable = true;
|
|
52074
|
+
json7.enum = [null];
|
|
52075
52075
|
} else {
|
|
52076
|
-
|
|
52076
|
+
json7.type = "null";
|
|
52077
52077
|
}
|
|
52078
52078
|
};
|
|
52079
|
-
var undefinedProcessor = (schema, ctx,
|
|
52080
|
-
handleUnrepresentable(schema, ctx,
|
|
52079
|
+
var undefinedProcessor = (schema, ctx, json7, params) => {
|
|
52080
|
+
handleUnrepresentable(schema, ctx, json7, params, "Undefined cannot be represented in JSON Schema");
|
|
52081
52081
|
};
|
|
52082
|
-
var voidProcessor = (schema, ctx,
|
|
52083
|
-
handleUnrepresentable(schema, ctx,
|
|
52082
|
+
var voidProcessor = (schema, ctx, json7, params) => {
|
|
52083
|
+
handleUnrepresentable(schema, ctx, json7, params, "Void cannot be represented in JSON Schema");
|
|
52084
52084
|
};
|
|
52085
|
-
var neverProcessor = (_schema, _ctx,
|
|
52086
|
-
|
|
52085
|
+
var neverProcessor = (_schema, _ctx, json7, _params) => {
|
|
52086
|
+
json7.not = {};
|
|
52087
52087
|
};
|
|
52088
52088
|
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
52089
52089
|
};
|
|
52090
52090
|
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
52091
52091
|
};
|
|
52092
|
-
var dateProcessor = (schema, ctx,
|
|
52093
|
-
handleUnrepresentable(schema, ctx,
|
|
52092
|
+
var dateProcessor = (schema, ctx, json7, params) => {
|
|
52093
|
+
handleUnrepresentable(schema, ctx, json7, params, "Date cannot be represented in JSON Schema");
|
|
52094
52094
|
};
|
|
52095
|
-
var enumProcessor = (schema, _ctx,
|
|
52095
|
+
var enumProcessor = (schema, _ctx, json7, _params) => {
|
|
52096
52096
|
const def = schema._zod.def;
|
|
52097
52097
|
const values = getEnumValues(def.entries);
|
|
52098
52098
|
if (values.length === 0) {
|
|
52099
|
-
|
|
52099
|
+
json7.not = {};
|
|
52100
52100
|
return;
|
|
52101
52101
|
}
|
|
52102
52102
|
if (values.every((v) => typeof v === "number"))
|
|
52103
|
-
|
|
52103
|
+
json7.type = "number";
|
|
52104
52104
|
if (values.every((v) => typeof v === "string"))
|
|
52105
|
-
|
|
52106
|
-
|
|
52105
|
+
json7.type = "string";
|
|
52106
|
+
json7.enum = values;
|
|
52107
52107
|
};
|
|
52108
|
-
var literalProcessor = (schema, ctx,
|
|
52108
|
+
var literalProcessor = (schema, ctx, json7, params) => {
|
|
52109
52109
|
const def = schema._zod.def;
|
|
52110
52110
|
if (def.values.length === 0) {
|
|
52111
|
-
|
|
52111
|
+
json7.not = {};
|
|
52112
52112
|
return;
|
|
52113
52113
|
}
|
|
52114
52114
|
const vals = [];
|
|
52115
52115
|
for (const val of def.values) {
|
|
52116
52116
|
if (val === void 0) {
|
|
52117
|
-
if (handleUnrepresentable(schema, ctx,
|
|
52117
|
+
if (handleUnrepresentable(schema, ctx, json7, params, "Literal `undefined` cannot be represented in JSON Schema"))
|
|
52118
52118
|
return;
|
|
52119
52119
|
} else if (typeof val === "bigint") {
|
|
52120
|
-
if (handleUnrepresentable(schema, ctx,
|
|
52120
|
+
if (handleUnrepresentable(schema, ctx, json7, params, "BigInt literals cannot be represented in JSON Schema"))
|
|
52121
52121
|
return;
|
|
52122
52122
|
vals.push(Number(val));
|
|
52123
52123
|
} else {
|
|
@@ -52127,37 +52127,37 @@ var literalProcessor = (schema, ctx, json6, params) => {
|
|
|
52127
52127
|
if (vals.length === 0) {
|
|
52128
52128
|
} else if (vals.length === 1) {
|
|
52129
52129
|
const val = vals[0];
|
|
52130
|
-
|
|
52130
|
+
json7.type = val === null ? "null" : typeof val;
|
|
52131
52131
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
52132
|
-
|
|
52132
|
+
json7.enum = [val];
|
|
52133
52133
|
} else {
|
|
52134
|
-
|
|
52134
|
+
json7.const = val;
|
|
52135
52135
|
}
|
|
52136
52136
|
} else {
|
|
52137
52137
|
if (vals.every((v) => typeof v === "number"))
|
|
52138
|
-
|
|
52138
|
+
json7.type = "number";
|
|
52139
52139
|
if (vals.every((v) => typeof v === "string"))
|
|
52140
|
-
|
|
52140
|
+
json7.type = "string";
|
|
52141
52141
|
if (vals.every((v) => typeof v === "boolean"))
|
|
52142
|
-
|
|
52142
|
+
json7.type = "boolean";
|
|
52143
52143
|
if (vals.every((v) => v === null))
|
|
52144
|
-
|
|
52145
|
-
|
|
52144
|
+
json7.type = "null";
|
|
52145
|
+
json7.enum = vals;
|
|
52146
52146
|
}
|
|
52147
52147
|
};
|
|
52148
|
-
var nanProcessor = (schema, ctx,
|
|
52149
|
-
handleUnrepresentable(schema, ctx,
|
|
52148
|
+
var nanProcessor = (schema, ctx, json7, params) => {
|
|
52149
|
+
handleUnrepresentable(schema, ctx, json7, params, "NaN cannot be represented in JSON Schema");
|
|
52150
52150
|
};
|
|
52151
|
-
var templateLiteralProcessor = (schema, _ctx,
|
|
52152
|
-
const _json =
|
|
52151
|
+
var templateLiteralProcessor = (schema, _ctx, json7, _params) => {
|
|
52152
|
+
const _json = json7;
|
|
52153
52153
|
const pattern = schema._zod.pattern;
|
|
52154
52154
|
if (!pattern)
|
|
52155
52155
|
throw new Error("Pattern not found in template literal");
|
|
52156
52156
|
_json.type = "string";
|
|
52157
52157
|
_json.pattern = pattern.source;
|
|
52158
52158
|
};
|
|
52159
|
-
var fileProcessor = (schema, _ctx,
|
|
52160
|
-
const _json =
|
|
52159
|
+
var fileProcessor = (schema, _ctx, json7, _params) => {
|
|
52160
|
+
const _json = json7;
|
|
52161
52161
|
_json.type = "string";
|
|
52162
52162
|
_json.format = "binary";
|
|
52163
52163
|
_json.contentEncoding = "binary";
|
|
@@ -52175,34 +52175,34 @@ var fileProcessor = (schema, _ctx, json6, _params) => {
|
|
|
52175
52175
|
else
|
|
52176
52176
|
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
52177
52177
|
};
|
|
52178
|
-
var successProcessor = (_schema, _ctx,
|
|
52179
|
-
|
|
52178
|
+
var successProcessor = (_schema, _ctx, json7, _params) => {
|
|
52179
|
+
json7.type = "boolean";
|
|
52180
52180
|
};
|
|
52181
|
-
var customProcessor = (schema, ctx,
|
|
52182
|
-
handleUnrepresentable(schema, ctx,
|
|
52181
|
+
var customProcessor = (schema, ctx, json7, params) => {
|
|
52182
|
+
handleUnrepresentable(schema, ctx, json7, params, "Custom types cannot be represented in JSON Schema");
|
|
52183
52183
|
};
|
|
52184
|
-
var functionProcessor = (schema, ctx,
|
|
52185
|
-
handleUnrepresentable(schema, ctx,
|
|
52184
|
+
var functionProcessor = (schema, ctx, json7, params) => {
|
|
52185
|
+
handleUnrepresentable(schema, ctx, json7, params, "Function types cannot be represented in JSON Schema");
|
|
52186
52186
|
};
|
|
52187
|
-
var transformProcessor = (schema, ctx,
|
|
52188
|
-
handleUnrepresentable(schema, ctx,
|
|
52187
|
+
var transformProcessor = (schema, ctx, json7, params) => {
|
|
52188
|
+
handleUnrepresentable(schema, ctx, json7, params, "Transforms cannot be represented in JSON Schema");
|
|
52189
52189
|
};
|
|
52190
|
-
var mapProcessor = (schema, ctx,
|
|
52191
|
-
handleUnrepresentable(schema, ctx,
|
|
52190
|
+
var mapProcessor = (schema, ctx, json7, params) => {
|
|
52191
|
+
handleUnrepresentable(schema, ctx, json7, params, "Map cannot be represented in JSON Schema");
|
|
52192
52192
|
};
|
|
52193
|
-
var setProcessor = (schema, ctx,
|
|
52194
|
-
handleUnrepresentable(schema, ctx,
|
|
52193
|
+
var setProcessor = (schema, ctx, json7, params) => {
|
|
52194
|
+
handleUnrepresentable(schema, ctx, json7, params, "Set cannot be represented in JSON Schema");
|
|
52195
52195
|
};
|
|
52196
52196
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
52197
|
-
const
|
|
52197
|
+
const json7 = _json;
|
|
52198
52198
|
const def = schema._zod.def;
|
|
52199
52199
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
52200
52200
|
if (typeof minimum === "number")
|
|
52201
|
-
|
|
52201
|
+
json7.minItems = minimum;
|
|
52202
52202
|
if (typeof maximum === "number")
|
|
52203
|
-
|
|
52204
|
-
|
|
52205
|
-
|
|
52203
|
+
json7.maxItems = maximum;
|
|
52204
|
+
json7.type = "array";
|
|
52205
|
+
json7.items = processSchema(def.element, ctx, {
|
|
52206
52206
|
...params,
|
|
52207
52207
|
path: [...params.path, "items"]
|
|
52208
52208
|
});
|
|
@@ -52218,17 +52218,17 @@ function inputOptin(schema) {
|
|
|
52218
52218
|
return schema._zod.optin;
|
|
52219
52219
|
}
|
|
52220
52220
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
52221
|
-
const
|
|
52221
|
+
const json7 = _json;
|
|
52222
52222
|
const def = schema._zod.def;
|
|
52223
52223
|
const shape = def.shape;
|
|
52224
52224
|
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
52225
|
-
if (symbolKeys.length && handleUnrepresentable(schema, ctx,
|
|
52225
|
+
if (symbolKeys.length && handleUnrepresentable(schema, ctx, json7, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
52226
52226
|
return;
|
|
52227
52227
|
}
|
|
52228
|
-
|
|
52229
|
-
|
|
52228
|
+
json7.type = "object";
|
|
52229
|
+
json7.properties = {};
|
|
52230
52230
|
for (const key in shape) {
|
|
52231
|
-
assignProp(
|
|
52231
|
+
assignProp(json7.properties, key, processSchema(shape[key], ctx, {
|
|
52232
52232
|
...params,
|
|
52233
52233
|
path: [...params.path, "properties", key]
|
|
52234
52234
|
}));
|
|
@@ -52241,21 +52241,21 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
52241
52241
|
}
|
|
52242
52242
|
}
|
|
52243
52243
|
if (requiredKeys.length > 0) {
|
|
52244
|
-
|
|
52244
|
+
json7.required = requiredKeys;
|
|
52245
52245
|
}
|
|
52246
52246
|
if (def.catchall?._zod.def.type === "never") {
|
|
52247
|
-
|
|
52247
|
+
json7.additionalProperties = false;
|
|
52248
52248
|
} else if (!def.catchall) {
|
|
52249
52249
|
if (ctx.io === "output")
|
|
52250
|
-
|
|
52250
|
+
json7.additionalProperties = false;
|
|
52251
52251
|
} else if (def.catchall) {
|
|
52252
|
-
|
|
52252
|
+
json7.additionalProperties = processSchema(def.catchall, ctx, {
|
|
52253
52253
|
...params,
|
|
52254
52254
|
path: [...params.path, "additionalProperties"]
|
|
52255
52255
|
});
|
|
52256
52256
|
}
|
|
52257
52257
|
};
|
|
52258
|
-
var unionProcessor = (schema, ctx,
|
|
52258
|
+
var unionProcessor = (schema, ctx, json7, params) => {
|
|
52259
52259
|
const def = schema._zod.def;
|
|
52260
52260
|
const isExclusive = def.inclusive === false;
|
|
52261
52261
|
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
@@ -52263,12 +52263,12 @@ var unionProcessor = (schema, ctx, json6, params) => {
|
|
|
52263
52263
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
52264
52264
|
}));
|
|
52265
52265
|
if (isExclusive) {
|
|
52266
|
-
|
|
52266
|
+
json7.oneOf = options;
|
|
52267
52267
|
} else {
|
|
52268
|
-
|
|
52268
|
+
json7.anyOf = options;
|
|
52269
52269
|
}
|
|
52270
52270
|
};
|
|
52271
|
-
var intersectionProcessor = (schema, ctx,
|
|
52271
|
+
var intersectionProcessor = (schema, ctx, json7, params) => {
|
|
52272
52272
|
const def = schema._zod.def;
|
|
52273
52273
|
const a = processSchema(def.left, ctx, {
|
|
52274
52274
|
...params,
|
|
@@ -52283,13 +52283,13 @@ var intersectionProcessor = (schema, ctx, json6, params) => {
|
|
|
52283
52283
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
52284
52284
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
52285
52285
|
];
|
|
52286
|
-
|
|
52286
|
+
json7.allOf = allOf;
|
|
52287
52287
|
ctx.intersections.push(allOf);
|
|
52288
52288
|
};
|
|
52289
52289
|
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
52290
|
-
const
|
|
52290
|
+
const json7 = _json;
|
|
52291
52291
|
const def = schema._zod.def;
|
|
52292
|
-
|
|
52292
|
+
json7.type = "array";
|
|
52293
52293
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
52294
52294
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
52295
52295
|
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
|
|
@@ -52311,70 +52311,70 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
52311
52311
|
const maxItems = def.items.length;
|
|
52312
52312
|
const isClosed = !def.rest;
|
|
52313
52313
|
if (ctx.target === "draft-2020-12") {
|
|
52314
|
-
|
|
52314
|
+
json7.prefixItems = prefixItems;
|
|
52315
52315
|
if (isClosed) {
|
|
52316
|
-
|
|
52316
|
+
json7.items = false;
|
|
52317
52317
|
} else if (rest) {
|
|
52318
|
-
|
|
52318
|
+
json7.items = rest;
|
|
52319
52319
|
}
|
|
52320
52320
|
if (minItems > 0)
|
|
52321
|
-
|
|
52321
|
+
json7.minItems = minItems;
|
|
52322
52322
|
if (isClosed)
|
|
52323
|
-
|
|
52323
|
+
json7.maxItems = maxItems;
|
|
52324
52324
|
} else if (ctx.target === "openapi-3.0") {
|
|
52325
|
-
|
|
52325
|
+
json7.items = {
|
|
52326
52326
|
anyOf: prefixItems
|
|
52327
52327
|
};
|
|
52328
52328
|
if (rest) {
|
|
52329
|
-
|
|
52329
|
+
json7.items.anyOf.push(rest);
|
|
52330
52330
|
}
|
|
52331
52331
|
if (minItems > 0)
|
|
52332
|
-
|
|
52332
|
+
json7.minItems = minItems;
|
|
52333
52333
|
if (isClosed)
|
|
52334
|
-
|
|
52334
|
+
json7.maxItems = maxItems;
|
|
52335
52335
|
} else {
|
|
52336
|
-
|
|
52336
|
+
json7.items = prefixItems;
|
|
52337
52337
|
if (isClosed) {
|
|
52338
|
-
|
|
52338
|
+
json7.additionalItems = false;
|
|
52339
52339
|
} else if (rest) {
|
|
52340
|
-
|
|
52340
|
+
json7.additionalItems = rest;
|
|
52341
52341
|
}
|
|
52342
52342
|
if (minItems > 0)
|
|
52343
|
-
|
|
52343
|
+
json7.minItems = minItems;
|
|
52344
52344
|
if (isClosed)
|
|
52345
|
-
|
|
52345
|
+
json7.maxItems = maxItems;
|
|
52346
52346
|
}
|
|
52347
52347
|
const { minimum, maximum } = aggregateChecks(schema);
|
|
52348
52348
|
if (typeof minimum === "number")
|
|
52349
|
-
|
|
52349
|
+
json7.minItems = minimum;
|
|
52350
52350
|
if (typeof maximum === "number")
|
|
52351
|
-
|
|
52351
|
+
json7.maxItems = maximum;
|
|
52352
52352
|
};
|
|
52353
|
-
function stringifyKeyNames(bySchema,
|
|
52354
|
-
if (
|
|
52355
|
-
if (visited.has(
|
|
52356
|
-
return
|
|
52357
|
-
visited.add(
|
|
52358
|
-
const def = bySchema.get(
|
|
52353
|
+
function stringifyKeyNames(bySchema, json7, visited) {
|
|
52354
|
+
if (json7.$ref) {
|
|
52355
|
+
if (visited.has(json7))
|
|
52356
|
+
return json7;
|
|
52357
|
+
visited.add(json7);
|
|
52358
|
+
const def = bySchema.get(json7)?.def;
|
|
52359
52359
|
if (!def)
|
|
52360
|
-
return
|
|
52360
|
+
return json7;
|
|
52361
52361
|
const inlined = stringifyKeyNames(bySchema, def, visited);
|
|
52362
|
-
return inlined === def ?
|
|
52362
|
+
return inlined === def ? json7 : inlined;
|
|
52363
52363
|
}
|
|
52364
52364
|
for (const keyword of ["anyOf", "oneOf"]) {
|
|
52365
|
-
const branches =
|
|
52365
|
+
const branches = json7[keyword];
|
|
52366
52366
|
if (!Array.isArray(branches))
|
|
52367
52367
|
continue;
|
|
52368
52368
|
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
|
|
52369
52369
|
if (mapped.some((branch, i) => branch !== branches[i]))
|
|
52370
|
-
|
|
52370
|
+
json7 = { ...json7, [keyword]: mapped };
|
|
52371
52371
|
}
|
|
52372
|
-
const types = Array.isArray(
|
|
52372
|
+
const types = Array.isArray(json7.type) ? json7.type : [json7.type];
|
|
52373
52373
|
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
|
|
52374
|
-
const values =
|
|
52374
|
+
const values = json7.enum ?? (json7.const !== void 0 ? [json7.const] : void 0);
|
|
52375
52375
|
if (!numericType && !values?.some((v) => typeof v === "number"))
|
|
52376
|
-
return
|
|
52377
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format: format2, id: id2, ...rest } =
|
|
52376
|
+
return json7;
|
|
52377
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format: format2, id: id2, ...rest } = json7;
|
|
52378
52378
|
if (rest.enum)
|
|
52379
52379
|
rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
|
|
52380
52380
|
else if (typeof rest.const === "number")
|
|
@@ -52414,9 +52414,9 @@ function rewriteKeyNames(ctx) {
|
|
|
52414
52414
|
}
|
|
52415
52415
|
}
|
|
52416
52416
|
var recordProcessor = (schema, ctx, _json, params) => {
|
|
52417
|
-
const
|
|
52417
|
+
const json7 = _json;
|
|
52418
52418
|
const def = schema._zod.def;
|
|
52419
|
-
|
|
52419
|
+
json7.type = "object";
|
|
52420
52420
|
const keyType = def.keyType;
|
|
52421
52421
|
const patterns = aggregateChecks(keyType).patterns;
|
|
52422
52422
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
@@ -52424,13 +52424,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
52424
52424
|
...params,
|
|
52425
52425
|
path: [...params.path, "patternProperties", "*"]
|
|
52426
52426
|
});
|
|
52427
|
-
|
|
52427
|
+
json7.patternProperties = {};
|
|
52428
52428
|
for (const pattern of patterns) {
|
|
52429
|
-
assignProp(
|
|
52429
|
+
assignProp(json7.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
52430
52430
|
}
|
|
52431
52431
|
} else {
|
|
52432
52432
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
52433
|
-
|
|
52433
|
+
json7.propertyNames = processSchema(def.keyType, ctx, {
|
|
52434
52434
|
...params,
|
|
52435
52435
|
path: [...params.path, "propertyNames"]
|
|
52436
52436
|
});
|
|
@@ -52442,7 +52442,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
52442
52442
|
}
|
|
52443
52443
|
pending2.push(schema);
|
|
52444
52444
|
}
|
|
52445
|
-
|
|
52445
|
+
json7.additionalProperties = processSchema(def.valueType, ctx, {
|
|
52446
52446
|
...params,
|
|
52447
52447
|
path: [...params.path, "additionalProperties"]
|
|
52448
52448
|
});
|
|
@@ -52452,19 +52452,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
52452
52452
|
if (keyValues && !def.partial && !omittableOnInput) {
|
|
52453
52453
|
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
52454
52454
|
if (validKeyValues.length > 0) {
|
|
52455
|
-
|
|
52455
|
+
json7.required = validKeyValues.map(String);
|
|
52456
52456
|
}
|
|
52457
52457
|
}
|
|
52458
52458
|
};
|
|
52459
|
-
var nullableProcessor = (schema, ctx,
|
|
52459
|
+
var nullableProcessor = (schema, ctx, json7, params) => {
|
|
52460
52460
|
const def = schema._zod.def;
|
|
52461
52461
|
const inner = processSchema(def.innerType, ctx, params);
|
|
52462
52462
|
const seen = ctx.seen.get(schema);
|
|
52463
52463
|
if (ctx.target === "openapi-3.0") {
|
|
52464
52464
|
seen.ref = def.innerType;
|
|
52465
|
-
|
|
52465
|
+
json7.nullable = true;
|
|
52466
52466
|
} else {
|
|
52467
|
-
|
|
52467
|
+
json7.anyOf = [inner, { type: "null" }];
|
|
52468
52468
|
}
|
|
52469
52469
|
};
|
|
52470
52470
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
@@ -52474,7 +52474,7 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
52474
52474
|
seen.ref = def.innerType;
|
|
52475
52475
|
};
|
|
52476
52476
|
var UNREPRESENTABLE_DEFAULT = /* @__PURE__ */ Symbol();
|
|
52477
|
-
function serializeDefaultValue(value, schema, ctx,
|
|
52477
|
+
function serializeDefaultValue(value, schema, ctx, json7, params) {
|
|
52478
52478
|
let unrepresentable = false;
|
|
52479
52479
|
const serialized = JSON.stringify(value, (_, val) => {
|
|
52480
52480
|
if (typeof val !== "bigint")
|
|
@@ -52484,30 +52484,30 @@ function serializeDefaultValue(value, schema, ctx, json6, params) {
|
|
|
52484
52484
|
});
|
|
52485
52485
|
if (!unrepresentable)
|
|
52486
52486
|
return JSON.parse(serialized);
|
|
52487
|
-
handleUnrepresentable(schema, ctx,
|
|
52487
|
+
handleUnrepresentable(schema, ctx, json7, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
52488
52488
|
return UNREPRESENTABLE_DEFAULT;
|
|
52489
52489
|
}
|
|
52490
|
-
var defaultProcessor = (schema, ctx,
|
|
52490
|
+
var defaultProcessor = (schema, ctx, json7, params) => {
|
|
52491
52491
|
const def = schema._zod.def;
|
|
52492
52492
|
processSchema(def.innerType, ctx, params);
|
|
52493
52493
|
const seen = ctx.seen.get(schema);
|
|
52494
52494
|
seen.ref = def.innerType;
|
|
52495
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
52495
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json7, params);
|
|
52496
52496
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
52497
|
-
|
|
52497
|
+
json7.default = value;
|
|
52498
52498
|
};
|
|
52499
|
-
var prefaultProcessor = (schema, ctx,
|
|
52499
|
+
var prefaultProcessor = (schema, ctx, json7, params) => {
|
|
52500
52500
|
const def = schema._zod.def;
|
|
52501
52501
|
processSchema(def.innerType, ctx, params);
|
|
52502
52502
|
const seen = ctx.seen.get(schema);
|
|
52503
52503
|
seen.ref = def.innerType;
|
|
52504
52504
|
if (ctx.io !== "input")
|
|
52505
52505
|
return;
|
|
52506
|
-
const value = serializeDefaultValue(def.defaultValue, schema, ctx,
|
|
52506
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json7, params);
|
|
52507
52507
|
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
52508
|
-
|
|
52508
|
+
json7._prefault = value;
|
|
52509
52509
|
};
|
|
52510
|
-
var catchProcessor = (schema, ctx,
|
|
52510
|
+
var catchProcessor = (schema, ctx, json7, params) => {
|
|
52511
52511
|
const def = schema._zod.def;
|
|
52512
52512
|
processSchema(def.innerType, ctx, params);
|
|
52513
52513
|
const seen = ctx.seen.get(schema);
|
|
@@ -52516,10 +52516,10 @@ var catchProcessor = (schema, ctx, json6, params) => {
|
|
|
52516
52516
|
try {
|
|
52517
52517
|
catchValue = def.catchValue(void 0);
|
|
52518
52518
|
} catch {
|
|
52519
|
-
handleUnrepresentable(schema, ctx,
|
|
52519
|
+
handleUnrepresentable(schema, ctx, json7, params, "Dynamic catch values are not supported in JSON Schema");
|
|
52520
52520
|
return;
|
|
52521
52521
|
}
|
|
52522
|
-
|
|
52522
|
+
json7.default = catchValue;
|
|
52523
52523
|
};
|
|
52524
52524
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
52525
52525
|
const def = schema._zod.def;
|
|
@@ -52529,12 +52529,12 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
52529
52529
|
const seen = ctx.seen.get(schema);
|
|
52530
52530
|
seen.ref = innerType;
|
|
52531
52531
|
};
|
|
52532
|
-
var readonlyProcessor = (schema, ctx,
|
|
52532
|
+
var readonlyProcessor = (schema, ctx, json7, params) => {
|
|
52533
52533
|
const def = schema._zod.def;
|
|
52534
52534
|
processSchema(def.innerType, ctx, params);
|
|
52535
52535
|
const seen = ctx.seen.get(schema);
|
|
52536
52536
|
seen.ref = def.innerType;
|
|
52537
|
-
|
|
52537
|
+
json7.readOnly = true;
|
|
52538
52538
|
};
|
|
52539
52539
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
52540
52540
|
const def = schema._zod.def;
|
|
@@ -53176,7 +53176,7 @@ var _ZodString = /* @__PURE__ */ $constructor(
|
|
|
53176
53176
|
(inst, def) => {
|
|
53177
53177
|
$ZodString.init(inst, def);
|
|
53178
53178
|
ZodType.init(inst, def);
|
|
53179
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53179
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => stringProcessor(inst, ctx, json7, params);
|
|
53180
53180
|
},
|
|
53181
53181
|
/* @__PURE__ */ util_exports.derived({
|
|
53182
53182
|
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
@@ -53535,7 +53535,7 @@ var ZodNumber = /* @__PURE__ */ $constructor(
|
|
|
53535
53535
|
(inst, def) => {
|
|
53536
53536
|
$ZodNumber.init(inst, def);
|
|
53537
53537
|
ZodType.init(inst, def);
|
|
53538
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53538
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => numberProcessor(inst, ctx, json7, params);
|
|
53539
53539
|
inst.isFinite = true;
|
|
53540
53540
|
},
|
|
53541
53541
|
/* @__PURE__ */ util_exports.derived({
|
|
@@ -53625,7 +53625,7 @@ function uint32(params) {
|
|
|
53625
53625
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
53626
53626
|
$ZodBoolean.init(inst, def);
|
|
53627
53627
|
ZodType.init(inst, def);
|
|
53628
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53628
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => booleanProcessor(inst, ctx, json7, params);
|
|
53629
53629
|
});
|
|
53630
53630
|
function boolean2(params) {
|
|
53631
53631
|
return _boolean(ZodBoolean, params);
|
|
@@ -53635,7 +53635,7 @@ var ZodBigInt = /* @__PURE__ */ $constructor(
|
|
|
53635
53635
|
(inst, def) => {
|
|
53636
53636
|
$ZodBigInt.init(inst, def);
|
|
53637
53637
|
ZodType.init(inst, def);
|
|
53638
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53638
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => bigintProcessor(inst, ctx, json7, params);
|
|
53639
53639
|
},
|
|
53640
53640
|
/* @__PURE__ */ util_exports.derived({
|
|
53641
53641
|
minValue: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
@@ -53693,7 +53693,7 @@ function uint64(params) {
|
|
|
53693
53693
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
53694
53694
|
$ZodSymbol.init(inst, def);
|
|
53695
53695
|
ZodType.init(inst, def);
|
|
53696
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53696
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => symbolProcessor(inst, ctx, json7, params);
|
|
53697
53697
|
});
|
|
53698
53698
|
function symbol(params) {
|
|
53699
53699
|
return _symbol(ZodSymbol, params);
|
|
@@ -53701,7 +53701,7 @@ function symbol(params) {
|
|
|
53701
53701
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
53702
53702
|
$ZodUndefined.init(inst, def);
|
|
53703
53703
|
ZodType.init(inst, def);
|
|
53704
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53704
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => undefinedProcessor(inst, ctx, json7, params);
|
|
53705
53705
|
});
|
|
53706
53706
|
function _undefined3(params) {
|
|
53707
53707
|
return _undefined2(ZodUndefined, params);
|
|
@@ -53709,7 +53709,7 @@ function _undefined3(params) {
|
|
|
53709
53709
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
53710
53710
|
$ZodNull.init(inst, def);
|
|
53711
53711
|
ZodType.init(inst, def);
|
|
53712
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53712
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => nullProcessor(inst, ctx, json7, params);
|
|
53713
53713
|
});
|
|
53714
53714
|
function _null3(params) {
|
|
53715
53715
|
return _null2(ZodNull, params);
|
|
@@ -53717,7 +53717,7 @@ function _null3(params) {
|
|
|
53717
53717
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
53718
53718
|
$ZodAny.init(inst, def);
|
|
53719
53719
|
ZodType.init(inst, def);
|
|
53720
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53720
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => anyProcessor(inst, ctx, json7, params);
|
|
53721
53721
|
});
|
|
53722
53722
|
function any() {
|
|
53723
53723
|
return _any(ZodAny);
|
|
@@ -53725,7 +53725,7 @@ function any() {
|
|
|
53725
53725
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
53726
53726
|
$ZodUnknown.init(inst, def);
|
|
53727
53727
|
ZodType.init(inst, def);
|
|
53728
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53728
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => unknownProcessor(inst, ctx, json7, params);
|
|
53729
53729
|
});
|
|
53730
53730
|
function unknown() {
|
|
53731
53731
|
return _unknown(ZodUnknown);
|
|
@@ -53733,7 +53733,7 @@ function unknown() {
|
|
|
53733
53733
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
53734
53734
|
$ZodNever.init(inst, def);
|
|
53735
53735
|
ZodType.init(inst, def);
|
|
53736
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53736
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => neverProcessor(inst, ctx, json7, params);
|
|
53737
53737
|
});
|
|
53738
53738
|
function never(params) {
|
|
53739
53739
|
return _never(ZodNever, params);
|
|
@@ -53741,7 +53741,7 @@ function never(params) {
|
|
|
53741
53741
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
53742
53742
|
$ZodVoid.init(inst, def);
|
|
53743
53743
|
ZodType.init(inst, def);
|
|
53744
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53744
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => voidProcessor(inst, ctx, json7, params);
|
|
53745
53745
|
});
|
|
53746
53746
|
function _void2(params) {
|
|
53747
53747
|
return _void(ZodVoid, params);
|
|
@@ -53751,7 +53751,7 @@ var ZodDate = /* @__PURE__ */ $constructor(
|
|
|
53751
53751
|
(inst, def) => {
|
|
53752
53752
|
$ZodDate.init(inst, def);
|
|
53753
53753
|
ZodType.init(inst, def);
|
|
53754
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53754
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => dateProcessor(inst, ctx, json7, params);
|
|
53755
53755
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
53756
53756
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
53757
53757
|
},
|
|
@@ -53773,7 +53773,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
53773
53773
|
_ensureDefaultMemoizer();
|
|
53774
53774
|
$ZodArray.init(inst, def);
|
|
53775
53775
|
ZodType.init(inst, def);
|
|
53776
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53776
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => arrayProcessor(inst, ctx, json7, params);
|
|
53777
53777
|
inst.element = def.element;
|
|
53778
53778
|
}, {
|
|
53779
53779
|
min(n, params) {
|
|
@@ -53803,7 +53803,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
53803
53803
|
_ensureDefaultMemoizer();
|
|
53804
53804
|
$ZodObjectJIT.init(inst, def);
|
|
53805
53805
|
ZodType.init(inst, def);
|
|
53806
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53806
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => objectProcessor(inst, ctx, json7, params);
|
|
53807
53807
|
util_exports.installLazyProp(inst, "shape", (self2) => self2._zod.def.shape, false);
|
|
53808
53808
|
}, {
|
|
53809
53809
|
keyof() {
|
|
@@ -53876,7 +53876,7 @@ function looseObject(shape, params) {
|
|
|
53876
53876
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
53877
53877
|
$ZodUnion.init(inst, def);
|
|
53878
53878
|
ZodType.init(inst, def);
|
|
53879
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53879
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => unionProcessor(inst, ctx, json7, params);
|
|
53880
53880
|
inst.options = def.options;
|
|
53881
53881
|
});
|
|
53882
53882
|
function union(options, params) {
|
|
@@ -53889,7 +53889,7 @@ function union(options, params) {
|
|
|
53889
53889
|
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
53890
53890
|
ZodUnion.init(inst, def);
|
|
53891
53891
|
$ZodXor.init(inst, def);
|
|
53892
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53892
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => unionProcessor(inst, ctx, json7, params);
|
|
53893
53893
|
inst.options = def.options;
|
|
53894
53894
|
});
|
|
53895
53895
|
function xor(options, params) {
|
|
@@ -53915,7 +53915,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
53915
53915
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
53916
53916
|
$ZodIntersection.init(inst, def);
|
|
53917
53917
|
ZodType.init(inst, def);
|
|
53918
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53918
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => intersectionProcessor(inst, ctx, json7, params);
|
|
53919
53919
|
});
|
|
53920
53920
|
function intersection(left, right) {
|
|
53921
53921
|
return new ZodIntersection({
|
|
@@ -53928,7 +53928,7 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
53928
53928
|
_ensureDefaultMemoizer();
|
|
53929
53929
|
$ZodTuple.init(inst, def);
|
|
53930
53930
|
ZodType.init(inst, def);
|
|
53931
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53931
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => tupleProcessor(inst, ctx, json7, params);
|
|
53932
53932
|
}, {
|
|
53933
53933
|
rest(rest) {
|
|
53934
53934
|
return this.clone({
|
|
@@ -53961,7 +53961,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
53961
53961
|
_ensureDefaultMemoizer();
|
|
53962
53962
|
$ZodRecord.init(inst, def);
|
|
53963
53963
|
ZodType.init(inst, def);
|
|
53964
|
-
inst._zod.processJSONSchema = (ctx,
|
|
53964
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => recordProcessor(inst, ctx, json7, params);
|
|
53965
53965
|
inst.keyType = def.keyType;
|
|
53966
53966
|
inst.valueType = def.valueType;
|
|
53967
53967
|
});
|
|
@@ -54003,7 +54003,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
|
54003
54003
|
_ensureDefaultMemoizer();
|
|
54004
54004
|
$ZodMap.init(inst, def);
|
|
54005
54005
|
ZodType.init(inst, def);
|
|
54006
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54006
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => mapProcessor(inst, ctx, json7, params);
|
|
54007
54007
|
inst.keyType = def.keyType;
|
|
54008
54008
|
inst.valueType = def.valueType;
|
|
54009
54009
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
@@ -54023,7 +54023,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
|
54023
54023
|
_ensureDefaultMemoizer();
|
|
54024
54024
|
$ZodSet.init(inst, def);
|
|
54025
54025
|
ZodType.init(inst, def);
|
|
54026
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54026
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => setProcessor(inst, ctx, json7, params);
|
|
54027
54027
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
54028
54028
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
54029
54029
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
@@ -54039,7 +54039,7 @@ function set(valueType, params) {
|
|
|
54039
54039
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
54040
54040
|
$ZodEnum.init(inst, def);
|
|
54041
54041
|
ZodType.init(inst, def);
|
|
54042
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54042
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => enumProcessor(inst, ctx, json7, params);
|
|
54043
54043
|
inst.enum = def.entries;
|
|
54044
54044
|
inst.options = [...inst._zod.values];
|
|
54045
54045
|
const keys2 = new Set(Object.keys(def.entries));
|
|
@@ -54092,7 +54092,7 @@ function nativeEnum(entries, params) {
|
|
|
54092
54092
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
54093
54093
|
$ZodLiteral.init(inst, def);
|
|
54094
54094
|
ZodType.init(inst, def);
|
|
54095
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54095
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => literalProcessor(inst, ctx, json7, params);
|
|
54096
54096
|
inst.values = new Set(def.values);
|
|
54097
54097
|
Object.defineProperty(inst, "value", {
|
|
54098
54098
|
get() {
|
|
@@ -54113,7 +54113,7 @@ function literal(value, params) {
|
|
|
54113
54113
|
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
54114
54114
|
$ZodFile.init(inst, def);
|
|
54115
54115
|
ZodType.init(inst, def);
|
|
54116
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54116
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => fileProcessor(inst, ctx, json7, params);
|
|
54117
54117
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
54118
54118
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
54119
54119
|
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
@@ -54125,7 +54125,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
54125
54125
|
_ensureDefaultMemoizer();
|
|
54126
54126
|
$ZodTransform.init(inst, def);
|
|
54127
54127
|
ZodType.init(inst, def);
|
|
54128
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54128
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => transformProcessor(inst, ctx, json7, params);
|
|
54129
54129
|
inst._zod.parse = (payload, _ctx) => {
|
|
54130
54130
|
if (_ctx.direction === "backward") {
|
|
54131
54131
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -54164,7 +54164,7 @@ function transform(fn) {
|
|
|
54164
54164
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
54165
54165
|
$ZodOptional.init(inst, def);
|
|
54166
54166
|
ZodType.init(inst, def);
|
|
54167
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54167
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => optionalProcessor(inst, ctx, json7, params);
|
|
54168
54168
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54169
54169
|
});
|
|
54170
54170
|
function optional(innerType) {
|
|
@@ -54176,7 +54176,7 @@ function optional(innerType) {
|
|
|
54176
54176
|
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
54177
54177
|
$ZodExactOptional.init(inst, def);
|
|
54178
54178
|
ZodType.init(inst, def);
|
|
54179
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54179
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => optionalProcessor(inst, ctx, json7, params);
|
|
54180
54180
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54181
54181
|
});
|
|
54182
54182
|
function exactOptional(innerType) {
|
|
@@ -54188,7 +54188,7 @@ function exactOptional(innerType) {
|
|
|
54188
54188
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
54189
54189
|
$ZodNullable.init(inst, def);
|
|
54190
54190
|
ZodType.init(inst, def);
|
|
54191
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54191
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => nullableProcessor(inst, ctx, json7, params);
|
|
54192
54192
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54193
54193
|
});
|
|
54194
54194
|
function nullable(innerType) {
|
|
@@ -54203,7 +54203,7 @@ function nullish2(innerType) {
|
|
|
54203
54203
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
54204
54204
|
$ZodDefault.init(inst, def);
|
|
54205
54205
|
ZodType.init(inst, def);
|
|
54206
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54206
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => defaultProcessor(inst, ctx, json7, params);
|
|
54207
54207
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54208
54208
|
inst.removeDefault = inst.unwrap;
|
|
54209
54209
|
});
|
|
@@ -54219,7 +54219,7 @@ function _default2(innerType, defaultValue) {
|
|
|
54219
54219
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
54220
54220
|
$ZodPrefault.init(inst, def);
|
|
54221
54221
|
ZodType.init(inst, def);
|
|
54222
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54222
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => prefaultProcessor(inst, ctx, json7, params);
|
|
54223
54223
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54224
54224
|
});
|
|
54225
54225
|
function prefault(innerType, defaultValue) {
|
|
@@ -54234,7 +54234,7 @@ function prefault(innerType, defaultValue) {
|
|
|
54234
54234
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
54235
54235
|
$ZodNonOptional.init(inst, def);
|
|
54236
54236
|
ZodType.init(inst, def);
|
|
54237
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54237
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => nonoptionalProcessor(inst, ctx, json7, params);
|
|
54238
54238
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54239
54239
|
});
|
|
54240
54240
|
function nonoptional(innerType, params) {
|
|
@@ -54247,7 +54247,7 @@ function nonoptional(innerType, params) {
|
|
|
54247
54247
|
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
54248
54248
|
$ZodSuccess.init(inst, def);
|
|
54249
54249
|
ZodType.init(inst, def);
|
|
54250
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54250
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => successProcessor(inst, ctx, json7, params);
|
|
54251
54251
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54252
54252
|
});
|
|
54253
54253
|
function success(innerType) {
|
|
@@ -54259,7 +54259,7 @@ function success(innerType) {
|
|
|
54259
54259
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
54260
54260
|
$ZodCatch.init(inst, def);
|
|
54261
54261
|
ZodType.init(inst, def);
|
|
54262
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54262
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => catchProcessor(inst, ctx, json7, params);
|
|
54263
54263
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54264
54264
|
inst.removeCatch = inst.unwrap;
|
|
54265
54265
|
});
|
|
@@ -54273,7 +54273,7 @@ function _catch2(innerType, catchValue) {
|
|
|
54273
54273
|
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
54274
54274
|
$ZodNaN.init(inst, def);
|
|
54275
54275
|
ZodType.init(inst, def);
|
|
54276
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54276
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => nanProcessor(inst, ctx, json7, params);
|
|
54277
54277
|
});
|
|
54278
54278
|
function nan(params) {
|
|
54279
54279
|
return _nan(ZodNaN, params);
|
|
@@ -54281,7 +54281,7 @@ function nan(params) {
|
|
|
54281
54281
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
54282
54282
|
$ZodPipe.init(inst, def);
|
|
54283
54283
|
ZodType.init(inst, def);
|
|
54284
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54284
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => pipeProcessor(inst, ctx, json7, params);
|
|
54285
54285
|
inst.in = def.in;
|
|
54286
54286
|
inst.out = def.out;
|
|
54287
54287
|
});
|
|
@@ -54323,7 +54323,7 @@ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) =>
|
|
|
54323
54323
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
54324
54324
|
$ZodReadonly.init(inst, def);
|
|
54325
54325
|
ZodType.init(inst, def);
|
|
54326
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54326
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => readonlyProcessor(inst, ctx, json7, params);
|
|
54327
54327
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54328
54328
|
});
|
|
54329
54329
|
function readonly(innerType) {
|
|
@@ -54335,7 +54335,7 @@ function readonly(innerType) {
|
|
|
54335
54335
|
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
54336
54336
|
$ZodTemplateLiteral.init(inst, def);
|
|
54337
54337
|
ZodType.init(inst, def);
|
|
54338
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54338
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => templateLiteralProcessor(inst, ctx, json7, params);
|
|
54339
54339
|
});
|
|
54340
54340
|
function templateLiteral(parts, params) {
|
|
54341
54341
|
return new ZodTemplateLiteral({
|
|
@@ -54347,7 +54347,7 @@ function templateLiteral(parts, params) {
|
|
|
54347
54347
|
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
54348
54348
|
$ZodLazy.init(inst, def);
|
|
54349
54349
|
ZodType.init(inst, def);
|
|
54350
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54350
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => lazyProcessor(inst, ctx, json7, params);
|
|
54351
54351
|
inst.unwrap = () => inst._zod.def.getter();
|
|
54352
54352
|
});
|
|
54353
54353
|
function lazy(getter) {
|
|
@@ -54359,7 +54359,7 @@ function lazy(getter) {
|
|
|
54359
54359
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
54360
54360
|
$ZodPromise.init(inst, def);
|
|
54361
54361
|
ZodType.init(inst, def);
|
|
54362
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54362
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => promiseProcessor(inst, ctx, json7, params);
|
|
54363
54363
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
54364
54364
|
});
|
|
54365
54365
|
function promise(innerType) {
|
|
@@ -54371,7 +54371,7 @@ function promise(innerType) {
|
|
|
54371
54371
|
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
54372
54372
|
$ZodFunction.init(inst, def);
|
|
54373
54373
|
ZodType.init(inst, def);
|
|
54374
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54374
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => functionProcessor(inst, ctx, json7, params);
|
|
54375
54375
|
});
|
|
54376
54376
|
function _function(params) {
|
|
54377
54377
|
return new ZodFunction({
|
|
@@ -54383,7 +54383,7 @@ function _function(params) {
|
|
|
54383
54383
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
54384
54384
|
$ZodCustom.init(inst, def);
|
|
54385
54385
|
ZodType.init(inst, def);
|
|
54386
|
-
inst._zod.processJSONSchema = (ctx,
|
|
54386
|
+
inst._zod.processJSONSchema = (ctx, json7, params) => customProcessor(inst, ctx, json7, params);
|
|
54387
54387
|
});
|
|
54388
54388
|
function check(fn) {
|
|
54389
54389
|
const ch = new $ZodCheck({
|
|
@@ -57622,6 +57622,7 @@ var FEATURE_NAMES = [
|
|
|
57622
57622
|
"chat",
|
|
57623
57623
|
"compute",
|
|
57624
57624
|
"connector",
|
|
57625
|
+
"discord",
|
|
57625
57626
|
"entitlement",
|
|
57626
57627
|
"external-connection",
|
|
57627
57628
|
"feature-flag",
|
|
@@ -57874,6 +57875,82 @@ var deviceGrantSummarySchema = deviceGrantSummarySchemaDefinition;
|
|
|
57874
57875
|
var ApiKeyApi = moduleApi()("api-key");
|
|
57875
57876
|
var apiKeyTrpc = defineTrpcContract("apiKey").mutation("create").withInput(createApiKeyInputSchema).withOutput(createdApiKeySchema).query("list").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(apiKeySummarySchema)).mutation("revoke").withInput(revokeApiKeyInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("listMine").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(personalApiKeySchema)).mutation("revokeMine").withInput(revokeApiKeyInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("deviceGrant").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), userCode: external_exports.string().min(1).max(20) })).withOutput(deviceGrantSummarySchema).mutation("approveDevice").withInput(decideDeviceGrantInputSchema).withOutput(external_exports.object({ approved: external_exports.literal(true) })).mutation("denyDevice").withInput(decideDeviceGrantInputSchema).withOutput(external_exports.object({ denied: external_exports.literal(true) })).build();
|
|
57876
57877
|
|
|
57878
|
+
// ../../modules/chat/contract/src/chat.emoji.ts
|
|
57879
|
+
var CUSTOM_EMOJI_MAX_BYTES = 256 * 1024;
|
|
57880
|
+
var CUSTOM_EMOJI_UPLOAD_MAX_BYTES = 5 * 1024 * 1024;
|
|
57881
|
+
var customEmojiNameSchema = external_exports.string().regex(/^[a-z0-9_+'-]{1,100}$/).describe("A custom emoji's name, as written between colons.");
|
|
57882
|
+
var typedEmojiNameSchema = external_exports.string().trim().max(200).transform((name3) => name3.replace(/^:(.*):$/, "$1"));
|
|
57883
|
+
var customEmojiTypeSchema = external_exports.enum(["image/png", "image/jpeg", "image/gif"]);
|
|
57884
|
+
var emojiAddPolicySchema = external_exports.enum(["everyone", "admins"]);
|
|
57885
|
+
var customEmojiAuthorSchema = external_exports.object({
|
|
57886
|
+
kind: external_exports.enum(["person", "agent"]),
|
|
57887
|
+
id: external_exports.string(),
|
|
57888
|
+
name: external_exports.string()
|
|
57889
|
+
});
|
|
57890
|
+
var customEmojiSchemaDefinition = external_exports.object({
|
|
57891
|
+
name: customEmojiNameSchema,
|
|
57892
|
+
/** The picture: Slack's address, or for a Laze emoji a link that lives until `urlExpiresAt`. */
|
|
57893
|
+
url: external_exports.string().max(4e3),
|
|
57894
|
+
source: external_exports.enum(["slack", "laze"]).optional(),
|
|
57895
|
+
/** Other names that show the same picture. */
|
|
57896
|
+
aliases: external_exports.array(external_exports.string()).optional(),
|
|
57897
|
+
/** Read the list again before this, for a fresh link. */
|
|
57898
|
+
urlExpiresAt: external_exports.iso.datetime().optional(),
|
|
57899
|
+
animated: external_exports.boolean().optional(),
|
|
57900
|
+
addedBy: customEmojiAuthorSchema.optional(),
|
|
57901
|
+
addedAt: external_exports.iso.datetime().optional(),
|
|
57902
|
+
/** Whether the reader may remove it: their own, or any for an admin. */
|
|
57903
|
+
removable: external_exports.boolean().optional()
|
|
57904
|
+
});
|
|
57905
|
+
var customEmojiSchema = customEmojiSchemaDefinition;
|
|
57906
|
+
var customEmojiListSchemaDefinition = external_exports.object({
|
|
57907
|
+
emoji: external_exports.array(customEmojiSchemaDefinition),
|
|
57908
|
+
addPolicy: emojiAddPolicySchema.optional(),
|
|
57909
|
+
/** Whether the reader may add emoji and aliases under the policy. */
|
|
57910
|
+
canAdd: external_exports.boolean().optional(),
|
|
57911
|
+
/** Whether the reader is an admin, who changes the policy and removes any emoji. */
|
|
57912
|
+
isAdmin: external_exports.boolean().optional()
|
|
57913
|
+
});
|
|
57914
|
+
var customEmojiListSchema = customEmojiListSchemaDefinition;
|
|
57915
|
+
var slackCustomEmojiSchema = external_exports.object({
|
|
57916
|
+
name: customEmojiNameSchema,
|
|
57917
|
+
url: external_exports.string().max(2e3).regex(/^https:\/\/[^\s()<>]+$/)
|
|
57918
|
+
});
|
|
57919
|
+
var saveCustomEmojiInputSchemaDefinition = external_exports.object({
|
|
57920
|
+
workspaceId: external_exports.string().min(1),
|
|
57921
|
+
emoji: external_exports.array(slackCustomEmojiSchema).max(1e4),
|
|
57922
|
+
/** Names the source no longer has, dropped from the workspace's set. */
|
|
57923
|
+
removed: external_exports.array(customEmojiNameSchema).max(1e4).default([])
|
|
57924
|
+
});
|
|
57925
|
+
var addCustomEmojiInputSchemaDefinition = external_exports.object({
|
|
57926
|
+
workspaceId: external_exports.string().min(1),
|
|
57927
|
+
name: typedEmojiNameSchema,
|
|
57928
|
+
contentType: external_exports.string().min(1).max(100),
|
|
57929
|
+
/** The picture, base64; at most 5 MB before it is made square. */
|
|
57930
|
+
dataBase64: external_exports.string().max(7e6),
|
|
57931
|
+
aliases: external_exports.array(typedEmojiNameSchema).max(20).default([])
|
|
57932
|
+
});
|
|
57933
|
+
var addCustomEmojiInputSchema = addCustomEmojiInputSchemaDefinition;
|
|
57934
|
+
var customEmojiNameInputSchemaDefinition = external_exports.object({
|
|
57935
|
+
workspaceId: external_exports.string().min(1),
|
|
57936
|
+
name: typedEmojiNameSchema
|
|
57937
|
+
});
|
|
57938
|
+
var customEmojiNameInputSchema = customEmojiNameInputSchemaDefinition;
|
|
57939
|
+
var addCustomEmojiAliasInputSchemaDefinition = external_exports.object({
|
|
57940
|
+
workspaceId: external_exports.string().min(1),
|
|
57941
|
+
/** The new name. */
|
|
57942
|
+
alias: typedEmojiNameSchema,
|
|
57943
|
+
/** The emoji, or one of its aliases, it stands for. */
|
|
57944
|
+
name: typedEmojiNameSchema
|
|
57945
|
+
});
|
|
57946
|
+
var addCustomEmojiAliasInputSchema = addCustomEmojiAliasInputSchemaDefinition;
|
|
57947
|
+
var setEmojiAddPolicyInputSchemaDefinition = external_exports.object({
|
|
57948
|
+
workspaceId: external_exports.string().min(1),
|
|
57949
|
+
addPolicy: emojiAddPolicySchema
|
|
57950
|
+
});
|
|
57951
|
+
var setEmojiAddPolicyInputSchema = setEmojiAddPolicyInputSchemaDefinition;
|
|
57952
|
+
var chatEmojiTrpc = defineTrpcContract("chat").query("customEmoji").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(customEmojiListSchema).mutation("addCustomEmoji").withInput(addCustomEmojiInputSchema).withOutput(customEmojiSchema).mutation("addCustomEmojiAlias").withInput(addCustomEmojiAliasInputSchema).withOutput(customEmojiSchema).mutation("removeCustomEmoji").withInput(customEmojiNameInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("setEmojiAddPolicy").withInput(setEmojiAddPolicyInputSchema).withOutput(customEmojiListSchema).build();
|
|
57953
|
+
|
|
57877
57954
|
// ../../modules/chat/contract/src/chat.gifs.ts
|
|
57878
57955
|
var GIF_QUERY_MAX = 100;
|
|
57879
57956
|
var searchGifsInputSchemaDefinition = external_exports.object({
|
|
@@ -58248,7 +58325,7 @@ var unfurlSchemaDefinition = external_exports.object({
|
|
|
58248
58325
|
/** The site has an icon, read with `unfurlImage` and part `icon`. */
|
|
58249
58326
|
icon: external_exports.boolean().default(false)
|
|
58250
58327
|
});
|
|
58251
|
-
var mirrorSourceSchema = external_exports.enum(["slack", "whatsapp_business", "laze"]);
|
|
58328
|
+
var mirrorSourceSchema = external_exports.enum(["slack", "whatsapp_business", "discord", "laze"]);
|
|
58252
58329
|
var mirrorDeliverySchema = external_exports.enum(["waiting", "failed"]);
|
|
58253
58330
|
var messageOriginSchemaDefinition = external_exports.object({
|
|
58254
58331
|
source: mirrorSourceSchema,
|
|
@@ -59266,19 +59343,6 @@ var hideUnfurlInputSchemaDefinition = external_exports.object({
|
|
|
59266
59343
|
unfurlId: idSchema4
|
|
59267
59344
|
});
|
|
59268
59345
|
var hideUnfurlInputSchema = hideUnfurlInputSchemaDefinition;
|
|
59269
|
-
var customEmojiNameSchema = external_exports.string().regex(/^[a-z0-9_+'-]{1,100}$/).describe("A custom emoji's name, as written between colons.");
|
|
59270
|
-
var customEmojiSchemaDefinition = external_exports.object({
|
|
59271
|
-
name: customEmojiNameSchema,
|
|
59272
|
-
url: external_exports.string().max(2e3).regex(/^https:\/\/[^\s()<>]+$/)
|
|
59273
|
-
});
|
|
59274
|
-
var customEmojiListSchemaDefinition = external_exports.object({ emoji: external_exports.array(customEmojiSchemaDefinition) });
|
|
59275
|
-
var customEmojiListSchema = customEmojiListSchemaDefinition;
|
|
59276
|
-
var saveCustomEmojiInputSchemaDefinition = external_exports.object({
|
|
59277
|
-
workspaceId: workspaceIdSchema,
|
|
59278
|
-
emoji: external_exports.array(customEmojiSchemaDefinition).max(1e4),
|
|
59279
|
-
/** Names the source no longer has, dropped from the workspace's set. */
|
|
59280
|
-
removed: external_exports.array(customEmojiNameSchema).max(1e4).default([])
|
|
59281
|
-
});
|
|
59282
59346
|
var unfurlImageInputSchemaDefinition = external_exports.object({
|
|
59283
59347
|
...hideUnfurlInputSchemaDefinition.shape,
|
|
59284
59348
|
/** The preview's picture, or the site's icon. */
|
|
@@ -59593,13 +59657,14 @@ var ChatApi = moduleApi()("chat");
|
|
|
59593
59657
|
var chatConversationsTrpc = defineTrpcContract("chat").query("overview").withInput(workspaceInputSchema).withOutput(chatOverviewSchema).query("unreadSummary").withInput(external_exports.object({})).withOutput(external_exports.array(workspaceUnreadSchema)).query("browse").withInput(workspaceInputSchema).withOutput(external_exports.array(browsableChannelSchema)).mutation("createChannel").withInput(createChannelInputSchema).withOutput(conversationSchema).mutation("join").withInput(channelInputSchema).withOutput(conversationSchema).mutation("leave").withInput(channelInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("updateChannel").withInput(updateChannelInputSchema).withOutput(conversationSchema).mutation("setDefaultAgent").withInput(setDefaultAgentInputSchema).withOutput(conversationSchema).query("logChannelHint").withInput(channelInputSchema).withOutput(logChannelHintSchema).mutation("dismissLogChannelHint").withInput(channelInputSchema).withOutput(external_exports.object({ dismissed: external_exports.literal(true) })).query("externalNotice").withInput(channelInputSchema).withOutput(externalNoticeSchema).mutation("dismissExternalNotice").withInput(dismissExternalNoticeInputSchema).withOutput(externalNoticeSchema).mutation("archiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("unarchiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("addMembers").withInput(addMembersInputSchema).withOutput(conversationSchema).mutation("removeMember").withInput(removeMemberInputSchema).withOutput(conversationSchema).mutation("openDirect").withInput(openDirectInputSchema).withOutput(conversationSchema).query("conversation").withInput(channelInputSchema).withOutput(conversationSchema).build();
|
|
59594
59658
|
var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
|
|
59595
59659
|
var chatMessagesTrpc = defineTrpcContract("chat").query("history").withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
|
|
59596
|
-
var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("
|
|
59660
|
+
var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
|
|
59597
59661
|
var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads").withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
|
|
59598
59662
|
var chatSessionTrpc = defineTrpcContract("chat").mutation("realtimeToken").withInput(workspaceInputSchema).withOutput(realtimeTokenSchema).query("drafts").withInput(workspaceInputSchema).withOutput(draftListSchema).mutation("saveDraft").withInput(saveDraftInputSchema).withOutput(draftSavedSchema).mutation("deleteDraft").withInput(deleteDraftInputSchema).withOutput(draftSavedSchema).query("sent").withInput(listSentInputSchema).withOutput(sentPageSchema).query("sidebarLayout").withInput(workspaceInputSchema).withOutput(sidebarLayoutSchema).mutation("editSidebar").withInput(editSidebarInputSchema).withOutput(sidebarLayoutSchema).mutation("star").withInput(starInputSchema).withOutput(starStatusSchema).query("starred").withInput(workspaceInputSchema).withOutput(starredListSchema).mutation("scrubSecrets").withInput(scrubChatInputSchema).withOutput(chatScrubReportSchema).mutation("restoreScrubbed").withInput(messageInputSchema).withOutput(messageSchema).build();
|
|
59599
59663
|
var chatScheduledTrpc = defineTrpcContract("chat").mutation("scheduleMessage").withInput(scheduleMessageInputSchema).withOutput(scheduledMessageSchema).query("scheduled").withInput(listScheduledInputSchema).withOutput(scheduledListSchema).mutation("editScheduled").withInput(editScheduledInputSchema).withOutput(scheduledMessageSchema).mutation("sendScheduledNow").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).mutation("cancelScheduled").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).build();
|
|
59600
59664
|
var chatPresenceTrpc = defineTrpcContract("chat").mutation("heartbeat").withInput(workspaceInputSchema).withOutput(heartbeatSchema).query("presence").withInput(workspaceInputSchema).withOutput(presenceListSchema).mutation("setStatus").withInput(setStatusInputSchema).withOutput(personPresenceSchema).mutation("clearStatus").withInput(workspaceInputSchema).withOutput(personPresenceSchema).mutation("setAway").withInput(setAwayInputSchema).withOutput(personPresenceSchema).build();
|
|
59601
59665
|
var chatTrpc = joinTrpcContracts(
|
|
59602
59666
|
"chat",
|
|
59667
|
+
chatEmojiTrpc,
|
|
59603
59668
|
chatConversationsTrpc,
|
|
59604
59669
|
chatChannelRolesTrpc,
|
|
59605
59670
|
chatMessagesTrpc,
|
|
@@ -60094,7 +60159,7 @@ function originsOf({ list: list11 }) {
|
|
|
60094
60159
|
return [...new Set(origins)];
|
|
60095
60160
|
}
|
|
60096
60161
|
var { appsDomain } = Config.define((c) => ({
|
|
60097
|
-
appsDomain: c.env("APPS_DOMAIN", external_exports.string().min(1).default("
|
|
60162
|
+
appsDomain: c.env("APPS_DOMAIN", external_exports.string().min(1).default("lazeapps.com"))
|
|
60098
60163
|
}));
|
|
60099
60164
|
var optionalNonBlank = external_exports.preprocess(
|
|
60100
60165
|
(value) => value === "" ? void 0 : value,
|
|
@@ -60594,6 +60659,8 @@ var realtimePublicationSchemaDefinition = external_exports.discriminatedUnion("t
|
|
|
60594
60659
|
channelId: external_exports.string()
|
|
60595
60660
|
}),
|
|
60596
60661
|
external_exports.object({ type: external_exports.literal("activity_added"), workspaceId: external_exports.string() }),
|
|
60662
|
+
/** The workspace's custom emoji or who may add them changed: read the list again. */
|
|
60663
|
+
external_exports.object({ type: external_exports.literal("custom_emoji_changed"), workspaceId: external_exports.string() }),
|
|
60597
60664
|
/** The reader's followed threads or their read state changed, on another device too. */
|
|
60598
60665
|
external_exports.object({ type: external_exports.literal("threads_changed"), workspaceId: external_exports.string() }),
|
|
60599
60666
|
/** The reader's saved items changed, or a reminder came due, on another device too. */
|
|
@@ -60655,11 +60722,13 @@ var chatConfig = Config.define((c) => ({
|
|
|
60655
60722
|
|
|
60656
60723
|
// ../../modules/chat/contract/src/chat.ui.ts
|
|
60657
60724
|
var chatUi = uiTokens("chat");
|
|
60725
|
+
var ChatEmojiNavSlot = chatUi.component("emoji-nav");
|
|
60658
60726
|
var ChatSidebarSlot = chatUi.component("sidebar");
|
|
60659
60727
|
var ChatConversationSlot = chatUi.component("conversation");
|
|
60660
60728
|
var ChatKeysSlot = chatUi.component("keys");
|
|
60661
60729
|
var ChatLiveHooksToken = chatUi.hooks("live");
|
|
60662
60730
|
var ChatUnreadHooksToken = chatUi.hooks("unread");
|
|
60731
|
+
var ChatPlaceHooksToken = chatUi.hooks("place");
|
|
60663
60732
|
var ChatPresenceHooksToken = chatUi.hooks("presence");
|
|
60664
60733
|
var ChatStatusDialogSlot = chatUi.component("status-dialog");
|
|
60665
60734
|
var ChatExternalPersonCardSlot = chatUi.extension("external-person-card");
|
|
@@ -65864,6 +65933,7 @@ var AgentLiveStepsSlot = agentUi.component("liveSteps");
|
|
|
65864
65933
|
var AgentCatchUpSlot = agentUi.component("catchUp");
|
|
65865
65934
|
var AgentSessionHooksToken = agentUi.hooks("session");
|
|
65866
65935
|
var AgentCreateDialogSlot = agentUi.component("createDialog");
|
|
65936
|
+
var AgentAddChoiceSlot = agentUi.component("addChoice");
|
|
65867
65937
|
var AgentEditDialogSlot = agentUi.component("editDialog");
|
|
65868
65938
|
var AgentFaceSlot = agentUi.component("face");
|
|
65869
65939
|
var AgentAccessSlot = agentUi.component("access");
|
|
@@ -66489,6 +66559,12 @@ var callerPinsPageSchemaDefinition = external_exports.object({ ...pinsPageSchema
|
|
|
66489
66559
|
var callerSavedPageSchemaDefinition = external_exports.object({ ...savedPageSchema.shape });
|
|
66490
66560
|
var callerSavedMarksSchemaDefinition = external_exports.object({ ...savedMarksSchema.shape });
|
|
66491
66561
|
var callerSavedStatusSchemaDefinition = external_exports.object({ ...savedStatusSchema.shape });
|
|
66562
|
+
var EMOJI_KEY_PATHS = {
|
|
66563
|
+
list: "/api/agents/me/emoji",
|
|
66564
|
+
add: "/api/agents/me/emoji/add",
|
|
66565
|
+
alias: "/api/agents/me/emoji/alias",
|
|
66566
|
+
remove: "/api/agents/me/emoji/remove"
|
|
66567
|
+
};
|
|
66492
66568
|
var CHAT_KEY_PATHS = {
|
|
66493
66569
|
thread: "/api/agents/me/chat/thread",
|
|
66494
66570
|
edit: "/api/agents/me/chat/edit",
|
|
@@ -66520,6 +66596,16 @@ var CHAT_KEY_PATHS = {
|
|
|
66520
66596
|
starred: "/api/agents/me/chat/starred"
|
|
66521
66597
|
};
|
|
66522
66598
|
|
|
66599
|
+
// ../../modules/agent/contract/src/agent-emoji.ts
|
|
66600
|
+
var callerEmojiSchemaDefinition = external_exports.object({ ...customEmojiSchema.shape });
|
|
66601
|
+
var callerEmojiListSchemaDefinition = external_exports.object({ ...customEmojiListSchema.shape });
|
|
66602
|
+
var emojiAddByKeyInputSchemaDefinition = addCustomEmojiInputSchema.omit({ workspaceId: true });
|
|
66603
|
+
var emojiAliasByKeyInputSchemaDefinition = addCustomEmojiAliasInputSchema.omit({
|
|
66604
|
+
workspaceId: true
|
|
66605
|
+
});
|
|
66606
|
+
var emojiNameByKeyInputSchemaDefinition = customEmojiNameInputSchema.omit({ workspaceId: true });
|
|
66607
|
+
var emojiRemovedSchemaDefinition = external_exports.object({ removed: external_exports.literal(true) });
|
|
66608
|
+
|
|
66523
66609
|
// ../../modules/agent/contract/src/agent-join-events.ts
|
|
66524
66610
|
var agentJoinRequestedPayloadSchemaDefinition = external_exports.object({
|
|
66525
66611
|
workspaceId: external_exports.string().min(1),
|
|
@@ -66738,11 +66824,11 @@ function printAccess({ context, args, access }) {
|
|
|
66738
66824
|
if (args.flags.json) return context.out(`${JSON.stringify(access, null, 2)}
|
|
66739
66825
|
`);
|
|
66740
66826
|
const people2 = access.people.map((person) => person.userId).join(", ") || "no one";
|
|
66741
|
-
const
|
|
66827
|
+
const channels3 = access.channels.map((channel) => `#${channel.name}`).join(", ") || "none";
|
|
66742
66828
|
context.out(
|
|
66743
66829
|
`${access.kind} agent, owned by ${access.ownerUserId}
|
|
66744
66830
|
People: ${people2}
|
|
66745
|
-
Channels: ${
|
|
66831
|
+
Channels: ${channels3}
|
|
66746
66832
|
`
|
|
66747
66833
|
);
|
|
66748
66834
|
}
|
|
@@ -67104,10 +67190,10 @@ function catchUpLinesOf(message2) {
|
|
|
67104
67190
|
];
|
|
67105
67191
|
if (older === 0) return lines2;
|
|
67106
67192
|
const channel = message2.channelKind === "public" || message2.channelKind === "private";
|
|
67107
|
-
const
|
|
67193
|
+
const history3 = `laze history ${channel ? `#${message2.channelName}` : message2.channelId}`;
|
|
67108
67194
|
const noun = older === 1 ? "message" : "messages";
|
|
67109
67195
|
const verb = older === 1 ? "is" : "are";
|
|
67110
|
-
const reads = `\`${
|
|
67196
|
+
const reads = `\`${history3} --before ${message2.messageId}\` reads them.`;
|
|
67111
67197
|
return [...lines2, `${older} older ${noun} in ${where} ${verb} left out; ${reads}`];
|
|
67112
67198
|
}
|
|
67113
67199
|
function formatInboxMessage({ message: message2 }) {
|
|
@@ -67283,6 +67369,23 @@ var openSlackDirectInputSchema = openSlackDirectInputSchemaDefinition;
|
|
|
67283
67369
|
var openedSlackDirectSchemaDefinition = external_exports.object({ channelId: external_exports.string() });
|
|
67284
67370
|
var openedSlackDirectSchema = openedSlackDirectSchemaDefinition;
|
|
67285
67371
|
|
|
67372
|
+
// ../../modules/slack/contract/src/slack-emoji.ts
|
|
67373
|
+
var slackEmojiSourceSchemaDefinition = external_exports.object({
|
|
67374
|
+
/** A Slack workspace is connected here, so its emoji can be imported. */
|
|
67375
|
+
connected: external_exports.boolean(),
|
|
67376
|
+
/** Its custom emoji pictures, aliases left out; null when Slack could not be asked. */
|
|
67377
|
+
available: external_exports.number().int().nonnegative().nullable()
|
|
67378
|
+
});
|
|
67379
|
+
var slackEmojiSourceSchema = slackEmojiSourceSchemaDefinition;
|
|
67380
|
+
var slackEmojiImportSchemaDefinition = external_exports.object({
|
|
67381
|
+
imported: external_exports.number().int().nonnegative(),
|
|
67382
|
+
/** Names Laze already had, or standard emoji names. */
|
|
67383
|
+
skipped: external_exports.number().int().nonnegative(),
|
|
67384
|
+
/** Pictures Slack would not hand over, or that could not be made small enough. */
|
|
67385
|
+
failed: external_exports.number().int().nonnegative()
|
|
67386
|
+
});
|
|
67387
|
+
var slackEmojiImportSchema = slackEmojiImportSchemaDefinition;
|
|
67388
|
+
|
|
67286
67389
|
// ../../modules/slack/contract/src/slack-link-prompt.ts
|
|
67287
67390
|
var slackLinkPromptKindSchema = external_exports.enum(["connect", "relink"]);
|
|
67288
67391
|
var slackLinkPromptSchemaDefinition = external_exports.object({
|
|
@@ -67863,7 +67966,7 @@ var slackSearchAnswerSchemaDefinition = external_exports.object({
|
|
|
67863
67966
|
var slackSearchAnswerSchema = slackSearchAnswerSchemaDefinition;
|
|
67864
67967
|
var SlackApi = moduleApi()("slack");
|
|
67865
67968
|
var workspaceInput3 = external_exports.object({ workspaceId: workspaceIdSchema14 });
|
|
67866
|
-
var slackTrpc = defineTrpcContract("slack").query("overview").withInput(workspaceInput3).withOutput(slackOverviewSchema).mutation("startSetup").withInput(startSlackSetupInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("beginSetup").withInput(beginSlackSetupInputSchema).withOutput(slackSetupSchema).mutation("saveAppCredentials").withInput(saveSlackAppCredentialsInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("installApp").withInput(installSlackAppInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startInstall").withInput(startSlackInstallInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startLink").withInput(startSlackLinkInputSchema).withOutput(startedSlackAuthorizeSchema).query("channels").withInput(slackTeamInputSchema).withOutput(external_exports.array(slackChannelViewSchema)).mutation("setMirror").withInput(setSlackMirrorInputSchema).withOutput(slackConnectionViewSchema).mutation("updateConnection").withInput(updateSlackConnectionInputSchema).withOutput(slackConnectionViewSchema).mutation("disconnect").withInput(slackTeamInputSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("unlink").withInput(slackTeamInputSchema).withOutput(slackConnectionViewSchema).query("linkPrompts").withInput(workspaceInput3).withOutput(slackLinkPromptsSchema).mutation("dismissLinkPrompt").withInput(dismissSlackLinkPromptInputSchema).withOutput(slackLinkPromptsSchema).query("people").withInput(slackPeopleInputSchema).withOutput(slackPeopleSchema).query("bookmarks").withInput(slackBookmarksInputSchema).withOutput(slackBookmarksSchema).query("profiles").withInput(slackProfilesInputSchema).withOutput(slackProfilesSchema).query("linkedNames").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(slackLinkedNamesSchema).query("externalPeople").withInput(slackExternalPeopleInputSchema).withOutput(slackExternalPeopleSchema).mutation("openDirect").withInput(openSlackDirectInputSchema).withOutput(openedSlackDirectSchema).mutation("updateApp").withInput(updateSlackAppInputSchema).withOutput(external_exports.object({ updated: external_exports.literal(true) })).query("history").withInput(slackHistoryInputSchema).withOutput(slackHistoryPageSchema).query("search").withInput(slackSearchInputSchema).withOutput(slackSearchAnswerSchema).query("movePreview").withInput(slackMoveChannelInputSchema).withOutput(slackMovePreviewSchema).mutation("startMoves").withInput(startSlackMovesInputSchema).withOutput(startedSlackMovesSchema).mutation("cancelMove").withInput(slackMoveInputSchema).withOutput(slackMoveViewSchema).query("moves").withInput(workspaceInput3).withOutput(slackMovesSchema).build();
|
|
67969
|
+
var slackTrpc = defineTrpcContract("slack").query("overview").withInput(workspaceInput3).withOutput(slackOverviewSchema).mutation("startSetup").withInput(startSlackSetupInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("beginSetup").withInput(beginSlackSetupInputSchema).withOutput(slackSetupSchema).mutation("saveAppCredentials").withInput(saveSlackAppCredentialsInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("installApp").withInput(installSlackAppInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startInstall").withInput(startSlackInstallInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startLink").withInput(startSlackLinkInputSchema).withOutput(startedSlackAuthorizeSchema).query("channels").withInput(slackTeamInputSchema).withOutput(external_exports.array(slackChannelViewSchema)).mutation("setMirror").withInput(setSlackMirrorInputSchema).withOutput(slackConnectionViewSchema).mutation("updateConnection").withInput(updateSlackConnectionInputSchema).withOutput(slackConnectionViewSchema).mutation("disconnect").withInput(slackTeamInputSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("unlink").withInput(slackTeamInputSchema).withOutput(slackConnectionViewSchema).query("linkPrompts").withInput(workspaceInput3).withOutput(slackLinkPromptsSchema).mutation("dismissLinkPrompt").withInput(dismissSlackLinkPromptInputSchema).withOutput(slackLinkPromptsSchema).query("people").withInput(slackPeopleInputSchema).withOutput(slackPeopleSchema).query("bookmarks").withInput(slackBookmarksInputSchema).withOutput(slackBookmarksSchema).query("profiles").withInput(slackProfilesInputSchema).withOutput(slackProfilesSchema).query("linkedNames").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(slackLinkedNamesSchema).query("externalPeople").withInput(slackExternalPeopleInputSchema).withOutput(slackExternalPeopleSchema).mutation("openDirect").withInput(openSlackDirectInputSchema).withOutput(openedSlackDirectSchema).mutation("updateApp").withInput(updateSlackAppInputSchema).withOutput(external_exports.object({ updated: external_exports.literal(true) })).query("history").withInput(slackHistoryInputSchema).withOutput(slackHistoryPageSchema).query("search").withInput(slackSearchInputSchema).withOutput(slackSearchAnswerSchema).query("movePreview").withInput(slackMoveChannelInputSchema).withOutput(slackMovePreviewSchema).mutation("startMoves").withInput(startSlackMovesInputSchema).withOutput(startedSlackMovesSchema).mutation("cancelMove").withInput(slackMoveInputSchema).withOutput(slackMoveViewSchema).query("moves").withInput(workspaceInput3).withOutput(slackMovesSchema).query("emojiSource").withInput(workspaceInput3).withOutput(slackEmojiSourceSchema).mutation("importEmoji").withInput(workspaceInput3).withOutput(slackEmojiImportSchema).build();
|
|
67867
67970
|
|
|
67868
67971
|
// ../../modules/slack/contract/src/slack-keys.ts
|
|
67869
67972
|
var SLACK_KEY_PATHS = {
|
|
@@ -68044,8 +68147,8 @@ function withoutShown({
|
|
|
68044
68147
|
laze,
|
|
68045
68148
|
limit
|
|
68046
68149
|
}) {
|
|
68047
|
-
const
|
|
68048
|
-
return { ...answer5, hits: answer5.hits.filter((hit) => !
|
|
68150
|
+
const shown2 = new Set(laze.hits.flatMap((hit) => hit.originKey ? [hit.originKey] : []));
|
|
68151
|
+
return { ...answer5, hits: answer5.hits.filter((hit) => !shown2.has(hit.key)).slice(0, limit) };
|
|
68049
68152
|
}
|
|
68050
68153
|
function slackTeamNoteOf(team) {
|
|
68051
68154
|
const where = `From Slack (${team.teamName})`;
|
|
@@ -68296,17 +68399,17 @@ async function dueFromSpool({
|
|
|
68296
68399
|
const entries = await readSpool({ path });
|
|
68297
68400
|
const pushed = entries.some((entry) => entry.pushedAt !== void 0);
|
|
68298
68401
|
const text2 = pushed ? await seen().catch(() => "") : "";
|
|
68299
|
-
const
|
|
68402
|
+
const shown2 = entries.filter(
|
|
68300
68403
|
(entry) => entry.pushedAt !== void 0 && text2.includes(entry.message.messageId)
|
|
68301
68404
|
);
|
|
68302
68405
|
await dropFromSpool({
|
|
68303
68406
|
context,
|
|
68304
68407
|
profile,
|
|
68305
|
-
messageIds:
|
|
68408
|
+
messageIds: shown2.map((entry) => entry.message.messageId)
|
|
68306
68409
|
});
|
|
68307
68410
|
const late = context.nowMs() - PUSH_GRACE_MS;
|
|
68308
68411
|
const settled2 = context.nowMs() - IN_FLIGHT_MS;
|
|
68309
|
-
return entries.filter((entry) => !
|
|
68412
|
+
return entries.filter((entry) => !shown2.includes(entry)).filter((entry) => !settledOnly || entry.takenAt <= settled2).filter((entry) => entry.pushedAt === void 0 || pushedToo && entry.pushedAt <= late).map((entry) => entry.message);
|
|
68310
68413
|
}
|
|
68311
68414
|
|
|
68312
68415
|
// src/services/harness-session.service.ts
|
|
@@ -68920,10 +69023,10 @@ async function textToSend({
|
|
|
68920
69023
|
var REQUEST_WAIT_SECONDS = 50;
|
|
68921
69024
|
async function listChannels({ context, args }) {
|
|
68922
69025
|
const { client } = await signedIn({ context, args });
|
|
68923
|
-
const
|
|
68924
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
69026
|
+
const channels3 = await client.get("/api/agents/me/channels");
|
|
69027
|
+
if (args.flags.json) return context.out(`${JSON.stringify(channels3, null, 2)}
|
|
68925
69028
|
`);
|
|
68926
|
-
for (const channel of
|
|
69029
|
+
for (const channel of channels3) {
|
|
68927
69030
|
const direct2 = ["dm", "group", "chat"].includes(channel.kind);
|
|
68928
69031
|
const name3 = channelLabelIn(channel);
|
|
68929
69032
|
const unread = channel.unread > 0 ? ` ${channel.unread} unread` : "";
|
|
@@ -68973,9 +69076,9 @@ function leavesLazeOf({
|
|
|
68973
69076
|
}) {
|
|
68974
69077
|
return async () => {
|
|
68975
69078
|
if (!channel) return true;
|
|
68976
|
-
const
|
|
69079
|
+
const channels3 = await client.get("/api/agents/me/channels");
|
|
68977
69080
|
const name3 = channel.trim().replace(/^#/, "").toLowerCase();
|
|
68978
|
-
const found =
|
|
69081
|
+
const found = channels3.find((one) => one.id === channel.trim()) ?? channels3.find((one) => one.name.length > 0 && one.name === name3);
|
|
68979
69082
|
return found ? found.leavesLaze : true;
|
|
68980
69083
|
};
|
|
68981
69084
|
}
|
|
@@ -70863,8 +70966,8 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
70863
70966
|
}
|
|
70864
70967
|
async call(method, params) {
|
|
70865
70968
|
const id2 = ++this.#nextId;
|
|
70866
|
-
const reply2 = await new Promise((
|
|
70867
|
-
this.#pending.set(id2,
|
|
70969
|
+
const reply2 = await new Promise((resolve21) => {
|
|
70970
|
+
this.#pending.set(id2, resolve21);
|
|
70868
70971
|
this.write({ id: id2, method, params });
|
|
70869
70972
|
});
|
|
70870
70973
|
if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
|
|
@@ -70876,12 +70979,12 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
70876
70979
|
/** Starts one turn; `done` settles when it completes, keeping its last agent message. */
|
|
70877
70980
|
async startTurn({ threadId, text: text2 }) {
|
|
70878
70981
|
const result = { answer: "" };
|
|
70879
|
-
const done = new Promise((
|
|
70982
|
+
const done = new Promise((resolve21) => {
|
|
70880
70983
|
const listen = (message2) => {
|
|
70881
70984
|
absorbTurnEvent({ result, message: message2 });
|
|
70882
70985
|
if (message2.method !== "turn/completed") return;
|
|
70883
70986
|
this.#listeners.delete(listen);
|
|
70884
|
-
|
|
70987
|
+
resolve21(result);
|
|
70885
70988
|
};
|
|
70886
70989
|
this.#listeners.add(listen);
|
|
70887
70990
|
});
|
|
@@ -71383,17 +71486,17 @@ function lazePluginFiles({
|
|
|
71383
71486
|
configPath
|
|
71384
71487
|
}) {
|
|
71385
71488
|
const line = (args) => cliLineOf({ program, args, configPath });
|
|
71386
|
-
const
|
|
71489
|
+
const json7 = (value) => `${JSON.stringify(value, null, 2)}
|
|
71387
71490
|
`;
|
|
71388
71491
|
const description = "Laze messages reach this session, and the laze tools to answer them";
|
|
71389
71492
|
const author = { name: "Laze", url: "https://laze.langwatch.ai" };
|
|
71390
71493
|
return {
|
|
71391
|
-
".claude-plugin/marketplace.json":
|
|
71494
|
+
".claude-plugin/marketplace.json": json7({
|
|
71392
71495
|
name: LAZE_PLUGIN,
|
|
71393
71496
|
owner: author,
|
|
71394
71497
|
plugins: [{ name: LAZE_PLUGIN, source: `./${LAZE_PLUGIN}`, description }]
|
|
71395
71498
|
}),
|
|
71396
|
-
"laze/plugin.json":
|
|
71499
|
+
"laze/plugin.json": json7({
|
|
71397
71500
|
$schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
71398
71501
|
name: LAZE_PLUGIN,
|
|
71399
71502
|
version: version2,
|
|
@@ -71404,24 +71507,24 @@ function lazePluginFiles({
|
|
|
71404
71507
|
extensions: { "ai.laze": { delivery: "ai.laze/delivery.json" } }
|
|
71405
71508
|
}),
|
|
71406
71509
|
"laze/skills/laze/SKILL.md": SKILL,
|
|
71407
|
-
"laze/ai.laze/delivery.json":
|
|
71510
|
+
"laze/ai.laze/delivery.json": json7({
|
|
71408
71511
|
about: "How a client that can run a background command and start a turn with its output delivers Laze messages. Run the command for the whole session; each block it prints is one message for the agent.",
|
|
71409
71512
|
command: [...NPX_CLI, "hook", "monitor"]
|
|
71410
71513
|
}),
|
|
71411
|
-
"laze/.claude-plugin/plugin.json":
|
|
71514
|
+
"laze/.claude-plugin/plugin.json": json7({
|
|
71412
71515
|
name: LAZE_PLUGIN,
|
|
71413
71516
|
version: version2,
|
|
71414
71517
|
description,
|
|
71415
71518
|
author
|
|
71416
71519
|
}),
|
|
71417
|
-
"laze/monitors/monitors.json":
|
|
71520
|
+
"laze/monitors/monitors.json": json7([
|
|
71418
71521
|
{
|
|
71419
71522
|
name: "laze-messages",
|
|
71420
71523
|
command: line(["hook", "monitor"]),
|
|
71421
71524
|
description: "Laze messages for this session"
|
|
71422
71525
|
}
|
|
71423
71526
|
]),
|
|
71424
|
-
"laze/hooks/hooks.json":
|
|
71527
|
+
"laze/hooks/hooks.json": json7(pluginHooksOf({ line }))
|
|
71425
71528
|
};
|
|
71426
71529
|
}
|
|
71427
71530
|
|
|
@@ -71730,11 +71833,11 @@ async function listAgents({ context, args }) {
|
|
|
71730
71833
|
const { client } = await signedIn({ context, args });
|
|
71731
71834
|
const agents = await client.get("/api/agents");
|
|
71732
71835
|
const wanted = args.words[2];
|
|
71733
|
-
const
|
|
71734
|
-
if (wanted &&
|
|
71735
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
71836
|
+
const shown2 = wanted ? agents.filter((agent2) => agent2.id === wanted || agent2.name === wanted) : agents;
|
|
71837
|
+
if (wanted && shown2.length === 0) throw new CliUsageError(`No agent named ${wanted}.`);
|
|
71838
|
+
if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
|
|
71736
71839
|
`);
|
|
71737
|
-
for (const agent2 of
|
|
71840
|
+
for (const agent2 of shown2) context.out(`${lineOf(agent2)}
|
|
71738
71841
|
`);
|
|
71739
71842
|
}
|
|
71740
71843
|
async function showAgent({ context, args }) {
|
|
@@ -71746,10 +71849,10 @@ async function showAgent({ context, args }) {
|
|
|
71746
71849
|
if (!agent2) throw new CliUsageError(`No agent named ${wanted}.`);
|
|
71747
71850
|
const members3 = await client.get("/api/workspaces/current/members");
|
|
71748
71851
|
const ownerName = members3.find((member) => member.userId === agent2.ownerUserId)?.name ?? "";
|
|
71749
|
-
const
|
|
71750
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
71852
|
+
const shown2 = agentProfileOf({ agent: agent2, ownerName, baseUrl: profile.url });
|
|
71853
|
+
if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
|
|
71751
71854
|
`);
|
|
71752
|
-
context.out(formatAgentProfile({ profile:
|
|
71855
|
+
context.out(formatAgentProfile({ profile: shown2 }));
|
|
71753
71856
|
}
|
|
71754
71857
|
async function harnessOf2({ context, args }) {
|
|
71755
71858
|
const named = flagText({ args, name: "harness" });
|
|
@@ -72106,9 +72209,9 @@ function formatLogins({ list: list11, nowMs }) {
|
|
|
72106
72209
|
const lines2 = list11.logins.map((login2) => {
|
|
72107
72210
|
const state = login2.agentsOnIt > 0 ? `in use by ${login2.agentsOnIt} ${login2.agentsOnIt === 1 ? "agent" : "agents"}` : "ready";
|
|
72108
72211
|
const usage = usageOf2({ ...login2, nowMs });
|
|
72109
|
-
let
|
|
72110
|
-
if (login2.state === "invalid")
|
|
72111
|
-
const line = `${HARNESS_NAMES2[login2.harness]} ${login2.name} (${
|
|
72212
|
+
let shown2 = usage.startsWith("out of usage") ? usage : `${state}, ${usage}`;
|
|
72213
|
+
if (login2.state === "invalid") shown2 = INVALID2;
|
|
72214
|
+
const line = `${HARNESS_NAMES2[login2.harness]} ${login2.name} (${shown2}) ${login2.id}`;
|
|
72112
72215
|
return login2.expiresSoon ? `${line}
|
|
72113
72216
|
${EXPIRES_SOON}` : line;
|
|
72114
72217
|
});
|
|
@@ -75831,16 +75934,16 @@ async function serveAppFolder({
|
|
|
75831
75934
|
(error62) => failed({ response, error: error62 })
|
|
75832
75935
|
);
|
|
75833
75936
|
});
|
|
75834
|
-
await new Promise((
|
|
75937
|
+
await new Promise((resolve21, reject) => {
|
|
75835
75938
|
server.once("error", reject);
|
|
75836
|
-
server.listen(port, "127.0.0.1", () =>
|
|
75939
|
+
server.listen(port, "127.0.0.1", () => resolve21());
|
|
75837
75940
|
});
|
|
75838
75941
|
const { port: bound } = server.address();
|
|
75839
75942
|
return {
|
|
75840
75943
|
url: `http://127.0.0.1:${bound}/`,
|
|
75841
|
-
close: () => new Promise((
|
|
75944
|
+
close: () => new Promise((resolve21) => {
|
|
75842
75945
|
server.closeAllConnections();
|
|
75843
|
-
server.close(() =>
|
|
75946
|
+
server.close(() => resolve21());
|
|
75844
75947
|
})
|
|
75845
75948
|
};
|
|
75846
75949
|
}
|
|
@@ -77734,9 +77837,9 @@ If the site needs a sign-in, run \`laze browser ask ${tab.id} "Sign in to <site>
|
|
|
77734
77837
|
`
|
|
77735
77838
|
);
|
|
77736
77839
|
}
|
|
77737
|
-
async function listTabs({ context, client, channel, json:
|
|
77840
|
+
async function listTabs({ context, client, channel, json: json7, print: print9 }) {
|
|
77738
77841
|
const { tabs } = await client.post(BROWSER_TAB_PATHS.list, channel);
|
|
77739
|
-
if (
|
|
77842
|
+
if (json7) return print9(tabs, "");
|
|
77740
77843
|
if (tabs.length === 0)
|
|
77741
77844
|
return context.out("No browser tabs here. `laze browser open <url>` opens one.\n");
|
|
77742
77845
|
for (const tab of tabs) context.out(tabLine(tab));
|
|
@@ -77804,7 +77907,7 @@ async function waitForDone({
|
|
|
77804
77907
|
return 75;
|
|
77805
77908
|
}
|
|
77806
77909
|
async function loginOnTab(run4) {
|
|
77807
|
-
const { context, args, client, channel, json:
|
|
77910
|
+
const { context, args, client, channel, json: json7 } = run4;
|
|
77808
77911
|
const tab = word({ args, at: 2 });
|
|
77809
77912
|
const connection = flagText({ args, name: "vault" });
|
|
77810
77913
|
if (!connection)
|
|
@@ -77853,7 +77956,7 @@ ${BROWSER_TAB_USAGE}`
|
|
|
77853
77956
|
nowMs: context.nowMs()
|
|
77854
77957
|
}) : null;
|
|
77855
77958
|
const { screenshot: _shown, ...rest } = answer5;
|
|
77856
|
-
if (
|
|
77959
|
+
if (json7) context.out(`${JSON.stringify({ ...rest, screenshotPath }, null, 2)}
|
|
77857
77960
|
`);
|
|
77858
77961
|
else context.out(loginText({ answer: answer5, tab, screenshotPath }));
|
|
77859
77962
|
return answer5.state === "refused" || answer5.state === "still_on_form" ? 1 : 0;
|
|
@@ -77927,10 +78030,10 @@ async function browserTab({
|
|
|
77927
78030
|
}) {
|
|
77928
78031
|
const handler = TAB_RUNS[args.words[1] ?? ""];
|
|
77929
78032
|
if (!handler) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
77930
|
-
const
|
|
77931
|
-
const print9 = (value, text2) => context.out(
|
|
78033
|
+
const json7 = Boolean(args.flags.json);
|
|
78034
|
+
const print9 = (value, text2) => context.out(json7 ? `${JSON.stringify(value, null, 2)}
|
|
77932
78035
|
` : text2);
|
|
77933
|
-
return handler({ context, args, client, channel: channelOf({ context, args }), json:
|
|
78036
|
+
return handler({ context, args, client, channel: channelOf({ context, args }), json: json7, print: print9 });
|
|
77934
78037
|
}
|
|
77935
78038
|
async function browserTabCdp({
|
|
77936
78039
|
context,
|
|
@@ -77976,7 +78079,7 @@ function tunnel({
|
|
|
77976
78079
|
host: host2,
|
|
77977
78080
|
port
|
|
77978
78081
|
}) {
|
|
77979
|
-
return new Promise((
|
|
78082
|
+
return new Promise((resolve21, reject) => {
|
|
77980
78083
|
const socket = connectTcp(proxy.port, proxy.host);
|
|
77981
78084
|
let answer5 = "";
|
|
77982
78085
|
const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
|
|
@@ -77993,7 +78096,7 @@ ${auth}\r
|
|
|
77993
78096
|
answer5 += chunk.toString("latin1");
|
|
77994
78097
|
if (!answer5.includes(HEADER_END)) return;
|
|
77995
78098
|
socket.off("data", onData);
|
|
77996
|
-
if (/^HTTP\/1\.[01] 200/.test(answer5)) return
|
|
78099
|
+
if (/^HTTP\/1\.[01] 200/.test(answer5)) return resolve21(socket);
|
|
77997
78100
|
socket.destroy();
|
|
77998
78101
|
reject(new Error(`proxy refused the tunnel: ${answer5.split("\r\n")[0] ?? ""}`));
|
|
77999
78102
|
};
|
|
@@ -78006,8 +78109,8 @@ async function upstreamOf({ target, proxy }) {
|
|
|
78006
78109
|
const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
|
|
78007
78110
|
if (!secure) return raw;
|
|
78008
78111
|
const tls = connectTls({ socket: raw, servername: target.hostname });
|
|
78009
|
-
await new Promise((
|
|
78010
|
-
tls.once("secureConnect", () =>
|
|
78112
|
+
await new Promise((resolve21, reject) => {
|
|
78113
|
+
tls.once("secureConnect", () => resolve21());
|
|
78011
78114
|
tls.once("error", reject);
|
|
78012
78115
|
});
|
|
78013
78116
|
return tls;
|
|
@@ -78049,8 +78152,8 @@ async function browserSocket({
|
|
|
78049
78152
|
createConnection: () => upstream,
|
|
78050
78153
|
perMessageDeflate: false
|
|
78051
78154
|
});
|
|
78052
|
-
await new Promise((
|
|
78053
|
-
socket.once("open", () =>
|
|
78155
|
+
await new Promise((resolve21, reject) => {
|
|
78156
|
+
socket.once("open", () => resolve21());
|
|
78054
78157
|
socket.once("error", reject);
|
|
78055
78158
|
});
|
|
78056
78159
|
return socket;
|
|
@@ -78063,12 +78166,12 @@ async function browserCall({
|
|
|
78063
78166
|
}) {
|
|
78064
78167
|
const socket = await browserSocket({ target, proxy });
|
|
78065
78168
|
try {
|
|
78066
|
-
return await new Promise((
|
|
78169
|
+
return await new Promise((resolve21, reject) => {
|
|
78067
78170
|
socket.on("message", (data) => {
|
|
78068
78171
|
const reply2 = JSON.parse(textOf2(data));
|
|
78069
78172
|
if (reply2.id !== 1) return;
|
|
78070
78173
|
if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
|
|
78071
|
-
else
|
|
78174
|
+
else resolve21(reply2.result ?? {});
|
|
78072
78175
|
});
|
|
78073
78176
|
socket.once(
|
|
78074
78177
|
"close",
|
|
@@ -78232,18 +78335,18 @@ function retargetCdpBridge({
|
|
|
78232
78335
|
target,
|
|
78233
78336
|
expiresAt
|
|
78234
78337
|
}) {
|
|
78235
|
-
return new Promise((
|
|
78338
|
+
return new Promise((resolve21) => {
|
|
78236
78339
|
const call = httpRequest(
|
|
78237
78340
|
{ host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
|
|
78238
78341
|
(response) => {
|
|
78239
78342
|
response.resume();
|
|
78240
|
-
|
|
78343
|
+
resolve21(response.statusCode === 204);
|
|
78241
78344
|
}
|
|
78242
78345
|
);
|
|
78243
78346
|
call.setHeader(KEY_HEADER, key);
|
|
78244
78347
|
call.setHeader("content-type", "application/json");
|
|
78245
78348
|
call.once("timeout", () => call.destroy());
|
|
78246
|
-
call.once("error", () =>
|
|
78349
|
+
call.once("error", () => resolve21(false));
|
|
78247
78350
|
call.end(JSON.stringify({ target, expiresAt }));
|
|
78248
78351
|
});
|
|
78249
78352
|
}
|
|
@@ -78292,15 +78395,15 @@ async function startCdpBridge({
|
|
|
78292
78395
|
(socket) => relayPage({ client: socket, targetId, target: url2, proxy })
|
|
78293
78396
|
);
|
|
78294
78397
|
});
|
|
78295
|
-
await new Promise((
|
|
78398
|
+
await new Promise((resolve21) => server.listen(0, "127.0.0.1", resolve21));
|
|
78296
78399
|
const port = server.address().port;
|
|
78297
78400
|
return {
|
|
78298
78401
|
port,
|
|
78299
|
-
close: () => new Promise((
|
|
78402
|
+
close: () => new Promise((resolve21) => {
|
|
78300
78403
|
for (const client of relayed) client.destroy();
|
|
78301
78404
|
pages.close();
|
|
78302
78405
|
server.closeAllConnections();
|
|
78303
|
-
server.close(() =>
|
|
78406
|
+
server.close(() => resolve21());
|
|
78304
78407
|
})
|
|
78305
78408
|
};
|
|
78306
78409
|
}
|
|
@@ -78317,18 +78420,18 @@ function launchCdpBridge({
|
|
|
78317
78420
|
stdio: ["ignore", "pipe", "ignore"],
|
|
78318
78421
|
env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
|
|
78319
78422
|
});
|
|
78320
|
-
return new Promise((
|
|
78321
|
-
let
|
|
78423
|
+
return new Promise((resolve21, reject) => {
|
|
78424
|
+
let printed2 = "";
|
|
78322
78425
|
child.once("error", reject);
|
|
78323
78426
|
child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
|
|
78324
78427
|
child.stdout.on("data", (chunk) => {
|
|
78325
|
-
|
|
78326
|
-
const port = Number(
|
|
78327
|
-
if (!
|
|
78428
|
+
printed2 += chunk.toString("utf8");
|
|
78429
|
+
const port = Number(printed2.split("\n")[0]);
|
|
78430
|
+
if (!printed2.includes("\n")) return;
|
|
78328
78431
|
child.stdout.destroy();
|
|
78329
78432
|
child.removeAllListeners("exit");
|
|
78330
78433
|
child.unref();
|
|
78331
|
-
if (Number.isInteger(port) && port > 0)
|
|
78434
|
+
if (Number.isInteger(port) && port > 0) resolve21(port);
|
|
78332
78435
|
else reject(new Error("the CDP bridge printed no port"));
|
|
78333
78436
|
});
|
|
78334
78437
|
});
|
|
@@ -78626,10 +78729,10 @@ function extendedLine({ detail }) {
|
|
|
78626
78729
|
`;
|
|
78627
78730
|
}
|
|
78628
78731
|
function formatBrowsable({
|
|
78629
|
-
channels:
|
|
78732
|
+
channels: channels3
|
|
78630
78733
|
}) {
|
|
78631
|
-
if (
|
|
78632
|
-
const rows =
|
|
78734
|
+
if (channels3.length === 0) return "No channels to browse.\n";
|
|
78735
|
+
const rows = channels3.map((channel) => {
|
|
78633
78736
|
const count5 = `${channel.memberCount} ${channel.memberCount === 1 ? "member" : "members"}`;
|
|
78634
78737
|
const marks = [
|
|
78635
78738
|
channel.joined ? "joined" : "not joined",
|
|
@@ -78919,13 +79022,13 @@ function channelOf2({ args, usage }) {
|
|
|
78919
79022
|
}
|
|
78920
79023
|
async function channelBrowse({ context, args }) {
|
|
78921
79024
|
const { client } = await signedIn({ context, args });
|
|
78922
|
-
const
|
|
79025
|
+
const channels3 = await client.post(
|
|
78923
79026
|
"/api/agents/me/channels/browse",
|
|
78924
79027
|
{}
|
|
78925
79028
|
);
|
|
78926
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
79029
|
+
if (args.flags.json) return context.out(`${JSON.stringify(channels3, null, 2)}
|
|
78927
79030
|
`);
|
|
78928
|
-
context.out(formatBrowsable({ channels:
|
|
79031
|
+
context.out(formatBrowsable({ channels: channels3 }));
|
|
78929
79032
|
}
|
|
78930
79033
|
async function channelJoin({ context, args }) {
|
|
78931
79034
|
const channel = channelOf2({ args, usage: "Usage: laze channel join <channel>" });
|
|
@@ -79122,19 +79225,19 @@ async function channelUnmute({ context, args }) {
|
|
|
79122
79225
|
async function channelSettings({ context, args }) {
|
|
79123
79226
|
const wanted = args.words[2]?.trim();
|
|
79124
79227
|
const { client } = await signedIn({ context, args });
|
|
79125
|
-
const
|
|
79228
|
+
const channels3 = (await client.get("/api/agents/me/channels")).filter(isChannel);
|
|
79126
79229
|
const name3 = wanted?.replace(/^#/, "").toLowerCase();
|
|
79127
|
-
const
|
|
79128
|
-
if (wanted &&
|
|
79230
|
+
const shown2 = wanted ? channels3.filter((channel) => channel.id === wanted || channel.name === name3) : channels3;
|
|
79231
|
+
if (wanted && shown2.length === 0) {
|
|
79129
79232
|
throw new CliUsageError(`You are not in ${wanted}. laze channel settings lists your channels.`);
|
|
79130
79233
|
}
|
|
79131
79234
|
if (args.flags.json) {
|
|
79132
|
-
const value = wanted ?
|
|
79235
|
+
const value = wanted ? shown2[0] : shown2;
|
|
79133
79236
|
return context.out(`${JSON.stringify(value, null, 2)}
|
|
79134
79237
|
`);
|
|
79135
79238
|
}
|
|
79136
|
-
if (
|
|
79137
|
-
for (const channel of
|
|
79239
|
+
if (shown2.length === 0) return context.out("You are in no channels.\n");
|
|
79240
|
+
for (const channel of shown2) context.out(settingRowOf({ channel }));
|
|
79138
79241
|
}
|
|
79139
79242
|
|
|
79140
79243
|
// src/services/chat-actions-commands.service.ts
|
|
@@ -82611,6 +82714,524 @@ async function conversationDelete({ context, args }) {
|
|
|
82611
82714
|
`);
|
|
82612
82715
|
}
|
|
82613
82716
|
|
|
82717
|
+
// src/services/discord-commands.service.ts
|
|
82718
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
82719
|
+
import { resolve as resolve9 } from "node:path";
|
|
82720
|
+
|
|
82721
|
+
// ../../modules/discord/contract/src/discord.ts
|
|
82722
|
+
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
82723
|
+
var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
82724
|
+
var discordIdSchema = external_exports.string().regex(/^\d{5,25}$/);
|
|
82725
|
+
var DISCORD_PERMISSIONS = {
|
|
82726
|
+
ADMINISTRATOR: 1n << 3n,
|
|
82727
|
+
ADD_REACTIONS: 1n << 6n,
|
|
82728
|
+
VIEW_CHANNEL: 1n << 10n,
|
|
82729
|
+
SEND_MESSAGES: 1n << 11n,
|
|
82730
|
+
EMBED_LINKS: 1n << 14n,
|
|
82731
|
+
ATTACH_FILES: 1n << 15n,
|
|
82732
|
+
READ_MESSAGE_HISTORY: 1n << 16n,
|
|
82733
|
+
MANAGE_WEBHOOKS: 1n << 29n,
|
|
82734
|
+
CREATE_PUBLIC_THREADS: 1n << 35n,
|
|
82735
|
+
SEND_MESSAGES_IN_THREADS: 1n << 38n
|
|
82736
|
+
};
|
|
82737
|
+
var discordSetupDefinition = external_exports.object({
|
|
82738
|
+
setupKey: external_exports.string().min(1),
|
|
82739
|
+
/** The OAuth2 redirect to add in the portal. */
|
|
82740
|
+
redirectUrl: external_exports.url(),
|
|
82741
|
+
/** The Developer Portal's applications page. */
|
|
82742
|
+
portalUrl: external_exports.url(),
|
|
82743
|
+
/** A bot was saved: the setup resumes at "Add to server". */
|
|
82744
|
+
saved: external_exports.boolean(),
|
|
82745
|
+
applicationId: external_exports.string().nullable()
|
|
82746
|
+
});
|
|
82747
|
+
var discordSetupSchema = discordSetupDefinition;
|
|
82748
|
+
var discordLinkViewDefinition = external_exports.object({
|
|
82749
|
+
discordUserId: discordIdSchema,
|
|
82750
|
+
name: external_exports.string(),
|
|
82751
|
+
avatarUrl: external_exports.string().nullable()
|
|
82752
|
+
});
|
|
82753
|
+
var discordConnectionStatusSchema = external_exports.enum([
|
|
82754
|
+
"connected",
|
|
82755
|
+
"needs_attention",
|
|
82756
|
+
"bot_removed"
|
|
82757
|
+
]);
|
|
82758
|
+
var discordConnectionViewDefinition = external_exports.object({
|
|
82759
|
+
guildId: discordIdSchema,
|
|
82760
|
+
guildName: external_exports.string(),
|
|
82761
|
+
guildIconUrl: external_exports.string().nullable(),
|
|
82762
|
+
/** How the server shows in Laze; null shows its Discord name. */
|
|
82763
|
+
label: external_exports.string().nullable(),
|
|
82764
|
+
status: discordConnectionStatusSchema,
|
|
82765
|
+
/** What needs doing, in a sentence, when the status is not connected. */
|
|
82766
|
+
problem: external_exports.string().nullable(),
|
|
82767
|
+
cacheDays: external_exports.number().int().min(1).max(30),
|
|
82768
|
+
applicationId: external_exports.string(),
|
|
82769
|
+
connectedByUserId: external_exports.string(),
|
|
82770
|
+
createdAt: external_exports.iso.datetime(),
|
|
82771
|
+
/** The viewer's own link; null until they link. */
|
|
82772
|
+
me: discordLinkViewDefinition.nullable(),
|
|
82773
|
+
/** How many channels the viewer picked. */
|
|
82774
|
+
myPicks: external_exports.number().int().nonnegative()
|
|
82775
|
+
});
|
|
82776
|
+
var discordConnectionViewSchema = discordConnectionViewDefinition;
|
|
82777
|
+
var discordOverviewDefinition = external_exports.object({
|
|
82778
|
+
/** The bot an admin set up or is setting up; null before anyone started. */
|
|
82779
|
+
setup: discordSetupDefinition.nullable(),
|
|
82780
|
+
connections: external_exports.array(discordConnectionViewDefinition)
|
|
82781
|
+
});
|
|
82782
|
+
var discordOverviewSchema = discordOverviewDefinition;
|
|
82783
|
+
var discordPickModeSchema = external_exports.enum(["read", "reply"]);
|
|
82784
|
+
var discordPickStateSchema = external_exports.enum(["mirroring", "waiting_for_access", "cannot_reply"]);
|
|
82785
|
+
var discordChannelKindSchema = external_exports.enum(["text", "announcement", "forum"]);
|
|
82786
|
+
var discordChannelViewDefinition = external_exports.object({
|
|
82787
|
+
channelId: discordIdSchema,
|
|
82788
|
+
name: external_exports.string(),
|
|
82789
|
+
kind: discordChannelKindSchema,
|
|
82790
|
+
/** The category it sits in; null at the top. */
|
|
82791
|
+
category: external_exports.string().nullable(),
|
|
82792
|
+
/** Not every member of the server sees it. */
|
|
82793
|
+
private: external_exports.boolean(),
|
|
82794
|
+
picked: external_exports.boolean(),
|
|
82795
|
+
mode: discordPickModeSchema.nullable(),
|
|
82796
|
+
state: discordPickStateSchema.nullable(),
|
|
82797
|
+
/** Permissions the Laze bot lacks in it for the pick's mode, as Discord labels them. */
|
|
82798
|
+
missing: external_exports.array(external_exports.string()),
|
|
82799
|
+
/** The Laze conversation once it mirrors. */
|
|
82800
|
+
lazeChannelId: external_exports.string().nullable(),
|
|
82801
|
+
/** Opens the channel in Discord. */
|
|
82802
|
+
url: external_exports.url()
|
|
82803
|
+
});
|
|
82804
|
+
var discordChannelViewSchema = discordChannelViewDefinition;
|
|
82805
|
+
var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, guildId: discordIdSchema });
|
|
82806
|
+
var discordGuildInputSchema = guildInputDefinition;
|
|
82807
|
+
var saveDiscordAppDefinition = external_exports.object({
|
|
82808
|
+
workspaceId: workspaceIdSchema20,
|
|
82809
|
+
setupKey: external_exports.string().min(1).max(64),
|
|
82810
|
+
applicationId: external_exports.string().trim().max(40),
|
|
82811
|
+
clientSecret: external_exports.string().trim().max(200),
|
|
82812
|
+
botToken: external_exports.string().trim().max(200)
|
|
82813
|
+
});
|
|
82814
|
+
var saveDiscordAppInputSchema = saveDiscordAppDefinition;
|
|
82815
|
+
var startedAuthorizeDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
82816
|
+
var startedDiscordAuthorizeSchema = startedAuthorizeDefinition;
|
|
82817
|
+
var pickDefinition = external_exports.object({
|
|
82818
|
+
workspaceId: workspaceIdSchema20,
|
|
82819
|
+
guildId: discordIdSchema,
|
|
82820
|
+
channelId: discordIdSchema,
|
|
82821
|
+
picked: external_exports.boolean(),
|
|
82822
|
+
mode: discordPickModeSchema.default("read")
|
|
82823
|
+
});
|
|
82824
|
+
var discordPickInputSchema = pickDefinition;
|
|
82825
|
+
var updateConnectionDefinition = external_exports.object({
|
|
82826
|
+
workspaceId: workspaceIdSchema20,
|
|
82827
|
+
guildId: discordIdSchema,
|
|
82828
|
+
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
82829
|
+
cacheDays: external_exports.number().int().min(1).max(30).optional()
|
|
82830
|
+
});
|
|
82831
|
+
var updateDiscordConnectionInputSchema = updateConnectionDefinition;
|
|
82832
|
+
var oauthCallbackDefinition = external_exports.object({
|
|
82833
|
+
code: external_exports.string().max(200).optional(),
|
|
82834
|
+
state: external_exports.string().max(200).optional(),
|
|
82835
|
+
guild_id: external_exports.string().max(40).optional(),
|
|
82836
|
+
permissions: external_exports.string().max(40).optional(),
|
|
82837
|
+
error: external_exports.string().max(200).optional()
|
|
82838
|
+
});
|
|
82839
|
+
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, guildId: discordIdSchema });
|
|
82840
|
+
var historyInputDefinition = external_exports.object({
|
|
82841
|
+
workspaceId: workspaceIdSchema20,
|
|
82842
|
+
/** The Laze conversation that mirrors the Discord channel. */
|
|
82843
|
+
channelId: external_exports.string().min(1).max(200),
|
|
82844
|
+
before: external_exports.iso.datetime()
|
|
82845
|
+
});
|
|
82846
|
+
var discordHistoryInputSchema = historyInputDefinition;
|
|
82847
|
+
var discordFileDefinition = external_exports.object({
|
|
82848
|
+
id: external_exports.string(),
|
|
82849
|
+
name: external_exports.string(),
|
|
82850
|
+
mimetype: external_exports.string(),
|
|
82851
|
+
size: external_exports.number().int().nonnegative()
|
|
82852
|
+
});
|
|
82853
|
+
var historyMessageDefinition = external_exports.object({
|
|
82854
|
+
key: external_exports.string().min(1),
|
|
82855
|
+
createdAt: external_exports.iso.datetime(),
|
|
82856
|
+
authorName: external_exports.string(),
|
|
82857
|
+
authorAvatarUrl: external_exports.string().nullable(),
|
|
82858
|
+
authorUserId: external_exports.string().nullable(),
|
|
82859
|
+
body: external_exports.string(),
|
|
82860
|
+
replyCount: external_exports.number().int().nonnegative(),
|
|
82861
|
+
files: external_exports.array(discordFileDefinition)
|
|
82862
|
+
});
|
|
82863
|
+
var historyPageDefinition = external_exports.object({
|
|
82864
|
+
/** Oldest first. */
|
|
82865
|
+
messages: external_exports.array(historyMessageDefinition),
|
|
82866
|
+
hasOlder: external_exports.boolean()
|
|
82867
|
+
});
|
|
82868
|
+
var discordHistoryPageSchema = historyPageDefinition;
|
|
82869
|
+
var fileParamsDefinition = external_exports.object({
|
|
82870
|
+
workspaceId: workspaceIdSchema20,
|
|
82871
|
+
channelId: external_exports.string().min(1).max(200),
|
|
82872
|
+
messageId: discordIdSchema,
|
|
82873
|
+
attachmentId: discordIdSchema
|
|
82874
|
+
});
|
|
82875
|
+
var guildByKeyDefinition = guildInputDefinition.omit({ workspaceId: true });
|
|
82876
|
+
var saveAppByKeyDefinition = external_exports.object({
|
|
82877
|
+
...saveDiscordAppDefinition.omit({ workspaceId: true }).shape,
|
|
82878
|
+
clientSecret: external_exports.string().trim().max(200).optional(),
|
|
82879
|
+
botToken: external_exports.string().trim().max(200).optional(),
|
|
82880
|
+
fromConnection: external_exports.string().trim().min(1).max(200).optional()
|
|
82881
|
+
});
|
|
82882
|
+
var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
|
|
82883
|
+
var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
|
|
82884
|
+
var historyByKeyDefinition = historyInputDefinition.omit({ workspaceId: true });
|
|
82885
|
+
var emptyDefinition = external_exports.object({});
|
|
82886
|
+
var DISCORD_KEY_PATHS = {
|
|
82887
|
+
overview: "/api/discord/overview",
|
|
82888
|
+
beginSetup: "/api/discord/setup",
|
|
82889
|
+
saveApp: "/api/discord/app",
|
|
82890
|
+
startInstall: "/api/discord/install",
|
|
82891
|
+
startLink: "/api/discord/link",
|
|
82892
|
+
unlink: "/api/discord/unlink",
|
|
82893
|
+
channels: "/api/discord/channels",
|
|
82894
|
+
pick: "/api/discord/pick",
|
|
82895
|
+
updateConnection: "/api/discord/connection",
|
|
82896
|
+
disconnect: "/api/discord/disconnect",
|
|
82897
|
+
history: "/api/discord/history"
|
|
82898
|
+
};
|
|
82899
|
+
var DiscordApi = moduleApi()("discord");
|
|
82900
|
+
var discordTrpc = defineTrpcContract("discord").query("overview").withInput(workspaceInput4).withOutput(discordOverviewSchema).mutation("beginSetup").withInput(workspaceInput4).withOutput(discordSetupSchema).mutation("saveApp").withInput(saveDiscordAppInputSchema).withOutput(startedDiscordAuthorizeSchema).mutation("startInstall").withInput(workspaceInput4).withOutput(startedDiscordAuthorizeSchema).mutation("startLink").withInput(discordGuildInputSchema).withOutput(startedDiscordAuthorizeSchema).mutation("unlink").withInput(discordGuildInputSchema).withOutput(discordConnectionViewSchema).query("channels").withInput(discordGuildInputSchema).withOutput(external_exports.array(discordChannelViewSchema)).mutation("pick").withInput(discordPickInputSchema).withOutput(discordChannelViewSchema).mutation("updateConnection").withInput(updateDiscordConnectionInputSchema).withOutput(discordConnectionViewSchema).mutation("disconnect").withInput(discordGuildInputSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).query("history").withInput(discordHistoryInputSchema).withOutput(discordHistoryPageSchema).build();
|
|
82901
|
+
|
|
82902
|
+
// ../../modules/discord/contract/src/discord.config.ts
|
|
82903
|
+
var positiveInt6 = external_exports.coerce.number().int().positive();
|
|
82904
|
+
var discordConfig = Config.define((c) => ({
|
|
82905
|
+
publicBaseUrl,
|
|
82906
|
+
/** The versioned REST base; routes are `${apiUrl}/<route>`. */
|
|
82907
|
+
apiUrl: c.env("DISCORD_API_URL", external_exports.url().default("https://discord.com/api/v10")),
|
|
82908
|
+
/** Discord's consent page for installs and links. */
|
|
82909
|
+
authorizeUrl: c.env(
|
|
82910
|
+
"DISCORD_AUTHORIZE_URL",
|
|
82911
|
+
external_exports.url().default("https://discord.com/oauth2/authorize")
|
|
82912
|
+
),
|
|
82913
|
+
/** The Developer Portal's applications page, where an admin makes the bot. */
|
|
82914
|
+
portalUrl: c.env(
|
|
82915
|
+
"DISCORD_PORTAL_URL",
|
|
82916
|
+
external_exports.url().default("https://discord.com/developers/applications")
|
|
82917
|
+
),
|
|
82918
|
+
/** Discord's web app, for "Open in Discord" links. */
|
|
82919
|
+
appUrl: c.env("DISCORD_APP_URL", external_exports.url().default("https://discord.com")),
|
|
82920
|
+
/** How long a started install or link waits for Discord's answer. */
|
|
82921
|
+
authorizationMinutes: c.env("DISCORD_AUTHORIZATION_MINUTES", positiveInt6.default(10)),
|
|
82922
|
+
/** The longest wait between two gateway reconnects. */
|
|
82923
|
+
reconnectMaxSeconds: c.env("DISCORD_RECONNECT_MAX_SECONDS", positiveInt6.default(60))
|
|
82924
|
+
}));
|
|
82925
|
+
|
|
82926
|
+
// ../../modules/discord/contract/src/discord.events.ts
|
|
82927
|
+
var attachmentDefinition = external_exports.object({
|
|
82928
|
+
id: external_exports.string().min(1),
|
|
82929
|
+
filename: external_exports.string(),
|
|
82930
|
+
contentType: external_exports.string(),
|
|
82931
|
+
size: external_exports.number().int().nonnegative()
|
|
82932
|
+
});
|
|
82933
|
+
var messageDefinition = external_exports.object({
|
|
82934
|
+
id: external_exports.string().min(1),
|
|
82935
|
+
/** Where it was posted: the picked channel, or a thread under it. */
|
|
82936
|
+
channelId: external_exports.string().min(1),
|
|
82937
|
+
authorId: external_exports.string().min(1),
|
|
82938
|
+
authorName: external_exports.string(),
|
|
82939
|
+
authorAvatarUrl: external_exports.string().nullable(),
|
|
82940
|
+
bot: external_exports.boolean(),
|
|
82941
|
+
/** Set for a message a webhook posted, Laze's own included. */
|
|
82942
|
+
webhookId: external_exports.string().nullable(),
|
|
82943
|
+
content: external_exports.string(),
|
|
82944
|
+
createdAt: external_exports.iso.datetime(),
|
|
82945
|
+
editedAt: external_exports.iso.datetime().nullable(),
|
|
82946
|
+
attachments: external_exports.array(attachmentDefinition),
|
|
82947
|
+
/** The people `<@id>` mentions in the content, with the name Discord shows. */
|
|
82948
|
+
mentions: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string() }))
|
|
82949
|
+
});
|
|
82950
|
+
var channelDefinition = external_exports.object({
|
|
82951
|
+
id: external_exports.string().min(1),
|
|
82952
|
+
name: external_exports.string(),
|
|
82953
|
+
/** Discord's channel type number: 0 text, 5 news, 15 forum, 11 and 12 threads. */
|
|
82954
|
+
type: external_exports.number().int(),
|
|
82955
|
+
parentId: external_exports.string().nullable()
|
|
82956
|
+
});
|
|
82957
|
+
var discordDispatchKindSchema = external_exports.enum([
|
|
82958
|
+
"message_created",
|
|
82959
|
+
"message_updated",
|
|
82960
|
+
"message_deleted",
|
|
82961
|
+
"reaction_added",
|
|
82962
|
+
"reaction_removed",
|
|
82963
|
+
"channel_updated",
|
|
82964
|
+
"channel_deleted",
|
|
82965
|
+
"thread_updated",
|
|
82966
|
+
"thread_deleted"
|
|
82967
|
+
]);
|
|
82968
|
+
var dispatchDefinition = external_exports.object({
|
|
82969
|
+
workspaceId: external_exports.string().min(1),
|
|
82970
|
+
guildId: external_exports.string().min(1),
|
|
82971
|
+
/** The gateway session and sequence: a replay after a resume carries the same pair. */
|
|
82972
|
+
sessionId: external_exports.string().min(1),
|
|
82973
|
+
seq: external_exports.number().int().nonnegative(),
|
|
82974
|
+
kind: discordDispatchKindSchema,
|
|
82975
|
+
/** The picked channel it belongs to: itself, or a thread's parent. */
|
|
82976
|
+
pickedChannelId: external_exports.string().min(1),
|
|
82977
|
+
/** Where it happened: the picked channel or a thread of it. */
|
|
82978
|
+
channelId: external_exports.string().min(1),
|
|
82979
|
+
messageId: external_exports.string().nullable(),
|
|
82980
|
+
message: messageDefinition.nullable(),
|
|
82981
|
+
reaction: external_exports.object({ userId: external_exports.string().min(1), emoji: external_exports.string().min(1).max(64) }).nullable(),
|
|
82982
|
+
channel: channelDefinition.nullable(),
|
|
82983
|
+
receivedAt: external_exports.iso.datetime()
|
|
82984
|
+
});
|
|
82985
|
+
var sweepScheduledDefinition = external_exports.object({
|
|
82986
|
+
workspaceId: external_exports.string().min(1),
|
|
82987
|
+
guildId: external_exports.string().min(1),
|
|
82988
|
+
changeId: external_exports.string().min(1),
|
|
82989
|
+
/** Epoch milliseconds. */
|
|
82990
|
+
nextSweepAt: external_exports.number().int()
|
|
82991
|
+
});
|
|
82992
|
+
var sweepStateDefinition = external_exports.object({
|
|
82993
|
+
workspaceId: external_exports.string().nullable(),
|
|
82994
|
+
guildId: external_exports.string().nullable(),
|
|
82995
|
+
nextWakeAt: external_exports.number().nullable()
|
|
82996
|
+
});
|
|
82997
|
+
var sweepIntentDefinition = external_exports.object({
|
|
82998
|
+
workspaceId: external_exports.string().min(1),
|
|
82999
|
+
guildId: external_exports.string().min(1)
|
|
83000
|
+
});
|
|
83001
|
+
|
|
83002
|
+
// src/services/discord-commands.service.ts
|
|
83003
|
+
var DISCORD_USAGE = `Usage (a person's key; Discord stays the source, each person picks their own channels):
|
|
83004
|
+
laze discord overview the bot's setup, connected servers and your link
|
|
83005
|
+
laze discord link <guildId> prints the link that links your own Discord
|
|
83006
|
+
laze discord unlink <guildId> take your Discord link back
|
|
83007
|
+
laze discord channels <guildId> the channels you can view, with your picks
|
|
83008
|
+
laze discord pick <guildId> <channelId> [--reply] [--off]
|
|
83009
|
+
mirror a channel for you (--reply lets Laze answer in it, --off stops it)
|
|
83010
|
+
laze discord history <channelId> [--before <iso time>] older messages of a mirrored conversation
|
|
83011
|
+
Admins:
|
|
83012
|
+
laze discord setup start the setup: the redirect to add in the portal
|
|
83013
|
+
laze discord save-app <setupKey> --application-id <id>
|
|
83014
|
+
the Client Secret then the Bot Token, one per line, from stdin or --from-file <path>,
|
|
83015
|
+
or --from-vault <connection> holding CLIENT_SECRET and BOT_TOKEN
|
|
83016
|
+
laze discord install prints the saved bot's "Add to server" link
|
|
83017
|
+
laze discord update <guildId> [--label <name>|none] [--cache-days <n>]
|
|
83018
|
+
laze discord disconnect <guildId> remove Laze from the server`;
|
|
83019
|
+
var SECRET_FLAGS2 = ["client-secret", "bot-token", "token", "secret"];
|
|
83020
|
+
function json4({ context, args, data }) {
|
|
83021
|
+
if (!args.flags.json) return false;
|
|
83022
|
+
context.out(`${JSON.stringify(data, null, 2)}
|
|
83023
|
+
`);
|
|
83024
|
+
return true;
|
|
83025
|
+
}
|
|
83026
|
+
function wordAt3(args, index) {
|
|
83027
|
+
const word3 = args.words[index];
|
|
83028
|
+
if (!word3) throw new CliUsageError(DISCORD_USAGE);
|
|
83029
|
+
return word3;
|
|
83030
|
+
}
|
|
83031
|
+
async function secretsOf({ context, args }) {
|
|
83032
|
+
if (SECRET_FLAGS2.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
83033
|
+
throw new CliUsageError(
|
|
83034
|
+
"A secret never goes in a flag: pipe it on stdin, use --from-file or --from-vault."
|
|
83035
|
+
);
|
|
83036
|
+
}
|
|
83037
|
+
const fromConnection = flagText({ args, name: "from-vault" });
|
|
83038
|
+
if (fromConnection) return { fromConnection };
|
|
83039
|
+
const file3 = flagText({ args, name: "from-file" });
|
|
83040
|
+
const text2 = file3 ? await readFile26(resolve9(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83041
|
+
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83042
|
+
if (lines2.length !== 2) {
|
|
83043
|
+
throw new CliUsageError(
|
|
83044
|
+
"Give the Client Secret then the Bot Token, one per line, on stdin or --from-file."
|
|
83045
|
+
);
|
|
83046
|
+
}
|
|
83047
|
+
return { clientSecret: lines2[0] ?? "", botToken: lines2[1] ?? "" };
|
|
83048
|
+
}
|
|
83049
|
+
function authorizeRun(path, label3, body) {
|
|
83050
|
+
return async ({ context, args, client }) => {
|
|
83051
|
+
const started = await client.post(path, body(args));
|
|
83052
|
+
if (json4({ context, args, data: started })) return;
|
|
83053
|
+
context.out(`${label3}:
|
|
83054
|
+
${started.authorizeUrl}
|
|
83055
|
+
`);
|
|
83056
|
+
};
|
|
83057
|
+
}
|
|
83058
|
+
function printConnection2({ context, row }) {
|
|
83059
|
+
const you = row.me ? `you: ${row.me.name}` : "you: not linked";
|
|
83060
|
+
const problem = row.problem ? ` ${row.problem}` : "";
|
|
83061
|
+
context.out(
|
|
83062
|
+
`${row.guildId} ${row.label ?? row.guildName} ${row.status.replaceAll("_", " ")} ${row.myPicks} picked ${you}${problem}
|
|
83063
|
+
`
|
|
83064
|
+
);
|
|
83065
|
+
}
|
|
83066
|
+
function connectionRun(path, body) {
|
|
83067
|
+
return async ({ context, args, client }) => {
|
|
83068
|
+
const row = await client.post(path, body(args));
|
|
83069
|
+
if (json4({ context, args, data: row })) return;
|
|
83070
|
+
printConnection2({ context, row });
|
|
83071
|
+
};
|
|
83072
|
+
}
|
|
83073
|
+
function printSetup({ context, setup: setup4 }) {
|
|
83074
|
+
context.out(`Setup key: ${setup4.setupKey}
|
|
83075
|
+
`);
|
|
83076
|
+
if (setup4.saved) {
|
|
83077
|
+
context.out(`Bot saved for application ${setup4.applicationId ?? ""}: laze discord install
|
|
83078
|
+
`);
|
|
83079
|
+
return;
|
|
83080
|
+
}
|
|
83081
|
+
context.out(`Add this OAuth2 redirect in the Developer Portal:
|
|
83082
|
+
${setup4.redirectUrl}
|
|
83083
|
+
`);
|
|
83084
|
+
context.out(`Developer Portal: ${setup4.portalUrl}
|
|
83085
|
+
`);
|
|
83086
|
+
context.out(
|
|
83087
|
+
`Then: laze discord save-app ${setup4.setupKey} --application-id <id>, with the Client Secret then the Bot Token on stdin
|
|
83088
|
+
`
|
|
83089
|
+
);
|
|
83090
|
+
}
|
|
83091
|
+
var overview = async ({ context, args, client }) => {
|
|
83092
|
+
const view = await client.get(DISCORD_KEY_PATHS.overview);
|
|
83093
|
+
if (json4({ context, args, data: view })) return;
|
|
83094
|
+
if (!view.setup) context.out("No Discord bot is set up. An admin runs `laze discord setup`.\n");
|
|
83095
|
+
else if (!view.setup.saved) context.out(`Setup started: ${view.setup.setupKey}
|
|
83096
|
+
`);
|
|
83097
|
+
if (view.connections.length === 0) return context.out("No Discord server is connected.\n");
|
|
83098
|
+
for (const row of view.connections) printConnection2({ context, row });
|
|
83099
|
+
};
|
|
83100
|
+
var setup2 = async ({ context, args, client }) => {
|
|
83101
|
+
const started = await client.post(DISCORD_KEY_PATHS.beginSetup, {});
|
|
83102
|
+
if (json4({ context, args, data: started })) return;
|
|
83103
|
+
printSetup({ context, setup: started });
|
|
83104
|
+
};
|
|
83105
|
+
var saveApp = async ({ context, args, client }) => {
|
|
83106
|
+
const applicationId = flagText({ args, name: "application-id" });
|
|
83107
|
+
if (!applicationId) throw new CliUsageError(DISCORD_USAGE);
|
|
83108
|
+
const body = {
|
|
83109
|
+
setupKey: wordAt3(args, 2),
|
|
83110
|
+
applicationId,
|
|
83111
|
+
...await secretsOf({ context, args })
|
|
83112
|
+
};
|
|
83113
|
+
await authorizeRun(
|
|
83114
|
+
DISCORD_KEY_PATHS.saveApp,
|
|
83115
|
+
"Saved. Open this link to add the bot to a server",
|
|
83116
|
+
() => body
|
|
83117
|
+
)({ context, args, client });
|
|
83118
|
+
};
|
|
83119
|
+
var channels = async ({ context, args, client }) => {
|
|
83120
|
+
const rows = await client.post(DISCORD_KEY_PATHS.channels, {
|
|
83121
|
+
guildId: wordAt3(args, 2)
|
|
83122
|
+
});
|
|
83123
|
+
if (json4({ context, args, data: rows })) return;
|
|
83124
|
+
if (rows.length === 0) return context.out("No channels you can view.\n");
|
|
83125
|
+
for (const row of rows) printChannel({ context, row });
|
|
83126
|
+
};
|
|
83127
|
+
function printChannel({ context, row }) {
|
|
83128
|
+
const where = row.category ? `${row.category}/` : "";
|
|
83129
|
+
const pick3 = row.picked ? ` picked (${row.mode ?? "read"})` : "";
|
|
83130
|
+
const state = row.state ? ` ${row.state.replaceAll("_", " ")}` : "";
|
|
83131
|
+
const missing = row.missing.length > 0 ? ` bot lacks: ${row.missing.join(", ")}` : "";
|
|
83132
|
+
const visibility = row.private ? " private" : "";
|
|
83133
|
+
context.out(
|
|
83134
|
+
`${row.channelId} ${where}#${row.name} ${row.kind}${visibility}${pick3}${state}${missing}
|
|
83135
|
+
`
|
|
83136
|
+
);
|
|
83137
|
+
}
|
|
83138
|
+
var pick2 = async ({ context, args, client }) => {
|
|
83139
|
+
const row = await client.post(DISCORD_KEY_PATHS.pick, {
|
|
83140
|
+
guildId: wordAt3(args, 2),
|
|
83141
|
+
channelId: wordAt3(args, 3),
|
|
83142
|
+
picked: args.flags.off !== true,
|
|
83143
|
+
mode: args.flags.reply === true ? "reply" : "read"
|
|
83144
|
+
});
|
|
83145
|
+
if (json4({ context, args, data: row })) return;
|
|
83146
|
+
printChannel({ context, row });
|
|
83147
|
+
};
|
|
83148
|
+
function numberFlag2(args, name3) {
|
|
83149
|
+
const text2 = flagText({ args, name: name3 });
|
|
83150
|
+
if (!text2) return void 0;
|
|
83151
|
+
const value = Number(text2);
|
|
83152
|
+
if (!Number.isInteger(value)) throw new CliUsageError(`--${name3} takes a whole number.`);
|
|
83153
|
+
return value;
|
|
83154
|
+
}
|
|
83155
|
+
function updateBody(args) {
|
|
83156
|
+
const label3 = flagText({ args, name: "label" });
|
|
83157
|
+
const cacheDays = numberFlag2(args, "cache-days");
|
|
83158
|
+
if (!label3 && cacheDays === void 0) throw new CliUsageError(DISCORD_USAGE);
|
|
83159
|
+
return {
|
|
83160
|
+
guildId: wordAt3(args, 2),
|
|
83161
|
+
...label3 && { label: label3 === "none" ? null : label3 },
|
|
83162
|
+
...cacheDays !== void 0 && { cacheDays }
|
|
83163
|
+
};
|
|
83164
|
+
}
|
|
83165
|
+
var disconnect = async ({ context, args, client }) => {
|
|
83166
|
+
const guildId = wordAt3(args, 2);
|
|
83167
|
+
const answer5 = await client.post(DISCORD_KEY_PATHS.disconnect, {
|
|
83168
|
+
guildId
|
|
83169
|
+
});
|
|
83170
|
+
if (json4({ context, args, data: answer5 })) return;
|
|
83171
|
+
context.out(`Disconnected ${guildId}.
|
|
83172
|
+
`);
|
|
83173
|
+
};
|
|
83174
|
+
function beforeOf({ context, args }) {
|
|
83175
|
+
const given = flagText({ args, name: "before" });
|
|
83176
|
+
try {
|
|
83177
|
+
const instant = given ? Temporal3.Instant.from(given) : Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
|
|
83178
|
+
return instant.toString({ smallestUnit: "millisecond" });
|
|
83179
|
+
} catch {
|
|
83180
|
+
throw new CliUsageError("--before takes an ISO time, such as 2026-10-24T10:00:00Z.");
|
|
83181
|
+
}
|
|
83182
|
+
}
|
|
83183
|
+
var history = async ({ context, args, client }) => {
|
|
83184
|
+
const before = beforeOf({ context, args });
|
|
83185
|
+
const page = await client.post(DISCORD_KEY_PATHS.history, {
|
|
83186
|
+
channelId: wordAt3(args, 2),
|
|
83187
|
+
before
|
|
83188
|
+
});
|
|
83189
|
+
if (json4({ context, args, data: page })) return;
|
|
83190
|
+
if (page.messages.length === 0) return context.out("No older messages.\n");
|
|
83191
|
+
for (const message2 of page.messages) {
|
|
83192
|
+
const files2 = message2.files.length > 0 ? ` [${message2.files.length} files]` : "";
|
|
83193
|
+
context.out(`[${message2.createdAt}] ${message2.authorName}: ${message2.body}${files2}
|
|
83194
|
+
`);
|
|
83195
|
+
}
|
|
83196
|
+
if (page.hasOlder) {
|
|
83197
|
+
const oldest = page.messages[0]?.createdAt ?? before;
|
|
83198
|
+
context.out(`Older: laze discord history ${wordAt3(args, 2)} --before ${oldest}
|
|
83199
|
+
`);
|
|
83200
|
+
}
|
|
83201
|
+
};
|
|
83202
|
+
var guildOf = (args) => ({ guildId: wordAt3(args, 2) });
|
|
83203
|
+
var RUNS3 = {
|
|
83204
|
+
overview,
|
|
83205
|
+
setup: setup2,
|
|
83206
|
+
"save-app": saveApp,
|
|
83207
|
+
install: authorizeRun(
|
|
83208
|
+
DISCORD_KEY_PATHS.startInstall,
|
|
83209
|
+
"Open this link to add the bot to a server",
|
|
83210
|
+
() => ({})
|
|
83211
|
+
),
|
|
83212
|
+
link: authorizeRun(
|
|
83213
|
+
DISCORD_KEY_PATHS.startLink,
|
|
83214
|
+
"Open this link to link your Discord account",
|
|
83215
|
+
guildOf
|
|
83216
|
+
),
|
|
83217
|
+
unlink: connectionRun(DISCORD_KEY_PATHS.unlink, guildOf),
|
|
83218
|
+
channels,
|
|
83219
|
+
pick: pick2,
|
|
83220
|
+
update: connectionRun(DISCORD_KEY_PATHS.updateConnection, updateBody),
|
|
83221
|
+
disconnect,
|
|
83222
|
+
history
|
|
83223
|
+
};
|
|
83224
|
+
async function discord({
|
|
83225
|
+
context,
|
|
83226
|
+
args
|
|
83227
|
+
}) {
|
|
83228
|
+
const verb = args.words[1] ?? "";
|
|
83229
|
+
const run4 = Object.hasOwn(RUNS3, verb) ? RUNS3[verb] : void 0;
|
|
83230
|
+
if (!run4) throw new CliUsageError(DISCORD_USAGE);
|
|
83231
|
+
const { client } = await signedIn({ context, args });
|
|
83232
|
+
await run4({ context, args, client });
|
|
83233
|
+
}
|
|
83234
|
+
|
|
82614
83235
|
// src/rules/dnd-input.rules.ts
|
|
82615
83236
|
var FOR = /^(\d{1,4})(m|h)$/;
|
|
82616
83237
|
var CLOCK = /^([01]?\d|2[0-3]):([0-5]\d)$/;
|
|
@@ -82718,6 +83339,92 @@ async function domains({ context, args }) {
|
|
|
82718
83339
|
await command({ context, args });
|
|
82719
83340
|
}
|
|
82720
83341
|
|
|
83342
|
+
// src/services/emoji-commands.service.ts
|
|
83343
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
83344
|
+
import { resolve as resolve10 } from "node:path";
|
|
83345
|
+
var EMOJI_USAGE = `Usage:
|
|
83346
|
+
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
83347
|
+
laze emoji add <name> <file> [--alias <a,b>] add a PNG, JPEG or GIF as :name: (made 128px square)
|
|
83348
|
+
laze emoji alias <alias> <name> another name for an emoji
|
|
83349
|
+
laze emoji remove <name> remove an emoji you added (admins: any), or an alias`;
|
|
83350
|
+
var shown = (emoji4) => `:${emoji4.name}: ${(emoji4.aliases ?? []).map((alias) => `:${alias}:`).join(" ") || "-"} ${emoji4.addedBy?.name ?? "Slack"}
|
|
83351
|
+
`;
|
|
83352
|
+
function wordAt4(args, index) {
|
|
83353
|
+
const word3 = args.words[index];
|
|
83354
|
+
if (!word3) throw new CliUsageError(EMOJI_USAGE);
|
|
83355
|
+
return word3;
|
|
83356
|
+
}
|
|
83357
|
+
var ACTIONS = ["list", "add", "alias", "remove", "rm"];
|
|
83358
|
+
var bare = (name3) => name3.replace(/^:|:$/g, "");
|
|
83359
|
+
var printed = ({ context, value }) => context.out(`${JSON.stringify(value, null, 2)}
|
|
83360
|
+
`);
|
|
83361
|
+
var NEEDED_WORDS = {
|
|
83362
|
+
list: [],
|
|
83363
|
+
add: [2, 3],
|
|
83364
|
+
alias: [2, 3],
|
|
83365
|
+
remove: [2],
|
|
83366
|
+
rm: [2]
|
|
83367
|
+
};
|
|
83368
|
+
function actionOf(args) {
|
|
83369
|
+
const action = ACTIONS.find((each) => each === (args.words[1] ?? "list"));
|
|
83370
|
+
if (!action) throw new CliUsageError(EMOJI_USAGE);
|
|
83371
|
+
for (const index of NEEDED_WORDS[action]) wordAt4(args, index);
|
|
83372
|
+
return action;
|
|
83373
|
+
}
|
|
83374
|
+
async function listEmoji({ context, args, client }) {
|
|
83375
|
+
const list11 = await client.get(EMOJI_KEY_PATHS.list);
|
|
83376
|
+
if (args.flags.json) return printed({ context, value: list11 });
|
|
83377
|
+
if (list11.emoji.length === 0) return context.out("This workspace has no custom emoji yet.\n");
|
|
83378
|
+
for (const each of list11.emoji) context.out(shown(each));
|
|
83379
|
+
}
|
|
83380
|
+
async function addEmoji({ context, args, client }) {
|
|
83381
|
+
const file3 = wordAt4(args, 3);
|
|
83382
|
+
let bytes;
|
|
83383
|
+
try {
|
|
83384
|
+
bytes = new Uint8Array(await readFile27(resolve10(context.cwd, file3)));
|
|
83385
|
+
} catch {
|
|
83386
|
+
throw new CliUsageError(`Cannot read ${file3}.`);
|
|
83387
|
+
}
|
|
83388
|
+
const aliases = flagText({ args, name: "alias" }).split(",").map((alias) => alias.trim()).filter(Boolean);
|
|
83389
|
+
const added = await client.post(EMOJI_KEY_PATHS.add, {
|
|
83390
|
+
name: wordAt4(args, 2),
|
|
83391
|
+
contentType: contentTypeOf(file3),
|
|
83392
|
+
dataBase64: Buffer.from(bytes).toString("base64"),
|
|
83393
|
+
aliases
|
|
83394
|
+
});
|
|
83395
|
+
if (args.flags.json) return printed({ context, value: added });
|
|
83396
|
+
context.out(`Added :${added.name}:.
|
|
83397
|
+
`);
|
|
83398
|
+
}
|
|
83399
|
+
async function aliasEmoji({ context, args, client }) {
|
|
83400
|
+
const answer5 = await client.post(EMOJI_KEY_PATHS.alias, {
|
|
83401
|
+
alias: wordAt4(args, 2),
|
|
83402
|
+
name: wordAt4(args, 3)
|
|
83403
|
+
});
|
|
83404
|
+
if (args.flags.json) return printed({ context, value: answer5 });
|
|
83405
|
+
context.out(`:${bare(wordAt4(args, 2))}: now shows :${answer5.name}:.
|
|
83406
|
+
`);
|
|
83407
|
+
}
|
|
83408
|
+
async function removeEmoji({ context, args, client }) {
|
|
83409
|
+
const name3 = wordAt4(args, 2);
|
|
83410
|
+
await client.post(EMOJI_KEY_PATHS.remove, { name: name3 });
|
|
83411
|
+
if (args.flags.json) return printed({ context, value: { removed: true } });
|
|
83412
|
+
context.out(`Removed :${bare(name3)}:.
|
|
83413
|
+
`);
|
|
83414
|
+
}
|
|
83415
|
+
var RUN = {
|
|
83416
|
+
list: listEmoji,
|
|
83417
|
+
add: addEmoji,
|
|
83418
|
+
alias: aliasEmoji,
|
|
83419
|
+
remove: removeEmoji,
|
|
83420
|
+
rm: removeEmoji
|
|
83421
|
+
};
|
|
83422
|
+
async function emoji3({ context, args }) {
|
|
83423
|
+
const action = actionOf(args);
|
|
83424
|
+
const { client } = await signedIn({ context, args });
|
|
83425
|
+
await RUN[action]({ context, args, client });
|
|
83426
|
+
}
|
|
83427
|
+
|
|
82721
83428
|
// ../../modules/external-connection/contract/src/external-connection.ts
|
|
82722
83429
|
var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
82723
83430
|
list: "/api/external-connections/list",
|
|
@@ -82740,10 +83447,10 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
|
82740
83447
|
block: "/api/external-connections/block",
|
|
82741
83448
|
report: "/api/external-connections/report"
|
|
82742
83449
|
};
|
|
82743
|
-
var
|
|
83450
|
+
var workspaceIdSchema21 = external_exports.string().min(1).max(64);
|
|
82744
83451
|
var idSchema21 = external_exports.string().min(1).max(64);
|
|
82745
83452
|
var iso = external_exports.iso.datetime();
|
|
82746
|
-
var
|
|
83453
|
+
var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema21 });
|
|
82747
83454
|
var connectionReference = external_exports.string().trim().min(1).max(120);
|
|
82748
83455
|
var externalConnectionStateSchema = external_exports.enum(["active", "ended"]);
|
|
82749
83456
|
var externalInviteStateSchema = external_exports.enum([
|
|
@@ -82847,10 +83554,10 @@ var rosterDefinition = external_exports.object({
|
|
|
82847
83554
|
members: external_exports.array(rosterMemberDefinition)
|
|
82848
83555
|
});
|
|
82849
83556
|
var externalRosterSchema = rosterDefinition;
|
|
82850
|
-
var rosterInputDefinition = external_exports.object({ workspaceId:
|
|
83557
|
+
var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, channelId: idSchema21 });
|
|
82851
83558
|
var externalRosterInputSchema = rosterInputDefinition;
|
|
82852
83559
|
var inviteInputDefinition = external_exports.object({
|
|
82853
|
-
workspaceId:
|
|
83560
|
+
workspaceId: workspaceIdSchema21,
|
|
82854
83561
|
email: external_exports.email().max(320),
|
|
82855
83562
|
/** The first channel to share, by id or name; it is shared once the invitation is accepted. */
|
|
82856
83563
|
share: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -82858,7 +83565,7 @@ var inviteInputDefinition = external_exports.object({
|
|
|
82858
83565
|
company: external_exports.string().trim().min(1).max(80).optional()
|
|
82859
83566
|
});
|
|
82860
83567
|
var externalInviteInputSchema = inviteInputDefinition;
|
|
82861
|
-
var inviteRefDefinition = external_exports.object({ workspaceId:
|
|
83568
|
+
var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, inviteId: idSchema21 });
|
|
82862
83569
|
var externalInviteRefSchema = inviteRefDefinition;
|
|
82863
83570
|
var pendingShareDefinition = external_exports.object({
|
|
82864
83571
|
channelId: external_exports.string(),
|
|
@@ -82882,7 +83589,7 @@ var pendingSharesDefinition = external_exports.object({
|
|
|
82882
83589
|
var externalPendingSharesSchema = pendingSharesDefinition;
|
|
82883
83590
|
var acceptInviteDefinition = external_exports.object({
|
|
82884
83591
|
/** The workspace to connect: one where the person is Admin or Owner. */
|
|
82885
|
-
workspaceId:
|
|
83592
|
+
workspaceId: workspaceIdSchema21,
|
|
82886
83593
|
inviteId: idSchema21,
|
|
82887
83594
|
/** The emailed link's secret; without it the invitation must be addressed to the person. */
|
|
82888
83595
|
secret: external_exports.string().trim().max(200).optional()
|
|
@@ -82891,26 +83598,26 @@ var externalAcceptInviteInputSchema = acceptInviteDefinition;
|
|
|
82891
83598
|
var answeredDefinition = external_exports.object({ id: external_exports.string(), state: externalInviteStateSchema });
|
|
82892
83599
|
var externalInviteAnsweredSchema = answeredDefinition;
|
|
82893
83600
|
var connectionInputDefinition = external_exports.object({
|
|
82894
|
-
workspaceId:
|
|
83601
|
+
workspaceId: workspaceIdSchema21,
|
|
82895
83602
|
connection: connectionReference
|
|
82896
83603
|
});
|
|
82897
83604
|
var externalConnectionInputSchema = connectionInputDefinition;
|
|
82898
83605
|
var settingsInputDefinition = external_exports.object({
|
|
82899
|
-
workspaceId:
|
|
83606
|
+
workspaceId: workspaceIdSchema21,
|
|
82900
83607
|
connection: connectionReference,
|
|
82901
83608
|
agentsAllowed: external_exports.boolean().optional(),
|
|
82902
83609
|
directAllowed: external_exports.boolean().optional()
|
|
82903
83610
|
});
|
|
82904
83611
|
var externalSettingsInputSchema = settingsInputDefinition;
|
|
82905
83612
|
var shareInputDefinition = external_exports.object({
|
|
82906
|
-
workspaceId:
|
|
83613
|
+
workspaceId: workspaceIdSchema21,
|
|
82907
83614
|
connection: connectionReference,
|
|
82908
83615
|
/** The channel as its id or name, `#` optional. */
|
|
82909
83616
|
channel: external_exports.string().trim().min(1).max(81)
|
|
82910
83617
|
});
|
|
82911
83618
|
var externalShareInputSchema = shareInputDefinition;
|
|
82912
83619
|
var acceptShareDefinition = external_exports.object({
|
|
82913
|
-
workspaceId:
|
|
83620
|
+
workspaceId: workspaceIdSchema21,
|
|
82914
83621
|
shareId: idSchema21,
|
|
82915
83622
|
/** Its name here; the host's name when left out. */
|
|
82916
83623
|
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
@@ -82918,13 +83625,13 @@ var acceptShareDefinition = external_exports.object({
|
|
|
82918
83625
|
});
|
|
82919
83626
|
var externalAcceptShareInputSchema = acceptShareDefinition;
|
|
82920
83627
|
var shareRefDefinition = external_exports.object({
|
|
82921
|
-
workspaceId:
|
|
83628
|
+
workspaceId: workspaceIdSchema21,
|
|
82922
83629
|
/** The share's id, or this workspace's channel as its id or name. */
|
|
82923
83630
|
share: external_exports.string().trim().min(1).max(81)
|
|
82924
83631
|
});
|
|
82925
83632
|
var externalShareRefSchema = shareRefDefinition;
|
|
82926
83633
|
var reportInputDefinition = external_exports.object({
|
|
82927
|
-
workspaceId:
|
|
83634
|
+
workspaceId: workspaceIdSchema21,
|
|
82928
83635
|
connection: connectionReference,
|
|
82929
83636
|
note: external_exports.string().trim().min(1).max(2e3)
|
|
82930
83637
|
});
|
|
@@ -82935,7 +83642,7 @@ var blockedDefinition = external_exports.object({
|
|
|
82935
83642
|
});
|
|
82936
83643
|
var externalBlockedSchema = blockedDefinition;
|
|
82937
83644
|
var openDirectDefinition = external_exports.object({
|
|
82938
|
-
workspaceId:
|
|
83645
|
+
workspaceId: workspaceIdSchema21,
|
|
82939
83646
|
/** The external person: their roster id (`laze:<id>`) or their name in a shared channel. */
|
|
82940
83647
|
person: external_exports.string().trim().min(1).max(120),
|
|
82941
83648
|
/** Their workspace, as a connection reference; needed only when a name is in two. */
|
|
@@ -82954,14 +83661,14 @@ var directDefinition = external_exports.object({
|
|
|
82954
83661
|
});
|
|
82955
83662
|
var externalDirectSchema = directDefinition;
|
|
82956
83663
|
var ExternalConnectionApi = moduleApi()("external-connection");
|
|
82957
|
-
var externalConnectionTrpc = defineTrpcContract("externalConnection").query("overview").withInput(
|
|
83664
|
+
var externalConnectionTrpc = defineTrpcContract("externalConnection").query("overview").withInput(workspaceInput5).withOutput(externalOverviewSchema).query("roster").withInput(externalRosterInputSchema).withOutput(externalRosterSchema).query("myInvitations").withInput(workspaceInput5).withOutput(external_exports.array(externalInvitationSchema)).mutation("invite").withInput(externalInviteInputSchema).withOutput(externalSentInviteSchema).mutation("revokeInvite").withInput(externalInviteRefSchema).withOutput(externalSentInviteSchema).mutation("resendInvite").withInput(externalInviteRefSchema).withOutput(externalSentInviteSchema).query("pendingShares").withInput(workspaceInput5).withOutput(externalPendingSharesSchema).mutation("acceptInvite").withInput(externalAcceptInviteInputSchema).withOutput(externalConnectionSchema).mutation("declineInvite").withInput(externalInviteRefSchema).withOutput(externalInviteAnsweredSchema).mutation("forwardInvite").withInput(externalInviteRefSchema).withOutput(externalInviteAnsweredSchema).mutation("disconnect").withInput(externalConnectionInputSchema).withOutput(externalConnectionSchema).mutation("updateSettings").withInput(externalSettingsInputSchema).withOutput(externalConnectionSchema).mutation("shareChannel").withInput(externalShareInputSchema).withOutput(externalSharedChannelSchema).mutation("acceptShare").withInput(externalAcceptShareInputSchema).withOutput(externalSharedChannelSchema).mutation("declineShare").withInput(externalShareRefSchema).withOutput(externalSharedChannelSchema).mutation("stopSharing").withInput(externalShareRefSchema).withOutput(externalSharedChannelSchema).mutation("block").withInput(externalConnectionInputSchema).withOutput(externalBlockedSchema).mutation("report").withInput(externalReportInputSchema).withOutput(externalBlockedSchema).mutation("openDirect").withInput(externalOpenDirectInputSchema).withOutput(externalDirectSchema).build();
|
|
82958
83665
|
|
|
82959
83666
|
// ../../modules/external-connection/contract/src/external-connection.config.ts
|
|
82960
83667
|
var externalConnectionConfig = Config.define(() => ({ publicBaseUrl }));
|
|
82961
83668
|
|
|
82962
83669
|
// ../../modules/external-connection/contract/src/external-connection.rest.ts
|
|
82963
83670
|
var keyed = { workspaceId: true };
|
|
82964
|
-
var
|
|
83671
|
+
var emptyDefinition2 = external_exports.object({});
|
|
82965
83672
|
var rosterDefinition2 = externalRosterInputSchema.omit(keyed);
|
|
82966
83673
|
var inviteDefinition = externalInviteInputSchema.omit(keyed);
|
|
82967
83674
|
var inviteRefDefinition2 = externalInviteRefSchema.omit(keyed);
|
|
@@ -82981,8 +83688,8 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
82981
83688
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
82982
83689
|
|
|
82983
83690
|
// src/services/workspace-commands.service.ts
|
|
82984
|
-
import { readFile as
|
|
82985
|
-
import { resolve as
|
|
83691
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
83692
|
+
import { resolve as resolve11 } from "node:path";
|
|
82986
83693
|
var ROLE_NAMES2 = {
|
|
82987
83694
|
OWNER: "Owner",
|
|
82988
83695
|
ADMIN: "Admin",
|
|
@@ -83164,7 +83871,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
83164
83871
|
async function readLogo({ context, file: file3 }) {
|
|
83165
83872
|
let bytes;
|
|
83166
83873
|
try {
|
|
83167
|
-
bytes = new Uint8Array(await
|
|
83874
|
+
bytes = new Uint8Array(await readFile28(resolve11(context.cwd, file3)));
|
|
83168
83875
|
} catch {
|
|
83169
83876
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
83170
83877
|
}
|
|
@@ -83420,7 +84127,7 @@ var EXTERNAL_USAGE = `Usage:
|
|
|
83420
84127
|
laze external report <workspace> --note "<why>" report a workspace to Laze staff, and block it (admins)`;
|
|
83421
84128
|
var printJson6 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
83422
84129
|
`);
|
|
83423
|
-
function
|
|
84130
|
+
function wordAt5({ args, at, what }) {
|
|
83424
84131
|
const word3 = args.words[at]?.trim();
|
|
83425
84132
|
if (!word3) throw new CliUsageError(`Name ${what}.
|
|
83426
84133
|
${EXTERNAL_USAGE}`);
|
|
@@ -83473,22 +84180,22 @@ function connectionLines(connection) {
|
|
|
83473
84180
|
}
|
|
83474
84181
|
async function list6({ context, args }) {
|
|
83475
84182
|
const { client } = await clientOf2({ context, args });
|
|
83476
|
-
const
|
|
83477
|
-
if (args.flags.json) return printJson6(context,
|
|
84183
|
+
const overview3 = await client.get(EXTERNAL_CONNECTION_REST_PATHS.list);
|
|
84184
|
+
if (args.flags.json) return printJson6(context, overview3);
|
|
83478
84185
|
const lines2 = [
|
|
83479
|
-
...
|
|
83480
|
-
...
|
|
83481
|
-
...
|
|
83482
|
-
...
|
|
84186
|
+
...overview3.connections.length === 0 ? ["No connected workspaces."] : [],
|
|
84187
|
+
...overview3.connections.flatMap(connectionLines),
|
|
84188
|
+
...overview3.invites.length > 0 ? ["Invitations sent:"] : [],
|
|
84189
|
+
...overview3.invites.map(
|
|
83483
84190
|
(invite3) => ` ${invite3.email} ${invite3.state} expires ${utcTimeOf(invite3.expiresAt)} ${invite3.id}`
|
|
83484
84191
|
),
|
|
83485
|
-
...
|
|
84192
|
+
...overview3.blocked.map((each) => `Blocked: ${each.name}`)
|
|
83486
84193
|
];
|
|
83487
84194
|
context.out(`${lines2.join("\n")}
|
|
83488
84195
|
`);
|
|
83489
84196
|
}
|
|
83490
84197
|
async function roster({ context, args }) {
|
|
83491
|
-
const channelId =
|
|
84198
|
+
const channelId = wordAt5({ args, at: 2, what: "the shared channel's id" });
|
|
83492
84199
|
const { client } = await clientOf2({ context, args });
|
|
83493
84200
|
const path = EXTERNAL_CONNECTION_REST_PATHS.roster;
|
|
83494
84201
|
const answer5 = await client.get(
|
|
@@ -83514,7 +84221,7 @@ async function invitations({ context, args }) {
|
|
|
83514
84221
|
}
|
|
83515
84222
|
}
|
|
83516
84223
|
async function invite2({ context, args }) {
|
|
83517
|
-
const email3 =
|
|
84224
|
+
const email3 = wordAt5({ args, at: 2, what: "the address to invite" });
|
|
83518
84225
|
const share3 = flagText({ args, name: "share" })?.trim();
|
|
83519
84226
|
const company = flagText({ args, name: "company" })?.trim();
|
|
83520
84227
|
const { client } = await clientOf2({ context, args });
|
|
@@ -83532,7 +84239,7 @@ async function invite2({ context, args }) {
|
|
|
83532
84239
|
);
|
|
83533
84240
|
}
|
|
83534
84241
|
async function resend({ context, args }) {
|
|
83535
|
-
const inviteId =
|
|
84242
|
+
const inviteId = wordAt5({ args, at: 2, what: "the invitation's id" });
|
|
83536
84243
|
const { client } = await clientOf2({ context, args });
|
|
83537
84244
|
const sent = await client.post(EXTERNAL_CONNECTION_REST_PATHS.resend, {
|
|
83538
84245
|
inviteId
|
|
@@ -83559,7 +84266,7 @@ async function pending({ context, args }) {
|
|
|
83559
84266
|
}
|
|
83560
84267
|
}
|
|
83561
84268
|
async function inviteRef({ context, args, path }) {
|
|
83562
|
-
const inviteId =
|
|
84269
|
+
const inviteId = wordAt5({ args, at: 2, what: "the invitation's id" });
|
|
83563
84270
|
const { client } = await clientOf2({ context, args });
|
|
83564
84271
|
return client.post(path, { inviteId });
|
|
83565
84272
|
}
|
|
@@ -83582,7 +84289,7 @@ async function forward({ context, args }) {
|
|
|
83582
84289
|
`);
|
|
83583
84290
|
}
|
|
83584
84291
|
async function accept({ context, args }) {
|
|
83585
|
-
const inviteId =
|
|
84292
|
+
const inviteId = wordAt5({ args, at: 2, what: "the invitation's id" });
|
|
83586
84293
|
const secret = flagText({ args, name: "secret" })?.trim();
|
|
83587
84294
|
const { client, name: name3 } = await clientOf2({ context, args });
|
|
83588
84295
|
const connection = await client.post(EXTERNAL_CONNECTION_REST_PATHS.accept, {
|
|
@@ -83594,8 +84301,8 @@ async function accept({ context, args }) {
|
|
|
83594
84301
|
context.out(`${own2} is connected to ${connection.peer.name} (${connection.id}).
|
|
83595
84302
|
`);
|
|
83596
84303
|
}
|
|
83597
|
-
async function
|
|
83598
|
-
const connection =
|
|
84304
|
+
async function disconnect2({ context, args }) {
|
|
84305
|
+
const connection = wordAt5({ args, at: 2, what: "the connected workspace" });
|
|
83599
84306
|
const { client } = await clientOf2({ context, args });
|
|
83600
84307
|
const answer5 = await client.post(EXTERNAL_CONNECTION_REST_PATHS.disconnect, {
|
|
83601
84308
|
connection
|
|
@@ -83605,7 +84312,7 @@ async function disconnect({ context, args }) {
|
|
|
83605
84312
|
`);
|
|
83606
84313
|
}
|
|
83607
84314
|
async function settings({ context, args }) {
|
|
83608
|
-
const connection =
|
|
84315
|
+
const connection = wordAt5({ args, at: 2, what: "the connected workspace" });
|
|
83609
84316
|
const agentsAllowed = onOff({ value: flagText({ args, name: "agents" }), flag: "agents" });
|
|
83610
84317
|
const directAllowed = onOff({ value: flagText({ args, name: "dms" }), flag: "dms" });
|
|
83611
84318
|
const { client } = await clientOf2({ context, args });
|
|
@@ -83619,7 +84326,7 @@ async function settings({ context, args }) {
|
|
|
83619
84326
|
`);
|
|
83620
84327
|
}
|
|
83621
84328
|
async function share({ context, args }) {
|
|
83622
|
-
const channel =
|
|
84329
|
+
const channel = wordAt5({ args, at: 2, what: "the channel to share" });
|
|
83623
84330
|
const connection = flagText({ args, name: "with" })?.trim();
|
|
83624
84331
|
if (!connection) throw new CliUsageError(`Name the workspace with --with.
|
|
83625
84332
|
${EXTERNAL_USAGE}`);
|
|
@@ -83635,7 +84342,7 @@ ${EXTERNAL_USAGE}`);
|
|
|
83635
84342
|
);
|
|
83636
84343
|
}
|
|
83637
84344
|
async function acceptShare({ context, args }) {
|
|
83638
|
-
const shareId =
|
|
84345
|
+
const shareId = wordAt5({ args, at: 2, what: "the share's id" });
|
|
83639
84346
|
const name3 = flagText({ args, name: "name" })?.trim();
|
|
83640
84347
|
const { client } = await clientOf2({ context, args });
|
|
83641
84348
|
const answer5 = await client.post(
|
|
@@ -83647,7 +84354,7 @@ async function acceptShare({ context, args }) {
|
|
|
83647
84354
|
`);
|
|
83648
84355
|
}
|
|
83649
84356
|
async function shareRef({ context, args, path }) {
|
|
83650
|
-
const reference =
|
|
84357
|
+
const reference = wordAt5({ args, at: 2, what: "the share or its channel" });
|
|
83651
84358
|
const { client } = await clientOf2({ context, args });
|
|
83652
84359
|
return client.post(path, { share: reference });
|
|
83653
84360
|
}
|
|
@@ -83668,7 +84375,7 @@ async function unshare({ context, args }) {
|
|
|
83668
84375
|
`);
|
|
83669
84376
|
}
|
|
83670
84377
|
async function direct({ context, args }) {
|
|
83671
|
-
const person =
|
|
84378
|
+
const person = wordAt5({ args, at: 2, what: "the person" });
|
|
83672
84379
|
const body = args.words.slice(3).join(" ").trim();
|
|
83673
84380
|
const connection = flagText({ args, name: "connection" })?.trim();
|
|
83674
84381
|
const { client } = await clientOf2({ context, args });
|
|
@@ -83685,7 +84392,7 @@ async function direct({ context, args }) {
|
|
|
83685
84392
|
);
|
|
83686
84393
|
}
|
|
83687
84394
|
async function block({ context, args }) {
|
|
83688
|
-
const connection =
|
|
84395
|
+
const connection = wordAt5({ args, at: 2, what: "the workspace to block" });
|
|
83689
84396
|
const { client } = await clientOf2({ context, args });
|
|
83690
84397
|
const answer5 = await client.post(EXTERNAL_CONNECTION_REST_PATHS.block, {
|
|
83691
84398
|
connection
|
|
@@ -83695,7 +84402,7 @@ async function block({ context, args }) {
|
|
|
83695
84402
|
`);
|
|
83696
84403
|
}
|
|
83697
84404
|
async function report({ context, args }) {
|
|
83698
|
-
const connection =
|
|
84405
|
+
const connection = wordAt5({ args, at: 2, what: "the workspace to report" });
|
|
83699
84406
|
const note = flagText({ args, name: "note" })?.trim();
|
|
83700
84407
|
if (!note) throw new CliUsageError(`Say why with --note.
|
|
83701
84408
|
${EXTERNAL_USAGE}`);
|
|
@@ -83719,7 +84426,7 @@ var EXTERNAL_COMMANDS = {
|
|
|
83719
84426
|
accept,
|
|
83720
84427
|
decline,
|
|
83721
84428
|
forward,
|
|
83722
|
-
disconnect,
|
|
84429
|
+
disconnect: disconnect2,
|
|
83723
84430
|
settings,
|
|
83724
84431
|
share,
|
|
83725
84432
|
"accept-share": acceptShare,
|
|
@@ -83737,8 +84444,8 @@ async function external({ context, args }) {
|
|
|
83737
84444
|
}
|
|
83738
84445
|
|
|
83739
84446
|
// src/services/feed-commands.service.ts
|
|
83740
|
-
import { readFile as
|
|
83741
|
-
import { resolve as
|
|
84447
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
84448
|
+
import { resolve as resolve13 } from "node:path";
|
|
83742
84449
|
|
|
83743
84450
|
// ../../modules/feed/contract/src/feed.ts
|
|
83744
84451
|
var feedAuthorSchemaDefinition = external_exports.object({
|
|
@@ -84487,8 +85194,8 @@ function feedFlagsOf({ args }) {
|
|
|
84487
85194
|
}
|
|
84488
85195
|
|
|
84489
85196
|
// src/services/feed-files.service.ts
|
|
84490
|
-
import { readFile as
|
|
84491
|
-
import { basename as basename4, resolve as
|
|
85197
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
85198
|
+
import { basename as basename4, resolve as resolve12 } from "node:path";
|
|
84492
85199
|
async function bytesOf2({
|
|
84493
85200
|
context,
|
|
84494
85201
|
source
|
|
@@ -84513,12 +85220,12 @@ async function downloaded({ context, url: url2 }) {
|
|
|
84513
85220
|
};
|
|
84514
85221
|
}
|
|
84515
85222
|
async function local({ context, path }) {
|
|
84516
|
-
const full =
|
|
85223
|
+
const full = resolve12(context.cwd, path);
|
|
84517
85224
|
const fileName = basename4(full);
|
|
84518
85225
|
return {
|
|
84519
85226
|
fileName,
|
|
84520
85227
|
contentType: contentTypeOf(fileName),
|
|
84521
|
-
bytes: new Uint8Array(await
|
|
85228
|
+
bytes: new Uint8Array(await readFile29(full))
|
|
84522
85229
|
};
|
|
84523
85230
|
}
|
|
84524
85231
|
async function directWith({ client, to }) {
|
|
@@ -84600,7 +85307,7 @@ async function bodyOf2({
|
|
|
84600
85307
|
flags: flags2
|
|
84601
85308
|
}) {
|
|
84602
85309
|
const body = { ...flags2.fields };
|
|
84603
|
-
const read3 = (source) => "file" in source ?
|
|
85310
|
+
const read3 = (source) => "file" in source ? readFile30(resolve13(context.cwd, source.file), "utf8") : source.text;
|
|
84604
85311
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
|
|
84605
85312
|
if (flags2.rich) {
|
|
84606
85313
|
const text2 = await read3(flags2.rich.source);
|
|
@@ -84621,8 +85328,8 @@ function printItem({
|
|
|
84621
85328
|
`);
|
|
84622
85329
|
const shownAt = item.item.showAt ? ` (shows ${item.item.showAt})` : "";
|
|
84623
85330
|
const countdown = item.item.autoSendOn ? ` (auto-sends on ${item.item.autoSendOn})` : "";
|
|
84624
|
-
const
|
|
84625
|
-
context.out(`${item.item.id} ${item.item.tag} ${item.item.title}${
|
|
85331
|
+
const shown2 = `${shownAt}${countdown}`;
|
|
85332
|
+
context.out(`${item.item.id} ${item.item.tag} ${item.item.title}${shown2}
|
|
84626
85333
|
`);
|
|
84627
85334
|
for (const message2 of item.messages) context.out(` > ${message2}
|
|
84628
85335
|
`);
|
|
@@ -84795,7 +85502,7 @@ async function textFlag({
|
|
|
84795
85502
|
}) {
|
|
84796
85503
|
const value = flagText({ args, name: name3 });
|
|
84797
85504
|
if (!value.startsWith("@")) return value;
|
|
84798
|
-
return
|
|
85505
|
+
return readFile30(resolve13(context.cwd, value.slice(1)), "utf8");
|
|
84799
85506
|
}
|
|
84800
85507
|
async function feedList({ context, args }) {
|
|
84801
85508
|
const { client } = await signedIn({ context, args });
|
|
@@ -84918,7 +85625,7 @@ async function feed({ context, args }) {
|
|
|
84918
85625
|
}
|
|
84919
85626
|
|
|
84920
85627
|
// src/services/github-commands.service.ts
|
|
84921
|
-
import { readFile as
|
|
85628
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
84922
85629
|
|
|
84923
85630
|
// src/rules/github-signature.rules.ts
|
|
84924
85631
|
var TURN_SEPARATOR = "~";
|
|
@@ -84988,7 +85695,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
84988
85695
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Its owner sets one on the agent's settings page or with `laze agent set-github <agent> <connection>`.";
|
|
84989
85696
|
async function turnFileToken({ env }) {
|
|
84990
85697
|
if (!env.LAZE_TURN_FILE) return "";
|
|
84991
|
-
return
|
|
85698
|
+
return readFile31(env.LAZE_TURN_FILE, "utf8").then(
|
|
84992
85699
|
(text2) => text2.trim(),
|
|
84993
85700
|
() => ""
|
|
84994
85701
|
);
|
|
@@ -85022,7 +85729,7 @@ async function githubGh({
|
|
|
85022
85729
|
args: args.rest,
|
|
85023
85730
|
agentName: profile.name ?? "An agent",
|
|
85024
85731
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
85025
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
85732
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile31(path, "utf8")
|
|
85026
85733
|
});
|
|
85027
85734
|
return context.runCommand({
|
|
85028
85735
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -85121,7 +85828,7 @@ async function setAgentGithub({
|
|
|
85121
85828
|
}
|
|
85122
85829
|
|
|
85123
85830
|
// src/services/history-commands.service.ts
|
|
85124
|
-
import { readFile as
|
|
85831
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
85125
85832
|
|
|
85126
85833
|
// src/rules/history-format.rules.ts
|
|
85127
85834
|
function timeOf2(iso2) {
|
|
@@ -85200,7 +85907,7 @@ function limitOf3({ args }) {
|
|
|
85200
85907
|
}
|
|
85201
85908
|
return limit;
|
|
85202
85909
|
}
|
|
85203
|
-
function
|
|
85910
|
+
function beforeOf2({ args }) {
|
|
85204
85911
|
const given = flagText({ args, name: "before" }).trim();
|
|
85205
85912
|
if (!given) return {};
|
|
85206
85913
|
const slackTs = SLACK_KEY.exec(given)?.[1];
|
|
@@ -85217,19 +85924,19 @@ async function turnTokenOf4({ context }) {
|
|
|
85217
85924
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
85218
85925
|
if (pinned) return pinned;
|
|
85219
85926
|
if (!env.LAZE_TURN_FILE) return "";
|
|
85220
|
-
return
|
|
85927
|
+
return readFile32(env.LAZE_TURN_FILE, "utf8").then(
|
|
85221
85928
|
(text2) => text2.trim(),
|
|
85222
85929
|
() => ""
|
|
85223
85930
|
);
|
|
85224
85931
|
}
|
|
85225
|
-
async function
|
|
85932
|
+
async function history2({
|
|
85226
85933
|
context,
|
|
85227
85934
|
args
|
|
85228
85935
|
}) {
|
|
85229
85936
|
const channel = args.words[1];
|
|
85230
85937
|
if (!channel) throw new CliUsageError(HISTORY_USAGE);
|
|
85231
85938
|
const limit = limitOf3({ args });
|
|
85232
|
-
const before =
|
|
85939
|
+
const before = beforeOf2({ args });
|
|
85233
85940
|
const { client: signed2 } = await signedIn({ context, args });
|
|
85234
85941
|
const turn = await turnTokenOf4({ context });
|
|
85235
85942
|
const client = turn ? signed2.withHeaders({ "x-laze-turn": turn }) : signed2;
|
|
@@ -85409,7 +86116,7 @@ async function ip({ context, args }) {
|
|
|
85409
86116
|
}
|
|
85410
86117
|
|
|
85411
86118
|
// src/services/join-commands.service.ts
|
|
85412
|
-
import { mkdir as mkdir20, readFile as
|
|
86119
|
+
import { mkdir as mkdir20, readFile as readFile33, rename as rename6, rm as rm11, writeFile as writeFile20 } from "node:fs/promises";
|
|
85413
86120
|
import { dirname as dirname19, join as join23 } from "node:path";
|
|
85414
86121
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
85415
86122
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
@@ -85421,7 +86128,7 @@ async function readPending({
|
|
|
85421
86128
|
url: url2,
|
|
85422
86129
|
args
|
|
85423
86130
|
}) {
|
|
85424
|
-
const pending2 = await
|
|
86131
|
+
const pending2 = await readFile33(pendingPathOf({ context }), "utf8").then(
|
|
85425
86132
|
(text2) => JSON.parse(text2),
|
|
85426
86133
|
() => void 0
|
|
85427
86134
|
);
|
|
@@ -85662,7 +86369,7 @@ var MACHINE_ACCESS_USAGE = [
|
|
|
85662
86369
|
" laze machine grant|revoke <machine> --member <userId> | --agent <agentId> share it or stop (owner)",
|
|
85663
86370
|
" laze machine budget <machine> <usd> [--period day|week|month] its spend cap (owner)"
|
|
85664
86371
|
].join("\n");
|
|
85665
|
-
function
|
|
86372
|
+
function wordAt6({ args, at }) {
|
|
85666
86373
|
const value = args.words[at];
|
|
85667
86374
|
if (!value) throw new CliUsageError(`Usage:
|
|
85668
86375
|
${MACHINE_ACCESS_USAGE}`);
|
|
@@ -85691,7 +86398,7 @@ async function status6({ context, args }) {
|
|
|
85691
86398
|
}
|
|
85692
86399
|
async function get({ context, args }) {
|
|
85693
86400
|
const client = await computeClient({ context, args });
|
|
85694
|
-
const machine2 =
|
|
86401
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
85695
86402
|
printMachine({
|
|
85696
86403
|
context,
|
|
85697
86404
|
args,
|
|
@@ -85699,8 +86406,8 @@ async function get({ context, args }) {
|
|
|
85699
86406
|
});
|
|
85700
86407
|
}
|
|
85701
86408
|
async function rename7({ context, args }) {
|
|
85702
|
-
const machine2 =
|
|
85703
|
-
const name3 =
|
|
86409
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
86410
|
+
const name3 = wordAt6({ args, at: 3 });
|
|
85704
86411
|
const client = await computeClient({ context, args });
|
|
85705
86412
|
const renamed = await client.post(COMPUTE_REST_PATHS.rename, { machine: machine2, name: name3 });
|
|
85706
86413
|
if (args.flags.json) return printMachine({ context, args, machine: renamed });
|
|
@@ -85715,7 +86422,7 @@ ${MACHINE_ACCESS_USAGE}`);
|
|
|
85715
86422
|
return member ? { kind: "member", id: member } : { kind: "agent", id: agent2 };
|
|
85716
86423
|
}
|
|
85717
86424
|
async function share2({ context, args }) {
|
|
85718
|
-
const machine2 =
|
|
86425
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
85719
86426
|
const grantee = granteeOf({ args });
|
|
85720
86427
|
const revoking = args.words[1] === "revoke";
|
|
85721
86428
|
const path = revoking ? COMPUTE_REST_PATHS.revokeGrant : COMPUTE_REST_PATHS.grant;
|
|
@@ -85727,8 +86434,8 @@ async function share2({ context, args }) {
|
|
|
85727
86434
|
`);
|
|
85728
86435
|
}
|
|
85729
86436
|
async function budget({ context, args }) {
|
|
85730
|
-
const machine2 =
|
|
85731
|
-
const budgetUsd = Number(
|
|
86437
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
86438
|
+
const budgetUsd = Number(wordAt6({ args, at: 3 }));
|
|
85732
86439
|
const named = flagText({ args, name: "period" });
|
|
85733
86440
|
const periods = MACHINE_BUDGET_PERIODS;
|
|
85734
86441
|
if (!(budgetUsd >= 0) || named && !periods.includes(named)) {
|
|
@@ -86054,6 +86761,10 @@ var MCP_SECRET_COMMANDS = {
|
|
|
86054
86761
|
"connect mcp-key": { instead: "connect mcp" },
|
|
86055
86762
|
"connect card-key": { instead: "connect card" },
|
|
86056
86763
|
"openclaw connect": { vaultFlag: "from-vault", secretFlags: ["token"] },
|
|
86764
|
+
"discord save-app": {
|
|
86765
|
+
vaultFlag: "from-vault",
|
|
86766
|
+
secretFlags: ["client-secret", "bot-token", "token", "secret"]
|
|
86767
|
+
},
|
|
86057
86768
|
"whatsapp-business connect": {
|
|
86058
86769
|
vaultFlag: "from-vault",
|
|
86059
86770
|
secretFlags: ["access-token", "app-secret", "token", "secret"]
|
|
@@ -86251,14 +86962,14 @@ async function serveMcp({
|
|
|
86251
86962
|
}
|
|
86252
86963
|
|
|
86253
86964
|
// src/services/mount-files.service.ts
|
|
86254
|
-
import { mkdir as mkdir21, readFile as
|
|
86255
|
-
import { dirname as dirname20, relative as relative5, resolve as
|
|
86965
|
+
import { mkdir as mkdir21, readFile as readFile34, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
|
|
86966
|
+
import { dirname as dirname20, relative as relative5, resolve as resolve14 } from "node:path";
|
|
86256
86967
|
async function textArgument({
|
|
86257
86968
|
context,
|
|
86258
86969
|
value
|
|
86259
86970
|
}) {
|
|
86260
86971
|
if (value === "-") return context.readStdin();
|
|
86261
|
-
if (value.startsWith("@")) return
|
|
86972
|
+
if (value.startsWith("@")) return readFile34(resolve14(context.cwd, value.slice(1)), "utf8");
|
|
86262
86973
|
return value;
|
|
86263
86974
|
}
|
|
86264
86975
|
function turnChannel({ context, args }) {
|
|
@@ -86270,11 +86981,11 @@ async function writeMount({
|
|
|
86270
86981
|
folder,
|
|
86271
86982
|
files: files2
|
|
86272
86983
|
}) {
|
|
86273
|
-
const root =
|
|
86984
|
+
const root = resolve14(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
86274
86985
|
await rm12(root, { recursive: true, force: true });
|
|
86275
86986
|
await mkdir21(root, { recursive: true });
|
|
86276
86987
|
for (const file3 of files2) {
|
|
86277
|
-
const target =
|
|
86988
|
+
const target = resolve14(root, file3.path);
|
|
86278
86989
|
const inside = relative5(root, target);
|
|
86279
86990
|
if (!inside || inside.startsWith(".."))
|
|
86280
86991
|
throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
|
|
@@ -86554,9 +87265,9 @@ function monitorRowOf(monitor) {
|
|
|
86554
87265
|
}
|
|
86555
87266
|
async function monitorAdd({ context, args }) {
|
|
86556
87267
|
const name3 = args.words[2];
|
|
86557
|
-
const
|
|
87268
|
+
const channels3 = flagText({ args, name: "channel" });
|
|
86558
87269
|
const prompt = flagText({ args, name: "prompt" });
|
|
86559
|
-
if (!name3 || !
|
|
87270
|
+
if (!name3 || !channels3 || !prompt) throw new CliUsageError(ADD_USAGE);
|
|
86560
87271
|
const matches = flagText({ args, name: "matches" });
|
|
86561
87272
|
const maxRuns = flagText({ args, name: "max-runs-per-day" });
|
|
86562
87273
|
if (maxRuns && !/^\d+$/.test(maxRuns)) throw new CliUsageError(ADD_USAGE);
|
|
@@ -86564,7 +87275,7 @@ async function monitorAdd({ context, args }) {
|
|
|
86564
87275
|
const added = await client.post("/api/agents/monitors", {
|
|
86565
87276
|
...agentOf(args),
|
|
86566
87277
|
name: name3,
|
|
86567
|
-
channels:
|
|
87278
|
+
channels: channels3,
|
|
86568
87279
|
prompt,
|
|
86569
87280
|
from: flagText({ args, name: "from", fallback: "anyone" }),
|
|
86570
87281
|
bots: flagText({ args, name: "not-from" }) !== "bots",
|
|
@@ -86646,14 +87357,14 @@ ${USAGE13}`);
|
|
|
86646
87357
|
return text2 === "on";
|
|
86647
87358
|
}
|
|
86648
87359
|
function changesOf(args) {
|
|
86649
|
-
const
|
|
86650
|
-
if (
|
|
87360
|
+
const channels3 = flagText({ args, name: "channels" });
|
|
87361
|
+
if (channels3 && !["all", "mentions", "nothing"].includes(channels3))
|
|
86651
87362
|
throw new CliUsageError(`--channels takes all, mentions or nothing.
|
|
86652
87363
|
${USAGE13}`);
|
|
86653
87364
|
const keywords = typeof args.flags.keywords === "string" ? args.flags.keywords : void 0;
|
|
86654
87365
|
const emailAfter = flagText({ args, name: "email-after" });
|
|
86655
87366
|
const changes2 = {
|
|
86656
|
-
channelDefault:
|
|
87367
|
+
channelDefault: channels3 || void 0,
|
|
86657
87368
|
keywords: keywords?.split(",").map((word3) => word3.trim()).filter(Boolean),
|
|
86658
87369
|
dndEnabled: switchOf({ args, name: "dnd" }),
|
|
86659
87370
|
dndStart: flagText({ args, name: "dnd-from" }) || void 0,
|
|
@@ -86705,7 +87416,7 @@ async function notifications({ context, args }) {
|
|
|
86705
87416
|
}
|
|
86706
87417
|
|
|
86707
87418
|
// src/services/openclaw-commands.service.ts
|
|
86708
|
-
import { resolve as
|
|
87419
|
+
import { resolve as resolve15 } from "node:path";
|
|
86709
87420
|
var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who connects it):
|
|
86710
87421
|
laze openclaw list the gateways connected here and their agents
|
|
86711
87422
|
laze openclaw connect <wss url> [--label <label>] (< token | --from-file <file> | --from-vault <connection>)
|
|
@@ -86721,13 +87432,13 @@ var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who
|
|
|
86721
87432
|
as its profile for that folder here, never printed; its previous key stops working
|
|
86722
87433
|
laze openclaw feed <connectionId> on|off temporary Workboard migration bridge, off by default
|
|
86723
87434
|
laze openclaw disconnect <connectionId> remove it, its Laze agents and its credentials`;
|
|
86724
|
-
function
|
|
87435
|
+
function wordAt7(args, index) {
|
|
86725
87436
|
const word3 = args.words[index];
|
|
86726
87437
|
if (!word3) throw new CliUsageError(OPENCLAW_USAGE);
|
|
86727
87438
|
return word3;
|
|
86728
87439
|
}
|
|
86729
87440
|
function switchAt(args, index) {
|
|
86730
|
-
const word3 =
|
|
87441
|
+
const word3 = wordAt7(args, index);
|
|
86731
87442
|
if (word3 !== "on" && word3 !== "off") throw new CliUsageError(OPENCLAW_USAGE);
|
|
86732
87443
|
return word3 === "on";
|
|
86733
87444
|
}
|
|
@@ -86738,7 +87449,7 @@ function scheduleLine(cron) {
|
|
|
86738
87449
|
return ` schedule ${cron.name} ${cron.schedule} ${next} ${last}
|
|
86739
87450
|
`;
|
|
86740
87451
|
}
|
|
86741
|
-
function
|
|
87452
|
+
function printConnection3({
|
|
86742
87453
|
context,
|
|
86743
87454
|
connection
|
|
86744
87455
|
}) {
|
|
@@ -86768,16 +87479,16 @@ function answer3({
|
|
|
86768
87479
|
}) {
|
|
86769
87480
|
if (args.flags.json) return context.out(`${JSON.stringify(connection, null, 2)}
|
|
86770
87481
|
`);
|
|
86771
|
-
|
|
87482
|
+
printConnection3({ context, connection });
|
|
86772
87483
|
}
|
|
86773
87484
|
var list10 = async ({ context, args, client }) => {
|
|
86774
|
-
const
|
|
86775
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
87485
|
+
const overview3 = await client.get(OPENCLAW_KEY_PATHS.overview);
|
|
87486
|
+
if (args.flags.json) return context.out(`${JSON.stringify(overview3, null, 2)}
|
|
86776
87487
|
`);
|
|
86777
|
-
if (
|
|
87488
|
+
if (overview3.connections.length === 0) {
|
|
86778
87489
|
return context.out("No OpenClaw gateways yet. Connect one with laze openclaw connect.\n");
|
|
86779
87490
|
}
|
|
86780
|
-
for (const connection of
|
|
87491
|
+
for (const connection of overview3.connections) printConnection3({ context, connection });
|
|
86781
87492
|
};
|
|
86782
87493
|
async function tokenOf({ context, args }) {
|
|
86783
87494
|
const vaulted = args.flags["from-vault"];
|
|
@@ -86795,8 +87506,8 @@ var connectLocal = async ({ context, args, client, url: url2 }) => {
|
|
|
86795
87506
|
);
|
|
86796
87507
|
let answer5;
|
|
86797
87508
|
if (kept) {
|
|
86798
|
-
const
|
|
86799
|
-
if (
|
|
87509
|
+
const overview3 = await client.get(OPENCLAW_KEY_PATHS.overview);
|
|
87510
|
+
if (overview3.connections.some((connection2) => connection2.id === kept[0])) {
|
|
86800
87511
|
answer5 = await client.post(OPENCLAW_KEY_PATHS.relayKey, {
|
|
86801
87512
|
connectionId: kept[0]
|
|
86802
87513
|
});
|
|
@@ -86816,7 +87527,7 @@ var connectLocal = async ({ context, args, client, url: url2 }) => {
|
|
|
86816
87527
|
const service = await installConnectService({ context });
|
|
86817
87528
|
if (args.flags.json) return context.out(`${JSON.stringify(connection, null, 2)}
|
|
86818
87529
|
`);
|
|
86819
|
-
|
|
87530
|
+
printConnection3({ context, connection });
|
|
86820
87531
|
context.out(
|
|
86821
87532
|
`${kept && answer5.connection.id === kept[0] ? "Reused" : "Connected"} ${connection.label} as a local gateway: Laze reaches it through the relay in the laze connect service, never by its address.
|
|
86822
87533
|
${service}
|
|
@@ -86826,7 +87537,7 @@ ${service}
|
|
|
86826
87537
|
var connect3 = async (input2) => {
|
|
86827
87538
|
if (input2.args.flags.local === true) return connectLocal(input2);
|
|
86828
87539
|
const { context, args, client } = input2;
|
|
86829
|
-
const gatewayUrl2 =
|
|
87540
|
+
const gatewayUrl2 = wordAt7(args, 2);
|
|
86830
87541
|
const label3 = flagText({ args, name: "label" });
|
|
86831
87542
|
const connection = await client.post(OPENCLAW_KEY_PATHS.connect, {
|
|
86832
87543
|
gatewayUrl: gatewayUrl2,
|
|
@@ -86839,8 +87550,8 @@ var agent = async (input2) => {
|
|
|
86839
87550
|
const { context, args, client } = input2;
|
|
86840
87551
|
const enabled = switchAt(args, 4);
|
|
86841
87552
|
const connection = await client.post(OPENCLAW_KEY_PATHS.setAgent, {
|
|
86842
|
-
connectionId:
|
|
86843
|
-
openclawAgentId:
|
|
87553
|
+
connectionId: wordAt7(args, 2),
|
|
87554
|
+
openclawAgentId: wordAt7(args, 3),
|
|
86844
87555
|
enabled
|
|
86845
87556
|
});
|
|
86846
87557
|
answer3({ context, args, connection });
|
|
@@ -86851,12 +87562,12 @@ function profileNameOf(agentName) {
|
|
|
86851
87562
|
}
|
|
86852
87563
|
var agentKey = async ({ context, args, client, url: url2 }) => {
|
|
86853
87564
|
const key = await client.post(OPENCLAW_KEY_PATHS.agentKey, {
|
|
86854
|
-
connectionId:
|
|
86855
|
-
openclawAgentId:
|
|
87565
|
+
connectionId: wordAt7(args, 2),
|
|
87566
|
+
openclawAgentId: wordAt7(args, 3)
|
|
86856
87567
|
});
|
|
86857
87568
|
const login2 = flagText({ args, name: "login" });
|
|
86858
87569
|
if (login2) {
|
|
86859
|
-
const folder =
|
|
87570
|
+
const folder = resolve15(context.cwd, login2);
|
|
86860
87571
|
const profile = profileNameOf(key.agentName);
|
|
86861
87572
|
await signInFolder({ context, url: url2, token: key.token, name: profile, folder });
|
|
86862
87573
|
context.out(
|
|
@@ -86877,31 +87588,31 @@ In the agent's own folder on its machine run:
|
|
|
86877
87588
|
};
|
|
86878
87589
|
var feed2 = async ({ context, args, client }) => {
|
|
86879
87590
|
const connection = await client.post(OPENCLAW_KEY_PATHS.setFeed, {
|
|
86880
|
-
connectionId:
|
|
87591
|
+
connectionId: wordAt7(args, 2),
|
|
86881
87592
|
enabled: switchAt(args, 3)
|
|
86882
87593
|
});
|
|
86883
87594
|
answer3({ context, args, connection });
|
|
86884
87595
|
};
|
|
86885
|
-
var
|
|
86886
|
-
const connectionId =
|
|
87596
|
+
var disconnect3 = async ({ context, args, client }) => {
|
|
87597
|
+
const connectionId = wordAt7(args, 2);
|
|
86887
87598
|
await client.post(OPENCLAW_KEY_PATHS.disconnect, { connectionId });
|
|
86888
87599
|
context.out(`Disconnected ${connectionId}.
|
|
86889
87600
|
`);
|
|
86890
87601
|
};
|
|
86891
|
-
var
|
|
87602
|
+
var RUNS4 = {
|
|
86892
87603
|
list: list10,
|
|
86893
87604
|
connect: connect3,
|
|
86894
87605
|
agent,
|
|
86895
87606
|
"agent-key": agentKey,
|
|
86896
87607
|
feed: feed2,
|
|
86897
|
-
disconnect:
|
|
87608
|
+
disconnect: disconnect3
|
|
86898
87609
|
};
|
|
86899
87610
|
async function openclaw({
|
|
86900
87611
|
context,
|
|
86901
87612
|
args
|
|
86902
87613
|
}) {
|
|
86903
87614
|
const verb = args.words[1] ?? "list";
|
|
86904
|
-
const run4 = Object.hasOwn(
|
|
87615
|
+
const run4 = Object.hasOwn(RUNS4, verb) ? RUNS4[verb] : void 0;
|
|
86905
87616
|
if (!run4) throw new CliUsageError(OPENCLAW_USAGE);
|
|
86906
87617
|
const { client, profile } = await signedIn({ context, args });
|
|
86907
87618
|
await run4({ context, args, client, url: profile.url });
|
|
@@ -86937,7 +87648,7 @@ ${OPS_USAGE}`);
|
|
|
86937
87648
|
}
|
|
86938
87649
|
|
|
86939
87650
|
// src/services/release-watch.service.ts
|
|
86940
|
-
import { mkdir as mkdir22, readFile as
|
|
87651
|
+
import { mkdir as mkdir22, readFile as readFile35, realpath, writeFile as writeFile22 } from "node:fs/promises";
|
|
86941
87652
|
import { dirname as dirname21, join as join24 } from "node:path";
|
|
86942
87653
|
|
|
86943
87654
|
// src/rules/cli-update.rules.ts
|
|
@@ -86994,13 +87705,13 @@ var RELEASE_AGE_SETTINGS = {
|
|
|
86994
87705
|
{ setting: "minimum-release-age", read: ["pnpm", "config", "get", "minimum-release-age"] }
|
|
86995
87706
|
]
|
|
86996
87707
|
};
|
|
86997
|
-
function settingValueOf({ printed }) {
|
|
86998
|
-
const value =
|
|
87708
|
+
function settingValueOf({ printed: printed2 }) {
|
|
87709
|
+
const value = printed2.trim();
|
|
86999
87710
|
return value === "" || value === "null" || value === "undefined" || value === "0" ? null : value;
|
|
87000
87711
|
}
|
|
87001
87712
|
var VERSION_LINE = /^laze (\S+)\s*$/m;
|
|
87002
|
-
function printedVersionOf({ printed }) {
|
|
87003
|
-
return VERSION_LINE.exec(
|
|
87713
|
+
function printedVersionOf({ printed: printed2 }) {
|
|
87714
|
+
return VERSION_LINE.exec(printed2)?.[1] ?? null;
|
|
87004
87715
|
}
|
|
87005
87716
|
function heldBackLineOf({
|
|
87006
87717
|
manager,
|
|
@@ -87086,7 +87797,7 @@ async function startedUpdate({
|
|
|
87086
87797
|
if (plan2.kind !== "install") return null;
|
|
87087
87798
|
const folder = dirname21(context.environment.configPath);
|
|
87088
87799
|
const stamp = join24(folder, "auto-update.json");
|
|
87089
|
-
const last = await
|
|
87800
|
+
const last = await readFile35(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
87090
87801
|
const now = context.nowMs();
|
|
87091
87802
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
87092
87803
|
await mkdir22(folder, { recursive: true, mode: 448 });
|
|
@@ -87130,7 +87841,7 @@ function watchingRelease({
|
|
|
87130
87841
|
}
|
|
87131
87842
|
|
|
87132
87843
|
// src/services/rush-guard.service.ts
|
|
87133
|
-
import { readFile as
|
|
87844
|
+
import { readFile as readFile36, rm as rm13 } from "node:fs/promises";
|
|
87134
87845
|
var WATCH_MS3 = 2e3;
|
|
87135
87846
|
var RETRY_MS2 = 3e4;
|
|
87136
87847
|
async function guardRound(guard) {
|
|
@@ -87173,7 +87884,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
87173
87884
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
|
87174
87885
|
const { client, name: name3 } = await signedIn({ context, args });
|
|
87175
87886
|
const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
87176
|
-
const note = await
|
|
87887
|
+
const note = await readFile36(noted, "utf8").then(
|
|
87177
87888
|
(text2) => JSON.parse(text2),
|
|
87178
87889
|
() => void 0
|
|
87179
87890
|
);
|
|
@@ -87342,8 +88053,8 @@ async function schedule({ context, args }) {
|
|
|
87342
88053
|
}
|
|
87343
88054
|
|
|
87344
88055
|
// src/services/skill-commands.service.ts
|
|
87345
|
-
import { readdir as readdir7, readFile as
|
|
87346
|
-
import { join as join25, relative as relative6, resolve as
|
|
88056
|
+
import { readdir as readdir7, readFile as readFile37 } from "node:fs/promises";
|
|
88057
|
+
import { join as join25, relative as relative6, resolve as resolve16 } from "node:path";
|
|
87347
88058
|
var USAGE15 = `Usage:
|
|
87348
88059
|
laze skill list [--agent <agentId>]
|
|
87349
88060
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -87365,7 +88076,7 @@ async function folderFiles({ root }) {
|
|
|
87365
88076
|
for (const entry of entries) {
|
|
87366
88077
|
if (!entry.isFile()) continue;
|
|
87367
88078
|
const full = join25(entry.parentPath, entry.name);
|
|
87368
|
-
files2.push({ path: relative6(root, full), content: await
|
|
88079
|
+
files2.push({ path: relative6(root, full), content: await readFile37(full, "utf8") });
|
|
87369
88080
|
}
|
|
87370
88081
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
87371
88082
|
}
|
|
@@ -87396,7 +88107,7 @@ async function skillInstall({ context, args }) {
|
|
|
87396
88107
|
if (!catalogueId === !from) throw new CliUsageError(USAGE15);
|
|
87397
88108
|
const name3 = flagText({ args, name: "as" });
|
|
87398
88109
|
const agent2 = flagText({ args, name: "agent" });
|
|
87399
|
-
const files2 = from ? await folderFiles({ root:
|
|
88110
|
+
const files2 = from ? await folderFiles({ root: resolve16(context.cwd, from) }) : void 0;
|
|
87400
88111
|
const { client } = await signedIn({ context, args });
|
|
87401
88112
|
const installed = await client.post("/api/skills/install", {
|
|
87402
88113
|
...catalogueId ? { catalogueId } : {},
|
|
@@ -87463,7 +88174,7 @@ async function skillUpdate({ context, args }) {
|
|
|
87463
88174
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
87464
88175
|
throw new CliUsageError(USAGE15);
|
|
87465
88176
|
}
|
|
87466
|
-
const skillMd = skillMdFile ? await
|
|
88177
|
+
const skillMd = skillMdFile ? await readFile37(resolve16(context.cwd, skillMdFile), "utf8") : void 0;
|
|
87467
88178
|
const { client } = await signedIn({ context, args });
|
|
87468
88179
|
const updated = await client.post("/api/skills/update", {
|
|
87469
88180
|
name: name3,
|
|
@@ -87509,8 +88220,8 @@ async function skill({ context, args }) {
|
|
|
87509
88220
|
}
|
|
87510
88221
|
|
|
87511
88222
|
// src/services/slack-commands.service.ts
|
|
87512
|
-
import { readFile as
|
|
87513
|
-
import { resolve as
|
|
88223
|
+
import { readFile as readFile38 } from "node:fs/promises";
|
|
88224
|
+
import { resolve as resolve17 } from "node:path";
|
|
87514
88225
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
87515
88226
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
87516
88227
|
laze slack link-prompts Slack workspaces you have not linked yet
|
|
@@ -87540,27 +88251,27 @@ var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins
|
|
|
87540
88251
|
laze slack move <teamId> <channelId>... [--name <name>] [--invite <slackUserId>]...
|
|
87541
88252
|
[--farewell <text>] move channels to Laze
|
|
87542
88253
|
laze slack cancel-move <moveId> stop a move that has not switched yet`;
|
|
87543
|
-
var
|
|
87544
|
-
function
|
|
88254
|
+
var SECRET_FLAGS3 = ["token", "config-token", "client-secret", "signing-secret", "value"];
|
|
88255
|
+
function json5({ context, args, data }) {
|
|
87545
88256
|
if (!args.flags.json) return false;
|
|
87546
88257
|
context.out(`${JSON.stringify(data, null, 2)}
|
|
87547
88258
|
`);
|
|
87548
88259
|
return true;
|
|
87549
88260
|
}
|
|
87550
|
-
function
|
|
88261
|
+
function wordAt8(args, index) {
|
|
87551
88262
|
const word3 = args.words[index];
|
|
87552
88263
|
if (!word3) throw new CliUsageError(SLACK_USAGE);
|
|
87553
88264
|
return word3;
|
|
87554
88265
|
}
|
|
87555
88266
|
async function secretLines({ context, args }) {
|
|
87556
|
-
if (
|
|
88267
|
+
if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
87557
88268
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
87558
88269
|
}
|
|
87559
88270
|
const file3 = flagText({ args, name: "from-file" });
|
|
87560
|
-
const text2 = file3 ? await
|
|
88271
|
+
const text2 = file3 ? await readFile38(resolve17(context.cwd, file3), "utf8") : await context.readStdin();
|
|
87561
88272
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
87562
88273
|
}
|
|
87563
|
-
async function
|
|
88274
|
+
async function secretsOf2({
|
|
87564
88275
|
context,
|
|
87565
88276
|
args,
|
|
87566
88277
|
fields
|
|
@@ -87578,32 +88289,32 @@ function printLink2({ context, label: label3, url: url2 }) {
|
|
|
87578
88289
|
${url2}
|
|
87579
88290
|
`);
|
|
87580
88291
|
}
|
|
87581
|
-
function
|
|
88292
|
+
function authorizeRun2(path, label3, body) {
|
|
87582
88293
|
return async ({ context, args, client }) => {
|
|
87583
88294
|
const started = await client.post(path, body(args));
|
|
87584
|
-
if (
|
|
88295
|
+
if (json5({ context, args, data: started })) return;
|
|
87585
88296
|
printLink2({ context, label: label3, url: started.authorizeUrl });
|
|
87586
88297
|
};
|
|
87587
88298
|
}
|
|
87588
|
-
function
|
|
88299
|
+
function printConnection4({ context, row }) {
|
|
87589
88300
|
const link = row.viewerLinkState ?? "not linked";
|
|
87590
88301
|
context.out(
|
|
87591
88302
|
`${row.teamId} ${row.label ?? row.teamName} ${row.status} ${row.mirrors.length} mirrored ${row.linkedPeople} linked you: ${link}
|
|
87592
88303
|
`
|
|
87593
88304
|
);
|
|
87594
88305
|
}
|
|
87595
|
-
function
|
|
88306
|
+
function connectionRun2(path, body) {
|
|
87596
88307
|
return async ({ context, args, client }) => {
|
|
87597
88308
|
const row = await client.post(path, body(args));
|
|
87598
|
-
if (
|
|
87599
|
-
|
|
88309
|
+
if (json5({ context, args, data: row })) return;
|
|
88310
|
+
printConnection4({ context, row });
|
|
87600
88311
|
};
|
|
87601
88312
|
}
|
|
87602
|
-
var
|
|
88313
|
+
var overview2 = async ({ context, args, client }) => {
|
|
87603
88314
|
const view = await client.get(SLACK_KEY_PATHS.overview);
|
|
87604
|
-
if (
|
|
88315
|
+
if (json5({ context, args, data: view })) return;
|
|
87605
88316
|
if (view.connections.length === 0) return context.out("No Slack workspace is connected.\n");
|
|
87606
|
-
for (const row of view.connections)
|
|
88317
|
+
for (const row of view.connections) printConnection4({ context, row });
|
|
87607
88318
|
};
|
|
87608
88319
|
function printPrompts({ context, answer: answer5 }) {
|
|
87609
88320
|
if (answer5.prompts.length === 0) return context.out("Nothing to link.\n");
|
|
@@ -87614,21 +88325,21 @@ function printPrompts({ context, answer: answer5 }) {
|
|
|
87614
88325
|
}
|
|
87615
88326
|
var linkPrompts = async ({ context, args, client }) => {
|
|
87616
88327
|
const answer5 = await client.get(SLACK_KEY_PATHS.linkPrompts);
|
|
87617
|
-
if (
|
|
88328
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87618
88329
|
printPrompts({ context, answer: answer5 });
|
|
87619
88330
|
};
|
|
87620
88331
|
var dismissLinkPrompt = async ({ context, args, client }) => {
|
|
87621
88332
|
const answer5 = await client.post(SLACK_KEY_PATHS.dismissLinkPrompt, {
|
|
87622
|
-
kind:
|
|
88333
|
+
kind: wordAt8(args, 2)
|
|
87623
88334
|
});
|
|
87624
|
-
if (
|
|
88335
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87625
88336
|
printPrompts({ context, answer: answer5 });
|
|
87626
88337
|
};
|
|
87627
88338
|
var people = async ({ context, args, client }) => {
|
|
87628
88339
|
const answer5 = await client.post(SLACK_KEY_PATHS.people, {
|
|
87629
88340
|
query: args.words.slice(2).join(" ")
|
|
87630
88341
|
});
|
|
87631
|
-
if (
|
|
88342
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87632
88343
|
if (answer5.people.length === 0) return context.out("No one found.\n");
|
|
87633
88344
|
for (const person of answer5.people) {
|
|
87634
88345
|
context.out(`${person.teamId} ${person.slackUserId} ${person.name}
|
|
@@ -87639,7 +88350,7 @@ var profiles = async ({ context, args, client }) => {
|
|
|
87639
88350
|
const answer5 = await client.post(SLACK_KEY_PATHS.profiles, {
|
|
87640
88351
|
ids: args.words.slice(2)
|
|
87641
88352
|
});
|
|
87642
|
-
if (
|
|
88353
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87643
88354
|
if (answer5.profiles.length === 0) return context.out("No one found.\n");
|
|
87644
88355
|
for (const each of answer5.profiles) {
|
|
87645
88356
|
const status9 = each.status ? `${each.status.emoji} ${each.status.text}`.trim() : "";
|
|
@@ -87649,25 +88360,25 @@ var profiles = async ({ context, args, client }) => {
|
|
|
87649
88360
|
};
|
|
87650
88361
|
var bookmarks = async ({ context, args, client }) => {
|
|
87651
88362
|
const answer5 = await client.post(SLACK_KEY_PATHS.bookmarks, {
|
|
87652
|
-
channelId:
|
|
88363
|
+
channelId: wordAt8(args, 2)
|
|
87653
88364
|
});
|
|
87654
|
-
if (
|
|
88365
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87655
88366
|
if (answer5.bookmarks.length === 0) return context.out("No bookmarks.\n");
|
|
87656
88367
|
for (const each of answer5.bookmarks) context.out(`${each.title} ${each.link}
|
|
87657
88368
|
`);
|
|
87658
88369
|
};
|
|
87659
88370
|
var dm = async ({ context, args, client }) => {
|
|
87660
88371
|
const opened = await client.post(SLACK_KEY_PATHS.direct, {
|
|
87661
|
-
teamId:
|
|
87662
|
-
slackUserId:
|
|
88372
|
+
teamId: wordAt8(args, 2),
|
|
88373
|
+
slackUserId: wordAt8(args, 3)
|
|
87663
88374
|
});
|
|
87664
|
-
if (
|
|
88375
|
+
if (json5({ context, args, data: opened })) return;
|
|
87665
88376
|
context.out(`${opened.channelId}
|
|
87666
88377
|
`);
|
|
87667
88378
|
};
|
|
87668
|
-
var
|
|
87669
|
-
const secrets = await
|
|
87670
|
-
await
|
|
88379
|
+
var setup3 = async ({ context, args, client }) => {
|
|
88380
|
+
const secrets = await secretsOf2({ context, args, fields: ["configToken"] });
|
|
88381
|
+
await authorizeRun2(
|
|
87671
88382
|
SLACK_KEY_PATHS.setup,
|
|
87672
88383
|
"Open this link to install the Laze app in Slack",
|
|
87673
88384
|
() => secrets
|
|
@@ -87675,7 +88386,7 @@ var setup2 = async ({ context, args, client }) => {
|
|
|
87675
88386
|
};
|
|
87676
88387
|
var beginSetup = async ({ context, args, client }) => {
|
|
87677
88388
|
const started = await client.post(SLACK_KEY_PATHS.beginSetup, {});
|
|
87678
|
-
if (
|
|
88389
|
+
if (json5({ context, args, data: started })) return;
|
|
87679
88390
|
context.out(`App key: ${started.appKey}
|
|
87680
88391
|
`);
|
|
87681
88392
|
if (started.savedAppId)
|
|
@@ -87695,30 +88406,30 @@ var credentials = async ({ context, args, client }) => {
|
|
|
87695
88406
|
const appId = flagText({ args, name: "app-id" });
|
|
87696
88407
|
const clientId = flagText({ args, name: "client-id" });
|
|
87697
88408
|
if (!appId || !clientId) throw new CliUsageError(SLACK_USAGE);
|
|
87698
|
-
const secrets = await
|
|
87699
|
-
const body = { appKey:
|
|
87700
|
-
await
|
|
88409
|
+
const secrets = await secretsOf2({ context, args, fields: ["clientSecret", "signingSecret"] });
|
|
88410
|
+
const body = { appKey: wordAt8(args, 2), appId, clientId, ...secrets };
|
|
88411
|
+
await authorizeRun2(
|
|
87701
88412
|
SLACK_KEY_PATHS.credentials,
|
|
87702
88413
|
"Open this link to install the app",
|
|
87703
88414
|
() => body
|
|
87704
88415
|
)({ context, args, client });
|
|
87705
88416
|
};
|
|
87706
88417
|
var updateApp = async ({ context, args, client }) => {
|
|
87707
|
-
const teamId =
|
|
87708
|
-
const secrets = await
|
|
88418
|
+
const teamId = wordAt8(args, 2);
|
|
88419
|
+
const secrets = await secretsOf2({ context, args, fields: ["configToken"] });
|
|
87709
88420
|
const answer5 = await client.post(SLACK_KEY_PATHS.updateApp, {
|
|
87710
88421
|
teamId,
|
|
87711
88422
|
...secrets
|
|
87712
88423
|
});
|
|
87713
|
-
if (
|
|
88424
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87714
88425
|
context.out(`Updated the Slack app of ${teamId}.
|
|
87715
88426
|
`);
|
|
87716
88427
|
};
|
|
87717
|
-
var
|
|
88428
|
+
var channels2 = async ({ context, args, client }) => {
|
|
87718
88429
|
const rows = await client.post(SLACK_KEY_PATHS.channels, {
|
|
87719
|
-
teamId:
|
|
88430
|
+
teamId: wordAt8(args, 2)
|
|
87720
88431
|
});
|
|
87721
|
-
if (
|
|
88432
|
+
if (json5({ context, args, data: rows })) return;
|
|
87722
88433
|
for (const row of rows) {
|
|
87723
88434
|
const mirrored = row.mirrored ? " mirrored" : "";
|
|
87724
88435
|
context.out(`${row.id} #${row.name} ${row.memberCount} members${mirrored}
|
|
@@ -87726,32 +88437,32 @@ var channels = async ({ context, args, client }) => {
|
|
|
87726
88437
|
}
|
|
87727
88438
|
};
|
|
87728
88439
|
function mirrorBody(args) {
|
|
87729
|
-
const state =
|
|
88440
|
+
const state = wordAt8(args, 4);
|
|
87730
88441
|
if (state !== "on" && state !== "off") throw new CliUsageError(SLACK_USAGE);
|
|
87731
|
-
return { teamId:
|
|
88442
|
+
return { teamId: wordAt8(args, 2), slackChannelId: wordAt8(args, 3), mirrored: state === "on" };
|
|
87732
88443
|
}
|
|
87733
|
-
function
|
|
88444
|
+
function numberFlag3(args, name3) {
|
|
87734
88445
|
const text2 = flagText({ args, name: name3 });
|
|
87735
88446
|
if (!text2) return void 0;
|
|
87736
88447
|
const value = Number(text2);
|
|
87737
88448
|
if (!Number.isInteger(value)) throw new CliUsageError(`--${name3} takes a whole number.`);
|
|
87738
88449
|
return value;
|
|
87739
88450
|
}
|
|
87740
|
-
function
|
|
88451
|
+
function updateBody2(args) {
|
|
87741
88452
|
const label3 = flagText({ args, name: "label" });
|
|
87742
|
-
const cacheDays =
|
|
87743
|
-
const readBudgetPages =
|
|
88453
|
+
const cacheDays = numberFlag3(args, "cache-days");
|
|
88454
|
+
const readBudgetPages = numberFlag3(args, "read-budget");
|
|
87744
88455
|
return {
|
|
87745
|
-
teamId:
|
|
88456
|
+
teamId: wordAt8(args, 2),
|
|
87746
88457
|
...label3 && { label: label3 === "none" ? null : label3 },
|
|
87747
88458
|
...cacheDays !== void 0 && { cacheDays },
|
|
87748
88459
|
...readBudgetPages !== void 0 && { readBudgetPages }
|
|
87749
88460
|
};
|
|
87750
88461
|
}
|
|
87751
|
-
var
|
|
87752
|
-
const teamId =
|
|
88462
|
+
var disconnect4 = async ({ context, args, client }) => {
|
|
88463
|
+
const teamId = wordAt8(args, 2);
|
|
87753
88464
|
const answer5 = await client.post(SLACK_KEY_PATHS.disconnect, { teamId });
|
|
87754
|
-
if (
|
|
88465
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87755
88466
|
context.out(`Disconnected ${teamId}.
|
|
87756
88467
|
`);
|
|
87757
88468
|
};
|
|
@@ -87762,16 +88473,16 @@ function printMove({ context, move: move3 }) {
|
|
|
87762
88473
|
}
|
|
87763
88474
|
var moves = async ({ context, args, client }) => {
|
|
87764
88475
|
const answer5 = await client.get(SLACK_KEY_PATHS.moves);
|
|
87765
|
-
if (
|
|
88476
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87766
88477
|
if (answer5.moves.length === 0) context.out("No moves yet.\n");
|
|
87767
88478
|
for (const move3 of answer5.moves) printMove({ context, move: move3 });
|
|
87768
88479
|
};
|
|
87769
88480
|
var movePreview = async ({ context, args, client }) => {
|
|
87770
88481
|
const preview = await client.post(SLACK_KEY_PATHS.movePreview, {
|
|
87771
|
-
teamId:
|
|
87772
|
-
slackChannelId:
|
|
88482
|
+
teamId: wordAt8(args, 2),
|
|
88483
|
+
slackChannelId: wordAt8(args, 3)
|
|
87773
88484
|
});
|
|
87774
|
-
if (
|
|
88485
|
+
if (json5({ context, args, data: preview })) return;
|
|
87775
88486
|
context.out(`#${preview.slackName} -> #${preview.name} ${preview.linkedMembers} members move
|
|
87776
88487
|
`);
|
|
87777
88488
|
for (const person of preview.leftBehind) {
|
|
@@ -87790,7 +88501,7 @@ function moveBody(args) {
|
|
|
87790
88501
|
const farewell = flagText({ args, name: "farewell" });
|
|
87791
88502
|
const invite3 = args.lists.invite ?? [];
|
|
87792
88503
|
return {
|
|
87793
|
-
teamId:
|
|
88504
|
+
teamId: wordAt8(args, 2),
|
|
87794
88505
|
channels: ids.map((slackChannelId) => ({
|
|
87795
88506
|
slackChannelId,
|
|
87796
88507
|
...name3 && { name: name3 },
|
|
@@ -87801,7 +88512,7 @@ function moveBody(args) {
|
|
|
87801
88512
|
}
|
|
87802
88513
|
var move2 = async ({ context, args, client }) => {
|
|
87803
88514
|
const answer5 = await client.post(SLACK_KEY_PATHS.startMoves, moveBody(args));
|
|
87804
|
-
if (
|
|
88515
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87805
88516
|
for (const one of answer5.started) {
|
|
87806
88517
|
if (one.move) printMove({ context, move: one.move });
|
|
87807
88518
|
else context.out(`${one.slackChannelId} refused: ${one.refused?.message ?? ""}
|
|
@@ -87810,40 +88521,40 @@ var move2 = async ({ context, args, client }) => {
|
|
|
87810
88521
|
};
|
|
87811
88522
|
var cancelMove = async ({ context, args, client }) => {
|
|
87812
88523
|
const moved = await client.post(SLACK_KEY_PATHS.cancelMove, {
|
|
87813
|
-
moveId:
|
|
88524
|
+
moveId: wordAt8(args, 2)
|
|
87814
88525
|
});
|
|
87815
|
-
if (
|
|
88526
|
+
if (json5({ context, args, data: moved })) return;
|
|
87816
88527
|
printMove({ context, move: moved });
|
|
87817
88528
|
};
|
|
87818
|
-
var teamOf = (args) => ({ teamId:
|
|
87819
|
-
var
|
|
87820
|
-
overview,
|
|
88529
|
+
var teamOf = (args) => ({ teamId: wordAt8(args, 2) });
|
|
88530
|
+
var RUNS5 = {
|
|
88531
|
+
overview: overview2,
|
|
87821
88532
|
"link-prompts": linkPrompts,
|
|
87822
88533
|
"dismiss-link-prompt": dismissLinkPrompt,
|
|
87823
88534
|
people,
|
|
87824
88535
|
profiles,
|
|
87825
88536
|
bookmarks,
|
|
87826
88537
|
dm,
|
|
87827
|
-
link:
|
|
87828
|
-
unlink:
|
|
87829
|
-
install:
|
|
88538
|
+
link: authorizeRun2(SLACK_KEY_PATHS.link, "Open this link to link your Slack account", teamOf),
|
|
88539
|
+
unlink: connectionRun2(SLACK_KEY_PATHS.unlink, teamOf),
|
|
88540
|
+
install: authorizeRun2(
|
|
87830
88541
|
SLACK_KEY_PATHS.install,
|
|
87831
88542
|
"Open this link to install Laze in Slack",
|
|
87832
88543
|
() => ({})
|
|
87833
88544
|
),
|
|
87834
|
-
setup:
|
|
88545
|
+
setup: setup3,
|
|
87835
88546
|
"begin-setup": beginSetup,
|
|
87836
88547
|
credentials,
|
|
87837
|
-
"install-app":
|
|
88548
|
+
"install-app": authorizeRun2(
|
|
87838
88549
|
SLACK_KEY_PATHS.installApp,
|
|
87839
88550
|
"Open this link to install the app",
|
|
87840
|
-
(args) => ({ appKey:
|
|
88551
|
+
(args) => ({ appKey: wordAt8(args, 2) })
|
|
87841
88552
|
),
|
|
87842
88553
|
"update-app": updateApp,
|
|
87843
|
-
channels,
|
|
87844
|
-
mirror:
|
|
87845
|
-
update:
|
|
87846
|
-
disconnect:
|
|
88554
|
+
channels: channels2,
|
|
88555
|
+
mirror: connectionRun2(SLACK_KEY_PATHS.mirror, mirrorBody),
|
|
88556
|
+
update: connectionRun2(SLACK_KEY_PATHS.connection, updateBody2),
|
|
88557
|
+
disconnect: disconnect4,
|
|
87847
88558
|
moves,
|
|
87848
88559
|
"move-preview": movePreview,
|
|
87849
88560
|
move: move2,
|
|
@@ -87854,14 +88565,14 @@ async function slack({
|
|
|
87854
88565
|
args
|
|
87855
88566
|
}) {
|
|
87856
88567
|
const verb = args.words[1] ?? "";
|
|
87857
|
-
const run4 = Object.hasOwn(
|
|
88568
|
+
const run4 = Object.hasOwn(RUNS5, verb) ? RUNS5[verb] : void 0;
|
|
87858
88569
|
if (!run4) throw new CliUsageError(SLACK_USAGE);
|
|
87859
88570
|
const { client } = await signedIn({ context, args });
|
|
87860
88571
|
await run4({ context, args, client });
|
|
87861
88572
|
}
|
|
87862
88573
|
|
|
87863
88574
|
// src/services/sso-commands.service.ts
|
|
87864
|
-
import { readFile as
|
|
88575
|
+
import { readFile as readFile39 } from "node:fs/promises";
|
|
87865
88576
|
var SSO_USAGE = `Usage:
|
|
87866
88577
|
laze sso domains claimed domains and how each signs in (admins)
|
|
87867
88578
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -87948,7 +88659,7 @@ function refuseSecretFlags({ args }) {
|
|
|
87948
88659
|
}
|
|
87949
88660
|
async function clientSecretOf({ context, args }) {
|
|
87950
88661
|
const file3 = flagText({ args, name: "from-file" });
|
|
87951
|
-
const text2 = file3 ? await
|
|
88662
|
+
const text2 = file3 ? await readFile39(file3, "utf8") : await context.readStdin();
|
|
87952
88663
|
const secret = text2.trim();
|
|
87953
88664
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
87954
88665
|
return secret;
|
|
@@ -88132,13 +88843,13 @@ function answer4({
|
|
|
88132
88843
|
context.out(statusLine2({ presence: presence2 }));
|
|
88133
88844
|
}
|
|
88134
88845
|
async function statusSet({ context, args }) {
|
|
88135
|
-
const [, ,
|
|
88136
|
-
if (!
|
|
88846
|
+
const [, , emoji4, ...words] = args.words;
|
|
88847
|
+
if (!emoji4) throw new CliUsageError(USAGE16);
|
|
88137
88848
|
const clearAfter = clearAfterOf({ args });
|
|
88138
88849
|
const timeZone = flagText({ args, name: "tz" }) || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
88139
88850
|
const { client } = await signedIn({ context, args });
|
|
88140
88851
|
const presence2 = await client.post("/api/agents/me/status/set", {
|
|
88141
|
-
emoji:
|
|
88852
|
+
emoji: emoji4,
|
|
88142
88853
|
text: words.join(" "),
|
|
88143
88854
|
clearAfter,
|
|
88144
88855
|
timeZone
|
|
@@ -88189,15 +88900,15 @@ async function printedBy({
|
|
|
88189
88900
|
context,
|
|
88190
88901
|
command
|
|
88191
88902
|
}) {
|
|
88192
|
-
let
|
|
88903
|
+
let printed2 = "";
|
|
88193
88904
|
const sink = {
|
|
88194
88905
|
write: (chunk) => {
|
|
88195
|
-
|
|
88906
|
+
printed2 += chunk;
|
|
88196
88907
|
}
|
|
88197
88908
|
};
|
|
88198
88909
|
try {
|
|
88199
88910
|
const code = await context.runCommand({ command, env: {}, stdout: sink, stderr: sink });
|
|
88200
|
-
return code === 0 ?
|
|
88911
|
+
return code === 0 ? printed2 : null;
|
|
88201
88912
|
} catch {
|
|
88202
88913
|
return null;
|
|
88203
88914
|
}
|
|
@@ -88250,8 +88961,8 @@ async function update2({
|
|
|
88250
88961
|
`);
|
|
88251
88962
|
return code;
|
|
88252
88963
|
}
|
|
88253
|
-
const
|
|
88254
|
-
const installed =
|
|
88964
|
+
const printed2 = await printedBy({ context, command: [...context.program, "--version"] });
|
|
88965
|
+
const installed = printed2 === null ? null : printedVersionOf({ printed: printed2 });
|
|
88255
88966
|
if (!installed) {
|
|
88256
88967
|
context.out("Installed. `laze --version` names the new version.\n");
|
|
88257
88968
|
return 0;
|
|
@@ -88280,8 +88991,8 @@ async function update2({
|
|
|
88280
88991
|
}
|
|
88281
88992
|
|
|
88282
88993
|
// src/services/vault-env-commands.service.ts
|
|
88283
|
-
import { readFile as
|
|
88284
|
-
import { dirname as dirname22, join as join26, resolve as
|
|
88994
|
+
import { readFile as readFile40, stat as stat6 } from "node:fs/promises";
|
|
88995
|
+
import { dirname as dirname22, join as join26, resolve as resolve18 } from "node:path";
|
|
88285
88996
|
|
|
88286
88997
|
// src/rules/vault-manifest.rules.ts
|
|
88287
88998
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -88622,10 +89333,10 @@ async function manifestPathOf({
|
|
|
88622
89333
|
args
|
|
88623
89334
|
}) {
|
|
88624
89335
|
const named = args.words[2];
|
|
88625
|
-
if (named) return
|
|
89336
|
+
if (named) return resolve18(context.cwd, named);
|
|
88626
89337
|
const environment = flagText({ args, name: "env" });
|
|
88627
89338
|
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
88628
|
-
for (let dir =
|
|
89339
|
+
for (let dir = resolve18(context.cwd); ; dir = dirname22(dir)) {
|
|
88629
89340
|
if (await isFile(join26(dir, file3))) return join26(dir, file3);
|
|
88630
89341
|
if (dirname22(dir) === dir) break;
|
|
88631
89342
|
}
|
|
@@ -88637,7 +89348,7 @@ async function manifestOf({
|
|
|
88637
89348
|
args
|
|
88638
89349
|
}) {
|
|
88639
89350
|
const file3 = await manifestPathOf({ context, args });
|
|
88640
|
-
const text2 = await
|
|
89351
|
+
const text2 = await readFile40(file3, "utf8").catch(() => {
|
|
88641
89352
|
throw new CliUsageError(`laze vault: cannot read ${file3}`);
|
|
88642
89353
|
});
|
|
88643
89354
|
return { file: file3, lines: parseManifest({ text: text2, file: file3 }) };
|
|
@@ -88868,8 +89579,8 @@ async function vaultScrub({ context, args }) {
|
|
|
88868
89579
|
}
|
|
88869
89580
|
|
|
88870
89581
|
// src/services/whatsapp-business-commands.service.ts
|
|
88871
|
-
import { readFile as
|
|
88872
|
-
import { resolve as
|
|
89582
|
+
import { readFile as readFile41 } from "node:fs/promises";
|
|
89583
|
+
import { resolve as resolve19 } from "node:path";
|
|
88873
89584
|
|
|
88874
89585
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
88875
89586
|
var whatsappBusinessCategorySchema = external_exports.enum([
|
|
@@ -88916,8 +89627,8 @@ var WHATSAPP_BUSINESS_REST_PATHS = {
|
|
|
88916
89627
|
var WHATSAPP_BUSINESS_TEXT_MAX = 4096;
|
|
88917
89628
|
var WHATSAPP_BUSINESS_LIMIT_MAX = 200;
|
|
88918
89629
|
var WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS = 50;
|
|
88919
|
-
var
|
|
88920
|
-
var
|
|
89630
|
+
var workspaceIdSchema22 = external_exports.string().min(1).max(64);
|
|
89631
|
+
var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema22 });
|
|
88921
89632
|
var digits = (what) => external_exports.string().trim().regex(/^\d{5,30}$/, `${what} is the number Meta shows, digits only`);
|
|
88922
89633
|
var appSecretSchema = external_exports.string().trim().regex(/^[a-f0-9]{32}$/i, "The app secret is 32 letters and digits from App settings > Basic");
|
|
88923
89634
|
var accessTokenSchema = external_exports.string().trim().min(20, "The access token is the long permanent system user token").max(2e3).regex(/^\S+$/, "The access token is one line with no spaces");
|
|
@@ -88951,7 +89662,7 @@ var statusDefinition = external_exports.object({
|
|
|
88951
89662
|
});
|
|
88952
89663
|
var whatsappBusinessStatusSchema = statusDefinition;
|
|
88953
89664
|
var connectDefinition = external_exports.object({
|
|
88954
|
-
workspaceId:
|
|
89665
|
+
workspaceId: workspaceIdSchema22,
|
|
88955
89666
|
appId: digits("The app id"),
|
|
88956
89667
|
wabaId: digits("The WhatsApp Business Account id"),
|
|
88957
89668
|
phoneNumberId: digits("The phone number id"),
|
|
@@ -88974,7 +89685,7 @@ var webhookDefinition = external_exports.object({
|
|
|
88974
89685
|
});
|
|
88975
89686
|
var whatsappBusinessWebhookSchema = webhookDefinition;
|
|
88976
89687
|
var settingsDefinition3 = external_exports.object({
|
|
88977
|
-
workspaceId:
|
|
89688
|
+
workspaceId: workspaceIdSchema22,
|
|
88978
89689
|
/** The agent that answers; null for none. Left out keeps the current one. */
|
|
88979
89690
|
agentId: external_exports.string().min(1).max(64).nullable().optional(),
|
|
88980
89691
|
replyMode: whatsappBusinessReplyModeSchema.optional()
|
|
@@ -88994,7 +89705,7 @@ var whatsappBusinessConversationSchema = conversationDefinition;
|
|
|
88994
89705
|
var limitSchema2 = external_exports.number().int().min(1).max(WHATSAPP_BUSINESS_LIMIT_MAX);
|
|
88995
89706
|
var contactRefSchema = external_exports.string().trim().min(1).max(64);
|
|
88996
89707
|
var conversationsInputDefinition = external_exports.object({
|
|
88997
|
-
workspaceId:
|
|
89708
|
+
workspaceId: workspaceIdSchema22,
|
|
88998
89709
|
limit: limitSchema2.optional()
|
|
88999
89710
|
});
|
|
89000
89711
|
var whatsappBusinessConversationsInputSchema = conversationsInputDefinition;
|
|
@@ -89009,7 +89720,7 @@ var whatsappBusinessSendStateSchema = external_exports.enum([
|
|
|
89009
89720
|
"denied",
|
|
89010
89721
|
"expired"
|
|
89011
89722
|
]);
|
|
89012
|
-
var
|
|
89723
|
+
var messageDefinition2 = external_exports.object({
|
|
89013
89724
|
id: external_exports.string(),
|
|
89014
89725
|
at: external_exports.iso.datetime(),
|
|
89015
89726
|
direction: external_exports.enum(["in", "out"]),
|
|
@@ -89020,21 +89731,21 @@ var messageDefinition = external_exports.object({
|
|
|
89020
89731
|
template: external_exports.string().nullable()
|
|
89021
89732
|
});
|
|
89022
89733
|
var readInputDefinition2 = external_exports.object({
|
|
89023
|
-
workspaceId:
|
|
89734
|
+
workspaceId: workspaceIdSchema22,
|
|
89024
89735
|
contact: contactRefSchema,
|
|
89025
89736
|
limit: limitSchema2.optional()
|
|
89026
89737
|
});
|
|
89027
89738
|
var readDefinition = external_exports.object({
|
|
89028
89739
|
conversation: conversationDefinition,
|
|
89029
|
-
messages: external_exports.array(
|
|
89740
|
+
messages: external_exports.array(messageDefinition2)
|
|
89030
89741
|
});
|
|
89031
89742
|
var sendInputDefinition2 = external_exports.object({
|
|
89032
|
-
workspaceId:
|
|
89743
|
+
workspaceId: workspaceIdSchema22,
|
|
89033
89744
|
to: contactRefSchema,
|
|
89034
89745
|
text: external_exports.string().trim().min(1).max(WHATSAPP_BUSINESS_TEXT_MAX)
|
|
89035
89746
|
});
|
|
89036
89747
|
var sendTemplateInputDefinition = external_exports.object({
|
|
89037
|
-
workspaceId:
|
|
89748
|
+
workspaceId: workspaceIdSchema22,
|
|
89038
89749
|
to: contactRefSchema,
|
|
89039
89750
|
template: external_exports.string().trim().min(1).max(512),
|
|
89040
89751
|
/** The template's language code; the only approved one when left out. */
|
|
@@ -89061,7 +89772,7 @@ function whatsappBusinessSendSettled({
|
|
|
89061
89772
|
return state !== "waiting" && state !== "sending";
|
|
89062
89773
|
}
|
|
89063
89774
|
var sendStatusInputDefinition2 = external_exports.object({
|
|
89064
|
-
workspaceId:
|
|
89775
|
+
workspaceId: workspaceIdSchema22,
|
|
89065
89776
|
sendId: external_exports.string().min(1).max(64),
|
|
89066
89777
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
89067
89778
|
});
|
|
@@ -89111,7 +89822,7 @@ var restSendStatusDefinition2 = sendStatusInputDefinition2.omit({ workspaceId: t
|
|
|
89111
89822
|
var restSettingsDefinition = settingsDefinition3.omit({ workspaceId: true });
|
|
89112
89823
|
var restEmptyDefinition = external_exports.object({});
|
|
89113
89824
|
var WhatsappBusinessApi = moduleApi()("whatsapp-business");
|
|
89114
|
-
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(
|
|
89825
|
+
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId: workspaceIdSchema22 })).withOutput(whatsappBusinessPricesSchema).build();
|
|
89115
89826
|
|
|
89116
89827
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.config.ts
|
|
89117
89828
|
var whatsappBusinessConfig = Config.define((c) => ({
|
|
@@ -89186,16 +89897,16 @@ var WHATSAPP_BUSINESS_USAGE = `Usage (the workspace's WhatsApp Business number o
|
|
|
89186
89897
|
laze whatsapp-business settings [--agent <agentId>|none] [--replies auto|ask]
|
|
89187
89898
|
laze whatsapp-business disconnect delete the secrets and archive the conversations
|
|
89188
89899
|
A contact is a phone number with its country code, a conversation id or a contact id.`;
|
|
89189
|
-
var
|
|
89900
|
+
var SECRET_FLAGS4 = ["access-token", "app-secret", "token", "secret"];
|
|
89190
89901
|
var STATUS_WAIT_SECONDS = 50;
|
|
89191
89902
|
var STATUS_CALLS = 2;
|
|
89192
|
-
function
|
|
89903
|
+
function json6({ context, args, data }) {
|
|
89193
89904
|
if (!args.flags.json) return false;
|
|
89194
89905
|
context.out(`${JSON.stringify(data, null, 2)}
|
|
89195
89906
|
`);
|
|
89196
89907
|
return true;
|
|
89197
89908
|
}
|
|
89198
|
-
function
|
|
89909
|
+
function wordAt9(args, index) {
|
|
89199
89910
|
const word3 = args.words[index];
|
|
89200
89911
|
if (!word3) throw new CliUsageError(WHATSAPP_BUSINESS_USAGE);
|
|
89201
89912
|
return word3;
|
|
@@ -89254,7 +89965,7 @@ function printSend({
|
|
|
89254
89965
|
args,
|
|
89255
89966
|
send: send5
|
|
89256
89967
|
}) {
|
|
89257
|
-
if (
|
|
89968
|
+
if (json6({ context, args, data: send5 }))
|
|
89258
89969
|
return send5.state === "failed" || send5.state === "denied" ? 1 : 0;
|
|
89259
89970
|
context.out(`${send5.outcome}
|
|
89260
89971
|
`);
|
|
@@ -89279,8 +89990,8 @@ async function settle2({ client, send: send5 }) {
|
|
|
89279
89990
|
}
|
|
89280
89991
|
return current2;
|
|
89281
89992
|
}
|
|
89282
|
-
async function
|
|
89283
|
-
if (
|
|
89993
|
+
async function secretsOf3({ context, args }) {
|
|
89994
|
+
if (SECRET_FLAGS4.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
89284
89995
|
throw new CliUsageError(
|
|
89285
89996
|
"A secret never goes in a flag: pipe it on stdin, use --from-file or --from-vault."
|
|
89286
89997
|
);
|
|
@@ -89288,7 +89999,7 @@ async function secretsOf2({ context, args }) {
|
|
|
89288
89999
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
89289
90000
|
if (fromConnection) return { fromConnection };
|
|
89290
90001
|
const file3 = flagText({ args, name: "from-file" });
|
|
89291
|
-
const text2 = file3 ? await
|
|
90002
|
+
const text2 = file3 ? await readFile41(resolve19(context.cwd, file3), "utf8") : await context.readStdin();
|
|
89292
90003
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
89293
90004
|
if (lines2.length !== 2) {
|
|
89294
90005
|
throw new CliUsageError(
|
|
@@ -89304,13 +90015,13 @@ function idFlag(args, name3) {
|
|
|
89304
90015
|
}
|
|
89305
90016
|
var status7 = async ({ context, args, client }) => {
|
|
89306
90017
|
const answer5 = await client.get(WHATSAPP_BUSINESS_REST_PATHS.status);
|
|
89307
|
-
if (!
|
|
90018
|
+
if (!json6({ context, args, data: answer5 })) printStatus2({ context, status: answer5 });
|
|
89308
90019
|
};
|
|
89309
90020
|
var conversations = async ({ context, args, client }) => {
|
|
89310
90021
|
const { limit } = limitOf4(args);
|
|
89311
90022
|
const path = limit ? `${WHATSAPP_BUSINESS_REST_PATHS.conversations}?limit=${limit}` : WHATSAPP_BUSINESS_REST_PATHS.conversations;
|
|
89312
90023
|
const answer5 = await client.get(path);
|
|
89313
|
-
if (
|
|
90024
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89314
90025
|
if (answer5.length === 0) {
|
|
89315
90026
|
context.out("No WhatsApp Business conversations you are in yet.\n");
|
|
89316
90027
|
return;
|
|
@@ -89323,10 +90034,10 @@ var conversations = async ({ context, args, client }) => {
|
|
|
89323
90034
|
};
|
|
89324
90035
|
var read = async ({ context, args, client }) => {
|
|
89325
90036
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.read, {
|
|
89326
|
-
contact:
|
|
90037
|
+
contact: wordAt9(args, 2),
|
|
89327
90038
|
...limitOf4(args)
|
|
89328
90039
|
});
|
|
89329
|
-
if (
|
|
90040
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89330
90041
|
const { conversation } = answer5;
|
|
89331
90042
|
context.out(`${conversation.name} (${conversation.phone}), ${conversation.market}
|
|
89332
90043
|
`);
|
|
@@ -89344,7 +90055,7 @@ var send3 = async ({ context, args, client }) => {
|
|
|
89344
90055
|
const text2 = args.words.slice(3).join(" ") || args.rest.join(" ");
|
|
89345
90056
|
if (!text2) throw new CliUsageError(WHATSAPP_BUSINESS_USAGE);
|
|
89346
90057
|
const asked = await client.post(WHATSAPP_BUSINESS_REST_PATHS.send, {
|
|
89347
|
-
to:
|
|
90058
|
+
to: wordAt9(args, 2),
|
|
89348
90059
|
text: text2
|
|
89349
90060
|
});
|
|
89350
90061
|
if (!whatsappBusinessSendSettled(asked) && !args.flags.json) context.err(`${asked.outcome}
|
|
@@ -89354,14 +90065,14 @@ var send3 = async ({ context, args, client }) => {
|
|
|
89354
90065
|
var sendTemplate = async ({ context, args, client }) => {
|
|
89355
90066
|
const language = flagText({ args, name: "language" });
|
|
89356
90067
|
const asked = await client.post(WHATSAPP_BUSINESS_REST_PATHS.sendTemplate, {
|
|
89357
|
-
to:
|
|
89358
|
-
template:
|
|
90068
|
+
to: wordAt9(args, 2),
|
|
90069
|
+
template: wordAt9(args, 3),
|
|
89359
90070
|
...language ? { language } : {},
|
|
89360
90071
|
params: flagValues(args, "param"),
|
|
89361
90072
|
confirm: args.flags.yes === true
|
|
89362
90073
|
});
|
|
89363
90074
|
if (asked.state === "quoted") {
|
|
89364
|
-
if (
|
|
90075
|
+
if (json6({ context, args, data: asked })) return 0;
|
|
89365
90076
|
context.out(`${asked.outcome}
|
|
89366
90077
|
Run it again with --yes to send it.
|
|
89367
90078
|
`);
|
|
@@ -89373,7 +90084,7 @@ Run it again with --yes to send it.
|
|
|
89373
90084
|
};
|
|
89374
90085
|
var sendStatus = async ({ context, args, client }) => {
|
|
89375
90086
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.sendStatus, {
|
|
89376
|
-
sendId:
|
|
90087
|
+
sendId: wordAt9(args, 2)
|
|
89377
90088
|
});
|
|
89378
90089
|
return printSend({ context, args, send: answer5 });
|
|
89379
90090
|
};
|
|
@@ -89381,7 +90092,7 @@ var templates = async ({ context, args, client }) => {
|
|
|
89381
90092
|
const answer5 = await client.get(
|
|
89382
90093
|
WHATSAPP_BUSINESS_REST_PATHS.templates
|
|
89383
90094
|
);
|
|
89384
|
-
if (
|
|
90095
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89385
90096
|
if (answer5.length === 0) {
|
|
89386
90097
|
context.out("The account has no message templates yet.\n");
|
|
89387
90098
|
return;
|
|
@@ -89397,7 +90108,7 @@ var prices = async ({ context, args, client }) => {
|
|
|
89397
90108
|
const country = flagText({ args, name: "country" });
|
|
89398
90109
|
const path = country ? `${WHATSAPP_BUSINESS_REST_PATHS.prices}?country=${encodeURIComponent(country)}` : WHATSAPP_BUSINESS_REST_PATHS.prices;
|
|
89399
90110
|
const answer5 = await client.get(path);
|
|
89400
|
-
if (
|
|
90111
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89401
90112
|
if (answer5.prices.length === 0) {
|
|
89402
90113
|
context.out(`No market matches "${country ?? ""}".
|
|
89403
90114
|
`);
|
|
@@ -89425,13 +90136,13 @@ var connect5 = async ({ context, args, client }) => {
|
|
|
89425
90136
|
appId: idFlag(args, "app-id"),
|
|
89426
90137
|
wabaId: idFlag(args, "waba-id"),
|
|
89427
90138
|
phoneNumberId: idFlag(args, "phone-number-id"),
|
|
89428
|
-
...await
|
|
90139
|
+
...await secretsOf3({ context, args })
|
|
89429
90140
|
});
|
|
89430
|
-
if (!
|
|
90141
|
+
if (!json6({ context, args, data: webhook })) printWebhook({ context, webhook });
|
|
89431
90142
|
};
|
|
89432
90143
|
var check2 = async ({ context, args, client }) => {
|
|
89433
90144
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.check, {});
|
|
89434
|
-
if (!
|
|
90145
|
+
if (!json6({ context, args, data: answer5 })) printStatus2({ context, status: answer5 });
|
|
89435
90146
|
return answer5.state === "connected" ? 0 : 1;
|
|
89436
90147
|
};
|
|
89437
90148
|
var verifyToken = async ({ context, args, client }) => {
|
|
@@ -89439,7 +90150,7 @@ var verifyToken = async ({ context, args, client }) => {
|
|
|
89439
90150
|
WHATSAPP_BUSINESS_REST_PATHS.verifyToken,
|
|
89440
90151
|
{}
|
|
89441
90152
|
);
|
|
89442
|
-
if (!
|
|
90153
|
+
if (!json6({ context, args, data: webhook })) printWebhook({ context, webhook });
|
|
89443
90154
|
};
|
|
89444
90155
|
var settings2 = async ({ context, args, client }) => {
|
|
89445
90156
|
const agent2 = flagText({ args, name: "agent" });
|
|
@@ -89451,18 +90162,18 @@ var settings2 = async ({ context, args, client }) => {
|
|
|
89451
90162
|
...agent2 ? { agentId: agent2 === "none" ? null : agent2 } : {},
|
|
89452
90163
|
...replies ? { replyMode: replies } : {}
|
|
89453
90164
|
});
|
|
89454
|
-
if (!
|
|
90165
|
+
if (!json6({ context, args, data: answer5 })) printStatus2({ context, status: answer5 });
|
|
89455
90166
|
};
|
|
89456
|
-
var
|
|
90167
|
+
var disconnect5 = async ({ context, args, client }) => {
|
|
89457
90168
|
const answer5 = await client.post(
|
|
89458
90169
|
WHATSAPP_BUSINESS_REST_PATHS.disconnect,
|
|
89459
90170
|
{}
|
|
89460
90171
|
);
|
|
89461
|
-
if (!
|
|
90172
|
+
if (!json6({ context, args, data: answer5 })) {
|
|
89462
90173
|
context.out("Disconnected. The secrets are deleted and the conversations are archived.\n");
|
|
89463
90174
|
}
|
|
89464
90175
|
};
|
|
89465
|
-
var
|
|
90176
|
+
var RUNS6 = {
|
|
89466
90177
|
status: status7,
|
|
89467
90178
|
conversations,
|
|
89468
90179
|
read,
|
|
@@ -89475,14 +90186,14 @@ var RUNS5 = {
|
|
|
89475
90186
|
check: check2,
|
|
89476
90187
|
"verify-token": verifyToken,
|
|
89477
90188
|
settings: settings2,
|
|
89478
|
-
disconnect:
|
|
90189
|
+
disconnect: disconnect5
|
|
89479
90190
|
};
|
|
89480
90191
|
async function whatsappBusiness({
|
|
89481
90192
|
context,
|
|
89482
90193
|
args
|
|
89483
90194
|
}) {
|
|
89484
90195
|
const verb = args.words[1] ?? "";
|
|
89485
|
-
const run4 = Object.hasOwn(
|
|
90196
|
+
const run4 = Object.hasOwn(RUNS6, verb) ? RUNS6[verb] : void 0;
|
|
89486
90197
|
if (!run4) throw new CliUsageError(WHATSAPP_BUSINESS_USAGE);
|
|
89487
90198
|
const client = await computeClient({ context, args });
|
|
89488
90199
|
return run4({ context, args, client });
|
|
@@ -89490,14 +90201,14 @@ async function whatsappBusiness({
|
|
|
89490
90201
|
|
|
89491
90202
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
89492
90203
|
import { writeFile as writeFile23 } from "node:fs/promises";
|
|
89493
|
-
import { resolve as
|
|
90204
|
+
import { resolve as resolve20 } from "node:path";
|
|
89494
90205
|
var WHATSAPP_PAIRING_USAGE = [
|
|
89495
90206
|
" laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
|
|
89496
90207
|
" laze whatsapp pairing <pairing-id> [--qr <file.svg>] where the linking stands, with a fresh code",
|
|
89497
90208
|
" laze whatsapp cancel <pairing-id> stop the linking",
|
|
89498
90209
|
" laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)"
|
|
89499
90210
|
].join("\n");
|
|
89500
|
-
function
|
|
90211
|
+
function wordAt10({ args, at }) {
|
|
89501
90212
|
const value = args.words[at];
|
|
89502
90213
|
if (!value) throw new CliUsageError(`Usage:
|
|
89503
90214
|
${WHATSAPP_PAIRING_USAGE}`);
|
|
@@ -89509,7 +90220,7 @@ function svgOf(dataUrl) {
|
|
|
89509
90220
|
return decodeURIComponent(body);
|
|
89510
90221
|
}
|
|
89511
90222
|
async function report2({ context, args, pairing: pairing2 }) {
|
|
89512
|
-
const qrFile = pairing2.qrSvg ?
|
|
90223
|
+
const qrFile = pairing2.qrSvg ? resolve20(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
|
|
89513
90224
|
if (qrFile && pairing2.qrSvg) await writeFile23(qrFile, svgOf(pairing2.qrSvg), "utf8");
|
|
89514
90225
|
if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
|
|
89515
90226
|
`);
|
|
@@ -89527,13 +90238,13 @@ async function report2({ context, args, pairing: pairing2 }) {
|
|
|
89527
90238
|
`);
|
|
89528
90239
|
}
|
|
89529
90240
|
async function pair({ context, args }) {
|
|
89530
|
-
const machine2 =
|
|
90241
|
+
const machine2 = wordAt10({ args, at: 2 });
|
|
89531
90242
|
const client = await computeClient({ context, args });
|
|
89532
90243
|
const pairing2 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pair, { machine: machine2 });
|
|
89533
90244
|
await report2({ context, args, pairing: pairing2 });
|
|
89534
90245
|
}
|
|
89535
90246
|
async function pairing({ context, args }) {
|
|
89536
|
-
const pairingId =
|
|
90247
|
+
const pairingId = wordAt10({ args, at: 2 });
|
|
89537
90248
|
const client = await computeClient({ context, args });
|
|
89538
90249
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pairing, {
|
|
89539
90250
|
pairingId
|
|
@@ -89541,7 +90252,7 @@ async function pairing({ context, args }) {
|
|
|
89541
90252
|
await report2({ context, args, pairing: answer5 });
|
|
89542
90253
|
}
|
|
89543
90254
|
async function cancel2({ context, args }) {
|
|
89544
|
-
const pairingId =
|
|
90255
|
+
const pairingId = wordAt10({ args, at: 2 });
|
|
89545
90256
|
const client = await computeClient({ context, args });
|
|
89546
90257
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
|
|
89547
90258
|
pairingId
|
|
@@ -89552,7 +90263,7 @@ async function cancel2({ context, args }) {
|
|
|
89552
90263
|
`);
|
|
89553
90264
|
}
|
|
89554
90265
|
async function unpair({ context, args }) {
|
|
89555
|
-
const machine2 =
|
|
90266
|
+
const machine2 = wordAt10({ args, at: 2 });
|
|
89556
90267
|
const client = await computeClient({ context, args });
|
|
89557
90268
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.unpair, { machine: machine2 });
|
|
89558
90269
|
if (args.flags.json) return context.out(`${JSON.stringify(answer5, null, 2)}
|
|
@@ -89942,6 +90653,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
89942
90653
|
laze dm <person>... open a direct message with people (an agent may name one agent), then laze post to it
|
|
89943
90654
|
laze activity [--mentions|--threads|--reactions] [--limit <n>] your mentions, replies and reactions
|
|
89944
90655
|
laze activity read mark your Activity read (people; agents use laze inbox)
|
|
90656
|
+
laze emoji list | add <name> <file> [--alias <a,b>] | alias <alias> <name> | remove <name> the workspace's custom emoji
|
|
89945
90657
|
laze status set <emoji> [text] [--for 30m|1h|4h|today|week|never] your status next to your name (people)
|
|
89946
90658
|
laze status clear | away | active clear it, or set yourself away by hand until active
|
|
89947
90659
|
laze conversation new <agent> <text|-> start a conversation with an agent; it names it
|
|
@@ -90043,6 +90755,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
90043
90755
|
laze connect list the connections this turn can use (agents)
|
|
90044
90756
|
laze slack overview|link-prompts|link|unlink|channels|mirror|update|moves|move ... Slack as yourself
|
|
90045
90757
|
admins set Slack up too: install|setup|begin-setup|credentials|install-app|update-app|disconnect
|
|
90758
|
+
laze discord overview|link|unlink|channels|pick|history ... Discord as yourself
|
|
90759
|
+
admins set Discord up too: setup|save-app|install|update|disconnect
|
|
90046
90760
|
laze connect providers|start|search|mcp|mcp-key|github|card|card-key connect services as yourself
|
|
90047
90761
|
laze connect install|status|stop|uninstall the service that hands linked Codex sessions their messages
|
|
90048
90762
|
laze openclaw list|connect|agent|agent-key|feed|disconnect your OpenClaw gateways and their agents
|
|
@@ -90157,6 +90871,7 @@ var COMMANDS3 = {
|
|
|
90157
90871
|
"status active": statusAway,
|
|
90158
90872
|
status: statusUsage,
|
|
90159
90873
|
dnd,
|
|
90874
|
+
emoji: emoji3,
|
|
90160
90875
|
"conversation new": conversationNew,
|
|
90161
90876
|
"conversation list": conversationList,
|
|
90162
90877
|
"conversation rename": conversationRename,
|
|
@@ -90171,7 +90886,7 @@ var COMMANDS3 = {
|
|
|
90171
90886
|
reply,
|
|
90172
90887
|
inbox,
|
|
90173
90888
|
search,
|
|
90174
|
-
history,
|
|
90889
|
+
history: history2,
|
|
90175
90890
|
"agents list": listAgents,
|
|
90176
90891
|
"agents show": showAgent,
|
|
90177
90892
|
"agents status": listAgents,
|
|
@@ -90200,6 +90915,7 @@ var COMMANDS3 = {
|
|
|
90200
90915
|
"vault save-from-message": vaultSaveFromMessage,
|
|
90201
90916
|
connect,
|
|
90202
90917
|
slack,
|
|
90918
|
+
discord,
|
|
90203
90919
|
"connect providers": connectAsPerson,
|
|
90204
90920
|
"connect start": connectAsPerson,
|
|
90205
90921
|
"connect search": connectAsPerson,
|
|
@@ -90309,6 +91025,8 @@ async function runCli({
|
|
|
90309
91025
|
[ops, `${OPS_USAGE}
|
|
90310
91026
|
`],
|
|
90311
91027
|
[slack, `${SLACK_USAGE}
|
|
91028
|
+
`],
|
|
91029
|
+
[discord, `${DISCORD_USAGE}
|
|
90312
91030
|
`],
|
|
90313
91031
|
[whatsappBusiness, `${WHATSAPP_BUSINESS_USAGE}
|
|
90314
91032
|
`],
|
|
@@ -90316,6 +91034,8 @@ async function runCli({
|
|
|
90316
91034
|
[connectService, CONNECT_SERVICE_USAGE],
|
|
90317
91035
|
[openclaw, OPENCLAW_USAGE],
|
|
90318
91036
|
[chatActions, CHAT_ACTIONS_USAGE],
|
|
91037
|
+
[emoji3, `${EMOJI_USAGE}
|
|
91038
|
+
`],
|
|
90319
91039
|
[agentLogins, LOGINS_HELP],
|
|
90320
91040
|
[agentPools, POOLS_HELP],
|
|
90321
91041
|
[browser, `${BROWSER_USAGE}
|
|
@@ -90347,7 +91067,7 @@ async function runCli({
|
|
|
90347
91067
|
// src/services/processes.service.ts
|
|
90348
91068
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
90349
91069
|
import { mkdirSync, openSync } from "node:fs";
|
|
90350
|
-
import { readFile as
|
|
91070
|
+
import { readFile as readFile42, readlink } from "node:fs/promises";
|
|
90351
91071
|
import { dirname as dirname23 } from "node:path";
|
|
90352
91072
|
import { promisify as promisify2 } from "node:util";
|
|
90353
91073
|
var run3 = promisify2(execFile2);
|
|
@@ -90361,14 +91081,14 @@ function alive(pid) {
|
|
|
90361
91081
|
}
|
|
90362
91082
|
}
|
|
90363
91083
|
async function argsOf(pid) {
|
|
90364
|
-
const raw = await
|
|
91084
|
+
const raw = await readFile42(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
90365
91085
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
90366
91086
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
90367
91087
|
const line = listed?.stdout.trim();
|
|
90368
91088
|
return line ? line.split(/\s+/) : void 0;
|
|
90369
91089
|
}
|
|
90370
91090
|
async function parentOf(pid) {
|
|
90371
|
-
const stat7 = await
|
|
91091
|
+
const stat7 = await readFile42(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
90372
91092
|
const fromStat = stat7 ? Number(stat7.slice(stat7.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
90373
91093
|
if (fromStat > 0) return fromStat;
|
|
90374
91094
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -90481,15 +91201,15 @@ function terminalAsk() {
|
|
|
90481
91201
|
};
|
|
90482
91202
|
}
|
|
90483
91203
|
function sleep(ms, signal) {
|
|
90484
|
-
return new Promise((
|
|
90485
|
-
if (signal?.aborted) return
|
|
91204
|
+
return new Promise((resolve21) => {
|
|
91205
|
+
if (signal?.aborted) return resolve21();
|
|
90486
91206
|
const stop3 = () => {
|
|
90487
91207
|
clearTimeout(timer);
|
|
90488
|
-
|
|
91208
|
+
resolve21();
|
|
90489
91209
|
};
|
|
90490
91210
|
const timer = setTimeout(() => {
|
|
90491
91211
|
signal?.removeEventListener("abort", stop3);
|
|
90492
|
-
|
|
91212
|
+
resolve21();
|
|
90493
91213
|
}, ms);
|
|
90494
91214
|
signal?.addEventListener("abort", stop3, { once: true });
|
|
90495
91215
|
});
|