@lazehq/cli 0.1.54 → 0.1.56
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 +1407 -670
- 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.56";
|
|
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,
|
|
@@ -59169,8 +59246,11 @@ var markReadInputSchema = markReadInputSchemaDefinition;
|
|
|
59169
59246
|
var markUnreadInputSchemaDefinition = external_exports.object({
|
|
59170
59247
|
workspaceId: workspaceIdSchema,
|
|
59171
59248
|
channelId: idSchema4,
|
|
59172
|
-
/**
|
|
59173
|
-
|
|
59249
|
+
/**
|
|
59250
|
+
* The message to read again from: the marker moves to just before it. Absent: the last
|
|
59251
|
+
* message that counts as unread for the reader, and the marker never moves forward.
|
|
59252
|
+
*/
|
|
59253
|
+
seq: external_exports.number().int().positive().optional()
|
|
59174
59254
|
});
|
|
59175
59255
|
var markUnreadInputSchema = markUnreadInputSchemaDefinition;
|
|
59176
59256
|
var searchInputSchemaDefinition = external_exports.object({
|
|
@@ -59266,19 +59346,6 @@ var hideUnfurlInputSchemaDefinition = external_exports.object({
|
|
|
59266
59346
|
unfurlId: idSchema4
|
|
59267
59347
|
});
|
|
59268
59348
|
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
59349
|
var unfurlImageInputSchemaDefinition = external_exports.object({
|
|
59283
59350
|
...hideUnfurlInputSchemaDefinition.shape,
|
|
59284
59351
|
/** The preview's picture, or the site's icon. */
|
|
@@ -59475,7 +59542,15 @@ var draftSchemaDefinition = external_exports.object({
|
|
|
59475
59542
|
reachable: external_exports.boolean()
|
|
59476
59543
|
});
|
|
59477
59544
|
var draftSchema = draftSchemaDefinition;
|
|
59478
|
-
var
|
|
59545
|
+
var clearedDraftSchemaDefinition = external_exports.object({
|
|
59546
|
+
channelId: idSchema4,
|
|
59547
|
+
threadRootId: idSchema4.nullable(),
|
|
59548
|
+
savedAt: external_exports.iso.datetime()
|
|
59549
|
+
});
|
|
59550
|
+
var draftListSchemaDefinition = external_exports.object({
|
|
59551
|
+
drafts: external_exports.array(draftSchemaDefinition),
|
|
59552
|
+
cleared: external_exports.array(clearedDraftSchemaDefinition).default([])
|
|
59553
|
+
});
|
|
59479
59554
|
var draftListSchema = draftListSchemaDefinition;
|
|
59480
59555
|
var saveDraftInputSchemaDefinition = external_exports.object({
|
|
59481
59556
|
workspaceId: workspaceIdSchema,
|
|
@@ -59593,13 +59668,14 @@ var ChatApi = moduleApi()("chat");
|
|
|
59593
59668
|
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
59669
|
var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
|
|
59595
59670
|
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("
|
|
59671
|
+
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
59672
|
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
59673
|
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
59674
|
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
59675
|
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
59676
|
var chatTrpc = joinTrpcContracts(
|
|
59602
59677
|
"chat",
|
|
59678
|
+
chatEmojiTrpc,
|
|
59603
59679
|
chatConversationsTrpc,
|
|
59604
59680
|
chatChannelRolesTrpc,
|
|
59605
59681
|
chatMessagesTrpc,
|
|
@@ -60094,7 +60170,7 @@ function originsOf({ list: list11 }) {
|
|
|
60094
60170
|
return [...new Set(origins)];
|
|
60095
60171
|
}
|
|
60096
60172
|
var { appsDomain } = Config.define((c) => ({
|
|
60097
|
-
appsDomain: c.env("APPS_DOMAIN", external_exports.string().min(1).default("
|
|
60173
|
+
appsDomain: c.env("APPS_DOMAIN", external_exports.string().min(1).default("lazeapps.com"))
|
|
60098
60174
|
}));
|
|
60099
60175
|
var optionalNonBlank = external_exports.preprocess(
|
|
60100
60176
|
(value) => value === "" ? void 0 : value,
|
|
@@ -60540,7 +60616,9 @@ var readMarkerMovedPayloadSchemaDefinition = external_exports.object({
|
|
|
60540
60616
|
seq: external_exports.number().int().nonnegative(),
|
|
60541
60617
|
at: external_exports.iso.datetime(),
|
|
60542
60618
|
/** A mirror moved it to match its source, so the source needs no telling. */
|
|
60543
|
-
fromSource: external_exports.boolean().default(false)
|
|
60619
|
+
fromSource: external_exports.boolean().default(false),
|
|
60620
|
+
/** The reader marked it unread: a Laze-side change the source never hears of. */
|
|
60621
|
+
markedUnread: external_exports.boolean().optional()
|
|
60544
60622
|
});
|
|
60545
60623
|
var realtimePublicationSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
60546
60624
|
external_exports.object({
|
|
@@ -60594,6 +60672,8 @@ var realtimePublicationSchemaDefinition = external_exports.discriminatedUnion("t
|
|
|
60594
60672
|
channelId: external_exports.string()
|
|
60595
60673
|
}),
|
|
60596
60674
|
external_exports.object({ type: external_exports.literal("activity_added"), workspaceId: external_exports.string() }),
|
|
60675
|
+
/** The workspace's custom emoji or who may add them changed: read the list again. */
|
|
60676
|
+
external_exports.object({ type: external_exports.literal("custom_emoji_changed"), workspaceId: external_exports.string() }),
|
|
60597
60677
|
/** The reader's followed threads or their read state changed, on another device too. */
|
|
60598
60678
|
external_exports.object({ type: external_exports.literal("threads_changed"), workspaceId: external_exports.string() }),
|
|
60599
60679
|
/** The reader's saved items changed, or a reminder came due, on another device too. */
|
|
@@ -60655,11 +60735,13 @@ var chatConfig = Config.define((c) => ({
|
|
|
60655
60735
|
|
|
60656
60736
|
// ../../modules/chat/contract/src/chat.ui.ts
|
|
60657
60737
|
var chatUi = uiTokens("chat");
|
|
60738
|
+
var ChatEmojiNavSlot = chatUi.component("emoji-nav");
|
|
60658
60739
|
var ChatSidebarSlot = chatUi.component("sidebar");
|
|
60659
60740
|
var ChatConversationSlot = chatUi.component("conversation");
|
|
60660
60741
|
var ChatKeysSlot = chatUi.component("keys");
|
|
60661
60742
|
var ChatLiveHooksToken = chatUi.hooks("live");
|
|
60662
60743
|
var ChatUnreadHooksToken = chatUi.hooks("unread");
|
|
60744
|
+
var ChatPlaceHooksToken = chatUi.hooks("place");
|
|
60663
60745
|
var ChatPresenceHooksToken = chatUi.hooks("presence");
|
|
60664
60746
|
var ChatStatusDialogSlot = chatUi.component("status-dialog");
|
|
60665
60747
|
var ChatExternalPersonCardSlot = chatUi.extension("external-person-card");
|
|
@@ -65864,6 +65946,7 @@ var AgentLiveStepsSlot = agentUi.component("liveSteps");
|
|
|
65864
65946
|
var AgentCatchUpSlot = agentUi.component("catchUp");
|
|
65865
65947
|
var AgentSessionHooksToken = agentUi.hooks("session");
|
|
65866
65948
|
var AgentCreateDialogSlot = agentUi.component("createDialog");
|
|
65949
|
+
var AgentAddChoiceSlot = agentUi.component("addChoice");
|
|
65867
65950
|
var AgentEditDialogSlot = agentUi.component("editDialog");
|
|
65868
65951
|
var AgentFaceSlot = agentUi.component("face");
|
|
65869
65952
|
var AgentAccessSlot = agentUi.component("access");
|
|
@@ -66489,6 +66572,12 @@ var callerPinsPageSchemaDefinition = external_exports.object({ ...pinsPageSchema
|
|
|
66489
66572
|
var callerSavedPageSchemaDefinition = external_exports.object({ ...savedPageSchema.shape });
|
|
66490
66573
|
var callerSavedMarksSchemaDefinition = external_exports.object({ ...savedMarksSchema.shape });
|
|
66491
66574
|
var callerSavedStatusSchemaDefinition = external_exports.object({ ...savedStatusSchema.shape });
|
|
66575
|
+
var EMOJI_KEY_PATHS = {
|
|
66576
|
+
list: "/api/agents/me/emoji",
|
|
66577
|
+
add: "/api/agents/me/emoji/add",
|
|
66578
|
+
alias: "/api/agents/me/emoji/alias",
|
|
66579
|
+
remove: "/api/agents/me/emoji/remove"
|
|
66580
|
+
};
|
|
66492
66581
|
var CHAT_KEY_PATHS = {
|
|
66493
66582
|
thread: "/api/agents/me/chat/thread",
|
|
66494
66583
|
edit: "/api/agents/me/chat/edit",
|
|
@@ -66520,6 +66609,16 @@ var CHAT_KEY_PATHS = {
|
|
|
66520
66609
|
starred: "/api/agents/me/chat/starred"
|
|
66521
66610
|
};
|
|
66522
66611
|
|
|
66612
|
+
// ../../modules/agent/contract/src/agent-emoji.ts
|
|
66613
|
+
var callerEmojiSchemaDefinition = external_exports.object({ ...customEmojiSchema.shape });
|
|
66614
|
+
var callerEmojiListSchemaDefinition = external_exports.object({ ...customEmojiListSchema.shape });
|
|
66615
|
+
var emojiAddByKeyInputSchemaDefinition = addCustomEmojiInputSchema.omit({ workspaceId: true });
|
|
66616
|
+
var emojiAliasByKeyInputSchemaDefinition = addCustomEmojiAliasInputSchema.omit({
|
|
66617
|
+
workspaceId: true
|
|
66618
|
+
});
|
|
66619
|
+
var emojiNameByKeyInputSchemaDefinition = customEmojiNameInputSchema.omit({ workspaceId: true });
|
|
66620
|
+
var emojiRemovedSchemaDefinition = external_exports.object({ removed: external_exports.literal(true) });
|
|
66621
|
+
|
|
66523
66622
|
// ../../modules/agent/contract/src/agent-join-events.ts
|
|
66524
66623
|
var agentJoinRequestedPayloadSchemaDefinition = external_exports.object({
|
|
66525
66624
|
workspaceId: external_exports.string().min(1),
|
|
@@ -66738,11 +66837,11 @@ function printAccess({ context, args, access }) {
|
|
|
66738
66837
|
if (args.flags.json) return context.out(`${JSON.stringify(access, null, 2)}
|
|
66739
66838
|
`);
|
|
66740
66839
|
const people2 = access.people.map((person) => person.userId).join(", ") || "no one";
|
|
66741
|
-
const
|
|
66840
|
+
const channels3 = access.channels.map((channel) => `#${channel.name}`).join(", ") || "none";
|
|
66742
66841
|
context.out(
|
|
66743
66842
|
`${access.kind} agent, owned by ${access.ownerUserId}
|
|
66744
66843
|
People: ${people2}
|
|
66745
|
-
Channels: ${
|
|
66844
|
+
Channels: ${channels3}
|
|
66746
66845
|
`
|
|
66747
66846
|
);
|
|
66748
66847
|
}
|
|
@@ -67104,10 +67203,10 @@ function catchUpLinesOf(message2) {
|
|
|
67104
67203
|
];
|
|
67105
67204
|
if (older === 0) return lines2;
|
|
67106
67205
|
const channel = message2.channelKind === "public" || message2.channelKind === "private";
|
|
67107
|
-
const
|
|
67206
|
+
const history3 = `laze history ${channel ? `#${message2.channelName}` : message2.channelId}`;
|
|
67108
67207
|
const noun = older === 1 ? "message" : "messages";
|
|
67109
67208
|
const verb = older === 1 ? "is" : "are";
|
|
67110
|
-
const reads = `\`${
|
|
67209
|
+
const reads = `\`${history3} --before ${message2.messageId}\` reads them.`;
|
|
67111
67210
|
return [...lines2, `${older} older ${noun} in ${where} ${verb} left out; ${reads}`];
|
|
67112
67211
|
}
|
|
67113
67212
|
function formatInboxMessage({ message: message2 }) {
|
|
@@ -67283,6 +67382,23 @@ var openSlackDirectInputSchema = openSlackDirectInputSchemaDefinition;
|
|
|
67283
67382
|
var openedSlackDirectSchemaDefinition = external_exports.object({ channelId: external_exports.string() });
|
|
67284
67383
|
var openedSlackDirectSchema = openedSlackDirectSchemaDefinition;
|
|
67285
67384
|
|
|
67385
|
+
// ../../modules/slack/contract/src/slack-emoji.ts
|
|
67386
|
+
var slackEmojiSourceSchemaDefinition = external_exports.object({
|
|
67387
|
+
/** A Slack workspace is connected here, so its emoji can be imported. */
|
|
67388
|
+
connected: external_exports.boolean(),
|
|
67389
|
+
/** Its custom emoji pictures, aliases left out; null when Slack could not be asked. */
|
|
67390
|
+
available: external_exports.number().int().nonnegative().nullable()
|
|
67391
|
+
});
|
|
67392
|
+
var slackEmojiSourceSchema = slackEmojiSourceSchemaDefinition;
|
|
67393
|
+
var slackEmojiImportSchemaDefinition = external_exports.object({
|
|
67394
|
+
imported: external_exports.number().int().nonnegative(),
|
|
67395
|
+
/** Names Laze already had, or standard emoji names. */
|
|
67396
|
+
skipped: external_exports.number().int().nonnegative(),
|
|
67397
|
+
/** Pictures Slack would not hand over, or that could not be made small enough. */
|
|
67398
|
+
failed: external_exports.number().int().nonnegative()
|
|
67399
|
+
});
|
|
67400
|
+
var slackEmojiImportSchema = slackEmojiImportSchemaDefinition;
|
|
67401
|
+
|
|
67286
67402
|
// ../../modules/slack/contract/src/slack-link-prompt.ts
|
|
67287
67403
|
var slackLinkPromptKindSchema = external_exports.enum(["connect", "relink"]);
|
|
67288
67404
|
var slackLinkPromptSchemaDefinition = external_exports.object({
|
|
@@ -67863,7 +67979,7 @@ var slackSearchAnswerSchemaDefinition = external_exports.object({
|
|
|
67863
67979
|
var slackSearchAnswerSchema = slackSearchAnswerSchemaDefinition;
|
|
67864
67980
|
var SlackApi = moduleApi()("slack");
|
|
67865
67981
|
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();
|
|
67982
|
+
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
67983
|
|
|
67868
67984
|
// ../../modules/slack/contract/src/slack-keys.ts
|
|
67869
67985
|
var SLACK_KEY_PATHS = {
|
|
@@ -67934,6 +68050,11 @@ var slackMoveByKeyInputSchemaDefinition = slackMoveInputSchema.omit(noWorkspace)
|
|
|
67934
68050
|
var positiveInt4 = external_exports.coerce.number().int().positive();
|
|
67935
68051
|
var slackConfig = Config.define((c) => ({
|
|
67936
68052
|
publicBaseUrl,
|
|
68053
|
+
/**
|
|
68054
|
+
* The origin Slack sends people back to after consent, when it is not `publicBaseUrl`: the
|
|
68055
|
+
* origin the Slack app lists as its redirect URL during a domain move (docs/ops/domains.md).
|
|
68056
|
+
*/
|
|
68057
|
+
oauthBaseUrl: c.env("SLACK_OAUTH_BASE_URL", external_exports.url().optional()),
|
|
67937
68058
|
/** The Web API base; methods are `${apiUrl}/<method>`. */
|
|
67938
68059
|
apiUrl: c.env("SLACK_API_URL", external_exports.url().default("https://slack.com/api")),
|
|
67939
68060
|
/** Slack's install and sign-in consent page. */
|
|
@@ -68044,8 +68165,8 @@ function withoutShown({
|
|
|
68044
68165
|
laze,
|
|
68045
68166
|
limit
|
|
68046
68167
|
}) {
|
|
68047
|
-
const
|
|
68048
|
-
return { ...answer5, hits: answer5.hits.filter((hit) => !
|
|
68168
|
+
const shown2 = new Set(laze.hits.flatMap((hit) => hit.originKey ? [hit.originKey] : []));
|
|
68169
|
+
return { ...answer5, hits: answer5.hits.filter((hit) => !shown2.has(hit.key)).slice(0, limit) };
|
|
68049
68170
|
}
|
|
68050
68171
|
function slackTeamNoteOf(team) {
|
|
68051
68172
|
const where = `From Slack (${team.teamName})`;
|
|
@@ -68296,17 +68417,17 @@ async function dueFromSpool({
|
|
|
68296
68417
|
const entries = await readSpool({ path });
|
|
68297
68418
|
const pushed = entries.some((entry) => entry.pushedAt !== void 0);
|
|
68298
68419
|
const text2 = pushed ? await seen().catch(() => "") : "";
|
|
68299
|
-
const
|
|
68420
|
+
const shown2 = entries.filter(
|
|
68300
68421
|
(entry) => entry.pushedAt !== void 0 && text2.includes(entry.message.messageId)
|
|
68301
68422
|
);
|
|
68302
68423
|
await dropFromSpool({
|
|
68303
68424
|
context,
|
|
68304
68425
|
profile,
|
|
68305
|
-
messageIds:
|
|
68426
|
+
messageIds: shown2.map((entry) => entry.message.messageId)
|
|
68306
68427
|
});
|
|
68307
68428
|
const late = context.nowMs() - PUSH_GRACE_MS;
|
|
68308
68429
|
const settled2 = context.nowMs() - IN_FLIGHT_MS;
|
|
68309
|
-
return entries.filter((entry) => !
|
|
68430
|
+
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
68431
|
}
|
|
68311
68432
|
|
|
68312
68433
|
// src/services/harness-session.service.ts
|
|
@@ -68920,10 +69041,10 @@ async function textToSend({
|
|
|
68920
69041
|
var REQUEST_WAIT_SECONDS = 50;
|
|
68921
69042
|
async function listChannels({ context, args }) {
|
|
68922
69043
|
const { client } = await signedIn({ context, args });
|
|
68923
|
-
const
|
|
68924
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
69044
|
+
const channels3 = await client.get("/api/agents/me/channels");
|
|
69045
|
+
if (args.flags.json) return context.out(`${JSON.stringify(channels3, null, 2)}
|
|
68925
69046
|
`);
|
|
68926
|
-
for (const channel of
|
|
69047
|
+
for (const channel of channels3) {
|
|
68927
69048
|
const direct2 = ["dm", "group", "chat"].includes(channel.kind);
|
|
68928
69049
|
const name3 = channelLabelIn(channel);
|
|
68929
69050
|
const unread = channel.unread > 0 ? ` ${channel.unread} unread` : "";
|
|
@@ -68973,9 +69094,9 @@ function leavesLazeOf({
|
|
|
68973
69094
|
}) {
|
|
68974
69095
|
return async () => {
|
|
68975
69096
|
if (!channel) return true;
|
|
68976
|
-
const
|
|
69097
|
+
const channels3 = await client.get("/api/agents/me/channels");
|
|
68977
69098
|
const name3 = channel.trim().replace(/^#/, "").toLowerCase();
|
|
68978
|
-
const found =
|
|
69099
|
+
const found = channels3.find((one) => one.id === channel.trim()) ?? channels3.find((one) => one.name.length > 0 && one.name === name3);
|
|
68979
69100
|
return found ? found.leavesLaze : true;
|
|
68980
69101
|
};
|
|
68981
69102
|
}
|
|
@@ -70863,8 +70984,8 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
70863
70984
|
}
|
|
70864
70985
|
async call(method, params) {
|
|
70865
70986
|
const id2 = ++this.#nextId;
|
|
70866
|
-
const reply2 = await new Promise((
|
|
70867
|
-
this.#pending.set(id2,
|
|
70987
|
+
const reply2 = await new Promise((resolve21) => {
|
|
70988
|
+
this.#pending.set(id2, resolve21);
|
|
70868
70989
|
this.write({ id: id2, method, params });
|
|
70869
70990
|
});
|
|
70870
70991
|
if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
|
|
@@ -70876,12 +70997,12 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
70876
70997
|
/** Starts one turn; `done` settles when it completes, keeping its last agent message. */
|
|
70877
70998
|
async startTurn({ threadId, text: text2 }) {
|
|
70878
70999
|
const result = { answer: "" };
|
|
70879
|
-
const done = new Promise((
|
|
71000
|
+
const done = new Promise((resolve21) => {
|
|
70880
71001
|
const listen = (message2) => {
|
|
70881
71002
|
absorbTurnEvent({ result, message: message2 });
|
|
70882
71003
|
if (message2.method !== "turn/completed") return;
|
|
70883
71004
|
this.#listeners.delete(listen);
|
|
70884
|
-
|
|
71005
|
+
resolve21(result);
|
|
70885
71006
|
};
|
|
70886
71007
|
this.#listeners.add(listen);
|
|
70887
71008
|
});
|
|
@@ -71383,17 +71504,17 @@ function lazePluginFiles({
|
|
|
71383
71504
|
configPath
|
|
71384
71505
|
}) {
|
|
71385
71506
|
const line = (args) => cliLineOf({ program, args, configPath });
|
|
71386
|
-
const
|
|
71507
|
+
const json7 = (value) => `${JSON.stringify(value, null, 2)}
|
|
71387
71508
|
`;
|
|
71388
71509
|
const description = "Laze messages reach this session, and the laze tools to answer them";
|
|
71389
71510
|
const author = { name: "Laze", url: "https://laze.langwatch.ai" };
|
|
71390
71511
|
return {
|
|
71391
|
-
".claude-plugin/marketplace.json":
|
|
71512
|
+
".claude-plugin/marketplace.json": json7({
|
|
71392
71513
|
name: LAZE_PLUGIN,
|
|
71393
71514
|
owner: author,
|
|
71394
71515
|
plugins: [{ name: LAZE_PLUGIN, source: `./${LAZE_PLUGIN}`, description }]
|
|
71395
71516
|
}),
|
|
71396
|
-
"laze/plugin.json":
|
|
71517
|
+
"laze/plugin.json": json7({
|
|
71397
71518
|
$schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
71398
71519
|
name: LAZE_PLUGIN,
|
|
71399
71520
|
version: version2,
|
|
@@ -71404,24 +71525,24 @@ function lazePluginFiles({
|
|
|
71404
71525
|
extensions: { "ai.laze": { delivery: "ai.laze/delivery.json" } }
|
|
71405
71526
|
}),
|
|
71406
71527
|
"laze/skills/laze/SKILL.md": SKILL,
|
|
71407
|
-
"laze/ai.laze/delivery.json":
|
|
71528
|
+
"laze/ai.laze/delivery.json": json7({
|
|
71408
71529
|
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
71530
|
command: [...NPX_CLI, "hook", "monitor"]
|
|
71410
71531
|
}),
|
|
71411
|
-
"laze/.claude-plugin/plugin.json":
|
|
71532
|
+
"laze/.claude-plugin/plugin.json": json7({
|
|
71412
71533
|
name: LAZE_PLUGIN,
|
|
71413
71534
|
version: version2,
|
|
71414
71535
|
description,
|
|
71415
71536
|
author
|
|
71416
71537
|
}),
|
|
71417
|
-
"laze/monitors/monitors.json":
|
|
71538
|
+
"laze/monitors/monitors.json": json7([
|
|
71418
71539
|
{
|
|
71419
71540
|
name: "laze-messages",
|
|
71420
71541
|
command: line(["hook", "monitor"]),
|
|
71421
71542
|
description: "Laze messages for this session"
|
|
71422
71543
|
}
|
|
71423
71544
|
]),
|
|
71424
|
-
"laze/hooks/hooks.json":
|
|
71545
|
+
"laze/hooks/hooks.json": json7(pluginHooksOf({ line }))
|
|
71425
71546
|
};
|
|
71426
71547
|
}
|
|
71427
71548
|
|
|
@@ -71730,11 +71851,11 @@ async function listAgents({ context, args }) {
|
|
|
71730
71851
|
const { client } = await signedIn({ context, args });
|
|
71731
71852
|
const agents = await client.get("/api/agents");
|
|
71732
71853
|
const wanted = args.words[2];
|
|
71733
|
-
const
|
|
71734
|
-
if (wanted &&
|
|
71735
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
71854
|
+
const shown2 = wanted ? agents.filter((agent2) => agent2.id === wanted || agent2.name === wanted) : agents;
|
|
71855
|
+
if (wanted && shown2.length === 0) throw new CliUsageError(`No agent named ${wanted}.`);
|
|
71856
|
+
if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
|
|
71736
71857
|
`);
|
|
71737
|
-
for (const agent2 of
|
|
71858
|
+
for (const agent2 of shown2) context.out(`${lineOf(agent2)}
|
|
71738
71859
|
`);
|
|
71739
71860
|
}
|
|
71740
71861
|
async function showAgent({ context, args }) {
|
|
@@ -71746,10 +71867,10 @@ async function showAgent({ context, args }) {
|
|
|
71746
71867
|
if (!agent2) throw new CliUsageError(`No agent named ${wanted}.`);
|
|
71747
71868
|
const members3 = await client.get("/api/workspaces/current/members");
|
|
71748
71869
|
const ownerName = members3.find((member) => member.userId === agent2.ownerUserId)?.name ?? "";
|
|
71749
|
-
const
|
|
71750
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
71870
|
+
const shown2 = agentProfileOf({ agent: agent2, ownerName, baseUrl: profile.url });
|
|
71871
|
+
if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
|
|
71751
71872
|
`);
|
|
71752
|
-
context.out(formatAgentProfile({ profile:
|
|
71873
|
+
context.out(formatAgentProfile({ profile: shown2 }));
|
|
71753
71874
|
}
|
|
71754
71875
|
async function harnessOf2({ context, args }) {
|
|
71755
71876
|
const named = flagText({ args, name: "harness" });
|
|
@@ -72106,9 +72227,9 @@ function formatLogins({ list: list11, nowMs }) {
|
|
|
72106
72227
|
const lines2 = list11.logins.map((login2) => {
|
|
72107
72228
|
const state = login2.agentsOnIt > 0 ? `in use by ${login2.agentsOnIt} ${login2.agentsOnIt === 1 ? "agent" : "agents"}` : "ready";
|
|
72108
72229
|
const usage = usageOf2({ ...login2, nowMs });
|
|
72109
|
-
let
|
|
72110
|
-
if (login2.state === "invalid")
|
|
72111
|
-
const line = `${HARNESS_NAMES2[login2.harness]} ${login2.name} (${
|
|
72230
|
+
let shown2 = usage.startsWith("out of usage") ? usage : `${state}, ${usage}`;
|
|
72231
|
+
if (login2.state === "invalid") shown2 = INVALID2;
|
|
72232
|
+
const line = `${HARNESS_NAMES2[login2.harness]} ${login2.name} (${shown2}) ${login2.id}`;
|
|
72112
72233
|
return login2.expiresSoon ? `${line}
|
|
72113
72234
|
${EXPIRES_SOON}` : line;
|
|
72114
72235
|
});
|
|
@@ -75831,16 +75952,16 @@ async function serveAppFolder({
|
|
|
75831
75952
|
(error62) => failed({ response, error: error62 })
|
|
75832
75953
|
);
|
|
75833
75954
|
});
|
|
75834
|
-
await new Promise((
|
|
75955
|
+
await new Promise((resolve21, reject) => {
|
|
75835
75956
|
server.once("error", reject);
|
|
75836
|
-
server.listen(port, "127.0.0.1", () =>
|
|
75957
|
+
server.listen(port, "127.0.0.1", () => resolve21());
|
|
75837
75958
|
});
|
|
75838
75959
|
const { port: bound } = server.address();
|
|
75839
75960
|
return {
|
|
75840
75961
|
url: `http://127.0.0.1:${bound}/`,
|
|
75841
|
-
close: () => new Promise((
|
|
75962
|
+
close: () => new Promise((resolve21) => {
|
|
75842
75963
|
server.closeAllConnections();
|
|
75843
|
-
server.close(() =>
|
|
75964
|
+
server.close(() => resolve21());
|
|
75844
75965
|
})
|
|
75845
75966
|
};
|
|
75846
75967
|
}
|
|
@@ -77734,9 +77855,9 @@ If the site needs a sign-in, run \`laze browser ask ${tab.id} "Sign in to <site>
|
|
|
77734
77855
|
`
|
|
77735
77856
|
);
|
|
77736
77857
|
}
|
|
77737
|
-
async function listTabs({ context, client, channel, json:
|
|
77858
|
+
async function listTabs({ context, client, channel, json: json7, print: print9 }) {
|
|
77738
77859
|
const { tabs } = await client.post(BROWSER_TAB_PATHS.list, channel);
|
|
77739
|
-
if (
|
|
77860
|
+
if (json7) return print9(tabs, "");
|
|
77740
77861
|
if (tabs.length === 0)
|
|
77741
77862
|
return context.out("No browser tabs here. `laze browser open <url>` opens one.\n");
|
|
77742
77863
|
for (const tab of tabs) context.out(tabLine(tab));
|
|
@@ -77804,7 +77925,7 @@ async function waitForDone({
|
|
|
77804
77925
|
return 75;
|
|
77805
77926
|
}
|
|
77806
77927
|
async function loginOnTab(run4) {
|
|
77807
|
-
const { context, args, client, channel, json:
|
|
77928
|
+
const { context, args, client, channel, json: json7 } = run4;
|
|
77808
77929
|
const tab = word({ args, at: 2 });
|
|
77809
77930
|
const connection = flagText({ args, name: "vault" });
|
|
77810
77931
|
if (!connection)
|
|
@@ -77853,7 +77974,7 @@ ${BROWSER_TAB_USAGE}`
|
|
|
77853
77974
|
nowMs: context.nowMs()
|
|
77854
77975
|
}) : null;
|
|
77855
77976
|
const { screenshot: _shown, ...rest } = answer5;
|
|
77856
|
-
if (
|
|
77977
|
+
if (json7) context.out(`${JSON.stringify({ ...rest, screenshotPath }, null, 2)}
|
|
77857
77978
|
`);
|
|
77858
77979
|
else context.out(loginText({ answer: answer5, tab, screenshotPath }));
|
|
77859
77980
|
return answer5.state === "refused" || answer5.state === "still_on_form" ? 1 : 0;
|
|
@@ -77927,10 +78048,10 @@ async function browserTab({
|
|
|
77927
78048
|
}) {
|
|
77928
78049
|
const handler = TAB_RUNS[args.words[1] ?? ""];
|
|
77929
78050
|
if (!handler) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
77930
|
-
const
|
|
77931
|
-
const print9 = (value, text2) => context.out(
|
|
78051
|
+
const json7 = Boolean(args.flags.json);
|
|
78052
|
+
const print9 = (value, text2) => context.out(json7 ? `${JSON.stringify(value, null, 2)}
|
|
77932
78053
|
` : text2);
|
|
77933
|
-
return handler({ context, args, client, channel: channelOf({ context, args }), json:
|
|
78054
|
+
return handler({ context, args, client, channel: channelOf({ context, args }), json: json7, print: print9 });
|
|
77934
78055
|
}
|
|
77935
78056
|
async function browserTabCdp({
|
|
77936
78057
|
context,
|
|
@@ -77976,7 +78097,7 @@ function tunnel({
|
|
|
77976
78097
|
host: host2,
|
|
77977
78098
|
port
|
|
77978
78099
|
}) {
|
|
77979
|
-
return new Promise((
|
|
78100
|
+
return new Promise((resolve21, reject) => {
|
|
77980
78101
|
const socket = connectTcp(proxy.port, proxy.host);
|
|
77981
78102
|
let answer5 = "";
|
|
77982
78103
|
const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
|
|
@@ -77993,7 +78114,7 @@ ${auth}\r
|
|
|
77993
78114
|
answer5 += chunk.toString("latin1");
|
|
77994
78115
|
if (!answer5.includes(HEADER_END)) return;
|
|
77995
78116
|
socket.off("data", onData);
|
|
77996
|
-
if (/^HTTP\/1\.[01] 200/.test(answer5)) return
|
|
78117
|
+
if (/^HTTP\/1\.[01] 200/.test(answer5)) return resolve21(socket);
|
|
77997
78118
|
socket.destroy();
|
|
77998
78119
|
reject(new Error(`proxy refused the tunnel: ${answer5.split("\r\n")[0] ?? ""}`));
|
|
77999
78120
|
};
|
|
@@ -78006,8 +78127,8 @@ async function upstreamOf({ target, proxy }) {
|
|
|
78006
78127
|
const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
|
|
78007
78128
|
if (!secure) return raw;
|
|
78008
78129
|
const tls = connectTls({ socket: raw, servername: target.hostname });
|
|
78009
|
-
await new Promise((
|
|
78010
|
-
tls.once("secureConnect", () =>
|
|
78130
|
+
await new Promise((resolve21, reject) => {
|
|
78131
|
+
tls.once("secureConnect", () => resolve21());
|
|
78011
78132
|
tls.once("error", reject);
|
|
78012
78133
|
});
|
|
78013
78134
|
return tls;
|
|
@@ -78049,8 +78170,8 @@ async function browserSocket({
|
|
|
78049
78170
|
createConnection: () => upstream,
|
|
78050
78171
|
perMessageDeflate: false
|
|
78051
78172
|
});
|
|
78052
|
-
await new Promise((
|
|
78053
|
-
socket.once("open", () =>
|
|
78173
|
+
await new Promise((resolve21, reject) => {
|
|
78174
|
+
socket.once("open", () => resolve21());
|
|
78054
78175
|
socket.once("error", reject);
|
|
78055
78176
|
});
|
|
78056
78177
|
return socket;
|
|
@@ -78063,12 +78184,12 @@ async function browserCall({
|
|
|
78063
78184
|
}) {
|
|
78064
78185
|
const socket = await browserSocket({ target, proxy });
|
|
78065
78186
|
try {
|
|
78066
|
-
return await new Promise((
|
|
78187
|
+
return await new Promise((resolve21, reject) => {
|
|
78067
78188
|
socket.on("message", (data) => {
|
|
78068
78189
|
const reply2 = JSON.parse(textOf2(data));
|
|
78069
78190
|
if (reply2.id !== 1) return;
|
|
78070
78191
|
if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
|
|
78071
|
-
else
|
|
78192
|
+
else resolve21(reply2.result ?? {});
|
|
78072
78193
|
});
|
|
78073
78194
|
socket.once(
|
|
78074
78195
|
"close",
|
|
@@ -78232,18 +78353,18 @@ function retargetCdpBridge({
|
|
|
78232
78353
|
target,
|
|
78233
78354
|
expiresAt
|
|
78234
78355
|
}) {
|
|
78235
|
-
return new Promise((
|
|
78356
|
+
return new Promise((resolve21) => {
|
|
78236
78357
|
const call = httpRequest(
|
|
78237
78358
|
{ host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
|
|
78238
78359
|
(response) => {
|
|
78239
78360
|
response.resume();
|
|
78240
|
-
|
|
78361
|
+
resolve21(response.statusCode === 204);
|
|
78241
78362
|
}
|
|
78242
78363
|
);
|
|
78243
78364
|
call.setHeader(KEY_HEADER, key);
|
|
78244
78365
|
call.setHeader("content-type", "application/json");
|
|
78245
78366
|
call.once("timeout", () => call.destroy());
|
|
78246
|
-
call.once("error", () =>
|
|
78367
|
+
call.once("error", () => resolve21(false));
|
|
78247
78368
|
call.end(JSON.stringify({ target, expiresAt }));
|
|
78248
78369
|
});
|
|
78249
78370
|
}
|
|
@@ -78292,15 +78413,15 @@ async function startCdpBridge({
|
|
|
78292
78413
|
(socket) => relayPage({ client: socket, targetId, target: url2, proxy })
|
|
78293
78414
|
);
|
|
78294
78415
|
});
|
|
78295
|
-
await new Promise((
|
|
78416
|
+
await new Promise((resolve21) => server.listen(0, "127.0.0.1", resolve21));
|
|
78296
78417
|
const port = server.address().port;
|
|
78297
78418
|
return {
|
|
78298
78419
|
port,
|
|
78299
|
-
close: () => new Promise((
|
|
78420
|
+
close: () => new Promise((resolve21) => {
|
|
78300
78421
|
for (const client of relayed) client.destroy();
|
|
78301
78422
|
pages.close();
|
|
78302
78423
|
server.closeAllConnections();
|
|
78303
|
-
server.close(() =>
|
|
78424
|
+
server.close(() => resolve21());
|
|
78304
78425
|
})
|
|
78305
78426
|
};
|
|
78306
78427
|
}
|
|
@@ -78317,18 +78438,18 @@ function launchCdpBridge({
|
|
|
78317
78438
|
stdio: ["ignore", "pipe", "ignore"],
|
|
78318
78439
|
env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
|
|
78319
78440
|
});
|
|
78320
|
-
return new Promise((
|
|
78321
|
-
let
|
|
78441
|
+
return new Promise((resolve21, reject) => {
|
|
78442
|
+
let printed2 = "";
|
|
78322
78443
|
child.once("error", reject);
|
|
78323
78444
|
child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
|
|
78324
78445
|
child.stdout.on("data", (chunk) => {
|
|
78325
|
-
|
|
78326
|
-
const port = Number(
|
|
78327
|
-
if (!
|
|
78446
|
+
printed2 += chunk.toString("utf8");
|
|
78447
|
+
const port = Number(printed2.split("\n")[0]);
|
|
78448
|
+
if (!printed2.includes("\n")) return;
|
|
78328
78449
|
child.stdout.destroy();
|
|
78329
78450
|
child.removeAllListeners("exit");
|
|
78330
78451
|
child.unref();
|
|
78331
|
-
if (Number.isInteger(port) && port > 0)
|
|
78452
|
+
if (Number.isInteger(port) && port > 0) resolve21(port);
|
|
78332
78453
|
else reject(new Error("the CDP bridge printed no port"));
|
|
78333
78454
|
});
|
|
78334
78455
|
});
|
|
@@ -78626,10 +78747,10 @@ function extendedLine({ detail }) {
|
|
|
78626
78747
|
`;
|
|
78627
78748
|
}
|
|
78628
78749
|
function formatBrowsable({
|
|
78629
|
-
channels:
|
|
78750
|
+
channels: channels3
|
|
78630
78751
|
}) {
|
|
78631
|
-
if (
|
|
78632
|
-
const rows =
|
|
78752
|
+
if (channels3.length === 0) return "No channels to browse.\n";
|
|
78753
|
+
const rows = channels3.map((channel) => {
|
|
78633
78754
|
const count5 = `${channel.memberCount} ${channel.memberCount === 1 ? "member" : "members"}`;
|
|
78634
78755
|
const marks = [
|
|
78635
78756
|
channel.joined ? "joined" : "not joined",
|
|
@@ -78919,13 +79040,13 @@ function channelOf2({ args, usage }) {
|
|
|
78919
79040
|
}
|
|
78920
79041
|
async function channelBrowse({ context, args }) {
|
|
78921
79042
|
const { client } = await signedIn({ context, args });
|
|
78922
|
-
const
|
|
79043
|
+
const channels3 = await client.post(
|
|
78923
79044
|
"/api/agents/me/channels/browse",
|
|
78924
79045
|
{}
|
|
78925
79046
|
);
|
|
78926
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
79047
|
+
if (args.flags.json) return context.out(`${JSON.stringify(channels3, null, 2)}
|
|
78927
79048
|
`);
|
|
78928
|
-
context.out(formatBrowsable({ channels:
|
|
79049
|
+
context.out(formatBrowsable({ channels: channels3 }));
|
|
78929
79050
|
}
|
|
78930
79051
|
async function channelJoin({ context, args }) {
|
|
78931
79052
|
const channel = channelOf2({ args, usage: "Usage: laze channel join <channel>" });
|
|
@@ -79122,19 +79243,19 @@ async function channelUnmute({ context, args }) {
|
|
|
79122
79243
|
async function channelSettings({ context, args }) {
|
|
79123
79244
|
const wanted = args.words[2]?.trim();
|
|
79124
79245
|
const { client } = await signedIn({ context, args });
|
|
79125
|
-
const
|
|
79246
|
+
const channels3 = (await client.get("/api/agents/me/channels")).filter(isChannel);
|
|
79126
79247
|
const name3 = wanted?.replace(/^#/, "").toLowerCase();
|
|
79127
|
-
const
|
|
79128
|
-
if (wanted &&
|
|
79248
|
+
const shown2 = wanted ? channels3.filter((channel) => channel.id === wanted || channel.name === name3) : channels3;
|
|
79249
|
+
if (wanted && shown2.length === 0) {
|
|
79129
79250
|
throw new CliUsageError(`You are not in ${wanted}. laze channel settings lists your channels.`);
|
|
79130
79251
|
}
|
|
79131
79252
|
if (args.flags.json) {
|
|
79132
|
-
const value = wanted ?
|
|
79253
|
+
const value = wanted ? shown2[0] : shown2;
|
|
79133
79254
|
return context.out(`${JSON.stringify(value, null, 2)}
|
|
79134
79255
|
`);
|
|
79135
79256
|
}
|
|
79136
|
-
if (
|
|
79137
|
-
for (const channel of
|
|
79257
|
+
if (shown2.length === 0) return context.out("You are in no channels.\n");
|
|
79258
|
+
for (const channel of shown2) context.out(settingRowOf({ channel }));
|
|
79138
79259
|
}
|
|
79139
79260
|
|
|
79140
79261
|
// src/services/chat-actions-commands.service.ts
|
|
@@ -79268,7 +79389,7 @@ var CHAT_ACTIONS_USAGE = `Usage:
|
|
|
79268
79389
|
laze message restore <messageId> put a scrubbed secret back in your message (people)
|
|
79269
79390
|
laze pins <channel> a conversation's pinned messages
|
|
79270
79391
|
laze channel read <channel> [--seq <n>] mark it read, up to a message or to the newest
|
|
79271
|
-
laze channel unread <channel> --seq <n>
|
|
79392
|
+
laze channel unread <channel> [--seq <n>] mark it unread from a message, or its last one
|
|
79272
79393
|
laze files <channel> [--before <fileId>] [--limit <n>] its files, newest first
|
|
79273
79394
|
laze file link <fileId> [--variant original|thumbnail|poster|preview] [--download]
|
|
79274
79395
|
laze file rename <fileId> <name> rename a file you posted
|
|
@@ -79446,10 +79567,9 @@ var channelRead = async ({ context, args, client }) => {
|
|
|
79446
79567
|
};
|
|
79447
79568
|
var channelUnread = async ({ context, args, client }) => {
|
|
79448
79569
|
const seq = numberFlag(args, "seq");
|
|
79449
|
-
if (!seq) throw new CliUsageError(CHAT_ACTIONS_USAGE);
|
|
79450
79570
|
const answer5 = await client.post(CHAT_KEY_PATHS.markUnread, {
|
|
79451
79571
|
channel: wordAt(args, 2),
|
|
79452
|
-
seq
|
|
79572
|
+
...seq !== void 0 && { seq }
|
|
79453
79573
|
});
|
|
79454
79574
|
print6({ context, args, answer: answer5, text: (it) => `Read up to ${it.lastReadSeq}.
|
|
79455
79575
|
` });
|
|
@@ -82611,6 +82731,524 @@ async function conversationDelete({ context, args }) {
|
|
|
82611
82731
|
`);
|
|
82612
82732
|
}
|
|
82613
82733
|
|
|
82734
|
+
// src/services/discord-commands.service.ts
|
|
82735
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
82736
|
+
import { resolve as resolve9 } from "node:path";
|
|
82737
|
+
|
|
82738
|
+
// ../../modules/discord/contract/src/discord.ts
|
|
82739
|
+
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
82740
|
+
var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
82741
|
+
var discordIdSchema = external_exports.string().regex(/^\d{5,25}$/);
|
|
82742
|
+
var DISCORD_PERMISSIONS = {
|
|
82743
|
+
ADMINISTRATOR: 1n << 3n,
|
|
82744
|
+
ADD_REACTIONS: 1n << 6n,
|
|
82745
|
+
VIEW_CHANNEL: 1n << 10n,
|
|
82746
|
+
SEND_MESSAGES: 1n << 11n,
|
|
82747
|
+
EMBED_LINKS: 1n << 14n,
|
|
82748
|
+
ATTACH_FILES: 1n << 15n,
|
|
82749
|
+
READ_MESSAGE_HISTORY: 1n << 16n,
|
|
82750
|
+
MANAGE_WEBHOOKS: 1n << 29n,
|
|
82751
|
+
CREATE_PUBLIC_THREADS: 1n << 35n,
|
|
82752
|
+
SEND_MESSAGES_IN_THREADS: 1n << 38n
|
|
82753
|
+
};
|
|
82754
|
+
var discordSetupDefinition = external_exports.object({
|
|
82755
|
+
setupKey: external_exports.string().min(1),
|
|
82756
|
+
/** The OAuth2 redirect to add in the portal. */
|
|
82757
|
+
redirectUrl: external_exports.url(),
|
|
82758
|
+
/** The Developer Portal's applications page. */
|
|
82759
|
+
portalUrl: external_exports.url(),
|
|
82760
|
+
/** A bot was saved: the setup resumes at "Add to server". */
|
|
82761
|
+
saved: external_exports.boolean(),
|
|
82762
|
+
applicationId: external_exports.string().nullable()
|
|
82763
|
+
});
|
|
82764
|
+
var discordSetupSchema = discordSetupDefinition;
|
|
82765
|
+
var discordLinkViewDefinition = external_exports.object({
|
|
82766
|
+
discordUserId: discordIdSchema,
|
|
82767
|
+
name: external_exports.string(),
|
|
82768
|
+
avatarUrl: external_exports.string().nullable()
|
|
82769
|
+
});
|
|
82770
|
+
var discordConnectionStatusSchema = external_exports.enum([
|
|
82771
|
+
"connected",
|
|
82772
|
+
"needs_attention",
|
|
82773
|
+
"bot_removed"
|
|
82774
|
+
]);
|
|
82775
|
+
var discordConnectionViewDefinition = external_exports.object({
|
|
82776
|
+
guildId: discordIdSchema,
|
|
82777
|
+
guildName: external_exports.string(),
|
|
82778
|
+
guildIconUrl: external_exports.string().nullable(),
|
|
82779
|
+
/** How the server shows in Laze; null shows its Discord name. */
|
|
82780
|
+
label: external_exports.string().nullable(),
|
|
82781
|
+
status: discordConnectionStatusSchema,
|
|
82782
|
+
/** What needs doing, in a sentence, when the status is not connected. */
|
|
82783
|
+
problem: external_exports.string().nullable(),
|
|
82784
|
+
cacheDays: external_exports.number().int().min(1).max(30),
|
|
82785
|
+
applicationId: external_exports.string(),
|
|
82786
|
+
connectedByUserId: external_exports.string(),
|
|
82787
|
+
createdAt: external_exports.iso.datetime(),
|
|
82788
|
+
/** The viewer's own link; null until they link. */
|
|
82789
|
+
me: discordLinkViewDefinition.nullable(),
|
|
82790
|
+
/** How many channels the viewer picked. */
|
|
82791
|
+
myPicks: external_exports.number().int().nonnegative()
|
|
82792
|
+
});
|
|
82793
|
+
var discordConnectionViewSchema = discordConnectionViewDefinition;
|
|
82794
|
+
var discordOverviewDefinition = external_exports.object({
|
|
82795
|
+
/** The bot an admin set up or is setting up; null before anyone started. */
|
|
82796
|
+
setup: discordSetupDefinition.nullable(),
|
|
82797
|
+
connections: external_exports.array(discordConnectionViewDefinition)
|
|
82798
|
+
});
|
|
82799
|
+
var discordOverviewSchema = discordOverviewDefinition;
|
|
82800
|
+
var discordPickModeSchema = external_exports.enum(["read", "reply"]);
|
|
82801
|
+
var discordPickStateSchema = external_exports.enum(["mirroring", "waiting_for_access", "cannot_reply"]);
|
|
82802
|
+
var discordChannelKindSchema = external_exports.enum(["text", "announcement", "forum"]);
|
|
82803
|
+
var discordChannelViewDefinition = external_exports.object({
|
|
82804
|
+
channelId: discordIdSchema,
|
|
82805
|
+
name: external_exports.string(),
|
|
82806
|
+
kind: discordChannelKindSchema,
|
|
82807
|
+
/** The category it sits in; null at the top. */
|
|
82808
|
+
category: external_exports.string().nullable(),
|
|
82809
|
+
/** Not every member of the server sees it. */
|
|
82810
|
+
private: external_exports.boolean(),
|
|
82811
|
+
picked: external_exports.boolean(),
|
|
82812
|
+
mode: discordPickModeSchema.nullable(),
|
|
82813
|
+
state: discordPickStateSchema.nullable(),
|
|
82814
|
+
/** Permissions the Laze bot lacks in it for the pick's mode, as Discord labels them. */
|
|
82815
|
+
missing: external_exports.array(external_exports.string()),
|
|
82816
|
+
/** The Laze conversation once it mirrors. */
|
|
82817
|
+
lazeChannelId: external_exports.string().nullable(),
|
|
82818
|
+
/** Opens the channel in Discord. */
|
|
82819
|
+
url: external_exports.url()
|
|
82820
|
+
});
|
|
82821
|
+
var discordChannelViewSchema = discordChannelViewDefinition;
|
|
82822
|
+
var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, guildId: discordIdSchema });
|
|
82823
|
+
var discordGuildInputSchema = guildInputDefinition;
|
|
82824
|
+
var saveDiscordAppDefinition = external_exports.object({
|
|
82825
|
+
workspaceId: workspaceIdSchema20,
|
|
82826
|
+
setupKey: external_exports.string().min(1).max(64),
|
|
82827
|
+
applicationId: external_exports.string().trim().max(40),
|
|
82828
|
+
clientSecret: external_exports.string().trim().max(200),
|
|
82829
|
+
botToken: external_exports.string().trim().max(200)
|
|
82830
|
+
});
|
|
82831
|
+
var saveDiscordAppInputSchema = saveDiscordAppDefinition;
|
|
82832
|
+
var startedAuthorizeDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
82833
|
+
var startedDiscordAuthorizeSchema = startedAuthorizeDefinition;
|
|
82834
|
+
var pickDefinition = external_exports.object({
|
|
82835
|
+
workspaceId: workspaceIdSchema20,
|
|
82836
|
+
guildId: discordIdSchema,
|
|
82837
|
+
channelId: discordIdSchema,
|
|
82838
|
+
picked: external_exports.boolean(),
|
|
82839
|
+
mode: discordPickModeSchema.default("read")
|
|
82840
|
+
});
|
|
82841
|
+
var discordPickInputSchema = pickDefinition;
|
|
82842
|
+
var updateConnectionDefinition = external_exports.object({
|
|
82843
|
+
workspaceId: workspaceIdSchema20,
|
|
82844
|
+
guildId: discordIdSchema,
|
|
82845
|
+
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
82846
|
+
cacheDays: external_exports.number().int().min(1).max(30).optional()
|
|
82847
|
+
});
|
|
82848
|
+
var updateDiscordConnectionInputSchema = updateConnectionDefinition;
|
|
82849
|
+
var oauthCallbackDefinition = external_exports.object({
|
|
82850
|
+
code: external_exports.string().max(200).optional(),
|
|
82851
|
+
state: external_exports.string().max(200).optional(),
|
|
82852
|
+
guild_id: external_exports.string().max(40).optional(),
|
|
82853
|
+
permissions: external_exports.string().max(40).optional(),
|
|
82854
|
+
error: external_exports.string().max(200).optional()
|
|
82855
|
+
});
|
|
82856
|
+
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, guildId: discordIdSchema });
|
|
82857
|
+
var historyInputDefinition = external_exports.object({
|
|
82858
|
+
workspaceId: workspaceIdSchema20,
|
|
82859
|
+
/** The Laze conversation that mirrors the Discord channel. */
|
|
82860
|
+
channelId: external_exports.string().min(1).max(200),
|
|
82861
|
+
before: external_exports.iso.datetime()
|
|
82862
|
+
});
|
|
82863
|
+
var discordHistoryInputSchema = historyInputDefinition;
|
|
82864
|
+
var discordFileDefinition = external_exports.object({
|
|
82865
|
+
id: external_exports.string(),
|
|
82866
|
+
name: external_exports.string(),
|
|
82867
|
+
mimetype: external_exports.string(),
|
|
82868
|
+
size: external_exports.number().int().nonnegative()
|
|
82869
|
+
});
|
|
82870
|
+
var historyMessageDefinition = external_exports.object({
|
|
82871
|
+
key: external_exports.string().min(1),
|
|
82872
|
+
createdAt: external_exports.iso.datetime(),
|
|
82873
|
+
authorName: external_exports.string(),
|
|
82874
|
+
authorAvatarUrl: external_exports.string().nullable(),
|
|
82875
|
+
authorUserId: external_exports.string().nullable(),
|
|
82876
|
+
body: external_exports.string(),
|
|
82877
|
+
replyCount: external_exports.number().int().nonnegative(),
|
|
82878
|
+
files: external_exports.array(discordFileDefinition)
|
|
82879
|
+
});
|
|
82880
|
+
var historyPageDefinition = external_exports.object({
|
|
82881
|
+
/** Oldest first. */
|
|
82882
|
+
messages: external_exports.array(historyMessageDefinition),
|
|
82883
|
+
hasOlder: external_exports.boolean()
|
|
82884
|
+
});
|
|
82885
|
+
var discordHistoryPageSchema = historyPageDefinition;
|
|
82886
|
+
var fileParamsDefinition = external_exports.object({
|
|
82887
|
+
workspaceId: workspaceIdSchema20,
|
|
82888
|
+
channelId: external_exports.string().min(1).max(200),
|
|
82889
|
+
messageId: discordIdSchema,
|
|
82890
|
+
attachmentId: discordIdSchema
|
|
82891
|
+
});
|
|
82892
|
+
var guildByKeyDefinition = guildInputDefinition.omit({ workspaceId: true });
|
|
82893
|
+
var saveAppByKeyDefinition = external_exports.object({
|
|
82894
|
+
...saveDiscordAppDefinition.omit({ workspaceId: true }).shape,
|
|
82895
|
+
clientSecret: external_exports.string().trim().max(200).optional(),
|
|
82896
|
+
botToken: external_exports.string().trim().max(200).optional(),
|
|
82897
|
+
fromConnection: external_exports.string().trim().min(1).max(200).optional()
|
|
82898
|
+
});
|
|
82899
|
+
var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
|
|
82900
|
+
var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
|
|
82901
|
+
var historyByKeyDefinition = historyInputDefinition.omit({ workspaceId: true });
|
|
82902
|
+
var emptyDefinition = external_exports.object({});
|
|
82903
|
+
var DISCORD_KEY_PATHS = {
|
|
82904
|
+
overview: "/api/discord/overview",
|
|
82905
|
+
beginSetup: "/api/discord/setup",
|
|
82906
|
+
saveApp: "/api/discord/app",
|
|
82907
|
+
startInstall: "/api/discord/install",
|
|
82908
|
+
startLink: "/api/discord/link",
|
|
82909
|
+
unlink: "/api/discord/unlink",
|
|
82910
|
+
channels: "/api/discord/channels",
|
|
82911
|
+
pick: "/api/discord/pick",
|
|
82912
|
+
updateConnection: "/api/discord/connection",
|
|
82913
|
+
disconnect: "/api/discord/disconnect",
|
|
82914
|
+
history: "/api/discord/history"
|
|
82915
|
+
};
|
|
82916
|
+
var DiscordApi = moduleApi()("discord");
|
|
82917
|
+
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();
|
|
82918
|
+
|
|
82919
|
+
// ../../modules/discord/contract/src/discord.config.ts
|
|
82920
|
+
var positiveInt6 = external_exports.coerce.number().int().positive();
|
|
82921
|
+
var discordConfig = Config.define((c) => ({
|
|
82922
|
+
publicBaseUrl,
|
|
82923
|
+
/** The versioned REST base; routes are `${apiUrl}/<route>`. */
|
|
82924
|
+
apiUrl: c.env("DISCORD_API_URL", external_exports.url().default("https://discord.com/api/v10")),
|
|
82925
|
+
/** Discord's consent page for installs and links. */
|
|
82926
|
+
authorizeUrl: c.env(
|
|
82927
|
+
"DISCORD_AUTHORIZE_URL",
|
|
82928
|
+
external_exports.url().default("https://discord.com/oauth2/authorize")
|
|
82929
|
+
),
|
|
82930
|
+
/** The Developer Portal's applications page, where an admin makes the bot. */
|
|
82931
|
+
portalUrl: c.env(
|
|
82932
|
+
"DISCORD_PORTAL_URL",
|
|
82933
|
+
external_exports.url().default("https://discord.com/developers/applications")
|
|
82934
|
+
),
|
|
82935
|
+
/** Discord's web app, for "Open in Discord" links. */
|
|
82936
|
+
appUrl: c.env("DISCORD_APP_URL", external_exports.url().default("https://discord.com")),
|
|
82937
|
+
/** How long a started install or link waits for Discord's answer. */
|
|
82938
|
+
authorizationMinutes: c.env("DISCORD_AUTHORIZATION_MINUTES", positiveInt6.default(10)),
|
|
82939
|
+
/** The longest wait between two gateway reconnects. */
|
|
82940
|
+
reconnectMaxSeconds: c.env("DISCORD_RECONNECT_MAX_SECONDS", positiveInt6.default(60))
|
|
82941
|
+
}));
|
|
82942
|
+
|
|
82943
|
+
// ../../modules/discord/contract/src/discord.events.ts
|
|
82944
|
+
var attachmentDefinition = external_exports.object({
|
|
82945
|
+
id: external_exports.string().min(1),
|
|
82946
|
+
filename: external_exports.string(),
|
|
82947
|
+
contentType: external_exports.string(),
|
|
82948
|
+
size: external_exports.number().int().nonnegative()
|
|
82949
|
+
});
|
|
82950
|
+
var messageDefinition = external_exports.object({
|
|
82951
|
+
id: external_exports.string().min(1),
|
|
82952
|
+
/** Where it was posted: the picked channel, or a thread under it. */
|
|
82953
|
+
channelId: external_exports.string().min(1),
|
|
82954
|
+
authorId: external_exports.string().min(1),
|
|
82955
|
+
authorName: external_exports.string(),
|
|
82956
|
+
authorAvatarUrl: external_exports.string().nullable(),
|
|
82957
|
+
bot: external_exports.boolean(),
|
|
82958
|
+
/** Set for a message a webhook posted, Laze's own included. */
|
|
82959
|
+
webhookId: external_exports.string().nullable(),
|
|
82960
|
+
content: external_exports.string(),
|
|
82961
|
+
createdAt: external_exports.iso.datetime(),
|
|
82962
|
+
editedAt: external_exports.iso.datetime().nullable(),
|
|
82963
|
+
attachments: external_exports.array(attachmentDefinition),
|
|
82964
|
+
/** The people `<@id>` mentions in the content, with the name Discord shows. */
|
|
82965
|
+
mentions: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string() }))
|
|
82966
|
+
});
|
|
82967
|
+
var channelDefinition = external_exports.object({
|
|
82968
|
+
id: external_exports.string().min(1),
|
|
82969
|
+
name: external_exports.string(),
|
|
82970
|
+
/** Discord's channel type number: 0 text, 5 news, 15 forum, 11 and 12 threads. */
|
|
82971
|
+
type: external_exports.number().int(),
|
|
82972
|
+
parentId: external_exports.string().nullable()
|
|
82973
|
+
});
|
|
82974
|
+
var discordDispatchKindSchema = external_exports.enum([
|
|
82975
|
+
"message_created",
|
|
82976
|
+
"message_updated",
|
|
82977
|
+
"message_deleted",
|
|
82978
|
+
"reaction_added",
|
|
82979
|
+
"reaction_removed",
|
|
82980
|
+
"channel_updated",
|
|
82981
|
+
"channel_deleted",
|
|
82982
|
+
"thread_updated",
|
|
82983
|
+
"thread_deleted"
|
|
82984
|
+
]);
|
|
82985
|
+
var dispatchDefinition = external_exports.object({
|
|
82986
|
+
workspaceId: external_exports.string().min(1),
|
|
82987
|
+
guildId: external_exports.string().min(1),
|
|
82988
|
+
/** The gateway session and sequence: a replay after a resume carries the same pair. */
|
|
82989
|
+
sessionId: external_exports.string().min(1),
|
|
82990
|
+
seq: external_exports.number().int().nonnegative(),
|
|
82991
|
+
kind: discordDispatchKindSchema,
|
|
82992
|
+
/** The picked channel it belongs to: itself, or a thread's parent. */
|
|
82993
|
+
pickedChannelId: external_exports.string().min(1),
|
|
82994
|
+
/** Where it happened: the picked channel or a thread of it. */
|
|
82995
|
+
channelId: external_exports.string().min(1),
|
|
82996
|
+
messageId: external_exports.string().nullable(),
|
|
82997
|
+
message: messageDefinition.nullable(),
|
|
82998
|
+
reaction: external_exports.object({ userId: external_exports.string().min(1), emoji: external_exports.string().min(1).max(64) }).nullable(),
|
|
82999
|
+
channel: channelDefinition.nullable(),
|
|
83000
|
+
receivedAt: external_exports.iso.datetime()
|
|
83001
|
+
});
|
|
83002
|
+
var sweepScheduledDefinition = external_exports.object({
|
|
83003
|
+
workspaceId: external_exports.string().min(1),
|
|
83004
|
+
guildId: external_exports.string().min(1),
|
|
83005
|
+
changeId: external_exports.string().min(1),
|
|
83006
|
+
/** Epoch milliseconds. */
|
|
83007
|
+
nextSweepAt: external_exports.number().int()
|
|
83008
|
+
});
|
|
83009
|
+
var sweepStateDefinition = external_exports.object({
|
|
83010
|
+
workspaceId: external_exports.string().nullable(),
|
|
83011
|
+
guildId: external_exports.string().nullable(),
|
|
83012
|
+
nextWakeAt: external_exports.number().nullable()
|
|
83013
|
+
});
|
|
83014
|
+
var sweepIntentDefinition = external_exports.object({
|
|
83015
|
+
workspaceId: external_exports.string().min(1),
|
|
83016
|
+
guildId: external_exports.string().min(1)
|
|
83017
|
+
});
|
|
83018
|
+
|
|
83019
|
+
// src/services/discord-commands.service.ts
|
|
83020
|
+
var DISCORD_USAGE = `Usage (a person's key; Discord stays the source, each person picks their own channels):
|
|
83021
|
+
laze discord overview the bot's setup, connected servers and your link
|
|
83022
|
+
laze discord link <guildId> prints the link that links your own Discord
|
|
83023
|
+
laze discord unlink <guildId> take your Discord link back
|
|
83024
|
+
laze discord channels <guildId> the channels you can view, with your picks
|
|
83025
|
+
laze discord pick <guildId> <channelId> [--reply] [--off]
|
|
83026
|
+
mirror a channel for you (--reply lets Laze answer in it, --off stops it)
|
|
83027
|
+
laze discord history <channelId> [--before <iso time>] older messages of a mirrored conversation
|
|
83028
|
+
Admins:
|
|
83029
|
+
laze discord setup start the setup: the redirect to add in the portal
|
|
83030
|
+
laze discord save-app <setupKey> --application-id <id>
|
|
83031
|
+
the Client Secret then the Bot Token, one per line, from stdin or --from-file <path>,
|
|
83032
|
+
or --from-vault <connection> holding CLIENT_SECRET and BOT_TOKEN
|
|
83033
|
+
laze discord install prints the saved bot's "Add to server" link
|
|
83034
|
+
laze discord update <guildId> [--label <name>|none] [--cache-days <n>]
|
|
83035
|
+
laze discord disconnect <guildId> remove Laze from the server`;
|
|
83036
|
+
var SECRET_FLAGS2 = ["client-secret", "bot-token", "token", "secret"];
|
|
83037
|
+
function json4({ context, args, data }) {
|
|
83038
|
+
if (!args.flags.json) return false;
|
|
83039
|
+
context.out(`${JSON.stringify(data, null, 2)}
|
|
83040
|
+
`);
|
|
83041
|
+
return true;
|
|
83042
|
+
}
|
|
83043
|
+
function wordAt3(args, index) {
|
|
83044
|
+
const word3 = args.words[index];
|
|
83045
|
+
if (!word3) throw new CliUsageError(DISCORD_USAGE);
|
|
83046
|
+
return word3;
|
|
83047
|
+
}
|
|
83048
|
+
async function secretsOf({ context, args }) {
|
|
83049
|
+
if (SECRET_FLAGS2.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
83050
|
+
throw new CliUsageError(
|
|
83051
|
+
"A secret never goes in a flag: pipe it on stdin, use --from-file or --from-vault."
|
|
83052
|
+
);
|
|
83053
|
+
}
|
|
83054
|
+
const fromConnection = flagText({ args, name: "from-vault" });
|
|
83055
|
+
if (fromConnection) return { fromConnection };
|
|
83056
|
+
const file3 = flagText({ args, name: "from-file" });
|
|
83057
|
+
const text2 = file3 ? await readFile26(resolve9(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83058
|
+
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83059
|
+
if (lines2.length !== 2) {
|
|
83060
|
+
throw new CliUsageError(
|
|
83061
|
+
"Give the Client Secret then the Bot Token, one per line, on stdin or --from-file."
|
|
83062
|
+
);
|
|
83063
|
+
}
|
|
83064
|
+
return { clientSecret: lines2[0] ?? "", botToken: lines2[1] ?? "" };
|
|
83065
|
+
}
|
|
83066
|
+
function authorizeRun(path, label3, body) {
|
|
83067
|
+
return async ({ context, args, client }) => {
|
|
83068
|
+
const started = await client.post(path, body(args));
|
|
83069
|
+
if (json4({ context, args, data: started })) return;
|
|
83070
|
+
context.out(`${label3}:
|
|
83071
|
+
${started.authorizeUrl}
|
|
83072
|
+
`);
|
|
83073
|
+
};
|
|
83074
|
+
}
|
|
83075
|
+
function printConnection2({ context, row }) {
|
|
83076
|
+
const you = row.me ? `you: ${row.me.name}` : "you: not linked";
|
|
83077
|
+
const problem = row.problem ? ` ${row.problem}` : "";
|
|
83078
|
+
context.out(
|
|
83079
|
+
`${row.guildId} ${row.label ?? row.guildName} ${row.status.replaceAll("_", " ")} ${row.myPicks} picked ${you}${problem}
|
|
83080
|
+
`
|
|
83081
|
+
);
|
|
83082
|
+
}
|
|
83083
|
+
function connectionRun(path, body) {
|
|
83084
|
+
return async ({ context, args, client }) => {
|
|
83085
|
+
const row = await client.post(path, body(args));
|
|
83086
|
+
if (json4({ context, args, data: row })) return;
|
|
83087
|
+
printConnection2({ context, row });
|
|
83088
|
+
};
|
|
83089
|
+
}
|
|
83090
|
+
function printSetup({ context, setup: setup4 }) {
|
|
83091
|
+
context.out(`Setup key: ${setup4.setupKey}
|
|
83092
|
+
`);
|
|
83093
|
+
if (setup4.saved) {
|
|
83094
|
+
context.out(`Bot saved for application ${setup4.applicationId ?? ""}: laze discord install
|
|
83095
|
+
`);
|
|
83096
|
+
return;
|
|
83097
|
+
}
|
|
83098
|
+
context.out(`Add this OAuth2 redirect in the Developer Portal:
|
|
83099
|
+
${setup4.redirectUrl}
|
|
83100
|
+
`);
|
|
83101
|
+
context.out(`Developer Portal: ${setup4.portalUrl}
|
|
83102
|
+
`);
|
|
83103
|
+
context.out(
|
|
83104
|
+
`Then: laze discord save-app ${setup4.setupKey} --application-id <id>, with the Client Secret then the Bot Token on stdin
|
|
83105
|
+
`
|
|
83106
|
+
);
|
|
83107
|
+
}
|
|
83108
|
+
var overview = async ({ context, args, client }) => {
|
|
83109
|
+
const view = await client.get(DISCORD_KEY_PATHS.overview);
|
|
83110
|
+
if (json4({ context, args, data: view })) return;
|
|
83111
|
+
if (!view.setup) context.out("No Discord bot is set up. An admin runs `laze discord setup`.\n");
|
|
83112
|
+
else if (!view.setup.saved) context.out(`Setup started: ${view.setup.setupKey}
|
|
83113
|
+
`);
|
|
83114
|
+
if (view.connections.length === 0) return context.out("No Discord server is connected.\n");
|
|
83115
|
+
for (const row of view.connections) printConnection2({ context, row });
|
|
83116
|
+
};
|
|
83117
|
+
var setup2 = async ({ context, args, client }) => {
|
|
83118
|
+
const started = await client.post(DISCORD_KEY_PATHS.beginSetup, {});
|
|
83119
|
+
if (json4({ context, args, data: started })) return;
|
|
83120
|
+
printSetup({ context, setup: started });
|
|
83121
|
+
};
|
|
83122
|
+
var saveApp = async ({ context, args, client }) => {
|
|
83123
|
+
const applicationId = flagText({ args, name: "application-id" });
|
|
83124
|
+
if (!applicationId) throw new CliUsageError(DISCORD_USAGE);
|
|
83125
|
+
const body = {
|
|
83126
|
+
setupKey: wordAt3(args, 2),
|
|
83127
|
+
applicationId,
|
|
83128
|
+
...await secretsOf({ context, args })
|
|
83129
|
+
};
|
|
83130
|
+
await authorizeRun(
|
|
83131
|
+
DISCORD_KEY_PATHS.saveApp,
|
|
83132
|
+
"Saved. Open this link to add the bot to a server",
|
|
83133
|
+
() => body
|
|
83134
|
+
)({ context, args, client });
|
|
83135
|
+
};
|
|
83136
|
+
var channels = async ({ context, args, client }) => {
|
|
83137
|
+
const rows = await client.post(DISCORD_KEY_PATHS.channels, {
|
|
83138
|
+
guildId: wordAt3(args, 2)
|
|
83139
|
+
});
|
|
83140
|
+
if (json4({ context, args, data: rows })) return;
|
|
83141
|
+
if (rows.length === 0) return context.out("No channels you can view.\n");
|
|
83142
|
+
for (const row of rows) printChannel({ context, row });
|
|
83143
|
+
};
|
|
83144
|
+
function printChannel({ context, row }) {
|
|
83145
|
+
const where = row.category ? `${row.category}/` : "";
|
|
83146
|
+
const pick3 = row.picked ? ` picked (${row.mode ?? "read"})` : "";
|
|
83147
|
+
const state = row.state ? ` ${row.state.replaceAll("_", " ")}` : "";
|
|
83148
|
+
const missing = row.missing.length > 0 ? ` bot lacks: ${row.missing.join(", ")}` : "";
|
|
83149
|
+
const visibility = row.private ? " private" : "";
|
|
83150
|
+
context.out(
|
|
83151
|
+
`${row.channelId} ${where}#${row.name} ${row.kind}${visibility}${pick3}${state}${missing}
|
|
83152
|
+
`
|
|
83153
|
+
);
|
|
83154
|
+
}
|
|
83155
|
+
var pick2 = async ({ context, args, client }) => {
|
|
83156
|
+
const row = await client.post(DISCORD_KEY_PATHS.pick, {
|
|
83157
|
+
guildId: wordAt3(args, 2),
|
|
83158
|
+
channelId: wordAt3(args, 3),
|
|
83159
|
+
picked: args.flags.off !== true,
|
|
83160
|
+
mode: args.flags.reply === true ? "reply" : "read"
|
|
83161
|
+
});
|
|
83162
|
+
if (json4({ context, args, data: row })) return;
|
|
83163
|
+
printChannel({ context, row });
|
|
83164
|
+
};
|
|
83165
|
+
function numberFlag2(args, name3) {
|
|
83166
|
+
const text2 = flagText({ args, name: name3 });
|
|
83167
|
+
if (!text2) return void 0;
|
|
83168
|
+
const value = Number(text2);
|
|
83169
|
+
if (!Number.isInteger(value)) throw new CliUsageError(`--${name3} takes a whole number.`);
|
|
83170
|
+
return value;
|
|
83171
|
+
}
|
|
83172
|
+
function updateBody(args) {
|
|
83173
|
+
const label3 = flagText({ args, name: "label" });
|
|
83174
|
+
const cacheDays = numberFlag2(args, "cache-days");
|
|
83175
|
+
if (!label3 && cacheDays === void 0) throw new CliUsageError(DISCORD_USAGE);
|
|
83176
|
+
return {
|
|
83177
|
+
guildId: wordAt3(args, 2),
|
|
83178
|
+
...label3 && { label: label3 === "none" ? null : label3 },
|
|
83179
|
+
...cacheDays !== void 0 && { cacheDays }
|
|
83180
|
+
};
|
|
83181
|
+
}
|
|
83182
|
+
var disconnect = async ({ context, args, client }) => {
|
|
83183
|
+
const guildId = wordAt3(args, 2);
|
|
83184
|
+
const answer5 = await client.post(DISCORD_KEY_PATHS.disconnect, {
|
|
83185
|
+
guildId
|
|
83186
|
+
});
|
|
83187
|
+
if (json4({ context, args, data: answer5 })) return;
|
|
83188
|
+
context.out(`Disconnected ${guildId}.
|
|
83189
|
+
`);
|
|
83190
|
+
};
|
|
83191
|
+
function beforeOf({ context, args }) {
|
|
83192
|
+
const given = flagText({ args, name: "before" });
|
|
83193
|
+
try {
|
|
83194
|
+
const instant = given ? Temporal3.Instant.from(given) : Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
|
|
83195
|
+
return instant.toString({ smallestUnit: "millisecond" });
|
|
83196
|
+
} catch {
|
|
83197
|
+
throw new CliUsageError("--before takes an ISO time, such as 2026-10-24T10:00:00Z.");
|
|
83198
|
+
}
|
|
83199
|
+
}
|
|
83200
|
+
var history = async ({ context, args, client }) => {
|
|
83201
|
+
const before = beforeOf({ context, args });
|
|
83202
|
+
const page = await client.post(DISCORD_KEY_PATHS.history, {
|
|
83203
|
+
channelId: wordAt3(args, 2),
|
|
83204
|
+
before
|
|
83205
|
+
});
|
|
83206
|
+
if (json4({ context, args, data: page })) return;
|
|
83207
|
+
if (page.messages.length === 0) return context.out("No older messages.\n");
|
|
83208
|
+
for (const message2 of page.messages) {
|
|
83209
|
+
const files2 = message2.files.length > 0 ? ` [${message2.files.length} files]` : "";
|
|
83210
|
+
context.out(`[${message2.createdAt}] ${message2.authorName}: ${message2.body}${files2}
|
|
83211
|
+
`);
|
|
83212
|
+
}
|
|
83213
|
+
if (page.hasOlder) {
|
|
83214
|
+
const oldest = page.messages[0]?.createdAt ?? before;
|
|
83215
|
+
context.out(`Older: laze discord history ${wordAt3(args, 2)} --before ${oldest}
|
|
83216
|
+
`);
|
|
83217
|
+
}
|
|
83218
|
+
};
|
|
83219
|
+
var guildOf = (args) => ({ guildId: wordAt3(args, 2) });
|
|
83220
|
+
var RUNS3 = {
|
|
83221
|
+
overview,
|
|
83222
|
+
setup: setup2,
|
|
83223
|
+
"save-app": saveApp,
|
|
83224
|
+
install: authorizeRun(
|
|
83225
|
+
DISCORD_KEY_PATHS.startInstall,
|
|
83226
|
+
"Open this link to add the bot to a server",
|
|
83227
|
+
() => ({})
|
|
83228
|
+
),
|
|
83229
|
+
link: authorizeRun(
|
|
83230
|
+
DISCORD_KEY_PATHS.startLink,
|
|
83231
|
+
"Open this link to link your Discord account",
|
|
83232
|
+
guildOf
|
|
83233
|
+
),
|
|
83234
|
+
unlink: connectionRun(DISCORD_KEY_PATHS.unlink, guildOf),
|
|
83235
|
+
channels,
|
|
83236
|
+
pick: pick2,
|
|
83237
|
+
update: connectionRun(DISCORD_KEY_PATHS.updateConnection, updateBody),
|
|
83238
|
+
disconnect,
|
|
83239
|
+
history
|
|
83240
|
+
};
|
|
83241
|
+
async function discord({
|
|
83242
|
+
context,
|
|
83243
|
+
args
|
|
83244
|
+
}) {
|
|
83245
|
+
const verb = args.words[1] ?? "";
|
|
83246
|
+
const run4 = Object.hasOwn(RUNS3, verb) ? RUNS3[verb] : void 0;
|
|
83247
|
+
if (!run4) throw new CliUsageError(DISCORD_USAGE);
|
|
83248
|
+
const { client } = await signedIn({ context, args });
|
|
83249
|
+
await run4({ context, args, client });
|
|
83250
|
+
}
|
|
83251
|
+
|
|
82614
83252
|
// src/rules/dnd-input.rules.ts
|
|
82615
83253
|
var FOR = /^(\d{1,4})(m|h)$/;
|
|
82616
83254
|
var CLOCK = /^([01]?\d|2[0-3]):([0-5]\d)$/;
|
|
@@ -82718,6 +83356,92 @@ async function domains({ context, args }) {
|
|
|
82718
83356
|
await command({ context, args });
|
|
82719
83357
|
}
|
|
82720
83358
|
|
|
83359
|
+
// src/services/emoji-commands.service.ts
|
|
83360
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
83361
|
+
import { resolve as resolve10 } from "node:path";
|
|
83362
|
+
var EMOJI_USAGE = `Usage:
|
|
83363
|
+
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
83364
|
+
laze emoji add <name> <file> [--alias <a,b>] add a PNG, JPEG or GIF as :name: (made 128px square)
|
|
83365
|
+
laze emoji alias <alias> <name> another name for an emoji
|
|
83366
|
+
laze emoji remove <name> remove an emoji you added (admins: any), or an alias`;
|
|
83367
|
+
var shown = (emoji4) => `:${emoji4.name}: ${(emoji4.aliases ?? []).map((alias) => `:${alias}:`).join(" ") || "-"} ${emoji4.addedBy?.name ?? "Slack"}
|
|
83368
|
+
`;
|
|
83369
|
+
function wordAt4(args, index) {
|
|
83370
|
+
const word3 = args.words[index];
|
|
83371
|
+
if (!word3) throw new CliUsageError(EMOJI_USAGE);
|
|
83372
|
+
return word3;
|
|
83373
|
+
}
|
|
83374
|
+
var ACTIONS = ["list", "add", "alias", "remove", "rm"];
|
|
83375
|
+
var bare = (name3) => name3.replace(/^:|:$/g, "");
|
|
83376
|
+
var printed = ({ context, value }) => context.out(`${JSON.stringify(value, null, 2)}
|
|
83377
|
+
`);
|
|
83378
|
+
var NEEDED_WORDS = {
|
|
83379
|
+
list: [],
|
|
83380
|
+
add: [2, 3],
|
|
83381
|
+
alias: [2, 3],
|
|
83382
|
+
remove: [2],
|
|
83383
|
+
rm: [2]
|
|
83384
|
+
};
|
|
83385
|
+
function actionOf(args) {
|
|
83386
|
+
const action = ACTIONS.find((each) => each === (args.words[1] ?? "list"));
|
|
83387
|
+
if (!action) throw new CliUsageError(EMOJI_USAGE);
|
|
83388
|
+
for (const index of NEEDED_WORDS[action]) wordAt4(args, index);
|
|
83389
|
+
return action;
|
|
83390
|
+
}
|
|
83391
|
+
async function listEmoji({ context, args, client }) {
|
|
83392
|
+
const list11 = await client.get(EMOJI_KEY_PATHS.list);
|
|
83393
|
+
if (args.flags.json) return printed({ context, value: list11 });
|
|
83394
|
+
if (list11.emoji.length === 0) return context.out("This workspace has no custom emoji yet.\n");
|
|
83395
|
+
for (const each of list11.emoji) context.out(shown(each));
|
|
83396
|
+
}
|
|
83397
|
+
async function addEmoji({ context, args, client }) {
|
|
83398
|
+
const file3 = wordAt4(args, 3);
|
|
83399
|
+
let bytes;
|
|
83400
|
+
try {
|
|
83401
|
+
bytes = new Uint8Array(await readFile27(resolve10(context.cwd, file3)));
|
|
83402
|
+
} catch {
|
|
83403
|
+
throw new CliUsageError(`Cannot read ${file3}.`);
|
|
83404
|
+
}
|
|
83405
|
+
const aliases = flagText({ args, name: "alias" }).split(",").map((alias) => alias.trim()).filter(Boolean);
|
|
83406
|
+
const added = await client.post(EMOJI_KEY_PATHS.add, {
|
|
83407
|
+
name: wordAt4(args, 2),
|
|
83408
|
+
contentType: contentTypeOf(file3),
|
|
83409
|
+
dataBase64: Buffer.from(bytes).toString("base64"),
|
|
83410
|
+
aliases
|
|
83411
|
+
});
|
|
83412
|
+
if (args.flags.json) return printed({ context, value: added });
|
|
83413
|
+
context.out(`Added :${added.name}:.
|
|
83414
|
+
`);
|
|
83415
|
+
}
|
|
83416
|
+
async function aliasEmoji({ context, args, client }) {
|
|
83417
|
+
const answer5 = await client.post(EMOJI_KEY_PATHS.alias, {
|
|
83418
|
+
alias: wordAt4(args, 2),
|
|
83419
|
+
name: wordAt4(args, 3)
|
|
83420
|
+
});
|
|
83421
|
+
if (args.flags.json) return printed({ context, value: answer5 });
|
|
83422
|
+
context.out(`:${bare(wordAt4(args, 2))}: now shows :${answer5.name}:.
|
|
83423
|
+
`);
|
|
83424
|
+
}
|
|
83425
|
+
async function removeEmoji({ context, args, client }) {
|
|
83426
|
+
const name3 = wordAt4(args, 2);
|
|
83427
|
+
await client.post(EMOJI_KEY_PATHS.remove, { name: name3 });
|
|
83428
|
+
if (args.flags.json) return printed({ context, value: { removed: true } });
|
|
83429
|
+
context.out(`Removed :${bare(name3)}:.
|
|
83430
|
+
`);
|
|
83431
|
+
}
|
|
83432
|
+
var RUN = {
|
|
83433
|
+
list: listEmoji,
|
|
83434
|
+
add: addEmoji,
|
|
83435
|
+
alias: aliasEmoji,
|
|
83436
|
+
remove: removeEmoji,
|
|
83437
|
+
rm: removeEmoji
|
|
83438
|
+
};
|
|
83439
|
+
async function emoji3({ context, args }) {
|
|
83440
|
+
const action = actionOf(args);
|
|
83441
|
+
const { client } = await signedIn({ context, args });
|
|
83442
|
+
await RUN[action]({ context, args, client });
|
|
83443
|
+
}
|
|
83444
|
+
|
|
82721
83445
|
// ../../modules/external-connection/contract/src/external-connection.ts
|
|
82722
83446
|
var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
82723
83447
|
list: "/api/external-connections/list",
|
|
@@ -82740,10 +83464,10 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
|
82740
83464
|
block: "/api/external-connections/block",
|
|
82741
83465
|
report: "/api/external-connections/report"
|
|
82742
83466
|
};
|
|
82743
|
-
var
|
|
83467
|
+
var workspaceIdSchema21 = external_exports.string().min(1).max(64);
|
|
82744
83468
|
var idSchema21 = external_exports.string().min(1).max(64);
|
|
82745
83469
|
var iso = external_exports.iso.datetime();
|
|
82746
|
-
var
|
|
83470
|
+
var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema21 });
|
|
82747
83471
|
var connectionReference = external_exports.string().trim().min(1).max(120);
|
|
82748
83472
|
var externalConnectionStateSchema = external_exports.enum(["active", "ended"]);
|
|
82749
83473
|
var externalInviteStateSchema = external_exports.enum([
|
|
@@ -82847,10 +83571,10 @@ var rosterDefinition = external_exports.object({
|
|
|
82847
83571
|
members: external_exports.array(rosterMemberDefinition)
|
|
82848
83572
|
});
|
|
82849
83573
|
var externalRosterSchema = rosterDefinition;
|
|
82850
|
-
var rosterInputDefinition = external_exports.object({ workspaceId:
|
|
83574
|
+
var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, channelId: idSchema21 });
|
|
82851
83575
|
var externalRosterInputSchema = rosterInputDefinition;
|
|
82852
83576
|
var inviteInputDefinition = external_exports.object({
|
|
82853
|
-
workspaceId:
|
|
83577
|
+
workspaceId: workspaceIdSchema21,
|
|
82854
83578
|
email: external_exports.email().max(320),
|
|
82855
83579
|
/** The first channel to share, by id or name; it is shared once the invitation is accepted. */
|
|
82856
83580
|
share: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -82858,7 +83582,7 @@ var inviteInputDefinition = external_exports.object({
|
|
|
82858
83582
|
company: external_exports.string().trim().min(1).max(80).optional()
|
|
82859
83583
|
});
|
|
82860
83584
|
var externalInviteInputSchema = inviteInputDefinition;
|
|
82861
|
-
var inviteRefDefinition = external_exports.object({ workspaceId:
|
|
83585
|
+
var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, inviteId: idSchema21 });
|
|
82862
83586
|
var externalInviteRefSchema = inviteRefDefinition;
|
|
82863
83587
|
var pendingShareDefinition = external_exports.object({
|
|
82864
83588
|
channelId: external_exports.string(),
|
|
@@ -82882,7 +83606,7 @@ var pendingSharesDefinition = external_exports.object({
|
|
|
82882
83606
|
var externalPendingSharesSchema = pendingSharesDefinition;
|
|
82883
83607
|
var acceptInviteDefinition = external_exports.object({
|
|
82884
83608
|
/** The workspace to connect: one where the person is Admin or Owner. */
|
|
82885
|
-
workspaceId:
|
|
83609
|
+
workspaceId: workspaceIdSchema21,
|
|
82886
83610
|
inviteId: idSchema21,
|
|
82887
83611
|
/** The emailed link's secret; without it the invitation must be addressed to the person. */
|
|
82888
83612
|
secret: external_exports.string().trim().max(200).optional()
|
|
@@ -82891,26 +83615,26 @@ var externalAcceptInviteInputSchema = acceptInviteDefinition;
|
|
|
82891
83615
|
var answeredDefinition = external_exports.object({ id: external_exports.string(), state: externalInviteStateSchema });
|
|
82892
83616
|
var externalInviteAnsweredSchema = answeredDefinition;
|
|
82893
83617
|
var connectionInputDefinition = external_exports.object({
|
|
82894
|
-
workspaceId:
|
|
83618
|
+
workspaceId: workspaceIdSchema21,
|
|
82895
83619
|
connection: connectionReference
|
|
82896
83620
|
});
|
|
82897
83621
|
var externalConnectionInputSchema = connectionInputDefinition;
|
|
82898
83622
|
var settingsInputDefinition = external_exports.object({
|
|
82899
|
-
workspaceId:
|
|
83623
|
+
workspaceId: workspaceIdSchema21,
|
|
82900
83624
|
connection: connectionReference,
|
|
82901
83625
|
agentsAllowed: external_exports.boolean().optional(),
|
|
82902
83626
|
directAllowed: external_exports.boolean().optional()
|
|
82903
83627
|
});
|
|
82904
83628
|
var externalSettingsInputSchema = settingsInputDefinition;
|
|
82905
83629
|
var shareInputDefinition = external_exports.object({
|
|
82906
|
-
workspaceId:
|
|
83630
|
+
workspaceId: workspaceIdSchema21,
|
|
82907
83631
|
connection: connectionReference,
|
|
82908
83632
|
/** The channel as its id or name, `#` optional. */
|
|
82909
83633
|
channel: external_exports.string().trim().min(1).max(81)
|
|
82910
83634
|
});
|
|
82911
83635
|
var externalShareInputSchema = shareInputDefinition;
|
|
82912
83636
|
var acceptShareDefinition = external_exports.object({
|
|
82913
|
-
workspaceId:
|
|
83637
|
+
workspaceId: workspaceIdSchema21,
|
|
82914
83638
|
shareId: idSchema21,
|
|
82915
83639
|
/** Its name here; the host's name when left out. */
|
|
82916
83640
|
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
@@ -82918,13 +83642,13 @@ var acceptShareDefinition = external_exports.object({
|
|
|
82918
83642
|
});
|
|
82919
83643
|
var externalAcceptShareInputSchema = acceptShareDefinition;
|
|
82920
83644
|
var shareRefDefinition = external_exports.object({
|
|
82921
|
-
workspaceId:
|
|
83645
|
+
workspaceId: workspaceIdSchema21,
|
|
82922
83646
|
/** The share's id, or this workspace's channel as its id or name. */
|
|
82923
83647
|
share: external_exports.string().trim().min(1).max(81)
|
|
82924
83648
|
});
|
|
82925
83649
|
var externalShareRefSchema = shareRefDefinition;
|
|
82926
83650
|
var reportInputDefinition = external_exports.object({
|
|
82927
|
-
workspaceId:
|
|
83651
|
+
workspaceId: workspaceIdSchema21,
|
|
82928
83652
|
connection: connectionReference,
|
|
82929
83653
|
note: external_exports.string().trim().min(1).max(2e3)
|
|
82930
83654
|
});
|
|
@@ -82935,7 +83659,7 @@ var blockedDefinition = external_exports.object({
|
|
|
82935
83659
|
});
|
|
82936
83660
|
var externalBlockedSchema = blockedDefinition;
|
|
82937
83661
|
var openDirectDefinition = external_exports.object({
|
|
82938
|
-
workspaceId:
|
|
83662
|
+
workspaceId: workspaceIdSchema21,
|
|
82939
83663
|
/** The external person: their roster id (`laze:<id>`) or their name in a shared channel. */
|
|
82940
83664
|
person: external_exports.string().trim().min(1).max(120),
|
|
82941
83665
|
/** Their workspace, as a connection reference; needed only when a name is in two. */
|
|
@@ -82954,14 +83678,14 @@ var directDefinition = external_exports.object({
|
|
|
82954
83678
|
});
|
|
82955
83679
|
var externalDirectSchema = directDefinition;
|
|
82956
83680
|
var ExternalConnectionApi = moduleApi()("external-connection");
|
|
82957
|
-
var externalConnectionTrpc = defineTrpcContract("externalConnection").query("overview").withInput(
|
|
83681
|
+
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
83682
|
|
|
82959
83683
|
// ../../modules/external-connection/contract/src/external-connection.config.ts
|
|
82960
83684
|
var externalConnectionConfig = Config.define(() => ({ publicBaseUrl }));
|
|
82961
83685
|
|
|
82962
83686
|
// ../../modules/external-connection/contract/src/external-connection.rest.ts
|
|
82963
83687
|
var keyed = { workspaceId: true };
|
|
82964
|
-
var
|
|
83688
|
+
var emptyDefinition2 = external_exports.object({});
|
|
82965
83689
|
var rosterDefinition2 = externalRosterInputSchema.omit(keyed);
|
|
82966
83690
|
var inviteDefinition = externalInviteInputSchema.omit(keyed);
|
|
82967
83691
|
var inviteRefDefinition2 = externalInviteRefSchema.omit(keyed);
|
|
@@ -82981,8 +83705,8 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
82981
83705
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
82982
83706
|
|
|
82983
83707
|
// src/services/workspace-commands.service.ts
|
|
82984
|
-
import { readFile as
|
|
82985
|
-
import { resolve as
|
|
83708
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
83709
|
+
import { resolve as resolve11 } from "node:path";
|
|
82986
83710
|
var ROLE_NAMES2 = {
|
|
82987
83711
|
OWNER: "Owner",
|
|
82988
83712
|
ADMIN: "Admin",
|
|
@@ -83164,7 +83888,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
83164
83888
|
async function readLogo({ context, file: file3 }) {
|
|
83165
83889
|
let bytes;
|
|
83166
83890
|
try {
|
|
83167
|
-
bytes = new Uint8Array(await
|
|
83891
|
+
bytes = new Uint8Array(await readFile28(resolve11(context.cwd, file3)));
|
|
83168
83892
|
} catch {
|
|
83169
83893
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
83170
83894
|
}
|
|
@@ -83420,7 +84144,7 @@ var EXTERNAL_USAGE = `Usage:
|
|
|
83420
84144
|
laze external report <workspace> --note "<why>" report a workspace to Laze staff, and block it (admins)`;
|
|
83421
84145
|
var printJson6 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
83422
84146
|
`);
|
|
83423
|
-
function
|
|
84147
|
+
function wordAt5({ args, at, what }) {
|
|
83424
84148
|
const word3 = args.words[at]?.trim();
|
|
83425
84149
|
if (!word3) throw new CliUsageError(`Name ${what}.
|
|
83426
84150
|
${EXTERNAL_USAGE}`);
|
|
@@ -83473,22 +84197,22 @@ function connectionLines(connection) {
|
|
|
83473
84197
|
}
|
|
83474
84198
|
async function list6({ context, args }) {
|
|
83475
84199
|
const { client } = await clientOf2({ context, args });
|
|
83476
|
-
const
|
|
83477
|
-
if (args.flags.json) return printJson6(context,
|
|
84200
|
+
const overview3 = await client.get(EXTERNAL_CONNECTION_REST_PATHS.list);
|
|
84201
|
+
if (args.flags.json) return printJson6(context, overview3);
|
|
83478
84202
|
const lines2 = [
|
|
83479
|
-
...
|
|
83480
|
-
...
|
|
83481
|
-
...
|
|
83482
|
-
...
|
|
84203
|
+
...overview3.connections.length === 0 ? ["No connected workspaces."] : [],
|
|
84204
|
+
...overview3.connections.flatMap(connectionLines),
|
|
84205
|
+
...overview3.invites.length > 0 ? ["Invitations sent:"] : [],
|
|
84206
|
+
...overview3.invites.map(
|
|
83483
84207
|
(invite3) => ` ${invite3.email} ${invite3.state} expires ${utcTimeOf(invite3.expiresAt)} ${invite3.id}`
|
|
83484
84208
|
),
|
|
83485
|
-
...
|
|
84209
|
+
...overview3.blocked.map((each) => `Blocked: ${each.name}`)
|
|
83486
84210
|
];
|
|
83487
84211
|
context.out(`${lines2.join("\n")}
|
|
83488
84212
|
`);
|
|
83489
84213
|
}
|
|
83490
84214
|
async function roster({ context, args }) {
|
|
83491
|
-
const channelId =
|
|
84215
|
+
const channelId = wordAt5({ args, at: 2, what: "the shared channel's id" });
|
|
83492
84216
|
const { client } = await clientOf2({ context, args });
|
|
83493
84217
|
const path = EXTERNAL_CONNECTION_REST_PATHS.roster;
|
|
83494
84218
|
const answer5 = await client.get(
|
|
@@ -83514,7 +84238,7 @@ async function invitations({ context, args }) {
|
|
|
83514
84238
|
}
|
|
83515
84239
|
}
|
|
83516
84240
|
async function invite2({ context, args }) {
|
|
83517
|
-
const email3 =
|
|
84241
|
+
const email3 = wordAt5({ args, at: 2, what: "the address to invite" });
|
|
83518
84242
|
const share3 = flagText({ args, name: "share" })?.trim();
|
|
83519
84243
|
const company = flagText({ args, name: "company" })?.trim();
|
|
83520
84244
|
const { client } = await clientOf2({ context, args });
|
|
@@ -83532,7 +84256,7 @@ async function invite2({ context, args }) {
|
|
|
83532
84256
|
);
|
|
83533
84257
|
}
|
|
83534
84258
|
async function resend({ context, args }) {
|
|
83535
|
-
const inviteId =
|
|
84259
|
+
const inviteId = wordAt5({ args, at: 2, what: "the invitation's id" });
|
|
83536
84260
|
const { client } = await clientOf2({ context, args });
|
|
83537
84261
|
const sent = await client.post(EXTERNAL_CONNECTION_REST_PATHS.resend, {
|
|
83538
84262
|
inviteId
|
|
@@ -83559,7 +84283,7 @@ async function pending({ context, args }) {
|
|
|
83559
84283
|
}
|
|
83560
84284
|
}
|
|
83561
84285
|
async function inviteRef({ context, args, path }) {
|
|
83562
|
-
const inviteId =
|
|
84286
|
+
const inviteId = wordAt5({ args, at: 2, what: "the invitation's id" });
|
|
83563
84287
|
const { client } = await clientOf2({ context, args });
|
|
83564
84288
|
return client.post(path, { inviteId });
|
|
83565
84289
|
}
|
|
@@ -83582,7 +84306,7 @@ async function forward({ context, args }) {
|
|
|
83582
84306
|
`);
|
|
83583
84307
|
}
|
|
83584
84308
|
async function accept({ context, args }) {
|
|
83585
|
-
const inviteId =
|
|
84309
|
+
const inviteId = wordAt5({ args, at: 2, what: "the invitation's id" });
|
|
83586
84310
|
const secret = flagText({ args, name: "secret" })?.trim();
|
|
83587
84311
|
const { client, name: name3 } = await clientOf2({ context, args });
|
|
83588
84312
|
const connection = await client.post(EXTERNAL_CONNECTION_REST_PATHS.accept, {
|
|
@@ -83594,8 +84318,8 @@ async function accept({ context, args }) {
|
|
|
83594
84318
|
context.out(`${own2} is connected to ${connection.peer.name} (${connection.id}).
|
|
83595
84319
|
`);
|
|
83596
84320
|
}
|
|
83597
|
-
async function
|
|
83598
|
-
const connection =
|
|
84321
|
+
async function disconnect2({ context, args }) {
|
|
84322
|
+
const connection = wordAt5({ args, at: 2, what: "the connected workspace" });
|
|
83599
84323
|
const { client } = await clientOf2({ context, args });
|
|
83600
84324
|
const answer5 = await client.post(EXTERNAL_CONNECTION_REST_PATHS.disconnect, {
|
|
83601
84325
|
connection
|
|
@@ -83605,7 +84329,7 @@ async function disconnect({ context, args }) {
|
|
|
83605
84329
|
`);
|
|
83606
84330
|
}
|
|
83607
84331
|
async function settings({ context, args }) {
|
|
83608
|
-
const connection =
|
|
84332
|
+
const connection = wordAt5({ args, at: 2, what: "the connected workspace" });
|
|
83609
84333
|
const agentsAllowed = onOff({ value: flagText({ args, name: "agents" }), flag: "agents" });
|
|
83610
84334
|
const directAllowed = onOff({ value: flagText({ args, name: "dms" }), flag: "dms" });
|
|
83611
84335
|
const { client } = await clientOf2({ context, args });
|
|
@@ -83619,7 +84343,7 @@ async function settings({ context, args }) {
|
|
|
83619
84343
|
`);
|
|
83620
84344
|
}
|
|
83621
84345
|
async function share({ context, args }) {
|
|
83622
|
-
const channel =
|
|
84346
|
+
const channel = wordAt5({ args, at: 2, what: "the channel to share" });
|
|
83623
84347
|
const connection = flagText({ args, name: "with" })?.trim();
|
|
83624
84348
|
if (!connection) throw new CliUsageError(`Name the workspace with --with.
|
|
83625
84349
|
${EXTERNAL_USAGE}`);
|
|
@@ -83635,7 +84359,7 @@ ${EXTERNAL_USAGE}`);
|
|
|
83635
84359
|
);
|
|
83636
84360
|
}
|
|
83637
84361
|
async function acceptShare({ context, args }) {
|
|
83638
|
-
const shareId =
|
|
84362
|
+
const shareId = wordAt5({ args, at: 2, what: "the share's id" });
|
|
83639
84363
|
const name3 = flagText({ args, name: "name" })?.trim();
|
|
83640
84364
|
const { client } = await clientOf2({ context, args });
|
|
83641
84365
|
const answer5 = await client.post(
|
|
@@ -83647,7 +84371,7 @@ async function acceptShare({ context, args }) {
|
|
|
83647
84371
|
`);
|
|
83648
84372
|
}
|
|
83649
84373
|
async function shareRef({ context, args, path }) {
|
|
83650
|
-
const reference =
|
|
84374
|
+
const reference = wordAt5({ args, at: 2, what: "the share or its channel" });
|
|
83651
84375
|
const { client } = await clientOf2({ context, args });
|
|
83652
84376
|
return client.post(path, { share: reference });
|
|
83653
84377
|
}
|
|
@@ -83668,7 +84392,7 @@ async function unshare({ context, args }) {
|
|
|
83668
84392
|
`);
|
|
83669
84393
|
}
|
|
83670
84394
|
async function direct({ context, args }) {
|
|
83671
|
-
const person =
|
|
84395
|
+
const person = wordAt5({ args, at: 2, what: "the person" });
|
|
83672
84396
|
const body = args.words.slice(3).join(" ").trim();
|
|
83673
84397
|
const connection = flagText({ args, name: "connection" })?.trim();
|
|
83674
84398
|
const { client } = await clientOf2({ context, args });
|
|
@@ -83685,7 +84409,7 @@ async function direct({ context, args }) {
|
|
|
83685
84409
|
);
|
|
83686
84410
|
}
|
|
83687
84411
|
async function block({ context, args }) {
|
|
83688
|
-
const connection =
|
|
84412
|
+
const connection = wordAt5({ args, at: 2, what: "the workspace to block" });
|
|
83689
84413
|
const { client } = await clientOf2({ context, args });
|
|
83690
84414
|
const answer5 = await client.post(EXTERNAL_CONNECTION_REST_PATHS.block, {
|
|
83691
84415
|
connection
|
|
@@ -83695,7 +84419,7 @@ async function block({ context, args }) {
|
|
|
83695
84419
|
`);
|
|
83696
84420
|
}
|
|
83697
84421
|
async function report({ context, args }) {
|
|
83698
|
-
const connection =
|
|
84422
|
+
const connection = wordAt5({ args, at: 2, what: "the workspace to report" });
|
|
83699
84423
|
const note = flagText({ args, name: "note" })?.trim();
|
|
83700
84424
|
if (!note) throw new CliUsageError(`Say why with --note.
|
|
83701
84425
|
${EXTERNAL_USAGE}`);
|
|
@@ -83719,7 +84443,7 @@ var EXTERNAL_COMMANDS = {
|
|
|
83719
84443
|
accept,
|
|
83720
84444
|
decline,
|
|
83721
84445
|
forward,
|
|
83722
|
-
disconnect,
|
|
84446
|
+
disconnect: disconnect2,
|
|
83723
84447
|
settings,
|
|
83724
84448
|
share,
|
|
83725
84449
|
"accept-share": acceptShare,
|
|
@@ -83737,8 +84461,8 @@ async function external({ context, args }) {
|
|
|
83737
84461
|
}
|
|
83738
84462
|
|
|
83739
84463
|
// src/services/feed-commands.service.ts
|
|
83740
|
-
import { readFile as
|
|
83741
|
-
import { resolve as
|
|
84464
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
84465
|
+
import { resolve as resolve13 } from "node:path";
|
|
83742
84466
|
|
|
83743
84467
|
// ../../modules/feed/contract/src/feed.ts
|
|
83744
84468
|
var feedAuthorSchemaDefinition = external_exports.object({
|
|
@@ -84487,8 +85211,8 @@ function feedFlagsOf({ args }) {
|
|
|
84487
85211
|
}
|
|
84488
85212
|
|
|
84489
85213
|
// src/services/feed-files.service.ts
|
|
84490
|
-
import { readFile as
|
|
84491
|
-
import { basename as basename4, resolve as
|
|
85214
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
85215
|
+
import { basename as basename4, resolve as resolve12 } from "node:path";
|
|
84492
85216
|
async function bytesOf2({
|
|
84493
85217
|
context,
|
|
84494
85218
|
source
|
|
@@ -84513,12 +85237,12 @@ async function downloaded({ context, url: url2 }) {
|
|
|
84513
85237
|
};
|
|
84514
85238
|
}
|
|
84515
85239
|
async function local({ context, path }) {
|
|
84516
|
-
const full =
|
|
85240
|
+
const full = resolve12(context.cwd, path);
|
|
84517
85241
|
const fileName = basename4(full);
|
|
84518
85242
|
return {
|
|
84519
85243
|
fileName,
|
|
84520
85244
|
contentType: contentTypeOf(fileName),
|
|
84521
|
-
bytes: new Uint8Array(await
|
|
85245
|
+
bytes: new Uint8Array(await readFile29(full))
|
|
84522
85246
|
};
|
|
84523
85247
|
}
|
|
84524
85248
|
async function directWith({ client, to }) {
|
|
@@ -84600,7 +85324,7 @@ async function bodyOf2({
|
|
|
84600
85324
|
flags: flags2
|
|
84601
85325
|
}) {
|
|
84602
85326
|
const body = { ...flags2.fields };
|
|
84603
|
-
const read3 = (source) => "file" in source ?
|
|
85327
|
+
const read3 = (source) => "file" in source ? readFile30(resolve13(context.cwd, source.file), "utf8") : source.text;
|
|
84604
85328
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
|
|
84605
85329
|
if (flags2.rich) {
|
|
84606
85330
|
const text2 = await read3(flags2.rich.source);
|
|
@@ -84621,8 +85345,8 @@ function printItem({
|
|
|
84621
85345
|
`);
|
|
84622
85346
|
const shownAt = item.item.showAt ? ` (shows ${item.item.showAt})` : "";
|
|
84623
85347
|
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}${
|
|
85348
|
+
const shown2 = `${shownAt}${countdown}`;
|
|
85349
|
+
context.out(`${item.item.id} ${item.item.tag} ${item.item.title}${shown2}
|
|
84626
85350
|
`);
|
|
84627
85351
|
for (const message2 of item.messages) context.out(` > ${message2}
|
|
84628
85352
|
`);
|
|
@@ -84795,7 +85519,7 @@ async function textFlag({
|
|
|
84795
85519
|
}) {
|
|
84796
85520
|
const value = flagText({ args, name: name3 });
|
|
84797
85521
|
if (!value.startsWith("@")) return value;
|
|
84798
|
-
return
|
|
85522
|
+
return readFile30(resolve13(context.cwd, value.slice(1)), "utf8");
|
|
84799
85523
|
}
|
|
84800
85524
|
async function feedList({ context, args }) {
|
|
84801
85525
|
const { client } = await signedIn({ context, args });
|
|
@@ -84918,7 +85642,7 @@ async function feed({ context, args }) {
|
|
|
84918
85642
|
}
|
|
84919
85643
|
|
|
84920
85644
|
// src/services/github-commands.service.ts
|
|
84921
|
-
import { readFile as
|
|
85645
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
84922
85646
|
|
|
84923
85647
|
// src/rules/github-signature.rules.ts
|
|
84924
85648
|
var TURN_SEPARATOR = "~";
|
|
@@ -84988,7 +85712,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
84988
85712
|
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
85713
|
async function turnFileToken({ env }) {
|
|
84990
85714
|
if (!env.LAZE_TURN_FILE) return "";
|
|
84991
|
-
return
|
|
85715
|
+
return readFile31(env.LAZE_TURN_FILE, "utf8").then(
|
|
84992
85716
|
(text2) => text2.trim(),
|
|
84993
85717
|
() => ""
|
|
84994
85718
|
);
|
|
@@ -85022,7 +85746,7 @@ async function githubGh({
|
|
|
85022
85746
|
args: args.rest,
|
|
85023
85747
|
agentName: profile.name ?? "An agent",
|
|
85024
85748
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
85025
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
85749
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile31(path, "utf8")
|
|
85026
85750
|
});
|
|
85027
85751
|
return context.runCommand({
|
|
85028
85752
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -85121,7 +85845,7 @@ async function setAgentGithub({
|
|
|
85121
85845
|
}
|
|
85122
85846
|
|
|
85123
85847
|
// src/services/history-commands.service.ts
|
|
85124
|
-
import { readFile as
|
|
85848
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
85125
85849
|
|
|
85126
85850
|
// src/rules/history-format.rules.ts
|
|
85127
85851
|
function timeOf2(iso2) {
|
|
@@ -85200,7 +85924,7 @@ function limitOf3({ args }) {
|
|
|
85200
85924
|
}
|
|
85201
85925
|
return limit;
|
|
85202
85926
|
}
|
|
85203
|
-
function
|
|
85927
|
+
function beforeOf2({ args }) {
|
|
85204
85928
|
const given = flagText({ args, name: "before" }).trim();
|
|
85205
85929
|
if (!given) return {};
|
|
85206
85930
|
const slackTs = SLACK_KEY.exec(given)?.[1];
|
|
@@ -85217,19 +85941,19 @@ async function turnTokenOf4({ context }) {
|
|
|
85217
85941
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
85218
85942
|
if (pinned) return pinned;
|
|
85219
85943
|
if (!env.LAZE_TURN_FILE) return "";
|
|
85220
|
-
return
|
|
85944
|
+
return readFile32(env.LAZE_TURN_FILE, "utf8").then(
|
|
85221
85945
|
(text2) => text2.trim(),
|
|
85222
85946
|
() => ""
|
|
85223
85947
|
);
|
|
85224
85948
|
}
|
|
85225
|
-
async function
|
|
85949
|
+
async function history2({
|
|
85226
85950
|
context,
|
|
85227
85951
|
args
|
|
85228
85952
|
}) {
|
|
85229
85953
|
const channel = args.words[1];
|
|
85230
85954
|
if (!channel) throw new CliUsageError(HISTORY_USAGE);
|
|
85231
85955
|
const limit = limitOf3({ args });
|
|
85232
|
-
const before =
|
|
85956
|
+
const before = beforeOf2({ args });
|
|
85233
85957
|
const { client: signed2 } = await signedIn({ context, args });
|
|
85234
85958
|
const turn = await turnTokenOf4({ context });
|
|
85235
85959
|
const client = turn ? signed2.withHeaders({ "x-laze-turn": turn }) : signed2;
|
|
@@ -85409,7 +86133,7 @@ async function ip({ context, args }) {
|
|
|
85409
86133
|
}
|
|
85410
86134
|
|
|
85411
86135
|
// src/services/join-commands.service.ts
|
|
85412
|
-
import { mkdir as mkdir20, readFile as
|
|
86136
|
+
import { mkdir as mkdir20, readFile as readFile33, rename as rename6, rm as rm11, writeFile as writeFile20 } from "node:fs/promises";
|
|
85413
86137
|
import { dirname as dirname19, join as join23 } from "node:path";
|
|
85414
86138
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
85415
86139
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
@@ -85421,7 +86145,7 @@ async function readPending({
|
|
|
85421
86145
|
url: url2,
|
|
85422
86146
|
args
|
|
85423
86147
|
}) {
|
|
85424
|
-
const pending2 = await
|
|
86148
|
+
const pending2 = await readFile33(pendingPathOf({ context }), "utf8").then(
|
|
85425
86149
|
(text2) => JSON.parse(text2),
|
|
85426
86150
|
() => void 0
|
|
85427
86151
|
);
|
|
@@ -85662,7 +86386,7 @@ var MACHINE_ACCESS_USAGE = [
|
|
|
85662
86386
|
" laze machine grant|revoke <machine> --member <userId> | --agent <agentId> share it or stop (owner)",
|
|
85663
86387
|
" laze machine budget <machine> <usd> [--period day|week|month] its spend cap (owner)"
|
|
85664
86388
|
].join("\n");
|
|
85665
|
-
function
|
|
86389
|
+
function wordAt6({ args, at }) {
|
|
85666
86390
|
const value = args.words[at];
|
|
85667
86391
|
if (!value) throw new CliUsageError(`Usage:
|
|
85668
86392
|
${MACHINE_ACCESS_USAGE}`);
|
|
@@ -85691,7 +86415,7 @@ async function status6({ context, args }) {
|
|
|
85691
86415
|
}
|
|
85692
86416
|
async function get({ context, args }) {
|
|
85693
86417
|
const client = await computeClient({ context, args });
|
|
85694
|
-
const machine2 =
|
|
86418
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
85695
86419
|
printMachine({
|
|
85696
86420
|
context,
|
|
85697
86421
|
args,
|
|
@@ -85699,8 +86423,8 @@ async function get({ context, args }) {
|
|
|
85699
86423
|
});
|
|
85700
86424
|
}
|
|
85701
86425
|
async function rename7({ context, args }) {
|
|
85702
|
-
const machine2 =
|
|
85703
|
-
const name3 =
|
|
86426
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
86427
|
+
const name3 = wordAt6({ args, at: 3 });
|
|
85704
86428
|
const client = await computeClient({ context, args });
|
|
85705
86429
|
const renamed = await client.post(COMPUTE_REST_PATHS.rename, { machine: machine2, name: name3 });
|
|
85706
86430
|
if (args.flags.json) return printMachine({ context, args, machine: renamed });
|
|
@@ -85715,7 +86439,7 @@ ${MACHINE_ACCESS_USAGE}`);
|
|
|
85715
86439
|
return member ? { kind: "member", id: member } : { kind: "agent", id: agent2 };
|
|
85716
86440
|
}
|
|
85717
86441
|
async function share2({ context, args }) {
|
|
85718
|
-
const machine2 =
|
|
86442
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
85719
86443
|
const grantee = granteeOf({ args });
|
|
85720
86444
|
const revoking = args.words[1] === "revoke";
|
|
85721
86445
|
const path = revoking ? COMPUTE_REST_PATHS.revokeGrant : COMPUTE_REST_PATHS.grant;
|
|
@@ -85727,8 +86451,8 @@ async function share2({ context, args }) {
|
|
|
85727
86451
|
`);
|
|
85728
86452
|
}
|
|
85729
86453
|
async function budget({ context, args }) {
|
|
85730
|
-
const machine2 =
|
|
85731
|
-
const budgetUsd = Number(
|
|
86454
|
+
const machine2 = wordAt6({ args, at: 2 });
|
|
86455
|
+
const budgetUsd = Number(wordAt6({ args, at: 3 }));
|
|
85732
86456
|
const named = flagText({ args, name: "period" });
|
|
85733
86457
|
const periods = MACHINE_BUDGET_PERIODS;
|
|
85734
86458
|
if (!(budgetUsd >= 0) || named && !periods.includes(named)) {
|
|
@@ -86054,6 +86778,10 @@ var MCP_SECRET_COMMANDS = {
|
|
|
86054
86778
|
"connect mcp-key": { instead: "connect mcp" },
|
|
86055
86779
|
"connect card-key": { instead: "connect card" },
|
|
86056
86780
|
"openclaw connect": { vaultFlag: "from-vault", secretFlags: ["token"] },
|
|
86781
|
+
"discord save-app": {
|
|
86782
|
+
vaultFlag: "from-vault",
|
|
86783
|
+
secretFlags: ["client-secret", "bot-token", "token", "secret"]
|
|
86784
|
+
},
|
|
86057
86785
|
"whatsapp-business connect": {
|
|
86058
86786
|
vaultFlag: "from-vault",
|
|
86059
86787
|
secretFlags: ["access-token", "app-secret", "token", "secret"]
|
|
@@ -86251,14 +86979,14 @@ async function serveMcp({
|
|
|
86251
86979
|
}
|
|
86252
86980
|
|
|
86253
86981
|
// src/services/mount-files.service.ts
|
|
86254
|
-
import { mkdir as mkdir21, readFile as
|
|
86255
|
-
import { dirname as dirname20, relative as relative5, resolve as
|
|
86982
|
+
import { mkdir as mkdir21, readFile as readFile34, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
|
|
86983
|
+
import { dirname as dirname20, relative as relative5, resolve as resolve14 } from "node:path";
|
|
86256
86984
|
async function textArgument({
|
|
86257
86985
|
context,
|
|
86258
86986
|
value
|
|
86259
86987
|
}) {
|
|
86260
86988
|
if (value === "-") return context.readStdin();
|
|
86261
|
-
if (value.startsWith("@")) return
|
|
86989
|
+
if (value.startsWith("@")) return readFile34(resolve14(context.cwd, value.slice(1)), "utf8");
|
|
86262
86990
|
return value;
|
|
86263
86991
|
}
|
|
86264
86992
|
function turnChannel({ context, args }) {
|
|
@@ -86270,11 +86998,11 @@ async function writeMount({
|
|
|
86270
86998
|
folder,
|
|
86271
86999
|
files: files2
|
|
86272
87000
|
}) {
|
|
86273
|
-
const root =
|
|
87001
|
+
const root = resolve14(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
86274
87002
|
await rm12(root, { recursive: true, force: true });
|
|
86275
87003
|
await mkdir21(root, { recursive: true });
|
|
86276
87004
|
for (const file3 of files2) {
|
|
86277
|
-
const target =
|
|
87005
|
+
const target = resolve14(root, file3.path);
|
|
86278
87006
|
const inside = relative5(root, target);
|
|
86279
87007
|
if (!inside || inside.startsWith(".."))
|
|
86280
87008
|
throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
|
|
@@ -86554,9 +87282,9 @@ function monitorRowOf(monitor) {
|
|
|
86554
87282
|
}
|
|
86555
87283
|
async function monitorAdd({ context, args }) {
|
|
86556
87284
|
const name3 = args.words[2];
|
|
86557
|
-
const
|
|
87285
|
+
const channels3 = flagText({ args, name: "channel" });
|
|
86558
87286
|
const prompt = flagText({ args, name: "prompt" });
|
|
86559
|
-
if (!name3 || !
|
|
87287
|
+
if (!name3 || !channels3 || !prompt) throw new CliUsageError(ADD_USAGE);
|
|
86560
87288
|
const matches = flagText({ args, name: "matches" });
|
|
86561
87289
|
const maxRuns = flagText({ args, name: "max-runs-per-day" });
|
|
86562
87290
|
if (maxRuns && !/^\d+$/.test(maxRuns)) throw new CliUsageError(ADD_USAGE);
|
|
@@ -86564,7 +87292,7 @@ async function monitorAdd({ context, args }) {
|
|
|
86564
87292
|
const added = await client.post("/api/agents/monitors", {
|
|
86565
87293
|
...agentOf(args),
|
|
86566
87294
|
name: name3,
|
|
86567
|
-
channels:
|
|
87295
|
+
channels: channels3,
|
|
86568
87296
|
prompt,
|
|
86569
87297
|
from: flagText({ args, name: "from", fallback: "anyone" }),
|
|
86570
87298
|
bots: flagText({ args, name: "not-from" }) !== "bots",
|
|
@@ -86646,14 +87374,14 @@ ${USAGE13}`);
|
|
|
86646
87374
|
return text2 === "on";
|
|
86647
87375
|
}
|
|
86648
87376
|
function changesOf(args) {
|
|
86649
|
-
const
|
|
86650
|
-
if (
|
|
87377
|
+
const channels3 = flagText({ args, name: "channels" });
|
|
87378
|
+
if (channels3 && !["all", "mentions", "nothing"].includes(channels3))
|
|
86651
87379
|
throw new CliUsageError(`--channels takes all, mentions or nothing.
|
|
86652
87380
|
${USAGE13}`);
|
|
86653
87381
|
const keywords = typeof args.flags.keywords === "string" ? args.flags.keywords : void 0;
|
|
86654
87382
|
const emailAfter = flagText({ args, name: "email-after" });
|
|
86655
87383
|
const changes2 = {
|
|
86656
|
-
channelDefault:
|
|
87384
|
+
channelDefault: channels3 || void 0,
|
|
86657
87385
|
keywords: keywords?.split(",").map((word3) => word3.trim()).filter(Boolean),
|
|
86658
87386
|
dndEnabled: switchOf({ args, name: "dnd" }),
|
|
86659
87387
|
dndStart: flagText({ args, name: "dnd-from" }) || void 0,
|
|
@@ -86705,7 +87433,7 @@ async function notifications({ context, args }) {
|
|
|
86705
87433
|
}
|
|
86706
87434
|
|
|
86707
87435
|
// src/services/openclaw-commands.service.ts
|
|
86708
|
-
import { resolve as
|
|
87436
|
+
import { resolve as resolve15 } from "node:path";
|
|
86709
87437
|
var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who connects it):
|
|
86710
87438
|
laze openclaw list the gateways connected here and their agents
|
|
86711
87439
|
laze openclaw connect <wss url> [--label <label>] (< token | --from-file <file> | --from-vault <connection>)
|
|
@@ -86721,13 +87449,13 @@ var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who
|
|
|
86721
87449
|
as its profile for that folder here, never printed; its previous key stops working
|
|
86722
87450
|
laze openclaw feed <connectionId> on|off temporary Workboard migration bridge, off by default
|
|
86723
87451
|
laze openclaw disconnect <connectionId> remove it, its Laze agents and its credentials`;
|
|
86724
|
-
function
|
|
87452
|
+
function wordAt7(args, index) {
|
|
86725
87453
|
const word3 = args.words[index];
|
|
86726
87454
|
if (!word3) throw new CliUsageError(OPENCLAW_USAGE);
|
|
86727
87455
|
return word3;
|
|
86728
87456
|
}
|
|
86729
87457
|
function switchAt(args, index) {
|
|
86730
|
-
const word3 =
|
|
87458
|
+
const word3 = wordAt7(args, index);
|
|
86731
87459
|
if (word3 !== "on" && word3 !== "off") throw new CliUsageError(OPENCLAW_USAGE);
|
|
86732
87460
|
return word3 === "on";
|
|
86733
87461
|
}
|
|
@@ -86738,7 +87466,7 @@ function scheduleLine(cron) {
|
|
|
86738
87466
|
return ` schedule ${cron.name} ${cron.schedule} ${next} ${last}
|
|
86739
87467
|
`;
|
|
86740
87468
|
}
|
|
86741
|
-
function
|
|
87469
|
+
function printConnection3({
|
|
86742
87470
|
context,
|
|
86743
87471
|
connection
|
|
86744
87472
|
}) {
|
|
@@ -86768,16 +87496,16 @@ function answer3({
|
|
|
86768
87496
|
}) {
|
|
86769
87497
|
if (args.flags.json) return context.out(`${JSON.stringify(connection, null, 2)}
|
|
86770
87498
|
`);
|
|
86771
|
-
|
|
87499
|
+
printConnection3({ context, connection });
|
|
86772
87500
|
}
|
|
86773
87501
|
var list10 = async ({ context, args, client }) => {
|
|
86774
|
-
const
|
|
86775
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
87502
|
+
const overview3 = await client.get(OPENCLAW_KEY_PATHS.overview);
|
|
87503
|
+
if (args.flags.json) return context.out(`${JSON.stringify(overview3, null, 2)}
|
|
86776
87504
|
`);
|
|
86777
|
-
if (
|
|
87505
|
+
if (overview3.connections.length === 0) {
|
|
86778
87506
|
return context.out("No OpenClaw gateways yet. Connect one with laze openclaw connect.\n");
|
|
86779
87507
|
}
|
|
86780
|
-
for (const connection of
|
|
87508
|
+
for (const connection of overview3.connections) printConnection3({ context, connection });
|
|
86781
87509
|
};
|
|
86782
87510
|
async function tokenOf({ context, args }) {
|
|
86783
87511
|
const vaulted = args.flags["from-vault"];
|
|
@@ -86795,8 +87523,8 @@ var connectLocal = async ({ context, args, client, url: url2 }) => {
|
|
|
86795
87523
|
);
|
|
86796
87524
|
let answer5;
|
|
86797
87525
|
if (kept) {
|
|
86798
|
-
const
|
|
86799
|
-
if (
|
|
87526
|
+
const overview3 = await client.get(OPENCLAW_KEY_PATHS.overview);
|
|
87527
|
+
if (overview3.connections.some((connection2) => connection2.id === kept[0])) {
|
|
86800
87528
|
answer5 = await client.post(OPENCLAW_KEY_PATHS.relayKey, {
|
|
86801
87529
|
connectionId: kept[0]
|
|
86802
87530
|
});
|
|
@@ -86816,7 +87544,7 @@ var connectLocal = async ({ context, args, client, url: url2 }) => {
|
|
|
86816
87544
|
const service = await installConnectService({ context });
|
|
86817
87545
|
if (args.flags.json) return context.out(`${JSON.stringify(connection, null, 2)}
|
|
86818
87546
|
`);
|
|
86819
|
-
|
|
87547
|
+
printConnection3({ context, connection });
|
|
86820
87548
|
context.out(
|
|
86821
87549
|
`${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
87550
|
${service}
|
|
@@ -86826,7 +87554,7 @@ ${service}
|
|
|
86826
87554
|
var connect3 = async (input2) => {
|
|
86827
87555
|
if (input2.args.flags.local === true) return connectLocal(input2);
|
|
86828
87556
|
const { context, args, client } = input2;
|
|
86829
|
-
const gatewayUrl2 =
|
|
87557
|
+
const gatewayUrl2 = wordAt7(args, 2);
|
|
86830
87558
|
const label3 = flagText({ args, name: "label" });
|
|
86831
87559
|
const connection = await client.post(OPENCLAW_KEY_PATHS.connect, {
|
|
86832
87560
|
gatewayUrl: gatewayUrl2,
|
|
@@ -86839,8 +87567,8 @@ var agent = async (input2) => {
|
|
|
86839
87567
|
const { context, args, client } = input2;
|
|
86840
87568
|
const enabled = switchAt(args, 4);
|
|
86841
87569
|
const connection = await client.post(OPENCLAW_KEY_PATHS.setAgent, {
|
|
86842
|
-
connectionId:
|
|
86843
|
-
openclawAgentId:
|
|
87570
|
+
connectionId: wordAt7(args, 2),
|
|
87571
|
+
openclawAgentId: wordAt7(args, 3),
|
|
86844
87572
|
enabled
|
|
86845
87573
|
});
|
|
86846
87574
|
answer3({ context, args, connection });
|
|
@@ -86851,12 +87579,12 @@ function profileNameOf(agentName) {
|
|
|
86851
87579
|
}
|
|
86852
87580
|
var agentKey = async ({ context, args, client, url: url2 }) => {
|
|
86853
87581
|
const key = await client.post(OPENCLAW_KEY_PATHS.agentKey, {
|
|
86854
|
-
connectionId:
|
|
86855
|
-
openclawAgentId:
|
|
87582
|
+
connectionId: wordAt7(args, 2),
|
|
87583
|
+
openclawAgentId: wordAt7(args, 3)
|
|
86856
87584
|
});
|
|
86857
87585
|
const login2 = flagText({ args, name: "login" });
|
|
86858
87586
|
if (login2) {
|
|
86859
|
-
const folder =
|
|
87587
|
+
const folder = resolve15(context.cwd, login2);
|
|
86860
87588
|
const profile = profileNameOf(key.agentName);
|
|
86861
87589
|
await signInFolder({ context, url: url2, token: key.token, name: profile, folder });
|
|
86862
87590
|
context.out(
|
|
@@ -86877,31 +87605,31 @@ In the agent's own folder on its machine run:
|
|
|
86877
87605
|
};
|
|
86878
87606
|
var feed2 = async ({ context, args, client }) => {
|
|
86879
87607
|
const connection = await client.post(OPENCLAW_KEY_PATHS.setFeed, {
|
|
86880
|
-
connectionId:
|
|
87608
|
+
connectionId: wordAt7(args, 2),
|
|
86881
87609
|
enabled: switchAt(args, 3)
|
|
86882
87610
|
});
|
|
86883
87611
|
answer3({ context, args, connection });
|
|
86884
87612
|
};
|
|
86885
|
-
var
|
|
86886
|
-
const connectionId =
|
|
87613
|
+
var disconnect3 = async ({ context, args, client }) => {
|
|
87614
|
+
const connectionId = wordAt7(args, 2);
|
|
86887
87615
|
await client.post(OPENCLAW_KEY_PATHS.disconnect, { connectionId });
|
|
86888
87616
|
context.out(`Disconnected ${connectionId}.
|
|
86889
87617
|
`);
|
|
86890
87618
|
};
|
|
86891
|
-
var
|
|
87619
|
+
var RUNS4 = {
|
|
86892
87620
|
list: list10,
|
|
86893
87621
|
connect: connect3,
|
|
86894
87622
|
agent,
|
|
86895
87623
|
"agent-key": agentKey,
|
|
86896
87624
|
feed: feed2,
|
|
86897
|
-
disconnect:
|
|
87625
|
+
disconnect: disconnect3
|
|
86898
87626
|
};
|
|
86899
87627
|
async function openclaw({
|
|
86900
87628
|
context,
|
|
86901
87629
|
args
|
|
86902
87630
|
}) {
|
|
86903
87631
|
const verb = args.words[1] ?? "list";
|
|
86904
|
-
const run4 = Object.hasOwn(
|
|
87632
|
+
const run4 = Object.hasOwn(RUNS4, verb) ? RUNS4[verb] : void 0;
|
|
86905
87633
|
if (!run4) throw new CliUsageError(OPENCLAW_USAGE);
|
|
86906
87634
|
const { client, profile } = await signedIn({ context, args });
|
|
86907
87635
|
await run4({ context, args, client, url: profile.url });
|
|
@@ -86937,7 +87665,7 @@ ${OPS_USAGE}`);
|
|
|
86937
87665
|
}
|
|
86938
87666
|
|
|
86939
87667
|
// src/services/release-watch.service.ts
|
|
86940
|
-
import { mkdir as mkdir22, readFile as
|
|
87668
|
+
import { mkdir as mkdir22, readFile as readFile35, realpath, writeFile as writeFile22 } from "node:fs/promises";
|
|
86941
87669
|
import { dirname as dirname21, join as join24 } from "node:path";
|
|
86942
87670
|
|
|
86943
87671
|
// src/rules/cli-update.rules.ts
|
|
@@ -86994,13 +87722,13 @@ var RELEASE_AGE_SETTINGS = {
|
|
|
86994
87722
|
{ setting: "minimum-release-age", read: ["pnpm", "config", "get", "minimum-release-age"] }
|
|
86995
87723
|
]
|
|
86996
87724
|
};
|
|
86997
|
-
function settingValueOf({ printed }) {
|
|
86998
|
-
const value =
|
|
87725
|
+
function settingValueOf({ printed: printed2 }) {
|
|
87726
|
+
const value = printed2.trim();
|
|
86999
87727
|
return value === "" || value === "null" || value === "undefined" || value === "0" ? null : value;
|
|
87000
87728
|
}
|
|
87001
87729
|
var VERSION_LINE = /^laze (\S+)\s*$/m;
|
|
87002
|
-
function printedVersionOf({ printed }) {
|
|
87003
|
-
return VERSION_LINE.exec(
|
|
87730
|
+
function printedVersionOf({ printed: printed2 }) {
|
|
87731
|
+
return VERSION_LINE.exec(printed2)?.[1] ?? null;
|
|
87004
87732
|
}
|
|
87005
87733
|
function heldBackLineOf({
|
|
87006
87734
|
manager,
|
|
@@ -87086,7 +87814,7 @@ async function startedUpdate({
|
|
|
87086
87814
|
if (plan2.kind !== "install") return null;
|
|
87087
87815
|
const folder = dirname21(context.environment.configPath);
|
|
87088
87816
|
const stamp = join24(folder, "auto-update.json");
|
|
87089
|
-
const last = await
|
|
87817
|
+
const last = await readFile35(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
87090
87818
|
const now = context.nowMs();
|
|
87091
87819
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
87092
87820
|
await mkdir22(folder, { recursive: true, mode: 448 });
|
|
@@ -87130,7 +87858,7 @@ function watchingRelease({
|
|
|
87130
87858
|
}
|
|
87131
87859
|
|
|
87132
87860
|
// src/services/rush-guard.service.ts
|
|
87133
|
-
import { readFile as
|
|
87861
|
+
import { readFile as readFile36, rm as rm13 } from "node:fs/promises";
|
|
87134
87862
|
var WATCH_MS3 = 2e3;
|
|
87135
87863
|
var RETRY_MS2 = 3e4;
|
|
87136
87864
|
async function guardRound(guard) {
|
|
@@ -87173,7 +87901,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
87173
87901
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
|
87174
87902
|
const { client, name: name3 } = await signedIn({ context, args });
|
|
87175
87903
|
const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
87176
|
-
const note = await
|
|
87904
|
+
const note = await readFile36(noted, "utf8").then(
|
|
87177
87905
|
(text2) => JSON.parse(text2),
|
|
87178
87906
|
() => void 0
|
|
87179
87907
|
);
|
|
@@ -87342,8 +88070,8 @@ async function schedule({ context, args }) {
|
|
|
87342
88070
|
}
|
|
87343
88071
|
|
|
87344
88072
|
// src/services/skill-commands.service.ts
|
|
87345
|
-
import { readdir as readdir7, readFile as
|
|
87346
|
-
import { join as join25, relative as relative6, resolve as
|
|
88073
|
+
import { readdir as readdir7, readFile as readFile37 } from "node:fs/promises";
|
|
88074
|
+
import { join as join25, relative as relative6, resolve as resolve16 } from "node:path";
|
|
87347
88075
|
var USAGE15 = `Usage:
|
|
87348
88076
|
laze skill list [--agent <agentId>]
|
|
87349
88077
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -87365,7 +88093,7 @@ async function folderFiles({ root }) {
|
|
|
87365
88093
|
for (const entry of entries) {
|
|
87366
88094
|
if (!entry.isFile()) continue;
|
|
87367
88095
|
const full = join25(entry.parentPath, entry.name);
|
|
87368
|
-
files2.push({ path: relative6(root, full), content: await
|
|
88096
|
+
files2.push({ path: relative6(root, full), content: await readFile37(full, "utf8") });
|
|
87369
88097
|
}
|
|
87370
88098
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
87371
88099
|
}
|
|
@@ -87396,7 +88124,7 @@ async function skillInstall({ context, args }) {
|
|
|
87396
88124
|
if (!catalogueId === !from) throw new CliUsageError(USAGE15);
|
|
87397
88125
|
const name3 = flagText({ args, name: "as" });
|
|
87398
88126
|
const agent2 = flagText({ args, name: "agent" });
|
|
87399
|
-
const files2 = from ? await folderFiles({ root:
|
|
88127
|
+
const files2 = from ? await folderFiles({ root: resolve16(context.cwd, from) }) : void 0;
|
|
87400
88128
|
const { client } = await signedIn({ context, args });
|
|
87401
88129
|
const installed = await client.post("/api/skills/install", {
|
|
87402
88130
|
...catalogueId ? { catalogueId } : {},
|
|
@@ -87463,7 +88191,7 @@ async function skillUpdate({ context, args }) {
|
|
|
87463
88191
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
87464
88192
|
throw new CliUsageError(USAGE15);
|
|
87465
88193
|
}
|
|
87466
|
-
const skillMd = skillMdFile ? await
|
|
88194
|
+
const skillMd = skillMdFile ? await readFile37(resolve16(context.cwd, skillMdFile), "utf8") : void 0;
|
|
87467
88195
|
const { client } = await signedIn({ context, args });
|
|
87468
88196
|
const updated = await client.post("/api/skills/update", {
|
|
87469
88197
|
name: name3,
|
|
@@ -87509,8 +88237,8 @@ async function skill({ context, args }) {
|
|
|
87509
88237
|
}
|
|
87510
88238
|
|
|
87511
88239
|
// src/services/slack-commands.service.ts
|
|
87512
|
-
import { readFile as
|
|
87513
|
-
import { resolve as
|
|
88240
|
+
import { readFile as readFile38 } from "node:fs/promises";
|
|
88241
|
+
import { resolve as resolve17 } from "node:path";
|
|
87514
88242
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
87515
88243
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
87516
88244
|
laze slack link-prompts Slack workspaces you have not linked yet
|
|
@@ -87540,27 +88268,27 @@ var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins
|
|
|
87540
88268
|
laze slack move <teamId> <channelId>... [--name <name>] [--invite <slackUserId>]...
|
|
87541
88269
|
[--farewell <text>] move channels to Laze
|
|
87542
88270
|
laze slack cancel-move <moveId> stop a move that has not switched yet`;
|
|
87543
|
-
var
|
|
87544
|
-
function
|
|
88271
|
+
var SECRET_FLAGS3 = ["token", "config-token", "client-secret", "signing-secret", "value"];
|
|
88272
|
+
function json5({ context, args, data }) {
|
|
87545
88273
|
if (!args.flags.json) return false;
|
|
87546
88274
|
context.out(`${JSON.stringify(data, null, 2)}
|
|
87547
88275
|
`);
|
|
87548
88276
|
return true;
|
|
87549
88277
|
}
|
|
87550
|
-
function
|
|
88278
|
+
function wordAt8(args, index) {
|
|
87551
88279
|
const word3 = args.words[index];
|
|
87552
88280
|
if (!word3) throw new CliUsageError(SLACK_USAGE);
|
|
87553
88281
|
return word3;
|
|
87554
88282
|
}
|
|
87555
88283
|
async function secretLines({ context, args }) {
|
|
87556
|
-
if (
|
|
88284
|
+
if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
87557
88285
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
87558
88286
|
}
|
|
87559
88287
|
const file3 = flagText({ args, name: "from-file" });
|
|
87560
|
-
const text2 = file3 ? await
|
|
88288
|
+
const text2 = file3 ? await readFile38(resolve17(context.cwd, file3), "utf8") : await context.readStdin();
|
|
87561
88289
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
87562
88290
|
}
|
|
87563
|
-
async function
|
|
88291
|
+
async function secretsOf2({
|
|
87564
88292
|
context,
|
|
87565
88293
|
args,
|
|
87566
88294
|
fields
|
|
@@ -87578,32 +88306,32 @@ function printLink2({ context, label: label3, url: url2 }) {
|
|
|
87578
88306
|
${url2}
|
|
87579
88307
|
`);
|
|
87580
88308
|
}
|
|
87581
|
-
function
|
|
88309
|
+
function authorizeRun2(path, label3, body) {
|
|
87582
88310
|
return async ({ context, args, client }) => {
|
|
87583
88311
|
const started = await client.post(path, body(args));
|
|
87584
|
-
if (
|
|
88312
|
+
if (json5({ context, args, data: started })) return;
|
|
87585
88313
|
printLink2({ context, label: label3, url: started.authorizeUrl });
|
|
87586
88314
|
};
|
|
87587
88315
|
}
|
|
87588
|
-
function
|
|
88316
|
+
function printConnection4({ context, row }) {
|
|
87589
88317
|
const link = row.viewerLinkState ?? "not linked";
|
|
87590
88318
|
context.out(
|
|
87591
88319
|
`${row.teamId} ${row.label ?? row.teamName} ${row.status} ${row.mirrors.length} mirrored ${row.linkedPeople} linked you: ${link}
|
|
87592
88320
|
`
|
|
87593
88321
|
);
|
|
87594
88322
|
}
|
|
87595
|
-
function
|
|
88323
|
+
function connectionRun2(path, body) {
|
|
87596
88324
|
return async ({ context, args, client }) => {
|
|
87597
88325
|
const row = await client.post(path, body(args));
|
|
87598
|
-
if (
|
|
87599
|
-
|
|
88326
|
+
if (json5({ context, args, data: row })) return;
|
|
88327
|
+
printConnection4({ context, row });
|
|
87600
88328
|
};
|
|
87601
88329
|
}
|
|
87602
|
-
var
|
|
88330
|
+
var overview2 = async ({ context, args, client }) => {
|
|
87603
88331
|
const view = await client.get(SLACK_KEY_PATHS.overview);
|
|
87604
|
-
if (
|
|
88332
|
+
if (json5({ context, args, data: view })) return;
|
|
87605
88333
|
if (view.connections.length === 0) return context.out("No Slack workspace is connected.\n");
|
|
87606
|
-
for (const row of view.connections)
|
|
88334
|
+
for (const row of view.connections) printConnection4({ context, row });
|
|
87607
88335
|
};
|
|
87608
88336
|
function printPrompts({ context, answer: answer5 }) {
|
|
87609
88337
|
if (answer5.prompts.length === 0) return context.out("Nothing to link.\n");
|
|
@@ -87614,21 +88342,21 @@ function printPrompts({ context, answer: answer5 }) {
|
|
|
87614
88342
|
}
|
|
87615
88343
|
var linkPrompts = async ({ context, args, client }) => {
|
|
87616
88344
|
const answer5 = await client.get(SLACK_KEY_PATHS.linkPrompts);
|
|
87617
|
-
if (
|
|
88345
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87618
88346
|
printPrompts({ context, answer: answer5 });
|
|
87619
88347
|
};
|
|
87620
88348
|
var dismissLinkPrompt = async ({ context, args, client }) => {
|
|
87621
88349
|
const answer5 = await client.post(SLACK_KEY_PATHS.dismissLinkPrompt, {
|
|
87622
|
-
kind:
|
|
88350
|
+
kind: wordAt8(args, 2)
|
|
87623
88351
|
});
|
|
87624
|
-
if (
|
|
88352
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87625
88353
|
printPrompts({ context, answer: answer5 });
|
|
87626
88354
|
};
|
|
87627
88355
|
var people = async ({ context, args, client }) => {
|
|
87628
88356
|
const answer5 = await client.post(SLACK_KEY_PATHS.people, {
|
|
87629
88357
|
query: args.words.slice(2).join(" ")
|
|
87630
88358
|
});
|
|
87631
|
-
if (
|
|
88359
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87632
88360
|
if (answer5.people.length === 0) return context.out("No one found.\n");
|
|
87633
88361
|
for (const person of answer5.people) {
|
|
87634
88362
|
context.out(`${person.teamId} ${person.slackUserId} ${person.name}
|
|
@@ -87639,7 +88367,7 @@ var profiles = async ({ context, args, client }) => {
|
|
|
87639
88367
|
const answer5 = await client.post(SLACK_KEY_PATHS.profiles, {
|
|
87640
88368
|
ids: args.words.slice(2)
|
|
87641
88369
|
});
|
|
87642
|
-
if (
|
|
88370
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87643
88371
|
if (answer5.profiles.length === 0) return context.out("No one found.\n");
|
|
87644
88372
|
for (const each of answer5.profiles) {
|
|
87645
88373
|
const status9 = each.status ? `${each.status.emoji} ${each.status.text}`.trim() : "";
|
|
@@ -87649,25 +88377,25 @@ var profiles = async ({ context, args, client }) => {
|
|
|
87649
88377
|
};
|
|
87650
88378
|
var bookmarks = async ({ context, args, client }) => {
|
|
87651
88379
|
const answer5 = await client.post(SLACK_KEY_PATHS.bookmarks, {
|
|
87652
|
-
channelId:
|
|
88380
|
+
channelId: wordAt8(args, 2)
|
|
87653
88381
|
});
|
|
87654
|
-
if (
|
|
88382
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87655
88383
|
if (answer5.bookmarks.length === 0) return context.out("No bookmarks.\n");
|
|
87656
88384
|
for (const each of answer5.bookmarks) context.out(`${each.title} ${each.link}
|
|
87657
88385
|
`);
|
|
87658
88386
|
};
|
|
87659
88387
|
var dm = async ({ context, args, client }) => {
|
|
87660
88388
|
const opened = await client.post(SLACK_KEY_PATHS.direct, {
|
|
87661
|
-
teamId:
|
|
87662
|
-
slackUserId:
|
|
88389
|
+
teamId: wordAt8(args, 2),
|
|
88390
|
+
slackUserId: wordAt8(args, 3)
|
|
87663
88391
|
});
|
|
87664
|
-
if (
|
|
88392
|
+
if (json5({ context, args, data: opened })) return;
|
|
87665
88393
|
context.out(`${opened.channelId}
|
|
87666
88394
|
`);
|
|
87667
88395
|
};
|
|
87668
|
-
var
|
|
87669
|
-
const secrets = await
|
|
87670
|
-
await
|
|
88396
|
+
var setup3 = async ({ context, args, client }) => {
|
|
88397
|
+
const secrets = await secretsOf2({ context, args, fields: ["configToken"] });
|
|
88398
|
+
await authorizeRun2(
|
|
87671
88399
|
SLACK_KEY_PATHS.setup,
|
|
87672
88400
|
"Open this link to install the Laze app in Slack",
|
|
87673
88401
|
() => secrets
|
|
@@ -87675,7 +88403,7 @@ var setup2 = async ({ context, args, client }) => {
|
|
|
87675
88403
|
};
|
|
87676
88404
|
var beginSetup = async ({ context, args, client }) => {
|
|
87677
88405
|
const started = await client.post(SLACK_KEY_PATHS.beginSetup, {});
|
|
87678
|
-
if (
|
|
88406
|
+
if (json5({ context, args, data: started })) return;
|
|
87679
88407
|
context.out(`App key: ${started.appKey}
|
|
87680
88408
|
`);
|
|
87681
88409
|
if (started.savedAppId)
|
|
@@ -87695,30 +88423,30 @@ var credentials = async ({ context, args, client }) => {
|
|
|
87695
88423
|
const appId = flagText({ args, name: "app-id" });
|
|
87696
88424
|
const clientId = flagText({ args, name: "client-id" });
|
|
87697
88425
|
if (!appId || !clientId) throw new CliUsageError(SLACK_USAGE);
|
|
87698
|
-
const secrets = await
|
|
87699
|
-
const body = { appKey:
|
|
87700
|
-
await
|
|
88426
|
+
const secrets = await secretsOf2({ context, args, fields: ["clientSecret", "signingSecret"] });
|
|
88427
|
+
const body = { appKey: wordAt8(args, 2), appId, clientId, ...secrets };
|
|
88428
|
+
await authorizeRun2(
|
|
87701
88429
|
SLACK_KEY_PATHS.credentials,
|
|
87702
88430
|
"Open this link to install the app",
|
|
87703
88431
|
() => body
|
|
87704
88432
|
)({ context, args, client });
|
|
87705
88433
|
};
|
|
87706
88434
|
var updateApp = async ({ context, args, client }) => {
|
|
87707
|
-
const teamId =
|
|
87708
|
-
const secrets = await
|
|
88435
|
+
const teamId = wordAt8(args, 2);
|
|
88436
|
+
const secrets = await secretsOf2({ context, args, fields: ["configToken"] });
|
|
87709
88437
|
const answer5 = await client.post(SLACK_KEY_PATHS.updateApp, {
|
|
87710
88438
|
teamId,
|
|
87711
88439
|
...secrets
|
|
87712
88440
|
});
|
|
87713
|
-
if (
|
|
88441
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87714
88442
|
context.out(`Updated the Slack app of ${teamId}.
|
|
87715
88443
|
`);
|
|
87716
88444
|
};
|
|
87717
|
-
var
|
|
88445
|
+
var channels2 = async ({ context, args, client }) => {
|
|
87718
88446
|
const rows = await client.post(SLACK_KEY_PATHS.channels, {
|
|
87719
|
-
teamId:
|
|
88447
|
+
teamId: wordAt8(args, 2)
|
|
87720
88448
|
});
|
|
87721
|
-
if (
|
|
88449
|
+
if (json5({ context, args, data: rows })) return;
|
|
87722
88450
|
for (const row of rows) {
|
|
87723
88451
|
const mirrored = row.mirrored ? " mirrored" : "";
|
|
87724
88452
|
context.out(`${row.id} #${row.name} ${row.memberCount} members${mirrored}
|
|
@@ -87726,32 +88454,32 @@ var channels = async ({ context, args, client }) => {
|
|
|
87726
88454
|
}
|
|
87727
88455
|
};
|
|
87728
88456
|
function mirrorBody(args) {
|
|
87729
|
-
const state =
|
|
88457
|
+
const state = wordAt8(args, 4);
|
|
87730
88458
|
if (state !== "on" && state !== "off") throw new CliUsageError(SLACK_USAGE);
|
|
87731
|
-
return { teamId:
|
|
88459
|
+
return { teamId: wordAt8(args, 2), slackChannelId: wordAt8(args, 3), mirrored: state === "on" };
|
|
87732
88460
|
}
|
|
87733
|
-
function
|
|
88461
|
+
function numberFlag3(args, name3) {
|
|
87734
88462
|
const text2 = flagText({ args, name: name3 });
|
|
87735
88463
|
if (!text2) return void 0;
|
|
87736
88464
|
const value = Number(text2);
|
|
87737
88465
|
if (!Number.isInteger(value)) throw new CliUsageError(`--${name3} takes a whole number.`);
|
|
87738
88466
|
return value;
|
|
87739
88467
|
}
|
|
87740
|
-
function
|
|
88468
|
+
function updateBody2(args) {
|
|
87741
88469
|
const label3 = flagText({ args, name: "label" });
|
|
87742
|
-
const cacheDays =
|
|
87743
|
-
const readBudgetPages =
|
|
88470
|
+
const cacheDays = numberFlag3(args, "cache-days");
|
|
88471
|
+
const readBudgetPages = numberFlag3(args, "read-budget");
|
|
87744
88472
|
return {
|
|
87745
|
-
teamId:
|
|
88473
|
+
teamId: wordAt8(args, 2),
|
|
87746
88474
|
...label3 && { label: label3 === "none" ? null : label3 },
|
|
87747
88475
|
...cacheDays !== void 0 && { cacheDays },
|
|
87748
88476
|
...readBudgetPages !== void 0 && { readBudgetPages }
|
|
87749
88477
|
};
|
|
87750
88478
|
}
|
|
87751
|
-
var
|
|
87752
|
-
const teamId =
|
|
88479
|
+
var disconnect4 = async ({ context, args, client }) => {
|
|
88480
|
+
const teamId = wordAt8(args, 2);
|
|
87753
88481
|
const answer5 = await client.post(SLACK_KEY_PATHS.disconnect, { teamId });
|
|
87754
|
-
if (
|
|
88482
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87755
88483
|
context.out(`Disconnected ${teamId}.
|
|
87756
88484
|
`);
|
|
87757
88485
|
};
|
|
@@ -87762,16 +88490,16 @@ function printMove({ context, move: move3 }) {
|
|
|
87762
88490
|
}
|
|
87763
88491
|
var moves = async ({ context, args, client }) => {
|
|
87764
88492
|
const answer5 = await client.get(SLACK_KEY_PATHS.moves);
|
|
87765
|
-
if (
|
|
88493
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87766
88494
|
if (answer5.moves.length === 0) context.out("No moves yet.\n");
|
|
87767
88495
|
for (const move3 of answer5.moves) printMove({ context, move: move3 });
|
|
87768
88496
|
};
|
|
87769
88497
|
var movePreview = async ({ context, args, client }) => {
|
|
87770
88498
|
const preview = await client.post(SLACK_KEY_PATHS.movePreview, {
|
|
87771
|
-
teamId:
|
|
87772
|
-
slackChannelId:
|
|
88499
|
+
teamId: wordAt8(args, 2),
|
|
88500
|
+
slackChannelId: wordAt8(args, 3)
|
|
87773
88501
|
});
|
|
87774
|
-
if (
|
|
88502
|
+
if (json5({ context, args, data: preview })) return;
|
|
87775
88503
|
context.out(`#${preview.slackName} -> #${preview.name} ${preview.linkedMembers} members move
|
|
87776
88504
|
`);
|
|
87777
88505
|
for (const person of preview.leftBehind) {
|
|
@@ -87790,7 +88518,7 @@ function moveBody(args) {
|
|
|
87790
88518
|
const farewell = flagText({ args, name: "farewell" });
|
|
87791
88519
|
const invite3 = args.lists.invite ?? [];
|
|
87792
88520
|
return {
|
|
87793
|
-
teamId:
|
|
88521
|
+
teamId: wordAt8(args, 2),
|
|
87794
88522
|
channels: ids.map((slackChannelId) => ({
|
|
87795
88523
|
slackChannelId,
|
|
87796
88524
|
...name3 && { name: name3 },
|
|
@@ -87801,7 +88529,7 @@ function moveBody(args) {
|
|
|
87801
88529
|
}
|
|
87802
88530
|
var move2 = async ({ context, args, client }) => {
|
|
87803
88531
|
const answer5 = await client.post(SLACK_KEY_PATHS.startMoves, moveBody(args));
|
|
87804
|
-
if (
|
|
88532
|
+
if (json5({ context, args, data: answer5 })) return;
|
|
87805
88533
|
for (const one of answer5.started) {
|
|
87806
88534
|
if (one.move) printMove({ context, move: one.move });
|
|
87807
88535
|
else context.out(`${one.slackChannelId} refused: ${one.refused?.message ?? ""}
|
|
@@ -87810,40 +88538,40 @@ var move2 = async ({ context, args, client }) => {
|
|
|
87810
88538
|
};
|
|
87811
88539
|
var cancelMove = async ({ context, args, client }) => {
|
|
87812
88540
|
const moved = await client.post(SLACK_KEY_PATHS.cancelMove, {
|
|
87813
|
-
moveId:
|
|
88541
|
+
moveId: wordAt8(args, 2)
|
|
87814
88542
|
});
|
|
87815
|
-
if (
|
|
88543
|
+
if (json5({ context, args, data: moved })) return;
|
|
87816
88544
|
printMove({ context, move: moved });
|
|
87817
88545
|
};
|
|
87818
|
-
var teamOf = (args) => ({ teamId:
|
|
87819
|
-
var
|
|
87820
|
-
overview,
|
|
88546
|
+
var teamOf = (args) => ({ teamId: wordAt8(args, 2) });
|
|
88547
|
+
var RUNS5 = {
|
|
88548
|
+
overview: overview2,
|
|
87821
88549
|
"link-prompts": linkPrompts,
|
|
87822
88550
|
"dismiss-link-prompt": dismissLinkPrompt,
|
|
87823
88551
|
people,
|
|
87824
88552
|
profiles,
|
|
87825
88553
|
bookmarks,
|
|
87826
88554
|
dm,
|
|
87827
|
-
link:
|
|
87828
|
-
unlink:
|
|
87829
|
-
install:
|
|
88555
|
+
link: authorizeRun2(SLACK_KEY_PATHS.link, "Open this link to link your Slack account", teamOf),
|
|
88556
|
+
unlink: connectionRun2(SLACK_KEY_PATHS.unlink, teamOf),
|
|
88557
|
+
install: authorizeRun2(
|
|
87830
88558
|
SLACK_KEY_PATHS.install,
|
|
87831
88559
|
"Open this link to install Laze in Slack",
|
|
87832
88560
|
() => ({})
|
|
87833
88561
|
),
|
|
87834
|
-
setup:
|
|
88562
|
+
setup: setup3,
|
|
87835
88563
|
"begin-setup": beginSetup,
|
|
87836
88564
|
credentials,
|
|
87837
|
-
"install-app":
|
|
88565
|
+
"install-app": authorizeRun2(
|
|
87838
88566
|
SLACK_KEY_PATHS.installApp,
|
|
87839
88567
|
"Open this link to install the app",
|
|
87840
|
-
(args) => ({ appKey:
|
|
88568
|
+
(args) => ({ appKey: wordAt8(args, 2) })
|
|
87841
88569
|
),
|
|
87842
88570
|
"update-app": updateApp,
|
|
87843
|
-
channels,
|
|
87844
|
-
mirror:
|
|
87845
|
-
update:
|
|
87846
|
-
disconnect:
|
|
88571
|
+
channels: channels2,
|
|
88572
|
+
mirror: connectionRun2(SLACK_KEY_PATHS.mirror, mirrorBody),
|
|
88573
|
+
update: connectionRun2(SLACK_KEY_PATHS.connection, updateBody2),
|
|
88574
|
+
disconnect: disconnect4,
|
|
87847
88575
|
moves,
|
|
87848
88576
|
"move-preview": movePreview,
|
|
87849
88577
|
move: move2,
|
|
@@ -87854,14 +88582,14 @@ async function slack({
|
|
|
87854
88582
|
args
|
|
87855
88583
|
}) {
|
|
87856
88584
|
const verb = args.words[1] ?? "";
|
|
87857
|
-
const run4 = Object.hasOwn(
|
|
88585
|
+
const run4 = Object.hasOwn(RUNS5, verb) ? RUNS5[verb] : void 0;
|
|
87858
88586
|
if (!run4) throw new CliUsageError(SLACK_USAGE);
|
|
87859
88587
|
const { client } = await signedIn({ context, args });
|
|
87860
88588
|
await run4({ context, args, client });
|
|
87861
88589
|
}
|
|
87862
88590
|
|
|
87863
88591
|
// src/services/sso-commands.service.ts
|
|
87864
|
-
import { readFile as
|
|
88592
|
+
import { readFile as readFile39 } from "node:fs/promises";
|
|
87865
88593
|
var SSO_USAGE = `Usage:
|
|
87866
88594
|
laze sso domains claimed domains and how each signs in (admins)
|
|
87867
88595
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -87948,7 +88676,7 @@ function refuseSecretFlags({ args }) {
|
|
|
87948
88676
|
}
|
|
87949
88677
|
async function clientSecretOf({ context, args }) {
|
|
87950
88678
|
const file3 = flagText({ args, name: "from-file" });
|
|
87951
|
-
const text2 = file3 ? await
|
|
88679
|
+
const text2 = file3 ? await readFile39(file3, "utf8") : await context.readStdin();
|
|
87952
88680
|
const secret = text2.trim();
|
|
87953
88681
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
87954
88682
|
return secret;
|
|
@@ -88132,13 +88860,13 @@ function answer4({
|
|
|
88132
88860
|
context.out(statusLine2({ presence: presence2 }));
|
|
88133
88861
|
}
|
|
88134
88862
|
async function statusSet({ context, args }) {
|
|
88135
|
-
const [, ,
|
|
88136
|
-
if (!
|
|
88863
|
+
const [, , emoji4, ...words] = args.words;
|
|
88864
|
+
if (!emoji4) throw new CliUsageError(USAGE16);
|
|
88137
88865
|
const clearAfter = clearAfterOf({ args });
|
|
88138
88866
|
const timeZone = flagText({ args, name: "tz" }) || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
88139
88867
|
const { client } = await signedIn({ context, args });
|
|
88140
88868
|
const presence2 = await client.post("/api/agents/me/status/set", {
|
|
88141
|
-
emoji:
|
|
88869
|
+
emoji: emoji4,
|
|
88142
88870
|
text: words.join(" "),
|
|
88143
88871
|
clearAfter,
|
|
88144
88872
|
timeZone
|
|
@@ -88189,15 +88917,15 @@ async function printedBy({
|
|
|
88189
88917
|
context,
|
|
88190
88918
|
command
|
|
88191
88919
|
}) {
|
|
88192
|
-
let
|
|
88920
|
+
let printed2 = "";
|
|
88193
88921
|
const sink = {
|
|
88194
88922
|
write: (chunk) => {
|
|
88195
|
-
|
|
88923
|
+
printed2 += chunk;
|
|
88196
88924
|
}
|
|
88197
88925
|
};
|
|
88198
88926
|
try {
|
|
88199
88927
|
const code = await context.runCommand({ command, env: {}, stdout: sink, stderr: sink });
|
|
88200
|
-
return code === 0 ?
|
|
88928
|
+
return code === 0 ? printed2 : null;
|
|
88201
88929
|
} catch {
|
|
88202
88930
|
return null;
|
|
88203
88931
|
}
|
|
@@ -88250,8 +88978,8 @@ async function update2({
|
|
|
88250
88978
|
`);
|
|
88251
88979
|
return code;
|
|
88252
88980
|
}
|
|
88253
|
-
const
|
|
88254
|
-
const installed =
|
|
88981
|
+
const printed2 = await printedBy({ context, command: [...context.program, "--version"] });
|
|
88982
|
+
const installed = printed2 === null ? null : printedVersionOf({ printed: printed2 });
|
|
88255
88983
|
if (!installed) {
|
|
88256
88984
|
context.out("Installed. `laze --version` names the new version.\n");
|
|
88257
88985
|
return 0;
|
|
@@ -88280,8 +89008,8 @@ async function update2({
|
|
|
88280
89008
|
}
|
|
88281
89009
|
|
|
88282
89010
|
// src/services/vault-env-commands.service.ts
|
|
88283
|
-
import { readFile as
|
|
88284
|
-
import { dirname as dirname22, join as join26, resolve as
|
|
89011
|
+
import { readFile as readFile40, stat as stat6 } from "node:fs/promises";
|
|
89012
|
+
import { dirname as dirname22, join as join26, resolve as resolve18 } from "node:path";
|
|
88285
89013
|
|
|
88286
89014
|
// src/rules/vault-manifest.rules.ts
|
|
88287
89015
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -88622,10 +89350,10 @@ async function manifestPathOf({
|
|
|
88622
89350
|
args
|
|
88623
89351
|
}) {
|
|
88624
89352
|
const named = args.words[2];
|
|
88625
|
-
if (named) return
|
|
89353
|
+
if (named) return resolve18(context.cwd, named);
|
|
88626
89354
|
const environment = flagText({ args, name: "env" });
|
|
88627
89355
|
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
88628
|
-
for (let dir =
|
|
89356
|
+
for (let dir = resolve18(context.cwd); ; dir = dirname22(dir)) {
|
|
88629
89357
|
if (await isFile(join26(dir, file3))) return join26(dir, file3);
|
|
88630
89358
|
if (dirname22(dir) === dir) break;
|
|
88631
89359
|
}
|
|
@@ -88637,7 +89365,7 @@ async function manifestOf({
|
|
|
88637
89365
|
args
|
|
88638
89366
|
}) {
|
|
88639
89367
|
const file3 = await manifestPathOf({ context, args });
|
|
88640
|
-
const text2 = await
|
|
89368
|
+
const text2 = await readFile40(file3, "utf8").catch(() => {
|
|
88641
89369
|
throw new CliUsageError(`laze vault: cannot read ${file3}`);
|
|
88642
89370
|
});
|
|
88643
89371
|
return { file: file3, lines: parseManifest({ text: text2, file: file3 }) };
|
|
@@ -88868,8 +89596,8 @@ async function vaultScrub({ context, args }) {
|
|
|
88868
89596
|
}
|
|
88869
89597
|
|
|
88870
89598
|
// src/services/whatsapp-business-commands.service.ts
|
|
88871
|
-
import { readFile as
|
|
88872
|
-
import { resolve as
|
|
89599
|
+
import { readFile as readFile41 } from "node:fs/promises";
|
|
89600
|
+
import { resolve as resolve19 } from "node:path";
|
|
88873
89601
|
|
|
88874
89602
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
88875
89603
|
var whatsappBusinessCategorySchema = external_exports.enum([
|
|
@@ -88916,8 +89644,8 @@ var WHATSAPP_BUSINESS_REST_PATHS = {
|
|
|
88916
89644
|
var WHATSAPP_BUSINESS_TEXT_MAX = 4096;
|
|
88917
89645
|
var WHATSAPP_BUSINESS_LIMIT_MAX = 200;
|
|
88918
89646
|
var WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS = 50;
|
|
88919
|
-
var
|
|
88920
|
-
var
|
|
89647
|
+
var workspaceIdSchema22 = external_exports.string().min(1).max(64);
|
|
89648
|
+
var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema22 });
|
|
88921
89649
|
var digits = (what) => external_exports.string().trim().regex(/^\d{5,30}$/, `${what} is the number Meta shows, digits only`);
|
|
88922
89650
|
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
89651
|
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 +89679,7 @@ var statusDefinition = external_exports.object({
|
|
|
88951
89679
|
});
|
|
88952
89680
|
var whatsappBusinessStatusSchema = statusDefinition;
|
|
88953
89681
|
var connectDefinition = external_exports.object({
|
|
88954
|
-
workspaceId:
|
|
89682
|
+
workspaceId: workspaceIdSchema22,
|
|
88955
89683
|
appId: digits("The app id"),
|
|
88956
89684
|
wabaId: digits("The WhatsApp Business Account id"),
|
|
88957
89685
|
phoneNumberId: digits("The phone number id"),
|
|
@@ -88974,7 +89702,7 @@ var webhookDefinition = external_exports.object({
|
|
|
88974
89702
|
});
|
|
88975
89703
|
var whatsappBusinessWebhookSchema = webhookDefinition;
|
|
88976
89704
|
var settingsDefinition3 = external_exports.object({
|
|
88977
|
-
workspaceId:
|
|
89705
|
+
workspaceId: workspaceIdSchema22,
|
|
88978
89706
|
/** The agent that answers; null for none. Left out keeps the current one. */
|
|
88979
89707
|
agentId: external_exports.string().min(1).max(64).nullable().optional(),
|
|
88980
89708
|
replyMode: whatsappBusinessReplyModeSchema.optional()
|
|
@@ -88994,7 +89722,7 @@ var whatsappBusinessConversationSchema = conversationDefinition;
|
|
|
88994
89722
|
var limitSchema2 = external_exports.number().int().min(1).max(WHATSAPP_BUSINESS_LIMIT_MAX);
|
|
88995
89723
|
var contactRefSchema = external_exports.string().trim().min(1).max(64);
|
|
88996
89724
|
var conversationsInputDefinition = external_exports.object({
|
|
88997
|
-
workspaceId:
|
|
89725
|
+
workspaceId: workspaceIdSchema22,
|
|
88998
89726
|
limit: limitSchema2.optional()
|
|
88999
89727
|
});
|
|
89000
89728
|
var whatsappBusinessConversationsInputSchema = conversationsInputDefinition;
|
|
@@ -89009,7 +89737,7 @@ var whatsappBusinessSendStateSchema = external_exports.enum([
|
|
|
89009
89737
|
"denied",
|
|
89010
89738
|
"expired"
|
|
89011
89739
|
]);
|
|
89012
|
-
var
|
|
89740
|
+
var messageDefinition2 = external_exports.object({
|
|
89013
89741
|
id: external_exports.string(),
|
|
89014
89742
|
at: external_exports.iso.datetime(),
|
|
89015
89743
|
direction: external_exports.enum(["in", "out"]),
|
|
@@ -89020,21 +89748,21 @@ var messageDefinition = external_exports.object({
|
|
|
89020
89748
|
template: external_exports.string().nullable()
|
|
89021
89749
|
});
|
|
89022
89750
|
var readInputDefinition2 = external_exports.object({
|
|
89023
|
-
workspaceId:
|
|
89751
|
+
workspaceId: workspaceIdSchema22,
|
|
89024
89752
|
contact: contactRefSchema,
|
|
89025
89753
|
limit: limitSchema2.optional()
|
|
89026
89754
|
});
|
|
89027
89755
|
var readDefinition = external_exports.object({
|
|
89028
89756
|
conversation: conversationDefinition,
|
|
89029
|
-
messages: external_exports.array(
|
|
89757
|
+
messages: external_exports.array(messageDefinition2)
|
|
89030
89758
|
});
|
|
89031
89759
|
var sendInputDefinition2 = external_exports.object({
|
|
89032
|
-
workspaceId:
|
|
89760
|
+
workspaceId: workspaceIdSchema22,
|
|
89033
89761
|
to: contactRefSchema,
|
|
89034
89762
|
text: external_exports.string().trim().min(1).max(WHATSAPP_BUSINESS_TEXT_MAX)
|
|
89035
89763
|
});
|
|
89036
89764
|
var sendTemplateInputDefinition = external_exports.object({
|
|
89037
|
-
workspaceId:
|
|
89765
|
+
workspaceId: workspaceIdSchema22,
|
|
89038
89766
|
to: contactRefSchema,
|
|
89039
89767
|
template: external_exports.string().trim().min(1).max(512),
|
|
89040
89768
|
/** The template's language code; the only approved one when left out. */
|
|
@@ -89061,7 +89789,7 @@ function whatsappBusinessSendSettled({
|
|
|
89061
89789
|
return state !== "waiting" && state !== "sending";
|
|
89062
89790
|
}
|
|
89063
89791
|
var sendStatusInputDefinition2 = external_exports.object({
|
|
89064
|
-
workspaceId:
|
|
89792
|
+
workspaceId: workspaceIdSchema22,
|
|
89065
89793
|
sendId: external_exports.string().min(1).max(64),
|
|
89066
89794
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
89067
89795
|
});
|
|
@@ -89111,7 +89839,7 @@ var restSendStatusDefinition2 = sendStatusInputDefinition2.omit({ workspaceId: t
|
|
|
89111
89839
|
var restSettingsDefinition = settingsDefinition3.omit({ workspaceId: true });
|
|
89112
89840
|
var restEmptyDefinition = external_exports.object({});
|
|
89113
89841
|
var WhatsappBusinessApi = moduleApi()("whatsapp-business");
|
|
89114
|
-
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(
|
|
89842
|
+
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
89843
|
|
|
89116
89844
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.config.ts
|
|
89117
89845
|
var whatsappBusinessConfig = Config.define((c) => ({
|
|
@@ -89186,16 +89914,16 @@ var WHATSAPP_BUSINESS_USAGE = `Usage (the workspace's WhatsApp Business number o
|
|
|
89186
89914
|
laze whatsapp-business settings [--agent <agentId>|none] [--replies auto|ask]
|
|
89187
89915
|
laze whatsapp-business disconnect delete the secrets and archive the conversations
|
|
89188
89916
|
A contact is a phone number with its country code, a conversation id or a contact id.`;
|
|
89189
|
-
var
|
|
89917
|
+
var SECRET_FLAGS4 = ["access-token", "app-secret", "token", "secret"];
|
|
89190
89918
|
var STATUS_WAIT_SECONDS = 50;
|
|
89191
89919
|
var STATUS_CALLS = 2;
|
|
89192
|
-
function
|
|
89920
|
+
function json6({ context, args, data }) {
|
|
89193
89921
|
if (!args.flags.json) return false;
|
|
89194
89922
|
context.out(`${JSON.stringify(data, null, 2)}
|
|
89195
89923
|
`);
|
|
89196
89924
|
return true;
|
|
89197
89925
|
}
|
|
89198
|
-
function
|
|
89926
|
+
function wordAt9(args, index) {
|
|
89199
89927
|
const word3 = args.words[index];
|
|
89200
89928
|
if (!word3) throw new CliUsageError(WHATSAPP_BUSINESS_USAGE);
|
|
89201
89929
|
return word3;
|
|
@@ -89254,7 +89982,7 @@ function printSend({
|
|
|
89254
89982
|
args,
|
|
89255
89983
|
send: send5
|
|
89256
89984
|
}) {
|
|
89257
|
-
if (
|
|
89985
|
+
if (json6({ context, args, data: send5 }))
|
|
89258
89986
|
return send5.state === "failed" || send5.state === "denied" ? 1 : 0;
|
|
89259
89987
|
context.out(`${send5.outcome}
|
|
89260
89988
|
`);
|
|
@@ -89279,8 +90007,8 @@ async function settle2({ client, send: send5 }) {
|
|
|
89279
90007
|
}
|
|
89280
90008
|
return current2;
|
|
89281
90009
|
}
|
|
89282
|
-
async function
|
|
89283
|
-
if (
|
|
90010
|
+
async function secretsOf3({ context, args }) {
|
|
90011
|
+
if (SECRET_FLAGS4.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
89284
90012
|
throw new CliUsageError(
|
|
89285
90013
|
"A secret never goes in a flag: pipe it on stdin, use --from-file or --from-vault."
|
|
89286
90014
|
);
|
|
@@ -89288,7 +90016,7 @@ async function secretsOf2({ context, args }) {
|
|
|
89288
90016
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
89289
90017
|
if (fromConnection) return { fromConnection };
|
|
89290
90018
|
const file3 = flagText({ args, name: "from-file" });
|
|
89291
|
-
const text2 = file3 ? await
|
|
90019
|
+
const text2 = file3 ? await readFile41(resolve19(context.cwd, file3), "utf8") : await context.readStdin();
|
|
89292
90020
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
89293
90021
|
if (lines2.length !== 2) {
|
|
89294
90022
|
throw new CliUsageError(
|
|
@@ -89304,13 +90032,13 @@ function idFlag(args, name3) {
|
|
|
89304
90032
|
}
|
|
89305
90033
|
var status7 = async ({ context, args, client }) => {
|
|
89306
90034
|
const answer5 = await client.get(WHATSAPP_BUSINESS_REST_PATHS.status);
|
|
89307
|
-
if (!
|
|
90035
|
+
if (!json6({ context, args, data: answer5 })) printStatus2({ context, status: answer5 });
|
|
89308
90036
|
};
|
|
89309
90037
|
var conversations = async ({ context, args, client }) => {
|
|
89310
90038
|
const { limit } = limitOf4(args);
|
|
89311
90039
|
const path = limit ? `${WHATSAPP_BUSINESS_REST_PATHS.conversations}?limit=${limit}` : WHATSAPP_BUSINESS_REST_PATHS.conversations;
|
|
89312
90040
|
const answer5 = await client.get(path);
|
|
89313
|
-
if (
|
|
90041
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89314
90042
|
if (answer5.length === 0) {
|
|
89315
90043
|
context.out("No WhatsApp Business conversations you are in yet.\n");
|
|
89316
90044
|
return;
|
|
@@ -89323,10 +90051,10 @@ var conversations = async ({ context, args, client }) => {
|
|
|
89323
90051
|
};
|
|
89324
90052
|
var read = async ({ context, args, client }) => {
|
|
89325
90053
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.read, {
|
|
89326
|
-
contact:
|
|
90054
|
+
contact: wordAt9(args, 2),
|
|
89327
90055
|
...limitOf4(args)
|
|
89328
90056
|
});
|
|
89329
|
-
if (
|
|
90057
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89330
90058
|
const { conversation } = answer5;
|
|
89331
90059
|
context.out(`${conversation.name} (${conversation.phone}), ${conversation.market}
|
|
89332
90060
|
`);
|
|
@@ -89344,7 +90072,7 @@ var send3 = async ({ context, args, client }) => {
|
|
|
89344
90072
|
const text2 = args.words.slice(3).join(" ") || args.rest.join(" ");
|
|
89345
90073
|
if (!text2) throw new CliUsageError(WHATSAPP_BUSINESS_USAGE);
|
|
89346
90074
|
const asked = await client.post(WHATSAPP_BUSINESS_REST_PATHS.send, {
|
|
89347
|
-
to:
|
|
90075
|
+
to: wordAt9(args, 2),
|
|
89348
90076
|
text: text2
|
|
89349
90077
|
});
|
|
89350
90078
|
if (!whatsappBusinessSendSettled(asked) && !args.flags.json) context.err(`${asked.outcome}
|
|
@@ -89354,14 +90082,14 @@ var send3 = async ({ context, args, client }) => {
|
|
|
89354
90082
|
var sendTemplate = async ({ context, args, client }) => {
|
|
89355
90083
|
const language = flagText({ args, name: "language" });
|
|
89356
90084
|
const asked = await client.post(WHATSAPP_BUSINESS_REST_PATHS.sendTemplate, {
|
|
89357
|
-
to:
|
|
89358
|
-
template:
|
|
90085
|
+
to: wordAt9(args, 2),
|
|
90086
|
+
template: wordAt9(args, 3),
|
|
89359
90087
|
...language ? { language } : {},
|
|
89360
90088
|
params: flagValues(args, "param"),
|
|
89361
90089
|
confirm: args.flags.yes === true
|
|
89362
90090
|
});
|
|
89363
90091
|
if (asked.state === "quoted") {
|
|
89364
|
-
if (
|
|
90092
|
+
if (json6({ context, args, data: asked })) return 0;
|
|
89365
90093
|
context.out(`${asked.outcome}
|
|
89366
90094
|
Run it again with --yes to send it.
|
|
89367
90095
|
`);
|
|
@@ -89373,7 +90101,7 @@ Run it again with --yes to send it.
|
|
|
89373
90101
|
};
|
|
89374
90102
|
var sendStatus = async ({ context, args, client }) => {
|
|
89375
90103
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.sendStatus, {
|
|
89376
|
-
sendId:
|
|
90104
|
+
sendId: wordAt9(args, 2)
|
|
89377
90105
|
});
|
|
89378
90106
|
return printSend({ context, args, send: answer5 });
|
|
89379
90107
|
};
|
|
@@ -89381,7 +90109,7 @@ var templates = async ({ context, args, client }) => {
|
|
|
89381
90109
|
const answer5 = await client.get(
|
|
89382
90110
|
WHATSAPP_BUSINESS_REST_PATHS.templates
|
|
89383
90111
|
);
|
|
89384
|
-
if (
|
|
90112
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89385
90113
|
if (answer5.length === 0) {
|
|
89386
90114
|
context.out("The account has no message templates yet.\n");
|
|
89387
90115
|
return;
|
|
@@ -89397,7 +90125,7 @@ var prices = async ({ context, args, client }) => {
|
|
|
89397
90125
|
const country = flagText({ args, name: "country" });
|
|
89398
90126
|
const path = country ? `${WHATSAPP_BUSINESS_REST_PATHS.prices}?country=${encodeURIComponent(country)}` : WHATSAPP_BUSINESS_REST_PATHS.prices;
|
|
89399
90127
|
const answer5 = await client.get(path);
|
|
89400
|
-
if (
|
|
90128
|
+
if (json6({ context, args, data: answer5 })) return;
|
|
89401
90129
|
if (answer5.prices.length === 0) {
|
|
89402
90130
|
context.out(`No market matches "${country ?? ""}".
|
|
89403
90131
|
`);
|
|
@@ -89425,13 +90153,13 @@ var connect5 = async ({ context, args, client }) => {
|
|
|
89425
90153
|
appId: idFlag(args, "app-id"),
|
|
89426
90154
|
wabaId: idFlag(args, "waba-id"),
|
|
89427
90155
|
phoneNumberId: idFlag(args, "phone-number-id"),
|
|
89428
|
-
...await
|
|
90156
|
+
...await secretsOf3({ context, args })
|
|
89429
90157
|
});
|
|
89430
|
-
if (!
|
|
90158
|
+
if (!json6({ context, args, data: webhook })) printWebhook({ context, webhook });
|
|
89431
90159
|
};
|
|
89432
90160
|
var check2 = async ({ context, args, client }) => {
|
|
89433
90161
|
const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.check, {});
|
|
89434
|
-
if (!
|
|
90162
|
+
if (!json6({ context, args, data: answer5 })) printStatus2({ context, status: answer5 });
|
|
89435
90163
|
return answer5.state === "connected" ? 0 : 1;
|
|
89436
90164
|
};
|
|
89437
90165
|
var verifyToken = async ({ context, args, client }) => {
|
|
@@ -89439,7 +90167,7 @@ var verifyToken = async ({ context, args, client }) => {
|
|
|
89439
90167
|
WHATSAPP_BUSINESS_REST_PATHS.verifyToken,
|
|
89440
90168
|
{}
|
|
89441
90169
|
);
|
|
89442
|
-
if (!
|
|
90170
|
+
if (!json6({ context, args, data: webhook })) printWebhook({ context, webhook });
|
|
89443
90171
|
};
|
|
89444
90172
|
var settings2 = async ({ context, args, client }) => {
|
|
89445
90173
|
const agent2 = flagText({ args, name: "agent" });
|
|
@@ -89451,18 +90179,18 @@ var settings2 = async ({ context, args, client }) => {
|
|
|
89451
90179
|
...agent2 ? { agentId: agent2 === "none" ? null : agent2 } : {},
|
|
89452
90180
|
...replies ? { replyMode: replies } : {}
|
|
89453
90181
|
});
|
|
89454
|
-
if (!
|
|
90182
|
+
if (!json6({ context, args, data: answer5 })) printStatus2({ context, status: answer5 });
|
|
89455
90183
|
};
|
|
89456
|
-
var
|
|
90184
|
+
var disconnect5 = async ({ context, args, client }) => {
|
|
89457
90185
|
const answer5 = await client.post(
|
|
89458
90186
|
WHATSAPP_BUSINESS_REST_PATHS.disconnect,
|
|
89459
90187
|
{}
|
|
89460
90188
|
);
|
|
89461
|
-
if (!
|
|
90189
|
+
if (!json6({ context, args, data: answer5 })) {
|
|
89462
90190
|
context.out("Disconnected. The secrets are deleted and the conversations are archived.\n");
|
|
89463
90191
|
}
|
|
89464
90192
|
};
|
|
89465
|
-
var
|
|
90193
|
+
var RUNS6 = {
|
|
89466
90194
|
status: status7,
|
|
89467
90195
|
conversations,
|
|
89468
90196
|
read,
|
|
@@ -89475,14 +90203,14 @@ var RUNS5 = {
|
|
|
89475
90203
|
check: check2,
|
|
89476
90204
|
"verify-token": verifyToken,
|
|
89477
90205
|
settings: settings2,
|
|
89478
|
-
disconnect:
|
|
90206
|
+
disconnect: disconnect5
|
|
89479
90207
|
};
|
|
89480
90208
|
async function whatsappBusiness({
|
|
89481
90209
|
context,
|
|
89482
90210
|
args
|
|
89483
90211
|
}) {
|
|
89484
90212
|
const verb = args.words[1] ?? "";
|
|
89485
|
-
const run4 = Object.hasOwn(
|
|
90213
|
+
const run4 = Object.hasOwn(RUNS6, verb) ? RUNS6[verb] : void 0;
|
|
89486
90214
|
if (!run4) throw new CliUsageError(WHATSAPP_BUSINESS_USAGE);
|
|
89487
90215
|
const client = await computeClient({ context, args });
|
|
89488
90216
|
return run4({ context, args, client });
|
|
@@ -89490,14 +90218,14 @@ async function whatsappBusiness({
|
|
|
89490
90218
|
|
|
89491
90219
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
89492
90220
|
import { writeFile as writeFile23 } from "node:fs/promises";
|
|
89493
|
-
import { resolve as
|
|
90221
|
+
import { resolve as resolve20 } from "node:path";
|
|
89494
90222
|
var WHATSAPP_PAIRING_USAGE = [
|
|
89495
90223
|
" laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
|
|
89496
90224
|
" laze whatsapp pairing <pairing-id> [--qr <file.svg>] where the linking stands, with a fresh code",
|
|
89497
90225
|
" laze whatsapp cancel <pairing-id> stop the linking",
|
|
89498
90226
|
" laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)"
|
|
89499
90227
|
].join("\n");
|
|
89500
|
-
function
|
|
90228
|
+
function wordAt10({ args, at }) {
|
|
89501
90229
|
const value = args.words[at];
|
|
89502
90230
|
if (!value) throw new CliUsageError(`Usage:
|
|
89503
90231
|
${WHATSAPP_PAIRING_USAGE}`);
|
|
@@ -89509,7 +90237,7 @@ function svgOf(dataUrl) {
|
|
|
89509
90237
|
return decodeURIComponent(body);
|
|
89510
90238
|
}
|
|
89511
90239
|
async function report2({ context, args, pairing: pairing2 }) {
|
|
89512
|
-
const qrFile = pairing2.qrSvg ?
|
|
90240
|
+
const qrFile = pairing2.qrSvg ? resolve20(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
|
|
89513
90241
|
if (qrFile && pairing2.qrSvg) await writeFile23(qrFile, svgOf(pairing2.qrSvg), "utf8");
|
|
89514
90242
|
if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
|
|
89515
90243
|
`);
|
|
@@ -89527,13 +90255,13 @@ async function report2({ context, args, pairing: pairing2 }) {
|
|
|
89527
90255
|
`);
|
|
89528
90256
|
}
|
|
89529
90257
|
async function pair({ context, args }) {
|
|
89530
|
-
const machine2 =
|
|
90258
|
+
const machine2 = wordAt10({ args, at: 2 });
|
|
89531
90259
|
const client = await computeClient({ context, args });
|
|
89532
90260
|
const pairing2 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pair, { machine: machine2 });
|
|
89533
90261
|
await report2({ context, args, pairing: pairing2 });
|
|
89534
90262
|
}
|
|
89535
90263
|
async function pairing({ context, args }) {
|
|
89536
|
-
const pairingId =
|
|
90264
|
+
const pairingId = wordAt10({ args, at: 2 });
|
|
89537
90265
|
const client = await computeClient({ context, args });
|
|
89538
90266
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pairing, {
|
|
89539
90267
|
pairingId
|
|
@@ -89541,7 +90269,7 @@ async function pairing({ context, args }) {
|
|
|
89541
90269
|
await report2({ context, args, pairing: answer5 });
|
|
89542
90270
|
}
|
|
89543
90271
|
async function cancel2({ context, args }) {
|
|
89544
|
-
const pairingId =
|
|
90272
|
+
const pairingId = wordAt10({ args, at: 2 });
|
|
89545
90273
|
const client = await computeClient({ context, args });
|
|
89546
90274
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
|
|
89547
90275
|
pairingId
|
|
@@ -89552,7 +90280,7 @@ async function cancel2({ context, args }) {
|
|
|
89552
90280
|
`);
|
|
89553
90281
|
}
|
|
89554
90282
|
async function unpair({ context, args }) {
|
|
89555
|
-
const machine2 =
|
|
90283
|
+
const machine2 = wordAt10({ args, at: 2 });
|
|
89556
90284
|
const client = await computeClient({ context, args });
|
|
89557
90285
|
const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.unpair, { machine: machine2 });
|
|
89558
90286
|
if (args.flags.json) return context.out(`${JSON.stringify(answer5, null, 2)}
|
|
@@ -89942,6 +90670,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
89942
90670
|
laze dm <person>... open a direct message with people (an agent may name one agent), then laze post to it
|
|
89943
90671
|
laze activity [--mentions|--threads|--reactions] [--limit <n>] your mentions, replies and reactions
|
|
89944
90672
|
laze activity read mark your Activity read (people; agents use laze inbox)
|
|
90673
|
+
laze emoji list | add <name> <file> [--alias <a,b>] | alias <alias> <name> | remove <name> the workspace's custom emoji
|
|
89945
90674
|
laze status set <emoji> [text] [--for 30m|1h|4h|today|week|never] your status next to your name (people)
|
|
89946
90675
|
laze status clear | away | active clear it, or set yourself away by hand until active
|
|
89947
90676
|
laze conversation new <agent> <text|-> start a conversation with an agent; it names it
|
|
@@ -90043,6 +90772,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
90043
90772
|
laze connect list the connections this turn can use (agents)
|
|
90044
90773
|
laze slack overview|link-prompts|link|unlink|channels|mirror|update|moves|move ... Slack as yourself
|
|
90045
90774
|
admins set Slack up too: install|setup|begin-setup|credentials|install-app|update-app|disconnect
|
|
90775
|
+
laze discord overview|link|unlink|channels|pick|history ... Discord as yourself
|
|
90776
|
+
admins set Discord up too: setup|save-app|install|update|disconnect
|
|
90046
90777
|
laze connect providers|start|search|mcp|mcp-key|github|card|card-key connect services as yourself
|
|
90047
90778
|
laze connect install|status|stop|uninstall the service that hands linked Codex sessions their messages
|
|
90048
90779
|
laze openclaw list|connect|agent|agent-key|feed|disconnect your OpenClaw gateways and their agents
|
|
@@ -90157,6 +90888,7 @@ var COMMANDS3 = {
|
|
|
90157
90888
|
"status active": statusAway,
|
|
90158
90889
|
status: statusUsage,
|
|
90159
90890
|
dnd,
|
|
90891
|
+
emoji: emoji3,
|
|
90160
90892
|
"conversation new": conversationNew,
|
|
90161
90893
|
"conversation list": conversationList,
|
|
90162
90894
|
"conversation rename": conversationRename,
|
|
@@ -90171,7 +90903,7 @@ var COMMANDS3 = {
|
|
|
90171
90903
|
reply,
|
|
90172
90904
|
inbox,
|
|
90173
90905
|
search,
|
|
90174
|
-
history,
|
|
90906
|
+
history: history2,
|
|
90175
90907
|
"agents list": listAgents,
|
|
90176
90908
|
"agents show": showAgent,
|
|
90177
90909
|
"agents status": listAgents,
|
|
@@ -90200,6 +90932,7 @@ var COMMANDS3 = {
|
|
|
90200
90932
|
"vault save-from-message": vaultSaveFromMessage,
|
|
90201
90933
|
connect,
|
|
90202
90934
|
slack,
|
|
90935
|
+
discord,
|
|
90203
90936
|
"connect providers": connectAsPerson,
|
|
90204
90937
|
"connect start": connectAsPerson,
|
|
90205
90938
|
"connect search": connectAsPerson,
|
|
@@ -90309,6 +91042,8 @@ async function runCli({
|
|
|
90309
91042
|
[ops, `${OPS_USAGE}
|
|
90310
91043
|
`],
|
|
90311
91044
|
[slack, `${SLACK_USAGE}
|
|
91045
|
+
`],
|
|
91046
|
+
[discord, `${DISCORD_USAGE}
|
|
90312
91047
|
`],
|
|
90313
91048
|
[whatsappBusiness, `${WHATSAPP_BUSINESS_USAGE}
|
|
90314
91049
|
`],
|
|
@@ -90316,6 +91051,8 @@ async function runCli({
|
|
|
90316
91051
|
[connectService, CONNECT_SERVICE_USAGE],
|
|
90317
91052
|
[openclaw, OPENCLAW_USAGE],
|
|
90318
91053
|
[chatActions, CHAT_ACTIONS_USAGE],
|
|
91054
|
+
[emoji3, `${EMOJI_USAGE}
|
|
91055
|
+
`],
|
|
90319
91056
|
[agentLogins, LOGINS_HELP],
|
|
90320
91057
|
[agentPools, POOLS_HELP],
|
|
90321
91058
|
[browser, `${BROWSER_USAGE}
|
|
@@ -90347,7 +91084,7 @@ async function runCli({
|
|
|
90347
91084
|
// src/services/processes.service.ts
|
|
90348
91085
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
90349
91086
|
import { mkdirSync, openSync } from "node:fs";
|
|
90350
|
-
import { readFile as
|
|
91087
|
+
import { readFile as readFile42, readlink } from "node:fs/promises";
|
|
90351
91088
|
import { dirname as dirname23 } from "node:path";
|
|
90352
91089
|
import { promisify as promisify2 } from "node:util";
|
|
90353
91090
|
var run3 = promisify2(execFile2);
|
|
@@ -90361,14 +91098,14 @@ function alive(pid) {
|
|
|
90361
91098
|
}
|
|
90362
91099
|
}
|
|
90363
91100
|
async function argsOf(pid) {
|
|
90364
|
-
const raw = await
|
|
91101
|
+
const raw = await readFile42(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
90365
91102
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
90366
91103
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
90367
91104
|
const line = listed?.stdout.trim();
|
|
90368
91105
|
return line ? line.split(/\s+/) : void 0;
|
|
90369
91106
|
}
|
|
90370
91107
|
async function parentOf(pid) {
|
|
90371
|
-
const stat7 = await
|
|
91108
|
+
const stat7 = await readFile42(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
90372
91109
|
const fromStat = stat7 ? Number(stat7.slice(stat7.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
90373
91110
|
if (fromStat > 0) return fromStat;
|
|
90374
91111
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -90481,15 +91218,15 @@ function terminalAsk() {
|
|
|
90481
91218
|
};
|
|
90482
91219
|
}
|
|
90483
91220
|
function sleep(ms, signal) {
|
|
90484
|
-
return new Promise((
|
|
90485
|
-
if (signal?.aborted) return
|
|
91221
|
+
return new Promise((resolve21) => {
|
|
91222
|
+
if (signal?.aborted) return resolve21();
|
|
90486
91223
|
const stop3 = () => {
|
|
90487
91224
|
clearTimeout(timer);
|
|
90488
|
-
|
|
91225
|
+
resolve21();
|
|
90489
91226
|
};
|
|
90490
91227
|
const timer = setTimeout(() => {
|
|
90491
91228
|
signal?.removeEventListener("abort", stop3);
|
|
90492
|
-
|
|
91229
|
+
resolve21();
|
|
90493
91230
|
}, ms);
|
|
90494
91231
|
signal?.addEventListener("abort", stop3, { once: true });
|
|
90495
91232
|
});
|