🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@chargebee/chargebee-apps

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chargebee/chargebee-apps - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+1
-1
dist/api/routes.js

@@ -1,1 +0,1 @@

"use strict";var __importDefault=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.setupServer=setupServer,exports.invokeEventHandler=invokeEventHandler,exports.setupApiRoutes=setupApiRoutes,exports.setupAppRoutes=setupAppRoutes;const chargebee_apps_libs_1=require("@chargebee/chargebee-apps-libs"),chargebee_apps_shared_1=require("@chargebee/chargebee-apps-shared"),express_1=__importDefault(require("express")),path_1=__importDefault(require("path")),registry_1=require("../registry"),iparams_routes_1=require("./iparams.routes"),pathResolver=new chargebee_apps_shared_1.PathResolver,WEB_STATIC_DIR=pathResolver.getPublicLibsUiWebDir(),PATHS={WEB_STATIC_DIR,MAIN_HTML_FILE:"index.html",HANDLER_FILE:"handler/handler.js",MANIFEST_FILE:"manifest.json",TEST_DATA_DIR:"test_data"},REGISTRY=registry_1.PublicCliRegistry.getInstance(),__logger=REGISTRY.logger;function setupServer(n,f,o=REGISTRY.fileSystem,t=REGISTRY.process,i=REGISTRY.dependencyManager){const c=(0,express_1.default)();c.disable("x-powered-by");const u=(0,chargebee_apps_libs_1.createCBPublicLogger)(o,t,f);c.use((e,s,l)=>{s.header("Access-Control-Allow-Origin","*"),s.header("Access-Control-Allow-Methods","GET, POST, OPTIONS"),s.header("Access-Control-Allow-Headers","Content-Type"),l()}),c.use(express_1.default.json()),c.use(express_1.default.static(PATHS.WEB_STATIC_DIR)),setupApiRoutes(c,u,f,o,t,i),(0,iparams_routes_1.setupIparamsRoutes)(c,f,o),setupAppRoutes(c,o);const r=c.listen(n,()=>{__logger.info(`Server is running on \x1B[4mhttp://localhost:${n}\x1B[0m`)});return t.on("SIGINT",()=>{__logger.info("Shutting down server..."),r.close(()=>{__logger.info("Server stopped!"),t.exit(0)})}),t.on("uncaughtException",async e=>{__logger.error(`Uncaught exception thrown: ${e.message}`),e&&e.stack&&__logger.error(`Stack Trace: ${e.stack}`),t.exit(1)}),r.on("error",e=>{e.code==="EADDRINUSE"?__logger.error(`Port ${n} is already in use. Try a different port with --port option.`):__logger.error("Server error:",e),t.exit(1)}),r}async function invokeEventHandler(n,f,o,t,i){const c=new chargebee_apps_shared_1.IparamsService(t),u=c.iparamsFileExists(o);let r;if(u)try{r=c.validateAndGetInputsForExecution(o)}catch(_){if(_ instanceof chargebee_apps_shared_1.MissingRequiredParamsError)throw _;const g=_;return{success:!1,error:`Parameters validation failed: ${g.message}`,stack:g.stack}}const s=new chargebee_apps_libs_1.ConfigLoader(t).loadAllowedModules(),l=new chargebee_apps_shared_1.PackageValidator(t),d=new chargebee_apps_shared_1.ManifestValidator(s,t),a=new chargebee_apps_libs_1.PublicSandboxWrapper(s,t,l,i,d),h=u?{event:n,iparams:r??{}}:{event:n};return await a.execute(o,h,f)}function setupApiRoutes(n,f,o,t,i,c){n.get("/api/manifest",(u,r,e)=>{const s=path_1.default.join(i.cwd(),PATHS.TEST_DATA_DIR),l=path_1.default.join(i.cwd(),PATHS.MANIFEST_FILE),d=path_1.default.join(i.cwd(),PATHS.HANDLER_FILE);try{const h=new chargebee_apps_libs_1.ConfigLoader(t).loadAllowedModules(),g=new chargebee_apps_shared_1.ManifestValidator(h,t).validateAndGetManifestFile(l),A=Object.keys(g.events||{}),E=t.existsSync(d),T=t.existsSync(s);let I=[];T&&(I=t.readdirSync(s).filter(p=>p.endsWith(".json")).map(p=>p.replace(".json","")));const w={events:A.map(p=>{const j=g.events[p],m=j?j.handler:null,M=I.includes(p);let v=!1;if(E&&m)try{delete require.cache[require.resolve(d)],v=typeof require(d)[m]=="function"}catch(x){__logger.error(`Error checking handler function ${m}:`,x.message),v=!1}else __logger.info(`Handler check skipped for ${p}: handlerExists=${E}, handlerName=${m}`);return{event_type:p,handler:{name:m,exists:v},has_test_data:M}}),dependencies:g.dependencies||{}};r.json(w)}catch(a){__logger.error("Error: Failed to get manifest",a),a instanceof Error&&a.message&&a.message.includes("manifest.json not found")?(__logger.error(`Manifest file not found: ${l}`),r.status(404).json({error:"Manifest file not found",message:a.message})):r.status(500).json({error:"Internal server error",message:a instanceof Error&&a.message?a.message:a}),e(a),r.status(500).json({error:"Failed to read test data directory"})}}),n.get("/api/test-data/:eventType",(u,r)=>{const{eventType:e}=u.params;if(!e){r.status(400).json({error:"Event type is required"});return}const s=path_1.default.basename(e);if(s!==e||/[\/\\]/.test(e)){r.status(400).json({error:"Invalid event type",message:"Event type must not contain path separators"});return}const l=path_1.default.resolve(i.cwd(),PATHS.TEST_DATA_DIR),d=path_1.default.resolve(l,`${s}.json`);if(!d.startsWith(l+path_1.default.sep)){r.status(400).json({error:"Invalid event type",message:"Access denied"});return}try{if(t.existsSync(d)){const a=t.readFileSync(d,"utf8");r.json(JSON.parse(a))}else r.status(404).json({error:`Test data for event '${s}' not found`,path:d,message:"Check if the test_data directory exists in your app directory"})}catch{r.status(500).json({error:"Failed to read test data file"})}}),n.post("/api/invoke",async(u,r)=>{try{const e=u.body,s=await invokeEventHandler(e,f,o,t,c);return s.success?r.json({status:"success"}):(__logger.error(`\u2717 Handler execution failed: ${s.error}`),r.status(500).json({error:"Uncaught exception thrown while invoking function",message:s.error,stack:s.stack}))}catch(e){if(e instanceof chargebee_apps_shared_1.MissingRequiredParamsError){const d=e.missing.length>1?"parameters":"parameter";return __logger.error(`\u2717 Missing required ${d}: ${e.missing.join(", ")}. Please provide values for these parameters in iparams.local.json`),r.status(400).json({error:"Parameters validation failed",message:e.message,missingParams:e.missing,showPopup:!0})}__logger.error("Error: Failed to invoke event handler",e);const s=e instanceof Error?e.message:"",l={"Handler function":{status:400,error:"Handler function not found"},"No handler configured":{status:400,error:"No handler configured"},"handler.js not found":{status:404,error:"Handler file not found"},"manifest.json not found":{status:404,error:"Manifest file not found"}};for(const[d,{status:a,error:h}]of Object.entries(l))if(s.includes(d))return r.status(a).json({error:h,message:s});return r.status(500).json({error:"Internal server error",message:s||e})}}),n.all("/api",(u,r)=>{__logger.info("API endpoint not found"),r.status(404).json({error:"API endpoint not found"})})}function setupAppRoutes(n,f){n.get("/",(o,t)=>{const i=path_1.default.join(PATHS.WEB_STATIC_DIR,PATHS.MAIN_HTML_FILE);f.existsSync(i)?t.sendFile(i):t.status(404).send("Web UI not found. Please check the file path.")}),n.use((o,t,i,c)=>{i.headersSent||(__logger.error("Error: Failed to handle middleware",o),i.status(500).json({error:"Internal server error",message:o.message}))})}
"use strict";var __importDefault=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.setupServer=setupServer,exports.invokeEventHandler=invokeEventHandler,exports.setupApiRoutes=setupApiRoutes,exports.setupAppRoutes=setupAppRoutes;const chargebee_apps_libs_1=require("@chargebee/chargebee-apps-libs"),chargebee_apps_shared_1=require("@chargebee/chargebee-apps-shared"),express_1=__importDefault(require("express")),path_1=__importDefault(require("path")),registry_1=require("../registry"),iparams_routes_1=require("./iparams.routes"),pathResolver=new chargebee_apps_libs_1.PublicPathResolver,WEB_STATIC_DIR=pathResolver.getPublicLibsUiWebDir(),PATHS={WEB_STATIC_DIR,MAIN_HTML_FILE:"index.html",HANDLER_FILE:"handler/handler.js",MANIFEST_FILE:"manifest.json",TEST_DATA_DIR:"test_data"},REGISTRY=registry_1.PublicCliRegistry.getInstance(),__logger=REGISTRY.logger;function setupServer(n,f,o=REGISTRY.fileSystem,t=REGISTRY.process,i=REGISTRY.dependencyManager){const c=(0,express_1.default)();c.disable("x-powered-by");const u=(0,chargebee_apps_libs_1.createCBPublicLogger)(o,t,f);c.use((e,s,l)=>{s.header("Access-Control-Allow-Origin","*"),s.header("Access-Control-Allow-Methods","GET, POST, OPTIONS"),s.header("Access-Control-Allow-Headers","Content-Type"),l()}),c.use(express_1.default.json()),c.use(express_1.default.static(PATHS.WEB_STATIC_DIR)),setupApiRoutes(c,u,f,o,t,i),(0,iparams_routes_1.setupIparamsRoutes)(c,f,o),setupAppRoutes(c,o);const r=c.listen(n,()=>{__logger.info(`Server is running on \x1B[4mhttp://localhost:${n}\x1B[0m`)});return t.on("SIGINT",()=>{__logger.info("Shutting down server..."),r.close(()=>{__logger.info("Server stopped!"),t.exit(0)})}),t.on("uncaughtException",async e=>{__logger.error(`Uncaught exception thrown: ${e.message}`),e&&e.stack&&__logger.error(`Stack Trace: ${e.stack}`),t.exit(1)}),r.on("error",e=>{e.code==="EADDRINUSE"?__logger.error(`Port ${n} is already in use. Try a different port with --port option.`):__logger.error("Server error:",e),t.exit(1)}),r}async function invokeEventHandler(n,f,o,t,i){const c=new chargebee_apps_shared_1.IparamsService(t),u=c.iparamsFileExists(o);let r;if(u)try{r=c.validateAndGetInputsForExecution(o)}catch(_){if(_ instanceof chargebee_apps_shared_1.MissingRequiredParamsError)throw _;const g=_;return{success:!1,error:`Parameters validation failed: ${g.message}`,stack:g.stack}}const s=new chargebee_apps_libs_1.ConfigLoader(t).loadAllowedModules(),l=new chargebee_apps_shared_1.PackageValidator(t),d=new chargebee_apps_shared_1.ManifestValidator(s,t),a=new chargebee_apps_libs_1.PublicSandboxWrapper(s,t,l,i,d),h=u?{event:n,iparams:r??{}}:{event:n};return await a.execute(o,h,f)}function setupApiRoutes(n,f,o,t,i,c){n.get("/api/manifest",(u,r,e)=>{const s=path_1.default.join(i.cwd(),PATHS.TEST_DATA_DIR),l=path_1.default.join(i.cwd(),PATHS.MANIFEST_FILE),d=path_1.default.join(i.cwd(),PATHS.HANDLER_FILE);try{const h=new chargebee_apps_libs_1.ConfigLoader(t).loadAllowedModules(),g=new chargebee_apps_shared_1.ManifestValidator(h,t).validateAndGetManifestFile(l),A=Object.keys(g.events||{}),E=t.existsSync(d),T=t.existsSync(s);let I=[];T&&(I=t.readdirSync(s).filter(p=>p.endsWith(".json")).map(p=>p.replace(".json","")));const w={events:A.map(p=>{const j=g.events[p],m=j?j.handler:null,M=I.includes(p);let v=!1;if(E&&m)try{delete require.cache[require.resolve(d)],v=typeof require(d)[m]=="function"}catch(x){__logger.error(`Error checking handler function ${m}:`,x.message),v=!1}else __logger.info(`Handler check skipped for ${p}: handlerExists=${E}, handlerName=${m}`);return{event_type:p,handler:{name:m,exists:v},has_test_data:M}}),dependencies:g.dependencies||{}};r.json(w)}catch(a){__logger.error("Error: Failed to get manifest",a),a instanceof Error&&a.message&&a.message.includes("manifest.json not found")?(__logger.error(`Manifest file not found: ${l}`),r.status(404).json({error:"Manifest file not found",message:a.message})):r.status(500).json({error:"Internal server error",message:a instanceof Error&&a.message?a.message:a}),e(a),r.status(500).json({error:"Failed to read test data directory"})}}),n.get("/api/test-data/:eventType",(u,r)=>{const{eventType:e}=u.params;if(!e){r.status(400).json({error:"Event type is required"});return}const s=path_1.default.basename(e);if(s!==e||/[\/\\]/.test(e)){r.status(400).json({error:"Invalid event type",message:"Event type must not contain path separators"});return}const l=path_1.default.resolve(i.cwd(),PATHS.TEST_DATA_DIR),d=path_1.default.resolve(l,`${s}.json`);if(!d.startsWith(l+path_1.default.sep)){r.status(400).json({error:"Invalid event type",message:"Access denied"});return}try{if(t.existsSync(d)){const a=t.readFileSync(d,"utf8");r.json(JSON.parse(a))}else r.status(404).json({error:`Test data for event '${s}' not found`,path:d,message:"Check if the test_data directory exists in your app directory"})}catch{r.status(500).json({error:"Failed to read test data file"})}}),n.post("/api/invoke",async(u,r)=>{try{const e=u.body,s=await invokeEventHandler(e,f,o,t,c);return s.success?r.json({status:"success"}):(__logger.error(`\u2717 Handler execution failed: ${s.error}`),r.status(500).json({error:"Uncaught exception thrown while invoking function",message:s.error,stack:s.stack}))}catch(e){if(e instanceof chargebee_apps_shared_1.MissingRequiredParamsError){const d=e.missing.length>1?"parameters":"parameter";return __logger.error(`\u2717 Missing required ${d}: ${e.missing.join(", ")}. Please provide values for these parameters in iparams.local.json`),r.status(400).json({error:"Parameters validation failed",message:e.message,missingParams:e.missing,showPopup:!0})}__logger.error("Error: Failed to invoke event handler",e);const s=e instanceof Error?e.message:"",l={"Handler function":{status:400,error:"Handler function not found"},"No handler configured":{status:400,error:"No handler configured"},"handler.js not found":{status:404,error:"Handler file not found"},"manifest.json not found":{status:404,error:"Manifest file not found"}};for(const[d,{status:a,error:h}]of Object.entries(l))if(s.includes(d))return r.status(a).json({error:h,message:s});return r.status(500).json({error:"Internal server error",message:s||e})}}),n.all("/api",(u,r)=>{__logger.info("API endpoint not found"),r.status(404).json({error:"API endpoint not found"})})}function setupAppRoutes(n,f){n.get("/",(o,t)=>{const i=path_1.default.join(PATHS.WEB_STATIC_DIR,PATHS.MAIN_HTML_FILE);f.existsSync(i)?t.sendFile(i):t.status(404).send("Web UI not found. Please check the file path.")}),n.use((o,t,i,c)=>{i.headersSent||(__logger.error("Error: Failed to handle middleware",o),i.status(500).json({error:"Internal server error",message:o.message}))})}

@@ -1,1 +0,1 @@

"use strict";var __importDefault=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createCommand=exports.CreateCommand=void 0;const chargebee_apps_shared_1=require("@chargebee/chargebee-apps-shared"),path_1=__importDefault(require("path")),registry_1=require("../registry"),pathResolver=new chargebee_apps_shared_1.PathResolver;class CreateCommand{constructor(r,t){const e=registry_1.PublicCliRegistry.getInstance();this.fileSystem=r||e.fileSystem,this.process=t||e.process;const o=pathResolver.getPublicLibsTemplatesDir();this.templateService=new chargebee_apps_shared_1.TemplateService(this.fileSystem,o)}execute(r,t){const e=r.template;chargebee_apps_shared_1.__logger.info("Creating new application...");const o=path_1.default.resolve(t);this.validate(o,t,e),this.createProject(o,e)}validate(r,t,e){if(e==="serverless-node-starter-app"?chargebee_apps_shared_1.__logger.info(`Using default template: ${e}`):chargebee_apps_shared_1.__logger.info(`Using template: ${e}`),!this.templateService.validateTemplate(e)){const s=this.templateService.getAvailableTemplates();chargebee_apps_shared_1.__logger.error(`Error: Template '${e}' not found.`),chargebee_apps_shared_1.__logger.error(`Available templates: ${s.join(", ")}`),this.process.exit(1)}try{const s=this.templateService.validateAppDirectory(r,t,e);s.length>0&&(chargebee_apps_shared_1.__logger.error("Error: The following files already exist in the current directory:"),s.forEach(a=>chargebee_apps_shared_1.__logger.error(` - ${a}`)),chargebee_apps_shared_1.__logger.error("Please remove these files or use a different directory."),this.process.exit(1))}catch(s){chargebee_apps_shared_1.__logger.error(`Error: ${s.message}`),chargebee_apps_shared_1.__logger.error("Use a different directory name or clear the existing directory first."),this.process.exit(1)}}createProject(r,t){try{this.fileSystem.existsSync(r)||this.fileSystem.mkdirSync(r,{recursive:!0});const e=this.templateService.getTemplatePath(t);this.templateService.copyTemplateFiles(e,r),chargebee_apps_shared_1.__logger.success(`Successfully created app in '${r}' using template '${t}'`),chargebee_apps_shared_1.__logger.info(`Directory: ${r}`),chargebee_apps_shared_1.__logger.info("Project structure:"),this.templateService.printProjectStructure(r)}catch(e){chargebee_apps_shared_1.__logger.error(`Error creating app: ${e}`),this.process.exit(1)}}}exports.CreateCommand=CreateCommand,exports.createCommand=new CreateCommand;
"use strict";var __importDefault=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.createCommand=exports.CreateCommand=void 0;const chargebee_apps_libs_1=require("@chargebee/chargebee-apps-libs"),chargebee_apps_shared_1=require("@chargebee/chargebee-apps-shared"),path_1=__importDefault(require("path")),registry_1=require("../registry"),pathResolver=new chargebee_apps_libs_1.PublicPathResolver;class CreateCommand{constructor(r,t){const e=registry_1.PublicCliRegistry.getInstance();this.fileSystem=r||e.fileSystem,this.process=t||e.process;const o=pathResolver.getPublicLibsTemplatesDir();this.templateService=new chargebee_apps_shared_1.TemplateService(this.fileSystem,o)}execute(r,t){const e=r.template;chargebee_apps_shared_1.__logger.info("Creating new application...");const o=path_1.default.resolve(t);this.validate(o,t,e),this.createProject(o,e)}validate(r,t,e){if(e==="serverless-node-starter-app"?chargebee_apps_shared_1.__logger.info(`Using default template: ${e}`):chargebee_apps_shared_1.__logger.info(`Using template: ${e}`),!this.templateService.validateTemplate(e)){const s=this.templateService.getAvailableTemplates();chargebee_apps_shared_1.__logger.error(`Error: Template '${e}' not found.`),chargebee_apps_shared_1.__logger.error(`Available templates: ${s.join(", ")}`),this.process.exit(1)}try{const s=this.templateService.validateAppDirectory(r,t,e);s.length>0&&(chargebee_apps_shared_1.__logger.error("Error: The following files already exist in the current directory:"),s.forEach(a=>chargebee_apps_shared_1.__logger.error(` - ${a}`)),chargebee_apps_shared_1.__logger.error("Please remove these files or use a different directory."),this.process.exit(1))}catch(s){chargebee_apps_shared_1.__logger.error(`Error: ${s.message}`),chargebee_apps_shared_1.__logger.error("Use a different directory name or clear the existing directory first."),this.process.exit(1)}}createProject(r,t){try{this.fileSystem.existsSync(r)||this.fileSystem.mkdirSync(r,{recursive:!0});const e=this.templateService.getTemplatePath(t);this.templateService.copyTemplateFiles(e,r),chargebee_apps_shared_1.__logger.success(`Successfully created app in '${r}' using template '${t}'`),chargebee_apps_shared_1.__logger.info(`Directory: ${r}`),chargebee_apps_shared_1.__logger.info("Project structure:"),this.templateService.printProjectStructure(r)}catch(e){chargebee_apps_shared_1.__logger.error(`Error creating app: ${e}`),this.process.exit(1)}}}exports.CreateCommand=CreateCommand,exports.createCommand=new CreateCommand;

@@ -1,3 +0,3 @@

"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.setupCLI=setupCLI;const commander_1=require("commander"),package_json_1=__importDefault(require("../../package.json")),create_1=require("./create"),package_1=require("./package"),run_1=require("./run"),chargebee_apps_shared_1=require("@chargebee/chargebee-apps-shared"),registry_1=require("../registry");function setupCLI(){const t=registry_1.PublicCliRegistry.getInstance(),o=new chargebee_apps_shared_1.PathResolver().getPublicLibsTemplatesDir(),n=new chargebee_apps_shared_1.TemplateService(t.fileSystem,o).getAvailableTemplates(),r=new commander_1.Command;return r.name("chargebee-apps").description("Chargebee Apps CLI - Create, test, and package serverless applications").version(package_json_1.default.version).usage("<command> <directory> [options]").showHelpAfterError().showSuggestionAfterError().addHelpCommand().configureHelp({sortSubcommands:!0,sortOptions:!0,subcommandTerm:e=>{const a=e.registeredArguments.map(p=>p.required?`<${p.name()}>`:`[${p.name()}]`).join(" "),s=e.options.length>0;return`${e.name()}${a?" "+a:""}${s?" [options]":""}`}}),r.command("create").usage("<directory> [options]").summary("Create a new application").description("Create a new application from a template").argument("<directory>","Path where the new application will be created").option("--template <template>","Template to scaffold from",package_json_1.default.config.defaultTemplate).addHelpText("after",`
`+["Available Templates:",...n.map(e=>` - ${e}`),"","Examples:"," chargebee-apps create my-app"," chargebee-apps create ./projects/new-app --template serverless-node-starter-app"," chargebee-apps create ./projects/my-app-with-iparams --template serverless-node-starter-app-with-iparams"].join(`
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.setupCLI=setupCLI;const commander_1=require("commander"),package_json_1=__importDefault(require("../../package.json")),create_1=require("./create"),package_1=require("./package"),run_1=require("./run"),chargebee_apps_libs_1=require("@chargebee/chargebee-apps-libs"),chargebee_apps_shared_1=require("@chargebee/chargebee-apps-shared"),registry_1=require("../registry");function setupCLI(){const t=registry_1.PublicCliRegistry.getInstance(),o=new chargebee_apps_libs_1.PublicPathResolver().getPublicLibsTemplatesDir(),s=new chargebee_apps_shared_1.TemplateService(t.fileSystem,o).getAvailableTemplates(),r=new commander_1.Command;return r.name("chargebee-apps").description("Chargebee Apps CLI - Create, test, and package serverless applications").version(package_json_1.default.version).usage("<command> <directory> [options]").showHelpAfterError().showSuggestionAfterError().addHelpCommand().configureHelp({sortSubcommands:!0,sortOptions:!0,subcommandTerm:e=>{const a=e.registeredArguments.map(p=>p.required?`<${p.name()}>`:`[${p.name()}]`).join(" "),n=e.options.length>0;return`${e.name()}${a?" "+a:""}${n?" [options]":""}`}}),r.command("create").usage("<directory> [options]").summary("Create a new application").description("Create a new application from a template").argument("<directory>","Path where the new application will be created").option("--template <template>","Template to scaffold from",package_json_1.default.config.defaultTemplate).addHelpText("after",`
`+["Available Templates:",...s.map(e=>` - ${e}`),"","Examples:"," chargebee-apps create my-app"," chargebee-apps create ./projects/new-app --template serverless-node-starter-app"," chargebee-apps create ./projects/my-app-with-iparams --template serverless-node-starter-app-with-iparams"].join(`
`)).action((e,a)=>create_1.createCommand.execute(a,e)),r.command("run").usage("<directory> [options]").summary("Start a local development server").description("Start a local development server to test your serverless application").argument("<directory>","Path to the application directory to run").option("-p, --port <port>","Port to run the server on",package_json_1.default.config.defaultPort.toString()).addHelpText("after",`

@@ -4,0 +4,0 @@ `+["Examples:"," chargebee-apps run ."," chargebee-apps run ./my-app"," chargebee-apps run ./my-app --port 15001"," chargebee-apps run ./my-app -p 15001"].join(`

{
"name": "@chargebee/chargebee-apps",
"version": "0.0.3",
"version": "0.0.4",
"description": "Chargebee Apps CLI tool that enables you to create, test and package the applications",

@@ -32,4 +32,4 @@ "main": "dist/index.js",

"dependencies": {
"@chargebee/chargebee-apps-libs": "0.0.3",
"@chargebee/chargebee-apps-shared": "0.0.3",
"@chargebee/chargebee-apps-libs": "0.0.4",
"@chargebee/chargebee-apps-shared": "0.0.4",
"archiver": "^7.0.1",

@@ -36,0 +36,0 @@ "chalk": "^4.1.2",

@@ -140,8 +140,8 @@ # Chargebee Apps CLI Developer Guide

```plain
MKPLC_CB_READ_ONLY_API=your_read_only_api_key_here
MKPLC_CB_READ_WRITE_API=your_read_write_api_key_here
MKPLC_SITE_DOMAIN=your_site_domain_here
CB_APPS_READ_ONLY_API=your_read_only_api_key_here
CB_APPS_READ_WRITE_API=your_read_write_api_key_here
CB_APPS_SITE_DOMAIN=your_site_domain_here
```
Access these values in your handler code through `process.env`, for example `process.env.MKPLC_CB_READ_ONLY_API`. The `.env` file is used for local development only and is not included when you package your app. In the hosted environment, Chargebee injects these variables automatically.
Access these values in your handler code through `process.env`, for example `process.env.CB_APPS_CB_READ_ONLY_API`. The `.env` file is used for local development only and is not included when you package your app. In the hosted environment, Chargebee injects these variables automatically.

@@ -300,2 +300,2 @@ > **Note**

Official documentation: [Chargebee Apps CLI Developer Guide](https://www.chargebee.com/docs/billing/2.0/chargebee-apps/cli-developer-guide)
Official documentation: [Chargebee Apps CLI Developer Guide](https://www.chargebee.com/docs/billing/2.0/chargebee-apps/cli-developer-guide)