jitar 0.3.0 → 0.3.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/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
3
|
|
|
4
|
+
## 0.3.1 (February 08, 2023)
|
|
5
|
+
|
|
6
|
+
New features:
|
|
7
|
+
- \[[`56164ee`](https://github.com/MaskingTechnology/jitar/commit/56164ee)] Implemented CORS middleware [basmasking](https://github.com/MaskingTechnology/jitar/pull/131)
|
|
8
|
+
|
|
4
9
|
## 0.3.0 (January 25, 2023)
|
|
5
10
|
|
|
6
11
|
New features:
|
package/dist/lib.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { default as RemoteGateway } from './runtime/RemoteGateway.js';
|
|
|
28
28
|
export { default as Repository } from './runtime/Repository.js';
|
|
29
29
|
export { default as Runtime } from './runtime/Runtime.js';
|
|
30
30
|
export { default as RemoteRepository } from './runtime/RemoteRepository.js';
|
|
31
|
+
export { default as CorsMiddleware } from './runtime/middleware/CorsMiddleware.js';
|
|
31
32
|
export { default as ModuleImporter } from './runtime/types/ModuleImporter.js';
|
|
32
33
|
export { default as ModuleLoader } from './runtime/utils/ModuleLoader.js';
|
|
33
34
|
export * from './client.js';
|
package/dist/lib.js
CHANGED
|
@@ -24,6 +24,7 @@ export { default as RemoteGateway } from './runtime/RemoteGateway.js';
|
|
|
24
24
|
export { default as Repository } from './runtime/Repository.js';
|
|
25
25
|
export { default as Runtime } from './runtime/Runtime.js';
|
|
26
26
|
export { default as RemoteRepository } from './runtime/RemoteRepository.js';
|
|
27
|
+
export { default as CorsMiddleware } from './runtime/middleware/CorsMiddleware.js';
|
|
27
28
|
export { default as ModuleLoader } from './runtime/utils/ModuleLoader.js';
|
|
28
29
|
export * from './client.js';
|
|
29
30
|
export * from './hooks.js';
|
|
@@ -4,6 +4,8 @@ export default class ProcedureRunner {
|
|
|
4
4
|
this.#runner = runner;
|
|
5
5
|
}
|
|
6
6
|
handle(fqn, version, args, headers, next) {
|
|
7
|
-
|
|
7
|
+
const result = this.#runner.run(fqn, version, args, headers);
|
|
8
|
+
headers.clear();
|
|
9
|
+
return result;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Middleware from '../interfaces/Middleware.js';
|
|
2
|
+
import Version from '../../core/Version.js';
|
|
3
|
+
import NextHandler from '../types/NextHandler.js';
|
|
4
|
+
export default class CorsMiddleware implements Middleware {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(origin?: string);
|
|
7
|
+
handle(fqn: string, version: Version, args: Map<string, unknown>, headers: Map<string, string>, next: NextHandler): Promise<unknown>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class CorsMiddleware {
|
|
2
|
+
#origin;
|
|
3
|
+
#methods = ['GET', 'POST'];
|
|
4
|
+
constructor(origin = '*') {
|
|
5
|
+
this.#origin = origin;
|
|
6
|
+
}
|
|
7
|
+
async handle(fqn, version, args, headers, next) {
|
|
8
|
+
const result = await next();
|
|
9
|
+
this.#setHeaders(headers);
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
#setHeaders(headers) {
|
|
13
|
+
headers.set('Access-Control-Allow-Origin', this.#origin);
|
|
14
|
+
headers.set('Access-Control-Allow-Methods', this.#methods.join(', '));
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jitar",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
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",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
26
|
-
"@typescript-eslint/parser": "^5.
|
|
27
|
-
"@types/jest": "^
|
|
28
|
-
"eslint": "^8.
|
|
29
|
-
"jest": "^
|
|
30
|
-
"ts-jest": "^
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
26
|
+
"@typescript-eslint/parser": "^5.51.0",
|
|
27
|
+
"@types/jest": "^29.4.0",
|
|
28
|
+
"eslint": "^8.33.0",
|
|
29
|
+
"jest": "^29.4.1",
|
|
30
|
+
"ts-jest": "^29.0.5"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18.7"
|