lua-cli 3.5.0-alpha.3 → 3.5.0-beta.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/README.md +137 -689
- package/dist/api/agent.api.service.d.ts +1 -8
- package/dist/api/agent.api.service.js +1 -11
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/api/auth.api.service.d.ts +1 -1
- package/dist/api/auth.api.service.js +1 -1
- package/dist/api/auth.api.service.js.map +1 -1
- package/dist/api/backup.api.service.d.ts +80 -0
- package/dist/api/backup.api.service.js +101 -0
- package/dist/api/backup.api.service.js.map +1 -0
- package/dist/api/basket.api.service.d.ts +4 -5
- package/dist/api/basket.api.service.js +13 -18
- package/dist/api/basket.api.service.js.map +1 -1
- package/dist/api/cdn.api.service.d.ts +2 -0
- package/dist/api/cdn.api.service.js +2 -0
- package/dist/api/cdn.api.service.js.map +1 -1
- package/dist/api/chat.api.service.d.ts +10 -2
- package/dist/api/chat.api.service.js +21 -2
- package/dist/api/chat.api.service.js.map +1 -1
- package/dist/api/credentials.js +5 -8
- package/dist/api/credentials.js.map +1 -1
- package/dist/api/custom.data.api.service.d.ts +3 -3
- package/dist/api/custom.data.api.service.js +9 -10
- package/dist/api/custom.data.api.service.js.map +1 -1
- package/dist/api/developer.api.service.d.ts +1 -1
- package/dist/api/developer.api.service.js +1 -1
- package/dist/api/developer.api.service.js.map +1 -1
- package/dist/api/http.client.js.map +1 -0
- package/dist/api/job.api.service.d.ts +2 -2
- package/dist/api/job.api.service.js +2 -2
- package/dist/api/job.api.service.js.map +1 -1
- package/dist/api/logs.api.service.d.ts +1 -1
- package/dist/api/logs.api.service.js +1 -1
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/marketplace.api.service.d.ts +6 -6
- package/dist/api/marketplace.api.service.js.map +1 -1
- package/dist/api/order.api.service.d.ts +3 -4
- package/dist/api/order.api.service.js +8 -10
- package/dist/api/order.api.service.js.map +1 -1
- package/dist/api/persona.api.service.d.ts +1 -1
- package/dist/api/persona.api.service.js +1 -1
- package/dist/api/persona.api.service.js.map +1 -1
- package/dist/api/postprocessor.api.service.d.ts +1 -1
- package/dist/api/postprocessor.api.service.js +1 -1
- package/dist/api/postprocessor.api.service.js.map +1 -1
- package/dist/api/preprocessor.api.service.d.ts +1 -1
- package/dist/api/preprocessor.api.service.js +1 -1
- package/dist/api/preprocessor.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +4 -4
- package/dist/api/products.api.service.js +6 -6
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api/resource.api.service.d.ts +76 -0
- package/dist/api/resource.api.service.js +74 -0
- package/dist/api/resource.api.service.js.map +1 -0
- package/dist/api/skills.api.service.d.ts +7 -15
- package/dist/api/skills.api.service.js +1 -1
- package/dist/api/skills.api.service.js.map +1 -1
- package/dist/api/tool.api.service.d.ts +1 -1
- package/dist/api/tool.api.service.js +1 -1
- package/dist/api/tool.api.service.js.map +1 -1
- package/dist/api/unifiedto.api.service.d.ts +1 -1
- package/dist/api/unifiedto.api.service.js +1 -1
- package/dist/api/unifiedto.api.service.js.map +1 -1
- package/dist/api/user.data.api.service.d.ts +7 -8
- package/dist/api/user.data.api.service.js +2 -3
- package/dist/api/user.data.api.service.js.map +1 -1
- package/dist/api/webhook.api.service.d.ts +1 -1
- package/dist/api/webhook.api.service.js +1 -1
- package/dist/api/webhook.api.service.js.map +1 -1
- package/dist/api/whatsapp-templates.api.service.d.ts +1 -1
- package/dist/api/whatsapp-templates.api.service.js +1 -1
- package/dist/api/whatsapp-templates.api.service.js.map +1 -1
- package/dist/api-exports.d.ts +14 -12
- package/dist/api-exports.js +8 -8
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.js +32 -17
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/admin.js +3 -24
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/agents.d.ts +8 -7
- package/dist/commands/agents.js +63 -21
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channels.js +11 -23
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.js +33 -47
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.js +11 -41
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.d.ts +26 -23
- package/dist/commands/compile.js +98 -403
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.js +1 -1
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/deploy.js +55 -25
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +29 -45
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/env.js +12 -25
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/evals.js +3 -20
- package/dist/commands/evals.js.map +1 -1
- package/dist/commands/features.js +10 -23
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +135 -19
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.js +26 -37
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.js +32 -56
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/logs.js +9 -20
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.js +34 -52
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.js +10 -23
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/persona.js +43 -74
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.js +15 -28
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.js +15 -28
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.js +30 -63
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.js +294 -1241
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts +22 -0
- package/dist/commands/pushBackup.js +133 -0
- package/dist/commands/pushBackup.js.map +1 -0
- package/dist/commands/resources.js +29 -72
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.js +58 -70
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sync.d.ts +1 -3
- package/dist/commands/sync.js +12 -24
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.js +135 -104
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/webhooks.js +15 -28
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts +104 -0
- package/dist/compiler/agent-traverser.js +311 -0
- package/dist/compiler/agent-traverser.js.map +1 -0
- package/dist/compiler/bundler.d.ts +42 -0
- package/dist/compiler/bundler.js +187 -0
- package/dist/compiler/bundler.js.map +1 -0
- package/dist/compiler/compiler.d.ts +177 -0
- package/dist/compiler/compiler.js +580 -0
- package/dist/compiler/compiler.js.map +1 -0
- package/dist/compiler/index.d.ts +36 -0
- package/dist/compiler/index.js +42 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/plugins/base.d.ts +264 -0
- package/dist/compiler/plugins/base.js +307 -0
- package/dist/compiler/plugins/base.js.map +1 -0
- package/dist/compiler/plugins/job.plugin.d.ts +33 -0
- package/dist/compiler/plugins/job.plugin.js +143 -0
- package/dist/compiler/plugins/job.plugin.js.map +1 -0
- package/dist/compiler/plugins/mcp-server.plugin.d.ts +50 -0
- package/dist/compiler/plugins/mcp-server.plugin.js +186 -0
- package/dist/compiler/plugins/mcp-server.plugin.js.map +1 -0
- package/dist/compiler/plugins/postprocessor.plugin.d.ts +20 -0
- package/dist/compiler/plugins/postprocessor.plugin.js +39 -0
- package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -0
- package/dist/compiler/plugins/preprocessor.plugin.d.ts +20 -0
- package/dist/compiler/plugins/preprocessor.plugin.js +48 -0
- package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -0
- package/dist/compiler/plugins/processor-base.d.ts +16 -0
- package/dist/compiler/plugins/processor-base.js +34 -0
- package/dist/compiler/plugins/processor-base.js.map +1 -0
- package/dist/compiler/plugins/registry.d.ts +61 -0
- package/dist/compiler/plugins/registry.js +107 -0
- package/dist/compiler/plugins/registry.js.map +1 -0
- package/dist/compiler/plugins/skill.plugin.d.ts +71 -0
- package/dist/compiler/plugins/skill.plugin.js +243 -0
- package/dist/compiler/plugins/skill.plugin.js.map +1 -0
- package/dist/compiler/plugins/tool.plugin.d.ts +67 -0
- package/dist/compiler/plugins/tool.plugin.js +279 -0
- package/dist/compiler/plugins/tool.plugin.js.map +1 -0
- package/dist/compiler/plugins/webhook.plugin.d.ts +37 -0
- package/dist/compiler/plugins/webhook.plugin.js +127 -0
- package/dist/compiler/plugins/webhook.plugin.js.map +1 -0
- package/dist/compiler/source-writer.d.ts +98 -0
- package/dist/compiler/source-writer.js +223 -0
- package/dist/compiler/source-writer.js.map +1 -0
- package/dist/compiler/types.d.ts +289 -0
- package/dist/compiler/types.js +20 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/compiler/utils/ast-helpers.d.ts +57 -0
- package/dist/compiler/utils/ast-helpers.js +164 -0
- package/dist/compiler/utils/ast-helpers.js.map +1 -0
- package/dist/compiler/utils/common.d.ts +23 -0
- package/dist/compiler/utils/common.js +66 -0
- package/dist/compiler/utils/common.js.map +1 -0
- package/dist/compiler/utils/file-discovery.d.ts +34 -0
- package/dist/compiler/utils/file-discovery.js +68 -0
- package/dist/compiler/utils/file-discovery.js.map +1 -0
- package/dist/compiler/utils/path-resolver.d.ts +25 -0
- package/dist/compiler/utils/path-resolver.js +66 -0
- package/dist/compiler/utils/path-resolver.js.map +1 -0
- package/dist/compiler/utils/schema-converter.d.ts +26 -0
- package/dist/compiler/utils/schema-converter.js +94 -0
- package/dist/compiler/utils/schema-converter.js.map +1 -0
- package/dist/config/compile.constants.d.ts +2 -22
- package/dist/config/compile.constants.js +2 -49
- package/dist/config/compile.constants.js.map +1 -1
- package/dist/config/constants.d.ts +18 -2
- package/dist/config/constants.js +28 -8
- package/dist/config/constants.js.map +1 -1
- package/dist/config/dev.constants.d.ts +0 -10
- package/dist/config/dev.constants.js +0 -10
- package/dist/config/dev.constants.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/instances/basket.instance.js.map +1 -0
- package/dist/instances/data.entry.instance.js.map +1 -0
- package/dist/instances/job.instance.js.map +1 -0
- package/dist/instances/order.instance.js.map +1 -0
- package/dist/instances/product.instance.js.map +1 -0
- package/dist/instances/product.pagination.instance.js.map +1 -0
- package/dist/instances/product.search.instance.js.map +1 -0
- package/dist/instances/user.instance.js.map +1 -0
- package/dist/interfaces/admin.d.ts +0 -38
- package/dist/interfaces/backup.d.ts +125 -0
- package/dist/interfaces/backup.js +8 -0
- package/dist/interfaces/backup.js.map +1 -0
- package/dist/interfaces/baskets.d.ts +0 -56
- package/dist/interfaces/common.d.ts +1 -0
- package/dist/interfaces/deploy.d.ts +0 -15
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/interfaces/marketplace.d.ts +51 -0
- package/dist/interfaces/marketplace.js +1 -1
- package/dist/interfaces/marketplace.js.map +1 -1
- package/dist/interfaces/message.d.ts +0 -3
- package/dist/interfaces/orders.d.ts +0 -24
- package/dist/interfaces/postprocessors.d.ts +0 -18
- package/dist/interfaces/preprocessors.d.ts +0 -18
- package/dist/interfaces/skills.d.ts +61 -0
- package/dist/interfaces/user.d.ts +25 -0
- package/dist/interfaces/webhooks.d.ts +0 -9
- package/dist/primitives/base.handler.d.ts +106 -0
- package/dist/primitives/base.handler.js +370 -0
- package/dist/primitives/base.handler.js.map +1 -0
- package/dist/primitives/index.d.ts +47 -0
- package/dist/primitives/index.js +78 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/job.handler.d.ts +52 -0
- package/dist/primitives/job.handler.js +118 -0
- package/dist/primitives/job.handler.js.map +1 -0
- package/dist/primitives/mcp-server.handler.d.ts +54 -0
- package/dist/primitives/mcp-server.handler.js +91 -0
- package/dist/primitives/mcp-server.handler.js.map +1 -0
- package/dist/primitives/postprocessor.handler.d.ts +49 -0
- package/dist/primitives/postprocessor.handler.js +81 -0
- package/dist/primitives/postprocessor.handler.js.map +1 -0
- package/dist/primitives/preprocessor.handler.d.ts +54 -0
- package/dist/primitives/preprocessor.handler.js +95 -0
- package/dist/primitives/preprocessor.handler.js.map +1 -0
- package/dist/primitives/skill.handler.d.ts +44 -0
- package/dist/primitives/skill.handler.js +192 -0
- package/dist/primitives/skill.handler.js.map +1 -0
- package/dist/primitives/types.d.ts +72 -0
- package/dist/primitives/types.js +17 -0
- package/dist/primitives/types.js.map +1 -0
- package/dist/primitives/webhook.handler.d.ts +50 -0
- package/dist/primitives/webhook.handler.js +96 -0
- package/dist/primitives/webhook.handler.js.map +1 -0
- package/dist/services/auth.js +1 -2
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts +103 -0
- package/dist/services/sandbox.service.js +479 -0
- package/dist/services/sandbox.service.js.map +1 -0
- package/dist/types/api-contracts.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +8 -2
- package/dist/types/skill.js +8 -0
- package/dist/types/skill.js.map +1 -1
- package/dist/types/yaml.types.d.ts +69 -0
- package/dist/types/yaml.types.js +6 -0
- package/dist/types/yaml.types.js.map +1 -0
- package/dist/utils/artifact-loader.d.ts +108 -0
- package/dist/utils/artifact-loader.js +188 -0
- package/dist/utils/artifact-loader.js.map +1 -0
- package/dist/utils/backup-helpers.d.ts +122 -0
- package/dist/utils/backup-helpers.js +274 -0
- package/dist/utils/backup-helpers.js.map +1 -0
- package/dist/utils/cli.d.ts +8 -0
- package/dist/utils/cli.js +19 -2
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/command-utils.d.ts +42 -0
- package/dist/utils/command-utils.js +83 -0
- package/dist/utils/command-utils.js.map +1 -0
- package/dist/utils/deploy-helpers.d.ts +0 -29
- package/dist/utils/deploy-helpers.js +0 -70
- package/dist/utils/deploy-helpers.js.map +1 -1
- package/dist/utils/dev-api.d.ts +3 -99
- package/dist/utils/dev-api.js +3 -430
- package/dist/utils/dev-api.js.map +1 -1
- package/dist/utils/dev-server.d.ts +3 -1
- package/dist/utils/dev-server.js +69 -145
- package/dist/utils/dev-server.js.map +1 -1
- package/dist/utils/dev-watcher.d.ts +0 -1
- package/dist/utils/dev-watcher.js +23 -8
- package/dist/utils/dev-watcher.js.map +1 -1
- package/dist/utils/env-loader.utils.d.ts +10 -1
- package/dist/utils/env-loader.utils.js +39 -31
- package/dist/utils/env-loader.utils.js.map +1 -1
- package/dist/utils/files.d.ts +47 -3
- package/dist/utils/files.js +98 -40
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/init-agent.js +1 -2
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts +2 -10
- package/dist/utils/init-helpers.js +9 -17
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts +0 -8
- package/dist/utils/init-prompts.js +0 -22
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/prompt-handler.d.ts +3 -0
- package/dist/utils/prompt-handler.js +13 -0
- package/dist/utils/prompt-handler.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts +6 -5
- package/dist/utils/sandbox-storage.js +12 -12
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/dist/utils/sandbox.d.ts +7 -30
- package/dist/utils/sandbox.js +247 -223
- package/dist/utils/sandbox.js.map +1 -1
- package/dist/utils/semver.d.ts +12 -0
- package/dist/utils/semver.js +23 -0
- package/dist/utils/semver.js.map +1 -1
- package/dist/utils/sync-display.d.ts +9 -0
- package/dist/utils/sync-display.js +67 -0
- package/dist/utils/sync-display.js.map +1 -0
- package/dist/utils/sync-fetch.d.ts +23 -0
- package/dist/utils/sync-fetch.js +64 -0
- package/dist/utils/sync-fetch.js.map +1 -0
- package/dist/utils/sync-helpers.d.ts +4 -59
- package/dist/utils/sync-helpers.js +4 -206
- package/dist/utils/sync-helpers.js.map +1 -1
- package/dist/web/app.css +912 -186
- package/dist/web/app.js +46 -46
- package/docs/API_INDEX.md +100 -0
- package/docs/API_REFERENCE.md +773 -0
- package/docs/CLI_REFERENCE.md +924 -0
- package/docs/GETTING_STARTED.md +862 -0
- package/docs/README.md +270 -0
- package/docs/api/AI.md +882 -0
- package/docs/api/Baskets.md +511 -0
- package/docs/api/CDN.md +524 -0
- package/docs/api/Data.md +446 -0
- package/docs/api/Jobs.md +524 -0
- package/docs/api/LuaAgent.md +454 -0
- package/docs/api/LuaJob.md +604 -0
- package/docs/api/LuaSkill.md +396 -0
- package/docs/api/LuaTool.md +521 -0
- package/docs/api/LuaWebhook.md +601 -0
- package/docs/api/Orders.md +514 -0
- package/docs/api/PostProcessor.md +565 -0
- package/docs/api/PreProcessor.md +630 -0
- package/docs/api/Products.md +507 -0
- package/docs/api/Templates.md +662 -0
- package/docs/api/User.md +567 -0
- package/docs/archive/DEVELOPMENT_GUIDE_V1.md +1294 -0
- package/docs/compiler-v2/ASSESSMENT.md +205 -0
- package/docs/compiler-v2/TEST_PLAN.md +306 -0
- package/package.json +3 -7
- package/template/tsconfig.json +1 -1
- package/dist/common/basket.instance.js.map +0 -1
- package/dist/common/data.entry.instance.js.map +0 -1
- package/dist/common/http.client.js.map +0 -1
- package/dist/common/job.instance.js.map +0 -1
- package/dist/common/order.instance.js.map +0 -1
- package/dist/common/product.instance.js.map +0 -1
- package/dist/common/product.pagination.instance.js.map +0 -1
- package/dist/common/product.search.instance.js.map +0 -1
- package/dist/common/user.instance.js.map +0 -1
- package/dist/config/auth.constants.d.ts +0 -11
- package/dist/config/auth.constants.js +0 -12
- package/dist/config/auth.constants.js.map +0 -1
- package/dist/config/init.constants.d.ts +0 -15
- package/dist/config/init.constants.js +0 -20
- package/dist/config/init.constants.js.map +0 -1
- package/dist/interfaces/compile.d.ts +0 -12
- package/dist/interfaces/compile.js +0 -5
- package/dist/interfaces/compile.js.map +0 -1
- package/dist/types/compile.types.d.ts +0 -131
- package/dist/types/compile.types.js +0 -6
- package/dist/types/compile.types.js.map +0 -1
- package/dist/utils/agent-code-utils.d.ts +0 -25
- package/dist/utils/agent-code-utils.js +0 -107
- package/dist/utils/agent-code-utils.js.map +0 -1
- package/dist/utils/bundling.d.ts +0 -89
- package/dist/utils/bundling.js +0 -1068
- package/dist/utils/bundling.js.map +0 -1
- package/dist/utils/compile.d.ts +0 -116
- package/dist/utils/compile.js +0 -1062
- package/dist/utils/compile.js.map +0 -1
- package/dist/utils/deploy-api.d.ts +0 -26
- package/dist/utils/deploy-api.js +0 -54
- package/dist/utils/deploy-api.js.map +0 -1
- package/dist/utils/deployment.d.ts +0 -26
- package/dist/utils/deployment.js +0 -218
- package/dist/utils/deployment.js.map +0 -1
- package/dist/utils/dev-helpers.d.ts +0 -47
- package/dist/utils/dev-helpers.js +0 -82
- package/dist/utils/dev-helpers.js.map +0 -1
- package/dist/utils/job-management.d.ts +0 -27
- package/dist/utils/job-management.js +0 -248
- package/dist/utils/job-management.js.map +0 -1
- package/dist/utils/mcp-server-management.d.ts +0 -26
- package/dist/utils/mcp-server-management.js +0 -197
- package/dist/utils/mcp-server-management.js.map +0 -1
- package/dist/utils/postprocessor-management.d.ts +0 -9
- package/dist/utils/postprocessor-management.js +0 -117
- package/dist/utils/postprocessor-management.js.map +0 -1
- package/dist/utils/pre-bundle-jobs.d.ts +0 -27
- package/dist/utils/pre-bundle-jobs.js +0 -189
- package/dist/utils/pre-bundle-jobs.js.map +0 -1
- package/dist/utils/preprocessor-management.d.ts +0 -9
- package/dist/utils/preprocessor-management.js +0 -117
- package/dist/utils/preprocessor-management.js.map +0 -1
- package/dist/utils/push-api.d.ts +0 -15
- package/dist/utils/push-api.js +0 -49
- package/dist/utils/push-api.js.map +0 -1
- package/dist/utils/push-helpers.d.ts +0 -82
- package/dist/utils/push-helpers.js +0 -246
- package/dist/utils/push-helpers.js.map +0 -1
- package/dist/utils/skill-management.d.ts +0 -39
- package/dist/utils/skill-management.js +0 -299
- package/dist/utils/skill-management.js.map +0 -1
- package/dist/utils/test-helpers.d.ts +0 -33
- package/dist/utils/test-helpers.js +0 -84
- package/dist/utils/test-helpers.js.map +0 -1
- package/dist/utils/test-prompts.d.ts +0 -23
- package/dist/utils/test-prompts.js +0 -187
- package/dist/utils/test-prompts.js.map +0 -1
- package/dist/utils/tool-detection.d.ts +0 -19
- package/dist/utils/tool-detection.js +0 -125
- package/dist/utils/tool-detection.js.map +0 -1
- package/dist/utils/webhook-management.d.ts +0 -27
- package/dist/utils/webhook-management.js +0 -241
- package/dist/utils/webhook-management.js.map +0 -1
- /package/dist/{common → api}/http.client.d.ts +0 -0
- /package/dist/{common → api}/http.client.js +0 -0
- /package/dist/{common → instances}/basket.instance.d.ts +0 -0
- /package/dist/{common → instances}/basket.instance.js +0 -0
- /package/dist/{common → instances}/data.entry.instance.d.ts +0 -0
- /package/dist/{common → instances}/data.entry.instance.js +0 -0
- /package/dist/{common → instances}/job.instance.d.ts +0 -0
- /package/dist/{common → instances}/job.instance.js +0 -0
- /package/dist/{common → instances}/order.instance.d.ts +0 -0
- /package/dist/{common → instances}/order.instance.js +0 -0
- /package/dist/{common → instances}/product.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.instance.js +0 -0
- /package/dist/{common → instances}/product.pagination.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.pagination.instance.js +0 -0
- /package/dist/{common → instances}/product.search.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.search.instance.js +0 -0
- /package/dist/{common → instances}/user.instance.d.ts +0 -0
- /package/dist/{common → instances}/user.instance.js +0 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
# Products API
|
|
2
|
+
|
|
3
|
+
The Products API provides methods for managing your product catalog, including CRUD operations, search, and pagination.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Products } from 'lua-cli';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The Products API allows you to:
|
|
14
|
+
- List all products with pagination
|
|
15
|
+
- Search products
|
|
16
|
+
- Get product by ID
|
|
17
|
+
- Create new products
|
|
18
|
+
- Update existing products
|
|
19
|
+
- Delete products
|
|
20
|
+
|
|
21
|
+
## Methods
|
|
22
|
+
|
|
23
|
+
### `Products.get(pageOrOptions?, limit?)`
|
|
24
|
+
|
|
25
|
+
Retrieves products with pagination and optional filtering. Supports both legacy (page, limit) and new (options object) signatures.
|
|
26
|
+
|
|
27
|
+
**Signatures:**
|
|
28
|
+
```typescript
|
|
29
|
+
// Legacy signature
|
|
30
|
+
Products.get(page?: number, limit?: number): Promise<ProductPaginationInstance>
|
|
31
|
+
|
|
32
|
+
// New signature (v3.2.0+)
|
|
33
|
+
Products.get(options?: ProductFilterOptions): Promise<ProductPaginationInstance>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Parameters (Legacy):**
|
|
37
|
+
- `page` (number, optional) - Page number (default: 1)
|
|
38
|
+
- `limit` (number, optional) - Items per page (default: 10)
|
|
39
|
+
|
|
40
|
+
**Parameters (Options Object):**
|
|
41
|
+
- `options.page` (number, optional) - Page number
|
|
42
|
+
- `options.limit` (number, optional) - Items per page
|
|
43
|
+
- `options.filter` (object, optional) - MongoDB-style filter criteria
|
|
44
|
+
|
|
45
|
+
**Returns:** `Promise<ProductPaginationInstance>`
|
|
46
|
+
|
|
47
|
+
**Example:**
|
|
48
|
+
```typescript
|
|
49
|
+
// Get first page (10 items)
|
|
50
|
+
const products = await Products.get();
|
|
51
|
+
|
|
52
|
+
// Legacy: Get page 2 with 20 items
|
|
53
|
+
const page2 = await Products.get(2, 20);
|
|
54
|
+
|
|
55
|
+
// New: Get products with options object
|
|
56
|
+
const page3 = await Products.get({ page: 3, limit: 20 });
|
|
57
|
+
|
|
58
|
+
// Filter products by category
|
|
59
|
+
const electronics = await Products.get({ filter: { category: "Electronics" } });
|
|
60
|
+
|
|
61
|
+
// Filter with MongoDB operators
|
|
62
|
+
const affordable = await Products.get({
|
|
63
|
+
filter: { price: { $lte: 100 }, inStock: true }
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Combine pagination and filter
|
|
67
|
+
const filtered = await Products.get({
|
|
68
|
+
page: 1,
|
|
69
|
+
limit: 10,
|
|
70
|
+
filter: { category: "Clothing", price: { $gte: 20, $lte: 50 } }
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Access products
|
|
74
|
+
for (const product of products) {
|
|
75
|
+
console.log(product.name, product.price);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Pagination info
|
|
79
|
+
console.log(products.pagination.totalPages);
|
|
80
|
+
console.log(products.pagination.hasNextPage);
|
|
81
|
+
|
|
82
|
+
// Navigate pages
|
|
83
|
+
if (products.pagination.hasNextPage) {
|
|
84
|
+
const nextPage = await products.nextPage();
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Supported Filter Operators:**
|
|
89
|
+
- `$eq` - Equal to
|
|
90
|
+
- `$ne` - Not equal to
|
|
91
|
+
- `$gt` - Greater than
|
|
92
|
+
- `$gte` - Greater than or equal
|
|
93
|
+
- `$lt` - Less than
|
|
94
|
+
- `$lte` - Less than or equal
|
|
95
|
+
- `$in` - In array
|
|
96
|
+
- `$nin` - Not in array
|
|
97
|
+
|
|
98
|
+
### `Products.search(query, limit?)`
|
|
99
|
+
|
|
100
|
+
Searches products by name or description.
|
|
101
|
+
|
|
102
|
+
**Parameters:**
|
|
103
|
+
- `query` (string) - Search term
|
|
104
|
+
- `limit` (number, optional) - Max results (default: 10)
|
|
105
|
+
|
|
106
|
+
**Returns:** `Promise<ProductSearchInstance>`
|
|
107
|
+
|
|
108
|
+
**Example:**
|
|
109
|
+
```typescript
|
|
110
|
+
const results = await Products.search('laptop');
|
|
111
|
+
|
|
112
|
+
// Access results
|
|
113
|
+
for (const product of results) {
|
|
114
|
+
console.log(product.name, product.price);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Results length
|
|
118
|
+
console.log(`Found ${results.length} products`);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### `Products.getById(productId)`
|
|
122
|
+
|
|
123
|
+
Retrieves a single product by ID.
|
|
124
|
+
|
|
125
|
+
**Parameters:**
|
|
126
|
+
- `productId` (string) - Product ID
|
|
127
|
+
|
|
128
|
+
**Returns:** `Promise<ProductInstance | null>`
|
|
129
|
+
|
|
130
|
+
**Example:**
|
|
131
|
+
```typescript
|
|
132
|
+
const product = await Products.getById('prod_123');
|
|
133
|
+
|
|
134
|
+
if (product) {
|
|
135
|
+
console.log(product.name);
|
|
136
|
+
console.log(product.price);
|
|
137
|
+
console.log(product.stock);
|
|
138
|
+
} else {
|
|
139
|
+
console.log('Product not found');
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `Products.create(productData)`
|
|
144
|
+
|
|
145
|
+
Creates a new product.
|
|
146
|
+
|
|
147
|
+
**Parameters:**
|
|
148
|
+
- `productData` (object) - Product information
|
|
149
|
+
|
|
150
|
+
**Returns:** `Promise<ProductInstance>`
|
|
151
|
+
|
|
152
|
+
**Example:**
|
|
153
|
+
```typescript
|
|
154
|
+
const product = await Products.create({
|
|
155
|
+
name: 'Wireless Mouse',
|
|
156
|
+
description: 'Ergonomic wireless mouse with USB receiver',
|
|
157
|
+
price: 29.99,
|
|
158
|
+
stock: 100,
|
|
159
|
+
category: 'Electronics',
|
|
160
|
+
sku: 'WM-001',
|
|
161
|
+
metadata: {
|
|
162
|
+
brand: 'TechCorp',
|
|
163
|
+
warranty: '1 year'
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
console.log('Created product:', product.id);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### `Products.update(productData, productId)`
|
|
171
|
+
|
|
172
|
+
Updates an existing product.
|
|
173
|
+
|
|
174
|
+
**Parameters:**
|
|
175
|
+
- `productData` (object) - Updated product data
|
|
176
|
+
- `productId` (string) - Product ID to update
|
|
177
|
+
|
|
178
|
+
**Returns:** `Promise<{ updated: boolean; product: Product }>`
|
|
179
|
+
|
|
180
|
+
**Example:**
|
|
181
|
+
```typescript
|
|
182
|
+
const result = await Products.update({
|
|
183
|
+
price: 24.99,
|
|
184
|
+
stock: 150
|
|
185
|
+
}, 'prod_123');
|
|
186
|
+
|
|
187
|
+
if (result.updated) {
|
|
188
|
+
console.log('Product updated');
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### `Products.delete(productId)`
|
|
193
|
+
|
|
194
|
+
Deletes a product.
|
|
195
|
+
|
|
196
|
+
**Parameters:**
|
|
197
|
+
- `productId` (string) - Product ID to delete
|
|
198
|
+
|
|
199
|
+
**Returns:** `Promise<DeleteProductResponse>`
|
|
200
|
+
|
|
201
|
+
**Example:**
|
|
202
|
+
```typescript
|
|
203
|
+
const result = await Products.delete('prod_123');
|
|
204
|
+
|
|
205
|
+
if (result.deleted) {
|
|
206
|
+
console.log('Product deleted');
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## ProductInstance
|
|
211
|
+
|
|
212
|
+
Product objects have convenient methods:
|
|
213
|
+
|
|
214
|
+
### `product.update(data)`
|
|
215
|
+
|
|
216
|
+
Updates this product.
|
|
217
|
+
|
|
218
|
+
**Example:**
|
|
219
|
+
```typescript
|
|
220
|
+
const product = await Products.getById('prod_123');
|
|
221
|
+
|
|
222
|
+
await product.update({
|
|
223
|
+
price: 19.99,
|
|
224
|
+
stock: 200
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### `product.delete()`
|
|
229
|
+
|
|
230
|
+
Deletes this product.
|
|
231
|
+
|
|
232
|
+
**Example:**
|
|
233
|
+
```typescript
|
|
234
|
+
const product = await Products.getById('prod_123');
|
|
235
|
+
await product.delete();
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### `product.save()`
|
|
239
|
+
|
|
240
|
+
Saves modifications to the product.
|
|
241
|
+
|
|
242
|
+
**Example:**
|
|
243
|
+
```typescript
|
|
244
|
+
const product = await Products.getById('prod_123');
|
|
245
|
+
|
|
246
|
+
// Modify properties
|
|
247
|
+
product.price = 24.99;
|
|
248
|
+
product.stock = 75;
|
|
249
|
+
|
|
250
|
+
// Save changes
|
|
251
|
+
await product.save();
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Property Access
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
const product = await Products.getById('prod_123');
|
|
258
|
+
|
|
259
|
+
// Direct access (via Proxy)
|
|
260
|
+
console.log(product.name);
|
|
261
|
+
console.log(product.price);
|
|
262
|
+
console.log(product.stock);
|
|
263
|
+
|
|
264
|
+
// Or via .data
|
|
265
|
+
console.log(product.data.name);
|
|
266
|
+
console.log(product.data.price);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Complete Examples
|
|
270
|
+
|
|
271
|
+
### Product Search Tool
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { LuaTool, Products } from 'lua-cli/skill';
|
|
275
|
+
import { z } from 'zod';
|
|
276
|
+
|
|
277
|
+
export default class SearchProductsTool implements LuaTool {
|
|
278
|
+
name = 'search_products';
|
|
279
|
+
description = 'Search for products by name or description';
|
|
280
|
+
|
|
281
|
+
inputSchema = z.object({
|
|
282
|
+
query: z.string().describe('Search term'),
|
|
283
|
+
maxResults: z.number().min(1).max(50).optional()
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
287
|
+
const results = await Products.search(
|
|
288
|
+
input.query,
|
|
289
|
+
input.maxResults || 10
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
success: true,
|
|
294
|
+
count: results.length,
|
|
295
|
+
products: results.map(p => ({
|
|
296
|
+
id: p.id,
|
|
297
|
+
name: p.name,
|
|
298
|
+
price: p.price,
|
|
299
|
+
inStock: (p.stock || 0) > 0
|
|
300
|
+
}))
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Product Management Tool
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
import { LuaTool, Products } from 'lua-cli/skill';
|
|
310
|
+
import { z } from 'zod';
|
|
311
|
+
|
|
312
|
+
export default class ManageProductTool implements LuaTool {
|
|
313
|
+
name = 'manage_product';
|
|
314
|
+
description = 'Create, update, or delete products';
|
|
315
|
+
|
|
316
|
+
inputSchema = z.object({
|
|
317
|
+
action: z.enum(['create', 'update', 'delete']),
|
|
318
|
+
productId: z.string().optional(),
|
|
319
|
+
name: z.string().optional(),
|
|
320
|
+
price: z.number().optional(),
|
|
321
|
+
stock: z.number().optional()
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
325
|
+
switch (input.action) {
|
|
326
|
+
case 'create':
|
|
327
|
+
if (!input.name || !input.price) {
|
|
328
|
+
return { success: false, error: 'Name and price required' };
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const product = await Products.create({
|
|
332
|
+
name: input.name,
|
|
333
|
+
price: input.price,
|
|
334
|
+
stock: input.stock || 0
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
return {
|
|
338
|
+
success: true,
|
|
339
|
+
action: 'created',
|
|
340
|
+
productId: product.id
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
case 'update':
|
|
344
|
+
if (!input.productId) {
|
|
345
|
+
return { success: false, error: 'Product ID required' };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const updates: any = {};
|
|
349
|
+
if (input.name) updates.name = input.name;
|
|
350
|
+
if (input.price) updates.price = input.price;
|
|
351
|
+
if (input.stock !== undefined) updates.stock = input.stock;
|
|
352
|
+
|
|
353
|
+
const result = await Products.update(updates, input.productId);
|
|
354
|
+
|
|
355
|
+
return {
|
|
356
|
+
success: result.updated,
|
|
357
|
+
action: 'updated',
|
|
358
|
+
productId: input.productId
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
case 'delete':
|
|
362
|
+
if (!input.productId) {
|
|
363
|
+
return { success: false, error: 'Product ID required' };
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const deleteResult = await Products.delete(input.productId);
|
|
367
|
+
|
|
368
|
+
return {
|
|
369
|
+
success: deleteResult.deleted,
|
|
370
|
+
action: 'deleted',
|
|
371
|
+
productId: input.productId
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Low Stock Alert
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
import { LuaTool, Products, User } from 'lua-cli/skill';
|
|
382
|
+
import { z } from 'zod';
|
|
383
|
+
|
|
384
|
+
export default class CheckLowStockTool implements LuaTool {
|
|
385
|
+
name = 'check_low_stock';
|
|
386
|
+
description = 'Check for products with low stock and alert user';
|
|
387
|
+
|
|
388
|
+
inputSchema = z.object({
|
|
389
|
+
threshold: z.number().min(0).default(10)
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
393
|
+
// Get all products
|
|
394
|
+
const allProducts = await Products.get(1, 100);
|
|
395
|
+
|
|
396
|
+
// Filter low stock items
|
|
397
|
+
const lowStock = allProducts.filter(p =>
|
|
398
|
+
(p.stock || 0) < input.threshold && (p.stock || 0) > 0
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
if (lowStock.length > 0) {
|
|
402
|
+
// Alert user
|
|
403
|
+
const user = await User.get();
|
|
404
|
+
const message = `⚠️ Low Stock Alert:\n\n` +
|
|
405
|
+
lowStock.map(p =>
|
|
406
|
+
`- ${p.name}: ${p.stock} remaining`
|
|
407
|
+
).join('\n');
|
|
408
|
+
|
|
409
|
+
await user.send([{ type: 'text', text: message }]);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return {
|
|
413
|
+
success: true,
|
|
414
|
+
lowStockCount: lowStock.length,
|
|
415
|
+
products: lowStock.map(p => ({
|
|
416
|
+
id: p.id,
|
|
417
|
+
name: p.name,
|
|
418
|
+
stock: p.stock
|
|
419
|
+
}))
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Product Data Structure
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
interface Product {
|
|
429
|
+
id: string;
|
|
430
|
+
name: string;
|
|
431
|
+
description?: string;
|
|
432
|
+
price: number;
|
|
433
|
+
stock?: number;
|
|
434
|
+
category?: string;
|
|
435
|
+
sku?: string;
|
|
436
|
+
images?: string[];
|
|
437
|
+
metadata?: Record<string, any>;
|
|
438
|
+
createdAt?: string;
|
|
439
|
+
updatedAt?: string;
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## Pagination
|
|
444
|
+
|
|
445
|
+
The `ProductPaginationInstance` provides:
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
interface ProductPaginationInstance {
|
|
449
|
+
products: ProductInstance[];
|
|
450
|
+
pagination: {
|
|
451
|
+
currentPage: number;
|
|
452
|
+
totalPages: number;
|
|
453
|
+
totalCount: number;
|
|
454
|
+
limit: number;
|
|
455
|
+
hasNextPage: boolean;
|
|
456
|
+
hasPrevPage: boolean;
|
|
457
|
+
nextPage: number | null;
|
|
458
|
+
prevPage: number | null;
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// Methods
|
|
462
|
+
nextPage(): Promise<ProductPaginationInstance>;
|
|
463
|
+
prevPage(): Promise<ProductPaginationInstance>;
|
|
464
|
+
|
|
465
|
+
// Array-like methods
|
|
466
|
+
map<T>(callback: (product: ProductInstance) => T): T[];
|
|
467
|
+
filter(callback: (product: ProductInstance) => boolean): ProductInstance[];
|
|
468
|
+
forEach(callback: (product: ProductInstance) => void): void;
|
|
469
|
+
find(callback: (product: ProductInstance) => boolean): ProductInstance | undefined;
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
## Error Handling
|
|
474
|
+
|
|
475
|
+
```typescript
|
|
476
|
+
try {
|
|
477
|
+
const product = await Products.getById(productId);
|
|
478
|
+
|
|
479
|
+
if (!product) {
|
|
480
|
+
return {
|
|
481
|
+
success: false,
|
|
482
|
+
error: 'Product not found',
|
|
483
|
+
productId
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// Process product...
|
|
488
|
+
} catch (error) {
|
|
489
|
+
return {
|
|
490
|
+
success: false,
|
|
491
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
## Related APIs
|
|
497
|
+
|
|
498
|
+
- [Baskets API](./Baskets.md) - Add products to cart
|
|
499
|
+
- [Orders API](./Orders.md) - Process product orders
|
|
500
|
+
- [Data API](./Data.md) - Store product metadata
|
|
501
|
+
|
|
502
|
+
## See Also
|
|
503
|
+
|
|
504
|
+
- [ProductInstance Documentation](./instances/ProductInstance.md)
|
|
505
|
+
- [Product Tools Example](../../template/src/skills/tools/ProductsTool.ts)
|
|
506
|
+
- [E-commerce Patterns](../guides/EcommercePatterns.md)
|
|
507
|
+
|