@botpress/cli 4.17.13 → 4.17.14
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/api/client.js +2 -1
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.js +9 -0
- package/dist/chat/index.js +1 -1
- package/dist/chat/index.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-implementation.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-typings/actions-module.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-typings/index.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-typings/tables-module.js.map +1 -1
- package/dist/code-generation/bot-implementation/bot-typings/workflows-module.js.map +1 -1
- package/dist/code-generation/bot-implementation/index.js.map +1 -1
- package/dist/code-generation/consts.js +2 -1
- package/dist/code-generation/generators.js.map +1 -1
- package/dist/code-generation/index.js +2 -1
- package/dist/code-generation/integration-implementation/index.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-implementation.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-secret.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/index.js.map +1 -1
- package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +1 -1
- package/dist/code-generation/integration-package/index.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/index.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/interfaces-module.js.map +1 -1
- package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +1 -1
- package/dist/code-generation/interface-implementation/integration-typings/actions-module.js.map +1 -1
- package/dist/code-generation/interface-implementation/integration-typings/channels-module.js.map +1 -1
- package/dist/code-generation/interface-implementation/integration-typings/entities-module.js.map +1 -1
- package/dist/code-generation/interface-implementation/integration-typings/events-module.js.map +1 -1
- package/dist/code-generation/interface-implementation/integration-typings/index.js.map +1 -1
- package/dist/code-generation/interface-package/index.js.map +1 -1
- package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +1 -1
- package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +1 -1
- package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +1 -1
- package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +1 -1
- package/dist/code-generation/interface-package/interface-package-definition/index.js.map +1 -1
- package/dist/code-generation/module.js +2 -2
- package/dist/code-generation/module.js.map +2 -2
- package/dist/code-generation/plugin-implementation/index.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-implementation.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-typings/tables-module.js.map +1 -1
- package/dist/code-generation/plugin-implementation/plugin-typings/workflows-module.js.map +1 -1
- package/dist/code-generation/plugin-package/index.js.map +1 -1
- package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +1 -1
- package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +1 -1
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +1 -1
- package/dist/code-generation/plugin-package/plugin-package-definition/interfaces-module.js.map +1 -1
- package/dist/code-generation/plugin-package/plugin-package-definition/recurring-events-module.js.map +1 -1
- package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js.map +1 -1
- package/dist/code-generation/strings.js.map +1 -1
- package/dist/command-definitions.js +0 -2
- package/dist/command-implementations/add-command.js.map +1 -1
- package/dist/command-implementations/base-command.js.map +1 -1
- package/dist/command-implementations/bot-commands.js.map +1 -1
- package/dist/command-implementations/build-command.js +4 -4
- package/dist/command-implementations/build-command.js.map +2 -2
- package/dist/command-implementations/bundle-command.js +8 -7
- package/dist/command-implementations/bundle-command.js.map +2 -2
- package/dist/command-implementations/chat-command.js.map +1 -1
- package/dist/command-implementations/deploy-command.js +1 -2
- package/dist/command-implementations/deploy-command.js.map +1 -1
- package/dist/command-implementations/dev-command.js +6 -1
- package/dist/command-implementations/dev-command.js.map +2 -2
- package/dist/command-implementations/gen-command.js.map +1 -1
- package/dist/command-implementations/global-command.js.map +1 -1
- package/dist/command-implementations/index.js +0 -2
- package/dist/command-implementations/init-command.js.map +1 -1
- package/dist/command-implementations/integration-commands.js.map +1 -1
- package/dist/command-implementations/interface-commands.js.map +1 -1
- package/dist/command-implementations/login-command.js +1 -2
- package/dist/command-implementations/login-command.js.map +1 -1
- package/dist/command-implementations/plugin-commands.js.map +1 -1
- package/dist/command-implementations/profile-commands.js +1 -2
- package/dist/command-implementations/profile-commands.js.map +1 -1
- package/dist/command-implementations/project-command.js.map +1 -1
- package/dist/command-implementations/serve-command.js.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/linter/base-linter.js.map +1 -1
- package/dist/linter/base-linter.test.js +4 -4
- package/dist/linter/base-linter.test.js.map +1 -1
- package/dist/linter/rulesets/bot.ruleset.js.map +1 -1
- package/dist/linter/rulesets/integration.ruleset.js.map +1 -1
- package/dist/linter/rulesets/interface.ruleset.js.map +1 -1
- package/dist/logger/base-logger.js.map +1 -1
- package/dist/logger/index.js.map +1 -1
- package/dist/package-ref.js.map +1 -1
- package/dist/package-ref.test.js.map +1 -1
- package/dist/register-yargs.js.map +1 -1
- package/dist/sdk/index.js +5 -0
- package/dist/sdk/validate-bot.js.map +1 -1
- package/dist/sdk/validate-integration.js.map +1 -1
- package/dist/tables/tables-publisher.js.map +1 -1
- package/dist/utils/case-utils.test.js.map +1 -1
- package/dist/utils/esbuild-utils.js +32 -1
- package/dist/utils/esbuild-utils.js.map +3 -3
- package/dist/utils/file-watcher.js.map +1 -1
- package/dist/utils/prompt-utils.js.map +1 -1
- package/dist/utils/require-utils.js.map +1 -1
- package/dist/utils/require-utils.test.js.map +1 -1
- package/dist/utils/tunnel-utils.js.map +1 -1
- package/dist/utils/url-utils.js.map +1 -1
- package/dist/worker/child-entrypoint.js.map +1 -1
- package/dist/worker/child-wrapper.js.map +1 -1
- package/dist/worker/is-child.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-implementation/plugin-typings/index.ts"],
|
|
4
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;AACxB,iCAAyC;AACzC,sCAAuC;AACvC,oBAA6D;AAC7D,4BAA8B;AAC9B,kCAA2C;AAC3C,2BAA6B;AAC7B,2BAA6B;AAC7B,2BAA6B;AAC7B,8BAAgC;AAEhC,MAAM,iCAAiC,iCAAmB;AAAA,EACjD,YAAY,QAA8B;AAC/C,UAAM;AAAA,MACJ,YAAY;AAAA,IACd,CAAC;AAED,eAAW,CAAC,OAAO,WAAW,KAAK,OAAO,QAAQ,OAAO,gBAAgB,CAAC,CAAC,GAAG;AAC5E,YAAM,oBAAoB,IAAI,oDAAyB,YAAY,UAAU;AAC7E,wBAAkB,QAAQ,KAAK;AAC/B,WAAK,QAAQ,iBAAiB;AAAA,IAChC;AAAA,EACF;AACF;AAEA,MAAM,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,aAAa,IAAI,IAAI,aAAa,UAAU;AAAA,MACzD,gBAAgB,gBAAgB,IAAI,IAAI,gBAAgB,UAAU;AAAA,MAClE;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-implementation/plugin-typings/states-module.ts"],
|
|
4
4
|
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport * as gen from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nexport class StatePayloadModule extends Module {\n public constructor(private _state: sdk.BotStateDefinition) {\n super({\n path: 'payload.ts',\n exportName: strings.typeName('Payload'),\n })\n }\n\n public async getContent() {\n return gen.zuiSchemaToTypeScriptType(this._state.schema, 'Payload')\n }\n}\n\nexport class StateModule extends Module {\n private _payloadModule: StatePayloadModule\n\n public constructor(\n private _name: string,\n private _state: sdk.BotStateDefinition\n ) {\n super({\n path: consts.INDEX_FILE,\n exportName: strings.typeName(_name),\n })\n\n this._payloadModule = new StatePayloadModule(_state)\n this.pushDep(this._payloadModule)\n }\n\n public async getContent(): Promise<string> {\n const { _payloadModule } = this\n const payloadImport = _payloadModule.import(this)\n\n const exportName = strings.typeName(this._name)\n\n return [\n consts.GENERATED_HEADER,\n `import * as ${_payloadModule.name} from './${payloadImport}'`,\n `export type ${exportName} = {`,\n ` type: ${gen.primitiveToTypescriptValue(this._state.type)},`,\n ` payload: ${_payloadModule.name}.${_payloadModule.exportName}`,\n '}',\n ].join('\\n')\n }\n}\n\nexport class StatesModule extends ReExportTypeModule {\n public constructor(states: Record<string, sdk.BotStateDefinition>) {\n super({ exportName: strings.typeName('states') })\n for (const [stateName, state] of Object.entries(states)) {\n const module = new StateModule(stateName, state)\n module.unshift(stateName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
-
"m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AAEO,MAAM,oBAAoB,qBAAO;AAAA,EAG/B,YACG,OACA,QACR;AACA,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,QAAQ,SAAS,KAAK;AAAA,IACpC,CAAC;AANO;AACA;AAOR,SAAK,iBAAiB,IAAI,mBAAmB,MAAM;AACnD,SAAK,QAAQ,KAAK,cAAc;AAAA,EAClC;AAAA,EAbQ;AAAA,EAeR,MAAa,aAA8B;AACzC,UAAM,EAAE,eAAe,IAAI;AAC3B,UAAM,gBAAgB,eAAe,OAAO,IAAI;AAEhD,UAAM,aAAa,QAAQ,SAAS,KAAK,KAAK;AAE9C,WAAO;AAAA,MACL,OAAO;AAAA,MACP,eAAe,eAAe,IAAI,YAAY,aAAa;AAAA,MAC3D,eAAe,UAAU;AAAA,MACzB,WAAW,IAAI,2BAA2B,KAAK,OAAO,IAAI,CAAC;AAAA,MAC3D,cAAc,eAAe,IAAI,IAAI,eAAe,UAAU;AAAA,MAC9D;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EAC5C,YAAY,QAAgD;AACjE,UAAM,EAAE,YAAY,QAAQ,SAAS,QAAQ,EAAE,CAAC;AAChD,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,MAAAA,QAAO,QAAQ,SAAS;AACxB,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["module"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-implementation/plugin-typings/tables-module.ts"],
|
|
4
4
|
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nexport class TableModule extends Module {\n public constructor(\n name: string,\n private _table: sdk.BotTableDefinition\n ) {\n super({\n path: `${name}.ts`,\n exportName: strings.typeName(name),\n })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._table.schema, this.exportName)\n }\n}\n\nexport class TablesModule extends ReExportTypeModule {\n public constructor(tables: Record<string, sdk.BotTableDefinition>) {\n super({ exportName: strings.typeName('tables') })\n for (const [tableName, table] of Object.entries(tables)) {\n const module = new TableModule(tableName, table)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAElB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAElB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG,IAAI;AAAA,MACb,YAAY,QAAQ,SAAS,IAAI;AAAA,IACnC,CAAC;AALO;AAAA,EAMV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EACtE;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EAC5C,YAAY,QAAgD;AACjE,UAAM,EAAE,YAAY,QAAQ,SAAS,QAAQ,EAAE,CAAC;AAChD,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["module"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-implementation/plugin-typings/workflows-module.ts"],
|
|
4
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,
|
|
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,IAAI,OAAO,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,IAAI,OAAO,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,IAAI,OAAO,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,CAAC,UAAU,EACjE,KAAK,IAAI;AAEZ,WAAO,eAAe,KAAK,UAAU,QAAQ,IAAI;AAAA,EACnD;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
6
|
"names": ["module"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/code-generation/plugin-package/index.ts"],
|
|
4
4
|
"sourcesContent": ["import _ from 'lodash'\nimport * as consts from '../consts'\nimport * as gen from '../generators'\nimport * as mod from '../module'\nimport * as types from '../typings'\nimport { PluginPackageDefinitionModule } from './plugin-package-definition'\n\nclass ImplementationModule extends mod.Module {\n public constructor(private _implementationCode: string) {\n super({\n path: 'implementation.ts',\n exportName: 'default',\n })\n }\n\n public async getContent(): Promise<string> {\n const base64Str = Buffer.from(this._implementationCode).toString('base64')\n const chunks: string[] = _.chunk(base64Str, 80).map((chunk) => chunk.join(''))\n\n return [\n //\n 'export default Buffer.from([',\n ...chunks.map((chunk) => ` \"${chunk}\",`),\n '].join(\"\"), \"base64\")',\n ].join('\\n')\n }\n}\n\nclass PluginModule extends mod.Module {\n private _implModule: ImplementationModule\n private _defModule: PluginPackageDefinitionModule\n\n public constructor(private _pkg: types.PluginInstallablePackage) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n this._implModule = new ImplementationModule(this._pkg.code)\n this.pushDep(this._implModule)\n\n this._defModule = new PluginPackageDefinitionModule(this._pkg.plugin)\n this._defModule.unshift('definition')\n this.pushDep(this._defModule)\n }\n\n public async getContent(): Promise<string> {\n const implImport = this._implModule.import(this)\n const defImport = this._defModule.import(this)\n\n const id = this._pkg.plugin.id\n const uri = this._pkg.path\n\n const tsId = gen.primitiveToTypescriptValue(id)\n const tsUri = gen.primitiveToTypescriptValue(uri)\n const tsName = gen.primitiveToTypescriptValue(this._pkg.name)\n const tsVersion = gen.primitiveToTypescriptValue(this._pkg.version)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import definition from \"./${defImport}\"`,\n `import implementation from \"./${implImport}\"`,\n '',\n 'export default {',\n ' type: \"plugin\",',\n ` id: ${tsId},`,\n ` uri: ${tsUri},`,\n ` name: ${tsName},`,\n ` version: ${tsVersion},`,\n ' definition,',\n ' implementation,',\n '} satisfies sdk.PluginPackage',\n ].join('\\n')\n }\n}\n\nexport const generatePluginPackage = async (pkg: types.PluginInstallablePackage): Promise<types.File[]> => {\n const module = new PluginModule(pkg)\n return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|
"sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/actions-module.ts"],
|
|
4
4
|
"sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\ntype ActionInput = types.ActionDefinition['input']\ntype ActionOutput = types.ActionDefinition['output']\n\nexport class ActionInputModule extends Module {\n public constructor(private _input: ActionInput) {\n const name = 'input'\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._input.schema, this.exportName)\n }\n}\n\nexport class ActionOutputModule extends Module {\n public constructor(private _output: ActionOutput) {\n const name = 'output'\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._output.schema, this.exportName)\n }\n}\n\nexport class ActionModule extends ReExportVariableModule {\n public constructor(actionName: string, action: types.ActionDefinition) {\n super({\n exportName: strings.varName(actionName),\n extraProps: {\n ...gen.primitiveRecordToTypescriptValues({\n title: action.title,\n description: action.description,\n }),\n ...(action.attributes ? { attributes: gen.stringifySingleLine(action.attributes) } : undefined),\n },\n })\n\n const inputModule = new ActionInputModule(action.input)\n const outputModule = new ActionOutputModule(action.output)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n }\n}\n\nexport class ActionsModule extends ReExportVariableModule {\n public constructor(actions: Record<string, types.ActionDefinition>) {\n super({ exportName: strings.varName('actions') })\n for (const [actionName, action] of Object.entries(actions)) {\n const module = new ActionModule(actionName, action)\n module.unshift(actionName)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAMlB,MAAM,0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,eAAe,IAAI,mBAAmB,OAAO,MAAM;AAEzD,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AAAA,EAC3B;AACF;AAEO,MAAM,sBAAsB,qCAAuB;AAAA,EACjD,YAAY,SAAiD;AAClE,UAAM,EAAE,YAAY,QAAQ,QAAQ,SAAS,EAAE,CAAC;AAChD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC1D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,MAAAA,QAAO,QAAQ,UAAU;AACzB,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["module"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/events-module.ts"],
|
|
4
4
|
"sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._event.schema, this.exportName, {\n ...gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n }),\n ...(this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : undefined),\n })\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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../../src/code-generation/plugin-package/plugin-package-definition/index.ts"],
|
|
4
4
|
"sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { RecurringEventsModule } from './recurring-events-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype PluginPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n actionsModule: ActionsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n interfacesModule: InterfacesModule\n recurringEventsModule: RecurringEventsModule\n}\n\nexport class PluginPackageDefinitionModule extends Module {\n private _dependencies: PluginPackageModuleDependencies\n\n public constructor(private _plugin: types.PluginDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_plugin.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const actionsModule = new ActionsModule(_plugin.actions ?? {})\n actionsModule.unshift('actions')\n\n const eventsModule = new EventsModule(_plugin.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_plugin.states ?? {})\n statesModule.unshift('states')\n\n const interfacesModule = new InterfacesModule(_plugin.dependencies?.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n const recurringEventsModule = new RecurringEventsModule(_plugin.recurringEvents ?? {})\n recurringEventsModule.unshift('recurringEvents')\n\n this._dependencies = {\n defaultConfigModule,\n actionsModule,\n eventsModule,\n statesModule,\n interfacesModule,\n recurringEventsModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { defaultConfigModule, actionsModule, eventsModule, statesModule, interfacesModule, recurringEventsModule } =\n this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const actionsImport = actionsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n const recurringEventsImport = recurringEventsModule.import(this)\n\n const user = {\n tags: this._plugin.user?.tags ?? {},\n }\n\n const conversation = {\n tags: this._plugin.conversation?.tags ?? {},\n }\n\n const pluginAttributes = this._plugin.attributes ? stringifySingleLine(this._plugin.attributes) : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `import * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._plugin.name}\",`,\n ` version: \"${this._plugin.version}\",`,\n ` attributes: ${pluginAttributes},`,\n ` user: ${stringifySingleLine(user)},`,\n ` conversation: ${stringifySingleLine(conversation)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n ` recurringEvents: ${recurringEventsModule.name}.${recurringEventsModule.exportName},`,\n '} satisfies sdk.PluginPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|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;AAAA,MACxD,eAAe,iBAAiB,IAAI,YAAY,gBAAgB;AAAA,MAChE,eAAe,sBAAsB,IAAI,YAAY,qBAAqB;AAAA,MAC1E,eAAe,oBAAoB,IAAI,YAAY,mBAAmB;AAAA,MACtE,eAAe,cAAc,IAAI,YAAY,aAAa;AAAA,MAC1D,eAAe,aAAa,IAAI,YAAY,YAAY;AAAA,MACxD,eAAe,aAAa,IAAI,YAAY,YAAY;AAAA,MACxD,eAAe,iBAAiB,IAAI,YAAY,gBAAgB;AAAA,MAChE,eAAe,sBAAsB,IAAI,YAAY,qBAAqB;AAAA,MAC1E;AAAA,MACA;AAAA,MACA,YAAY,KAAK,QAAQ,IAAI;AAAA,MAC7B,eAAe,KAAK,QAAQ,OAAO;AAAA,MACnC,iBAAiB,gBAAgB;AAAA,MACjC,eAAW,uCAAoB,IAAI,CAAC;AAAA,MACpC,uBAAmB,uCAAoB,YAAY,CAAC;AAAA,MACpD,oBAAoB,oBAAoB,IAAI,IAAI,oBAAoB,UAAU;AAAA,MAC9E,cAAc,cAAc,IAAI,IAAI,cAAc,UAAU;AAAA,MAC5D,aAAa,aAAa,IAAI,IAAI,aAAa,UAAU;AAAA,MACzD,aAAa,aAAa,IAAI,IAAI,aAAa,UAAU;AAAA,MACzD,iBAAiB,iBAAiB,IAAI,IAAI,iBAAiB,UAAU;AAAA,MACrE,sBAAsB,sBAAsB,IAAI,IAAI,sBAAsB,UAAU;AAAA,MACpF;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/code-generation/plugin-package/plugin-package-definition/interfaces-module.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/interfaces-module.ts"],
|
|
4
4
|
"sourcesContent": ["import * as consts from '../../consts'\nimport * as mod from '../../module'\nimport * as types from './typings'\n\nexport class InterfacesModule extends mod.Module {\n public constructor(private _interfaces: Record<string, types.InterfaceDefinition>) {\n super({ exportName: 'interfaces', path: 'index.ts' })\n }\n\n public async getContent() {\n return [\n consts.GENERATED_HEADER,\n 'export const interfaces = {',\n ...Object.entries(this._interfaces).map(([k, { id, name, version }]) => {\n const keyStr = JSON.stringify(k)\n const valueStr = JSON.stringify({ id, name, version })\n return ` [${keyStr}]: ${valueStr},`\n }),\n '}',\n ].join('\\n')\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,UAAqB;AAGd,MAAM,yBAAyB,IAAI,OAAO;AAAA,EACxC,YAAoB,aAAwD;AACjF,UAAM,EAAE,YAAY,cAAc,MAAM,WAAW,CAAC;AAD3B;AAAA,EAE3B;AAAA,EAEA,MAAa,aAAa;AACxB,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,GAAG,OAAO,QAAQ,KAAK,WAAW,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,MAAM,QAAQ,CAAC,MAAM;AACtE,cAAM,SAAS,KAAK,UAAU,CAAC;AAC/B,cAAM,WAAW,KAAK,UAAU,EAAE,IAAI,MAAM,QAAQ,CAAC;AACrD,eAAO,MAAM,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,UAAqB;AAGd,MAAM,yBAAyB,IAAI,OAAO;AAAA,EACxC,YAAoB,aAAwD;AACjF,UAAM,EAAE,YAAY,cAAc,MAAM,WAAW,CAAC;AAD3B;AAAA,EAE3B;AAAA,EAEA,MAAa,aAAa;AACxB,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,GAAG,OAAO,QAAQ,KAAK,WAAW,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,MAAM,QAAQ,CAAC,MAAM;AACtE,cAAM,SAAS,KAAK,UAAU,CAAC;AAC/B,cAAM,WAAW,KAAK,UAAU,EAAE,IAAI,MAAM,QAAQ,CAAC;AACrD,eAAO,MAAM,MAAM,MAAM,QAAQ;AAAA,MACnC,CAAC;AAAA,MACD;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/code-generation/plugin-package/plugin-package-definition/recurring-events-module.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/recurring-events-module.ts"],
|
|
4
4
|
"sourcesContent": ["import * as prettier from 'prettier'\nimport * as consts from '../../consts'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as commonTypes from '../../typings'\n\nclass RecurringEventModule extends Module {\n public constructor(\n name: string,\n private _event: commonTypes.RecurringEventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent(): Promise<string> {\n const code = [\n consts.GENERATED_HEADER,\n `export const ${this.exportName} = {`,\n ` type: ${gen.primitiveToTypescriptValue(this._event.type)},`,\n ` schedule: ${gen.stringifySingleLine(this._event.schedule)},`,\n ` payload: ${gen.primitiveRecordToRecordString(this._event.payload)}`,\n '}',\n ].join('\\n')\n return await prettier.format(code, { parser: 'typescript' })\n }\n}\n\nexport class RecurringEventsModule extends ReExportVariableModule {\n public constructor(recurringEvents: Exclude<commonTypes.PluginDefinition['recurringEvents'], undefined>) {\n super({ exportName: strings.varName('recurringEvents') })\n for (const [eventName, event] of Object.entries(recurringEvents)) {\n const module = new RecurringEventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAA0B;AAC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
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/states-module.ts"],
|
|
4
4
|
"sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class StateModule extends Module {\n public constructor(\n name: string,\n private _state: types.StateDefinition\n ) {\n super({\n path: `${name}.ts`,\n exportName: strings.varName(name),\n })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._state.schema, this.exportName, {\n type: `\"${this._state.type}\" as const`,\n ...gen.primitiveRecordToTypescriptValues({\n title: this._state.title,\n description: this._state.description,\n }),\n })\n }\n}\n\nexport class StatesModule extends ReExportVariableModule {\n public constructor(states: Record<string, types.StateDefinition>) {\n super({ exportName: strings.varName('states') })\n for (const [stateName, state] of Object.entries(states)) {\n const module = new StateModule(stateName, state)\n this.pushDep(module)\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG,IAAI;AAAA,MACb,YAAY,QAAQ,QAAQ,IAAI;AAAA,IAClC,CAAC;AALO;AAAA,EAMV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,YAAY;AAAA,MAC1E,MAAM,IAAI,KAAK,OAAO,IAAI;AAAA,MAC1B,GAAG,IAAI,kCAAkC;AAAA,QACvC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["module"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/code-generation/strings.ts"],
|
|
4
4
|
"sourcesContent": ["import * as utils from '../utils'\ntype StrTransform = (str: string) => string\n\nconst TYPESCRIPT_RESERVED_TOKENS = new Set([\n 'break',\n 'as',\n 'any',\n 'case',\n 'implements',\n 'boolean',\n 'catch',\n 'interface',\n 'constructor',\n 'class',\n 'let',\n 'declare',\n 'const',\n 'package',\n 'get',\n 'continue',\n 'private',\n 'module',\n 'debugger',\n 'protected',\n 'require',\n 'default',\n 'public',\n 'number',\n 'delete',\n 'static',\n 'set',\n 'do',\n 'yield',\n 'string',\n 'else',\n 'symbol',\n 'enum',\n 'type',\n 'export',\n 'from',\n 'extends',\n 'of',\n 'false',\n 'finally',\n 'for',\n 'function',\n 'if',\n 'import',\n 'in',\n 'instanceof',\n 'new',\n 'null',\n 'return',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'while',\n 'with',\n])\n\nconst SPECIAL_FILE_NAME_CHARS = /[^a-zA-Z0-9_\\-\\.]/g\n\nconst escapeTypescriptReserved = (str: string): string => {\n if (TYPESCRIPT_RESERVED_TOKENS.has(str)) {\n return `_${str}`\n }\n return str\n}\n\nconst escapeFileNameSpecialChars = (str: string): string => str.replace(SPECIAL_FILE_NAME_CHARS, '-')\n\nconst apply = (str: string, ...transforms: StrTransform[]) => transforms.reduce((acc, transform) => transform(acc), str)\n\nexport const typeName = (name: string) => apply(name, utils.casing.to.pascalCase)\nexport const importAlias = (name: string) => apply(name, utils.casing.to.camelCase, escapeTypescriptReserved)\nexport const varName = (name: string) => apply(name, utils.casing.to.camelCase, escapeTypescriptReserved)\nexport const fileName = (name: string) => apply(name, escapeFileNameSpecialChars)\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAGvB,MAAM,6BAA6B,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AAC,KAAK,cAAc,UAAU,GAAG,GAAG,GAAG;AAEhH,MAAM,WAAW,CAAC,SAAiB,MAAM,MAAM,MAAM,OAAO,GAAG,UAAU;AACzE,MAAM,cAAc,CAAC,SAAiB,MAAM,MAAM,MAAM,OAAO,GAAG,WAAW,wBAAwB;AACrG,MAAM,UAAU,CAAC,SAAiB,MAAM,MAAM,MAAM,OAAO,GAAG,WAAW,wBAAwB;AACjG,MAAM,WAAW,CAAC,SAAiB,MAAM,MAAM,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/add-command.ts"],
|
|
4
4
|
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as fslib from 'fs'\nimport * as pathlib from 'path'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport * as pkgRef from '../package-ref'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\nimport { ProjectCache, ProjectCommand, ProjectCommandDefinition, ProjectDefinition } from './project-command'\n\ntype InstallablePackage =\n | {\n type: 'integration'\n pkg: codegen.IntegrationInstallablePackage\n }\n | {\n type: 'interface'\n pkg: codegen.InterfaceInstallablePackage\n }\n | {\n type: 'plugin'\n pkg: codegen.PluginInstallablePackage\n }\n\nexport type AddCommandDefinition = typeof commandDefinitions.add\nexport class AddCommand extends GlobalCommand<AddCommandDefinition> {\n public async run(): Promise<void> {\n const ref = this._parseArgvRef()\n if (ref) {\n return await this._addSinglePackage(ref)\n }\n\n const pkgJson = await utils.pkgJson.readPackageJson(this.argv.installPath)\n if (!pkgJson) {\n this.logger.warn('No package.json found in the install path')\n return\n }\n\n const { bpDependencies } = pkgJson\n if (!bpDependencies) {\n this.logger.log('No bp dependencies found in package.json')\n return\n }\n\n const bpDependenciesSchema = sdk.z.record(sdk.z.string())\n const parseResults = bpDependenciesSchema.safeParse(bpDependencies)\n if (!parseResults.success) {\n throw new errors.BotpressCLIError('Invalid bpDependencies found in package.json')\n }\n\n for (const [pkgAlias, pkgRefStr] of Object.entries(parseResults.data)) {\n const parsed = pkgRef.parsePackageRef(pkgRefStr)\n if (!parsed) {\n throw new errors.InvalidPackageReferenceError(pkgRefStr)\n }\n\n await this._addSinglePackage({ ...parsed, alias: pkgAlias })\n }\n }\n\n private _parseArgvRef = (): pkgRef.PackageRef | undefined => {\n if (!this.argv.packageRef) {\n return\n }\n\n const parsed = pkgRef.parsePackageRef(this.argv.packageRef)\n if (!parsed) {\n throw new errors.InvalidPackageReferenceError(this.argv.packageRef)\n }\n\n if (parsed.type !== 'name') {\n return parsed\n }\n\n const argvPkgType = this.argv.packageType\n if (!argvPkgType) {\n return parsed\n }\n\n const ref = { ...parsed, pkg: argvPkgType }\n\n const strRef = pkgRef.formatPackageRef(ref)\n this.logger.warn(`argument --packageType is deprecated; please use the package reference format \"${strRef}\"`)\n\n return ref\n }\n\n private async _addSinglePackage(ref: pkgRef.PackageRef & { alias?: string }): Promise<void> {\n const targetPackage = ref.type === 'path' ? await this._findLocalPackage(ref) : await this._findRemotePackage(ref)\n\n if (!targetPackage) {\n const strRef = pkgRef.formatPackageRef(ref)\n throw new errors.BotpressCLIError(`Could not find package \"${strRef}\"`)\n }\n\n const packageName = ref.alias ?? targetPackage.pkg.name\n const baseInstallPath = utils.path.absoluteFrom(utils.path.cwd(), this.argv.installPath)\n const packageDirName = utils.casing.to.kebabCase(packageName)\n const installPath = utils.path.join(baseInstallPath, consts.installDirName, packageDirName)\n\n const alreadyInstalled = fslib.existsSync(installPath)\n if (alreadyInstalled) {\n this.logger.warn(`Package with name \"${packageName}\" already installed.`)\n const res = await this.prompt.confirm('Do you want to overwrite the existing package?')\n if (!res) {\n this.logger.log('Aborted')\n return\n }\n\n await this._uninstall(installPath)\n }\n\n if (ref.type === 'name' && ref.version === pkgRef.LATEST_TAG) {\n // If the semver version expression is 'latest', we assume the project\n // is compatible with all versions of the latest major:\n const major = semver.major(targetPackage.pkg.version)\n targetPackage.pkg.version = `>=${major}.0.0 <${major + 1}.0.0`\n\n this.logger.log(\n `Dependency \"${packageName}\" will be installed with version \"${targetPackage.pkg.version}\". ` +\n `To pin a specific version or version range, please change \"${targetPackage.type}:${packageName}@latest\" ` +\n 'to a specific version number or range instead of \"latest\".'\n )\n } else if (ref.type === 'name') {\n // Preserve the semver version expression in the generated code:\n targetPackage.pkg.version = ref.version\n }\n\n let files: codegen.File[]\n if (targetPackage.type === 'integration') {\n files = await codegen.generateIntegrationPackage(targetPackage.pkg)\n } else if (targetPackage.type === 'interface') {\n files = await codegen.generateInterfacePackage(targetPackage.pkg)\n } else if (targetPackage.type === 'plugin') {\n files = await codegen.generatePluginPackage(targetPackage.pkg)\n } else {\n type _assertion = utils.types.AssertNever<typeof targetPackage>\n throw new errors.BotpressCLIError('Invalid package type')\n }\n\n await this._install(installPath, files)\n }\n\n private async _findRemotePackage(ref: pkgRef.ApiPackageRef): Promise<InstallablePackage | undefined> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n if (this._pkgCouldBe(ref, 'integration')) {\n const integration = await api.findPublicOrPrivateIntegration(ref)\n if (integration) {\n const { name, version } = integration\n return { type: 'integration', pkg: { integration, name, version } }\n }\n }\n if (this._pkgCouldBe(ref, 'interface')) {\n const intrface = await api.findPublicOrPrivateInterface(ref)\n if (intrface) {\n const { name, version } = intrface\n return { type: 'interface', pkg: { interface: intrface, name, version } }\n }\n }\n if (this._pkgCouldBe(ref, 'plugin')) {\n const plugin = await api.findPublicOrPrivatePlugin(ref)\n if (plugin) {\n const { code } = plugin.public\n ? await api.client.getPublicPluginCode({ id: plugin.id, platform: 'node' })\n : await api.client.getPluginCode({ id: plugin.id, platform: 'node' })\n const { name, version } = plugin\n return {\n type: 'plugin',\n pkg: {\n name,\n version,\n plugin,\n code,\n },\n }\n }\n }\n return\n }\n\n private async _findLocalPackage(ref: pkgRef.LocalPackageRef): Promise<InstallablePackage | undefined> {\n const absPath = utils.path.absoluteFrom(utils.path.cwd(), ref.path)\n const {\n definition: projectDefinition,\n implementation: projectImplementation,\n devId: projectDevId,\n } = await this._readProject(absPath)\n\n if (projectDefinition?.type === 'integration') {\n const { name, version } = projectDefinition.definition\n let devId: string | undefined\n if (this.argv.useDev && projectDevId) {\n this.logger.warn(`Installing integration \"${name}\" with dev version \"${projectDevId}\"`)\n devId = projectDevId\n }\n\n let createIntegrationReqBody = await this._getProjectCmd(ref.path).prepareCreateIntegrationBody(\n projectDefinition.definition\n )\n createIntegrationReqBody = {\n ...createIntegrationReqBody,\n interfaces: utils.records.mapValues(projectDefinition.definition.interfaces ?? {}, (i) => ({\n id: '', // TODO: do this better\n ...i,\n })),\n }\n return {\n type: 'integration',\n pkg: { path: absPath, devId, name, version, integration: createIntegrationReqBody },\n }\n }\n\n if (projectDefinition?.type === 'interface') {\n const { name, version } = projectDefinition.definition\n const createInterfaceReqBody = await apiUtils.prepareCreateInterfaceBody(projectDefinition.definition)\n return {\n type: 'interface',\n pkg: { path: absPath, name, version, interface: createInterfaceReqBody },\n }\n }\n\n if (projectDefinition?.type === 'plugin') {\n if (!projectImplementation) {\n throw new errors.BotpressCLIError(\n 'Plugin implementation not found; Please build the plugin project before installing'\n )\n }\n\n const pluginDefinition = projectDefinition.definition\n const { name, version } = pluginDefinition\n const code = projectImplementation\n\n const createPluginReqBody = await apiUtils.prepareCreatePluginBody(pluginDefinition)\n return {\n type: 'plugin',\n pkg: {\n path: absPath,\n name,\n version,\n code,\n plugin: {\n ...createPluginReqBody,\n dependencies: {\n interfaces: await utils.promises.awaitRecord(\n utils.records.mapValues(pluginDefinition.interfaces ?? {}, apiUtils.prepareCreateInterfaceBody)\n ),\n integrations: await utils.promises.awaitRecord(\n utils.records.mapValues(pluginDefinition.integrations ?? {}, apiUtils.prepareCreateIntegrationBody)\n ),\n },\n recurringEvents: pluginDefinition.recurringEvents,\n },\n },\n }\n }\n\n if (projectDefinition?.type === 'bot') {\n throw new errors.BotpressCLIError('Cannot install a bot as a package')\n }\n return\n }\n\n private async _install(installPath: utils.path.AbsolutePath, files: codegen.File[]): Promise<void> {\n const line = this.logger.line()\n line.started(`Installing ${files.length} files to \"${installPath}\"`)\n try {\n for (const file of files) {\n const filePath = utils.path.absoluteFrom(installPath, file.path)\n const dirPath = pathlib.dirname(filePath)\n await fslib.promises.mkdir(dirPath, { recursive: true })\n await fslib.promises.writeFile(filePath, file.content)\n }\n line.success(`Installed ${files.length} files to \"${installPath}\"`)\n } finally {\n line.commit()\n }\n }\n\n private async _uninstall(installPath: utils.path.AbsolutePath): Promise<void> {\n await fslib.promises.rm(installPath, { recursive: true })\n }\n\n private async _readProject(workDir: utils.path.AbsolutePath): Promise<{\n definition?: ProjectDefinition\n implementation?: string\n devId?: string\n }> {\n const cmd = this._getProjectCmd(workDir)\n\n const definition = await cmd.readProjectDefinitionFromFS().catch((thrown) => {\n if (thrown instanceof errors.ProjectDefinitionNotFoundError) {\n return undefined\n }\n throw thrown\n })\n\n const devId = await cmd.projectCache.get('devId')\n\n const implementationAbsPath = utils.path.join(workDir, consts.fromWorkDir.outFileCJS)\n if (!fslib.existsSync(implementationAbsPath)) {\n return { definition, devId }\n }\n\n const implementation = await fslib.promises.readFile(implementationAbsPath, 'utf8')\n return { definition, implementation, devId }\n }\n\n private _pkgCouldBe = (ref: pkgRef.ApiPackageRef, pkgType: InstallablePackage['type']) => {\n if (ref.type === 'id') {\n // TODO: use ULID prefixes to determine the type of the package\n return true\n }\n if (!ref.pkg) {\n return true // ref does not specify the package type\n }\n return ref.pkg === pkgType\n }\n\n private _getProjectCmd(workDir: string): _AnyProjectCommand {\n return new _AnyProjectCommand(apiUtils.ApiClient, this.prompt, this.logger, {\n ...this.argv,\n workDir,\n })\n }\n}\n\n// this is a hack to avoid refactoring the project command class\nclass _AnyProjectCommand extends ProjectCommand<ProjectCommandDefinition> {\n public async run(): Promise<void> {\n throw new errors.BotpressCLIError('Not implemented')\n }\n\n public async readProjectDefinitionFromFS(): Promise<ProjectDefinition> {\n return super.readProjectDefinitionFromFS()\n }\n\n public async prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n return super.prepareCreateIntegrationBody(integrationDef)\n }\n\n public get projectCache(): utils.cache.FSKeyValueCache<ProjectCache> {\n return super.projectCache\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAAqB;AACrB,YAAuB;AACvB,cAAyB;AACzB,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4BAA8B;AAC9B,6BAA0F;AAiBnF,MAAM,mBAAmB,oCAAoC;AAAA,EAClE,MAAa,MAAqB;AAChC,UAAM,MAAM,KAAK,cAAc;AAC/B,QAAI,KAAK;AACP,aAAO,MAAM,KAAK,kBAAkB,GAAG;AAAA,IACzC;AAEA,UAAM,UAAU,MAAM,MAAM,QAAQ,gBAAgB,KAAK,KAAK,WAAW;AACzE,QAAI,CAAC,SAAS;AACZ,WAAK,OAAO,KAAK,2CAA2C;AAC5D;AAAA,IACF;AAEA,UAAM,EAAE,eAAe,IAAI;AAC3B,QAAI,CAAC,gBAAgB;AACnB,WAAK,OAAO,IAAI,0CAA0C;AAC1D;AAAA,IACF;AAEA,UAAM,uBAAuB,IAAI,EAAE,OAAO,IAAI,EAAE,OAAO,CAAC;AACxD,UAAM,eAAe,qBAAqB,UAAU,cAAc;AAClE,QAAI,CAAC,aAAa,SAAS;AACzB,YAAM,IAAI,OAAO,iBAAiB,8CAA8C;AAAA,IAClF;AAEA,eAAW,CAAC,UAAU,SAAS,KAAK,OAAO,QAAQ,aAAa,IAAI,GAAG;AACrE,YAAM,SAAS,OAAO,gBAAgB,SAAS;AAC/C,UA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": ["import * as errors from '../errors'\nimport type { Logger } from '../logger'\nimport type { CommandArgv, CommandDefinition } from '../typings'\n\nexport abstract class BaseCommand<C extends CommandDefinition> {\n public constructor(\n protected readonly logger: Logger,\n protected readonly argv: CommandArgv<C>\n ) {}\n\n protected abstract run(): Promise<void>\n protected bootstrap?(): Promise<void>\n protected teardown?(): Promise<void>\n\n public async handler(): Promise<{ exitCode: number }> {\n let exitCode = 0\n try {\n if (this.bootstrap) {\n await this.bootstrap()\n }\n await this.run()\n } catch (thrown) {\n const error = errors.BotpressCLIError.map(thrown)\n\n if (error.debug) {\n const msg = error.message + ' (Run with verbose flag (-v) to see more details)'\n this.logger.error(msg)\n this.logger.debug(error.debug)\n } else {\n this.logger.error(error.message)\n }\n\n exitCode = 1\n } finally {\n if (this.teardown) {\n await this.teardown()\n }\n }\n\n return { exitCode }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAIjB,MAAe,YAAyC;AAAA,EACtD,YACc,QACA,MACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAMH,MAAa,UAAyC;AACpD,QAAI,WAAW;AACf,QAAI;AACF,UAAI,KAAK,WAAW;AAClB,cAAM,KAAK,UAAU;AAAA,MACvB;AACA,YAAM,KAAK,IAAI;AAAA,IACjB,SAAS,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAIjB,MAAe,YAAyC;AAAA,EACtD,YACc,QACA,MACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAMH,MAAa,UAAyC;AACpD,QAAI,WAAW;AACf,QAAI;AACF,UAAI,KAAK,WAAW;AAClB,cAAM,KAAK,UAAU;AAAA,MACvB;AACA,YAAM,KAAK,IAAI;AAAA,IACjB,SAAS,QAAQ;AACf,YAAM,QAAQ,OAAO,iBAAiB,IAAI,MAAM;AAEhD,UAAI,MAAM,OAAO;AACf,cAAM,MAAM,MAAM,UAAU;AAC5B,aAAK,OAAO,MAAM,GAAG;AACrB,aAAK,OAAO,MAAM,MAAM,KAAK;AAAA,MAC/B,OAAO;AACL,aAAK,OAAO,MAAM,MAAM,OAAO;AAAA,MACjC;AAEA,iBAAW;AAAA,IACb,UAAE;AACA,UAAI,KAAK,UAAU;AACjB,cAAM,KAAK,SAAS;AAAA,MACtB;AAAA,IACF;AAEA,WAAO,EAAE,SAAS;AAAA,EACpB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/bot-commands.ts"],
|
|
4
4
|
"sourcesContent": ["import chalk from 'chalk'\nimport { ApiClient } from 'src/api/client'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { GlobalCommand } from './global-command'\n\nexport type GetBotCommandDefinition = typeof commandDefinitions.bots.subcommands.get\nexport class GetBotCommand extends GlobalCommand<GetBotCommandDefinition> {\n public async run(): Promise<void> {\n const { client } = await this.ensureLoginAndCreateClient(this.argv)\n\n try {\n const { bot } = await client.getBot({ id: this.argv.botRef })\n this.logger.success(`Bot ${chalk.bold(this.argv.botRef)}:`)\n this.logger.json(bot)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get bot ${this.argv.botRef}`)\n }\n }\n}\n\nexport type ListBotsCommandDefinition = typeof commandDefinitions.bots.subcommands.list\nexport class ListBotsCommand extends GlobalCommand<ListBotsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n try {\n const { dev } = this.argv\n const bots = await api.listAllPages(\n (x) => api.client.listBots({ ...x, dev }),\n (r) => r.bots\n )\n this.logger.success('Bots:')\n this.logger.json(bots)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list bots')\n }\n }\n}\n\nexport type DeleteBotCommandDefinition = typeof commandDefinitions.bots.subcommands.delete\nexport class DeleteBotCommand extends GlobalCommand<DeleteBotCommandDefinition> {\n public async run(): Promise<void> {\n const { client } = await this.ensureLoginAndCreateClient(this.argv)\n\n try {\n await client.deleteBot({ id: this.argv.botRef })\n this.logger.success(`Bot ${chalk.bold(this.argv.botRef)} deleted`)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete bot ${this.argv.botRef}`)\n }\n }\n}\n\nexport type CreateBotCommandDefinition = typeof commandDefinitions.bots.subcommands.create\nexport class CreateBotCommand extends GlobalCommand<CreateBotCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n try {\n if (this.argv.ifNotExists) {\n await this._getOrCreate(api, this.argv.name)\n return\n }\n await this._create(api, this.argv.name)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not create bot')\n }\n }\n\n private _getOrCreate = async (api: ApiClient, name: string | undefined) => {\n if (!name) {\n throw new errors.BotpressCLIError('option --if-not-exists requires that a name be provided')\n }\n const existingBot = await api.findBotByName(name)\n if (existingBot) {\n this.logger.success(`Bot ${chalk.bold(name)} already exists`)\n this.logger.json(existingBot)\n return\n }\n return this._create(api, name)\n }\n\n private _create = async (api: ApiClient, name: string | undefined) => {\n const { bot } = await api.client.createBot({ name })\n this.logger.success(`Bot ${chalk.bold(bot.id)}:`)\n this.logger.json(bot)\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGlB,aAAwB;AACxB,4BAA8B;AAGvB,MAAM,sBAAsB,oCAAuC;AAAA,EACxE,MAAa,MAAqB;AAChC,UAAM,EAAE,OAAO,IAAI,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAElE,QAAI;AACF,YAAM,EAAE,IAAI,IAAI,MAAM,OAAO,OAAO,EAAE,I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;AAAA,EACtB;AACF;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
|
@@ -25,7 +25,7 @@ var import_bundle_command = require("./bundle-command");
|
|
|
25
25
|
var import_gen_command = require("./gen-command");
|
|
26
26
|
var import_project_command = require("./project-command");
|
|
27
27
|
class BuildCommand extends import_project_command.ProjectCommand {
|
|
28
|
-
async run() {
|
|
28
|
+
async run(buildContext) {
|
|
29
29
|
const t0 = Date.now();
|
|
30
30
|
const { type: projectType, definition: integrationDef } = await this.readProjectDefinitionFromFS();
|
|
31
31
|
if (projectType === "interface") {
|
|
@@ -35,15 +35,15 @@ class BuildCommand extends import_project_command.ProjectCommand {
|
|
|
35
35
|
if (integrationDef) {
|
|
36
36
|
await this._runGenerate();
|
|
37
37
|
}
|
|
38
|
-
await this._runBundle();
|
|
38
|
+
await this._runBundle(buildContext);
|
|
39
39
|
const dt = Date.now() - t0;
|
|
40
40
|
this.logger.log(`Build completed in ${dt}ms`);
|
|
41
41
|
}
|
|
42
42
|
_runGenerate() {
|
|
43
43
|
return new import_gen_command.GenerateCommand(this.api, this.prompt, this.logger, this.argv).run();
|
|
44
44
|
}
|
|
45
|
-
_runBundle() {
|
|
46
|
-
return new import_bundle_command.BundleCommand(this.api, this.prompt, this.logger, this.argv).run();
|
|
45
|
+
_runBundle(buildContext) {
|
|
46
|
+
return new import_bundle_command.BundleCommand(this.api, this.prompt, this.logger, this.argv).run(buildContext);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/build-command.ts"],
|
|
4
|
-
"sourcesContent": ["import type commandDefinitions from '../command-definitions'\nimport { BundleCommand } from './bundle-command'\nimport { GenerateCommand } from './gen-command'\nimport { ProjectCommand } from './project-command'\n\nexport type BuildCommandDefinition = typeof commandDefinitions.build\nexport class BuildCommand extends ProjectCommand<BuildCommandDefinition> {\n public async run(): Promise<void> {\n const t0 = Date.now()\n const { type: projectType, definition: integrationDef } = await this.readProjectDefinitionFromFS()\n\n if (projectType === 'interface') {\n this.logger.success('Interface projects have nothing to build.')\n return\n }\n\n if (integrationDef) {\n await this._runGenerate()\n }\n\n await this._runBundle()\n const dt = Date.now() - t0\n this.logger.log(`Build completed in ${dt}ms`)\n }\n\n private _runGenerate() {\n return new GenerateCommand(this.api, this.prompt, this.logger, this.argv).run()\n }\n\n private _runBundle() {\n return new BundleCommand(this.api, this.prompt, this.logger, this.argv).run()\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import type commandDefinitions from '../command-definitions'\nimport * as utils from '../utils'\nimport { BundleCommand } from './bundle-command'\nimport { GenerateCommand } from './gen-command'\nimport { ProjectCommand } from './project-command'\n\nexport type BuildCommandDefinition = typeof commandDefinitions.build\nexport class BuildCommand extends ProjectCommand<BuildCommandDefinition> {\n public async run(buildContext?: utils.esbuild.IncrementalBuildContext): Promise<void> {\n const t0 = Date.now()\n const { type: projectType, definition: integrationDef } = await this.readProjectDefinitionFromFS()\n\n if (projectType === 'interface') {\n this.logger.success('Interface projects have nothing to build.')\n return\n }\n\n if (integrationDef) {\n await this._runGenerate()\n }\n\n await this._runBundle(buildContext)\n const dt = Date.now() - t0\n this.logger.log(`Build completed in ${dt}ms`)\n }\n\n private _runGenerate() {\n return new GenerateCommand(this.api, this.prompt, this.logger, this.argv).run()\n }\n\n private _runBundle(buildContext?: utils.esbuild.IncrementalBuildContext) {\n return new BundleCommand(this.api, this.prompt, this.logger, this.argv).run(buildContext)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,4BAA8B;AAC9B,yBAAgC;AAChC,6BAA+B;AAGxB,MAAM,qBAAqB,sCAAuC;AAAA,EACvE,MAAa,IAAI,cAAqE;AACpF,UAAM,KAAK,KAAK,IAAI;AACpB,UAAM,EAAE,MAAM,aAAa,YAAY,eAAe,IAAI,MAAM,KAAK,4BAA4B;AAEjG,QAAI,gBAAgB,aAAa;AAC/B,WAAK,OAAO,QAAQ,2CAA2C;AAC/D;AAAA,IACF;AAEA,QAAI,gBAAgB;AAClB,YAAM,KAAK,aAAa;AAAA,IAC1B;AAEA,UAAM,KAAK,WAAW,YAAY;AAClC,UAAM,KAAK,KAAK,IAAI,IAAI;AACxB,SAAK,OAAO,IAAI,sBAAsB,EAAE,IAAI;AAAA,EAC9C;AAAA,EAEQ,eAAe;AACrB,WAAO,IAAI,mCAAgB,KAAK,KAAK,KAAK,QAAQ,KAAK,QAAQ,KAAK,IAAI,EAAE,IAAI;AAAA,EAChF;AAAA,EAEQ,WAAW,cAAsD;AACvE,WAAO,IAAI,oCAAc,KAAK,KAAK,KAAK,QAAQ,KAAK,QAAQ,KAAK,IAAI,EAAE,IAAI,YAAY;AAAA,EAC1F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,7 +36,7 @@ var errors = __toESM(require("../errors"));
|
|
|
36
36
|
var utils = __toESM(require("../utils"));
|
|
37
37
|
var import_project_command = require("./project-command");
|
|
38
38
|
class BundleCommand extends import_project_command.ProjectCommand {
|
|
39
|
-
async run() {
|
|
39
|
+
async run(buildContext) {
|
|
40
40
|
const projectDef = await this.readProjectDefinitionFromFS();
|
|
41
41
|
const abs = this.projectPaths.abs;
|
|
42
42
|
const rel = this.projectPaths.rel("workDir");
|
|
@@ -46,23 +46,24 @@ class BundleCommand extends import_project_command.ProjectCommand {
|
|
|
46
46
|
} else if (projectDef.type === "integration") {
|
|
47
47
|
const { name, __advanced } = projectDef.definition;
|
|
48
48
|
line.started(`Bundling integration ${import_chalk.default.bold(name)}...`);
|
|
49
|
-
await this._bundle(abs.outFileCJS, __advanced?.esbuild ?? {});
|
|
49
|
+
await this._bundle(abs.outFileCJS, buildContext, __advanced?.esbuild ?? {});
|
|
50
50
|
} else if (projectDef.type === "bot") {
|
|
51
51
|
line.started("Bundling bot...");
|
|
52
|
-
await this._bundle(abs.outFileCJS);
|
|
52
|
+
await this._bundle(abs.outFileCJS, buildContext);
|
|
53
53
|
} else if (projectDef.type === "plugin") {
|
|
54
54
|
line.started("Bundling plugin with platform node...");
|
|
55
|
-
await this._bundle(abs.outFileCJS);
|
|
55
|
+
await this._bundle(abs.outFileCJS, buildContext);
|
|
56
56
|
line.started("Bundling plugin with platform browser...");
|
|
57
|
-
await this._bundle(abs.outFileESM, { platform: "browser", format: "esm" });
|
|
57
|
+
await this._bundle(abs.outFileESM, buildContext, { platform: "browser", format: "esm" });
|
|
58
58
|
} else {
|
|
59
59
|
throw new errors.UnsupportedProjectType();
|
|
60
60
|
}
|
|
61
61
|
line.success(`Bundle available at ${import_chalk.default.grey(rel.outDir)}`);
|
|
62
62
|
}
|
|
63
|
-
async _bundle(outfile, props = {}) {
|
|
63
|
+
async _bundle(outfile, buildContext, props = {}) {
|
|
64
64
|
const abs = this.projectPaths.abs;
|
|
65
|
-
|
|
65
|
+
const context = buildContext ?? new utils.esbuild.IncrementalBuildContext();
|
|
66
|
+
await context.rebuild(
|
|
66
67
|
{
|
|
67
68
|
outfile,
|
|
68
69
|
absWorkingDir: abs.workDir,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/bundle-command.ts"],
|
|
4
|
-
"sourcesContent": ["import chalk from 'chalk'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport { ProjectCommand } from './project-command'\n\nexport type BundleCommandDefinition = typeof commandDefinitions.bundle\nexport class BundleCommand extends ProjectCommand<BundleCommandDefinition> {\n public async run(): Promise<void> {\n const projectDef = await this.readProjectDefinitionFromFS()\n\n const abs = this.projectPaths.abs\n const rel = this.projectPaths.rel('workDir')\n const line = this.logger.line()\n\n if (projectDef.type === 'interface') {\n this.logger.success('Interface projects have no implementation to bundle.')\n } else if (projectDef.type === 'integration') {\n const { name, __advanced } = projectDef.definition\n line.started(`Bundling integration ${chalk.bold(name)}...`)\n await this._bundle(abs.outFileCJS, __advanced?.esbuild ?? {})\n } else if (projectDef.type === 'bot') {\n line.started('Bundling bot...')\n await this._bundle(abs.outFileCJS)\n } else if (projectDef.type === 'plugin') {\n line.started('Bundling plugin with platform node...')\n await this._bundle(abs.outFileCJS)\n\n line.started('Bundling plugin with platform browser...')\n await this._bundle(abs.outFileESM, { platform: 'browser', format: 'esm' })\n } else {\n type _assertion = utils.types.AssertNever<typeof projectDef>\n throw new errors.UnsupportedProjectType()\n }\n\n line.success(`Bundle available at ${chalk.grey(rel.outDir)}`)\n }\n\n private async _bundle(outfile: string
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,aAAwB;AACxB,YAAuB;AACvB,6BAA+B;AAGxB,MAAM,sBAAsB,sCAAwC;AAAA,EACzE,MAAa,
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport { ProjectCommand } from './project-command'\n\nexport type BundleCommandDefinition = typeof commandDefinitions.bundle\nexport class BundleCommand extends ProjectCommand<BundleCommandDefinition> {\n public async run(buildContext?: utils.esbuild.IncrementalBuildContext): Promise<void> {\n const projectDef = await this.readProjectDefinitionFromFS()\n\n const abs = this.projectPaths.abs\n const rel = this.projectPaths.rel('workDir')\n const line = this.logger.line()\n\n if (projectDef.type === 'interface') {\n this.logger.success('Interface projects have no implementation to bundle.')\n } else if (projectDef.type === 'integration') {\n const { name, __advanced } = projectDef.definition\n line.started(`Bundling integration ${chalk.bold(name)}...`)\n await this._bundle(abs.outFileCJS, buildContext, __advanced?.esbuild ?? {})\n } else if (projectDef.type === 'bot') {\n line.started('Bundling bot...')\n await this._bundle(abs.outFileCJS, buildContext)\n } else if (projectDef.type === 'plugin') {\n line.started('Bundling plugin with platform node...')\n await this._bundle(abs.outFileCJS, buildContext)\n\n line.started('Bundling plugin with platform browser...')\n await this._bundle(abs.outFileESM, buildContext, { platform: 'browser', format: 'esm' })\n } else {\n type _assertion = utils.types.AssertNever<typeof projectDef>\n throw new errors.UnsupportedProjectType()\n }\n\n line.success(`Bundle available at ${chalk.grey(rel.outDir)}`)\n }\n\n private async _bundle(\n outfile: string,\n buildContext?: utils.esbuild.IncrementalBuildContext,\n props: Partial<utils.esbuild.BuildOptions> = {}\n ) {\n const abs = this.projectPaths.abs\n const context = buildContext ?? new utils.esbuild.IncrementalBuildContext()\n await context.rebuild(\n {\n outfile,\n absWorkingDir: abs.workDir,\n code: this._code,\n },\n {\n ...this._buildOptions,\n ...props,\n }\n )\n }\n\n private get _code() {\n const rel = this.projectPaths.rel('workDir')\n const unixPath = utils.path.toUnix(rel.entryPoint)\n const importFrom = utils.path.rmExtension(unixPath)\n return `import x from './${importFrom}'; export default x; export const handler = x.handler;`\n }\n\n private get _buildOptions(): Partial<utils.esbuild.BuildOptions> {\n return {\n logLevel: this.argv.verbose ? 'info' : 'silent',\n sourcemap: this.argv.sourceMap,\n minify: this.argv.minify,\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,aAAwB;AACxB,YAAuB;AACvB,6BAA+B;AAGxB,MAAM,sBAAsB,sCAAwC;AAAA,EACzE,MAAa,IAAI,cAAqE;AACpF,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,UAAM,MAAM,KAAK,aAAa;AAC9B,UAAM,MAAM,KAAK,aAAa,IAAI,SAAS;AAC3C,UAAM,OAAO,KAAK,OAAO,KAAK;AAE9B,QAAI,WAAW,SAAS,aAAa;AACnC,WAAK,OAAO,QAAQ,s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Y,gBAAqD;AAC/D,WAAO;AAAA,MACL,UAAU,KAAK,KAAK,UAAU,SAAS;AAAA,MACvC,WAAW,KAAK,KAAK;AAAA,MACrB,QAAQ,KAAK,KAAK;AAAA,IACpB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/chat-command.ts"],
|
|
4
4
|
"sourcesContent": ["import * as chat from '@botpress/chat'\nimport * as client from '@botpress/client'\nimport semver from 'semver'\nimport { ApiClient } from '../api'\nimport { Chat } from '../chat'\nimport type commandDefinitions from '../command-definitions'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\ntype IntegrationInstance = {\n id: string\n instance: client.Bot['integrations'][string]\n}\n\nexport type ChatCommandDefinition = typeof commandDefinitions.chat\nexport class ChatCommand extends GlobalCommand<ChatCommandDefinition> {\n public async run(): Promise<void> {\n if (process.platform === 'win32') {\n this.logger.warn('The chat command was not tested on Windows and may not work as expected')\n }\n\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const botId = this.argv.botId ?? (await this._selectBot(api))\n const { bot } = await api.client.getBot({ id: botId }).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not fetch bot \"${botId}\"`)\n })\n\n const targetChatVersion = this._getChatApiTargetVersionRange()\n let chatIntegrationInstance = this._findChatInstance(bot)\n\n if (!chatIntegrationInstance) {\n this.logger.log(`Chat integration with version ${targetChatVersion} is not installed in the selected bot`)\n const confirmInstall = await this.prompt.confirm('Do you wish to install it now?')\n if (!confirmInstall) {\n throw new errors.BotpressCLIError('Chat integration is required to proceed')\n }\n chatIntegrationInstance = await this._installChatIntegration(api, botId)\n }\n\n const { webhookId } = chatIntegrationInstance.instance\n const chatApiBaseUrl = this._getChatApiUrl(api)\n this.logger.debug(`using chat api url: \"${chatApiBaseUrl}\"`)\n\n const chatApiUrl = `${chatApiBaseUrl}/${webhookId}`\n const chatClient = await chat.Client.connect({ apiUrl: chatApiUrl })\n await this._chat(chatClient)\n }\n\n private _chat = async (client: chat.AuthenticatedClient): Promise<void> => {\n const convLine = this.logger.line()\n convLine.started('Creating a conversation...')\n const { conversation } = await client.createConversation({})\n convLine.success(`Conversation created with id \"${conversation.id}\"`)\n convLine.commit()\n\n const chat = Chat.launch({ client, conversationId: conversation.id })\n await chat.wait()\n }\n\n private _getChatApiUrl = (api: ApiClient): string => {\n if (this.argv.chatApiUrl) {\n return this.argv.chatApiUrl\n }\n\n const parseResult = utils.url.parse(api.url)\n if (parseResult.status === 'error') {\n return consts.defaultChatApiUrl\n }\n\n const { host, ...url } = parseResult.url\n if (!host.startsWith('api.')) {\n return consts.defaultChatApiUrl\n }\n\n const newHost = host.replace('api.', 'chat.')\n return utils.url.format({ ...url, host: newHost })\n }\n\n private _selectBot = async (api: ApiClient): Promise<string> => {\n const availableBots = 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 (!availableBots.length) {\n throw new errors.NoBotsFoundError()\n }\n\n const prompted = await this.prompt.select('Which bot do you want to deploy?', {\n choices: availableBots.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 private _installChatIntegration = async (api: ApiClient, botId: string): Promise<IntegrationInstance> => {\n const line = this.logger.line()\n line.started('Installing chat integration...')\n\n const { integration } = await api.client.getPublicIntegration({\n name: 'chat',\n version: this._getChatApiTargetVersion(),\n })\n\n const { bot } = await api.client.updateBot({\n id: botId,\n integrations: {\n [integration.id]: {\n enabled: true,\n configuration: {}, // empty object will always be a valid chat integration configuration\n },\n },\n })\n\n line.success('Chat integration installed')\n line.commit()\n\n const inst = this._findChatInstance(bot)\n if (!inst) {\n throw new errors.BotpressCLIError('Chat integration was installed but could not be found')\n }\n\n return inst\n }\n\n private _findChatInstance = (bot: client.Bot): IntegrationInstance | undefined => {\n const integrationInstances = Object.entries(bot.integrations).map(([integrationId, integrationInstance]) => ({\n id: integrationId,\n instance: integrationInstance,\n }))\n\n const targetChatVersion = this._getChatApiTargetVersionRange()\n return integrationInstances.find(\n (i) => i.instance.name === 'chat' && semver.satisfies(i.instance.version, targetChatVersion)\n )\n }\n\n private _getChatApiTargetVersionRange = (): string => {\n const targetApiVersion = this._getChatApiTargetVersion()\n const nextMajor = semver.inc(targetApiVersion, 'major')\n return `>=${targetApiVersion} <${nextMajor}`\n }\n\n private _getChatApiTargetVersion = (): string => {\n const dummyClient = new chat.Client({ apiUrl: '' })\n return dummyClient.apiVersion\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAEtB,oBAAmB;AAEnB,kBAAqB;AAErB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4BAA8B;AAQvB,MAAM,oBAAoB,oCAAqC;AAAA,EACpE,MAAa,MAAqB;AAChC,QAAI,QAAQ,aAAa,SAAS;AAChC,WAAK,OAAO,KAAK,yEAAyE;AAAA,IAC5F;AAEA,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,QAAQ,KAAK,KAAK,SAAU,MAAM,KAAK,WAAW,GAAG;AAC3D,UAAM,EAAE,IAAI,IAAI,MAAM,IAAI,OAAO,OAAO,EAAE,IAAI,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW;AACvE,YAAM,OAAO,iBAAiB,KAAK,QAAQ,wBAAwB,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAsB;AAEtB,oBAAmB;AAEnB,kBAAqB;AAErB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,4B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names": ["client", "chat", "semver"]
|
|
7
7
|
}
|
|
@@ -77,8 +77,7 @@ class DeployCommand extends import_project_command.ProjectCommand {
|
|
|
77
77
|
}
|
|
78
78
|
async _deployIntegration(api, integrationDef) {
|
|
79
79
|
const res = await this._manageWorkspaceHandle(api, integrationDef);
|
|
80
|
-
if (!res)
|
|
81
|
-
return;
|
|
80
|
+
if (!res) return;
|
|
82
81
|
const { integration: updatedIntegrationDef, workspaceId } = res;
|
|
83
82
|
integrationDef = updatedIntegrationDef;
|
|
84
83
|
if (workspaceId) {
|