@devbro/pashmak 0.1.54 → 0.1.55
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 +2 -2
- package/dist/esm/facades.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
> [!CAUTION]
|
|
4
4
|
> Still in Beta. Stable to use but not fully battle tested. I expect a few more things to change. For the most part only new stuff will be added so backward compatibility is mostly guaranteed.
|
|
5
5
|
|
|
6
|
-
Inspired by laravel and Rails, Pashmak is a typescript focused, ESM first framework. Pashmak was created to provide a simple and seamless way to build web applications, APIs, and services using modern JavaScript and TypeScript features. It is ideal for rapid prototyping and development of web applications, RESTful APIs, and microservices.
|
|
6
|
+
Inspired by laravel and Rails, Pashmak is a typescript focused, ESM first framework that follows CUPID methodology. Pashmak was created to provide a simple and seamless way to build web applications, APIs, and services using modern JavaScript and TypeScript features. It is ideal for rapid prototyping and development of web applications, RESTful APIs, and microservices.
|
|
7
7
|
|
|
8
|
-
Pashmak is designed with developer experience, rapid development and delivery in mind. It aims to provide a clean and intuitive approach so developers can focus on writing business logic rather than dealing with boilerplate code.
|
|
8
|
+
Pashmak is designed with developer experience, rapid development and delivery in mind. It aims to provide a clean and intuitive approach so developers can focus on writing business logic rather than dealing with boilerplate code. With Pashmak, AI can create simple and intuitive code that needs little to no intervention and easily understood with developers.
|
|
9
9
|
|
|
10
10
|
for documentation please check [documentations](https://devbro1.github.io/pashmak/)
|
|
11
11
|
|
package/dist/esm/facades.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/facades.mts"],"sourcesContent":["import { Router } from \"./router.mjs\";\nimport { Schedule, Scheduler } from \"@devbro/neko-scheduler\";\nimport { createSingleton } from \"@devbro/neko-helper\";\nimport { ctx, ctxSafe } from \"@devbro/neko-context\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { Storage, StorageProviderFactory } from \"@devbro/neko-storage\";\nimport {\n Mailer,\n MailerProvider,\n MailerProviderFactory,\n} from \"@devbro/neko-mailer\";\nimport { config } from \"@devbro/neko-config\";\nimport { Cli } from \"clipanion\";\nimport { HttpServer, handleHttpErrors } from \"./http.mjs\";\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/facades.mts"],"sourcesContent":["import { Router } from \"./router.mjs\";\nimport { Schedule, Scheduler } from \"@devbro/neko-scheduler\";\nimport { createSingleton } from \"@devbro/neko-helper\";\nimport { ctx, ctxSafe } from \"@devbro/neko-context\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { Storage, StorageProviderFactory } from \"@devbro/neko-storage\";\nimport {\n Mailer,\n MailerProvider,\n MailerProviderFactory,\n} from \"@devbro/neko-mailer\";\nimport { config } from \"@devbro/neko-config\";\nimport { Cli } from \"clipanion\";\nimport { HttpServer, handleHttpErrors } from \"./http.mjs\";\nimport { Logger } from \"@devbro/neko-logger\";\nimport { CacheProviderFactory } from \"./factories.mjs\";\nimport { Cache } from \"@devbro/neko-cache\";\nimport { QueueConnection, QueueTransportFactory } from \"@devbro/neko-queue\";\n\n/**\n * Wraps a singleton function with property accessors that delegate to the default instance.\n * This allows both `facade()` and `facade.method()` calling patterns.\n * @param singletonFn - The singleton function to wrap\n * @returns The wrapped singleton with property accessors\n */\nfunction wrapSingletonWithAccessors<T>(\n singletonFn: (label?: string, ...args: any[]) => T,\n): typeof singletonFn & Omit<T, keyof Function> {\n // Create a proxy that lazily adds method accessors on first access\n let methodsInitialized = false;\n\n const initializeMethods = () => {\n if (methodsInitialized) return;\n\n const defaultInstance = singletonFn();\n const prototype = Object.getPrototypeOf(defaultInstance);\n\n // Get all method names from the instance's prototype\n const methodNames = Object.getOwnPropertyNames(prototype).filter(\n (name) =>\n name !== \"constructor\" &&\n typeof (prototype as any)[name] === \"function\",\n );\n\n // Attach each method as a property on the singleton function\n for (const methodName of methodNames) {\n (singletonFn as any)[methodName] = (...args: any[]) => {\n const instance = singletonFn();\n return (instance as any)[methodName](...args);\n };\n }\n\n methodsInitialized = true;\n };\n\n // Use a proxy to intercept property access and lazily initialize methods\n return new Proxy(singletonFn, {\n get(target, prop, receiver) {\n // If accessing a method that doesn't exist yet, initialize methods\n if (typeof prop === \"string\" && !Reflect.has(target, prop)) {\n initializeMethods();\n }\n return Reflect.get(target, prop, receiver);\n },\n }) as typeof singletonFn & Omit<T, keyof Function>;\n}\n\nexport const router = createSingleton<Router>(() => new Router());\nexport const scheduler = wrapSingletonWithAccessors(\n createSingleton<Scheduler>(() => {\n const rc = new Scheduler();\n rc.setErrorHandler((err: any, job: Schedule) => {\n logger().error({\n msg: \"Scheduled job error\",\n err,\n job_name: job.getName(),\n });\n });\n return rc;\n }),\n);\n\nexport const db = (label = \"default\") =>\n ctx().getOrThrow<Connection>([\"database\", label]);\n\nexport const storage = wrapSingletonWithAccessors(\n createSingleton<Storage>((label: string = \"default\") => {\n let storage_config: any = config.get([\"storages\", label].join(\".\"));\n\n const provider = StorageProviderFactory.create(\n storage_config.provider,\n storage_config.config,\n );\n\n return new Storage(provider);\n }),\n);\n\nexport const cli = createSingleton<Cli>(() => {\n const [node, app, ...args] = process.argv;\n return new Cli({\n binaryLabel: `My Application`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n });\n});\n\nexport const httpServer = createSingleton<HttpServer>(() => {\n const server = new HttpServer();\n\n server.setErrorHandler(handleHttpErrors);\n server.setRouter(router());\n\n return server;\n});\n\nexport const logger = wrapSingletonWithAccessors(\n createSingleton<Logger>((label) => {\n const logger_config: any = config.get([\"loggers\", label].join(\".\"));\n const rc = new Logger(logger_config);\n rc.setExtrasFunction((message: any) => {\n message.requestId = ctxSafe()?.get(\"requestId\") || \"N/A\";\n return message;\n });\n\n return rc;\n }),\n);\n\nexport const mailer = wrapSingletonWithAccessors(\n createSingleton((label) => {\n const mailer_config: any = config.get([\"mailer\", label].join(\".\"));\n\n const provider: MailerProvider = MailerProviderFactory.create(\n mailer_config.provider,\n mailer_config.config,\n );\n\n const rc = new Mailer(provider);\n return rc;\n }),\n);\n\nexport const queue = wrapSingletonWithAccessors(\n createSingleton((label) => {\n const queue_config: any = config.get([\"queues\", label].join(\".\"));\n if (!queue_config) {\n throw new Error(`Queue configuration for '${label}' not found`);\n }\n const provider = QueueTransportFactory.create(\n queue_config.provider,\n queue_config.config,\n );\n return new QueueConnection(provider);\n }),\n);\n\nexport const cache = wrapSingletonWithAccessors(\n createSingleton((label) => {\n const cache_config: any = config.get([\"caches\", label].join(\".\"));\n if (!cache_config) {\n throw new Error(`Cache configuration for '${label}' not found`);\n }\n const provider = CacheProviderFactory.create(\n cache_config.provider,\n cache_config.config,\n );\n\n return new Cache(provider);\n }),\n);\n"],"mappings":";;AAAA,SAAS,cAAc;AACvB,SAAmB,iBAAiB;AACpC,SAAS,uBAAuB;AAChC,SAAS,KAAK,eAAe;AAE7B,SAAS,SAAS,8BAA8B;AAChD;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,WAAW;AACpB,SAAS,YAAY,wBAAwB;AAC7C,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC,SAAS,aAAa;AACtB,SAAS,iBAAiB,6BAA6B;AAQvD,SAAS,2BACP,aAC8C;AAE9C,MAAI,qBAAqB;AAEzB,QAAM,oBAAoB,6BAAM;AAC9B,QAAI,mBAAoB;AAExB,UAAM,kBAAkB,YAAY;AACpC,UAAM,YAAY,OAAO,eAAe,eAAe;AAGvD,UAAM,cAAc,OAAO,oBAAoB,SAAS,EAAE;AAAA,MACxD,CAAC,SACC,SAAS,iBACT,OAAQ,UAAkB,IAAI,MAAM;AAAA,IACxC;AAGA,eAAW,cAAc,aAAa;AACpC,MAAC,YAAoB,UAAU,IAAI,IAAI,SAAgB;AACrD,cAAM,WAAW,YAAY;AAC7B,eAAQ,SAAiB,UAAU,EAAE,GAAG,IAAI;AAAA,MAC9C;AAAA,IACF;AAEA,yBAAqB;AAAA,EACvB,GA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ACb,aAAa;AAAA,IACf;AAEA,WAAO,IAAI,MAAM,QAAQ;AAAA,EAC3B,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devbro/pashmak",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.55",
|
|
4
|
+
"description": "Pashmak framework, the framework that aims to be the easiest framework for all",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
7
7
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"@swc/core": "^1.12.9",
|
|
121
121
|
"@types/yup": "^0.32.0",
|
|
122
122
|
"globby": "^14.1.0",
|
|
123
|
-
"typescript": "^5.
|
|
123
|
+
"typescript": "^5.9.3"
|
|
124
124
|
},
|
|
125
125
|
"dependencies": {
|
|
126
126
|
"@devbro/neko-cache": "0.1.*",
|