@lorion-org/composition-graph 1.0.0-beta.0 → 1.0.0-beta.1
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 +57 -36
- package/examples/deployment-composition.js +21 -15
- package/examples/deployment-composition.ts +28 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,42 +30,65 @@ pnpm add @lorion-org/composition-graph
|
|
|
30
30
|
import { createDescriptorCatalog } from '@lorion-org/composition-graph';
|
|
31
31
|
|
|
32
32
|
const catalog = createDescriptorCatalog({
|
|
33
|
-
|
|
33
|
+
descriptors: [
|
|
34
34
|
{
|
|
35
|
-
id: '
|
|
36
|
-
|
|
35
|
+
id: 'default',
|
|
36
|
+
version: '1.0.0',
|
|
37
|
+
dependencies: { web: '^1.0.0' },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'web',
|
|
41
|
+
version: '1.0.0',
|
|
42
|
+
dependencies: {
|
|
43
|
+
checkout: '^1.0.0',
|
|
44
|
+
payments: '^1.0.0',
|
|
45
|
+
'payment-provider-invoice': '^1.0.0',
|
|
46
|
+
'payment-provider-stripe': '^1.0.0',
|
|
47
|
+
shops: '^1.0.0',
|
|
48
|
+
'shop-coffee': '^1.0.0',
|
|
49
|
+
'shop-stationery': '^1.0.0',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'checkout',
|
|
54
|
+
version: '1.0.0',
|
|
55
|
+
dependencies: { payments: '^1.0.0' },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'payments',
|
|
59
|
+
version: '1.0.0',
|
|
37
60
|
},
|
|
38
|
-
],
|
|
39
|
-
descriptors: [
|
|
40
61
|
{
|
|
41
|
-
id: '
|
|
62
|
+
id: 'shops',
|
|
42
63
|
version: '1.0.0',
|
|
43
|
-
dependencies: { storage: '*' },
|
|
44
|
-
integrations: { analytics: '*' },
|
|
45
64
|
},
|
|
46
65
|
{
|
|
47
|
-
id: '
|
|
66
|
+
id: 'payment-provider-invoice',
|
|
48
67
|
version: '1.0.0',
|
|
68
|
+
providesFor: 'payment-checkout',
|
|
69
|
+
dependencies: { payments: '^1.0.0' },
|
|
49
70
|
},
|
|
50
71
|
{
|
|
51
|
-
id: '
|
|
72
|
+
id: 'payment-provider-stripe',
|
|
52
73
|
version: '1.0.0',
|
|
74
|
+
providesFor: 'payment-checkout',
|
|
75
|
+
dependencies: { payments: '^1.0.0' },
|
|
53
76
|
},
|
|
54
77
|
{
|
|
55
|
-
id: '
|
|
78
|
+
id: 'shop-coffee',
|
|
56
79
|
version: '1.0.0',
|
|
57
|
-
dependencies: {
|
|
80
|
+
dependencies: { shops: '^1.0.0' },
|
|
58
81
|
},
|
|
59
82
|
{
|
|
60
|
-
id: '
|
|
83
|
+
id: 'shop-stationery',
|
|
61
84
|
version: '1.0.0',
|
|
85
|
+
dependencies: { shops: '^1.0.0' },
|
|
62
86
|
},
|
|
63
87
|
],
|
|
64
88
|
});
|
|
65
89
|
|
|
66
90
|
const selection = catalog.resolveSelection({
|
|
67
|
-
selected: ['
|
|
68
|
-
baseDescriptors: ['web-shell'],
|
|
91
|
+
selected: ['default'],
|
|
69
92
|
});
|
|
70
93
|
|
|
71
94
|
console.log(selection.getResolved());
|
|
@@ -83,33 +106,32 @@ import { createDescriptorCatalog } from '@lorion-org/composition-graph';
|
|
|
83
106
|
const catalog = createDescriptorCatalog({
|
|
84
107
|
descriptors: [
|
|
85
108
|
{
|
|
86
|
-
id: '
|
|
109
|
+
id: 'web',
|
|
87
110
|
version: '1.0.0',
|
|
88
|
-
dependencies: {
|
|
111
|
+
dependencies: { checkout: '^1.0.0', shops: '^1.0.0' },
|
|
89
112
|
},
|
|
90
113
|
{
|
|
91
|
-
id: '
|
|
114
|
+
id: 'checkout',
|
|
92
115
|
version: '1.0.0',
|
|
116
|
+
dependencies: { payments: '^1.0.0' },
|
|
93
117
|
},
|
|
94
118
|
{
|
|
95
|
-
id: '
|
|
119
|
+
id: 'payments',
|
|
96
120
|
version: '1.0.0',
|
|
97
|
-
dependencies: { router: '*' },
|
|
98
121
|
},
|
|
99
122
|
{
|
|
100
|
-
id: '
|
|
123
|
+
id: 'shops',
|
|
101
124
|
version: '1.0.0',
|
|
102
125
|
},
|
|
103
126
|
],
|
|
104
127
|
});
|
|
105
128
|
|
|
106
129
|
const selection = catalog.resolveSelection({
|
|
107
|
-
|
|
108
|
-
baseDescriptors: ['web-shell'],
|
|
130
|
+
baseDescriptors: ['web'],
|
|
109
131
|
});
|
|
110
132
|
|
|
111
133
|
selection.getResolved();
|
|
112
|
-
// => ['
|
|
134
|
+
// => ['checkout', 'payments', 'shops', 'web']
|
|
113
135
|
```
|
|
114
136
|
|
|
115
137
|
## Example: explain why something is present
|
|
@@ -123,30 +145,30 @@ import { createDescriptorCatalog } from '@lorion-org/composition-graph';
|
|
|
123
145
|
const catalog = createDescriptorCatalog({
|
|
124
146
|
descriptors: [
|
|
125
147
|
{
|
|
126
|
-
id: '
|
|
148
|
+
id: 'web',
|
|
127
149
|
version: '1.0.0',
|
|
128
|
-
dependencies: {
|
|
150
|
+
dependencies: { checkout: '^1.0.0' },
|
|
129
151
|
},
|
|
130
152
|
{
|
|
131
|
-
id: '
|
|
153
|
+
id: 'checkout',
|
|
132
154
|
version: '1.0.0',
|
|
133
|
-
dependencies: {
|
|
155
|
+
dependencies: { payments: '^1.0.0' },
|
|
134
156
|
},
|
|
135
157
|
{
|
|
136
|
-
id: '
|
|
158
|
+
id: 'payments',
|
|
137
159
|
version: '1.0.0',
|
|
138
160
|
},
|
|
139
161
|
],
|
|
140
162
|
});
|
|
141
163
|
|
|
142
164
|
catalog.explain({
|
|
143
|
-
from: '
|
|
144
|
-
to: '
|
|
165
|
+
from: 'web',
|
|
166
|
+
to: 'payments',
|
|
145
167
|
relationIds: ['dependencies'],
|
|
146
168
|
});
|
|
147
169
|
// => [
|
|
148
|
-
// { from: '
|
|
149
|
-
// { from: '
|
|
170
|
+
// { from: 'web', to: 'checkout', relation: 'dependencies' },
|
|
171
|
+
// { from: 'checkout', to: 'payments', relation: 'dependencies' },
|
|
150
172
|
// ]
|
|
151
173
|
```
|
|
152
174
|
|
|
@@ -160,9 +182,8 @@ import { createDescriptorCatalog } from '@lorion-org/composition-graph';
|
|
|
160
182
|
import { discoverDescriptors } from '@lorion-org/descriptor-discovery';
|
|
161
183
|
|
|
162
184
|
const discovered = discoverDescriptors({
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
idField: 'name',
|
|
185
|
+
cwd: './playground',
|
|
186
|
+
descriptorPaths: ['layer-extensions/*/extension.json'],
|
|
166
187
|
nestedField: 'bundles',
|
|
167
188
|
});
|
|
168
189
|
|
|
@@ -2,42 +2,48 @@
|
|
|
2
2
|
import { createDescriptorCatalog } from '../dist/index.js';
|
|
3
3
|
|
|
4
4
|
const catalog = createDescriptorCatalog({
|
|
5
|
-
|
|
5
|
+
descriptors: [
|
|
6
6
|
{
|
|
7
|
-
id: '
|
|
8
|
-
|
|
7
|
+
id: 'web',
|
|
8
|
+
version: '1.0.0',
|
|
9
|
+
dependencies: {
|
|
10
|
+
checkout: '^1.0.0',
|
|
11
|
+
payments: '^1.0.0',
|
|
12
|
+
'payment-provider-invoice': '^1.0.0',
|
|
13
|
+
'payment-provider-stripe': '^1.0.0',
|
|
14
|
+
shops: '^1.0.0',
|
|
15
|
+
},
|
|
9
16
|
},
|
|
10
|
-
],
|
|
11
|
-
descriptors: [
|
|
12
17
|
{
|
|
13
|
-
id: '
|
|
18
|
+
id: 'checkout',
|
|
14
19
|
version: '1.0.0',
|
|
15
|
-
dependencies: {
|
|
16
|
-
integrations: { analytics: '*' },
|
|
20
|
+
dependencies: { payments: '^1.0.0' },
|
|
17
21
|
},
|
|
18
22
|
{
|
|
19
|
-
id: '
|
|
23
|
+
id: 'payments',
|
|
20
24
|
version: '1.0.0',
|
|
21
25
|
},
|
|
22
26
|
{
|
|
23
|
-
id: '
|
|
27
|
+
id: 'shops',
|
|
24
28
|
version: '1.0.0',
|
|
25
29
|
},
|
|
26
30
|
{
|
|
27
|
-
id: '
|
|
31
|
+
id: 'payment-provider-invoice',
|
|
28
32
|
version: '1.0.0',
|
|
29
|
-
|
|
33
|
+
providesFor: 'payment-checkout',
|
|
34
|
+
dependencies: { payments: '^1.0.0' },
|
|
30
35
|
},
|
|
31
36
|
{
|
|
32
|
-
id: '
|
|
37
|
+
id: 'payment-provider-stripe',
|
|
33
38
|
version: '1.0.0',
|
|
39
|
+
providesFor: 'payment-checkout',
|
|
40
|
+
dependencies: { payments: '^1.0.0' },
|
|
34
41
|
},
|
|
35
42
|
],
|
|
36
43
|
});
|
|
37
44
|
|
|
38
45
|
const selection = catalog.resolveSelection({
|
|
39
|
-
selected: ['
|
|
40
|
-
baseDescriptors: ['ui-shell'],
|
|
46
|
+
selected: ['web'],
|
|
41
47
|
});
|
|
42
48
|
|
|
43
49
|
process.stdout.write(`${selection.getResolved().join(', ')}\n`);
|
|
@@ -1,52 +1,59 @@
|
|
|
1
1
|
import { createDescriptorCatalog } from '@lorion-org/composition-graph';
|
|
2
2
|
|
|
3
3
|
const catalog = createDescriptorCatalog({
|
|
4
|
-
|
|
4
|
+
descriptors: [
|
|
5
5
|
{
|
|
6
|
-
id: '
|
|
7
|
-
|
|
6
|
+
id: 'web',
|
|
7
|
+
version: '1.0.0',
|
|
8
|
+
dependencies: {
|
|
9
|
+
checkout: '^1.0.0',
|
|
10
|
+
payments: '^1.0.0',
|
|
11
|
+
'payment-provider-invoice': '^1.0.0',
|
|
12
|
+
'payment-provider-stripe': '^1.0.0',
|
|
13
|
+
shops: '^1.0.0',
|
|
14
|
+
},
|
|
8
15
|
},
|
|
9
|
-
],
|
|
10
|
-
descriptors: [
|
|
11
16
|
{
|
|
12
|
-
id: '
|
|
17
|
+
id: 'checkout',
|
|
13
18
|
version: '1.0.0',
|
|
14
|
-
dependencies: {
|
|
15
|
-
integrations: { analytics: '*' },
|
|
19
|
+
dependencies: { payments: '^1.0.0' },
|
|
16
20
|
},
|
|
17
21
|
{
|
|
18
|
-
id: '
|
|
22
|
+
id: 'payments',
|
|
19
23
|
version: '1.0.0',
|
|
20
24
|
},
|
|
21
25
|
{
|
|
22
|
-
id: '
|
|
26
|
+
id: 'shops',
|
|
23
27
|
version: '1.0.0',
|
|
24
28
|
},
|
|
25
29
|
{
|
|
26
|
-
id: '
|
|
30
|
+
id: 'payment-provider-invoice',
|
|
27
31
|
version: '1.0.0',
|
|
28
|
-
|
|
32
|
+
providesFor: 'payment-checkout',
|
|
33
|
+
dependencies: { payments: '^1.0.0' },
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
|
-
id: '
|
|
36
|
+
id: 'payment-provider-stripe',
|
|
32
37
|
version: '1.0.0',
|
|
38
|
+
providesFor: 'payment-checkout',
|
|
39
|
+
dependencies: { payments: '^1.0.0' },
|
|
33
40
|
},
|
|
34
41
|
],
|
|
35
42
|
});
|
|
36
43
|
|
|
37
44
|
const selection = catalog.resolveSelection({
|
|
38
|
-
selected: ['
|
|
39
|
-
baseDescriptors: ['ui-shell'],
|
|
45
|
+
selected: ['web'],
|
|
40
46
|
});
|
|
41
47
|
|
|
42
48
|
console.log(selection.getResolved());
|
|
43
|
-
// ['
|
|
49
|
+
// ['checkout', 'payment-provider-invoice', 'payment-provider-stripe', 'payments', 'shops', 'web']
|
|
44
50
|
|
|
45
51
|
console.log(selection.getProvenance());
|
|
46
52
|
// [
|
|
47
|
-
// { descriptorId: '
|
|
48
|
-
// { descriptorId: '
|
|
49
|
-
// { descriptorId: '
|
|
50
|
-
// { descriptorId: '
|
|
51
|
-
// { descriptorId: '
|
|
53
|
+
// { descriptorId: 'checkout', origins: ['resolved'] },
|
|
54
|
+
// { descriptorId: 'payment-provider-invoice', origins: ['resolved'] },
|
|
55
|
+
// { descriptorId: 'payment-provider-stripe', origins: ['resolved'] },
|
|
56
|
+
// { descriptorId: 'payments', origins: ['resolved'] },
|
|
57
|
+
// { descriptorId: 'shops', origins: ['resolved'] },
|
|
58
|
+
// { descriptorId: 'web', origins: ['selected'] }
|
|
52
59
|
// ]
|
package/package.json
CHANGED