@travetto/registry 3.0.2 → 3.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -11
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!-- This file was generated by @travetto/doc and should not be modified directly -->
|
|
2
|
-
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/registry/DOC.
|
|
2
|
+
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/registry/DOC.tsx and execute "npx trv doc" to rebuild -->
|
|
3
3
|
# Registry
|
|
4
|
+
|
|
4
5
|
## Patterns and utilities for handling registration of metadata and functionality for run-time use
|
|
5
6
|
|
|
6
7
|
**Install: @travetto/registry**
|
|
@@ -18,14 +19,10 @@ This module is the backbone for all "discovered" and "registered" behaviors with
|
|
|
18
19
|
Registration, within the framework flows throw two main use cases:
|
|
19
20
|
|
|
20
21
|
### Initial Flows
|
|
21
|
-
|
|
22
22
|
The primary flow occurs on initialization of the application. At that point, the module will:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
1. Initialize [RootRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/root.ts) and will automatically register/load all relevant files
|
|
23
|
+
1. Initialize [RootRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/root.ts#L10) and will automatically register/load all relevant files
|
|
26
24
|
1. As files are imported, decorators within the files will record various metadata relevant to the respective registries
|
|
27
|
-
1. When all files are processed, the [RootRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/root.ts) is finished, and it will signal to anything waiting on registered data that its free to use it.
|
|
28
|
-
|
|
25
|
+
1. When all files are processed, the [RootRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/root.ts#L10) is finished, and it will signal to anything waiting on registered data that its free to use it.
|
|
29
26
|
This flow ensures all files are loaded and processed before application starts. A sample registry could like:
|
|
30
27
|
|
|
31
28
|
**Code: Sample Registry**
|
|
@@ -75,16 +72,16 @@ export class SampleRegistry extends MetadataRegistry<Group, Child> {
|
|
|
75
72
|
The registry is a [MetadataRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/metadata.ts#L13) that similar to the [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.")'s Schema registry and [Dependency Injection](https://github.com/travetto/travetto/tree/main/module/di#readme "Dependency registration/management and injection support.")'s Dependency registry.
|
|
76
73
|
|
|
77
74
|
### Live Flow
|
|
78
|
-
At runtime, the registry is designed to listen for changes and to propagate the changes as necessary. In many cases the same file is handled by multiple registries.
|
|
75
|
+
At runtime, the registry is designed to listen for changes and to propagate the changes as necessary. In many cases the same file is handled by multiple registries.
|
|
79
76
|
|
|
80
|
-
As the [DynamicFileLoader](https://github.com/travetto/travetto/tree/main/module/base/src/internal/file-loader.ts) notifies that a file has been changed, the [RootRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/root.ts) will pick it up, and process it accordingly.
|
|
77
|
+
As the [DynamicFileLoader](https://github.com/travetto/travetto/tree/main/module/base/src/internal/file-loader.ts#L24) notifies that a file has been changed, the [RootRegistry](https://github.com/travetto/travetto/tree/main/module/registry/src/service/root.ts#L10) will pick it up, and process it accordingly.
|
|
81
78
|
|
|
82
79
|
## Supporting Metadata
|
|
83
|
-
|
|
84
|
-
As mentioned in [Manifest](https://github.com/travetto/travetto/tree/main/module/manifest#readme "Support for project indexing, manifesting, along with file watching")'s readme, the framework produces hashes of methods, classes, and functions, to allow for detecting changes to individual parts of the codebase. During the live flow, various registries will inspect this information to determine if action should be taken.
|
|
80
|
+
As mentioned in [Manifest](https://github.com/travetto/travetto/tree/main/module/manifest#readme "Support for project indexing, manifesting, along with file watching")'s readme, the framework produces hashes of methods, classes, and functions, to allow for detecting changes to individual parts of the codebase. During the live flow, various registries will inspect this information to determine if action should be taken.
|
|
85
81
|
|
|
86
82
|
**Code: Sample Class Diffing**
|
|
87
83
|
```typescript
|
|
84
|
+
|
|
88
85
|
#handleFileChanges(file: string, classes: Class[] = []): void {
|
|
89
86
|
const next = new Map<string, Class>(classes.map(cls => [cls.Ⲑid, cls] as const));
|
|
90
87
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/registry",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.1.0-rc.0",
|
|
4
4
|
"description": "Patterns and utilities for handling registration of metadata and functionality for run-time use",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ast-transformations",
|
|
@@ -27,14 +27,18 @@
|
|
|
27
27
|
"directory": "module/registry"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/base": "^3.0.
|
|
30
|
+
"@travetto/base": "^3.1.0-rc.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@travetto/transformer": "^3.0.
|
|
33
|
+
"@travetto/transformer": "^3.1.0-rc.0",
|
|
34
|
+
"@travetto/cli": "^3.1.0-rc.0"
|
|
34
35
|
},
|
|
35
36
|
"peerDependenciesMeta": {
|
|
36
37
|
"@travetto/transformer": {
|
|
37
38
|
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"@travetto/cli": {
|
|
41
|
+
"optional": true
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
"travetto": {
|