jitar 0.1.3 → 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 +49 -0
- package/dist/core/types/Component.d.ts +1 -1
- package/dist/core/types/FlexObject.d.ts +1 -1
- package/dist/core/types/Module.d.ts +1 -1
- package/dist/core/types/SegmentImplementation.d.ts +1 -1
- package/dist/core/types/SegmentModule.d.ts +1 -1
- package/dist/core/types/SegmentProcedure.d.ts +1 -1
- package/dist/lib.d.ts +28 -1
- package/dist/lib.js +25 -1
- package/dist/runtime/LocalGateway.d.ts +2 -0
- package/dist/runtime/LocalGateway.js +7 -0
- package/dist/runtime/caching/types/SegmentFile.d.ts +1 -1
- package/dist/runtime/caching/types/SegmentImportProperties.d.ts +1 -1
- package/dist/runtime/caching/types/SegmentImports.d.ts +1 -1
- package/dist/runtime/serialization/ArrayBufferSerializer.d.ts +10 -0
- package/dist/runtime/serialization/ArrayBufferSerializer.js +54 -0
- package/dist/runtime/serialization/DateSerializer.d.ts +9 -0
- package/dist/runtime/serialization/DateSerializer.js +21 -0
- package/dist/runtime/serialization/ValueSerializer.d.ts +1 -0
- package/dist/runtime/serialization/ValueSerializer.js +24 -1
- package/dist/runtime/serialization/types/SerializableObject.d.ts +1 -1
- package/dist/runtime/serialization/types/Serialized.d.ts +1 -1
- package/dist/runtime/serialization/types/SerializedArrayBuffer.d.ts +6 -0
- package/dist/runtime/serialization/types/SerializedArrayBuffer.js +1 -0
- package/dist/runtime/serialization/types/SerializedClass.d.ts +1 -1
- package/dist/runtime/serialization/types/SerializedDate.d.ts +5 -0
- package/dist/runtime/serialization/types/SerializedDate.js +1 -0
- package/dist/runtime/serialization/types/SerializedMap.d.ts +1 -1
- package/dist/runtime/serialization/types/SerializedObject.d.ts +1 -1
- package/dist/runtime/serialization/types/SerializedSet.d.ts +1 -1
- package/dist/runtime/serialization/types/TypedArray.d.ts +2 -0
- package/dist/runtime/serialization/types/TypedArray.js +1 -0
- package/dist/runtime/types/JitarHooks.d.ts +1 -1
- package/dist/runtime/types/ModuleImporter.d.ts +1 -1
- package/dist/runtime/utils/ModuleLoader.js +1 -1
- package/package.json +4 -22
- package/dist/server/JitarServer.d.ts +0 -8
- package/dist/server/JitarServer.js +0 -109
- package/dist/server/configuration/GatewayConfiguration.d.ts +0 -3
- package/dist/server/configuration/GatewayConfiguration.js +0 -18
- package/dist/server/configuration/NodeConfiguration.d.ts +0 -5
- package/dist/server/configuration/NodeConfiguration.js +0 -28
- package/dist/server/configuration/ProxyConfiguration.d.ts +0 -5
- package/dist/server/configuration/ProxyConfiguration.js +0 -29
- package/dist/server/configuration/RepositoryConfiguration.d.ts +0 -6
- package/dist/server/configuration/RepositoryConfiguration.js +0 -36
- package/dist/server/configuration/RuntimeConfiguration.d.ts +0 -13
- package/dist/server/configuration/RuntimeConfiguration.js +0 -48
- package/dist/server/configuration/ServerOptions.d.ts +0 -4
- package/dist/server/configuration/ServerOptions.js +0 -25
- package/dist/server/configuration/StandaloneConfiguration.d.ts +0 -7
- package/dist/server/configuration/StandaloneConfiguration.js +0 -42
- package/dist/server/controllers/AssetsController.d.ts +0 -8
- package/dist/server/controllers/AssetsController.js +0 -50
- package/dist/server/controllers/HealthController.d.ts +0 -10
- package/dist/server/controllers/HealthController.js +0 -47
- package/dist/server/controllers/JitarController.d.ts +0 -4
- package/dist/server/controllers/JitarController.js +0 -26
- package/dist/server/controllers/ModulesController.d.ts +0 -10
- package/dist/server/controllers/ModulesController.js +0 -68
- package/dist/server/controllers/NodesController.d.ts +0 -9
- package/dist/server/controllers/NodesController.js +0 -60
- package/dist/server/controllers/ProceduresController.d.ts +0 -10
- package/dist/server/controllers/ProceduresController.js +0 -35
- package/dist/server/controllers/ProxyController.d.ts +0 -7
- package/dist/server/controllers/ProxyController.js +0 -37
- package/dist/server/controllers/RPCController.d.ts +0 -9
- package/dist/server/controllers/RPCController.js +0 -146
- package/dist/server/definitions/RuntimeDefaults.d.ts +0 -7
- package/dist/server/definitions/RuntimeDefaults.js +0 -8
- package/dist/server/errors/MissingConfigurationValue.d.ts +0 -3
- package/dist/server/errors/MissingConfigurationValue.js +0 -5
- package/dist/server/errors/RuntimeNotAvaiable.d.ts +0 -3
- package/dist/server/errors/RuntimeNotAvaiable.js +0 -5
- package/dist/server/errors/UnknownRuntimeMode.d.ts +0 -3
- package/dist/server/errors/UnknownRuntimeMode.js +0 -5
- package/dist/server/models/HealthDto.d.ts +0 -4
- package/dist/server/models/HealthDto.js +0 -22
- package/dist/server/models/NodeDto.d.ts +0 -4
- package/dist/server/models/NodeDto.js +0 -22
- package/dist/server/utils/DataConverter.d.ts +0 -4
- package/dist/server/utils/DataConverter.js +0 -9
- package/dist/server/utils/LocalFileManager.d.ts +0 -21
- package/dist/server/utils/LocalFileManager.js +0 -81
- package/dist/server/utils/RuntimeConfigurationLoader.d.ts +0 -4
- package/dist/server/utils/RuntimeConfigurationLoader.js +0 -11
- package/dist/server/utils/RuntimeConfigurator.d.ts +0 -6
- package/dist/server/utils/RuntimeConfigurator.js +0 -135
- package/dist/server/utils/ServerOptionsReader.d.ts +0 -4
- package/dist/server/utils/ServerOptionsReader.js +0 -10
- package/dist/server.d.ts +0 -3
- package/dist/server.js +0 -8
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)
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
export { default as HealthCheck } from './runtime/interfaces/HealthCheck.js';
|
|
2
|
+
export { default as Version } from './core/Version.js';
|
|
3
|
+
export { default as ImplementationNotFound } from './core/errors/ImplementationNotFound.js';
|
|
4
|
+
export { default as InvalidVersionNumber } from './core/errors/InvalidVersionNumber.js';
|
|
5
|
+
export { default as MissingParameterValue } from './core/errors/MissingParameterValue.js';
|
|
6
|
+
export { default as ProcedureNotFound } from './core/errors/ProcedureNotFound.js';
|
|
7
|
+
export { default as UnknownParameter } from './core/errors/UnknownParameter.js';
|
|
8
|
+
export { default as InvalidPropertyType } from './runtime/serialization/errors/InvalidPropertyType.js';
|
|
9
|
+
export { default as FileNotFound } from './runtime/errors/FileNotFound.js';
|
|
10
|
+
export { default as LocalRepository } from './runtime/LocalRepository.js';
|
|
11
|
+
export { default as LocalNode } from './runtime/LocalNode.js';
|
|
12
|
+
export { default as Proxy } from './runtime/Proxy.js';
|
|
13
|
+
export { default as ValueSerializer } from './runtime/serialization/ValueSerializer.js';
|
|
14
|
+
export { default as ClientId } from './runtime/ClientId.js';
|
|
15
|
+
export { default as RemoteNode } from './runtime/RemoteNode.js';
|
|
16
|
+
export { default as LocalGateway } from './runtime/LocalGateway.js';
|
|
17
|
+
export { default as ProcedureContainer } from './runtime/interfaces/ProcedureContainer.js';
|
|
18
|
+
export { default as FileManager } from './runtime/interfaces/FileManager.js';
|
|
19
|
+
export { default as File } from './runtime/models/File.js';
|
|
20
|
+
export { default as CacheBuilder } from './runtime/caching/CacheBuilder.js';
|
|
21
|
+
export { default as Gateway } from './runtime/Gateway.js';
|
|
22
|
+
export { default as Node } from './runtime/Node.js';
|
|
23
|
+
export { default as NodeMonitor } from './runtime/NodeMonitor.js';
|
|
24
|
+
export { default as RemoteGateway } from './runtime/RemoteGateway.js';
|
|
25
|
+
export { default as Repository } from './runtime/Repository.js';
|
|
26
|
+
export { default as Runtime } from './runtime/Runtime.js';
|
|
27
|
+
export { default as RemoteRepository } from './runtime/RemoteRepository.js';
|
|
28
|
+
export { default as ModuleImporter } from './runtime/types/ModuleImporter.js';
|
|
29
|
+
export { default as ModuleLoader } from './runtime/utils/ModuleLoader.js';
|
|
2
30
|
export * from './client.js';
|
|
3
|
-
export * from './server.js';
|
|
4
31
|
export * from './hooks.js';
|
package/dist/lib.js
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
export { default as Version } from './core/Version.js';
|
|
2
|
+
export { default as ImplementationNotFound } from './core/errors/ImplementationNotFound.js';
|
|
3
|
+
export { default as InvalidVersionNumber } from './core/errors/InvalidVersionNumber.js';
|
|
4
|
+
export { default as MissingParameterValue } from './core/errors/MissingParameterValue.js';
|
|
5
|
+
export { default as ProcedureNotFound } from './core/errors/ProcedureNotFound.js';
|
|
6
|
+
export { default as UnknownParameter } from './core/errors/UnknownParameter.js';
|
|
7
|
+
export { default as InvalidPropertyType } from './runtime/serialization/errors/InvalidPropertyType.js';
|
|
8
|
+
export { default as FileNotFound } from './runtime/errors/FileNotFound.js';
|
|
9
|
+
export { default as LocalRepository } from './runtime/LocalRepository.js';
|
|
10
|
+
export { default as LocalNode } from './runtime/LocalNode.js';
|
|
11
|
+
export { default as Proxy } from './runtime/Proxy.js';
|
|
12
|
+
export { default as ValueSerializer } from './runtime/serialization/ValueSerializer.js';
|
|
13
|
+
export { default as ClientId } from './runtime/ClientId.js';
|
|
14
|
+
export { default as RemoteNode } from './runtime/RemoteNode.js';
|
|
15
|
+
export { default as LocalGateway } from './runtime/LocalGateway.js';
|
|
16
|
+
export { default as File } from './runtime/models/File.js';
|
|
17
|
+
export { default as CacheBuilder } from './runtime/caching/CacheBuilder.js';
|
|
18
|
+
export { default as Gateway } from './runtime/Gateway.js';
|
|
19
|
+
export { default as Node } from './runtime/Node.js';
|
|
20
|
+
export { default as NodeMonitor } from './runtime/NodeMonitor.js';
|
|
21
|
+
export { default as RemoteGateway } from './runtime/RemoteGateway.js';
|
|
22
|
+
export { default as Repository } from './runtime/Repository.js';
|
|
23
|
+
export { default as Runtime } from './runtime/Runtime.js';
|
|
24
|
+
export { default as RemoteRepository } from './runtime/RemoteRepository.js';
|
|
25
|
+
export { default as ModuleLoader } from './runtime/utils/ModuleLoader.js';
|
|
1
26
|
export * from './client.js';
|
|
2
|
-
export * from './server.js';
|
|
3
27
|
export * from './hooks.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
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Serializer from './interfaces/Serializer.js';
|
|
2
|
+
import SerializedArrayBuffer from './types/SerializedArrayBuffer.js';
|
|
3
|
+
import TypedArray from './types/TypedArray.js';
|
|
4
|
+
declare class ArrayBufferSerializer implements Serializer {
|
|
5
|
+
#private;
|
|
6
|
+
serialize(data: TypedArray): SerializedArrayBuffer;
|
|
7
|
+
deserialize(object: SerializedArrayBuffer): Promise<TypedArray>;
|
|
8
|
+
}
|
|
9
|
+
declare const instance: ArrayBufferSerializer;
|
|
10
|
+
export default instance;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import InvalidPropertyType from './errors/InvalidPropertyType.js';
|
|
2
|
+
import ReflectionHelper from '../../core/reflection/ReflectionHelper.js';
|
|
3
|
+
class ArrayBufferSerializer {
|
|
4
|
+
serialize(data) {
|
|
5
|
+
const type = data.constructor.name;
|
|
6
|
+
const view = new DataView(data.buffer);
|
|
7
|
+
const bytes = [];
|
|
8
|
+
for (let index = 0; index < view.byteLength; index++) {
|
|
9
|
+
bytes.push(view.getUint8(index));
|
|
10
|
+
}
|
|
11
|
+
const returnvalue = { serialized: true, name: 'ArrayBuffer', type: type, bytes: bytes };
|
|
12
|
+
return returnvalue;
|
|
13
|
+
}
|
|
14
|
+
async deserialize(object) {
|
|
15
|
+
this.#validateSerializedArrayBuffer(object);
|
|
16
|
+
const type = object.type;
|
|
17
|
+
const bytes = object.bytes;
|
|
18
|
+
const buffer = new ArrayBuffer(bytes.length);
|
|
19
|
+
const view = new DataView(buffer);
|
|
20
|
+
for (let index = 0; index < bytes.length; index++) {
|
|
21
|
+
view.setUint8(index, bytes[index]);
|
|
22
|
+
}
|
|
23
|
+
const clazz = globalThis[type];
|
|
24
|
+
return ReflectionHelper.createInstance(clazz, [buffer]);
|
|
25
|
+
}
|
|
26
|
+
#validateSerializedArrayBuffer(object) {
|
|
27
|
+
if ((object.bytes instanceof Array) === false) {
|
|
28
|
+
throw new InvalidPropertyType('ArrayBuffer', 'bytes', 'Array');
|
|
29
|
+
}
|
|
30
|
+
if (this.#isValidType(object.type) === false) {
|
|
31
|
+
throw new InvalidPropertyType('ArrayBuffer', 'type', 'TypedArray');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
#isValidType(type) {
|
|
35
|
+
switch (type) {
|
|
36
|
+
case 'Int8Array':
|
|
37
|
+
case 'Uint8Array':
|
|
38
|
+
case 'Uint8ClampedArray':
|
|
39
|
+
case 'Int16Array':
|
|
40
|
+
case 'Uint16Array':
|
|
41
|
+
case 'Int32Array':
|
|
42
|
+
case 'Uint32Array':
|
|
43
|
+
case 'Float32Array':
|
|
44
|
+
case 'Float64Array':
|
|
45
|
+
case 'BigInt64Array':
|
|
46
|
+
case 'BigUint64Array':
|
|
47
|
+
return true;
|
|
48
|
+
default:
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const instance = new ArrayBufferSerializer();
|
|
54
|
+
export default instance;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Serializer from './interfaces/Serializer.js';
|
|
2
|
+
import SerializedDate from './types/SerializedDate.js';
|
|
3
|
+
declare class DateSerializer implements Serializer {
|
|
4
|
+
#private;
|
|
5
|
+
serialize(date: Date): SerializedDate;
|
|
6
|
+
deserialize(serializedDate: SerializedDate): Promise<Date>;
|
|
7
|
+
}
|
|
8
|
+
declare const instance: DateSerializer;
|
|
9
|
+
export default instance;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import InvalidPropertyType from './errors/InvalidPropertyType.js';
|
|
2
|
+
class DateSerializer {
|
|
3
|
+
serialize(date) {
|
|
4
|
+
return { serialized: true, name: 'Date', value: date.toISOString() };
|
|
5
|
+
}
|
|
6
|
+
async deserialize(serializedDate) {
|
|
7
|
+
this.#validateDate(serializedDate);
|
|
8
|
+
return new Date(serializedDate.value);
|
|
9
|
+
}
|
|
10
|
+
#validateDate(serializedDate) {
|
|
11
|
+
if (typeof serializedDate.value !== 'string') {
|
|
12
|
+
throw new InvalidPropertyType('date', 'value', 'string');
|
|
13
|
+
}
|
|
14
|
+
const date = Date.parse(serializedDate.value);
|
|
15
|
+
if (Number.isNaN(date)) {
|
|
16
|
+
throw new InvalidPropertyType('date', 'value', 'date');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const instance = new DateSerializer();
|
|
21
|
+
export default instance;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import ReflectionHelper from '../../core/reflection/ReflectionHelper.js';
|
|
2
|
+
import ArrayBufferSerializer from './ArrayBufferSerializer.js';
|
|
2
3
|
import ArraySerializer from './ArraySerializer.js';
|
|
3
4
|
import ClassSerializer from './ClassSerializer.js';
|
|
4
5
|
import MapSerializer from './MapSerializer.js';
|
|
5
6
|
import ObjectSerializer from './ObjectSerializer.js';
|
|
6
7
|
import SetSerializer from './SetSerializer.js';
|
|
8
|
+
import DateSerializer from './DateSerializer.js';
|
|
7
9
|
class ValueSerializer {
|
|
8
10
|
serialize(value) {
|
|
9
|
-
if (value
|
|
11
|
+
if (this.#isTypedArray(value)) {
|
|
12
|
+
return ArrayBufferSerializer.serialize(value);
|
|
13
|
+
}
|
|
14
|
+
else if (value instanceof Array) {
|
|
10
15
|
return ArraySerializer.serialize(value);
|
|
11
16
|
}
|
|
12
17
|
else if (value instanceof Map) {
|
|
@@ -15,6 +20,9 @@ class ValueSerializer {
|
|
|
15
20
|
else if (value instanceof Set) {
|
|
16
21
|
return SetSerializer.serialize(value);
|
|
17
22
|
}
|
|
23
|
+
if (value instanceof Date) {
|
|
24
|
+
return DateSerializer.serialize(value);
|
|
25
|
+
}
|
|
18
26
|
else if (value instanceof Error) {
|
|
19
27
|
return ClassSerializer.serialize(value);
|
|
20
28
|
}
|
|
@@ -38,9 +46,24 @@ class ValueSerializer {
|
|
|
38
46
|
switch (value.name) {
|
|
39
47
|
case 'Map': return await MapSerializer.deserialize(value);
|
|
40
48
|
case 'Set': return await SetSerializer.deserialize(value);
|
|
49
|
+
case 'Date': return await DateSerializer.deserialize(value);
|
|
50
|
+
case 'ArrayBuffer': return await ArrayBufferSerializer.deserialize(value);
|
|
41
51
|
default: return await ClassSerializer.deserialize(value);
|
|
42
52
|
}
|
|
43
53
|
}
|
|
54
|
+
#isTypedArray(value) {
|
|
55
|
+
return (value instanceof Int8Array)
|
|
56
|
+
|| (value instanceof Uint8Array)
|
|
57
|
+
|| (value instanceof Uint8ClampedArray)
|
|
58
|
+
|| (value instanceof Int16Array)
|
|
59
|
+
|| (value instanceof Uint16Array)
|
|
60
|
+
|| (value instanceof Int32Array)
|
|
61
|
+
|| (value instanceof Uint32Array)
|
|
62
|
+
|| (value instanceof Float32Array)
|
|
63
|
+
|| (value instanceof Float64Array)
|
|
64
|
+
|| (value instanceof BigInt64Array)
|
|
65
|
+
|| (value instanceof BigUint64Array);
|
|
66
|
+
}
|
|
44
67
|
}
|
|
45
68
|
const instance = new ValueSerializer();
|
|
46
69
|
export default instance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,7 +11,7 @@ export default class ModuleLoader {
|
|
|
11
11
|
}
|
|
12
12
|
static async load(url) {
|
|
13
13
|
if (url.startsWith('/jitar')) {
|
|
14
|
-
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.1
|
|
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",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./dist/lib.js",
|
|
12
12
|
"./client.js": "./dist/client.js",
|
|
13
|
-
"./server.js": "./dist/server.js",
|
|
14
13
|
"./hooks.js": "./dist/hooks.js"
|
|
15
14
|
},
|
|
16
15
|
"scripts": {
|
|
@@ -21,34 +20,17 @@
|
|
|
21
20
|
"clean": "rm -rf dist build",
|
|
22
21
|
"release": "npm run clean && npm run build && npm publish"
|
|
23
22
|
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@overnightjs/core": "^1.7.6",
|
|
26
|
-
"class-transformer": "^0.5.1",
|
|
27
|
-
"class-validator": "^0.13.2",
|
|
28
|
-
"express": "^4.18.1",
|
|
29
|
-
"express-http-proxy": "^1.6.3",
|
|
30
|
-
"fs-extra": "^10.1.0",
|
|
31
|
-
"glob": "^8.0.3",
|
|
32
|
-
"glob-promise": "^5.0.0",
|
|
33
|
-
"mime-types": "^2.1.35",
|
|
34
|
-
"tslog": "^3.3.3",
|
|
35
|
-
"yargs": "^17.6.0"
|
|
36
|
-
},
|
|
23
|
+
"dependencies": {},
|
|
37
24
|
"devDependencies": {
|
|
38
|
-
"@types/express": "^4.17.13",
|
|
39
|
-
"@types/express-http-proxy": "^1.6.3",
|
|
40
|
-
"@types/fs-extra": "^9.0.13",
|
|
41
|
-
"@types/jest": "^28.1.3",
|
|
42
|
-
"@types/mime-types": "^2.1.1",
|
|
43
|
-
"@types/yargs": "^17.0.13",
|
|
44
25
|
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
45
26
|
"@typescript-eslint/parser": "^5.29.0",
|
|
27
|
+
"@types/jest": "^28.1.3",
|
|
46
28
|
"eslint": "^8.18.0",
|
|
47
29
|
"jest": "^28.1.3",
|
|
48
30
|
"ts-jest": "^28.0.8"
|
|
49
31
|
},
|
|
50
32
|
"engines": {
|
|
51
|
-
"node": ">=18.7"
|
|
33
|
+
"node": ">=18.7"
|
|
52
34
|
},
|
|
53
35
|
"repository": {
|
|
54
36
|
"type": "git",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Server as OvernightServer } from '@overnightjs/core';
|
|
2
|
-
import HealthCheck from '../runtime/interfaces/HealthCheck.js';
|
|
3
|
-
export default class JitarServer extends OvernightServer {
|
|
4
|
-
#private;
|
|
5
|
-
constructor();
|
|
6
|
-
start(): Promise<void>;
|
|
7
|
-
addHealthCheck(name: string, healthCheck: HealthCheck): void;
|
|
8
|
-
}
|