@promptbook/remote-client 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 +2 -2
- package/umd/index.umd.js +52 -3
- package/umd/index.umd.js.map +1 -1
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.89.0-
|
|
3
|
+
"version": "0.89.0-33",
|
|
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,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"module": "./esm/index.es.js",
|
|
52
52
|
"typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.89.0-
|
|
54
|
+
"@promptbook/core": "0.89.0-33"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-33';
|
|
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
|
|
@@ -1837,6 +1837,28 @@
|
|
|
1837
1837
|
// encoding: 'utf-8',
|
|
1838
1838
|
});
|
|
1839
1839
|
|
|
1840
|
+
/**
|
|
1841
|
+
* Function to check if a string is valid CSV
|
|
1842
|
+
*
|
|
1843
|
+
* @param value The string to check
|
|
1844
|
+
* @returns True if the string is a valid CSV string, false otherwise
|
|
1845
|
+
*
|
|
1846
|
+
* @public exported from `@promptbook/utils`
|
|
1847
|
+
*/
|
|
1848
|
+
function isValidCsvString(value) {
|
|
1849
|
+
try {
|
|
1850
|
+
// A simple check for CSV format: at least one comma and no invalid characters
|
|
1851
|
+
if (value.includes(',') && /^[\w\s,"']+$/.test(value)) {
|
|
1852
|
+
return true;
|
|
1853
|
+
}
|
|
1854
|
+
return false;
|
|
1855
|
+
}
|
|
1856
|
+
catch (error) {
|
|
1857
|
+
assertsError(error);
|
|
1858
|
+
return false;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1840
1862
|
/**
|
|
1841
1863
|
* Definition for CSV spreadsheet
|
|
1842
1864
|
*
|
|
@@ -1847,7 +1869,7 @@
|
|
|
1847
1869
|
formatName: 'CSV',
|
|
1848
1870
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
1849
1871
|
isValid(value, settings, schema) {
|
|
1850
|
-
return
|
|
1872
|
+
return isValidCsvString(value);
|
|
1851
1873
|
},
|
|
1852
1874
|
canBeValid(partialValue, settings, schema) {
|
|
1853
1875
|
return true;
|
|
@@ -1928,6 +1950,9 @@
|
|
|
1928
1950
|
/**
|
|
1929
1951
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1930
1952
|
*
|
|
1953
|
+
* @param value The string to check
|
|
1954
|
+
* @returns True if the string is a valid JSON string, false otherwise
|
|
1955
|
+
*
|
|
1931
1956
|
* @public exported from `@promptbook/utils`
|
|
1932
1957
|
*/
|
|
1933
1958
|
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
@@ -2020,6 +2045,30 @@
|
|
|
2020
2045
|
* TODO: [🏢] Allow to expect something inside each item of list and other formats
|
|
2021
2046
|
*/
|
|
2022
2047
|
|
|
2048
|
+
/**
|
|
2049
|
+
* Function to check if a string is valid XML
|
|
2050
|
+
*
|
|
2051
|
+
* @param value
|
|
2052
|
+
* @returns True if the string is a valid XML string, false otherwise
|
|
2053
|
+
*
|
|
2054
|
+
* @public exported from `@promptbook/utils`
|
|
2055
|
+
*/
|
|
2056
|
+
function isValidXmlString(value) {
|
|
2057
|
+
try {
|
|
2058
|
+
const parser = new DOMParser();
|
|
2059
|
+
const parsedDocument = parser.parseFromString(value, 'application/xml');
|
|
2060
|
+
const parserError = parsedDocument.getElementsByTagName('parsererror');
|
|
2061
|
+
if (parserError.length > 0) {
|
|
2062
|
+
return false;
|
|
2063
|
+
}
|
|
2064
|
+
return true;
|
|
2065
|
+
}
|
|
2066
|
+
catch (error) {
|
|
2067
|
+
assertsError(error);
|
|
2068
|
+
return false;
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2023
2072
|
/**
|
|
2024
2073
|
* Definition for XML format
|
|
2025
2074
|
*
|
|
@@ -2029,7 +2078,7 @@
|
|
|
2029
2078
|
formatName: 'XML',
|
|
2030
2079
|
mimeType: 'application/xml',
|
|
2031
2080
|
isValid(value, settings, schema) {
|
|
2032
|
-
return
|
|
2081
|
+
return isValidXmlString(value);
|
|
2033
2082
|
},
|
|
2034
2083
|
canBeValid(partialValue, settings, schema) {
|
|
2035
2084
|
return true;
|