jitar 0.3.1 → 0.3.3

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.
Files changed (229) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENCE +23 -0
  3. package/dist/client.d.ts +3 -0
  4. package/dist/client.js +24 -0
  5. package/dist/core/Context.d.ts +5 -0
  6. package/dist/core/Context.js +7 -0
  7. package/dist/core/ErrorManager.d.ts +3 -0
  8. package/dist/core/ErrorManager.js +11 -0
  9. package/dist/core/Implementation.d.ts +10 -0
  10. package/dist/core/Implementation.js +44 -0
  11. package/dist/core/Procedure.d.ts +13 -0
  12. package/dist/core/Procedure.js +58 -0
  13. package/dist/core/Segment.d.ts +13 -0
  14. package/dist/core/Segment.js +36 -0
  15. package/dist/core/SegmentBuilder.d.ts +6 -0
  16. package/dist/core/SegmentBuilder.js +32 -0
  17. package/dist/core/Version.d.ts +13 -0
  18. package/dist/core/Version.js +50 -0
  19. package/dist/core/definitions/AccessLevel.d.ts +2 -0
  20. package/dist/core/definitions/AccessLevel.js +2 -0
  21. package/dist/core/errors/BadRequest.d.ts +3 -0
  22. package/dist/core/errors/BadRequest.js +6 -0
  23. package/dist/core/errors/Forbidden.d.ts +3 -0
  24. package/dist/core/errors/Forbidden.js +6 -0
  25. package/dist/core/errors/ImplementationNotFound.d.ts +4 -0
  26. package/dist/core/errors/ImplementationNotFound.js +7 -0
  27. package/dist/core/errors/InvalidVersionNumber.d.ts +4 -0
  28. package/dist/core/errors/InvalidVersionNumber.js +7 -0
  29. package/dist/core/errors/MissingParameterValue.d.ts +4 -0
  30. package/dist/core/errors/MissingParameterValue.js +7 -0
  31. package/dist/core/errors/NotFound.d.ts +3 -0
  32. package/dist/core/errors/NotFound.js +6 -0
  33. package/dist/core/errors/NotImplemented.d.ts +3 -0
  34. package/dist/core/errors/NotImplemented.js +6 -0
  35. package/dist/core/errors/PaymentRequired.d.ts +3 -0
  36. package/dist/core/errors/PaymentRequired.js +6 -0
  37. package/dist/core/errors/ProcedureNotFound.d.ts +4 -0
  38. package/dist/core/errors/ProcedureNotFound.js +7 -0
  39. package/dist/core/errors/Teapot.d.ts +3 -0
  40. package/dist/core/errors/Teapot.js +6 -0
  41. package/dist/core/errors/Unauthorized.d.ts +3 -0
  42. package/dist/core/errors/Unauthorized.js +6 -0
  43. package/dist/core/errors/UnknownParameter.d.ts +4 -0
  44. package/dist/core/errors/UnknownParameter.js +7 -0
  45. package/dist/core/interfaces/Runner.d.ts +4 -0
  46. package/dist/core/interfaces/Runner.js +1 -0
  47. package/dist/core/reflection/ParameterParser.d.ts +5 -0
  48. package/dist/core/reflection/ParameterParser.js +51 -0
  49. package/dist/core/reflection/ReflectionHelper.d.ts +13 -0
  50. package/dist/core/reflection/ReflectionHelper.js +69 -0
  51. package/dist/core/reflection/models/ReflectionField.d.ts +8 -0
  52. package/dist/core/reflection/models/ReflectionField.js +14 -0
  53. package/dist/core/reflection/models/ReflectionParameter.d.ts +7 -0
  54. package/dist/core/reflection/models/ReflectionParameter.js +11 -0
  55. package/dist/core/types/Component.d.ts +5 -0
  56. package/dist/core/types/Component.js +1 -0
  57. package/dist/core/types/FlexObject.d.ts +4 -0
  58. package/dist/core/types/FlexObject.js +1 -0
  59. package/dist/core/types/Module.d.ts +3 -0
  60. package/dist/core/types/Module.js +1 -0
  61. package/dist/core/types/SegmentImplementation.d.ts +6 -0
  62. package/dist/core/types/SegmentImplementation.js +1 -0
  63. package/dist/core/types/SegmentModule.d.ts +5 -0
  64. package/dist/core/types/SegmentModule.js +1 -0
  65. package/dist/core/types/SegmentProcedure.d.ts +7 -0
  66. package/dist/core/types/SegmentProcedure.js +1 -0
  67. package/dist/core/utils/FqnBuilder.d.ts +3 -0
  68. package/dist/core/utils/FqnBuilder.js +5 -0
  69. package/dist/hooks.d.ts +2 -0
  70. package/dist/hooks.js +2 -0
  71. package/dist/lib.d.ts +35 -0
  72. package/dist/lib.js +30 -0
  73. package/dist/runtime/ClientId.d.ts +4 -0
  74. package/dist/runtime/ClientId.js +11 -0
  75. package/dist/runtime/Gateway.d.ts +5 -0
  76. package/dist/runtime/Gateway.js +3 -0
  77. package/dist/runtime/LocalGateway.d.ts +14 -0
  78. package/dist/runtime/LocalGateway.js +61 -0
  79. package/dist/runtime/LocalNode.d.ts +18 -0
  80. package/dist/runtime/LocalNode.js +75 -0
  81. package/dist/runtime/LocalRepository.d.ts +17 -0
  82. package/dist/runtime/LocalRepository.js +94 -0
  83. package/dist/runtime/Node.d.ts +3 -0
  84. package/dist/runtime/Node.js +3 -0
  85. package/dist/runtime/NodeBalancer.d.ts +9 -0
  86. package/dist/runtime/NodeBalancer.js +34 -0
  87. package/dist/runtime/NodeMonitor.d.ts +7 -0
  88. package/dist/runtime/NodeMonitor.js +38 -0
  89. package/dist/runtime/ProcedureRunner.d.ts +9 -0
  90. package/dist/runtime/ProcedureRunner.js +11 -0
  91. package/dist/runtime/ProcedureRuntime.d.ts +13 -0
  92. package/dist/runtime/ProcedureRuntime.js +25 -0
  93. package/dist/runtime/Proxy.d.ts +18 -0
  94. package/dist/runtime/Proxy.js +33 -0
  95. package/dist/runtime/Remote.d.ts +15 -0
  96. package/dist/runtime/Remote.js +102 -0
  97. package/dist/runtime/RemoteGateway.d.ts +11 -0
  98. package/dist/runtime/RemoteGateway.js +22 -0
  99. package/dist/runtime/RemoteNode.d.ts +12 -0
  100. package/dist/runtime/RemoteNode.js +29 -0
  101. package/dist/runtime/RemoteRepository.d.ts +14 -0
  102. package/dist/runtime/RemoteRepository.js +34 -0
  103. package/dist/runtime/Repository.d.ts +11 -0
  104. package/dist/runtime/Repository.js +3 -0
  105. package/dist/runtime/Runtime.d.ts +9 -0
  106. package/dist/runtime/Runtime.js +27 -0
  107. package/dist/runtime/caching/CacheBuilder.d.ts +6 -0
  108. package/dist/runtime/caching/CacheBuilder.js +249 -0
  109. package/dist/runtime/caching/ImportRewriter.d.ts +4 -0
  110. package/dist/runtime/caching/ImportRewriter.js +49 -0
  111. package/dist/runtime/caching/RemoteBuilder.d.ts +5 -0
  112. package/dist/runtime/caching/RemoteBuilder.js +31 -0
  113. package/dist/runtime/caching/SourceAppender.d.ts +5 -0
  114. package/dist/runtime/caching/SourceAppender.js +30 -0
  115. package/dist/runtime/caching/definitions/Keywords.d.ts +2 -0
  116. package/dist/runtime/caching/definitions/Keywords.js +2 -0
  117. package/dist/runtime/caching/errors/InvalidSegmentFilename.d.ts +3 -0
  118. package/dist/runtime/caching/errors/InvalidSegmentFilename.js +5 -0
  119. package/dist/runtime/caching/errors/MissingModuleExport.d.ts +3 -0
  120. package/dist/runtime/caching/errors/MissingModuleExport.js +5 -0
  121. package/dist/runtime/caching/errors/SegmentFileNotLoaded.d.ts +3 -0
  122. package/dist/runtime/caching/errors/SegmentFileNotLoaded.js +5 -0
  123. package/dist/runtime/caching/errors/SegmentModuleNotLoaded.d.ts +3 -0
  124. package/dist/runtime/caching/errors/SegmentModuleNotLoaded.js +5 -0
  125. package/dist/runtime/caching/models/ApplicationModule.d.ts +9 -0
  126. package/dist/runtime/caching/models/ApplicationModule.js +19 -0
  127. package/dist/runtime/caching/models/Implementation.d.ts +12 -0
  128. package/dist/runtime/caching/models/Implementation.js +27 -0
  129. package/dist/runtime/caching/models/Procedure.d.ts +9 -0
  130. package/dist/runtime/caching/models/Procedure.js +15 -0
  131. package/dist/runtime/caching/models/Segment.d.ts +10 -0
  132. package/dist/runtime/caching/models/Segment.js +16 -0
  133. package/dist/runtime/caching/models/SegmentModule.d.ts +10 -0
  134. package/dist/runtime/caching/models/SegmentModule.js +14 -0
  135. package/dist/runtime/caching/types/SegmentFile.d.ts +5 -0
  136. package/dist/runtime/caching/types/SegmentFile.js +1 -0
  137. package/dist/runtime/caching/types/SegmentImportProperties.d.ts +6 -0
  138. package/dist/runtime/caching/types/SegmentImportProperties.js +1 -0
  139. package/dist/runtime/caching/types/SegmentImports.d.ts +5 -0
  140. package/dist/runtime/caching/types/SegmentImports.js +1 -0
  141. package/dist/runtime/errors/ClientNotFound.d.ts +3 -0
  142. package/dist/runtime/errors/ClientNotFound.js +6 -0
  143. package/dist/runtime/errors/FileNotFound.d.ts +3 -0
  144. package/dist/runtime/errors/FileNotFound.js +6 -0
  145. package/dist/runtime/errors/InvalidClientId.d.ts +3 -0
  146. package/dist/runtime/errors/InvalidClientId.js +6 -0
  147. package/dist/runtime/errors/InvalidJitarHooks.d.ts +3 -0
  148. package/dist/runtime/errors/InvalidJitarHooks.js +6 -0
  149. package/dist/runtime/errors/InvalidSegmentFile.d.ts +3 -0
  150. package/dist/runtime/errors/InvalidSegmentFile.js +6 -0
  151. package/dist/runtime/errors/ModuleNotLoaded.d.ts +3 -0
  152. package/dist/runtime/errors/ModuleNotLoaded.js +6 -0
  153. package/dist/runtime/errors/NoNodeAvailable.d.ts +3 -0
  154. package/dist/runtime/errors/NoNodeAvailable.js +6 -0
  155. package/dist/runtime/errors/RepositoryNotAvaiable.d.ts +3 -0
  156. package/dist/runtime/errors/RepositoryNotAvaiable.js +6 -0
  157. package/dist/runtime/errors/RuntimeNotAvailable.d.ts +3 -0
  158. package/dist/runtime/errors/RuntimeNotAvailable.js +6 -0
  159. package/dist/runtime/errors/SegmentNotFound.d.ts +3 -0
  160. package/dist/runtime/errors/SegmentNotFound.js +6 -0
  161. package/dist/runtime/hooks/dependencies.d.ts +2 -0
  162. package/dist/runtime/hooks/dependencies.js +9 -0
  163. package/dist/runtime/hooks/runtime.d.ts +3 -0
  164. package/dist/runtime/hooks/runtime.js +16 -0
  165. package/dist/runtime/interfaces/FileManager.d.ts +11 -0
  166. package/dist/runtime/interfaces/FileManager.js +1 -0
  167. package/dist/runtime/interfaces/HealthCheck.d.ts +3 -0
  168. package/dist/runtime/interfaces/HealthCheck.js +1 -0
  169. package/dist/runtime/interfaces/Middleware.d.ts +5 -0
  170. package/dist/runtime/interfaces/Middleware.js +1 -0
  171. package/dist/runtime/middleware/CorsMiddleware.d.ts +8 -0
  172. package/dist/runtime/middleware/CorsMiddleware.js +19 -0
  173. package/dist/runtime/models/File.d.ts +9 -0
  174. package/dist/runtime/models/File.js +14 -0
  175. package/dist/runtime/serialization/ArrayBufferSerializer.d.ts +10 -0
  176. package/dist/runtime/serialization/ArrayBufferSerializer.js +54 -0
  177. package/dist/runtime/serialization/ArraySerializer.d.ts +7 -0
  178. package/dist/runtime/serialization/ArraySerializer.js +15 -0
  179. package/dist/runtime/serialization/ClassSerializer.d.ts +10 -0
  180. package/dist/runtime/serialization/ClassSerializer.js +74 -0
  181. package/dist/runtime/serialization/DateSerializer.d.ts +9 -0
  182. package/dist/runtime/serialization/DateSerializer.js +21 -0
  183. package/dist/runtime/serialization/MapSerializer.d.ts +9 -0
  184. package/dist/runtime/serialization/MapSerializer.js +35 -0
  185. package/dist/runtime/serialization/ObjectSerializer.d.ts +9 -0
  186. package/dist/runtime/serialization/ObjectSerializer.js +21 -0
  187. package/dist/runtime/serialization/SetSerializer.d.ts +9 -0
  188. package/dist/runtime/serialization/SetSerializer.js +23 -0
  189. package/dist/runtime/serialization/ValueSerializer.d.ts +8 -0
  190. package/dist/runtime/serialization/ValueSerializer.js +69 -0
  191. package/dist/runtime/serialization/errors/ClassNotFound.d.ts +3 -0
  192. package/dist/runtime/serialization/errors/ClassNotFound.js +6 -0
  193. package/dist/runtime/serialization/errors/InvalidClass.d.ts +3 -0
  194. package/dist/runtime/serialization/errors/InvalidClass.js +6 -0
  195. package/dist/runtime/serialization/errors/InvalidPropertyType.d.ts +4 -0
  196. package/dist/runtime/serialization/errors/InvalidPropertyType.js +7 -0
  197. package/dist/runtime/serialization/interfaces/Serializer.d.ts +4 -0
  198. package/dist/runtime/serialization/interfaces/Serializer.js +1 -0
  199. package/dist/runtime/serialization/types/SerializableObject.d.ts +3 -0
  200. package/dist/runtime/serialization/types/SerializableObject.js +1 -0
  201. package/dist/runtime/serialization/types/Serialized.d.ts +5 -0
  202. package/dist/runtime/serialization/types/Serialized.js +1 -0
  203. package/dist/runtime/serialization/types/SerializedArrayBuffer.d.ts +6 -0
  204. package/dist/runtime/serialization/types/SerializedArrayBuffer.js +1 -0
  205. package/dist/runtime/serialization/types/SerializedClass.d.ts +8 -0
  206. package/dist/runtime/serialization/types/SerializedClass.js +1 -0
  207. package/dist/runtime/serialization/types/SerializedDate.d.ts +5 -0
  208. package/dist/runtime/serialization/types/SerializedDate.js +1 -0
  209. package/dist/runtime/serialization/types/SerializedMap.d.ts +8 -0
  210. package/dist/runtime/serialization/types/SerializedMap.js +1 -0
  211. package/dist/runtime/serialization/types/SerializedObject.d.ts +4 -0
  212. package/dist/runtime/serialization/types/SerializedObject.js +1 -0
  213. package/dist/runtime/serialization/types/SerializedSet.d.ts +5 -0
  214. package/dist/runtime/serialization/types/SerializedSet.js +1 -0
  215. package/dist/runtime/serialization/types/TypedArray.d.ts +2 -0
  216. package/dist/runtime/serialization/types/TypedArray.js +1 -0
  217. package/dist/runtime/types/JitarHooks.d.ts +6 -0
  218. package/dist/runtime/types/JitarHooks.js +1 -0
  219. package/dist/runtime/types/ModuleImporter.d.ts +3 -0
  220. package/dist/runtime/types/ModuleImporter.js +1 -0
  221. package/dist/runtime/types/NextHandler.d.ts +2 -0
  222. package/dist/runtime/types/NextHandler.js +1 -0
  223. package/dist/runtime/utils/ModuleAnalyser.d.ts +7 -0
  224. package/dist/runtime/utils/ModuleAnalyser.js +34 -0
  225. package/dist/runtime/utils/ModuleLoader.d.ts +8 -0
  226. package/dist/runtime/utils/ModuleLoader.js +30 -0
  227. package/dist/runtime/utils/UrlRewriter.d.ts +4 -0
  228. package/dist/runtime/utils/UrlRewriter.js +36 -0
  229. package/package.json +7 -7
@@ -0,0 +1,3 @@
1
+ export default class InvalidClass extends Error {
2
+ constructor(name: string);
3
+ }
@@ -0,0 +1,6 @@
1
+ export default class InvalidClass extends Error {
2
+ constructor(name) {
3
+ super(`The class '${name}' is invalid`);
4
+ }
5
+ }
6
+ InvalidClass.source = '/jitar/runtime/serialization/errors/InvalidClass.js';
@@ -0,0 +1,4 @@
1
+ import BadRequest from '../../../core/errors/BadRequest.js';
2
+ export default class InvalidPropertyType extends BadRequest {
3
+ constructor(typeName: string, propertyName: string, expectedType: string);
4
+ }
@@ -0,0 +1,7 @@
1
+ import BadRequest from '../../../core/errors/BadRequest.js';
2
+ export default class InvalidPropertyType extends BadRequest {
3
+ constructor(typeName, propertyName, expectedType) {
4
+ super(`The ${typeName} property '${propertyName}' has an invalid type (expected '${expectedType}')`);
5
+ }
6
+ }
7
+ InvalidPropertyType.source = '/jitar/runtime/serialization/errors/InvalidPropertyType.js';
@@ -0,0 +1,4 @@
1
+ export default interface Serializer {
2
+ serialize(value: unknown): unknown;
3
+ deserialize(value: unknown): Promise<unknown>;
4
+ }
@@ -0,0 +1,3 @@
1
+ import FlexObject from '../../../core/types/FlexObject.js';
2
+ type SerializableObject = FlexObject;
3
+ export default SerializableObject;
@@ -0,0 +1,5 @@
1
+ type Serialized = {
2
+ serialized: boolean;
3
+ name: string;
4
+ };
5
+ export default Serialized;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import Serialized from './Serialized.js';
2
+ type SerializedArrayBuffer = Serialized & {
3
+ type: string;
4
+ bytes: number[];
5
+ };
6
+ export default SerializedArrayBuffer;
@@ -0,0 +1,8 @@
1
+ import FlexObject from '../../../core/types/FlexObject.js';
2
+ import Serialized from './Serialized.js';
3
+ type SerializedClass = Serialized & {
4
+ source: string | null;
5
+ args: unknown[];
6
+ fields: FlexObject;
7
+ };
8
+ export default SerializedClass;
@@ -0,0 +1,5 @@
1
+ import Serialized from './Serialized.js';
2
+ type SerializedDate = Serialized & {
3
+ value: string;
4
+ };
5
+ export default SerializedDate;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import Serialized from './Serialized.js';
2
+ type SerializedMap = Serialized & {
3
+ entries: {
4
+ keys: unknown[];
5
+ values: unknown[];
6
+ };
7
+ };
8
+ export default SerializedMap;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ type SerializedObject = {
2
+ [key: string]: unknown;
3
+ };
4
+ export default SerializedObject;
@@ -0,0 +1,5 @@
1
+ import Serialized from './Serialized.js';
2
+ type SerializedSet = Serialized & {
3
+ values: unknown[];
4
+ };
5
+ export default SerializedSet;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
2
+ export default TypedArray;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import Runtime from '../Runtime.js';
2
+ type JitarHooks = {
3
+ setRuntime: (runtime: Runtime) => void;
4
+ setDependencyLoader: (loader: Function) => void;
5
+ };
6
+ export default JitarHooks;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import Module from '../../core/types/Module.js';
2
+ type ModuleImporter = (name: string) => Promise<Module>;
3
+ export default ModuleImporter;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ type NextHandler = () => Promise<unknown>;
2
+ export default NextHandler;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import Module from '../../core/types/Module.js';
2
+ export default class ModuleAnalyser {
3
+ #private;
4
+ static filterObjects(module: Module): Map<string, Object>;
5
+ static filterFunctions(module: Module): Map<string, Function>;
6
+ static filterClasses(module: Module): Map<string, Function>;
7
+ }
@@ -0,0 +1,34 @@
1
+ export default class ModuleAnalyser {
2
+ static filterObjects(module) {
3
+ return this.#filterexported(module, Object);
4
+ }
5
+ static filterFunctions(module) {
6
+ const functions = this.#filterexported(module, Function);
7
+ return this.#filterFunctionTypes(functions, false);
8
+ }
9
+ static filterClasses(module) {
10
+ const functions = this.#filterexported(module, Function);
11
+ return this.#filterFunctionTypes(functions, true);
12
+ }
13
+ static #filterexported(module, type) {
14
+ const keys = Object.keys(module);
15
+ const filtered = new Map();
16
+ for (const key of keys) {
17
+ const exported = module[key];
18
+ if (exported instanceof type) {
19
+ filtered.set(key, exported);
20
+ }
21
+ }
22
+ return filtered;
23
+ }
24
+ static #filterFunctionTypes(functions, filterClasses) {
25
+ const filtered = new Map();
26
+ for (const [key, value] of functions) {
27
+ const code = value.toString();
28
+ if (code.startsWith('class') === filterClasses) {
29
+ filtered.set(key, value);
30
+ }
31
+ }
32
+ return filtered;
33
+ }
34
+ }
@@ -0,0 +1,8 @@
1
+ import Module from '../../core/types/Module.js';
2
+ import ModuleImporter from '../types/ModuleImporter.js';
3
+ export default class ModuleLoader {
4
+ static setBaseUrl(baseUrl: string): void;
5
+ static setImporter(importer: ModuleImporter): void;
6
+ static load(url: string): Promise<Module>;
7
+ static import(specifier: string): Promise<import("../../core/types/FlexObject.js").default>;
8
+ }
@@ -0,0 +1,30 @@
1
+ import ModuleNotLoaded from '../errors/ModuleNotLoaded.js';
2
+ import UrlRewriter from './UrlRewriter.js';
3
+ let _baseUrl;
4
+ let _import = async (name) => { return import(name); };
5
+ export default class ModuleLoader {
6
+ static setBaseUrl(baseUrl) {
7
+ _baseUrl = baseUrl;
8
+ }
9
+ static setImporter(importer) {
10
+ _import = importer;
11
+ }
12
+ static async load(url) {
13
+ if (url.startsWith('/jitar')) {
14
+ url = `../..${url}`;
15
+ }
16
+ if (_baseUrl !== undefined && url.startsWith(_baseUrl) === false) {
17
+ url = UrlRewriter.addBase(url, _baseUrl);
18
+ }
19
+ return this.import(url);
20
+ }
21
+ static async import(specifier) {
22
+ try {
23
+ return await _import(specifier);
24
+ }
25
+ catch (error) {
26
+ const message = error instanceof Error ? error.message : String(error);
27
+ throw new ModuleNotLoaded(specifier, message);
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,4 @@
1
+ export default class UrlRewriter {
2
+ #private;
3
+ static addBase(url: string, base: string): string;
4
+ }
@@ -0,0 +1,36 @@
1
+ export default class UrlRewriter {
2
+ static addBase(url, base) {
3
+ url = this.#ensureStartsWithoutSlash(url);
4
+ base = this.#assureEndWithSlash(base);
5
+ return this.#translateRelativeParts(`${base}${url}`);
6
+ }
7
+ static #ensureStartsWithoutSlash(url) {
8
+ if (url.startsWith('/')) {
9
+ return url.substring(1);
10
+ }
11
+ return url;
12
+ }
13
+ static #assureEndWithSlash(base) {
14
+ if (base.endsWith('/')) {
15
+ return base;
16
+ }
17
+ return `${base}/`;
18
+ }
19
+ static #translateRelativeParts(url) {
20
+ const parts = url.split('/');
21
+ const translated = [];
22
+ translated.push(parts[0]);
23
+ for (let index = 1; index < parts.length; index++) {
24
+ const part = parts[index].trim();
25
+ if (part === '.' || part === '') {
26
+ continue;
27
+ }
28
+ else if (part === '..') {
29
+ translated.pop();
30
+ continue;
31
+ }
32
+ translated.push(part);
33
+ }
34
+ return translated.join('/');
35
+ }
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitar",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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,13 +20,12 @@
20
20
  "clean": "rm -rf dist build",
21
21
  "release": "npm run clean && npm run build && npm publish"
22
22
  },
23
- "dependencies": {},
24
23
  "devDependencies": {
24
+ "@types/jest": "^29.4.0",
25
25
  "@typescript-eslint/eslint-plugin": "^5.51.0",
26
26
  "@typescript-eslint/parser": "^5.51.0",
27
- "@types/jest": "^29.4.0",
28
- "eslint": "^8.33.0",
29
- "jest": "^29.4.1",
27
+ "eslint": "^8.34.0",
28
+ "jest": "^29.4.2",
30
29
  "ts-jest": "^29.0.5"
31
30
  },
32
31
  "engines": {
@@ -49,5 +48,6 @@
49
48
  "monolith",
50
49
  "full stack",
51
50
  "web applications"
52
- ]
53
- }
51
+ ],
52
+ "gitHead": "26a6275ac9afbc971ca891f7dcae739a7f317cd4"
53
+ }