@botpress/cli 3.4.0 ā 3.5.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 +10 -10
- package/dist/code-generation/bot-implementation/bot-plugins/index.js +3 -3
- package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +4 -4
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-typings/index.js +11 -2
- package/dist/code-generation/bot-implementation/bot-typings/index.js.map +2 -2
- package/dist/code-generation/bot-implementation/bot-typings/workflows-module.js +104 -0
- package/dist/code-generation/bot-implementation/bot-typings/workflows-module.js.map +7 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js +24 -11
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +2 -2
- package/dist/code-generation/plugin-implementation/plugin-typings/workflows-module.js +104 -0
- package/dist/code-generation/plugin-implementation/plugin-typings/workflows-module.js.map +7 -0
- package/dist/code-generation/typings.js.map +1 -1
- package/dist/command-implementations/deploy-command.js +1 -2
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/sdk/validate-bot.js +5 -1
- package/dist/sdk/validate-bot.js.map +2 -2
- package/dist/sdk/validate-bot.test.js +131 -0
- package/dist/sdk/validate-bot.test.js.map +7 -0
- package/package.json +3 -3
- package/templates/empty-bot/.botpress/implementation/typings/index.ts +3 -0
- package/templates/empty-bot/.botpress/implementation/typings/workflows/index.ts +6 -0
- package/templates/empty-bot/package.json +2 -2
- package/templates/empty-integration/package.json +2 -2
- package/templates/empty-plugin/.botpress/implementation/typings/index.ts +5 -0
- package/templates/empty-plugin/.botpress/implementation/typings/workflows/index.ts +6 -0
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/package.json +2 -2
- package/templates/webhook-message/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@3.
|
|
2
|
+
> @botpress/cli@3.5.0 build /home/runner/work/botpress/botpress/packages/cli
|
|
3
3
|
> pnpm run bundle && pnpm run template:gen
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/cli@3.
|
|
6
|
+
> @botpress/cli@3.5.0 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> ts-node -T build.ts
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@3.
|
|
10
|
+
> @botpress/cli@3.5.0 template:gen /home/runner/work/botpress/botpress/packages/cli
|
|
11
11
|
> pnpm -r --stream -F @bp-templates/* exec bp gen
|
|
12
12
|
|
|
13
|
-
š¤ Botpress CLI v3.
|
|
14
|
-
š¤ Botpress CLI v3.
|
|
15
|
-
š¤ Botpress CLI v3.
|
|
16
|
-
š¤ Botpress CLI v3.
|
|
13
|
+
š¤ Botpress CLI v3.5.0
|
|
14
|
+
š¤ Botpress CLI v3.5.0
|
|
15
|
+
š¤ Botpress CLI v3.5.0
|
|
16
|
+
š¤ Botpress CLI v3.5.0
|
|
17
17
|
[2K[1Gā Generating typings for bot...[2K[1Gā Typings available at .botpress
|
|
18
|
-
[2K[1Gā Generating typings for integration hello-world...[2K[1Gā Typings available at .botpress
|
|
19
|
-
[2K[1G
|
|
18
|
+
[2K[1Gā Generating typings for integration hello-world...[2K[1Gā Generating typings for plugin empty-plugin...[2K[1Gā Typings available at .botpress
|
|
19
|
+
[2K[1Gā Typings available at .botpress
|
|
20
20
|
[2K[1Gā Generating typings for integration empty-integration...[2K[1Gā Typings available at .botpress
|
|
21
|
-
š¤ Botpress CLI v3.
|
|
21
|
+
š¤ Botpress CLI v3.5.0
|
|
22
22
|
[2K[1Gā Generating typings for integration webhook-message...[2K[1Gā Typings available at .botpress
|
|
@@ -45,7 +45,7 @@ class BotPluginsIndexModule extends mod.Module {
|
|
|
45
45
|
const pluginsModules = [];
|
|
46
46
|
for (const plugin of Object.values(sdkBotDefinition.plugins ?? {})) {
|
|
47
47
|
const pluginModule = new import_plugin_module.BotPluginModule(plugin);
|
|
48
|
-
pluginModule.unshift(
|
|
48
|
+
pluginModule.unshift(pluginModule.pluginKey);
|
|
49
49
|
this.pushDep(pluginModule);
|
|
50
50
|
pluginsModules.push(pluginModule);
|
|
51
51
|
}
|
|
@@ -64,11 +64,11 @@ class BotPluginsIndexModule extends mod.Module {
|
|
|
64
64
|
...modules.map(({ importAlias, importFrom }) => `export * as ${importAlias} from "./${importFrom}";`),
|
|
65
65
|
"",
|
|
66
66
|
`export const ${this.exportName} = {`,
|
|
67
|
-
...modules.map(({ module: module2, importAlias }) => ` "${module2.
|
|
67
|
+
...modules.map(({ module: module2, importAlias }) => ` "${module2.pluginKey}": ${importAlias}.${module2.exportName},`),
|
|
68
68
|
"}",
|
|
69
69
|
"",
|
|
70
70
|
"export type TPlugins = {",
|
|
71
|
-
...modules.map(({ module: module2, importAlias }) => ` "${module2.
|
|
71
|
+
...modules.map(({ module: module2, importAlias }) => ` "${module2.pluginKey}": ${importAlias}.TPlugin;`),
|
|
72
72
|
"}"
|
|
73
73
|
].join("\n");
|
|
74
74
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/bot-implementation/bot-plugins/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport * as mod from '../../module'\nimport * as strings from '../../strings'\nimport { BotPluginModule } from './plugin-module'\n\nexport class BotPluginsIndexModule extends mod.Module {\n private _pluginModules: BotPluginModule[]\n\n public constructor(sdkBotDefinition: sdk.BotDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: 'plugins',\n })\n\n const pluginsModules: BotPluginModule[] = []\n for (const plugin of Object.values(sdkBotDefinition.plugins ?? {})) {\n const pluginModule = new BotPluginModule(plugin)\n pluginModule.unshift(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,UAAqB;AACrB,cAAyB;AACzB,2BAAgC;AAEzB,MAAM,8BAA8B,IAAI,OAAO;AAAA,EAC5C;AAAA,EAED,YAAY,kBAAqC;AACtD,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAED,UAAM,iBAAoC,CAAC;AAC3C,eAAW,UAAU,OAAO,OAAO,iBAAiB,WAAW,CAAC,CAAC,GAAG;AAClE,YAAM,eAAe,IAAI,qCAAgB,MAAM;AAC/C,mBAAa,QAAQ,
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport * as mod from '../../module'\nimport * as strings from '../../strings'\nimport { BotPluginModule } from './plugin-module'\n\nexport class BotPluginsIndexModule extends mod.Module {\n private _pluginModules: BotPluginModule[]\n\n public constructor(sdkBotDefinition: sdk.BotDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: 'plugins',\n })\n\n const pluginsModules: BotPluginModule[] = []\n for (const plugin of Object.values(sdkBotDefinition.plugins ?? {})) {\n const pluginModule = new BotPluginModule(plugin)\n pluginModule.unshift(pluginModule.pluginKey)\n this.pushDep(pluginModule)\n pluginsModules.push(pluginModule)\n }\n\n this._pluginModules = pluginsModules\n }\n\n public async getContent(): Promise<string> {\n const modules = this._pluginModules.map((module) => ({\n importAlias: strings.importAlias(module.name),\n importFrom: module.import(this),\n module,\n }))\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n ...modules.map(({ importAlias, importFrom }) => `import * as ${importAlias} from \"./${importFrom}\";`),\n ...modules.map(({ importAlias, importFrom }) => `export * as ${importAlias} from \"./${importFrom}\";`),\n '',\n `export const ${this.exportName} = {`,\n ...modules.map(({ module, importAlias }) => ` \"${module.pluginKey}\": ${importAlias}.${module.exportName},`),\n '}',\n '',\n 'export type TPlugins = {',\n ...modules.map(({ module, importAlias }) => ` \"${module.pluginKey}\": ${importAlias}.TPlugin;`),\n '}',\n ].join('\\n')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,UAAqB;AACrB,cAAyB;AACzB,2BAAgC;AAEzB,MAAM,8BAA8B,IAAI,OAAO;AAAA,EAC5C;AAAA,EAED,YAAY,kBAAqC;AACtD,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAED,UAAM,iBAAoC,CAAC;AAC3C,eAAW,UAAU,OAAO,OAAO,iBAAiB,WAAW,CAAC,CAAC,GAAG;AAClE,YAAM,eAAe,IAAI,qCAAgB,MAAM;AAC/C,mBAAa,QAAQ,aAAa,SAAS;AAC3C,WAAK,QAAQ,YAAY;AACzB,qBAAe,KAAK,YAAY;AAAA,IAClC;AAEA,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEA,MAAa,aAA8B;AACzC,UAAM,UAAU,KAAK,eAAe,IAAI,CAACA,aAAY;AAAA,MACnD,aAAa,QAAQ,YAAYA,QAAO,IAAI;AAAA,MAC5C,YAAYA,QAAO,OAAO,IAAI;AAAA,MAC9B,QAAAA;AAAA,IACF,EAAE;AAEF,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,GAAG,QAAQ,IAAI,CAAC,EAAE,aAAa,WAAW,MAAM,eAAe,uBAAuB,cAAc;AAAA,MACpG,GAAG,QAAQ,IAAI,CAAC,EAAE,aAAa,WAAW,MAAM,eAAe,uBAAuB,cAAc;AAAA,MACpG;AAAA,MACA,gBAAgB,KAAK;AAAA,MACrB,GAAG,QAAQ,IAAI,CAAC,EAAE,QAAAA,SAAQ,YAAY,MAAM,MAAMA,QAAO,eAAe,eAAeA,QAAO,aAAa;AAAA,MAC3G;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG,QAAQ,IAAI,CAAC,EAAE,QAAAA,SAAQ,YAAY,MAAM,MAAMA,QAAO,eAAe,sBAAsB;AAAA,MAC9F;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
|
|
6
6
|
"names": ["module"]
|
|
7
7
|
}
|
|
@@ -74,8 +74,8 @@ class PluginConfigModule extends import_module.Module {
|
|
|
74
74
|
this._plugin = config.plugin;
|
|
75
75
|
}
|
|
76
76
|
async getContent() {
|
|
77
|
-
const { interfaces, configuration } = this._plugin;
|
|
78
|
-
const content = JSON.stringify({ interfaces, configuration }, null, 2);
|
|
77
|
+
const { interfaces, configuration, alias } = this._plugin;
|
|
78
|
+
const content = JSON.stringify({ alias, interfaces, configuration }, null, 2);
|
|
79
79
|
return `export default ${content}`;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -84,13 +84,13 @@ class BotPluginModule extends import_module.Module {
|
|
|
84
84
|
_bundleJsModule;
|
|
85
85
|
_bundleDtsModule;
|
|
86
86
|
_configModule;
|
|
87
|
-
|
|
87
|
+
pluginKey;
|
|
88
88
|
constructor(plugin) {
|
|
89
89
|
super({
|
|
90
90
|
exportName: "default",
|
|
91
91
|
path: consts.INDEX_FILE
|
|
92
92
|
});
|
|
93
|
-
this.
|
|
93
|
+
this.pluginKey = plugin.alias ?? plugin.name;
|
|
94
94
|
this._typingsModule = new import_plugin_typings.PluginTypingsModule(plugin.definition);
|
|
95
95
|
this._typingsModule.unshift("typings");
|
|
96
96
|
this.pushDep(this._typingsModule);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/bot-implementation/bot-plugins/plugin-module.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport { Module, ModuleProps } from '../../module'\nimport { PluginTypingsModule } from '../../plugin-implementation/plugin-typings'\n\ntype PluginInstance = NonNullable<sdk.BotDefinition['plugins']>[string]\n\nclass BundleJsModule extends Module {\n private _indexJs: string\n public constructor(plugin: PluginInstance) {\n super({\n path: 'bundle.js',\n exportName: 'default',\n })\n this._indexJs = plugin.implementation.toString()\n }\n\n public async getContent() {\n return this._indexJs\n }\n}\n\nclass BundleDtsModule extends Module {\n public constructor(private _typingsModule: PluginTypingsModule) {\n super({\n path: 'bundle.d.ts',\n exportName: 'default',\n })\n }\n\n public async getContent() {\n const typingsImport = this._typingsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `type TPlugin = sdk.DefaultPlugin<${this._typingsModule.name}.${this._typingsModule.exportName}>`,\n 'export default new sdk.Plugin<TPlugin>({})',\n '',\n ].join('\\n')\n }\n}\n\nclass PluginConfigModule extends Module {\n private _plugin: PluginInstance\n public constructor(config: ModuleProps & { plugin: PluginInstance }) {\n super(config)\n this._plugin = config.plugin\n }\n\n public async getContent() {\n const { interfaces, configuration } = this._plugin\n const content = JSON.stringify({ interfaces, configuration }, null, 2)\n return `export default ${content}`\n }\n}\n\nexport class BotPluginModule extends Module {\n private _typingsModule: PluginTypingsModule\n private _bundleJsModule: BundleJsModule\n private _bundleDtsModule: BundleDtsModule\n private _configModule: PluginConfigModule\n\n public readonly
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAoC;AACpC,4BAAoC;AAIpC,MAAM,uBAAuB,qBAAO;AAAA,EAC1B;AAAA,EACD,YAAY,QAAwB;AACzC,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,YAAY;AAAA,IACd,CAAC;AACD,SAAK,WAAW,OAAO,eAAe,SAAS;AAAA,EACjD;AAAA,EAEA,MAAa,aAAa;AACxB,WAAO,KAAK;AAAA,EACd;AACF;AAEA,MAAM,wBAAwB,qBAAO;AAAA,EAC5B,YAAoB,gBAAqC;AAC9D,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,YAAY;AAAA,IACd,CAAC;AAJwB;AAAA,EAK3B;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AAErD,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,eAAe,KAAK,eAAe,gBAAgB;AAAA,MACnD,oCAAoC,KAAK,eAAe,QAAQ,KAAK,eAAe;AAAA,MACpF;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAEA,MAAM,2BAA2B,qBAAO;AAAA,EAC9B;AAAA,EACD,YAAY,QAAkD;AACnE,UAAM,MAAM;AACZ,SAAK,UAAU,OAAO;AAAA,EACxB;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,EAAE,YAAY,
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport { Module, ModuleProps } from '../../module'\nimport { PluginTypingsModule } from '../../plugin-implementation/plugin-typings'\n\ntype PluginInstance = NonNullable<sdk.BotDefinition['plugins']>[string]\n\nclass BundleJsModule extends Module {\n private _indexJs: string\n public constructor(plugin: PluginInstance) {\n super({\n path: 'bundle.js',\n exportName: 'default',\n })\n this._indexJs = plugin.implementation.toString()\n }\n\n public async getContent() {\n return this._indexJs\n }\n}\n\nclass BundleDtsModule extends Module {\n public constructor(private _typingsModule: PluginTypingsModule) {\n super({\n path: 'bundle.d.ts',\n exportName: 'default',\n })\n }\n\n public async getContent() {\n const typingsImport = this._typingsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `type TPlugin = sdk.DefaultPlugin<${this._typingsModule.name}.${this._typingsModule.exportName}>`,\n 'export default new sdk.Plugin<TPlugin>({})',\n '',\n ].join('\\n')\n }\n}\n\nclass PluginConfigModule extends Module {\n private _plugin: PluginInstance\n public constructor(config: ModuleProps & { plugin: PluginInstance }) {\n super(config)\n this._plugin = config.plugin\n }\n\n public async getContent() {\n const { interfaces, configuration, alias } = this._plugin\n const content = JSON.stringify({ alias, interfaces, configuration }, null, 2)\n return `export default ${content}`\n }\n}\n\nexport class BotPluginModule extends Module {\n private _typingsModule: PluginTypingsModule\n private _bundleJsModule: BundleJsModule\n private _bundleDtsModule: BundleDtsModule\n private _configModule: PluginConfigModule\n\n public readonly pluginKey: string\n\n public constructor(plugin: PluginInstance) {\n super({\n exportName: 'default',\n path: consts.INDEX_FILE,\n })\n\n this.pluginKey = plugin.alias ?? plugin.name\n\n this._typingsModule = new PluginTypingsModule(plugin.definition)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n\n this._bundleJsModule = new BundleJsModule(plugin)\n this.pushDep(this._bundleJsModule)\n\n this._bundleDtsModule = new BundleDtsModule(this._typingsModule)\n this.pushDep(this._bundleDtsModule)\n\n this._configModule = new PluginConfigModule({\n path: 'config.ts',\n exportName: 'default',\n plugin,\n })\n this.pushDep(this._configModule)\n }\n\n public async getContent() {\n const configImport = this._configModule.import(this)\n const typingsImport = this._typingsModule.import(this)\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n 'import bundle from \"./bundle\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `import * as ${this._configModule.name} from \"./${configImport}\"`,\n '',\n `export type TPlugin = sdk.DefaultPlugin<${this._typingsModule.name}.${this._typingsModule.exportName}>`,\n '',\n `export const configuration = ${this._configModule.name}.${this._configModule.exportName}.configuration`,\n `export const interfaces = ${this._configModule.name}.${this._configModule.exportName}.interfaces`,\n '',\n `export default bundle.initialize(${this._configModule.name}.${this._configModule.exportName})`,\n '',\n ].join('\\n')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oB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D,SAAK,eAAe,QAAQ,SAAS;AACrC,SAAK,QAAQ,KAAK,cAAc;AAEhC,SAAK,kBAAkB,IAAI,eAAe,MAAM;AAChD,SAAK,QAAQ,KAAK,eAAe;AAEjC,SAAK,mBAAmB,IAAI,gBAAgB,KAAK,cAAc;AAC/D,SAAK,QAAQ,KAAK,gBAAgB;AAElC,SAAK,gBAAgB,IAAI,mBAAmB;AAAA,MAC1C,MAAM;AAAA,MACN,YAAY;AAAA,MACZ;AAAA,IACF,CAAC;AACD,SAAK,QAAQ,KAAK,aAAa;AAAA,EACjC;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,eAAe,KAAK,cAAc,OAAO,IAAI;AACnD,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AACrD,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,eAAe,KAAK,eAAe,gBAAgB;AAAA,MACnD,eAAe,KAAK,cAAc,gBAAgB;AAAA,MAClD;AAAA,MACA,2CAA2C,KAAK,eAAe,QAAQ,KAAK,eAAe;AAAA,MAC3F;AAAA,MACA,gCAAgC,KAAK,cAAc,QAAQ,KAAK,cAAc;AAAA,MAC9E,6BAA6B,KAAK,cAAc,QAAQ,KAAK,cAAc;AAAA,MAC3E;AAAA,MACA,oCAAoC,KAAK,cAAc,QAAQ,KAAK,cAAc;AAAA,MAClF;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,6 +38,7 @@ var import_actions_module = require("./actions-module");
|
|
|
38
38
|
var import_events_module = require("./events-module");
|
|
39
39
|
var import_states_module = require("./states-module");
|
|
40
40
|
var import_tables_module = require("./tables-module");
|
|
41
|
+
var import_workflows_module = require("./workflows-module");
|
|
41
42
|
class BotIntegrationsModule extends import_module.ReExportTypeModule {
|
|
42
43
|
constructor(bot) {
|
|
43
44
|
super({
|
|
@@ -72,21 +73,26 @@ class BotTypingsModule extends import_module.Module {
|
|
|
72
73
|
const actionsModule = new import_actions_module.ActionsModule(bot.actions ?? {});
|
|
73
74
|
actionsModule.unshift("actions");
|
|
74
75
|
this.pushDep(actionsModule);
|
|
76
|
+
const workflowsModule = new import_workflows_module.WorkflowsModule(bot.workflows ?? {});
|
|
77
|
+
workflowsModule.unshift("workflows");
|
|
78
|
+
this.pushDep(workflowsModule);
|
|
75
79
|
this._dependencies = {
|
|
76
80
|
integrationsModule,
|
|
77
81
|
eventsModule,
|
|
78
82
|
statesModule,
|
|
79
83
|
actionsModule,
|
|
80
|
-
tablesModule
|
|
84
|
+
tablesModule,
|
|
85
|
+
workflowsModule
|
|
81
86
|
};
|
|
82
87
|
}
|
|
83
88
|
async getContent() {
|
|
84
|
-
const { integrationsModule, eventsModule, statesModule, actionsModule, tablesModule } = this._dependencies;
|
|
89
|
+
const { integrationsModule, eventsModule, statesModule, actionsModule, tablesModule, workflowsModule } = this._dependencies;
|
|
85
90
|
const integrationsImport = integrationsModule.import(this);
|
|
86
91
|
const eventsImport = eventsModule.import(this);
|
|
87
92
|
const statesImport = statesModule.import(this);
|
|
88
93
|
const actionsImport = actionsModule;
|
|
89
94
|
const tablesImport = tablesModule.import(this);
|
|
95
|
+
const workflowsImport = workflowsModule;
|
|
90
96
|
return [
|
|
91
97
|
consts.GENERATED_HEADER,
|
|
92
98
|
`import * as ${integrationsModule.name} from './${integrationsImport}'`,
|
|
@@ -94,12 +100,14 @@ class BotTypingsModule extends import_module.Module {
|
|
|
94
100
|
`import * as ${statesModule.name} from './${statesModule.name}'`,
|
|
95
101
|
`import * as ${actionsModule.name} from './${actionsImport.name}'`,
|
|
96
102
|
`import * as ${tablesModule.name} from './${tablesImport}'`,
|
|
103
|
+
`import * as ${workflowsModule.name} from './${workflowsImport.name}'`,
|
|
97
104
|
"",
|
|
98
105
|
`export * as ${integrationsModule.name} from './${integrationsImport}'`,
|
|
99
106
|
`export * as ${eventsModule.name} from './${eventsImport}'`,
|
|
100
107
|
`export * as ${statesModule.name} from './${statesImport}'`,
|
|
101
108
|
`export * as ${actionsModule.name} from './${actionsImport.name}'`,
|
|
102
109
|
`export * as ${tablesModule.name} from './${tablesImport}'`,
|
|
110
|
+
`export * as ${workflowsModule.name} from './${workflowsImport.name}'`,
|
|
103
111
|
"",
|
|
104
112
|
"export type TBot = {",
|
|
105
113
|
` integrations: ${integrationsModule.name}.${integrationsModule.exportName}`,
|
|
@@ -107,6 +115,7 @@ class BotTypingsModule extends import_module.Module {
|
|
|
107
115
|
` states: ${statesModule.name}.${statesModule.exportName}`,
|
|
108
116
|
` actions: ${actionsModule.name}.${actionsModule.exportName}`,
|
|
109
117
|
` tables: ${tablesModule.name}.${tablesModule.exportName}`,
|
|
118
|
+
` workflows: ${workflowsModule.name}.${workflowsModule.exportName}`,
|
|
110
119
|
"}"
|
|
111
120
|
].join("\n");
|
|
112
121
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/bot-implementation/bot-typings/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport { IntegrationTypingsModule } from '../../integration-implementation/integration-typings'\nimport { Module, ReExportTypeModule } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { EventsModule } from './events-module'\nimport { StatesModule } from './states-module'\nimport { TablesModule } from './tables-module'\n\nclass BotIntegrationsModule extends ReExportTypeModule {\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'Integrations',\n })\n\n for (const [alias, integration] of Object.entries(bot.integrations ?? {})) {\n const integrationModule = new IntegrationTypingsModule(integration.definition)\n integrationModule.unshift(alias)\n this.pushDep(integrationModule)\n }\n }\n}\n\ntype BotTypingsIndexDependencies = {\n integrationsModule: BotIntegrationsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n actionsModule: ActionsModule\n tablesModule: TablesModule\n}\n\nexport class BotTypingsModule extends Module {\n private _dependencies: BotTypingsIndexDependencies\n\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'TBot',\n path: consts.INDEX_FILE,\n })\n\n const integrationsModule = new BotIntegrationsModule(bot)\n integrationsModule.unshift('integrations')\n this.pushDep(integrationsModule)\n\n const eventsModule = new EventsModule(bot.events ?? {})\n eventsModule.unshift('events')\n this.pushDep(eventsModule)\n\n const statesModule = new StatesModule(bot.states ?? {})\n statesModule.unshift('states')\n this.pushDep(statesModule)\n\n const tablesModule = new TablesModule(bot.tables ?? {})\n tablesModule.unshift('tables')\n this.pushDep(tablesModule)\n\n const actionsModule = new ActionsModule(bot.actions ?? {})\n actionsModule.unshift('actions')\n this.pushDep(actionsModule)\n\n this._dependencies = {\n integrationsModule,\n eventsModule,\n statesModule,\n actionsModule,\n tablesModule,\n }\n }\n\n public async getContent() {\n const { integrationsModule, eventsModule, statesModule, actionsModule, tablesModule }
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,iCAAyC;AACzC,oBAA2C;AAC3C,4BAA8B;AAC9B,2BAA6B;AAC7B,2BAA6B;AAC7B,2BAA6B;
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport { IntegrationTypingsModule } from '../../integration-implementation/integration-typings'\nimport { Module, ReExportTypeModule } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { EventsModule } from './events-module'\nimport { StatesModule } from './states-module'\nimport { TablesModule } from './tables-module'\nimport { WorkflowsModule } from './workflows-module'\n\nclass BotIntegrationsModule extends ReExportTypeModule {\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'Integrations',\n })\n\n for (const [alias, integration] of Object.entries(bot.integrations ?? {})) {\n const integrationModule = new IntegrationTypingsModule(integration.definition)\n integrationModule.unshift(alias)\n this.pushDep(integrationModule)\n }\n }\n}\n\ntype BotTypingsIndexDependencies = {\n integrationsModule: BotIntegrationsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n actionsModule: ActionsModule\n tablesModule: TablesModule\n workflowsModule: WorkflowsModule\n}\n\nexport class BotTypingsModule extends Module {\n private _dependencies: BotTypingsIndexDependencies\n\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'TBot',\n path: consts.INDEX_FILE,\n })\n\n const integrationsModule = new BotIntegrationsModule(bot)\n integrationsModule.unshift('integrations')\n this.pushDep(integrationsModule)\n\n const eventsModule = new EventsModule(bot.events ?? {})\n eventsModule.unshift('events')\n this.pushDep(eventsModule)\n\n const statesModule = new StatesModule(bot.states ?? {})\n statesModule.unshift('states')\n this.pushDep(statesModule)\n\n const tablesModule = new TablesModule(bot.tables ?? {})\n tablesModule.unshift('tables')\n this.pushDep(tablesModule)\n\n const actionsModule = new ActionsModule(bot.actions ?? {})\n actionsModule.unshift('actions')\n this.pushDep(actionsModule)\n\n const workflowsModule = new WorkflowsModule(bot.workflows ?? {})\n workflowsModule.unshift('workflows')\n this.pushDep(workflowsModule)\n\n this._dependencies = {\n integrationsModule,\n eventsModule,\n statesModule,\n actionsModule,\n tablesModule,\n workflowsModule,\n }\n }\n\n public async getContent() {\n const { integrationsModule, eventsModule, statesModule, actionsModule, tablesModule, workflowsModule } =\n this._dependencies\n\n const integrationsImport = integrationsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const actionsImport = actionsModule\n const tablesImport = tablesModule.import(this)\n const workflowsImport = workflowsModule\n\n return [\n consts.GENERATED_HEADER,\n `import * as ${integrationsModule.name} from './${integrationsImport}'`,\n `import * as ${eventsModule.name} from './${eventsModule.name}'`,\n `import * as ${statesModule.name} from './${statesModule.name}'`,\n `import * as ${actionsModule.name} from './${actionsImport.name}'`,\n `import * as ${tablesModule.name} from './${tablesImport}'`,\n `import * as ${workflowsModule.name} from './${workflowsImport.name}'`,\n '',\n `export * as ${integrationsModule.name} from './${integrationsImport}'`,\n `export * as ${eventsModule.name} from './${eventsImport}'`,\n `export * as ${statesModule.name} from './${statesImport}'`,\n `export * as ${actionsModule.name} from './${actionsImport.name}'`,\n `export * as ${tablesModule.name} from './${tablesImport}'`,\n `export * as ${workflowsModule.name} from './${workflowsImport.name}'`,\n '',\n 'export type TBot = {',\n ` integrations: ${integrationsModule.name}.${integrationsModule.exportName}`,\n ` events: ${eventsModule.name}.${eventsModule.exportName}`,\n ` states: ${statesModule.name}.${statesModule.exportName}`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName}`,\n ` tables: ${tablesModule.name}.${tablesModule.exportName}`,\n ` workflows: ${workflowsModule.name}.${workflowsModule.exportName}`,\n '}',\n ].join('\\n')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,iCAAyC;AACzC,oBAA2C;AAC3C,4BAA8B;AAC9B,2BAA6B;AAC7B,2BAA6B;AAC7B,2BAA6B;AAC7B,8BAAgC;AAEhC,MAAM,8BAA8B,iCAAmB;AAAA,EAC9C,YAAY,KAAwB;AACzC,UAAM;AAAA,MACJ,YAAY;AAAA,IACd,CAAC;AAED,eAAW,CAAC,OAAO,WAAW,KAAK,OAAO,QAAQ,IAAI,gBAAgB,CAAC,CAAC,GAAG;AACzE,YAAM,oBAAoB,IAAI,oDAAyB,YAAY,UAAU;AAC7E,wBAAkB,QAAQ,KAAK;AAC/B,WAAK,QAAQ,iBAAiB;AAAA,IAChC;AAAA,EACF;AACF;AAWO,MAAM,yBAAyB,qBAAO;AAAA,EACnC;AAAA,EAED,YAAY,KAAwB;AACzC,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM,OAAO;AAAA,IACf,CAAC;AAED,UAAM,qBAAqB,IAAI,sBAAsB,GAAG;AACxD,uBAAmB,QAAQ,cAAc;AACzC,SAAK,QAAQ,kBAAkB;AAE/B,UAAM,eAAe,IAAI,kCAAa,IAAI,UAAU,CAAC,CAAC;AACtD,iB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,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,cAAc,gBAAgB,cAAc;AAAA,MAC3D,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,gBAAgB,gBAAgB,gBAAgB;AAAA,MAC/D;AAAA,MACA;AAAA,MACA,mBAAmB,mBAAmB,QAAQ,mBAAmB;AAAA,MACjE,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,gBAAgB,gBAAgB,QAAQ,gBAAgB;AAAA,MACxD;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var workflows_module_exports = {};
|
|
30
|
+
__export(workflows_module_exports, {
|
|
31
|
+
WorkflowInputModule: () => WorkflowInputModule,
|
|
32
|
+
WorkflowModule: () => WorkflowModule,
|
|
33
|
+
WorkflowOutputModule: () => WorkflowOutputModule,
|
|
34
|
+
WorkflowTagsModule: () => WorkflowTagsModule,
|
|
35
|
+
WorkflowsModule: () => WorkflowsModule
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(workflows_module_exports);
|
|
38
|
+
var import_generators = require("../../generators");
|
|
39
|
+
var import_module = require("../../module");
|
|
40
|
+
var strings = __toESM(require("../../strings"));
|
|
41
|
+
class WorkflowInputModule extends import_module.Module {
|
|
42
|
+
constructor(_input) {
|
|
43
|
+
const name = "input";
|
|
44
|
+
const exportName = strings.typeName(name);
|
|
45
|
+
super({ path: `${name}.ts`, exportName });
|
|
46
|
+
this._input = _input;
|
|
47
|
+
}
|
|
48
|
+
async getContent() {
|
|
49
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._input.schema, this.exportName);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class WorkflowOutputModule extends import_module.Module {
|
|
53
|
+
constructor(_output) {
|
|
54
|
+
const name = "output";
|
|
55
|
+
const exportName = strings.typeName(name);
|
|
56
|
+
super({ path: `${name}.ts`, exportName });
|
|
57
|
+
this._output = _output;
|
|
58
|
+
}
|
|
59
|
+
async getContent() {
|
|
60
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._output.schema, this.exportName);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class WorkflowTagsModule extends import_module.Module {
|
|
64
|
+
constructor(_tags) {
|
|
65
|
+
const name = "tags";
|
|
66
|
+
const exportName = strings.typeName(name);
|
|
67
|
+
super({ path: `${name}.ts`, exportName });
|
|
68
|
+
this._tags = _tags;
|
|
69
|
+
}
|
|
70
|
+
async getContent() {
|
|
71
|
+
const tags = Object.keys(this._tags ?? {}).map((tagName) => `${(0, import_generators.primitiveToTypescriptValue)(tagName)}: string`).join(", ");
|
|
72
|
+
return `export type ${this.exportName} = { ${tags} }`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class WorkflowModule extends import_module.ReExportTypeModule {
|
|
76
|
+
constructor(workflowName, workflow) {
|
|
77
|
+
super({ exportName: strings.typeName(workflowName) });
|
|
78
|
+
const inputModule = new WorkflowInputModule(workflow.input);
|
|
79
|
+
const outputModule = new WorkflowOutputModule(workflow.output);
|
|
80
|
+
const tagsModule = new WorkflowTagsModule(workflow.tags);
|
|
81
|
+
this.pushDep(inputModule);
|
|
82
|
+
this.pushDep(outputModule);
|
|
83
|
+
this.pushDep(tagsModule);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class WorkflowsModule extends import_module.ReExportTypeModule {
|
|
87
|
+
constructor(workflows) {
|
|
88
|
+
super({ exportName: strings.typeName("workflows") });
|
|
89
|
+
for (const [workflowName, workflow] of Object.entries(workflows)) {
|
|
90
|
+
const module2 = new WorkflowModule(workflowName, workflow);
|
|
91
|
+
module2.unshift(workflowName);
|
|
92
|
+
this.pushDep(module2);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
WorkflowInputModule,
|
|
99
|
+
WorkflowModule,
|
|
100
|
+
WorkflowOutputModule,
|
|
101
|
+
WorkflowTagsModule,
|
|
102
|
+
WorkflowsModule
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=workflows-module.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/bot-implementation/bot-typings/workflows-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { primitiveToTypescriptValue, zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\ntype WorkflowInput = sdk.BotWorkflowDefinition['input']\ntype WorkflowOutput = sdk.BotWorkflowDefinition['output']\ntype WorkflowTags = sdk.BotWorkflowDefinition['tags']\n\nexport class WorkflowInputModule extends Module {\n public constructor(private _input: WorkflowInput) {\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 WorkflowOutputModule extends Module {\n public constructor(private _output: WorkflowOutput) {\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 WorkflowTagsModule extends Module {\n public constructor(private _tags: WorkflowTags) {\n const name = 'tags'\n const exportName = strings.typeName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n const tags = Object.keys(this._tags ?? {})\n .map((tagName) => `${primitiveToTypescriptValue(tagName)}: string`)\n .join(', ')\n\n return `export type ${this.exportName} = { ${tags} }`\n }\n}\n\nexport class WorkflowModule extends ReExportTypeModule {\n public constructor(workflowName: string, workflow: sdk.BotWorkflowDefinition) {\n super({ exportName: strings.typeName(workflowName) })\n\n const inputModule = new WorkflowInputModule(workflow.input)\n const outputModule = new WorkflowOutputModule(workflow.output)\n const tagsModule = new WorkflowTagsModule(workflow.tags)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n this.pushDep(tagsModule)\n }\n}\n\nexport class WorkflowsModule extends ReExportTypeModule {\n public constructor(workflows: Record<string, sdk.BotWorkflowDefinition>) {\n super({ exportName: strings.typeName('workflows') })\n for (const [workflowName, workflow] of Object.entries(workflows)) {\n const module = new WorkflowModule(workflowName, workflow)\n module.unshift(workflowName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsE;AACtE,oBAA2C;AAC3C,cAAyB;AAMlB,MAAM,4BAA4B,qBAAO;AAAA,EACvC,YAAoB,QAAuB;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,OAAO,QAAQ,KAAK,UAAU;AAAA,EACtE;AACF;AAEO,MAAM,6BAA6B,qBAAO;AAAA,EACxC,YAAoB,SAAyB;AAClD,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,2BAA2B,qBAAO;AAAA,EACtC,YAAoB,OAAqB;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,UAAM,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,EACtC,IAAI,CAAC,YAAY,OAAG,8CAA2B,OAAO,WAAW,EACjE,KAAK,IAAI;AAEZ,WAAO,eAAe,KAAK,kBAAkB;AAAA,EAC/C;AACF;AAEO,MAAM,uBAAuB,iCAAmB;AAAA,EAC9C,YAAY,cAAsB,UAAqC;AAC5E,UAAM,EAAE,YAAY,QAAQ,SAAS,YAAY,EAAE,CAAC;AAEpD,UAAM,cAAc,IAAI,oBAAoB,SAAS,KAAK;AAC1D,UAAM,eAAe,IAAI,qBAAqB,SAAS,MAAM;AAC7D,UAAM,aAAa,IAAI,mBAAmB,SAAS,IAAI;AAEvD,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AACzB,SAAK,QAAQ,UAAU;AAAA,EACzB;AACF;AAEO,MAAM,wBAAwB,iCAAmB;AAAA,EAC/C,YAAY,WAAsD;AACvE,UAAM,EAAE,YAAY,QAAQ,SAAS,WAAW,EAAE,CAAC;AACnD,eAAW,CAAC,cAAc,QAAQ,KAAK,OAAO,QAAQ,SAAS,GAAG;AAChE,YAAMA,UAAS,IAAI,eAAe,cAAc,QAAQ;AACxD,MAAAA,QAAO,QAAQ,YAAY;AAC3B,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
|
@@ -40,6 +40,7 @@ var import_configuration_module = require("./configuration-module");
|
|
|
40
40
|
var import_events_module = require("./events-module");
|
|
41
41
|
var import_states_module = require("./states-module");
|
|
42
42
|
var import_tables_module = require("./tables-module");
|
|
43
|
+
var import_workflows_module = require("./workflows-module");
|
|
43
44
|
class PluginIntegrationsModule extends import_module.ReExportTypeModule {
|
|
44
45
|
constructor(plugin) {
|
|
45
46
|
super({
|
|
@@ -68,41 +69,44 @@ const _isLocalPluginDefinition = (plugin) => {
|
|
|
68
69
|
return "props" in plugin;
|
|
69
70
|
};
|
|
70
71
|
class PluginTypingsModule extends import_module.Module {
|
|
71
|
-
|
|
72
|
-
constructor(plugin) {
|
|
72
|
+
constructor(_plugin) {
|
|
73
73
|
super({
|
|
74
74
|
exportName: "TPlugin",
|
|
75
75
|
path: consts.INDEX_FILE
|
|
76
76
|
});
|
|
77
|
-
|
|
77
|
+
this._plugin = _plugin;
|
|
78
|
+
const integrationsModule = _isLocalPluginDefinition(_plugin) ? new PluginIntegrationsModule(_plugin) : new import_module.SingleFileModule({
|
|
78
79
|
path: consts.INDEX_FILE,
|
|
79
80
|
exportName: "Integrations",
|
|
80
81
|
content: "export type Integrations = {}"
|
|
81
82
|
});
|
|
82
83
|
integrationsModule.unshift("integrations");
|
|
83
84
|
this.pushDep(integrationsModule);
|
|
84
|
-
const interfacesModule = _isLocalPluginDefinition(
|
|
85
|
+
const interfacesModule = _isLocalPluginDefinition(_plugin) ? new PluginInterfacesModule(_plugin) : new import_module.SingleFileModule({
|
|
85
86
|
path: consts.INDEX_FILE,
|
|
86
87
|
exportName: "Interfaces",
|
|
87
88
|
content: "export type Interfaces = {}"
|
|
88
89
|
});
|
|
89
90
|
interfacesModule.unshift("interfaces");
|
|
90
91
|
this.pushDep(interfacesModule);
|
|
91
|
-
const defaultConfigModule = new import_configuration_module.DefaultConfigurationModule(
|
|
92
|
+
const defaultConfigModule = new import_configuration_module.DefaultConfigurationModule(_plugin.configuration);
|
|
92
93
|
defaultConfigModule.unshift("configuration");
|
|
93
94
|
this.pushDep(defaultConfigModule);
|
|
94
|
-
const eventsModule = new import_events_module.EventsModule(
|
|
95
|
+
const eventsModule = new import_events_module.EventsModule(_plugin.events ?? {});
|
|
95
96
|
eventsModule.unshift("events");
|
|
96
97
|
this.pushDep(eventsModule);
|
|
97
|
-
const statesModule = new import_states_module.StatesModule(
|
|
98
|
+
const statesModule = new import_states_module.StatesModule(_plugin.states ?? {});
|
|
98
99
|
statesModule.unshift("states");
|
|
99
100
|
this.pushDep(statesModule);
|
|
100
|
-
const actionsModule = new import_actions_module.ActionsModule(
|
|
101
|
+
const actionsModule = new import_actions_module.ActionsModule(_plugin.actions ?? {});
|
|
101
102
|
actionsModule.unshift("actions");
|
|
102
103
|
this.pushDep(actionsModule);
|
|
103
|
-
const tablesModule = new import_tables_module.TablesModule(
|
|
104
|
+
const tablesModule = new import_tables_module.TablesModule(_plugin.tables ?? {});
|
|
104
105
|
tablesModule.unshift("tables");
|
|
105
106
|
this.pushDep(tablesModule);
|
|
107
|
+
const workflowsModule = new import_workflows_module.WorkflowsModule(_plugin.workflows ?? {});
|
|
108
|
+
workflowsModule.unshift("workflows");
|
|
109
|
+
this.pushDep(workflowsModule);
|
|
106
110
|
this._dependencies = {
|
|
107
111
|
integrationsModule,
|
|
108
112
|
interfacesModule,
|
|
@@ -110,9 +114,11 @@ class PluginTypingsModule extends import_module.Module {
|
|
|
110
114
|
eventsModule,
|
|
111
115
|
statesModule,
|
|
112
116
|
actionsModule,
|
|
113
|
-
tablesModule
|
|
117
|
+
tablesModule,
|
|
118
|
+
workflowsModule
|
|
114
119
|
};
|
|
115
120
|
}
|
|
121
|
+
_dependencies;
|
|
116
122
|
async getContent() {
|
|
117
123
|
const {
|
|
118
124
|
integrationsModule,
|
|
@@ -121,7 +127,8 @@ class PluginTypingsModule extends import_module.Module {
|
|
|
121
127
|
eventsModule,
|
|
122
128
|
statesModule,
|
|
123
129
|
actionsModule,
|
|
124
|
-
tablesModule
|
|
130
|
+
tablesModule,
|
|
131
|
+
workflowsModule
|
|
125
132
|
} = this._dependencies;
|
|
126
133
|
const integrationsImport = integrationsModule.import(this);
|
|
127
134
|
const interfacesImport = interfacesModule.import(this);
|
|
@@ -130,6 +137,7 @@ class PluginTypingsModule extends import_module.Module {
|
|
|
130
137
|
const statesImport = statesModule.import(this);
|
|
131
138
|
const actionsImport = actionsModule;
|
|
132
139
|
const tablesImport = tablesModule.import(this);
|
|
140
|
+
const workflowsImport = workflowsModule;
|
|
133
141
|
return [
|
|
134
142
|
consts.GENERATED_HEADER,
|
|
135
143
|
`import * as ${integrationsModule.name} from './${integrationsImport}'`,
|
|
@@ -139,6 +147,7 @@ class PluginTypingsModule extends import_module.Module {
|
|
|
139
147
|
`import * as ${statesModule.name} from './${statesModule.name}'`,
|
|
140
148
|
`import * as ${actionsModule.name} from './${actionsImport.name}'`,
|
|
141
149
|
`import * as ${tablesModule.name} from './${tablesImport}'`,
|
|
150
|
+
`import * as ${workflowsModule.name} from './${workflowsImport.name}'`,
|
|
142
151
|
"",
|
|
143
152
|
`export * as ${integrationsModule.name} from './${integrationsImport}'`,
|
|
144
153
|
`export * as ${interfacesModule.name} from './${interfacesImport}'`,
|
|
@@ -147,8 +156,11 @@ class PluginTypingsModule extends import_module.Module {
|
|
|
147
156
|
`export * as ${statesModule.name} from './${statesImport}'`,
|
|
148
157
|
`export * as ${actionsModule.name} from './${actionsImport.name}'`,
|
|
149
158
|
`export * as ${tablesModule.name} from './${tablesImport}'`,
|
|
159
|
+
`export * as ${workflowsModule.name} from './${workflowsImport.name}'`,
|
|
150
160
|
"",
|
|
151
161
|
"export type TPlugin = {",
|
|
162
|
+
` name: "${this._plugin.name}"`,
|
|
163
|
+
` version: "${this._plugin.version}"`,
|
|
152
164
|
` integrations: ${integrationsModule.name}.${integrationsModule.exportName}`,
|
|
153
165
|
` interfaces: ${interfacesModule.name}.${interfacesModule.exportName}`,
|
|
154
166
|
` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName}`,
|
|
@@ -156,6 +168,7 @@ class PluginTypingsModule extends import_module.Module {
|
|
|
156
168
|
` states: ${statesModule.name}.${statesModule.exportName}`,
|
|
157
169
|
` actions: ${actionsModule.name}.${actionsModule.exportName}`,
|
|
158
170
|
` tables: ${tablesModule.name}.${tablesModule.exportName}`,
|
|
171
|
+
` workflows: ${workflowsModule.name}.${workflowsModule.exportName}`,
|
|
159
172
|
"}"
|
|
160
173
|
].join("\n");
|
|
161
174
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-implementation/plugin-typings/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as utils from '../../../utils'\nimport * as consts from '../../consts'\nimport { IntegrationTypingsModule } from '../../integration-implementation/integration-typings'\nimport { InterfaceTypingsModule } from '../../interface-implementation'\nimport { Module, ReExportTypeModule, SingleFileModule } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { StatesModule } from './states-module'\nimport { TablesModule } from './tables-module'\n\nclass PluginIntegrationsModule extends ReExportTypeModule {\n public constructor(plugin: sdk.PluginDefinition) {\n super({\n exportName: 'Integrations',\n })\n\n for (const [alias, integration] of Object.entries(plugin.integrations ?? {})) {\n const integrationModule = new IntegrationTypingsModule(integration.definition)\n integrationModule.unshift(alias)\n this.pushDep(integrationModule)\n }\n }\n}\n\nclass PluginInterfacesModule extends ReExportTypeModule {\n public constructor(plugin: sdk.PluginDefinition) {\n super({\n exportName: 'Interfaces',\n })\n\n for (const [alias, intrface] of Object.entries(plugin.interfaces ?? {})) {\n const interfaceModule = new InterfaceTypingsModule(intrface.definition)\n interfaceModule.unshift(alias)\n this.pushDep(interfaceModule)\n }\n }\n}\n\ntype PluginTypingsIndexDependencies = {\n integrationsModule: PluginIntegrationsModule\n interfacesModule: PluginInterfacesModule\n defaultConfigModule: DefaultConfigurationModule\n eventsModule: EventsModule\n statesModule: StatesModule\n actionsModule: ActionsModule\n tablesModule: TablesModule\n}\n\ntype _assertPropsInPluginDefinition = utils.types.AssertKeyOf<'props', sdk.PluginDefinition>\nconst _isLocalPluginDefinition = (\n plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']\n): plugin is sdk.PluginDefinition => {\n return 'props' in plugin\n}\n\nexport class PluginTypingsModule extends Module {\n private _dependencies: PluginTypingsIndexDependencies\n\n public constructor(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,aAAwB;AACxB,iCAAyC;AACzC,sCAAuC;AACvC,oBAA6D;AAC7D,4BAA8B;AAC9B,kCAA2C;AAC3C,2BAA6B;AAC7B,2BAA6B;AAC7B,2BAA6B;
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as utils from '../../../utils'\nimport * as consts from '../../consts'\nimport { IntegrationTypingsModule } from '../../integration-implementation/integration-typings'\nimport { InterfaceTypingsModule } from '../../interface-implementation'\nimport { Module, ReExportTypeModule, SingleFileModule } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { StatesModule } from './states-module'\nimport { TablesModule } from './tables-module'\nimport { WorkflowsModule } from './workflows-module'\n\nclass PluginIntegrationsModule extends ReExportTypeModule {\n public constructor(plugin: sdk.PluginDefinition) {\n super({\n exportName: 'Integrations',\n })\n\n for (const [alias, integration] of Object.entries(plugin.integrations ?? {})) {\n const integrationModule = new IntegrationTypingsModule(integration.definition)\n integrationModule.unshift(alias)\n this.pushDep(integrationModule)\n }\n }\n}\n\nclass PluginInterfacesModule extends ReExportTypeModule {\n public constructor(plugin: sdk.PluginDefinition) {\n super({\n exportName: 'Interfaces',\n })\n\n for (const [alias, intrface] of Object.entries(plugin.interfaces ?? {})) {\n const interfaceModule = new InterfaceTypingsModule(intrface.definition)\n interfaceModule.unshift(alias)\n this.pushDep(interfaceModule)\n }\n }\n}\n\ntype PluginTypingsIndexDependencies = {\n integrationsModule: PluginIntegrationsModule\n interfacesModule: PluginInterfacesModule\n defaultConfigModule: DefaultConfigurationModule\n eventsModule: EventsModule\n statesModule: StatesModule\n actionsModule: ActionsModule\n tablesModule: TablesModule\n workflowsModule: WorkflowsModule\n}\n\ntype _assertPropsInPluginDefinition = utils.types.AssertKeyOf<'props', sdk.PluginDefinition>\nconst _isLocalPluginDefinition = (\n plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']\n): plugin is sdk.PluginDefinition => {\n return 'props' in plugin\n}\n\nexport class PluginTypingsModule extends Module {\n private _dependencies: PluginTypingsIndexDependencies\n\n public constructor(private _plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']) {\n super({\n exportName: 'TPlugin',\n path: consts.INDEX_FILE,\n })\n\n const integrationsModule = _isLocalPluginDefinition(_plugin)\n ? new PluginIntegrationsModule(_plugin)\n : new SingleFileModule({\n path: consts.INDEX_FILE,\n exportName: 'Integrations',\n content: 'export type Integrations = {}',\n })\n integrationsModule.unshift('integrations')\n this.pushDep(integrationsModule)\n\n const interfacesModule = _isLocalPluginDefinition(_plugin)\n ? new PluginInterfacesModule(_plugin)\n : new SingleFileModule({\n path: consts.INDEX_FILE,\n exportName: 'Interfaces',\n content: 'export type Interfaces = {}',\n })\n interfacesModule.unshift('interfaces')\n this.pushDep(interfacesModule)\n\n const defaultConfigModule = new DefaultConfigurationModule(_plugin.configuration)\n defaultConfigModule.unshift('configuration')\n this.pushDep(defaultConfigModule)\n\n const eventsModule = new EventsModule(_plugin.events ?? {})\n eventsModule.unshift('events')\n this.pushDep(eventsModule)\n\n const statesModule = new StatesModule(_plugin.states ?? {})\n statesModule.unshift('states')\n this.pushDep(statesModule)\n\n const actionsModule = new ActionsModule(_plugin.actions ?? {})\n actionsModule.unshift('actions')\n this.pushDep(actionsModule)\n\n const tablesModule = new TablesModule(_plugin.tables ?? {})\n tablesModule.unshift('tables')\n this.pushDep(tablesModule)\n\n const workflowsModule = new WorkflowsModule(_plugin.workflows ?? {})\n workflowsModule.unshift('workflows')\n this.pushDep(workflowsModule)\n\n this._dependencies = {\n integrationsModule,\n interfacesModule,\n defaultConfigModule,\n eventsModule,\n statesModule,\n actionsModule,\n tablesModule,\n workflowsModule,\n }\n }\n\n public async getContent() {\n const {\n integrationsModule,\n interfacesModule,\n defaultConfigModule,\n eventsModule,\n statesModule,\n actionsModule,\n tablesModule,\n workflowsModule,\n } = this._dependencies\n\n const integrationsImport = integrationsModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n const defaultConfigImport = defaultConfigModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const actionsImport = actionsModule\n const tablesImport = tablesModule.import(this)\n const workflowsImport = workflowsModule\n\n return [\n consts.GENERATED_HEADER,\n `import * as ${integrationsModule.name} from './${integrationsImport}'`,\n `import * as ${interfacesModule.name} from './${interfacesImport}'`,\n `import * as ${defaultConfigModule.name} from './${defaultConfigImport}'`,\n `import * as ${eventsModule.name} from './${eventsModule.name}'`,\n `import * as ${statesModule.name} from './${statesModule.name}'`,\n `import * as ${actionsModule.name} from './${actionsImport.name}'`,\n `import * as ${tablesModule.name} from './${tablesImport}'`,\n `import * as ${workflowsModule.name} from './${workflowsImport.name}'`,\n '',\n `export * as ${integrationsModule.name} from './${integrationsImport}'`,\n `export * as ${interfacesModule.name} from './${interfacesImport}'`,\n `export * as ${defaultConfigModule.name} from './${defaultConfigImport}'`,\n `export * as ${eventsModule.name} from './${eventsImport}'`,\n `export * as ${statesModule.name} from './${statesImport}'`,\n `export * as ${actionsModule.name} from './${actionsImport.name}'`,\n `export * as ${tablesModule.name} from './${tablesImport}'`,\n `export * as ${workflowsModule.name} from './${workflowsImport.name}'`,\n '',\n 'export type TPlugin = {',\n ` name: \"${this._plugin.name}\"`,\n ` version: \"${this._plugin.version}\"`,\n ` integrations: ${integrationsModule.name}.${integrationsModule.exportName}`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName}`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName}`,\n ` events: ${eventsModule.name}.${eventsModule.exportName}`,\n ` states: ${statesModule.name}.${statesModule.exportName}`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName}`,\n ` tables: ${tablesModule.name}.${tablesModule.exportName}`,\n ` workflows: ${workflowsModule.name}.${workflowsModule.exportName}`,\n '}',\n ].join('\\n')\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,aAAwB;A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AAE,KAAK,IAAI;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var workflows_module_exports = {};
|
|
30
|
+
__export(workflows_module_exports, {
|
|
31
|
+
WorkflowInputModule: () => WorkflowInputModule,
|
|
32
|
+
WorkflowModule: () => WorkflowModule,
|
|
33
|
+
WorkflowOutputModule: () => WorkflowOutputModule,
|
|
34
|
+
WorkflowTagsModule: () => WorkflowTagsModule,
|
|
35
|
+
WorkflowsModule: () => WorkflowsModule
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(workflows_module_exports);
|
|
38
|
+
var import_generators = require("../../generators");
|
|
39
|
+
var import_module = require("../../module");
|
|
40
|
+
var strings = __toESM(require("../../strings"));
|
|
41
|
+
class WorkflowInputModule extends import_module.Module {
|
|
42
|
+
constructor(_input) {
|
|
43
|
+
const name = "input";
|
|
44
|
+
const exportName = strings.typeName(name);
|
|
45
|
+
super({ path: `${name}.ts`, exportName });
|
|
46
|
+
this._input = _input;
|
|
47
|
+
}
|
|
48
|
+
async getContent() {
|
|
49
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._input.schema, this.exportName);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class WorkflowOutputModule extends import_module.Module {
|
|
53
|
+
constructor(_output) {
|
|
54
|
+
const name = "output";
|
|
55
|
+
const exportName = strings.typeName(name);
|
|
56
|
+
super({ path: `${name}.ts`, exportName });
|
|
57
|
+
this._output = _output;
|
|
58
|
+
}
|
|
59
|
+
async getContent() {
|
|
60
|
+
return (0, import_generators.zuiSchemaToTypeScriptType)(this._output.schema, this.exportName);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class WorkflowTagsModule extends import_module.Module {
|
|
64
|
+
constructor(_tags) {
|
|
65
|
+
const name = "tags";
|
|
66
|
+
const exportName = strings.typeName(name);
|
|
67
|
+
super({ path: `${name}.ts`, exportName });
|
|
68
|
+
this._tags = _tags;
|
|
69
|
+
}
|
|
70
|
+
async getContent() {
|
|
71
|
+
const tags = Object.keys(this._tags ?? {}).map((tagName) => `${(0, import_generators.primitiveToTypescriptValue)(tagName)}: string`).join(", ");
|
|
72
|
+
return `export type ${this.exportName} = { ${tags} }`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class WorkflowModule extends import_module.ReExportTypeModule {
|
|
76
|
+
constructor(workflowName, workflow) {
|
|
77
|
+
super({ exportName: strings.typeName(workflowName) });
|
|
78
|
+
const inputModule = new WorkflowInputModule(workflow.input);
|
|
79
|
+
const outputModule = new WorkflowOutputModule(workflow.output);
|
|
80
|
+
const tagsModule = new WorkflowTagsModule(workflow.tags);
|
|
81
|
+
this.pushDep(inputModule);
|
|
82
|
+
this.pushDep(outputModule);
|
|
83
|
+
this.pushDep(tagsModule);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class WorkflowsModule extends import_module.ReExportTypeModule {
|
|
87
|
+
constructor(workflows) {
|
|
88
|
+
super({ exportName: strings.typeName("workflows") });
|
|
89
|
+
for (const [workflowName, workflow] of Object.entries(workflows)) {
|
|
90
|
+
const module2 = new WorkflowModule(workflowName, workflow);
|
|
91
|
+
module2.unshift(workflowName);
|
|
92
|
+
this.pushDep(module2);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
WorkflowInputModule,
|
|
99
|
+
WorkflowModule,
|
|
100
|
+
WorkflowOutputModule,
|
|
101
|
+
WorkflowTagsModule,
|
|
102
|
+
WorkflowsModule
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=workflows-module.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/code-generation/plugin-implementation/plugin-typings/workflows-module.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { primitiveToTypescriptValue, zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\ntype WorkflowInput = sdk.BotWorkflowDefinition['input']\ntype WorkflowOutput = sdk.BotWorkflowDefinition['output']\ntype WorkflowTags = sdk.BotWorkflowDefinition['tags']\n\nexport class WorkflowInputModule extends Module {\n public constructor(private _input: WorkflowInput) {\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 WorkflowOutputModule extends Module {\n public constructor(private _output: WorkflowOutput) {\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 WorkflowTagsModule extends Module {\n public constructor(private _tags: WorkflowTags) {\n const name = 'tags'\n const exportName = strings.typeName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n const tags = Object.keys(this._tags ?? {})\n .map((tagName) => `${primitiveToTypescriptValue(tagName)}: string`)\n .join(', ')\n\n return `export type ${this.exportName} = { ${tags} }`\n }\n}\n\nexport class WorkflowModule extends ReExportTypeModule {\n public constructor(workflowName: string, workflow: sdk.BotWorkflowDefinition) {\n super({ exportName: strings.typeName(workflowName) })\n\n const inputModule = new WorkflowInputModule(workflow.input)\n const outputModule = new WorkflowOutputModule(workflow.output)\n const tagsModule = new WorkflowTagsModule(workflow.tags)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n this.pushDep(tagsModule)\n }\n}\n\nexport class WorkflowsModule extends ReExportTypeModule {\n public constructor(workflows: Record<string, sdk.BotWorkflowDefinition>) {\n super({ exportName: strings.typeName('workflows') })\n for (const [workflowName, workflow] of Object.entries(workflows)) {\n const module = new WorkflowModule(workflowName, workflow)\n module.unshift(workflowName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsE;AACtE,oBAA2C;AAC3C,cAAyB;AAMlB,MAAM,4BAA4B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,EACzB;AACF;AAEO,MAAM,wBAAwB,iCAAmB;AAAA,EAC/C,YAAY,WAAsD;AACvE,UAAM,EAAE,YAAY,QAAQ,SAAS,WAAW,EAAE,CAAC;AACnD,eAAW,CAAC,cAAc,QAAQ,KAAK,OAAO,QAAQ,SAAS,GAAG;AAChE,YAAMA,UAAS,IAAI,eAAe,cAAc,QAAQ;AACxD,MAAAA,QAAO,QAAQ,YAAY;AAC3B,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["module"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/code-generation/typings.ts"],
|
|
4
|
-
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as utils from '../utils'\n\ntype NameVersion = { name: string; version: string }\ntype PackageRef = { id?: string; name: string; version: string }\ntype Schema = Record<string, any>\ntype Aliases = Record<string, { name: string }>\n\ntype TitleDescription = { title?: string; description?: string }\n\nexport type File = { path: string; content: string }\n\nexport type IntegrationDefinition = PackageRef & {\n interfaces?: Record<\n string,\n {\n id?: string\n entities?: Aliases\n actions?: Aliases\n events?: Aliases\n channels?: Aliases\n }\n >\n configuration?: TitleDescription & {\n schema?: Schema\n }\n configurations?: Record<\n string,\n TitleDescription & {\n schema?: Schema\n }\n >\n channels?: Record<\n string,\n TitleDescription & {\n messages: Record<string, TitleDescription & { schema: Schema }>\n conversation?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n message?: {\n tags?: Record<string, {}>\n }\n }\n >\n states?: Record<\n string,\n TitleDescription & {\n type: client.State['type']\n schema: Schema\n }\n >\n events?: Record<string, TitleDescription & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription & {\n billable?: boolean\n cacheable?: boolean\n input: {\n schema: Schema\n }\n output: {\n schema: Schema\n }\n }\n >\n entities?: Record<string, TitleDescription & { schema: Schema }>\n user?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n}\n\nexport type InterfaceDefinition = PackageRef & {\n entities?: Record<string, TitleDescription & { schema: Schema }>\n events?: Record<string, TitleDescription & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription & {\n billable?: boolean\n cacheable?: boolean\n input: { schema: Schema }\n output: { schema: Schema }\n }\n >\n channels?: Record<string, TitleDescription & { messages: Record<string, TitleDescription & { schema: Schema }> }>\n}\n\nexport type PluginDefinition = PackageRef & {\n configuration?: TitleDescription & { schema?: Schema }\n user?: { tags: Record<string, {}> }\n conversation?:
|
|
4
|
+
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as utils from '../utils'\n\ntype NameVersion = { name: string; version: string }\ntype PackageRef = { id?: string; name: string; version: string }\ntype Schema = Record<string, any>\ntype Aliases = Record<string, { name: string }>\n\ntype TitleDescription = { title?: string; description?: string }\ntype Tags = { tags: Record<string, {}> }\ntype InputOutput = { input: { schema: Schema }; output: { schema: Schema } }\n\nexport type File = { path: string; content: string }\n\nexport type IntegrationDefinition = PackageRef & {\n interfaces?: Record<\n string,\n {\n id?: string\n entities?: Aliases\n actions?: Aliases\n events?: Aliases\n channels?: Aliases\n }\n >\n configuration?: TitleDescription & {\n schema?: Schema\n }\n configurations?: Record<\n string,\n TitleDescription & {\n schema?: Schema\n }\n >\n channels?: Record<\n string,\n TitleDescription & {\n messages: Record<string, TitleDescription & { schema: Schema }>\n conversation?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n message?: {\n tags?: Record<string, {}>\n }\n }\n >\n states?: Record<\n string,\n TitleDescription & {\n type: client.State['type']\n schema: Schema\n }\n >\n events?: Record<string, TitleDescription & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription & {\n billable?: boolean\n cacheable?: boolean\n input: {\n schema: Schema\n }\n output: {\n schema: Schema\n }\n }\n >\n entities?: Record<string, TitleDescription & { schema: Schema }>\n user?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n}\n\nexport type InterfaceDefinition = PackageRef & {\n entities?: Record<string, TitleDescription & { schema: Schema }>\n events?: Record<string, TitleDescription & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription & {\n billable?: boolean\n cacheable?: boolean\n input: { schema: Schema }\n output: { schema: Schema }\n }\n >\n channels?: Record<string, TitleDescription & { messages: Record<string, TitleDescription & { schema: Schema }> }>\n}\n\nexport type PluginDefinition = PackageRef & {\n configuration?: TitleDescription & { schema?: Schema }\n user?: { tags: Record<string, {}> }\n conversation?: Tags\n states?: Record<string, TitleDescription & { type: client.State['type']; schema: Schema }>\n events?: Record<string, TitleDescription & { schema: Schema }>\n actions?: Record<string, TitleDescription & InputOutput>\n workflows?: Record<string, TitleDescription & Tags & InputOutput>\n dependencies?: {\n interfaces?: Record<string, PackageRef>\n integrations?: Record<string, PackageRef>\n }\n}\n\nexport type IntegrationInstallablePackage = NameVersion & {\n integration: IntegrationDefinition\n devId?: string\n path?: utils.path.AbsolutePath\n}\n\nexport type InterfaceInstallablePackage = NameVersion & {\n interface: InterfaceDefinition\n path?: utils.path.AbsolutePath\n}\n\nexport type PluginInstallablePackage = NameVersion & {\n plugin: PluginDefinition\n path?: utils.path.AbsolutePath\n code: string\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -142,8 +142,7 @@ class DeployCommand extends import_project_command.ProjectCommand {
|
|
|
142
142
|
this.logger.debug("no previous version found");
|
|
143
143
|
}
|
|
144
144
|
const knownSecrets = previousVersion?.secrets;
|
|
145
|
-
|
|
146
|
-
createBody.secrets = utils.records.filterValues(createSecrets, utils.guards.is.notNull);
|
|
145
|
+
createBody.secrets = await this.promptSecrets(integrationDef, this.argv, { knownSecrets });
|
|
147
146
|
this._detectDeprecatedFeatures(integrationDef, {
|
|
148
147
|
allowDeprecated: this._allowDeprecatedFeatures(integrationDef, previousVersion)
|
|
149
148
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/deploy-command.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport chalk from 'chalk'\nimport * as fs from 'fs'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport * as tables from '../tables'\nimport * as utils from '../utils'\nimport { BuildCommand } from './build-command'\nimport { ProjectCommand } from './project-command'\n\nexport type DeployCommandDefinition = typeof commandDefinitions.deploy\nexport class DeployCommand extends ProjectCommand<DeployCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n if (!this.argv.noBuild) {\n await this._runBuild() // This ensures the bundle is always synced with source code\n }\n\n const projectDef = await this.readProjectDefinitionFromFS()\n\n if (projectDef.type === 'integration') {\n return this._deployIntegration(api, projectDef.definition)\n }\n if (projectDef.type === 'interface') {\n return this._deployInterface(api, projectDef.definition)\n }\n if (projectDef.type === 'plugin') {\n return this._deployPlugin(api, projectDef.definition)\n }\n if (projectDef.type === 'bot') {\n return this._deployBot(api, projectDef.definition, this.argv.botId, this.argv.createNewBot)\n }\n throw new errors.UnsupportedProjectType()\n }\n\n private async _runBuild() {\n return new BuildCommand(this.api, this.prompt, this.logger, this.argv).run()\n }\n\n private async _deployIntegration(api: apiUtils.ApiClient, integrationDef: sdk.IntegrationDefinition) {\n const { integration: updatedIntegrationDef, workspaceId } = await this._manageWorkspaceHandle(api, integrationDef)\n integrationDef = updatedIntegrationDef\n if (workspaceId) {\n api = api.switchWorkspace(workspaceId)\n }\n\n const { name, version } = integrationDef\n\n if (integrationDef.icon && !integrationDef.icon.toLowerCase().endsWith('.svg')) {\n throw new errors.BotpressCLIError('Icon must be an SVG file')\n }\n\n if (integrationDef.readme && !integrationDef.readme.toLowerCase().endsWith('.md')) {\n throw new errors.BotpressCLIError('Readme must be a Markdown file')\n }\n\n const integration = await api.findIntegration({ type: 'name', name, version })\n if (integration && integration.workspaceId !== api.workspaceId) {\n throw new errors.BotpressCLIError(\n `Public integration ${name} v${version} is already deployed in another workspace.`\n )\n }\n\n if (integration && integration.public && !api.isBotpressWorkspace) {\n throw new errors.BotpressCLIError(\n `Integration ${name} v${version} is already deployed publicly and cannot be updated. Please bump the version.`\n )\n }\n\n let message: string\n if (integration) {\n this.logger.warn('Integration already exists. If you decide to deploy, it will override the existing one.')\n message = `Are you sure you want to override integration ${name} v${version}?`\n } else {\n message = `Are you sure you want to deploy integration ${name} v${version}?`\n }\n\n const confirm = await this.prompt.confirm(message)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n this.logger.debug('Preparing integration request body...')\n\n const createBody = {\n ...(await this.prepareCreateIntegrationBody(integrationDef)),\n ...(await this.prepareIntegrationDependencies(integrationDef, api)),\n public: this.argv.public,\n }\n\n const startedMessage = `Deploying integration ${chalk.bold(name)} v${version}...`\n const successMessage = 'Integration deployed'\n if (integration) {\n const updateBody = apiUtils.prepareUpdateIntegrationBody(\n {\n id: integration.id,\n ...createBody,\n },\n integration\n )\n\n const { secrets: knownSecrets } = integration\n updateBody.secrets = await this.promptSecrets(integrationDef, this.argv, { knownSecrets })\n this._detectDeprecatedFeatures(integrationDef, { allowDeprecated: true })\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.log('Dry-run mode is active. Simulating integration update...')\n\n await api.client.validateIntegrationUpdate(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update integration \"${name}\"`)\n })\n } else {\n await api.client.updateIntegration(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update integration \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n } else {\n this.logger.debug(`looking for previous version of integration \"${name}\"`)\n const previousVersion = await api.findPreviousIntegrationVersion({ type: 'name', name, version })\n\n if (previousVersion) {\n this.logger.debug(`previous version found: ${previousVersion.version}`)\n } else {\n this.logger.debug('no previous version found')\n }\n\n const knownSecrets = previousVersion?.secrets\n\n const createSecrets = await this.promptSecrets(integrationDef, this.argv, { knownSecrets })\n createBody.secrets = utils.records.filterValues(createSecrets, utils.guards.is.notNull)\n\n this._detectDeprecatedFeatures(integrationDef, {\n allowDeprecated: this._allowDeprecatedFeatures(integrationDef, previousVersion),\n })\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.log('Dry-run mode is active. Simulating integration creation...')\n\n await api.client.validateIntegrationCreation(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create integration \"${name}\"`)\n })\n } else {\n await api.client.createIntegration(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create integration \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n }\n }\n\n private async _deployInterface(api: apiUtils.ApiClient, interfaceDeclaration: sdk.InterfaceDefinition) {\n if (!api.isBotpressWorkspace) {\n throw new errors.BotpressCLIError('Your workspace is not allowed to deploy interfaces.')\n }\n\n const { name, version } = interfaceDeclaration\n const intrface = await api.findPublicInterface({ type: 'name', name, version })\n\n let message: string\n if (intrface) {\n this.logger.warn('Interface already exists. If you decide to deploy, it will override the existing one.')\n message = `Are you sure you want to override interface ${name} v${version}?`\n } else {\n message = `Are you sure you want to deploy interface ${name} v${version}?`\n }\n\n const confirm = await this.prompt.confirm(message)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n const createBody = await apiUtils.prepareCreateInterfaceBody(interfaceDeclaration)\n\n const startedMessage = `Deploying interface ${chalk.bold(name)} v${version}...`\n const successMessage = 'Interface deployed'\n if (intrface) {\n const updateBody = apiUtils.prepareUpdateInterfaceBody(\n {\n id: intrface.id,\n ...createBody,\n },\n intrface\n )\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for interface updates. Skipping deployment...')\n } else {\n await api.client.updateInterface(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update interface \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n } else {\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for interface creation. Skipping deployment...')\n } else {\n await api.client.createInterface(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create interface \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n }\n }\n\n private async _deployPlugin(api: apiUtils.ApiClient, pluginDef: sdk.PluginDefinition) {\n const codeCJS = await fs.promises.readFile(this.projectPaths.abs.outFileCJS, 'utf-8')\n const codeESM = await fs.promises.readFile(this.projectPaths.abs.outFileESM, 'utf-8')\n\n const { name, version } = pluginDef\n\n if (pluginDef.icon && !pluginDef.icon.toLowerCase().endsWith('.svg')) {\n throw new errors.BotpressCLIError('Icon must be an SVG file')\n }\n\n if (pluginDef.readme && !pluginDef.readme.toLowerCase().endsWith('.md')) {\n throw new errors.BotpressCLIError('Readme must be a Markdown file')\n }\n\n const plugin = await api.findPublicPlugin({ type: 'name', name, version })\n\n let message: string\n if (plugin) {\n this.logger.warn('Plugin already exists. If you decide to deploy, it will override the existing one.')\n message = `Are you sure you want to override plugin ${name} v${version}?`\n } else {\n message = `Are you sure you want to deploy plugin ${name} v${version}?`\n }\n\n const confirm = await this.prompt.confirm(message)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n this.logger.debug('Preparing plugin request body...')\n\n const icon = await this.readProjectFile(pluginDef.icon, 'base64')\n const readme = await this.readProjectFile(pluginDef.readme, 'base64')\n\n const createBody = {\n ...(await apiUtils.prepareCreatePluginBody(pluginDef)),\n ...(await this.preparePluginDependencies(pluginDef, api)),\n icon,\n readme,\n code: {\n node: codeCJS,\n browser: codeESM,\n },\n }\n\n const startedMessage = `Deploying plugin ${chalk.bold(name)} v${version}...`\n const successMessage = 'Plugin deployed'\n if (plugin) {\n const updateBody = apiUtils.prepareUpdatePluginBody(\n {\n id: plugin.id,\n ...createBody,\n },\n plugin\n )\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for plugin updates. Skipping deployment...')\n } else {\n await api.client.updatePlugin(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update plugin \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n } else {\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for plugin creation. Skipping deployment...')\n } else {\n await api.client.createPlugin(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create plugin \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n }\n }\n\n private _allowDeprecatedFeatures(\n integrationDef: sdk.IntegrationDefinition,\n previousVersion: client.Integration | undefined\n ): boolean {\n if (this.argv.allowDeprecated) {\n return true\n }\n\n if (!previousVersion) {\n return false\n }\n\n const versionDiff = semver.diff(integrationDef.version, previousVersion.version)\n if (!versionDiff) {\n return false\n }\n\n return utils.semver.releases.lt(versionDiff, 'major')\n }\n\n private _detectDeprecatedFeatures(\n integrationDef: sdk.IntegrationDefinition,\n opts: { allowDeprecated?: boolean } = {}\n ) {\n const deprecatedFields: string[] = []\n const { user, channels } = integrationDef\n if (user?.creation?.enabled) {\n deprecatedFields.push('user.creation')\n }\n\n for (const [channelName, channel] of Object.entries(channels ?? {})) {\n if (channel?.conversation?.creation?.enabled) {\n deprecatedFields.push(`channels.${channelName}.creation`)\n }\n }\n\n if (!deprecatedFields.length) {\n return\n }\n\n const errorMessage = `The following fields of the integration's definition are deprecated: ${deprecatedFields.join(\n ', '\n )}`\n\n if (opts.allowDeprecated) {\n this.logger.warn(errorMessage)\n } else {\n throw new errors.BotpressCLIError(errorMessage)\n }\n }\n\n private async _deployBot(\n api: apiUtils.ApiClient,\n botDefinition: sdk.BotDefinition,\n argvBotId: string | undefined,\n argvCreateNew: boolean | undefined\n ) {\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for bot deployments. Skipping deployment...')\n return\n }\n\n const outfile = this.projectPaths.abs.outFileCJS\n const code = await fs.promises.readFile(outfile, 'utf-8')\n\n let bot: client.Bot\n if (argvBotId && argvCreateNew) {\n throw new errors.BotpressCLIError('Cannot specify both --botId and --createNew')\n } else if (argvCreateNew) {\n const confirm = await this.prompt.confirm('Are you sure you want to create a new bot ?')\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n bot = await this._createNewBot(api)\n } else {\n bot = await this._getExistingBot(api, argvBotId)\n\n const confirm = await this.prompt.confirm(`Are you sure you want to deploy the bot \"${bot.name}\"?`)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n }\n\n const line = this.logger.line()\n line.started(`Deploying bot ${chalk.bold(bot.name)}...`)\n\n const updateBotBody = apiUtils.prepareUpdateBotBody(\n {\n ...(await apiUtils.prepareCreateBotBody(botDefinition)),\n ...(await this.prepareBotDependencies(botDefinition, api)),\n id: bot.id,\n code,\n },\n bot\n )\n\n const { bot: updatedBot } = await api.client.updateBot(updateBotBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update bot \"${bot.name}\"`)\n })\n\n const tablesPublisher = new tables.TablesPublisher({ api, logger: this.logger, prompt: this.prompt })\n await tablesPublisher.deployTables({ botId: updatedBot.id, botDefinition })\n\n line.success('Bot deployed')\n this.displayWebhookUrls(updatedBot)\n }\n\n private async _createNewBot(api: apiUtils.ApiClient): Promise<client.Bot> {\n const line = this.logger.line()\n const { bot: createdBot } = await api.client.createBot({}).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not create bot')\n })\n line.success(`Bot created with ID \"${createdBot.id}\" and name \"${createdBot.name}\"`)\n await this.projectCache.set('botId', createdBot.id)\n return createdBot\n }\n\n private async _getExistingBot(api: apiUtils.ApiClient, botId: string | undefined): Promise<client.Bot> {\n const promptedBotId = await this.projectCache.sync('botId', botId, async (defaultId) => {\n const userBots = await api\n .listAllPages(api.client.listBots, (r) => r.bots)\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not fetch existing bots')\n })\n\n if (!userBots.length) {\n throw new errors.NoBotsFoundError()\n }\n\n const initial = userBots.find((bot) => bot.id === defaultId)\n\n const prompted = await this.prompt.select('Which bot do you want to deploy?', {\n initial: initial && { title: initial.name, value: initial.id },\n choices: userBots.map((bot) => ({ title: bot.name, value: bot.id })),\n })\n\n if (!prompted) {\n throw new errors.ParamRequiredError('Bot Id')\n }\n\n return prompted\n })\n\n const { bot: fetchedBot } = await api.client.getBot({ id: promptedBotId }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not get bot info')\n })\n\n return fetchedBot\n }\n\n private async _manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n integration: sdk.IntegrationDefinition\n ): Promise<{\n integration: sdk.IntegrationDefinition\n workspaceId?: string // Set if user opted to deploy on another available workspace\n }> {\n const { name: localName, workspaceHandle: localHandle } = this._parseIntegrationName(integration.name)\n if (!localHandle && api.isBotpressWorkspace) {\n this.logger.debug('Botpress workspace detected; workspace handle omitted')\n return { integration } // botpress has the right to omit workspace handle\n }\n\n const { handle: remoteHandle, name: workspaceName } = await api.getWorkspace().catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not fetch workspace')\n })\n\n if (localHandle && remoteHandle) {\n let workspaceId: string | undefined = undefined\n if (localHandle !== remoteHandle) {\n const remoteWorkspace = await api.findWorkspaceByHandle(localHandle).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list workspaces')\n })\n if (!remoteWorkspace) {\n throw new errors.BotpressCLIError(\n `The integration handle \"${localHandle}\" is not associated with any of your workspaces.`\n )\n }\n this.logger.warn(\n `Your are logged in to workspace \"${workspaceName}\" but integration handle \"${localHandle}\" belongs to \"${remoteWorkspace.name}\".`\n )\n const confirmUseAlternateWorkspace = await this.prompt.confirm(\n 'Do you want to deploy integration on this workspace instead?'\n )\n if (!confirmUseAlternateWorkspace) {\n throw new errors.BotpressCLIError(\n `Cannot deploy integration with handle \"${localHandle}\" on workspace \"${workspaceName}\"`\n )\n }\n\n workspaceId = remoteWorkspace.id\n }\n return { integration, workspaceId }\n }\n\n const workspaceHandleIsMandatoryMsg = 'Cannot deploy integration without workspace handle'\n\n if (!localHandle && remoteHandle) {\n const confirmAddHandle = await this.prompt.confirm(\n `Your current workspace handle is \"${remoteHandle}\". Do you want to use the name \"${remoteHandle}/${localName}\"?`\n )\n if (!confirmAddHandle) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n const newName = `${remoteHandle}/${localName}`\n return { integration: new sdk.IntegrationDefinition({ ...integration, name: newName }) }\n }\n\n if (localHandle && !remoteHandle) {\n const { available } = await api.client.checkHandleAvailability({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not check handle availability')\n })\n\n if (!available) {\n throw new errors.BotpressCLIError(`Handle \"${localHandle}\" is not yours and is not available`)\n }\n\n const confirmClaimHandle = await this.prompt.confirm(\n `Handle \"${localHandle}\" is available. Do you want to claim it for your workspace ${workspaceName}?`\n )\n if (!confirmClaimHandle) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n await api.updateWorkspace({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${localHandle}\"`)\n })\n\n this.logger.success(`Handle \"${localHandle}\" is now yours!`)\n return { integration }\n }\n\n this.logger.warn(\"It seems you don't have a workspace handle yet.\")\n let claimedHandle: string | undefined = undefined\n do {\n const prompted = await this.prompt.text('Please enter a workspace handle')\n if (!prompted) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n const { available, suggestions } = await api.client.checkHandleAvailability({ handle: prompted })\n if (!available) {\n this.logger.warn(`Handle \"${prompted}\" is not available. Suggestions: ${suggestions.join(', ')}`)\n continue\n }\n\n claimedHandle = prompted\n await api.updateWorkspace({ handle: claimedHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${claimedHandle}\"`)\n })\n } while (!claimedHandle)\n\n this.logger.success(`Handle \"${claimedHandle}\" is yours!`)\n const newName = `${claimedHandle}/${localName}`\n return { integration: new sdk.IntegrationDefinition({ ...integration, name: newName }) }\n }\n\n private _parseIntegrationName = (integrationName: string): { name: string; workspaceHandle?: string } => {\n const parts = integrationName.split('/')\n if (parts.length > 2) {\n throw new errors.BotpressCLIError(\n `Invalid integration name \"${integrationName}\": a single forward slash is allowed`\n )\n }\n if (parts.length === 2) {\n const [workspaceHandle, name] = parts as [string, string]\n return { name, workspaceHandle }\n }\n const [name] = parts as [string]\n return { name }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,UAAqB;AACrB,mBAAkB;AAClB,SAAoB;AACpB,oBAAmB;AACnB,eAA0B;AAE1B,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,2BAA6B;AAC7B,6BAA+B;AAGxB,MAAM,sBAAsB,sCAAwC;AAAA,EACzE,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAE3D,QAAI,CAAC,KAAK,KAAK,SAAS;AACtB,YAAM,KAAK,UAAU;AAAA,IACvB;AAEA,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,QAAI,WAAW,SAAS,eAAe;AACrC,aAAO,KAAK,mBAAmB,KAAK,WAAW,UAAU;AAAA,IAC3D;AACA,QAAI,WAAW,SAAS,aAAa;AACnC,aAAO,KAAK,iBAAiB,KAAK,WAAW,UAAU;AAAA,IACzD;AACA,QAAI,WAAW,SAAS,UAAU;AAChC,aAAO,KAAK,cAA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AM,gBAAgB;AAAA,IACjC;AACA,UAAM,CAAC,IAAI,IAAI;AACf,WAAO,EAAE,KAAK;AAAA,EAChB;AACF;",
|
|
4
|
+
"sourcesContent": ["import type * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport chalk from 'chalk'\nimport * as fs from 'fs'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport * as tables from '../tables'\nimport * as utils from '../utils'\nimport { BuildCommand } from './build-command'\nimport { ProjectCommand } from './project-command'\n\nexport type DeployCommandDefinition = typeof commandDefinitions.deploy\nexport class DeployCommand extends ProjectCommand<DeployCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n if (!this.argv.noBuild) {\n await this._runBuild() // This ensures the bundle is always synced with source code\n }\n\n const projectDef = await this.readProjectDefinitionFromFS()\n\n if (projectDef.type === 'integration') {\n return this._deployIntegration(api, projectDef.definition)\n }\n if (projectDef.type === 'interface') {\n return this._deployInterface(api, projectDef.definition)\n }\n if (projectDef.type === 'plugin') {\n return this._deployPlugin(api, projectDef.definition)\n }\n if (projectDef.type === 'bot') {\n return this._deployBot(api, projectDef.definition, this.argv.botId, this.argv.createNewBot)\n }\n throw new errors.UnsupportedProjectType()\n }\n\n private async _runBuild() {\n return new BuildCommand(this.api, this.prompt, this.logger, this.argv).run()\n }\n\n private async _deployIntegration(api: apiUtils.ApiClient, integrationDef: sdk.IntegrationDefinition) {\n const { integration: updatedIntegrationDef, workspaceId } = await this._manageWorkspaceHandle(api, integrationDef)\n integrationDef = updatedIntegrationDef\n if (workspaceId) {\n api = api.switchWorkspace(workspaceId)\n }\n\n const { name, version } = integrationDef\n\n if (integrationDef.icon && !integrationDef.icon.toLowerCase().endsWith('.svg')) {\n throw new errors.BotpressCLIError('Icon must be an SVG file')\n }\n\n if (integrationDef.readme && !integrationDef.readme.toLowerCase().endsWith('.md')) {\n throw new errors.BotpressCLIError('Readme must be a Markdown file')\n }\n\n const integration = await api.findIntegration({ type: 'name', name, version })\n if (integration && integration.workspaceId !== api.workspaceId) {\n throw new errors.BotpressCLIError(\n `Public integration ${name} v${version} is already deployed in another workspace.`\n )\n }\n\n if (integration && integration.public && !api.isBotpressWorkspace) {\n throw new errors.BotpressCLIError(\n `Integration ${name} v${version} is already deployed publicly and cannot be updated. Please bump the version.`\n )\n }\n\n let message: string\n if (integration) {\n this.logger.warn('Integration already exists. If you decide to deploy, it will override the existing one.')\n message = `Are you sure you want to override integration ${name} v${version}?`\n } else {\n message = `Are you sure you want to deploy integration ${name} v${version}?`\n }\n\n const confirm = await this.prompt.confirm(message)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n this.logger.debug('Preparing integration request body...')\n\n const createBody = {\n ...(await this.prepareCreateIntegrationBody(integrationDef)),\n ...(await this.prepareIntegrationDependencies(integrationDef, api)),\n public: this.argv.public,\n }\n\n const startedMessage = `Deploying integration ${chalk.bold(name)} v${version}...`\n const successMessage = 'Integration deployed'\n if (integration) {\n const updateBody = apiUtils.prepareUpdateIntegrationBody(\n {\n id: integration.id,\n ...createBody,\n },\n integration\n )\n\n const { secrets: knownSecrets } = integration\n updateBody.secrets = await this.promptSecrets(integrationDef, this.argv, { knownSecrets })\n this._detectDeprecatedFeatures(integrationDef, { allowDeprecated: true })\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.log('Dry-run mode is active. Simulating integration update...')\n\n await api.client.validateIntegrationUpdate(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update integration \"${name}\"`)\n })\n } else {\n await api.client.updateIntegration(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update integration \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n } else {\n this.logger.debug(`looking for previous version of integration \"${name}\"`)\n const previousVersion = await api.findPreviousIntegrationVersion({ type: 'name', name, version })\n\n if (previousVersion) {\n this.logger.debug(`previous version found: ${previousVersion.version}`)\n } else {\n this.logger.debug('no previous version found')\n }\n\n const knownSecrets = previousVersion?.secrets\n\n createBody.secrets = await this.promptSecrets(integrationDef, this.argv, { knownSecrets })\n this._detectDeprecatedFeatures(integrationDef, {\n allowDeprecated: this._allowDeprecatedFeatures(integrationDef, previousVersion),\n })\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.log('Dry-run mode is active. Simulating integration creation...')\n\n await api.client.validateIntegrationCreation(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create integration \"${name}\"`)\n })\n } else {\n await api.client.createIntegration(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create integration \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n }\n }\n\n private async _deployInterface(api: apiUtils.ApiClient, interfaceDeclaration: sdk.InterfaceDefinition) {\n if (!api.isBotpressWorkspace) {\n throw new errors.BotpressCLIError('Your workspace is not allowed to deploy interfaces.')\n }\n\n const { name, version } = interfaceDeclaration\n const intrface = await api.findPublicInterface({ type: 'name', name, version })\n\n let message: string\n if (intrface) {\n this.logger.warn('Interface already exists. If you decide to deploy, it will override the existing one.')\n message = `Are you sure you want to override interface ${name} v${version}?`\n } else {\n message = `Are you sure you want to deploy interface ${name} v${version}?`\n }\n\n const confirm = await this.prompt.confirm(message)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n const createBody = await apiUtils.prepareCreateInterfaceBody(interfaceDeclaration)\n\n const startedMessage = `Deploying interface ${chalk.bold(name)} v${version}...`\n const successMessage = 'Interface deployed'\n if (intrface) {\n const updateBody = apiUtils.prepareUpdateInterfaceBody(\n {\n id: intrface.id,\n ...createBody,\n },\n intrface\n )\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for interface updates. Skipping deployment...')\n } else {\n await api.client.updateInterface(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update interface \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n } else {\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for interface creation. Skipping deployment...')\n } else {\n await api.client.createInterface(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create interface \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n }\n }\n\n private async _deployPlugin(api: apiUtils.ApiClient, pluginDef: sdk.PluginDefinition) {\n const codeCJS = await fs.promises.readFile(this.projectPaths.abs.outFileCJS, 'utf-8')\n const codeESM = await fs.promises.readFile(this.projectPaths.abs.outFileESM, 'utf-8')\n\n const { name, version } = pluginDef\n\n if (pluginDef.icon && !pluginDef.icon.toLowerCase().endsWith('.svg')) {\n throw new errors.BotpressCLIError('Icon must be an SVG file')\n }\n\n if (pluginDef.readme && !pluginDef.readme.toLowerCase().endsWith('.md')) {\n throw new errors.BotpressCLIError('Readme must be a Markdown file')\n }\n\n const plugin = await api.findPublicPlugin({ type: 'name', name, version })\n\n let message: string\n if (plugin) {\n this.logger.warn('Plugin already exists. If you decide to deploy, it will override the existing one.')\n message = `Are you sure you want to override plugin ${name} v${version}?`\n } else {\n message = `Are you sure you want to deploy plugin ${name} v${version}?`\n }\n\n const confirm = await this.prompt.confirm(message)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n this.logger.debug('Preparing plugin request body...')\n\n const icon = await this.readProjectFile(pluginDef.icon, 'base64')\n const readme = await this.readProjectFile(pluginDef.readme, 'base64')\n\n const createBody = {\n ...(await apiUtils.prepareCreatePluginBody(pluginDef)),\n ...(await this.preparePluginDependencies(pluginDef, api)),\n icon,\n readme,\n code: {\n node: codeCJS,\n browser: codeESM,\n },\n }\n\n const startedMessage = `Deploying plugin ${chalk.bold(name)} v${version}...`\n const successMessage = 'Plugin deployed'\n if (plugin) {\n const updateBody = apiUtils.prepareUpdatePluginBody(\n {\n id: plugin.id,\n ...createBody,\n },\n plugin\n )\n\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for plugin updates. Skipping deployment...')\n } else {\n await api.client.updatePlugin(updateBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update plugin \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n } else {\n const line = this.logger.line()\n line.started(startedMessage)\n\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for plugin creation. Skipping deployment...')\n } else {\n await api.client.createPlugin(createBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not create plugin \"${name}\"`)\n })\n }\n\n line.success(successMessage)\n }\n }\n\n private _allowDeprecatedFeatures(\n integrationDef: sdk.IntegrationDefinition,\n previousVersion: client.Integration | undefined\n ): boolean {\n if (this.argv.allowDeprecated) {\n return true\n }\n\n if (!previousVersion) {\n return false\n }\n\n const versionDiff = semver.diff(integrationDef.version, previousVersion.version)\n if (!versionDiff) {\n return false\n }\n\n return utils.semver.releases.lt(versionDiff, 'major')\n }\n\n private _detectDeprecatedFeatures(\n integrationDef: sdk.IntegrationDefinition,\n opts: { allowDeprecated?: boolean } = {}\n ) {\n const deprecatedFields: string[] = []\n const { user, channels } = integrationDef\n if (user?.creation?.enabled) {\n deprecatedFields.push('user.creation')\n }\n\n for (const [channelName, channel] of Object.entries(channels ?? {})) {\n if (channel?.conversation?.creation?.enabled) {\n deprecatedFields.push(`channels.${channelName}.creation`)\n }\n }\n\n if (!deprecatedFields.length) {\n return\n }\n\n const errorMessage = `The following fields of the integration's definition are deprecated: ${deprecatedFields.join(\n ', '\n )}`\n\n if (opts.allowDeprecated) {\n this.logger.warn(errorMessage)\n } else {\n throw new errors.BotpressCLIError(errorMessage)\n }\n }\n\n private async _deployBot(\n api: apiUtils.ApiClient,\n botDefinition: sdk.BotDefinition,\n argvBotId: string | undefined,\n argvCreateNew: boolean | undefined\n ) {\n if (this.argv.dryRun) {\n this.logger.warn('Dry-run mode is not supported for bot deployments. Skipping deployment...')\n return\n }\n\n const outfile = this.projectPaths.abs.outFileCJS\n const code = await fs.promises.readFile(outfile, 'utf-8')\n\n let bot: client.Bot\n if (argvBotId && argvCreateNew) {\n throw new errors.BotpressCLIError('Cannot specify both --botId and --createNew')\n } else if (argvCreateNew) {\n const confirm = await this.prompt.confirm('Are you sure you want to create a new bot ?')\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n\n bot = await this._createNewBot(api)\n } else {\n bot = await this._getExistingBot(api, argvBotId)\n\n const confirm = await this.prompt.confirm(`Are you sure you want to deploy the bot \"${bot.name}\"?`)\n if (!confirm) {\n this.logger.log('Aborted')\n return\n }\n }\n\n const line = this.logger.line()\n line.started(`Deploying bot ${chalk.bold(bot.name)}...`)\n\n const updateBotBody = apiUtils.prepareUpdateBotBody(\n {\n ...(await apiUtils.prepareCreateBotBody(botDefinition)),\n ...(await this.prepareBotDependencies(botDefinition, api)),\n id: bot.id,\n code,\n },\n bot\n )\n\n const { bot: updatedBot } = await api.client.updateBot(updateBotBody).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not update bot \"${bot.name}\"`)\n })\n\n const tablesPublisher = new tables.TablesPublisher({ api, logger: this.logger, prompt: this.prompt })\n await tablesPublisher.deployTables({ botId: updatedBot.id, botDefinition })\n\n line.success('Bot deployed')\n this.displayWebhookUrls(updatedBot)\n }\n\n private async _createNewBot(api: apiUtils.ApiClient): Promise<client.Bot> {\n const line = this.logger.line()\n const { bot: createdBot } = await api.client.createBot({}).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not create bot')\n })\n line.success(`Bot created with ID \"${createdBot.id}\" and name \"${createdBot.name}\"`)\n await this.projectCache.set('botId', createdBot.id)\n return createdBot\n }\n\n private async _getExistingBot(api: apiUtils.ApiClient, botId: string | undefined): Promise<client.Bot> {\n const promptedBotId = await this.projectCache.sync('botId', botId, async (defaultId) => {\n const userBots = await api\n .listAllPages(api.client.listBots, (r) => r.bots)\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not fetch existing bots')\n })\n\n if (!userBots.length) {\n throw new errors.NoBotsFoundError()\n }\n\n const initial = userBots.find((bot) => bot.id === defaultId)\n\n const prompted = await this.prompt.select('Which bot do you want to deploy?', {\n initial: initial && { title: initial.name, value: initial.id },\n choices: userBots.map((bot) => ({ title: bot.name, value: bot.id })),\n })\n\n if (!prompted) {\n throw new errors.ParamRequiredError('Bot Id')\n }\n\n return prompted\n })\n\n const { bot: fetchedBot } = await api.client.getBot({ id: promptedBotId }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not get bot info')\n })\n\n return fetchedBot\n }\n\n private async _manageWorkspaceHandle(\n api: apiUtils.ApiClient,\n integration: sdk.IntegrationDefinition\n ): Promise<{\n integration: sdk.IntegrationDefinition\n workspaceId?: string // Set if user opted to deploy on another available workspace\n }> {\n const { name: localName, workspaceHandle: localHandle } = this._parseIntegrationName(integration.name)\n if (!localHandle && api.isBotpressWorkspace) {\n this.logger.debug('Botpress workspace detected; workspace handle omitted')\n return { integration } // botpress has the right to omit workspace handle\n }\n\n const { handle: remoteHandle, name: workspaceName } = await api.getWorkspace().catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not fetch workspace')\n })\n\n if (localHandle && remoteHandle) {\n let workspaceId: string | undefined = undefined\n if (localHandle !== remoteHandle) {\n const remoteWorkspace = await api.findWorkspaceByHandle(localHandle).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list workspaces')\n })\n if (!remoteWorkspace) {\n throw new errors.BotpressCLIError(\n `The integration handle \"${localHandle}\" is not associated with any of your workspaces.`\n )\n }\n this.logger.warn(\n `Your are logged in to workspace \"${workspaceName}\" but integration handle \"${localHandle}\" belongs to \"${remoteWorkspace.name}\".`\n )\n const confirmUseAlternateWorkspace = await this.prompt.confirm(\n 'Do you want to deploy integration on this workspace instead?'\n )\n if (!confirmUseAlternateWorkspace) {\n throw new errors.BotpressCLIError(\n `Cannot deploy integration with handle \"${localHandle}\" on workspace \"${workspaceName}\"`\n )\n }\n\n workspaceId = remoteWorkspace.id\n }\n return { integration, workspaceId }\n }\n\n const workspaceHandleIsMandatoryMsg = 'Cannot deploy integration without workspace handle'\n\n if (!localHandle && remoteHandle) {\n const confirmAddHandle = await this.prompt.confirm(\n `Your current workspace handle is \"${remoteHandle}\". Do you want to use the name \"${remoteHandle}/${localName}\"?`\n )\n if (!confirmAddHandle) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n const newName = `${remoteHandle}/${localName}`\n return { integration: new sdk.IntegrationDefinition({ ...integration, name: newName }) }\n }\n\n if (localHandle && !remoteHandle) {\n const { available } = await api.client.checkHandleAvailability({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not check handle availability')\n })\n\n if (!available) {\n throw new errors.BotpressCLIError(`Handle \"${localHandle}\" is not yours and is not available`)\n }\n\n const confirmClaimHandle = await this.prompt.confirm(\n `Handle \"${localHandle}\" is available. Do you want to claim it for your workspace ${workspaceName}?`\n )\n if (!confirmClaimHandle) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n await api.updateWorkspace({ handle: localHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${localHandle}\"`)\n })\n\n this.logger.success(`Handle \"${localHandle}\" is now yours!`)\n return { integration }\n }\n\n this.logger.warn(\"It seems you don't have a workspace handle yet.\")\n let claimedHandle: string | undefined = undefined\n do {\n const prompted = await this.prompt.text('Please enter a workspace handle')\n if (!prompted) {\n throw new errors.BotpressCLIError(workspaceHandleIsMandatoryMsg)\n }\n\n const { available, suggestions } = await api.client.checkHandleAvailability({ handle: prompted })\n if (!available) {\n this.logger.warn(`Handle \"${prompted}\" is not available. Suggestions: ${suggestions.join(', ')}`)\n continue\n }\n\n claimedHandle = prompted\n await api.updateWorkspace({ handle: claimedHandle }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not claim handle \"${claimedHandle}\"`)\n })\n } while (!claimedHandle)\n\n this.logger.success(`Handle \"${claimedHandle}\" is yours!`)\n const newName = `${claimedHandle}/${localName}`\n return { integration: new sdk.IntegrationDefinition({ ...integration, name: newName }) }\n }\n\n private _parseIntegrationName = (integrationName: string): { name: string; workspaceHandle?: string } => {\n const parts = integrationName.split('/')\n if (parts.length > 2) {\n throw new errors.BotpressCLIError(\n `Invalid integration name \"${integrationName}\": a single forward slash is allowed`\n )\n }\n if (parts.length === 2) {\n const [workspaceHandle, name] = parts as [string, string]\n return { name, workspaceHandle }\n }\n const [name] = parts as [string]\n return { name }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,UAAqB;AACrB,mBAAkB;AAClB,SAAoB;AACpB,oBAAmB;AACnB,eAA0B;AAE1B,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,2BAA6B;AAC7B,6BAA+B;AAGxB,MAAM,sBAAsB,sCAAwC;AAAA,EACzE,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAE3D,QAAI,CAAC,KAAK,KAAK,SAAS;AACtB,YAAM,KAAK,UAAU;AAAA,IACvB;AAEA,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,QAAI,WAAW,SAAS,eAAe;AACrC,aAAO,KAAK,mBAAmB,KAAK,WAAW,UAAU;AAAA,IAC3D;AACA,QAAI,WAAW,SAAS,aAAa;AACnC,aAAO,KAAK,iBAAiB,KAAK,WAAW,UAAU;AAAA,IACzD;AACA,QAAI,WAAW,SAAS,UAAU;AAChC,aAAO,KAAK,cAAc,KAAK,WAAW,UAAU;AAAA,IACtD;AACA,QAAI,WAAW,SAAS,OAAO;AAC7B,aAAO,KAAK,WAAW,KAAK,WAAW,YAA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GED
|
@@ -33,6 +33,7 @@ __export(validate_bot_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(validate_bot_exports);
|
|
34
34
|
var errors = __toESM(require("../errors"));
|
|
35
35
|
var utils = __toESM(require("../utils"));
|
|
36
|
+
const PLUGIN_PREFIX_SEP = "#";
|
|
36
37
|
const validateBotDefinition = (b) => {
|
|
37
38
|
const { actions, events, states } = b;
|
|
38
39
|
const invalidActionNames = _nonCamelCaseKeys(actions ?? {});
|
|
@@ -74,7 +75,10 @@ const validateBotDefinition = (b) => {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
const _nonCamelCaseKeys = (obj) => Object.keys(obj).filter((
|
|
78
|
+
const _nonCamelCaseKeys = (obj) => Object.keys(obj).filter((key) => {
|
|
79
|
+
const tokens = key.split(PLUGIN_PREFIX_SEP, 2);
|
|
80
|
+
return tokens.some((t) => !utils.casing.is.camelCase(t));
|
|
81
|
+
});
|
|
78
82
|
const _hasIntegrationDependency = (b, dep) => {
|
|
79
83
|
const integrationInstances = Object.entries(b.integrations ?? {}).map(([_k, v]) => v);
|
|
80
84
|
return integrationInstances.some(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sdk/validate-bot.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\n\ntype PackageRef = { name: string; version: string }\n\nexport const validateBotDefinition = (b: sdk.BotDefinition): void => {\n const { actions, events, states } = b\n\n const invalidActionNames = _nonCamelCaseKeys(actions ?? {})\n if (invalidActionNames.length) {\n throw new errors.BotpressCLIError(\n `The following action names are not in camelCase: ${invalidActionNames.join(', ')}`\n )\n }\n\n const invalidEventNames = _nonCamelCaseKeys(events ?? {})\n if (invalidEventNames.length) {\n throw new errors.BotpressCLIError(`The following event names are not in camelCase: ${invalidEventNames.join(', ')}`)\n }\n\n const invalidStateNames = _nonCamelCaseKeys(states ?? {})\n if (invalidStateNames.length) {\n throw new errors.BotpressCLIError(`The following state names are not in camelCase: ${invalidStateNames.join(', ')}`)\n }\n\n for (const [pluginName, plugin] of Object.entries(b.plugins ?? {})) {\n const integrationDependencies = plugin.definition.integrations ?? {}\n for (const dep of Object.values(integrationDependencies)) {\n if (!_hasIntegrationDependency(b, dep)) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on integration \"${dep.name}@${dep.version}\", but it is not present in the bot definition. Please install it.`\n )\n }\n }\n\n const interfaceDepdencies = plugin.definition.interfaces ?? {}\n for (const dep of Object.values(interfaceDepdencies)) {\n const interfaceImpl = plugin.interfaces[dep.name]\n if (!interfaceImpl) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on interface \"${dep.name}@${dep.version}\", but the bot does not specify an implementation for it.`\n )\n }\n\n if (!_hasIntegrationDependency(b, interfaceImpl)) {\n throw new errors.BotpressCLIError(\n `Integration \"${interfaceImpl.name}@${interfaceImpl.version}\" is not installed in the bot, but specified as an implementation for interface \"${dep.name}@${dep.version}\"`\n )\n }\n }\n }\n}\n\nconst _nonCamelCaseKeys = (obj: Record<string, any>): string[] =>\n Object.keys(obj).filter((
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,YAAuB;
|
|
4
|
+
"sourcesContent": ["import type * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\n\ntype PackageRef = { name: string; version: string }\n\nconst PLUGIN_PREFIX_SEP = '#'\n\nexport const validateBotDefinition = (b: sdk.BotDefinition): void => {\n const { actions, events, states } = b\n\n const invalidActionNames = _nonCamelCaseKeys(actions ?? {})\n if (invalidActionNames.length) {\n throw new errors.BotpressCLIError(\n `The following action names are not in camelCase: ${invalidActionNames.join(', ')}`\n )\n }\n\n const invalidEventNames = _nonCamelCaseKeys(events ?? {})\n if (invalidEventNames.length) {\n throw new errors.BotpressCLIError(`The following event names are not in camelCase: ${invalidEventNames.join(', ')}`)\n }\n\n const invalidStateNames = _nonCamelCaseKeys(states ?? {})\n if (invalidStateNames.length) {\n throw new errors.BotpressCLIError(`The following state names are not in camelCase: ${invalidStateNames.join(', ')}`)\n }\n\n for (const [pluginName, plugin] of Object.entries(b.plugins ?? {})) {\n const integrationDependencies = plugin.definition.integrations ?? {}\n for (const dep of Object.values(integrationDependencies)) {\n if (!_hasIntegrationDependency(b, dep)) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on integration \"${dep.name}@${dep.version}\", but it is not present in the bot definition. Please install it.`\n )\n }\n }\n\n const interfaceDepdencies = plugin.definition.interfaces ?? {}\n for (const dep of Object.values(interfaceDepdencies)) {\n const interfaceImpl = plugin.interfaces[dep.name]\n if (!interfaceImpl) {\n throw new errors.BotpressCLIError(\n `Plugin \"${pluginName}\" has a dependency on interface \"${dep.name}@${dep.version}\", but the bot does not specify an implementation for it.`\n )\n }\n\n if (!_hasIntegrationDependency(b, interfaceImpl)) {\n throw new errors.BotpressCLIError(\n `Integration \"${interfaceImpl.name}@${interfaceImpl.version}\" is not installed in the bot, but specified as an implementation for interface \"${dep.name}@${dep.version}\"`\n )\n }\n }\n }\n}\n\nconst _nonCamelCaseKeys = (obj: Record<string, any>): string[] =>\n Object.keys(obj).filter((key) => {\n const tokens: string[] = key.split(PLUGIN_PREFIX_SEP, 2)\n return tokens.some((t) => !utils.casing.is.camelCase(t))\n })\n\nconst _hasIntegrationDependency = (b: sdk.BotDefinition, dep: PackageRef): boolean => {\n const integrationInstances = Object.entries(b.integrations ?? {}).map(([_k, v]) => v)\n return integrationInstances.some(\n (integration) => integration.name === dep.name && integration.version === dep.version\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,YAAuB;AAI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Ac,QAAQ,cAAc,2FAA2F,IAAI,QAAQ,IAAI;AAAA,QACjK;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,oBAAoB,CAAC,QACzB,OAAO,KAAK,GAAG,EAAE,OAAO,CAAC,QAAQ;AAC/B,QAAM,SAAmB,IAAI,MAAM,mBAAmB,CAAC;AACvD,SAAO,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC;AACzD,CAAC;AAEH,MAAM,4BAA4B,CAAC,GAAsB,QAA6B;AACpF,QAAM,uBAAuB,OAAO,QAAQ,EAAE,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;AACpF,SAAO,qBAAqB;AAAA,IAC1B,CAAC,gBAAgB,YAAY,SAAS,IAAI,QAAQ,YAAY,YAAY,IAAI;AAAA,EAChF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var sdk = __toESM(require("@botpress/sdk"));
|
|
25
|
+
var errors = __toESM(require("../errors"));
|
|
26
|
+
var import_vitest = require("vitest");
|
|
27
|
+
var import_validate_bot = require("./validate-bot");
|
|
28
|
+
import_vitest.describe.concurrent("validateBotDefinition", () => {
|
|
29
|
+
(0, import_vitest.it)("should throw an error if action names are not in camelCase", async () => {
|
|
30
|
+
const bot = new sdk.BotDefinition({
|
|
31
|
+
actions: {
|
|
32
|
+
"invalid-action": {
|
|
33
|
+
input: { schema: sdk.z.object({}) },
|
|
34
|
+
output: { schema: sdk.z.object({}) }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).toThrowError(errors.BotpressCLIError);
|
|
39
|
+
});
|
|
40
|
+
(0, import_vitest.it)("should throw an error if event names are not in camelCase", async () => {
|
|
41
|
+
const bot = new sdk.BotDefinition({
|
|
42
|
+
events: {
|
|
43
|
+
"invalid-event": {
|
|
44
|
+
schema: sdk.z.object({})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).toThrowError(errors.BotpressCLIError);
|
|
49
|
+
});
|
|
50
|
+
(0, import_vitest.it)("should throw an error if state names are not in camelCase", async () => {
|
|
51
|
+
const bot = new sdk.BotDefinition({
|
|
52
|
+
states: {
|
|
53
|
+
"invalid-state": {
|
|
54
|
+
type: "bot",
|
|
55
|
+
schema: sdk.z.object({})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).toThrowError(errors.BotpressCLIError);
|
|
60
|
+
});
|
|
61
|
+
(0, import_vitest.it)("should allow plugin prefix in action names", async () => {
|
|
62
|
+
const bot = new sdk.BotDefinition({
|
|
63
|
+
actions: {
|
|
64
|
+
"plugin#action": {
|
|
65
|
+
input: { schema: sdk.z.object({}) },
|
|
66
|
+
output: { schema: sdk.z.object({}) }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).not.toThrowError();
|
|
71
|
+
});
|
|
72
|
+
(0, import_vitest.it)("should allow plugin prefix in event names", async () => {
|
|
73
|
+
const bot = new sdk.BotDefinition({
|
|
74
|
+
events: {
|
|
75
|
+
"plugin#event": {
|
|
76
|
+
schema: sdk.z.object({})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).not.toThrowError();
|
|
81
|
+
});
|
|
82
|
+
(0, import_vitest.it)("should allow plugin prefix in state names", async () => {
|
|
83
|
+
const bot = new sdk.BotDefinition({
|
|
84
|
+
states: {
|
|
85
|
+
"plugin#state": {
|
|
86
|
+
type: "bot",
|
|
87
|
+
schema: sdk.z.object({})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
(0, import_vitest.expect)(() => (0, import_validate_bot.validateBotDefinition)(bot)).not.toThrowError();
|
|
92
|
+
});
|
|
93
|
+
(0, import_vitest.it)("should throw an error if plugin prefix is not in camelCase", async () => {
|
|
94
|
+
(0, import_vitest.expect)(
|
|
95
|
+
() => (0, import_validate_bot.validateBotDefinition)(
|
|
96
|
+
new sdk.BotDefinition({
|
|
97
|
+
actions: {
|
|
98
|
+
"my-plugin#actionName": {
|
|
99
|
+
input: { schema: sdk.z.object({}) },
|
|
100
|
+
output: { schema: sdk.z.object({}) }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
)
|
|
105
|
+
).toThrowError(errors.BotpressCLIError);
|
|
106
|
+
(0, import_vitest.expect)(
|
|
107
|
+
() => (0, import_validate_bot.validateBotDefinition)(
|
|
108
|
+
new sdk.BotDefinition({
|
|
109
|
+
events: {
|
|
110
|
+
"my-plugin#eventName": {
|
|
111
|
+
schema: sdk.z.object({})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
)
|
|
116
|
+
).toThrowError(errors.BotpressCLIError);
|
|
117
|
+
(0, import_vitest.expect)(
|
|
118
|
+
() => (0, import_validate_bot.validateBotDefinition)(
|
|
119
|
+
new sdk.BotDefinition({
|
|
120
|
+
states: {
|
|
121
|
+
"my-plugin#stateName": {
|
|
122
|
+
type: "bot",
|
|
123
|
+
schema: sdk.z.object({})
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
)
|
|
128
|
+
).toThrowError(errors.BotpressCLIError);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=validate-bot.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sdk/validate-bot.test.ts"],
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport { describe, expect, it } from 'vitest'\nimport { validateBotDefinition } from './validate-bot'\n\ndescribe.concurrent('validateBotDefinition', () => {\n it('should throw an error if action names are not in camelCase', async () => {\n const bot = new sdk.BotDefinition({\n actions: {\n 'invalid-action': {\n input: { schema: sdk.z.object({}) },\n output: { schema: sdk.z.object({}) },\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).toThrowError(errors.BotpressCLIError)\n })\n\n it('should throw an error if event names are not in camelCase', async () => {\n const bot = new sdk.BotDefinition({\n events: {\n 'invalid-event': {\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).toThrowError(errors.BotpressCLIError)\n })\n\n it('should throw an error if state names are not in camelCase', async () => {\n const bot = new sdk.BotDefinition({\n states: {\n 'invalid-state': {\n type: 'bot',\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).toThrowError(errors.BotpressCLIError)\n })\n\n it('should allow plugin prefix in action names', async () => {\n const bot = new sdk.BotDefinition({\n actions: {\n 'plugin#action': {\n input: { schema: sdk.z.object({}) },\n output: { schema: sdk.z.object({}) },\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).not.toThrowError()\n })\n\n it('should allow plugin prefix in event names', async () => {\n const bot = new sdk.BotDefinition({\n events: {\n 'plugin#event': {\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).not.toThrowError()\n })\n\n it('should allow plugin prefix in state names', async () => {\n const bot = new sdk.BotDefinition({\n states: {\n 'plugin#state': {\n type: 'bot',\n schema: sdk.z.object({}),\n },\n },\n })\n\n expect(() => validateBotDefinition(bot)).not.toThrowError()\n })\n\n it('should throw an error if plugin prefix is not in camelCase', async () => {\n expect(() =>\n validateBotDefinition(\n new sdk.BotDefinition({\n actions: {\n 'my-plugin#actionName': {\n input: { schema: sdk.z.object({}) },\n output: { schema: sdk.z.object({}) },\n },\n },\n })\n )\n ).toThrowError(errors.BotpressCLIError)\n\n expect(() =>\n validateBotDefinition(\n new sdk.BotDefinition({\n events: {\n 'my-plugin#eventName': {\n schema: sdk.z.object({}),\n },\n },\n })\n )\n ).toThrowError(errors.BotpressCLIError)\n\n expect(() =>\n validateBotDefinition(\n new sdk.BotDefinition({\n states: {\n 'my-plugin#stateName': {\n type: 'bot',\n schema: sdk.z.object({}),\n },\n },\n })\n )\n ).toThrowError(errors.BotpressCLIError)\n })\n})\n"],
|
|
5
|
+
"mappings": ";;;;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AA,MACH;AAAA,IACF,EAAE,aAAa,OAAO,gBAAgB;AAEtC;AAAA,MAAO,UACL;AAAA,QACE,IAAI,IAAI,cAAc;AAAA,UACpB,QAAQ;AAAA,YACN,uBAAuB;AAAA,cACrB,MAAM;AAAA,cACN,QAAQ,IAAI,EAAE,OAAO,CAAC,CAAC;AAAA,YACzB;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,EAAE,aAAa,OAAO,gBAAgB;AAAA,EACxC,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run bundle && pnpm run template:gen",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
|
23
23
|
"@botpress/chat": "0.5.1",
|
|
24
|
-
"@botpress/client": "0.
|
|
25
|
-
"@botpress/sdk": "3.
|
|
24
|
+
"@botpress/client": "0.48.0",
|
|
25
|
+
"@botpress/sdk": "3.5.0",
|
|
26
26
|
"@bpinternal/const": "^0.1.0",
|
|
27
27
|
"@bpinternal/tunnel": "^0.1.1",
|
|
28
28
|
"@bpinternal/yargs-extra": "^0.0.3",
|
|
@@ -7,12 +7,14 @@ import * as events from './events'
|
|
|
7
7
|
import * as states from './states'
|
|
8
8
|
import * as actions from './actions'
|
|
9
9
|
import * as tables from './tables/index'
|
|
10
|
+
import * as workflows from './workflows'
|
|
10
11
|
|
|
11
12
|
export * as integrations from './integrations/index'
|
|
12
13
|
export * as events from './events/index'
|
|
13
14
|
export * as states from './states/index'
|
|
14
15
|
export * as actions from './actions'
|
|
15
16
|
export * as tables from './tables/index'
|
|
17
|
+
export * as workflows from './workflows'
|
|
16
18
|
|
|
17
19
|
export type TBot = {
|
|
18
20
|
integrations: integrations.Integrations
|
|
@@ -20,4 +22,5 @@ export type TBot = {
|
|
|
20
22
|
states: states.States
|
|
21
23
|
actions: actions.Actions
|
|
22
24
|
tables: tables.Tables
|
|
25
|
+
workflows: workflows.Workflows
|
|
23
26
|
}
|
|
@@ -9,6 +9,7 @@ import * as events from './events'
|
|
|
9
9
|
import * as states from './states'
|
|
10
10
|
import * as actions from './actions'
|
|
11
11
|
import * as tables from './tables/index'
|
|
12
|
+
import * as workflows from './workflows'
|
|
12
13
|
|
|
13
14
|
export * as integrations from './integrations/index'
|
|
14
15
|
export * as interfaces from './interfaces/index'
|
|
@@ -17,8 +18,11 @@ export * as events from './events/index'
|
|
|
17
18
|
export * as states from './states/index'
|
|
18
19
|
export * as actions from './actions'
|
|
19
20
|
export * as tables from './tables/index'
|
|
21
|
+
export * as workflows from './workflows'
|
|
20
22
|
|
|
21
23
|
export type TPlugin = {
|
|
24
|
+
name: "empty-plugin"
|
|
25
|
+
version: "1.0.0"
|
|
22
26
|
integrations: integrations.Integrations
|
|
23
27
|
interfaces: interfaces.Interfaces
|
|
24
28
|
configuration: configuration.Configuration
|
|
@@ -26,4 +30,5 @@ export type TPlugin = {
|
|
|
26
30
|
states: states.States
|
|
27
31
|
actions: actions.Actions
|
|
28
32
|
tables: tables.Tables
|
|
33
|
+
workflows: workflows.Workflows
|
|
29
34
|
}
|