@botpress/cli 0.6.16 → 0.8.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/code-generation/map-integration.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport { z } from 'zod'\nimport * as utils from '../utils'\nimport * as types from './typings'\n\nexport namespace from {\n export const sdk = (i: sdk.IntegrationDefinition): types.IntegrationDefinition => ({\n id: null,\n name: i.name,\n version: i.version,\n user: {\n tags: i.user?.tags ?? {},\n creation: i.user?.creation ?? { enabled: false, requiredTags: [] },\n },\n configuration: i.configuration ? _mapSchema(i.configuration) : { schema: {} },\n events: i.events ? utils.records.mapValues(i.events, _mapSchema) : {},\n states: i.states ? utils.records.mapValues(i.states, _mapSchema) : {},\n actions: i.actions\n ? utils.records.mapValues(i.actions, (a) => ({\n input: _mapSchema(a.input),\n output: _mapSchema(a.output),\n }))\n : {},\n channels: i.channels\n ? utils.records.mapValues(i.channels, (c) => ({\n conversation: {\n tags: c.conversation?.tags ?? {},\n creation: c.conversation?.creation ?? { enabled: false, requiredTags: [] },\n },\n message: {\n tags: c.message?.tags ?? {},\n },\n messages: utils.records.mapValues(c.messages, _mapSchema),\n }))\n : {},\n })\n\n export const client = (i: client.Integration): types.IntegrationDefinition => {\n const { id, name, version, configuration, channels, states, events, actions, user } = i\n return { id, name, version, configuration, channels, states, events, actions, user }\n }\n\n const _mapSchema = <T extends { schema: z.ZodObject<any> }>(\n x: T\n ): utils.types.Merge<T, { schema: ReturnType<typeof utils.schema.mapZodToJsonSchema> }> => ({\n ...x,\n schema: utils.schema.mapZodToJsonSchema(x),\n })\n}\n"],
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport { z } from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './typings'\n\nexport namespace from {\n export const sdk = (i: sdk.IntegrationDefinition): types.IntegrationDefinition => ({\n id: null,\n name: i.name,\n version: i.version,\n user: {\n tags: i.user?.tags ?? {},\n creation: i.user?.creation ?? { enabled: false, requiredTags: [] },\n },\n configuration: i.configuration ? _mapSchema(i.configuration) : { schema: {} },\n events: i.events ? utils.records.mapValues(i.events, _mapSchema) : {},\n states: i.states ? utils.records.mapValues(i.states, _mapSchema) : {},\n actions: i.actions\n ? utils.records.mapValues(i.actions, (a) => ({\n input: _mapSchema(a.input),\n output: _mapSchema(a.output),\n }))\n : {},\n channels: i.channels\n ? utils.records.mapValues(i.channels, (c) => ({\n conversation: {\n tags: c.conversation?.tags ?? {},\n creation: c.conversation?.creation ?? { enabled: false, requiredTags: [] },\n },\n message: {\n tags: c.message?.tags ?? {},\n },\n messages: utils.records.mapValues(c.messages, _mapSchema),\n }))\n : {},\n })\n\n export const client = (i: client.Integration): types.IntegrationDefinition => {\n const { id, name, version, configuration, channels, states, events, actions, user } = i\n return { id, name, version, configuration, channels, states, events, actions, user }\n }\n\n const _mapSchema = <T extends { schema: z.ZodObject<any> }>(\n x: T\n ): utils.types.Merge<T, { schema: ReturnType<typeof utils.schema.mapZodToJsonSchema> }> => ({\n ...x,\n schema: utils.schema.mapZodToJsonSchema(x),\n })\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,YAAuB;AAGhB,IAAU;AAAA,CAAV,CAAUA,UAAV;AACE,EAAMA,MAAA,MAAM,CAAC,OAA+D;AAAA,IACjF,IAAI;AAAA,IACJ,MAAM,EAAE;AAAA,IACR,SAAS,EAAE;AAAA,IACX,MAAM;AAAA,MACJ,MAAM,EAAE,MAAM,QAAQ,CAAC;AAAA,MACvB,UAAU,EAAE,MAAM,YAAY,EAAE,SAAS,OAAO,cAAc,CAAC,EAAE;AAAA,IACnE;AAAA,IACA,eAAe,EAAE,gBAAgB,WAAW,EAAE,aAAa,IAAI,EAAE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wnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,20 +15,16 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
19
  var schema_utils_exports = {};
26
20
  __export(schema_utils_exports, {
27
21
  mapZodToJsonSchema: () => mapZodToJsonSchema
28
22
  });
29
23
  module.exports = __toCommonJS(schema_utils_exports);
30
- var import_zod_to_json_schema = __toESM(require("@bpinternal/zod-to-json-schema"));
31
- const isObjectSchema = (schema) => schema?.type === "object";
24
+ var import_sdk = require("@botpress/sdk");
25
+ const isObjectSchema = (schema) => schema.type === "object";
32
26
  function mapZodToJsonSchema(definition) {
33
- const schema = (0, import_zod_to_json_schema.default)(definition.schema, { errorMessages: true });
27
+ const schema = import_sdk.transforms.zuiToJsonSchema(definition.schema, { target: "jsonSchema7" });
34
28
  if (!isObjectSchema(schema) || !definition.ui) {
35
29
  return schema;
36
30
  }
@@ -40,9 +34,11 @@ function mapZodToJsonSchema(definition) {
40
34
  continue;
41
35
  }
42
36
  if (!!value?.title) {
37
+ ;
43
38
  property.title = value.title;
44
39
  }
45
40
  if (!!value?.examples) {
41
+ ;
46
42
  property.examples = value.examples;
47
43
  }
48
44
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/schema-utils.ts"],
4
- "sourcesContent": ["import zodToJsonSchema from '@bpinternal/zod-to-json-schema'\nimport type { JsonSchema7Type } from '@bpinternal/zod-to-json-schema/src/parseDef'\nimport type { JsonSchema7ObjectType } from '@bpinternal/zod-to-json-schema/src/parsers/object'\nimport { z } from 'zod'\n\ntype SchemaOptions = {\n title?: string\n examples?: any[]\n}\n\ntype SchemaDefinition = {\n schema: z.ZodObject<any>\n ui?: Record<string, SchemaOptions | undefined>\n}\n\nconst isObjectSchema = (schema: JsonSchema7Type): schema is JsonSchema7ObjectType => (schema as any)?.type === 'object'\n\nexport function mapZodToJsonSchema(definition: SchemaDefinition): ReturnType<typeof zodToJsonSchema> {\n const schema = zodToJsonSchema(definition.schema, { errorMessages: true })\n if (!isObjectSchema(schema) || !definition.ui) {\n return schema\n }\n\n for (const [key, value] of Object.entries(definition.ui ?? {})) {\n const property = schema.properties?.[key] as (JsonSchema7Type & { title?: string; examples?: any[] }) | undefined\n\n if (!property) {\n continue\n }\n\n if (!!value?.title) {\n property.title = value.title\n }\n\n if (!!value?.examples) {\n property.examples = value.examples\n }\n }\n\n return schema\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA4B;AAe5B,MAAM,iBAAiB,CAAC,WAA8D,QAAgB,SAAS;AAExG,SAAS,mBAAmB,YAAkE;AACnG,QAAM,aAAS,0BAAAA,SAAgB,WAAW,QAAQ,EAAE,eAAe,KAAK,CAAC;AACzE,MAAI,CAAC,eAAe,MAAM,KAAK,CAAC,WAAW,IAAI;AAC7C,WAAO;AAAA,EACT;AAEA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,WAAW,MAAM,CAAC,CAAC,GAAG;AAC9D,UAAM,WAAW,OAAO,aAAa;AAErC,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,QAAI,CAAC,CAAC,OAAO,OAAO;AAClB,eAAS,QAAQ,MAAM;AAAA,IACzB;AAEA,QAAI,CAAC,CAAC,OAAO,UAAU;AACrB,eAAS,WAAW,MAAM;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AACT;",
6
- "names": ["zodToJsonSchema"]
4
+ "sourcesContent": ["import { z, transforms } from '@botpress/sdk'\n\ntype ZuiToJsonSchema = typeof transforms.zuiToJsonSchema\ntype JsonSchema = ReturnType<ZuiToJsonSchema>\ntype ObjectJsonSchema = Extract<JsonSchema, { type: 'object' }>\n\ntype SchemaOptions = {\n title?: string\n examples?: any[]\n}\n\ntype SchemaDefinition = {\n schema: z.ZodObject<any>\n ui?: Record<string, SchemaOptions | undefined>\n}\n\nconst isObjectSchema = (schema: JsonSchema): schema is ObjectJsonSchema => schema.type === 'object'\n\nexport function mapZodToJsonSchema(definition: SchemaDefinition): ReturnType<typeof transforms.zuiToJsonSchema> {\n const schema = transforms.zuiToJsonSchema(definition.schema, { target: 'jsonSchema7' })\n if (!isObjectSchema(schema) || !definition.ui) {\n return schema\n }\n\n for (const [key, value] of Object.entries(definition.ui ?? {})) {\n const property = schema.properties?.[key]\n\n if (!property) {\n continue\n }\n\n if (!!value?.title) {\n ;(property as any).title = value.title\n }\n\n if (!!value?.examples) {\n ;(property as any).examples = value.examples\n }\n }\n\n return schema\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA8B;AAgB9B,MAAM,iBAAiB,CAAC,WAAmD,OAAO,SAAS;AAEpF,SAAS,mBAAmB,YAA6E;AAC9G,QAAM,SAAS,sBAAW,gBAAgB,WAAW,QAAQ,EAAE,QAAQ,cAAc,CAAC;AACtF,MAAI,CAAC,eAAe,MAAM,KAAK,CAAC,WAAW,IAAI;AAC7C,WAAO;AAAA,EACT;AAEA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,WAAW,MAAM,CAAC,CAAC,GAAG;AAC9D,UAAM,WAAW,OAAO,aAAa;AAErC,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,QAAI,CAAC,CAAC,OAAO,OAAO;AAClB;AAAC,MAAC,SAAiB,QAAQ,MAAM;AAAA,IACnC;AAEA,QAAI,CAAC,CAAC,OAAO,UAAU;AACrB;AAAC,MAAC,SAAiB,WAAW,MAAM;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": []
7
7
  }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
19
  var config_exports = {};
26
20
  __export(config_exports, {
@@ -28,18 +22,18 @@ __export(config_exports, {
28
22
  configSchema: () => configSchema
29
23
  });
30
24
  module.exports = __toCommonJS(config_exports);
31
- var import_zod = __toESM(require("zod"));
25
+ var import_sdk = require("@botpress/sdk");
32
26
  const CONFIG_ENV_KEY = "CHILD_PROCESS_CONFIGURATION";
33
- const configSchema = import_zod.default.union([
34
- import_zod.default.object({
35
- type: import_zod.default.literal("code"),
36
- code: import_zod.default.string(),
37
- env: import_zod.default.record(import_zod.default.string(), import_zod.default.string()).optional()
27
+ const configSchema = import_sdk.z.union([
28
+ import_sdk.z.object({
29
+ type: import_sdk.z.literal("code"),
30
+ code: import_sdk.z.string(),
31
+ env: import_sdk.z.record(import_sdk.z.string(), import_sdk.z.string()).optional()
38
32
  }),
39
- import_zod.default.object({
40
- type: import_zod.default.literal("file"),
41
- file: import_zod.default.string(),
42
- env: import_zod.default.record(import_zod.default.string(), import_zod.default.string()).optional()
33
+ import_sdk.z.object({
34
+ type: import_sdk.z.literal("file"),
35
+ file: import_sdk.z.string(),
36
+ env: import_sdk.z.record(import_sdk.z.string(), import_sdk.z.string()).optional()
43
37
  })
44
38
  ]);
45
39
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/worker/config.ts"],
4
- "sourcesContent": ["import zod from 'zod'\n\nexport const CONFIG_ENV_KEY = 'CHILD_PROCESS_CONFIGURATION'\n\nexport type Config = zod.infer<typeof configSchema>\nexport const configSchema = zod.union([\n zod.object({\n type: zod.literal('code'),\n code: zod.string(),\n env: zod.record(zod.string(), zod.string()).optional(),\n }),\n zod.object({\n type: zod.literal('file'),\n file: zod.string(),\n env: zod.record(zod.string(), zod.string()).optional(),\n }),\n])\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAgB;AAET,MAAM,iBAAiB;AAGvB,MAAM,eAAe,WAAAA,QAAI,MAAM;AAAA,EACpC,WAAAA,QAAI,OAAO;AAAA,IACT,MAAM,WAAAA,QAAI,QAAQ,MAAM;AAAA,IACxB,MAAM,WAAAA,QAAI,OAAO;AAAA,IACjB,KAAK,WAAAA,QAAI,OAAO,WAAAA,QAAI,OAAO,GAAG,WAAAA,QAAI,OAAO,CAAC,EAAE,SAAS;AAAA,EACvD,CAAC;AAAA,EACD,WAAAA,QAAI,OAAO;AAAA,IACT,MAAM,WAAAA,QAAI,QAAQ,MAAM;AAAA,IACxB,MAAM,WAAAA,QAAI,OAAO;AAAA,IACjB,KAAK,WAAAA,QAAI,OAAO,WAAAA,QAAI,OAAO,GAAG,WAAAA,QAAI,OAAO,CAAC,EAAE,SAAS;AAAA,EACvD,CAAC;AACH,CAAC;",
6
- "names": ["zod"]
4
+ "sourcesContent": ["import { z } from '@botpress/sdk'\n\nexport const CONFIG_ENV_KEY = 'CHILD_PROCESS_CONFIGURATION'\n\nexport type Config = z.infer<typeof configSchema>\nexport const configSchema = z.union([\n z.object({\n type: z.literal('code'),\n code: z.string(),\n env: z.record(z.string(), z.string()).optional(),\n }),\n z.object({\n type: z.literal('file'),\n file: z.string(),\n env: z.record(z.string(), z.string()).optional(),\n }),\n])\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAEX,MAAM,iBAAiB;AAGvB,MAAM,eAAe,aAAE,MAAM;AAAA,EAClC,aAAE,OAAO;AAAA,IACP,MAAM,aAAE,QAAQ,MAAM;AAAA,IACtB,MAAM,aAAE,OAAO;AAAA,IACf,KAAK,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACjD,CAAC;AAAA,EACD,aAAE,OAAO;AAAA,IACP,MAAM,aAAE,QAAQ,MAAM;AAAA,IACtB,MAAM,aAAE,OAAO;AAAA,IACf,KAAK,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACjD,CAAC;AACH,CAAC;",
6
+ "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "0.6.16",
3
+ "version": "0.8.0",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run bundle && pnpm run template:gen",
@@ -24,7 +24,6 @@
24
24
  "@bpinternal/const": "^0.0.20",
25
25
  "@bpinternal/tunnel": "^0.1.1",
26
26
  "@bpinternal/yargs-extra": "^0.0.3",
27
- "@bpinternal/zod-to-json-schema": "^3.21.4",
28
27
  "@parcel/watcher": "^2.1.0",
29
28
  "@types/lodash": "^4.14.191",
30
29
  "@types/node": "^18.11.17",
@@ -45,11 +44,10 @@
45
44
  "typescript": "^4.9.4",
46
45
  "uuid": "^9.0.0",
47
46
  "verror": "^1.10.1",
48
- "winston": "^3.8.2",
49
- "zod": "^3.20.6"
47
+ "winston": "^3.8.2"
50
48
  },
51
49
  "devDependencies": {
52
- "@botpress/sdk": "0.6.15",
50
+ "@botpress/sdk": "0.8.0",
53
51
  "@bpinternal/log4bot": "^0.0.4",
54
52
  "@types/bluebird": "^3.5.38",
55
53
  "@types/json-schema": "^7.0.11",
@@ -9,8 +9,7 @@
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
11
  "@botpress/client": "0.14.0",
12
- "@botpress/sdk": "0.6.15",
13
- "zod": "^3.20.6"
12
+ "@botpress/sdk": "0.8.0"
14
13
  },
15
14
  "devDependencies": {
16
15
  "@types/node": "^18.11.17",
@@ -1,5 +1,4 @@
1
- import { Bot } from '@botpress/sdk'
2
- import { z } from 'zod'
1
+ import { Bot, z } from '@botpress/sdk'
3
2
  // import * as botpress from '.botpress' /** uncomment to get generated code */
4
3
 
5
4
  const bot = new Bot({
@@ -10,8 +10,7 @@
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@botpress/client": "0.14.0",
13
- "@botpress/sdk": "0.6.15",
14
- "zod": "^3.20.6"
13
+ "@botpress/sdk": "0.8.0"
15
14
  },
16
15
  "devDependencies": {
17
16
  "@types/node": "^18.11.17",