@base44-preview/cli 0.0.36-pr.353.0dd351f → 0.0.36-pr.353.1448b47
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 +822 -794
- package/dist/cli/index.js.map +14 -14
- 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
|
|
|
@@ -244238,8 +244238,359 @@ class Database {
|
|
|
244238
244238
|
}
|
|
244239
244239
|
}
|
|
244240
244240
|
|
|
244241
|
-
//
|
|
244242
|
-
|
|
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 { basename as basename6, normalize as normalize2, relative as relative4 } from "node:path";
|
|
244243
244594
|
|
|
244244
244595
|
// node_modules/chokidar/index.js
|
|
244245
244596
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -244332,7 +244683,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
244332
244683
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
244333
244684
|
const statMethod = opts.lstat ? lstat2 : stat2;
|
|
244334
244685
|
if (wantBigintFsStats) {
|
|
244335
|
-
this._stat = (
|
|
244686
|
+
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
244336
244687
|
} else {
|
|
244337
244688
|
this._stat = statMethod;
|
|
244338
244689
|
}
|
|
@@ -244357,8 +244708,8 @@ class ReaddirpStream extends Readable6 {
|
|
|
244357
244708
|
const par = this.parent;
|
|
244358
244709
|
const fil = par && par.files;
|
|
244359
244710
|
if (fil && fil.length > 0) {
|
|
244360
|
-
const { path:
|
|
244361
|
-
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));
|
|
244362
244713
|
const awaited = await Promise.all(slice);
|
|
244363
244714
|
for (const entry of awaited) {
|
|
244364
244715
|
if (!entry)
|
|
@@ -244398,20 +244749,20 @@ class ReaddirpStream extends Readable6 {
|
|
|
244398
244749
|
this.reading = false;
|
|
244399
244750
|
}
|
|
244400
244751
|
}
|
|
244401
|
-
async _exploreDir(
|
|
244752
|
+
async _exploreDir(path19, depth) {
|
|
244402
244753
|
let files;
|
|
244403
244754
|
try {
|
|
244404
|
-
files = await readdir2(
|
|
244755
|
+
files = await readdir2(path19, this._rdOptions);
|
|
244405
244756
|
} catch (error48) {
|
|
244406
244757
|
this._onError(error48);
|
|
244407
244758
|
}
|
|
244408
|
-
return { files, depth, path:
|
|
244759
|
+
return { files, depth, path: path19 };
|
|
244409
244760
|
}
|
|
244410
|
-
async _formatEntry(dirent,
|
|
244761
|
+
async _formatEntry(dirent, path19) {
|
|
244411
244762
|
let entry;
|
|
244412
244763
|
const basename4 = this._isDirent ? dirent.name : dirent;
|
|
244413
244764
|
try {
|
|
244414
|
-
const fullPath = presolve(pjoin(
|
|
244765
|
+
const fullPath = presolve(pjoin(path19, basename4));
|
|
244415
244766
|
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
|
|
244416
244767
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
244417
244768
|
} catch (err) {
|
|
@@ -244810,16 +245161,16 @@ var delFromSet = (main, prop, item) => {
|
|
|
244810
245161
|
};
|
|
244811
245162
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
244812
245163
|
var FsWatchInstances = new Map;
|
|
244813
|
-
function createFsWatchInstance(
|
|
245164
|
+
function createFsWatchInstance(path19, options8, listener, errHandler, emitRaw) {
|
|
244814
245165
|
const handleEvent = (rawEvent, evPath) => {
|
|
244815
|
-
listener(
|
|
244816
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
244817
|
-
if (evPath &&
|
|
244818
|
-
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));
|
|
244819
245170
|
}
|
|
244820
245171
|
};
|
|
244821
245172
|
try {
|
|
244822
|
-
return fs_watch(
|
|
245173
|
+
return fs_watch(path19, {
|
|
244823
245174
|
persistent: options8.persistent
|
|
244824
245175
|
}, handleEvent);
|
|
244825
245176
|
} catch (error48) {
|
|
@@ -244835,12 +245186,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
|
244835
245186
|
listener(val1, val2, val3);
|
|
244836
245187
|
});
|
|
244837
245188
|
};
|
|
244838
|
-
var setFsWatchListener = (
|
|
245189
|
+
var setFsWatchListener = (path19, fullPath, options8, handlers) => {
|
|
244839
245190
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
244840
245191
|
let cont = FsWatchInstances.get(fullPath);
|
|
244841
245192
|
let watcher;
|
|
244842
245193
|
if (!options8.persistent) {
|
|
244843
|
-
watcher = createFsWatchInstance(
|
|
245194
|
+
watcher = createFsWatchInstance(path19, options8, listener, errHandler, rawEmitter);
|
|
244844
245195
|
if (!watcher)
|
|
244845
245196
|
return;
|
|
244846
245197
|
return watcher.close.bind(watcher);
|
|
@@ -244850,7 +245201,7 @@ var setFsWatchListener = (path18, fullPath, options8, handlers) => {
|
|
|
244850
245201
|
addAndConvert(cont, KEY_ERR, errHandler);
|
|
244851
245202
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
244852
245203
|
} else {
|
|
244853
|
-
watcher = createFsWatchInstance(
|
|
245204
|
+
watcher = createFsWatchInstance(path19, options8, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
|
|
244854
245205
|
if (!watcher)
|
|
244855
245206
|
return;
|
|
244856
245207
|
watcher.on(EV.ERROR, async (error48) => {
|
|
@@ -244859,7 +245210,7 @@ var setFsWatchListener = (path18, fullPath, options8, handlers) => {
|
|
|
244859
245210
|
cont.watcherUnusable = true;
|
|
244860
245211
|
if (isWindows4 && error48.code === "EPERM") {
|
|
244861
245212
|
try {
|
|
244862
|
-
const fd = await open2(
|
|
245213
|
+
const fd = await open2(path19, "r");
|
|
244863
245214
|
await fd.close();
|
|
244864
245215
|
broadcastErr(error48);
|
|
244865
245216
|
} catch (err) {}
|
|
@@ -244889,7 +245240,7 @@ var setFsWatchListener = (path18, fullPath, options8, handlers) => {
|
|
|
244889
245240
|
};
|
|
244890
245241
|
};
|
|
244891
245242
|
var FsWatchFileInstances = new Map;
|
|
244892
|
-
var setFsWatchFileListener = (
|
|
245243
|
+
var setFsWatchFileListener = (path19, fullPath, options8, handlers) => {
|
|
244893
245244
|
const { listener, rawEmitter } = handlers;
|
|
244894
245245
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
244895
245246
|
const copts = cont && cont.options;
|
|
@@ -244911,7 +245262,7 @@ var setFsWatchFileListener = (path18, fullPath, options8, handlers) => {
|
|
|
244911
245262
|
});
|
|
244912
245263
|
const currmtime = curr.mtimeMs;
|
|
244913
245264
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
244914
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
245265
|
+
foreach(cont.listeners, (listener2) => listener2(path19, curr));
|
|
244915
245266
|
}
|
|
244916
245267
|
})
|
|
244917
245268
|
};
|
|
@@ -244936,13 +245287,13 @@ class NodeFsHandler {
|
|
|
244936
245287
|
this.fsw = fsW;
|
|
244937
245288
|
this._boundHandleError = (error48) => fsW._handleError(error48);
|
|
244938
245289
|
}
|
|
244939
|
-
_watchWithNodeFs(
|
|
245290
|
+
_watchWithNodeFs(path19, listener) {
|
|
244940
245291
|
const opts = this.fsw.options;
|
|
244941
|
-
const directory = sp2.dirname(
|
|
244942
|
-
const basename5 = sp2.basename(
|
|
245292
|
+
const directory = sp2.dirname(path19);
|
|
245293
|
+
const basename5 = sp2.basename(path19);
|
|
244943
245294
|
const parent = this.fsw._getWatchedDir(directory);
|
|
244944
245295
|
parent.add(basename5);
|
|
244945
|
-
const absolutePath = sp2.resolve(
|
|
245296
|
+
const absolutePath = sp2.resolve(path19);
|
|
244946
245297
|
const options8 = {
|
|
244947
245298
|
persistent: opts.persistent
|
|
244948
245299
|
};
|
|
@@ -244952,12 +245303,12 @@ class NodeFsHandler {
|
|
|
244952
245303
|
if (opts.usePolling) {
|
|
244953
245304
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
244954
245305
|
options8.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
|
|
244955
|
-
closer = setFsWatchFileListener(
|
|
245306
|
+
closer = setFsWatchFileListener(path19, absolutePath, options8, {
|
|
244956
245307
|
listener,
|
|
244957
245308
|
rawEmitter: this.fsw._emitRaw
|
|
244958
245309
|
});
|
|
244959
245310
|
} else {
|
|
244960
|
-
closer = setFsWatchListener(
|
|
245311
|
+
closer = setFsWatchListener(path19, absolutePath, options8, {
|
|
244961
245312
|
listener,
|
|
244962
245313
|
errHandler: this._boundHandleError,
|
|
244963
245314
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -244975,7 +245326,7 @@ class NodeFsHandler {
|
|
|
244975
245326
|
let prevStats = stats;
|
|
244976
245327
|
if (parent.has(basename5))
|
|
244977
245328
|
return;
|
|
244978
|
-
const listener = async (
|
|
245329
|
+
const listener = async (path19, newStats) => {
|
|
244979
245330
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
244980
245331
|
return;
|
|
244981
245332
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -244989,11 +245340,11 @@ class NodeFsHandler {
|
|
|
244989
245340
|
this.fsw._emit(EV.CHANGE, file2, newStats2);
|
|
244990
245341
|
}
|
|
244991
245342
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
244992
|
-
this.fsw._closeFile(
|
|
245343
|
+
this.fsw._closeFile(path19);
|
|
244993
245344
|
prevStats = newStats2;
|
|
244994
245345
|
const closer2 = this._watchWithNodeFs(file2, listener);
|
|
244995
245346
|
if (closer2)
|
|
244996
|
-
this.fsw._addPathCloser(
|
|
245347
|
+
this.fsw._addPathCloser(path19, closer2);
|
|
244997
245348
|
} else {
|
|
244998
245349
|
prevStats = newStats2;
|
|
244999
245350
|
}
|
|
@@ -245017,7 +245368,7 @@ class NodeFsHandler {
|
|
|
245017
245368
|
}
|
|
245018
245369
|
return closer;
|
|
245019
245370
|
}
|
|
245020
|
-
async _handleSymlink(entry, directory,
|
|
245371
|
+
async _handleSymlink(entry, directory, path19, item) {
|
|
245021
245372
|
if (this.fsw.closed) {
|
|
245022
245373
|
return;
|
|
245023
245374
|
}
|
|
@@ -245027,7 +245378,7 @@ class NodeFsHandler {
|
|
|
245027
245378
|
this.fsw._incrReadyCount();
|
|
245028
245379
|
let linkPath;
|
|
245029
245380
|
try {
|
|
245030
|
-
linkPath = await fsrealpath(
|
|
245381
|
+
linkPath = await fsrealpath(path19);
|
|
245031
245382
|
} catch (e8) {
|
|
245032
245383
|
this.fsw._emitReady();
|
|
245033
245384
|
return true;
|
|
@@ -245037,12 +245388,12 @@ class NodeFsHandler {
|
|
|
245037
245388
|
if (dir.has(item)) {
|
|
245038
245389
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
245039
245390
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
245040
|
-
this.fsw._emit(EV.CHANGE,
|
|
245391
|
+
this.fsw._emit(EV.CHANGE, path19, entry.stats);
|
|
245041
245392
|
}
|
|
245042
245393
|
} else {
|
|
245043
245394
|
dir.add(item);
|
|
245044
245395
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
245045
|
-
this.fsw._emit(EV.ADD,
|
|
245396
|
+
this.fsw._emit(EV.ADD, path19, entry.stats);
|
|
245046
245397
|
}
|
|
245047
245398
|
this.fsw._emitReady();
|
|
245048
245399
|
return true;
|
|
@@ -245072,9 +245423,9 @@ class NodeFsHandler {
|
|
|
245072
245423
|
return;
|
|
245073
245424
|
}
|
|
245074
245425
|
const item = entry.path;
|
|
245075
|
-
let
|
|
245426
|
+
let path19 = sp2.join(directory, item);
|
|
245076
245427
|
current.add(item);
|
|
245077
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
245428
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path19, item)) {
|
|
245078
245429
|
return;
|
|
245079
245430
|
}
|
|
245080
245431
|
if (this.fsw.closed) {
|
|
@@ -245083,8 +245434,8 @@ class NodeFsHandler {
|
|
|
245083
245434
|
}
|
|
245084
245435
|
if (item === target || !target && !previous.has(item)) {
|
|
245085
245436
|
this.fsw._incrReadyCount();
|
|
245086
|
-
|
|
245087
|
-
this._addToNodeFs(
|
|
245437
|
+
path19 = sp2.join(dir, sp2.relative(dir, path19));
|
|
245438
|
+
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
245088
245439
|
}
|
|
245089
245440
|
}).on(EV.ERROR, this._boundHandleError);
|
|
245090
245441
|
return new Promise((resolve7, reject) => {
|
|
@@ -245133,13 +245484,13 @@ class NodeFsHandler {
|
|
|
245133
245484
|
}
|
|
245134
245485
|
return closer;
|
|
245135
245486
|
}
|
|
245136
|
-
async _addToNodeFs(
|
|
245487
|
+
async _addToNodeFs(path19, initialAdd, priorWh, depth, target) {
|
|
245137
245488
|
const ready = this.fsw._emitReady;
|
|
245138
|
-
if (this.fsw._isIgnored(
|
|
245489
|
+
if (this.fsw._isIgnored(path19) || this.fsw.closed) {
|
|
245139
245490
|
ready();
|
|
245140
245491
|
return false;
|
|
245141
245492
|
}
|
|
245142
|
-
const wh2 = this.fsw._getWatchHelpers(
|
|
245493
|
+
const wh2 = this.fsw._getWatchHelpers(path19);
|
|
245143
245494
|
if (priorWh) {
|
|
245144
245495
|
wh2.filterPath = (entry) => priorWh.filterPath(entry);
|
|
245145
245496
|
wh2.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -245155,8 +245506,8 @@ class NodeFsHandler {
|
|
|
245155
245506
|
const follow = this.fsw.options.followSymlinks;
|
|
245156
245507
|
let closer;
|
|
245157
245508
|
if (stats.isDirectory()) {
|
|
245158
|
-
const absPath = sp2.resolve(
|
|
245159
|
-
const targetPath = follow ? await fsrealpath(
|
|
245509
|
+
const absPath = sp2.resolve(path19);
|
|
245510
|
+
const targetPath = follow ? await fsrealpath(path19) : path19;
|
|
245160
245511
|
if (this.fsw.closed)
|
|
245161
245512
|
return;
|
|
245162
245513
|
closer = await this._handleDir(wh2.watchPath, stats, initialAdd, depth, target, wh2, targetPath);
|
|
@@ -245166,29 +245517,29 @@ class NodeFsHandler {
|
|
|
245166
245517
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
245167
245518
|
}
|
|
245168
245519
|
} else if (stats.isSymbolicLink()) {
|
|
245169
|
-
const targetPath = follow ? await fsrealpath(
|
|
245520
|
+
const targetPath = follow ? await fsrealpath(path19) : path19;
|
|
245170
245521
|
if (this.fsw.closed)
|
|
245171
245522
|
return;
|
|
245172
245523
|
const parent = sp2.dirname(wh2.watchPath);
|
|
245173
245524
|
this.fsw._getWatchedDir(parent).add(wh2.watchPath);
|
|
245174
245525
|
this.fsw._emit(EV.ADD, wh2.watchPath, stats);
|
|
245175
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
245526
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path19, wh2, targetPath);
|
|
245176
245527
|
if (this.fsw.closed)
|
|
245177
245528
|
return;
|
|
245178
245529
|
if (targetPath !== undefined) {
|
|
245179
|
-
this.fsw._symlinkPaths.set(sp2.resolve(
|
|
245530
|
+
this.fsw._symlinkPaths.set(sp2.resolve(path19), targetPath);
|
|
245180
245531
|
}
|
|
245181
245532
|
} else {
|
|
245182
245533
|
closer = this._handleFile(wh2.watchPath, stats, initialAdd);
|
|
245183
245534
|
}
|
|
245184
245535
|
ready();
|
|
245185
245536
|
if (closer)
|
|
245186
|
-
this.fsw._addPathCloser(
|
|
245537
|
+
this.fsw._addPathCloser(path19, closer);
|
|
245187
245538
|
return false;
|
|
245188
245539
|
} catch (error48) {
|
|
245189
245540
|
if (this.fsw._handleError(error48)) {
|
|
245190
245541
|
ready();
|
|
245191
|
-
return
|
|
245542
|
+
return path19;
|
|
245192
245543
|
}
|
|
245193
245544
|
}
|
|
245194
245545
|
}
|
|
@@ -245232,24 +245583,24 @@ function createPattern(matcher) {
|
|
|
245232
245583
|
}
|
|
245233
245584
|
return () => false;
|
|
245234
245585
|
}
|
|
245235
|
-
function normalizePath(
|
|
245236
|
-
if (typeof
|
|
245586
|
+
function normalizePath(path19) {
|
|
245587
|
+
if (typeof path19 !== "string")
|
|
245237
245588
|
throw new Error("string expected");
|
|
245238
|
-
|
|
245239
|
-
|
|
245589
|
+
path19 = sp3.normalize(path19);
|
|
245590
|
+
path19 = path19.replace(/\\/g, "/");
|
|
245240
245591
|
let prepend = false;
|
|
245241
|
-
if (
|
|
245592
|
+
if (path19.startsWith("//"))
|
|
245242
245593
|
prepend = true;
|
|
245243
|
-
|
|
245594
|
+
path19 = path19.replace(DOUBLE_SLASH_RE, "/");
|
|
245244
245595
|
if (prepend)
|
|
245245
|
-
|
|
245246
|
-
return
|
|
245596
|
+
path19 = "/" + path19;
|
|
245597
|
+
return path19;
|
|
245247
245598
|
}
|
|
245248
245599
|
function matchPatterns(patterns, testString, stats) {
|
|
245249
|
-
const
|
|
245600
|
+
const path19 = normalizePath(testString);
|
|
245250
245601
|
for (let index = 0;index < patterns.length; index++) {
|
|
245251
245602
|
const pattern = patterns[index];
|
|
245252
|
-
if (pattern(
|
|
245603
|
+
if (pattern(path19, stats)) {
|
|
245253
245604
|
return true;
|
|
245254
245605
|
}
|
|
245255
245606
|
}
|
|
@@ -245287,19 +245638,19 @@ var toUnix = (string4) => {
|
|
|
245287
245638
|
}
|
|
245288
245639
|
return str;
|
|
245289
245640
|
};
|
|
245290
|
-
var normalizePathToUnix = (
|
|
245291
|
-
var normalizeIgnored = (cwd = "") => (
|
|
245292
|
-
if (typeof
|
|
245293
|
-
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));
|
|
245294
245645
|
} else {
|
|
245295
|
-
return
|
|
245646
|
+
return path19;
|
|
245296
245647
|
}
|
|
245297
245648
|
};
|
|
245298
|
-
var getAbsolutePath = (
|
|
245299
|
-
if (sp3.isAbsolute(
|
|
245300
|
-
return
|
|
245649
|
+
var getAbsolutePath = (path19, cwd) => {
|
|
245650
|
+
if (sp3.isAbsolute(path19)) {
|
|
245651
|
+
return path19;
|
|
245301
245652
|
}
|
|
245302
|
-
return sp3.join(cwd,
|
|
245653
|
+
return sp3.join(cwd, path19);
|
|
245303
245654
|
};
|
|
245304
245655
|
var EMPTY_SET = Object.freeze(new Set);
|
|
245305
245656
|
|
|
@@ -245366,10 +245717,10 @@ class WatchHelper {
|
|
|
245366
245717
|
dirParts;
|
|
245367
245718
|
followSymlinks;
|
|
245368
245719
|
statMethod;
|
|
245369
|
-
constructor(
|
|
245720
|
+
constructor(path19, follow, fsw) {
|
|
245370
245721
|
this.fsw = fsw;
|
|
245371
|
-
const watchPath =
|
|
245372
|
-
this.path =
|
|
245722
|
+
const watchPath = path19;
|
|
245723
|
+
this.path = path19 = path19.replace(REPLACER_RE, "");
|
|
245373
245724
|
this.watchPath = watchPath;
|
|
245374
245725
|
this.fullWatchPath = sp3.resolve(watchPath);
|
|
245375
245726
|
this.dirParts = [];
|
|
@@ -245500,20 +245851,20 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245500
245851
|
this._closePromise = undefined;
|
|
245501
245852
|
let paths = unifyPaths(paths_);
|
|
245502
245853
|
if (cwd) {
|
|
245503
|
-
paths = paths.map((
|
|
245504
|
-
const absPath = getAbsolutePath(
|
|
245854
|
+
paths = paths.map((path19) => {
|
|
245855
|
+
const absPath = getAbsolutePath(path19, cwd);
|
|
245505
245856
|
return absPath;
|
|
245506
245857
|
});
|
|
245507
245858
|
}
|
|
245508
|
-
paths.forEach((
|
|
245509
|
-
this._removeIgnoredPath(
|
|
245859
|
+
paths.forEach((path19) => {
|
|
245860
|
+
this._removeIgnoredPath(path19);
|
|
245510
245861
|
});
|
|
245511
245862
|
this._userIgnored = undefined;
|
|
245512
245863
|
if (!this._readyCount)
|
|
245513
245864
|
this._readyCount = 0;
|
|
245514
245865
|
this._readyCount += paths.length;
|
|
245515
|
-
Promise.all(paths.map(async (
|
|
245516
|
-
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);
|
|
245517
245868
|
if (res)
|
|
245518
245869
|
this._emitReady();
|
|
245519
245870
|
return res;
|
|
@@ -245532,17 +245883,17 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245532
245883
|
return this;
|
|
245533
245884
|
const paths = unifyPaths(paths_);
|
|
245534
245885
|
const { cwd } = this.options;
|
|
245535
|
-
paths.forEach((
|
|
245536
|
-
if (!sp3.isAbsolute(
|
|
245886
|
+
paths.forEach((path19) => {
|
|
245887
|
+
if (!sp3.isAbsolute(path19) && !this._closers.has(path19)) {
|
|
245537
245888
|
if (cwd)
|
|
245538
|
-
|
|
245539
|
-
|
|
245889
|
+
path19 = sp3.join(cwd, path19);
|
|
245890
|
+
path19 = sp3.resolve(path19);
|
|
245540
245891
|
}
|
|
245541
|
-
this._closePath(
|
|
245542
|
-
this._addIgnoredPath(
|
|
245543
|
-
if (this._watched.has(
|
|
245892
|
+
this._closePath(path19);
|
|
245893
|
+
this._addIgnoredPath(path19);
|
|
245894
|
+
if (this._watched.has(path19)) {
|
|
245544
245895
|
this._addIgnoredPath({
|
|
245545
|
-
path:
|
|
245896
|
+
path: path19,
|
|
245546
245897
|
recursive: true
|
|
245547
245898
|
});
|
|
245548
245899
|
}
|
|
@@ -245591,38 +245942,38 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245591
245942
|
if (event !== EVENTS.ERROR)
|
|
245592
245943
|
this.emit(EVENTS.ALL, event, ...args);
|
|
245593
245944
|
}
|
|
245594
|
-
async _emit(event,
|
|
245945
|
+
async _emit(event, path19, stats) {
|
|
245595
245946
|
if (this.closed)
|
|
245596
245947
|
return;
|
|
245597
245948
|
const opts = this.options;
|
|
245598
245949
|
if (isWindows4)
|
|
245599
|
-
|
|
245950
|
+
path19 = sp3.normalize(path19);
|
|
245600
245951
|
if (opts.cwd)
|
|
245601
|
-
|
|
245602
|
-
const args = [
|
|
245952
|
+
path19 = sp3.relative(opts.cwd, path19);
|
|
245953
|
+
const args = [path19];
|
|
245603
245954
|
if (stats != null)
|
|
245604
245955
|
args.push(stats);
|
|
245605
245956
|
const awf = opts.awaitWriteFinish;
|
|
245606
245957
|
let pw;
|
|
245607
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
245958
|
+
if (awf && (pw = this._pendingWrites.get(path19))) {
|
|
245608
245959
|
pw.lastChange = new Date;
|
|
245609
245960
|
return this;
|
|
245610
245961
|
}
|
|
245611
245962
|
if (opts.atomic) {
|
|
245612
245963
|
if (event === EVENTS.UNLINK) {
|
|
245613
|
-
this._pendingUnlinks.set(
|
|
245964
|
+
this._pendingUnlinks.set(path19, [event, ...args]);
|
|
245614
245965
|
setTimeout(() => {
|
|
245615
|
-
this._pendingUnlinks.forEach((entry,
|
|
245966
|
+
this._pendingUnlinks.forEach((entry, path20) => {
|
|
245616
245967
|
this.emit(...entry);
|
|
245617
245968
|
this.emit(EVENTS.ALL, ...entry);
|
|
245618
|
-
this._pendingUnlinks.delete(
|
|
245969
|
+
this._pendingUnlinks.delete(path20);
|
|
245619
245970
|
});
|
|
245620
245971
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
245621
245972
|
return this;
|
|
245622
245973
|
}
|
|
245623
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
245974
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path19)) {
|
|
245624
245975
|
event = EVENTS.CHANGE;
|
|
245625
|
-
this._pendingUnlinks.delete(
|
|
245976
|
+
this._pendingUnlinks.delete(path19);
|
|
245626
245977
|
}
|
|
245627
245978
|
}
|
|
245628
245979
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -245640,16 +245991,16 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245640
245991
|
this.emitWithAll(event, args);
|
|
245641
245992
|
}
|
|
245642
245993
|
};
|
|
245643
|
-
this._awaitWriteFinish(
|
|
245994
|
+
this._awaitWriteFinish(path19, awf.stabilityThreshold, event, awfEmit);
|
|
245644
245995
|
return this;
|
|
245645
245996
|
}
|
|
245646
245997
|
if (event === EVENTS.CHANGE) {
|
|
245647
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
245998
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path19, 50);
|
|
245648
245999
|
if (isThrottled)
|
|
245649
246000
|
return this;
|
|
245650
246001
|
}
|
|
245651
246002
|
if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
245652
|
-
const fullPath = opts.cwd ? sp3.join(opts.cwd,
|
|
246003
|
+
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
245653
246004
|
let stats2;
|
|
245654
246005
|
try {
|
|
245655
246006
|
stats2 = await stat4(fullPath);
|
|
@@ -245668,23 +246019,23 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245668
246019
|
}
|
|
245669
246020
|
return error48 || this.closed;
|
|
245670
246021
|
}
|
|
245671
|
-
_throttle(actionType,
|
|
246022
|
+
_throttle(actionType, path19, timeout3) {
|
|
245672
246023
|
if (!this._throttled.has(actionType)) {
|
|
245673
246024
|
this._throttled.set(actionType, new Map);
|
|
245674
246025
|
}
|
|
245675
246026
|
const action = this._throttled.get(actionType);
|
|
245676
246027
|
if (!action)
|
|
245677
246028
|
throw new Error("invalid throttle");
|
|
245678
|
-
const actionPath = action.get(
|
|
246029
|
+
const actionPath = action.get(path19);
|
|
245679
246030
|
if (actionPath) {
|
|
245680
246031
|
actionPath.count++;
|
|
245681
246032
|
return false;
|
|
245682
246033
|
}
|
|
245683
246034
|
let timeoutObject;
|
|
245684
246035
|
const clear = () => {
|
|
245685
|
-
const item = action.get(
|
|
246036
|
+
const item = action.get(path19);
|
|
245686
246037
|
const count2 = item ? item.count : 0;
|
|
245687
|
-
action.delete(
|
|
246038
|
+
action.delete(path19);
|
|
245688
246039
|
clearTimeout(timeoutObject);
|
|
245689
246040
|
if (item)
|
|
245690
246041
|
clearTimeout(item.timeoutObject);
|
|
@@ -245692,50 +246043,50 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245692
246043
|
};
|
|
245693
246044
|
timeoutObject = setTimeout(clear, timeout3);
|
|
245694
246045
|
const thr = { timeoutObject, clear, count: 0 };
|
|
245695
|
-
action.set(
|
|
246046
|
+
action.set(path19, thr);
|
|
245696
246047
|
return thr;
|
|
245697
246048
|
}
|
|
245698
246049
|
_incrReadyCount() {
|
|
245699
246050
|
return this._readyCount++;
|
|
245700
246051
|
}
|
|
245701
|
-
_awaitWriteFinish(
|
|
246052
|
+
_awaitWriteFinish(path19, threshold, event, awfEmit) {
|
|
245702
246053
|
const awf = this.options.awaitWriteFinish;
|
|
245703
246054
|
if (typeof awf !== "object")
|
|
245704
246055
|
return;
|
|
245705
246056
|
const pollInterval = awf.pollInterval;
|
|
245706
246057
|
let timeoutHandler;
|
|
245707
|
-
let fullPath =
|
|
245708
|
-
if (this.options.cwd && !sp3.isAbsolute(
|
|
245709
|
-
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);
|
|
245710
246061
|
}
|
|
245711
246062
|
const now = new Date;
|
|
245712
246063
|
const writes = this._pendingWrites;
|
|
245713
246064
|
function awaitWriteFinishFn(prevStat) {
|
|
245714
246065
|
statcb(fullPath, (err, curStat) => {
|
|
245715
|
-
if (err || !writes.has(
|
|
246066
|
+
if (err || !writes.has(path19)) {
|
|
245716
246067
|
if (err && err.code !== "ENOENT")
|
|
245717
246068
|
awfEmit(err);
|
|
245718
246069
|
return;
|
|
245719
246070
|
}
|
|
245720
246071
|
const now2 = Number(new Date);
|
|
245721
246072
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
245722
|
-
writes.get(
|
|
246073
|
+
writes.get(path19).lastChange = now2;
|
|
245723
246074
|
}
|
|
245724
|
-
const pw = writes.get(
|
|
246075
|
+
const pw = writes.get(path19);
|
|
245725
246076
|
const df3 = now2 - pw.lastChange;
|
|
245726
246077
|
if (df3 >= threshold) {
|
|
245727
|
-
writes.delete(
|
|
246078
|
+
writes.delete(path19);
|
|
245728
246079
|
awfEmit(undefined, curStat);
|
|
245729
246080
|
} else {
|
|
245730
246081
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
245731
246082
|
}
|
|
245732
246083
|
});
|
|
245733
246084
|
}
|
|
245734
|
-
if (!writes.has(
|
|
245735
|
-
writes.set(
|
|
246085
|
+
if (!writes.has(path19)) {
|
|
246086
|
+
writes.set(path19, {
|
|
245736
246087
|
lastChange: now,
|
|
245737
246088
|
cancelWait: () => {
|
|
245738
|
-
writes.delete(
|
|
246089
|
+
writes.delete(path19);
|
|
245739
246090
|
clearTimeout(timeoutHandler);
|
|
245740
246091
|
return event;
|
|
245741
246092
|
}
|
|
@@ -245743,8 +246094,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245743
246094
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
|
|
245744
246095
|
}
|
|
245745
246096
|
}
|
|
245746
|
-
_isIgnored(
|
|
245747
|
-
if (this.options.atomic && DOT_RE.test(
|
|
246097
|
+
_isIgnored(path19, stats) {
|
|
246098
|
+
if (this.options.atomic && DOT_RE.test(path19))
|
|
245748
246099
|
return true;
|
|
245749
246100
|
if (!this._userIgnored) {
|
|
245750
246101
|
const { cwd } = this.options;
|
|
@@ -245754,13 +246105,13 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245754
246105
|
const list3 = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
245755
246106
|
this._userIgnored = anymatch(list3, undefined);
|
|
245756
246107
|
}
|
|
245757
|
-
return this._userIgnored(
|
|
246108
|
+
return this._userIgnored(path19, stats);
|
|
245758
246109
|
}
|
|
245759
|
-
_isntIgnored(
|
|
245760
|
-
return !this._isIgnored(
|
|
246110
|
+
_isntIgnored(path19, stat5) {
|
|
246111
|
+
return !this._isIgnored(path19, stat5);
|
|
245761
246112
|
}
|
|
245762
|
-
_getWatchHelpers(
|
|
245763
|
-
return new WatchHelper(
|
|
246113
|
+
_getWatchHelpers(path19) {
|
|
246114
|
+
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
245764
246115
|
}
|
|
245765
246116
|
_getWatchedDir(directory) {
|
|
245766
246117
|
const dir = sp3.resolve(directory);
|
|
@@ -245774,57 +246125,57 @@ class FSWatcher extends EventEmitter3 {
|
|
|
245774
246125
|
return Boolean(Number(stats.mode) & 256);
|
|
245775
246126
|
}
|
|
245776
246127
|
_remove(directory, item, isDirectory3) {
|
|
245777
|
-
const
|
|
245778
|
-
const fullPath = sp3.resolve(
|
|
245779
|
-
isDirectory3 = isDirectory3 != null ? isDirectory3 : this._watched.has(
|
|
245780
|
-
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))
|
|
245781
246132
|
return;
|
|
245782
246133
|
if (!isDirectory3 && this._watched.size === 1) {
|
|
245783
246134
|
this.add(directory, item, true);
|
|
245784
246135
|
}
|
|
245785
|
-
const wp5 = this._getWatchedDir(
|
|
246136
|
+
const wp5 = this._getWatchedDir(path19);
|
|
245786
246137
|
const nestedDirectoryChildren = wp5.getChildren();
|
|
245787
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
246138
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path19, nested));
|
|
245788
246139
|
const parent = this._getWatchedDir(directory);
|
|
245789
246140
|
const wasTracked = parent.has(item);
|
|
245790
246141
|
parent.remove(item);
|
|
245791
246142
|
if (this._symlinkPaths.has(fullPath)) {
|
|
245792
246143
|
this._symlinkPaths.delete(fullPath);
|
|
245793
246144
|
}
|
|
245794
|
-
let relPath =
|
|
246145
|
+
let relPath = path19;
|
|
245795
246146
|
if (this.options.cwd)
|
|
245796
|
-
relPath = sp3.relative(this.options.cwd,
|
|
246147
|
+
relPath = sp3.relative(this.options.cwd, path19);
|
|
245797
246148
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
245798
246149
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
245799
246150
|
if (event === EVENTS.ADD)
|
|
245800
246151
|
return;
|
|
245801
246152
|
}
|
|
245802
|
-
this._watched.delete(
|
|
246153
|
+
this._watched.delete(path19);
|
|
245803
246154
|
this._watched.delete(fullPath);
|
|
245804
246155
|
const eventName = isDirectory3 ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
245805
|
-
if (wasTracked && !this._isIgnored(
|
|
245806
|
-
this._emit(eventName,
|
|
245807
|
-
this._closePath(
|
|
246156
|
+
if (wasTracked && !this._isIgnored(path19))
|
|
246157
|
+
this._emit(eventName, path19);
|
|
246158
|
+
this._closePath(path19);
|
|
245808
246159
|
}
|
|
245809
|
-
_closePath(
|
|
245810
|
-
this._closeFile(
|
|
245811
|
-
const dir = sp3.dirname(
|
|
245812
|
-
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));
|
|
245813
246164
|
}
|
|
245814
|
-
_closeFile(
|
|
245815
|
-
const closers = this._closers.get(
|
|
246165
|
+
_closeFile(path19) {
|
|
246166
|
+
const closers = this._closers.get(path19);
|
|
245816
246167
|
if (!closers)
|
|
245817
246168
|
return;
|
|
245818
246169
|
closers.forEach((closer) => closer());
|
|
245819
|
-
this._closers.delete(
|
|
246170
|
+
this._closers.delete(path19);
|
|
245820
246171
|
}
|
|
245821
|
-
_addPathCloser(
|
|
246172
|
+
_addPathCloser(path19, closer) {
|
|
245822
246173
|
if (!closer)
|
|
245823
246174
|
return;
|
|
245824
|
-
let list3 = this._closers.get(
|
|
246175
|
+
let list3 = this._closers.get(path19);
|
|
245825
246176
|
if (!list3) {
|
|
245826
246177
|
list3 = [];
|
|
245827
|
-
this._closers.set(
|
|
246178
|
+
this._closers.set(path19, list3);
|
|
245828
246179
|
}
|
|
245829
246180
|
list3.push(closer);
|
|
245830
246181
|
}
|
|
@@ -245852,409 +246203,87 @@ function watch(paths, options8 = {}) {
|
|
|
245852
246203
|
return watcher;
|
|
245853
246204
|
}
|
|
245854
246205
|
|
|
245855
|
-
// src/cli/dev/dev-server/
|
|
246206
|
+
// src/cli/dev/dev-server/watcher.ts
|
|
245856
246207
|
var import_debounce = __toESM(require_debounce(), 1);
|
|
245857
246208
|
var WATCH_DEBOUNCE_MS = 300;
|
|
246209
|
+
var WATCH_QUEUE_DELAY_MS = 500;
|
|
245858
246210
|
|
|
245859
|
-
class
|
|
245860
|
-
|
|
246211
|
+
class WatchBase44 {
|
|
246212
|
+
pathsToWatch;
|
|
245861
246213
|
onChange;
|
|
245862
246214
|
logger;
|
|
245863
|
-
|
|
245864
|
-
|
|
245865
|
-
|
|
246215
|
+
watchers = [];
|
|
246216
|
+
queueWaitForCreation = [];
|
|
246217
|
+
queueWaitForCreationTimeout = null;
|
|
246218
|
+
constructor(pathsToWatch, onChange, logger) {
|
|
246219
|
+
this.pathsToWatch = pathsToWatch;
|
|
245866
246220
|
this.onChange = onChange;
|
|
245867
246221
|
this.logger = logger;
|
|
245868
246222
|
}
|
|
245869
246223
|
async start() {
|
|
245870
|
-
if (this.
|
|
246224
|
+
if (this.watchers.length > 0) {
|
|
245871
246225
|
return;
|
|
245872
246226
|
}
|
|
245873
|
-
|
|
245874
|
-
|
|
246227
|
+
for (const path19 of this.pathsToWatch) {
|
|
246228
|
+
if (await pathExists(path19)) {
|
|
246229
|
+
this.watchers.push(this.watchTarget(path19));
|
|
246230
|
+
} else {
|
|
246231
|
+
this.queueWaitForCreation.push(path19);
|
|
246232
|
+
}
|
|
245875
246233
|
}
|
|
246234
|
+
this.watchCreationQueue();
|
|
245876
246235
|
}
|
|
245877
246236
|
async close() {
|
|
245878
|
-
|
|
245879
|
-
|
|
246237
|
+
if (this.queueWaitForCreationTimeout) {
|
|
246238
|
+
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246239
|
+
this.queueWaitForCreationTimeout = null;
|
|
246240
|
+
}
|
|
246241
|
+
for (const watcher of this.watchers) {
|
|
246242
|
+
await watcher.close();
|
|
246243
|
+
}
|
|
246244
|
+
this.watchers = [];
|
|
245880
246245
|
}
|
|
245881
|
-
getSubfolder(
|
|
245882
|
-
|
|
245883
|
-
if (!rel || rel === ".")
|
|
245884
|
-
return;
|
|
245885
|
-
return rel.split(sep)[0];
|
|
246246
|
+
getSubfolder(watchedPath) {
|
|
246247
|
+
return basename6(normalize2(watchedPath));
|
|
245886
246248
|
}
|
|
245887
|
-
|
|
245888
|
-
|
|
245889
|
-
|
|
245890
|
-
|
|
245891
|
-
|
|
245892
|
-
|
|
245893
|
-
|
|
245894
|
-
|
|
245895
|
-
|
|
245896
|
-
return false;
|
|
246249
|
+
watchCreationQueue() {
|
|
246250
|
+
if (this.queueWaitForCreationTimeout) {
|
|
246251
|
+
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246252
|
+
}
|
|
246253
|
+
this.queueWaitForCreationTimeout = setTimeout(async () => {
|
|
246254
|
+
for (const path19 of this.queueWaitForCreation) {
|
|
246255
|
+
if (await pathExists(path19)) {
|
|
246256
|
+
this.watchers.push(this.watchTarget(path19));
|
|
246257
|
+
this.queueWaitForCreation.splice(this.queueWaitForCreation.indexOf(path19), 1);
|
|
245897
246258
|
}
|
|
245898
|
-
const subfolder = this.getSubfolder(filePath);
|
|
245899
|
-
return subfolder !== "functions";
|
|
245900
246259
|
}
|
|
245901
|
-
|
|
245902
|
-
|
|
245903
|
-
|
|
245904
|
-
|
|
245905
|
-
|
|
246260
|
+
if (this.queueWaitForCreation.length > 0) {
|
|
246261
|
+
this.watchCreationQueue();
|
|
246262
|
+
} else {
|
|
246263
|
+
this.queueWaitForCreationTimeout = null;
|
|
246264
|
+
}
|
|
246265
|
+
}, WATCH_QUEUE_DELAY_MS);
|
|
245906
246266
|
}
|
|
245907
|
-
|
|
245908
|
-
|
|
245909
|
-
|
|
245910
|
-
|
|
245911
|
-
|
|
245912
|
-
|
|
245913
|
-
|
|
245914
|
-
function createRealtimeServer(httpServer) {
|
|
245915
|
-
const io6 = new Server(httpServer, {
|
|
245916
|
-
path: "/ws-user-apps/socket.io/",
|
|
245917
|
-
cors: {
|
|
245918
|
-
origin: /^http:\/\/localhost(:\d+)?$/,
|
|
245919
|
-
credentials: true
|
|
245920
|
-
},
|
|
245921
|
-
transports: ["websocket"]
|
|
245922
|
-
});
|
|
245923
|
-
io6.on("connection", (socket) => {
|
|
245924
|
-
socket.on("join", (room) => {
|
|
245925
|
-
socket.join(room);
|
|
246267
|
+
watchTarget(watchedPath) {
|
|
246268
|
+
const handler = import_debounce.default(async (_event, path19) => {
|
|
246269
|
+
const subfolder = this.getSubfolder(watchedPath);
|
|
246270
|
+
await this.onChange(subfolder, relative4(watchedPath, path19));
|
|
246271
|
+
}, WATCH_DEBOUNCE_MS);
|
|
246272
|
+
const watcher = watch(watchedPath, {
|
|
246273
|
+
ignoreInitial: true
|
|
245926
246274
|
});
|
|
245927
|
-
|
|
245928
|
-
|
|
246275
|
+
watcher.on("all", handler);
|
|
246276
|
+
watcher.on("unlink", async () => {
|
|
246277
|
+
await watcher.close();
|
|
246278
|
+
this.watchers.splice(this.watchers.indexOf(watcher), 1);
|
|
246279
|
+
this.queueWaitForCreation.push(watchedPath);
|
|
246280
|
+
this.watchCreationQueue();
|
|
245929
246281
|
});
|
|
245930
|
-
|
|
245931
|
-
|
|
245932
|
-
}
|
|
245933
|
-
function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
245934
|
-
const room = `entities:${appId}:${entityName}`;
|
|
245935
|
-
io6.to(room).emit("update_model", {
|
|
245936
|
-
room,
|
|
245937
|
-
data: JSON.stringify(event)
|
|
245938
|
-
});
|
|
245939
|
-
}
|
|
245940
|
-
|
|
245941
|
-
// src/cli/dev/dev-server/routes/entities.ts
|
|
245942
|
-
var import_express2 = __toESM(require_express(), 1);
|
|
245943
|
-
|
|
245944
|
-
// node_modules/nanoid/index.js
|
|
245945
|
-
import { webcrypto as crypto } from "node:crypto";
|
|
245946
|
-
|
|
245947
|
-
// node_modules/nanoid/url-alphabet/index.js
|
|
245948
|
-
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
245949
|
-
|
|
245950
|
-
// node_modules/nanoid/index.js
|
|
245951
|
-
var POOL_SIZE_MULTIPLIER = 128;
|
|
245952
|
-
var pool;
|
|
245953
|
-
var poolOffset;
|
|
245954
|
-
function fillPool(bytes) {
|
|
245955
|
-
if (!pool || pool.length < bytes) {
|
|
245956
|
-
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
245957
|
-
crypto.getRandomValues(pool);
|
|
245958
|
-
poolOffset = 0;
|
|
245959
|
-
} else if (poolOffset + bytes > pool.length) {
|
|
245960
|
-
crypto.getRandomValues(pool);
|
|
245961
|
-
poolOffset = 0;
|
|
245962
|
-
}
|
|
245963
|
-
poolOffset += bytes;
|
|
245964
|
-
}
|
|
245965
|
-
function nanoid3(size = 21) {
|
|
245966
|
-
fillPool(size |= 0);
|
|
245967
|
-
let id2 = "";
|
|
245968
|
-
for (let i5 = poolOffset - size;i5 < poolOffset; i5++) {
|
|
245969
|
-
id2 += urlAlphabet[pool[i5] & 63];
|
|
245970
|
-
}
|
|
245971
|
-
return id2;
|
|
245972
|
-
}
|
|
245973
|
-
|
|
245974
|
-
// src/cli/dev/dev-server/routes/entities.ts
|
|
245975
|
-
function parseSort(sort) {
|
|
245976
|
-
if (!sort) {
|
|
245977
|
-
return;
|
|
245978
|
-
}
|
|
245979
|
-
if (sort.startsWith("-")) {
|
|
245980
|
-
return { [sort.slice(1)]: -1 };
|
|
245981
|
-
}
|
|
245982
|
-
return { [sort]: 1 };
|
|
245983
|
-
}
|
|
245984
|
-
function parseFields(fields) {
|
|
245985
|
-
if (!fields) {
|
|
245986
|
-
return;
|
|
245987
|
-
}
|
|
245988
|
-
const projection = {};
|
|
245989
|
-
for (const field of fields.split(",")) {
|
|
245990
|
-
const trimmed = field.trim();
|
|
245991
|
-
if (trimmed) {
|
|
245992
|
-
projection[trimmed] = 1;
|
|
245993
|
-
}
|
|
245994
|
-
}
|
|
245995
|
-
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
245996
|
-
}
|
|
245997
|
-
function stripInternalFields(doc2) {
|
|
245998
|
-
if (Array.isArray(doc2)) {
|
|
245999
|
-
return doc2.map((d5) => stripInternalFields(d5));
|
|
246000
|
-
}
|
|
246001
|
-
const { _id, ...rest } = doc2;
|
|
246002
|
-
return rest;
|
|
246003
|
-
}
|
|
246004
|
-
function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
246005
|
-
const router = import_express2.Router({ mergeParams: true });
|
|
246006
|
-
const parseBody = import_express2.json();
|
|
246007
|
-
function withCollection(handler) {
|
|
246008
|
-
return async (req, res) => {
|
|
246009
|
-
const collection = db2.getCollection(req.params.entityName);
|
|
246010
|
-
if (!collection) {
|
|
246011
|
-
res.status(404).json({ error: `Entity "${req.params.entityName}" not found` });
|
|
246012
|
-
return;
|
|
246013
|
-
}
|
|
246014
|
-
await handler(req, res, collection);
|
|
246015
|
-
};
|
|
246016
|
-
}
|
|
246017
|
-
function emit(appId, entityName, type, data) {
|
|
246018
|
-
const createData = (item) => ({
|
|
246019
|
-
type,
|
|
246020
|
-
data: item,
|
|
246021
|
-
id: item.id,
|
|
246022
|
-
timestamp: new Date().toISOString()
|
|
246282
|
+
watcher.on("error", (err) => {
|
|
246283
|
+
this.logger.error(`[dev-server] Watch handler failed for ${watchedPath}`, err instanceof Error ? err : undefined);
|
|
246023
246284
|
});
|
|
246024
|
-
|
|
246025
|
-
for (const item of data) {
|
|
246026
|
-
broadcast(appId, entityName, createData(item));
|
|
246027
|
-
}
|
|
246028
|
-
return;
|
|
246029
|
-
}
|
|
246030
|
-
broadcast(appId, entityName, createData(data));
|
|
246285
|
+
return watcher;
|
|
246031
246286
|
}
|
|
246032
|
-
router.get("/User/:id", (req, res, next) => {
|
|
246033
|
-
logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
246034
|
-
req.url = req.originalUrl;
|
|
246035
|
-
remoteProxy(req, res, next);
|
|
246036
|
-
});
|
|
246037
|
-
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
246038
|
-
const { entityName, id: id2 } = req.params;
|
|
246039
|
-
try {
|
|
246040
|
-
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
246041
|
-
if (!doc2) {
|
|
246042
|
-
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
246043
|
-
return;
|
|
246044
|
-
}
|
|
246045
|
-
res.json(stripInternalFields(doc2));
|
|
246046
|
-
} catch (error48) {
|
|
246047
|
-
logger.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
246048
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246049
|
-
}
|
|
246050
|
-
}));
|
|
246051
|
-
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
246052
|
-
const { entityName } = req.params;
|
|
246053
|
-
try {
|
|
246054
|
-
const { sort, limit, skip: skip2, fields, q: q13 } = req.query;
|
|
246055
|
-
let query = {};
|
|
246056
|
-
if (q13 && typeof q13 === "string") {
|
|
246057
|
-
try {
|
|
246058
|
-
query = JSON.parse(q13);
|
|
246059
|
-
} catch {
|
|
246060
|
-
res.status(400).json({ error: "Invalid query parameter 'q'" });
|
|
246061
|
-
return;
|
|
246062
|
-
}
|
|
246063
|
-
}
|
|
246064
|
-
let cursor3 = collection.findAsync(query);
|
|
246065
|
-
const sortObj = parseSort(sort);
|
|
246066
|
-
if (sortObj) {
|
|
246067
|
-
cursor3 = cursor3.sort(sortObj);
|
|
246068
|
-
}
|
|
246069
|
-
if (skip2) {
|
|
246070
|
-
const skipNum = Number.parseInt(skip2, 10);
|
|
246071
|
-
if (!Number.isNaN(skipNum)) {
|
|
246072
|
-
cursor3 = cursor3.skip(skipNum);
|
|
246073
|
-
}
|
|
246074
|
-
}
|
|
246075
|
-
if (limit) {
|
|
246076
|
-
const limitNum = Number.parseInt(limit, 10);
|
|
246077
|
-
if (!Number.isNaN(limitNum)) {
|
|
246078
|
-
cursor3 = cursor3.limit(limitNum);
|
|
246079
|
-
}
|
|
246080
|
-
}
|
|
246081
|
-
const projection = parseFields(fields);
|
|
246082
|
-
if (projection) {
|
|
246083
|
-
cursor3 = cursor3.projection(projection);
|
|
246084
|
-
}
|
|
246085
|
-
const docs = await cursor3;
|
|
246086
|
-
res.json(stripInternalFields(docs));
|
|
246087
|
-
} catch (error48) {
|
|
246088
|
-
logger.error(`Error in GET /${entityName}:`, error48);
|
|
246089
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246090
|
-
}
|
|
246091
|
-
}));
|
|
246092
|
-
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
246093
|
-
const { appId, entityName } = req.params;
|
|
246094
|
-
try {
|
|
246095
|
-
const now = new Date().toISOString();
|
|
246096
|
-
const { _id, ...body } = req.body;
|
|
246097
|
-
const record2 = {
|
|
246098
|
-
...body,
|
|
246099
|
-
id: nanoid3(),
|
|
246100
|
-
created_date: now,
|
|
246101
|
-
updated_date: now
|
|
246102
|
-
};
|
|
246103
|
-
const inserted = stripInternalFields(await collection.insertAsync(record2));
|
|
246104
|
-
emit(appId, entityName, "create", inserted);
|
|
246105
|
-
res.status(201).json(inserted);
|
|
246106
|
-
} catch (error48) {
|
|
246107
|
-
logger.error(`Error in POST /${entityName}:`, error48);
|
|
246108
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246109
|
-
}
|
|
246110
|
-
}));
|
|
246111
|
-
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection) => {
|
|
246112
|
-
const { appId, entityName } = req.params;
|
|
246113
|
-
if (!Array.isArray(req.body)) {
|
|
246114
|
-
res.status(400).json({ error: "Request body must be an array" });
|
|
246115
|
-
return;
|
|
246116
|
-
}
|
|
246117
|
-
try {
|
|
246118
|
-
const now = new Date().toISOString();
|
|
246119
|
-
const records = req.body.map((item) => ({
|
|
246120
|
-
...item,
|
|
246121
|
-
id: nanoid3(),
|
|
246122
|
-
created_date: now,
|
|
246123
|
-
updated_date: now
|
|
246124
|
-
}));
|
|
246125
|
-
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
246126
|
-
emit(appId, entityName, "create", inserted);
|
|
246127
|
-
res.status(201).json(inserted);
|
|
246128
|
-
} catch (error48) {
|
|
246129
|
-
logger.error(`Error in POST /${entityName}/bulk:`, error48);
|
|
246130
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246131
|
-
}
|
|
246132
|
-
}));
|
|
246133
|
-
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection) => {
|
|
246134
|
-
const { appId, entityName, id: id2 } = req.params;
|
|
246135
|
-
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
246136
|
-
try {
|
|
246137
|
-
const updateData = {
|
|
246138
|
-
...body,
|
|
246139
|
-
updated_date: new Date().toISOString()
|
|
246140
|
-
};
|
|
246141
|
-
const result = await collection.updateAsync({ id: id2 }, { $set: updateData }, { returnUpdatedDocs: true });
|
|
246142
|
-
if (result.numAffected === 0 || !result.affectedDocuments) {
|
|
246143
|
-
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
246144
|
-
return;
|
|
246145
|
-
}
|
|
246146
|
-
const updated = stripInternalFields(result.affectedDocuments);
|
|
246147
|
-
emit(appId, entityName, "update", updated);
|
|
246148
|
-
res.json(updated);
|
|
246149
|
-
} catch (error48) {
|
|
246150
|
-
logger.error(`Error in PUT /${entityName}/${id2}:`, error48);
|
|
246151
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246152
|
-
}
|
|
246153
|
-
}));
|
|
246154
|
-
router.delete("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
246155
|
-
const { appId, entityName, id: id2 } = req.params;
|
|
246156
|
-
try {
|
|
246157
|
-
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
246158
|
-
const numRemoved = await collection.removeAsync({ id: id2 }, { multi: false });
|
|
246159
|
-
if (numRemoved === 0) {
|
|
246160
|
-
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
246161
|
-
return;
|
|
246162
|
-
}
|
|
246163
|
-
if (doc2) {
|
|
246164
|
-
emit(appId, entityName, "delete", stripInternalFields(doc2));
|
|
246165
|
-
}
|
|
246166
|
-
res.json({ success: true });
|
|
246167
|
-
} catch (error48) {
|
|
246168
|
-
logger.error(`Error in DELETE /${entityName}/${id2}:`, error48);
|
|
246169
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246170
|
-
}
|
|
246171
|
-
}));
|
|
246172
|
-
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
246173
|
-
const { entityName } = req.params;
|
|
246174
|
-
try {
|
|
246175
|
-
const query = req.body || {};
|
|
246176
|
-
const numRemoved = await collection.removeAsync(query, { multi: true });
|
|
246177
|
-
res.json({ success: true, deleted: numRemoved });
|
|
246178
|
-
} catch (error48) {
|
|
246179
|
-
logger.error(`Error in DELETE /${entityName}:`, error48);
|
|
246180
|
-
res.status(500).json({ error: "Internal server error" });
|
|
246181
|
-
}
|
|
246182
|
-
}));
|
|
246183
|
-
return router;
|
|
246184
|
-
}
|
|
246185
|
-
|
|
246186
|
-
// src/cli/dev/dev-server/routes/integrations.ts
|
|
246187
|
-
var import_express3 = __toESM(require_express(), 1);
|
|
246188
|
-
var import_multer = __toESM(require_multer(), 1);
|
|
246189
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
246190
|
-
import fs28 from "node:fs";
|
|
246191
|
-
import path18 from "node:path";
|
|
246192
|
-
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
246193
|
-
const router = import_express3.Router({ mergeParams: true });
|
|
246194
|
-
const parseBody = import_express3.json();
|
|
246195
|
-
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
246196
|
-
const storage = import_multer.default.diskStorage({
|
|
246197
|
-
destination: mediaFilesDir,
|
|
246198
|
-
filename: (_req, file2, cb2) => {
|
|
246199
|
-
const ext = path18.extname(file2.originalname);
|
|
246200
|
-
cb2(null, `${randomUUID2()}${ext}`);
|
|
246201
|
-
}
|
|
246202
|
-
});
|
|
246203
|
-
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
246204
|
-
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
246205
|
-
router.post("/Core/UploadFile", upload.single("file"), (req, res) => {
|
|
246206
|
-
if (!req.file) {
|
|
246207
|
-
res.status(400).json({ error: "No file uploaded" });
|
|
246208
|
-
return;
|
|
246209
|
-
}
|
|
246210
|
-
const file_url = `${baseUrl}/media/${req.file.filename}`;
|
|
246211
|
-
res.json({ file_url });
|
|
246212
|
-
});
|
|
246213
|
-
router.post("/Core/UploadPrivateFile", upload.single("file"), (req, res) => {
|
|
246214
|
-
if (!req.file) {
|
|
246215
|
-
res.status(400).json({ error: "No file uploaded" });
|
|
246216
|
-
return;
|
|
246217
|
-
}
|
|
246218
|
-
const file_uri = req.file.filename;
|
|
246219
|
-
res.json({ file_uri });
|
|
246220
|
-
});
|
|
246221
|
-
router.post("/Core/CreateFileSignedUrl", parseBody, (req, res) => {
|
|
246222
|
-
const { file_uri } = req.body;
|
|
246223
|
-
if (!file_uri) {
|
|
246224
|
-
res.status(400).json({ error: "file_uri is required" });
|
|
246225
|
-
return;
|
|
246226
|
-
}
|
|
246227
|
-
const signature = randomUUID2();
|
|
246228
|
-
const signed_url = `${baseUrl}/media/${file_uri}?signature=${signature}`;
|
|
246229
|
-
res.json({ signed_url });
|
|
246230
|
-
});
|
|
246231
|
-
router.post("/Core/:endpointName", (req, res, next) => {
|
|
246232
|
-
logger.warn(`Core.${req.params.endpointName} is not supported in local development`);
|
|
246233
|
-
req.url = req.originalUrl;
|
|
246234
|
-
remoteProxy(req, res, next);
|
|
246235
|
-
});
|
|
246236
|
-
router.post("/installable/:packageName/integration-endpoints/:endpointName", (req, res, next) => {
|
|
246237
|
-
logger.warn(`${req.params.packageName}.${req.params.endpointName} is not supported in local development`);
|
|
246238
|
-
req.url = req.originalUrl;
|
|
246239
|
-
remoteProxy(req, res, next);
|
|
246240
|
-
});
|
|
246241
|
-
router.use((err, _req, res, next) => {
|
|
246242
|
-
if (err instanceof import_multer.default.MulterError) {
|
|
246243
|
-
res.status(err.code === "LIMIT_FILE_SIZE" ? 413 : 400).json({ error: err.message });
|
|
246244
|
-
return;
|
|
246245
|
-
}
|
|
246246
|
-
next(err);
|
|
246247
|
-
});
|
|
246248
|
-
return router;
|
|
246249
|
-
}
|
|
246250
|
-
function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
246251
|
-
const router = import_express3.Router({ mergeParams: true });
|
|
246252
|
-
router.post("/:slug/:operationId", (req, res, next) => {
|
|
246253
|
-
logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
246254
|
-
req.url = req.originalUrl;
|
|
246255
|
-
remoteProxy(req, res, next);
|
|
246256
|
-
});
|
|
246257
|
-
return router;
|
|
246258
246287
|
}
|
|
246259
246288
|
|
|
246260
246289
|
// src/cli/dev/dev-server/main.ts
|
|
@@ -246323,8 +246352,7 @@ async function createDevServer(options8) {
|
|
|
246323
246352
|
emitEntityEvent = (appId, entityName, event) => {
|
|
246324
246353
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246325
246354
|
};
|
|
246326
|
-
const
|
|
246327
|
-
const base44ConfigWatcher = new WatchBase44Directory(configDir, async (subfolder) => {
|
|
246355
|
+
const base44ConfigWatcher = new WatchBase44([join18(dirname14(project2.configPath), project2.functionsDir)], async (subfolder) => {
|
|
246328
246356
|
if (subfolder === "functions") {
|
|
246329
246357
|
const { functions: functions2 } = await options8.loadResources();
|
|
246330
246358
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
@@ -246495,7 +246523,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
246495
246523
|
import { release, type } from "node:os";
|
|
246496
246524
|
|
|
246497
246525
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
246498
|
-
import { dirname as dirname15, posix, sep
|
|
246526
|
+
import { dirname as dirname15, posix, sep } from "path";
|
|
246499
246527
|
function createModulerModifier() {
|
|
246500
246528
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
246501
246529
|
return async (frames) => {
|
|
@@ -246504,7 +246532,7 @@ function createModulerModifier() {
|
|
|
246504
246532
|
return frames;
|
|
246505
246533
|
};
|
|
246506
246534
|
}
|
|
246507
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 =
|
|
246535
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
246508
246536
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
246509
246537
|
return (filename) => {
|
|
246510
246538
|
if (!filename)
|
|
@@ -250722,4 +250750,4 @@ export {
|
|
|
250722
250750
|
CLIExitError
|
|
250723
250751
|
};
|
|
250724
250752
|
|
|
250725
|
-
//# debugId=
|
|
250753
|
+
//# debugId=CA7CF50A6F3C097064756E2164756E21
|