@arkstack/driver-express 0.1.1 → 0.1.2

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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import express, { type ErrorRequestHandler, type Express, type Handler } from \"express\";\n\nimport { ArkstackKitDriver, PromiseOrValue } from \"@arkstack/contract\";\n\nexport interface ExpressDriverOptions {\n bindRouter: (app: Express) => PromiseOrValue<void>;\n errorHandler?: ErrorRequestHandler | Handler;\n}\n\n/**\n * The ExpressDriver class implements the ArkstackKitDriver \n * contract for the Express framework.\n */\nexport class ExpressDriver extends ArkstackKitDriver<Express, Handler> {\n readonly name = \"express\";\n private readonly options: ExpressDriverOptions;\n\n /**\n * Creates an instance of ExpressDriver.\n * \n * @param options \n */\n constructor(options: ExpressDriverOptions) {\n super();\n this.options = options;\n }\n\n /**\n * Creates an Express application instance.\n * \n * @returns \n */\n createApp (): Express {\n return express();\n }\n\n /**\n * Mounts static assets from the specified public path to the Express application.\n * \n * @param app \n * @param publicPath \n */\n mountPublicAssets (app: Express, publicPath: string): void {\n app.use(express.static(publicPath));\n }\n\n /**\n * Binds the router to the Express application using the provided bindRouter function.\n * \n * @param app \n */\n bindRouter (app: Express): PromiseOrValue<void> {\n return this.options.bindRouter(app);\n }\n\n /**\n * Applies middleware to the Express application.\n * \n * @param app \n * @param middleware \n */\n applyMiddleware (app: Express, middleware: Handler): void {\n app.use(middleware);\n }\n\n /**\n * Registers an error handler middleware to the Express \n * application if provided in the options.\n * \n * @param app \n */\n registerErrorHandler (app: Express): void {\n if (this.options.errorHandler) {\n app.use(this.options.errorHandler as ErrorRequestHandler);\n }\n }\n\n /**\n * Starts the Express server on the specified port.\n * \n * @param app \n * @param port \n */\n start (app: Express, port: number): void {\n app.listen(port, () => {\n console.log(`Server is running on http://localhost:${port}`);\n });\n }\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,gBAAb,cAAmC,kBAAoC;CACnE,AAAS,OAAO;CAChB,AAAiB;;;;;;CAOjB,YAAY,SAA+B;AACvC,SAAO;AACP,OAAK,UAAU;;;;;;;CAQnB,YAAsB;AAClB,SAAO,SAAS;;;;;;;;CASpB,kBAAmB,KAAc,YAA0B;AACvD,MAAI,IAAI,QAAQ,OAAO,WAAW,CAAC;;;;;;;CAQvC,WAAY,KAAoC;AAC5C,SAAO,KAAK,QAAQ,WAAW,IAAI;;;;;;;;CASvC,gBAAiB,KAAc,YAA2B;AACtD,MAAI,IAAI,WAAW;;;;;;;;CASvB,qBAAsB,KAAoB;AACtC,MAAI,KAAK,QAAQ,aACb,KAAI,IAAI,KAAK,QAAQ,aAAoC;;;;;;;;CAUjE,MAAO,KAAc,MAAoB;AACrC,MAAI,OAAO,YAAY;AACnB,WAAQ,IAAI,yCAAyC,OAAO;IAC9D"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import express, { type ErrorRequestHandler, type Express, type Handler } from 'express'\n\nimport { ArkstackKitDriver, PromiseOrValue } from '@arkstack/contract'\n\nexport interface ExpressDriverOptions {\n bindRouter: (app: Express) => PromiseOrValue<void>;\n errorHandler?: ErrorRequestHandler | Handler;\n}\n\n/**\n * The ExpressDriver class implements the ArkstackKitDriver \n * contract for the Express framework.\n */\nexport class ExpressDriver extends ArkstackKitDriver<Express, Handler> {\n readonly name = 'express'\n private readonly options: ExpressDriverOptions\n\n /**\n * Creates an instance of ExpressDriver.\n * \n * @param options \n */\n constructor(options: ExpressDriverOptions) {\n super()\n this.options = options\n }\n\n /**\n * Creates an Express application instance.\n * \n * @returns \n */\n createApp (): Express {\n return express()\n }\n\n /**\n * Mounts static assets from the specified public path to the Express application.\n * \n * @param app \n * @param publicPath \n */\n mountPublicAssets (app: Express, publicPath: string): void {\n app.use(express.static(publicPath))\n }\n\n /**\n * Binds the router to the Express application using the provided bindRouter function.\n * \n * @param app \n */\n bindRouter (app: Express): PromiseOrValue<void> {\n return this.options.bindRouter(app)\n }\n\n /**\n * Applies middleware to the Express application.\n * \n * @param app \n * @param middleware \n */\n applyMiddleware (app: Express, middleware: Handler): void {\n app.use(middleware)\n }\n\n /**\n * Registers an error handler middleware to the Express \n * application if provided in the options.\n * \n * @param app \n */\n registerErrorHandler (app: Express): void {\n if (this.options.errorHandler) {\n app.use(this.options.errorHandler as ErrorRequestHandler)\n }\n }\n\n /**\n * Starts the Express server on the specified port.\n * \n * @param app \n * @param port \n */\n start (app: Express, port: number): void {\n app.listen(port, () => {\n console.log(`Server is running on http://localhost:${port}`)\n })\n }\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,gBAAb,cAAmC,kBAAoC;CACnE,AAAS,OAAO;CAChB,AAAiB;;;;;;CAOjB,YAAY,SAA+B;AACvC,SAAO;AACP,OAAK,UAAU;;;;;;;CAQnB,YAAsB;AAClB,SAAO,SAAS;;;;;;;;CASpB,kBAAmB,KAAc,YAA0B;AACvD,MAAI,IAAI,QAAQ,OAAO,WAAW,CAAC;;;;;;;CAQvC,WAAY,KAAoC;AAC5C,SAAO,KAAK,QAAQ,WAAW,IAAI;;;;;;;;CASvC,gBAAiB,KAAc,YAA2B;AACtD,MAAI,IAAI,WAAW;;;;;;;;CASvB,qBAAsB,KAAoB;AACtC,MAAI,KAAK,QAAQ,aACb,KAAI,IAAI,KAAK,QAAQ,aAAoC;;;;;;;;CAUjE,MAAO,KAAc,MAAoB;AACrC,MAAI,OAAO,YAAY;AACnB,WAAQ,IAAI,yCAAyC,OAAO;IAC9D"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@arkstack/driver-express",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Express driver package for Arkstack providing Express-specific implementations of core Arkstack features such as routing, middleware, and database integration.",
6
+ "homepage": "https://arkstack.toneflix.net",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/arkstack-hq/arkstack.git",
@@ -34,7 +35,7 @@
34
35
  "./package.json": "./package.json"
35
36
  },
36
37
  "dependencies": {
37
- "@arkstack/contract": "^0.1.1"
38
+ "@arkstack/contract": "^0.1.2"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "express": "^5.2.1"