@promptbook/markdown-utils 0.85.0-0 → 0.85.0-10
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 +25 -8
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +0 -1
- package/esm/typings/src/execution/ExecutionTask.d.ts +7 -3
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +6 -4
- package/esm/typings/src/utils/normalization/suffixUrl.d.ts +7 -0
- package/esm/typings/src/utils/normalization/suffixUrl.test.d.ts +1 -0
- package/package.json +1 -1
- package/umd/index.umd.js +24 -7
- package/umd/index.umd.js.map +1 -1
|
@@ -47,6 +47,7 @@ import { parseKeywords } from '../utils/normalization/parseKeywords';
|
|
|
47
47
|
import { parseKeywordsFromString } from '../utils/normalization/parseKeywordsFromString';
|
|
48
48
|
import { removeDiacritics } from '../utils/normalization/removeDiacritics';
|
|
49
49
|
import { searchKeywords } from '../utils/normalization/searchKeywords';
|
|
50
|
+
import { suffixUrl } from '../utils/normalization/suffixUrl';
|
|
50
51
|
import { titleToName } from '../utils/normalization/titleToName';
|
|
51
52
|
import { spaceTrim } from '../utils/organization/spaceTrim';
|
|
52
53
|
import { extractParameterNames } from '../utils/parameters/extractParameterNames';
|
|
@@ -128,6 +129,7 @@ export { parseKeywords };
|
|
|
128
129
|
export { parseKeywordsFromString };
|
|
129
130
|
export { removeDiacritics };
|
|
130
131
|
export { searchKeywords };
|
|
132
|
+
export { suffixUrl };
|
|
131
133
|
export { titleToName };
|
|
132
134
|
export { spaceTrim };
|
|
133
135
|
export { extractParameterNames };
|
|
@@ -8,7 +8,6 @@ import type { Command as Program } from 'commander';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function $initializeAboutCommand(program: Program): void;
|
|
10
10
|
/**
|
|
11
|
-
* TODO: !!! Test this in `deno`
|
|
12
11
|
* TODO: [🗽] Unite branding and make single place for it
|
|
13
12
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14
13
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
2
|
import { PartialDeep } from 'type-fest';
|
|
3
|
-
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
4
3
|
import type { task_id } from '../types/typeAliases';
|
|
4
|
+
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
5
5
|
import type { AbstractTaskResult } from './AbstractTaskResult';
|
|
6
6
|
import type { PipelineExecutorResult } from './PipelineExecutorResult';
|
|
7
7
|
/**
|
|
@@ -30,7 +30,7 @@ export declare function createTask<TTaskResult extends AbstractTaskResult>(optio
|
|
|
30
30
|
*/
|
|
31
31
|
export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
|
|
32
32
|
readonly taskType: 'EXECUTION';
|
|
33
|
-
readonly taskId: `
|
|
33
|
+
readonly taskId: `exec-${task_id}`;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* Represents a task that prepares a pipeline
|
|
@@ -38,7 +38,7 @@ export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
|
|
|
38
38
|
*/
|
|
39
39
|
export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
|
|
40
40
|
readonly taskType: 'PREPARATION';
|
|
41
|
-
readonly taskId: `
|
|
41
|
+
readonly taskId: `prep-${task_id}`;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* Base interface for all task types
|
|
@@ -62,6 +62,10 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
62
62
|
* Gets an observable stream of partial task results
|
|
63
63
|
*/
|
|
64
64
|
asObservable(): Observable<PartialDeep<TTaskResult>>;
|
|
65
|
+
/**
|
|
66
|
+
* Gets just the current value which is mutated during the task processing
|
|
67
|
+
*/
|
|
68
|
+
currentValue: PartialDeep<TTaskResult>;
|
|
65
69
|
};
|
|
66
70
|
export type Task = ExecutionTask | PreparationTask;
|
|
67
71
|
export {};
|
|
@@ -11,6 +11,7 @@ import type { RemoteServerOptions } from './types/RemoteServerOptions';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function startRemoteServer<TCustomOptions = undefined>(options: RemoteServerOptions<TCustomOptions>): IDestroyable;
|
|
13
13
|
/**
|
|
14
|
+
* TODO: !! Add CORS and security - probbably via `helmet`
|
|
14
15
|
* TODO: [👩🏾🤝🧑🏾] Allow to pass custom fetch function here - PromptbookFetch
|
|
15
16
|
* TODO: Split this file into multiple functions - handler for each request
|
|
16
17
|
* TODO: Maybe use `$exportJson`
|
|
@@ -25,12 +25,14 @@ export type RemoteServerOptions<TCustomOptions> = CommonToolsOptions & {
|
|
|
25
25
|
*/
|
|
26
26
|
readonly port: number;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Root path of the server
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* Note: This is useful when you reverse proxy the server without changing the path
|
|
31
|
+
*
|
|
32
|
+
* @default '/'
|
|
33
|
+
* @example '/api/promptbook/'
|
|
32
34
|
*/
|
|
33
|
-
readonly
|
|
35
|
+
readonly rootPath: string_uri;
|
|
34
36
|
} & (AnonymousRemoteServerOptions | ApplicationRemoteServerOptions<TCustomOptions> | (AnonymousRemoteServerOptions & ApplicationRemoteServerOptions<TCustomOptions>));
|
|
35
37
|
export type AnonymousRemoteServerOptions = {
|
|
36
38
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
28
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-9';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2190,10 +2190,26 @@
|
|
|
2190
2190
|
*/
|
|
2191
2191
|
function createTask(options) {
|
|
2192
2192
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2193
|
-
var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(
|
|
2194
|
-
var
|
|
2193
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2194
|
+
var partialResultSubject = new rxjs.BehaviorSubject({});
|
|
2195
2195
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2196
|
-
|
|
2196
|
+
partialResultSubject.next(newOngoingResult);
|
|
2197
|
+
});
|
|
2198
|
+
finalResultPromise
|
|
2199
|
+
.catch(function (error) {
|
|
2200
|
+
partialResultSubject.error(error);
|
|
2201
|
+
})
|
|
2202
|
+
.then(function (value) {
|
|
2203
|
+
if (value) {
|
|
2204
|
+
try {
|
|
2205
|
+
assertsTaskSuccessful(value);
|
|
2206
|
+
partialResultSubject.next(value);
|
|
2207
|
+
}
|
|
2208
|
+
catch (error) {
|
|
2209
|
+
partialResultSubject.error(error);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
partialResultSubject.complete();
|
|
2197
2213
|
});
|
|
2198
2214
|
function asPromise(options) {
|
|
2199
2215
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -2218,9 +2234,10 @@
|
|
|
2218
2234
|
taskId: taskId,
|
|
2219
2235
|
asPromise: asPromise,
|
|
2220
2236
|
asObservable: function () {
|
|
2221
|
-
return
|
|
2222
|
-
|
|
2223
|
-
|
|
2237
|
+
return partialResultSubject.asObservable();
|
|
2238
|
+
},
|
|
2239
|
+
get currentValue() {
|
|
2240
|
+
return partialResultSubject.value;
|
|
2224
2241
|
},
|
|
2225
2242
|
};
|
|
2226
2243
|
}
|