@dooboostore/simple-web-component 1.0.26 → 1.0.27
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/README.md +186 -3441
- package/dist/cjs/decorators/attribute.js +32 -43
- package/dist/cjs/decorators/attribute.js.map +3 -3
- package/dist/cjs/decorators/elementDefine.js +33 -19
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/index.js +1 -0
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +5 -5
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/query.js +4 -4
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +4 -4
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChange.js +59 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/cjs/elements/SwcAppEngine.js +18 -63
- package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
- package/dist/cjs/elements/SwcAppMixin.js +103 -24
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/register.js +0 -1
- package/dist/cjs/elements/register.js.map +2 -2
- package/dist/cjs/utils/Utils.js +18 -0
- package/dist/cjs/utils/Utils.js.map +3 -3
- package/dist/esm/decorators/attribute.js +32 -43
- package/dist/esm/decorators/attribute.js.map +3 -3
- package/dist/esm/decorators/elementDefine.js +34 -20
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/index.js +1 -0
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +5 -5
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/query.js +4 -4
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +4 -4
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChange.js +40 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/esm/elements/SwcAppEngine.js +18 -63
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +103 -24
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/register.js +0 -1
- package/dist/esm/elements/register.js.map +2 -2
- package/dist/esm/utils/Utils.js +18 -0
- package/dist/esm/utils/Utils.js.map +3 -3
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +164 -2480
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/attribute.d.ts +0 -1
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +1 -0
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +2 -2
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +1 -1
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +1 -1
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +18 -0
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
- package/dist/types/elements/SwcAppEngine.d.ts +3 -5
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +9 -0
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/register.d.ts +1 -1
- package/dist/types/elements/register.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +3 -0
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +164 -2480
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +2 -2
- package/src/decorators/attribute.ts +62 -53
- package/src/decorators/elementDefine.ts +79 -30
- package/src/decorators/index.ts +1 -0
- package/src/decorators/lifecycles.ts +2 -2
- package/src/decorators/query.ts +5 -5
- package/src/decorators/queryAll.ts +8 -7
- package/src/decorators/subscribeSwcAppRouteChange.ts +71 -0
- package/src/elements/SwcAppEngine.ts +25 -81
- package/src/elements/SwcAppMixin.ts +143 -28
- package/src/elements/register.ts +0 -2
- package/src/utils/Utils.ts +33 -0
|
@@ -297,8 +297,8 @@ var require_Reflect = __commonJS({
|
|
|
297
297
|
keys.push(key);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
for (var
|
|
301
|
-
var key = parentKeys_1[
|
|
300
|
+
for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
|
|
301
|
+
var key = parentKeys_1[_a];
|
|
302
302
|
var hasKey = set.has(key);
|
|
303
303
|
if (!hasKey) {
|
|
304
304
|
set.add(key);
|
|
@@ -1110,10 +1110,10 @@ var require_Reflect = __commonJS({
|
|
|
1110
1110
|
});
|
|
1111
1111
|
|
|
1112
1112
|
// src/bundle-entry.ts
|
|
1113
|
-
var
|
|
1113
|
+
var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
|
|
1114
1114
|
|
|
1115
1115
|
// src/index.ts
|
|
1116
|
-
var
|
|
1116
|
+
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
1117
1117
|
|
|
1118
1118
|
// ../core/dist/esm/valid/ValidUtils.js
|
|
1119
1119
|
var ValidUtils;
|
|
@@ -4789,107 +4789,6 @@ var Observable = class {
|
|
|
4789
4789
|
}
|
|
4790
4790
|
};
|
|
4791
4791
|
|
|
4792
|
-
// ../core/dist/esm/message/Subject.js
|
|
4793
|
-
var Subject = class extends Observable {
|
|
4794
|
-
constructor() {
|
|
4795
|
-
super((subscriber) => {
|
|
4796
|
-
return this._subscribeToSubject(subscriber);
|
|
4797
|
-
});
|
|
4798
|
-
this._observers = /* @__PURE__ */ new Set();
|
|
4799
|
-
this._isStopped = false;
|
|
4800
|
-
this._hasError = false;
|
|
4801
|
-
}
|
|
4802
|
-
_subscribeToSubject(subscriber) {
|
|
4803
|
-
const partialObserver = {
|
|
4804
|
-
next: subscriber.next.bind(subscriber),
|
|
4805
|
-
error: subscriber.error.bind(subscriber),
|
|
4806
|
-
complete: subscriber.complete.bind(subscriber)
|
|
4807
|
-
};
|
|
4808
|
-
if (this._isStopped) {
|
|
4809
|
-
if (this._hasError) {
|
|
4810
|
-
partialObserver.error?.(this._error);
|
|
4811
|
-
} else {
|
|
4812
|
-
partialObserver.complete?.();
|
|
4813
|
-
}
|
|
4814
|
-
return Subscription.EMPTY;
|
|
4815
|
-
}
|
|
4816
|
-
this._observers.add(partialObserver);
|
|
4817
|
-
return new Subscription(() => {
|
|
4818
|
-
this._observers.delete(partialObserver);
|
|
4819
|
-
});
|
|
4820
|
-
}
|
|
4821
|
-
next(data) {
|
|
4822
|
-
if (this._isStopped) {
|
|
4823
|
-
return;
|
|
4824
|
-
}
|
|
4825
|
-
this._observers.forEach((observer) => {
|
|
4826
|
-
observer.next?.(data);
|
|
4827
|
-
});
|
|
4828
|
-
}
|
|
4829
|
-
error(err) {
|
|
4830
|
-
if (this._isStopped) {
|
|
4831
|
-
return;
|
|
4832
|
-
}
|
|
4833
|
-
this._hasError = true;
|
|
4834
|
-
this._error = err;
|
|
4835
|
-
this._isStopped = true;
|
|
4836
|
-
this._observers.forEach((observer) => observer.error?.(err));
|
|
4837
|
-
this._observers.clear();
|
|
4838
|
-
}
|
|
4839
|
-
complete() {
|
|
4840
|
-
if (this._isStopped) {
|
|
4841
|
-
return;
|
|
4842
|
-
}
|
|
4843
|
-
this._isStopped = true;
|
|
4844
|
-
this._observers.forEach((observer) => observer.complete?.());
|
|
4845
|
-
this._observers.clear();
|
|
4846
|
-
}
|
|
4847
|
-
asObservable() {
|
|
4848
|
-
return new Observable((subscriber) => {
|
|
4849
|
-
return this._subscribeToSubject(subscriber);
|
|
4850
|
-
});
|
|
4851
|
-
}
|
|
4852
|
-
};
|
|
4853
|
-
|
|
4854
|
-
// ../core/dist/esm/message/ReplaySubject.js
|
|
4855
|
-
var ReplaySubject = class extends Subject {
|
|
4856
|
-
// Removed: private _error: E | undefined;
|
|
4857
|
-
// Removed: private _isStopped = false;
|
|
4858
|
-
constructor(bufferSize = Infinity) {
|
|
4859
|
-
super();
|
|
4860
|
-
this.bufferSize = bufferSize;
|
|
4861
|
-
this._buffer = [];
|
|
4862
|
-
}
|
|
4863
|
-
next(data) {
|
|
4864
|
-
if (this._isStopped) {
|
|
4865
|
-
return;
|
|
4866
|
-
}
|
|
4867
|
-
this._buffer.push(data);
|
|
4868
|
-
if (this._buffer.length > this.bufferSize) {
|
|
4869
|
-
this._buffer.shift();
|
|
4870
|
-
}
|
|
4871
|
-
super.next(data);
|
|
4872
|
-
}
|
|
4873
|
-
error(err) {
|
|
4874
|
-
super.error(err);
|
|
4875
|
-
}
|
|
4876
|
-
complete() {
|
|
4877
|
-
super.complete();
|
|
4878
|
-
}
|
|
4879
|
-
_subscribeToSubject(subscriber) {
|
|
4880
|
-
this._buffer.forEach((value) => subscriber.next(value));
|
|
4881
|
-
if (this._isStopped) {
|
|
4882
|
-
if (this._hasError) {
|
|
4883
|
-
subscriber.error(this._error);
|
|
4884
|
-
} else {
|
|
4885
|
-
subscriber.complete();
|
|
4886
|
-
}
|
|
4887
|
-
return Subscription.EMPTY;
|
|
4888
|
-
}
|
|
4889
|
-
return super._subscribeToSubject(subscriber);
|
|
4890
|
-
}
|
|
4891
|
-
};
|
|
4892
|
-
|
|
4893
4792
|
// ../core/dist/esm/message/AutoCloseSubscription.js
|
|
4894
4793
|
var AutoCloseSubscription = class extends Subscription {
|
|
4895
4794
|
constructor(userUnsubscribe) {
|
|
@@ -5224,284 +5123,6 @@ var Promises;
|
|
|
5224
5123
|
})(Result = Promises2.Result || (Promises2.Result = {}));
|
|
5225
5124
|
})(Promises || (Promises = {}));
|
|
5226
5125
|
|
|
5227
|
-
// ../core/dist/esm/fetch/Fetcher.js
|
|
5228
|
-
var Fetcher = class {
|
|
5229
|
-
createPipe(config) {
|
|
5230
|
-
return {};
|
|
5231
|
-
}
|
|
5232
|
-
fetch(config) {
|
|
5233
|
-
return new Promise((resolve, reject) => {
|
|
5234
|
-
const pipe = this.createPipe(config);
|
|
5235
|
-
Promise.resolve().then(() => {
|
|
5236
|
-
this.before(config, pipe);
|
|
5237
|
-
config?.before?.();
|
|
5238
|
-
}).then(() => {
|
|
5239
|
-
return this.execute(config);
|
|
5240
|
-
}).then((data) => {
|
|
5241
|
-
const hasError = config.config?.hasErrorChecker?.(data);
|
|
5242
|
-
if (hasError) {
|
|
5243
|
-
throw hasError;
|
|
5244
|
-
}
|
|
5245
|
-
pipe.responseData = data;
|
|
5246
|
-
this.afterSuccess(config, pipe);
|
|
5247
|
-
config?.afterSuccess?.();
|
|
5248
|
-
const gdata = config?.transform ? config.transform(data) : data;
|
|
5249
|
-
this.afterSuccessTransform(config, pipe);
|
|
5250
|
-
resolve(gdata);
|
|
5251
|
-
}).catch(async (e) => {
|
|
5252
|
-
this.error(config, pipe, e);
|
|
5253
|
-
config?.error?.();
|
|
5254
|
-
if (config?.errorTransform) {
|
|
5255
|
-
e = await config.errorTransform(e);
|
|
5256
|
-
}
|
|
5257
|
-
e = await this.errorTransform(e);
|
|
5258
|
-
reject(e);
|
|
5259
|
-
}).finally(() => {
|
|
5260
|
-
this.finally(config, pipe);
|
|
5261
|
-
config?.finally?.();
|
|
5262
|
-
});
|
|
5263
|
-
});
|
|
5264
|
-
}
|
|
5265
|
-
};
|
|
5266
|
-
|
|
5267
|
-
// ../core/dist/esm/fetch/HttpFetcher.js
|
|
5268
|
-
var HttpResponseError = class extends Error {
|
|
5269
|
-
};
|
|
5270
|
-
var HttpFetcher = class extends Fetcher {
|
|
5271
|
-
get(config) {
|
|
5272
|
-
config.config ?? (config.config = {});
|
|
5273
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
5274
|
-
config.config.fetch.method = "GET";
|
|
5275
|
-
return this.fetch(config);
|
|
5276
|
-
}
|
|
5277
|
-
post(config) {
|
|
5278
|
-
config.config ?? (config.config = {});
|
|
5279
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
5280
|
-
config.config.fetch.method = "POST";
|
|
5281
|
-
return this.fetch(config);
|
|
5282
|
-
}
|
|
5283
|
-
patch(config) {
|
|
5284
|
-
config.config ?? (config.config = {});
|
|
5285
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
5286
|
-
config.config.fetch.method = "PATCH";
|
|
5287
|
-
return this.fetch(config);
|
|
5288
|
-
}
|
|
5289
|
-
put(config) {
|
|
5290
|
-
config.config ?? (config.config = {});
|
|
5291
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
5292
|
-
config.config.fetch.method = "PUT";
|
|
5293
|
-
return this.fetch(config);
|
|
5294
|
-
}
|
|
5295
|
-
head(config) {
|
|
5296
|
-
config.config ?? (config.config = {});
|
|
5297
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
5298
|
-
config.config.fetch.method = "HEAD";
|
|
5299
|
-
return this.fetch(config);
|
|
5300
|
-
}
|
|
5301
|
-
delete(config) {
|
|
5302
|
-
config.config ?? (config.config = {});
|
|
5303
|
-
config.config.fetch = config.config?.fetch ?? {};
|
|
5304
|
-
config.config.fetch.method = "DELETE";
|
|
5305
|
-
return this.fetch(config);
|
|
5306
|
-
}
|
|
5307
|
-
async beforeProxyFetch(config) {
|
|
5308
|
-
return config;
|
|
5309
|
-
}
|
|
5310
|
-
async afterProxyFetch(config) {
|
|
5311
|
-
return config.response;
|
|
5312
|
-
}
|
|
5313
|
-
afterSuccess(config, pipe) {
|
|
5314
|
-
}
|
|
5315
|
-
afterSuccessTransform(config, pipe) {
|
|
5316
|
-
}
|
|
5317
|
-
before(config, pipe) {
|
|
5318
|
-
}
|
|
5319
|
-
error(config, pipe, e) {
|
|
5320
|
-
}
|
|
5321
|
-
finally(config, pipe) {
|
|
5322
|
-
}
|
|
5323
|
-
beforeFetch(fetch2) {
|
|
5324
|
-
}
|
|
5325
|
-
afterFetch(fetch2, response) {
|
|
5326
|
-
}
|
|
5327
|
-
// protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
|
|
5328
|
-
async errorTransform(e) {
|
|
5329
|
-
const httpResponseError = new HttpResponseError();
|
|
5330
|
-
httpResponseError.error = e;
|
|
5331
|
-
if (e instanceof Response) {
|
|
5332
|
-
httpResponseError.response = e;
|
|
5333
|
-
try {
|
|
5334
|
-
httpResponseError.body = await e.clone().text();
|
|
5335
|
-
httpResponseError.message = e.statusText;
|
|
5336
|
-
} catch (e2) {
|
|
5337
|
-
httpResponseError.body = e2;
|
|
5338
|
-
httpResponseError.message = e2.message;
|
|
5339
|
-
}
|
|
5340
|
-
} else {
|
|
5341
|
-
httpResponseError.body = e;
|
|
5342
|
-
httpResponseError.message = e.message;
|
|
5343
|
-
}
|
|
5344
|
-
return httpResponseError;
|
|
5345
|
-
}
|
|
5346
|
-
async execute(fetcherRequest) {
|
|
5347
|
-
let target = fetcherRequest.target;
|
|
5348
|
-
let config = fetcherRequest.config;
|
|
5349
|
-
if (!(target instanceof URL) && typeof target !== "string") {
|
|
5350
|
-
const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
|
|
5351
|
-
try {
|
|
5352
|
-
const url = typeof target.url === "string" ? new URL(target.url) : target.url;
|
|
5353
|
-
searchParams.forEach((value, key) => {
|
|
5354
|
-
url.searchParams.append(key, value);
|
|
5355
|
-
});
|
|
5356
|
-
target = url;
|
|
5357
|
-
} catch (e) {
|
|
5358
|
-
if (typeof target.url === "string") {
|
|
5359
|
-
const searchParamString = searchParams.toString();
|
|
5360
|
-
target = target.url + (searchParamString ? "?" + searchParamString : "");
|
|
5361
|
-
} else {
|
|
5362
|
-
target = "";
|
|
5363
|
-
}
|
|
5364
|
-
}
|
|
5365
|
-
}
|
|
5366
|
-
const beforeProxyData = { requestInfo: target, init: config?.fetch };
|
|
5367
|
-
let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
|
|
5368
|
-
beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
|
|
5369
|
-
target = beforeData.requestInfo;
|
|
5370
|
-
if (beforeData.init) {
|
|
5371
|
-
config ?? (config = {});
|
|
5372
|
-
config.fetch = beforeData.init;
|
|
5373
|
-
}
|
|
5374
|
-
let abortedTimeout;
|
|
5375
|
-
if (config?.fetch && "timeout" in config.fetch) {
|
|
5376
|
-
const abortController = new AbortController();
|
|
5377
|
-
abortedTimeout = setTimeout(() => {
|
|
5378
|
-
if (config?.fetch?.signal) {
|
|
5379
|
-
const inputSignal = config.fetch.signal;
|
|
5380
|
-
const listener = () => {
|
|
5381
|
-
if (!abortController.signal.aborted) {
|
|
5382
|
-
abortController.abort();
|
|
5383
|
-
}
|
|
5384
|
-
inputSignal.removeEventListener("abort", listener);
|
|
5385
|
-
};
|
|
5386
|
-
inputSignal.addEventListener("abort", listener);
|
|
5387
|
-
}
|
|
5388
|
-
if (!abortController.signal.aborted) {
|
|
5389
|
-
abortController.abort();
|
|
5390
|
-
}
|
|
5391
|
-
}, config.fetch.timeout);
|
|
5392
|
-
config.fetch.signal = abortController.signal;
|
|
5393
|
-
}
|
|
5394
|
-
this.beforeFetch({ target, requestInit: config?.fetch });
|
|
5395
|
-
return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
|
|
5396
|
-
this.afterFetch({ target, requestInit: config?.fetch }, it);
|
|
5397
|
-
const afterProxyData = {
|
|
5398
|
-
fetch: { target, requestInit: config.fetch },
|
|
5399
|
-
config: beforeData,
|
|
5400
|
-
response: it
|
|
5401
|
-
};
|
|
5402
|
-
it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
|
|
5403
|
-
it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
|
|
5404
|
-
config?.fetchResponseAfterCallBack?.(it, config);
|
|
5405
|
-
if (!config?.allowedResponseNotOk && !it.ok) {
|
|
5406
|
-
throw it;
|
|
5407
|
-
}
|
|
5408
|
-
const data = config?.hasResponseErrorChecker?.(it, config);
|
|
5409
|
-
if (data) {
|
|
5410
|
-
throw data;
|
|
5411
|
-
}
|
|
5412
|
-
return it;
|
|
5413
|
-
}).finally(() => {
|
|
5414
|
-
if (abortedTimeout) {
|
|
5415
|
-
clearTimeout(abortedTimeout);
|
|
5416
|
-
}
|
|
5417
|
-
});
|
|
5418
|
-
}
|
|
5419
|
-
};
|
|
5420
|
-
|
|
5421
|
-
// ../core/dist/esm/fetch/HttpJsonFetcher.js
|
|
5422
|
-
var HttpJsonFetcher = class extends HttpFetcher {
|
|
5423
|
-
updateJsonFetchConfigAndData(config) {
|
|
5424
|
-
var _a4, _b2;
|
|
5425
|
-
const headers = {
|
|
5426
|
-
"Content-Type": "application/json",
|
|
5427
|
-
Accept: "application/json, text/plain, */*"
|
|
5428
|
-
};
|
|
5429
|
-
config.config ?? (config.config = {});
|
|
5430
|
-
(_a4 = config.config).fetch ?? (_a4.fetch = {});
|
|
5431
|
-
(_b2 = config.config.fetch).headers ?? (_b2.headers = {});
|
|
5432
|
-
config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
|
|
5433
|
-
if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
|
|
5434
|
-
config.config.fetch.body = JSON.stringify(config.config.fetch.body);
|
|
5435
|
-
}
|
|
5436
|
-
return config;
|
|
5437
|
-
}
|
|
5438
|
-
get(config) {
|
|
5439
|
-
return super.get(config);
|
|
5440
|
-
}
|
|
5441
|
-
delete(config) {
|
|
5442
|
-
return super.delete(config);
|
|
5443
|
-
}
|
|
5444
|
-
post(config) {
|
|
5445
|
-
return super.post(config);
|
|
5446
|
-
}
|
|
5447
|
-
patch(config) {
|
|
5448
|
-
return super.patch(config);
|
|
5449
|
-
}
|
|
5450
|
-
put(config) {
|
|
5451
|
-
return super.put(config);
|
|
5452
|
-
}
|
|
5453
|
-
head(config) {
|
|
5454
|
-
return super.head(config);
|
|
5455
|
-
}
|
|
5456
|
-
postJson(config) {
|
|
5457
|
-
return super.post(this.updateJsonFetchConfigAndData(config));
|
|
5458
|
-
}
|
|
5459
|
-
patchJson(config) {
|
|
5460
|
-
return super.patch(this.updateJsonFetchConfigAndData(config));
|
|
5461
|
-
}
|
|
5462
|
-
putJson(config) {
|
|
5463
|
-
return super.put(this.updateJsonFetchConfigAndData(config));
|
|
5464
|
-
}
|
|
5465
|
-
async errorTransform(e) {
|
|
5466
|
-
const httpResponseError = new HttpResponseError();
|
|
5467
|
-
httpResponseError.error = e;
|
|
5468
|
-
if (e instanceof Response) {
|
|
5469
|
-
httpResponseError.response = e;
|
|
5470
|
-
try {
|
|
5471
|
-
httpResponseError.body = await e.clone().json();
|
|
5472
|
-
httpResponseError.message = e.statusText;
|
|
5473
|
-
} catch (parseError) {
|
|
5474
|
-
httpResponseError.body = parseError;
|
|
5475
|
-
httpResponseError.message = parseError.message;
|
|
5476
|
-
}
|
|
5477
|
-
} else {
|
|
5478
|
-
httpResponseError.body = e;
|
|
5479
|
-
httpResponseError.message = e.message;
|
|
5480
|
-
}
|
|
5481
|
-
return httpResponseError;
|
|
5482
|
-
}
|
|
5483
|
-
// protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
|
|
5484
|
-
execute(fetcherRequest) {
|
|
5485
|
-
return super.execute(fetcherRequest).then((response) => {
|
|
5486
|
-
const config = fetcherRequest.config;
|
|
5487
|
-
const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
|
|
5488
|
-
if (transform === "response") {
|
|
5489
|
-
return response;
|
|
5490
|
-
} else if (transform === "text") {
|
|
5491
|
-
return response?.text();
|
|
5492
|
-
} else if (typeof transform === "function") {
|
|
5493
|
-
return transform(response);
|
|
5494
|
-
} else {
|
|
5495
|
-
return response?.text().then((it) => {
|
|
5496
|
-
if ((it ?? "").length > 0) {
|
|
5497
|
-
return JSON.parse(it);
|
|
5498
|
-
}
|
|
5499
|
-
});
|
|
5500
|
-
}
|
|
5501
|
-
});
|
|
5502
|
-
}
|
|
5503
|
-
};
|
|
5504
|
-
|
|
5505
5126
|
// ../core/dist/esm/entity/object/obj/RenderDrawObj.js
|
|
5506
5127
|
var RenderDrawObj = class extends Obj {
|
|
5507
5128
|
render(draw, config) {
|
|
@@ -5778,7 +5399,7 @@ _RenderTransactionDrawObj.DEFAULT_BEZIER = { p1x: 0.61, p1y: 1, p2x: 0.88, p2y:
|
|
|
5778
5399
|
// ../core/dist/esm/schedule/Schedule.js
|
|
5779
5400
|
var Schedule;
|
|
5780
5401
|
((Schedule2) => {
|
|
5781
|
-
Schedule2.SYMBOL = Symbol("
|
|
5402
|
+
Schedule2.SYMBOL = Symbol.for("core:schedule-token");
|
|
5782
5403
|
})(Schedule || (Schedule = {}));
|
|
5783
5404
|
|
|
5784
5405
|
// ../core/dist/esm/url/UrlUtils.js
|
|
@@ -5932,6 +5553,17 @@ var ReflectUtils;
|
|
|
5932
5553
|
Reflect.defineMetadata(metadataKey, value, target);
|
|
5933
5554
|
}
|
|
5934
5555
|
};
|
|
5556
|
+
ReflectUtils2.copyMetadata = (from, to, propertyKey) => {
|
|
5557
|
+
const keys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);
|
|
5558
|
+
for (const key of keys) {
|
|
5559
|
+
const data = propertyKey ? Reflect.getOwnMetadata(key, from, propertyKey) : Reflect.getOwnMetadata(key, from);
|
|
5560
|
+
if (propertyKey) {
|
|
5561
|
+
Reflect.defineMetadata(key, data, to, propertyKey);
|
|
5562
|
+
} else {
|
|
5563
|
+
Reflect.defineMetadata(key, data, to);
|
|
5564
|
+
}
|
|
5565
|
+
}
|
|
5566
|
+
};
|
|
5935
5567
|
})(ReflectUtils || (ReflectUtils = {}));
|
|
5936
5568
|
|
|
5937
5569
|
// ../core/dist/esm/function/FunctionUtils.js
|
|
@@ -6116,7 +5748,7 @@ function addEventListenerHost(type, options) {
|
|
|
6116
5748
|
}
|
|
6117
5749
|
|
|
6118
5750
|
// src/decorators/lifecycles.ts
|
|
6119
|
-
var
|
|
5751
|
+
var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
6120
5752
|
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
6121
5753
|
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
6122
5754
|
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
@@ -6137,7 +5769,7 @@ function createLifecycleDecorator(metadataKey) {
|
|
|
6137
5769
|
list.push(propertyKey);
|
|
6138
5770
|
};
|
|
6139
5771
|
}
|
|
6140
|
-
var
|
|
5772
|
+
var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
|
|
6141
5773
|
var onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
6142
5774
|
var onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
|
|
6143
5775
|
var onConnected = onAfterConnected;
|
|
@@ -6252,49 +5884,37 @@ function attribute(selector, options = {}) {
|
|
|
6252
5884
|
}
|
|
6253
5885
|
});
|
|
6254
5886
|
};
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
return
|
|
6270
|
-
}
|
|
6271
|
-
return null;
|
|
6272
|
-
}
|
|
6273
|
-
return convertValue(this[privateKey], targetType);
|
|
6274
|
-
},
|
|
6275
|
-
set(nv) {
|
|
6276
|
-
const attrName = options.name || String(propertyKey);
|
|
6277
|
-
const conf = getElementConfig(this);
|
|
6278
|
-
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
6279
|
-
if (this.__swc_syncing_init) {
|
|
6280
|
-
if (options.connectedInitialize === true) {
|
|
6281
|
-
const targets2 = resolveTargetEls(this, selector, options, currentWin);
|
|
6282
|
-
applySetAttribute(this, targets2, attrName, nv);
|
|
6283
|
-
} else {
|
|
6284
|
-
this[privateKey] = nv;
|
|
5887
|
+
try {
|
|
5888
|
+
Object.defineProperty(target, propertyKey, {
|
|
5889
|
+
get() {
|
|
5890
|
+
const attrName = options.name || String(propertyKey);
|
|
5891
|
+
const conf = getElementConfig(this);
|
|
5892
|
+
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
5893
|
+
const targetType = options.type || designType;
|
|
5894
|
+
const targets = resolveTargetEls(this, selector, options, currentWin);
|
|
5895
|
+
const primaryTarget = targets[0];
|
|
5896
|
+
if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
|
|
5897
|
+
if (primaryTarget.hasAttribute(attrName)) {
|
|
5898
|
+
const domVal = primaryTarget.getAttribute(attrName);
|
|
5899
|
+
return convertValue(domVal, targetType);
|
|
5900
|
+
}
|
|
5901
|
+
return null;
|
|
6285
5902
|
}
|
|
6286
|
-
return;
|
|
6287
|
-
}
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
5903
|
+
return convertValue(this[privateKey], targetType);
|
|
5904
|
+
},
|
|
5905
|
+
set(nv) {
|
|
5906
|
+
const attrName = options.name || String(propertyKey);
|
|
5907
|
+
const conf = getElementConfig(this);
|
|
5908
|
+
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
5909
|
+
const targets = resolveTargetEls(this, selector, options, currentWin);
|
|
5910
|
+
applySetAttribute(this, targets, attrName, nv);
|
|
5911
|
+
},
|
|
5912
|
+
enumerable: true,
|
|
5913
|
+
configurable: true
|
|
5914
|
+
});
|
|
5915
|
+
} catch (err) {
|
|
5916
|
+
console.error("[SWC] defineProperty error:", err);
|
|
5917
|
+
}
|
|
6298
5918
|
};
|
|
6299
5919
|
}
|
|
6300
5920
|
function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
@@ -6317,7 +5937,8 @@ function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
|
6317
5937
|
}
|
|
6318
5938
|
}
|
|
6319
5939
|
var findAllAttributeMetadata = (target) => {
|
|
6320
|
-
|
|
5940
|
+
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
5941
|
+
return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, actualTarget).flat();
|
|
6321
5942
|
};
|
|
6322
5943
|
|
|
6323
5944
|
// src/decorators/changedAttributeHost.ts
|
|
@@ -6573,10 +6194,6 @@ function query(selectorOrTarget, options = {}) {
|
|
|
6573
6194
|
});
|
|
6574
6195
|
};
|
|
6575
6196
|
}
|
|
6576
|
-
var getQueryMetadata = (target) => {
|
|
6577
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
6578
|
-
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
6579
|
-
};
|
|
6580
6197
|
function queryHost(targetOrOptions, propertyKey) {
|
|
6581
6198
|
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6582
6199
|
return query(":host", {})(targetOrOptions, propertyKey);
|
|
@@ -6648,6 +6265,10 @@ function lastAppHost(targetOrOptions, propertyKey) {
|
|
|
6648
6265
|
return query(":lastAppHost", {});
|
|
6649
6266
|
}
|
|
6650
6267
|
}
|
|
6268
|
+
var getQueryMetadata = (target) => {
|
|
6269
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
6270
|
+
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
6271
|
+
};
|
|
6651
6272
|
|
|
6652
6273
|
// src/decorators/queryAll.ts
|
|
6653
6274
|
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
@@ -6741,10 +6362,6 @@ function queryAll(selectorOrTarget, options = {}) {
|
|
|
6741
6362
|
});
|
|
6742
6363
|
};
|
|
6743
6364
|
}
|
|
6744
|
-
var getQueryAllMetadata = (target) => {
|
|
6745
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
6746
|
-
return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
6747
|
-
};
|
|
6748
6365
|
function queryAllHost(targetOrOptions, propertyKey) {
|
|
6749
6366
|
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6750
6367
|
return queryAll(":host", {})(targetOrOptions, propertyKey);
|
|
@@ -6816,6 +6433,10 @@ function allLastAppHost(targetOrOptions, propertyKey) {
|
|
|
6816
6433
|
return queryAll(":lastAppHost", {});
|
|
6817
6434
|
}
|
|
6818
6435
|
}
|
|
6436
|
+
var getQueryAllMetadata = (target) => {
|
|
6437
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
6438
|
+
return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
6439
|
+
};
|
|
6819
6440
|
|
|
6820
6441
|
// src/decorators/applyClass.ts
|
|
6821
6442
|
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
@@ -7161,6 +6782,41 @@ var findAllAttributeApplyMetadata = (target) => {
|
|
|
7161
6782
|
return result;
|
|
7162
6783
|
};
|
|
7163
6784
|
|
|
6785
|
+
// src/decorators/subscribeSwcAppRouteChange.ts
|
|
6786
|
+
var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change");
|
|
6787
|
+
function createSwcAppRouteChangeSubscriber(options) {
|
|
6788
|
+
return (target, propertyKey, descriptor) => {
|
|
6789
|
+
const pathPattern = options?.path;
|
|
6790
|
+
const filter = options?.filter;
|
|
6791
|
+
const constructor = target.constructor;
|
|
6792
|
+
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
|
|
6793
|
+
if (!list) {
|
|
6794
|
+
list = [];
|
|
6795
|
+
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, list, constructor);
|
|
6796
|
+
}
|
|
6797
|
+
list.push({ propertyKey, pathPattern, filter });
|
|
6798
|
+
return descriptor;
|
|
6799
|
+
};
|
|
6800
|
+
}
|
|
6801
|
+
function subscribeSwcAppRouteChange(targetOrOptions, propertyKey, descriptor) {
|
|
6802
|
+
if (propertyKey && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6803
|
+
return createSwcAppRouteChangeSubscriber({})(targetOrOptions, propertyKey, descriptor);
|
|
6804
|
+
}
|
|
6805
|
+
let options = {};
|
|
6806
|
+
if (Array.isArray(targetOrOptions)) {
|
|
6807
|
+
options.path = targetOrOptions;
|
|
6808
|
+
} else if (typeof targetOrOptions === "string") {
|
|
6809
|
+
options.path = targetOrOptions;
|
|
6810
|
+
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
6811
|
+
options = targetOrOptions;
|
|
6812
|
+
}
|
|
6813
|
+
return createSwcAppRouteChangeSubscriber(options);
|
|
6814
|
+
}
|
|
6815
|
+
var getSubscribeSwcAppRouteChangeMetadata = (target) => {
|
|
6816
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
6817
|
+
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
|
|
6818
|
+
};
|
|
6819
|
+
|
|
7164
6820
|
// src/utils/Utils.ts
|
|
7165
6821
|
var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
|
|
7166
6822
|
var htmlFragment = (html, doc) => {
|
|
@@ -7396,6 +7052,24 @@ var SwcUtils;
|
|
|
7396
7052
|
...loopContext
|
|
7397
7053
|
};
|
|
7398
7054
|
};
|
|
7055
|
+
SwcUtils2.parsePathPattern = (pattern, currentPath) => {
|
|
7056
|
+
if (pattern === null || pattern === void 0) return {};
|
|
7057
|
+
const trimmedPattern = pattern.trim();
|
|
7058
|
+
if (trimmedPattern === "" && pattern !== "") return {};
|
|
7059
|
+
const paramNames = [];
|
|
7060
|
+
const regexPattern = trimmedPattern.replace(/{(\w+)(?::(.+?))?}/g, (match2, paramName, customRegex) => {
|
|
7061
|
+
paramNames.push(paramName);
|
|
7062
|
+
return `(${customRegex || "[^/]+"})`;
|
|
7063
|
+
});
|
|
7064
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
7065
|
+
const match = currentPath.match(regex);
|
|
7066
|
+
if (!match) return null;
|
|
7067
|
+
const result = {};
|
|
7068
|
+
paramNames.forEach((name, index) => {
|
|
7069
|
+
result[name] = match[index + 1];
|
|
7070
|
+
});
|
|
7071
|
+
return result;
|
|
7072
|
+
};
|
|
7399
7073
|
})(SwcUtils || (SwcUtils = {}));
|
|
7400
7074
|
|
|
7401
7075
|
// src/decorators/emitCustomEvent.ts
|
|
@@ -7563,46 +7237,7 @@ var SituationTypeContainers = class {
|
|
|
7563
7237
|
return this.containers.find(predicate);
|
|
7564
7238
|
}
|
|
7565
7239
|
};
|
|
7566
|
-
var
|
|
7567
|
-
return "symbol" in config && config.symbol !== void 0;
|
|
7568
|
-
};
|
|
7569
|
-
var isTargetType = (config) => {
|
|
7570
|
-
return "type" in config && config.type !== void 0;
|
|
7571
|
-
};
|
|
7572
|
-
var isTargetScheme = (config) => {
|
|
7573
|
-
return "scheme" in config && config.scheme !== void 0;
|
|
7574
|
-
};
|
|
7575
|
-
var isTargetFactory = (config) => {
|
|
7576
|
-
return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
|
|
7577
|
-
};
|
|
7578
|
-
var InjectMetadataKey = Symbol("Inject");
|
|
7579
|
-
var injectProcess = (config, target, propertyKey, parameterIndex) => {
|
|
7580
|
-
if (propertyKey && typeof target === "object") {
|
|
7581
|
-
const otarget = target;
|
|
7582
|
-
target = target.constructor;
|
|
7583
|
-
const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
|
|
7584
|
-
const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
|
|
7585
|
-
saves.push({ index: parameterIndex, config, propertyKey, type });
|
|
7586
|
-
ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
|
|
7587
|
-
} else if (!propertyKey || typeof target === "function") {
|
|
7588
|
-
const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
|
|
7589
|
-
const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
|
|
7590
|
-
existingInjectdParameters.push({ index: parameterIndex, config, type });
|
|
7591
|
-
ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
|
|
7592
|
-
}
|
|
7593
|
-
};
|
|
7594
|
-
function Inject(configOrTarget, propertyKey, parameterIndex) {
|
|
7595
|
-
if (propertyKey && parameterIndex !== void 0) {
|
|
7596
|
-
injectProcess({}, configOrTarget, propertyKey, parameterIndex);
|
|
7597
|
-
} else {
|
|
7598
|
-
return (target, propertyKey2, parameterIndex2) => {
|
|
7599
|
-
injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
|
|
7600
|
-
};
|
|
7601
|
-
}
|
|
7602
|
-
}
|
|
7603
|
-
var getInject = (target, propertyKey) => {
|
|
7604
|
-
return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
|
|
7605
|
-
};
|
|
7240
|
+
var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
|
|
7606
7241
|
|
|
7607
7242
|
// src/types.ts
|
|
7608
7243
|
var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
|
|
@@ -7631,9 +7266,26 @@ var ensureInit2 = (inst) => {
|
|
|
7631
7266
|
inst._emitHandlers = /* @__PURE__ */ new Map();
|
|
7632
7267
|
inst._boundListeners = [];
|
|
7633
7268
|
inst.__swc_initialized = true;
|
|
7269
|
+
const target = inst instanceof Function ? inst : inst.constructor;
|
|
7270
|
+
const attributeList = findAllAttributeMetadata(target);
|
|
7271
|
+
attributeList.forEach((meta) => {
|
|
7272
|
+
delete inst[meta.propertyKey];
|
|
7273
|
+
});
|
|
7274
|
+
const queryList = getQueryMetadata(target);
|
|
7275
|
+
if (queryList) {
|
|
7276
|
+
queryList.forEach((meta) => {
|
|
7277
|
+
delete inst[meta.propertyKey];
|
|
7278
|
+
});
|
|
7279
|
+
}
|
|
7280
|
+
const queryAllList = getQueryAllMetadata(target);
|
|
7281
|
+
if (queryAllList) {
|
|
7282
|
+
queryAllList.forEach((meta) => {
|
|
7283
|
+
delete inst[meta.propertyKey];
|
|
7284
|
+
});
|
|
7285
|
+
}
|
|
7634
7286
|
const hostSet = SwcUtils.getHostSet(inst);
|
|
7635
7287
|
inst._executeSwcScript?.("swc-on-constructor", hostSet);
|
|
7636
|
-
const cMethods = findAllLifecycleMetadata(inst,
|
|
7288
|
+
const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);
|
|
7637
7289
|
if (cMethods) {
|
|
7638
7290
|
for (const m of cMethods) inst._invokeLifecycleMethod(m, hostSet);
|
|
7639
7291
|
}
|
|
@@ -7800,12 +7452,12 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7800
7452
|
const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
|
|
7801
7453
|
const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
7802
7454
|
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
|
|
7803
|
-
const
|
|
7455
|
+
const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
|
|
7804
7456
|
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
|
|
7805
7457
|
...metadata.observedAttributes ?? [],
|
|
7806
7458
|
...attrChangeMap.keys(),
|
|
7807
7459
|
...attributeApplyNames,
|
|
7808
|
-
...
|
|
7460
|
+
...hostAttributes,
|
|
7809
7461
|
...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
|
|
7810
7462
|
...swcLifecycleAttributes,
|
|
7811
7463
|
...swcOnEvents
|
|
@@ -7816,30 +7468,18 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7816
7468
|
const originalConnected = proto.connectedCallback;
|
|
7817
7469
|
proto.connectedCallback = function() {
|
|
7818
7470
|
ensureInit2(this);
|
|
7471
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
7472
|
+
const appHost2 = hostSet.$appHost;
|
|
7473
|
+
const conf = getElementConfig(this);
|
|
7474
|
+
const currentWin = this._resolveWindow(conf);
|
|
7819
7475
|
if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
|
|
7820
7476
|
this.attachShadow({ mode: "open" });
|
|
7821
7477
|
}
|
|
7822
|
-
const conf = getElementConfig(this);
|
|
7823
|
-
const currentWin = this._resolveWindow(conf);
|
|
7824
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
7825
7478
|
this._executeSwcScript("swc-on-before-connected", hostSet);
|
|
7826
7479
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
7827
7480
|
if (bMethods) {
|
|
7828
7481
|
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
7829
7482
|
}
|
|
7830
|
-
attributeList.forEach((meta) => {
|
|
7831
|
-
if (meta.options.connectedInitialize === true) {
|
|
7832
|
-
this.__swc_syncing_init = true;
|
|
7833
|
-
try {
|
|
7834
|
-
const memoryVal = this[meta.privateKey];
|
|
7835
|
-
if (memoryVal !== void 0) {
|
|
7836
|
-
this[meta.propertyKey] = memoryVal;
|
|
7837
|
-
}
|
|
7838
|
-
} finally {
|
|
7839
|
-
this.__swc_syncing_init = false;
|
|
7840
|
-
}
|
|
7841
|
-
}
|
|
7842
|
-
});
|
|
7843
7483
|
if (connectedInnerHtmlList.length > 0) {
|
|
7844
7484
|
let sContent = "", lContent = "";
|
|
7845
7485
|
for (const meta of connectedInnerHtmlList) {
|
|
@@ -7975,6 +7615,9 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7975
7615
|
this._executeSwcScript("swc-on-connected", hostSet);
|
|
7976
7616
|
this._executeSwcScript("swc-on-after-connected", hostSet);
|
|
7977
7617
|
this.__swc_connected = true;
|
|
7618
|
+
if (appHost2 && typeof appHost2._connected === "function") {
|
|
7619
|
+
appHost2._connected(this);
|
|
7620
|
+
}
|
|
7978
7621
|
};
|
|
7979
7622
|
const originalDisconnected = proto.disconnectedCallback;
|
|
7980
7623
|
proto.disconnectedCallback = function() {
|
|
@@ -7996,6 +7639,10 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7996
7639
|
this._executeSwcScript("swc-on-disconnected", hostSet);
|
|
7997
7640
|
this._executeSwcScript("swc-on-after-disconnected", hostSet);
|
|
7998
7641
|
this.__swc_connected = false;
|
|
7642
|
+
const appHost2 = hostSet.$appHost;
|
|
7643
|
+
if (appHost2 && typeof appHost2._disconnected === "function") {
|
|
7644
|
+
appHost2._disconnected(this);
|
|
7645
|
+
}
|
|
7999
7646
|
};
|
|
8000
7647
|
const originalAdopted = proto.adoptedCallback;
|
|
8001
7648
|
proto.adoptedCallback = function() {
|
|
@@ -8044,1178 +7691,27 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
8044
7691
|
return constructor;
|
|
8045
7692
|
};
|
|
8046
7693
|
|
|
8047
|
-
// ../simple-boot/dist/esm/
|
|
8048
|
-
var
|
|
8049
|
-
|
|
8050
|
-
this.message = message;
|
|
8051
|
-
this.name = name;
|
|
8052
|
-
this.stack = stack;
|
|
8053
|
-
}
|
|
8054
|
-
};
|
|
7694
|
+
// ../simple-boot/dist/esm/decorators/SimDecorator.js
|
|
7695
|
+
var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
|
|
7696
|
+
var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
|
|
8055
7697
|
|
|
8056
|
-
// ../simple-boot/dist/esm/
|
|
8057
|
-
var
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
}
|
|
8061
|
-
};
|
|
7698
|
+
// ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
|
|
7699
|
+
var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
|
|
7700
|
+
var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
|
|
7701
|
+
var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
|
|
8062
7702
|
|
|
8063
|
-
// ../simple-boot/dist/esm/decorators/
|
|
8064
|
-
var
|
|
8065
|
-
Lifecycle2["Singleton"] = "Singleton";
|
|
8066
|
-
Lifecycle2["Transient"] = "Transient";
|
|
8067
|
-
return Lifecycle2;
|
|
8068
|
-
})(Lifecycle || {});
|
|
8069
|
-
var sims = /* @__PURE__ */ new Map();
|
|
8070
|
-
var containers = /* @__PURE__ */ new Set();
|
|
8071
|
-
var SimMetadataKey = Symbol("Sim");
|
|
8072
|
-
var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
|
|
8073
|
-
var simProcess = (config, inputTarget) => {
|
|
8074
|
-
const target = (() => {
|
|
8075
|
-
if (typeof inputTarget === "object") {
|
|
8076
|
-
return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
|
|
8077
|
-
}
|
|
8078
|
-
if (ValidUtils.isArrowFunction(inputTarget)) {
|
|
8079
|
-
return () => inputTarget();
|
|
8080
|
-
}
|
|
8081
|
-
return inputTarget;
|
|
8082
|
-
})();
|
|
8083
|
-
let targetType;
|
|
8084
|
-
if (isNotNullObjetInstance(target)) {
|
|
8085
|
-
targetType = target.constructor;
|
|
8086
|
-
} else {
|
|
8087
|
-
targetType = target;
|
|
8088
|
-
}
|
|
8089
|
-
config.scope = config?.scope ?? "Singleton";
|
|
8090
|
-
ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
|
|
8091
|
-
const adding = (targetKey, target2 = targetKey) => {
|
|
8092
|
-
const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
|
|
8093
|
-
items.add(target2);
|
|
8094
|
-
sims.set(targetKey, items);
|
|
8095
|
-
};
|
|
8096
|
-
if (Array.isArray(config?.type)) {
|
|
8097
|
-
config?.type.forEach((it) => {
|
|
8098
|
-
adding(it, target);
|
|
8099
|
-
});
|
|
8100
|
-
} else if (config.type) {
|
|
8101
|
-
adding(config?.type, target);
|
|
8102
|
-
} else {
|
|
8103
|
-
adding(target);
|
|
8104
|
-
}
|
|
8105
|
-
};
|
|
8106
|
-
function Sim(configOrTarget) {
|
|
8107
|
-
if (typeof configOrTarget === "function") {
|
|
8108
|
-
simProcess({}, configOrTarget);
|
|
8109
|
-
} else {
|
|
8110
|
-
return (target) => {
|
|
8111
|
-
simProcess(configOrTarget, target);
|
|
8112
|
-
};
|
|
8113
|
-
}
|
|
8114
|
-
}
|
|
8115
|
-
var getSim = (target) => {
|
|
8116
|
-
if (target != null && target !== void 0 && typeof target === "object") {
|
|
8117
|
-
target = Object.getPrototypeOf(target).constructor;
|
|
8118
|
-
}
|
|
8119
|
-
try {
|
|
8120
|
-
return ReflectUtils.getMetadata(SimMetadataKey, target);
|
|
8121
|
-
} catch (e) {
|
|
8122
|
-
}
|
|
8123
|
-
};
|
|
8124
|
-
var PostConstructMetadataKey = Symbol("PostConstruct");
|
|
8125
|
-
var getPostConstructs = (target) => {
|
|
8126
|
-
return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
|
|
8127
|
-
};
|
|
7703
|
+
// ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
|
|
7704
|
+
var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
|
|
8128
7705
|
|
|
8129
|
-
// ../simple-boot/dist/esm/
|
|
8130
|
-
var
|
|
8131
|
-
constructor(type, simstanceManager, config) {
|
|
8132
|
-
this.type = type;
|
|
8133
|
-
this.simstanceManager = simstanceManager;
|
|
8134
|
-
this.config = config;
|
|
8135
|
-
this.value = type.value;
|
|
8136
|
-
}
|
|
8137
|
-
getConfig(key = SimMetadataKey) {
|
|
8138
|
-
return ReflectUtils.getMetadata(key, this.type.originalType);
|
|
8139
|
-
}
|
|
8140
|
-
getConfigs() {
|
|
8141
|
-
return ReflectUtils.getMetadatas(this.type.originalType);
|
|
8142
|
-
}
|
|
8143
|
-
getValue(config) {
|
|
8144
|
-
if (config?.refresh) {
|
|
8145
|
-
this.value = void 0;
|
|
8146
|
-
}
|
|
8147
|
-
if (!this.value) {
|
|
8148
|
-
if (typeof this.type.targetKeyType === "symbol") {
|
|
8149
|
-
this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
|
|
8150
|
-
} else {
|
|
8151
|
-
this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
|
|
8152
|
-
}
|
|
8153
|
-
}
|
|
8154
|
-
return this.value;
|
|
8155
|
-
}
|
|
8156
|
-
};
|
|
7706
|
+
// ../simple-boot/dist/esm/decorators/SimNoProxy.js
|
|
7707
|
+
var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
|
|
8157
7708
|
|
|
8158
|
-
// ../simple-boot/dist/esm/
|
|
8159
|
-
var
|
|
8160
|
-
constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
|
|
8161
|
-
this.rootRouter = rootRouter;
|
|
8162
|
-
this.container = container;
|
|
8163
|
-
this.advice = advice;
|
|
8164
|
-
this.excludeProxys = excludeProxys;
|
|
8165
|
-
this.proxy = proxy;
|
|
8166
|
-
this.using = using;
|
|
8167
|
-
this.cache = cache;
|
|
8168
|
-
}
|
|
8169
|
-
addAdvicce(advice) {
|
|
8170
|
-
this.advice ?? (this.advice = []);
|
|
8171
|
-
this.advice.push(advice);
|
|
8172
|
-
}
|
|
8173
|
-
setAdvice(...advice) {
|
|
8174
|
-
this.advice = advice;
|
|
8175
|
-
return this;
|
|
8176
|
-
}
|
|
8177
|
-
};
|
|
7709
|
+
// ../simple-boot/dist/esm/decorators/inject/Injection.js
|
|
7710
|
+
var InjectionMetadataKey = Symbol("Injection");
|
|
8178
7711
|
|
|
8179
|
-
// ../simple-boot/dist/esm/decorators/
|
|
8180
|
-
var
|
|
8181
|
-
|
|
8182
|
-
this.target = target;
|
|
8183
|
-
this.metaData = metaData;
|
|
8184
|
-
}
|
|
8185
|
-
};
|
|
8186
|
-
var MetaDataPropertyAtomic = class extends MetaDataAtomic {
|
|
8187
|
-
constructor(target, metaData, property, parameter) {
|
|
8188
|
-
super(target, metaData);
|
|
8189
|
-
this.property = property;
|
|
8190
|
-
this.parameter = parameter;
|
|
8191
|
-
}
|
|
8192
|
-
call(...parameter) {
|
|
8193
|
-
return this.target[this.property](...parameter);
|
|
8194
|
-
}
|
|
8195
|
-
};
|
|
8196
|
-
|
|
8197
|
-
// ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
|
|
8198
|
-
var AfterMetadataKey = Symbol("After");
|
|
8199
|
-
var BeforeMetadataKey = Symbol("Before");
|
|
8200
|
-
var AroundMetadataKey = Symbol("Around");
|
|
8201
|
-
var getAfter = (target, propertyKey) => {
|
|
8202
|
-
return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
|
|
8203
|
-
};
|
|
8204
|
-
var getAfters = (target) => {
|
|
8205
|
-
return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
|
|
8206
|
-
};
|
|
8207
|
-
var getProtoAfters = (target, propertyKey, type) => {
|
|
8208
|
-
return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
|
|
8209
|
-
};
|
|
8210
|
-
var getBefore = (target, propertyKey) => {
|
|
8211
|
-
return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
|
|
8212
|
-
};
|
|
8213
|
-
var getBefores = (target) => {
|
|
8214
|
-
return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
|
|
8215
|
-
};
|
|
8216
|
-
var getProtoBefores = (target, propertyKey, type) => {
|
|
8217
|
-
return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
|
|
8218
|
-
};
|
|
8219
|
-
|
|
8220
|
-
// ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
|
|
8221
|
-
var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
|
|
8222
|
-
ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
|
|
8223
|
-
ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
|
|
8224
|
-
return ExceptionHandlerSituationType2;
|
|
8225
|
-
})(ExceptionHandlerSituationType || {});
|
|
8226
|
-
var ExceptionHandlerMetadataKey = Symbol("ExceptionHandler");
|
|
8227
|
-
var getExceptionHandlers = (target) => {
|
|
8228
|
-
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
8229
|
-
target = target.constructor;
|
|
8230
|
-
}
|
|
8231
|
-
return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
|
|
8232
|
-
};
|
|
8233
|
-
var targetExceptionHandlers = (target, error) => {
|
|
8234
|
-
const exceptionHandlers = getExceptionHandlers(target);
|
|
8235
|
-
const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
|
|
8236
|
-
const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
|
|
8237
|
-
const targetSorts = targets?.sort((a, b) => {
|
|
8238
|
-
const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
|
|
8239
|
-
const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
|
|
8240
|
-
return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
|
|
8241
|
-
});
|
|
8242
|
-
return (targetSorts ?? []).concat(...emptyTargets ?? []);
|
|
8243
|
-
};
|
|
8244
|
-
var targetExceptionHandler = (target, error, excludeMethods = []) => {
|
|
8245
|
-
let exceptionHandlers = targetExceptionHandlers(target, error);
|
|
8246
|
-
exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
|
|
8247
|
-
if (exceptionHandlers && exceptionHandlers.length > 0) {
|
|
8248
|
-
return exceptionHandlers[0];
|
|
8249
|
-
} else {
|
|
8250
|
-
return void 0;
|
|
8251
|
-
}
|
|
8252
|
-
};
|
|
8253
|
-
|
|
8254
|
-
// ../simple-boot/dist/esm/proxy/SimProxyHandler.js
|
|
8255
|
-
var SimProxyHandler = class {
|
|
8256
|
-
constructor(simpleApplication, simstanceManager, simOption) {
|
|
8257
|
-
this.simpleApplication = simpleApplication;
|
|
8258
|
-
this.simstanceManager = simstanceManager;
|
|
8259
|
-
this.simOption = simOption;
|
|
8260
|
-
}
|
|
8261
|
-
// 잘받게 해놨네 ㅋㅋ simstanceManager
|
|
8262
|
-
get(target, name) {
|
|
8263
|
-
if (name === "_SimpleBoot_application") {
|
|
8264
|
-
return this.simpleApplication;
|
|
8265
|
-
} else if (name === "_SimpleBoot_simstanceManager") {
|
|
8266
|
-
return this.simstanceManager;
|
|
8267
|
-
} else if (name === "_SimpleBoot_simOption") {
|
|
8268
|
-
return this.simOption;
|
|
8269
|
-
} else if (name === "_SimpleBoot_origin") {
|
|
8270
|
-
return target;
|
|
8271
|
-
} else {
|
|
8272
|
-
return target[name];
|
|
8273
|
-
}
|
|
8274
|
-
}
|
|
8275
|
-
set(obj, prop, value, receiver) {
|
|
8276
|
-
value = this.simstanceManager?.proxy(value);
|
|
8277
|
-
obj[prop] = value;
|
|
8278
|
-
return true;
|
|
8279
|
-
}
|
|
8280
|
-
apply(target, thisArg, argumentsList) {
|
|
8281
|
-
let r;
|
|
8282
|
-
try {
|
|
8283
|
-
this.aopBefore(thisArg, target);
|
|
8284
|
-
try {
|
|
8285
|
-
r = Reflect.apply(target, thisArg, argumentsList);
|
|
8286
|
-
} catch (e) {
|
|
8287
|
-
throw e;
|
|
8288
|
-
} finally {
|
|
8289
|
-
this.aopAfter(thisArg, target);
|
|
8290
|
-
}
|
|
8291
|
-
} catch (e) {
|
|
8292
|
-
console.error(e);
|
|
8293
|
-
const inHandlers = this.getExceptionHandler(e, thisArg, target);
|
|
8294
|
-
if (inHandlers.length > 0 && inHandlers[0]) {
|
|
8295
|
-
const inHandler = inHandlers[0];
|
|
8296
|
-
this.executeExceptionHandler(e, inHandler, argumentsList);
|
|
8297
|
-
} else {
|
|
8298
|
-
throw e;
|
|
8299
|
-
}
|
|
8300
|
-
}
|
|
8301
|
-
return r;
|
|
8302
|
-
}
|
|
8303
|
-
executeExceptionHandler(e, inHandler, argumentsList) {
|
|
8304
|
-
const otherStorage = /* @__PURE__ */ new Map();
|
|
8305
|
-
otherStorage.set(e.constructor, e);
|
|
8306
|
-
const situationErrorTypeContainer = new SituationTypeContainer({
|
|
8307
|
-
situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
|
|
8308
|
-
data: e
|
|
8309
|
-
});
|
|
8310
|
-
const situationParameterTypeContainer = new SituationTypeContainer({
|
|
8311
|
-
situationType: ExceptionHandlerSituationType.PARAMETER,
|
|
8312
|
-
data: argumentsList
|
|
8313
|
-
});
|
|
8314
|
-
otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
|
|
8315
|
-
argumentsList?.forEach((it) => {
|
|
8316
|
-
otherStorage.set(it.constructor, it);
|
|
8317
|
-
});
|
|
8318
|
-
try {
|
|
8319
|
-
this.simstanceManager.executeBindParameterSim(
|
|
8320
|
-
{
|
|
8321
|
-
target: inHandler.thisArg,
|
|
8322
|
-
targetKey: inHandler.config.propertyKey
|
|
8323
|
-
},
|
|
8324
|
-
otherStorage
|
|
8325
|
-
);
|
|
8326
|
-
} catch (es) {
|
|
8327
|
-
e = es;
|
|
8328
|
-
}
|
|
8329
|
-
if (inHandler.config.config.throw) {
|
|
8330
|
-
const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
|
|
8331
|
-
if ((exceptionHandler?.length ?? 0) > 0) {
|
|
8332
|
-
this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
|
|
8333
|
-
}
|
|
8334
|
-
}
|
|
8335
|
-
}
|
|
8336
|
-
getExceptionHandler(e, thisArg, target) {
|
|
8337
|
-
const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
|
|
8338
|
-
return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
|
|
8339
|
-
}) ?? [];
|
|
8340
|
-
const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
|
|
8341
|
-
const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
|
|
8342
|
-
return inHandlers;
|
|
8343
|
-
}
|
|
8344
|
-
aopBefore(obj, protoType) {
|
|
8345
|
-
const propertyName = ObjectUtils.prototypeName(obj, protoType);
|
|
8346
|
-
if (propertyName && obj) {
|
|
8347
|
-
getProtoBefores(obj, propertyName).forEach((it) => {
|
|
8348
|
-
it.call(obj, protoType, propertyName);
|
|
8349
|
-
});
|
|
8350
|
-
for (let i = 0; i < this.simOption.advice.length; i++) {
|
|
8351
|
-
const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
|
|
8352
|
-
const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
|
|
8353
|
-
protoBefores.forEach((it) => {
|
|
8354
|
-
it.call(obj, protoType, propertyName);
|
|
8355
|
-
});
|
|
8356
|
-
}
|
|
8357
|
-
}
|
|
8358
|
-
}
|
|
8359
|
-
aopAfter(obj, protoType) {
|
|
8360
|
-
const propertyName = ObjectUtils.prototypeName(obj, protoType);
|
|
8361
|
-
if (propertyName) {
|
|
8362
|
-
getProtoAfters(obj, propertyName).forEach((it) => {
|
|
8363
|
-
it.call(obj, protoType, propertyName);
|
|
8364
|
-
});
|
|
8365
|
-
for (let i = 0; i < this.simOption.advice.length; i++) {
|
|
8366
|
-
const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
|
|
8367
|
-
const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
|
|
8368
|
-
protoBefores.forEach((it) => {
|
|
8369
|
-
it.call(obj, protoType, propertyName);
|
|
8370
|
-
});
|
|
8371
|
-
}
|
|
8372
|
-
}
|
|
8373
|
-
}
|
|
8374
|
-
has(target, key) {
|
|
8375
|
-
if (key === "_SimpleBoot_isProxy") {
|
|
8376
|
-
return true;
|
|
8377
|
-
}
|
|
8378
|
-
return key in target;
|
|
8379
|
-
}
|
|
8380
|
-
};
|
|
8381
|
-
|
|
8382
|
-
// ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
|
|
8383
|
-
var isOnSimCreate = (obj) => {
|
|
8384
|
-
return typeof obj?.onSimCreate === "function";
|
|
8385
|
-
};
|
|
8386
|
-
|
|
8387
|
-
// ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
|
|
8388
|
-
var isOnSimCreateProxyCompleted = (obj) => {
|
|
8389
|
-
return typeof obj?.onSimCreateProxyCompleted === "function";
|
|
8390
|
-
};
|
|
8391
|
-
|
|
8392
|
-
// ../simple-boot/dist/esm/decorators/SimNoProxy.js
|
|
8393
|
-
var SimNoProxyKey = Symbol("Sim:NoProxy");
|
|
8394
|
-
var getSimNoProxy = (target, propertyKey) => {
|
|
8395
|
-
try {
|
|
8396
|
-
if (propertyKey === void 0) {
|
|
8397
|
-
return Reflect.getMetadata(SimNoProxyKey, target);
|
|
8398
|
-
}
|
|
8399
|
-
return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
|
|
8400
|
-
} catch (e) {
|
|
8401
|
-
return void 0;
|
|
8402
|
-
}
|
|
8403
|
-
};
|
|
8404
|
-
var isSimNoProxy = (target, propertyKey) => {
|
|
8405
|
-
if (target === null || target === void 0) {
|
|
8406
|
-
return false;
|
|
8407
|
-
}
|
|
8408
|
-
return getSimNoProxy(target, propertyKey) === true;
|
|
8409
|
-
};
|
|
8410
|
-
|
|
8411
|
-
// ../simple-boot/dist/esm/simstance/SimstanceManager.js
|
|
8412
|
-
var SimstanceManager = class _SimstanceManager {
|
|
8413
|
-
// private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
|
|
8414
|
-
constructor(simpleApplication, option) {
|
|
8415
|
-
this.simpleApplication = simpleApplication;
|
|
8416
|
-
this.option = option;
|
|
8417
|
-
this._storage = /* @__PURE__ */ new Map();
|
|
8418
|
-
this.name = "simstanceManager-" + RandomUtils.uuid4();
|
|
8419
|
-
this.setStoreSet(SimpleApplication, this.simpleApplication);
|
|
8420
|
-
this.setStoreSet(_SimstanceManager, this);
|
|
8421
|
-
this.setStoreSet(option.constructor, option);
|
|
8422
|
-
this.setStoreSet(SimOption, option);
|
|
8423
|
-
this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
|
|
8424
|
-
}
|
|
8425
|
-
get storage() {
|
|
8426
|
-
return this._storage;
|
|
8427
|
-
}
|
|
8428
|
-
getSimAtomics() {
|
|
8429
|
-
const r = [];
|
|
8430
|
-
Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
|
|
8431
|
-
r.push(
|
|
8432
|
-
...Array.from(Array.from(targetMap.keys())).map(
|
|
8433
|
-
(sit) => new SimAtomic(
|
|
8434
|
-
{
|
|
8435
|
-
targetKeyType,
|
|
8436
|
-
originalType: sit
|
|
8437
|
-
},
|
|
8438
|
-
this
|
|
8439
|
-
)
|
|
8440
|
-
)
|
|
8441
|
-
);
|
|
8442
|
-
});
|
|
8443
|
-
return r;
|
|
8444
|
-
}
|
|
8445
|
-
getSimConfig(schemeOrSymbol) {
|
|
8446
|
-
const newVar = this.getSimAtomics().filter((it) => {
|
|
8447
|
-
const config = it?.getConfig();
|
|
8448
|
-
const symbols = ConvertUtils.flatArray(config?.symbol);
|
|
8449
|
-
const schemes = ConvertUtils.flatArray(config?.scheme);
|
|
8450
|
-
if (typeof schemeOrSymbol === "symbol") {
|
|
8451
|
-
return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
|
|
8452
|
-
} else if (typeof schemeOrSymbol === "string") {
|
|
8453
|
-
return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
|
|
8454
|
-
} else {
|
|
8455
|
-
return false;
|
|
8456
|
-
}
|
|
8457
|
-
}) || [];
|
|
8458
|
-
return newVar;
|
|
8459
|
-
}
|
|
8460
|
-
findSims(data) {
|
|
8461
|
-
let r = [];
|
|
8462
|
-
if (data) {
|
|
8463
|
-
const simAtomics = this.getSimAtomics();
|
|
8464
|
-
r = simAtomics.filter((it) => {
|
|
8465
|
-
let b = false;
|
|
8466
|
-
const config = it.getConfig();
|
|
8467
|
-
const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
|
|
8468
|
-
const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
|
|
8469
|
-
if (typeof data === "symbol") {
|
|
8470
|
-
b = symbols.includes(data);
|
|
8471
|
-
} else {
|
|
8472
|
-
const { scheme, type } = data;
|
|
8473
|
-
b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
|
|
8474
|
-
}
|
|
8475
|
-
return b;
|
|
8476
|
-
});
|
|
8477
|
-
}
|
|
8478
|
-
return r;
|
|
8479
|
-
}
|
|
8480
|
-
findFirstSim(data) {
|
|
8481
|
-
if (typeof data === "symbol") {
|
|
8482
|
-
return this.findSims(data)[0];
|
|
8483
|
-
} else {
|
|
8484
|
-
return this.findSims(data)[0];
|
|
8485
|
-
}
|
|
8486
|
-
}
|
|
8487
|
-
findLastSim(data) {
|
|
8488
|
-
if (typeof data === "symbol") {
|
|
8489
|
-
return this.findSims(data).reverse()[0];
|
|
8490
|
-
} else {
|
|
8491
|
-
return this.findSims(data).reverse()[0];
|
|
8492
|
-
}
|
|
8493
|
-
}
|
|
8494
|
-
flatStoreSets() {
|
|
8495
|
-
return new Map(
|
|
8496
|
-
Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
|
|
8497
|
-
);
|
|
8498
|
-
}
|
|
8499
|
-
getStoreSets(targetKey) {
|
|
8500
|
-
const map = this.storage.get(targetKey);
|
|
8501
|
-
const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
|
|
8502
|
-
return datas.map((it) => ({ type: it[0], instance: it[1] }));
|
|
8503
|
-
}
|
|
8504
|
-
getStoreSet(targetKey, target) {
|
|
8505
|
-
const sets = this.getStoreSets(targetKey);
|
|
8506
|
-
let find = sets.find((it) => it.type === target);
|
|
8507
|
-
if (!find && (!target || target === targetKey)) {
|
|
8508
|
-
find = sets.find((it) => it.instance);
|
|
8509
|
-
}
|
|
8510
|
-
if (!find?.instance) {
|
|
8511
|
-
const type = target ?? targetKey;
|
|
8512
|
-
if (typeof type === "object") {
|
|
8513
|
-
const find2 = this.storage.get(type);
|
|
8514
|
-
if (find2) {
|
|
8515
|
-
return { type, instance: type };
|
|
8516
|
-
}
|
|
8517
|
-
}
|
|
8518
|
-
const flatStoreSets = this.flatStoreSets();
|
|
8519
|
-
const data = flatStoreSets.get(type);
|
|
8520
|
-
if (data) {
|
|
8521
|
-
this.setStoreSet(targetKey, data, type);
|
|
8522
|
-
}
|
|
8523
|
-
return { type, instance: data };
|
|
8524
|
-
} else {
|
|
8525
|
-
return find;
|
|
8526
|
-
}
|
|
8527
|
-
}
|
|
8528
|
-
getStoreInstance(targetKey, target) {
|
|
8529
|
-
return this.getStoreSet(targetKey, target)?.instance;
|
|
8530
|
-
}
|
|
8531
|
-
getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
|
|
8532
|
-
if (target) {
|
|
8533
|
-
const registed = this.getStoreSet(target, originTypeTarget);
|
|
8534
|
-
if (registed?.type && !registed?.instance) {
|
|
8535
|
-
return this.resolve({
|
|
8536
|
-
targetKey: target,
|
|
8537
|
-
target: originTypeTarget,
|
|
8538
|
-
newInstanceCarrier
|
|
8539
|
-
});
|
|
8540
|
-
}
|
|
8541
|
-
return registed?.instance;
|
|
8542
|
-
}
|
|
8543
|
-
}
|
|
8544
|
-
setStoreSet(targetKey, obj, target = targetKey) {
|
|
8545
|
-
const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
|
|
8546
|
-
itemMap.set(target, obj);
|
|
8547
|
-
this.storage.set(targetKey, itemMap);
|
|
8548
|
-
}
|
|
8549
|
-
registerStore(targetKey, regTyps) {
|
|
8550
|
-
const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
|
|
8551
|
-
regTyps.forEach((it) => {
|
|
8552
|
-
const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
|
|
8553
|
-
if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
|
|
8554
|
-
itemMap.set(type, value);
|
|
8555
|
-
}
|
|
8556
|
-
});
|
|
8557
|
-
this.storage.set(targetKey, itemMap);
|
|
8558
|
-
}
|
|
8559
|
-
// 진입점
|
|
8560
|
-
resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
|
|
8561
|
-
const registed = this.getStoreSet(targetKey, target);
|
|
8562
|
-
if (registed?.instance) {
|
|
8563
|
-
return registed.instance;
|
|
8564
|
-
}
|
|
8565
|
-
if (this.storage.has(targetKey) && void 0 === registed?.instance) {
|
|
8566
|
-
newInstanceCarrier.depth++;
|
|
8567
|
-
const newSim = this.newSim({
|
|
8568
|
-
target: registed?.type ?? targetKey,
|
|
8569
|
-
newInstanceCarrier,
|
|
8570
|
-
simCreateAfter: (data) => {
|
|
8571
|
-
if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
|
|
8572
|
-
this.setStoreSet(targetKey, data, target);
|
|
8573
|
-
}
|
|
8574
|
-
}
|
|
8575
|
-
});
|
|
8576
|
-
newInstanceCarrier.depth--;
|
|
8577
|
-
if (newInstanceCarrier.depth === 0) {
|
|
8578
|
-
newInstanceCarrier.newInstances.forEach((it) => {
|
|
8579
|
-
this.callBindPostConstruct(it);
|
|
8580
|
-
});
|
|
8581
|
-
}
|
|
8582
|
-
if (isOnSimCreate(newSim)) {
|
|
8583
|
-
newSim.onSimCreate();
|
|
8584
|
-
}
|
|
8585
|
-
return newSim;
|
|
8586
|
-
}
|
|
8587
|
-
const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
|
|
8588
|
-
console.error(simNoSuch);
|
|
8589
|
-
throw simNoSuch;
|
|
8590
|
-
}
|
|
8591
|
-
newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
|
|
8592
|
-
const parameters = this.getParameterSim({
|
|
8593
|
-
target,
|
|
8594
|
-
otherStorage,
|
|
8595
|
-
newInstanceCarrier
|
|
8596
|
-
});
|
|
8597
|
-
const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
|
|
8598
|
-
let p = this.proxy(r);
|
|
8599
|
-
const config = getSim(target);
|
|
8600
|
-
if (config?.proxy) {
|
|
8601
|
-
const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
|
|
8602
|
-
proxys.forEach((it) => {
|
|
8603
|
-
if (typeof it === "object") {
|
|
8604
|
-
p = new Proxy(p, it);
|
|
8605
|
-
} else {
|
|
8606
|
-
const simConfig = getSim(it);
|
|
8607
|
-
p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
|
|
8608
|
-
}
|
|
8609
|
-
});
|
|
8610
|
-
}
|
|
8611
|
-
newInstanceCarrier?.newInstances.push(p);
|
|
8612
|
-
simCreateAfter?.(p);
|
|
8613
|
-
if (isOnSimCreateProxyCompleted(p)) {
|
|
8614
|
-
p.onSimCreateProxyCompleted(p);
|
|
8615
|
-
}
|
|
8616
|
-
return p;
|
|
8617
|
-
}
|
|
8618
|
-
callBindPostConstruct(obj) {
|
|
8619
|
-
const postConstruct = getPostConstructs(obj);
|
|
8620
|
-
postConstruct.forEach((it) => {
|
|
8621
|
-
obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
|
|
8622
|
-
});
|
|
8623
|
-
}
|
|
8624
|
-
async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
|
|
8625
|
-
const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
|
|
8626
|
-
if (typeof target === "object" && targetKey) {
|
|
8627
|
-
const targetMethod = target[targetKey];
|
|
8628
|
-
return targetMethod?.bind(target)?.(...binds);
|
|
8629
|
-
} else if (typeof target === "function" && !targetKey) {
|
|
8630
|
-
return new target(...binds);
|
|
8631
|
-
}
|
|
8632
|
-
}
|
|
8633
|
-
executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
|
|
8634
|
-
const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
|
|
8635
|
-
if (typeof target === "object" && targetKey) {
|
|
8636
|
-
const targetMethod = target[targetKey];
|
|
8637
|
-
return targetMethod?.bind(target)?.(...binds);
|
|
8638
|
-
} else if (typeof target === "function" && !targetKey) {
|
|
8639
|
-
return new target(...binds);
|
|
8640
|
-
}
|
|
8641
|
-
}
|
|
8642
|
-
getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
|
|
8643
|
-
const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
|
|
8644
|
-
let injections = [];
|
|
8645
|
-
const injects = getInject(target, targetKey);
|
|
8646
|
-
const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
|
|
8647
|
-
const loopArray = new Array(loopCount).fill(void 0);
|
|
8648
|
-
injections = loopArray.map((_, idx) => {
|
|
8649
|
-
const token = paramTypes[idx];
|
|
8650
|
-
const saveInject = injects?.find((it) => it.index === idx);
|
|
8651
|
-
for (const f of firstCheckMaker ?? []) {
|
|
8652
|
-
const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
|
|
8653
|
-
if (void 0 !== firstCheckObj) {
|
|
8654
|
-
return firstCheckObj;
|
|
8655
|
-
}
|
|
8656
|
-
}
|
|
8657
|
-
if (saveInject) {
|
|
8658
|
-
const inject = saveInject.config;
|
|
8659
|
-
let obj = otherStorage?.get(token);
|
|
8660
|
-
if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
|
|
8661
|
-
const p = [];
|
|
8662
|
-
if (isTargetType(inject) && inject.type) {
|
|
8663
|
-
p.push(
|
|
8664
|
-
...this.getStoreSets(inject.type).map(
|
|
8665
|
-
(it) => this.resolve({
|
|
8666
|
-
targetKey: inject.type,
|
|
8667
|
-
target: it.type,
|
|
8668
|
-
newInstanceCarrier
|
|
8669
|
-
})
|
|
8670
|
-
).reverse()
|
|
8671
|
-
);
|
|
8672
|
-
}
|
|
8673
|
-
if (isTargetSymbol(inject)) {
|
|
8674
|
-
p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
|
|
8675
|
-
}
|
|
8676
|
-
if (isTargetScheme(inject)) {
|
|
8677
|
-
p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
|
|
8678
|
-
}
|
|
8679
|
-
return p;
|
|
8680
|
-
}
|
|
8681
|
-
if (inject.situationType && otherStorage) {
|
|
8682
|
-
const situations = otherStorage.get(SituationTypeContainers);
|
|
8683
|
-
const situation = otherStorage.get(SituationTypeContainer);
|
|
8684
|
-
if (inject.situationType === situation?.situationType) {
|
|
8685
|
-
obj = situation.data;
|
|
8686
|
-
} else if (situations && situations.length > 0) {
|
|
8687
|
-
const find = situations.find((a) => {
|
|
8688
|
-
if (a.index !== void 0) {
|
|
8689
|
-
return a.situationType === inject.situationType && a.index === idx;
|
|
8690
|
-
} else {
|
|
8691
|
-
return a.situationType === inject.situationType;
|
|
8692
|
-
}
|
|
8693
|
-
});
|
|
8694
|
-
if (find) {
|
|
8695
|
-
obj = find.data;
|
|
8696
|
-
}
|
|
8697
|
-
}
|
|
8698
|
-
}
|
|
8699
|
-
if (!obj) {
|
|
8700
|
-
const currentInstance = typeof target === "object" ? target : void 0;
|
|
8701
|
-
if (isTargetFactory(inject)) {
|
|
8702
|
-
obj = inject.factory({
|
|
8703
|
-
instance: currentInstance,
|
|
8704
|
-
methodName: String(targetKey),
|
|
8705
|
-
parameter: inputParameters,
|
|
8706
|
-
application: this.simpleApplication
|
|
8707
|
-
});
|
|
8708
|
-
} else {
|
|
8709
|
-
let findLastSim;
|
|
8710
|
-
if (isTargetSymbol(inject)) {
|
|
8711
|
-
findLastSim = this.findLastSim(inject.symbol);
|
|
8712
|
-
} else if (isTargetType(inject) || isTargetScheme(inject)) {
|
|
8713
|
-
findLastSim = this.findLastSim(inject);
|
|
8714
|
-
}
|
|
8715
|
-
try {
|
|
8716
|
-
obj = findLastSim ? this.resolve({
|
|
8717
|
-
targetKey: findLastSim?.type.targetKeyType ?? token,
|
|
8718
|
-
newInstanceCarrier
|
|
8719
|
-
}) : this.resolve({
|
|
8720
|
-
targetKey: token,
|
|
8721
|
-
newInstanceCarrier
|
|
8722
|
-
});
|
|
8723
|
-
if (inject.factory && obj) {
|
|
8724
|
-
if (typeof inject.factory === "function") {
|
|
8725
|
-
obj = inject.factory({
|
|
8726
|
-
instance: currentInstance,
|
|
8727
|
-
methodName: String(targetKey),
|
|
8728
|
-
parameter: inputParameters,
|
|
8729
|
-
application: this.simpleApplication,
|
|
8730
|
-
injectInstance: obj
|
|
8731
|
-
});
|
|
8732
|
-
}
|
|
8733
|
-
}
|
|
8734
|
-
} catch (e) {
|
|
8735
|
-
if (inject.optional) {
|
|
8736
|
-
return void 0;
|
|
8737
|
-
} else {
|
|
8738
|
-
throw e;
|
|
8739
|
-
}
|
|
8740
|
-
}
|
|
8741
|
-
}
|
|
8742
|
-
}
|
|
8743
|
-
if (inject.proxy && obj) {
|
|
8744
|
-
if (ValidUtils.isConstructor(inject.proxy)) {
|
|
8745
|
-
const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
|
|
8746
|
-
if (handler) {
|
|
8747
|
-
obj = new Proxy(obj, handler);
|
|
8748
|
-
}
|
|
8749
|
-
} else if (typeof inject.proxy === "function") {
|
|
8750
|
-
const handler = inject.proxy({
|
|
8751
|
-
application: this.simpleApplication,
|
|
8752
|
-
instance: obj
|
|
8753
|
-
});
|
|
8754
|
-
if (handler) {
|
|
8755
|
-
obj = new Proxy(obj, handler);
|
|
8756
|
-
}
|
|
8757
|
-
}
|
|
8758
|
-
}
|
|
8759
|
-
return obj;
|
|
8760
|
-
} else {
|
|
8761
|
-
return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
|
|
8762
|
-
}
|
|
8763
|
-
});
|
|
8764
|
-
return injections;
|
|
8765
|
-
}
|
|
8766
|
-
proxy(target) {
|
|
8767
|
-
try {
|
|
8768
|
-
const noProxy = isSimNoProxy(target);
|
|
8769
|
-
const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
|
|
8770
|
-
if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
|
|
8771
|
-
for (const key in target) {
|
|
8772
|
-
if (!isSimNoProxy(target, key)) {
|
|
8773
|
-
target[key] = this.proxy(target[key]);
|
|
8774
|
-
}
|
|
8775
|
-
}
|
|
8776
|
-
const protoTypeName = ObjectUtils.ownPropertyNames(target);
|
|
8777
|
-
protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
|
|
8778
|
-
target[it] = new Proxy(target[it], this.simProxyHandler);
|
|
8779
|
-
});
|
|
8780
|
-
if (this.simProxyHandler) {
|
|
8781
|
-
target = new Proxy(target, this.simProxyHandler);
|
|
8782
|
-
}
|
|
8783
|
-
}
|
|
8784
|
-
if (this.option.proxy) {
|
|
8785
|
-
target = this.option.proxy.onAfterProxy(target);
|
|
8786
|
-
}
|
|
8787
|
-
return target;
|
|
8788
|
-
} catch (e) {
|
|
8789
|
-
console.log("sim proxy error");
|
|
8790
|
-
throw e;
|
|
8791
|
-
}
|
|
8792
|
-
}
|
|
8793
|
-
run(otherInstanceSim = /* @__PURE__ */ new Map()) {
|
|
8794
|
-
for (const [k, v] of Array.from(otherInstanceSim.entries())) {
|
|
8795
|
-
if (typeof k === "symbol") {
|
|
8796
|
-
simProcess({ symbol: k }, v);
|
|
8797
|
-
} else if (typeof k === "object") {
|
|
8798
|
-
simProcess(k, v);
|
|
8799
|
-
} else {
|
|
8800
|
-
simProcess({ type: k }, v);
|
|
8801
|
-
}
|
|
8802
|
-
}
|
|
8803
|
-
const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
|
|
8804
|
-
Array.from(sims.entries()).forEach(([type, value]) => {
|
|
8805
|
-
const targetContainers = ConvertUtils.flatArray(getSim(type)?.container).filter(ValidUtils.isDefined);
|
|
8806
|
-
let isInclude = false;
|
|
8807
|
-
if (myContainers.length <= 0 && targetContainers.length <= 0) {
|
|
8808
|
-
isInclude = true;
|
|
8809
|
-
} else if (targetContainers.length <= 0) {
|
|
8810
|
-
isInclude = true;
|
|
8811
|
-
} else {
|
|
8812
|
-
isInclude = myContainers.some((it) => targetContainers.includes(it));
|
|
8813
|
-
}
|
|
8814
|
-
this.registerStore(type, value);
|
|
8815
|
-
});
|
|
8816
|
-
this.callBindPostConstruct(this);
|
|
8817
|
-
this.getSimAtomics().forEach((it) => {
|
|
8818
|
-
if (it.getConfig()?.autoCreate) {
|
|
8819
|
-
it.getValue();
|
|
8820
|
-
}
|
|
8821
|
-
});
|
|
8822
|
-
}
|
|
8823
|
-
};
|
|
8824
|
-
|
|
8825
|
-
// ../simple-boot/dist/esm/intent/Intent.js
|
|
8826
|
-
var Intent = class {
|
|
8827
|
-
constructor(uri, data, event) {
|
|
8828
|
-
this.uri = uri;
|
|
8829
|
-
this.data = data;
|
|
8830
|
-
this.event = event;
|
|
8831
|
-
this.sessionData = /* @__PURE__ */ new Map();
|
|
8832
|
-
if (typeof uri === "string") {
|
|
8833
|
-
const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
|
|
8834
|
-
if (match) {
|
|
8835
|
-
const symbol = Symbol.for(match[1]);
|
|
8836
|
-
this.uri = {
|
|
8837
|
-
symbol,
|
|
8838
|
-
uri: match[2]
|
|
8839
|
-
};
|
|
8840
|
-
}
|
|
8841
|
-
}
|
|
8842
|
-
}
|
|
8843
|
-
get symbols() {
|
|
8844
|
-
if (typeof this.uri === "object") {
|
|
8845
|
-
return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
|
|
8846
|
-
}
|
|
8847
|
-
return void 0;
|
|
8848
|
-
}
|
|
8849
|
-
get scheme() {
|
|
8850
|
-
if (typeof this.uri === "string") {
|
|
8851
|
-
const parts = this.uri.split("://");
|
|
8852
|
-
if (parts.length > 1) {
|
|
8853
|
-
return parts[0];
|
|
8854
|
-
}
|
|
8855
|
-
return void 0;
|
|
8856
|
-
} else {
|
|
8857
|
-
return void 0;
|
|
8858
|
-
}
|
|
8859
|
-
}
|
|
8860
|
-
get paths() {
|
|
8861
|
-
return this.pathname.split("/") ?? [];
|
|
8862
|
-
}
|
|
8863
|
-
get fullPath() {
|
|
8864
|
-
const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
|
|
8865
|
-
const paths = uri.split("://");
|
|
8866
|
-
return paths[paths.length >= 2 ? 1 : 0] ?? "";
|
|
8867
|
-
}
|
|
8868
|
-
get pathname() {
|
|
8869
|
-
const paths = this.fullPath.split("?");
|
|
8870
|
-
return paths[0];
|
|
8871
|
-
}
|
|
8872
|
-
get query() {
|
|
8873
|
-
const paths = this.fullPath.split("?");
|
|
8874
|
-
return paths[1] ?? "";
|
|
8875
|
-
}
|
|
8876
|
-
getQueryParamDecodeURI(key) {
|
|
8877
|
-
const p = this.queryParamsDecodeURI;
|
|
8878
|
-
if (key) {
|
|
8879
|
-
return p[key];
|
|
8880
|
-
} else {
|
|
8881
|
-
return p;
|
|
8882
|
-
}
|
|
8883
|
-
}
|
|
8884
|
-
getQueryParamDecodeURIFirst(key) {
|
|
8885
|
-
const param = this.getQueryParamDecodeURI(key);
|
|
8886
|
-
if (Array.isArray(param)) {
|
|
8887
|
-
return param[0];
|
|
8888
|
-
} else {
|
|
8889
|
-
return param;
|
|
8890
|
-
}
|
|
8891
|
-
}
|
|
8892
|
-
getQueryParam(key) {
|
|
8893
|
-
const p = this.queryParams;
|
|
8894
|
-
if (key) {
|
|
8895
|
-
return p[key];
|
|
8896
|
-
} else {
|
|
8897
|
-
return p;
|
|
8898
|
-
}
|
|
8899
|
-
}
|
|
8900
|
-
getQueryParamFirst(key) {
|
|
8901
|
-
const param = this.getQueryParam(key);
|
|
8902
|
-
if (Array.isArray(param)) {
|
|
8903
|
-
return param[0];
|
|
8904
|
-
} else {
|
|
8905
|
-
return param;
|
|
8906
|
-
}
|
|
8907
|
-
}
|
|
8908
|
-
get queryParams() {
|
|
8909
|
-
const param = {};
|
|
8910
|
-
this.query.split("&")?.forEach((it) => {
|
|
8911
|
-
const a = it.split("=");
|
|
8912
|
-
if (param[a[0]]) {
|
|
8913
|
-
if (Array.isArray(param[a[0]])) {
|
|
8914
|
-
param[a[0]].push(a[1]);
|
|
8915
|
-
} else {
|
|
8916
|
-
param[a[0]] = [param[a[0]], a[1]];
|
|
8917
|
-
}
|
|
8918
|
-
} else {
|
|
8919
|
-
param[a[0]] = a[1];
|
|
8920
|
-
}
|
|
8921
|
-
});
|
|
8922
|
-
return param;
|
|
8923
|
-
}
|
|
8924
|
-
get queryParamsDecodeURI() {
|
|
8925
|
-
const params = this.queryParams;
|
|
8926
|
-
for (const key in params) {
|
|
8927
|
-
if (params.hasOwnProperty(key)) {
|
|
8928
|
-
const param = params[key];
|
|
8929
|
-
if (Array.isArray(param)) {
|
|
8930
|
-
params[key] = param.map((p) => decodeURIComponent(p));
|
|
8931
|
-
} else {
|
|
8932
|
-
params[key] = decodeURIComponent(param);
|
|
8933
|
-
}
|
|
8934
|
-
}
|
|
8935
|
-
}
|
|
8936
|
-
return params;
|
|
8937
|
-
}
|
|
8938
|
-
getPathnameData(urlExpression) {
|
|
8939
|
-
return Expression.Path.pathNameData(this.pathname, urlExpression);
|
|
8940
|
-
}
|
|
8941
|
-
get isSymbolScheme() {
|
|
8942
|
-
return this.symbols !== void 0;
|
|
8943
|
-
}
|
|
8944
|
-
};
|
|
8945
|
-
|
|
8946
|
-
// ../simple-boot/dist/esm/intent/IntentSubscribe.js
|
|
8947
|
-
var isIntentSubscribe = (obj) => {
|
|
8948
|
-
return !!obj && typeof obj.intentSubscribe === "function";
|
|
8949
|
-
};
|
|
8950
|
-
|
|
8951
|
-
// ../simple-boot/dist/esm/intent/IntentManager.js
|
|
8952
|
-
var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
|
|
8953
|
-
var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
|
|
8954
|
-
var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
|
|
8955
|
-
var IntentManager = class {
|
|
8956
|
-
constructor(simpleApplication, simstanceManager, routerManager, simOption) {
|
|
8957
|
-
this.simpleApplication = simpleApplication;
|
|
8958
|
-
this.simstanceManager = simstanceManager;
|
|
8959
|
-
this.routerManager = routerManager;
|
|
8960
|
-
this.simOption = simOption;
|
|
8961
|
-
this.subject = new Subject();
|
|
8962
|
-
}
|
|
8963
|
-
get observable() {
|
|
8964
|
-
return this.subject.asObservable();
|
|
8965
|
-
}
|
|
8966
|
-
async makeIntentData(it, data) {
|
|
8967
|
-
const target = [];
|
|
8968
|
-
const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
|
|
8969
|
-
if (isRouterPublishType(it)) {
|
|
8970
|
-
it = it.router;
|
|
8971
|
-
}
|
|
8972
|
-
const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
|
|
8973
|
-
if (routerMatch && typeof it === "string") {
|
|
8974
|
-
const routerBasePath = routerMatch[1];
|
|
8975
|
-
const actualPath = routerMatch[2];
|
|
8976
|
-
const routerModule = await this.routerManager.routing(routerBasePath, {
|
|
8977
|
-
router: rootRouter
|
|
8978
|
-
});
|
|
8979
|
-
const instance = routerModule.getModuleInstance();
|
|
8980
|
-
if (instance) {
|
|
8981
|
-
target.push(instance);
|
|
8982
|
-
}
|
|
8983
|
-
it = new Intent(actualPath, data);
|
|
8984
|
-
} else if (isSymbolPublishType(it)) {
|
|
8985
|
-
it = new Intent({ symbol: it.symbol, uri: it.path }, data);
|
|
8986
|
-
} else if (isSchemePublishType(it)) {
|
|
8987
|
-
it = new Intent(`${it.scheme}://${it.path}`, data);
|
|
8988
|
-
} else if (typeof it === "string") {
|
|
8989
|
-
it = new Intent(it, data);
|
|
8990
|
-
}
|
|
8991
|
-
const intent = it;
|
|
8992
|
-
if (!routerMatch) {
|
|
8993
|
-
if (intent.symbols) {
|
|
8994
|
-
target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
|
|
8995
|
-
} else if (intent.scheme) {
|
|
8996
|
-
target.push(...this.simstanceManager.getSimConfig(intent.scheme));
|
|
8997
|
-
} else {
|
|
8998
|
-
target.push(...this.simstanceManager.getSimAtomics());
|
|
8999
|
-
}
|
|
9000
|
-
}
|
|
9001
|
-
return { intent, target };
|
|
9002
|
-
}
|
|
9003
|
-
async publishMeta(it, data) {
|
|
9004
|
-
const { intent, target } = await this.makeIntentData(it, data);
|
|
9005
|
-
const r = [];
|
|
9006
|
-
const targetInstances = target.map((it2) => {
|
|
9007
|
-
if (it2 instanceof SimAtomic) {
|
|
9008
|
-
return it2.getValue();
|
|
9009
|
-
} else {
|
|
9010
|
-
return it2;
|
|
9011
|
-
}
|
|
9012
|
-
});
|
|
9013
|
-
this.subject.next(intent);
|
|
9014
|
-
for (let data2 of targetInstances) {
|
|
9015
|
-
let orNewSim = data2;
|
|
9016
|
-
if (orNewSim) {
|
|
9017
|
-
const filteredPaths = intent.paths.filter((i) => i);
|
|
9018
|
-
if (filteredPaths.length > 0) {
|
|
9019
|
-
let callthis = orNewSim;
|
|
9020
|
-
let lastProp = "";
|
|
9021
|
-
filteredPaths.forEach((i) => {
|
|
9022
|
-
callthis = orNewSim;
|
|
9023
|
-
orNewSim = orNewSim?.[i];
|
|
9024
|
-
lastProp = i;
|
|
9025
|
-
});
|
|
9026
|
-
if (orNewSim && typeof orNewSim === "function") {
|
|
9027
|
-
const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
|
|
9028
|
-
const result = await this.simstanceManager.executeBindParameterSimPromise({
|
|
9029
|
-
target: callthis,
|
|
9030
|
-
targetKey: lastProp,
|
|
9031
|
-
parameterCount: intentData.length,
|
|
9032
|
-
inputParameters: intentData,
|
|
9033
|
-
firstCheckMaker: [
|
|
9034
|
-
(obj, token, idx) => {
|
|
9035
|
-
if (idx < intentData.length) {
|
|
9036
|
-
return intentData[idx];
|
|
9037
|
-
}
|
|
9038
|
-
if (token === Intent && idx === 0) {
|
|
9039
|
-
return intent;
|
|
9040
|
-
}
|
|
9041
|
-
}
|
|
9042
|
-
]
|
|
9043
|
-
});
|
|
9044
|
-
r.push(result);
|
|
9045
|
-
} else if (orNewSim) {
|
|
9046
|
-
callthis[lastProp] = intent.data;
|
|
9047
|
-
r.push(callthis[lastProp]);
|
|
9048
|
-
}
|
|
9049
|
-
} else {
|
|
9050
|
-
const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
|
|
9051
|
-
if (isIntentSubscribe(orNewSim)) {
|
|
9052
|
-
r.push(orNewSim.intentSubscribe(...intentData));
|
|
9053
|
-
}
|
|
9054
|
-
}
|
|
9055
|
-
}
|
|
9056
|
-
}
|
|
9057
|
-
return { return: r, target };
|
|
9058
|
-
}
|
|
9059
|
-
async publish(it, data) {
|
|
9060
|
-
const rdata = await this.publishMeta(it, data);
|
|
9061
|
-
return rdata.return;
|
|
9062
|
-
}
|
|
9063
|
-
};
|
|
9064
|
-
|
|
9065
|
-
// ../simple-boot/dist/esm/decorators/inject/Injection.js
|
|
9066
|
-
var InjectionMetadataKey = Symbol("Injection");
|
|
9067
|
-
var getInjection = (target, propertyKey) => {
|
|
9068
|
-
return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
|
|
9069
|
-
};
|
|
9070
|
-
|
|
9071
|
-
// ../simple-boot/dist/esm/throwable/MethodNoSuch.js
|
|
9072
|
-
var MethodNoSuch = class extends SimError {
|
|
9073
|
-
constructor(message, name, propertyKeys, stack) {
|
|
9074
|
-
super(message, name, stack);
|
|
9075
|
-
this.propertyKeys = propertyKeys;
|
|
9076
|
-
}
|
|
9077
|
-
};
|
|
9078
|
-
|
|
9079
|
-
// ../simple-boot/dist/esm/decorators/route/Router.js
|
|
9080
|
-
var RouterMetadataKey = Symbol("Router");
|
|
9081
|
-
var getRouter = (target) => {
|
|
9082
|
-
if (target != null && typeof target === "object") {
|
|
9083
|
-
target = target.constructor;
|
|
9084
|
-
}
|
|
9085
|
-
try {
|
|
9086
|
-
return ReflectUtils.getMetadata(RouterMetadataKey, target);
|
|
9087
|
-
} catch (e) {
|
|
9088
|
-
}
|
|
9089
|
-
};
|
|
9090
|
-
var RouteMetadataKey = Symbol("RouteMetadataKey");
|
|
9091
|
-
|
|
9092
|
-
// ../simple-boot/dist/esm/route/RouterModule.js
|
|
9093
|
-
var RouterModule = class {
|
|
9094
|
-
constructor(simstanceManager, router, module, routerChains = []) {
|
|
9095
|
-
this.simstanceManager = simstanceManager;
|
|
9096
|
-
this.router = router;
|
|
9097
|
-
this.module = module;
|
|
9098
|
-
this.routerChains = routerChains;
|
|
9099
|
-
}
|
|
9100
|
-
get path() {
|
|
9101
|
-
return this._path;
|
|
9102
|
-
}
|
|
9103
|
-
set path(value) {
|
|
9104
|
-
this._path = value;
|
|
9105
|
-
}
|
|
9106
|
-
get data() {
|
|
9107
|
-
return this._data;
|
|
9108
|
-
}
|
|
9109
|
-
set data(value) {
|
|
9110
|
-
this._data = value;
|
|
9111
|
-
}
|
|
9112
|
-
get intent() {
|
|
9113
|
-
return this._intent;
|
|
9114
|
-
}
|
|
9115
|
-
set intent(value) {
|
|
9116
|
-
this._intent = value;
|
|
9117
|
-
}
|
|
9118
|
-
get propertyKeys() {
|
|
9119
|
-
return this._propertyKeys;
|
|
9120
|
-
}
|
|
9121
|
-
set propertyKeys(value) {
|
|
9122
|
-
this._propertyKeys = value;
|
|
9123
|
-
}
|
|
9124
|
-
get pathData() {
|
|
9125
|
-
return this._pathData;
|
|
9126
|
-
}
|
|
9127
|
-
getPathData() {
|
|
9128
|
-
return this._pathData;
|
|
9129
|
-
}
|
|
9130
|
-
set pathData(value) {
|
|
9131
|
-
this._pathData = value;
|
|
9132
|
-
}
|
|
9133
|
-
getRouterPath(join = "") {
|
|
9134
|
-
return this.getRouterPaths().map((it) => it ?? "").join(join);
|
|
9135
|
-
}
|
|
9136
|
-
getRouterPaths() {
|
|
9137
|
-
return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
|
|
9138
|
-
}
|
|
9139
|
-
getRouterPathData(pathName) {
|
|
9140
|
-
return Expression.Path.pathNameData(pathName, this.getRouterPath());
|
|
9141
|
-
}
|
|
9142
|
-
getModuleInstance(propertyKey, instanceBind = true) {
|
|
9143
|
-
const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
|
|
9144
|
-
if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
|
|
9145
|
-
let instanceElement = instance[propertyKey];
|
|
9146
|
-
if (instanceBind && typeof instanceBind === "boolean") {
|
|
9147
|
-
instanceElement = instanceElement.bind(instance);
|
|
9148
|
-
} else if (instanceBind && typeof instanceBind === "object") {
|
|
9149
|
-
instanceElement = instanceElement.bind(instanceBind);
|
|
9150
|
-
}
|
|
9151
|
-
return instanceElement;
|
|
9152
|
-
} else {
|
|
9153
|
-
return instance;
|
|
9154
|
-
}
|
|
9155
|
-
}
|
|
9156
|
-
executeModuleProperty(propertyKey, ...param) {
|
|
9157
|
-
const target = this.getModuleInstance();
|
|
9158
|
-
if (propertyKey) {
|
|
9159
|
-
const config = getInjection(target, propertyKey);
|
|
9160
|
-
if (config) {
|
|
9161
|
-
const other = /* @__PURE__ */ new Map();
|
|
9162
|
-
param.forEach((it) => other.set(it.constructor, it));
|
|
9163
|
-
return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
|
|
9164
|
-
} else {
|
|
9165
|
-
if (target[propertyKey]) {
|
|
9166
|
-
return target[propertyKey]?.(...param);
|
|
9167
|
-
} else {
|
|
9168
|
-
throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
|
|
9169
|
-
}
|
|
9170
|
-
}
|
|
9171
|
-
}
|
|
9172
|
-
}
|
|
9173
|
-
get firstRouteChain() {
|
|
9174
|
-
return this.routerChains[0];
|
|
9175
|
-
}
|
|
9176
|
-
get firstRouteChainValue() {
|
|
9177
|
-
return this.firstRouteChain?.getValue();
|
|
9178
|
-
}
|
|
9179
|
-
get lastRouteChain() {
|
|
9180
|
-
return this.routerChains[this.routerChains.length - 1];
|
|
9181
|
-
}
|
|
9182
|
-
get lastRouteChainValue() {
|
|
9183
|
-
return this.lastRouteChain?.getValue();
|
|
9184
|
-
}
|
|
9185
|
-
hasActivateInLastRoute(obj) {
|
|
9186
|
-
return this.lastRouteChainValue?.hasActivate(obj) === true;
|
|
9187
|
-
}
|
|
9188
|
-
getQueryParamDecodeURI(key) {
|
|
9189
|
-
if (this.intent) {
|
|
9190
|
-
return this.intent.getQueryParamDecodeURI(key);
|
|
9191
|
-
}
|
|
9192
|
-
}
|
|
9193
|
-
getQueryParamDecodeURIFirst(key) {
|
|
9194
|
-
if (this.intent) {
|
|
9195
|
-
return this.intent.getQueryParamDecodeURIFirst(key);
|
|
9196
|
-
}
|
|
9197
|
-
}
|
|
9198
|
-
getQueryParam(key) {
|
|
9199
|
-
if (this.intent) {
|
|
9200
|
-
return this.intent.getQueryParam(key);
|
|
9201
|
-
}
|
|
9202
|
-
}
|
|
9203
|
-
getQueryParamFirst(key) {
|
|
9204
|
-
if (this.intent) {
|
|
9205
|
-
return this.intent.getQueryParamFirst(key);
|
|
9206
|
-
}
|
|
9207
|
-
}
|
|
9208
|
-
get queryParams() {
|
|
9209
|
-
if (this.intent) {
|
|
9210
|
-
return this.intent.queryParams;
|
|
9211
|
-
}
|
|
9212
|
-
}
|
|
9213
|
-
get queryParamsAfterDecodeURI() {
|
|
9214
|
-
if (this.intent) {
|
|
9215
|
-
return this.intent.queryParamsDecodeURI;
|
|
9216
|
-
}
|
|
9217
|
-
}
|
|
9218
|
-
};
|
|
7712
|
+
// ../simple-boot/dist/esm/decorators/route/Router.js
|
|
7713
|
+
var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
|
|
7714
|
+
var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
|
|
9219
7715
|
|
|
9220
7716
|
// ../simple-boot/dist/esm/route/RouterAction.js
|
|
9221
7717
|
var RouterAction;
|
|
@@ -9231,435 +7727,6 @@ var RouterAction;
|
|
|
9231
7727
|
};
|
|
9232
7728
|
})(RouterAction || (RouterAction = {}));
|
|
9233
7729
|
|
|
9234
|
-
// ../simple-boot/dist/esm/route/RouterManager.js
|
|
9235
|
-
var RouterManager = class {
|
|
9236
|
-
constructor(simpleApplication, simstanceManager, simOption) {
|
|
9237
|
-
this.simpleApplication = simpleApplication;
|
|
9238
|
-
this.simstanceManager = simstanceManager;
|
|
9239
|
-
this.simOption = simOption;
|
|
9240
|
-
this.subject = new Subject();
|
|
9241
|
-
}
|
|
9242
|
-
// @SimNoProxy
|
|
9243
|
-
get observable() {
|
|
9244
|
-
return this.subject.asObservable();
|
|
9245
|
-
}
|
|
9246
|
-
routingMap(option) {
|
|
9247
|
-
const targetRouter = option?.router ?? this.simOption.rootRouter;
|
|
9248
|
-
if (!targetRouter) {
|
|
9249
|
-
throw new Error("no router");
|
|
9250
|
-
}
|
|
9251
|
-
const map = {};
|
|
9252
|
-
if (targetRouter) {
|
|
9253
|
-
const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
|
|
9254
|
-
const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
|
|
9255
|
-
const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
|
|
9256
|
-
const routerData = routerAtomic.getConfig(RouterMetadataKey);
|
|
9257
|
-
if (routerData) {
|
|
9258
|
-
const currentPrefix = (option?.prefix ?? "") + routerData.path;
|
|
9259
|
-
if (routerData.route && routerData.route[""]) {
|
|
9260
|
-
map[currentPrefix] = routerData.route[""];
|
|
9261
|
-
}
|
|
9262
|
-
if (routerData.route) {
|
|
9263
|
-
Object.entries(routerData.route).forEach(([key, value]) => {
|
|
9264
|
-
map[currentPrefix + key] = value;
|
|
9265
|
-
});
|
|
9266
|
-
}
|
|
9267
|
-
routerData.routers?.forEach((it) => {
|
|
9268
|
-
Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
|
|
9269
|
-
});
|
|
9270
|
-
}
|
|
9271
|
-
}
|
|
9272
|
-
return map;
|
|
9273
|
-
}
|
|
9274
|
-
/** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
|
|
9275
|
-
* @deprecated
|
|
9276
|
-
*/
|
|
9277
|
-
async routings(intent, option) {
|
|
9278
|
-
const targetRouter = option?.router ?? this.simOption.rootRouter;
|
|
9279
|
-
if (!targetRouter) {
|
|
9280
|
-
throw new Error("no router");
|
|
9281
|
-
}
|
|
9282
|
-
const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
|
|
9283
|
-
const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
|
|
9284
|
-
const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
|
|
9285
|
-
const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
|
|
9286
|
-
const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
|
|
9287
|
-
if (exactModuleMatches.length > 0) {
|
|
9288
|
-
exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
|
|
9289
|
-
return exactModuleMatches;
|
|
9290
|
-
}
|
|
9291
|
-
const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
|
|
9292
|
-
if (exactPathMatches.length > 0) {
|
|
9293
|
-
exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
|
|
9294
|
-
return exactPathMatches;
|
|
9295
|
-
}
|
|
9296
|
-
return [];
|
|
9297
|
-
}
|
|
9298
|
-
async routing(intent, option) {
|
|
9299
|
-
if (typeof intent === "string") {
|
|
9300
|
-
intent = new Intent(intent);
|
|
9301
|
-
}
|
|
9302
|
-
const targetRouter = option?.router ?? this.simOption.rootRouter;
|
|
9303
|
-
const callCheckOnRouting = option?.noOnRouting !== true;
|
|
9304
|
-
if (!targetRouter) {
|
|
9305
|
-
debugger;
|
|
9306
|
-
throw new Error("no router");
|
|
9307
|
-
}
|
|
9308
|
-
const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
|
|
9309
|
-
const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
|
|
9310
|
-
const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
|
|
9311
|
-
const rootRouter = routerAtomic.getValue();
|
|
9312
|
-
const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
|
|
9313
|
-
if (executeModuleResult) {
|
|
9314
|
-
const [executeModule, routerChains] = executeModuleResult;
|
|
9315
|
-
executeModule.routerChains = routerChains;
|
|
9316
|
-
this.activeRouterModule = executeModule;
|
|
9317
|
-
const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
|
|
9318
|
-
if (routerChains.length > 0) {
|
|
9319
|
-
for (let i = 0; i < routerChains.length; i++) {
|
|
9320
|
-
const current = routerChains[i];
|
|
9321
|
-
const next = routerChains[i + 1];
|
|
9322
|
-
const value = current.getValue();
|
|
9323
|
-
if (RouterAction.isCanActivate(value) && next) {
|
|
9324
|
-
await value.canActivate(routingDataSet, next.getValue());
|
|
9325
|
-
}
|
|
9326
|
-
if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
|
|
9327
|
-
await value.onRouting(routingDataSet);
|
|
9328
|
-
}
|
|
9329
|
-
}
|
|
9330
|
-
}
|
|
9331
|
-
this.activeRouterModule = executeModule;
|
|
9332
|
-
const moduleInstance = executeModule.getModuleInstance();
|
|
9333
|
-
if (!executeModule?.module) {
|
|
9334
|
-
const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
|
|
9335
|
-
const value = routerChain?.getValue();
|
|
9336
|
-
if (RouterAction.isCanActivate(value)) {
|
|
9337
|
-
await value.canActivate(routingDataSet, moduleInstance);
|
|
9338
|
-
}
|
|
9339
|
-
if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
|
|
9340
|
-
await value.onRouting(routingDataSet);
|
|
9341
|
-
}
|
|
9342
|
-
} else {
|
|
9343
|
-
const value = executeModule.router?.getValue();
|
|
9344
|
-
if (RouterAction.isCanActivate(value)) {
|
|
9345
|
-
await value.canActivate(routingDataSet, moduleInstance);
|
|
9346
|
-
}
|
|
9347
|
-
if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
|
|
9348
|
-
await value.onRouting(routingDataSet);
|
|
9349
|
-
}
|
|
9350
|
-
if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
|
|
9351
|
-
await moduleInstance.onRouting(routingDataSet);
|
|
9352
|
-
}
|
|
9353
|
-
}
|
|
9354
|
-
const find = this.activeRouterModule;
|
|
9355
|
-
this.subject.next({ intent, routerModule: find, routerManager: this });
|
|
9356
|
-
return find;
|
|
9357
|
-
} else {
|
|
9358
|
-
const empty = await this._handleNotFoundRouting(rootRouter, intent);
|
|
9359
|
-
this.subject.next({ intent, routerModule: empty, routerManager: this });
|
|
9360
|
-
return empty;
|
|
9361
|
-
}
|
|
9362
|
-
}
|
|
9363
|
-
/**
|
|
9364
|
-
* URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
|
|
9365
|
-
* "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
|
|
9366
|
-
* 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
|
|
9367
|
-
* @param rootRouter 앱의 최상위 라우터 인스턴스
|
|
9368
|
-
* @param intent 확인에 실패한 원본 Intent 객체
|
|
9369
|
-
* @private
|
|
9370
|
-
*/
|
|
9371
|
-
async _handleNotFoundRouting(rootRouter, intent) {
|
|
9372
|
-
const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
|
|
9373
|
-
const routingDataSet = { intent, routerModule, routerManager: this };
|
|
9374
|
-
const value = rootRouter;
|
|
9375
|
-
if (RouterAction.isCanActivate(value)) {
|
|
9376
|
-
await value.canActivate(routingDataSet, null);
|
|
9377
|
-
}
|
|
9378
|
-
if (RouterAction.isOnRouting(value)) {
|
|
9379
|
-
await value.onRouting(routingDataSet);
|
|
9380
|
-
}
|
|
9381
|
-
this.activeRouterModule = routerModule;
|
|
9382
|
-
return this.activeRouterModule;
|
|
9383
|
-
}
|
|
9384
|
-
getExecuteModule(router, intent, parentRouters, option) {
|
|
9385
|
-
const path = intent.pathname;
|
|
9386
|
-
const routerConfig = router.getConfig(RouterMetadataKey);
|
|
9387
|
-
if (routerConfig) {
|
|
9388
|
-
const filters = [];
|
|
9389
|
-
if (Array.isArray(routerConfig.filters)) {
|
|
9390
|
-
filters.push(...routerConfig.filters);
|
|
9391
|
-
} else if (routerConfig.filters) {
|
|
9392
|
-
filters.push(routerConfig.filters);
|
|
9393
|
-
}
|
|
9394
|
-
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9395
|
-
if (noAccept) {
|
|
9396
|
-
return;
|
|
9397
|
-
}
|
|
9398
|
-
const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
|
|
9399
|
-
const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
|
|
9400
|
-
if (isRoot) {
|
|
9401
|
-
const currentParentRouters = [...parentRouters, router];
|
|
9402
|
-
if (routerConfig.routers && routerConfig.routers.length > 0) {
|
|
9403
|
-
let bestMatchModule = void 0;
|
|
9404
|
-
let bestMatchLength = -1;
|
|
9405
|
-
for (const child of routerConfig.routers) {
|
|
9406
|
-
const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
|
|
9407
|
-
if (!routerAtomic) {
|
|
9408
|
-
continue;
|
|
9409
|
-
}
|
|
9410
|
-
const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
|
|
9411
|
-
if (executeModule) {
|
|
9412
|
-
const [rm, chains] = executeModule;
|
|
9413
|
-
const currentMatchLength = rm.path?.length || 0;
|
|
9414
|
-
if (currentMatchLength > bestMatchLength) {
|
|
9415
|
-
bestMatchLength = currentMatchLength;
|
|
9416
|
-
bestMatchModule = executeModule;
|
|
9417
|
-
} else if (currentMatchLength === bestMatchLength) {
|
|
9418
|
-
if (option?.find?.router === "last") {
|
|
9419
|
-
bestMatchModule = executeModule;
|
|
9420
|
-
}
|
|
9421
|
-
}
|
|
9422
|
-
}
|
|
9423
|
-
}
|
|
9424
|
-
if (bestMatchModule) {
|
|
9425
|
-
return bestMatchModule;
|
|
9426
|
-
}
|
|
9427
|
-
}
|
|
9428
|
-
const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
|
|
9429
|
-
if (module) {
|
|
9430
|
-
return [module, currentParentRouters];
|
|
9431
|
-
}
|
|
9432
|
-
}
|
|
9433
|
-
}
|
|
9434
|
-
}
|
|
9435
|
-
// path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
|
|
9436
|
-
isRootUrl(path, parentRoots, url) {
|
|
9437
|
-
const searchString = parentRoots.join("") + (path || "");
|
|
9438
|
-
if (searchString === "/") {
|
|
9439
|
-
return true;
|
|
9440
|
-
}
|
|
9441
|
-
const searchs = searchString.split("/");
|
|
9442
|
-
const urls = url.split("/");
|
|
9443
|
-
const trimmedUrls = urls.slice(0, searchs.length).join("/");
|
|
9444
|
-
return !!Expression.Path.pathNameData(trimmedUrls, searchString);
|
|
9445
|
-
}
|
|
9446
|
-
_collectAllMatchingModules(router, intent, parentRouters) {
|
|
9447
|
-
const matches = [];
|
|
9448
|
-
const path = intent.pathname;
|
|
9449
|
-
const routerConfig = router.getConfig(RouterMetadataKey);
|
|
9450
|
-
if (routerConfig) {
|
|
9451
|
-
const filters = [];
|
|
9452
|
-
if (Array.isArray(routerConfig.filters)) {
|
|
9453
|
-
filters.push(...routerConfig.filters);
|
|
9454
|
-
} else if (routerConfig.filters) {
|
|
9455
|
-
filters.push(routerConfig.filters);
|
|
9456
|
-
}
|
|
9457
|
-
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9458
|
-
if (noAccept) {
|
|
9459
|
-
return matches;
|
|
9460
|
-
}
|
|
9461
|
-
const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
|
|
9462
|
-
const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
|
|
9463
|
-
if (isRoot) {
|
|
9464
|
-
const currentParentRouters = [...parentRouters, router];
|
|
9465
|
-
if (routerConfig.routers && routerConfig.routers.length > 0) {
|
|
9466
|
-
for (const child of routerConfig.routers) {
|
|
9467
|
-
const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
|
|
9468
|
-
if (!routerAtomic) {
|
|
9469
|
-
continue;
|
|
9470
|
-
}
|
|
9471
|
-
matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
|
|
9472
|
-
}
|
|
9473
|
-
}
|
|
9474
|
-
const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
|
|
9475
|
-
if (module) {
|
|
9476
|
-
module.routerChains = currentParentRouters;
|
|
9477
|
-
matches.push(module);
|
|
9478
|
-
}
|
|
9479
|
-
}
|
|
9480
|
-
}
|
|
9481
|
-
return matches;
|
|
9482
|
-
}
|
|
9483
|
-
findRouterOrModule(router, routerData, parentRoots, intent) {
|
|
9484
|
-
const module = this.findRouting(router, routerData, parentRoots, intent);
|
|
9485
|
-
if (module?.module) {
|
|
9486
|
-
module.intent = intent;
|
|
9487
|
-
return module;
|
|
9488
|
-
}
|
|
9489
|
-
const urlRoot = parentRoots.join("") + (routerData.path || "");
|
|
9490
|
-
if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
|
|
9491
|
-
const rm = new RouterModule(this.simstanceManager, router);
|
|
9492
|
-
rm.intent = intent;
|
|
9493
|
-
rm.path = urlRoot;
|
|
9494
|
-
rm.pathData = intent.getPathnameData(urlRoot);
|
|
9495
|
-
return rm;
|
|
9496
|
-
}
|
|
9497
|
-
return void 0;
|
|
9498
|
-
}
|
|
9499
|
-
findRouting(router, routerData, parentRoots, intent) {
|
|
9500
|
-
const urlRoot = parentRoots.join("") + routerData.path;
|
|
9501
|
-
if (routerData.route) {
|
|
9502
|
-
for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
|
|
9503
|
-
const path = urlRoot + it;
|
|
9504
|
-
const pathnameData = intent.getPathnameData(path);
|
|
9505
|
-
if (pathnameData) {
|
|
9506
|
-
try {
|
|
9507
|
-
const dataSet = this.findRouteProperty(routerData.route, it, intent);
|
|
9508
|
-
const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
|
|
9509
|
-
rm.data = dataSet.data;
|
|
9510
|
-
rm.path = path;
|
|
9511
|
-
rm.pathData = pathnameData;
|
|
9512
|
-
rm.propertyKeys = dataSet.propertyKeys;
|
|
9513
|
-
return rm;
|
|
9514
|
-
} catch (e) {
|
|
9515
|
-
}
|
|
9516
|
-
}
|
|
9517
|
-
}
|
|
9518
|
-
}
|
|
9519
|
-
}
|
|
9520
|
-
findRouteProperty(route, propertyName, intent) {
|
|
9521
|
-
let child;
|
|
9522
|
-
let data;
|
|
9523
|
-
let propertyKeys;
|
|
9524
|
-
const routeElement = route[propertyName];
|
|
9525
|
-
if (typeof routeElement === "function") {
|
|
9526
|
-
child = { targetKeyType: routeElement, originalType: routeElement };
|
|
9527
|
-
} else if (typeof routeElement === "symbol") {
|
|
9528
|
-
const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
|
|
9529
|
-
if (findSimType?.originalType) {
|
|
9530
|
-
child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
|
|
9531
|
-
}
|
|
9532
|
-
} else if (typeof routeElement === "string") {
|
|
9533
|
-
return this.findRouteProperty(route, routeElement, intent);
|
|
9534
|
-
} else if (Array.isArray(routeElement)) {
|
|
9535
|
-
const r = routeElement?.[0];
|
|
9536
|
-
if (typeof r === "object" && "filters" in r && "target" in r) {
|
|
9537
|
-
const filters = [];
|
|
9538
|
-
if (Array.isArray(r.filters)) {
|
|
9539
|
-
filters.push(...r.filters);
|
|
9540
|
-
} else if (r.filters) {
|
|
9541
|
-
filters.push(r.filters);
|
|
9542
|
-
}
|
|
9543
|
-
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9544
|
-
if (!noAccept) {
|
|
9545
|
-
child = { targetKeyType: r.target, originalType: r.target };
|
|
9546
|
-
}
|
|
9547
|
-
} else {
|
|
9548
|
-
child = { targetKeyType: r, originalType: r };
|
|
9549
|
-
}
|
|
9550
|
-
data = routeElement?.[1];
|
|
9551
|
-
} else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
|
|
9552
|
-
const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9553
|
-
if (!noAccept) {
|
|
9554
|
-
child = { targetKeyType: routeElement.target, originalType: routeElement.target };
|
|
9555
|
-
propertyKeys = routeElement.propertyKeys;
|
|
9556
|
-
}
|
|
9557
|
-
} else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
|
|
9558
|
-
const filters = [];
|
|
9559
|
-
if (Array.isArray(routeElement.filters)) {
|
|
9560
|
-
filters.push(...routeElement.filters);
|
|
9561
|
-
} else if (routeElement.filters) {
|
|
9562
|
-
filters.push(routeElement.filters);
|
|
9563
|
-
}
|
|
9564
|
-
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9565
|
-
if (!noAccept) {
|
|
9566
|
-
child = { targetKeyType: routeElement.target, originalType: routeElement.target };
|
|
9567
|
-
}
|
|
9568
|
-
}
|
|
9569
|
-
return {
|
|
9570
|
-
child,
|
|
9571
|
-
data,
|
|
9572
|
-
propertyKeys
|
|
9573
|
-
};
|
|
9574
|
-
}
|
|
9575
|
-
};
|
|
9576
|
-
|
|
9577
|
-
// ../simple-boot/dist/esm/SimpleApplication.js
|
|
9578
|
-
var SimpleApplication = class _SimpleApplication {
|
|
9579
|
-
// public rootRouter?: ConstructorType<any>;
|
|
9580
|
-
// constructor();
|
|
9581
|
-
// constructor(option: SimOption);
|
|
9582
|
-
// constructor(rootRouter?: ConstructorType<Object> | Function);
|
|
9583
|
-
// constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
|
|
9584
|
-
// constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
|
|
9585
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
9586
|
-
constructor(option = new SimOption()) {
|
|
9587
|
-
this.option = option;
|
|
9588
|
-
this.simstanceManager = new SimstanceManager(this, option);
|
|
9589
|
-
this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
|
|
9590
|
-
this.routerManager = new RouterManager(this, this.simstanceManager, option);
|
|
9591
|
-
this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
|
|
9592
|
-
this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
|
|
9593
|
-
this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
|
|
9594
|
-
containers.add(this);
|
|
9595
|
-
}
|
|
9596
|
-
getSimstanceManager() {
|
|
9597
|
-
return this.simstanceManager;
|
|
9598
|
-
}
|
|
9599
|
-
getIntentManager() {
|
|
9600
|
-
return this.intentManager;
|
|
9601
|
-
}
|
|
9602
|
-
getRouterManager() {
|
|
9603
|
-
return this.routerManager;
|
|
9604
|
-
}
|
|
9605
|
-
run(otherInstanceSim) {
|
|
9606
|
-
otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
|
|
9607
|
-
otherInstanceSim.set(_SimpleApplication, this);
|
|
9608
|
-
this.simstanceManager.run(otherInstanceSim);
|
|
9609
|
-
return this;
|
|
9610
|
-
}
|
|
9611
|
-
simAtomic(type) {
|
|
9612
|
-
if (typeof type === "symbol") {
|
|
9613
|
-
return this.simstanceManager.findFirstSim(type);
|
|
9614
|
-
} else if (typeof type === "function") {
|
|
9615
|
-
return this.simstanceManager.findFirstSim({ type });
|
|
9616
|
-
}
|
|
9617
|
-
}
|
|
9618
|
-
simAtomics(type) {
|
|
9619
|
-
if (typeof type === "symbol") {
|
|
9620
|
-
return this.simstanceManager.findSims(type) ?? [];
|
|
9621
|
-
} else if (typeof type === "function") {
|
|
9622
|
-
return this.simstanceManager.findSims({ type }) ?? [];
|
|
9623
|
-
} else {
|
|
9624
|
-
return [];
|
|
9625
|
-
}
|
|
9626
|
-
}
|
|
9627
|
-
getInstance(type) {
|
|
9628
|
-
const i = this.sim(type);
|
|
9629
|
-
if (i) {
|
|
9630
|
-
return i;
|
|
9631
|
-
} else {
|
|
9632
|
-
throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
|
|
9633
|
-
}
|
|
9634
|
-
}
|
|
9635
|
-
sim(type) {
|
|
9636
|
-
return this.simAtomic(type)?.getValue();
|
|
9637
|
-
}
|
|
9638
|
-
sims(type) {
|
|
9639
|
-
return this.simAtomics(type).map((it) => it.getValue());
|
|
9640
|
-
}
|
|
9641
|
-
addSim(configOrTarget, target) {
|
|
9642
|
-
const r = Sim(configOrTarget);
|
|
9643
|
-
if (typeof r === "function" && target) {
|
|
9644
|
-
r(target);
|
|
9645
|
-
}
|
|
9646
|
-
}
|
|
9647
|
-
publishIntent(i, data) {
|
|
9648
|
-
return this.intentManager.publish(i, data);
|
|
9649
|
-
}
|
|
9650
|
-
routing(i, option) {
|
|
9651
|
-
if (i instanceof Intent) {
|
|
9652
|
-
return this.routerManager.routing(i, option);
|
|
9653
|
-
} else if (typeof i === "string") {
|
|
9654
|
-
const intent = new Intent(i);
|
|
9655
|
-
return this.routerManager.routing(intent, option);
|
|
9656
|
-
} else {
|
|
9657
|
-
const intent = new Intent(i.path, i.data);
|
|
9658
|
-
return this.routerManager.routing(intent, option);
|
|
9659
|
-
}
|
|
9660
|
-
}
|
|
9661
|
-
};
|
|
9662
|
-
|
|
9663
7730
|
// ../core-web/dist/esm/element/CanvasUtils.js
|
|
9664
7731
|
var CanvasUtils;
|
|
9665
7732
|
((CanvasUtils2) => {
|
|
@@ -10420,392 +8487,6 @@ var ValidUtils2;
|
|
|
10420
8487
|
return /Mobi/i.test(targetWindow.navigator.userAgent);
|
|
10421
8488
|
};
|
|
10422
8489
|
})(ValidUtils2 || (ValidUtils2 = {}));
|
|
10423
|
-
|
|
10424
|
-
// ../simple-boot/dist/esm/index.js
|
|
10425
|
-
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
10426
|
-
|
|
10427
|
-
// ../simple-boot/dist/esm/alert/AlertAction.js
|
|
10428
|
-
var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
|
|
10429
|
-
AlertAction2["ACTIVE"] = "ACTIVE";
|
|
10430
|
-
AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
|
|
10431
|
-
return AlertAction2;
|
|
10432
|
-
})(AlertAction || {});
|
|
10433
|
-
|
|
10434
|
-
// ../simple-boot/dist/esm/alert/Alert.js
|
|
10435
|
-
var Alert = class {
|
|
10436
|
-
constructor(alertService, config) {
|
|
10437
|
-
this.alertService = alertService;
|
|
10438
|
-
this.config = config;
|
|
10439
|
-
this.isActive = false;
|
|
10440
|
-
this.activateBefore = [];
|
|
10441
|
-
this.activateAfter = [];
|
|
10442
|
-
this.deActivateBefore = [];
|
|
10443
|
-
this.deActivateAfter = [];
|
|
10444
|
-
this.data = /* @__PURE__ */ new Map();
|
|
10445
|
-
if (config?.uuid) {
|
|
10446
|
-
this.uuid = config.uuid;
|
|
10447
|
-
} else {
|
|
10448
|
-
this.uuid = RandomUtils.uuid();
|
|
10449
|
-
}
|
|
10450
|
-
}
|
|
10451
|
-
addOpenBefore(fn) {
|
|
10452
|
-
this.activateBefore.push(fn);
|
|
10453
|
-
}
|
|
10454
|
-
addOpenAfter(fn) {
|
|
10455
|
-
this.activateAfter.push(fn);
|
|
10456
|
-
}
|
|
10457
|
-
addCloseBefore(fn) {
|
|
10458
|
-
this.deActivateBefore.push(fn);
|
|
10459
|
-
}
|
|
10460
|
-
addCloseAfter(fn) {
|
|
10461
|
-
this.deActivateAfter.push(fn);
|
|
10462
|
-
}
|
|
10463
|
-
setData(key, value) {
|
|
10464
|
-
this.data.set(key, value);
|
|
10465
|
-
}
|
|
10466
|
-
getData(key) {
|
|
10467
|
-
return this.data.get(key);
|
|
10468
|
-
}
|
|
10469
|
-
async activate() {
|
|
10470
|
-
try {
|
|
10471
|
-
await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
|
|
10472
|
-
this.result = this.make();
|
|
10473
|
-
this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
|
|
10474
|
-
this.isActive = true;
|
|
10475
|
-
if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
|
|
10476
|
-
setTimeout(() => {
|
|
10477
|
-
this.deActivate();
|
|
10478
|
-
}, this.config.closeTime);
|
|
10479
|
-
}
|
|
10480
|
-
this.config?.activate?.(this.result, this);
|
|
10481
|
-
});
|
|
10482
|
-
} catch (e) {
|
|
10483
|
-
} finally {
|
|
10484
|
-
await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
|
|
10485
|
-
});
|
|
10486
|
-
}
|
|
10487
|
-
}
|
|
10488
|
-
async deActivate() {
|
|
10489
|
-
try {
|
|
10490
|
-
await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
|
|
10491
|
-
this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
|
|
10492
|
-
this.isActive = false;
|
|
10493
|
-
this.config?.deActivate?.(this.result, this);
|
|
10494
|
-
});
|
|
10495
|
-
} catch (e) {
|
|
10496
|
-
} finally {
|
|
10497
|
-
await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
|
|
10498
|
-
});
|
|
10499
|
-
}
|
|
10500
|
-
}
|
|
10501
|
-
};
|
|
10502
|
-
|
|
10503
|
-
// ../simple-boot/dist/esm/alert/AlertFactory.js
|
|
10504
|
-
var __decorate = function(decorators, target, key, desc) {
|
|
10505
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10506
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10507
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10508
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10509
|
-
};
|
|
10510
|
-
var AlertFactory;
|
|
10511
|
-
(function(AlertFactory2) {
|
|
10512
|
-
AlertFactory2.SYMBOL = Symbol("AlertFactory");
|
|
10513
|
-
})(AlertFactory || (AlertFactory = {}));
|
|
10514
|
-
var DefaultAlertFactory = class DefaultAlertFactory2 {
|
|
10515
|
-
create(data) {
|
|
10516
|
-
return void 0;
|
|
10517
|
-
}
|
|
10518
|
-
};
|
|
10519
|
-
DefaultAlertFactory = __decorate([
|
|
10520
|
-
Sim({ symbol: AlertFactory.SYMBOL })
|
|
10521
|
-
], DefaultAlertFactory);
|
|
10522
|
-
|
|
10523
|
-
// ../simple-boot/dist/esm/alert/AlertType.js
|
|
10524
|
-
var AlertType = /* @__PURE__ */ ((AlertType2) => {
|
|
10525
|
-
AlertType2["DANGER"] = "DANGER";
|
|
10526
|
-
AlertType2["NORMAL"] = "NORMAL";
|
|
10527
|
-
AlertType2["PROGRESS"] = "PROGRESS";
|
|
10528
|
-
AlertType2["SUCCESS"] = "SUCCESS";
|
|
10529
|
-
AlertType2["ERROR"] = "ERROR";
|
|
10530
|
-
AlertType2["INFO"] = "INFO";
|
|
10531
|
-
AlertType2["WARNING"] = "WARNING";
|
|
10532
|
-
AlertType2["CONSOLE"] = "CONSOLE";
|
|
10533
|
-
AlertType2["ETC"] = "ETC";
|
|
10534
|
-
return AlertType2;
|
|
10535
|
-
})(AlertType || {});
|
|
10536
|
-
|
|
10537
|
-
// ../simple-boot/dist/esm/alert/AlertService.js
|
|
10538
|
-
var __decorate2 = function(decorators, target, key, desc) {
|
|
10539
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10540
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10541
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10542
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10543
|
-
};
|
|
10544
|
-
var __metadata = function(k, v) {
|
|
10545
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10546
|
-
};
|
|
10547
|
-
var __param = function(paramIndex, decorator) {
|
|
10548
|
-
return function(target, key) {
|
|
10549
|
-
decorator(target, key, paramIndex);
|
|
10550
|
-
};
|
|
10551
|
-
};
|
|
10552
|
-
var _a;
|
|
10553
|
-
var AlertService = class AlertService2 {
|
|
10554
|
-
constructor(alertFactory) {
|
|
10555
|
-
this.name = (/* @__PURE__ */ new Date()).toUTCString();
|
|
10556
|
-
this.subject = new ReplaySubject();
|
|
10557
|
-
this.alertFactory = alertFactory;
|
|
10558
|
-
}
|
|
10559
|
-
// @PostConstruct
|
|
10560
|
-
// postConstruct(
|
|
10561
|
-
// ) {
|
|
10562
|
-
// this.alertFactory = alertFactory;
|
|
10563
|
-
// }
|
|
10564
|
-
get observable() {
|
|
10565
|
-
return this.subject.asObservable();
|
|
10566
|
-
}
|
|
10567
|
-
publish(data) {
|
|
10568
|
-
this.subject.next(data);
|
|
10569
|
-
}
|
|
10570
|
-
create(factory, config) {
|
|
10571
|
-
return new class extends Alert {
|
|
10572
|
-
make() {
|
|
10573
|
-
return factory(this);
|
|
10574
|
-
}
|
|
10575
|
-
}(this, config);
|
|
10576
|
-
}
|
|
10577
|
-
createFromFactory(type, config) {
|
|
10578
|
-
return this.alertFactory?.create({ caller: this, type, config });
|
|
10579
|
-
}
|
|
10580
|
-
danger(config) {
|
|
10581
|
-
return this.createFromFactory(AlertType.DANGER, config);
|
|
10582
|
-
}
|
|
10583
|
-
progress(config) {
|
|
10584
|
-
config = config ?? {};
|
|
10585
|
-
return this.createFromFactory(AlertType.PROGRESS, config);
|
|
10586
|
-
}
|
|
10587
|
-
success(config) {
|
|
10588
|
-
return this.createFromFactory(AlertType.SUCCESS, config);
|
|
10589
|
-
}
|
|
10590
|
-
info(config) {
|
|
10591
|
-
return this.createFromFactory(AlertType.INFO, config);
|
|
10592
|
-
}
|
|
10593
|
-
error(config) {
|
|
10594
|
-
return this.createFromFactory(AlertType.ERROR, config);
|
|
10595
|
-
}
|
|
10596
|
-
warning(config) {
|
|
10597
|
-
return this.createFromFactory(AlertType.WARNING, config);
|
|
10598
|
-
}
|
|
10599
|
-
};
|
|
10600
|
-
AlertService = __decorate2([
|
|
10601
|
-
Sim,
|
|
10602
|
-
__param(0, Inject({ symbol: AlertFactory.SYMBOL })),
|
|
10603
|
-
__metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
|
|
10604
|
-
], AlertService);
|
|
10605
|
-
|
|
10606
|
-
// ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
|
|
10607
|
-
var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
|
|
10608
|
-
var getCacheSet = (simpleApplication) => {
|
|
10609
|
-
return simpleApplicationCache.get(simpleApplication);
|
|
10610
|
-
};
|
|
10611
|
-
var findCacheByKey = (simpleApplication, key) => {
|
|
10612
|
-
const storage = simpleApplicationCache.get(simpleApplication);
|
|
10613
|
-
if (storage) {
|
|
10614
|
-
return Array.from(storage.config.entries()).find(([k, v]) => k === key);
|
|
10615
|
-
}
|
|
10616
|
-
};
|
|
10617
|
-
var findCacheByKeyStartWith = (simpleApplication, key) => {
|
|
10618
|
-
const storage = simpleApplicationCache.get(simpleApplication);
|
|
10619
|
-
if (storage) {
|
|
10620
|
-
return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
|
|
10621
|
-
} else {
|
|
10622
|
-
return [];
|
|
10623
|
-
}
|
|
10624
|
-
};
|
|
10625
|
-
var deleteCacheByKey = (simpleApplication, key) => {
|
|
10626
|
-
const storage = simpleApplicationCache.get(simpleApplication);
|
|
10627
|
-
if (storage) {
|
|
10628
|
-
storage.storage.delete(key);
|
|
10629
|
-
findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
|
|
10630
|
-
const data = storage.config.get(k);
|
|
10631
|
-
if (data?.expireTimeout) {
|
|
10632
|
-
clearTimeout(data.expireTimeout);
|
|
10633
|
-
}
|
|
10634
|
-
storage.config.delete(k);
|
|
10635
|
-
storage.storage.delete(k);
|
|
10636
|
-
});
|
|
10637
|
-
}
|
|
10638
|
-
};
|
|
10639
|
-
var deleteCacheByKeyStartWith = (simpleApplication, key) => {
|
|
10640
|
-
findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
|
|
10641
|
-
};
|
|
10642
|
-
var CacheMetadataKey = Symbol("Cache");
|
|
10643
|
-
|
|
10644
|
-
// ../simple-boot/dist/esm/cache/CacheManager.js
|
|
10645
|
-
var __decorate3 = function(decorators, target, key, desc) {
|
|
10646
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10647
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10648
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10649
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10650
|
-
};
|
|
10651
|
-
var __metadata2 = function(k, v) {
|
|
10652
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10653
|
-
};
|
|
10654
|
-
var _a2;
|
|
10655
|
-
var CacheManager = class CacheManager2 {
|
|
10656
|
-
constructor(simpleApplication) {
|
|
10657
|
-
this.simpleApplication = simpleApplication;
|
|
10658
|
-
}
|
|
10659
|
-
findCacheByKey(key) {
|
|
10660
|
-
return findCacheByKey(this.simpleApplication, key);
|
|
10661
|
-
}
|
|
10662
|
-
findCacheByKeyStartWith(key) {
|
|
10663
|
-
return findCacheByKeyStartWith(this.simpleApplication, key);
|
|
10664
|
-
}
|
|
10665
|
-
deleteCacheByKey(key) {
|
|
10666
|
-
return deleteCacheByKey(this.simpleApplication, key);
|
|
10667
|
-
}
|
|
10668
|
-
deleteCacheByKeyStartWith(key) {
|
|
10669
|
-
return deleteCacheByKeyStartWith(this.simpleApplication, key);
|
|
10670
|
-
}
|
|
10671
|
-
getCacheSet() {
|
|
10672
|
-
return getCacheSet(this.simpleApplication);
|
|
10673
|
-
}
|
|
10674
|
-
};
|
|
10675
|
-
CacheManager = __decorate3([
|
|
10676
|
-
Sim,
|
|
10677
|
-
__metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
|
|
10678
|
-
], CacheManager);
|
|
10679
|
-
|
|
10680
|
-
// ../simple-boot/dist/esm/decorators/event/EventListener.js
|
|
10681
|
-
var EventListenerMetadataKey = Symbol("EventListener");
|
|
10682
|
-
|
|
10683
|
-
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
10684
|
-
var ValidMetadataKey = Symbol("ValidMetadataKey");
|
|
10685
|
-
var ValidationMetadataKey = Symbol("ValidationMetadataKey");
|
|
10686
|
-
|
|
10687
|
-
// ../simple-boot/dist/esm/fetch/ApiService.js
|
|
10688
|
-
var __decorate4 = function(decorators, target, key, desc) {
|
|
10689
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10690
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10691
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10692
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10693
|
-
};
|
|
10694
|
-
var __metadata3 = function(k, v) {
|
|
10695
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10696
|
-
};
|
|
10697
|
-
var _a3;
|
|
10698
|
-
var _b;
|
|
10699
|
-
var ApiServiceInterceptor;
|
|
10700
|
-
(function(ApiServiceInterceptor2) {
|
|
10701
|
-
ApiServiceInterceptor2.TOKEN = Symbol("ApiServiceInterceptor");
|
|
10702
|
-
ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
|
|
10703
|
-
try {
|
|
10704
|
-
return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
|
|
10705
|
-
} catch (e) {
|
|
10706
|
-
return [];
|
|
10707
|
-
}
|
|
10708
|
-
};
|
|
10709
|
-
})(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
|
|
10710
|
-
var ApiService = class ApiService2 extends HttpJsonFetcher {
|
|
10711
|
-
constructor(simstanceManager, alertService) {
|
|
10712
|
-
super();
|
|
10713
|
-
this.simstanceManager = simstanceManager;
|
|
10714
|
-
this.subject = new Subject();
|
|
10715
|
-
this.alertService = alertService;
|
|
10716
|
-
}
|
|
10717
|
-
// @PostConstruct
|
|
10718
|
-
// postConstruct(alertService: AlertService<any>) {
|
|
10719
|
-
// this.alertService = alertService;
|
|
10720
|
-
// }
|
|
10721
|
-
get observable() {
|
|
10722
|
-
return this.subject.asObservable();
|
|
10723
|
-
}
|
|
10724
|
-
createPipe(config) {
|
|
10725
|
-
return {};
|
|
10726
|
-
}
|
|
10727
|
-
async beforeProxyFetch(config) {
|
|
10728
|
-
let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
|
|
10729
|
-
for (const interceptor of interceptors) {
|
|
10730
|
-
if (interceptor.beforeProxyFetch) {
|
|
10731
|
-
config = await interceptor.beforeProxyFetch(config);
|
|
10732
|
-
}
|
|
10733
|
-
}
|
|
10734
|
-
this.subject.next({ type: "beforeFetchData", config });
|
|
10735
|
-
return config;
|
|
10736
|
-
}
|
|
10737
|
-
async afterProxyFetch(config) {
|
|
10738
|
-
let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
|
|
10739
|
-
let r = config.response;
|
|
10740
|
-
for (const interceptor of interceptors) {
|
|
10741
|
-
if (interceptor.afterProxyFetch) {
|
|
10742
|
-
r = await interceptor.afterProxyFetch(config);
|
|
10743
|
-
}
|
|
10744
|
-
}
|
|
10745
|
-
this.subject.next({ type: "afterFetchData", response: r });
|
|
10746
|
-
return r;
|
|
10747
|
-
}
|
|
10748
|
-
beforeFetch(fetch2) {
|
|
10749
|
-
this.subject.next({ type: "beforeFetch", fetch: fetch2 });
|
|
10750
|
-
}
|
|
10751
|
-
afterFetch(fetch2, response) {
|
|
10752
|
-
this.subject.next({ type: "afterFetch", fetch: fetch2, response });
|
|
10753
|
-
}
|
|
10754
|
-
before(config, pipe) {
|
|
10755
|
-
this.subject.next({ type: "progress", config, pipe });
|
|
10756
|
-
config.config?.config?.callBackProgress?.(config, pipe);
|
|
10757
|
-
if (config.config?.config?.alertProgress) {
|
|
10758
|
-
const alert = this.alertService?.progress({ title: config.config.config.title });
|
|
10759
|
-
if (alert) {
|
|
10760
|
-
pipe.progress = alert;
|
|
10761
|
-
alert.activate();
|
|
10762
|
-
}
|
|
10763
|
-
}
|
|
10764
|
-
}
|
|
10765
|
-
afterSuccess(config, pipe) {
|
|
10766
|
-
this.subject.next({ type: "success", config, pipe });
|
|
10767
|
-
config.config?.config?.callBackSuccess?.(config, pipe);
|
|
10768
|
-
if (config.config?.config?.alertSuccessMsg) {
|
|
10769
|
-
this.alertService?.success({ title: config.config.config.title })?.activate();
|
|
10770
|
-
}
|
|
10771
|
-
}
|
|
10772
|
-
afterSuccessTransform(config, pipe) {
|
|
10773
|
-
}
|
|
10774
|
-
finally(config, pipe) {
|
|
10775
|
-
this.subject.next({ type: "final", config, pipe });
|
|
10776
|
-
config.config?.config?.callBackFinal?.(config, pipe);
|
|
10777
|
-
pipe.progress?.deActivate();
|
|
10778
|
-
}
|
|
10779
|
-
error(config, pipe, e) {
|
|
10780
|
-
console.log("error", e);
|
|
10781
|
-
this.subject.next({ type: "error", config, pipe, e });
|
|
10782
|
-
config.config?.config?.callBackError?.(config, pipe, e);
|
|
10783
|
-
if (config.config?.config?.alertErrorMsg) {
|
|
10784
|
-
this.alertService?.danger({
|
|
10785
|
-
title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
|
|
10786
|
-
})?.activate();
|
|
10787
|
-
}
|
|
10788
|
-
if (config.config?.config?.enableErrorConsole) {
|
|
10789
|
-
console.error(`apiService Error ${config?.config?.config?.title}`, e);
|
|
10790
|
-
}
|
|
10791
|
-
}
|
|
10792
|
-
async execute(fetcherRequest) {
|
|
10793
|
-
const target = fetcherRequest.target;
|
|
10794
|
-
const config = fetcherRequest.config;
|
|
10795
|
-
let r = { target, config };
|
|
10796
|
-
const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
|
|
10797
|
-
for (const apiServiceInterceptor of interceptor) {
|
|
10798
|
-
if (apiServiceInterceptor.beforeProxyExecute) {
|
|
10799
|
-
r = await apiServiceInterceptor.beforeProxyExecute?.(r);
|
|
10800
|
-
}
|
|
10801
|
-
}
|
|
10802
|
-
return super.execute(r);
|
|
10803
|
-
}
|
|
10804
|
-
};
|
|
10805
|
-
ApiService = __decorate4([
|
|
10806
|
-
Sim,
|
|
10807
|
-
__metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
|
|
10808
|
-
], ApiService);
|
|
10809
8490
|
export {
|
|
10810
8491
|
ADD_EVENT_LISTENER_METADATA_KEY,
|
|
10811
8492
|
APPLY_NODE_METADATA_KEY,
|
|
@@ -10828,10 +8509,11 @@ export {
|
|
|
10828
8509
|
ON_BEFORE_ADOPTED_METADATA_KEY,
|
|
10829
8510
|
ON_BEFORE_CONNECTED_METADATA_KEY,
|
|
10830
8511
|
ON_BEFORE_DISCONNECTED_METADATA_KEY,
|
|
10831
|
-
|
|
8512
|
+
ON_INITIALIZE_METADATA_KEY,
|
|
10832
8513
|
QUERY_ALL_METADATA_KEY,
|
|
10833
8514
|
QUERY_METADATA_KEY,
|
|
10834
8515
|
STYLE_METADATA_KEY,
|
|
8516
|
+
SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY,
|
|
10835
8517
|
SWC_NOT_FOUND,
|
|
10836
8518
|
SwcUtils,
|
|
10837
8519
|
addClass,
|
|
@@ -10883,6 +8565,7 @@ export {
|
|
|
10883
8565
|
getOnConnectedInnerHtmlMetadata,
|
|
10884
8566
|
getQueryAllMetadata,
|
|
10885
8567
|
getQueryMetadata,
|
|
8568
|
+
getSubscribeSwcAppRouteChangeMetadata,
|
|
10886
8569
|
host,
|
|
10887
8570
|
htmlAElement,
|
|
10888
8571
|
htmlArticleElement,
|
|
@@ -10907,8 +8590,8 @@ export {
|
|
|
10907
8590
|
onBeforeDisconnected,
|
|
10908
8591
|
onConnected,
|
|
10909
8592
|
onConnectedInnerHtml,
|
|
10910
|
-
onConstructor,
|
|
10911
8593
|
onDisconnected,
|
|
8594
|
+
onInitialize,
|
|
10912
8595
|
parentHost,
|
|
10913
8596
|
query,
|
|
10914
8597
|
queryAll,
|
|
@@ -10927,6 +8610,7 @@ export {
|
|
|
10927
8610
|
setClassHost,
|
|
10928
8611
|
setStyle,
|
|
10929
8612
|
setStyleHost,
|
|
8613
|
+
subscribeSwcAppRouteChange,
|
|
10930
8614
|
textNode,
|
|
10931
8615
|
toggleClass,
|
|
10932
8616
|
toggleClassHost,
|