@wexample/js-app 0.0.34 → 0.0.42

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 CHANGED
@@ -1,135 +1,8 @@
1
1
  # @wexample/js-app
2
2
 
3
- Version: 0.0.34
3
+ Version: 0.0.42
4
4
 
5
5
  ## Table of Contents
6
6
 
7
- - [Api Reference](#api-reference)
8
- - [Code Quality](#code-quality)
9
- - [Versioning](#versioning)
10
- - [Changelog](#changelog)
11
- - [Migration Notes](#migration-notes)
12
- - [Security](#security)
13
- - [Privacy](#privacy)
14
- - [Support](#support)
15
- - [Contribution Guidelines](#contribution-guidelines)
16
- - [Maintainers](#maintainers)
17
- - [License](#license)
18
- - [Suite Integration](#suite-integration)
19
- - [Compatibility Matrix](#compatibility-matrix)
20
- - [Dependencies](#dependencies)
21
- - [Suite Signature](#suite-signature)
22
7
 
23
8
 
24
- ## API Reference
25
-
26
- Full API documentation is available in the source code docstrings.
27
-
28
- Key modules and classes are documented with type hints for better IDE support.
29
-
30
- ## Code Quality & Typing
31
-
32
- All the suite packages follow strict quality standards:
33
-
34
- - **Type hints**: Full type coverage with mypy validation
35
- - **Code formatting**: Enforced with black and isort
36
- - **Linting**: Comprehensive checks with custom scripts and tools
37
- - **Testing**: High test coverage requirements
38
-
39
- These standards ensure reliability and maintainability across the suite.
40
-
41
- ## Versioning & Compatibility Policy
42
-
43
- Wexample packages follow **Semantic Versioning** (SemVer):
44
-
45
- - **MAJOR**: Breaking changes
46
- - **MINOR**: New features, backward compatible
47
- - **PATCH**: Bug fixes, backward compatible
48
-
49
- We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
50
-
51
- ## Changelog
52
-
53
- See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
54
-
55
- Major changes are documented with migration guides when applicable.
56
-
57
- ## Migration Notes
58
-
59
- When upgrading between major versions, refer to the migration guides in the documentation.
60
-
61
- Breaking changes are clearly documented with upgrade paths and examples.
62
-
63
- ## Security Policy
64
-
65
- ### Reporting Vulnerabilities
66
-
67
- If you discover a security vulnerability, please email contact@wexample.com.
68
-
69
- **Do not** open public issues for security vulnerabilities.
70
-
71
- We take security seriously and will respond promptly to verified reports.
72
-
73
- ## Privacy & Telemetry
74
-
75
- This package does **not** collect any telemetry or usage data.
76
-
77
- Your privacy is respected — no data is transmitted to external services.
78
-
79
- ## Support Channels
80
-
81
- - **GitHub Issues**: Bug reports and feature requests
82
- - **GitHub Discussions**: Questions and community support
83
- - **Documentation**: Comprehensive guides and API reference
84
- - **Email**: contact@wexample.com for general inquiries
85
-
86
- Community support is available through GitHub Discussions.
87
-
88
- ## Contribution Guidelines
89
-
90
- We welcome contributions to the Wexample suite!
91
-
92
- ### How to Contribute
93
-
94
- 1. **Fork** the repository
95
- 2. **Create** a feature branch
96
- 3. **Make** your changes
97
- 4. **Test** thoroughly
98
- 5. **Submit** a pull request
99
-
100
- ## Maintainers & Authors
101
-
102
- Maintained by the Wexample team and community contributors.
103
-
104
- See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
105
-
106
- ## License
107
-
108
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
109
-
110
- Free to use in both personal and commercial projects.
111
-
112
- ## Integration in the Suite
113
-
114
- This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
115
-
116
- ### Related Packages
117
-
118
- The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
119
-
120
- Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
121
-
122
- ## Compatibility Matrix
123
-
124
- This package is part of the Wexample suite and is compatible with other suite packages.
125
-
126
- Refer to each package's documentation for specific version compatibility requirements.
127
-
128
- # About us
129
-
130
- [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
131
-
132
- This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
133
-
134
- Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
135
-
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
- "version": "0.0.34",
2
+ "version": "0.0.42",
3
3
  "type": "module",
4
4
  "name": "@wexample/js-app",
5
5
  "scripts": {
6
- "clean": "rm -rf dist",
7
- "build": "npm run clean && tsc",
6
+ "build": "tsc --noEmit",
8
7
  "prepublishOnly": "npm run build"
9
8
  },
10
9
  "devDependencies": {
@@ -18,13 +17,20 @@
18
17
  },
19
18
  "repository": "https://github.com/wexample/js-app",
20
19
  "files": [
21
- "dist"
20
+ "src"
22
21
  ],
23
22
  "sideEffects": false,
24
23
  "exports": {
25
24
  "./*": {
26
- "types": "./dist/*.d.ts",
27
- "default": "./dist/*.js"
25
+ "types": "./src/*.ts",
26
+ "default": "./src/*.ts"
27
+ }
28
+ },
29
+ "typesVersions": {
30
+ "*": {
31
+ "*": [
32
+ "src/*"
33
+ ]
28
34
  }
29
35
  }
30
36
  }
@@ -0,0 +1,115 @@
1
+ import MixinsService from '@wexample/js-app/Services/MixinsService';
2
+ import AsyncConstructor from '@wexample/js-helpers/Common/AsyncConstructor';
3
+ import { arrayUnique } from '@wexample/js-helpers/Helper/Array';
4
+ import type ServicesRegistryInterface from '../Interfaces/ServicesRegistryInterface.js';
5
+ import type { AppServiceConstructor, ServiceDefinition } from '../Types/AppServiceTypes.js';
6
+ import type AppService from './AppService.js';
7
+
8
+ type ReadyCallback = (() => void) | (() => Promise<void>);
9
+
10
+ export default class App extends AsyncConstructor {
11
+ public services: ServicesRegistryInterface = {};
12
+
13
+ constructor(readyCallback?: ReadyCallback, globalName: string = 'app') {
14
+ super();
15
+
16
+ window[globalName] = this;
17
+
18
+ const doc = window.document;
19
+
20
+ const run = async () => {
21
+ // Allow children to perform setup before sealing.
22
+ await this.beforeReady();
23
+
24
+ // Every core properties has been set,
25
+ // block any try to add extra property.
26
+ this.seal();
27
+
28
+ // Execute ready callbacks.
29
+ await this.readyComplete();
30
+
31
+ readyCallback && (await readyCallback());
32
+ };
33
+
34
+ const readyState = doc.readyState;
35
+
36
+ // Document has been parsed.
37
+ // Allows running after loaded event.
38
+ if (['complete', 'loaded', 'interactive'].indexOf(readyState) !== -1) {
39
+ this.defer(run);
40
+ } else {
41
+ doc.addEventListener('DOMContentLoaded', run);
42
+ }
43
+ }
44
+
45
+ // Hook for children: executed after DOM is ready but before seal().
46
+ protected async beforeReady(): Promise<void> {
47
+ await this.loadAndInitServices(this.getServices());
48
+ }
49
+
50
+ getServices(): ServiceDefinition[] {
51
+ return [MixinsService];
52
+ }
53
+
54
+ loadServices(services: ServiceDefinition[]): AppService[] {
55
+ services = this.getServicesAndDependencies(services);
56
+ const instances = [];
57
+
58
+ services.forEach((service: ServiceDefinition) => {
59
+ let serviceClass: AppServiceConstructor;
60
+ let serviceArgs: unknown[] = [];
61
+
62
+ if (Array.isArray(service)) {
63
+ serviceClass = service[0];
64
+ serviceArgs = service[1];
65
+ } else {
66
+ serviceClass = service;
67
+ }
68
+
69
+ const name = serviceClass.serviceName;
70
+
71
+ if (!this.services[name]) {
72
+ this.services[name] = new serviceClass(this, ...serviceArgs);
73
+ instances.push(this.services[name]);
74
+ }
75
+ });
76
+
77
+ return instances;
78
+ }
79
+
80
+ async loadAndInitServices(services: ServiceDefinition[]): Promise<unknown> {
81
+ const loadedServices = this.loadServices(services);
82
+
83
+ return this.services.mixins.invokeUntilComplete(
84
+ 'hookInit',
85
+ 'app',
86
+ [],
87
+ undefined,
88
+ loadedServices
89
+ );
90
+ }
91
+
92
+ getServicesAndDependencies(services: ServiceDefinition[]): ServiceDefinition[] {
93
+ services.forEach((serviceDef: ServiceDefinition) => {
94
+ let serviceClass: AppServiceConstructor;
95
+
96
+ if (Array.isArray(serviceDef)) {
97
+ serviceClass = serviceDef[0];
98
+ } else {
99
+ serviceClass = serviceDef;
100
+ }
101
+
102
+ if (serviceClass.dependencies) {
103
+ services = [...services, ...this.getServicesAndDependencies(serviceClass.dependencies)];
104
+ }
105
+ });
106
+
107
+ return arrayUnique(services) as ServiceDefinition[];
108
+ }
109
+
110
+ getService(name: string | { serviceName: string }): AppService {
111
+ name = typeof name === 'string' ? name : name.serviceName;
112
+
113
+ return this.services[name];
114
+ }
115
+ }
@@ -1,7 +1,10 @@
1
1
  import AsyncConstructor from '@wexample/js-helpers/Common/AsyncConstructor';
2
2
  import type App from './App.js';
3
+
3
4
  export default class extends AsyncConstructor {
4
- protected readonly app: App;
5
- constructor(app: App);
5
+ constructor(protected readonly app: App) {
6
+ super();
7
+
8
+ this.app = app;
9
+ }
6
10
  }
7
- //# sourceMappingURL=AppChild.d.ts.map
@@ -0,0 +1,24 @@
1
+ import type { ServiceDefinition } from '../Types/AppServiceTypes.js';
2
+ import type App from './App.js';
3
+ import AppChild from './AppChild.js';
4
+
5
+ export default abstract class AppService extends AppChild {
6
+ public static LOAD_STATUS_COMPLETE = 'complete';
7
+ public static LOAD_STATUS_WAIT = 'wait';
8
+
9
+ public app: App;
10
+ public static dependencies: ServiceDefinition[] = [];
11
+ public static serviceName: string;
12
+
13
+ registerHooks(): {
14
+ app?: Record<string, unknown>;
15
+ page?: Record<string, unknown>;
16
+ renderNode?: Record<string, unknown>;
17
+ } {
18
+ return {};
19
+ }
20
+
21
+ registerMethods(_object: unknown, _group: string) {
22
+ return {};
23
+ }
24
+ }
@@ -1,5 +1,5 @@
1
1
  import type MixinsService from '../Services/MixinsService.js';
2
+
2
3
  export default interface ServicesRegistryInterface {
3
- mixins?: MixinsService;
4
+ mixins?: MixinsService;
4
5
  }
5
- //# sourceMappingURL=ServicesRegistryInterface.d.ts.map
@@ -0,0 +1,87 @@
1
+ import AppService from '@wexample/js-app/Common/AppService';
2
+ import type { AppServiceConstructor } from '../Types/AppServiceTypes.js';
3
+
4
+ export default class MixinsService extends AppService {
5
+ public static serviceName = 'mixins';
6
+
7
+ /**
8
+ * Execute a hook until all ext do not return false.
9
+ * Useful to manage order when processing : an ext can wait for
10
+ * another one to be executed.
11
+ *
12
+ * The pre-last arg of callback will be a registry of ext statuses.
13
+ * The last arg of callback well be a next() method in case of async operation.
14
+ *
15
+ * @param method
16
+ * @param args
17
+ * @param group
18
+ * @param timeoutLimit
19
+ * @param services
20
+ */
21
+ async invokeUntilComplete(
22
+ method: string,
23
+ group: string = 'app',
24
+ args: unknown[] = [],
25
+ timeoutLimit: number = 2000,
26
+ services: AppService[] = Object.values(this.app.services) as AppService[]
27
+ ): Promise<boolean> {
28
+ const errorTrace: AppService[] = [];
29
+ let loops: number = 0;
30
+ const loopsLimit: number = 100;
31
+ const registry: Record<string, unknown> = {};
32
+
33
+ while (true) {
34
+ const service = services.shift();
35
+ if (!service) {
36
+ break;
37
+ }
38
+
39
+ const currentName = (service.constructor as AppServiceConstructor).serviceName;
40
+ const timeout = setTimeout(() => {
41
+ const message = [
42
+ `Mixins invocation timeout on method "${method}", stopping at "${currentName}".`,
43
+ `Registry: ${JSON.stringify(registry)}.`,
44
+ ].join(' ');
45
+
46
+ throw new Error(message);
47
+ }, timeoutLimit);
48
+
49
+ const hooks = service.registerHooks() as Record<string, Record<string, unknown>> | undefined;
50
+ const hook = hooks?.[group]?.[method];
51
+
52
+ if (loops++ > loopsLimit) {
53
+ const message = [
54
+ `Stopping more than ${loops} recursions during services invocation on method "${method}", stopping at ${currentName}.`,
55
+ `Trace: ${errorTrace.join(' -> ') || 'none'}.`,
56
+ `Registry: ${JSON.stringify(registry)}.`,
57
+ ].join(' ');
58
+
59
+ throw new Error(message);
60
+ } else if (loops > loopsLimit - 10) {
61
+ errorTrace.push(service);
62
+ }
63
+
64
+ if (typeof hook === 'function') {
65
+ const argsLocal = args.concat([registry]);
66
+ registry[currentName] = await (hook as (...hookArgs: unknown[]) => unknown).apply(
67
+ service,
68
+ argsLocal
69
+ );
70
+ }
71
+
72
+ if (registry[currentName] === undefined) {
73
+ registry[currentName] = AppService.LOAD_STATUS_COMPLETE;
74
+ }
75
+
76
+ // "wait" says to retry after processing other services.
77
+ if (registry[currentName] === AppService.LOAD_STATUS_WAIT) {
78
+ // Enqueue again.
79
+ services.push(service);
80
+ }
81
+
82
+ clearTimeout(timeout);
83
+ }
84
+
85
+ return true;
86
+ }
87
+ }
@@ -0,0 +1,12 @@
1
+ import type App from '../Common/App.js';
2
+ import type AppService from '../Common/AppService.js';
3
+
4
+ export type AppServiceConstructor = (new (
5
+ app: App,
6
+ ...args: unknown[]
7
+ ) => AppService) & {
8
+ serviceName: string;
9
+ dependencies?: ServiceDefinition[];
10
+ };
11
+
12
+ export type ServiceDefinition = AppServiceConstructor | [AppServiceConstructor, unknown[]];
@@ -1,19 +0,0 @@
1
- import AsyncConstructor from '@wexample/js-helpers/Common/AsyncConstructor';
2
- import type ServicesRegistryInterface from '../Interfaces/ServicesRegistryInterface.js';
3
- import type { ServiceDefinition } from '../Types/AppServiceTypes.js';
4
- import type AppService from './AppService.js';
5
- type ReadyCallback = (() => void) | (() => Promise<void>);
6
- export default class App extends AsyncConstructor {
7
- services: ServicesRegistryInterface;
8
- constructor(readyCallback?: ReadyCallback, globalName?: string);
9
- protected beforeReady(): Promise<void>;
10
- getServices(): ServiceDefinition[];
11
- loadServices(services: ServiceDefinition[]): AppService[];
12
- loadAndInitServices(services: ServiceDefinition[]): Promise<unknown>;
13
- getServicesAndDependencies(services: ServiceDefinition[]): ServiceDefinition[];
14
- getService(name: string | {
15
- serviceName: string;
16
- }): AppService;
17
- }
18
- export {};
19
- //# sourceMappingURL=App.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/Common/App.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAE5E,OAAO,KAAK,yBAAyB,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EAAyB,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAE9C,KAAK,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,gBAAgB;IACxC,QAAQ,EAAE,yBAAyB,CAAM;gBAEpC,aAAa,CAAC,EAAE,aAAa,EAAE,UAAU,GAAE,MAAc;cAiCrD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C,WAAW,IAAI,iBAAiB,EAAE;IAIlC,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,UAAU,EAAE;IA0BnD,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAY1E,0BAA0B,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IAkB9E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,UAAU;CAK/D"}
@@ -1,82 +0,0 @@
1
- import MixinsService from '@wexample/js-app/Services/MixinsService';
2
- import AsyncConstructor from '@wexample/js-helpers/Common/AsyncConstructor';
3
- import { arrayUnique } from '@wexample/js-helpers/Helper/Array';
4
- export default class App extends AsyncConstructor {
5
- constructor(readyCallback, globalName = 'app') {
6
- super();
7
- this.services = {};
8
- window[globalName] = this;
9
- const doc = window.document;
10
- const run = async () => {
11
- // Allow children to perform setup before sealing.
12
- await this.beforeReady();
13
- // Every core properties has been set,
14
- // block any try to add extra property.
15
- this.seal();
16
- // Execute ready callbacks.
17
- await this.readyComplete();
18
- readyCallback && (await readyCallback());
19
- };
20
- const readyState = doc.readyState;
21
- // Document has been parsed.
22
- // Allows running after loaded event.
23
- if (['complete', 'loaded', 'interactive'].indexOf(readyState) !== -1) {
24
- this.defer(run);
25
- }
26
- else {
27
- doc.addEventListener('DOMContentLoaded', run);
28
- }
29
- }
30
- // Hook for children: executed after DOM is ready but before seal().
31
- async beforeReady() {
32
- await this.loadAndInitServices(this.getServices());
33
- }
34
- getServices() {
35
- return [MixinsService];
36
- }
37
- loadServices(services) {
38
- services = this.getServicesAndDependencies(services);
39
- const instances = [];
40
- services.forEach((service) => {
41
- let serviceClass;
42
- let serviceArgs = [];
43
- if (Array.isArray(service)) {
44
- serviceClass = service[0];
45
- serviceArgs = service[1];
46
- }
47
- else {
48
- serviceClass = service;
49
- }
50
- const name = serviceClass.serviceName;
51
- if (!this.services[name]) {
52
- this.services[name] = new serviceClass(this, ...serviceArgs);
53
- instances.push(this.services[name]);
54
- }
55
- });
56
- return instances;
57
- }
58
- async loadAndInitServices(services) {
59
- const loadedServices = this.loadServices(services);
60
- return this.services.mixins.invokeUntilComplete('hookInit', 'app', [], undefined, loadedServices);
61
- }
62
- getServicesAndDependencies(services) {
63
- services.forEach((serviceDef) => {
64
- let serviceClass;
65
- if (Array.isArray(serviceDef)) {
66
- serviceClass = serviceDef[0];
67
- }
68
- else {
69
- serviceClass = serviceDef;
70
- }
71
- if (serviceClass.dependencies) {
72
- services = [...services, ...this.getServicesAndDependencies(serviceClass.dependencies)];
73
- }
74
- });
75
- return arrayUnique(services);
76
- }
77
- getService(name) {
78
- name = typeof name === 'string' ? name : name.serviceName;
79
- return this.services[name];
80
- }
81
- }
82
- //# sourceMappingURL=App.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"App.js","sourceRoot":"","sources":["../../src/Common/App.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,yCAAyC,CAAC;AACpE,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAOhE,MAAM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YAAY,CAAC,YAAY,EAAE,CAAC;gBAC9B,QAAQ,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,0BAA0B,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC,QAAQ,CAAwB,CAAC;IACtD,CAAC;IAED,UAAU,CAAC,IAAsC;QAC/C,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;QAE1D,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppChild.d.ts","sourceRoot":"","sources":["../../src/Common/AppChild.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAC5E,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC,MAAM,CAAC,OAAO,MAAO,SAAQ,gBAAgB;IAC/B,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG;gBAAR,GAAG,EAAE,GAAG;CAKxC"}
@@ -1,9 +0,0 @@
1
- import AsyncConstructor from '@wexample/js-helpers/Common/AsyncConstructor';
2
- export default class extends AsyncConstructor {
3
- constructor(app) {
4
- super();
5
- this.app = app;
6
- this.app = app;
7
- }
8
- }
9
- //# sourceMappingURL=AppChild.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppChild.js","sourceRoot":"","sources":["../../src/Common/AppChild.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAG5E,MAAM,CAAC,OAAO,MAAO,SAAQ,gBAAgB;IAC3C,YAA+B,GAAQ;QACrC,KAAK,EAAE,CAAC;QADqB,QAAG,GAAH,GAAG,CAAK;QAGrC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- import type { ServiceDefinition } from '../Types/AppServiceTypes.js';
2
- import type App from './App.js';
3
- import AppChild from './AppChild.js';
4
- export default abstract class AppService extends AppChild {
5
- static LOAD_STATUS_COMPLETE: string;
6
- static LOAD_STATUS_WAIT: string;
7
- app: App;
8
- static dependencies: ServiceDefinition[];
9
- static serviceName: string;
10
- registerHooks(): {
11
- app?: Record<string, unknown>;
12
- page?: Record<string, unknown>;
13
- renderNode?: Record<string, unknown>;
14
- };
15
- registerMethods(_object: unknown, _group: string): {};
16
- }
17
- //# sourceMappingURL=AppService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppService.d.ts","sourceRoot":"","sources":["../../src/Common/AppService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,UAAW,SAAQ,QAAQ;IACvD,OAAc,oBAAoB,SAAc;IAChD,OAAc,gBAAgB,SAAU;IAEjC,GAAG,EAAE,GAAG,CAAC;IAChB,OAAc,YAAY,EAAE,iBAAiB,EAAE,CAAM;IACrD,OAAc,WAAW,EAAE,MAAM,CAAC;IAElC,aAAa,IAAI;QACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;IAID,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;CAGjD"}
@@ -1,14 +0,0 @@
1
- import AppChild from './AppChild.js';
2
- class AppService extends AppChild {
3
- registerHooks() {
4
- return {};
5
- }
6
- registerMethods(_object, _group) {
7
- return {};
8
- }
9
- }
10
- AppService.LOAD_STATUS_COMPLETE = 'complete';
11
- AppService.LOAD_STATUS_WAIT = 'wait';
12
- AppService.dependencies = [];
13
- export default AppService;
14
- //# sourceMappingURL=AppService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppService.js","sourceRoot":"","sources":["../../src/Common/AppService.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,MAA8B,UAAW,SAAQ,QAAQ;IAQvD,aAAa;QAKX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,eAAe,CAAC,OAAgB,EAAE,MAAc;QAC9C,OAAO,EAAE,CAAC;IACZ,CAAC;;AAjBa,+BAAoB,GAAG,UAAU,CAAC;AAClC,2BAAgB,GAAG,MAAM,CAAC;AAG1B,uBAAY,GAAwB,EAAE,CAAC;eALzB,UAAU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServicesRegistryInterface.d.ts","sourceRoot":"","sources":["../../src/Interfaces/ServicesRegistryInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAC;AAE9D,MAAM,CAAC,OAAO,WAAW,yBAAyB;IAChD,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ServicesRegistryInterface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServicesRegistryInterface.js","sourceRoot":"","sources":["../../src/Interfaces/ServicesRegistryInterface.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import AppService from '@wexample/js-app/Common/AppService';
2
- export default class MixinsService extends AppService {
3
- static serviceName: string;
4
- /**
5
- * Execute a hook until all ext do not return false.
6
- * Useful to manage order when processing : an ext can wait for
7
- * another one to be executed.
8
- *
9
- * The pre-last arg of callback will be a registry of ext statuses.
10
- * The last arg of callback well be a next() method in case of async operation.
11
- *
12
- * @param method
13
- * @param args
14
- * @param group
15
- * @param timeoutLimit
16
- * @param services
17
- */
18
- invokeUntilComplete(method: string, group?: string, args?: unknown[], timeoutLimit?: number, services?: AppService[]): Promise<boolean>;
19
- }
20
- //# sourceMappingURL=MixinsService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MixinsService.d.ts","sourceRoot":"","sources":["../../src/Services/MixinsService.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAG5D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,OAAc,WAAW,SAAY;IAErC;;;;;;;;;;;;;OAaG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAc,EACrB,IAAI,GAAE,OAAO,EAAO,EACpB,YAAY,GAAE,MAAa,EAC3B,QAAQ,GAAE,UAAU,EAAqD,GACxE,OAAO,CAAC,OAAO,CAAC;CA4DpB"}
@@ -1,67 +0,0 @@
1
- import AppService from '@wexample/js-app/Common/AppService';
2
- class MixinsService extends AppService {
3
- /**
4
- * Execute a hook until all ext do not return false.
5
- * Useful to manage order when processing : an ext can wait for
6
- * another one to be executed.
7
- *
8
- * The pre-last arg of callback will be a registry of ext statuses.
9
- * The last arg of callback well be a next() method in case of async operation.
10
- *
11
- * @param method
12
- * @param args
13
- * @param group
14
- * @param timeoutLimit
15
- * @param services
16
- */
17
- async invokeUntilComplete(method, group = 'app', args = [], timeoutLimit = 2000, services = Object.values(this.app.services)) {
18
- const errorTrace = [];
19
- let loops = 0;
20
- const loopsLimit = 100;
21
- const registry = {};
22
- while (true) {
23
- const service = services.shift();
24
- if (!service) {
25
- break;
26
- }
27
- const currentName = service.constructor.serviceName;
28
- const timeout = setTimeout(() => {
29
- const message = [
30
- `Mixins invocation timeout on method "${method}", stopping at "${currentName}".`,
31
- `Registry: ${JSON.stringify(registry)}.`,
32
- ].join(' ');
33
- throw new Error(message);
34
- }, timeoutLimit);
35
- const hooks = service.registerHooks();
36
- const hook = hooks?.[group]?.[method];
37
- if (loops++ > loopsLimit) {
38
- const message = [
39
- `Stopping more than ${loops} recursions during services invocation on method "${method}", stopping at ${currentName}.`,
40
- `Trace: ${errorTrace.join(' -> ') || 'none'}.`,
41
- `Registry: ${JSON.stringify(registry)}.`,
42
- ].join(' ');
43
- throw new Error(message);
44
- }
45
- else if (loops > loopsLimit - 10) {
46
- errorTrace.push(service);
47
- }
48
- if (typeof hook === 'function') {
49
- const argsLocal = args.concat([registry]);
50
- registry[currentName] = await hook.apply(service, argsLocal);
51
- }
52
- if (registry[currentName] === undefined) {
53
- registry[currentName] = AppService.LOAD_STATUS_COMPLETE;
54
- }
55
- // "wait" says to retry after processing other services.
56
- if (registry[currentName] === AppService.LOAD_STATUS_WAIT) {
57
- // Enqueue again.
58
- services.push(service);
59
- }
60
- clearTimeout(timeout);
61
- }
62
- return true;
63
- }
64
- }
65
- MixinsService.serviceName = 'mixins';
66
- export default MixinsService;
67
- //# sourceMappingURL=MixinsService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MixinsService.js","sourceRoot":"","sources":["../../src/Services/MixinsService.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAG5D,MAAqB,aAAc,SAAQ,UAAU;IAGnD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,mBAAmB,CACvB,MAAc,EACd,QAAgB,KAAK,EACrB,OAAkB,EAAE,EACpB,eAAuB,IAAI,EAC3B,WAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAiB;QAEzE,MAAM,UAAU,GAAiB,EAAE,CAAC;QACpC,IAAI,KAAK,GAAW,CAAC,CAAC;QACtB,MAAM,UAAU,GAAW,GAAG,CAAC;QAC/B,MAAM,QAAQ,GAA4B,EAAE,CAAC;QAE7C,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO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P,SAAS,CACV,CAAC;YACJ,CAAC;YAED,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE,CAAC;gBACxC,QAAQ,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC;YAC1D,CAAC;YAED,wDAAwD;YACxD,IAAI,QAAQ,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC,gBAAgB,EAAE,CAAC;gBAC1D,iBAAiB;gBACjB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;YAED,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;;AAjFa,yBAAW,GAAG,QAAQ,CAAC;eADlB,aAAa"}
@@ -1,8 +0,0 @@
1
- import type App from '../Common/App.js';
2
- import type AppService from '../Common/AppService.js';
3
- export type AppServiceConstructor = (new (app: App, ...args: unknown[]) => AppService) & {
4
- serviceName: string;
5
- dependencies?: ServiceDefinition[];
6
- };
7
- export type ServiceDefinition = AppServiceConstructor | [AppServiceConstructor, unknown[]];
8
- //# sourceMappingURL=AppServiceTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppServiceTypes.d.ts","sourceRoot":"","sources":["../../src/Types/AppServiceTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,CAAC,KACnC,GAAG,EAAE,GAAG,EACR,GAAG,IAAI,EAAE,OAAO,EAAE,KACf,UAAU,CAAC,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG,CAAC,qBAAqB,EAAE,OAAO,EAAE,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=AppServiceTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppServiceTypes.js","sourceRoot":"","sources":["../../src/Types/AppServiceTypes.ts"],"names":[],"mappings":""}