@adimm/x-injection 0.4.0 → 0.5.0
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/dist/index.cjs +175 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -85
- package/dist/index.d.ts +117 -85
- package/dist/index.js +166 -132
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var e = Object.defineProperty, i = (i, t) => e(i, "name", {
|
|
|
5
5
|
|
|
6
6
|
import { injectable as n } from "inversify";
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var r, o, s = function(e) {
|
|
9
9
|
return e[e.Singleton = 0] = "Singleton", e[e.Transient = 1] = "Transient", e[e.Request = 2] = "Request",
|
|
10
10
|
e;
|
|
11
11
|
}({});
|
|
@@ -41,75 +41,94 @@ i(d, "injectionScopeToBindingScope"), i(c, "bindingScopeToInjectionScope");
|
|
|
41
41
|
import { getClassMetadata as a } from "@inversifyjs/core";
|
|
42
42
|
|
|
43
43
|
function u(e) {
|
|
44
|
-
return "function" == typeof e &&
|
|
44
|
+
return "function" == typeof e && Function.prototype.toString.call(e).startsWith("class ");
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function h(e) {
|
|
48
|
-
return "
|
|
48
|
+
return "function" == typeof e;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function p(e) {
|
|
52
|
+
return "function" == typeof e && !Function.prototype.toString.call(e).startsWith("class ");
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
function f(e) {
|
|
52
|
-
|
|
53
|
-
const i = e.constructor;
|
|
54
|
-
if (void 0 === i) return !0;
|
|
55
|
-
const t = i.prototype;
|
|
56
|
-
return !1 !== h(t) && !1 !== t.hasOwnProperty("isPrototypeOf");
|
|
56
|
+
return "[object Object]" === Object.prototype.toString.call(e);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function l(e) {
|
|
60
|
-
|
|
60
|
+
if (!1 === f(e)) return !1;
|
|
61
|
+
const i = e.constructor;
|
|
62
|
+
if (void 0 === i) return !0;
|
|
63
|
+
const t = i.prototype;
|
|
64
|
+
return !1 !== f(t) && !1 !== t.hasOwnProperty("isPrototypeOf");
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
function
|
|
67
|
+
function v(e) {
|
|
64
68
|
return void 0 === e ? n() : n(d(e));
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
i(u, "isClass"), i(h, "
|
|
71
|
+
i(u, "isClass"), i(h, "isClassOrFunction"), i(p, "isFunction"), i(f, "isObject"),
|
|
72
|
+
i(l, "isPlainObject"), function(e) {
|
|
68
73
|
function t(e) {
|
|
69
|
-
return
|
|
74
|
+
return y(e) && "useClass" in e;
|
|
70
75
|
}
|
|
71
76
|
function n(e) {
|
|
72
|
-
return
|
|
73
|
-
}
|
|
74
|
-
function o(e) {
|
|
75
|
-
return v(e) && "useFactory" in e;
|
|
77
|
+
return y(e) && "useValue" in e;
|
|
76
78
|
}
|
|
77
79
|
function r(e) {
|
|
78
|
-
return
|
|
80
|
+
return y(e) && "useFactory" in e;
|
|
81
|
+
}
|
|
82
|
+
function o(e) {
|
|
83
|
+
return "string" == typeof e || "symbol" == typeof e || h(e);
|
|
79
84
|
}
|
|
80
85
|
function s(e) {
|
|
81
|
-
return
|
|
86
|
+
return o(e) ? e : e.provide;
|
|
82
87
|
}
|
|
83
88
|
function d(e) {
|
|
84
89
|
return e.map((e => s(e)));
|
|
85
90
|
}
|
|
86
|
-
function
|
|
87
|
-
return
|
|
91
|
+
function f(e, i) {
|
|
92
|
+
return u(e) ? {
|
|
93
|
+
...i,
|
|
94
|
+
provide: i?.provide ?? e,
|
|
95
|
+
useClass: i?.useClass ?? e
|
|
96
|
+
} : p(e) ? {
|
|
97
|
+
...i,
|
|
98
|
+
provide: i?.provide ?? e,
|
|
99
|
+
useFactory: i?.useFactory ?? e
|
|
100
|
+
} : {
|
|
101
|
+
...e,
|
|
102
|
+
...i
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function v(e, i) {
|
|
106
|
+
return m(e) ?? S(e) ?? i;
|
|
88
107
|
}
|
|
89
|
-
function
|
|
90
|
-
if (
|
|
108
|
+
function g(e) {
|
|
109
|
+
if (y(e)) return e;
|
|
91
110
|
}
|
|
92
|
-
function
|
|
93
|
-
const i =
|
|
111
|
+
function m(e) {
|
|
112
|
+
const i = g(e);
|
|
94
113
|
if (i) return i.scope;
|
|
95
114
|
}
|
|
96
|
-
function
|
|
115
|
+
function S(e) {
|
|
97
116
|
const i = s(e);
|
|
98
117
|
if (!u(i)) return;
|
|
99
118
|
const t = a(i)?.scope;
|
|
100
119
|
return t ? c(t) : void 0;
|
|
101
120
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
121
|
+
function y(e) {
|
|
122
|
+
return l(e) && "object" == typeof e && "provide" in e;
|
|
104
123
|
}
|
|
105
124
|
i(t, "isClassToken"), e.isClassToken = t, i(n, "isValueToken"), e.isValueToken = n,
|
|
106
|
-
i(
|
|
125
|
+
i(r, "isFactoryToken"), e.isFactoryToken = r, i(o, "isProviderIdentifier"), e.isProviderIdentifier = o,
|
|
107
126
|
i(s, "toServiceIdentifier"), e.toServiceIdentifier = s, i(d, "toServiceIdentifiers"),
|
|
108
|
-
e.toServiceIdentifiers = d, i(
|
|
109
|
-
i(
|
|
110
|
-
e.
|
|
111
|
-
i(
|
|
112
|
-
}(
|
|
127
|
+
e.toServiceIdentifiers = d, i(f, "toDependencyProviderWithOptions"), e.toDependencyProviderWithOptions = f,
|
|
128
|
+
i(v, "getInjectionScopeByPriority"), e.getInjectionScopeByPriority = v, i(g, "tryGetProviderOptions"),
|
|
129
|
+
e.tryGetProviderOptions = g, i(m, "tryGetScopeFromProvider"), e.tryGetScopeFromProvider = m,
|
|
130
|
+
i(S, "tryGetDecoratorScopeFromClass"), e.tryGetDecoratorScopeFromClass = S, i(y, "hasProvideProperty");
|
|
131
|
+
}(r || (r = {})), function(e) {
|
|
113
132
|
function t(e) {
|
|
114
133
|
return e;
|
|
115
134
|
}
|
|
@@ -118,86 +137,86 @@ i(u, "isClass"), i(h, "isObject"), i(f, "isPlainObject"), function(e) {
|
|
|
118
137
|
}
|
|
119
138
|
i(t, "buildInternalConstructorParams"), e.buildInternalConstructorParams = t, i(n, "isDynamicExport"),
|
|
120
139
|
e.isDynamicExport = n;
|
|
121
|
-
}(
|
|
140
|
+
}(o || (o = {})), i(v, "Injectable");
|
|
122
141
|
|
|
123
142
|
import { inject as g } from "inversify";
|
|
124
143
|
|
|
125
|
-
function
|
|
126
|
-
return g(
|
|
144
|
+
function m(e) {
|
|
145
|
+
return g(r.toServiceIdentifier(e));
|
|
127
146
|
}
|
|
128
147
|
|
|
129
|
-
i(
|
|
148
|
+
i(m, "Inject");
|
|
130
149
|
|
|
131
150
|
import { multiInject as S } from "inversify";
|
|
132
151
|
|
|
133
152
|
function y(e) {
|
|
134
|
-
return S(
|
|
153
|
+
return S(r.toServiceIdentifier(e));
|
|
135
154
|
}
|
|
136
155
|
|
|
137
156
|
i(y, "MultiInject");
|
|
138
157
|
|
|
139
|
-
import { injectFromBase as
|
|
158
|
+
import { injectFromBase as I } from "inversify";
|
|
140
159
|
|
|
141
|
-
function
|
|
142
|
-
return
|
|
160
|
+
function E(e) {
|
|
161
|
+
return I(e);
|
|
143
162
|
}
|
|
144
163
|
|
|
145
|
-
i(
|
|
164
|
+
i(E, "InjectFromBase");
|
|
146
165
|
|
|
147
166
|
import { named as b } from "inversify";
|
|
148
167
|
|
|
149
|
-
function
|
|
168
|
+
function T(e) {
|
|
150
169
|
return b(e);
|
|
151
170
|
}
|
|
152
171
|
|
|
153
|
-
i(
|
|
172
|
+
i(T, "Named");
|
|
154
173
|
|
|
155
|
-
import { optional as
|
|
174
|
+
import { optional as _ } from "inversify";
|
|
156
175
|
|
|
157
|
-
function
|
|
158
|
-
return
|
|
176
|
+
function w() {
|
|
177
|
+
return _();
|
|
159
178
|
}
|
|
160
179
|
|
|
161
|
-
i(
|
|
180
|
+
i(w, "Optional");
|
|
162
181
|
|
|
163
182
|
import { postConstruct as B } from "inversify";
|
|
164
183
|
|
|
165
|
-
function
|
|
184
|
+
function D() {
|
|
166
185
|
return B();
|
|
167
186
|
}
|
|
168
187
|
|
|
169
|
-
i(
|
|
188
|
+
i(D, "PostConstruct");
|
|
170
189
|
|
|
171
|
-
import { preDestroy as
|
|
190
|
+
import { preDestroy as P } from "inversify";
|
|
172
191
|
|
|
173
|
-
function
|
|
174
|
-
return
|
|
192
|
+
function M() {
|
|
193
|
+
return P();
|
|
175
194
|
}
|
|
176
195
|
|
|
177
|
-
i(
|
|
196
|
+
i(M, "PreDestroy");
|
|
178
197
|
|
|
179
|
-
import { tagged as
|
|
198
|
+
import { tagged as C } from "inversify";
|
|
180
199
|
|
|
181
|
-
function
|
|
182
|
-
return
|
|
200
|
+
function k(e, i) {
|
|
201
|
+
return C(e, i);
|
|
183
202
|
}
|
|
184
203
|
|
|
185
|
-
i(
|
|
204
|
+
i(k, "Tagged");
|
|
186
205
|
|
|
187
|
-
import { unmanaged as
|
|
206
|
+
import { unmanaged as x } from "inversify";
|
|
188
207
|
|
|
189
208
|
function j() {
|
|
190
|
-
return
|
|
209
|
+
return x();
|
|
191
210
|
}
|
|
192
211
|
|
|
193
212
|
i(j, "Unmanaged");
|
|
194
213
|
|
|
195
|
-
var
|
|
214
|
+
var A = class e extends Error {
|
|
196
215
|
static {
|
|
197
216
|
i(this, "XInjectionError");
|
|
198
217
|
}
|
|
199
218
|
name=e.name;
|
|
200
|
-
},
|
|
219
|
+
}, R = class e extends Error {
|
|
201
220
|
static {
|
|
202
221
|
i(this, "XInjectionProviderModuleError");
|
|
203
222
|
}
|
|
@@ -205,7 +224,7 @@ var x = class e extends Error {
|
|
|
205
224
|
constructor(e, i) {
|
|
206
225
|
super(`{ProviderModule.${e.toString()}} => ${i}`);
|
|
207
226
|
}
|
|
208
|
-
},
|
|
227
|
+
}, F = class e extends R {
|
|
209
228
|
static {
|
|
210
229
|
i(this, "XInjectionProviderModuleDisposedError");
|
|
211
230
|
}
|
|
@@ -213,7 +232,7 @@ var x = class e extends Error {
|
|
|
213
232
|
constructor(e) {
|
|
214
233
|
super(e, "Has been disposed! You can re-initialize it by using the `_lazyInit` method.");
|
|
215
234
|
}
|
|
216
|
-
},
|
|
235
|
+
}, O = class e extends R {
|
|
217
236
|
static {
|
|
218
237
|
i(this, "XInjectionDynamicExportsOutOfRange");
|
|
219
238
|
}
|
|
@@ -221,7 +240,7 @@ var x = class e extends Error {
|
|
|
221
240
|
constructor(e) {
|
|
222
241
|
super(e, `The 'ProviderModule.${e.toString()}' is trying to dynamically export providers/modules out of the declared range of the static exports!`);
|
|
223
242
|
}
|
|
224
|
-
},
|
|
243
|
+
}, N = class e extends R {
|
|
225
244
|
static {
|
|
226
245
|
i(this, "XInjectionProviderModuleMissingIdentifierError");
|
|
227
246
|
}
|
|
@@ -231,15 +250,15 @@ var x = class e extends Error {
|
|
|
231
250
|
}
|
|
232
251
|
};
|
|
233
252
|
|
|
234
|
-
import { Container as
|
|
253
|
+
import { Container as U } from "inversify";
|
|
235
254
|
|
|
236
|
-
var
|
|
255
|
+
var G = new U({
|
|
237
256
|
defaultScope: "Singleton"
|
|
238
257
|
});
|
|
239
258
|
|
|
240
|
-
import { Container as
|
|
259
|
+
import { Container as V } from "inversify";
|
|
241
260
|
|
|
242
|
-
var
|
|
261
|
+
var W = class {
|
|
243
262
|
static {
|
|
244
263
|
i(this, "ProviderModuleUtils");
|
|
245
264
|
}
|
|
@@ -252,30 +271,27 @@ var V = class {
|
|
|
252
271
|
this.module = e, this.moduleNaked = e.toNaked();
|
|
253
272
|
}
|
|
254
273
|
bindToContainer(e, i) {
|
|
255
|
-
return
|
|
256
|
-
}
|
|
257
|
-
bindManyToContainer(e, i) {
|
|
258
|
-
e.forEach((e => this.bindToContainer(e, i)));
|
|
274
|
+
return r.isProviderIdentifier(e) ? this.bindSelfTokenToContainer(e, i) : r.isClassToken(e) ? this.bindClassTokenToContainer(e, i) : r.isValueToken(e) ? this.bindValueTokenToContainer(e) : !!r.isFactoryToken(e) && this.bindFactoryTokenToContainer(e, i);
|
|
259
275
|
}
|
|
260
276
|
bindSelfTokenToContainer(e, i) {
|
|
261
|
-
return this.setBindingScope(e, this.container.bind(
|
|
277
|
+
return this.setBindingScope(e, this.container.bind(r.toServiceIdentifier(e)).toSelf(), i),
|
|
262
278
|
this.moduleNaked.__isCurrentBound(e);
|
|
263
279
|
}
|
|
264
280
|
bindClassTokenToContainer(e, i) {
|
|
265
|
-
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(
|
|
281
|
+
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(r.toServiceIdentifier(e)).to(e.useClass), i))),
|
|
266
282
|
this.moduleNaked.__isCurrentBound(e);
|
|
267
283
|
}
|
|
268
284
|
bindValueTokenToContainer(e) {
|
|
269
|
-
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.container.bind(
|
|
285
|
+
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.container.bind(r.toServiceIdentifier(e)).toConstantValue(e.useValue))),
|
|
270
286
|
this.moduleNaked.__isCurrentBound(e);
|
|
271
287
|
}
|
|
272
288
|
bindFactoryTokenToContainer(e, i) {
|
|
273
|
-
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(
|
|
289
|
+
return this.setBindingOnEvent(e, this.setWhenBinding(e, this.setBindingScope(e, this.container.bind(r.toServiceIdentifier(e)).toResolvedValue(e.useFactory, r.toServiceIdentifiers(e.inject ?? [])), i))),
|
|
274
290
|
this.moduleNaked.__isCurrentBound(e);
|
|
275
291
|
}
|
|
276
292
|
setBindingScope(e, i, t) {
|
|
277
|
-
if (
|
|
278
|
-
switch (
|
|
293
|
+
if (r.isValueToken(e)) return i;
|
|
294
|
+
switch (r.getInjectionScopeByPriority(e, t)) {
|
|
279
295
|
case s.Singleton:
|
|
280
296
|
return i.inSingletonScope();
|
|
281
297
|
|
|
@@ -287,12 +303,12 @@ var V = class {
|
|
|
287
303
|
}
|
|
288
304
|
}
|
|
289
305
|
setWhenBinding(e, i) {
|
|
290
|
-
if (
|
|
306
|
+
if (r.isProviderIdentifier(e)) return i;
|
|
291
307
|
const t = e.when;
|
|
292
308
|
return t ? i.when(t) : i;
|
|
293
309
|
}
|
|
294
310
|
setBindingOnEvent(e, i) {
|
|
295
|
-
if (
|
|
311
|
+
if (r.isProviderIdentifier(e)) return;
|
|
296
312
|
const t = e;
|
|
297
313
|
t.onEvent?.activation && i.onActivation(t.onEvent.activation), t.onEvent?.deactivation && i.onDeactivation(t.onEvent.deactivation);
|
|
298
314
|
}
|
|
@@ -308,20 +324,22 @@ var V = class {
|
|
|
308
324
|
dynamicExports;
|
|
309
325
|
onReady;
|
|
310
326
|
onDispose;
|
|
327
|
+
importedProvidersMap;
|
|
311
328
|
moduleUtils;
|
|
329
|
+
imports;
|
|
312
330
|
providers;
|
|
331
|
+
importedProviders;
|
|
313
332
|
exports;
|
|
314
|
-
imports;
|
|
315
333
|
registeredBindingSideEffects;
|
|
316
|
-
constructor({identifier: e, imports: i, providers: t, exports: n, defaultScope:
|
|
334
|
+
constructor({identifier: e, imports: i, providers: t, exports: n, defaultScope: r, dynamicExports: o, onReady: s, onDispose: d, ...c}) {
|
|
317
335
|
const a = c;
|
|
318
|
-
this.identifier = this.setIdentifier(e), this.isAppModule = a.isAppModule ?? !1,
|
|
336
|
+
this.identifier = this.setIdentifier(e), this.isDisposed = a.isDisposed ?? !1, this.isAppModule = a.isAppModule ?? !1,
|
|
319
337
|
this.isAppModule || this._lazyInit({
|
|
320
338
|
imports: i,
|
|
321
339
|
providers: t,
|
|
322
340
|
exports: n,
|
|
323
|
-
defaultScope:
|
|
324
|
-
dynamicExports:
|
|
341
|
+
defaultScope: r,
|
|
342
|
+
dynamicExports: o,
|
|
325
343
|
onReady: s,
|
|
326
344
|
onDispose: d,
|
|
327
345
|
...c
|
|
@@ -334,54 +352,71 @@ var V = class {
|
|
|
334
352
|
}
|
|
335
353
|
getMany(...e) {
|
|
336
354
|
return e.map((e => {
|
|
337
|
-
const i =
|
|
355
|
+
const i = l(e) && "provider" in e;
|
|
338
356
|
return this.get(i ? e.provider : e, !!i && e.isOptional);
|
|
339
357
|
}));
|
|
340
358
|
}
|
|
341
359
|
onActivationEvent(e, i) {
|
|
342
|
-
this.container.onActivation(
|
|
360
|
+
this.shouldThrowIfDisposed(), this.container.onActivation(r.toServiceIdentifier(e), i);
|
|
343
361
|
}
|
|
344
362
|
onDeactivationEvent(e, i) {
|
|
345
|
-
this.container.onDeactivation(
|
|
363
|
+
this.shouldThrowIfDisposed(), this.container.onDeactivation(r.toServiceIdentifier(e), i);
|
|
346
364
|
}
|
|
347
365
|
toNaked() {
|
|
348
366
|
return this;
|
|
349
367
|
}
|
|
368
|
+
clone(i) {
|
|
369
|
+
let t = [ ...this.providers ];
|
|
370
|
+
return i?.providersMap && (t = t.map((e => i.providersMap(e, this, !1)))), new e(o.buildInternalConstructorParams({
|
|
371
|
+
isAppModule: this.isAppModule,
|
|
372
|
+
identifier: this.identifier,
|
|
373
|
+
isDisposed: this.isDisposed,
|
|
374
|
+
defaultScope: this.defaultScope.native,
|
|
375
|
+
dynamicExports: this.dynamicExports,
|
|
376
|
+
onReady: this.onReady,
|
|
377
|
+
onDispose: this.onDispose,
|
|
378
|
+
importedProvidersMap: i?.importedProvidersMap,
|
|
379
|
+
imports: [ ...this.imports ],
|
|
380
|
+
providers: t,
|
|
381
|
+
exports: [ ...this.exports ]
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
350
384
|
toString() {
|
|
351
385
|
return this.identifier?.description ?? "Unknown";
|
|
352
386
|
}
|
|
353
387
|
setIdentifier(e) {
|
|
354
|
-
if (!e) throw new
|
|
388
|
+
if (!e) throw new N(this);
|
|
355
389
|
return e;
|
|
356
390
|
}
|
|
357
391
|
prepareContainer(e) {
|
|
358
|
-
return this.isAppModule ? e.container?.() ??
|
|
359
|
-
e.container()) : new
|
|
360
|
-
parent:
|
|
392
|
+
return this.isAppModule ? e.container?.() ?? G : e.container ? (console.warn(`[xInjection]: The '${this.toString()}' module is using a dynamic container!`),
|
|
393
|
+
e.container()) : new V({
|
|
394
|
+
parent: G,
|
|
361
395
|
defaultScope: this.defaultScope.inversify
|
|
362
396
|
});
|
|
363
397
|
}
|
|
364
398
|
injectImportedModules(t) {
|
|
365
399
|
t && 0 !== t.length && t.forEach((t => {
|
|
366
|
-
if ("GlobalAppModule" === t.toString()) throw new
|
|
367
|
-
const n = t._getExportableModulesAndProviders(),
|
|
368
|
-
void 0 !==
|
|
369
|
-
(
|
|
400
|
+
if ("GlobalAppModule" === t.toString()) throw new R(this, "The 'GlobalAppModule' can't be imported!");
|
|
401
|
+
const n = t._getExportableModulesAndProviders(), o = t.dynamicExports?.(this, n);
|
|
402
|
+
void 0 !== o && this.shouldThrowWhenModuleDynamicExportsDontMatchTheStaticExports(t, n, o),
|
|
403
|
+
(o ?? n).forEach((n => {
|
|
370
404
|
if (n instanceof e) {
|
|
371
405
|
const e = n.toNaked();
|
|
372
406
|
return void this.injectImportedModules([ e ]);
|
|
373
407
|
}
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
408
|
+
const o = n, s = this.importedProvidersMap({
|
|
409
|
+
scope: r.getInjectionScopeByPriority(o, t.defaultScope.native),
|
|
410
|
+
provide: r.toServiceIdentifier(o),
|
|
411
|
+
useFactory: i((() => t.get(o)), "useFactory")
|
|
412
|
+
}, o, t);
|
|
413
|
+
this.importedProviders.set(t, [ ...this.importedProviders.get(t) ?? [], s ]), this.moduleUtils.bindToContainer(s, t.defaultScope.native),
|
|
414
|
+
t._onUnbind(o, (() => this.__unbind(s)));
|
|
380
415
|
}));
|
|
381
416
|
}));
|
|
382
417
|
}
|
|
383
418
|
injectProviders() {
|
|
384
|
-
this.
|
|
419
|
+
this.providers.forEach((e => this.moduleUtils.bindToContainer(e, this.defaultScope.native)));
|
|
385
420
|
}
|
|
386
421
|
registerBindingSideEffect(e, i, t) {
|
|
387
422
|
this.registeredBindingSideEffects.has(e) || this.registeredBindingSideEffects.set(e, {
|
|
@@ -401,28 +436,27 @@ var V = class {
|
|
|
401
436
|
this.registeredBindingSideEffects.delete(e)) : this.registeredBindingSideEffects.forEach((({onUnbindEffects: e}) => e.forEach((e => e())))));
|
|
402
437
|
}
|
|
403
438
|
shouldThrowWhenModuleDynamicExportsDontMatchTheStaticExports(e, i, t) {
|
|
404
|
-
if (t.length > i.length || t.some((e => !i.includes(e)))) throw new
|
|
439
|
+
if (t.length > i.length || t.some((e => !i.includes(e)))) throw new O(e);
|
|
405
440
|
}
|
|
406
441
|
shouldThrowIfDisposed() {
|
|
407
|
-
if (null === this.container) throw new
|
|
408
|
-
}
|
|
409
|
-
_importedDependencyFactory(e, i) {
|
|
410
|
-
return i.get(e);
|
|
442
|
+
if (null === this.container) throw new F(this);
|
|
411
443
|
}
|
|
412
444
|
async _dispose() {
|
|
413
445
|
await (this.onDispose?.(this)), await this.__unbindAll(), this.container = null,
|
|
414
|
-
this.imports = null, this.providers = null, this.
|
|
415
|
-
this.registeredBindingSideEffects = null, this.isDisposed = !0;
|
|
446
|
+
this.imports = null, this.providers = null, this.importedProviders = null, this.exports = null,
|
|
447
|
+
this.dynamicExports = null, this.registeredBindingSideEffects = null, this.isDisposed = !0;
|
|
416
448
|
}
|
|
417
|
-
_lazyInit({imports: e = [], providers: i = [], exports: t = [], defaultScope: n = s.Singleton, dynamicExports:
|
|
418
|
-
this.isDisposed = !1, this.imports = e, this.providers = i, this.
|
|
449
|
+
_lazyInit({imports: e = [], providers: i = [], exports: t = [], defaultScope: n = s.Singleton, dynamicExports: r, onReady: o, onDispose: c, ...a}) {
|
|
450
|
+
return this.isDisposed = !1, this.imports = e, this.providers = i, this.importedProviders = a.importedProviders ?? new Map,
|
|
451
|
+
this.exports = t, this.defaultScope = {
|
|
419
452
|
native: n,
|
|
420
453
|
inversify: d(n)
|
|
421
|
-
}, this.dynamicExports =
|
|
454
|
+
}, this.dynamicExports = r, this.onReady = o, this.onDispose = c, this.importedProvidersMap = a.importedProvidersMap ?? (e => e),
|
|
455
|
+
this.container = this.prepareContainer({
|
|
422
456
|
...a
|
|
423
|
-
}), this.moduleUtils = new
|
|
457
|
+
}), this.moduleUtils = new W(this), this.registeredBindingSideEffects = new Map,
|
|
424
458
|
this.injectImportedModules(this._getImportedModules()), this.injectProviders(),
|
|
425
|
-
this.onReady?.(this);
|
|
459
|
+
this.onReady?.(this), this;
|
|
426
460
|
}
|
|
427
461
|
_getImportedModules() {
|
|
428
462
|
return this.shouldThrowIfDisposed(), this.imports;
|
|
@@ -447,26 +481,26 @@ var V = class {
|
|
|
447
481
|
}
|
|
448
482
|
__bind(e) {
|
|
449
483
|
this.shouldThrowIfDisposed();
|
|
450
|
-
const i = this.container.bind(
|
|
484
|
+
const i = this.container.bind(r.toServiceIdentifier(e));
|
|
451
485
|
return this.invokeRegisteredBindingSideEffects(e, "onBind"), i;
|
|
452
486
|
}
|
|
453
487
|
__get(e, i) {
|
|
454
|
-
return this.shouldThrowIfDisposed(), this.container.get(
|
|
488
|
+
return this.shouldThrowIfDisposed(), this.container.get(r.toServiceIdentifier(e), i);
|
|
455
489
|
}
|
|
456
490
|
async __getAsync(e, i) {
|
|
457
|
-
return this.shouldThrowIfDisposed(), this.container.getAsync(
|
|
491
|
+
return this.shouldThrowIfDisposed(), this.container.getAsync(r.toServiceIdentifier(e), i);
|
|
458
492
|
}
|
|
459
493
|
__getAll(e, i) {
|
|
460
|
-
return this.shouldThrowIfDisposed(), this.container.getAll(
|
|
494
|
+
return this.shouldThrowIfDisposed(), this.container.getAll(r.toServiceIdentifier(e), i);
|
|
461
495
|
}
|
|
462
496
|
async __getAllAsync(e, i) {
|
|
463
|
-
return this.shouldThrowIfDisposed(), this.container.getAllAsync(
|
|
497
|
+
return this.shouldThrowIfDisposed(), this.container.getAllAsync(r.toServiceIdentifier(e), i);
|
|
464
498
|
}
|
|
465
499
|
__isBound(e, i) {
|
|
466
|
-
return this.shouldThrowIfDisposed(), this.container.isBound(
|
|
500
|
+
return this.shouldThrowIfDisposed(), this.container.isBound(r.toServiceIdentifier(e), i);
|
|
467
501
|
}
|
|
468
502
|
__isCurrentBound(e, i) {
|
|
469
|
-
return this.shouldThrowIfDisposed(), this.container.isCurrentBound(
|
|
503
|
+
return this.shouldThrowIfDisposed(), this.container.isCurrentBound(r.toServiceIdentifier(e), i);
|
|
470
504
|
}
|
|
471
505
|
__takeSnapshot() {
|
|
472
506
|
this.shouldThrowIfDisposed(), this.container.snapshot();
|
|
@@ -476,39 +510,39 @@ var V = class {
|
|
|
476
510
|
}
|
|
477
511
|
async __rebind(e) {
|
|
478
512
|
this.shouldThrowIfDisposed();
|
|
479
|
-
const i = await this.container.rebind(
|
|
513
|
+
const i = await this.container.rebind(r.toServiceIdentifier(e));
|
|
480
514
|
return this.invokeRegisteredBindingSideEffects(e, "onRebind"), i;
|
|
481
515
|
}
|
|
482
516
|
__rebindSync(e) {
|
|
483
517
|
this.shouldThrowIfDisposed();
|
|
484
|
-
const i = this.container.rebindSync(
|
|
518
|
+
const i = this.container.rebindSync(r.toServiceIdentifier(e));
|
|
485
519
|
return this.invokeRegisteredBindingSideEffects(e, "onRebind"), i;
|
|
486
520
|
}
|
|
487
521
|
async __unbind(e) {
|
|
488
|
-
this.shouldThrowIfDisposed(), await this.container.unbind(
|
|
522
|
+
this.shouldThrowIfDisposed(), await this.container.unbind(r.toServiceIdentifier(e)),
|
|
489
523
|
this.removeRegisteredBindingSideEffects(e);
|
|
490
524
|
}
|
|
491
525
|
__unbindSync(e) {
|
|
492
|
-
this.shouldThrowIfDisposed(), this.container.unbindSync(
|
|
526
|
+
this.shouldThrowIfDisposed(), this.container.unbindSync(r.toServiceIdentifier(e)),
|
|
493
527
|
this.removeRegisteredBindingSideEffects(e);
|
|
494
528
|
}
|
|
495
529
|
async __unbindAll() {
|
|
496
530
|
this.shouldThrowIfDisposed(), await this.container.unbindAll(), this.removeRegisteredBindingSideEffects("all");
|
|
497
531
|
}
|
|
498
|
-
},
|
|
532
|
+
}, $ = class extends q {
|
|
499
533
|
static {
|
|
500
534
|
i(this, "GlobalAppModule");
|
|
501
535
|
}
|
|
502
536
|
nakedModule=this;
|
|
503
537
|
isLoaded=!1;
|
|
504
538
|
constructor() {
|
|
505
|
-
super(
|
|
539
|
+
super(o.buildInternalConstructorParams({
|
|
506
540
|
identifier: Symbol(t),
|
|
507
541
|
isAppModule: !0
|
|
508
542
|
}));
|
|
509
543
|
}
|
|
510
544
|
register(e) {
|
|
511
|
-
if (this.isLoaded) throw new
|
|
545
|
+
if (this.isLoaded) throw new A(`The '${this.toString()}' has already been registered!`);
|
|
512
546
|
return this.nakedModule._lazyInit(e), this.isLoaded = !0, this;
|
|
513
547
|
}
|
|
514
548
|
toNaked() {
|
|
@@ -517,6 +551,6 @@ var V = class {
|
|
|
517
551
|
async _dispose() {
|
|
518
552
|
this.isLoaded = !1, super._dispose();
|
|
519
553
|
}
|
|
520
|
-
},
|
|
554
|
+
}, z = new $;
|
|
521
555
|
|
|
522
|
-
export {
|
|
556
|
+
export { z as AppModule, t as GLOBAL_APP_MODULE_ID, $ as GlobalAppModule, G as GlobalContainer, m as Inject, E as InjectFromBase, v as Injectable, s as InjectionScope, y as MultiInject, T as Named, w as Optional, D as PostConstruct, M as PreDestroy, q as ProviderModule, o as ProviderModuleHelpers, r as ProviderTokenHelpers, k as Tagged, j as Unmanaged, O as XInjectionDynamicExportsOutOfRange, A as XInjectionError, F as XInjectionProviderModuleDisposedError, R as XInjectionProviderModuleError, N as XInjectionProviderModuleMissingIdentifierError, c as bindingScopeToInjectionScope, d as injectionScopeToBindingScope, u as isClass, h as isClassOrFunction, p as isFunction, l as isPlainObject };//# sourceMappingURL=index.js.map
|