@promptbook/cli 0.61.0-17 → 0.61.0-18
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/esm/index.es.js +84 -59
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +10 -10
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +7 -7
- package/package.json +2 -2
- package/umd/index.umd.js +84 -59
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +10 -10
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +7 -7
package/esm/index.es.js
CHANGED
|
@@ -150,7 +150,7 @@ new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined'
|
|
|
150
150
|
/**
|
|
151
151
|
* The version of the Promptbook library
|
|
152
152
|
*/
|
|
153
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
153
|
+
var PROMPTBOOK_VERSION = '0.61.0-17';
|
|
154
154
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
155
155
|
|
|
156
156
|
/**
|
|
@@ -492,7 +492,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
492
492
|
});
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
495
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-17",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-17",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {content}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-17",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {content}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-17",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-17",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
496
496
|
|
|
497
497
|
/**
|
|
498
498
|
* Prettify the html code
|
|
@@ -1168,79 +1168,94 @@ var ReferenceError$1 = /** @class */ (function (_super) {
|
|
|
1168
1168
|
}(Error));
|
|
1169
1169
|
|
|
1170
1170
|
/**
|
|
1171
|
-
*
|
|
1172
|
-
|
|
1171
|
+
* Unprepare just strips the preparation data of the pipeline
|
|
1172
|
+
*/
|
|
1173
|
+
function unpreparePipeline(pipeline) {
|
|
1174
|
+
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources;
|
|
1175
|
+
personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
|
|
1176
|
+
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
1177
|
+
return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
1181
|
+
* TODO: Write tests for `preparePipeline`
|
|
1182
|
+
*/
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Library of pipelines that groups together pipelines for an application.
|
|
1186
|
+
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
1173
1187
|
*
|
|
1174
1188
|
* @private use `createCollectionFromJson` instead
|
|
1175
|
-
* @see https://github.com/webgptorg/
|
|
1189
|
+
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
1176
1190
|
*/
|
|
1177
1191
|
var SimplePipelineCollection = /** @class */ (function () {
|
|
1178
1192
|
/**
|
|
1179
|
-
* Constructs a pipeline collection from
|
|
1193
|
+
* Constructs a pipeline collection from pipelines
|
|
1180
1194
|
*
|
|
1181
|
-
* @param
|
|
1195
|
+
* @param pipelines @@@
|
|
1182
1196
|
*
|
|
1183
1197
|
* @private Use instead `createCollectionFromJson`
|
|
1184
|
-
* Note: During the construction logic of all
|
|
1198
|
+
* Note: During the construction logic of all pipelines are validated
|
|
1185
1199
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
1186
1200
|
*/
|
|
1187
1201
|
function SimplePipelineCollection() {
|
|
1188
1202
|
var e_1, _a;
|
|
1189
|
-
var
|
|
1203
|
+
var pipelines = [];
|
|
1190
1204
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1191
|
-
|
|
1205
|
+
pipelines[_i] = arguments[_i];
|
|
1192
1206
|
}
|
|
1193
1207
|
this.collection = new Map();
|
|
1194
1208
|
try {
|
|
1195
|
-
for (var
|
|
1196
|
-
var
|
|
1197
|
-
if (
|
|
1198
|
-
throw new ReferenceError$1(spaceTrim$1("\n
|
|
1209
|
+
for (var pipelines_1 = __values(pipelines), pipelines_1_1 = pipelines_1.next(); !pipelines_1_1.done; pipelines_1_1 = pipelines_1.next()) {
|
|
1210
|
+
var pipeline = pipelines_1_1.value;
|
|
1211
|
+
if (pipeline.pipelineUrl === undefined) {
|
|
1212
|
+
throw new ReferenceError$1(spaceTrim$1("\n Pipeline with name \"".concat(pipeline.title, "\" does not have defined URL\n\n File:\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines without URLs are called anonymous pipelines\n They can be used as standalone pipelines, but they cannot be referenced by other pipelines\n And also they cannot be used in the pipeline collection\n\n ")));
|
|
1199
1213
|
}
|
|
1200
|
-
validatePipeline(
|
|
1214
|
+
validatePipeline(pipeline);
|
|
1201
1215
|
// Note: [🦄]
|
|
1202
|
-
if (this.collection.has(
|
|
1203
|
-
pipelineJsonToString(
|
|
1204
|
-
|
|
1205
|
-
|
|
1216
|
+
if (this.collection.has(pipeline.pipelineUrl) &&
|
|
1217
|
+
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
1218
|
+
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
1219
|
+
var existing = this.collection.get(pipeline.pipelineUrl);
|
|
1220
|
+
throw new ReferenceError$1(spaceTrim$1("\n Pipeline with URL \"".concat(pipeline.pipelineUrl, "\" is already in the collection\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
|
|
1206
1221
|
}
|
|
1207
|
-
this.collection.set(
|
|
1222
|
+
this.collection.set(pipeline.pipelineUrl, pipeline);
|
|
1208
1223
|
}
|
|
1209
1224
|
}
|
|
1210
1225
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1211
1226
|
finally {
|
|
1212
1227
|
try {
|
|
1213
|
-
if (
|
|
1228
|
+
if (pipelines_1_1 && !pipelines_1_1.done && (_a = pipelines_1.return)) _a.call(pipelines_1);
|
|
1214
1229
|
}
|
|
1215
1230
|
finally { if (e_1) throw e_1.error; }
|
|
1216
1231
|
}
|
|
1217
1232
|
}
|
|
1218
1233
|
/**
|
|
1219
|
-
* Gets all
|
|
1234
|
+
* Gets all pipelines in the collection
|
|
1220
1235
|
*/
|
|
1221
1236
|
SimplePipelineCollection.prototype.listPipelines = function () {
|
|
1222
1237
|
return Array.from(this.collection.keys());
|
|
1223
1238
|
};
|
|
1224
1239
|
/**
|
|
1225
|
-
* Gets
|
|
1240
|
+
* Gets pipeline by its URL
|
|
1226
1241
|
*
|
|
1227
1242
|
* Note: This is not a direct fetching from the URL, but a lookup in the collection
|
|
1228
1243
|
*/
|
|
1229
1244
|
SimplePipelineCollection.prototype.getPipelineByUrl = function (url) {
|
|
1230
1245
|
var _this = this;
|
|
1231
|
-
var
|
|
1232
|
-
if (!
|
|
1246
|
+
var pipeline = this.collection.get(url);
|
|
1247
|
+
if (!pipeline) {
|
|
1233
1248
|
if (this.listPipelines().length === 0) {
|
|
1234
|
-
throw new NotFoundError(spaceTrim$1("\n
|
|
1249
|
+
throw new NotFoundError(spaceTrim$1("\n Pipeline with url \"".concat(url, "\" not found\n\n No pipelines available\n ")));
|
|
1235
1250
|
}
|
|
1236
|
-
throw new NotFoundError(spaceTrim$1(function (block) { return "\n
|
|
1251
|
+
throw new NotFoundError(spaceTrim$1(function (block) { return "\n Pipeline with url \"".concat(url, "\" not found\n\n Available pipelines:\n ").concat(block(_this.listPipelines()
|
|
1237
1252
|
.map(function (pipelineUrl) { return "- ".concat(pipelineUrl); })
|
|
1238
1253
|
.join('\n')), "\n\n "); }));
|
|
1239
1254
|
}
|
|
1240
|
-
return
|
|
1255
|
+
return pipeline;
|
|
1241
1256
|
};
|
|
1242
1257
|
/**
|
|
1243
|
-
* Checks whether given prompt was defined in any
|
|
1258
|
+
* Checks whether given prompt was defined in any pipeline in the collection
|
|
1244
1259
|
*/
|
|
1245
1260
|
SimplePipelineCollection.prototype.isResponsibleForPrompt = function (prompt) {
|
|
1246
1261
|
return true;
|
|
@@ -2015,7 +2030,7 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2015
2030
|
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors.map(function (error) { return "- ".concat(error.name || 'Error', ": ").concat(error.message); }).join('\n')), "\n\n "); }));
|
|
2016
2031
|
}
|
|
2017
2032
|
else {
|
|
2018
|
-
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n
|
|
2033
|
+
throw new PipelineExecutionError(spaceTrim(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.llmExecutionTools
|
|
2019
2034
|
.map(function (tools) { return "- ".concat(tools.title, " ").concat(tools.description || ''); })
|
|
2020
2035
|
.join('\n')), "\n\n "); }));
|
|
2021
2036
|
}
|
|
@@ -2094,7 +2109,7 @@ function joinLlmExecutionTools() {
|
|
|
2094
2109
|
llmExecutionTools[_i] = arguments[_i];
|
|
2095
2110
|
}
|
|
2096
2111
|
if (llmExecutionTools.length === 0) {
|
|
2097
|
-
var warningMessage = spaceTrim("\n You have provided
|
|
2112
|
+
var warningMessage = spaceTrim("\n You have not provided any `LlmExecutionTools`\n This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.\n\n Technically, it's not an error, but it's probably not what you want because it does not make sense to use Promptbook without language models.\n ");
|
|
2098
2113
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
2099
2114
|
console.warn(warningMessage);
|
|
2100
2115
|
/*
|
|
@@ -5459,11 +5474,11 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
|
5459
5474
|
}
|
|
5460
5475
|
|
|
5461
5476
|
/**
|
|
5462
|
-
* Constructs
|
|
5477
|
+
* Constructs Pipeline from given directory
|
|
5463
5478
|
*
|
|
5464
5479
|
* Note: Works only in Node.js environment because it reads the file system
|
|
5465
5480
|
*
|
|
5466
|
-
* @param path - path to the directory with
|
|
5481
|
+
* @param path - path to the directory with pipelines
|
|
5467
5482
|
* @param options - Misc options for the collection
|
|
5468
5483
|
* @returns PipelineCollection
|
|
5469
5484
|
*/
|
|
@@ -5493,20 +5508,31 @@ function createCollectionFromDirectory(path, options) {
|
|
|
5493
5508
|
}
|
|
5494
5509
|
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? false : _c, _d = _a.isLazyLoaded, isLazyLoaded = _d === void 0 ? false : _d, _e = _a.isCrashedOnError, isCrashedOnError = _e === void 0 ? true : _e;
|
|
5495
5510
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5496
|
-
var fileNames,
|
|
5511
|
+
var fileNames, pipelines, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
|
|
5497
5512
|
var e_1, _a;
|
|
5498
5513
|
return __generator(this, function (_b) {
|
|
5499
5514
|
switch (_b.label) {
|
|
5500
5515
|
case 0:
|
|
5501
5516
|
if (isVerbose) {
|
|
5502
|
-
console.info("Creating pipeline collection from path ".concat(path.split('\\').join('/')));
|
|
5517
|
+
console.info(colors.cyan("Creating pipeline collection from path ".concat(path.split('\\').join('/'))));
|
|
5503
5518
|
}
|
|
5504
5519
|
return [4 /*yield*/, listAllFiles(path, isRecursive)];
|
|
5505
5520
|
case 1:
|
|
5506
5521
|
fileNames = _b.sent();
|
|
5507
|
-
|
|
5522
|
+
// Note: First load all .ptbk.json and then .ptbk.md files
|
|
5523
|
+
// .ptbk.json can be prepared so it is faster to load
|
|
5524
|
+
fileNames.sort(function (a, b) {
|
|
5525
|
+
if (a.endsWith('.ptbk.json') && b.endsWith('.ptbk.md')) {
|
|
5526
|
+
return -1;
|
|
5527
|
+
}
|
|
5528
|
+
if (a.endsWith('.ptbk.md') && b.endsWith('.ptbk.json')) {
|
|
5529
|
+
return 1;
|
|
5530
|
+
}
|
|
5531
|
+
return 0;
|
|
5532
|
+
});
|
|
5533
|
+
pipelines = [];
|
|
5508
5534
|
_loop_1 = function (fileName) {
|
|
5509
|
-
var sourceFile,
|
|
5535
|
+
var sourceFile, pipeline, pipelineString, _c, _d, error_1, wrappedErrorMessage;
|
|
5510
5536
|
return __generator(this, function (_e) {
|
|
5511
5537
|
switch (_e.label) {
|
|
5512
5538
|
case 0:
|
|
@@ -5514,53 +5540,52 @@ function createCollectionFromDirectory(path, options) {
|
|
|
5514
5540
|
_e.label = 1;
|
|
5515
5541
|
case 1:
|
|
5516
5542
|
_e.trys.push([1, 8, , 9]);
|
|
5517
|
-
|
|
5543
|
+
pipeline = null;
|
|
5518
5544
|
if (!fileName.endsWith('.ptbk.md')) return [3 /*break*/, 4];
|
|
5519
5545
|
return [4 /*yield*/, readFile(fileName, 'utf8')];
|
|
5520
5546
|
case 2:
|
|
5521
5547
|
pipelineString = (_e.sent());
|
|
5522
5548
|
return [4 /*yield*/, pipelineStringToJson(pipelineString, options)];
|
|
5523
5549
|
case 3:
|
|
5524
|
-
|
|
5525
|
-
|
|
5550
|
+
pipeline = _e.sent();
|
|
5551
|
+
pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
|
|
5526
5552
|
return [3 /*break*/, 7];
|
|
5527
5553
|
case 4:
|
|
5528
5554
|
if (!fileName.endsWith('.ptbk.json')) return [3 /*break*/, 6];
|
|
5529
|
-
if (isVerbose) {
|
|
5530
|
-
console.info("Loading ".concat(fileName.split('\\').join('/')));
|
|
5531
|
-
}
|
|
5532
5555
|
_d = (_c = JSON).parse;
|
|
5533
5556
|
return [4 /*yield*/, readFile(fileName, 'utf8')];
|
|
5534
5557
|
case 5:
|
|
5535
5558
|
// TODO: Handle non-valid JSON files
|
|
5536
|
-
|
|
5559
|
+
pipeline = _d.apply(_c, [_e.sent()]);
|
|
5537
5560
|
// TODO: [🌗]
|
|
5538
|
-
|
|
5561
|
+
pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
|
|
5539
5562
|
return [3 /*break*/, 7];
|
|
5540
5563
|
case 6:
|
|
5541
5564
|
if (isVerbose) {
|
|
5542
|
-
console.info("Skipping file ".concat(fileName.split('\\').join('/')));
|
|
5565
|
+
console.info(colors.gray("Skipping file ".concat(fileName.split('\\').join('/'))));
|
|
5543
5566
|
}
|
|
5544
5567
|
_e.label = 7;
|
|
5545
5568
|
case 7:
|
|
5546
5569
|
// ---
|
|
5547
|
-
if (
|
|
5548
|
-
if (!
|
|
5570
|
+
if (pipeline !== null) {
|
|
5571
|
+
if (!pipeline.pipelineUrl) {
|
|
5549
5572
|
if (isVerbose) {
|
|
5550
|
-
console.info("
|
|
5573
|
+
console.info(colors.red("Can not load pipeline from ".concat(fileName
|
|
5574
|
+
.split('\\')
|
|
5575
|
+
.join('/'), " because of missing URL")));
|
|
5551
5576
|
}
|
|
5552
5577
|
}
|
|
5553
5578
|
else {
|
|
5554
|
-
if (isVerbose) {
|
|
5555
|
-
console.info("Loading ".concat(fileName.split('\\').join('/')));
|
|
5556
|
-
}
|
|
5557
5579
|
if (!isCrashedOnError) {
|
|
5558
|
-
// Note: Validate
|
|
5580
|
+
// Note: Validate pipeline to check if it is logically correct to not crash on invalid pipelines
|
|
5559
5581
|
// But be handled in current try-catch block
|
|
5560
|
-
validatePipeline(
|
|
5582
|
+
validatePipeline(pipeline);
|
|
5583
|
+
}
|
|
5584
|
+
if (isVerbose) {
|
|
5585
|
+
console.info(colors.green("Loading ".concat(fileName.split('\\').join('/'))));
|
|
5561
5586
|
}
|
|
5562
|
-
// Note: [🦄]
|
|
5563
|
-
|
|
5587
|
+
// Note: [🦄] Pipeline with same url uniqueness will be checked automatically in SimplePipelineCollection
|
|
5588
|
+
pipelines.push(pipeline);
|
|
5564
5589
|
}
|
|
5565
5590
|
}
|
|
5566
5591
|
return [3 /*break*/, 9];
|
|
@@ -5606,7 +5631,7 @@ function createCollectionFromDirectory(path, options) {
|
|
|
5606
5631
|
}
|
|
5607
5632
|
finally { if (e_1) throw e_1.error; }
|
|
5608
5633
|
return [7 /*endfinally*/];
|
|
5609
|
-
case 9: return [2 /*return*/,
|
|
5634
|
+
case 9: return [2 /*return*/, pipelines];
|
|
5610
5635
|
}
|
|
5611
5636
|
});
|
|
5612
5637
|
}); });
|
|
@@ -5680,8 +5705,8 @@ function listAllFiles(path, isRecursive) {
|
|
|
5680
5705
|
});
|
|
5681
5706
|
}
|
|
5682
5707
|
/**
|
|
5683
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json
|
|
5684
|
-
* Note: [🟢] This code should never be published outside of `@
|
|
5708
|
+
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json pipelines
|
|
5709
|
+
* Note: [🟢] This code should never be published outside of `@pipeline/node`
|
|
5685
5710
|
*/
|
|
5686
5711
|
|
|
5687
5712
|
/**
|