@modular-circuit/middleware 0.0.33 → 0.0.38

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.
@@ -1,3 +1,3 @@
1
- const Test_Module_A = import('./test_module_a.json');
2
- const Test_Module_B = import('./test_module_b.json');
1
+ var Test_Module_A = import('./test_module_a.json');
2
+ var Test_Module_B = import('./test_module_b.json');
3
3
  export { Test_Module_A, Test_Module_B };
@@ -1,2 +1,2 @@
1
- const Categories = import('./categories.json');
1
+ var Categories = import('./categories.json');
2
2
  export { Categories };
@@ -8,5 +8,7 @@ export declare class DefaultRegistryMgr implements RegistryMgr {
8
8
  get_available_registries(): Promise<ModuleResolver[]>;
9
9
  get_module_achieve(idx: ModuleIndex): Promise<URL | undefined>;
10
10
  get_module_circuit(idx: ModuleIndex): Promise<ModuleCircuit | undefined>;
11
+ get_module_circuit_by_id(id: string): Promise<ModuleCircuit | undefined>;
12
+ get_module_achieve_by_id(id: string): Promise<URL | undefined>;
11
13
  }
12
14
  //# sourceMappingURL=default_registry_mgr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default_registry_mgr.d.ts","sourceRoot":"","sources":["../../src/registry/default_registry_mgr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,iBAAiB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,UAAU,CAAuB;gBACtB,eAAe,EAAE,UAAU,EAAE;IAK1C,wBAAwB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAG3D,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAS9D,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CASzE"}
1
+ {"version":3,"file":"default_registry_mgr.d.ts","sourceRoot":"","sources":["../../src/registry/default_registry_mgr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,iBAAiB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,UAAU,CAAuB;gBACtB,eAAe,EAAE,UAAU,EAAE;IAK1C,wBAAwB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAG3D,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAS9D,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IASxE,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAUxE,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;CAS/D"}
@@ -1,24 +1,160 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __values = (this && this.__values) || function(o) {
38
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
+ if (m) return m.call(o);
40
+ if (o && typeof o.length === "number") return {
41
+ next: function () {
42
+ if (o && i >= o.length) o = void 0;
43
+ return { value: o && o[i++], done: !o };
44
+ }
45
+ };
46
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
+ };
1
48
  import { HttpRegistry } from './http_registry';
2
- export class DefaultRegistryMgr {
3
- registries = [];
4
- constructor(http_registries) {
5
- for (const cnf of http_registries) {
6
- this.registries.push(new HttpRegistry(cnf));
49
+ var DefaultRegistryMgr = /** @class */ (function () {
50
+ function DefaultRegistryMgr(http_registries) {
51
+ var e_1, _a;
52
+ this.registries = [];
53
+ try {
54
+ for (var http_registries_1 = __values(http_registries), http_registries_1_1 = http_registries_1.next(); !http_registries_1_1.done; http_registries_1_1 = http_registries_1.next()) {
55
+ var cnf = http_registries_1_1.value;
56
+ this.registries.push(new HttpRegistry(cnf));
57
+ }
58
+ }
59
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
60
+ finally {
61
+ try {
62
+ if (http_registries_1_1 && !http_registries_1_1.done && (_a = http_registries_1.return)) _a.call(http_registries_1);
63
+ }
64
+ finally { if (e_1) throw e_1.error; }
7
65
  }
8
66
  }
9
- async get_available_registries() {
10
- return this.registries;
11
- }
12
- get_module_achieve(idx) {
13
- return this.registries.reduce(async (prev, registry) => {
14
- const res = await registry.get_module_achieve(idx);
15
- return res ? res : await prev;
16
- }, Promise.resolve(undefined));
17
- }
18
- get_module_circuit(idx) {
19
- return this.registries.reduce(async (prev, registry) => {
20
- const res = await registry.get_module_circuit(idx);
21
- return res ? res : await prev;
22
- }, Promise.resolve(undefined));
23
- }
24
- }
67
+ DefaultRegistryMgr.prototype.get_available_registries = function () {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, this.registries];
71
+ });
72
+ });
73
+ };
74
+ DefaultRegistryMgr.prototype.get_module_achieve = function (idx) {
75
+ var _this = this;
76
+ return this.registries.reduce(function (prev, registry) { return __awaiter(_this, void 0, void 0, function () {
77
+ var res, _a;
78
+ return __generator(this, function (_b) {
79
+ switch (_b.label) {
80
+ case 0: return [4 /*yield*/, registry.get_module_achieve(idx)];
81
+ case 1:
82
+ res = _b.sent();
83
+ if (!res) return [3 /*break*/, 2];
84
+ _a = res;
85
+ return [3 /*break*/, 4];
86
+ case 2: return [4 /*yield*/, prev];
87
+ case 3:
88
+ _a = _b.sent();
89
+ _b.label = 4;
90
+ case 4: return [2 /*return*/, _a];
91
+ }
92
+ });
93
+ }); }, Promise.resolve(undefined));
94
+ };
95
+ DefaultRegistryMgr.prototype.get_module_circuit = function (idx) {
96
+ var _this = this;
97
+ return this.registries.reduce(function (prev, registry) { return __awaiter(_this, void 0, void 0, function () {
98
+ var res, _a;
99
+ return __generator(this, function (_b) {
100
+ switch (_b.label) {
101
+ case 0: return [4 /*yield*/, registry.get_module_circuit(idx)];
102
+ case 1:
103
+ res = _b.sent();
104
+ if (!res) return [3 /*break*/, 2];
105
+ _a = res;
106
+ return [3 /*break*/, 4];
107
+ case 2: return [4 /*yield*/, prev];
108
+ case 3:
109
+ _a = _b.sent();
110
+ _b.label = 4;
111
+ case 4: return [2 /*return*/, _a];
112
+ }
113
+ });
114
+ }); }, Promise.resolve(undefined));
115
+ };
116
+ DefaultRegistryMgr.prototype.get_module_circuit_by_id = function (id) {
117
+ var _this = this;
118
+ return this.registries.reduce(function (prev, registry) { return __awaiter(_this, void 0, void 0, function () {
119
+ var res, _a;
120
+ return __generator(this, function (_b) {
121
+ switch (_b.label) {
122
+ case 0: return [4 /*yield*/, registry.get_module_circuit_by_id(id)];
123
+ case 1:
124
+ res = _b.sent();
125
+ if (!res) return [3 /*break*/, 2];
126
+ _a = res;
127
+ return [3 /*break*/, 4];
128
+ case 2: return [4 /*yield*/, prev];
129
+ case 3:
130
+ _a = _b.sent();
131
+ _b.label = 4;
132
+ case 4: return [2 /*return*/, _a];
133
+ }
134
+ });
135
+ }); }, Promise.resolve(undefined));
136
+ };
137
+ DefaultRegistryMgr.prototype.get_module_achieve_by_id = function (id) {
138
+ var _this = this;
139
+ return this.registries.reduce(function (prev, registry) { return __awaiter(_this, void 0, void 0, function () {
140
+ var res, _a;
141
+ return __generator(this, function (_b) {
142
+ switch (_b.label) {
143
+ case 0: return [4 /*yield*/, registry.get_module_achieve_by_id(id)];
144
+ case 1:
145
+ res = _b.sent();
146
+ if (!res) return [3 /*break*/, 2];
147
+ _a = res;
148
+ return [3 /*break*/, 4];
149
+ case 2: return [4 /*yield*/, prev];
150
+ case 3:
151
+ _a = _b.sent();
152
+ _b.label = 4;
153
+ case 4: return [2 /*return*/, _a];
154
+ }
155
+ });
156
+ }); }, Promise.resolve(undefined));
157
+ };
158
+ return DefaultRegistryMgr;
159
+ }());
160
+ export { DefaultRegistryMgr };
@@ -1,4 +1,4 @@
1
- import type { ModuleCircuit, ModuleResolver } from '@modular-circuit/ir';
1
+ import type { ModuleCircuit, ModuleResolver, RuntimeModuleCircuit } from '@modular-circuit/ir';
2
2
  import type { ModuleIndex } from '@modular-circuit/ir';
3
3
  export interface HttpResponse {
4
4
  code: number;
@@ -9,6 +9,7 @@ export interface HttpConfig {
9
9
  module_achieve_url: URL;
10
10
  module_circuit_url: URL;
11
11
  zip_origin?: string;
12
+ all_modules?: RuntimeModuleCircuit[];
12
13
  }
13
14
  export declare class HttpRegistry implements ModuleResolver {
14
15
  private cnf;
@@ -17,5 +18,7 @@ export declare class HttpRegistry implements ModuleResolver {
17
18
  constructor(cnf: HttpConfig);
18
19
  get_module_achieve(idx: ModuleIndex): Promise<URL | undefined>;
19
20
  get_module_circuit(idx: ModuleIndex): Promise<ModuleCircuit | undefined>;
21
+ get_module_circuit_by_id(id: string): Promise<ModuleCircuit | undefined>;
22
+ get_module_achieve_by_id(id: string): Promise<URL | undefined>;
20
23
  }
21
24
  //# sourceMappingURL=http_registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http_registry.d.ts","sourceRoot":"","sources":["../../src/registry/http_registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAItD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,kBAAkB,EAAE,GAAG,CAAA;IACvB,kBAAkB,EAAE,GAAG,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AACD,qBAAa,YAAa,YAAW,cAAc;IAG9B,OAAO,CAAC,GAAG;IAF9B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,aAAa,CAAoC;gBAC9B,GAAG,EAAE,UAAU;IAGpC,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAO9D,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAQ/E"}
1
+ {"version":3,"file":"http_registry.d.ts","sourceRoot":"","sources":["../../src/registry/http_registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAItD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,kBAAkB,EAAE,GAAG,CAAA;IACvB,kBAAkB,EAAE,GAAG,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAA;CACrC;AACD,qBAAa,YAAa,YAAW,cAAc;IAG9B,OAAO,CAAC,GAAG;IAF9B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,aAAa,CAA2C;gBACrC,GAAG,EAAE,UAAU;IAMpC,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAO9D,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAKxE,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAIxE,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;CAKrE"}
@@ -1,26 +1,124 @@
1
- import { stringify_dependency } from '@modular-circuit/utils';
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __values = (this && this.__values) || function(o) {
38
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
+ if (m) return m.call(o);
40
+ if (o && typeof o.length === "number") return {
41
+ next: function () {
42
+ if (o && i >= o.length) o = void 0;
43
+ return { value: o && o[i++], done: !o };
44
+ }
45
+ };
46
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
+ };
2
48
  import { do_fetch } from '../utils';
3
- export class HttpRegistry {
4
- cnf;
5
- zip_origin;
6
- module_caches = {};
7
- constructor(cnf) {
49
+ var HttpRegistry = /** @class */ (function () {
50
+ function HttpRegistry(cnf) {
51
+ var e_1, _a;
52
+ var _b, _c;
8
53
  this.cnf = cnf;
9
- this.zip_origin = cnf.zip_origin ?? cnf.module_achieve_url.origin;
10
- }
11
- async get_module_achieve(idx) {
12
- const it = await do_fetch(this.cnf.module_achieve_url, idx);
13
- const pp = (await it.json()).result;
14
- if (!pp)
15
- return;
16
- const full = `${this.zip_origin}${pp}`;
17
- return new URL(full);
18
- }
19
- async get_module_circuit(idx) {
20
- const module_idx = stringify_dependency(idx);
21
- if (module_idx in this.module_caches)
22
- return this.module_caches[module_idx];
23
- const it = await do_fetch(this.cnf.module_circuit_url, idx);
24
- return (await it.json()).result;
54
+ this.module_caches = {};
55
+ this.zip_origin = (_b = cnf.zip_origin) !== null && _b !== void 0 ? _b : cnf.module_achieve_url.origin;
56
+ try {
57
+ for (var _d = __values((_c = cnf.all_modules) !== null && _c !== void 0 ? _c : []), _e = _d.next(); !_e.done; _e = _d.next()) {
58
+ var module_circuit = _e.value;
59
+ this.module_caches[module_circuit.id] = module_circuit;
60
+ }
61
+ }
62
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
63
+ finally {
64
+ try {
65
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
66
+ }
67
+ finally { if (e_1) throw e_1.error; }
68
+ }
25
69
  }
26
- }
70
+ HttpRegistry.prototype.get_module_achieve = function (idx) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var it, pp, full;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0: return [4 /*yield*/, do_fetch(this.cnf.module_achieve_url, idx)];
76
+ case 1:
77
+ it = _a.sent();
78
+ return [4 /*yield*/, it.json()];
79
+ case 2:
80
+ pp = (_a.sent()).result;
81
+ if (!pp)
82
+ return [2 /*return*/];
83
+ full = "".concat(this.zip_origin).concat(pp);
84
+ return [2 /*return*/, new URL(full)];
85
+ }
86
+ });
87
+ });
88
+ };
89
+ HttpRegistry.prototype.get_module_circuit = function (idx) {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var it;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, do_fetch(this.cnf.module_circuit_url, idx)];
95
+ case 1:
96
+ it = _a.sent();
97
+ return [4 /*yield*/, it.json()];
98
+ case 2: return [2 /*return*/, (_a.sent()).result];
99
+ }
100
+ });
101
+ });
102
+ };
103
+ HttpRegistry.prototype.get_module_circuit_by_id = function (id) {
104
+ return __awaiter(this, void 0, void 0, function () {
105
+ return __generator(this, function (_a) {
106
+ return [2 /*return*/, this.module_caches[id]];
107
+ });
108
+ });
109
+ };
110
+ HttpRegistry.prototype.get_module_achieve_by_id = function (id) {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ var path;
113
+ var _a;
114
+ return __generator(this, function (_b) {
115
+ path = (_a = this.module_caches[id]) === null || _a === void 0 ? void 0 : _a.file_zip;
116
+ if (!path)
117
+ return [2 /*return*/];
118
+ return [2 /*return*/, new URL(!path.startsWith('/') ? "".concat(this.zip_origin, "/").concat(path) : "".concat(this.zip_origin).concat(path))];
119
+ });
120
+ });
121
+ };
122
+ return HttpRegistry;
123
+ }());
124
+ export { HttpRegistry };
@@ -1,8 +1,27 @@
1
- export const fmt_parameter_to_url = (params) => {
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
17
+ export var fmt_parameter_to_url = function (params) {
2
18
  return Object.entries(params)
3
- .map(([k, v]) => `${k}=${v}`)
19
+ .map(function (_a) {
20
+ var _b = __read(_a, 2), k = _b[0], v = _b[1];
21
+ return "".concat(k, "=").concat(v);
22
+ })
4
23
  .join('&');
5
24
  };
6
25
  export function do_fetch(url, params) {
7
- return fetch(`${url}?${fmt_parameter_to_url(params)}`);
26
+ return fetch("".concat(url, "?").concat(fmt_parameter_to_url(params)));
8
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/middleware",
3
- "version": "0.0.33",
3
+ "version": "0.0.38",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
@@ -24,8 +24,8 @@
24
24
  "typescript": "^5.4.5"
25
25
  },
26
26
  "dependencies": {
27
- "@modular-circuit/ir": "0.0.59",
28
- "@modular-circuit/utils": "0.0.38"
27
+ "@modular-circuit/ir": "0.0.62",
28
+ "@modular-circuit/utils": "0.0.40"
29
29
  },
30
30
  "scripts": {
31
31
  "clean": "rimraf build",