@botpress/cli 0.11.6 → 1.0.0
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/.turbo/turbo-build.log +9 -9
- package/dist/api/bot-body.js.map +2 -2
- package/dist/api/client.js +14 -28
- package/dist/api/client.js.map +3 -3
- package/dist/api/find-previous-version.js.map +1 -1
- package/dist/api/index.js +23 -0
- package/dist/api/index.js.map +7 -0
- package/dist/api/interface-body.js +25 -10
- package/dist/api/interface-body.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-implementation.js +92 -0
- package/dist/code-generation/bot-implementation/bot-implementation.js.map +7 -0
- package/dist/code-generation/{integration-schemas → bot-implementation/bot-typings}/events-module.js +15 -22
- package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/bot-typings/index.js +96 -0
- package/dist/code-generation/bot-implementation/bot-typings/index.js.map +7 -0
- package/dist/code-generation/{integration-schemas → bot-implementation/bot-typings}/states-module.js +17 -22
- package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +7 -0
- package/dist/code-generation/bot-implementation/index.js +56 -0
- package/dist/code-generation/bot-implementation/index.js.map +7 -0
- package/dist/code-generation/{const.js → consts.js} +9 -4
- package/dist/code-generation/consts.js.map +7 -0
- package/dist/code-generation/generators.js +37 -7
- package/dist/code-generation/generators.js.map +2 -2
- package/dist/code-generation/index.js +15 -105
- package/dist/code-generation/index.js.map +3 -3
- package/dist/code-generation/integration-implementation/index.js +66 -0
- package/dist/code-generation/integration-implementation/index.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-implementation.js +110 -0
- package/dist/code-generation/integration-implementation/integration-implementation.js.map +7 -0
- package/dist/code-generation/{integration-secret.js → integration-implementation/integration-secret.js} +17 -7
- package/dist/code-generation/integration-implementation/integration-secret.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/actions-module.js +28 -40
- package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/channels-module.js +103 -0
- package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/configuration-module.js +18 -20
- package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/configurations-module.js +21 -27
- package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +7 -0
- package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/entities-module.js +15 -22
- package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/events-module.js +59 -0
- package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/index.js +128 -0
- package/dist/code-generation/integration-implementation/integration-typings/index.js.map +7 -0
- package/dist/code-generation/integration-implementation/integration-typings/states-module.js +60 -0
- package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +7 -0
- package/dist/code-generation/integration-package/index.js +81 -0
- package/dist/code-generation/integration-package/index.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +84 -0
- package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/channels-module.js +103 -0
- package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js +58 -0
- package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js +66 -0
- package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/entities-module.js +59 -0
- package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/events-module.js +62 -0
- package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/index.js +136 -0
- package/dist/code-generation/integration-package/integration-package-definition/index.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/states-module.js +62 -0
- package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +7 -0
- package/dist/code-generation/integration-package/integration-package-definition/typings.js +17 -0
- package/dist/code-generation/integration-package/integration-package-definition/typings.js.map +7 -0
- package/dist/code-generation/interface-package/index.js +81 -0
- package/dist/code-generation/interface-package/index.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +84 -0
- package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/channels-module.js +94 -0
- package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/entities-module.js +59 -0
- package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/events-module.js +62 -0
- package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/index.js +100 -0
- package/dist/code-generation/interface-package/interface-package-definition/index.js.map +7 -0
- package/dist/code-generation/interface-package/interface-package-definition/typings.js +17 -0
- package/dist/code-generation/interface-package/interface-package-definition/typings.js.map +7 -0
- package/dist/code-generation/module.js +60 -16
- package/dist/code-generation/module.js.map +2 -2
- package/dist/code-generation/strings.js +5 -2
- package/dist/code-generation/strings.js.map +2 -2
- package/dist/code-generation/typings.js.map +1 -1
- package/dist/command-implementations/add-command.js +102 -91
- package/dist/command-implementations/add-command.js.map +3 -3
- package/dist/command-implementations/bundle-command.js +16 -9
- package/dist/command-implementations/bundle-command.js.map +2 -2
- package/dist/command-implementations/deploy-command.js +27 -19
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/dev-command.js +15 -12
- package/dist/command-implementations/dev-command.js.map +2 -2
- package/dist/command-implementations/gen-command.js +31 -12
- package/dist/command-implementations/gen-command.js.map +3 -3
- package/dist/command-implementations/init-command.js +2 -2
- package/dist/command-implementations/init-command.js.map +2 -2
- package/dist/command-implementations/integration-commands.js +5 -5
- package/dist/command-implementations/integration-commands.js.map +2 -2
- package/dist/command-implementations/interface-commands.js +5 -5
- package/dist/command-implementations/interface-commands.js.map +2 -2
- package/dist/command-implementations/lint-command.js +3 -1
- package/dist/command-implementations/lint-command.js.map +3 -3
- package/dist/command-implementations/project-command.js +40 -23
- package/dist/command-implementations/project-command.js.map +3 -3
- package/dist/command-implementations/read-command.js +0 -5
- package/dist/command-implementations/read-command.js.map +2 -2
- package/dist/config.js +22 -7
- package/dist/config.js.map +2 -2
- package/dist/consts.js +15 -6
- package/dist/consts.js.map +2 -2
- package/dist/errors.js +19 -11
- package/dist/errors.js.map +2 -2
- package/dist/logger/index.js +4 -2
- package/dist/logger/index.js.map +2 -2
- package/dist/{integration-ref.js → package-ref.js} +11 -11
- package/dist/package-ref.js.map +7 -0
- package/dist/{integration-ref.test.js → package-ref.test.js} +18 -18
- package/dist/package-ref.test.js.map +7 -0
- package/dist/sdk/index.js +21 -0
- package/dist/sdk/index.js.map +7 -0
- package/dist/sdk/resolve-bot-interfaces.js +38 -0
- package/dist/sdk/resolve-bot-interfaces.js.map +7 -0
- package/dist/sdk/resolve-integration-interfaces.js +148 -0
- package/dist/sdk/resolve-integration-interfaces.js.map +7 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +2 -2
- package/dist/utils/path-utils.js +25 -8
- package/dist/utils/path-utils.js.map +3 -3
- package/dist/utils/path-utils.test.js +69 -0
- package/dist/utils/path-utils.test.js.map +7 -0
- package/dist/utils/record-utils.js +25 -0
- package/dist/utils/record-utils.js.map +3 -3
- package/dist/utils/schema-utils.js +11 -0
- package/dist/utils/schema-utils.js.map +2 -2
- package/dist/utils/schema-utils.test.js +51 -0
- package/dist/utils/schema-utils.test.js.map +7 -0
- package/dist/utils/template-utils.js +47 -0
- package/dist/utils/template-utils.js.map +7 -0
- package/dist/utils/type-utils.js.map +1 -1
- package/e2e/index.ts +2 -0
- package/e2e/tests/install-package.ts +163 -0
- package/e2e/utils.ts +25 -2
- package/package.json +5 -4
- package/templates/empty-bot/.botpress/implementation/index.ts +41 -0
- package/templates/empty-bot/.botpress/implementation/typings/index.ts +17 -0
- package/templates/empty-bot/.botpress/implementation/typings/integrations/index.ts +6 -0
- package/templates/empty-bot/.botpress/index.ts +1 -0
- package/templates/empty-bot/bot.definition.ts +2 -0
- package/templates/{echo-bot → empty-bot}/package.json +2 -2
- package/templates/empty-bot/src/index.ts +5 -0
- package/templates/empty-integration/.botpress/implementation/index.ts +7 -35
- package/templates/empty-integration/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/empty-integration/.botpress/implementation/typings/index.ts +31 -0
- package/templates/empty-integration/package.json +1 -1
- package/templates/hello-world/.botpress/implementation/index.ts +7 -35
- package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/input.ts +5 -0
- package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/output.ts +5 -0
- package/templates/hello-world/.botpress/implementation/typings/configuration/index.ts +2 -0
- package/templates/hello-world/.botpress/implementation/typings/index.ts +31 -0
- package/templates/hello-world/package.json +1 -1
- package/templates/webhook-message/.botpress/implementation/index.ts +7 -35
- package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/text.ts +5 -0
- package/templates/webhook-message/.botpress/implementation/typings/configuration/index.ts +8 -0
- package/templates/webhook-message/.botpress/implementation/typings/events/index.ts +6 -0
- package/templates/webhook-message/.botpress/implementation/typings/index.ts +31 -0
- package/templates/webhook-message/.botpress/implementation/typings/states/index.ts +6 -0
- package/templates/webhook-message/package.json +1 -1
- package/dist/code-generation/const.js.map +0 -7
- package/dist/code-generation/integration-implementation.js +0 -192
- package/dist/code-generation/integration-implementation.js.map +0 -7
- package/dist/code-generation/integration-instance.js +0 -185
- package/dist/code-generation/integration-instance.js.map +0 -7
- package/dist/code-generation/integration-schemas/actions-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/channels-module.js +0 -117
- package/dist/code-generation/integration-schemas/channels-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/configuration-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/configurations-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/entities-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/events-module.js.map +0 -7
- package/dist/code-generation/integration-schemas/states-module.js.map +0 -7
- package/dist/code-generation/integration-secret.js.map +0 -7
- package/dist/code-generation/map-integration.js +0 -76
- package/dist/code-generation/map-integration.js.map +0 -7
- package/dist/integration-ref.js.map +0 -7
- package/dist/integration-ref.test.js.map +0 -7
- package/templates/echo-bot/src/index.ts +0 -30
- package/templates/empty-integration/.botpress/implementation/configuration/index.ts +0 -10
- package/templates/hello-world/.botpress/implementation/actions/helloWorld/input.ts +0 -10
- package/templates/hello-world/.botpress/implementation/actions/helloWorld/output.ts +0 -10
- package/templates/hello-world/.botpress/implementation/configuration/index.ts +0 -10
- package/templates/webhook-message/.botpress/implementation/channels/webhook/messages/text.ts +0 -10
- package/templates/webhook-message/.botpress/implementation/configuration/index.ts +0 -13
- /package/templates/{empty-integration/.botpress/implementation → empty-bot/.botpress/implementation/typings}/events/index.ts +0 -0
- /package/templates/{empty-integration/.botpress/implementation → empty-bot/.botpress/implementation/typings}/states/index.ts +0 -0
- /package/templates/{echo-bot → empty-bot}/tsconfig.json +0 -0
- /package/templates/empty-integration/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
- /package/templates/empty-integration/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
- /package/templates/empty-integration/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
- /package/templates/empty-integration/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
- /package/templates/{hello-world/.botpress/implementation → empty-integration/.botpress/implementation/typings}/events/index.ts +0 -0
- /package/templates/{hello-world/.botpress/implementation → empty-integration/.botpress/implementation/typings}/states/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{actions → typings/actions}/helloWorld/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
- /package/templates/hello-world/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
- /package/templates/{webhook-message/.botpress/implementation → hello-world/.botpress/implementation/typings}/events/index.ts +0 -0
- /package/templates/{webhook-message/.botpress/implementation → hello-world/.botpress/implementation/typings}/states/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/webhook/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/webhook/messages/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
- /package/templates/webhook-message/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
18
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
25
|
var integration_secret_exports = {};
|
|
20
26
|
__export(integration_secret_exports, {
|
|
@@ -22,15 +28,19 @@ __export(integration_secret_exports, {
|
|
|
22
28
|
secretEnvVariableName: () => secretEnvVariableName
|
|
23
29
|
});
|
|
24
30
|
module.exports = __toCommonJS(integration_secret_exports);
|
|
25
|
-
var import_utils = require("
|
|
26
|
-
var
|
|
27
|
-
var import_module = require("
|
|
31
|
+
var import_utils = require("../../utils");
|
|
32
|
+
var consts = __toESM(require("../consts"));
|
|
33
|
+
var import_module = require("../module");
|
|
28
34
|
const secretEnvVariableName = (secretName) => `SECRET_${import_utils.casing.to.screamingSnakeCase(secretName)}`;
|
|
29
35
|
class IntegrationSecretIndexModule extends import_module.Module {
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
constructor(_integration) {
|
|
37
|
+
super({ exportName: "secrets", path: consts.INDEX_FILE });
|
|
38
|
+
this._integration = _integration;
|
|
39
|
+
}
|
|
40
|
+
async getContent() {
|
|
41
|
+
let content = consts.GENERATED_HEADER;
|
|
32
42
|
content += "class Secrets {\n";
|
|
33
|
-
for (const [secretName, { optional }] of Object.entries(
|
|
43
|
+
for (const [secretName, { optional }] of Object.entries(this._integration.secrets ?? {})) {
|
|
34
44
|
const envVariableName = secretEnvVariableName(secretName);
|
|
35
45
|
const fieldName = import_utils.casing.to.screamingSnakeCase(secretName);
|
|
36
46
|
if (optional) {
|
|
@@ -53,7 +63,7 @@ class IntegrationSecretIndexModule extends import_module.Module {
|
|
|
53
63
|
}
|
|
54
64
|
content += "}\n";
|
|
55
65
|
content += "export const secrets = new Secrets()\n";
|
|
56
|
-
return
|
|
66
|
+
return content;
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/code-generation/integration-implementation/integration-secret.ts"],
|
|
4
|
+
"sourcesContent": ["import { IntegrationDefinition } from '@botpress/sdk'\nimport { casing } from '../../utils'\nimport * as consts from '../consts'\nimport { Module } from '../module'\n\nexport const secretEnvVariableName = (secretName: string) => `SECRET_${casing.to.screamingSnakeCase(secretName)}`\n\nexport class IntegrationSecretIndexModule extends Module {\n public constructor(private _integration: IntegrationDefinition) {\n super({ exportName: 'secrets', path: consts.INDEX_FILE })\n }\n\n public async getContent() {\n let content = consts.GENERATED_HEADER\n content += 'class Secrets {\\n'\n for (const [secretName, { optional }] of Object.entries(this._integration.secrets ?? {})) {\n const envVariableName = secretEnvVariableName(secretName)\n const fieldName = casing.to.screamingSnakeCase(secretName)\n\n if (optional) {\n content += ` public get ${fieldName}(): string | undefined {\\n`\n content += ` const envVarValue = process.env.${envVariableName}\\n`\n content += ' return envVarValue\\n'\n content += ' }\\n'\n } else {\n content += ` public get ${fieldName}(): string {\\n`\n content += ` const envVarValue = process.env.${envVariableName}\\n`\n content += ` if (!envVarValue) throw new Error('Missing required secret \"${secretName}\"')\\n`\n content += ' return envVarValue\\n'\n content += ' }\\n'\n }\n }\n content += '}\\n'\n content += 'export const secrets = new Secrets()\\n'\n return content\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAuB;AACvB,aAAwB;AACxB,oBAAuB;AAEhB,MAAM,wBAAwB,CAAC,eAAuB,UAAU,oBAAO,GAAG,mBAAmB,UAAU;AAEvG,MAAM,qCAAqC,qBAAO;AAAA,EAChD,YAAoB,cAAqC;AAC9D,UAAM,EAAE,YAAY,WAAW,MAAM,OAAO,WAAW,CAAC;AAD/B;AAAA,EAE3B;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,UAAU,OAAO;AACrB,eAAW;AACX,eAAW,CAAC,YAAY,EAAE,SAAS,CAAC,KAAK,OAAO,QAAQ,KAAK,aAAa,WAAW,CAAC,CAAC,GAAG;AACxF,YAAM,kBAAkB,sBAAsB,UAAU;AACxD,YAAM,YAAY,oBAAO,GAAG,mBAAmB,UAAU;AAEzD,UAAI,UAAU;AACZ,mBAAW,gBAAgB;AAAA;AAC3B,mBAAW,uCAAuC;AAAA;AAClD,mBAAW;AACX,mBAAW;AAAA,MACb,OAAO;AACL,mBAAW,gBAAgB;AAAA;AAC3B,mBAAW,uCAAuC;AAAA;AAClD,mBAAW,mEAAmE;AAAA;AAC9E,mBAAW;AACX,mBAAW;AAAA,MACb;AAAA,IACF;AACA,eAAW;AACX,eAAW;AACX,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -30,60 +30,48 @@ __export(actions_module_exports, {
|
|
|
30
30
|
ActionsModule: () => ActionsModule
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(actions_module_exports);
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var strings = __toESM(require("../strings"));
|
|
33
|
+
var import_generators = require("../../generators");
|
|
34
|
+
var import_module = require("../../module");
|
|
35
|
+
var strings = __toESM(require("../../strings"));
|
|
37
36
|
class ActionInputModule extends import_module.Module {
|
|
38
|
-
|
|
39
|
-
const schema = input.schema;
|
|
37
|
+
constructor(_input) {
|
|
40
38
|
const name = "input";
|
|
41
39
|
const exportName = strings.typeName(name);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return new ActionInputModule(def);
|
|
40
|
+
super({ path: `${name}.ts`, exportName });
|
|
41
|
+
this._input = _input;
|
|
42
|
+
}
|
|
43
|
+
async getContent() {
|
|
44
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._input.schema, this.exportName);
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
class ActionOutputModule extends import_module.Module {
|
|
51
|
-
|
|
52
|
-
const schema = output.schema;
|
|
48
|
+
constructor(_output) {
|
|
53
49
|
const name = "output";
|
|
54
50
|
const exportName = strings.typeName(name);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return new ActionOutputModule(def);
|
|
51
|
+
super({ path: `${name}.ts`, exportName });
|
|
52
|
+
this._output = _output;
|
|
53
|
+
}
|
|
54
|
+
async getContent() {
|
|
55
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._output.schema, this.exportName);
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
58
|
class ActionModule extends import_module.ReExportTypeModule {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
inst.pushDep(inputModule);
|
|
72
|
-
inst.pushDep(outputModule);
|
|
73
|
-
return inst;
|
|
59
|
+
constructor(actionName, action) {
|
|
60
|
+
super({ exportName: strings.typeName(actionName) });
|
|
61
|
+
const inputModule = new ActionInputModule(action.input);
|
|
62
|
+
const outputModule = new ActionOutputModule(action.output);
|
|
63
|
+
this.pushDep(inputModule);
|
|
64
|
+
this.pushDep(outputModule);
|
|
74
65
|
}
|
|
75
66
|
}
|
|
76
67
|
class ActionsModule extends import_module.ReExportTypeModule {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
inst.pushDep(...actionModules);
|
|
86
|
-
return inst;
|
|
68
|
+
constructor(actions) {
|
|
69
|
+
super({ exportName: strings.typeName("actions") });
|
|
70
|
+
for (const [actionName, action] of Object.entries(actions)) {
|
|
71
|
+
const module2 = new ActionModule(actionName, action);
|
|
72
|
+
module2.unshift(actionName);
|
|
73
|
+
this.pushDep(module2);
|
|
74
|
+
}
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
77
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/actions-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\ntype ActionInput = sdk.ActionDefinition['input']\ntype ActionOutput = sdk.ActionDefinition['output']\n\nexport class ActionInputModule extends Module {\n public constructor(private _input: ActionInput) {\n const name = 'input'\n const exportName = strings.typeName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._input.schema, this.exportName)\n }\n}\n\nexport class ActionOutputModule extends Module {\n public constructor(private _output: ActionOutput) {\n const name = 'output'\n const exportName = strings.typeName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._output.schema, this.exportName)\n }\n}\n\nexport class ActionModule extends ReExportTypeModule {\n public constructor(actionName: string, action: sdk.ActionDefinition) {\n super({ exportName: strings.typeName(actionName) })\n\n const inputModule = new ActionInputModule(action.input)\n const outputModule = new ActionOutputModule(action.output)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n }\n}\n\nexport class ActionsModule extends ReExportTypeModule {\n public constructor(actions: Record<string, sdk.ActionDefinition>) {\n super({ exportName: strings.typeName('actions') })\n for (const [actionName, action] of Object.entries(actions)) {\n const module = new ActionModule(actionName, action)\n module.unshift(actionName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAKlB,MAAM,0BAA0B,qBAAO;AAAA,EACrC,YAAoB,QAAqB;AAC9C,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EACtE;AACF;AAEO,MAAM,2BAA2B,qBAAO;AAAA,EACtC,YAAoB,SAAuB;AAChD,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,QAAQ,QAAQ,KAAK,UAAU;AAAA,EACvE;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EAC5C,YAAY,YAAoB,QAA8B;AACnE,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAElD,UAAM,cAAc,IAAI,kBAAkB,OAAO,KAAK;AACtD,UAAM,eAAe,IAAI,mBAAmB,OAAO,MAAM;AAEzD,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AAAA,EAC3B;AACF;AAEO,MAAM,sBAAsB,iCAAmB;AAAA,EAC7C,YAAY,SAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,SAAS,SAAS,EAAE,CAAC;AACjD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC1D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,MAAAA,QAAO,QAAQ,UAAU;AACzB,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
package/dist/code-generation/integration-implementation/integration-typings/channels-module.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var channels_module_exports = {};
|
|
26
|
+
__export(channels_module_exports, {
|
|
27
|
+
ChannelsModule: () => ChannelsModule
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(channels_module_exports);
|
|
30
|
+
var import_consts = require("../../consts");
|
|
31
|
+
var import_generators = require("../../generators");
|
|
32
|
+
var import_module = require("../../module");
|
|
33
|
+
var strings = __toESM(require("../../strings"));
|
|
34
|
+
class MessageModule extends import_module.Module {
|
|
35
|
+
constructor(name, _message) {
|
|
36
|
+
super({
|
|
37
|
+
path: `${name}.ts`,
|
|
38
|
+
exportName: strings.typeName(name)
|
|
39
|
+
});
|
|
40
|
+
this._message = _message;
|
|
41
|
+
}
|
|
42
|
+
async getContent() {
|
|
43
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._message.schema, this.exportName);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class MessagesModule extends import_module.ReExportTypeModule {
|
|
47
|
+
constructor(channel) {
|
|
48
|
+
super({ exportName: strings.typeName("messages") });
|
|
49
|
+
for (const [messageName, message] of Object.entries(channel.messages ?? {})) {
|
|
50
|
+
const module2 = new MessageModule(messageName, message);
|
|
51
|
+
this.pushDep(module2);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class ChannelModule extends import_module.Module {
|
|
56
|
+
constructor(channelName, _channel) {
|
|
57
|
+
super({
|
|
58
|
+
path: import_consts.INDEX_FILE,
|
|
59
|
+
exportName: strings.typeName(channelName)
|
|
60
|
+
});
|
|
61
|
+
this._channel = _channel;
|
|
62
|
+
this._messagesModule = new MessagesModule(_channel);
|
|
63
|
+
this._messagesModule.unshift("messages");
|
|
64
|
+
this.pushDep(this._messagesModule);
|
|
65
|
+
}
|
|
66
|
+
_messagesModule;
|
|
67
|
+
async getContent() {
|
|
68
|
+
const messageImport = this._messagesModule.import(this);
|
|
69
|
+
const conversation = {
|
|
70
|
+
tags: this._channel.conversation?.tags ?? {},
|
|
71
|
+
creation: this._channel.conversation?.creation ?? { enabled: false, requiredTags: [] }
|
|
72
|
+
};
|
|
73
|
+
const message = {
|
|
74
|
+
tags: this._channel.message?.tags ?? {}
|
|
75
|
+
};
|
|
76
|
+
return [
|
|
77
|
+
import_consts.GENERATED_HEADER,
|
|
78
|
+
`import { ${this._messagesModule.exportName} } from './${messageImport}'`,
|
|
79
|
+
`export * from './${messageImport}'`,
|
|
80
|
+
"",
|
|
81
|
+
`export type ${this.exportName} = {`,
|
|
82
|
+
` messages: ${this._messagesModule.exportName}`,
|
|
83
|
+
` message: ${(0, import_generators.stringifySingleLine)(message)}`,
|
|
84
|
+
` conversation: ${(0, import_generators.stringifySingleLine)(conversation)}`,
|
|
85
|
+
"}"
|
|
86
|
+
].join("\n");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
class ChannelsModule extends import_module.ReExportTypeModule {
|
|
90
|
+
constructor(channels) {
|
|
91
|
+
super({ exportName: strings.typeName("channels") });
|
|
92
|
+
for (const [channelName, channel] of Object.entries(channels)) {
|
|
93
|
+
const module2 = new ChannelModule(channelName, channel);
|
|
94
|
+
module2.unshift(channelName);
|
|
95
|
+
this.pushDep(module2);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
ChannelsModule
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=channels-module.js.map
|
package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/channels-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { GENERATED_HEADER, INDEX_FILE } from '../../consts'\nimport { zuiSchemaToTypeScriptType, stringifySingleLine } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nclass MessageModule extends Module {\n public constructor(name: string, private _message: sdk.MessageDefinition) {\n super({\n path: `${name}.ts`,\n exportName: strings.typeName(name),\n })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._message.schema, this.exportName)\n }\n}\n\nclass MessagesModule extends ReExportTypeModule {\n public constructor(channel: sdk.ChannelDefinition) {\n super({ exportName: strings.typeName('messages') })\n for (const [messageName, message] of Object.entries(channel.messages ?? {})) {\n const module = new MessageModule(messageName, message)\n this.pushDep(module)\n }\n }\n}\n\nclass ChannelModule extends Module {\n private _messagesModule: MessagesModule\n\n public constructor(channelName: string, private _channel: sdk.ChannelDefinition) {\n super({\n path: INDEX_FILE,\n exportName: strings.typeName(channelName),\n })\n\n this._messagesModule = new MessagesModule(_channel)\n this._messagesModule.unshift('messages')\n this.pushDep(this._messagesModule)\n }\n\n public async getContent() {\n const messageImport = this._messagesModule.import(this)\n\n const conversation = {\n tags: this._channel.conversation?.tags ?? {},\n creation: this._channel.conversation?.creation ?? { enabled: false, requiredTags: [] },\n }\n\n const message = {\n tags: this._channel.message?.tags ?? {},\n }\n\n return [\n GENERATED_HEADER,\n `import { ${this._messagesModule.exportName} } from './${messageImport}'`,\n `export * from './${messageImport}'`,\n '',\n `export type ${this.exportName} = {`,\n ` messages: ${this._messagesModule.exportName}`,\n ` message: ${stringifySingleLine(message)}`,\n ` conversation: ${stringifySingleLine(conversation)}`,\n '}',\n ].join('\\n')\n }\n}\n\nexport class ChannelsModule extends ReExportTypeModule {\n public constructor(channels: Record<string, sdk.ChannelDefinition>) {\n super({ exportName: strings.typeName('channels') })\n for (const [channelName, channel] of Object.entries(channels)) {\n const module = new ChannelModule(channelName, channel)\n module.unshift(channelName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA6C;AAC7C,wBAA+D;AAC/D,oBAA2C;AAC3C,cAAyB;AAEzB,MAAM,sBAAsB,qBAAO;AAAA,EAC1B,YAAY,MAAsB,UAAiC;AACxE,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,MACT,YAAY,QAAQ,SAAS,IAAI;AAAA,IACnC,CAAC;AAJsC;AAAA,EAKzC;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,SAAS,QAAQ,KAAK,UAAU;AAAA,EACxE;AACF;AAEA,MAAM,uBAAuB,iCAAmB;AAAA,EACvC,YAAY,SAAgC;AACjD,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAClD,eAAW,CAAC,aAAa,OAAO,KAAK,OAAO,QAAQ,QAAQ,YAAY,CAAC,CAAC,GAAG;AAC3E,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;AAEA,MAAM,sBAAsB,qBAAO;AAAA,EAG1B,YAAY,aAA6B,UAAiC;AAC/E,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,YAAY,QAAQ,SAAS,WAAW;AAAA,IAC1C,CAAC;AAJ6C;AAM9C,SAAK,kBAAkB,IAAI,eAAe,QAAQ;AAClD,SAAK,gBAAgB,QAAQ,UAAU;AACvC,SAAK,QAAQ,KAAK,eAAe;AAAA,EACnC;AAAA,EAXQ;AAAA,EAaR,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,gBAAgB,OAAO,IAAI;AAEtD,UAAM,eAAe;AAAA,MACnB,MAAM,KAAK,SAAS,cAAc,QAAQ,CAAC;AAAA,MAC3C,UAAU,KAAK,SAAS,cAAc,YAAY,EAAE,SAAS,OAAO,cAAc,CAAC,EAAE;AAAA,IACvF;AAEA,UAAM,UAAU;AAAA,MACd,MAAM,KAAK,SAAS,SAAS,QAAQ,CAAC;AAAA,IACxC;AAEA,WAAO;AAAA,MACL;AAAA,MACA,YAAY,KAAK,gBAAgB,wBAAwB;AAAA,MACzD,oBAAoB;AAAA,MACpB;AAAA,MACA,eAAe,KAAK;AAAA,MACpB,eAAe,KAAK,gBAAgB;AAAA,MACpC,kBAAc,uCAAoB,OAAO;AAAA,MACzC,uBAAmB,uCAAoB,YAAY;AAAA,MACnD;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAEO,MAAM,uBAAuB,iCAAmB;AAAA,EAC9C,YAAY,UAAiD;AAClE,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAClD,eAAW,CAAC,aAAa,OAAO,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC7D,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,MAAAA,QAAO,QAAQ,WAAW;AAC1B,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
|
@@ -27,30 +27,28 @@ __export(configuration_module_exports, {
|
|
|
27
27
|
DefaultConfigurationModule: () => DefaultConfigurationModule
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(configuration_module_exports);
|
|
30
|
-
var
|
|
31
|
-
var import_generators = require("
|
|
32
|
-
var import_module = require("
|
|
33
|
-
var strings = __toESM(require("
|
|
30
|
+
var import_consts = require("../../consts");
|
|
31
|
+
var import_generators = require("../../generators");
|
|
32
|
+
var import_module = require("../../module");
|
|
33
|
+
var strings = __toESM(require("../../strings"));
|
|
34
34
|
class DefaultConfigurationModule extends import_module.Module {
|
|
35
|
-
|
|
36
|
-
const { schema } = configuration;
|
|
37
|
-
if (!schema) {
|
|
38
|
-
return new DefaultConfigurationModule({
|
|
39
|
-
path: import_const.INDEX_FILE,
|
|
40
|
-
exportName: "Configuration",
|
|
41
|
-
content: [
|
|
42
|
-
"/** Default Configuration of the Integration */",
|
|
43
|
-
"export type Configuration = Record<string, never>;"
|
|
44
|
-
].join("\n")
|
|
45
|
-
});
|
|
46
|
-
}
|
|
35
|
+
constructor(_configuration) {
|
|
47
36
|
const name = "configuration";
|
|
48
37
|
const exportName = strings.typeName(name);
|
|
49
|
-
|
|
50
|
-
path:
|
|
51
|
-
exportName
|
|
52
|
-
content: await (0, import_generators.jsonSchemaToTypeScriptType)(schema, exportName)
|
|
38
|
+
super({
|
|
39
|
+
path: import_consts.INDEX_FILE,
|
|
40
|
+
exportName
|
|
53
41
|
});
|
|
42
|
+
this._configuration = _configuration;
|
|
43
|
+
}
|
|
44
|
+
async getContent() {
|
|
45
|
+
if (!this._configuration) {
|
|
46
|
+
return [
|
|
47
|
+
"/** Default Configuration of the Integration */",
|
|
48
|
+
"export type Configuration = Record<string, never>;"
|
|
49
|
+
].join("\n");
|
|
50
|
+
}
|
|
51
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._configuration.schema, this.exportName);
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/configuration-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { INDEX_FILE } from '../../consts'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module } from '../../module'\nimport * as strings from '../../strings'\n\nexport class DefaultConfigurationModule extends Module {\n public constructor(private _configuration: sdk.ConfigurationDefinition | undefined) {\n const name = 'configuration'\n const exportName = strings.typeName(name)\n super({\n path: INDEX_FILE,\n exportName,\n })\n }\n\n public async getContent() {\n if (!this._configuration) {\n return [\n '/** Default Configuration of the Integration */',\n 'export type Configuration = Record<string, never>;',\n ].join('\\n')\n }\n return zuiSchemaToTypeScriptType(this._configuration.schema, this.exportName)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA2B;AAC3B,wBAA0C;AAC1C,oBAAuB;AACvB,cAAyB;AAElB,MAAM,mCAAmC,qBAAO;AAAA,EAC9C,YAAoB,gBAAyD;AAClF,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,SAAS,IAAI;AACxC,UAAM;AAAA,MACJ,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AANwB;AAAA,EAO3B;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,CAAC,KAAK,gBAAgB;AACxB,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF,EAAE,KAAK,IAAI;AAAA,IACb;AACA,eAAO,6CAA0B,KAAK,eAAe,QAAQ,KAAK,UAAU;AAAA,EAC9E;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -28,40 +28,34 @@ __export(configurations_module_exports, {
|
|
|
28
28
|
ConfigurationsModule: () => ConfigurationsModule
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(configurations_module_exports);
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var strings = __toESM(require("../strings"));
|
|
31
|
+
var import_generators = require("../../generators");
|
|
32
|
+
var import_module = require("../../module");
|
|
33
|
+
var strings = __toESM(require("../../strings"));
|
|
35
34
|
class ConfigurationModule extends import_module.Module {
|
|
36
|
-
|
|
35
|
+
constructor(name, _configuration) {
|
|
37
36
|
const configurationName = name;
|
|
38
|
-
const schema = configuration.schema;
|
|
39
37
|
const exportName = strings.typeName(`${configurationName}Config`);
|
|
40
|
-
|
|
41
|
-
if (schema) {
|
|
42
|
-
content = await (0, import_generators.jsonSchemaToTypeScriptType)(schema, exportName);
|
|
43
|
-
} else {
|
|
44
|
-
content = `export type ${exportName} = Record<string, never>;`;
|
|
45
|
-
}
|
|
46
|
-
const def = {
|
|
38
|
+
super({
|
|
47
39
|
path: `${name}.ts`,
|
|
48
|
-
exportName
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
exportName
|
|
41
|
+
});
|
|
42
|
+
this._configuration = _configuration;
|
|
43
|
+
}
|
|
44
|
+
async getContent() {
|
|
45
|
+
const { schema } = this._configuration;
|
|
46
|
+
if (!schema) {
|
|
47
|
+
return `export type ${this.exportName} = Record<string, never>;`;
|
|
48
|
+
}
|
|
49
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(schema, this.exportName);
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
class ConfigurationsModule extends import_module.ReExportTypeModule {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
exportName: strings.typeName("configurations")
|
|
62
|
-
});
|
|
63
|
-
inst.pushDep(...configurationModules);
|
|
64
|
-
return inst;
|
|
53
|
+
constructor(configurations) {
|
|
54
|
+
super({ exportName: strings.typeName("configurations") });
|
|
55
|
+
for (const [configurationName, configuration] of Object.entries(configurations)) {
|
|
56
|
+
const module2 = new ConfigurationModule(configurationName, configuration);
|
|
57
|
+
this.pushDep(module2);
|
|
58
|
+
}
|
|
65
59
|
}
|
|
66
60
|
}
|
|
67
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/configurations-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nexport class ConfigurationModule extends Module {\n public constructor(name: string, private _configuration: sdk.ConfigurationDefinition) {\n const configurationName = name\n const exportName = strings.typeName(`${configurationName}Config`)\n super({\n path: `${name}.ts`,\n exportName,\n })\n }\n\n public async getContent() {\n const { schema } = this._configuration\n if (!schema) {\n return `export type ${this.exportName} = Record<string, never>;`\n }\n return zuiSchemaToTypeScriptType(schema, this.exportName)\n }\n}\n\nexport class ConfigurationsModule extends ReExportTypeModule {\n public constructor(configurations: Record<string, sdk.ConfigurationDefinition>) {\n super({ exportName: strings.typeName('configurations') })\n for (const [configurationName, configuration] of Object.entries(configurations)) {\n const module = new ConfigurationModule(configurationName, configuration)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAElB,MAAM,4BAA4B,qBAAO;AAAA,EACvC,YAAY,MAAsB,gBAA6C;AACpF,UAAM,oBAAoB;AAC1B,UAAM,aAAa,QAAQ,SAAS,GAAG,yBAAyB;AAChE,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,MACT;AAAA,IACF,CAAC;AANsC;AAAA,EAOzC;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,EAAE,OAAO,IAAI,KAAK;AACxB,QAAI,CAAC,QAAQ;AACX,aAAO,eAAe,KAAK;AAAA,IAC7B;AACA,eAAO,6CAA0B,QAAQ,KAAK,UAAU;AAAA,EAC1D;AACF;AAEO,MAAM,6BAA6B,iCAAmB;AAAA,EACpD,YAAY,gBAA6D;AAC9E,UAAM,EAAE,YAAY,QAAQ,SAAS,gBAAgB,EAAE,CAAC;AACxD,eAAW,CAAC,mBAAmB,aAAa,KAAK,OAAO,QAAQ,cAAc,GAAG;AAC/E,YAAMA,UAAS,IAAI,oBAAoB,mBAAmB,aAAa;AACvE,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
|
@@ -28,34 +28,27 @@ __export(entities_module_exports, {
|
|
|
28
28
|
EntityModule: () => EntityModule
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(entities_module_exports);
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var strings = __toESM(require("../strings"));
|
|
31
|
+
var import_generators = require("../../generators");
|
|
32
|
+
var import_module = require("../../module");
|
|
33
|
+
var strings = __toESM(require("../../strings"));
|
|
35
34
|
class EntityModule extends import_module.Module {
|
|
36
|
-
|
|
35
|
+
constructor(name, _entity) {
|
|
37
36
|
const entityName = name;
|
|
38
|
-
const schema = entity.schema;
|
|
39
37
|
const exportName = strings.typeName(entityName);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return new EntityModule(def);
|
|
38
|
+
super({ path: `${name}.ts`, exportName });
|
|
39
|
+
this._entity = _entity;
|
|
40
|
+
}
|
|
41
|
+
async getContent() {
|
|
42
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._entity.schema, this.exportName);
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
45
|
class EntitiesModule extends import_module.ReExportTypeModule {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exportName: strings.typeName("entities")
|
|
56
|
-
});
|
|
57
|
-
inst.pushDep(...entityModules);
|
|
58
|
-
return inst;
|
|
46
|
+
constructor(entities) {
|
|
47
|
+
super({ exportName: strings.typeName("entities") });
|
|
48
|
+
for (const [entityName, entity] of Object.entries(entities)) {
|
|
49
|
+
const module2 = new EntityModule(entityName, entity);
|
|
50
|
+
this.pushDep(module2);
|
|
51
|
+
}
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/entities-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nexport class EntityModule extends Module {\n public constructor(name: string, private _entity: sdk.EntityDefinition) {\n const entityName = name\n const exportName = strings.typeName(entityName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._entity.schema, this.exportName)\n }\n}\n\nexport class EntitiesModule extends ReExportTypeModule {\n public constructor(entities: Record<string, sdk.EntityDefinition>) {\n super({ exportName: strings.typeName('entities') })\n\n for (const [entityName, entity] of Object.entries(entities)) {\n const module = new EntityModule(entityName, entity)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAElB,MAAM,qBAAqB,qBAAO;AAAA,EAChC,YAAY,MAAsB,SAA+B;AACtE,UAAM,aAAa;AACnB,UAAM,aAAa,QAAQ,SAAS,UAAU;AAC9C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHD;AAAA,EAIzC;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,QAAQ,QAAQ,KAAK,UAAU;AAAA,EACvE;AACF;AAEO,MAAM,uBAAuB,iCAAmB;AAAA,EAC9C,YAAY,UAAgD;AACjE,UAAM,EAAE,YAAY,QAAQ,SAAS,UAAU,EAAE,CAAC;AAElD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC3D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var events_module_exports = {};
|
|
26
|
+
__export(events_module_exports, {
|
|
27
|
+
EventModule: () => EventModule,
|
|
28
|
+
EventsModule: () => EventsModule
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(events_module_exports);
|
|
31
|
+
var import_generators = require("../../generators");
|
|
32
|
+
var import_module = require("../../module");
|
|
33
|
+
var strings = __toESM(require("../../strings"));
|
|
34
|
+
class EventModule extends import_module.Module {
|
|
35
|
+
constructor(name, _event) {
|
|
36
|
+
const eventName = name;
|
|
37
|
+
const exportName = strings.typeName(eventName);
|
|
38
|
+
super({ path: `${name}.ts`, exportName });
|
|
39
|
+
this._event = _event;
|
|
40
|
+
}
|
|
41
|
+
async getContent() {
|
|
42
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._event.schema, this.exportName);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
class EventsModule extends import_module.ReExportTypeModule {
|
|
46
|
+
constructor(events) {
|
|
47
|
+
super({ exportName: strings.typeName("events") });
|
|
48
|
+
for (const [eventName, event] of Object.entries(events)) {
|
|
49
|
+
const module2 = new EventModule(eventName, event);
|
|
50
|
+
this.pushDep(module2);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
EventModule,
|
|
57
|
+
EventsModule
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=events-module.js.map
|
package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/integration-implementation/integration-typings/events-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nexport class EventModule extends Module {\n public constructor(name: string, private _event: sdk.EventDefinition) {\n const eventName = name\n const exportName = strings.typeName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._event.schema, this.exportName)\n }\n}\n\nexport class EventsModule extends ReExportTypeModule {\n public constructor(events: Record<string, sdk.EventDefinition>) {\n super({ exportName: strings.typeName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAElB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YAAY,MAAsB,QAA6B;AACpE,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,SAAS,SAAS;AAC7C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHD;AAAA,EAIzC;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EACtE;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EAC5C,YAAY,QAA6C;AAC9D,UAAM,EAAE,YAAY,QAAQ,SAAS,QAAQ,EAAE,CAAC;AAChD,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|