@promptbook/core 0.89.0-31 → 0.89.0-33
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 +52 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +9 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.test.d.ts +1 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +3 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +9 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.test.d.ts +1 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/Identification.d.ts +7 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +7 -0
- package/package.json +1 -1
- package/umd/index.umd.js +52 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -210,6 +210,7 @@ import type { string_uri_part } from '../types/typeAliases';
|
|
|
210
210
|
import type { string_hostname } from '../types/typeAliases';
|
|
211
211
|
import type { string_host } from '../types/typeAliases';
|
|
212
212
|
import type { string_protocol } from '../types/typeAliases';
|
|
213
|
+
import type { string_ip_address } from '../types/typeAliases';
|
|
213
214
|
import type { string_email } from '../types/typeAliases';
|
|
214
215
|
import type { string_emails } from '../types/typeAliases';
|
|
215
216
|
import type { string_uuid } from '../types/typeAliases';
|
|
@@ -505,6 +506,7 @@ export type { string_uri_part };
|
|
|
505
506
|
export type { string_hostname };
|
|
506
507
|
export type { string_host };
|
|
507
508
|
export type { string_protocol };
|
|
509
|
+
export type { string_ip_address };
|
|
508
510
|
export type { string_email };
|
|
509
511
|
export type { string_emails };
|
|
510
512
|
export type { string_uuid };
|
|
@@ -5,7 +5,9 @@ import { renderPromptbookMermaid } from '../conversion/prettify/renderPipelineMe
|
|
|
5
5
|
import { deserializeError } from '../errors/utils/deserializeError';
|
|
6
6
|
import { serializeError } from '../errors/utils/serializeError';
|
|
7
7
|
import { forEachAsync } from '../execution/utils/forEachAsync';
|
|
8
|
+
import { isValidCsvString } from '../formats/csv/utils/isValidCsvString';
|
|
8
9
|
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';
|
|
10
|
+
import { isValidXmlString } from '../formats/xml/utils/isValidXmlString';
|
|
9
11
|
import { prompt } from '../pipeline/prompt-notation';
|
|
10
12
|
import { promptTemplate } from '../pipeline/prompt-notation';
|
|
11
13
|
import { $getCurrentDate } from '../utils/$getCurrentDate';
|
|
@@ -87,7 +89,9 @@ export { renderPromptbookMermaid };
|
|
|
87
89
|
export { deserializeError };
|
|
88
90
|
export { serializeError };
|
|
89
91
|
export { forEachAsync };
|
|
92
|
+
export { isValidCsvString };
|
|
90
93
|
export { isValidJsonString };
|
|
94
|
+
export { isValidXmlString };
|
|
91
95
|
export { prompt };
|
|
92
96
|
export { promptTemplate };
|
|
93
97
|
export { $getCurrentDate };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to check if a string is valid CSV
|
|
3
|
+
*
|
|
4
|
+
* @param value The string to check
|
|
5
|
+
* @returns True if the string is a valid CSV string, false otherwise
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/utils`
|
|
8
|
+
*/
|
|
9
|
+
export declare function isValidCsvString(value: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
3
3
|
*
|
|
4
|
+
* @param value The string to check
|
|
5
|
+
* @returns True if the string is a valid JSON string, false otherwise
|
|
6
|
+
*
|
|
4
7
|
* @public exported from `@promptbook/utils`
|
|
5
8
|
*/
|
|
6
9
|
export declare function isValidJsonString(value: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to check if a string is valid XML
|
|
3
|
+
*
|
|
4
|
+
* @param value
|
|
5
|
+
* @returns True if the string is a valid XML string, false otherwise
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/utils`
|
|
8
|
+
*/
|
|
9
|
+
export declare function isValidXmlString(value: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LlmToolsConfiguration } from '../../../llm-providers/_common/register/LlmToolsConfiguration';
|
|
2
|
+
import type { string_ip_address } from '../../../types/typeAliases';
|
|
2
3
|
import type { string_user_id } from '../../../types/typeAliases';
|
|
3
4
|
import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteServerOptions';
|
|
4
5
|
/**
|
|
@@ -7,7 +8,12 @@ import type { ApplicationRemoteServerClientOptions } from '../../types/RemoteSer
|
|
|
7
8
|
* @public exported from `@promptbook/remote-server`
|
|
8
9
|
* @public exported from `@promptbook/remote-client`
|
|
9
10
|
*/
|
|
10
|
-
export type Identification<TCustomOptions> = ApplicationModeIdentification<TCustomOptions> | AnonymousModeIdentification
|
|
11
|
+
export type Identification<TCustomOptions> = (ApplicationModeIdentification<TCustomOptions> | AnonymousModeIdentification) & {
|
|
12
|
+
/**
|
|
13
|
+
* Identifier of the IP address of the client
|
|
14
|
+
*/
|
|
15
|
+
readonly ipAddress?: string_ip_address;
|
|
16
|
+
};
|
|
11
17
|
/**
|
|
12
18
|
* Application mode is situation when you run known and well-defined books with your own api keys
|
|
13
19
|
*
|
|
@@ -8,6 +8,7 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
|
8
8
|
import type { string_app_id } from '../../types/typeAliases';
|
|
9
9
|
import type { string_email } from '../../types/typeAliases';
|
|
10
10
|
import type { string_password } from '../../types/typeAliases';
|
|
11
|
+
import type { string_token } from '../../types/typeAliases';
|
|
11
12
|
import type { string_user_id } from '../../types/typeAliases';
|
|
12
13
|
import type { ApplicationModeIdentification } from '../socket-types/_subtypes/Identification';
|
|
13
14
|
import type { Identification } from '../socket-types/_subtypes/Identification';
|
|
@@ -101,7 +102,7 @@ export type ApplicationRemoteServerClientOptions<TCustomOptions> = {
|
|
|
101
102
|
*
|
|
102
103
|
* Note: This is passed for example to `createLlmExecutionTools`
|
|
103
104
|
*/
|
|
104
|
-
readonly userToken?:
|
|
105
|
+
readonly userToken?: string_token;
|
|
105
106
|
/**
|
|
106
107
|
* Additional arbitrary options to identify the client or to pass custom metadata
|
|
107
108
|
*/
|
|
@@ -414,6 +414,13 @@ export type string_host = string;
|
|
|
414
414
|
* Semantic helper
|
|
415
415
|
*/
|
|
416
416
|
export type string_protocol = 'http:' | 'https:';
|
|
417
|
+
/**
|
|
418
|
+
* Semantic helper
|
|
419
|
+
*
|
|
420
|
+
* For example `"192.168.1.1"` (IPv4)
|
|
421
|
+
* For example `"2001:0db8:85a3:0000:0000:8a2e:0370:7334"` (IPv6)
|
|
422
|
+
*/
|
|
423
|
+
export type string_ip_address = string;
|
|
417
424
|
/**
|
|
418
425
|
* Semantic helper
|
|
419
426
|
*
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-33';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -595,6 +595,9 @@
|
|
|
595
595
|
/**
|
|
596
596
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
597
597
|
*
|
|
598
|
+
* @param value The string to check
|
|
599
|
+
* @returns True if the string is a valid JSON string, false otherwise
|
|
600
|
+
*
|
|
598
601
|
* @public exported from `@promptbook/utils`
|
|
599
602
|
*/
|
|
600
603
|
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
@@ -2708,6 +2711,28 @@
|
|
|
2708
2711
|
// encoding: 'utf-8',
|
|
2709
2712
|
});
|
|
2710
2713
|
|
|
2714
|
+
/**
|
|
2715
|
+
* Function to check if a string is valid CSV
|
|
2716
|
+
*
|
|
2717
|
+
* @param value The string to check
|
|
2718
|
+
* @returns True if the string is a valid CSV string, false otherwise
|
|
2719
|
+
*
|
|
2720
|
+
* @public exported from `@promptbook/utils`
|
|
2721
|
+
*/
|
|
2722
|
+
function isValidCsvString(value) {
|
|
2723
|
+
try {
|
|
2724
|
+
// A simple check for CSV format: at least one comma and no invalid characters
|
|
2725
|
+
if (value.includes(',') && /^[\w\s,"']+$/.test(value)) {
|
|
2726
|
+
return true;
|
|
2727
|
+
}
|
|
2728
|
+
return false;
|
|
2729
|
+
}
|
|
2730
|
+
catch (error) {
|
|
2731
|
+
assertsError(error);
|
|
2732
|
+
return false;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2711
2736
|
/**
|
|
2712
2737
|
* Definition for CSV spreadsheet
|
|
2713
2738
|
*
|
|
@@ -2718,7 +2743,7 @@
|
|
|
2718
2743
|
formatName: 'CSV',
|
|
2719
2744
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2720
2745
|
isValid(value, settings, schema) {
|
|
2721
|
-
return
|
|
2746
|
+
return isValidCsvString(value);
|
|
2722
2747
|
},
|
|
2723
2748
|
canBeValid(partialValue, settings, schema) {
|
|
2724
2749
|
return true;
|
|
@@ -2872,6 +2897,30 @@
|
|
|
2872
2897
|
* TODO: [🏢] Allow to expect something inside each item of list and other formats
|
|
2873
2898
|
*/
|
|
2874
2899
|
|
|
2900
|
+
/**
|
|
2901
|
+
* Function to check if a string is valid XML
|
|
2902
|
+
*
|
|
2903
|
+
* @param value
|
|
2904
|
+
* @returns True if the string is a valid XML string, false otherwise
|
|
2905
|
+
*
|
|
2906
|
+
* @public exported from `@promptbook/utils`
|
|
2907
|
+
*/
|
|
2908
|
+
function isValidXmlString(value) {
|
|
2909
|
+
try {
|
|
2910
|
+
const parser = new DOMParser();
|
|
2911
|
+
const parsedDocument = parser.parseFromString(value, 'application/xml');
|
|
2912
|
+
const parserError = parsedDocument.getElementsByTagName('parsererror');
|
|
2913
|
+
if (parserError.length > 0) {
|
|
2914
|
+
return false;
|
|
2915
|
+
}
|
|
2916
|
+
return true;
|
|
2917
|
+
}
|
|
2918
|
+
catch (error) {
|
|
2919
|
+
assertsError(error);
|
|
2920
|
+
return false;
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2875
2924
|
/**
|
|
2876
2925
|
* Definition for XML format
|
|
2877
2926
|
*
|
|
@@ -2881,7 +2930,7 @@
|
|
|
2881
2930
|
formatName: 'XML',
|
|
2882
2931
|
mimeType: 'application/xml',
|
|
2883
2932
|
isValid(value, settings, schema) {
|
|
2884
|
-
return
|
|
2933
|
+
return isValidXmlString(value);
|
|
2885
2934
|
},
|
|
2886
2935
|
canBeValid(partialValue, settings, schema) {
|
|
2887
2936
|
return true;
|