jitar 0.3.8 → 0.3.9

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/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
 
2
2
  # Changelog
3
3
 
4
+ ## 0.3.9 (March 10, 2023)
5
+
6
+ New features:
7
+ - \[[`ccd0d50`](https://github.com/MaskingTechnology/jitar/commit/ccd0d50)] Added support for preflight requests [basmasking](https://github.com/MaskingTechnology/jitar/pull/204)
8
+
9
+ ## 0.3.8 (March 04, 2023)
10
+
11
+ Fixes:
12
+ - \[[`5ce818e`](https://github.com/MaskingTechnology/jitar/commit/5ce818e)] Fixed importing commonJS modules [petermasking](https://github.com/MaskingTechnology/jitar/pull/195)
13
+
4
14
  ## 0.3.7 (February 26, 2023)
5
15
 
6
16
  Fixes:
@@ -9,5 +9,6 @@ export default abstract class ProcedureRuntime extends Runtime implements Runner
9
9
  abstract hasProcedure(name: string): boolean;
10
10
  abstract run(fqn: string, version: Version, args: Map<string, unknown>, headers: Map<string, string>): Promise<unknown>;
11
11
  addMiddleware(middleware: Middleware): void;
12
+ getMiddleware(type: Function): Middleware | undefined;
12
13
  handle(fqn: string, version: Version, args: Map<string, unknown>, headers: Map<string, string>): Promise<unknown>;
13
14
  }
@@ -9,6 +9,9 @@ export default class ProcedureRuntime extends Runtime {
9
9
  addMiddleware(middleware) {
10
10
  this.#middlewares.push(middleware);
11
11
  }
12
+ getMiddleware(type) {
13
+ return this.#middlewares.find(middleware => middleware instanceof type);
14
+ }
12
15
  handle(fqn, version, args, headers) {
13
16
  const startHandler = this.#getNextHandler(fqn, version, args, headers, 0);
14
17
  return startHandler();
@@ -4,5 +4,8 @@ import NextHandler from '../types/NextHandler.js';
4
4
  export default class CorsMiddleware implements Middleware {
5
5
  #private;
6
6
  constructor(origin?: string, headers?: string);
7
+ get allowOrigin(): string;
8
+ get allowMethods(): string;
9
+ get allowHeaders(): string;
7
10
  handle(fqn: string, version: Version, args: Map<string, unknown>, headers: Map<string, string>, next: NextHandler): Promise<unknown>;
8
11
  }
@@ -6,6 +6,9 @@ export default class CorsMiddleware {
6
6
  this.#allowOrigin = origin;
7
7
  this.#allowHeaders = headers;
8
8
  }
9
+ get allowOrigin() { return this.#allowOrigin; }
10
+ get allowMethods() { return this.#allowMethods; }
11
+ get allowHeaders() { return this.#allowHeaders; }
9
12
  async handle(fqn, version, args, headers, next) {
10
13
  const result = await next();
11
14
  this.#setHeaders(headers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitar",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Distributed runtime for JavaScript and TypeScript to chop monolithic applications into micros.",
5
5
  "author": "Masking Technology <info@masking.tech> (https://jitar.dev)",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "release": "npm run clean && npm run build && npm publish"
22
22
  },
23
23
  "dependencies": {
24
- "jitar-reflection": "^0.3.7"
24
+ "jitar-reflection": "^0.3.9"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=18.7"
@@ -44,5 +44,5 @@
44
44
  "full stack",
45
45
  "web applications"
46
46
  ],
47
- "gitHead": "8eafe79ce9317964f843301bc2fbf6278a4fb88f"
47
+ "gitHead": "ce393774f3566f9c2732b1c46f46c33a756a97e1"
48
48
  }