jitar 0.2.0 → 0.2.1

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 ADDED
@@ -0,0 +1,49 @@
1
+
2
+ # Changelog
3
+
4
+ ## 0.2.1 (December 02, 2022)
5
+
6
+ Fixes:
7
+ - \[[`fb04f99`](https://github.com/MaskingTechnology/jitar/commit/fb04f99)] Fixed error deserialization at gateway [basmasking](https://github.com/MaskingTechnology/jitar/pull/69)
8
+
9
+
10
+ ## 0.2.0 (November 18, 2022)
11
+
12
+ New features:
13
+ - \[[`0c115e1`](https://github.com/MaskingTechnology/jitar/commit/0c115e1)] Added binary data serialization [basmasking](https://github.com/MaskingTechnology/jitar/pull/56)
14
+ - \[[`38b90da`](https://github.com/MaskingTechnology/jitar/commit/38b90da)] Added date serialization [basmasking](https://github.com/MaskingTechnology/jitar/pull/58)
15
+ - \[[`b27f571`](https://github.com/MaskingTechnology/jitar/commit/b27f571)] Split jitar into multiple packages [basmasking](https://github.com/MaskingTechnology/jitar/pull/60)
16
+
17
+
18
+ ## 0.1.3 (November 11, 2022)
19
+
20
+ Fixes:
21
+ - \[[`4b7a8d0`](https://github.com/MaskingTechnology/jitar/commit/4b7a8d0)] Added release script and released to npm [basmasking](https://github.com/BasMasking)
22
+
23
+ ## 0.1.2 (November 11, 2022)
24
+
25
+ New features:
26
+ - \[[`a842fb0`](https://github.com/MaskingTechnology/jitar/commit/a842fb0)] Data type validation on RPC calls [Yusuf-YENICERI](https://github.com/MaskingTechnology/jitar/pull/44)
27
+ - \[[`265a5f5`](https://github.com/MaskingTechnology/jitar/commit/265a5f5)] Asset protection (public/private assets) [basmasking](https://github.com/MaskingTechnology/jitar/pull/48)
28
+ - \[[`0b0cf57`](https://github.com/MaskingTechnology/jitar/commit/0b0cf57)] Extended error handling [basmeeuwissen](https://github.com/MaskingTechnology/jitar/pull/53)
29
+ - \[[`ec63abd`](https://github.com/MaskingTechnology/jitar/commit/ec63abd)] Fixed segment in startClient documentation [pvvliet](https://github.com/MaskingTechnology/jitar/pull/54)
30
+
31
+ ## 0.1.1 (October 28, 2022)
32
+
33
+ Fixes:
34
+ - Linting issues (typing, code improvements, etc.)
35
+ - \[[`e85db81`](https://github.com/MaskingTechnology/jitar/commit/e85db81)] Extended deserialization data validation [petermasking](https://github.com/MaskingTechnology/jitar/pull/24)
36
+ - \[[`468d92c`](https://github.com/MaskingTechnology/jitar/commit/468d92c)] Improved the client id generation and validation [petermasking](https://github.com/MaskingTechnology/jitar/pull/22)
37
+
38
+ ## 0.1.0 (October 21, 2022)
39
+
40
+ New features:
41
+ - Segmentation (configurable)
42
+ - Orchestration (automatic)
43
+ - Load belancing (round robin)
44
+ - Access protection (public/private)
45
+ - Multi-version (procedures)
46
+ - Data transportation (serialization)
47
+ - Error handling
48
+ - Health checks
49
+ - RPC API (HTTP)
@@ -1,4 +1,4 @@
1
- declare type Component = {
1
+ type Component = {
2
2
  name: string;
3
3
  source?: string;
4
4
  };
@@ -1,4 +1,4 @@
1
- declare type FlexObject = {
1
+ type FlexObject = {
2
2
  [key: string]: unknown;
3
3
  };
4
4
  export default FlexObject;
@@ -1,3 +1,3 @@
1
1
  import FlexObject from './FlexObject.js';
2
- declare type Module = FlexObject;
2
+ type Module = FlexObject;
3
3
  export default Module;
@@ -1,4 +1,4 @@
1
- declare type SegmentImplementation = {
1
+ type SegmentImplementation = {
2
2
  access: string;
3
3
  version: string;
4
4
  executable: Function;
@@ -1,5 +1,5 @@
1
1
  import SegmentProcedure from './SegmentProcedure.js';
2
- declare type SegmentModule = {
2
+ type SegmentModule = {
3
3
  procedures: SegmentProcedure[];
4
4
  };
5
5
  export default SegmentModule;
@@ -1,5 +1,5 @@
1
1
  import SegmentImplementation from './SegmentImplementation.js';
2
- declare type SegmentProcedure = {
2
+ type SegmentProcedure = {
3
3
  module: string;
4
4
  name: string;
5
5
  implementations: SegmentImplementation[];
package/dist/lib.d.ts CHANGED
@@ -5,6 +5,7 @@ export { default as InvalidVersionNumber } from './core/errors/InvalidVersionNum
5
5
  export { default as MissingParameterValue } from './core/errors/MissingParameterValue.js';
6
6
  export { default as ProcedureNotFound } from './core/errors/ProcedureNotFound.js';
7
7
  export { default as UnknownParameter } from './core/errors/UnknownParameter.js';
8
+ export { default as InvalidPropertyType } from './runtime/serialization/errors/InvalidPropertyType.js';
8
9
  export { default as FileNotFound } from './runtime/errors/FileNotFound.js';
9
10
  export { default as LocalRepository } from './runtime/LocalRepository.js';
10
11
  export { default as LocalNode } from './runtime/LocalNode.js';
package/dist/lib.js CHANGED
@@ -4,6 +4,7 @@ export { default as InvalidVersionNumber } from './core/errors/InvalidVersionNum
4
4
  export { default as MissingParameterValue } from './core/errors/MissingParameterValue.js';
5
5
  export { default as ProcedureNotFound } from './core/errors/ProcedureNotFound.js';
6
6
  export { default as UnknownParameter } from './core/errors/UnknownParameter.js';
7
+ export { default as InvalidPropertyType } from './runtime/serialization/errors/InvalidPropertyType.js';
7
8
  export { default as FileNotFound } from './runtime/errors/FileNotFound.js';
8
9
  export { default as LocalRepository } from './runtime/LocalRepository.js';
9
10
  export { default as LocalNode } from './runtime/LocalNode.js';
@@ -1,6 +1,7 @@
1
1
  import Version from '../core/Version.js';
2
2
  import Gateway from './Gateway.js';
3
3
  import Node from './Node.js';
4
+ import Repository from './Repository.js';
4
5
  export default class LocalGateway extends Gateway {
5
6
  #private;
6
7
  get nodes(): Node[];
@@ -8,5 +9,6 @@ export default class LocalGateway extends Gateway {
8
9
  hasProcedure(fqn: string): boolean;
9
10
  addNode(node: Node): Promise<void>;
10
11
  removeNode(node: Node): void;
12
+ setBaseUrl(repository: Repository): Promise<void>;
11
13
  run(fqn: string, version: Version, args: Map<string, unknown>): Promise<unknown>;
12
14
  }
@@ -1,6 +1,8 @@
1
1
  import ProcedureNotFound from '../core/errors/ProcedureNotFound.js';
2
2
  import Gateway from './Gateway.js';
3
3
  import NodeBalancer from './NodeBalancer.js';
4
+ import ModuleLoader from './utils/ModuleLoader.js';
5
+ const NO_SEGMENTS = [];
4
6
  export default class LocalGateway extends Gateway {
5
7
  #nodes = new Set();
6
8
  #balancers = new Map();
@@ -33,6 +35,11 @@ export default class LocalGateway extends Gateway {
33
35
  balancer.removeNode(node);
34
36
  }
35
37
  }
38
+ async setBaseUrl(repository) {
39
+ const clientId = await repository.registerClient(NO_SEGMENTS);
40
+ const moduleLocation = await repository.getModuleLocation(clientId);
41
+ ModuleLoader.setBaseUrl(moduleLocation);
42
+ }
36
43
  #getBalancer(fqn) {
37
44
  return this.#balancers.get(fqn);
38
45
  }
@@ -1,5 +1,5 @@
1
1
  import SegmentImports from './SegmentImports.js';
2
- declare type SegmentFile = {
2
+ type SegmentFile = {
3
3
  [key: string]: SegmentImports;
4
4
  };
5
5
  export default SegmentFile;
@@ -1,4 +1,4 @@
1
- declare type SegmentImportProperties = {
1
+ type SegmentImportProperties = {
2
2
  as?: string;
3
3
  access?: string;
4
4
  version?: string;
@@ -1,5 +1,5 @@
1
1
  import SegmentImportProperties from './SegmentImportProperties.js';
2
- declare type SegmentImports = {
2
+ type SegmentImports = {
3
3
  [key: string]: SegmentImportProperties;
4
4
  };
5
5
  export default SegmentImports;
@@ -1,3 +1,3 @@
1
1
  import FlexObject from '../../../core/types/FlexObject.js';
2
- declare type SerializableObject = FlexObject;
2
+ type SerializableObject = FlexObject;
3
3
  export default SerializableObject;
@@ -1,4 +1,4 @@
1
- declare type Serialized = {
1
+ type Serialized = {
2
2
  serialized: boolean;
3
3
  name: string;
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import Serialized from './Serialized.js';
2
- declare type SerializedArrayBuffer = Serialized & {
2
+ type SerializedArrayBuffer = Serialized & {
3
3
  type: string;
4
4
  bytes: number[];
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import FlexObject from '../../../core/types/FlexObject.js';
2
2
  import Serialized from './Serialized.js';
3
- declare type SerializedClass = Serialized & {
3
+ type SerializedClass = Serialized & {
4
4
  source: string | null;
5
5
  args: unknown[];
6
6
  fields: FlexObject;
@@ -1,5 +1,5 @@
1
1
  import Serialized from './Serialized.js';
2
- declare type SerializedDate = Serialized & {
2
+ type SerializedDate = Serialized & {
3
3
  value: string;
4
4
  };
5
5
  export default SerializedDate;
@@ -1,5 +1,5 @@
1
1
  import Serialized from './Serialized.js';
2
- declare type SerializedMap = Serialized & {
2
+ type SerializedMap = Serialized & {
3
3
  entries: {
4
4
  keys: unknown[];
5
5
  values: unknown[];
@@ -1,4 +1,4 @@
1
- declare type SerializedObject = {
1
+ type SerializedObject = {
2
2
  [key: string]: unknown;
3
3
  };
4
4
  export default SerializedObject;
@@ -1,5 +1,5 @@
1
1
  import Serialized from './Serialized.js';
2
- declare type SerializedSet = Serialized & {
2
+ type SerializedSet = Serialized & {
3
3
  values: unknown[];
4
4
  };
5
5
  export default SerializedSet;
@@ -1,2 +1,2 @@
1
- declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
1
+ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
2
2
  export default TypedArray;
@@ -1,5 +1,5 @@
1
1
  import Runtime from '../Runtime.js';
2
- declare type JitarHooks = {
2
+ type JitarHooks = {
3
3
  setRuntime: (runtime: Runtime) => void;
4
4
  setDependencyLoader: (loader: Function) => void;
5
5
  };
@@ -1,3 +1,3 @@
1
1
  import Module from '../../core/types/Module.js';
2
- declare type ModuleImporter = (name: string) => Promise<Module>;
2
+ type ModuleImporter = (name: string) => Promise<Module>;
3
3
  export default ModuleImporter;
@@ -11,7 +11,7 @@ export default class ModuleLoader {
11
11
  }
12
12
  static async load(url) {
13
13
  if (url.startsWith('/jitar')) {
14
- url = `../../${url}`;
14
+ url = `../..${url}`;
15
15
  }
16
16
  if (_baseUrl !== undefined && url.startsWith(_baseUrl) === false) {
17
17
  url = UrlRewriter.addBase(url, _baseUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitar",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
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",
@@ -20,9 +20,7 @@
20
20
  "clean": "rm -rf dist build",
21
21
  "release": "npm run clean && npm run build && npm publish"
22
22
  },
23
- "dependencies": {
24
-
25
- },
23
+ "dependencies": {},
26
24
  "devDependencies": {
27
25
  "@typescript-eslint/eslint-plugin": "^5.29.0",
28
26
  "@typescript-eslint/parser": "^5.29.0",
@@ -32,7 +30,7 @@
32
30
  "ts-jest": "^28.0.8"
33
31
  },
34
32
  "engines": {
35
- "node": ">=18.7"
33
+ "node": ">=18.7"
36
34
  },
37
35
  "repository": {
38
36
  "type": "git",