@promptbook/remote-client 0.88.0-11 → 0.88.0-12
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/README.md +7 -19
- package/esm/index.es.js +27 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/PipelineExecutionError.d.ts +5 -0
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +5 -0
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +3 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -0
- package/package.json +3 -2
- package/umd/index.umd.js +30 -7
- package/umd/index.umd.js.map +1 -1
|
@@ -5,3 +5,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
7
|
export declare function countCharacters(text: string): ExpectationAmount;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
10
|
+
*/
|
|
@@ -7,3 +7,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function countLines(text: string): ExpectationAmount;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
12
|
+
*/
|
|
@@ -7,3 +7,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
9
|
export declare function countPages(text: string): ExpectationAmount;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
12
|
+
*/
|
|
@@ -5,3 +5,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
7
|
export declare function countParagraphs(text: string): ExpectationAmount;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
10
|
+
*/
|
|
@@ -11,3 +11,6 @@ export declare function splitIntoSentences(text: string): ReadonlyArray<string>;
|
|
|
11
11
|
* @public exported from `@promptbook/utils`
|
|
12
12
|
*/
|
|
13
13
|
export declare function countSentences(text: string): ExpectationAmount;
|
|
14
|
+
/**
|
|
15
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
16
|
+
*/
|
|
@@ -5,3 +5,6 @@ import type { ExpectationAmount } from '../../pipeline/PipelineJson/Expectations
|
|
|
5
5
|
* @public exported from `@promptbook/utils`
|
|
6
6
|
*/
|
|
7
7
|
export declare function countWords(text: string): ExpectationAmount;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
10
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.88.0-
|
|
3
|
+
"version": "0.88.0-12",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.88.0-
|
|
50
|
+
"@promptbook/core": "0.88.0-12"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"crypto": "^1.0.1",
|
|
53
54
|
"crypto-js": "4.2.0",
|
|
54
55
|
"papaparse": "5.4.1",
|
|
55
56
|
"socket.io-client": "4.7.2",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('socket.io-client'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'socket.io-client', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
-
})(this, (function (exports, spaceTrim, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
+
})(this, (function (exports, spaceTrim, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.88.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.88.0-12';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -197,6 +197,21 @@
|
|
|
197
197
|
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
198
198
|
*/
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Generates random token
|
|
202
|
+
*
|
|
203
|
+
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
204
|
+
*
|
|
205
|
+
* @private internal helper function
|
|
206
|
+
* @returns secure random token
|
|
207
|
+
*/
|
|
208
|
+
function $randomToken(randomness) {
|
|
209
|
+
return crypto.randomBytes(randomness).toString('hex');
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
213
|
+
*/
|
|
214
|
+
|
|
200
215
|
/**
|
|
201
216
|
* This error indicates errors during the execution of the pipeline
|
|
202
217
|
*
|
|
@@ -204,11 +219,17 @@
|
|
|
204
219
|
*/
|
|
205
220
|
class PipelineExecutionError extends Error {
|
|
206
221
|
constructor(message) {
|
|
222
|
+
// Added id parameter
|
|
207
223
|
super(message);
|
|
208
224
|
this.name = 'PipelineExecutionError';
|
|
225
|
+
// TODO: [🐙] DRY - Maybe $randomId
|
|
226
|
+
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */)}`;
|
|
209
227
|
Object.setPrototypeOf(this, PipelineExecutionError.prototype);
|
|
210
228
|
}
|
|
211
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* TODO: !!!!!! Add id to all errors
|
|
232
|
+
*/
|
|
212
233
|
|
|
213
234
|
/**
|
|
214
235
|
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
@@ -464,7 +485,7 @@
|
|
|
464
485
|
* @public exported from `@promptbook/utils`
|
|
465
486
|
*/
|
|
466
487
|
function deserializeError(error) {
|
|
467
|
-
const { name, stack } = error;
|
|
488
|
+
const { name, stack, id } = error; // Added id
|
|
468
489
|
let { message } = error;
|
|
469
490
|
let ErrorClass = ALL_ERRORS[error.name];
|
|
470
491
|
if (ErrorClass === undefined) {
|
|
@@ -479,7 +500,9 @@
|
|
|
479
500
|
${block(stack || '')}
|
|
480
501
|
`);
|
|
481
502
|
}
|
|
482
|
-
|
|
503
|
+
const deserializedError = new ErrorClass(message);
|
|
504
|
+
deserializedError.id = id; // Assign id to the error object
|
|
505
|
+
return deserializedError;
|
|
483
506
|
}
|
|
484
507
|
|
|
485
508
|
/**
|