@botpress/cli 4.17.19 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/dist/api/bot-body.js +15 -5
- package/dist/api/bot-body.js.map +2 -2
- package/dist/api/integration-body.d.ts +1 -1
- package/dist/api/integration-body.js +18 -6
- package/dist/api/integration-body.js.map +2 -2
- package/dist/api/interface-body.d.ts +1 -1
- package/dist/api/interface-body.js +15 -5
- package/dist/api/interface-body.js.map +2 -2
- package/dist/api/plugin-body.d.ts +1 -1
- package/dist/api/plugin-body.js +15 -5
- package/dist/api/plugin-body.js.map +2 -2
- package/dist/chat/index.js +4 -4
- package/dist/chat/index.js.map +3 -3
- package/dist/command-implementations/add-command.js +2 -6
- package/dist/command-implementations/add-command.js.map +2 -2
- package/dist/command-implementations/deploy-command.js +5 -0
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/project-command.js +6 -2
- package/dist/command-implementations/project-command.js.map +2 -2
- package/dist/linter/rulesets/integration.ruleset.js +2 -2
- package/dist/linter/rulesets/integration.ruleset.js.map +1 -1
- package/dist/utils/schema-utils.d.ts +4 -1
- package/dist/utils/schema-utils.js +7 -2
- package/dist/utils/schema-utils.js.map +2 -2
- package/package.json +3 -3
- package/templates/empty-bot/package.json +1 -1
- package/templates/empty-integration/package.json +1 -1
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/package.json +1 -1
- package/templates/webhook-message/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/linter/rulesets/integration.ruleset.ts"],
|
|
4
|
-
"sourcesContent": ["import { type RulesetDefinition } from '@stoplight/spectral-core'\nimport { falsy, truthy } from '@stoplight/spectral-functions'\nimport { truthyWithMessage } from '../spectral-functions'\n\nexport const INTEGRATION_RULESET = {\n extends: [],\n rules: {\n 'integration-title-must-be-present': {\n description: 'The integration MUST have a non-empty title',\n severity: 'error',\n given: '$',\n then: [{ field: 'title', function: truthy }],\n },\n 'integration-description-must-be-present': {\n description: 'The integration MUST have a non-empty description',\n severity: 'error',\n given: '$',\n then: [{ field: 'description', function: truthy }],\n },\n 'integration-must-have-an-icon': {\n description: 'The integration MUST have an icon',\n severity: 'error',\n given: '$',\n then: [{ field: 'icon', function: truthy }],\n },\n 'integration-must-have-a-readme-file': {\n description: 'The integration MUST have a readme file',\n severity: 'error',\n given: '$',\n then: [{ field: 'readme', function: truthy }],\n },\n 'actions-should-have-a-title': {\n description: 'All actions SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.actions[*]',\n then: [{ field: 'title', function: truthyWithMessage(({ path }) => `action \"${path[1]}\"`) }],\n },\n 'actions-must-have-a-description': {\n description: 'All actions MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.actions[*]',\n then: [{ field: 'description', function: truthyWithMessage(({ path }) => `action \"${path[1]}\"`) }],\n },\n 'action-inputparams-should-have-a-title': {\n description: 'All action input parameters SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.actions[*].input..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `input parameter \"${path.at(-3)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'action-inputparams-must-have-a-description': {\n description: 'All action input parameters MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.actions[*].input..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `input parameter \"${path.at(-2)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'action-outputparams-should-have-a-title': {\n description: 'All action output parameters SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.actions[*].output..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-3)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'action-outputparams-must-have-a-description': {\n description: 'All action output parameters MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.actions[*].output..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-2)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'event-outputparams-should-have-title': {\n description: 'All event output parameters SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.events[*]..schema.properties[*]',\n then: [\n {\n field: 'x-zui.title',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-3)}\" of event \"${path[1]}\"`),\n },\n ],\n },\n 'event-outputparams-must-have-description': {\n description: 'All event output parameters MUST have a description',\n message:\n '{{description}}: {{error}} SHOULD provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.events[*]..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-2)}\" of event \"${path[1]}\"`),\n },\n ],\n },\n 'events-must-have-a-title': {\n description: 'All events MUST have a title',\n message: '{{description}}: {{error}} MUST be a non-empty string',\n severity: 'error',\n given: '$.events[*]',\n then: [{ field: 'title', function: truthyWithMessage(({ path }) => `event \"${path[1]}\"`) }],\n },\n 'events-must-have-a-description': {\n description: 'All events MUST have a description',\n message: '{{description}}: {{error}} MUST be a non-empty string',\n severity: 'error',\n given: '$.events[*]',\n then: [{ field: 'description', function: truthyWithMessage(({ path }) => `event \"${path[1]}\"`) }],\n },\n 'consider-migrating-to-configurations': {\n description:\n 'Consider migrating to the new multiple configuration format: you MAY move your configuration from \"configuration\" to \"configurations\" and remove the \"configuration\" property',\n severity: 'off',\n given: '$',\n then: [\n { field: 'configuration', function: falsy },\n { field: 'configurations', function: truthy },\n ],\n },\n 'configuration-fields-must-have-a-title': {\n description: 'All configuration fields MUST have a title',\n message: '{{description}}: {{error}} MUST provide a non-empty title by using .title() in its Zod schema',\n severity: 'error',\n given: '$.configuration..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `configuration parameter \"${path.at(-3)}\"`),\n },\n ],\n },\n 'configuration-fields-must-have-a-description': {\n description: 'All configuration fields MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.configuration..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `configuration parameter \"${path.at(-2)}\"`),\n },\n ],\n },\n 'multiple-configurations-must-have-a-title': {\n description: 'Multiple configuration definitions MUST have a title',\n message: '{{description}}: {{error}} MUST have a title',\n severity: 'error',\n given: '$.configurations[*]',\n then: [{ field: 'title', function: truthyWithMessage(({ path }) => `configuration \"${path[1]}\"`) }],\n },\n 'multiple-configurations-must-have-a-description': {\n description: 'Multiple configuration definitions MUST have a description',\n message: '{{description}}: {{error}} MUST have a description',\n severity: 'error',\n given: '$.configurations[*]',\n then: [{ field: 'description', function: truthyWithMessage(({ path }) => `configuration \"${path[1]}\"`) }],\n },\n 'multipes-configurations-fields-must-have-a-title': {\n description: 'All configuration fields in multiple configurations MUST have a title',\n message: '{{description}}: {{error}} MUST provide a non-empty title by using .title() in its Zod schema',\n severity: 'error',\n given: '$.configurations[*]..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(\n ({ path }) => `configuration field \"${path.at(-3)}\" of configuration \"${path[1]}\"`\n ),\n },\n ],\n },\n 'multipes-configurations-fields-must-have-a-description': {\n description: 'All configuration fields in multiple configurations MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.configurations[*]..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(\n ({ path }) => `configuration field \"${path.at(-2)}\" of configuration \"${path[1]}\"`\n ),\n },\n ],\n },\n 'user-tags-should-have-a-title': {\n description: 'All user tags SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.user.tags[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `user tag \"${path[2]}\"`),\n },\n ],\n },\n 'user-tags-must-have-a-description': {\n description: 'All user tags MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.user.tags[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `user tag \"${path[2]}\"`),\n },\n ],\n },\n 'channels-should-have-a-title': {\n description: 'All channels SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.channels[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-must-have-a-description': {\n description: 'All channels MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.channels[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-conversation-tags-should-have-a-title': {\n description: 'All conversation tags SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.channels[*].conversation.tags[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `conversation tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-conversation-tags-must-have-a-description': {\n description: 'All conversation tags MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.channels[*].conversation.tags[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `conversation tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-message-tags-should-have-a-title': {\n description: 'All message tags SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.channels[*].message.tags[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `message tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-message-tags-must-have-a-description': {\n description: 'All message tags MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.channels[*].message.tags[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `message tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'legacy-zui-title-should-be-removed': {\n description:\n 'Legacy ZUI title fields (ui.title) SHOULD be removed. Please use .title() in your Zod schemas instead',\n severity: 'error',\n given: '$..ui[*].title',\n then: [{ function: falsy }],\n },\n 'legacy-zui-examples-should-be-removed': {\n description: 'Legacy ZUI examples fields (ui.examples) SHOULD be removed. There are currently no alternatives',\n severity: 'hint',\n given: '$..ui[*].examples',\n then: [{ function: falsy }],\n },\n 'state-fields-should-have-title': {\n description: 'All state fields SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.states[*]..schema.properties[*]',\n then: [\n {\n field: 'x-zui.title',\n function: truthyWithMessage(({ path }) => `field \"${path.at(-3)}\" of state \"${path[1]}\"`),\n },\n ],\n },\n 'state-fields-must-have-description': {\n description: 'All state fields MUST have a description',\n message:\n '{{description}}: {{error}} SHOULD provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.states[*]..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `field \"${path.at(-2)}\" of state \"${path[1]}\"`),\n },\n ],\n },\n 'secrets-must-have-a-description': {\n description: 'All secrets MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.secrets[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `secret \"${path[1]}\"`),\n },\n ],\n },\n },\n} satisfies RulesetDefinition\n"],
|
|
4
|
+
"sourcesContent": ["import { type RulesetDefinition } from '@stoplight/spectral-core'\nimport { falsy, truthy } from '@stoplight/spectral-functions'\nimport { truthyWithMessage } from '../spectral-functions'\n\nexport const INTEGRATION_RULESET = {\n extends: [],\n rules: {\n 'integration-title-must-be-present': {\n description: 'The integration MUST have a non-empty title',\n severity: 'error',\n given: '$',\n then: [{ field: 'title', function: truthy }],\n },\n 'integration-description-must-be-present': {\n description: 'The integration MUST have a non-empty description',\n severity: 'error',\n given: '$',\n then: [{ field: 'description', function: truthy }],\n },\n 'integration-must-have-an-icon': {\n description: 'The integration MUST have an icon',\n severity: 'error',\n given: '$',\n then: [{ field: 'icon', function: truthy }],\n },\n 'integration-must-have-a-readme-file': {\n description: 'The integration MUST have a readme file',\n severity: 'error',\n given: '$',\n then: [{ field: 'readme', function: truthy }],\n },\n 'actions-should-have-a-title': {\n description: 'All actions SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.actions[*]',\n then: [{ field: 'title', function: truthyWithMessage(({ path }) => `action \"${path[1]}\"`) }],\n },\n 'actions-must-have-a-description': {\n description: 'All actions MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.actions[*]',\n then: [{ field: 'description', function: truthyWithMessage(({ path }) => `action \"${path[1]}\"`) }],\n },\n 'action-inputparams-should-have-a-title': {\n description: 'All action input parameters SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.actions[*].input..schema.properties[*]',\n then: [\n {\n field: 'x-zui.title',\n function: truthyWithMessage(({ path }) => `input parameter \"${path.at(-3)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'action-inputparams-must-have-a-description': {\n description: 'All action input parameters MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.actions[*].input..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `input parameter \"${path.at(-2)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'action-outputparams-should-have-a-title': {\n description: 'All action output parameters SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.actions[*].output..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-3)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'action-outputparams-must-have-a-description': {\n description: 'All action output parameters MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.actions[*].output..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-2)}\" of action \"${path[1]}\"`),\n },\n ],\n },\n 'event-outputparams-should-have-title': {\n description: 'All event output parameters SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.events[*]..schema.properties[*]',\n then: [\n {\n field: 'x-zui.title',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-3)}\" of event \"${path[1]}\"`),\n },\n ],\n },\n 'event-outputparams-must-have-description': {\n description: 'All event output parameters MUST have a description',\n message:\n '{{description}}: {{error}} SHOULD provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.events[*]..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `output parameter \"${path.at(-2)}\" of event \"${path[1]}\"`),\n },\n ],\n },\n 'events-must-have-a-title': {\n description: 'All events MUST have a title',\n message: '{{description}}: {{error}} MUST be a non-empty string',\n severity: 'error',\n given: '$.events[*]',\n then: [{ field: 'title', function: truthyWithMessage(({ path }) => `event \"${path[1]}\"`) }],\n },\n 'events-must-have-a-description': {\n description: 'All events MUST have a description',\n message: '{{description}}: {{error}} MUST be a non-empty string',\n severity: 'error',\n given: '$.events[*]',\n then: [{ field: 'description', function: truthyWithMessage(({ path }) => `event \"${path[1]}\"`) }],\n },\n 'consider-migrating-to-configurations': {\n description:\n 'Consider migrating to the new multiple configuration format: you MAY move your configuration from \"configuration\" to \"configurations\" and remove the \"configuration\" property',\n severity: 'off',\n given: '$',\n then: [\n { field: 'configuration', function: falsy },\n { field: 'configurations', function: truthy },\n ],\n },\n 'configuration-fields-must-have-a-title': {\n description: 'All configuration fields MUST have a title',\n message: '{{description}}: {{error}} MUST provide a non-empty title by using .title() in its Zod schema',\n severity: 'error',\n given: '$.configuration..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `configuration parameter \"${path.at(-3)}\"`),\n },\n ],\n },\n 'configuration-fields-must-have-a-description': {\n description: 'All configuration fields MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.configuration..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `configuration parameter \"${path.at(-2)}\"`),\n },\n ],\n },\n 'multiple-configurations-must-have-a-title': {\n description: 'Multiple configuration definitions MUST have a title',\n message: '{{description}}: {{error}} MUST have a title',\n severity: 'error',\n given: '$.configurations[*]',\n then: [{ field: 'title', function: truthyWithMessage(({ path }) => `configuration \"${path[1]}\"`) }],\n },\n 'multiple-configurations-must-have-a-description': {\n description: 'Multiple configuration definitions MUST have a description',\n message: '{{description}}: {{error}} MUST have a description',\n severity: 'error',\n given: '$.configurations[*]',\n then: [{ field: 'description', function: truthyWithMessage(({ path }) => `configuration \"${path[1]}\"`) }],\n },\n 'multipes-configurations-fields-must-have-a-title': {\n description: 'All configuration fields in multiple configurations MUST have a title',\n message: '{{description}}: {{error}} MUST provide a non-empty title by using .title() in its Zod schema',\n severity: 'error',\n given: '$.configurations[*]..schema.properties[*].x-zui',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(\n ({ path }) => `configuration field \"${path.at(-3)}\" of configuration \"${path[1]}\"`\n ),\n },\n ],\n },\n 'multipes-configurations-fields-must-have-a-description': {\n description: 'All configuration fields in multiple configurations MUST have a description',\n message: '{{description}}: {{error}} MUST provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.configurations[*]..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(\n ({ path }) => `configuration field \"${path.at(-2)}\" of configuration \"${path[1]}\"`\n ),\n },\n ],\n },\n 'user-tags-should-have-a-title': {\n description: 'All user tags SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.user.tags[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `user tag \"${path[2]}\"`),\n },\n ],\n },\n 'user-tags-must-have-a-description': {\n description: 'All user tags MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.user.tags[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `user tag \"${path[2]}\"`),\n },\n ],\n },\n 'channels-should-have-a-title': {\n description: 'All channels SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.channels[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-must-have-a-description': {\n description: 'All channels MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.channels[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-conversation-tags-should-have-a-title': {\n description: 'All conversation tags SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.channels[*].conversation.tags[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `conversation tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-conversation-tags-must-have-a-description': {\n description: 'All conversation tags MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.channels[*].conversation.tags[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `conversation tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-message-tags-should-have-a-title': {\n description: 'All message tags SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD have a non-empty title',\n severity: 'warn',\n given: '$.channels[*].message.tags[*]',\n then: [\n {\n field: 'title',\n function: truthyWithMessage(({ path }) => `message tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'channels-message-tags-must-have-a-description': {\n description: 'All message tags MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.channels[*].message.tags[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `message tag \"${path.at(-2)}\" of channel \"${path[1]}\"`),\n },\n ],\n },\n 'legacy-zui-title-should-be-removed': {\n description:\n 'Legacy ZUI title fields (ui.title) SHOULD be removed. Please use .title() in your Zod schemas instead',\n severity: 'error',\n given: '$..ui[*].title',\n then: [{ function: falsy }],\n },\n 'legacy-zui-examples-should-be-removed': {\n description: 'Legacy ZUI examples fields (ui.examples) SHOULD be removed. There are currently no alternatives',\n severity: 'hint',\n given: '$..ui[*].examples',\n then: [{ function: falsy }],\n },\n 'state-fields-should-have-title': {\n description: 'All state fields SHOULD have a title',\n message: '{{description}}: {{error}} SHOULD provide a non-empty title by using .title() in its Zod schema',\n severity: 'warn',\n given: '$.states[*]..schema.properties[*]',\n then: [\n {\n field: 'x-zui.title',\n function: truthyWithMessage(({ path }) => `field \"${path.at(-3)}\" of state \"${path[1]}\"`),\n },\n ],\n },\n 'state-fields-must-have-description': {\n description: 'All state fields MUST have a description',\n message:\n '{{description}}: {{error}} SHOULD provide a non-empty description by using .describe() in its Zod schema',\n severity: 'error',\n given: '$.states[*]..schema.properties[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `field \"${path.at(-2)}\" of state \"${path[1]}\"`),\n },\n ],\n },\n 'secrets-must-have-a-description': {\n description: 'All secrets MUST have a description',\n message: '{{description}}: {{error}} MUST have a non-empty description',\n severity: 'error',\n given: '$.secrets[*]',\n then: [\n {\n field: 'description',\n function: truthyWithMessage(({ path }) => `secret \"${path[1]}\"`),\n },\n ],\n },\n },\n} satisfies RulesetDefinition\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAA8B;AAC9B,IAAAA,6BAAkC;AAE3B,MAAM,sBAAsB;AAAA,EACjC,SAAS,CAAC;AAAA,EACV,OAAO;AAAA,IACL,qCAAqC;AAAA,MACnC,aAAa;AAAA,MACb,UAAU;AAAA,MACV,OAAO;AAAA,MACP,MAAM,CAAC,EAAE,OAAO,SAAS,UAAU,iCAAO,CAAC;AAAA,IAC7C;AAAA,IACA,2CAA2C;AAAA,MACzC,aAAa;AAAA,MACb,UAAU;AAAA,MACV,OAAO;AAAA,MACP,MAAM,CAAC,EAAE,OAAO,eAAe,UAAU,iCAAO,CAAC;AAAA,IACnD;AAAA,IACA,iCAAiC;AAAA,MAC/B,aAAa;AAAA,MACb,UAAU;AAAA,MACV,OAAO;AAAA,MACP,MAAM,CAAC,EAAE,OAAO,QAAQ,UAAU,iCAAO,CAAC;AAAA,IAC5C;AAAA,IACA,uCAAuC;AAAA,MACrC,aAAa;AAAA,MACb,UAAU;AAAA,MACV,OAAO;AAAA,MACP,MAAM,CAAC,EAAE,OAAO,UAAU,UAAU,iCAAO,CAAC;AAAA,IAC9C;AAAA,IACA,+BAA+B;AAAA,MAC7B,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAA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;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["import_spectral_functions"]
|
|
7
7
|
}
|
|
@@ -8,6 +8,9 @@ type SchemaDefinition = {
|
|
|
8
8
|
schema: sdk.ZuiObjectOrRefSchema;
|
|
9
9
|
ui?: Record<string, SchemaOptions | undefined>;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type MapSchemaOptions = {
|
|
12
|
+
useLegacyZuiTransformer?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function mapZodToJsonSchema(definition: SchemaDefinition, options: MapSchemaOptions): Promise<ReturnType<typeof sdk.transforms.toJSONSchemaLegacy>>;
|
|
12
15
|
export declare const dereferenceSchema: (schema: JSONSchema7) => Promise<JSONSchema7>;
|
|
13
16
|
export {};
|
|
@@ -35,8 +35,13 @@ module.exports = __toCommonJS(schema_utils_exports);
|
|
|
35
35
|
var import_json_schema_ref_parser = require("@apidevtools/json-schema-ref-parser");
|
|
36
36
|
var sdk = __toESM(require("@botpress/sdk"));
|
|
37
37
|
const isObjectSchema = (schema) => schema.type === "object";
|
|
38
|
-
async function mapZodToJsonSchema(definition) {
|
|
39
|
-
let schema
|
|
38
|
+
async function mapZodToJsonSchema(definition, options) {
|
|
39
|
+
let schema;
|
|
40
|
+
if (options.useLegacyZuiTransformer) {
|
|
41
|
+
schema = sdk.transforms.toJSONSchemaLegacy(definition.schema, { target: "jsonSchema7" });
|
|
42
|
+
} else {
|
|
43
|
+
schema = sdk.transforms.toJSONSchema(definition.schema);
|
|
44
|
+
}
|
|
40
45
|
schema = await dereferenceSchema(schema);
|
|
41
46
|
if (!isObjectSchema(schema) || !definition.ui) {
|
|
42
47
|
return schema;
|
|
@@ -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 * as sdk from '@botpress/sdk'\nimport { JSONSchema7 } from 'json-schema'\n\ntype ZuiToJsonSchema = typeof sdk.transforms.toJSONSchemaLegacy\ntype JsonSchema = ReturnType<ZuiToJsonSchema>\n\ntype SchemaOptions = {\n title?: string\n examples?: any[]\n}\n\ntype SchemaDefinition = {\n schema: sdk.ZuiObjectOrRefSchema\n ui?: Record<string, SchemaOptions | undefined>\n}\n\nconst isObjectSchema = (schema: JsonSchema): boolean => schema.type === 'object'\n\nexport async function mapZodToJsonSchema(\n definition: SchemaDefinition\n): Promise<ReturnType<typeof sdk.transforms.toJSONSchemaLegacy>> {\n let schema = sdk.transforms.toJSONSchemaLegacy(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,UAAqB;
|
|
4
|
+
"sourcesContent": ["import { dereference } from '@apidevtools/json-schema-ref-parser'\nimport * as sdk from '@botpress/sdk'\nimport { JSONSchema7 } from 'json-schema'\n\ntype ZuiToJsonSchema = typeof sdk.transforms.toJSONSchemaLegacy\ntype JsonSchema = ReturnType<ZuiToJsonSchema>\n\ntype SchemaOptions = {\n title?: string\n examples?: any[]\n}\n\ntype SchemaDefinition = {\n schema: sdk.ZuiObjectOrRefSchema\n ui?: Record<string, SchemaOptions | undefined>\n}\n\ntype MapSchemaOptions = {\n useLegacyZuiTransformer?: boolean\n}\n\nconst isObjectSchema = (schema: JsonSchema): boolean => schema.type === 'object'\n\nexport async function mapZodToJsonSchema(\n definition: SchemaDefinition,\n options: MapSchemaOptions\n): Promise<ReturnType<typeof sdk.transforms.toJSONSchemaLegacy>> {\n let schema: JSONSchema7\n if (options.useLegacyZuiTransformer) {\n schema = sdk.transforms.toJSONSchemaLegacy(definition.schema, { target: 'jsonSchema7' })\n } else {\n schema = sdk.transforms.toJSONSchema(definition.schema)\n }\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,UAAqB;AAoBrB,MAAM,iBAAiB,CAAC,WAAgC,OAAO,SAAS;AAExE,eAAsB,mBACpB,YACA,SAC+D;AAC/D,MAAI;AACJ,MAAI,QAAQ,yBAAyB;AACnC,aAAS,IAAI,WAAW,mBAAmB,WAAW,QAAQ,EAAE,QAAQ,cAAc,CAAC;AAAA,EACzF,OAAO;AACL,aAAS,IAAI,WAAW,aAAa,WAAW,MAAM;AAAA,EACxD;AACA,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,GAAG;AAExC,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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.0",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run build:types && pnpm run bundle && pnpm run template:gen",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
|
25
|
-
"@botpress/chat": "0.5.
|
|
25
|
+
"@botpress/chat": "0.5.2",
|
|
26
26
|
"@botpress/client": "1.25.0",
|
|
27
|
-
"@botpress/sdk": "4.15.
|
|
27
|
+
"@botpress/sdk": "4.15.11",
|
|
28
28
|
"@bpinternal/const": "^0.1.0",
|
|
29
29
|
"@bpinternal/tunnel": "^0.1.1",
|
|
30
30
|
"@bpinternal/yargs-extra": "^0.0.3",
|