@squidcloud/cli 1.0.447 → 1.0.449
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/index.js +261 -32
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -21930,6 +21930,43 @@ module.exports = Array.isArray || function (arr) {
|
|
|
21930
21930
|
};
|
|
21931
21931
|
|
|
21932
21932
|
|
|
21933
|
+
/***/ },
|
|
21934
|
+
|
|
21935
|
+
/***/ 6102
|
|
21936
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
21937
|
+
|
|
21938
|
+
"use strict";
|
|
21939
|
+
__webpack_require__.r(__webpack_exports__);
|
|
21940
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
21941
|
+
/* harmony export */ LOG_LEVELS: () => (/* binding */ e),
|
|
21942
|
+
/* harmony export */ createDateTimePipe: () => (/* binding */ g),
|
|
21943
|
+
/* harmony export */ createJsonPipe: () => (/* binding */ x),
|
|
21944
|
+
/* harmony export */ createJsonStringifyPipe: () => (/* binding */ P),
|
|
21945
|
+
/* harmony export */ createLogCachePipe: () => (/* binding */ O),
|
|
21946
|
+
/* harmony export */ createLogLevelFilterPipe: () => (/* binding */ V),
|
|
21947
|
+
/* harmony export */ createLogMessageFilterPipe: () => (/* binding */ N),
|
|
21948
|
+
/* harmony export */ createNoopPipe: () => (/* binding */ M),
|
|
21949
|
+
/* harmony export */ estimateArgsSizeByStringify: () => (/* binding */ L),
|
|
21950
|
+
/* harmony export */ generateUuidSimple: () => (/* binding */ v),
|
|
21951
|
+
/* harmony export */ getConsoleOverrides: () => (/* binding */ l),
|
|
21952
|
+
/* harmony export */ getDefaultDateTimePipeOptions: () => (/* binding */ f),
|
|
21953
|
+
/* harmony export */ getDefaultJsonPipeOptions: () => (/* binding */ h),
|
|
21954
|
+
/* harmony export */ getDefaultJsonSimplifierOptions: () => (/* binding */ y),
|
|
21955
|
+
/* harmony export */ getDefaultJsonStringifyPipeOptions: () => (/* binding */ S),
|
|
21956
|
+
/* harmony export */ getDefaultLogCachePipeOptions: () => (/* binding */ j),
|
|
21957
|
+
/* harmony export */ getLogMessageFilterPipeOptions: () => (/* binding */ I),
|
|
21958
|
+
/* harmony export */ getOriginalConsoleMethods: () => (/* binding */ u),
|
|
21959
|
+
/* harmony export */ installConsoleOverride: () => (/* binding */ o),
|
|
21960
|
+
/* harmony export */ installConsoleOverrides: () => (/* binding */ i),
|
|
21961
|
+
/* harmony export */ simplifyJson: () => (/* binding */ d),
|
|
21962
|
+
/* harmony export */ simplifyValue: () => (/* binding */ b),
|
|
21963
|
+
/* harmony export */ uninstallAllConsoleOverrides: () => (/* binding */ c),
|
|
21964
|
+
/* harmony export */ uninstallConsoleOverride: () => (/* binding */ s),
|
|
21965
|
+
/* harmony export */ uninstallConsoleOverrides: () => (/* binding */ a)
|
|
21966
|
+
/* harmony export */ });
|
|
21967
|
+
const e=["debug","error","info","log","trace","warn"],t=[],r=()=>{},n={debug:r,error:r,info:r,log:r,trace:r,warn:r};function o(e){i(...Array.isArray(e)?e:[e])}function i(...o){!function(){if(n.debug===r)for(const r of e)n[r]=console[r],console[r]=(...e)=>{var o,i,s;let a=r,c=e;for(const e of t){const t=e(a,...c);if(!t||(Array.isArray(t)?0===(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0):0===(null!==(s=null===(i=t.args)||void 0===i?void 0:i.length)&&void 0!==s?s:0)))return;Array.isArray(t)?c=t:(a=t.level,c=t.args)}n[a](...c)}}();for(const e of o)!t.includes(e)&&e.onInstall&&e.onInstall(),t.push(e)}function s(e){a(...Array.isArray(e)?e:[e])}function a(...o){for(const e of o)for(let r=t.indexOf(e);r>=0;r=t.indexOf(e)){const e=t.splice(r,1)[0];!t.includes(e)&&e.onUninstall&&e.onUninstall()}!function(){if(!(t.length>0)&&n.debug!==r)for(const t of e)console[t]=n[t],n[t]=r}()}function c(){for(const e of[...t])s(e)}function l(){return[...t]}function u(){if(n.debug!==r)return Object.assign({},n);const t={};for(const r of e)t[r]=console[r];return t}function f(){return{dateFormatter:e=>new Date(e).toISOString()}}function g({dateFormatter:e}=f()){return(t,...r)=>[e(Date.now()),...r]}function y(){return{maxDepthLimit:10,maxArrayLength:100,maxObjectPropertyCount:100,isIgnoredProperty:()=>!1,replacePropertyValue:(e,t)=>t,depthLimitValue:"[Depth limit ~]",arrayLengthLimitValue:"[Array, length: $length ~]",objectPropertyCountLimitValue:"[Object, properties: $count ~]",circularReferenceValue:"[Circular ~]",functionValue:"[Function ~]",symbolValue:"[Symbol ~]"}}const p={maxDepthLimit:10,maxArrayLength:100,maxObjectPropertyCount:100,isIgnoredProperty:()=>!1,replacePropertyValue:(e,t)=>t,depthLimitValue:"[Depth limit ~]",arrayLengthLimitValue:"[Array, length: $length ~]",objectPropertyCountLimitValue:"[Object, properties: $count ~]",circularReferenceValue:"[Circular ~]",functionValue:"[Function ~]",symbolValue:"[Symbol ~]"},m=["cause","message","name","stack"];function d(e,t={},r=0,n=new Set){const o=Object.assign(Object.assign({},p),t);if(r>o.maxDepthLimit)return o.depthLimitValue;if("string"==typeof(e=b(e))||"boolean"==typeof e||"number"==typeof e||null==e)return e;if(n.has(e))return o.circularReferenceValue;if(n.add(e),Array.isArray(e))return e.length>o.maxArrayLength?o.arrayLengthLimitValue.replace("$length",`${e.length}`):e.map((e=>d(e,o,r+1,n)));const i=Object.entries(e);if(i.length>o.maxObjectPropertyCount)return o.objectPropertyCountLimitValue.replace("$count",`${i.length}`);const s={};for(const[e,t]of i)0===r&&o.isIgnoredProperty(e)||(s[e]=d(t,o,r+1,n));for(const t of m)if(!s[t]&&!o.isIgnoredProperty(t)){const i=e[t];void 0!==i&&(s[t]=d(i,o,r+1,n))}if(o.replacePropertyValue!==p.replacePropertyValue)for(const[e,t]of Object.entries(s))s[e]=o.replacePropertyValue(e,t);return s}function b(e,t={}){if(null==e)return e;switch(typeof e){case"undefined":case"boolean":case"string":return e;case"bigint":return`BigInt(${e.toString()})`;case"number":return isNaN(e)?"NaN":e===1/0?"Infinity":e===-1/0?"-Infinity":e;case"function":return t.functionValue||p.functionValue;case"symbol":return t.symbolValue||p.symbolValue;case"object":if(e instanceof Set)return[...e.keys()];if(e instanceof Map)return Object.fromEntries([...e.entries()]);if(e instanceof String||e instanceof Number||e instanceof Boolean)return e.valueOf();if(e instanceof Date)return e.toISOString()}return e}function h(){return Object.assign(Object.assign({},{maxDepthLimit:10,maxArrayLength:100,maxObjectPropertyCount:100,isIgnoredProperty:()=>!1,replacePropertyValue:(e,t)=>t,depthLimitValue:"[Depth limit ~]",arrayLengthLimitValue:"[Array, length: $length ~]",objectPropertyCountLimitValue:"[Object, properties: $count ~]",circularReferenceValue:"[Circular ~]",functionValue:"[Function ~]",symbolValue:"[Symbol ~]"}),{messagePropertyName:"message",levelPropertyName:"level",levelPropertyFormatter:e=>e,timestampPropertyName:"timestamp",timestampPropertyFormatter:e=>new Date(e).toISOString(),messageIdPropertyName:"message_id",messageIdPropertyProvider:v,isIgnoredProperty:()=>!1,getObjectMessageToken:e=>`$${e+1}`,pickFieldNameAsObjectMessageTokenForSingleFieldObjects:!1,undefinedMessageValue:void 0})}function x(e={}){const t=h(),r=Object.assign(Object.assign({},t),e);let n,o="";const i=(e,...i)=>{const s={};let a;s[r.messagePropertyName]=void 0;let c=0;for(let e=0;e<i.length;e++){const t=b(i[e]);let n=t;if("object"==typeof t&&null!==t){let o=d(t,r);if(r.pickFieldNameAsObjectMessageTokenForSingleFieldObjects&&"object"==typeof o&&null!==o){const e=Object.entries(o);if(1===e.length){const[t,r]=e[0],i=`$${t}`;if(void 0===s[i])if(n=i,null===(l=r)||"string"==typeof l||void 0===l||"number"==typeof l||"boolean"==typeof l){const e="string"==typeof r?"'":"";n+=`:[${e}${r}${e}]`,o=void 0}else o=r}}"string"!=typeof n&&(n=r.getObjectMessageToken(c,t,e),c++),s[n]=o}else void 0===t?void 0!==r.undefinedMessageValue&&(n+=r.undefinedMessageValue):n=t;a=void 0===a?`${n}`:`${a} ${n}`}var l;if(a&&(s[r.messagePropertyName]=a),r.levelPropertyName&&(s[r.levelPropertyName]=r.levelPropertyFormatter(e)),r.timestampPropertyName&&(s[r.timestampPropertyName]=r.timestampPropertyFormatter(Date.now())),r.messageIdPropertyName){let a=n||r.messageIdPropertyProvider(e,...i);void 0===a&&(a=t.messageIdPropertyProvider()),o=a,s[r.messageIdPropertyName]=o,n=void 0}return[s]};return i.getLastMessageId=()=>o,i.setNextMessageId=e=>{n=e},i}function v(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+Math.floor(16*Math.random()))%16;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}function S(){return Object.assign(Object.assign({},h()),{preStringifyCallback:()=>{}})}function P(e={}){const t=Object.assign(Object.assign({},S()),e),r=x(t),n=(e,...n)=>{const o=r(e,...n);if(0===o.length)return[];const i=o[0];return t.preStringifyCallback(i),[JSON.stringify(i)]};return n.getLastMessageId=r.getLastMessageId,n.setNextMessageId=r.setNextMessageId,n}function j(){return{cacheSize:1e3,cacheSizeByStringify:-1}}function O(e={}){const t=Object.assign(Object.assign({},{cacheSize:1e3,cacheSizeByStringify:-1}),e);if(t.cacheSize<0||isNaN(t.cacheSize))throw new Error(`Invalid cache size: ${t.cacheSize}`);const r={size:0};let n=!1,o=0;function i(){r.first&&(o>0&&(o-=L(...r.first.value.args)),r.first=r.first.next,r.size--)}const s=(e,...a)=>{if(0===t.cacheSize||n)return a;var c;c={value:{level:e,args:a,timestamp:Date.now()}},void 0===r.last?r.first=c:r.last.next=c,r.last=c,r.size++,t.cacheSizeByStringify>=0&&(o+=L(...c.value.args));const l=r.size>t.cacheSize,u=t.cacheSizeByStringify>=0&&o>t.cacheSizeByStringify;if((l||u)&&t.onCacheSizeReached){n=!0;try{t.onCacheSizeReached(s)}finally{n=!1}}if(u){for(;o>t.cacheSizeByStringify&&void 0!==r.first;)i();o=Math.max(o,0),void 0===r.first&&(o=0)}else l&&i();return a};return s.getMessages=()=>{const e=[];let t=r.first;for(;void 0!==t;)e.push(t.value),t=t.next;return e},s.clearMessages=()=>{r.first=void 0,r.last=void 0,r.size=0,o=0},s.onInstall=()=>s.clearMessages(),s}function L(...e){let t=0;for(const r of e)void 0!==r&&(t+=JSON.stringify(d(r)).length);return t}function V(e={}){const t=Object.assign({excludedLogLevels:[]},e);return(e,...r)=>{const n="function"==typeof t.excludedLogLevels?t.excludedLogLevels(e):t.excludedLogLevels;return("boolean"==typeof n?n:n.includes(e))?[]:r}}function I(){return{isCaseSensitive:!1,excludedMessageTokens:[]}}function N(e){const{excludedMessageTokens:t,isCaseSensitive:r}=Object.assign(Object.assign({},{isCaseSensitive:!1,excludedMessageTokens:[]}),e),n=t.filter((e=>"string"==typeof e)).map((e=>r?e:e.toLowerCase())),o=t.filter((e=>"object"==typeof e));return t.sort(((e,t)=>typeof e==typeof t?0:"string"==typeof e?-1:1)),(e,...i)=>{if(0===t.length)return i;if(r){for(const e of i)if("string"==typeof e){if(n.some((t=>e.includes(t))))return[];if(o.some((t=>t.test(e))))return[]}}else for(const e of i)if("string"==typeof e){const t=e.toLowerCase();if(n.some((e=>t.includes(e))))return[];if(o.some((t=>t.test(e))))return[]}return i}}function M(){return(e,...t)=>t}
|
|
21968
|
+
//# sourceMappingURL=index.esm.js.map
|
|
21969
|
+
|
|
21933
21970
|
/***/ },
|
|
21934
21971
|
|
|
21935
21972
|
/***/ 2577
|
|
@@ -30183,6 +30220,148 @@ exports.applicationAppConnectorsAssertion = {
|
|
|
30183
30220
|
};
|
|
30184
30221
|
|
|
30185
30222
|
|
|
30223
|
+
/***/ },
|
|
30224
|
+
|
|
30225
|
+
/***/ 8700
|
|
30226
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30227
|
+
|
|
30228
|
+
"use strict";
|
|
30229
|
+
|
|
30230
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30231
|
+
exports.debugLogFilterPipe = void 0;
|
|
30232
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
30233
|
+
const enable_debug_logs_decorator_1 = __webpack_require__(5692);
|
|
30234
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
30235
|
+
exports.debugLogFilterPipe = (0, logpipes_1.createLogLevelFilterPipe)({
|
|
30236
|
+
excludedLogLevels: level => {
|
|
30237
|
+
if (level !== 'debug')
|
|
30238
|
+
return false;
|
|
30239
|
+
if ((0, global_utils_1.isDebugEnabled)())
|
|
30240
|
+
return false; // Debug is enabled globally.
|
|
30241
|
+
return !(0, enable_debug_logs_decorator_1.isInDebugDecoratorContext)(); // Check if debug is enabled only for this nested call.
|
|
30242
|
+
},
|
|
30243
|
+
});
|
|
30244
|
+
|
|
30245
|
+
|
|
30246
|
+
/***/ },
|
|
30247
|
+
|
|
30248
|
+
/***/ 5692
|
|
30249
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30250
|
+
|
|
30251
|
+
"use strict";
|
|
30252
|
+
|
|
30253
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30254
|
+
exports.EnableDebugLogs = EnableDebugLogs;
|
|
30255
|
+
exports.isInDebugDecoratorContext = isInDebugDecoratorContext;
|
|
30256
|
+
const async_hooks_1 = __webpack_require__(290);
|
|
30257
|
+
const store = new async_hooks_1.AsyncLocalStorage();
|
|
30258
|
+
/**
|
|
30259
|
+
* Method decorator that enables debug logs only within the async context of the decorated method call.
|
|
30260
|
+
* This allows debug logging to be scoped to specific method executions without affecting global debug settings.
|
|
30261
|
+
* Works by making isInDebugContext() return true within the decorated context.
|
|
30262
|
+
*
|
|
30263
|
+
* Note: the decoration works only in Node.js.
|
|
30264
|
+
*/
|
|
30265
|
+
function EnableDebugLogs(_target, _propertyName, descriptor) {
|
|
30266
|
+
const method = descriptor.value;
|
|
30267
|
+
descriptor.value = async function (...args) {
|
|
30268
|
+
// Run the method within the debug context.
|
|
30269
|
+
return store.run(true, async () => {
|
|
30270
|
+
return await method.apply(this, args);
|
|
30271
|
+
});
|
|
30272
|
+
};
|
|
30273
|
+
return descriptor;
|
|
30274
|
+
}
|
|
30275
|
+
/** Returns true if called from within debug log enabled context. */
|
|
30276
|
+
function isInDebugDecoratorContext() {
|
|
30277
|
+
return store.getStore() === true;
|
|
30278
|
+
}
|
|
30279
|
+
|
|
30280
|
+
|
|
30281
|
+
/***/ },
|
|
30282
|
+
|
|
30283
|
+
/***/ 6334
|
|
30284
|
+
(__unused_webpack_module, exports) {
|
|
30285
|
+
|
|
30286
|
+
"use strict";
|
|
30287
|
+
|
|
30288
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30289
|
+
exports.DebugLogger = void 0;
|
|
30290
|
+
exports.getGlobal = getGlobal;
|
|
30291
|
+
exports.isDebugEnabled = isDebugEnabled;
|
|
30292
|
+
exports.enableDebugLogs = enableDebugLogs;
|
|
30293
|
+
exports.disableTimestampsInLog = disableTimestampsInLog;
|
|
30294
|
+
/** @internal */
|
|
30295
|
+
function getGlobal() {
|
|
30296
|
+
if (typeof window !== 'undefined') {
|
|
30297
|
+
return window; // Browser environment.
|
|
30298
|
+
}
|
|
30299
|
+
if (typeof global !== 'undefined') {
|
|
30300
|
+
return global; // Node.js environment.
|
|
30301
|
+
}
|
|
30302
|
+
if (typeof self !== 'undefined') {
|
|
30303
|
+
return self; // Web Worker environment.
|
|
30304
|
+
}
|
|
30305
|
+
throw new Error('Unable to locate global object');
|
|
30306
|
+
}
|
|
30307
|
+
/** @internal */
|
|
30308
|
+
function isDebugEnabled() {
|
|
30309
|
+
const globalObj = getGlobal();
|
|
30310
|
+
return globalObj?.['SQUID_LOG_DEBUG_ENABLED'] === true;
|
|
30311
|
+
}
|
|
30312
|
+
/** @internal */
|
|
30313
|
+
function enableDebugLogs(isEnabled = true) {
|
|
30314
|
+
const globalObj = getGlobal();
|
|
30315
|
+
globalObj['SQUID_LOG_DEBUG_ENABLED'] = isEnabled;
|
|
30316
|
+
}
|
|
30317
|
+
function isSquidDebugEnabledByDefault() {
|
|
30318
|
+
let param = '';
|
|
30319
|
+
if (typeof window !== 'undefined' && window.location) {
|
|
30320
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
30321
|
+
param = searchParams.get('SQUID_DEBUG') || '';
|
|
30322
|
+
}
|
|
30323
|
+
else if (typeof process !== 'undefined' && process.env) {
|
|
30324
|
+
param = process.env['SQUID_DEBUG'] || '';
|
|
30325
|
+
}
|
|
30326
|
+
return param === '1' || param === 'true';
|
|
30327
|
+
}
|
|
30328
|
+
enableDebugLogs(isSquidDebugEnabledByDefault());
|
|
30329
|
+
/** @internal */
|
|
30330
|
+
function disableTimestampsInLog() {
|
|
30331
|
+
const globalObj = getGlobal();
|
|
30332
|
+
globalObj['SQUID_LOG_TIMESTAMPS_DISABLED'] = true;
|
|
30333
|
+
}
|
|
30334
|
+
function isTimestampsEnabled() {
|
|
30335
|
+
const globalObj = getGlobal();
|
|
30336
|
+
return globalObj?.['SQUID_LOG_TIMESTAMPS_DISABLED'] !== true;
|
|
30337
|
+
}
|
|
30338
|
+
/**
|
|
30339
|
+
* This class is used by the @squidcloud/client code.
|
|
30340
|
+
* We can’t override console.debug() with "logpipes" as we do for the core or tenant
|
|
30341
|
+
* because @squidcloud/client code is run in user environment.
|
|
30342
|
+
* Therefore, when we want to log anything from the client code, we use this logger.
|
|
30343
|
+
*
|
|
30344
|
+
* @internal.
|
|
30345
|
+
*/
|
|
30346
|
+
class DebugLogger {
|
|
30347
|
+
static debug(...args) {
|
|
30348
|
+
if (!isDebugEnabled())
|
|
30349
|
+
return;
|
|
30350
|
+
console.debug(`${getLogPrefixString()} DEBUG`, ...args);
|
|
30351
|
+
}
|
|
30352
|
+
}
|
|
30353
|
+
exports.DebugLogger = DebugLogger;
|
|
30354
|
+
function getLogPrefixString() {
|
|
30355
|
+
if (isTimestampsEnabled()) {
|
|
30356
|
+
const date = new Date();
|
|
30357
|
+
return `[${date.toLocaleTimeString()}.${date.getMilliseconds()}] squid`;
|
|
30358
|
+
}
|
|
30359
|
+
else {
|
|
30360
|
+
return 'squid';
|
|
30361
|
+
}
|
|
30362
|
+
}
|
|
30363
|
+
|
|
30364
|
+
|
|
30186
30365
|
/***/ },
|
|
30187
30366
|
|
|
30188
30367
|
/***/ 866
|
|
@@ -30266,6 +30445,38 @@ function isIOS(regionPrefix) {
|
|
|
30266
30445
|
}
|
|
30267
30446
|
|
|
30268
30447
|
|
|
30448
|
+
/***/ },
|
|
30449
|
+
|
|
30450
|
+
/***/ 9590
|
|
30451
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30452
|
+
|
|
30453
|
+
"use strict";
|
|
30454
|
+
|
|
30455
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30456
|
+
exports.timeSince = timeSince;
|
|
30457
|
+
exports.timePeriod = timePeriod;
|
|
30458
|
+
/*** The file contains logging helper methods. Used to reduce boilerplate code in logging functions. */
|
|
30459
|
+
const time_units_1 = __webpack_require__(1929);
|
|
30460
|
+
/**
|
|
30461
|
+
* Returns a formatted time duration string for the period from Date.now() to `startDate`.
|
|
30462
|
+
* Example "in 12s".
|
|
30463
|
+
* */
|
|
30464
|
+
function timeSince(startTime, prefix) {
|
|
30465
|
+
return timePeriod(Date.now() - startTime, prefix);
|
|
30466
|
+
}
|
|
30467
|
+
/**
|
|
30468
|
+
* Returns a formatted of duration of the `periodInMillis`.
|
|
30469
|
+
* Example "in 12s".
|
|
30470
|
+
* */
|
|
30471
|
+
function timePeriod(periodInMillis, prefix) {
|
|
30472
|
+
prefix = prefix === undefined ? 'time: ' : prefix;
|
|
30473
|
+
if (periodInMillis < time_units_1.MILLIS_PER_SECOND) {
|
|
30474
|
+
return `${prefix}${periodInMillis}ms`;
|
|
30475
|
+
}
|
|
30476
|
+
return `${prefix}${periodInMillis / time_units_1.MILLIS_PER_SECOND}s`;
|
|
30477
|
+
}
|
|
30478
|
+
|
|
30479
|
+
|
|
30269
30480
|
/***/ },
|
|
30270
30481
|
|
|
30271
30482
|
/***/ 3563
|
|
@@ -31010,12 +31221,16 @@ const adm_zip_1 = __importDefault(__webpack_require__(8023));
|
|
|
31010
31221
|
const assertic_1 = __webpack_require__(3205);
|
|
31011
31222
|
const fsSync = __importStar(__webpack_require__(9896));
|
|
31012
31223
|
const fs_1 = __webpack_require__(9896);
|
|
31224
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
31013
31225
|
const module_1 = __webpack_require__(3339);
|
|
31014
31226
|
const node_child_process_1 = __webpack_require__(1421);
|
|
31015
31227
|
const path_1 = __importDefault(__webpack_require__(6928));
|
|
31016
31228
|
const webpack_1 = __importDefault(__webpack_require__(6807));
|
|
31017
31229
|
const connector_types_1 = __webpack_require__(3420);
|
|
31018
31230
|
const assertion_utils_1 = __webpack_require__(6883);
|
|
31231
|
+
const enable_debug_decorator_utils_1 = __webpack_require__(8700);
|
|
31232
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
31233
|
+
const log_utils_1 = __webpack_require__(9590);
|
|
31019
31234
|
const openapi_utils_1 = __webpack_require__(3563);
|
|
31020
31235
|
const process_env_utils_1 = __webpack_require__(9360);
|
|
31021
31236
|
const resolve_1 = __webpack_require__(412);
|
|
@@ -31042,8 +31257,10 @@ async function displayVersionWarning(versionCheckPromise) {
|
|
|
31042
31257
|
catch (_ignored) { }
|
|
31043
31258
|
}
|
|
31044
31259
|
async function build({ verbose, dev, skipVersionCheck }) {
|
|
31045
|
-
|
|
31046
|
-
|
|
31260
|
+
const buildPhaseStart = Date.now();
|
|
31261
|
+
(0, global_utils_1.enableDebugLogs)(verbose || (0, global_utils_1.isDebugEnabled)());
|
|
31262
|
+
(0, logpipes_1.installConsoleOverrides)(enable_debug_decorator_utils_1.debugLogFilterPipe);
|
|
31263
|
+
console.debug(`Starting Squid project build. CLI package version: ${packageJson.version}`);
|
|
31047
31264
|
await (0, validate_1.validateSquidProject)();
|
|
31048
31265
|
// Start version checks in the background if not disabled.
|
|
31049
31266
|
const shouldSkipVersionCheck = skipVersionCheck || (0, process_env_utils_1.isEnvVarTruthy)('SQUID_SKIP_BUILD_TIME_VERSION_CHECK');
|
|
@@ -31052,27 +31269,29 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
31052
31269
|
const versionCheckPromise = shouldSkipVersionCheck ? Promise.resolve(undefined) : (0, version_check_1.checkCliVersion)(currentVersion);
|
|
31053
31270
|
const distPath = path_1.default.resolve(process.cwd(), 'dist');
|
|
31054
31271
|
if (fsSync.existsSync(distPath)) {
|
|
31055
|
-
|
|
31056
|
-
console.log(`Cleaning existing dist dir before the build: ${distPath}`);
|
|
31272
|
+
console.debug(`Cleaning existing dist dir before the build: ${distPath}`);
|
|
31057
31273
|
await fs_1.promises.rm(distPath, { recursive: true, force: true });
|
|
31058
31274
|
}
|
|
31059
31275
|
await fs_1.promises.mkdir(distPath);
|
|
31060
31276
|
const isSquidConnector = (0, process_env_utils_1.isEnvVarTruthy)('SQUID_CONNECTOR');
|
|
31277
|
+
const specsStart = Date.now();
|
|
31061
31278
|
const openApiSpecAndControllers = await tsoa_utils_1.TsoaUtils.generateAllSpecs(verbose, !isSquidConnector);
|
|
31279
|
+
console.debug((0, log_utils_1.timeSince)(specsStart, '⏱ TsoaUtils.generateAllSpecs '));
|
|
31062
31280
|
await fs_1.promises.writeFile(path_1.default.join(distPath, '', 'openapi-spec-and-controllers.json'), JSON.stringify(openApiSpecAndControllers));
|
|
31063
31281
|
const isUserConfigMode = fsSync.existsSync(resolve_2.USER_WEBPACK_CONFIG_PATH);
|
|
31064
31282
|
const webpackConfigPath = isUserConfigMode ? resolve_2.USER_WEBPACK_CONFIG_PATH : resolve_2.BUILT_IN_WEBPACK_CONFIG_PATH;
|
|
31065
|
-
|
|
31066
|
-
console.log(`Using webpack config from ${webpackConfigPath}`);
|
|
31283
|
+
console.debug(`Using webpack config from ${webpackConfigPath}`);
|
|
31067
31284
|
const localConfig = (0, resolve_1.requirePath)(webpackConfigPath);
|
|
31068
31285
|
const mode = dev ? 'development' : 'production';
|
|
31069
31286
|
const webpackConfig = localConfig(undefined, { mode });
|
|
31070
31287
|
webpackConfig.mode = webpackConfig.mode || mode;
|
|
31071
31288
|
try {
|
|
31072
31289
|
console.log((0, logging_1.primary)('Building...'));
|
|
31290
|
+
const webpackStart = Date.now();
|
|
31073
31291
|
await new Promise((resolve, reject) => {
|
|
31074
31292
|
(0, webpack_1.default)(webpackConfig, (err, stats) => {
|
|
31075
31293
|
if (err) {
|
|
31294
|
+
console.debug((0, log_utils_1.timeSince)(webpackStart, '⏱ webpack build '));
|
|
31076
31295
|
console.error('Build failed a fatal error.');
|
|
31077
31296
|
return reject(err);
|
|
31078
31297
|
}
|
|
@@ -31089,34 +31308,36 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
31089
31308
|
}));
|
|
31090
31309
|
}
|
|
31091
31310
|
if (stats?.hasErrors()) {
|
|
31311
|
+
console.debug((0, log_utils_1.timeSince)(webpackStart, '⏱ webpack build '));
|
|
31092
31312
|
return reject(new Error('Build failed with errors.'));
|
|
31093
31313
|
}
|
|
31314
|
+
console.debug((0, log_utils_1.timeSince)(webpackStart, '⏱ webpack build '));
|
|
31094
31315
|
console.log('Build succeeded.');
|
|
31095
31316
|
resolve();
|
|
31096
31317
|
});
|
|
31097
31318
|
});
|
|
31098
31319
|
// Generate connector metadata if this is a connector build.
|
|
31099
31320
|
if (isSquidConnector) {
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
await generateConnectorMetadata(distPath
|
|
31321
|
+
console.debug('Generating connector metadata...');
|
|
31322
|
+
const metadataStart = Date.now();
|
|
31323
|
+
await generateConnectorMetadata(distPath);
|
|
31324
|
+
console.debug((0, log_utils_1.timeSince)(metadataStart, '⏱ generateConnectorMetadata '));
|
|
31103
31325
|
// Add metadata to bundle.zip.
|
|
31104
31326
|
const zipPath = path_1.default.join(distPath, 'bundle.zip');
|
|
31105
31327
|
const zip = new adm_zip_1.default(zipPath);
|
|
31106
31328
|
zip.addLocalFile(path_1.default.join(distPath, connector_types_1.CONNECTOR_METADATA_JSON_FILE));
|
|
31107
31329
|
zip.writeZip(zipPath);
|
|
31108
|
-
|
|
31109
|
-
console.log('Added connector metadata to bundle.zip');
|
|
31330
|
+
console.debug('Added connector metadata to bundle.zip');
|
|
31110
31331
|
}
|
|
31111
31332
|
// Show version check warning after successful build.
|
|
31112
31333
|
await displayVersionWarning(versionCheckPromise);
|
|
31334
|
+
console.debug((0, log_utils_1.timeSince)(buildPhaseStart, '⏱ Total CLI build time '));
|
|
31113
31335
|
}
|
|
31114
31336
|
catch (e) {
|
|
31115
31337
|
// Show a version check warning even if the build failed.
|
|
31116
31338
|
await displayVersionWarning(versionCheckPromise);
|
|
31117
31339
|
const errorMessage = (0, assertic_1.getMessageFromError)(e);
|
|
31118
|
-
|
|
31119
|
-
console.log(`Exiting with error: ${errorMessage}`);
|
|
31340
|
+
console.debug(`Exiting with error: ${errorMessage}`);
|
|
31120
31341
|
(0, process_utils_1.exitWithError)(errorMessage);
|
|
31121
31342
|
}
|
|
31122
31343
|
}
|
|
@@ -31125,7 +31346,7 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
31125
31346
|
*/
|
|
31126
31347
|
const INTEGRATIONLESS_CONNECTORS = ['cotomi'];
|
|
31127
31348
|
/** Generates connector metadata JSON file in the dist directory. */
|
|
31128
|
-
async function generateConnectorMetadata(distPath
|
|
31349
|
+
async function generateConnectorMetadata(distPath) {
|
|
31129
31350
|
const packageJsonPath = path_1.default.resolve(process.cwd(), 'package.json');
|
|
31130
31351
|
const packageJson = JSON.parse(await fs_1.promises.readFile(packageJsonPath, 'utf8'));
|
|
31131
31352
|
(0, assertic_1.assertTruthy)(packageJson.version, 'Failed to read version from package.json');
|
|
@@ -31148,8 +31369,7 @@ async function generateConnectorMetadata(distPath, verbose) {
|
|
|
31148
31369
|
(0, assertic_1.assertTruthy)(typeof bundleData === 'object', `Unexpected "default:metadata" function response: ${typeof bundleData}`);
|
|
31149
31370
|
// Populate openApiControllersMap from openapi-spec-and-controllers.json.
|
|
31150
31371
|
await (0, openapi_utils_1.populateOpenApiControllersMap)(bundleData, distPath, 'connector');
|
|
31151
|
-
|
|
31152
|
-
console.log('Populated openApiControllersMap in bundle metadata');
|
|
31372
|
+
console.debug('Populated openApiControllersMap in bundle metadata');
|
|
31153
31373
|
const integrationTypes = INTEGRATIONLESS_CONNECTORS.includes(connectorId)
|
|
31154
31374
|
? []
|
|
31155
31375
|
: buildSupportedIntegrationTypesFromBundleData(bundleData);
|
|
@@ -31161,10 +31381,7 @@ async function generateConnectorMetadata(distPath, verbose) {
|
|
|
31161
31381
|
};
|
|
31162
31382
|
const metadataPath = path_1.default.join(distPath, connector_types_1.CONNECTOR_METADATA_JSON_FILE);
|
|
31163
31383
|
await fs_1.promises.writeFile(metadataPath, JSON.stringify(packageMetadata, null, 2));
|
|
31164
|
-
|
|
31165
|
-
console.log('Connector metadata generated successfully:');
|
|
31166
|
-
console.dir(packageMetadata, { depth: 2, colors: true });
|
|
31167
|
-
}
|
|
31384
|
+
console.debug('Connector metadata generated successfully:', packageMetadata);
|
|
31168
31385
|
}
|
|
31169
31386
|
/** Returns a list of supported integration types. Checks AI function attributes for that. */
|
|
31170
31387
|
function buildSupportedIntegrationTypesFromBundleData(bundleData) {
|
|
@@ -31220,12 +31437,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
31220
31437
|
exports.deploy = deploy;
|
|
31221
31438
|
const assertic_1 = __webpack_require__(3205);
|
|
31222
31439
|
const fs = __importStar(__webpack_require__(1943));
|
|
31440
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
31223
31441
|
const communication_types_1 = __webpack_require__(3443);
|
|
31442
|
+
const enable_debug_decorator_utils_1 = __webpack_require__(8700);
|
|
31443
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
31224
31444
|
const http_1 = __webpack_require__(866);
|
|
31225
31445
|
const shell_runner_1 = __webpack_require__(3089);
|
|
31226
31446
|
const environment_1 = __webpack_require__(722);
|
|
31227
31447
|
const process_utils_1 = __webpack_require__(8251);
|
|
31228
31448
|
async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct, isUserSpecifiedPath, skipBuild, internalApiKey, environmentId) {
|
|
31449
|
+
(0, global_utils_1.enableDebugLogs)(verbose || (0, global_utils_1.isDebugEnabled)());
|
|
31450
|
+
(0, logpipes_1.installConsoleOverrides)(enable_debug_decorator_utils_1.debugLogFilterPipe);
|
|
31229
31451
|
if (!direct && !isUserSpecifiedPath && !skipBuild) {
|
|
31230
31452
|
console.log('Building code bundle...');
|
|
31231
31453
|
await (0, shell_runner_1.runInShell)('npm run build');
|
|
@@ -31240,9 +31462,7 @@ async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct,
|
|
|
31240
31462
|
? (0, http_1.getApplicationUrl)(consoleRegion, appIdWithEnvId, 'application/updateApplicationCode')
|
|
31241
31463
|
: (0, http_1.getApplicationUrl)(consoleRegion, environment_1.environment.consoleAppId, 'webhooks/updateApplicationCode');
|
|
31242
31464
|
console.log(`Deploying code bundle for appId '${appId}' to the '${environmentId}' environment...`);
|
|
31243
|
-
|
|
31244
|
-
console.log('Deploying bundle to:', updateCodeUrl);
|
|
31245
|
-
}
|
|
31465
|
+
console.debug('Deploying bundle to:', updateCodeUrl);
|
|
31246
31466
|
try {
|
|
31247
31467
|
const headers = new Headers();
|
|
31248
31468
|
if (apiKey) {
|
|
@@ -31259,9 +31479,7 @@ async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct,
|
|
|
31259
31479
|
console.log('Code deployed');
|
|
31260
31480
|
}
|
|
31261
31481
|
catch (error) {
|
|
31262
|
-
|
|
31263
|
-
console.error('VERBOSE: error deploying bundle:', error);
|
|
31264
|
-
}
|
|
31482
|
+
console.debug('Error deploying bundle:', error);
|
|
31265
31483
|
const errorMessage = (0, assertic_1.getMessageFromError)(error, '');
|
|
31266
31484
|
(0, process_utils_1.exitWithError)('Unable to deploy bundle:', errorMessage || error);
|
|
31267
31485
|
}
|
|
@@ -31762,9 +31980,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
31762
31980
|
exports.initSample = initSample;
|
|
31763
31981
|
const assertic_1 = __webpack_require__(3205);
|
|
31764
31982
|
const promises_1 = __importDefault(__webpack_require__(1943));
|
|
31983
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
31765
31984
|
const path_1 = __importDefault(__webpack_require__(6928));
|
|
31766
31985
|
const communication_types_1 = __webpack_require__(3443);
|
|
31767
31986
|
const utils_1 = __webpack_require__(1215);
|
|
31987
|
+
const enable_debug_decorator_utils_1 = __webpack_require__(8700);
|
|
31988
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
31768
31989
|
const shell_runner_1 = __webpack_require__(3089);
|
|
31769
31990
|
const git_utils_1 = __webpack_require__(954);
|
|
31770
31991
|
const logging_1 = __webpack_require__(443);
|
|
@@ -31772,6 +31993,8 @@ const process_utils_1 = __webpack_require__(8251);
|
|
|
31772
31993
|
const report_utils_1 = __webpack_require__(3066);
|
|
31773
31994
|
const ORG = 'squid-cloud-samples';
|
|
31774
31995
|
async function initSample(consoleRegion, isOnPremConsole, dirPath, appId, apiKey, environmentId, squidDeveloperId, region, templateName, verbose = false) {
|
|
31996
|
+
(0, global_utils_1.enableDebugLogs)(verbose || (0, global_utils_1.isDebugEnabled)());
|
|
31997
|
+
(0, logpipes_1.installConsoleOverrides)(enable_debug_decorator_utils_1.debugLogFilterPipe);
|
|
31775
31998
|
try {
|
|
31776
31999
|
await promises_1.default.stat(path_1.default.resolve(dirPath));
|
|
31777
32000
|
(0, process_utils_1.exitWithError)(`Project already exists: ${dirPath}`);
|
|
@@ -31875,7 +32098,7 @@ ${(0, logging_1.primary)('Done. Now run:')}
|
|
|
31875
32098
|
cd ${dirPath}
|
|
31876
32099
|
npm run start
|
|
31877
32100
|
`);
|
|
31878
|
-
await (0, report_utils_1.reportLocalBackendInitialized)(consoleRegion, (0, communication_types_1.appIdWithEnvironmentIdAndDevId)(appId, environmentId, squidDeveloperId), apiKey
|
|
32101
|
+
await (0, report_utils_1.reportLocalBackendInitialized)(consoleRegion, (0, communication_types_1.appIdWithEnvironmentIdAndDevId)(appId, environmentId, squidDeveloperId), apiKey);
|
|
31879
32102
|
}
|
|
31880
32103
|
else {
|
|
31881
32104
|
console.log((0, logging_1.link)('https://console.getsquid.ai'));
|
|
@@ -32169,11 +32392,9 @@ exports.reportLocalBackendInitialized = reportLocalBackendInitialized;
|
|
|
32169
32392
|
const assertic_1 = __webpack_require__(3205);
|
|
32170
32393
|
const http_1 = __webpack_require__(866);
|
|
32171
32394
|
const environment_1 = __webpack_require__(722);
|
|
32172
|
-
async function reportLocalBackendInitialized(consoleRegion, appId, apiKey
|
|
32395
|
+
async function reportLocalBackendInitialized(consoleRegion, appId, apiKey) {
|
|
32173
32396
|
const url = `${(0, http_1.getApplicationUrl)(consoleRegion, environment_1.environment.consoleAppId, 'webhooks/reportLocalBackendInitialized')}`;
|
|
32174
|
-
|
|
32175
|
-
console.log('Reporting backend initialization to Squid Console...', url);
|
|
32176
|
-
}
|
|
32397
|
+
console.debug('Reporting backend initialization to Squid Console...', url);
|
|
32177
32398
|
try {
|
|
32178
32399
|
const headers = new Headers();
|
|
32179
32400
|
headers.append('Authorization', `ApiKey ${apiKey}`);
|
|
@@ -33982,6 +34203,14 @@ module.exports = require("assert");
|
|
|
33982
34203
|
|
|
33983
34204
|
/***/ },
|
|
33984
34205
|
|
|
34206
|
+
/***/ 290
|
|
34207
|
+
(module) {
|
|
34208
|
+
|
|
34209
|
+
"use strict";
|
|
34210
|
+
module.exports = require("async_hooks");
|
|
34211
|
+
|
|
34212
|
+
/***/ },
|
|
34213
|
+
|
|
33985
34214
|
/***/ 181
|
|
33986
34215
|
(module) {
|
|
33987
34216
|
|
|
@@ -36708,7 +36937,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"seek-bzip","version":"1.0.6",
|
|
|
36708
36937
|
(module) {
|
|
36709
36938
|
|
|
36710
36939
|
"use strict";
|
|
36711
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.
|
|
36940
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.449","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.449","adm-zip":"^0.5.16","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","logpipes":"^1.11.0","nodemon":"^3.1.9","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.101.3","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/adm-zip":"^0.5.7","@types/decompress":"^4.2.7","@types/node":"^20.19.9","terminal-link":"^3.0.0"}}');
|
|
36712
36941
|
|
|
36713
36942
|
/***/ }
|
|
36714
36943
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.449",
|
|
4
4
|
"description": "The Squid CLI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@squidcloud/local-backend": "^1.0.
|
|
31
|
+
"@squidcloud/local-backend": "^1.0.449",
|
|
32
32
|
"adm-zip": "^0.5.16",
|
|
33
33
|
"copy-webpack-plugin": "^12.0.2",
|
|
34
34
|
"decompress": "^4.2.1",
|
|
35
|
+
"logpipes": "^1.11.0",
|
|
35
36
|
"nodemon": "^3.1.9",
|
|
36
37
|
"terser-webpack-plugin": "^5.3.10",
|
|
37
38
|
"ts-loader": "^9.5.1",
|