@promptbook/core 0.75.1 → 0.75.3
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 +76 -32
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +0 -4
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -3
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +1 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -4
- package/package.json +1 -1
- package/umd/index.umd.js +76 -32
- package/umd/index.umd.js.map +1 -1
|
@@ -20,7 +20,3 @@ export type PipelineInterface = {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly outputParameters: ReadonlyArray<OutputParameterJson>;
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
* TODO: [🧠][🤓] How to pass optional parameters - for example summary in FORMFACTOR Translator
|
|
25
|
-
* TODO: [🧠] Better name than `PipelineInterface` to avoid confusion with typescript `interface`
|
|
26
|
-
*/
|
|
@@ -3,11 +3,9 @@ import type { PipelineInterface } from './PipelineInterface';
|
|
|
3
3
|
/**
|
|
4
4
|
* @@@
|
|
5
5
|
*
|
|
6
|
+
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
6
7
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
7
8
|
*
|
|
8
9
|
* @public exported from `@promptbook/core`
|
|
9
10
|
*/
|
|
10
11
|
export declare function getPipelineInterface(pipeline: PipelineJson): PipelineInterface;
|
|
11
|
-
/**
|
|
12
|
-
* TODO: !!!!!! Write unit test
|
|
13
|
-
*/
|
|
@@ -18,12 +18,9 @@ export type IsPipelineImplementingInterfaceOptions = {
|
|
|
18
18
|
/**
|
|
19
19
|
* @@@
|
|
20
20
|
*
|
|
21
|
+
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
21
22
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
22
23
|
*
|
|
23
24
|
* @public exported from `@promptbook/core`
|
|
24
25
|
*/
|
|
25
26
|
export declare function isPipelineImplementingInterface(options: IsPipelineImplementingInterfaceOptions): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* TODO: !!!!!! Test real implementing NOT equality
|
|
28
|
-
* TODO: !!!!!! Write unit test
|
|
29
|
-
*/
|
|
@@ -2,12 +2,9 @@ import type { PipelineInterface } from './PipelineInterface';
|
|
|
2
2
|
/**
|
|
3
3
|
* @@@
|
|
4
4
|
*
|
|
5
|
+
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
5
6
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/core`
|
|
8
9
|
*/
|
|
9
10
|
export declare function isPipelineInterfacesEqual(pipelineInterface1: PipelineInterface, pipelineInterface2: PipelineInterface): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* TODO: [🧠] !!! Return more states than true/false - 'IDENTICAL' |'IDENTICAL_UNPREPARED' | 'IDENTICAL_INTERFACE' | 'DIFFERENT'
|
|
12
|
-
* TODO: !!! Write unit test
|
|
13
|
-
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.2';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1290,7 +1290,6 @@
|
|
|
1290
1290
|
while (unresovedTasks.length > 0) {
|
|
1291
1291
|
_loop_3();
|
|
1292
1292
|
}
|
|
1293
|
-
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1294
1293
|
}
|
|
1295
1294
|
/**
|
|
1296
1295
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -5117,16 +5116,16 @@
|
|
|
5117
5116
|
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
5118
5117
|
*/
|
|
5119
5118
|
var all = [];
|
|
5120
|
-
var _loop_1 = function (packageName, className) {
|
|
5119
|
+
var _loop_1 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
|
|
5121
5120
|
if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
|
|
5122
5121
|
return "continue";
|
|
5123
5122
|
}
|
|
5124
|
-
all.push({ packageName: packageName, className: className });
|
|
5123
|
+
all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
|
|
5125
5124
|
};
|
|
5126
5125
|
try {
|
|
5127
5126
|
for (var _c = __values($scrapersMetadataRegister.list()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
5128
|
-
var _e = _d.value, packageName = _e.packageName, className = _e.className;
|
|
5129
|
-
_loop_1(packageName, className);
|
|
5127
|
+
var _e = _d.value, packageName = _e.packageName, className = _e.className, mimeTypes = _e.mimeTypes, documentationUrl = _e.documentationUrl, isAvilableInBrowser = _e.isAvilableInBrowser;
|
|
5128
|
+
_loop_1(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
|
|
5130
5129
|
}
|
|
5131
5130
|
}
|
|
5132
5131
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -5136,16 +5135,16 @@
|
|
|
5136
5135
|
}
|
|
5137
5136
|
finally { if (e_1) throw e_1.error; }
|
|
5138
5137
|
}
|
|
5139
|
-
var _loop_2 = function (packageName, className) {
|
|
5138
|
+
var _loop_2 = function (packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser) {
|
|
5140
5139
|
if (all.some(function (item) { return item.packageName === packageName && item.className === className; })) {
|
|
5141
5140
|
return "continue";
|
|
5142
5141
|
}
|
|
5143
|
-
all.push({ packageName: packageName, className: className });
|
|
5142
|
+
all.push({ packageName: packageName, className: className, mimeTypes: mimeTypes, documentationUrl: documentationUrl, isAvilableInBrowser: isAvilableInBrowser });
|
|
5144
5143
|
};
|
|
5145
5144
|
try {
|
|
5146
5145
|
for (var _f = __values($scrapersRegister.list()), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
5147
|
-
var _h = _g.value, packageName = _h.packageName, className = _h.className;
|
|
5148
|
-
_loop_2(packageName, className);
|
|
5146
|
+
var _h = _g.value, packageName = _h.packageName, className = _h.className, mimeTypes = _h.mimeTypes, documentationUrl = _h.documentationUrl, isAvilableInBrowser = _h.isAvilableInBrowser;
|
|
5147
|
+
_loop_2(packageName, className, mimeTypes, documentationUrl, isAvilableInBrowser);
|
|
5149
5148
|
}
|
|
5150
5149
|
}
|
|
5151
5150
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -5175,29 +5174,33 @@
|
|
|
5175
5174
|
}
|
|
5176
5175
|
return spaceTrim__default["default"](function (block) { return "\n Available scrapers are:\n ".concat(block(metadata
|
|
5177
5176
|
.map(function (_a, i) {
|
|
5178
|
-
var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled;
|
|
5177
|
+
var packageName = _a.packageName, className = _a.className, isMetadataAviailable = _a.isMetadataAviailable, isInstalled = _a.isInstalled, mimeTypes = _a.mimeTypes, isAvilableInBrowser = _a.isAvilableInBrowser;
|
|
5179
5178
|
var more;
|
|
5179
|
+
// TODO: Use documentationUrl
|
|
5180
5180
|
if (just(false)) {
|
|
5181
5181
|
more = '';
|
|
5182
5182
|
}
|
|
5183
5183
|
else if (!isMetadataAviailable && !isInstalled) {
|
|
5184
5184
|
// TODO: [�][�] Maybe do allow to do auto-install if package not registered and not found
|
|
5185
|
-
more = "(not installed and no metadata, looks like a unexpected behavior)";
|
|
5185
|
+
more = "*(not installed and no metadata, looks like a unexpected behavior)*";
|
|
5186
5186
|
}
|
|
5187
5187
|
else if (isMetadataAviailable && !isInstalled) {
|
|
5188
5188
|
// TODO: [�][�]
|
|
5189
|
-
more = "(not installed)";
|
|
5189
|
+
more = "*(not installed)*";
|
|
5190
5190
|
}
|
|
5191
5191
|
else if (!isMetadataAviailable && isInstalled) {
|
|
5192
|
-
more = "(no metadata, looks like a unexpected behavior)";
|
|
5192
|
+
more = "*(no metadata, looks like a unexpected behavior)*";
|
|
5193
5193
|
}
|
|
5194
5194
|
else if (isMetadataAviailable && isInstalled) {
|
|
5195
5195
|
more = "(installed)";
|
|
5196
5196
|
}
|
|
5197
5197
|
else {
|
|
5198
|
-
more = "(unknown state, looks like a unexpected behavior)";
|
|
5198
|
+
more = "*(unknown state, looks like a unexpected behavior)*";
|
|
5199
5199
|
}
|
|
5200
|
-
|
|
5200
|
+
if (!isAvilableInBrowser) {
|
|
5201
|
+
more += " *(not available in browser)*";
|
|
5202
|
+
}
|
|
5203
|
+
return "".concat(i + 1, ") `").concat(className, "` from `").concat(packageName, "` compatible to scrape ").concat(mimeTypes.join(', '), " ").concat(more);
|
|
5201
5204
|
})
|
|
5202
5205
|
.join('\n')), "\n "); });
|
|
5203
5206
|
}
|
|
@@ -5582,7 +5585,10 @@
|
|
|
5582
5585
|
return [7 /*endfinally*/];
|
|
5583
5586
|
case 9:
|
|
5584
5587
|
if (partialPieces === null) {
|
|
5585
|
-
throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge from source
|
|
5588
|
+
throw new KnowledgeScrapeError(spaceTrim__default["default"](function (block) { return "\n Cannot scrape knowledge from source:\n \n > ".concat(block(knowledgeSource.sourceContent
|
|
5589
|
+
.split('\n')
|
|
5590
|
+
.map(function (line) { return "> ".concat(line); })
|
|
5591
|
+
.join('\n')), "\n\n No scraper found for the mime type \"").concat(sourceHandler.mimeType, "\"\n\n ").concat(block($registeredScrapersMessage()), "\n\n\n "); }));
|
|
5586
5592
|
}
|
|
5587
5593
|
pieces = partialPieces.map(function (partialPiece) { return (__assign(__assign({}, partialPiece), { sources: [
|
|
5588
5594
|
{
|
|
@@ -10057,6 +10063,7 @@
|
|
|
10057
10063
|
/**
|
|
10058
10064
|
* @@@
|
|
10059
10065
|
*
|
|
10066
|
+
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
10060
10067
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
10061
10068
|
*
|
|
10062
10069
|
* @public exported from `@promptbook/core`
|
|
@@ -10094,8 +10101,6 @@
|
|
|
10094
10101
|
var name2 = _b.name;
|
|
10095
10102
|
return name1.localeCompare(name2);
|
|
10096
10103
|
});
|
|
10097
|
-
// <- TODO: [🧠] Should we compare a descriptions?
|
|
10098
|
-
// <- TODO: [🧠][🛴] Maybe add type + expectations into the intefrace, like "a person name"
|
|
10099
10104
|
}
|
|
10100
10105
|
}
|
|
10101
10106
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -10107,29 +10112,72 @@
|
|
|
10107
10112
|
}
|
|
10108
10113
|
return $deepFreeze(pipelineInterface);
|
|
10109
10114
|
}
|
|
10110
|
-
/**
|
|
10111
|
-
* TODO: !!!!!! Write unit test
|
|
10112
|
-
*/
|
|
10113
10115
|
|
|
10114
10116
|
/**
|
|
10115
10117
|
* @@@
|
|
10116
10118
|
*
|
|
10119
|
+
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
10117
10120
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
10118
10121
|
*
|
|
10119
10122
|
* @public exported from `@promptbook/core`
|
|
10120
10123
|
*/
|
|
10121
10124
|
function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
|
|
10122
|
-
|
|
10123
|
-
|
|
10125
|
+
var e_1, _a, e_2, _b;
|
|
10126
|
+
try {
|
|
10127
|
+
for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
10128
|
+
var whichParameters = _d.value;
|
|
10129
|
+
var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
|
|
10130
|
+
var parameters2 = pipelineInterface2[whichParameters];
|
|
10131
|
+
if (parameters1.length !== parameters2.length) {
|
|
10132
|
+
return false;
|
|
10133
|
+
}
|
|
10134
|
+
var _loop_1 = function (parameter) {
|
|
10135
|
+
var matchingParameter = parameters2.find(function (_a) {
|
|
10136
|
+
var name = _a.name;
|
|
10137
|
+
return name === parameter.name;
|
|
10138
|
+
});
|
|
10139
|
+
if (!matchingParameter) {
|
|
10140
|
+
return { value: false };
|
|
10141
|
+
}
|
|
10142
|
+
// Note: Do not compare description, it is not relevant for compatibility
|
|
10143
|
+
if (matchingParameter.isInput !== parameter.isInput) {
|
|
10144
|
+
return { value: false };
|
|
10145
|
+
}
|
|
10146
|
+
if (matchingParameter.isOutput !== parameter.isOutput) {
|
|
10147
|
+
return { value: false };
|
|
10148
|
+
}
|
|
10149
|
+
};
|
|
10150
|
+
try {
|
|
10151
|
+
for (var parameters1_1 = (e_2 = void 0, __values(parameters1)), parameters1_1_1 = parameters1_1.next(); !parameters1_1_1.done; parameters1_1_1 = parameters1_1.next()) {
|
|
10152
|
+
var parameter = parameters1_1_1.value;
|
|
10153
|
+
var state_1 = _loop_1(parameter);
|
|
10154
|
+
if (typeof state_1 === "object")
|
|
10155
|
+
return state_1.value;
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
10159
|
+
finally {
|
|
10160
|
+
try {
|
|
10161
|
+
if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
|
|
10162
|
+
}
|
|
10163
|
+
finally { if (e_2) throw e_2.error; }
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10166
|
+
}
|
|
10167
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
10168
|
+
finally {
|
|
10169
|
+
try {
|
|
10170
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
10171
|
+
}
|
|
10172
|
+
finally { if (e_1) throw e_1.error; }
|
|
10173
|
+
}
|
|
10174
|
+
return true;
|
|
10124
10175
|
}
|
|
10125
|
-
/**
|
|
10126
|
-
* TODO: [🧠] !!! Return more states than true/false - 'IDENTICAL' |'IDENTICAL_UNPREPARED' | 'IDENTICAL_INTERFACE' | 'DIFFERENT'
|
|
10127
|
-
* TODO: !!! Write unit test
|
|
10128
|
-
*/
|
|
10129
10176
|
|
|
10130
10177
|
/**
|
|
10131
10178
|
* @@@
|
|
10132
10179
|
*
|
|
10180
|
+
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
10133
10181
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
10134
10182
|
*
|
|
10135
10183
|
* @public exported from `@promptbook/core`
|
|
@@ -10138,10 +10186,6 @@
|
|
|
10138
10186
|
var pipeline = options.pipeline, pipelineInterface = options.pipelineInterface;
|
|
10139
10187
|
return isPipelineInterfacesEqual(getPipelineInterface(pipeline), pipelineInterface);
|
|
10140
10188
|
}
|
|
10141
|
-
/**
|
|
10142
|
-
* TODO: !!!!!! Test real implementing NOT equality
|
|
10143
|
-
* TODO: !!!!!! Write unit test
|
|
10144
|
-
*/
|
|
10145
10189
|
|
|
10146
10190
|
/**
|
|
10147
10191
|
* Metadata of the scraper
|