@botpress/cli 2.2.5 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/dist/api/bot-body.js.map +2 -2
  3. package/dist/api/client.js +10 -2
  4. package/dist/api/client.js.map +2 -2
  5. package/dist/api/find-previous-version.test.js +1 -1
  6. package/dist/api/find-previous-version.test.js.map +2 -2
  7. package/dist/api/index.js +1 -0
  8. package/dist/api/index.js.map +2 -2
  9. package/dist/api/integration-body.js +6 -19
  10. package/dist/api/integration-body.js.map +2 -2
  11. package/dist/api/interface-body.js +1 -5
  12. package/dist/api/interface-body.js.map +2 -2
  13. package/dist/api/plugin-body.js +3 -0
  14. package/dist/api/plugin-body.js.map +2 -2
  15. package/dist/api/types.js.map +1 -1
  16. package/dist/code-generation/bot-implementation/bot-implementation.js +5 -2
  17. package/dist/code-generation/bot-implementation/bot-implementation.js.map +2 -2
  18. package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +3 -0
  19. package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +2 -2
  20. package/dist/code-generation/bot-implementation/bot-typings/index.js +11 -2
  21. package/dist/code-generation/bot-implementation/bot-typings/index.js.map +2 -2
  22. package/dist/code-generation/bot-implementation/bot-typings/tables-module.js +64 -0
  23. package/dist/code-generation/bot-implementation/bot-typings/tables-module.js.map +7 -0
  24. package/dist/code-generation/generators.js +11 -2
  25. package/dist/code-generation/generators.js.map +3 -3
  26. package/dist/code-generation/integration-package/index.js +4 -21
  27. package/dist/code-generation/integration-package/index.js.map +2 -2
  28. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +10 -1
  29. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +2 -2
  30. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js +11 -1
  31. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +2 -2
  32. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js +10 -8
  33. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js.map +2 -2
  34. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js +10 -5
  35. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +2 -2
  36. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js +9 -1
  37. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +2 -2
  38. package/dist/code-generation/integration-package/integration-package-definition/events-module.js +9 -4
  39. package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +2 -2
  40. package/dist/code-generation/integration-package/integration-package-definition/index.js +12 -3
  41. package/dist/code-generation/integration-package/integration-package-definition/index.js.map +2 -2
  42. package/dist/code-generation/integration-package/integration-package-definition/interfaces-module.js +61 -0
  43. package/dist/code-generation/integration-package/integration-package-definition/interfaces-module.js.map +7 -0
  44. package/dist/code-generation/integration-package/integration-package-definition/states-module.js +6 -1
  45. package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +2 -2
  46. package/dist/code-generation/integration-package/integration-package-definition/typings.js.map +1 -1
  47. package/dist/code-generation/interface-package/index.js +4 -21
  48. package/dist/code-generation/interface-package/index.js.map +2 -2
  49. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +10 -1
  50. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +2 -2
  51. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js +9 -1
  52. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +2 -2
  53. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js +9 -1
  54. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +2 -2
  55. package/dist/code-generation/interface-package/interface-package-definition/events-module.js +9 -1
  56. package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +2 -2
  57. package/dist/code-generation/interface-package/interface-package-definition/index.js +0 -2
  58. package/dist/code-generation/interface-package/interface-package-definition/index.js.map +2 -2
  59. package/dist/code-generation/interface-package/interface-package-definition/typings.js.map +1 -1
  60. package/dist/code-generation/module.js +13 -7
  61. package/dist/code-generation/module.js.map +2 -2
  62. package/dist/code-generation/plugin-implementation/plugin-implementation.js +27 -4
  63. package/dist/code-generation/plugin-implementation/plugin-implementation.js.map +2 -2
  64. package/dist/code-generation/plugin-implementation/plugin-typings/index.js +19 -2
  65. package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +2 -2
  66. package/dist/code-generation/plugin-implementation/plugin-typings/tables-module.js +64 -0
  67. package/dist/code-generation/plugin-implementation/plugin-typings/tables-module.js.map +7 -0
  68. package/dist/code-generation/plugin-package/index.js +4 -46
  69. package/dist/code-generation/plugin-package/index.js.map +2 -2
  70. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js +8 -1
  71. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +2 -2
  72. package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js +10 -1
  73. package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js.map +2 -2
  74. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js +9 -4
  75. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +2 -2
  76. package/dist/code-generation/plugin-package/plugin-package-definition/index.js +15 -3
  77. package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +2 -2
  78. package/dist/code-generation/plugin-package/plugin-package-definition/interfaces-module.js +58 -0
  79. package/dist/code-generation/plugin-package/plugin-package-definition/interfaces-module.js.map +7 -0
  80. package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js +6 -1
  81. package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js.map +2 -2
  82. package/dist/code-generation/plugin-package/plugin-package-definition/typings.js.map +1 -1
  83. package/dist/code-generation/strings.js +10 -5
  84. package/dist/code-generation/strings.js.map +2 -2
  85. package/dist/code-generation/typings.js.map +1 -1
  86. package/dist/code-generation/typings.test.js +15 -0
  87. package/dist/code-generation/typings.test.js.map +7 -0
  88. package/dist/command-implementations/add-command.js +70 -25
  89. package/dist/command-implementations/add-command.js.map +2 -2
  90. package/dist/command-implementations/bundle-command.js +34 -27
  91. package/dist/command-implementations/bundle-command.js.map +2 -2
  92. package/dist/command-implementations/deploy-command.js +26 -68
  93. package/dist/command-implementations/deploy-command.js.map +2 -2
  94. package/dist/command-implementations/dev-command.js +13 -17
  95. package/dist/command-implementations/dev-command.js.map +2 -2
  96. package/dist/command-implementations/lint-command.js +5 -8
  97. package/dist/command-implementations/lint-command.js.map +3 -3
  98. package/dist/command-implementations/plugin-commands.js +1 -2
  99. package/dist/command-implementations/plugin-commands.js.map +2 -2
  100. package/dist/command-implementations/project-command.js +82 -34
  101. package/dist/command-implementations/project-command.js.map +2 -2
  102. package/dist/command-implementations/read-command.js +23 -8
  103. package/dist/command-implementations/read-command.js.map +2 -2
  104. package/dist/command-implementations/serve-command.js +1 -1
  105. package/dist/command-implementations/serve-command.js.map +1 -1
  106. package/dist/consts.js +4 -2
  107. package/dist/consts.js.map +2 -2
  108. package/dist/errors.js +3 -3
  109. package/dist/errors.js.map +2 -2
  110. package/dist/linter/base-linter.test.js +6 -1
  111. package/dist/linter/base-linter.test.js.map +2 -2
  112. package/dist/linter/bot-linter.js.map +2 -2
  113. package/dist/linter/integration-linter.js.map +1 -1
  114. package/dist/linter/interface-linter.js.map +2 -2
  115. package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +2 -2
  116. package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +2 -2
  117. package/dist/sdk/index.js +0 -2
  118. package/dist/sdk/index.js.map +2 -2
  119. package/dist/{sdk/resolve-bot-interfaces.js → tables/index.js} +7 -21
  120. package/dist/tables/index.js.map +7 -0
  121. package/dist/tables/schemas.js +106 -0
  122. package/dist/tables/schemas.js.map +7 -0
  123. package/dist/tables/tables-publisher.js +157 -0
  124. package/dist/tables/tables-publisher.js.map +7 -0
  125. package/dist/utils/esbuild-utils.js +15 -13
  126. package/dist/utils/esbuild-utils.js.map +2 -2
  127. package/dist/utils/type-utils.js.map +1 -1
  128. package/package.json +2 -2
  129. package/templates/empty-bot/.botpress/implementation/index.ts +5 -2
  130. package/templates/empty-bot/.botpress/implementation/typings/index.ts +3 -0
  131. package/templates/empty-bot/.botpress/implementation/typings/tables/index.ts +6 -0
  132. package/templates/empty-bot/package.json +1 -1
  133. package/templates/empty-integration/package.json +1 -1
  134. package/templates/empty-plugin/.botpress/implementation/index.ts +27 -4
  135. package/templates/empty-plugin/.botpress/implementation/typings/index.ts +3 -0
  136. package/templates/empty-plugin/.botpress/implementation/typings/tables/index.ts +6 -0
  137. package/templates/empty-plugin/package.json +1 -1
  138. package/templates/hello-world/package.json +1 -1
  139. package/templates/webhook-message/package.json +1 -1
  140. package/dist/sdk/resolve-bot-interfaces.js.map +0 -7
  141. package/dist/sdk/resolve-integration-interfaces.js +0 -161
  142. package/dist/sdk/resolve-integration-interfaces.js.map +0 -7
@@ -40,6 +40,7 @@ var import_configuration_module = require("./configuration-module");
40
40
  var import_configurations_module = require("./configurations-module");
41
41
  var import_entities_module = require("./entities-module");
42
42
  var import_events_module = require("./events-module");
43
+ var import_interfaces_module = require("./interfaces-module");
43
44
  var import_states_module = require("./states-module");
44
45
  class IntegrationPackageDefinitionModule extends import_module.Module {
45
46
  constructor(_integration) {
@@ -48,7 +49,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
48
49
  exportName: consts.DEFAULT_EXPORT_NAME
49
50
  });
50
51
  this._integration = _integration;
51
- const defaultConfigModule = new import_configuration_module.DefaultConfigurationModule(_integration.configuration);
52
+ const defaultConfigModule = new import_configuration_module.DefaultConfigurationModule(_integration.configuration ?? {});
52
53
  defaultConfigModule.unshift("configuration");
53
54
  const configurationsModule = new import_configurations_module.ConfigurationsModule(_integration.configurations ?? {});
54
55
  configurationsModule.unshift("configurations");
@@ -62,6 +63,8 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
62
63
  statesModule.unshift("states");
63
64
  const entitiesModule = new import_entities_module.EntitiesModule(_integration.entities ?? {});
64
65
  entitiesModule.unshift("entities");
66
+ const interfacesModule = new import_interfaces_module.InterfacesModule(_integration.interfaces ?? {});
67
+ interfacesModule.unshift("interfaces");
65
68
  this._dependencies = {
66
69
  defaultConfigModule,
67
70
  configurationsModule,
@@ -69,7 +72,8 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
69
72
  channelsModule,
70
73
  eventsModule,
71
74
  statesModule,
72
- entitiesModule
75
+ entitiesModule,
76
+ interfacesModule
73
77
  };
74
78
  for (const dep of Object.values(this._dependencies)) {
75
79
  this.pushDep(dep);
@@ -85,7 +89,8 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
85
89
  channelsModule,
86
90
  eventsModule,
87
91
  statesModule,
88
- entitiesModule
92
+ entitiesModule,
93
+ interfacesModule
89
94
  } = this._dependencies;
90
95
  const defaultConfigImport = defaultConfigModule.import(this);
91
96
  const configurationsImport = configurationsModule.import(this);
@@ -94,6 +99,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
94
99
  const eventsImport = eventsModule.import(this);
95
100
  const statesImport = statesModule.import(this);
96
101
  const entitiesImport = entitiesModule.import(this);
102
+ const interfacesImport = interfacesModule.import(this);
97
103
  const user = {
98
104
  tags: this._integration.user?.tags ?? {},
99
105
  creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] }
@@ -109,6 +115,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
109
115
  `import * as ${eventsModule.name} from "./${eventsImport}"`,
110
116
  `import * as ${statesModule.name} from "./${statesImport}"`,
111
117
  `import * as ${entitiesModule.name} from "./${entitiesImport}"`,
118
+ `import * as ${interfacesModule.name} from "./${interfacesImport}"`,
112
119
  `export * as ${defaultConfigModule.name} from "./${defaultConfigImport}"`,
113
120
  `export * as ${configurationsModule.name} from "./${configurationsImport}"`,
114
121
  `export * as ${actionsModule.name} from "./${actionsImport}"`,
@@ -116,6 +123,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
116
123
  `export * as ${eventsModule.name} from "./${eventsImport}"`,
117
124
  `export * as ${statesModule.name} from "./${statesImport}"`,
118
125
  `export * as ${entitiesModule.name} from "./${entitiesImport}"`,
126
+ `export * as ${interfacesModule.name} from "./${interfacesImport}"`,
119
127
  "",
120
128
  "export default {",
121
129
  ` name: "${this._integration.name}",`,
@@ -128,6 +136,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
128
136
  ` events: ${eventsModule.name}.${eventsModule.exportName},`,
129
137
  ` states: ${statesModule.name}.${statesModule.exportName},`,
130
138
  ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,
139
+ ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,
131
140
  '} satisfies sdk.IntegrationPackage["definition"]'
132
141
  ].join("\n");
133
142
  return content;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/integration-package/integration-package-definition/index.ts"],
4
- "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { ConfigurationsModule } from './configurations-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype IntegrationPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n configurationsModule: ConfigurationsModule\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n entitiesModule: EntitiesModule\n}\n\nexport class IntegrationPackageDefinitionModule extends Module {\n private _dependencies: IntegrationPackageModuleDependencies\n\n public constructor(private _integration: types.ApiIntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_integration.configuration)\n defaultConfigModule.unshift('configuration')\n\n const configurationsModule = new ConfigurationsModule(_integration.configurations ?? {})\n configurationsModule.unshift('configurations')\n\n const actionsModule = new ActionsModule(_integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_integration.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_integration.states ?? {})\n statesModule.unshift('states')\n\n const entitiesModule = new EntitiesModule(_integration.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\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 {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n } = this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const configurationsImport = configurationsModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n const user = {\n tags: this._integration.user?.tags ?? {},\n creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] },\n }\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 ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._integration.name}\",`,\n ` version: \"${this._integration.version}\",`,\n ` user: ${stringifySingleLine(user)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n '} satisfies sdk.IntegrationPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,kCAA2C;AAC3C,mCAAqC;AACrC,6BAA+B;AAC/B,2BAA6B;AAC7B,2BAA6B;AAatB,MAAM,2CAA2C,qBAAO;AAAA,EAGtD,YAAoB,cAA8C;AACvE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,aAAa,aAAa;AACrF,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,uBAAuB,IAAI,kDAAqB,aAAa,kBAAkB,CAAC,CAAC;AACvF,yBAAqB,QAAQ,gBAAgB;AAE7C,UAAM,gBAAgB,IAAI,oCAAc,aAAa,WAAW,CAAC,CAAC;AAClE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,s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BAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,qBAAqB,gBAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C;AAAA,MACA;AAAA,MACA,YAAY,KAAK,aAAa;AAAA,MAC9B,eAAe,KAAK,aAAa;AAAA,MACjC,eAAW,uCAAoB,IAAI;AAAA,MACnC,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,qBAAqB,qBAAqB,QAAQ,qBAAqB;AAAA,MACvE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { ConfigurationsModule } from './configurations-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype IntegrationPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n configurationsModule: ConfigurationsModule\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n entitiesModule: EntitiesModule\n interfacesModule: InterfacesModule\n}\n\nexport class IntegrationPackageDefinitionModule extends Module {\n private _dependencies: IntegrationPackageModuleDependencies\n\n public constructor(private _integration: types.IntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_integration.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const configurationsModule = new ConfigurationsModule(_integration.configurations ?? {})\n configurationsModule.unshift('configurations')\n\n const actionsModule = new ActionsModule(_integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_integration.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_integration.states ?? {})\n statesModule.unshift('states')\n\n const entitiesModule = new EntitiesModule(_integration.entities ?? {})\n entitiesModule.unshift('entities')\n\n const interfacesModule = new InterfacesModule(_integration.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n this._dependencies = {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\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 {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n } = this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const configurationsImport = configurationsModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n\n const user = {\n tags: this._integration.user?.tags ?? {},\n creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] },\n }\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 ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._integration.name}\",`,\n ` version: \"${this._integration.version}\",`,\n ` user: ${stringifySingleLine(user)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n '} satisfies sdk.IntegrationPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;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AAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,aAAa;AAAA,MAC9B,eAAe,KAAK,aAAa;AAAA,MACjC,eAAW,uCAAoB,IAAI;AAAA,MACnC,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,qBAAqB,qBAAqB,QAAQ,qBAAqB;AAAA,MACvE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,61 @@
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 interfaces_module_exports = {};
30
+ __export(interfaces_module_exports, {
31
+ InterfaceModule: () => InterfaceModule,
32
+ InterfacesModule: () => InterfacesModule
33
+ });
34
+ module.exports = __toCommonJS(interfaces_module_exports);
35
+ var import_module = require("../../module");
36
+ var strings = __toESM(require("../../strings"));
37
+ class InterfaceModule extends import_module.Module {
38
+ constructor(name, _interface) {
39
+ const exportName = strings.varName(name);
40
+ super({ path: `${name}.ts`, exportName });
41
+ this._interface = _interface;
42
+ }
43
+ async getContent() {
44
+ return `export const ${this.exportName} = ${JSON.stringify(this._interface, null, 2)}`;
45
+ }
46
+ }
47
+ class InterfacesModule extends import_module.ReExportVariableModule {
48
+ constructor(interfaces) {
49
+ super({ exportName: strings.varName("interfaces") });
50
+ for (const [interfaceName, intrface] of Object.entries(interfaces)) {
51
+ const module2 = new InterfaceModule(interfaceName, intrface);
52
+ this.pushDep(module2);
53
+ }
54
+ }
55
+ }
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ InterfaceModule,
59
+ InterfacesModule
60
+ });
61
+ //# sourceMappingURL=interfaces-module.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/code-generation/integration-package/integration-package-definition/interfaces-module.ts"],
4
+ "sourcesContent": ["import { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class InterfaceModule extends Module {\n public constructor(\n name: string,\n private _interface: types.InterfaceExtension\n ) {\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return `export const ${this.exportName} = ${JSON.stringify(this._interface, null, 2)}`\n }\n}\n\nexport class InterfacesModule extends ReExportVariableModule {\n public constructor(interfaces: Record<string, types.InterfaceExtension>) {\n super({ exportName: strings.varName('interfaces') })\n for (const [interfaceName, intrface] of Object.entries(interfaces)) {\n const module = new InterfaceModule(interfaceName, intrface)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,wBAAwB,qBAAO;AAAA,EACnC,YACL,MACQ,YACR;AACA,UAAM,aAAa,QAAQ,QAAQ,IAAI;AACvC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHhC;AAAA,EAIV;AAAA,EAEA,MAAa,aAAa;AACxB,WAAO,gBAAgB,KAAK,gBAAgB,KAAK,UAAU,KAAK,YAAY,MAAM,CAAC;AAAA,EACrF;AACF;AAEO,MAAM,yBAAyB,qCAAuB;AAAA,EACpD,YAAY,YAAsD;AACvE,UAAM,EAAE,YAAY,QAAQ,QAAQ,YAAY,EAAE,CAAC;AACnD,eAAW,CAAC,eAAe,QAAQ,KAAK,OAAO,QAAQ,UAAU,GAAG;AAClE,YAAMA,UAAS,IAAI,gBAAgB,eAAe,QAAQ;AAC1D,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
+ "names": ["module"]
7
+ }
@@ -33,6 +33,7 @@ __export(states_module_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(states_module_exports);
35
35
  var import_generators = require("../../generators");
36
+ var gen = __toESM(require("../../generators"));
36
37
  var import_module = require("../../module");
37
38
  var strings = __toESM(require("../../strings"));
38
39
  class StateModule extends import_module.Module {
@@ -45,7 +46,11 @@ class StateModule extends import_module.Module {
45
46
  }
46
47
  async getContent() {
47
48
  return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._state.schema, this.exportName, {
48
- type: `"${this._state.type}" as const`
49
+ type: `"${this._state.type}" as const`,
50
+ ...gen.primitiveRecordToTypescriptValues({
51
+ title: this._state.title,
52
+ description: this._state.description
53
+ })
49
54
  });
50
55
  }
51
56
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/integration-package/integration-package-definition/states-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } 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.ApiStateDefinition\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 })\n }\n}\n\nexport class StatesModule extends ReExportVariableModule {\n public constructor(states: Record<string, types.ApiStateDefinition>) {\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,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,MACT,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;AAAA,IACxB,CAAC;AAAA,EACH;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAAkD;AACnE,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;",
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,MACT,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;AAAA,MACtB,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
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/integration-package/integration-package-definition/typings.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nexport type ApiIntegrationDefinition = client.Integration\nexport type ApiActionDefinition = ApiIntegrationDefinition['actions'][string]\nexport type ApiChannelDefinition = ApiIntegrationDefinition['channels'][string]\nexport type ApiMessageDefinition = ApiChannelDefinition['messages'][string]\nexport type ApiConfigurationDefinition = ApiIntegrationDefinition['configurations'][string]\nexport type ApiEntityDefinition = ApiIntegrationDefinition['entities'][string]\nexport type ApiEventDefinition = ApiIntegrationDefinition['events'][string]\nexport type ApiStateDefinition = ApiIntegrationDefinition['states'][string]\n"],
4
+ "sourcesContent": ["import * as types from '../../typings'\nexport type IntegrationDefinition = types.IntegrationDefinition\nexport type ActionDefinition = NonNullable<IntegrationDefinition['actions']>[string]\nexport type ChannelDefinition = NonNullable<IntegrationDefinition['channels']>[string]\nexport type MessageDefinition = NonNullable<ChannelDefinition['messages']>[string]\nexport type ConfigurationDefinition = NonNullable<IntegrationDefinition['configurations']>[string]\nexport type EntityDefinition = NonNullable<IntegrationDefinition['entities']>[string]\nexport type EventDefinition = NonNullable<IntegrationDefinition['events']>[string]\nexport type StateDefinition = NonNullable<IntegrationDefinition['states']>[string]\nexport type InterfaceExtension = NonNullable<IntegrationDefinition['interfaces']>[string]\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -31,13 +31,12 @@ __export(interface_package_exports, {
31
31
  generateInterfacePackage: () => generateInterfacePackage
32
32
  });
33
33
  module.exports = __toCommonJS(interface_package_exports);
34
- var utils = __toESM(require("../../utils"));
35
34
  var consts = __toESM(require("../consts"));
36
35
  var gen = __toESM(require("../generators"));
37
36
  var import_interface_package_definition = require("./interface-package-definition");
38
37
  const generateInterfacePackageModule = (definitionImport, pkg) => {
39
- const id = pkg.source === "remote" ? pkg.interface.id : void 0;
40
- const uri = pkg.source === "local" ? utils.path.toNormalizedPosixPath(pkg.path) : void 0;
38
+ const id = pkg.interface.id;
39
+ const uri = pkg.path;
41
40
  const tsId = gen.primitiveToTypescriptValue(id);
42
41
  const tsUri = gen.primitiveToTypescriptValue(uri);
43
42
  const tsName = gen.primitiveToTypescriptValue(pkg.name);
@@ -46,7 +45,7 @@ const generateInterfacePackageModule = (definitionImport, pkg) => {
46
45
  consts.GENERATED_HEADER,
47
46
  'import * as sdk from "@botpress/sdk"',
48
47
  "",
49
- `import definition from "${utils.path.toNormalizedPosixPath(definitionImport)}"`,
48
+ `import definition from "${definitionImport}"`,
50
49
  "",
51
50
  "export default {",
52
51
  ' type: "interface",',
@@ -58,7 +57,7 @@ const generateInterfacePackageModule = (definitionImport, pkg) => {
58
57
  "} satisfies sdk.InterfacePackage"
59
58
  ].join("\n");
60
59
  };
61
- const generateInterfacePackageFromRemote = async (pkg) => {
60
+ const generateInterfacePackage = async (pkg) => {
62
61
  const definitionDir = "definition";
63
62
  const definitionModule = new import_interface_package_definition.InterfacePackageDefinitionModule(pkg.interface);
64
63
  definitionModule.unshift(definitionDir);
@@ -71,22 +70,6 @@ const generateInterfacePackageFromRemote = async (pkg) => {
71
70
  }
72
71
  ];
73
72
  };
74
- const generateInterfacePackageFromLocal = async (pkg) => {
75
- let definitionImport = utils.path.join(pkg.path, consts.fromWorkDir.interfaceDefinition);
76
- definitionImport = utils.path.rmExtension(definitionImport);
77
- return [
78
- {
79
- path: consts.INDEX_FILE,
80
- content: generateInterfacePackageModule(definitionImport, pkg)
81
- }
82
- ];
83
- };
84
- const generateInterfacePackage = async (pkg) => {
85
- if (pkg.source === "remote") {
86
- return generateInterfacePackageFromRemote(pkg);
87
- }
88
- return generateInterfacePackageFromLocal(pkg);
89
- };
90
73
  // Annotate the CommonJS export names for ESM import in node:
91
74
  0 && (module.exports = {
92
75
  generateInterfacePackage
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/code-generation/interface-package/index.ts"],
4
- "sourcesContent": ["import * as utils from '../../utils'\nimport * as consts from '../consts'\nimport * as gen from '../generators'\nimport * as types from '../typings'\nimport { InterfacePackageDefinitionModule } from './interface-package-definition'\n\nconst generateInterfacePackageModule = (definitionImport: string, pkg: types.InterfaceInstallablePackage): string => {\n const id = pkg.source === 'remote' ? pkg.interface.id : undefined\n const uri = pkg.source === 'local' ? utils.path.toNormalizedPosixPath(pkg.path) : undefined\n\n const tsId = gen.primitiveToTypescriptValue(id)\n const tsUri = gen.primitiveToTypescriptValue(uri)\n const tsName = gen.primitiveToTypescriptValue(pkg.name)\n const tsVersion = gen.primitiveToTypescriptValue(pkg.version)\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import definition from \"${utils.path.toNormalizedPosixPath(definitionImport)}\"`,\n '',\n 'export default {',\n ' type: \"interface\",',\n ` id: ${tsId},`,\n ` uri: ${tsUri},`,\n ` name: ${tsName},`,\n ` version: ${tsVersion},`,\n ' definition,',\n '} satisfies sdk.InterfacePackage',\n ].join('\\n')\n}\n\nconst generateInterfacePackageFromRemote = async (\n pkg: Extract<types.InterfaceInstallablePackage, { source: 'remote' }>\n): Promise<types.File[]> => {\n const definitionDir = 'definition'\n const definitionModule = new InterfacePackageDefinitionModule(pkg.interface)\n definitionModule.unshift(definitionDir)\n\n const definitionFiles = await definitionModule.flatten()\n return [\n ...definitionFiles,\n {\n path: consts.INDEX_FILE,\n content: generateInterfacePackageModule(`./${definitionDir}`, pkg),\n },\n ]\n}\n\nconst generateInterfacePackageFromLocal = async (\n pkg: Extract<types.InterfaceInstallablePackage, { source: 'local' }>\n): Promise<types.File[]> => {\n let definitionImport: string = utils.path.join(pkg.path, consts.fromWorkDir.interfaceDefinition)\n definitionImport = utils.path.rmExtension(definitionImport)\n return [\n {\n path: consts.INDEX_FILE,\n content: generateInterfacePackageModule(definitionImport, pkg),\n },\n ]\n}\n\nexport const generateInterfacePackage = async (pkg: types.InterfaceInstallablePackage): Promise<types.File[]> => {\n if (pkg.source === 'remote') {\n return generateInterfacePackageFromRemote(pkg)\n }\n return generateInterfacePackageFromLocal(pkg)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,aAAwB;AACxB,UAAqB;AAErB,0CAAiD;AAEjD,MAAM,iCAAiC,CAAC,kBAA0B,QAAmD;AACnH,QAAM,KAAK,IAAI,WAAW,WAAW,IAAI,UAAU,KAAK;AACxD,QAAM,MAAM,IAAI,WAAW,UAAU,MAAM,KAAK,sBAAsB,IAAI,IAAI,IAAI;AAElF,QAAM,OAAO,IAAI,2BAA2B,EAAE;AAC9C,QAAM,QAAQ,IAAI,2BAA2B,GAAG;AAChD,QAAM,SAAS,IAAI,2BAA2B,IAAI,IAAI;AACtD,QAAM,YAAY,IAAI,2BAA2B,IAAI,OAAO;AAC5D,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,2BAA2B,MAAM,KAAK,sBAAsB,gBAAgB;AAAA,IAC5E;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA,IACX,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AAEA,MAAM,qCAAqC,OACzC,QAC0B;AAC1B,QAAM,gBAAgB;AACtB,QAAM,mBAAmB,IAAI,qEAAiC,IAAI,SAAS;AAC3E,mBAAiB,QAAQ,aAAa;AAEtC,QAAM,kBAAkB,MAAM,iBAAiB,QAAQ;AACvD,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,MACE,MAAM,OAAO;AAAA,MACb,SAAS,+BAA+B,KAAK,iBAAiB,GAAG;AAAA,IACnE;AAAA,EACF;AACF;AAEA,MAAM,oCAAoC,OACxC,QAC0B;AAC1B,MAAI,mBAA2B,MAAM,KAAK,KAAK,IAAI,MAAM,OAAO,YAAY,mBAAmB;AAC/F,qBAAmB,MAAM,KAAK,YAAY,gBAAgB;AAC1D,SAAO;AAAA,IACL;AAAA,MACE,MAAM,OAAO;AAAA,MACb,SAAS,+BAA+B,kBAAkB,GAAG;AAAA,IAC/D;AAAA,EACF;AACF;AAEO,MAAM,2BAA2B,OAAO,QAAkE;AAC/G,MAAI,IAAI,WAAW,UAAU;AAC3B,WAAO,mCAAmC,GAAG;AAAA,EAC/C;AACA,SAAO,kCAAkC,GAAG;AAC9C;",
4
+ "sourcesContent": ["import * as consts from '../consts'\nimport * as gen from '../generators'\nimport * as types from '../typings'\nimport { InterfacePackageDefinitionModule } from './interface-package-definition'\n\nconst generateInterfacePackageModule = (definitionImport: string, pkg: types.InterfaceInstallablePackage): string => {\n const id = pkg.interface.id\n const uri = pkg.path\n\n const tsId = gen.primitiveToTypescriptValue(id)\n const tsUri = gen.primitiveToTypescriptValue(uri)\n const tsName = gen.primitiveToTypescriptValue(pkg.name)\n const tsVersion = gen.primitiveToTypescriptValue(pkg.version)\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import definition from \"${definitionImport}\"`,\n '',\n 'export default {',\n ' type: \"interface\",',\n ` id: ${tsId},`,\n ` uri: ${tsUri},`,\n ` name: ${tsName},`,\n ` version: ${tsVersion},`,\n ' definition,',\n '} satisfies sdk.InterfacePackage',\n ].join('\\n')\n}\n\nexport const generateInterfacePackage = async (pkg: types.InterfaceInstallablePackage): Promise<types.File[]> => {\n const definitionDir = 'definition'\n const definitionModule = new InterfacePackageDefinitionModule(pkg.interface)\n definitionModule.unshift(definitionDir)\n\n const definitionFiles = await definitionModule.flatten()\n return [\n ...definitionFiles,\n {\n path: consts.INDEX_FILE,\n content: generateInterfacePackageModule(`./${definitionDir}`, pkg),\n },\n ]\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,UAAqB;AAErB,0CAAiD;AAEjD,MAAM,iCAAiC,CAAC,kBAA0B,QAAmD;AACnH,QAAM,KAAK,IAAI,UAAU;AACzB,QAAM,MAAM,IAAI;AAEhB,QAAM,OAAO,IAAI,2BAA2B,EAAE;AAC9C,QAAM,QAAQ,IAAI,2BAA2B,GAAG;AAChD,QAAM,SAAS,IAAI,2BAA2B,IAAI,IAAI;AACtD,QAAM,YAAY,IAAI,2BAA2B,IAAI,OAAO;AAC5D,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,2BAA2B;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA,IACX,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AAEO,MAAM,2BAA2B,OAAO,QAAkE;AAC/G,QAAM,gBAAgB;AACtB,QAAM,mBAAmB,IAAI,qEAAiC,IAAI,SAAS;AAC3E,mBAAiB,QAAQ,aAAa;AAEtC,QAAM,kBAAkB,MAAM,iBAAiB,QAAQ;AACvD,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,MACE,MAAM,OAAO;AAAA,MACb,SAAS,+BAA+B,KAAK,iBAAiB,GAAG;AAAA,IACnE;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -35,6 +35,7 @@ __export(actions_module_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(actions_module_exports);
37
37
  var import_generators = require("../../generators");
38
+ var gen = __toESM(require("../../generators"));
38
39
  var import_module = require("../../module");
39
40
  var strings = __toESM(require("../../strings"));
40
41
  class ActionInputModule extends import_module.Module {
@@ -61,7 +62,15 @@ class ActionOutputModule extends import_module.Module {
61
62
  }
62
63
  class ActionModule extends import_module.ReExportVariableModule {
63
64
  constructor(actionName, action) {
64
- super({ exportName: strings.varName(actionName) });
65
+ super({
66
+ exportName: strings.varName(actionName),
67
+ extraProps: gen.primitiveRecordToTypescriptValues({
68
+ title: action.title,
69
+ description: action.description,
70
+ billable: action.billable,
71
+ cacheable: action.cacheable
72
+ })
73
+ });
65
74
  const inputModule = new ActionInputModule(action.input);
66
75
  const outputModule = new ActionOutputModule(action.output);
67
76
  this.pushDep(inputModule);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/actions-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\ntype ActionInput = types.ApiActionDefinition['input']\ntype ActionOutput = types.ApiActionDefinition['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.ApiActionDefinition) {\n super({ exportName: strings.varName(actionName) })\n\n const inputModule = new ActionInputModule(action.input)\n const outputModule = new ActionOutputModule(action.output)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n }\n}\n\nexport class ActionsModule extends ReExportVariableModule {\n public constructor(actions: Record<string, types.ApiActionDefinition>) {\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,oBAA+C;AAC/C,cAAyB;AAMlB,MAAM,0BAA0B,qBAAO;AAAA,EACrC,YAAoB,QAAqB;AAC9C,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,QAAQ,IAAI;AACvC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EAC5E;AACF;AAEO,MAAM,2BAA2B,qBAAO;AAAA,EACtC,YAAoB,SAAuB;AAChD,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,QAAQ,IAAI;AACvC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,QAAQ,QAAQ,KAAK,UAAU;AAAA,EAC7E;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,YAAoB,QAAmC;AACxE,UAAM,EAAE,YAAY,QAAQ,QAAQ,UAAU,EAAE,CAAC;AAEjD,UAAM,cAAc,IAAI,kBAAkB,OAAO,KAAK;AACtD,UAAM,eAAe,IAAI,mBAAmB,OAAO,MAAM;AAEzD,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AAAA,EAC3B;AACF;AAEO,MAAM,sBAAsB,qCAAuB;AAAA,EACjD,YAAY,SAAoD;AACrE,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;",
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: gen.primitiveRecordToTypescriptValues({\n title: action.title,\n description: action.description,\n billable: action.billable,\n cacheable: action.cacheable,\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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AAC;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
  }
@@ -33,6 +33,7 @@ __export(channels_module_exports, {
33
33
  module.exports = __toCommonJS(channels_module_exports);
34
34
  var import_consts = require("../../consts");
35
35
  var import_generators = require("../../generators");
36
+ var gen = __toESM(require("../../generators"));
36
37
  var import_module = require("../../module");
37
38
  var strings = __toESM(require("../../strings"));
38
39
  class MessageModule extends import_module.Module {
@@ -44,7 +45,14 @@ class MessageModule extends import_module.Module {
44
45
  this._message = _message;
45
46
  }
46
47
  async getContent() {
47
- return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._message.schema, this.exportName);
48
+ return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(
49
+ this._message.schema,
50
+ this.exportName,
51
+ gen.primitiveRecordToTypescriptValues({
52
+ title: this._message.title,
53
+ description: this._message.description
54
+ })
55
+ );
48
56
  }
49
57
  }
50
58
  class MessagesModule extends import_module.ReExportVariableModule {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/channels-module.ts"],
4
- "sourcesContent": ["import { GENERATED_HEADER, INDEX_FILE } from '../../consts'\nimport { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nclass MessageModule extends Module {\n public constructor(\n name: string,\n private _message: types.ApiMessageDefinition\n ) {\n super({\n path: `${name}.ts`,\n exportName: strings.varName(name),\n })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._message.schema, this.exportName)\n }\n}\n\nclass MessagesModule extends ReExportVariableModule {\n public constructor(channel: types.ApiChannelDefinition) {\n super({ exportName: strings.varName('messages') })\n for (const [messageName, message] of Object.entries(channel.messages ?? {})) {\n const module = new MessageModule(messageName, message)\n this.pushDep(module)\n }\n }\n}\n\nclass ChannelModule extends Module {\n private _messagesModule: MessagesModule\n\n public constructor(\n channelName: string,\n private _channel: types.ApiChannelDefinition\n ) {\n super({\n path: INDEX_FILE,\n exportName: strings.varName(channelName),\n })\n\n this._messagesModule = new MessagesModule(_channel)\n this._messagesModule.unshift('messages')\n this.pushDep(this._messagesModule)\n }\n\n public async getContent() {\n const messageImport = this._messagesModule.import(this)\n\n return [\n GENERATED_HEADER,\n `import { ${this._messagesModule.exportName} } from './${messageImport}'`,\n `export * from './${messageImport}'`,\n '',\n `export const ${this.exportName} = {`,\n ` messages: ${this._messagesModule.exportName},`,\n '}',\n ].join('\\n')\n }\n}\n\nexport class ChannelsModule extends ReExportVariableModule {\n public constructor(channels: Record<string, types.ApiChannelDefinition>) {\n super({ exportName: strings.varName('channels') })\n for (const [channelName, channel] of Object.entries(channels)) {\n const module = new ChannelModule(channelName, channel)\n module.unshift(channelName)\n this.pushDep(module)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6C;AAC7C,wBAAgD;AAChD,oBAA+C;AAC/C,cAAyB;AAGzB,MAAM,sBAAsB,qBAAO;AAAA,EAC1B,YACL,MACQ,UACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,MACT,YAAY,QAAQ,QAAQ,IAAI;AAAA,IAClC,CAAC;AALO;AAAA,EAMV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,SAAS,QAAQ,KAAK,UAAU;AAAA,EAC9E;AACF;AAEA,MAAM,uBAAuB,qCAAuB;AAAA,EAC3C,YAAY,SAAqC;AACtD,UAAM,EAAE,YAAY,QAAQ,QAAQ,UAAU,EAAE,CAAC;AACjD,eAAW,CAAC,aAAa,OAAO,KAAK,OAAO,QAAQ,QAAQ,YAAY,CAAC,CAAC,GAAG;AAC3E,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;AAEA,MAAM,sBAAsB,qBAAO;AAAA,EAG1B,YACL,aACQ,UACR;AACA,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,YAAY,QAAQ,QAAQ,WAAW;AAAA,IACzC,CAAC;AALO;AAOR,SAAK,kBAAkB,IAAI,eAAe,QAAQ;AAClD,SAAK,gBAAgB,QAAQ,UAAU;AACvC,SAAK,QAAQ,KAAK,eAAe;AAAA,EACnC;AAAA,EAdQ;AAAA,EAgBR,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,gBAAgB,OAAO,IAAI;AAEtD,WAAO;AAAA,MACL;AAAA,MACA,YAAY,KAAK,gBAAgB,wBAAwB;AAAA,MACzD,oBAAoB;AAAA,MACpB;AAAA,MACA,gBAAgB,KAAK;AAAA,MACrB,eAAe,KAAK,gBAAgB;AAAA,MACpC;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAEO,MAAM,uBAAuB,qCAAuB;AAAA,EAClD,YAAY,UAAsD;AACvE,UAAM,EAAE,YAAY,QAAQ,QAAQ,UAAU,EAAE,CAAC;AACjD,eAAW,CAAC,aAAa,OAAO,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC7D,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,MAAAA,QAAO,QAAQ,WAAW;AAC1B,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { GENERATED_HEADER, INDEX_FILE } from '../../consts'\nimport { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nclass MessageModule extends Module {\n public constructor(\n name: string,\n private _message: types.MessageDefinition\n ) {\n super({\n path: `${name}.ts`,\n exportName: strings.varName(name),\n })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(\n this._message.schema,\n this.exportName,\n gen.primitiveRecordToTypescriptValues({\n title: this._message.title,\n description: this._message.description,\n })\n )\n }\n}\n\nclass MessagesModule extends ReExportVariableModule {\n public constructor(channel: types.ChannelDefinition) {\n super({ exportName: strings.varName('messages') })\n for (const [messageName, message] of Object.entries(channel.messages ?? {})) {\n const module = new MessageModule(messageName, message)\n this.pushDep(module)\n }\n }\n}\n\nclass ChannelModule extends Module {\n private _messagesModule: MessagesModule\n\n public constructor(\n channelName: string,\n private _channel: types.ChannelDefinition\n ) {\n super({\n path: INDEX_FILE,\n exportName: strings.varName(channelName),\n })\n\n this._messagesModule = new MessagesModule(_channel)\n this._messagesModule.unshift('messages')\n this.pushDep(this._messagesModule)\n }\n\n public async getContent() {\n const messageImport = this._messagesModule.import(this)\n\n return [\n GENERATED_HEADER,\n `import { ${this._messagesModule.exportName} } from './${messageImport}'`,\n `export * from './${messageImport}'`,\n '',\n `export const ${this.exportName} = {`,\n ` messages: ${this._messagesModule.exportName},`,\n '}',\n ].join('\\n')\n }\n}\n\nexport class ChannelsModule extends ReExportVariableModule {\n public constructor(channels: Record<string, types.ChannelDefinition>) {\n super({ exportName: strings.varName('channels') })\n for (const [channelName, channel] of Object.entries(channels)) {\n const module = new ChannelModule(channelName, channel)\n module.unshift(channelName)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6C;AAC7C,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGzB,MAAM,sBAAsB,qBAAO;AAAA,EAC1B,YACL,MACQ,UACR;AACA,UAAM;AAAA,MACJ,MAAM,GAAG;AAAA,MACT,YAAY,QAAQ,QAAQ,IAAI;AAAA,IAClC,CAAC;AALO;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,GAAG;AAC7D,YAAMA,UAAS,IAAI,cAAc,aAAa,OAAO;AACrD,MAAAA,QAAO,QAAQ,WAAW;AAC1B,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
6
  "names": ["module"]
7
7
  }
@@ -33,6 +33,7 @@ __export(entities_module_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(entities_module_exports);
35
35
  var import_generators = require("../../generators");
36
+ var gen = __toESM(require("../../generators"));
36
37
  var import_module = require("../../module");
37
38
  var strings = __toESM(require("../../strings"));
38
39
  class EntityModule extends import_module.Module {
@@ -43,7 +44,14 @@ class EntityModule extends import_module.Module {
43
44
  this._entity = _entity;
44
45
  }
45
46
  async getContent() {
46
- return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._entity.schema, this.exportName);
47
+ return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(
48
+ this._entity.schema,
49
+ this.exportName,
50
+ gen.primitiveRecordToTypescriptValues({
51
+ title: this._entity.title,
52
+ description: this._entity.description
53
+ })
54
+ );
47
55
  }
48
56
  }
49
57
  class EntitiesModule extends import_module.ReExportVariableModule {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/entities-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EntityModule extends Module {\n public constructor(\n name: string,\n private _entity: types.ApiEntityDefinition\n ) {\n const entityName = name\n const exportName = strings.varName(entityName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._entity.schema, this.exportName)\n }\n}\n\nexport class EntitiesModule extends ReExportVariableModule {\n public constructor(entities: Record<string, types.ApiEntityDefinition>) {\n super({ exportName: strings.varName('entities') })\n\n for (const [entityName, entity] of Object.entries(entities)) {\n const module = new EntityModule(entityName, entity)\n this.pushDep(module)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,qBAAqB,qBAAO;AAAA,EAChC,YACL,MACQ,SACR;AACA,UAAM,aAAa;AACnB,UAAM,aAAa,QAAQ,QAAQ,UAAU;AAC7C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,QAAQ,QAAQ,KAAK,UAAU;AAAA,EAC7E;AACF;AAEO,MAAM,uBAAuB,qCAAuB;AAAA,EAClD,YAAY,UAAqD;AACtE,UAAM,EAAE,YAAY,QAAQ,QAAQ,UAAU,EAAE,CAAC;AAEjD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC3D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
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 EntityModule extends Module {\n public constructor(\n name: string,\n private _entity: types.EntityDefinition\n ) {\n const entityName = name\n const exportName = strings.varName(entityName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(\n this._entity.schema,\n this.exportName,\n gen.primitiveRecordToTypescriptValues({\n title: this._entity.title,\n description: this._entity.description,\n })\n )\n }\n}\n\nexport class EntitiesModule extends ReExportVariableModule {\n public constructor(entities: Record<string, types.EntityDefinition>) {\n super({ exportName: strings.varName('entities') })\n\n for (const [entityName, entity] of Object.entries(entities)) {\n const module = new EntityModule(entityName, entity)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,qBAAqB,qBAAO;AAAA,EAChC,YACL,MACQ,SACR;AACA,UAAM,aAAa;AACnB,UAAM,aAAa,QAAQ,QAAQ,UAAU;AAC7C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO;AAAA,MACL,KAAK,QAAQ;AAAA,MACb,KAAK;AAAA,MACL,IAAI,kCAAkC;AAAA,QACpC,OAAO,KAAK,QAAQ;AAAA,QACpB,aAAa,KAAK,QAAQ;AAAA,MAC5B,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,uBAAuB,qCAAuB;AAAA,EAClD,YAAY,UAAkD;AACnE,UAAM,EAAE,YAAY,QAAQ,QAAQ,UAAU,EAAE,CAAC;AAEjD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAC3D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
6
  "names": ["module"]
7
7
  }
@@ -33,6 +33,7 @@ __export(events_module_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(events_module_exports);
35
35
  var import_generators = require("../../generators");
36
+ var gen = __toESM(require("../../generators"));
36
37
  var import_module = require("../../module");
37
38
  var strings = __toESM(require("../../strings"));
38
39
  class EventModule extends import_module.Module {
@@ -46,7 +47,14 @@ class EventModule extends import_module.Module {
46
47
  if (!this._event.schema) {
47
48
  return `export const ${this.exportName} = z.object({});`;
48
49
  }
49
- return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._event.schema, this.exportName);
50
+ return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(
51
+ this._event.schema,
52
+ this.exportName,
53
+ gen.primitiveRecordToTypescriptValues({
54
+ title: this._event.title,
55
+ description: this._event.description
56
+ })
57
+ );
50
58
  }
51
59
  }
52
60
  class EventsModule extends import_module.ReExportVariableModule {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/events-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } 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.ApiEventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n if (!this._event.schema) {\n return `export const ${this.exportName} = z.object({});`\n }\n return jsonSchemaToTypescriptZuiSchema(this._event.schema, this.exportName)\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.ApiEventDefinition>) {\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;AAAA;AAAA,wBAAgD;AAChD,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,CAAC,KAAK,OAAO,QAAQ;AACvB,aAAO,gBAAgB,KAAK;AAAA,IAC9B;AACA,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EAC5E;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAAkD;AACnE,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;",
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 if (!this._event.schema) {\n return `export const ${this.exportName} = z.object({});`\n }\n return jsonSchemaToTypescriptZuiSchema(\n this._event.schema,\n this.exportName,\n gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n })\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;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,CAAC,KAAK,OAAO,QAAQ;AACvB,aAAO,gBAAgB,KAAK;AAAA,IAC9B;AACA,eAAO;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,KAAK;AAAA,MACL,IAAI,kCAAkC;AAAA,QACpC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,IACH;AAAA,EACF;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
  }
@@ -70,7 +70,6 @@ class InterfacePackageDefinitionModule extends import_module.Module {
70
70
  const channelsImport = channelsModule.import(this);
71
71
  const eventsImport = eventsModule.import(this);
72
72
  const entitiesImport = entitiesModule.import(this);
73
- const templateName = this._interface.nameTemplate === void 0 ? "undefined" : `"${this._interface.nameTemplate.script}"`;
74
73
  content += [
75
74
  consts.GENERATED_HEADER,
76
75
  'import * as sdk from "@botpress/sdk"',
@@ -91,7 +90,6 @@ class InterfacePackageDefinitionModule extends import_module.Module {
91
90
  ` channels: ${channelsModule.name}.${channelsModule.exportName},`,
92
91
  ` events: ${eventsModule.name}.${eventsModule.exportName},`,
93
92
  ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,
94
- ` templateName: ${templateName},`,
95
93
  '} satisfies sdk.InterfacePackage["definition"]'
96
94
  ].join("\n");
97
95
  return content;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/index.ts"],
4
- "sourcesContent": ["import * as consts from '../../consts'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport * as types from './typings'\n\ntype InterfacePackageModuleDependencies = {\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n entitiesModule: EntitiesModule\n}\n\nexport class InterfacePackageDefinitionModule extends Module {\n private _dependencies: InterfacePackageModuleDependencies\n\n public constructor(private _interface: types.ApiInterfaceDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const actionsModule = new ActionsModule(_interface.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_interface.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_interface.events ?? {})\n eventsModule.unshift('events')\n\n const entitiesModule = new EntitiesModule(_interface.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n actionsModule,\n channelsModule,\n eventsModule,\n entitiesModule,\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 { actionsModule, channelsModule, eventsModule, entitiesModule } = this._dependencies\n\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n const templateName =\n this._interface.nameTemplate === undefined ? 'undefined' : `\"${this._interface.nameTemplate.script}\"`\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._interface.name}\",`,\n ` version: \"${this._interface.version}\",`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n ` templateName: ${templateName},`,\n '} satisfies sdk.InterfacePackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,6BAA+B;AAC/B,2BAA6B;AAUtB,MAAM,yCAAyC,qBAAO;AAAA,EAGpD,YAAoB,YAA0C;AACnE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,gBAAgB,IAAI,oCAAc,WAAW,WAAW,CAAC,CAAC;AAChE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,sCAAe,WAAW,YAAY,CAAC,CAAC;AACnE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,eAAe,IAAI,kCAAa,WAAW,UAAU,CAAC,CAAC;AAC7D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,iBAAiB,IAAI,sCAAe,WAAW,YAAY,CAAC,CAAC;AACnE,mBAAe,QAAQ,UAAU;AAEjC,SAAK,gBAAgB;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,eAAW,OAAO,OAAO,OAAO,KAAK,aAAa,GAAG;AACnD,WAAK,QAAQ,GAAG;AAAA,IAClB;AAAA,EACF;AAAA,EA9BQ;AAAA,EAgCR,MAAa,aAAa;AACxB,QAAI,UAAU;AAEd,UAAM,EAAE,eAAe,gBAAgB,cAAc,eAAe,IAAI,KAAK;AAE7E,UAAM,gBAAgB,cAAc,OAAO,IAAI;AAC/C,UAAM,iBAAiB,eAAe,OAAO,IAAI;AACjD,UAAM,eAAe,aAAa,OAAO,IAAI;AAC7C,UAAM,iBAAiB,eAAe,OAAO,IAAI;AAEjD,UAAM,eACJ,KAAK,WAAW,iBAAiB,SAAY,cAAc,IAAI,KAAK,WAAW,aAAa;AAE9F,eAAW;AAAA,MACT,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C;AAAA,MACA;AAAA,MACA,YAAY,KAAK,WAAW;AAAA,MAC5B,eAAe,KAAK,WAAW;AAAA,MAC/B,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,mBAAmB;AAAA,MACnB;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import * as consts from '../../consts'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport * as types from './typings'\n\ntype InterfacePackageModuleDependencies = {\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n entitiesModule: EntitiesModule\n}\n\nexport class InterfacePackageDefinitionModule extends Module {\n private _dependencies: InterfacePackageModuleDependencies\n\n public constructor(private _interface: types.InterfaceDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const actionsModule = new ActionsModule(_interface.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_interface.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_interface.events ?? {})\n eventsModule.unshift('events')\n\n const entitiesModule = new EntitiesModule(_interface.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n actionsModule,\n channelsModule,\n eventsModule,\n entitiesModule,\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 { actionsModule, channelsModule, eventsModule, entitiesModule } = this._dependencies\n\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._interface.name}\",`,\n ` version: \"${this._interface.version}\",`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n '} satisfies sdk.InterfacePackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;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gBAAgB;AAAA,MAC9C,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C;AAAA,MACA;AAAA,MACA,YAAY,KAAK,WAAW;AAAA,MAC5B,eAAe,KAAK,WAAW;AAAA,MAC/B,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/typings.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nexport type ApiInterfaceDefinition = client.Interface\nexport type ApiActionDefinition = ApiInterfaceDefinition['actions'][string]\nexport type ApiChannelDefinition = ApiInterfaceDefinition['channels'][string]\nexport type ApiMessageDefinition = ApiChannelDefinition['messages'][string]\nexport type ApiEntityDefinition = ApiInterfaceDefinition['entities'][string]\nexport type ApiEventDefinition = ApiInterfaceDefinition['events'][string]\n"],
4
+ "sourcesContent": ["import * as types from '../../typings'\nexport type InterfaceDefinition = types.InterfaceDefinition\nexport type ActionDefinition = NonNullable<InterfaceDefinition['actions']>[string]\nexport type ChannelDefinition = NonNullable<InterfaceDefinition['channels']>[string]\nexport type MessageDefinition = NonNullable<ChannelDefinition['messages']>[string]\nexport type EntityDefinition = NonNullable<InterfaceDefinition['entities']>[string]\nexport type EventDefinition = NonNullable<InterfaceDefinition['events']>[string]\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }