@botpress/cli 1.2.0 ā 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@1.2.
|
|
2
|
+
> @botpress/cli@1.2.1 build /home/runner/work/botpress/botpress/packages/cli
|
|
3
3
|
> pnpm run bundle && pnpm run template:gen
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/cli@1.2.
|
|
6
|
+
> @botpress/cli@1.2.1 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> ts-node -T build.ts
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@1.2.
|
|
10
|
+
> @botpress/cli@1.2.1 template:gen /home/runner/work/botpress/botpress/packages/cli
|
|
11
11
|
> pnpm -r --stream -F @bp-templates/* exec bp gen
|
|
12
12
|
|
|
13
|
-
š¤ Botpress CLI v1.2.
|
|
14
|
-
š¤ Botpress CLI v1.2.
|
|
15
|
-
š¤ Botpress CLI v1.2.
|
|
16
|
-
š¤ Botpress CLI v1.2.
|
|
17
|
-
[2K[1Gā Generating typings for bot...[2K[1Gā Typings available at .botpress
|
|
13
|
+
š¤ Botpress CLI v1.2.1
|
|
14
|
+
š¤ Botpress CLI v1.2.1
|
|
15
|
+
š¤ Botpress CLI v1.2.1
|
|
16
|
+
š¤ Botpress CLI v1.2.1
|
|
17
|
+
[2K[1Gā Generating typings for integration hello-world...[2K[1Gā Generating typings for bot...[2K[1Gā Typings available at .botpress
|
|
18
18
|
[2K[1Gā Generating typings for integration empty-integration...[2K[1Gā Generating typings for integration webhook-message...[2K[1Gā Typings available at .botpress
|
|
19
|
-
[2K[1G
|
|
19
|
+
[2K[1Gā Typings available at .botpress
|
|
20
20
|
[2K[1Gā Typings available at .botpress
|
|
@@ -27,7 +27,7 @@ var import_sdk = require("@botpress/sdk");
|
|
|
27
27
|
const isObjectSchema = (schema) => schema.type === "object";
|
|
28
28
|
async function mapZodToJsonSchema(definition) {
|
|
29
29
|
let schema = import_sdk.transforms.zuiToJsonSchema(definition.schema, { target: "jsonSchema7" });
|
|
30
|
-
schema = await (
|
|
30
|
+
schema = await dereferenceSchema(schema);
|
|
31
31
|
if (!isObjectSchema(schema) || !definition.ui) {
|
|
32
32
|
return schema;
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/schema-utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { dereference } from '@apidevtools/json-schema-ref-parser'\nimport { z, transforms } from '@botpress/sdk'\nimport { JSONSchema7 } from 'json-schema'\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 async function mapZodToJsonSchema(\n definition: SchemaDefinition\n): Promise<ReturnType<typeof transforms.zuiToJsonSchema>> {\n let schema = transforms.zuiToJsonSchema(definition.schema, { target: 'jsonSchema7' })\n schema = (await
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA4B;AAC5B,iBAA8B;AAiB9B,MAAM,iBAAiB,CAAC,WAAmD,OAAO,SAAS;AAE3F,eAAsB,mBACpB,YACwD;AACxD,MAAI,SAAS,sBAAW,gBAAgB,WAAW,QAAQ,EAAE,QAAQ,cAAc,CAAC;AACpF,WAAU,
|
|
4
|
+
"sourcesContent": ["import { dereference } from '@apidevtools/json-schema-ref-parser'\nimport { z, transforms } from '@botpress/sdk'\nimport { JSONSchema7 } from 'json-schema'\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 async function mapZodToJsonSchema(\n definition: SchemaDefinition\n): Promise<ReturnType<typeof transforms.zuiToJsonSchema>> {\n let schema = transforms.zuiToJsonSchema(definition.schema, { target: 'jsonSchema7' })\n schema = (await dereferenceSchema(schema)) as typeof schema\n\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\nexport const dereferenceSchema = async (schema: JSONSchema7): Promise<JSONSchema7> => {\n return dereference(schema, {\n resolve: {\n external: false,\n file: false,\n http: false,\n },\n })\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAA4B;AAC5B,iBAA8B;AAiB9B,MAAM,iBAAiB,CAAC,WAAmD,OAAO,SAAS;AAE3F,eAAsB,mBACpB,YACwD;AACxD,MAAI,SAAS,sBAAW,gBAAgB,WAAW,QAAQ,EAAE,QAAQ,cAAc,CAAC;AACpF,WAAU,MAAM,kBAAkB,MAAM;AAExC,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;AAEO,MAAM,oBAAoB,OAAO,WAA8C;AACpF,aAAO,2CAAY,QAAQ;AAAA,IACzB,SAAS;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|