@base44-preview/cli 0.0.36-pr.353.a7eb989 → 0.0.36-pr.353.bc8cb09
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/cli/index.js +836 -788
- package/dist/cli/index.js.map +15 -15
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -166165,168 +166165,6 @@ var require_nedb = __commonJS((exports, module) => {
|
|
|
166165
166165
|
module.exports = Datastore;
|
|
166166
166166
|
});
|
|
166167
166167
|
|
|
166168
|
-
// node_modules/lodash/isObject.js
|
|
166169
|
-
var require_isObject = __commonJS((exports, module) => {
|
|
166170
|
-
function isObject5(value) {
|
|
166171
|
-
var type = typeof value;
|
|
166172
|
-
return value != null && (type == "object" || type == "function");
|
|
166173
|
-
}
|
|
166174
|
-
module.exports = isObject5;
|
|
166175
|
-
});
|
|
166176
|
-
|
|
166177
|
-
// node_modules/lodash/now.js
|
|
166178
|
-
var require_now = __commonJS((exports, module) => {
|
|
166179
|
-
var root2 = require__root();
|
|
166180
|
-
var now = function() {
|
|
166181
|
-
return root2.Date.now();
|
|
166182
|
-
};
|
|
166183
|
-
module.exports = now;
|
|
166184
|
-
});
|
|
166185
|
-
|
|
166186
|
-
// node_modules/lodash/_trimmedEndIndex.js
|
|
166187
|
-
var require__trimmedEndIndex = __commonJS((exports, module) => {
|
|
166188
|
-
var reWhitespace = /\s/;
|
|
166189
|
-
function trimmedEndIndex(string4) {
|
|
166190
|
-
var index = string4.length;
|
|
166191
|
-
while (index-- && reWhitespace.test(string4.charAt(index))) {}
|
|
166192
|
-
return index;
|
|
166193
|
-
}
|
|
166194
|
-
module.exports = trimmedEndIndex;
|
|
166195
|
-
});
|
|
166196
|
-
|
|
166197
|
-
// node_modules/lodash/_baseTrim.js
|
|
166198
|
-
var require__baseTrim = __commonJS((exports, module) => {
|
|
166199
|
-
var trimmedEndIndex = require__trimmedEndIndex();
|
|
166200
|
-
var reTrimStart = /^\s+/;
|
|
166201
|
-
function baseTrim(string4) {
|
|
166202
|
-
return string4 ? string4.slice(0, trimmedEndIndex(string4) + 1).replace(reTrimStart, "") : string4;
|
|
166203
|
-
}
|
|
166204
|
-
module.exports = baseTrim;
|
|
166205
|
-
});
|
|
166206
|
-
|
|
166207
|
-
// node_modules/lodash/toNumber.js
|
|
166208
|
-
var require_toNumber = __commonJS((exports, module) => {
|
|
166209
|
-
var baseTrim = require__baseTrim();
|
|
166210
|
-
var isObject5 = require_isObject();
|
|
166211
|
-
var isSymbol = require_isSymbol();
|
|
166212
|
-
var NAN = 0 / 0;
|
|
166213
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
166214
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
166215
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
166216
|
-
var freeParseInt = parseInt;
|
|
166217
|
-
function toNumber(value) {
|
|
166218
|
-
if (typeof value == "number") {
|
|
166219
|
-
return value;
|
|
166220
|
-
}
|
|
166221
|
-
if (isSymbol(value)) {
|
|
166222
|
-
return NAN;
|
|
166223
|
-
}
|
|
166224
|
-
if (isObject5(value)) {
|
|
166225
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
166226
|
-
value = isObject5(other) ? other + "" : other;
|
|
166227
|
-
}
|
|
166228
|
-
if (typeof value != "string") {
|
|
166229
|
-
return value === 0 ? value : +value;
|
|
166230
|
-
}
|
|
166231
|
-
value = baseTrim(value);
|
|
166232
|
-
var isBinary = reIsBinary.test(value);
|
|
166233
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
166234
|
-
}
|
|
166235
|
-
module.exports = toNumber;
|
|
166236
|
-
});
|
|
166237
|
-
|
|
166238
|
-
// node_modules/lodash/debounce.js
|
|
166239
|
-
var require_debounce = __commonJS((exports, module) => {
|
|
166240
|
-
var isObject5 = require_isObject();
|
|
166241
|
-
var now = require_now();
|
|
166242
|
-
var toNumber = require_toNumber();
|
|
166243
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
166244
|
-
var nativeMax = Math.max;
|
|
166245
|
-
var nativeMin = Math.min;
|
|
166246
|
-
function debounce(func, wait, options8) {
|
|
166247
|
-
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
166248
|
-
if (typeof func != "function") {
|
|
166249
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
166250
|
-
}
|
|
166251
|
-
wait = toNumber(wait) || 0;
|
|
166252
|
-
if (isObject5(options8)) {
|
|
166253
|
-
leading = !!options8.leading;
|
|
166254
|
-
maxing = "maxWait" in options8;
|
|
166255
|
-
maxWait = maxing ? nativeMax(toNumber(options8.maxWait) || 0, wait) : maxWait;
|
|
166256
|
-
trailing = "trailing" in options8 ? !!options8.trailing : trailing;
|
|
166257
|
-
}
|
|
166258
|
-
function invokeFunc(time3) {
|
|
166259
|
-
var args = lastArgs, thisArg = lastThis;
|
|
166260
|
-
lastArgs = lastThis = undefined;
|
|
166261
|
-
lastInvokeTime = time3;
|
|
166262
|
-
result = func.apply(thisArg, args);
|
|
166263
|
-
return result;
|
|
166264
|
-
}
|
|
166265
|
-
function leadingEdge(time3) {
|
|
166266
|
-
lastInvokeTime = time3;
|
|
166267
|
-
timerId = setTimeout(timerExpired, wait);
|
|
166268
|
-
return leading ? invokeFunc(time3) : result;
|
|
166269
|
-
}
|
|
166270
|
-
function remainingWait(time3) {
|
|
166271
|
-
var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
166272
|
-
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
166273
|
-
}
|
|
166274
|
-
function shouldInvoke(time3) {
|
|
166275
|
-
var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime;
|
|
166276
|
-
return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
166277
|
-
}
|
|
166278
|
-
function timerExpired() {
|
|
166279
|
-
var time3 = now();
|
|
166280
|
-
if (shouldInvoke(time3)) {
|
|
166281
|
-
return trailingEdge(time3);
|
|
166282
|
-
}
|
|
166283
|
-
timerId = setTimeout(timerExpired, remainingWait(time3));
|
|
166284
|
-
}
|
|
166285
|
-
function trailingEdge(time3) {
|
|
166286
|
-
timerId = undefined;
|
|
166287
|
-
if (trailing && lastArgs) {
|
|
166288
|
-
return invokeFunc(time3);
|
|
166289
|
-
}
|
|
166290
|
-
lastArgs = lastThis = undefined;
|
|
166291
|
-
return result;
|
|
166292
|
-
}
|
|
166293
|
-
function cancel() {
|
|
166294
|
-
if (timerId !== undefined) {
|
|
166295
|
-
clearTimeout(timerId);
|
|
166296
|
-
}
|
|
166297
|
-
lastInvokeTime = 0;
|
|
166298
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
166299
|
-
}
|
|
166300
|
-
function flush() {
|
|
166301
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
166302
|
-
}
|
|
166303
|
-
function debounced() {
|
|
166304
|
-
var time3 = now(), isInvoking = shouldInvoke(time3);
|
|
166305
|
-
lastArgs = arguments;
|
|
166306
|
-
lastThis = this;
|
|
166307
|
-
lastCallTime = time3;
|
|
166308
|
-
if (isInvoking) {
|
|
166309
|
-
if (timerId === undefined) {
|
|
166310
|
-
return leadingEdge(lastCallTime);
|
|
166311
|
-
}
|
|
166312
|
-
if (maxing) {
|
|
166313
|
-
clearTimeout(timerId);
|
|
166314
|
-
timerId = setTimeout(timerExpired, wait);
|
|
166315
|
-
return invokeFunc(lastCallTime);
|
|
166316
|
-
}
|
|
166317
|
-
}
|
|
166318
|
-
if (timerId === undefined) {
|
|
166319
|
-
timerId = setTimeout(timerExpired, wait);
|
|
166320
|
-
}
|
|
166321
|
-
return result;
|
|
166322
|
-
}
|
|
166323
|
-
debounced.cancel = cancel;
|
|
166324
|
-
debounced.flush = flush;
|
|
166325
|
-
return debounced;
|
|
166326
|
-
}
|
|
166327
|
-
module.exports = debounce;
|
|
166328
|
-
});
|
|
166329
|
-
|
|
166330
166168
|
// node_modules/socket.io/node_modules/accepts/node_modules/negotiator/lib/charset.js
|
|
166331
166169
|
var require_charset2 = __commonJS((exports, module) => {
|
|
166332
166170
|
module.exports = preferredCharsets;
|
|
@@ -175355,7 +175193,7 @@ var require_mime_types2 = __commonJS((exports) => {
|
|
|
175355
175193
|
* MIT Licensed
|
|
175356
175194
|
*/
|
|
175357
175195
|
var db2 = require_db2();
|
|
175358
|
-
var
|
|
175196
|
+
var extname2 = __require("path").extname;
|
|
175359
175197
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
175360
175198
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
175361
175199
|
exports.charset = charset;
|
|
@@ -175410,7 +175248,7 @@ var require_mime_types2 = __commonJS((exports) => {
|
|
|
175410
175248
|
if (!path18 || typeof path18 !== "string") {
|
|
175411
175249
|
return false;
|
|
175412
175250
|
}
|
|
175413
|
-
var extension2 =
|
|
175251
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
175414
175252
|
if (!extension2) {
|
|
175415
175253
|
return false;
|
|
175416
175254
|
}
|
|
@@ -185402,7 +185240,7 @@ var require_mime_types3 = __commonJS((exports) => {
|
|
|
185402
185240
|
* MIT Licensed
|
|
185403
185241
|
*/
|
|
185404
185242
|
var db2 = require_db3();
|
|
185405
|
-
var
|
|
185243
|
+
var extname2 = __require("path").extname;
|
|
185406
185244
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
185407
185245
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
185408
185246
|
exports.charset = charset;
|
|
@@ -185457,7 +185295,7 @@ var require_mime_types3 = __commonJS((exports) => {
|
|
|
185457
185295
|
if (!path18 || typeof path18 !== "string") {
|
|
185458
185296
|
return false;
|
|
185459
185297
|
}
|
|
185460
|
-
var extension2 =
|
|
185298
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
185461
185299
|
if (!extension2) {
|
|
185462
185300
|
return false;
|
|
185463
185301
|
}
|
|
@@ -187975,13 +187813,13 @@ var require_extension = __commonJS((exports, module) => {
|
|
|
187975
187813
|
|
|
187976
187814
|
// node_modules/ws/lib/websocket.js
|
|
187977
187815
|
var require_websocket2 = __commonJS((exports, module) => {
|
|
187978
|
-
var
|
|
187816
|
+
var EventEmitter3 = __require("events");
|
|
187979
187817
|
var https = __require("https");
|
|
187980
187818
|
var http = __require("http");
|
|
187981
187819
|
var net2 = __require("net");
|
|
187982
187820
|
var tls = __require("tls");
|
|
187983
187821
|
var { randomBytes: randomBytes2, createHash } = __require("crypto");
|
|
187984
|
-
var { Duplex: Duplex4, Readable:
|
|
187822
|
+
var { Duplex: Duplex4, Readable: Readable6 } = __require("stream");
|
|
187985
187823
|
var { URL: URL2 } = __require("url");
|
|
187986
187824
|
var PerMessageDeflate = require_permessage_deflate();
|
|
187987
187825
|
var Receiver = require_receiver();
|
|
@@ -188008,7 +187846,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
188008
187846
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
188009
187847
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
188010
187848
|
|
|
188011
|
-
class WebSocket extends
|
|
187849
|
+
class WebSocket extends EventEmitter3 {
|
|
188012
187850
|
constructor(address, protocols, options8) {
|
|
188013
187851
|
super();
|
|
188014
187852
|
this._binaryType = BINARY_TYPES[0];
|
|
@@ -188797,7 +188635,7 @@ var require_stream6 = __commonJS((exports, module) => {
|
|
|
188797
188635
|
};
|
|
188798
188636
|
duplex2._final = function(callback) {
|
|
188799
188637
|
if (ws8.readyState === ws8.CONNECTING) {
|
|
188800
|
-
ws8.once("open", function
|
|
188638
|
+
ws8.once("open", function open2() {
|
|
188801
188639
|
duplex2._final(callback);
|
|
188802
188640
|
});
|
|
188803
188641
|
return;
|
|
@@ -188821,7 +188659,7 @@ var require_stream6 = __commonJS((exports, module) => {
|
|
|
188821
188659
|
};
|
|
188822
188660
|
duplex2._write = function(chunk, encoding, callback) {
|
|
188823
188661
|
if (ws8.readyState === ws8.CONNECTING) {
|
|
188824
|
-
ws8.once("open", function
|
|
188662
|
+
ws8.once("open", function open2() {
|
|
188825
188663
|
duplex2._write(chunk, encoding, callback);
|
|
188826
188664
|
});
|
|
188827
188665
|
return;
|
|
@@ -188882,7 +188720,7 @@ var require_subprotocol = __commonJS((exports, module) => {
|
|
|
188882
188720
|
|
|
188883
188721
|
// node_modules/ws/lib/websocket-server.js
|
|
188884
188722
|
var require_websocket_server = __commonJS((exports, module) => {
|
|
188885
|
-
var
|
|
188723
|
+
var EventEmitter3 = __require("events");
|
|
188886
188724
|
var http = __require("http");
|
|
188887
188725
|
var { Duplex: Duplex4 } = __require("stream");
|
|
188888
188726
|
var { createHash } = __require("crypto");
|
|
@@ -188896,7 +188734,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
188896
188734
|
var CLOSING = 1;
|
|
188897
188735
|
var CLOSED2 = 2;
|
|
188898
188736
|
|
|
188899
|
-
class WebSocketServer extends
|
|
188737
|
+
class WebSocketServer extends EventEmitter3 {
|
|
188900
188738
|
constructor(options8, callback) {
|
|
188901
188739
|
super();
|
|
188902
188740
|
options8 = {
|
|
@@ -191433,13 +191271,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
191433
191271
|
return true;
|
|
191434
191272
|
}
|
|
191435
191273
|
emitWithAck(ev2, ...args) {
|
|
191436
|
-
return new Promise((
|
|
191274
|
+
return new Promise((resolve6, reject) => {
|
|
191437
191275
|
args.push((err, responses) => {
|
|
191438
191276
|
if (err) {
|
|
191439
191277
|
err.responses = responses;
|
|
191440
191278
|
return reject(err);
|
|
191441
191279
|
} else {
|
|
191442
|
-
return
|
|
191280
|
+
return resolve6(responses);
|
|
191443
191281
|
}
|
|
191444
191282
|
});
|
|
191445
191283
|
this.emit(ev2, ...args);
|
|
@@ -191627,12 +191465,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
191627
191465
|
}
|
|
191628
191466
|
emitWithAck(ev2, ...args) {
|
|
191629
191467
|
const withErr = this.flags.timeout !== undefined;
|
|
191630
|
-
return new Promise((
|
|
191468
|
+
return new Promise((resolve6, reject) => {
|
|
191631
191469
|
args.push((arg1, arg2) => {
|
|
191632
191470
|
if (withErr) {
|
|
191633
|
-
return arg1 ? reject(arg1) :
|
|
191471
|
+
return arg1 ? reject(arg1) : resolve6(arg2);
|
|
191634
191472
|
} else {
|
|
191635
|
-
return
|
|
191473
|
+
return resolve6(arg1);
|
|
191636
191474
|
}
|
|
191637
191475
|
});
|
|
191638
191476
|
this.emit(ev2, ...args);
|
|
@@ -192087,13 +191925,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
192087
191925
|
return true;
|
|
192088
191926
|
}
|
|
192089
191927
|
serverSideEmitWithAck(ev2, ...args) {
|
|
192090
|
-
return new Promise((
|
|
191928
|
+
return new Promise((resolve6, reject) => {
|
|
192091
191929
|
args.push((err, responses) => {
|
|
192092
191930
|
if (err) {
|
|
192093
191931
|
err.responses = responses;
|
|
192094
191932
|
return reject(err);
|
|
192095
191933
|
} else {
|
|
192096
|
-
return
|
|
191934
|
+
return resolve6(responses);
|
|
192097
191935
|
}
|
|
192098
191936
|
});
|
|
192099
191937
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -192777,7 +192615,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192777
192615
|
return localSockets;
|
|
192778
192616
|
}
|
|
192779
192617
|
const requestId = randomId();
|
|
192780
|
-
return new Promise((
|
|
192618
|
+
return new Promise((resolve6, reject) => {
|
|
192781
192619
|
const timeout3 = setTimeout(() => {
|
|
192782
192620
|
const storedRequest2 = this.requests.get(requestId);
|
|
192783
192621
|
if (storedRequest2) {
|
|
@@ -192787,7 +192625,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192787
192625
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
192788
192626
|
const storedRequest = {
|
|
192789
192627
|
type: MessageType.FETCH_SOCKETS,
|
|
192790
|
-
resolve:
|
|
192628
|
+
resolve: resolve6,
|
|
192791
192629
|
timeout: timeout3,
|
|
192792
192630
|
current: 0,
|
|
192793
192631
|
expected: expectedResponseCount,
|
|
@@ -192997,7 +192835,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
192997
192835
|
return localSockets;
|
|
192998
192836
|
}
|
|
192999
192837
|
const requestId = randomId();
|
|
193000
|
-
return new Promise((
|
|
192838
|
+
return new Promise((resolve6, reject) => {
|
|
193001
192839
|
const timeout3 = setTimeout(() => {
|
|
193002
192840
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
193003
192841
|
if (storedRequest2) {
|
|
@@ -193007,7 +192845,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
193007
192845
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
193008
192846
|
const storedRequest = {
|
|
193009
192847
|
type: MessageType.FETCH_SOCKETS,
|
|
193010
|
-
resolve:
|
|
192848
|
+
resolve: resolve6,
|
|
193011
192849
|
timeout: timeout3,
|
|
193012
192850
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
193013
192851
|
responses: localSockets
|
|
@@ -193736,13 +193574,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
193736
193574
|
this.engine.close();
|
|
193737
193575
|
(0, uws_1.restoreAdapter)();
|
|
193738
193576
|
if (this.httpServer) {
|
|
193739
|
-
return new Promise((
|
|
193577
|
+
return new Promise((resolve6) => {
|
|
193740
193578
|
this.httpServer.close((err) => {
|
|
193741
193579
|
fn9 && fn9(err);
|
|
193742
193580
|
if (err) {
|
|
193743
193581
|
debug("server was not running");
|
|
193744
193582
|
}
|
|
193745
|
-
|
|
193583
|
+
resolve6();
|
|
193746
193584
|
});
|
|
193747
193585
|
});
|
|
193748
193586
|
} else {
|
|
@@ -202478,7 +202316,7 @@ var require_mime_types4 = __commonJS((exports) => {
|
|
|
202478
202316
|
* MIT Licensed
|
|
202479
202317
|
*/
|
|
202480
202318
|
var db2 = require_db4();
|
|
202481
|
-
var
|
|
202319
|
+
var extname2 = __require("path").extname;
|
|
202482
202320
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
202483
202321
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
202484
202322
|
exports.charset = charset;
|
|
@@ -202533,7 +202371,7 @@ var require_mime_types4 = __commonJS((exports) => {
|
|
|
202533
202371
|
if (!path18 || typeof path18 !== "string") {
|
|
202534
202372
|
return false;
|
|
202535
202373
|
}
|
|
202536
|
-
var extension2 =
|
|
202374
|
+
var extension2 = extname2("x." + path18).toLowerCase().substr(1);
|
|
202537
202375
|
if (!extension2) {
|
|
202538
202376
|
return false;
|
|
202539
202377
|
}
|
|
@@ -202576,7 +202414,7 @@ var require_type_is2 = __commonJS((exports, module) => {
|
|
|
202576
202414
|
module.exports = typeofrequest;
|
|
202577
202415
|
module.exports.is = typeis;
|
|
202578
202416
|
module.exports.hasBody = hasbody;
|
|
202579
|
-
module.exports.normalize =
|
|
202417
|
+
module.exports.normalize = normalize;
|
|
202580
202418
|
module.exports.match = mimeMatch;
|
|
202581
202419
|
function typeis(value, types_) {
|
|
202582
202420
|
var i5;
|
|
@@ -202596,7 +202434,7 @@ var require_type_is2 = __commonJS((exports, module) => {
|
|
|
202596
202434
|
}
|
|
202597
202435
|
var type;
|
|
202598
202436
|
for (i5 = 0;i5 < types.length; i5++) {
|
|
202599
|
-
if (mimeMatch(
|
|
202437
|
+
if (mimeMatch(normalize(type = types[i5]), val)) {
|
|
202600
202438
|
return type[0] === "+" || type.indexOf("*") !== -1 ? val : type;
|
|
202601
202439
|
}
|
|
202602
202440
|
}
|
|
@@ -202619,7 +202457,7 @@ var require_type_is2 = __commonJS((exports, module) => {
|
|
|
202619
202457
|
var value = req.headers["content-type"];
|
|
202620
202458
|
return typeis(value, types);
|
|
202621
202459
|
}
|
|
202622
|
-
function
|
|
202460
|
+
function normalize(type) {
|
|
202623
202461
|
if (typeof type !== "string") {
|
|
202624
202462
|
return false;
|
|
202625
202463
|
}
|
|
@@ -203040,7 +202878,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
203040
202878
|
if (decode4)
|
|
203041
202879
|
return decode4(data, hint);
|
|
203042
202880
|
}
|
|
203043
|
-
function
|
|
202881
|
+
function basename4(path18) {
|
|
203044
202882
|
if (typeof path18 !== "string")
|
|
203045
202883
|
return "";
|
|
203046
202884
|
for (let i5 = path18.length - 1;i5 >= 0; --i5) {
|
|
@@ -204344,7 +204182,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
204344
204182
|
-1
|
|
204345
204183
|
];
|
|
204346
204184
|
module.exports = {
|
|
204347
|
-
basename:
|
|
204185
|
+
basename: basename4,
|
|
204348
204186
|
convertToUTF8,
|
|
204349
204187
|
getDecoder,
|
|
204350
204188
|
parseContentType,
|
|
@@ -204749,10 +204587,10 @@ var require_sbmh = __commonJS((exports, module) => {
|
|
|
204749
204587
|
|
|
204750
204588
|
// node_modules/busboy/lib/types/multipart.js
|
|
204751
204589
|
var require_multipart = __commonJS((exports, module) => {
|
|
204752
|
-
var { Readable:
|
|
204590
|
+
var { Readable: Readable6, Writable: Writable4 } = __require("stream");
|
|
204753
204591
|
var StreamSearch = require_sbmh();
|
|
204754
204592
|
var {
|
|
204755
|
-
basename:
|
|
204593
|
+
basename: basename4,
|
|
204756
204594
|
convertToUTF8,
|
|
204757
204595
|
getDecoder,
|
|
204758
204596
|
parseContentType,
|
|
@@ -204907,7 +204745,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
204907
204745
|
}
|
|
204908
204746
|
}
|
|
204909
204747
|
|
|
204910
|
-
class FileStream extends
|
|
204748
|
+
class FileStream extends Readable6 {
|
|
204911
204749
|
constructor(opts, owner) {
|
|
204912
204750
|
super(opts);
|
|
204913
204751
|
this.truncated = false;
|
|
@@ -205014,7 +204852,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
205014
204852
|
else if (disp.params.filename)
|
|
205015
204853
|
filename = disp.params.filename;
|
|
205016
204854
|
if (filename !== undefined && !preservePath)
|
|
205017
|
-
filename =
|
|
204855
|
+
filename = basename4(filename);
|
|
205018
204856
|
}
|
|
205019
204857
|
if (header2["content-type"]) {
|
|
205020
204858
|
const conType = parseContentType(header2["content-type"][0]);
|
|
@@ -206499,12 +206337,12 @@ var require_append_field = __commonJS((exports, module) => {
|
|
|
206499
206337
|
|
|
206500
206338
|
// node_modules/multer/lib/counter.js
|
|
206501
206339
|
var require_counter = __commonJS((exports, module) => {
|
|
206502
|
-
var
|
|
206340
|
+
var EventEmitter3 = __require("events").EventEmitter;
|
|
206503
206341
|
function Counter() {
|
|
206504
|
-
|
|
206342
|
+
EventEmitter3.call(this);
|
|
206505
206343
|
this.value = 0;
|
|
206506
206344
|
}
|
|
206507
|
-
Counter.prototype = Object.create(
|
|
206345
|
+
Counter.prototype = Object.create(EventEmitter3.prototype);
|
|
206508
206346
|
Counter.prototype.increment = function increment2() {
|
|
206509
206347
|
this.value++;
|
|
206510
206348
|
};
|
|
@@ -206865,8 +206703,8 @@ var require_mkdirp = __commonJS((exports, module) => {
|
|
|
206865
206703
|
});
|
|
206866
206704
|
break;
|
|
206867
206705
|
default:
|
|
206868
|
-
xfs.stat(p4, function(er22,
|
|
206869
|
-
if (er22 || !
|
|
206706
|
+
xfs.stat(p4, function(er22, stat2) {
|
|
206707
|
+
if (er22 || !stat2.isDirectory())
|
|
206870
206708
|
cb2(er10, made);
|
|
206871
206709
|
else
|
|
206872
206710
|
cb2(null, made);
|
|
@@ -206897,13 +206735,13 @@ var require_mkdirp = __commonJS((exports, module) => {
|
|
|
206897
206735
|
sync(p4, opts, made);
|
|
206898
206736
|
break;
|
|
206899
206737
|
default:
|
|
206900
|
-
var
|
|
206738
|
+
var stat2;
|
|
206901
206739
|
try {
|
|
206902
|
-
|
|
206740
|
+
stat2 = xfs.statSync(p4);
|
|
206903
206741
|
} catch (err1) {
|
|
206904
206742
|
throw err0;
|
|
206905
206743
|
}
|
|
206906
|
-
if (!
|
|
206744
|
+
if (!stat2.isDirectory())
|
|
206907
206745
|
throw err0;
|
|
206908
206746
|
break;
|
|
206909
206747
|
}
|
|
@@ -207106,7 +206944,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
207106
206944
|
}
|
|
207107
206945
|
}, {
|
|
207108
206946
|
key: "join",
|
|
207109
|
-
value: function
|
|
206947
|
+
value: function join16(s5) {
|
|
207110
206948
|
if (this.length === 0)
|
|
207111
206949
|
return "";
|
|
207112
206950
|
var p4 = this.head;
|
|
@@ -207932,9 +207770,9 @@ var require__stream_duplex = __commonJS((exports, module) => {
|
|
|
207932
207770
|
return keys2;
|
|
207933
207771
|
};
|
|
207934
207772
|
module.exports = Duplex4;
|
|
207935
|
-
var
|
|
207773
|
+
var Readable6 = require__stream_readable();
|
|
207936
207774
|
var Writable4 = require__stream_writable();
|
|
207937
|
-
require_inherits()(Duplex4,
|
|
207775
|
+
require_inherits()(Duplex4, Readable6);
|
|
207938
207776
|
{
|
|
207939
207777
|
keys = objectKeys(Writable4.prototype);
|
|
207940
207778
|
for (v10 = 0;v10 < keys.length; v10++) {
|
|
@@ -207949,7 +207787,7 @@ var require__stream_duplex = __commonJS((exports, module) => {
|
|
|
207949
207787
|
function Duplex4(options8) {
|
|
207950
207788
|
if (!(this instanceof Duplex4))
|
|
207951
207789
|
return new Duplex4(options8);
|
|
207952
|
-
|
|
207790
|
+
Readable6.call(this, options8);
|
|
207953
207791
|
Writable4.call(this, options8);
|
|
207954
207792
|
this.allowHalfOpen = true;
|
|
207955
207793
|
if (options8) {
|
|
@@ -208461,14 +208299,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208461
208299
|
};
|
|
208462
208300
|
}
|
|
208463
208301
|
function readAndResolve(iter) {
|
|
208464
|
-
var
|
|
208465
|
-
if (
|
|
208302
|
+
var resolve6 = iter[kLastResolve];
|
|
208303
|
+
if (resolve6 !== null) {
|
|
208466
208304
|
var data = iter[kStream].read();
|
|
208467
208305
|
if (data !== null) {
|
|
208468
208306
|
iter[kLastPromise] = null;
|
|
208469
208307
|
iter[kLastResolve] = null;
|
|
208470
208308
|
iter[kLastReject] = null;
|
|
208471
|
-
|
|
208309
|
+
resolve6(createIterResult(data, false));
|
|
208472
208310
|
}
|
|
208473
208311
|
}
|
|
208474
208312
|
}
|
|
@@ -208476,13 +208314,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208476
208314
|
process.nextTick(readAndResolve, iter);
|
|
208477
208315
|
}
|
|
208478
208316
|
function wrapForNext(lastPromise, iter) {
|
|
208479
|
-
return function(
|
|
208317
|
+
return function(resolve6, reject) {
|
|
208480
208318
|
lastPromise.then(function() {
|
|
208481
208319
|
if (iter[kEnded]) {
|
|
208482
|
-
|
|
208320
|
+
resolve6(createIterResult(undefined, true));
|
|
208483
208321
|
return;
|
|
208484
208322
|
}
|
|
208485
|
-
iter[kHandlePromise](
|
|
208323
|
+
iter[kHandlePromise](resolve6, reject);
|
|
208486
208324
|
}, reject);
|
|
208487
208325
|
};
|
|
208488
208326
|
}
|
|
@@ -208501,12 +208339,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208501
208339
|
return Promise.resolve(createIterResult(undefined, true));
|
|
208502
208340
|
}
|
|
208503
208341
|
if (this[kStream].destroyed) {
|
|
208504
|
-
return new Promise(function(
|
|
208342
|
+
return new Promise(function(resolve6, reject) {
|
|
208505
208343
|
process.nextTick(function() {
|
|
208506
208344
|
if (_this[kError]) {
|
|
208507
208345
|
reject(_this[kError]);
|
|
208508
208346
|
} else {
|
|
208509
|
-
|
|
208347
|
+
resolve6(createIterResult(undefined, true));
|
|
208510
208348
|
}
|
|
208511
208349
|
});
|
|
208512
208350
|
});
|
|
@@ -208529,13 +208367,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208529
208367
|
return this;
|
|
208530
208368
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
208531
208369
|
var _this2 = this;
|
|
208532
|
-
return new Promise(function(
|
|
208370
|
+
return new Promise(function(resolve6, reject) {
|
|
208533
208371
|
_this2[kStream].destroy(null, function(err) {
|
|
208534
208372
|
if (err) {
|
|
208535
208373
|
reject(err);
|
|
208536
208374
|
return;
|
|
208537
208375
|
}
|
|
208538
|
-
|
|
208376
|
+
resolve6(createIterResult(undefined, true));
|
|
208539
208377
|
});
|
|
208540
208378
|
});
|
|
208541
208379
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -208557,15 +208395,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208557
208395
|
value: stream._readableState.endEmitted,
|
|
208558
208396
|
writable: true
|
|
208559
208397
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
208560
|
-
value: function value(
|
|
208398
|
+
value: function value(resolve6, reject) {
|
|
208561
208399
|
var data = iterator[kStream].read();
|
|
208562
208400
|
if (data) {
|
|
208563
208401
|
iterator[kLastPromise] = null;
|
|
208564
208402
|
iterator[kLastResolve] = null;
|
|
208565
208403
|
iterator[kLastReject] = null;
|
|
208566
|
-
|
|
208404
|
+
resolve6(createIterResult(data, false));
|
|
208567
208405
|
} else {
|
|
208568
|
-
iterator[kLastResolve] =
|
|
208406
|
+
iterator[kLastResolve] = resolve6;
|
|
208569
208407
|
iterator[kLastReject] = reject;
|
|
208570
208408
|
}
|
|
208571
208409
|
},
|
|
@@ -208584,12 +208422,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208584
208422
|
iterator[kError] = err;
|
|
208585
208423
|
return;
|
|
208586
208424
|
}
|
|
208587
|
-
var
|
|
208588
|
-
if (
|
|
208425
|
+
var resolve6 = iterator[kLastResolve];
|
|
208426
|
+
if (resolve6 !== null) {
|
|
208589
208427
|
iterator[kLastPromise] = null;
|
|
208590
208428
|
iterator[kLastResolve] = null;
|
|
208591
208429
|
iterator[kLastReject] = null;
|
|
208592
|
-
|
|
208430
|
+
resolve6(createIterResult(undefined, true));
|
|
208593
208431
|
}
|
|
208594
208432
|
iterator[kEnded] = true;
|
|
208595
208433
|
});
|
|
@@ -208601,7 +208439,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
208601
208439
|
|
|
208602
208440
|
// node_modules/readable-stream/lib/internal/streams/from.js
|
|
208603
208441
|
var require_from = __commonJS((exports, module) => {
|
|
208604
|
-
function asyncGeneratorStep(gen,
|
|
208442
|
+
function asyncGeneratorStep(gen, resolve6, reject, _next, _throw, key2, arg) {
|
|
208605
208443
|
try {
|
|
208606
208444
|
var info = gen[key2](arg);
|
|
208607
208445
|
var value = info.value;
|
|
@@ -208610,7 +208448,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208610
208448
|
return;
|
|
208611
208449
|
}
|
|
208612
208450
|
if (info.done) {
|
|
208613
|
-
|
|
208451
|
+
resolve6(value);
|
|
208614
208452
|
} else {
|
|
208615
208453
|
Promise.resolve(value).then(_next, _throw);
|
|
208616
208454
|
}
|
|
@@ -208618,13 +208456,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208618
208456
|
function _asyncToGenerator(fn9) {
|
|
208619
208457
|
return function() {
|
|
208620
208458
|
var self2 = this, args = arguments;
|
|
208621
|
-
return new Promise(function(
|
|
208459
|
+
return new Promise(function(resolve6, reject) {
|
|
208622
208460
|
var gen = fn9.apply(self2, args);
|
|
208623
208461
|
function _next(value) {
|
|
208624
|
-
asyncGeneratorStep(gen,
|
|
208462
|
+
asyncGeneratorStep(gen, resolve6, reject, _next, _throw, "next", value);
|
|
208625
208463
|
}
|
|
208626
208464
|
function _throw(err) {
|
|
208627
|
-
asyncGeneratorStep(gen,
|
|
208465
|
+
asyncGeneratorStep(gen, resolve6, reject, _next, _throw, "throw", err);
|
|
208628
208466
|
}
|
|
208629
208467
|
_next(undefined);
|
|
208630
208468
|
});
|
|
@@ -208677,7 +208515,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208677
208515
|
return (hint === "string" ? String : Number)(input);
|
|
208678
208516
|
}
|
|
208679
208517
|
var ERR_INVALID_ARG_TYPE = require_errors3().codes.ERR_INVALID_ARG_TYPE;
|
|
208680
|
-
function from(
|
|
208518
|
+
function from(Readable6, iterable, opts) {
|
|
208681
208519
|
var iterator;
|
|
208682
208520
|
if (iterable && typeof iterable.next === "function") {
|
|
208683
208521
|
iterator = iterable;
|
|
@@ -208687,7 +208525,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208687
208525
|
iterator = iterable[Symbol.iterator]();
|
|
208688
208526
|
else
|
|
208689
208527
|
throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
|
|
208690
|
-
var readable2 = new
|
|
208528
|
+
var readable2 = new Readable6(_objectSpread({
|
|
208691
208529
|
objectMode: true
|
|
208692
208530
|
}, opts));
|
|
208693
208531
|
var reading = false;
|
|
@@ -208724,9 +208562,9 @@ var require_from = __commonJS((exports, module) => {
|
|
|
208724
208562
|
|
|
208725
208563
|
// node_modules/readable-stream/lib/_stream_readable.js
|
|
208726
208564
|
var require__stream_readable = __commonJS((exports, module) => {
|
|
208727
|
-
module.exports =
|
|
208565
|
+
module.exports = Readable6;
|
|
208728
208566
|
var Duplex4;
|
|
208729
|
-
|
|
208567
|
+
Readable6.ReadableState = ReadableState;
|
|
208730
208568
|
var EE3 = __require("events").EventEmitter;
|
|
208731
208569
|
var EElistenerCount = function EElistenerCount2(emitter, type) {
|
|
208732
208570
|
return emitter.listeners(type).length;
|
|
@@ -208759,7 +208597,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208759
208597
|
var StringDecoder4;
|
|
208760
208598
|
var createReadableStreamAsyncIterator;
|
|
208761
208599
|
var from;
|
|
208762
|
-
require_inherits()(
|
|
208600
|
+
require_inherits()(Readable6, Stream2);
|
|
208763
208601
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
208764
208602
|
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
|
|
208765
208603
|
function prependListener(emitter, event, fn9) {
|
|
@@ -208810,10 +208648,10 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208810
208648
|
this.encoding = options8.encoding;
|
|
208811
208649
|
}
|
|
208812
208650
|
}
|
|
208813
|
-
function
|
|
208651
|
+
function Readable6(options8) {
|
|
208814
208652
|
Duplex4 = Duplex4 || require__stream_duplex();
|
|
208815
|
-
if (!(this instanceof
|
|
208816
|
-
return new
|
|
208653
|
+
if (!(this instanceof Readable6))
|
|
208654
|
+
return new Readable6(options8);
|
|
208817
208655
|
var isDuplex = this instanceof Duplex4;
|
|
208818
208656
|
this._readableState = new ReadableState(options8, this, isDuplex);
|
|
208819
208657
|
this.readable = true;
|
|
@@ -208825,7 +208663,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208825
208663
|
}
|
|
208826
208664
|
Stream2.call(this);
|
|
208827
208665
|
}
|
|
208828
|
-
Object.defineProperty(
|
|
208666
|
+
Object.defineProperty(Readable6.prototype, "destroyed", {
|
|
208829
208667
|
enumerable: false,
|
|
208830
208668
|
get: function get() {
|
|
208831
208669
|
if (this._readableState === undefined) {
|
|
@@ -208840,12 +208678,12 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208840
208678
|
this._readableState.destroyed = value;
|
|
208841
208679
|
}
|
|
208842
208680
|
});
|
|
208843
|
-
|
|
208844
|
-
|
|
208845
|
-
|
|
208681
|
+
Readable6.prototype.destroy = destroyImpl.destroy;
|
|
208682
|
+
Readable6.prototype._undestroy = destroyImpl.undestroy;
|
|
208683
|
+
Readable6.prototype._destroy = function(err, cb2) {
|
|
208846
208684
|
cb2(err);
|
|
208847
208685
|
};
|
|
208848
|
-
|
|
208686
|
+
Readable6.prototype.push = function(chunk, encoding) {
|
|
208849
208687
|
var state = this._readableState;
|
|
208850
208688
|
var skipChunkCheck;
|
|
208851
208689
|
if (!state.objectMode) {
|
|
@@ -208862,7 +208700,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208862
208700
|
}
|
|
208863
208701
|
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
|
|
208864
208702
|
};
|
|
208865
|
-
|
|
208703
|
+
Readable6.prototype.unshift = function(chunk) {
|
|
208866
208704
|
return readableAddChunk(this, chunk, null, true, false);
|
|
208867
208705
|
};
|
|
208868
208706
|
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
|
|
@@ -208931,10 +208769,10 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208931
208769
|
}
|
|
208932
208770
|
return er10;
|
|
208933
208771
|
}
|
|
208934
|
-
|
|
208772
|
+
Readable6.prototype.isPaused = function() {
|
|
208935
208773
|
return this._readableState.flowing === false;
|
|
208936
208774
|
};
|
|
208937
|
-
|
|
208775
|
+
Readable6.prototype.setEncoding = function(enc) {
|
|
208938
208776
|
if (!StringDecoder4)
|
|
208939
208777
|
StringDecoder4 = require_string_decoder().StringDecoder;
|
|
208940
208778
|
var decoder = new StringDecoder4(enc);
|
|
@@ -208988,7 +208826,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
208988
208826
|
}
|
|
208989
208827
|
return state.length;
|
|
208990
208828
|
}
|
|
208991
|
-
|
|
208829
|
+
Readable6.prototype.read = function(n5) {
|
|
208992
208830
|
debug("read", n5);
|
|
208993
208831
|
n5 = parseInt(n5, 10);
|
|
208994
208832
|
var state = this._readableState;
|
|
@@ -209109,10 +208947,10 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209109
208947
|
}
|
|
209110
208948
|
state.readingMore = false;
|
|
209111
208949
|
}
|
|
209112
|
-
|
|
208950
|
+
Readable6.prototype._read = function(n5) {
|
|
209113
208951
|
errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
|
|
209114
208952
|
};
|
|
209115
|
-
|
|
208953
|
+
Readable6.prototype.pipe = function(dest, pipeOpts) {
|
|
209116
208954
|
var src = this;
|
|
209117
208955
|
var state = this._readableState;
|
|
209118
208956
|
switch (state.pipesCount) {
|
|
@@ -209220,7 +209058,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209220
209058
|
}
|
|
209221
209059
|
};
|
|
209222
209060
|
}
|
|
209223
|
-
|
|
209061
|
+
Readable6.prototype.unpipe = function(dest) {
|
|
209224
209062
|
var state = this._readableState;
|
|
209225
209063
|
var unpipeInfo = {
|
|
209226
209064
|
hasUnpiped: false
|
|
@@ -209261,7 +209099,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209261
209099
|
dest.emit("unpipe", this, unpipeInfo);
|
|
209262
209100
|
return this;
|
|
209263
209101
|
};
|
|
209264
|
-
|
|
209102
|
+
Readable6.prototype.on = function(ev2, fn9) {
|
|
209265
209103
|
var res = Stream2.prototype.on.call(this, ev2, fn9);
|
|
209266
209104
|
var state = this._readableState;
|
|
209267
209105
|
if (ev2 === "data") {
|
|
@@ -209283,15 +209121,15 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209283
209121
|
}
|
|
209284
209122
|
return res;
|
|
209285
209123
|
};
|
|
209286
|
-
|
|
209287
|
-
|
|
209124
|
+
Readable6.prototype.addListener = Readable6.prototype.on;
|
|
209125
|
+
Readable6.prototype.removeListener = function(ev2, fn9) {
|
|
209288
209126
|
var res = Stream2.prototype.removeListener.call(this, ev2, fn9);
|
|
209289
209127
|
if (ev2 === "readable") {
|
|
209290
209128
|
process.nextTick(updateReadableListening, this);
|
|
209291
209129
|
}
|
|
209292
209130
|
return res;
|
|
209293
209131
|
};
|
|
209294
|
-
|
|
209132
|
+
Readable6.prototype.removeAllListeners = function(ev2) {
|
|
209295
209133
|
var res = Stream2.prototype.removeAllListeners.apply(this, arguments);
|
|
209296
209134
|
if (ev2 === "readable" || ev2 === undefined) {
|
|
209297
209135
|
process.nextTick(updateReadableListening, this);
|
|
@@ -209311,7 +209149,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209311
209149
|
debug("readable nexttick read 0");
|
|
209312
209150
|
self2.read(0);
|
|
209313
209151
|
}
|
|
209314
|
-
|
|
209152
|
+
Readable6.prototype.resume = function() {
|
|
209315
209153
|
var state = this._readableState;
|
|
209316
209154
|
if (!state.flowing) {
|
|
209317
209155
|
debug("resume");
|
|
@@ -209338,7 +209176,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209338
209176
|
if (state.flowing && !state.reading)
|
|
209339
209177
|
stream.read(0);
|
|
209340
209178
|
}
|
|
209341
|
-
|
|
209179
|
+
Readable6.prototype.pause = function() {
|
|
209342
209180
|
debug("call pause flowing=%j", this._readableState.flowing);
|
|
209343
209181
|
if (this._readableState.flowing !== false) {
|
|
209344
209182
|
debug("pause");
|
|
@@ -209354,7 +209192,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209354
209192
|
while (state.flowing && stream.read() !== null)
|
|
209355
209193
|
;
|
|
209356
209194
|
}
|
|
209357
|
-
|
|
209195
|
+
Readable6.prototype.wrap = function(stream) {
|
|
209358
209196
|
var _this = this;
|
|
209359
209197
|
var state = this._readableState;
|
|
209360
209198
|
var paused = false;
|
|
@@ -209403,26 +209241,26 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209403
209241
|
return this;
|
|
209404
209242
|
};
|
|
209405
209243
|
if (typeof Symbol === "function") {
|
|
209406
|
-
|
|
209244
|
+
Readable6.prototype[Symbol.asyncIterator] = function() {
|
|
209407
209245
|
if (createReadableStreamAsyncIterator === undefined) {
|
|
209408
209246
|
createReadableStreamAsyncIterator = require_async_iterator();
|
|
209409
209247
|
}
|
|
209410
209248
|
return createReadableStreamAsyncIterator(this);
|
|
209411
209249
|
};
|
|
209412
209250
|
}
|
|
209413
|
-
Object.defineProperty(
|
|
209251
|
+
Object.defineProperty(Readable6.prototype, "readableHighWaterMark", {
|
|
209414
209252
|
enumerable: false,
|
|
209415
209253
|
get: function get() {
|
|
209416
209254
|
return this._readableState.highWaterMark;
|
|
209417
209255
|
}
|
|
209418
209256
|
});
|
|
209419
|
-
Object.defineProperty(
|
|
209257
|
+
Object.defineProperty(Readable6.prototype, "readableBuffer", {
|
|
209420
209258
|
enumerable: false,
|
|
209421
209259
|
get: function get() {
|
|
209422
209260
|
return this._readableState && this._readableState.buffer;
|
|
209423
209261
|
}
|
|
209424
209262
|
});
|
|
209425
|
-
Object.defineProperty(
|
|
209263
|
+
Object.defineProperty(Readable6.prototype, "readableFlowing", {
|
|
209426
209264
|
enumerable: false,
|
|
209427
209265
|
get: function get() {
|
|
209428
209266
|
return this._readableState.flowing;
|
|
@@ -209433,8 +209271,8 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209433
209271
|
}
|
|
209434
209272
|
}
|
|
209435
209273
|
});
|
|
209436
|
-
|
|
209437
|
-
Object.defineProperty(
|
|
209274
|
+
Readable6._fromList = fromList;
|
|
209275
|
+
Object.defineProperty(Readable6.prototype, "readableLength", {
|
|
209438
209276
|
enumerable: false,
|
|
209439
209277
|
get: function get() {
|
|
209440
209278
|
return this._readableState.length;
|
|
@@ -209482,11 +209320,11 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
209482
209320
|
}
|
|
209483
209321
|
}
|
|
209484
209322
|
if (typeof Symbol === "function") {
|
|
209485
|
-
|
|
209323
|
+
Readable6.from = function(iterable, opts) {
|
|
209486
209324
|
if (from === undefined) {
|
|
209487
209325
|
from = require_from();
|
|
209488
209326
|
}
|
|
209489
|
-
return from(
|
|
209327
|
+
return from(Readable6, iterable, opts);
|
|
209490
209328
|
};
|
|
209491
209329
|
}
|
|
209492
209330
|
function indexOf(xs8, x10) {
|
|
@@ -210564,6 +210402,168 @@ var require_multer = __commonJS((exports, module) => {
|
|
|
210564
210402
|
module.exports.MulterError = MulterError;
|
|
210565
210403
|
});
|
|
210566
210404
|
|
|
210405
|
+
// node_modules/lodash/isObject.js
|
|
210406
|
+
var require_isObject = __commonJS((exports, module) => {
|
|
210407
|
+
function isObject5(value) {
|
|
210408
|
+
var type = typeof value;
|
|
210409
|
+
return value != null && (type == "object" || type == "function");
|
|
210410
|
+
}
|
|
210411
|
+
module.exports = isObject5;
|
|
210412
|
+
});
|
|
210413
|
+
|
|
210414
|
+
// node_modules/lodash/now.js
|
|
210415
|
+
var require_now = __commonJS((exports, module) => {
|
|
210416
|
+
var root2 = require__root();
|
|
210417
|
+
var now = function() {
|
|
210418
|
+
return root2.Date.now();
|
|
210419
|
+
};
|
|
210420
|
+
module.exports = now;
|
|
210421
|
+
});
|
|
210422
|
+
|
|
210423
|
+
// node_modules/lodash/_trimmedEndIndex.js
|
|
210424
|
+
var require__trimmedEndIndex = __commonJS((exports, module) => {
|
|
210425
|
+
var reWhitespace = /\s/;
|
|
210426
|
+
function trimmedEndIndex(string4) {
|
|
210427
|
+
var index = string4.length;
|
|
210428
|
+
while (index-- && reWhitespace.test(string4.charAt(index))) {}
|
|
210429
|
+
return index;
|
|
210430
|
+
}
|
|
210431
|
+
module.exports = trimmedEndIndex;
|
|
210432
|
+
});
|
|
210433
|
+
|
|
210434
|
+
// node_modules/lodash/_baseTrim.js
|
|
210435
|
+
var require__baseTrim = __commonJS((exports, module) => {
|
|
210436
|
+
var trimmedEndIndex = require__trimmedEndIndex();
|
|
210437
|
+
var reTrimStart = /^\s+/;
|
|
210438
|
+
function baseTrim(string4) {
|
|
210439
|
+
return string4 ? string4.slice(0, trimmedEndIndex(string4) + 1).replace(reTrimStart, "") : string4;
|
|
210440
|
+
}
|
|
210441
|
+
module.exports = baseTrim;
|
|
210442
|
+
});
|
|
210443
|
+
|
|
210444
|
+
// node_modules/lodash/toNumber.js
|
|
210445
|
+
var require_toNumber = __commonJS((exports, module) => {
|
|
210446
|
+
var baseTrim = require__baseTrim();
|
|
210447
|
+
var isObject5 = require_isObject();
|
|
210448
|
+
var isSymbol = require_isSymbol();
|
|
210449
|
+
var NAN = 0 / 0;
|
|
210450
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
210451
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
210452
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
210453
|
+
var freeParseInt = parseInt;
|
|
210454
|
+
function toNumber(value) {
|
|
210455
|
+
if (typeof value == "number") {
|
|
210456
|
+
return value;
|
|
210457
|
+
}
|
|
210458
|
+
if (isSymbol(value)) {
|
|
210459
|
+
return NAN;
|
|
210460
|
+
}
|
|
210461
|
+
if (isObject5(value)) {
|
|
210462
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
210463
|
+
value = isObject5(other) ? other + "" : other;
|
|
210464
|
+
}
|
|
210465
|
+
if (typeof value != "string") {
|
|
210466
|
+
return value === 0 ? value : +value;
|
|
210467
|
+
}
|
|
210468
|
+
value = baseTrim(value);
|
|
210469
|
+
var isBinary = reIsBinary.test(value);
|
|
210470
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
210471
|
+
}
|
|
210472
|
+
module.exports = toNumber;
|
|
210473
|
+
});
|
|
210474
|
+
|
|
210475
|
+
// node_modules/lodash/debounce.js
|
|
210476
|
+
var require_debounce = __commonJS((exports, module) => {
|
|
210477
|
+
var isObject5 = require_isObject();
|
|
210478
|
+
var now = require_now();
|
|
210479
|
+
var toNumber = require_toNumber();
|
|
210480
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
210481
|
+
var nativeMax = Math.max;
|
|
210482
|
+
var nativeMin = Math.min;
|
|
210483
|
+
function debounce(func, wait, options8) {
|
|
210484
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
210485
|
+
if (typeof func != "function") {
|
|
210486
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
210487
|
+
}
|
|
210488
|
+
wait = toNumber(wait) || 0;
|
|
210489
|
+
if (isObject5(options8)) {
|
|
210490
|
+
leading = !!options8.leading;
|
|
210491
|
+
maxing = "maxWait" in options8;
|
|
210492
|
+
maxWait = maxing ? nativeMax(toNumber(options8.maxWait) || 0, wait) : maxWait;
|
|
210493
|
+
trailing = "trailing" in options8 ? !!options8.trailing : trailing;
|
|
210494
|
+
}
|
|
210495
|
+
function invokeFunc(time3) {
|
|
210496
|
+
var args = lastArgs, thisArg = lastThis;
|
|
210497
|
+
lastArgs = lastThis = undefined;
|
|
210498
|
+
lastInvokeTime = time3;
|
|
210499
|
+
result = func.apply(thisArg, args);
|
|
210500
|
+
return result;
|
|
210501
|
+
}
|
|
210502
|
+
function leadingEdge(time3) {
|
|
210503
|
+
lastInvokeTime = time3;
|
|
210504
|
+
timerId = setTimeout(timerExpired, wait);
|
|
210505
|
+
return leading ? invokeFunc(time3) : result;
|
|
210506
|
+
}
|
|
210507
|
+
function remainingWait(time3) {
|
|
210508
|
+
var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
210509
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
210510
|
+
}
|
|
210511
|
+
function shouldInvoke(time3) {
|
|
210512
|
+
var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime;
|
|
210513
|
+
return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
210514
|
+
}
|
|
210515
|
+
function timerExpired() {
|
|
210516
|
+
var time3 = now();
|
|
210517
|
+
if (shouldInvoke(time3)) {
|
|
210518
|
+
return trailingEdge(time3);
|
|
210519
|
+
}
|
|
210520
|
+
timerId = setTimeout(timerExpired, remainingWait(time3));
|
|
210521
|
+
}
|
|
210522
|
+
function trailingEdge(time3) {
|
|
210523
|
+
timerId = undefined;
|
|
210524
|
+
if (trailing && lastArgs) {
|
|
210525
|
+
return invokeFunc(time3);
|
|
210526
|
+
}
|
|
210527
|
+
lastArgs = lastThis = undefined;
|
|
210528
|
+
return result;
|
|
210529
|
+
}
|
|
210530
|
+
function cancel() {
|
|
210531
|
+
if (timerId !== undefined) {
|
|
210532
|
+
clearTimeout(timerId);
|
|
210533
|
+
}
|
|
210534
|
+
lastInvokeTime = 0;
|
|
210535
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
210536
|
+
}
|
|
210537
|
+
function flush() {
|
|
210538
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
210539
|
+
}
|
|
210540
|
+
function debounced() {
|
|
210541
|
+
var time3 = now(), isInvoking = shouldInvoke(time3);
|
|
210542
|
+
lastArgs = arguments;
|
|
210543
|
+
lastThis = this;
|
|
210544
|
+
lastCallTime = time3;
|
|
210545
|
+
if (isInvoking) {
|
|
210546
|
+
if (timerId === undefined) {
|
|
210547
|
+
return leadingEdge(lastCallTime);
|
|
210548
|
+
}
|
|
210549
|
+
if (maxing) {
|
|
210550
|
+
clearTimeout(timerId);
|
|
210551
|
+
timerId = setTimeout(timerExpired, wait);
|
|
210552
|
+
return invokeFunc(lastCallTime);
|
|
210553
|
+
}
|
|
210554
|
+
}
|
|
210555
|
+
if (timerId === undefined) {
|
|
210556
|
+
timerId = setTimeout(timerExpired, wait);
|
|
210557
|
+
}
|
|
210558
|
+
return result;
|
|
210559
|
+
}
|
|
210560
|
+
debounced.cancel = cancel;
|
|
210561
|
+
debounced.flush = flush;
|
|
210562
|
+
return debounced;
|
|
210563
|
+
}
|
|
210564
|
+
module.exports = debounce;
|
|
210565
|
+
});
|
|
210566
|
+
|
|
210567
210567
|
// node_modules/@vercel/detect-agent/dist/index.js
|
|
210568
210568
|
var require_dist5 = __commonJS((exports, module) => {
|
|
210569
210569
|
var __defProp4 = Object.defineProperty;
|
|
@@ -243860,7 +243860,7 @@ function getTypesCommand(context) {
|
|
|
243860
243860
|
}
|
|
243861
243861
|
|
|
243862
243862
|
// src/cli/dev/dev-server/main.ts
|
|
243863
|
-
import { dirname as dirname14 } from "node:path";
|
|
243863
|
+
import { dirname as dirname14, join as join18 } from "node:path";
|
|
243864
243864
|
var import_cors = __toESM(require_lib4(), 1);
|
|
243865
243865
|
var import_express4 = __toESM(require_express(), 1);
|
|
243866
243866
|
|
|
@@ -244068,6 +244068,10 @@ class FunctionManager {
|
|
|
244068
244068
|
try {
|
|
244069
244069
|
return await promise2;
|
|
244070
244070
|
} finally {
|
|
244071
|
+
if (!this.starting.has(name2) && this.running.has(name2)) {
|
|
244072
|
+
this.running.get(name2)?.process.kill();
|
|
244073
|
+
this.running.delete(name2);
|
|
244074
|
+
}
|
|
244071
244075
|
this.starting.delete(name2);
|
|
244072
244076
|
}
|
|
244073
244077
|
}
|
|
@@ -244234,8 +244238,359 @@ class Database {
|
|
|
244234
244238
|
}
|
|
244235
244239
|
}
|
|
244236
244240
|
|
|
244237
|
-
//
|
|
244238
|
-
|
|
244241
|
+
// node_modules/socket.io/wrapper.mjs
|
|
244242
|
+
var import_dist = __toESM(require_dist4(), 1);
|
|
244243
|
+
var { Server, Namespace, Socket } = import_dist.default;
|
|
244244
|
+
|
|
244245
|
+
// src/cli/dev/dev-server/realtime.ts
|
|
244246
|
+
function createRealtimeServer(httpServer) {
|
|
244247
|
+
const io6 = new Server(httpServer, {
|
|
244248
|
+
path: "/ws-user-apps/socket.io/",
|
|
244249
|
+
cors: {
|
|
244250
|
+
origin: /^http:\/\/localhost(:\d+)?$/,
|
|
244251
|
+
credentials: true
|
|
244252
|
+
},
|
|
244253
|
+
transports: ["websocket"]
|
|
244254
|
+
});
|
|
244255
|
+
io6.on("connection", (socket) => {
|
|
244256
|
+
socket.on("join", (room) => {
|
|
244257
|
+
socket.join(room);
|
|
244258
|
+
});
|
|
244259
|
+
socket.on("leave", (room) => {
|
|
244260
|
+
socket.leave(room);
|
|
244261
|
+
});
|
|
244262
|
+
});
|
|
244263
|
+
return io6;
|
|
244264
|
+
}
|
|
244265
|
+
function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
244266
|
+
const room = `entities:${appId}:${entityName}`;
|
|
244267
|
+
io6.to(room).emit("update_model", {
|
|
244268
|
+
room,
|
|
244269
|
+
data: JSON.stringify(event)
|
|
244270
|
+
});
|
|
244271
|
+
}
|
|
244272
|
+
|
|
244273
|
+
// src/cli/dev/dev-server/routes/entities.ts
|
|
244274
|
+
var import_express2 = __toESM(require_express(), 1);
|
|
244275
|
+
|
|
244276
|
+
// node_modules/nanoid/index.js
|
|
244277
|
+
import { webcrypto as crypto } from "node:crypto";
|
|
244278
|
+
|
|
244279
|
+
// node_modules/nanoid/url-alphabet/index.js
|
|
244280
|
+
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
244281
|
+
|
|
244282
|
+
// node_modules/nanoid/index.js
|
|
244283
|
+
var POOL_SIZE_MULTIPLIER = 128;
|
|
244284
|
+
var pool;
|
|
244285
|
+
var poolOffset;
|
|
244286
|
+
function fillPool(bytes) {
|
|
244287
|
+
if (!pool || pool.length < bytes) {
|
|
244288
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
244289
|
+
crypto.getRandomValues(pool);
|
|
244290
|
+
poolOffset = 0;
|
|
244291
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
244292
|
+
crypto.getRandomValues(pool);
|
|
244293
|
+
poolOffset = 0;
|
|
244294
|
+
}
|
|
244295
|
+
poolOffset += bytes;
|
|
244296
|
+
}
|
|
244297
|
+
function nanoid3(size = 21) {
|
|
244298
|
+
fillPool(size |= 0);
|
|
244299
|
+
let id2 = "";
|
|
244300
|
+
for (let i5 = poolOffset - size;i5 < poolOffset; i5++) {
|
|
244301
|
+
id2 += urlAlphabet[pool[i5] & 63];
|
|
244302
|
+
}
|
|
244303
|
+
return id2;
|
|
244304
|
+
}
|
|
244305
|
+
|
|
244306
|
+
// src/cli/dev/dev-server/routes/entities.ts
|
|
244307
|
+
function parseSort(sort) {
|
|
244308
|
+
if (!sort) {
|
|
244309
|
+
return;
|
|
244310
|
+
}
|
|
244311
|
+
if (sort.startsWith("-")) {
|
|
244312
|
+
return { [sort.slice(1)]: -1 };
|
|
244313
|
+
}
|
|
244314
|
+
return { [sort]: 1 };
|
|
244315
|
+
}
|
|
244316
|
+
function parseFields(fields) {
|
|
244317
|
+
if (!fields) {
|
|
244318
|
+
return;
|
|
244319
|
+
}
|
|
244320
|
+
const projection = {};
|
|
244321
|
+
for (const field of fields.split(",")) {
|
|
244322
|
+
const trimmed = field.trim();
|
|
244323
|
+
if (trimmed) {
|
|
244324
|
+
projection[trimmed] = 1;
|
|
244325
|
+
}
|
|
244326
|
+
}
|
|
244327
|
+
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
244328
|
+
}
|
|
244329
|
+
function stripInternalFields(doc2) {
|
|
244330
|
+
if (Array.isArray(doc2)) {
|
|
244331
|
+
return doc2.map((d5) => stripInternalFields(d5));
|
|
244332
|
+
}
|
|
244333
|
+
const { _id, ...rest } = doc2;
|
|
244334
|
+
return rest;
|
|
244335
|
+
}
|
|
244336
|
+
function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
244337
|
+
const router = import_express2.Router({ mergeParams: true });
|
|
244338
|
+
const parseBody = import_express2.json();
|
|
244339
|
+
function withCollection(handler) {
|
|
244340
|
+
return async (req, res) => {
|
|
244341
|
+
const collection = db2.getCollection(req.params.entityName);
|
|
244342
|
+
if (!collection) {
|
|
244343
|
+
res.status(404).json({ error: `Entity "${req.params.entityName}" not found` });
|
|
244344
|
+
return;
|
|
244345
|
+
}
|
|
244346
|
+
await handler(req, res, collection);
|
|
244347
|
+
};
|
|
244348
|
+
}
|
|
244349
|
+
function emit(appId, entityName, type, data) {
|
|
244350
|
+
const createData = (item) => ({
|
|
244351
|
+
type,
|
|
244352
|
+
data: item,
|
|
244353
|
+
id: item.id,
|
|
244354
|
+
timestamp: new Date().toISOString()
|
|
244355
|
+
});
|
|
244356
|
+
if (Array.isArray(data)) {
|
|
244357
|
+
for (const item of data) {
|
|
244358
|
+
broadcast(appId, entityName, createData(item));
|
|
244359
|
+
}
|
|
244360
|
+
return;
|
|
244361
|
+
}
|
|
244362
|
+
broadcast(appId, entityName, createData(data));
|
|
244363
|
+
}
|
|
244364
|
+
router.get("/User/:id", (req, res, next) => {
|
|
244365
|
+
logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
244366
|
+
req.url = req.originalUrl;
|
|
244367
|
+
remoteProxy(req, res, next);
|
|
244368
|
+
});
|
|
244369
|
+
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
244370
|
+
const { entityName, id: id2 } = req.params;
|
|
244371
|
+
try {
|
|
244372
|
+
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
244373
|
+
if (!doc2) {
|
|
244374
|
+
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
244375
|
+
return;
|
|
244376
|
+
}
|
|
244377
|
+
res.json(stripInternalFields(doc2));
|
|
244378
|
+
} catch (error48) {
|
|
244379
|
+
logger.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
244380
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244381
|
+
}
|
|
244382
|
+
}));
|
|
244383
|
+
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
244384
|
+
const { entityName } = req.params;
|
|
244385
|
+
try {
|
|
244386
|
+
const { sort, limit, skip: skip2, fields, q: q13 } = req.query;
|
|
244387
|
+
let query = {};
|
|
244388
|
+
if (q13 && typeof q13 === "string") {
|
|
244389
|
+
try {
|
|
244390
|
+
query = JSON.parse(q13);
|
|
244391
|
+
} catch {
|
|
244392
|
+
res.status(400).json({ error: "Invalid query parameter 'q'" });
|
|
244393
|
+
return;
|
|
244394
|
+
}
|
|
244395
|
+
}
|
|
244396
|
+
let cursor3 = collection.findAsync(query);
|
|
244397
|
+
const sortObj = parseSort(sort);
|
|
244398
|
+
if (sortObj) {
|
|
244399
|
+
cursor3 = cursor3.sort(sortObj);
|
|
244400
|
+
}
|
|
244401
|
+
if (skip2) {
|
|
244402
|
+
const skipNum = Number.parseInt(skip2, 10);
|
|
244403
|
+
if (!Number.isNaN(skipNum)) {
|
|
244404
|
+
cursor3 = cursor3.skip(skipNum);
|
|
244405
|
+
}
|
|
244406
|
+
}
|
|
244407
|
+
if (limit) {
|
|
244408
|
+
const limitNum = Number.parseInt(limit, 10);
|
|
244409
|
+
if (!Number.isNaN(limitNum)) {
|
|
244410
|
+
cursor3 = cursor3.limit(limitNum);
|
|
244411
|
+
}
|
|
244412
|
+
}
|
|
244413
|
+
const projection = parseFields(fields);
|
|
244414
|
+
if (projection) {
|
|
244415
|
+
cursor3 = cursor3.projection(projection);
|
|
244416
|
+
}
|
|
244417
|
+
const docs = await cursor3;
|
|
244418
|
+
res.json(stripInternalFields(docs));
|
|
244419
|
+
} catch (error48) {
|
|
244420
|
+
logger.error(`Error in GET /${entityName}:`, error48);
|
|
244421
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244422
|
+
}
|
|
244423
|
+
}));
|
|
244424
|
+
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
244425
|
+
const { appId, entityName } = req.params;
|
|
244426
|
+
try {
|
|
244427
|
+
const now = new Date().toISOString();
|
|
244428
|
+
const { _id, ...body } = req.body;
|
|
244429
|
+
const record2 = {
|
|
244430
|
+
...body,
|
|
244431
|
+
id: nanoid3(),
|
|
244432
|
+
created_date: now,
|
|
244433
|
+
updated_date: now
|
|
244434
|
+
};
|
|
244435
|
+
const inserted = stripInternalFields(await collection.insertAsync(record2));
|
|
244436
|
+
emit(appId, entityName, "create", inserted);
|
|
244437
|
+
res.status(201).json(inserted);
|
|
244438
|
+
} catch (error48) {
|
|
244439
|
+
logger.error(`Error in POST /${entityName}:`, error48);
|
|
244440
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244441
|
+
}
|
|
244442
|
+
}));
|
|
244443
|
+
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection) => {
|
|
244444
|
+
const { appId, entityName } = req.params;
|
|
244445
|
+
if (!Array.isArray(req.body)) {
|
|
244446
|
+
res.status(400).json({ error: "Request body must be an array" });
|
|
244447
|
+
return;
|
|
244448
|
+
}
|
|
244449
|
+
try {
|
|
244450
|
+
const now = new Date().toISOString();
|
|
244451
|
+
const records = req.body.map((item) => ({
|
|
244452
|
+
...item,
|
|
244453
|
+
id: nanoid3(),
|
|
244454
|
+
created_date: now,
|
|
244455
|
+
updated_date: now
|
|
244456
|
+
}));
|
|
244457
|
+
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
244458
|
+
emit(appId, entityName, "create", inserted);
|
|
244459
|
+
res.status(201).json(inserted);
|
|
244460
|
+
} catch (error48) {
|
|
244461
|
+
logger.error(`Error in POST /${entityName}/bulk:`, error48);
|
|
244462
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244463
|
+
}
|
|
244464
|
+
}));
|
|
244465
|
+
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection) => {
|
|
244466
|
+
const { appId, entityName, id: id2 } = req.params;
|
|
244467
|
+
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
244468
|
+
try {
|
|
244469
|
+
const updateData = {
|
|
244470
|
+
...body,
|
|
244471
|
+
updated_date: new Date().toISOString()
|
|
244472
|
+
};
|
|
244473
|
+
const result = await collection.updateAsync({ id: id2 }, { $set: updateData }, { returnUpdatedDocs: true });
|
|
244474
|
+
if (result.numAffected === 0 || !result.affectedDocuments) {
|
|
244475
|
+
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
244476
|
+
return;
|
|
244477
|
+
}
|
|
244478
|
+
const updated = stripInternalFields(result.affectedDocuments);
|
|
244479
|
+
emit(appId, entityName, "update", updated);
|
|
244480
|
+
res.json(updated);
|
|
244481
|
+
} catch (error48) {
|
|
244482
|
+
logger.error(`Error in PUT /${entityName}/${id2}:`, error48);
|
|
244483
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244484
|
+
}
|
|
244485
|
+
}));
|
|
244486
|
+
router.delete("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
244487
|
+
const { appId, entityName, id: id2 } = req.params;
|
|
244488
|
+
try {
|
|
244489
|
+
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
244490
|
+
const numRemoved = await collection.removeAsync({ id: id2 }, { multi: false });
|
|
244491
|
+
if (numRemoved === 0) {
|
|
244492
|
+
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
244493
|
+
return;
|
|
244494
|
+
}
|
|
244495
|
+
if (doc2) {
|
|
244496
|
+
emit(appId, entityName, "delete", stripInternalFields(doc2));
|
|
244497
|
+
}
|
|
244498
|
+
res.json({ success: true });
|
|
244499
|
+
} catch (error48) {
|
|
244500
|
+
logger.error(`Error in DELETE /${entityName}/${id2}:`, error48);
|
|
244501
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244502
|
+
}
|
|
244503
|
+
}));
|
|
244504
|
+
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
244505
|
+
const { entityName } = req.params;
|
|
244506
|
+
try {
|
|
244507
|
+
const query = req.body || {};
|
|
244508
|
+
const numRemoved = await collection.removeAsync(query, { multi: true });
|
|
244509
|
+
res.json({ success: true, deleted: numRemoved });
|
|
244510
|
+
} catch (error48) {
|
|
244511
|
+
logger.error(`Error in DELETE /${entityName}:`, error48);
|
|
244512
|
+
res.status(500).json({ error: "Internal server error" });
|
|
244513
|
+
}
|
|
244514
|
+
}));
|
|
244515
|
+
return router;
|
|
244516
|
+
}
|
|
244517
|
+
|
|
244518
|
+
// src/cli/dev/dev-server/routes/integrations.ts
|
|
244519
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
244520
|
+
var import_multer = __toESM(require_multer(), 1);
|
|
244521
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
244522
|
+
import fs28 from "node:fs";
|
|
244523
|
+
import path18 from "node:path";
|
|
244524
|
+
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
244525
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
244526
|
+
const parseBody = import_express3.json();
|
|
244527
|
+
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
244528
|
+
const storage = import_multer.default.diskStorage({
|
|
244529
|
+
destination: mediaFilesDir,
|
|
244530
|
+
filename: (_req, file2, cb2) => {
|
|
244531
|
+
const ext = path18.extname(file2.originalname);
|
|
244532
|
+
cb2(null, `${randomUUID2()}${ext}`);
|
|
244533
|
+
}
|
|
244534
|
+
});
|
|
244535
|
+
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
244536
|
+
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
244537
|
+
router.post("/Core/UploadFile", upload.single("file"), (req, res) => {
|
|
244538
|
+
if (!req.file) {
|
|
244539
|
+
res.status(400).json({ error: "No file uploaded" });
|
|
244540
|
+
return;
|
|
244541
|
+
}
|
|
244542
|
+
const file_url = `${baseUrl}/media/${req.file.filename}`;
|
|
244543
|
+
res.json({ file_url });
|
|
244544
|
+
});
|
|
244545
|
+
router.post("/Core/UploadPrivateFile", upload.single("file"), (req, res) => {
|
|
244546
|
+
if (!req.file) {
|
|
244547
|
+
res.status(400).json({ error: "No file uploaded" });
|
|
244548
|
+
return;
|
|
244549
|
+
}
|
|
244550
|
+
const file_uri = req.file.filename;
|
|
244551
|
+
res.json({ file_uri });
|
|
244552
|
+
});
|
|
244553
|
+
router.post("/Core/CreateFileSignedUrl", parseBody, (req, res) => {
|
|
244554
|
+
const { file_uri } = req.body;
|
|
244555
|
+
if (!file_uri) {
|
|
244556
|
+
res.status(400).json({ error: "file_uri is required" });
|
|
244557
|
+
return;
|
|
244558
|
+
}
|
|
244559
|
+
const signature = randomUUID2();
|
|
244560
|
+
const signed_url = `${baseUrl}/media/${file_uri}?signature=${signature}`;
|
|
244561
|
+
res.json({ signed_url });
|
|
244562
|
+
});
|
|
244563
|
+
router.post("/Core/:endpointName", (req, res, next) => {
|
|
244564
|
+
logger.warn(`Core.${req.params.endpointName} is not supported in local development`);
|
|
244565
|
+
req.url = req.originalUrl;
|
|
244566
|
+
remoteProxy(req, res, next);
|
|
244567
|
+
});
|
|
244568
|
+
router.post("/installable/:packageName/integration-endpoints/:endpointName", (req, res, next) => {
|
|
244569
|
+
logger.warn(`${req.params.packageName}.${req.params.endpointName} is not supported in local development`);
|
|
244570
|
+
req.url = req.originalUrl;
|
|
244571
|
+
remoteProxy(req, res, next);
|
|
244572
|
+
});
|
|
244573
|
+
router.use((err, _req, res, next) => {
|
|
244574
|
+
if (err instanceof import_multer.default.MulterError) {
|
|
244575
|
+
res.status(err.code === "LIMIT_FILE_SIZE" ? 413 : 400).json({ error: err.message });
|
|
244576
|
+
return;
|
|
244577
|
+
}
|
|
244578
|
+
next(err);
|
|
244579
|
+
});
|
|
244580
|
+
return router;
|
|
244581
|
+
}
|
|
244582
|
+
function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
244583
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
244584
|
+
router.post("/:slug/:operationId", (req, res, next) => {
|
|
244585
|
+
logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
244586
|
+
req.url = req.originalUrl;
|
|
244587
|
+
remoteProxy(req, res, next);
|
|
244588
|
+
});
|
|
244589
|
+
return router;
|
|
244590
|
+
}
|
|
244591
|
+
|
|
244592
|
+
// src/cli/dev/dev-server/watcher.ts
|
|
244593
|
+
import { relative as relative4 } from "node:path";
|
|
244239
244594
|
|
|
244240
244595
|
// node_modules/chokidar/index.js
|
|
244241
244596
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -244328,7 +244683,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
244328
244683
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
244329
244684
|
const statMethod = opts.lstat ? lstat2 : stat2;
|
|
244330
244685
|
if (wantBigintFsStats) {
|
|
244331
|
-
this._stat = (
|
|
244686
|
+
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
244332
244687
|
} else {
|
|
244333
244688
|
this._stat = statMethod;
|
|
244334
244689
|
}
|
|
@@ -244353,8 +244708,8 @@ class ReaddirpStream extends Readable6 {
|
|
|
244353
244708
|
const par = this.parent;
|
|
244354
244709
|
const fil = par && par.files;
|
|
244355
244710
|
if (fil && fil.length > 0) {
|
|
244356
|
-
const { path:
|
|
244357
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
244711
|
+
const { path: path19, depth } = par;
|
|
244712
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path19));
|
|
244358
244713
|
const awaited = await Promise.all(slice);
|
|
244359
244714
|
for (const entry of awaited) {
|
|
244360
244715
|
if (!entry)
|
|
@@ -244394,20 +244749,20 @@ class ReaddirpStream extends Readable6 {
|
|
|
244394
244749
|
this.reading = false;
|
|
244395
244750
|
}
|
|
244396
244751
|
}
|
|
244397
|
-
async _exploreDir(
|
|
244752
|
+
async _exploreDir(path19, depth) {
|
|
244398
244753
|
let files;
|
|
244399
244754
|
try {
|
|
244400
|
-
files = await readdir2(
|
|
244755
|
+
files = await readdir2(path19, this._rdOptions);
|
|
244401
244756
|
} catch (error48) {
|
|
244402
244757
|
this._onError(error48);
|
|
244403
244758
|
}
|
|
244404
|
-
return { files, depth, path:
|
|
244759
|
+
return { files, depth, path: path19 };
|
|
244405
244760
|
}
|
|
244406
|
-
async _formatEntry(dirent,
|
|
244761
|
+
async _formatEntry(dirent, path19) {
|
|
244407
244762
|
let entry;
|
|
244408
244763
|
const basename4 = this._isDirent ? dirent.name : dirent;
|
|
244409
244764
|
try {
|
|
244410
|
-
const fullPath = presolve(pjoin(
|
|
244765
|
+
const fullPath = presolve(pjoin(path19, basename4));
|
|
244411
244766
|
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
|
|
244412
244767
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
244413
244768
|
} catch (err) {
|
|
@@ -244806,16 +245161,16 @@ var delFromSet = (main, prop, item) => {
|
|
|
244806
245161
|
};
|
|
244807
245162
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
244808
245163
|
var FsWatchInstances = new Map;
|
|
244809
|
-
function createFsWatchInstance(
|
|
245164
|
+
function createFsWatchInstance(path19, options8, listener, errHandler, emitRaw) {
|
|
244810
245165
|
const handleEvent = (rawEvent, evPath) => {
|
|
244811
|
-
listener(
|
|
244812
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
244813
|
-
if (evPath &&
|
|
244814
|
-
fsWatchBroadcast(sp2.resolve(
|
|
245166
|
+
listener(path19);
|
|
245167
|
+
emitRaw(rawEvent, evPath, { watchedPath: path19 });
|
|
245168
|
+
if (evPath && path19 !== evPath) {
|
|
245169
|
+
fsWatchBroadcast(sp2.resolve(path19, evPath), KEY_LISTENERS, sp2.join(path19, evPath));
|
|
244815
245170
|
}
|
|
244816
245171
|
};
|
|
244817
245172
|
try {
|
|
244818
|
-
return fs_watch(
|
|
245173
|
+
return fs_watch(path19, {
|
|
244819
245174
|
persistent: options8.persistent
|
|
244820
245175
|
}, handleEvent);
|
|
244821
245176
|
} catch (error48) {
|
|
@@ -244831,12 +245186,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
|
244831
245186
|
listener(val1, val2, val3);
|
|
244832
245187
|
});
|
|
244833
245188
|
};
|
|
244834
|
-
var setFsWatchListener = (
|
|
245189
|
+
var setFsWatchListener = (path19, fullPath, options8, handlers) => {
|
|
244835
245190
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
244836
245191
|
let cont = FsWatchInstances.get(fullPath);
|
|
244837
245192
|
let watcher;
|
|
244838
245193
|
if (!options8.persistent) {
|
|
244839
|
-
watcher = createFsWatchInstance(
|
|
245194
|
+
watcher = createFsWatchInstance(path19, options8, listener, errHandler, rawEmitter);
|
|
244840
245195
|
if (!watcher)
|
|
244841
245196
|
return;
|
|
244842
245197
|
return watcher.close.bind(watcher);
|
|
@@ -244846,7 +245201,7 @@ var setFsWatchListener = (path18, fullPath, options8, handlers) => {
|
|
|
244846
245201
|
addAndConvert(cont, KEY_ERR, errHandler);
|
|
244847
245202
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
244848
245203
|
} else {
|
|
244849
|
-
watcher = createFsWatchInstance(
|
|
245204
|
+
watcher = createFsWatchInstance(path19, options8, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
|
|
244850
245205
|
if (!watcher)
|
|
244851
245206
|
return;
|
|
244852
245207
|
watcher.on(EV.ERROR, async (error48) => {
|
|
@@ -244855,7 +245210,7 @@ var setFsWatchListener = (path18, fullPath, options8, handlers) => {
|
|
|
244855
245210
|
cont.watcherUnusable = true;
|
|
244856
245211
|
if (isWindows4 && error48.code === "EPERM") {
|
|
244857
245212
|
try {
|
|
244858
|
-
const fd = await open2(
|
|
245213
|
+
const fd = await open2(path19, "r");
|
|
244859
245214
|
await fd.close();
|
|
244860
245215
|
broadcastErr(error48);
|
|
244861
245216
|
} catch (err) {}
|
|
@@ -244885,7 +245240,7 @@ var setFsWatchListener = (path18, fullPath, options8, handlers) => {
|
|
|
244885
245240
|
};
|
|
244886
245241
|
};
|
|
244887
245242
|
var FsWatchFileInstances = new Map;
|
|
244888
|
-
var setFsWatchFileListener = (
|
|
245243
|
+
var setFsWatchFileListener = (path19, fullPath, options8, handlers) => {
|
|
244889
245244
|
const { listener, rawEmitter } = handlers;
|
|
244890
245245
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
244891
245246
|
const copts = cont && cont.options;
|
|
@@ -244907,7 +245262,7 @@ var setFsWatchFileListener = (path18, fullPath, options8, handlers) => {
|
|
|
244907
245262
|
});
|
|
244908
245263
|
const currmtime = curr.mtimeMs;
|
|
244909
245264
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
244910
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
245265
|
+
foreach(cont.listeners, (listener2) => listener2(path19, curr));
|
|
244911
245266
|
}
|
|
244912
245267
|
})
|
|
244913
245268
|
};
|
|
@@ -244932,13 +245287,13 @@ class NodeFsHandler {
|
|
|
244932
245287
|
this.fsw = fsW;
|
|
244933
245288
|
this._boundHandleError = (error48) => fsW._handleError(error48);
|
|
244934
245289
|
}
|
|
244935
|
-
_watchWithNodeFs(
|
|
245290
|
+
_watchWithNodeFs(path19, listener) {
|
|
244936
245291
|
const opts = this.fsw.options;
|
|
244937
|
-
const directory = sp2.dirname(
|
|
244938
|
-
const basename5 = sp2.basename(
|
|
245292
|
+
const directory = sp2.dirname(path19);
|
|
245293
|
+
const basename5 = sp2.basename(path19);
|
|
244939
245294
|
const parent = this.fsw._getWatchedDir(directory);
|
|
244940
245295
|
parent.add(basename5);
|
|
244941
|
-
const absolutePath = sp2.resolve(
|
|
245296
|
+
const absolutePath = sp2.resolve(path19);
|
|
244942
245297
|
const options8 = {
|
|
244943
245298
|
persistent: opts.persistent
|
|
244944
245299
|
};
|
|
@@ -244948,12 +245303,12 @@ class NodeFsHandler {
|
|
|
244948
245303
|
if (opts.usePolling) {
|
|
244949
245304
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
244950
245305
|
options8.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
|
|
244951
|
-
closer = setFsWatchFileListener(
|
|
245306
|
+
closer = setFsWatchFileListener(path19, absolutePath, options8, {
|
|
244952
245307
|
listener,
|
|
244953
245308
|
rawEmitter: this.fsw._emitRaw
|
|
244954
245309
|
});
|
|
244955
245310
|
} else {
|
|
244956
|
-
closer = setFsWatchListener(
|
|
245311
|
+
closer = setFsWatchListener(path19, absolutePath, options8, {
|
|
244957
245312
|
listener,
|
|
244958
245313
|
errHandler: this._boundHandleError,
|
|
244959
245314
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -244971,7 +245326,7 @@ class NodeFsHandler {
|
|
|
244971
245326
|
let prevStats = stats;
|
|
244972
245327
|
if (parent.has(basename5))
|
|
244973
245328
|
return;
|
|
244974
|
-
const listener = async (
|
|
245329
|
+
const listener = async (path19, newStats) => {
|
|
244975
245330
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
244976
245331
|
return;
|
|
244977
245332
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -244985,11 +245340,11 @@ class NodeFsHandler {
|
|
|
244985
245340
|
this.fsw._emit(EV.CHANGE, file2, newStats2);
|
|
244986
245341
|
}
|
|
244987
245342
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
244988
|
-
this.fsw._closeFile(
|
|
245343
|
+
this.fsw._closeFile(path19);
|
|
244989
245344
|
prevStats = newStats2;
|
|
244990
245345
|
const closer2 = this._watchWithNodeFs(file2, listener);
|
|
244991
245346
|
if (closer2)
|
|
244992
|
-
this.fsw._addPathCloser(
|
|
245347
|
+
this.fsw._addPathCloser(path19, closer2);
|
|
244993
245348
|
} else {
|
|
244994
245349
|
prevStats = newStats2;
|
|
244995
245350
|
}
|
|
@@ -245013,7 +245368,7 @@ class NodeFsHandler {
|
|
|
245013
245368
|
}
|
|
245014
245369
|
return closer;
|
|
245015
245370
|
}
|
|
245016
|
-
async _handleSymlink(entry, directory,
|
|
245371
|
+
async _handleSymlink(entry, directory, path19, item) {
|
|
245017
245372
|
if (this.fsw.closed) {
|
|
245018
245373
|
return;
|
|
245019
245374
|
}
|
|
@@ -245023,7 +245378,7 @@ class NodeFsHandler {
|
|
|
245023
245378
|
this.fsw._incrReadyCount();
|
|
245024
245379
|
let linkPath;
|
|
245025
245380
|
try {
|
|
245026
|
-
linkPath = await fsrealpath(
|
|
245381
|
+
linkPath = await fsrealpath(path19);
|
|
245027
245382
|
} catch (e8) {
|
|
245028
245383
|
this.fsw._emitReady();
|
|
245029
245384
|
return true;
|
|
@@ -245033,12 +245388,12 @@ class NodeFsHandler {
|
|
|
245033
245388
|
if (dir.has(item)) {
|
|
245034
245389
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
245035
245390
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
245036
|
-
this.fsw._emit(EV.CHANGE,
|
|
245391
|
+
this.fsw._emit(EV.CHANGE, path19, entry.stats);
|
|
245037
245392
|
}
|
|
245038
245393
|
} else {
|
|
245039
245394
|
dir.add(item);
|
|
245040
245395
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
245041
|
-
this.fsw._emit(EV.ADD,
|
|
245396
|
+
this.fsw._emit(EV.ADD, path19, entry.stats);
|
|
245042
245397
|
}
|
|
245043
245398
|
this.fsw._emitReady();
|
|
245044
245399
|
return true;
|
|
@@ -245068,9 +245423,9 @@ class NodeFsHandler {
|
|
|
245068
245423
|
return;
|
|
245069
245424
|
}
|
|
245070
245425
|
const item = entry.path;
|
|
245071
|
-
let
|
|
245426
|
+
let path19 = sp2.join(directory, item);
|
|
245072
245427
|
current.add(item);
|
|
245073
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
245428
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path19, item)) {
|
|
245074
245429
|
return;
|
|
245075
245430
|
}
|
|
245076
245431
|
if (this.fsw.closed) {
|
|
@@ -245079,8 +245434,8 @@ class NodeFsHandler {
|
|
|
245079
245434
|
}
|
|
245080
245435
|
if (item === target || !target && !previous.has(item)) {
|
|
245081
245436
|
this.fsw._incrReadyCount();
|
|
245082
|
-
|
|
245083
|
-
this._addToNodeFs(
|
|
245437
|
+
path19 = sp2.join(dir, sp2.relative(dir, path19));
|
|
245438
|
+
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
245084
245439
|
}
|
|
245085
245440
|
}).on(EV.ERROR, this._boundHandleError);
|
|
245086
245441
|
return new Promise((resolve7, reject) => {
|
|
@@ -245129,13 +245484,13 @@ class NodeFsHandler {
|
|
|
245129
245484
|
}
|
|
245130
245485
|
return closer;
|
|
245131
245486
|
}
|
|
245132
|
-
async _addToNodeFs(
|
|
245487
|
+
async _addToNodeFs(path19, initialAdd, priorWh, depth, target) {
|
|
245133
245488
|
const ready = this.fsw._emitReady;
|
|
245134
|
-
if (this.fsw._isIgnored(
|
|
245489
|
+
if (this.fsw._isIgnored(path19) || this.fsw.closed) {
|
|
245135
245490
|
ready();
|
|
245136
245491
|
return false;
|
|
245137
245492
|
}
|
|
245138
|
-
const wh2 = this.fsw._getWatchHelpers(
|
|
245493
|
+
const wh2 = this.fsw._getWatchHelpers(path19);
|
|
245139
245494
|
if (priorWh) {
|
|
245140
245495
|
wh2.filterPath = (entry) => priorWh.filterPath(entry);
|
|
245141
245496
|
wh2.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -245151,8 +245506,8 @@ class NodeFsHandler {
|
|
|
245151
245506
|
const follow = this.fsw.options.followSymlinks;
|
|
245152
245507
|
let closer;
|
|
245153
245508
|
if (stats.isDirectory()) {
|
|
245154
|
-
const absPath = sp2.resolve(
|
|
245155
|
-
const targetPath = follow ? await fsrealpath(
|
|
245509
|
+
const absPath = sp2.resolve(path19);
|
|
245510
|
+
const targetPath = follow ? await fsrealpath(path19) : path19;
|
|
245156
245511
|
if (this.fsw.closed)
|
|
245157
245512
|
return;
|
|
245158
245513
|
closer = await this._handleDir(wh2.watchPath, stats, initialAdd, depth, target, wh2, targetPath);
|
|
@@ -245162,29 +245517,29 @@ class NodeFsHandler {
|
|
|
245162
245517
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
245163
245518
|
}
|
|
245164
245519
|
} else if (stats.isSymbolicLink()) {
|
|
245165
|
-
const targetPath = follow ? await fsrealpath(
|
|
245520
|
+
const targetPath = follow ? await fsrealpath(path19) : path19;
|
|
245166
245521
|
if (this.fsw.closed)
|
|
245167
245522
|
return;
|
|
245168
245523
|
const parent = sp2.dirname(wh2.watchPath);
|
|
245169
245524
|
this.fsw._getWatchedDir(parent).add(wh2.watchPath);
|
|
245170
245525
|
this.fsw._emit(EV.ADD, wh2.watchPath, stats);
|
|
245171
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
245526
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path19, wh2, targetPath);
|
|
245172
245527
|
if (this.fsw.closed)
|
|
245173
245528
|
return;
|
|
245174
245529
|
if (targetPath !== undefined) {
|
|
245175
|
-
this.fsw._symlinkPaths.set(sp2.resolve(
|
|
245530
|
+
this.fsw._symlinkPaths.set(sp2.resolve(path19), targetPath);
|
|
245176
245531
|
}
|
|
245177
245532
|
} else {
|
|
245178
245533
|
closer = this._handleFile(wh2.watchPath, stats, initialAdd);
|
|
245179
245534
|
}
|
|
245180
245535
|
ready();
|
|
245181
245536
|
if (closer)
|
|
245182
|
-
this.fsw._addPathCloser(
|
|
245537
|
+
this.fsw._addPathCloser(path19, closer);
|
|
245183
245538
|
return false;
|
|
245184
245539
|
} catch (error48) {
|
|
245185
245540
|
if (this.fsw._handleError(error48)) {
|
|
245186
245541
|
ready();
|
|
245187
|
-
return
|
|
245542
|
+
return path19;
|
|
245188
245543
|
}
|
|
245189
245544
|
}
|
|
245190
245545
|
}
|
|
@@ -245228,24 +245583,24 @@ function createPattern(matcher) {
|
|
|
245228
245583
|
}
|
|
245229
245584
|
return () => false;
|
|
245230
245585
|
}
|
|
245231
|
-
function normalizePath(
|
|
245232
|
-
if (typeof
|
|
245586
|
+
function normalizePath(path19) {
|
|
245587
|
+
if (typeof path19 !== "string")
|
|
245233
245588
|
throw new Error("string expected");
|
|
245234
|
-
|
|
245235
|
-
|
|
245589
|
+
path19 = sp3.normalize(path19);
|
|
245590
|
+
path19 = path19.replace(/\\/g, "/");
|
|
245236
245591
|
let prepend = false;
|
|
245237
|
-
if (
|
|
245592
|
+
if (path19.startsWith("//"))
|
|
245238
245593
|
prepend = true;
|
|
245239
|
-
|
|
245594
|
+
path19 = path19.replace(DOUBLE_SLASH_RE, "/");
|
|
245240
245595
|
if (prepend)
|
|
245241
|
-
|
|
245242
|
-
return
|
|
245596
|
+
path19 = "/" + path19;
|
|
245597
|
+
return path19;
|
|
245243
245598
|
}
|
|
245244
245599
|
function matchPatterns(patterns, testString, stats) {
|
|
245245
|
-
const
|
|
245600
|
+
const path19 = normalizePath(testString);
|
|
245246
245601
|
for (let index = 0;index < patterns.length; index++) {
|
|
245247
245602
|
const pattern = patterns[index];
|
|
245248
|
-
if (pattern(
|
|
245603
|
+
if (pattern(path19, stats)) {
|
|
245249
245604
|
return true;
|
|
245250
245605
|
}
|
|
245251
245606
|
}
|
|
@@ -245283,19 +245638,19 @@ var toUnix = (string4) => {
|
|
|
245283
245638
|
}
|
|
245284
245639
|
return str;
|
|
245285
245640
|
};
|
|
245286
|
-
var normalizePathToUnix = (
|
|
245287
|
-
var normalizeIgnored = (cwd = "") => (
|
|
245288
|
-
if (typeof
|
|
245289
|
-
return normalizePathToUnix(sp3.isAbsolute(
|
|
245641
|
+
var normalizePathToUnix = (path19) => toUnix(sp3.normalize(toUnix(path19)));
|
|
245642
|
+
var normalizeIgnored = (cwd = "") => (path19) => {
|
|
245643
|
+
if (typeof path19 === "string") {
|
|
245644
|
+
return normalizePathToUnix(sp3.isAbsolute(path19) ? path19 : sp3.join(cwd, path19));
|
|
245290
245645
|
} else {
|
|
245291
|
-
return
|
|
245646
|
+
return path19;
|
|
245292
245647
|
}
|
|
245293
245648
|
};
|
|
245294
|
-
var getAbsolutePath = (
|
|
245295
|
-
if (sp3.isAbsolute(
|
|
245296
|
-
return
|
|
245649
|
+
var getAbsolutePath = (path19, cwd) => {
|
|
245650
|
+
if (sp3.isAbsolute(path19)) {
|
|
245651
|
+
return path19;
|
|
245297
245652
|
}
|
|
245298
|
-
return sp3.join(cwd,
|
|
245653
|
+
return sp3.join(cwd, path19);
|
|
245299
245654
|
};
|
|
245300
245655
|
var EMPTY_SET = Object.freeze(new Set);
|
|
245301
245656
|
|
|
@@ -245362,10 +245717,10 @@ class WatchHelper {
|
|
|
245362
245717
|
dirParts;
|
|
245363
245718
|
followSymlinks;
|
|
245364
245719
|
statMethod;
|
|
245365
|
-
constructor(
|
|
245720
|
+
constructor(path19, follow, fsw) {
|
|
245366
245721
|
this.fsw = fsw;
|
|
245367
|
-
const watchPath =
|
|
245368
|
-
this.path =
|
|
245722
|
+
const watchPath = path19;
|
|
245723
|
+
this.path = path19 = path19.replace(REPLACER_RE, "");
|
|
245369
245724
|
this.watchPath = watchPath;
|
|
245370
245725
|
this.fullWatchPath = sp3.resolve(watchPath);
|
|
245371
245726
|
this.dirParts = [];
|
|
@@ -245496,20 +245851,20 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245496
245851
|
this._closePromise = undefined;
|
|
245497
245852
|
let paths = unifyPaths(paths_);
|
|
245498
245853
|
if (cwd) {
|
|
245499
|
-
paths = paths.map((
|
|
245500
|
-
const absPath = getAbsolutePath(
|
|
245854
|
+
paths = paths.map((path19) => {
|
|
245855
|
+
const absPath = getAbsolutePath(path19, cwd);
|
|
245501
245856
|
return absPath;
|
|
245502
245857
|
});
|
|
245503
245858
|
}
|
|
245504
|
-
paths.forEach((
|
|
245505
|
-
this._removeIgnoredPath(
|
|
245859
|
+
paths.forEach((path19) => {
|
|
245860
|
+
this._removeIgnoredPath(path19);
|
|
245506
245861
|
});
|
|
245507
245862
|
this._userIgnored = undefined;
|
|
245508
245863
|
if (!this._readyCount)
|
|
245509
245864
|
this._readyCount = 0;
|
|
245510
245865
|
this._readyCount += paths.length;
|
|
245511
|
-
Promise.all(paths.map(async (
|
|
245512
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
245866
|
+
Promise.all(paths.map(async (path19) => {
|
|
245867
|
+
const res = await this._nodeFsHandler._addToNodeFs(path19, !_internal, undefined, 0, _origAdd);
|
|
245513
245868
|
if (res)
|
|
245514
245869
|
this._emitReady();
|
|
245515
245870
|
return res;
|
|
@@ -245528,17 +245883,17 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245528
245883
|
return this;
|
|
245529
245884
|
const paths = unifyPaths(paths_);
|
|
245530
245885
|
const { cwd } = this.options;
|
|
245531
|
-
paths.forEach((
|
|
245532
|
-
if (!sp3.isAbsolute(
|
|
245886
|
+
paths.forEach((path19) => {
|
|
245887
|
+
if (!sp3.isAbsolute(path19) && !this._closers.has(path19)) {
|
|
245533
245888
|
if (cwd)
|
|
245534
|
-
|
|
245535
|
-
|
|
245889
|
+
path19 = sp3.join(cwd, path19);
|
|
245890
|
+
path19 = sp3.resolve(path19);
|
|
245536
245891
|
}
|
|
245537
|
-
this._closePath(
|
|
245538
|
-
this._addIgnoredPath(
|
|
245539
|
-
if (this._watched.has(
|
|
245892
|
+
this._closePath(path19);
|
|
245893
|
+
this._addIgnoredPath(path19);
|
|
245894
|
+
if (this._watched.has(path19)) {
|
|
245540
245895
|
this._addIgnoredPath({
|
|
245541
|
-
path:
|
|
245896
|
+
path: path19,
|
|
245542
245897
|
recursive: true
|
|
245543
245898
|
});
|
|
245544
245899
|
}
|
|
@@ -245587,38 +245942,38 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245587
245942
|
if (event !== EVENTS.ERROR)
|
|
245588
245943
|
this.emit(EVENTS.ALL, event, ...args);
|
|
245589
245944
|
}
|
|
245590
|
-
async _emit(event,
|
|
245945
|
+
async _emit(event, path19, stats) {
|
|
245591
245946
|
if (this.closed)
|
|
245592
245947
|
return;
|
|
245593
245948
|
const opts = this.options;
|
|
245594
245949
|
if (isWindows4)
|
|
245595
|
-
|
|
245950
|
+
path19 = sp3.normalize(path19);
|
|
245596
245951
|
if (opts.cwd)
|
|
245597
|
-
|
|
245598
|
-
const args = [
|
|
245952
|
+
path19 = sp3.relative(opts.cwd, path19);
|
|
245953
|
+
const args = [path19];
|
|
245599
245954
|
if (stats != null)
|
|
245600
245955
|
args.push(stats);
|
|
245601
245956
|
const awf = opts.awaitWriteFinish;
|
|
245602
245957
|
let pw;
|
|
245603
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
245958
|
+
if (awf && (pw = this._pendingWrites.get(path19))) {
|
|
245604
245959
|
pw.lastChange = new Date;
|
|
245605
245960
|
return this;
|
|
245606
245961
|
}
|
|
245607
245962
|
if (opts.atomic) {
|
|
245608
245963
|
if (event === EVENTS.UNLINK) {
|
|
245609
|
-
this._pendingUnlinks.set(
|
|
245964
|
+
this._pendingUnlinks.set(path19, [event, ...args]);
|
|
245610
245965
|
setTimeout(() => {
|
|
245611
|
-
this._pendingUnlinks.forEach((entry,
|
|
245966
|
+
this._pendingUnlinks.forEach((entry, path20) => {
|
|
245612
245967
|
this.emit(...entry);
|
|
245613
245968
|
this.emit(EVENTS.ALL, ...entry);
|
|
245614
|
-
this._pendingUnlinks.delete(
|
|
245969
|
+
this._pendingUnlinks.delete(path20);
|
|
245615
245970
|
});
|
|
245616
245971
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
245617
245972
|
return this;
|
|
245618
245973
|
}
|
|
245619
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
245974
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path19)) {
|
|
245620
245975
|
event = EVENTS.CHANGE;
|
|
245621
|
-
this._pendingUnlinks.delete(
|
|
245976
|
+
this._pendingUnlinks.delete(path19);
|
|
245622
245977
|
}
|
|
245623
245978
|
}
|
|
245624
245979
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -245636,16 +245991,16 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245636
245991
|
this.emitWithAll(event, args);
|
|
245637
245992
|
}
|
|
245638
245993
|
};
|
|
245639
|
-
this._awaitWriteFinish(
|
|
245994
|
+
this._awaitWriteFinish(path19, awf.stabilityThreshold, event, awfEmit);
|
|
245640
245995
|
return this;
|
|
245641
245996
|
}
|
|
245642
245997
|
if (event === EVENTS.CHANGE) {
|
|
245643
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
245998
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path19, 50);
|
|
245644
245999
|
if (isThrottled)
|
|
245645
246000
|
return this;
|
|
245646
246001
|
}
|
|
245647
246002
|
if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
245648
|
-
const fullPath = opts.cwd ? sp3.join(opts.cwd,
|
|
246003
|
+
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
245649
246004
|
let stats2;
|
|
245650
246005
|
try {
|
|
245651
246006
|
stats2 = await stat4(fullPath);
|
|
@@ -245664,23 +246019,23 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245664
246019
|
}
|
|
245665
246020
|
return error48 || this.closed;
|
|
245666
246021
|
}
|
|
245667
|
-
_throttle(actionType,
|
|
246022
|
+
_throttle(actionType, path19, timeout3) {
|
|
245668
246023
|
if (!this._throttled.has(actionType)) {
|
|
245669
246024
|
this._throttled.set(actionType, new Map);
|
|
245670
246025
|
}
|
|
245671
246026
|
const action = this._throttled.get(actionType);
|
|
245672
246027
|
if (!action)
|
|
245673
246028
|
throw new Error("invalid throttle");
|
|
245674
|
-
const actionPath = action.get(
|
|
246029
|
+
const actionPath = action.get(path19);
|
|
245675
246030
|
if (actionPath) {
|
|
245676
246031
|
actionPath.count++;
|
|
245677
246032
|
return false;
|
|
245678
246033
|
}
|
|
245679
246034
|
let timeoutObject;
|
|
245680
246035
|
const clear = () => {
|
|
245681
|
-
const item = action.get(
|
|
246036
|
+
const item = action.get(path19);
|
|
245682
246037
|
const count2 = item ? item.count : 0;
|
|
245683
|
-
action.delete(
|
|
246038
|
+
action.delete(path19);
|
|
245684
246039
|
clearTimeout(timeoutObject);
|
|
245685
246040
|
if (item)
|
|
245686
246041
|
clearTimeout(item.timeoutObject);
|
|
@@ -245688,50 +246043,50 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245688
246043
|
};
|
|
245689
246044
|
timeoutObject = setTimeout(clear, timeout3);
|
|
245690
246045
|
const thr = { timeoutObject, clear, count: 0 };
|
|
245691
|
-
action.set(
|
|
246046
|
+
action.set(path19, thr);
|
|
245692
246047
|
return thr;
|
|
245693
246048
|
}
|
|
245694
246049
|
_incrReadyCount() {
|
|
245695
246050
|
return this._readyCount++;
|
|
245696
246051
|
}
|
|
245697
|
-
_awaitWriteFinish(
|
|
246052
|
+
_awaitWriteFinish(path19, threshold, event, awfEmit) {
|
|
245698
246053
|
const awf = this.options.awaitWriteFinish;
|
|
245699
246054
|
if (typeof awf !== "object")
|
|
245700
246055
|
return;
|
|
245701
246056
|
const pollInterval = awf.pollInterval;
|
|
245702
246057
|
let timeoutHandler;
|
|
245703
|
-
let fullPath =
|
|
245704
|
-
if (this.options.cwd && !sp3.isAbsolute(
|
|
245705
|
-
fullPath = sp3.join(this.options.cwd,
|
|
246058
|
+
let fullPath = path19;
|
|
246059
|
+
if (this.options.cwd && !sp3.isAbsolute(path19)) {
|
|
246060
|
+
fullPath = sp3.join(this.options.cwd, path19);
|
|
245706
246061
|
}
|
|
245707
246062
|
const now = new Date;
|
|
245708
246063
|
const writes = this._pendingWrites;
|
|
245709
246064
|
function awaitWriteFinishFn(prevStat) {
|
|
245710
246065
|
statcb(fullPath, (err, curStat) => {
|
|
245711
|
-
if (err || !writes.has(
|
|
246066
|
+
if (err || !writes.has(path19)) {
|
|
245712
246067
|
if (err && err.code !== "ENOENT")
|
|
245713
246068
|
awfEmit(err);
|
|
245714
246069
|
return;
|
|
245715
246070
|
}
|
|
245716
246071
|
const now2 = Number(new Date);
|
|
245717
246072
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
245718
|
-
writes.get(
|
|
246073
|
+
writes.get(path19).lastChange = now2;
|
|
245719
246074
|
}
|
|
245720
|
-
const pw = writes.get(
|
|
246075
|
+
const pw = writes.get(path19);
|
|
245721
246076
|
const df3 = now2 - pw.lastChange;
|
|
245722
246077
|
if (df3 >= threshold) {
|
|
245723
|
-
writes.delete(
|
|
246078
|
+
writes.delete(path19);
|
|
245724
246079
|
awfEmit(undefined, curStat);
|
|
245725
246080
|
} else {
|
|
245726
246081
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
245727
246082
|
}
|
|
245728
246083
|
});
|
|
245729
246084
|
}
|
|
245730
|
-
if (!writes.has(
|
|
245731
|
-
writes.set(
|
|
246085
|
+
if (!writes.has(path19)) {
|
|
246086
|
+
writes.set(path19, {
|
|
245732
246087
|
lastChange: now,
|
|
245733
246088
|
cancelWait: () => {
|
|
245734
|
-
writes.delete(
|
|
246089
|
+
writes.delete(path19);
|
|
245735
246090
|
clearTimeout(timeoutHandler);
|
|
245736
246091
|
return event;
|
|
245737
246092
|
}
|
|
@@ -245739,8 +246094,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245739
246094
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
|
|
245740
246095
|
}
|
|
245741
246096
|
}
|
|
245742
|
-
_isIgnored(
|
|
245743
|
-
if (this.options.atomic && DOT_RE.test(
|
|
246097
|
+
_isIgnored(path19, stats) {
|
|
246098
|
+
if (this.options.atomic && DOT_RE.test(path19))
|
|
245744
246099
|
return true;
|
|
245745
246100
|
if (!this._userIgnored) {
|
|
245746
246101
|
const { cwd } = this.options;
|
|
@@ -245750,13 +246105,13 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245750
246105
|
const list3 = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
245751
246106
|
this._userIgnored = anymatch(list3, undefined);
|
|
245752
246107
|
}
|
|
245753
|
-
return this._userIgnored(
|
|
246108
|
+
return this._userIgnored(path19, stats);
|
|
245754
246109
|
}
|
|
245755
|
-
_isntIgnored(
|
|
245756
|
-
return !this._isIgnored(
|
|
246110
|
+
_isntIgnored(path19, stat5) {
|
|
246111
|
+
return !this._isIgnored(path19, stat5);
|
|
245757
246112
|
}
|
|
245758
|
-
_getWatchHelpers(
|
|
245759
|
-
return new WatchHelper(
|
|
246113
|
+
_getWatchHelpers(path19) {
|
|
246114
|
+
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
245760
246115
|
}
|
|
245761
246116
|
_getWatchedDir(directory) {
|
|
245762
246117
|
const dir = sp3.resolve(directory);
|
|
@@ -245770,57 +246125,57 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245770
246125
|
return Boolean(Number(stats.mode) & 256);
|
|
245771
246126
|
}
|
|
245772
246127
|
_remove(directory, item, isDirectory3) {
|
|
245773
|
-
const
|
|
245774
|
-
const fullPath = sp3.resolve(
|
|
245775
|
-
isDirectory3 = isDirectory3 != null ? isDirectory3 : this._watched.has(
|
|
245776
|
-
if (!this._throttle("remove",
|
|
246128
|
+
const path19 = sp3.join(directory, item);
|
|
246129
|
+
const fullPath = sp3.resolve(path19);
|
|
246130
|
+
isDirectory3 = isDirectory3 != null ? isDirectory3 : this._watched.has(path19) || this._watched.has(fullPath);
|
|
246131
|
+
if (!this._throttle("remove", path19, 100))
|
|
245777
246132
|
return;
|
|
245778
246133
|
if (!isDirectory3 && this._watched.size === 1) {
|
|
245779
246134
|
this.add(directory, item, true);
|
|
245780
246135
|
}
|
|
245781
|
-
const wp5 = this._getWatchedDir(
|
|
246136
|
+
const wp5 = this._getWatchedDir(path19);
|
|
245782
246137
|
const nestedDirectoryChildren = wp5.getChildren();
|
|
245783
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
246138
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path19, nested));
|
|
245784
246139
|
const parent = this._getWatchedDir(directory);
|
|
245785
246140
|
const wasTracked = parent.has(item);
|
|
245786
246141
|
parent.remove(item);
|
|
245787
246142
|
if (this._symlinkPaths.has(fullPath)) {
|
|
245788
246143
|
this._symlinkPaths.delete(fullPath);
|
|
245789
246144
|
}
|
|
245790
|
-
let relPath =
|
|
246145
|
+
let relPath = path19;
|
|
245791
246146
|
if (this.options.cwd)
|
|
245792
|
-
relPath = sp3.relative(this.options.cwd,
|
|
246147
|
+
relPath = sp3.relative(this.options.cwd, path19);
|
|
245793
246148
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
245794
246149
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
245795
246150
|
if (event === EVENTS.ADD)
|
|
245796
246151
|
return;
|
|
245797
246152
|
}
|
|
245798
|
-
this._watched.delete(
|
|
246153
|
+
this._watched.delete(path19);
|
|
245799
246154
|
this._watched.delete(fullPath);
|
|
245800
246155
|
const eventName = isDirectory3 ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
245801
|
-
if (wasTracked && !this._isIgnored(
|
|
245802
|
-
this._emit(eventName,
|
|
245803
|
-
this._closePath(
|
|
246156
|
+
if (wasTracked && !this._isIgnored(path19))
|
|
246157
|
+
this._emit(eventName, path19);
|
|
246158
|
+
this._closePath(path19);
|
|
245804
246159
|
}
|
|
245805
|
-
_closePath(
|
|
245806
|
-
this._closeFile(
|
|
245807
|
-
const dir = sp3.dirname(
|
|
245808
|
-
this._getWatchedDir(dir).remove(sp3.basename(
|
|
246160
|
+
_closePath(path19) {
|
|
246161
|
+
this._closeFile(path19);
|
|
246162
|
+
const dir = sp3.dirname(path19);
|
|
246163
|
+
this._getWatchedDir(dir).remove(sp3.basename(path19));
|
|
245809
246164
|
}
|
|
245810
|
-
_closeFile(
|
|
245811
|
-
const closers = this._closers.get(
|
|
246165
|
+
_closeFile(path19) {
|
|
246166
|
+
const closers = this._closers.get(path19);
|
|
245812
246167
|
if (!closers)
|
|
245813
246168
|
return;
|
|
245814
246169
|
closers.forEach((closer) => closer());
|
|
245815
|
-
this._closers.delete(
|
|
246170
|
+
this._closers.delete(path19);
|
|
245816
246171
|
}
|
|
245817
|
-
_addPathCloser(
|
|
246172
|
+
_addPathCloser(path19, closer) {
|
|
245818
246173
|
if (!closer)
|
|
245819
246174
|
return;
|
|
245820
|
-
let list3 = this._closers.get(
|
|
246175
|
+
let list3 = this._closers.get(path19);
|
|
245821
246176
|
if (!list3) {
|
|
245822
246177
|
list3 = [];
|
|
245823
|
-
this._closers.set(
|
|
246178
|
+
this._closers.set(path19, list3);
|
|
245824
246179
|
}
|
|
245825
246180
|
list3.push(closer);
|
|
245826
246181
|
}
|
|
@@ -245848,402 +246203,91 @@ function watch(paths, options8 = {}) {
|
|
|
245848
246203
|
return watcher;
|
|
245849
246204
|
}
|
|
245850
246205
|
|
|
245851
|
-
// src/cli/dev/dev-server/
|
|
246206
|
+
// src/cli/dev/dev-server/watcher.ts
|
|
245852
246207
|
var import_debounce = __toESM(require_debounce(), 1);
|
|
245853
246208
|
var WATCH_DEBOUNCE_MS = 300;
|
|
246209
|
+
var WATCH_QUEUE_DELAY_MS = 500;
|
|
245854
246210
|
|
|
245855
|
-
class
|
|
245856
|
-
|
|
246211
|
+
class WatchBase44 {
|
|
246212
|
+
itemsToWatch;
|
|
245857
246213
|
onChange;
|
|
245858
246214
|
logger;
|
|
245859
|
-
|
|
245860
|
-
|
|
245861
|
-
|
|
246215
|
+
watchers = [];
|
|
246216
|
+
queueWaitForCreation = [];
|
|
246217
|
+
queueWaitForCreationTimeout = null;
|
|
246218
|
+
constructor(itemsToWatch, onChange, logger) {
|
|
246219
|
+
this.itemsToWatch = itemsToWatch;
|
|
245862
246220
|
this.onChange = onChange;
|
|
245863
246221
|
this.logger = logger;
|
|
245864
246222
|
}
|
|
245865
246223
|
async start() {
|
|
245866
|
-
if (this.
|
|
246224
|
+
if (this.watchers.length > 0 || this.queueWaitForCreation.length > 0) {
|
|
245867
246225
|
return;
|
|
245868
246226
|
}
|
|
245869
|
-
|
|
245870
|
-
|
|
246227
|
+
for (const item of this.itemsToWatch) {
|
|
246228
|
+
if (await pathExists(item.path)) {
|
|
246229
|
+
this.watchers.push(this.watchTarget(item));
|
|
246230
|
+
} else {
|
|
246231
|
+
this.queueWaitForCreation.push(item);
|
|
246232
|
+
}
|
|
245871
246233
|
}
|
|
246234
|
+
this.watchCreationQueue();
|
|
245872
246235
|
}
|
|
245873
246236
|
async close() {
|
|
245874
|
-
|
|
245875
|
-
|
|
245876
|
-
|
|
245877
|
-
getSubfolder(path18) {
|
|
245878
|
-
const rel = relative4(this.configDir, path18);
|
|
245879
|
-
if (!rel || rel === ".")
|
|
245880
|
-
return;
|
|
245881
|
-
return rel.split(sep)[0];
|
|
245882
|
-
}
|
|
245883
|
-
watchTarget() {
|
|
245884
|
-
const handler = import_debounce.default(async (_event, path18) => {
|
|
245885
|
-
const subfolder = this.getSubfolder(path18);
|
|
245886
|
-
await this.onChange(subfolder);
|
|
245887
|
-
}, WATCH_DEBOUNCE_MS);
|
|
245888
|
-
this.watcher = watch(this.configDir, {
|
|
245889
|
-
ignoreInitial: true
|
|
245890
|
-
});
|
|
245891
|
-
this.watcher.on("all", handler);
|
|
245892
|
-
this.watcher.on("error", (err) => {
|
|
245893
|
-
this.logger.error(`[dev-server] Watch handler failed for ${this.configDir}`, err instanceof Error ? err : undefined);
|
|
245894
|
-
});
|
|
245895
|
-
}
|
|
245896
|
-
}
|
|
245897
|
-
|
|
245898
|
-
// node_modules/socket.io/wrapper.mjs
|
|
245899
|
-
var import_dist = __toESM(require_dist4(), 1);
|
|
245900
|
-
var { Server, Namespace, Socket } = import_dist.default;
|
|
245901
|
-
|
|
245902
|
-
// src/cli/dev/dev-server/realtime.ts
|
|
245903
|
-
function createRealtimeServer(httpServer) {
|
|
245904
|
-
const io6 = new Server(httpServer, {
|
|
245905
|
-
path: "/ws-user-apps/socket.io/",
|
|
245906
|
-
cors: {
|
|
245907
|
-
origin: /^http:\/\/localhost(:\d+)?$/,
|
|
245908
|
-
credentials: true
|
|
245909
|
-
},
|
|
245910
|
-
transports: ["websocket"]
|
|
245911
|
-
});
|
|
245912
|
-
io6.on("connection", (socket) => {
|
|
245913
|
-
socket.on("join", (room) => {
|
|
245914
|
-
socket.join(room);
|
|
245915
|
-
});
|
|
245916
|
-
socket.on("leave", (room) => {
|
|
245917
|
-
socket.leave(room);
|
|
245918
|
-
});
|
|
245919
|
-
});
|
|
245920
|
-
return io6;
|
|
245921
|
-
}
|
|
245922
|
-
function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
245923
|
-
const room = `entities:${appId}:${entityName}`;
|
|
245924
|
-
io6.to(room).emit("update_model", {
|
|
245925
|
-
room,
|
|
245926
|
-
data: JSON.stringify(event)
|
|
245927
|
-
});
|
|
245928
|
-
}
|
|
245929
|
-
|
|
245930
|
-
// src/cli/dev/dev-server/routes/entities.ts
|
|
245931
|
-
var import_express2 = __toESM(require_express(), 1);
|
|
245932
|
-
|
|
245933
|
-
// node_modules/nanoid/index.js
|
|
245934
|
-
import { webcrypto as crypto } from "node:crypto";
|
|
245935
|
-
|
|
245936
|
-
// node_modules/nanoid/url-alphabet/index.js
|
|
245937
|
-
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
245938
|
-
|
|
245939
|
-
// node_modules/nanoid/index.js
|
|
245940
|
-
var POOL_SIZE_MULTIPLIER = 128;
|
|
245941
|
-
var pool;
|
|
245942
|
-
var poolOffset;
|
|
245943
|
-
function fillPool(bytes) {
|
|
245944
|
-
if (!pool || pool.length < bytes) {
|
|
245945
|
-
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
245946
|
-
crypto.getRandomValues(pool);
|
|
245947
|
-
poolOffset = 0;
|
|
245948
|
-
} else if (poolOffset + bytes > pool.length) {
|
|
245949
|
-
crypto.getRandomValues(pool);
|
|
245950
|
-
poolOffset = 0;
|
|
245951
|
-
}
|
|
245952
|
-
poolOffset += bytes;
|
|
245953
|
-
}
|
|
245954
|
-
function nanoid3(size = 21) {
|
|
245955
|
-
fillPool(size |= 0);
|
|
245956
|
-
let id2 = "";
|
|
245957
|
-
for (let i5 = poolOffset - size;i5 < poolOffset; i5++) {
|
|
245958
|
-
id2 += urlAlphabet[pool[i5] & 63];
|
|
245959
|
-
}
|
|
245960
|
-
return id2;
|
|
245961
|
-
}
|
|
245962
|
-
|
|
245963
|
-
// src/cli/dev/dev-server/routes/entities.ts
|
|
245964
|
-
function parseSort(sort) {
|
|
245965
|
-
if (!sort) {
|
|
245966
|
-
return;
|
|
245967
|
-
}
|
|
245968
|
-
if (sort.startsWith("-")) {
|
|
245969
|
-
return { [sort.slice(1)]: -1 };
|
|
245970
|
-
}
|
|
245971
|
-
return { [sort]: 1 };
|
|
245972
|
-
}
|
|
245973
|
-
function parseFields(fields) {
|
|
245974
|
-
if (!fields) {
|
|
245975
|
-
return;
|
|
245976
|
-
}
|
|
245977
|
-
const projection = {};
|
|
245978
|
-
for (const field of fields.split(",")) {
|
|
245979
|
-
const trimmed = field.trim();
|
|
245980
|
-
if (trimmed) {
|
|
245981
|
-
projection[trimmed] = 1;
|
|
246237
|
+
if (this.queueWaitForCreationTimeout) {
|
|
246238
|
+
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246239
|
+
this.queueWaitForCreationTimeout = null;
|
|
245982
246240
|
}
|
|
245983
|
-
|
|
245984
|
-
|
|
245985
|
-
}
|
|
245986
|
-
function stripInternalFields(doc2) {
|
|
245987
|
-
if (Array.isArray(doc2)) {
|
|
245988
|
-
return doc2.map((d5) => stripInternalFields(d5));
|
|
245989
|
-
}
|
|
245990
|
-
const { _id, ...rest } = doc2;
|
|
245991
|
-
return rest;
|
|
245992
|
-
}
|
|
245993
|
-
function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
245994
|
-
const router = import_express2.Router({ mergeParams: true });
|
|
245995
|
-
const parseBody = import_express2.json();
|
|
245996
|
-
function withCollection(handler) {
|
|
245997
|
-
return async (req, res) => {
|
|
245998
|
-
const collection = db2.getCollection(req.params.entityName);
|
|
245999
|
-
if (!collection) {
|
|
246000
|
-
res.status(404).json({ error: `Entity "${req.params.entityName}" not found` });
|
|
246001
|
-
return;
|
|
246002
|
-
}
|
|
246003
|
-
await handler(req, res, collection);
|
|
246004
|
-
};
|
|
246005
|
-
}
|
|
246006
|
-
function emit(appId, entityName, type, data) {
|
|
246007
|
-
const createData = (item) => ({
|
|
246008
|
-
type,
|
|
246009
|
-
data: item,
|
|
246010
|
-
id: item.id,
|
|
246011
|
-
timestamp: new Date().toISOString()
|
|
246012
|
-
});
|
|
246013
|
-
if (Array.isArray(data)) {
|
|
246014
|
-
for (const item of data) {
|
|
246015
|
-
broadcast(appId, entityName, createData(item));
|
|
246016
|
-
}
|
|
246017
|
-
return;
|
|
246241
|
+
for (const watcher of this.watchers) {
|
|
246242
|
+
await watcher.close();
|
|
246018
246243
|
}
|
|
246019
|
-
|
|
246244
|
+
this.watchers = [];
|
|
246245
|
+
this.queueWaitForCreation = [];
|
|
246020
246246
|
}
|
|
246021
|
-
|
|
246022
|
-
|
|
246023
|
-
|
|
246024
|
-
remoteProxy(req, res, next);
|
|
246025
|
-
});
|
|
246026
|
-
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
246027
|
-
const { entityName, id: id2 } = req.params;
|
|
246028
|
-
try {
|
|
246029
|
-
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
246030
|
-
if (!doc2) {
|
|
246031
|
-
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
246032
|
-
return;
|
|
246033
|
-
}
|
|
246034
|
-
res.json(stripInternalFields(doc2));
|
|
246035
|
-
} catch (error48) {
|
|
246036
|
-
logger.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
246037
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246247
|
+
watchCreationQueue() {
|
|
246248
|
+
if (this.queueWaitForCreationTimeout) {
|
|
246249
|
+
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246038
246250
|
}
|
|
246039
|
-
|
|
246040
|
-
|
|
246041
|
-
|
|
246042
|
-
|
|
246043
|
-
|
|
246044
|
-
|
|
246045
|
-
if (q13 && typeof q13 === "string") {
|
|
246046
|
-
try {
|
|
246047
|
-
query = JSON.parse(q13);
|
|
246048
|
-
} catch {
|
|
246049
|
-
res.status(400).json({ error: "Invalid query parameter 'q'" });
|
|
246050
|
-
return;
|
|
246251
|
+
this.queueWaitForCreationTimeout = setTimeout(async () => {
|
|
246252
|
+
const toRemove = [];
|
|
246253
|
+
for (const entry of this.queueWaitForCreation) {
|
|
246254
|
+
if (await pathExists(entry.path)) {
|
|
246255
|
+
this.watchers.push(this.watchTarget(entry));
|
|
246256
|
+
toRemove.push(entry);
|
|
246051
246257
|
}
|
|
246052
246258
|
}
|
|
246053
|
-
|
|
246054
|
-
|
|
246055
|
-
|
|
246056
|
-
|
|
246057
|
-
|
|
246058
|
-
if (skip2) {
|
|
246059
|
-
const skipNum = Number.parseInt(skip2, 10);
|
|
246060
|
-
if (!Number.isNaN(skipNum)) {
|
|
246061
|
-
cursor3 = cursor3.skip(skipNum);
|
|
246062
|
-
}
|
|
246063
|
-
}
|
|
246064
|
-
if (limit) {
|
|
246065
|
-
const limitNum = Number.parseInt(limit, 10);
|
|
246066
|
-
if (!Number.isNaN(limitNum)) {
|
|
246067
|
-
cursor3 = cursor3.limit(limitNum);
|
|
246068
|
-
}
|
|
246069
|
-
}
|
|
246070
|
-
const projection = parseFields(fields);
|
|
246071
|
-
if (projection) {
|
|
246072
|
-
cursor3 = cursor3.projection(projection);
|
|
246073
|
-
}
|
|
246074
|
-
const docs = await cursor3;
|
|
246075
|
-
res.json(stripInternalFields(docs));
|
|
246076
|
-
} catch (error48) {
|
|
246077
|
-
logger.error(`Error in GET /${entityName}:`, error48);
|
|
246078
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246079
|
-
}
|
|
246080
|
-
}));
|
|
246081
|
-
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
246082
|
-
const { appId, entityName } = req.params;
|
|
246083
|
-
try {
|
|
246084
|
-
const now = new Date().toISOString();
|
|
246085
|
-
const { _id, ...body } = req.body;
|
|
246086
|
-
const record2 = {
|
|
246087
|
-
...body,
|
|
246088
|
-
id: nanoid3(),
|
|
246089
|
-
created_date: now,
|
|
246090
|
-
updated_date: now
|
|
246091
|
-
};
|
|
246092
|
-
const inserted = stripInternalFields(await collection.insertAsync(record2));
|
|
246093
|
-
emit(appId, entityName, "create", inserted);
|
|
246094
|
-
res.status(201).json(inserted);
|
|
246095
|
-
} catch (error48) {
|
|
246096
|
-
logger.error(`Error in POST /${entityName}:`, error48);
|
|
246097
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246098
|
-
}
|
|
246099
|
-
}));
|
|
246100
|
-
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection) => {
|
|
246101
|
-
const { appId, entityName } = req.params;
|
|
246102
|
-
if (!Array.isArray(req.body)) {
|
|
246103
|
-
res.status(400).json({ error: "Request body must be an array" });
|
|
246104
|
-
return;
|
|
246105
|
-
}
|
|
246106
|
-
try {
|
|
246107
|
-
const now = new Date().toISOString();
|
|
246108
|
-
const records = req.body.map((item) => ({
|
|
246109
|
-
...item,
|
|
246110
|
-
id: nanoid3(),
|
|
246111
|
-
created_date: now,
|
|
246112
|
-
updated_date: now
|
|
246113
|
-
}));
|
|
246114
|
-
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
246115
|
-
emit(appId, entityName, "create", inserted);
|
|
246116
|
-
res.status(201).json(inserted);
|
|
246117
|
-
} catch (error48) {
|
|
246118
|
-
logger.error(`Error in POST /${entityName}/bulk:`, error48);
|
|
246119
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246120
|
-
}
|
|
246121
|
-
}));
|
|
246122
|
-
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection) => {
|
|
246123
|
-
const { appId, entityName, id: id2 } = req.params;
|
|
246124
|
-
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
246125
|
-
try {
|
|
246126
|
-
const updateData = {
|
|
246127
|
-
...body,
|
|
246128
|
-
updated_date: new Date().toISOString()
|
|
246129
|
-
};
|
|
246130
|
-
const result = await collection.updateAsync({ id: id2 }, { $set: updateData }, { returnUpdatedDocs: true });
|
|
246131
|
-
if (result.numAffected === 0 || !result.affectedDocuments) {
|
|
246132
|
-
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
246133
|
-
return;
|
|
246259
|
+
this.queueWaitForCreation = this.queueWaitForCreation.filter((entry) => !toRemove.includes(entry));
|
|
246260
|
+
if (this.queueWaitForCreation.length > 0) {
|
|
246261
|
+
this.watchCreationQueue();
|
|
246262
|
+
} else {
|
|
246263
|
+
this.queueWaitForCreationTimeout = null;
|
|
246134
246264
|
}
|
|
246135
|
-
|
|
246136
|
-
|
|
246137
|
-
|
|
246138
|
-
|
|
246139
|
-
|
|
246140
|
-
|
|
246141
|
-
|
|
246142
|
-
|
|
246143
|
-
|
|
246144
|
-
|
|
246145
|
-
|
|
246146
|
-
|
|
246147
|
-
const numRemoved = await collection.removeAsync({ id: id2 }, { multi: false });
|
|
246148
|
-
if (numRemoved === 0) {
|
|
246149
|
-
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
246265
|
+
}, WATCH_QUEUE_DELAY_MS);
|
|
246266
|
+
}
|
|
246267
|
+
watchTarget(item) {
|
|
246268
|
+
const handler = import_debounce.default(async (_event, path19) => {
|
|
246269
|
+
await this.onChange(item.name, relative4(item.path, path19));
|
|
246270
|
+
}, WATCH_DEBOUNCE_MS);
|
|
246271
|
+
const watcher = watch(item.path, {
|
|
246272
|
+
ignoreInitial: true
|
|
246273
|
+
});
|
|
246274
|
+
watcher.on("all", handler);
|
|
246275
|
+
watcher.on("unlinkDir", async (deletedPath) => {
|
|
246276
|
+
if (deletedPath !== item.path) {
|
|
246150
246277
|
return;
|
|
246151
246278
|
}
|
|
246152
|
-
|
|
246153
|
-
|
|
246154
|
-
|
|
246155
|
-
|
|
246156
|
-
|
|
246157
|
-
|
|
246158
|
-
|
|
246159
|
-
|
|
246160
|
-
|
|
246161
|
-
|
|
246162
|
-
|
|
246163
|
-
|
|
246164
|
-
const query = req.body || {};
|
|
246165
|
-
const numRemoved = await collection.removeAsync(query, { multi: true });
|
|
246166
|
-
res.json({ success: true, deleted: numRemoved });
|
|
246167
|
-
} catch (error48) {
|
|
246168
|
-
logger.error(`Error in DELETE /${entityName}:`, error48);
|
|
246169
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246170
|
-
}
|
|
246171
|
-
}));
|
|
246172
|
-
return router;
|
|
246173
|
-
}
|
|
246174
|
-
|
|
246175
|
-
// src/cli/dev/dev-server/routes/integrations.ts
|
|
246176
|
-
var import_express3 = __toESM(require_express(), 1);
|
|
246177
|
-
var import_multer = __toESM(require_multer(), 1);
|
|
246178
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
246179
|
-
import fs28 from "node:fs";
|
|
246180
|
-
import path18 from "node:path";
|
|
246181
|
-
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
246182
|
-
const router = import_express3.Router({ mergeParams: true });
|
|
246183
|
-
const parseBody = import_express3.json();
|
|
246184
|
-
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
246185
|
-
const storage = import_multer.default.diskStorage({
|
|
246186
|
-
destination: mediaFilesDir,
|
|
246187
|
-
filename: (_req, file2, cb2) => {
|
|
246188
|
-
const ext = path18.extname(file2.originalname);
|
|
246189
|
-
cb2(null, `${randomUUID2()}${ext}`);
|
|
246190
|
-
}
|
|
246191
|
-
});
|
|
246192
|
-
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
246193
|
-
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
246194
|
-
router.post("/Core/UploadFile", upload.single("file"), (req, res) => {
|
|
246195
|
-
if (!req.file) {
|
|
246196
|
-
res.status(400).json({ error: "No file uploaded" });
|
|
246197
|
-
return;
|
|
246198
|
-
}
|
|
246199
|
-
const file_url = `${baseUrl}/media/${req.file.filename}`;
|
|
246200
|
-
res.json({ file_url });
|
|
246201
|
-
});
|
|
246202
|
-
router.post("/Core/UploadPrivateFile", upload.single("file"), (req, res) => {
|
|
246203
|
-
if (!req.file) {
|
|
246204
|
-
res.status(400).json({ error: "No file uploaded" });
|
|
246205
|
-
return;
|
|
246206
|
-
}
|
|
246207
|
-
const file_uri = req.file.filename;
|
|
246208
|
-
res.json({ file_uri });
|
|
246209
|
-
});
|
|
246210
|
-
router.post("/Core/CreateFileSignedUrl", parseBody, (req, res) => {
|
|
246211
|
-
const { file_uri } = req.body;
|
|
246212
|
-
if (!file_uri) {
|
|
246213
|
-
res.status(400).json({ error: "file_uri is required" });
|
|
246214
|
-
return;
|
|
246215
|
-
}
|
|
246216
|
-
const signature = randomUUID2();
|
|
246217
|
-
const signed_url = `${baseUrl}/media/${file_uri}?signature=${signature}`;
|
|
246218
|
-
res.json({ signed_url });
|
|
246219
|
-
});
|
|
246220
|
-
router.post("/Core/:endpointName", (req, res, next) => {
|
|
246221
|
-
logger.warn(`Core.${req.params.endpointName} is not supported in local development`);
|
|
246222
|
-
req.url = req.originalUrl;
|
|
246223
|
-
remoteProxy(req, res, next);
|
|
246224
|
-
});
|
|
246225
|
-
router.post("/installable/:packageName/integration-endpoints/:endpointName", (req, res, next) => {
|
|
246226
|
-
logger.warn(`${req.params.packageName}.${req.params.endpointName} is not supported in local development`);
|
|
246227
|
-
req.url = req.originalUrl;
|
|
246228
|
-
remoteProxy(req, res, next);
|
|
246229
|
-
});
|
|
246230
|
-
router.use((err, _req, res, next) => {
|
|
246231
|
-
if (err instanceof import_multer.default.MulterError) {
|
|
246232
|
-
res.status(err.code === "LIMIT_FILE_SIZE" ? 413 : 400).json({ error: err.message });
|
|
246233
|
-
return;
|
|
246234
|
-
}
|
|
246235
|
-
next(err);
|
|
246236
|
-
});
|
|
246237
|
-
return router;
|
|
246238
|
-
}
|
|
246239
|
-
function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
246240
|
-
const router = import_express3.Router({ mergeParams: true });
|
|
246241
|
-
router.post("/:slug/:operationId", (req, res, next) => {
|
|
246242
|
-
logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
246243
|
-
req.url = req.originalUrl;
|
|
246244
|
-
remoteProxy(req, res, next);
|
|
246245
|
-
});
|
|
246246
|
-
return router;
|
|
246279
|
+
await watcher.close();
|
|
246280
|
+
this.queueWaitForCreation.push(item);
|
|
246281
|
+
this.watchCreationQueue();
|
|
246282
|
+
setTimeout(() => {
|
|
246283
|
+
this.watchers = this.watchers.filter((watcher2) => !watcher2.closed);
|
|
246284
|
+
});
|
|
246285
|
+
});
|
|
246286
|
+
watcher.on("error", (err) => {
|
|
246287
|
+
this.logger.error(`[dev-server] Watch handler failed for ${item.path}`, err instanceof Error ? err : undefined);
|
|
246288
|
+
});
|
|
246289
|
+
return watcher;
|
|
246290
|
+
}
|
|
246247
246291
|
}
|
|
246248
246292
|
|
|
246249
246293
|
// src/cli/dev/dev-server/main.ts
|
|
@@ -246312,9 +246356,13 @@ async function createDevServer(options8) {
|
|
|
246312
246356
|
emitEntityEvent = (appId, entityName, event) => {
|
|
246313
246357
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246314
246358
|
};
|
|
246315
|
-
const
|
|
246316
|
-
|
|
246317
|
-
|
|
246359
|
+
const base44ConfigWatcher = new WatchBase44([
|
|
246360
|
+
{
|
|
246361
|
+
name: "functions",
|
|
246362
|
+
path: join18(dirname14(project2.configPath), project2.functionsDir)
|
|
246363
|
+
}
|
|
246364
|
+
], async (name2) => {
|
|
246365
|
+
if (name2 === "functions") {
|
|
246318
246366
|
const { functions: functions2 } = await options8.loadResources();
|
|
246319
246367
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
246320
246368
|
functionManager.reload(functions2);
|
|
@@ -246484,7 +246532,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
246484
246532
|
import { release, type } from "node:os";
|
|
246485
246533
|
|
|
246486
246534
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
246487
|
-
import { dirname as dirname15, posix, sep
|
|
246535
|
+
import { dirname as dirname15, posix, sep } from "path";
|
|
246488
246536
|
function createModulerModifier() {
|
|
246489
246537
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
246490
246538
|
return async (frames) => {
|
|
@@ -246493,7 +246541,7 @@ function createModulerModifier() {
|
|
|
246493
246541
|
return frames;
|
|
246494
246542
|
};
|
|
246495
246543
|
}
|
|
246496
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 =
|
|
246544
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
246497
246545
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
246498
246546
|
return (filename) => {
|
|
246499
246547
|
if (!filename)
|
|
@@ -250711,4 +250759,4 @@ export {
|
|
|
250711
250759
|
CLIExitError
|
|
250712
250760
|
};
|
|
250713
250761
|
|
|
250714
|
-
//# debugId=
|
|
250762
|
+
//# debugId=36CCDF1FA5999E6D64756E2164756E21
|