@promptbook/remote-server 0.89.0-29 → 0.89.0-30
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
CHANGED
|
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
33
33
|
* @generated
|
|
34
34
|
* @see https://github.com/webgptorg/promptbook
|
|
35
35
|
*/
|
|
36
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
36
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-30';
|
|
37
37
|
/**
|
|
38
38
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
39
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6778,15 +6778,15 @@ async function $provideScriptingForNode(options) {
|
|
|
6778
6778
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
6779
6779
|
*/
|
|
6780
6780
|
|
|
6781
|
-
// TODO:
|
|
6782
|
-
// TODO:
|
|
6781
|
+
// TODO: !!!! List running services from REMOTE_SERVER_URLS
|
|
6782
|
+
// TODO: !!!! Import directly from YML
|
|
6783
6783
|
/**
|
|
6784
6784
|
* @private !!!! Decide how to expose this
|
|
6785
6785
|
*/
|
|
6786
6786
|
const openapiJson = {
|
|
6787
6787
|
openapi: '3.0.0',
|
|
6788
6788
|
info: {
|
|
6789
|
-
title: 'Promptbook Remote Server API (
|
|
6789
|
+
title: 'Promptbook Remote Server API (!!!! From TS)',
|
|
6790
6790
|
version: '1.0.0',
|
|
6791
6791
|
description: 'API documentation for the Promptbook Remote Server',
|
|
6792
6792
|
},
|
|
@@ -7044,17 +7044,14 @@ function startRemoteServer(options) {
|
|
|
7044
7044
|
response.setHeader('X-Powered-By', 'Promptbook engine');
|
|
7045
7045
|
next();
|
|
7046
7046
|
});
|
|
7047
|
-
// TODO:
|
|
7047
|
+
// TODO: !!!! Expose openapiJson to consumer and also allow to add new routes
|
|
7048
7048
|
app.use(OpenApiValidator.middleware({
|
|
7049
7049
|
apiSpec: openapiJson,
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
console.warn(`!!! Ignoring paths`, ...args);
|
|
7053
|
-
return true;
|
|
7050
|
+
ignorePaths(path) {
|
|
7051
|
+
return path.startsWith('/api-docs') || path.startsWith('/swagger') || path.startsWith('/openapi');
|
|
7054
7052
|
},
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
validateResponses: false, // false by default
|
|
7053
|
+
validateRequests: true,
|
|
7054
|
+
validateResponses: true,
|
|
7058
7055
|
}));
|
|
7059
7056
|
app.use([`/api-docs`, `/swagger`], swaggerUi.serve, swaggerUi.setup(openapiJson, {
|
|
7060
7057
|
// customCss: '.swagger-ui .topbar { display: none }',
|
|
@@ -7064,10 +7061,6 @@ function startRemoteServer(options) {
|
|
|
7064
7061
|
app.get(`/openapi`, (request, response) => {
|
|
7065
7062
|
response.json(openapiJson);
|
|
7066
7063
|
});
|
|
7067
|
-
// TODO: !!! Remove:
|
|
7068
|
-
app.get(`/xxx`, (request, response) => {
|
|
7069
|
-
response.json(openapiJson);
|
|
7070
|
-
});
|
|
7071
7064
|
const runningExecutionTasks = [];
|
|
7072
7065
|
// <- TODO: [🤬] Identify the users
|
|
7073
7066
|
// TODO: [🧠] Do here some garbage collection of finished tasks
|
|
@@ -7231,7 +7224,7 @@ function startRemoteServer(options) {
|
|
|
7231
7224
|
}
|
|
7232
7225
|
}
|
|
7233
7226
|
app.get(`/executions`, async (request, response) => {
|
|
7234
|
-
response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)));
|
|
7227
|
+
response.send(runningExecutionTasks.map((runningExecutionTask) => exportExecutionTask(runningExecutionTask, false)) /* <- TODO: satisfies paths['/executions']['get']['responses']['200']['content']['application/json'] */);
|
|
7235
7228
|
});
|
|
7236
7229
|
app.get(`/executions/last`, async (request, response) => {
|
|
7237
7230
|
// TODO: [🤬] Filter only for user
|
|
@@ -7257,7 +7250,9 @@ function startRemoteServer(options) {
|
|
|
7257
7250
|
app.post(`/executions/new`, async (request, response) => {
|
|
7258
7251
|
try {
|
|
7259
7252
|
const { inputParameters, identification /* <- [🤬] */ } = request.body;
|
|
7260
|
-
const pipelineUrl = request.body
|
|
7253
|
+
const pipelineUrl = request.body
|
|
7254
|
+
.pipelineUrl /* <- TODO: as paths['/executions/new']['post']['requestBody']['content']['application/json'] */ ||
|
|
7255
|
+
request.body.book;
|
|
7261
7256
|
// TODO: [🧠] Check `pipelineUrl` and `inputParameters` here or it should be responsibility of `collection.getPipelineByUrl` and `pipelineExecutor`
|
|
7262
7257
|
const pipeline = await (collection === null || collection === void 0 ? void 0 : collection.getPipelineByUrl(pipelineUrl));
|
|
7263
7258
|
if (pipeline === undefined) {
|
|
@@ -7271,7 +7266,7 @@ function startRemoteServer(options) {
|
|
|
7271
7266
|
await forTime(10);
|
|
7272
7267
|
// <- Note: Wait for a while to wait for quick responses or sudden but asynchronous errors
|
|
7273
7268
|
// <- TODO: Put this into configuration
|
|
7274
|
-
response.send(executionTask);
|
|
7269
|
+
response.send(executionTask /* <- TODO: satisfies paths['/executions/new']['post']['responses']['200']['content']['application/json'] */);
|
|
7275
7270
|
/*/
|
|
7276
7271
|
executionTask.asObservable().subscribe({
|
|
7277
7272
|
next(partialResult) {
|