@squidcloud/cli 1.0.447 → 1.0.450
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
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
|
|
@@ -29619,6 +29656,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
29619
29656
|
exports.OPEN_AI_CREATE_SPEECH_FORMATS = exports.AI_AUDIO_CREATE_SPEECH_MODEL_NAMES = exports.AI_AUDIO_TRANSCRIPTION_MODEL_NAMES = exports.AI_IMAGE_MODEL_NAMES = exports.FLUX_MODEL_NAMES = exports.STABLE_DIFFUSION_MODEL_NAMES = exports.OPENAI_AUDIO_MODEL_NAMES = exports.OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES = exports.OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES = exports.OPENAI_IMAGE_MODEL_NAMES = exports.AI_EMBEDDINGS_MODEL_NAMES = exports.BEDROCK_EMBEDDING_MODEL_NAMES = exports.VOYAGE_EMBEDDING_MODEL_NAMES = exports.OPENAI_EMBEDDINGS_MODEL_NAMES = exports.VENDOR_AI_CHAT_MODEL_NAMES = exports.ANTHROPIC_CHAT_MODEL_NAMES = exports.GROK_CHAT_MODEL_NAMES = exports.GEMINI_CHAT_MODEL_NAMES = exports.OPENAI_CHAT_MODEL_NAMES = exports.AI_PROVIDER_TYPES = exports.RERANK_PROVIDERS = void 0;
|
|
29620
29657
|
exports.isVendorAiChatModelName = isVendorAiChatModelName;
|
|
29621
29658
|
exports.isAiEmbeddingsModelName = isAiEmbeddingsModelName;
|
|
29659
|
+
exports.isIntegrationEmbeddingModelSpec = isIntegrationEmbeddingModelSpec;
|
|
29622
29660
|
exports.isIntegrationModelSpec = isIntegrationModelSpec;
|
|
29623
29661
|
/**
|
|
29624
29662
|
* @category AI
|
|
@@ -29705,6 +29743,13 @@ exports.AI_EMBEDDINGS_MODEL_NAMES = [
|
|
|
29705
29743
|
function isAiEmbeddingsModelName(modelName) {
|
|
29706
29744
|
return exports.AI_EMBEDDINGS_MODEL_NAMES.includes(modelName);
|
|
29707
29745
|
}
|
|
29746
|
+
/**
|
|
29747
|
+
* Type guard for `IntegrationEmbeddingModelSpec`.
|
|
29748
|
+
* @category AI
|
|
29749
|
+
*/
|
|
29750
|
+
function isIntegrationEmbeddingModelSpec(model) {
|
|
29751
|
+
return (typeof model === 'object' && model !== null && 'integrationId' in model && 'model' in model && 'dimensions' in model);
|
|
29752
|
+
}
|
|
29708
29753
|
/**
|
|
29709
29754
|
* The supported AI image generation model names.
|
|
29710
29755
|
* @category AI
|
|
@@ -29856,6 +29901,7 @@ exports.INTEGRATION_TYPES = [
|
|
|
29856
29901
|
'legend',
|
|
29857
29902
|
'teams',
|
|
29858
29903
|
'openai_compatible',
|
|
29904
|
+
'openai_compatible_embedding',
|
|
29859
29905
|
];
|
|
29860
29906
|
/**
|
|
29861
29907
|
* @category Database
|
|
@@ -30183,6 +30229,152 @@ exports.applicationAppConnectorsAssertion = {
|
|
|
30183
30229
|
};
|
|
30184
30230
|
|
|
30185
30231
|
|
|
30232
|
+
/***/ },
|
|
30233
|
+
|
|
30234
|
+
/***/ 8700
|
|
30235
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30236
|
+
|
|
30237
|
+
"use strict";
|
|
30238
|
+
|
|
30239
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30240
|
+
exports.debugLogFilterPipe = void 0;
|
|
30241
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
30242
|
+
const enable_debug_logs_decorator_1 = __webpack_require__(5692);
|
|
30243
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
30244
|
+
exports.debugLogFilterPipe = (0, logpipes_1.createLogLevelFilterPipe)({
|
|
30245
|
+
excludedLogLevels: level => {
|
|
30246
|
+
if (level !== 'debug')
|
|
30247
|
+
return false;
|
|
30248
|
+
if ((0, global_utils_1.isDebugEnabled)())
|
|
30249
|
+
return false; // Debug is enabled globally.
|
|
30250
|
+
return !(0, enable_debug_logs_decorator_1.isInDebugDecoratorContext)(); // Check if debug is enabled only for this nested call.
|
|
30251
|
+
},
|
|
30252
|
+
});
|
|
30253
|
+
|
|
30254
|
+
|
|
30255
|
+
/***/ },
|
|
30256
|
+
|
|
30257
|
+
/***/ 5692
|
|
30258
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30259
|
+
|
|
30260
|
+
"use strict";
|
|
30261
|
+
|
|
30262
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30263
|
+
exports.EnableDebugLogs = EnableDebugLogs;
|
|
30264
|
+
exports.isInDebugDecoratorContext = isInDebugDecoratorContext;
|
|
30265
|
+
const async_hooks_1 = __webpack_require__(290);
|
|
30266
|
+
const store = new async_hooks_1.AsyncLocalStorage();
|
|
30267
|
+
/**
|
|
30268
|
+
* Method decorator that enables debug logs only within the async context of the decorated method call.
|
|
30269
|
+
* This allows debug logging to be scoped to specific method executions without affecting global debug settings.
|
|
30270
|
+
* Works by making isInDebugContext() return true within the decorated context.
|
|
30271
|
+
*
|
|
30272
|
+
* Note: the decoration works only in Node.js.
|
|
30273
|
+
*/
|
|
30274
|
+
function EnableDebugLogs(_target, _propertyName, descriptor) {
|
|
30275
|
+
const method = descriptor.value;
|
|
30276
|
+
descriptor.value = async function (...args) {
|
|
30277
|
+
// Run the method within the debug context.
|
|
30278
|
+
return store.run(true, async () => {
|
|
30279
|
+
return await method.apply(this, args);
|
|
30280
|
+
});
|
|
30281
|
+
};
|
|
30282
|
+
return descriptor;
|
|
30283
|
+
}
|
|
30284
|
+
/** Returns true if called from within debug log enabled context. */
|
|
30285
|
+
function isInDebugDecoratorContext() {
|
|
30286
|
+
return store.getStore() === true;
|
|
30287
|
+
}
|
|
30288
|
+
|
|
30289
|
+
|
|
30290
|
+
/***/ },
|
|
30291
|
+
|
|
30292
|
+
/***/ 6334
|
|
30293
|
+
(__unused_webpack_module, exports) {
|
|
30294
|
+
|
|
30295
|
+
"use strict";
|
|
30296
|
+
|
|
30297
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30298
|
+
exports.DebugLogger = void 0;
|
|
30299
|
+
exports.getGlobal = getGlobal;
|
|
30300
|
+
exports.isDebugEnabled = isDebugEnabled;
|
|
30301
|
+
exports.enableDebugLogs = enableDebugLogs;
|
|
30302
|
+
exports.disableTimestampsInLog = disableTimestampsInLog;
|
|
30303
|
+
/** @internal */
|
|
30304
|
+
function getGlobal() {
|
|
30305
|
+
if (typeof window !== 'undefined') {
|
|
30306
|
+
return window; // Browser environment.
|
|
30307
|
+
}
|
|
30308
|
+
if (typeof global !== 'undefined') {
|
|
30309
|
+
return global; // Node.js environment.
|
|
30310
|
+
}
|
|
30311
|
+
if (typeof self !== 'undefined') {
|
|
30312
|
+
return self; // Web Worker environment.
|
|
30313
|
+
}
|
|
30314
|
+
throw new Error('Unable to locate global object');
|
|
30315
|
+
}
|
|
30316
|
+
/** @internal */
|
|
30317
|
+
function isDebugEnabled() {
|
|
30318
|
+
const globalObj = getGlobal();
|
|
30319
|
+
return globalObj?.['SQUID_LOG_DEBUG_ENABLED'] === true;
|
|
30320
|
+
}
|
|
30321
|
+
/** @internal */
|
|
30322
|
+
function enableDebugLogs(isEnabled = true) {
|
|
30323
|
+
const globalObj = getGlobal();
|
|
30324
|
+
globalObj['SQUID_LOG_DEBUG_ENABLED'] = isEnabled;
|
|
30325
|
+
}
|
|
30326
|
+
function isSquidDebugEnabledByDefault() {
|
|
30327
|
+
let param = '';
|
|
30328
|
+
if (typeof window !== 'undefined' && window.location) {
|
|
30329
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
30330
|
+
param = searchParams.get('SQUID_DEBUG') || '';
|
|
30331
|
+
}
|
|
30332
|
+
else if (typeof process !== 'undefined' && process.env) {
|
|
30333
|
+
param = process.env['SQUID_DEBUG'] || '';
|
|
30334
|
+
}
|
|
30335
|
+
return param === '1' || param === 'true';
|
|
30336
|
+
}
|
|
30337
|
+
// Auto-initialize debug flag only if not explicitly set already.
|
|
30338
|
+
// This prevents bundled code from overriding the flag set by the host application.
|
|
30339
|
+
if (getGlobal()?.['SQUID_LOG_DEBUG_ENABLED'] === undefined) {
|
|
30340
|
+
enableDebugLogs(isSquidDebugEnabledByDefault());
|
|
30341
|
+
}
|
|
30342
|
+
/** @internal */
|
|
30343
|
+
function disableTimestampsInLog() {
|
|
30344
|
+
const globalObj = getGlobal();
|
|
30345
|
+
globalObj['SQUID_LOG_TIMESTAMPS_DISABLED'] = true;
|
|
30346
|
+
}
|
|
30347
|
+
function isTimestampsEnabled() {
|
|
30348
|
+
const globalObj = getGlobal();
|
|
30349
|
+
return globalObj?.['SQUID_LOG_TIMESTAMPS_DISABLED'] !== true;
|
|
30350
|
+
}
|
|
30351
|
+
/**
|
|
30352
|
+
* This class is used by the @squidcloud/client code.
|
|
30353
|
+
* We can’t override console.debug() with "logpipes" as we do for the core or tenant
|
|
30354
|
+
* because @squidcloud/client code is run in user environment.
|
|
30355
|
+
* Therefore, when we want to log anything from the client code, we use this logger.
|
|
30356
|
+
*
|
|
30357
|
+
* @internal.
|
|
30358
|
+
*/
|
|
30359
|
+
class DebugLogger {
|
|
30360
|
+
static debug(...args) {
|
|
30361
|
+
if (!isDebugEnabled())
|
|
30362
|
+
return;
|
|
30363
|
+
console.debug(`${getLogPrefixString()} DEBUG`, ...args);
|
|
30364
|
+
}
|
|
30365
|
+
}
|
|
30366
|
+
exports.DebugLogger = DebugLogger;
|
|
30367
|
+
function getLogPrefixString() {
|
|
30368
|
+
if (isTimestampsEnabled()) {
|
|
30369
|
+
const date = new Date();
|
|
30370
|
+
return `[${date.toLocaleTimeString()}.${date.getMilliseconds()}] squid`;
|
|
30371
|
+
}
|
|
30372
|
+
else {
|
|
30373
|
+
return 'squid';
|
|
30374
|
+
}
|
|
30375
|
+
}
|
|
30376
|
+
|
|
30377
|
+
|
|
30186
30378
|
/***/ },
|
|
30187
30379
|
|
|
30188
30380
|
/***/ 866
|
|
@@ -30266,6 +30458,38 @@ function isIOS(regionPrefix) {
|
|
|
30266
30458
|
}
|
|
30267
30459
|
|
|
30268
30460
|
|
|
30461
|
+
/***/ },
|
|
30462
|
+
|
|
30463
|
+
/***/ 9590
|
|
30464
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
30465
|
+
|
|
30466
|
+
"use strict";
|
|
30467
|
+
|
|
30468
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30469
|
+
exports.timeSince = timeSince;
|
|
30470
|
+
exports.timePeriod = timePeriod;
|
|
30471
|
+
/*** The file contains logging helper methods. Used to reduce boilerplate code in logging functions. */
|
|
30472
|
+
const time_units_1 = __webpack_require__(1929);
|
|
30473
|
+
/**
|
|
30474
|
+
* Returns a formatted time duration string for the period from Date.now() to `startDate`.
|
|
30475
|
+
* Example "in 12s".
|
|
30476
|
+
* */
|
|
30477
|
+
function timeSince(startTime, prefix) {
|
|
30478
|
+
return timePeriod(Date.now() - startTime, prefix);
|
|
30479
|
+
}
|
|
30480
|
+
/**
|
|
30481
|
+
* Returns a formatted of duration of the `periodInMillis`.
|
|
30482
|
+
* Example "in 12s".
|
|
30483
|
+
* */
|
|
30484
|
+
function timePeriod(periodInMillis, prefix) {
|
|
30485
|
+
prefix = prefix === undefined ? 'time: ' : prefix;
|
|
30486
|
+
if (periodInMillis < time_units_1.MILLIS_PER_SECOND) {
|
|
30487
|
+
return `${prefix}${periodInMillis}ms`;
|
|
30488
|
+
}
|
|
30489
|
+
return `${prefix}${periodInMillis / time_units_1.MILLIS_PER_SECOND}s`;
|
|
30490
|
+
}
|
|
30491
|
+
|
|
30492
|
+
|
|
30269
30493
|
/***/ },
|
|
30270
30494
|
|
|
30271
30495
|
/***/ 3563
|
|
@@ -31010,17 +31234,22 @@ const adm_zip_1 = __importDefault(__webpack_require__(8023));
|
|
|
31010
31234
|
const assertic_1 = __webpack_require__(3205);
|
|
31011
31235
|
const fsSync = __importStar(__webpack_require__(9896));
|
|
31012
31236
|
const fs_1 = __webpack_require__(9896);
|
|
31237
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
31013
31238
|
const module_1 = __webpack_require__(3339);
|
|
31014
31239
|
const node_child_process_1 = __webpack_require__(1421);
|
|
31015
31240
|
const path_1 = __importDefault(__webpack_require__(6928));
|
|
31016
31241
|
const webpack_1 = __importDefault(__webpack_require__(6807));
|
|
31017
31242
|
const connector_types_1 = __webpack_require__(3420);
|
|
31018
31243
|
const assertion_utils_1 = __webpack_require__(6883);
|
|
31244
|
+
const enable_debug_decorator_utils_1 = __webpack_require__(8700);
|
|
31245
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
31246
|
+
const log_utils_1 = __webpack_require__(9590);
|
|
31019
31247
|
const openapi_utils_1 = __webpack_require__(3563);
|
|
31020
31248
|
const process_env_utils_1 = __webpack_require__(9360);
|
|
31021
31249
|
const resolve_1 = __webpack_require__(412);
|
|
31022
31250
|
const tsoa_utils_1 = __webpack_require__(1431);
|
|
31023
31251
|
const packageJson = __importStar(__webpack_require__(8330));
|
|
31252
|
+
const update_skills_1 = __webpack_require__(7286);
|
|
31024
31253
|
const logging_1 = __webpack_require__(443);
|
|
31025
31254
|
const process_utils_1 = __webpack_require__(8251);
|
|
31026
31255
|
const resolve_2 = __webpack_require__(3878);
|
|
@@ -31032,18 +31261,11 @@ const version_check_1 = __webpack_require__(4827);
|
|
|
31032
31261
|
// - Default: colors only if TTY (stdout is a terminal).
|
|
31033
31262
|
const isTerminal = process.stdout.isTTY;
|
|
31034
31263
|
const useColorsInOutput = (0, process_env_utils_1.isEnvVarTruthy)('FORCE_COLOR') || (!(0, process_env_utils_1.isEnvVarTruthy)('NO_COLOR') && isTerminal);
|
|
31035
|
-
async function displayVersionWarning(versionCheckPromise) {
|
|
31036
|
-
try {
|
|
31037
|
-
const versionWarning = await versionCheckPromise;
|
|
31038
|
-
if (versionWarning) {
|
|
31039
|
-
console.warn(versionWarning);
|
|
31040
|
-
}
|
|
31041
|
-
}
|
|
31042
|
-
catch (_ignored) { }
|
|
31043
|
-
}
|
|
31044
31264
|
async function build({ verbose, dev, skipVersionCheck }) {
|
|
31045
|
-
|
|
31046
|
-
|
|
31265
|
+
const buildPhaseStart = Date.now();
|
|
31266
|
+
(0, global_utils_1.enableDebugLogs)(verbose || (0, global_utils_1.isDebugEnabled)());
|
|
31267
|
+
(0, logpipes_1.installConsoleOverrides)(enable_debug_decorator_utils_1.debugLogFilterPipe);
|
|
31268
|
+
console.debug(`Starting Squid project build. CLI package version: ${packageJson.version}`);
|
|
31047
31269
|
await (0, validate_1.validateSquidProject)();
|
|
31048
31270
|
// Start version checks in the background if not disabled.
|
|
31049
31271
|
const shouldSkipVersionCheck = skipVersionCheck || (0, process_env_utils_1.isEnvVarTruthy)('SQUID_SKIP_BUILD_TIME_VERSION_CHECK');
|
|
@@ -31052,27 +31274,29 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
31052
31274
|
const versionCheckPromise = shouldSkipVersionCheck ? Promise.resolve(undefined) : (0, version_check_1.checkCliVersion)(currentVersion);
|
|
31053
31275
|
const distPath = path_1.default.resolve(process.cwd(), 'dist');
|
|
31054
31276
|
if (fsSync.existsSync(distPath)) {
|
|
31055
|
-
|
|
31056
|
-
console.log(`Cleaning existing dist dir before the build: ${distPath}`);
|
|
31277
|
+
console.debug(`Cleaning existing dist dir before the build: ${distPath}`);
|
|
31057
31278
|
await fs_1.promises.rm(distPath, { recursive: true, force: true });
|
|
31058
31279
|
}
|
|
31059
31280
|
await fs_1.promises.mkdir(distPath);
|
|
31060
31281
|
const isSquidConnector = (0, process_env_utils_1.isEnvVarTruthy)('SQUID_CONNECTOR');
|
|
31282
|
+
const specsStart = Date.now();
|
|
31061
31283
|
const openApiSpecAndControllers = await tsoa_utils_1.TsoaUtils.generateAllSpecs(verbose, !isSquidConnector);
|
|
31284
|
+
console.debug((0, log_utils_1.timeSince)(specsStart, 'OpenAPI specs generation time '));
|
|
31062
31285
|
await fs_1.promises.writeFile(path_1.default.join(distPath, '', 'openapi-spec-and-controllers.json'), JSON.stringify(openApiSpecAndControllers));
|
|
31063
31286
|
const isUserConfigMode = fsSync.existsSync(resolve_2.USER_WEBPACK_CONFIG_PATH);
|
|
31064
31287
|
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}`);
|
|
31288
|
+
console.debug(`Using webpack config from ${webpackConfigPath}`);
|
|
31067
31289
|
const localConfig = (0, resolve_1.requirePath)(webpackConfigPath);
|
|
31068
31290
|
const mode = dev ? 'development' : 'production';
|
|
31069
31291
|
const webpackConfig = localConfig(undefined, { mode });
|
|
31070
31292
|
webpackConfig.mode = webpackConfig.mode || mode;
|
|
31071
31293
|
try {
|
|
31072
31294
|
console.log((0, logging_1.primary)('Building...'));
|
|
31295
|
+
const webpackStart = Date.now();
|
|
31073
31296
|
await new Promise((resolve, reject) => {
|
|
31074
31297
|
(0, webpack_1.default)(webpackConfig, (err, stats) => {
|
|
31075
31298
|
if (err) {
|
|
31299
|
+
console.debug((0, log_utils_1.timeSince)(webpackStart, 'Webpack build time '));
|
|
31076
31300
|
console.error('Build failed a fatal error.');
|
|
31077
31301
|
return reject(err);
|
|
31078
31302
|
}
|
|
@@ -31089,34 +31313,40 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
31089
31313
|
}));
|
|
31090
31314
|
}
|
|
31091
31315
|
if (stats?.hasErrors()) {
|
|
31316
|
+
console.debug((0, log_utils_1.timeSince)(webpackStart, 'Webpack build time '));
|
|
31092
31317
|
return reject(new Error('Build failed with errors.'));
|
|
31093
31318
|
}
|
|
31319
|
+
console.debug((0, log_utils_1.timeSince)(webpackStart, 'Webpack build time '));
|
|
31094
31320
|
console.log('Build succeeded.');
|
|
31095
31321
|
resolve();
|
|
31096
31322
|
});
|
|
31097
31323
|
});
|
|
31098
31324
|
// Generate connector metadata if this is a connector build.
|
|
31099
31325
|
if (isSquidConnector) {
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
await generateConnectorMetadata(distPath
|
|
31326
|
+
console.debug('Generating connector metadata...');
|
|
31327
|
+
const metadataStart = Date.now();
|
|
31328
|
+
await generateConnectorMetadata(distPath);
|
|
31329
|
+
console.debug((0, log_utils_1.timeSince)(metadataStart, 'Connector metadata generation time '));
|
|
31103
31330
|
// Add metadata to bundle.zip.
|
|
31331
|
+
const metadataBundleStart = Date.now();
|
|
31104
31332
|
const zipPath = path_1.default.join(distPath, 'bundle.zip');
|
|
31105
31333
|
const zip = new adm_zip_1.default(zipPath);
|
|
31106
31334
|
zip.addLocalFile(path_1.default.join(distPath, connector_types_1.CONNECTOR_METADATA_JSON_FILE));
|
|
31107
31335
|
zip.writeZip(zipPath);
|
|
31108
|
-
|
|
31109
|
-
|
|
31336
|
+
console.debug('Added connector metadata to bundle.zip');
|
|
31337
|
+
console.debug((0, log_utils_1.timeSince)(metadataBundleStart, 'Connector metadata bundling time '));
|
|
31110
31338
|
}
|
|
31111
31339
|
// Show version check warning after successful build.
|
|
31112
|
-
await
|
|
31340
|
+
await (0, version_check_1.displayVersionWarningIfOutdated)(versionCheckPromise);
|
|
31341
|
+
(0, update_skills_1.displaySkillsWarningIfOutdated)();
|
|
31342
|
+
console.debug((0, log_utils_1.timeSince)(buildPhaseStart, 'Build time '));
|
|
31113
31343
|
}
|
|
31114
31344
|
catch (e) {
|
|
31115
31345
|
// Show a version check warning even if the build failed.
|
|
31116
|
-
await
|
|
31346
|
+
await (0, version_check_1.displayVersionWarningIfOutdated)(versionCheckPromise);
|
|
31347
|
+
(0, update_skills_1.displaySkillsWarningIfOutdated)();
|
|
31117
31348
|
const errorMessage = (0, assertic_1.getMessageFromError)(e);
|
|
31118
|
-
|
|
31119
|
-
console.log(`Exiting with error: ${errorMessage}`);
|
|
31349
|
+
console.debug(`Exiting with error: ${errorMessage}`);
|
|
31120
31350
|
(0, process_utils_1.exitWithError)(errorMessage);
|
|
31121
31351
|
}
|
|
31122
31352
|
}
|
|
@@ -31125,7 +31355,7 @@ async function build({ verbose, dev, skipVersionCheck }) {
|
|
|
31125
31355
|
*/
|
|
31126
31356
|
const INTEGRATIONLESS_CONNECTORS = ['cotomi'];
|
|
31127
31357
|
/** Generates connector metadata JSON file in the dist directory. */
|
|
31128
|
-
async function generateConnectorMetadata(distPath
|
|
31358
|
+
async function generateConnectorMetadata(distPath) {
|
|
31129
31359
|
const packageJsonPath = path_1.default.resolve(process.cwd(), 'package.json');
|
|
31130
31360
|
const packageJson = JSON.parse(await fs_1.promises.readFile(packageJsonPath, 'utf8'));
|
|
31131
31361
|
(0, assertic_1.assertTruthy)(packageJson.version, 'Failed to read version from package.json');
|
|
@@ -31148,8 +31378,7 @@ async function generateConnectorMetadata(distPath, verbose) {
|
|
|
31148
31378
|
(0, assertic_1.assertTruthy)(typeof bundleData === 'object', `Unexpected "default:metadata" function response: ${typeof bundleData}`);
|
|
31149
31379
|
// Populate openApiControllersMap from openapi-spec-and-controllers.json.
|
|
31150
31380
|
await (0, openapi_utils_1.populateOpenApiControllersMap)(bundleData, distPath, 'connector');
|
|
31151
|
-
|
|
31152
|
-
console.log('Populated openApiControllersMap in bundle metadata');
|
|
31381
|
+
console.debug('Populated openApiControllersMap in bundle metadata');
|
|
31153
31382
|
const integrationTypes = INTEGRATIONLESS_CONNECTORS.includes(connectorId)
|
|
31154
31383
|
? []
|
|
31155
31384
|
: buildSupportedIntegrationTypesFromBundleData(bundleData);
|
|
@@ -31161,10 +31390,7 @@ async function generateConnectorMetadata(distPath, verbose) {
|
|
|
31161
31390
|
};
|
|
31162
31391
|
const metadataPath = path_1.default.join(distPath, connector_types_1.CONNECTOR_METADATA_JSON_FILE);
|
|
31163
31392
|
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
|
-
}
|
|
31393
|
+
console.debug('Connector metadata generated successfully:', packageMetadata);
|
|
31168
31394
|
}
|
|
31169
31395
|
/** Returns a list of supported integration types. Checks AI function attributes for that. */
|
|
31170
31396
|
function buildSupportedIntegrationTypesFromBundleData(bundleData) {
|
|
@@ -31220,12 +31446,20 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
31220
31446
|
exports.deploy = deploy;
|
|
31221
31447
|
const assertic_1 = __webpack_require__(3205);
|
|
31222
31448
|
const fs = __importStar(__webpack_require__(1943));
|
|
31449
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
31223
31450
|
const communication_types_1 = __webpack_require__(3443);
|
|
31451
|
+
const enable_debug_decorator_utils_1 = __webpack_require__(8700);
|
|
31452
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
31224
31453
|
const http_1 = __webpack_require__(866);
|
|
31225
31454
|
const shell_runner_1 = __webpack_require__(3089);
|
|
31455
|
+
const packageJson = __importStar(__webpack_require__(8330));
|
|
31226
31456
|
const environment_1 = __webpack_require__(722);
|
|
31227
31457
|
const process_utils_1 = __webpack_require__(8251);
|
|
31458
|
+
const version_check_1 = __webpack_require__(4827);
|
|
31228
31459
|
async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct, isUserSpecifiedPath, skipBuild, internalApiKey, environmentId) {
|
|
31460
|
+
(0, global_utils_1.enableDebugLogs)(verbose || (0, global_utils_1.isDebugEnabled)());
|
|
31461
|
+
(0, logpipes_1.installConsoleOverrides)(enable_debug_decorator_utils_1.debugLogFilterPipe);
|
|
31462
|
+
const versionCheckPromise = (0, version_check_1.checkCliVersion)(packageJson.version);
|
|
31229
31463
|
if (!direct && !isUserSpecifiedPath && !skipBuild) {
|
|
31230
31464
|
console.log('Building code bundle...');
|
|
31231
31465
|
await (0, shell_runner_1.runInShell)('npm run build');
|
|
@@ -31240,9 +31474,7 @@ async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct,
|
|
|
31240
31474
|
? (0, http_1.getApplicationUrl)(consoleRegion, appIdWithEnvId, 'application/updateApplicationCode')
|
|
31241
31475
|
: (0, http_1.getApplicationUrl)(consoleRegion, environment_1.environment.consoleAppId, 'webhooks/updateApplicationCode');
|
|
31242
31476
|
console.log(`Deploying code bundle for appId '${appId}' to the '${environmentId}' environment...`);
|
|
31243
|
-
|
|
31244
|
-
console.log('Deploying bundle to:', updateCodeUrl);
|
|
31245
|
-
}
|
|
31477
|
+
console.debug('Deploying bundle to:', updateCodeUrl);
|
|
31246
31478
|
try {
|
|
31247
31479
|
const headers = new Headers();
|
|
31248
31480
|
if (apiKey) {
|
|
@@ -31257,11 +31489,11 @@ async function deploy(consoleRegion, appId, bundlePath, apiKey, verbose, direct,
|
|
|
31257
31489
|
(0, process_utils_1.exitWithError)('Unable to deploy bundle:', await response.text());
|
|
31258
31490
|
}
|
|
31259
31491
|
console.log('Code deployed');
|
|
31492
|
+
await (0, version_check_1.displayVersionWarningIfOutdated)(versionCheckPromise);
|
|
31260
31493
|
}
|
|
31261
31494
|
catch (error) {
|
|
31262
|
-
|
|
31263
|
-
|
|
31264
|
-
}
|
|
31495
|
+
await (0, version_check_1.displayVersionWarningIfOutdated)(versionCheckPromise);
|
|
31496
|
+
console.debug('Error deploying bundle:', error);
|
|
31265
31497
|
const errorMessage = (0, assertic_1.getMessageFromError)(error, '');
|
|
31266
31498
|
(0, process_utils_1.exitWithError)('Unable to deploy bundle:', errorMessage || error);
|
|
31267
31499
|
}
|
|
@@ -31472,6 +31704,7 @@ const init_webpack_1 = __webpack_require__(1134);
|
|
|
31472
31704
|
const sample_1 = __webpack_require__(4328);
|
|
31473
31705
|
const start_1 = __webpack_require__(496);
|
|
31474
31706
|
const undeploy_1 = __webpack_require__(7097);
|
|
31707
|
+
const update_skills_1 = __webpack_require__(7286);
|
|
31475
31708
|
const process_utils_1 = __webpack_require__(8251);
|
|
31476
31709
|
const validate_1 = __webpack_require__(2246);
|
|
31477
31710
|
function setupDotEnv(baseDir) {
|
|
@@ -31496,6 +31729,7 @@ function run() {
|
|
|
31496
31729
|
setupInitWebpackCommand(yargs_1.default);
|
|
31497
31730
|
setupStartCommand(yargs_1.default);
|
|
31498
31731
|
setupUndeployCommand(yargs_1.default);
|
|
31732
|
+
setupUpdateSkillsCommand(yargs_1.default);
|
|
31499
31733
|
yargs_1.default.parse();
|
|
31500
31734
|
}
|
|
31501
31735
|
function setupStartCommand(yargs) {
|
|
@@ -31626,6 +31860,11 @@ function setupBuildCommand(yargs) {
|
|
|
31626
31860
|
await (0, build_1.build)({ verbose: !!argv.verbose, dev: !!argv.dev, skipVersionCheck: !!argv['skip-version-check'] });
|
|
31627
31861
|
});
|
|
31628
31862
|
}
|
|
31863
|
+
function setupUpdateSkillsCommand(yargs) {
|
|
31864
|
+
yargs.command('update-skills', 'Updates Squid Claude skills to the latest version', () => { }, async () => {
|
|
31865
|
+
await (0, update_skills_1.updateSkills)();
|
|
31866
|
+
});
|
|
31867
|
+
}
|
|
31629
31868
|
run();
|
|
31630
31869
|
function attachAppIdOption(yargs, demandOption) {
|
|
31631
31870
|
yargs.option('appId', {
|
|
@@ -31755,6 +31994,39 @@ function getConsoleRegionFromAppRegion(appRegion) {
|
|
|
31755
31994
|
|
|
31756
31995
|
"use strict";
|
|
31757
31996
|
|
|
31997
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
31998
|
+
if (k2 === undefined) k2 = k;
|
|
31999
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32000
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32001
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
32002
|
+
}
|
|
32003
|
+
Object.defineProperty(o, k2, desc);
|
|
32004
|
+
}) : (function(o, m, k, k2) {
|
|
32005
|
+
if (k2 === undefined) k2 = k;
|
|
32006
|
+
o[k2] = m[k];
|
|
32007
|
+
}));
|
|
32008
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32009
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
32010
|
+
}) : function(o, v) {
|
|
32011
|
+
o["default"] = v;
|
|
32012
|
+
});
|
|
32013
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32014
|
+
var ownKeys = function(o) {
|
|
32015
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32016
|
+
var ar = [];
|
|
32017
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32018
|
+
return ar;
|
|
32019
|
+
};
|
|
32020
|
+
return ownKeys(o);
|
|
32021
|
+
};
|
|
32022
|
+
return function (mod) {
|
|
32023
|
+
if (mod && mod.__esModule) return mod;
|
|
32024
|
+
var result = {};
|
|
32025
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32026
|
+
__setModuleDefault(result, mod);
|
|
32027
|
+
return result;
|
|
32028
|
+
};
|
|
32029
|
+
})();
|
|
31758
32030
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31759
32031
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31760
32032
|
};
|
|
@@ -31762,16 +32034,25 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
31762
32034
|
exports.initSample = initSample;
|
|
31763
32035
|
const assertic_1 = __webpack_require__(3205);
|
|
31764
32036
|
const promises_1 = __importDefault(__webpack_require__(1943));
|
|
32037
|
+
const logpipes_1 = __webpack_require__(6102);
|
|
31765
32038
|
const path_1 = __importDefault(__webpack_require__(6928));
|
|
31766
32039
|
const communication_types_1 = __webpack_require__(3443);
|
|
31767
32040
|
const utils_1 = __webpack_require__(1215);
|
|
32041
|
+
const enable_debug_decorator_utils_1 = __webpack_require__(8700);
|
|
32042
|
+
const global_utils_1 = __webpack_require__(6334);
|
|
31768
32043
|
const shell_runner_1 = __webpack_require__(3089);
|
|
32044
|
+
const packageJson = __importStar(__webpack_require__(8330));
|
|
32045
|
+
const update_skills_1 = __webpack_require__(7286);
|
|
31769
32046
|
const git_utils_1 = __webpack_require__(954);
|
|
31770
32047
|
const logging_1 = __webpack_require__(443);
|
|
31771
32048
|
const process_utils_1 = __webpack_require__(8251);
|
|
31772
32049
|
const report_utils_1 = __webpack_require__(3066);
|
|
32050
|
+
const version_check_1 = __webpack_require__(4827);
|
|
31773
32051
|
const ORG = 'squid-cloud-samples';
|
|
31774
32052
|
async function initSample(consoleRegion, isOnPremConsole, dirPath, appId, apiKey, environmentId, squidDeveloperId, region, templateName, verbose = false) {
|
|
32053
|
+
(0, global_utils_1.enableDebugLogs)(verbose || (0, global_utils_1.isDebugEnabled)());
|
|
32054
|
+
(0, logpipes_1.installConsoleOverrides)(enable_debug_decorator_utils_1.debugLogFilterPipe);
|
|
32055
|
+
const versionCheckPromise = (0, version_check_1.checkCliVersion)(packageJson.version);
|
|
31775
32056
|
try {
|
|
31776
32057
|
await promises_1.default.stat(path_1.default.resolve(dirPath));
|
|
31777
32058
|
(0, process_utils_1.exitWithError)(`Project already exists: ${dirPath}`);
|
|
@@ -31791,42 +32072,25 @@ async function initSample(consoleRegion, isOnPremConsole, dirPath, appId, apiKey
|
|
|
31791
32072
|
catch {
|
|
31792
32073
|
(0, process_utils_1.exitWithError)(`Unable to download repository: ${templateRepoPath}`);
|
|
31793
32074
|
}
|
|
31794
|
-
// Copy
|
|
32075
|
+
// Copy Squid skills if they don't already exist.
|
|
31795
32076
|
const projectPath = path_1.default.resolve(dirPath);
|
|
31796
32077
|
const skillsDir = path_1.default.join(projectPath, '.claude', 'skills');
|
|
31797
|
-
const
|
|
31798
|
-
|
|
31799
|
-
|
|
31800
|
-
|
|
31801
|
-
|
|
31802
|
-
else {
|
|
31803
|
-
// Skill doesn't exist, copy it.
|
|
31804
|
-
try {
|
|
31805
|
-
await promises_1.default.mkdir(skillsDir, { recursive: true });
|
|
31806
|
-
await promises_1.default.cp(squidSkillSourcePath, squidSkillDestPath, { recursive: true });
|
|
31807
|
-
console.debug('Squid development skill copied successfully');
|
|
32078
|
+
for (const skillName of update_skills_1.SQUID_SKILLS) {
|
|
32079
|
+
const sourcePath = path_1.default.join(__dirname, 'resources', 'claude', 'skills', skillName);
|
|
32080
|
+
const destPath = path_1.default.join(skillsDir, skillName);
|
|
32081
|
+
if (await (0, utils_1.checkFileOrDirExists)(destPath)) {
|
|
32082
|
+
console.debug(`${skillName} skill already exists, skipping...`);
|
|
31808
32083
|
}
|
|
31809
|
-
|
|
31810
|
-
|
|
31811
|
-
|
|
31812
|
-
|
|
31813
|
-
|
|
31814
|
-
|
|
31815
|
-
|
|
31816
|
-
|
|
31817
|
-
|
|
31818
|
-
|
|
31819
|
-
}
|
|
31820
|
-
else {
|
|
31821
|
-
// Skill doesn't exist, copy it.
|
|
31822
|
-
try {
|
|
31823
|
-
await promises_1.default.mkdir(skillsDir, { recursive: true });
|
|
31824
|
-
await promises_1.default.cp(reactSkillSourcePath, reactSkillDestPath, { recursive: true });
|
|
31825
|
-
console.debug('Squid React development skill copied successfully');
|
|
31826
|
-
}
|
|
31827
|
-
catch (error) {
|
|
31828
|
-
// Non-fatal: log the error but continue with initialization.
|
|
31829
|
-
console.debug(`Warning: Could not copy Squid React development skill: ${(0, assertic_1.getMessageFromError)(error)}`);
|
|
32084
|
+
else {
|
|
32085
|
+
try {
|
|
32086
|
+
await promises_1.default.mkdir(skillsDir, { recursive: true });
|
|
32087
|
+
await promises_1.default.cp(sourcePath, destPath, { recursive: true });
|
|
32088
|
+
console.debug(`${skillName} skill copied successfully`);
|
|
32089
|
+
}
|
|
32090
|
+
catch (error) {
|
|
32091
|
+
// Non-fatal: log the error but continue with initialization.
|
|
32092
|
+
console.debug(`Warning: Could not copy ${skillName} skill: ${(0, assertic_1.getMessageFromError)(error)}`);
|
|
32093
|
+
}
|
|
31830
32094
|
}
|
|
31831
32095
|
}
|
|
31832
32096
|
console.log('Installing dependencies...');
|
|
@@ -31875,7 +32139,7 @@ ${(0, logging_1.primary)('Done. Now run:')}
|
|
|
31875
32139
|
cd ${dirPath}
|
|
31876
32140
|
npm run start
|
|
31877
32141
|
`);
|
|
31878
|
-
await (0, report_utils_1.reportLocalBackendInitialized)(consoleRegion, (0, communication_types_1.appIdWithEnvironmentIdAndDevId)(appId, environmentId, squidDeveloperId), apiKey
|
|
32142
|
+
await (0, report_utils_1.reportLocalBackendInitialized)(consoleRegion, (0, communication_types_1.appIdWithEnvironmentIdAndDevId)(appId, environmentId, squidDeveloperId), apiKey);
|
|
31879
32143
|
}
|
|
31880
32144
|
else {
|
|
31881
32145
|
console.log((0, logging_1.link)('https://console.getsquid.ai'));
|
|
@@ -31889,6 +32153,7 @@ ${(0, logging_1.primary)('Done. Next steps:')}
|
|
|
31889
32153
|
npm run start
|
|
31890
32154
|
`);
|
|
31891
32155
|
}
|
|
32156
|
+
await (0, version_check_1.displayVersionWarningIfOutdated)(versionCheckPromise);
|
|
31892
32157
|
}
|
|
31893
32158
|
|
|
31894
32159
|
|
|
@@ -31941,12 +32206,18 @@ const fs = __importStar(__webpack_require__(1943));
|
|
|
31941
32206
|
const path_1 = __importDefault(__webpack_require__(6928));
|
|
31942
32207
|
const resolve_1 = __webpack_require__(412);
|
|
31943
32208
|
const shell_runner_1 = __webpack_require__(3089);
|
|
32209
|
+
const cliPackageJson = __importStar(__webpack_require__(8330));
|
|
32210
|
+
const update_skills_1 = __webpack_require__(7286);
|
|
31944
32211
|
const logging_1 = __webpack_require__(443);
|
|
31945
32212
|
const process_utils_1 = __webpack_require__(8251);
|
|
31946
32213
|
const validate_1 = __webpack_require__(2246);
|
|
32214
|
+
const version_check_1 = __webpack_require__(4827);
|
|
31947
32215
|
async function start() {
|
|
31948
32216
|
const packageJson = await (0, validate_1.validateSquidProject)();
|
|
32217
|
+
const versionCheckPromise = (0, version_check_1.checkCliVersion)(cliPackageJson.version);
|
|
31949
32218
|
console.log((0, logging_1.primary)('Please note:'), 'to debug your application, you need to run the "start" npm script in your IDE in debug mode');
|
|
32219
|
+
await (0, version_check_1.displayVersionWarningIfOutdated)(versionCheckPromise);
|
|
32220
|
+
(0, update_skills_1.displaySkillsWarningIfOutdated)();
|
|
31950
32221
|
console.log((0, logging_1.primary)('Starting...'));
|
|
31951
32222
|
const modulePath = await (0, resolve_1.findModulePath)('@squidcloud/local-backend');
|
|
31952
32223
|
if (!modulePath) {
|
|
@@ -32027,6 +32298,149 @@ async function undeploy(consoleRegion, appId, apiKey, environmentId) {
|
|
|
32027
32298
|
}
|
|
32028
32299
|
|
|
32029
32300
|
|
|
32301
|
+
/***/ },
|
|
32302
|
+
|
|
32303
|
+
/***/ 7286
|
|
32304
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
32305
|
+
|
|
32306
|
+
"use strict";
|
|
32307
|
+
|
|
32308
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
32309
|
+
if (k2 === undefined) k2 = k;
|
|
32310
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32311
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32312
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
32313
|
+
}
|
|
32314
|
+
Object.defineProperty(o, k2, desc);
|
|
32315
|
+
}) : (function(o, m, k, k2) {
|
|
32316
|
+
if (k2 === undefined) k2 = k;
|
|
32317
|
+
o[k2] = m[k];
|
|
32318
|
+
}));
|
|
32319
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32320
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
32321
|
+
}) : function(o, v) {
|
|
32322
|
+
o["default"] = v;
|
|
32323
|
+
});
|
|
32324
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32325
|
+
var ownKeys = function(o) {
|
|
32326
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32327
|
+
var ar = [];
|
|
32328
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32329
|
+
return ar;
|
|
32330
|
+
};
|
|
32331
|
+
return ownKeys(o);
|
|
32332
|
+
};
|
|
32333
|
+
return function (mod) {
|
|
32334
|
+
if (mod && mod.__esModule) return mod;
|
|
32335
|
+
var result = {};
|
|
32336
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32337
|
+
__setModuleDefault(result, mod);
|
|
32338
|
+
return result;
|
|
32339
|
+
};
|
|
32340
|
+
})();
|
|
32341
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32342
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32343
|
+
};
|
|
32344
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32345
|
+
exports.SQUID_SKILLS = void 0;
|
|
32346
|
+
exports.getSkillsNeedingUpdate = getSkillsNeedingUpdate;
|
|
32347
|
+
exports.displaySkillsWarningIfOutdated = displaySkillsWarningIfOutdated;
|
|
32348
|
+
exports.updateSkills = updateSkills;
|
|
32349
|
+
const chalk_1 = __importDefault(__webpack_require__(7459));
|
|
32350
|
+
const fsSync = __importStar(__webpack_require__(9896));
|
|
32351
|
+
const fs = __importStar(__webpack_require__(1943));
|
|
32352
|
+
const path_1 = __importDefault(__webpack_require__(6928));
|
|
32353
|
+
const logging_1 = __webpack_require__(443);
|
|
32354
|
+
const validate_1 = __webpack_require__(2246);
|
|
32355
|
+
/** List of Squid-owned skills that can be copied/updated. */
|
|
32356
|
+
exports.SQUID_SKILLS = ['squid-development', 'squid-react-development'];
|
|
32357
|
+
/**
|
|
32358
|
+
* Gets all files in a directory, sorted for consistent ordering.
|
|
32359
|
+
*/
|
|
32360
|
+
function getFilesSorted(dir) {
|
|
32361
|
+
const files = fsSync.readdirSync(dir, { recursive: true });
|
|
32362
|
+
return files.filter(file => fsSync.statSync(path_1.default.join(dir, file)).isFile()).sort();
|
|
32363
|
+
}
|
|
32364
|
+
/**
|
|
32365
|
+
* Checks if a specific skill needs to be updated.
|
|
32366
|
+
* Returns true if project is missing skill or any CLI file is missing/different.
|
|
32367
|
+
* Extra files in project are ignored
|
|
32368
|
+
*/
|
|
32369
|
+
function skillNeedsUpdate(skillName) {
|
|
32370
|
+
const projectSkillPath = path_1.default.join(process.cwd(), '.claude', 'skills', skillName);
|
|
32371
|
+
const cliSkillPath = path_1.default.join(__dirname, 'resources', 'claude', 'skills', skillName);
|
|
32372
|
+
// If CLI doesn't have this skill bundled, nothing to update.
|
|
32373
|
+
if (!fsSync.existsSync(cliSkillPath)) {
|
|
32374
|
+
return false;
|
|
32375
|
+
}
|
|
32376
|
+
// If project doesn't have this skill but CLI does, it needs to be added.
|
|
32377
|
+
if (!fsSync.existsSync(projectSkillPath)) {
|
|
32378
|
+
return true;
|
|
32379
|
+
}
|
|
32380
|
+
// Check each CLI file exists in project with same content.
|
|
32381
|
+
const cliFiles = getFilesSorted(cliSkillPath);
|
|
32382
|
+
for (const file of cliFiles) {
|
|
32383
|
+
const cliFilePath = path_1.default.join(cliSkillPath, file);
|
|
32384
|
+
const projectFilePath = path_1.default.join(projectSkillPath, file);
|
|
32385
|
+
// Project missing a file that CLI has.
|
|
32386
|
+
if (!fsSync.existsSync(projectFilePath)) {
|
|
32387
|
+
return true;
|
|
32388
|
+
}
|
|
32389
|
+
// Content differs (normalize line endings for cross-platform compatibility).
|
|
32390
|
+
const cliContent = fsSync.readFileSync(cliFilePath, 'utf8').replace(/\r\n/g, '\n');
|
|
32391
|
+
const projectContent = fsSync.readFileSync(projectFilePath, 'utf8').replace(/\r\n/g, '\n');
|
|
32392
|
+
if (cliContent !== projectContent) {
|
|
32393
|
+
return true;
|
|
32394
|
+
}
|
|
32395
|
+
}
|
|
32396
|
+
return false;
|
|
32397
|
+
}
|
|
32398
|
+
/**
|
|
32399
|
+
* Returns a list of skills that need to be updated (missing or outdated).
|
|
32400
|
+
*/
|
|
32401
|
+
function getSkillsNeedingUpdate() {
|
|
32402
|
+
return exports.SQUID_SKILLS.filter(skillNeedsUpdate);
|
|
32403
|
+
}
|
|
32404
|
+
function displaySkillsWarningIfOutdated() {
|
|
32405
|
+
try {
|
|
32406
|
+
const skillsToUpdate = getSkillsNeedingUpdate();
|
|
32407
|
+
if (skillsToUpdate.length > 0) {
|
|
32408
|
+
console.warn(chalk_1.default.yellow(`⚠ Squid skills need updating (${skillsToUpdate.join(', ')}). Run: squid update-skills`));
|
|
32409
|
+
}
|
|
32410
|
+
}
|
|
32411
|
+
catch (_ignored) { }
|
|
32412
|
+
}
|
|
32413
|
+
/**
|
|
32414
|
+
* Updates all Squid-owned skills to the latest version bundled with the CLI.
|
|
32415
|
+
*/
|
|
32416
|
+
async function updateSkills() {
|
|
32417
|
+
await (0, validate_1.validateSquidProject)();
|
|
32418
|
+
const skillsToUpdate = getSkillsNeedingUpdate();
|
|
32419
|
+
if (skillsToUpdate.length === 0) {
|
|
32420
|
+
console.log(chalk_1.default.green('✓ Skills already up to date'));
|
|
32421
|
+
return;
|
|
32422
|
+
}
|
|
32423
|
+
const skillsDir = path_1.default.join(process.cwd(), '.claude', 'skills');
|
|
32424
|
+
let updatedCount = 0;
|
|
32425
|
+
for (const skillName of skillsToUpdate) {
|
|
32426
|
+
const cliSkillPath = path_1.default.join(__dirname, 'resources', 'claude', 'skills', skillName);
|
|
32427
|
+
const projectSkillPath = path_1.default.join(skillsDir, skillName);
|
|
32428
|
+
try {
|
|
32429
|
+
await fs.mkdir(skillsDir, { recursive: true });
|
|
32430
|
+
await fs.cp(cliSkillPath, projectSkillPath, { recursive: true });
|
|
32431
|
+
console.log(`Updated ${(0, logging_1.primary)(skillName)} skill`);
|
|
32432
|
+
updatedCount++;
|
|
32433
|
+
}
|
|
32434
|
+
catch (_error) {
|
|
32435
|
+
console.warn(`Warning: Could not update ${skillName} skill`);
|
|
32436
|
+
}
|
|
32437
|
+
}
|
|
32438
|
+
if (updatedCount > 0) {
|
|
32439
|
+
console.log(chalk_1.default.green(`✓ ${updatedCount} skill(s) updated successfully`));
|
|
32440
|
+
}
|
|
32441
|
+
}
|
|
32442
|
+
|
|
32443
|
+
|
|
32030
32444
|
/***/ },
|
|
32031
32445
|
|
|
32032
32446
|
/***/ 954
|
|
@@ -32169,11 +32583,9 @@ exports.reportLocalBackendInitialized = reportLocalBackendInitialized;
|
|
|
32169
32583
|
const assertic_1 = __webpack_require__(3205);
|
|
32170
32584
|
const http_1 = __webpack_require__(866);
|
|
32171
32585
|
const environment_1 = __webpack_require__(722);
|
|
32172
|
-
async function reportLocalBackendInitialized(consoleRegion, appId, apiKey
|
|
32586
|
+
async function reportLocalBackendInitialized(consoleRegion, appId, apiKey) {
|
|
32173
32587
|
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
|
-
}
|
|
32588
|
+
console.debug('Reporting backend initialization to Squid Console...', url);
|
|
32177
32589
|
try {
|
|
32178
32590
|
const headers = new Headers();
|
|
32179
32591
|
headers.append('Authorization', `ApiKey ${apiKey}`);
|
|
@@ -32284,6 +32696,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32284
32696
|
};
|
|
32285
32697
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32286
32698
|
exports.checkCliVersion = checkCliVersion;
|
|
32699
|
+
exports.displayVersionWarningIfOutdated = displayVersionWarningIfOutdated;
|
|
32287
32700
|
const assertic_1 = __webpack_require__(3205);
|
|
32288
32701
|
const chalk_1 = __importDefault(__webpack_require__(7459));
|
|
32289
32702
|
const time_units_1 = __webpack_require__(1929);
|
|
@@ -32360,6 +32773,15 @@ function parseVersion(version) {
|
|
|
32360
32773
|
function formatWarningMessage(currentVersion, latestVersion) {
|
|
32361
32774
|
return chalk_1.default.yellow(`⚠ Your @squidcloud/cli (${currentVersion}) is outdated. Latest: ${latestVersion}. Update: npm install -g @squidcloud/cli@latest`);
|
|
32362
32775
|
}
|
|
32776
|
+
async function displayVersionWarningIfOutdated(versionCheckPromise) {
|
|
32777
|
+
try {
|
|
32778
|
+
const versionWarning = await versionCheckPromise;
|
|
32779
|
+
if (versionWarning) {
|
|
32780
|
+
console.warn(versionWarning);
|
|
32781
|
+
}
|
|
32782
|
+
}
|
|
32783
|
+
catch (_ignored) { }
|
|
32784
|
+
}
|
|
32363
32785
|
|
|
32364
32786
|
|
|
32365
32787
|
/***/ },
|
|
@@ -33982,6 +34404,14 @@ module.exports = require("assert");
|
|
|
33982
34404
|
|
|
33983
34405
|
/***/ },
|
|
33984
34406
|
|
|
34407
|
+
/***/ 290
|
|
34408
|
+
(module) {
|
|
34409
|
+
|
|
34410
|
+
"use strict";
|
|
34411
|
+
module.exports = require("async_hooks");
|
|
34412
|
+
|
|
34413
|
+
/***/ },
|
|
34414
|
+
|
|
33985
34415
|
/***/ 181
|
|
33986
34416
|
(module) {
|
|
33987
34417
|
|
|
@@ -36708,7 +37138,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"seek-bzip","version":"1.0.6",
|
|
|
36708
37138
|
(module) {
|
|
36709
37139
|
|
|
36710
37140
|
"use strict";
|
|
36711
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.
|
|
37141
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.450","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.450","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
37142
|
|
|
36713
37143
|
/***/ }
|
|
36714
37144
|
|
|
@@ -18,7 +18,7 @@ Squid is a backend-as-a-service platform that provides:
|
|
|
18
18
|
- **[client.md](reference/client.md)** → client SDK, initialization, setup, auth, login, tokens, OAuth, appId, region, environmentId, apiKey, authProvider, getToken, setAuthProvider, Squid client, frontend, collection, executeFunction, executeFunctionWithHeaders, getWebhookUrl, externalAuth, saveAuthCode, getAccessToken, storage, uploadFile, downloadUrl, queues, produce, consume, distributed locks, acquireLock, withLock, web, aiSearch, getUrlContent, createShortUrl, jobs, getJob, awaitJob, observability, metrics, reportMetric, queryMetrics, notifications, publishNotification, observeNotifications
|
|
19
19
|
- **[console.md](reference/console.md)** → Squid Console, web UI, organizations, applications, AI Studio, knowledge bases, integrations, monitoring, logs, API keys, secrets, testing, debugging, profile settings, management API keys
|
|
20
20
|
- **[ai.md](reference/ai.md)** → AI agents, chat, ask, askWithAnnotations, askAsync, askWithVoiceResponse, transcribeAndChat, transcribeAndAsk, knowledge bases, RAG, embeddings, image generation, audio, transcription, text-to-speech, TTS, connectedAgents, connectedIntegrations, connectedKnowledgeBases, @aiFunction, @secureAiAgent, @secureAiQuery, memory, memoryOptions, voiceOptions, OpenAI, Anthropic, Gemini, Grok, DALL-E, Whisper, MCP, @mcpServer, @mcpTool, executeAiQuery, executeAiApiCall, extraction, createPdf, upsert agent, listAgents
|
|
21
|
-
- **[databases.md](reference/databases.md)** → collections, documents, queries, subscriptions, snapshots, insert, update, delete, CRUD, real-time, dereference, pagination, transactions, query operators, eq, neq, gt, gte, lt, lte, like, in, nin, arrayIncludesSome, arrayIncludesAll, sortBy, limit, join queries, OR queries, @trigger, native queries, SQL, MongoDB, Elasticsearch, incrementInPath, decrementInPath, watch changes, doc()
|
|
21
|
+
- **[databases.md](reference/databases.md)** → collections, documents, queries, subscriptions, snapshots, insert, update, delete, CRUD, real-time, dereference, pagination, transactions, query operators, eq, neq, gt, gte, lt, lte, like, in, nin, arrayIncludesSome, arrayIncludesAll, sortBy, limit, join queries, OR queries, @trigger, native queries, SQL, MongoDB, Elasticsearch, incrementInPath, decrementInPath, watch changes, doc(), projectFields, field projection, __docId__, __id
|
|
22
22
|
- **[backend.md](reference/backend.md)** → SquidService, @executable, @webhook, @trigger, TriggerRequest, @scheduler, @limits, rate limiting, quotas, decorators, backend functions, WebhookRequest, CronExpression, cron, file handling, SquidFile, getUserAuth, isAuthenticated, assertIsAuthenticated, createWebhookResponse, this.squid, this.secrets, @clientConnectionStateHandler, CLI, squid init, squid start, squid deploy, squid build, project structure
|
|
23
23
|
- **[security.md](reference/security.md)** → security rules, @secureDatabase, @secureCollection, @secureTopic, @secureStorage, @secureApi, @secureNativeQuery, @secureAiQuery, @secureAiAgent, @secureDistributedLock, @secureGraphQL, QueryContext, MutationContext, isSubqueryOf, affectsPath, permissions, authorization, row-level security, role-based access
|
|
24
24
|
- **[admin.md](reference/admin.md)** → ManagementClient, management API keys, organizations, applications, programmatic management, CI/CD, automation, integrations admin, secrets admin, upsertIntegration, discoverDataConnectionSchema, testDataConnection, createOrganization, createApplication
|
|
@@ -11,6 +11,7 @@ Squid provides database functionality similar to Firestore but more powerful, wi
|
|
|
11
11
|
- OR Queries
|
|
12
12
|
- Join Queries
|
|
13
13
|
- Dereference
|
|
14
|
+
- Field Projection
|
|
14
15
|
- Pagination
|
|
15
16
|
- Watch Changes
|
|
16
17
|
- Transactions
|
|
@@ -314,6 +315,144 @@ const userData = await users.query()
|
|
|
314
315
|
// - You need DocumentReference methods like .update() or .delete()
|
|
315
316
|
```
|
|
316
317
|
|
|
318
|
+
## Field Projection
|
|
319
|
+
|
|
320
|
+
Return only specific fields from queries to reduce bandwidth and improve performance.
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
// Basic usage
|
|
324
|
+
const results = await users.query()
|
|
325
|
+
.projectFields(['name', 'email'])
|
|
326
|
+
.dereference()
|
|
327
|
+
.snapshot();
|
|
328
|
+
|
|
329
|
+
// Works with all query methods
|
|
330
|
+
const results = await users.query()
|
|
331
|
+
.eq('status', 'active')
|
|
332
|
+
.sortBy('name')
|
|
333
|
+
.limit(50)
|
|
334
|
+
.projectFields(['name', 'email', 'status'])
|
|
335
|
+
.dereference()
|
|
336
|
+
.snapshot();
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Always-Included Fields
|
|
340
|
+
|
|
341
|
+
These fields are **always** included in results regardless of projection:
|
|
342
|
+
|
|
343
|
+
| Field | Present On | Description |
|
|
344
|
+
|-------|------------|-------------|
|
|
345
|
+
| `__docId__` | All integrations | JSON-stringified document identifier |
|
|
346
|
+
| `__id` | `built_in_db` only | Primary key value |
|
|
347
|
+
|
|
348
|
+
For **composite primary keys**, individual key fields are automatically spread to the top level:
|
|
349
|
+
```typescript
|
|
350
|
+
// Document with composite PK (pk1, pk2)
|
|
351
|
+
// Result includes: { name: 'Alice', __docId__: '{"pk1":"a","pk2":1}', pk1: 'a', pk2: 1 }
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Nested Fields
|
|
355
|
+
|
|
356
|
+
Use dot notation for nested paths:
|
|
357
|
+
```typescript
|
|
358
|
+
const results = await users.query()
|
|
359
|
+
.projectFields(['name', 'address.city', 'address.zip'])
|
|
360
|
+
.dereference()
|
|
361
|
+
.snapshot();
|
|
362
|
+
// Result: { name: 'Alice', address: { city: 'NYC', zip: '10001' } }
|
|
363
|
+
// Other address fields NOT included
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Validation Rules
|
|
367
|
+
|
|
368
|
+
**Filter fields must be projected:**
|
|
369
|
+
```typescript
|
|
370
|
+
// ERROR: Cannot filter by 'email' not in projectFields
|
|
371
|
+
users.query().eq('email', 'test@example.com').projectFields(['name']);
|
|
372
|
+
|
|
373
|
+
// CORRECT: Include filter field
|
|
374
|
+
users.query().eq('email', 'test@example.com').projectFields(['name', 'email']);
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Sort fields must be projected:**
|
|
378
|
+
```typescript
|
|
379
|
+
// ERROR: Cannot sort by 'email' not in projectFields
|
|
380
|
+
users.query().sortBy('email').projectFields(['name']);
|
|
381
|
+
|
|
382
|
+
// CORRECT: Include sort field
|
|
383
|
+
users.query().sortBy('email').projectFields(['name', 'email']);
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Exception:** `__docId__` can always be used for filtering/sorting without being in projection:
|
|
387
|
+
```typescript
|
|
388
|
+
// ALLOWED: __docId__ is always available
|
|
389
|
+
users.query().where('__docId__', '>=', 'user_100').projectFields(['name']);
|
|
390
|
+
users.query().sortBy('__docId__').projectFields(['name']);
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Composite conditions must use projected fields:**
|
|
394
|
+
```typescript
|
|
395
|
+
// ERROR: Cannot filter by 'email' not in projectFields
|
|
396
|
+
users.query().projectFields(['name']).addCompositeCondition([{ fieldName: 'email', operator: '>=', value: 'a' }]);
|
|
397
|
+
|
|
398
|
+
// ALLOWED: __docId__ works without projection
|
|
399
|
+
users.query().projectFields(['name']).addCompositeCondition([{ fieldName: '__docId__', operator: '>=', value: 'a' }]);
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Calling projectFields twice:** Second call must be a subset of the first:
|
|
403
|
+
```typescript
|
|
404
|
+
// ALLOWED: ['name'] is subset of ['name', 'age', 'email']
|
|
405
|
+
users.query().projectFields(['name', 'age', 'email']).projectFields(['name']);
|
|
406
|
+
|
|
407
|
+
// ERROR: 'email' was not in first projection
|
|
408
|
+
users.query().projectFields(['name', 'age']).projectFields(['name', 'email']);
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**Cloning:** `projectFields` returns a cloned QueryBuilder - original is unmodified:
|
|
412
|
+
```typescript
|
|
413
|
+
const base = collection.query().where('age', '>=', 18);
|
|
414
|
+
const projected = base.projectFields(['name']); // Returns clone
|
|
415
|
+
// base still returns all fields, projected returns only 'name'
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Empty Array Behavior
|
|
419
|
+
|
|
420
|
+
| Integration | Behavior |
|
|
421
|
+
|-------------|----------|
|
|
422
|
+
| `built_in_db` | Returns documents with only `__docId__` and `__id`, no user fields |
|
|
423
|
+
| External DBs | **Throws error** - must specify at least one field |
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
// built_in_db: returns { __docId__: '...', __id: '...' }
|
|
427
|
+
await builtInCollection.query().projectFields([]).snapshot();
|
|
428
|
+
|
|
429
|
+
// External DB: throws error
|
|
430
|
+
await postgresCollection.query().projectFields([]); // Error!
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Edge Cases
|
|
434
|
+
|
|
435
|
+
- **Non-existent fields:** Silently ignored, no error thrown
|
|
436
|
+
- **Duplicate fields:** Handled gracefully, no duplication in results
|
|
437
|
+
- **Including `__id` explicitly:** Not duplicated if already auto-included
|
|
438
|
+
- **Optimistic updates:** Local updates respect the projection - document store only contains projected fields. Multiple subscriptions with different projections maintain isolated views of the same document.
|
|
439
|
+
|
|
440
|
+
### Without dereference()
|
|
441
|
+
|
|
442
|
+
When not using `dereference()`, you get `DocumentReference` objects. Access projected data via `.data`:
|
|
443
|
+
```typescript
|
|
444
|
+
const refs = await users.query().projectFields(['name']).snapshot();
|
|
445
|
+
console.log(refs[0].data.name); // Projected data on .data property
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Works With
|
|
449
|
+
|
|
450
|
+
- One-time queries (`.snapshot()`)
|
|
451
|
+
- Real-time subscriptions (`.snapshots()`)
|
|
452
|
+
- Pagination (`.paginate()`)
|
|
453
|
+
- Join queries
|
|
454
|
+
- All database integrations (MongoDB, PostgreSQL, MySQL, ClickHouse, MS SQL, built_in_db)
|
|
455
|
+
|
|
317
456
|
## Pagination
|
|
318
457
|
|
|
319
458
|
```typescript
|
|
@@ -21,6 +21,15 @@ module.exports = function (env, argv) {
|
|
|
21
21
|
'bufferutil': 'commonjs bufferutil',
|
|
22
22
|
'utf-8-validate': 'commonjs utf-8-validate',
|
|
23
23
|
},
|
|
24
|
+
// Suppress warnings from dependencies that use dynamic requires.
|
|
25
|
+
// These are typically dev dependencies used during build and don't affect runtime.
|
|
26
|
+
ignoreWarnings: [
|
|
27
|
+
{ module: /tsoa/ },
|
|
28
|
+
{ module: /@tsoa\/cli/ },
|
|
29
|
+
{ module: /handlebars/ },
|
|
30
|
+
{ module: /typescript/ },
|
|
31
|
+
{ module: /yargs/ },
|
|
32
|
+
],
|
|
24
33
|
output: {
|
|
25
34
|
path: path.resolve(process.cwd(), 'dist'),
|
|
26
35
|
filename: 'index.js',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.450",
|
|
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.450",
|
|
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",
|