@servable/tools 1.3.0 → 1.4.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 +1 -1
- package/package.json +2 -2
- package/src/config/candidates/index.js +5 -5
- package/src/config/candidates/{featureCandidates → protocolCandidates}/index.js +5 -5
- package/src/config/validate/index.js +2 -2
- package/src/config/validate/{feature → protocol}/index.js +1 -1
- package/src/document/{1.1.0/all/build/feature → 1.0.0/all/build/protocol}/index.js +23 -23
- package/src/document/1.0.0/all/index.js +4 -4
- package/src/document/1.0.0/all/write/index.js +3 -3
- package/src/document/1.0.0/chunks/build/class/class.js +2 -2
- package/src/document/1.0.0/chunks/build/class/functions.js +2 -2
- package/src/document/1.0.0/chunks/build/class/lib.js +2 -2
- package/src/document/1.0.0/chunks/build/class/seed.js +2 -2
- package/src/document/1.0.0/chunks/build/class/triggers.js +2 -2
- package/src/document/1.0.0/chunks/build/{feature → protocol}/afterInit.js +2 -2
- package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/beforeInit.js +2 -2
- package/src/document/1.0.0/chunks/build/{feature → protocol}/class.js +3 -3
- package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/config.js +2 -2
- package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/functions.js +2 -2
- package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/lib.js +2 -2
- package/src/document/1.0.0/chunks/build/{feature → protocol}/liveClasses.js +2 -2
- package/src/document/1.0.0/chunks/build/{feature → protocol}/schema.js +2 -2
- package/src/document/1.0.0/chunks/build/{feature → protocol}/seed.js +2 -2
- package/src/document/1.0.0/chunks/build/{feature → protocol}/system.js +2 -2
- package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/triggers.js +2 -2
- package/src/document/1.0.0/generateGithubReadme/build/chunks/dependencies/index.js +2 -2
- package/src/document/1.0.0/generateGithubReadme/build/chunks/footer.js +1 -1
- package/src/document/1.0.0/generateGithubReadme/build/chunks/githubTags.js +3 -3
- package/src/document/1.0.0/generateGithubReadme/build/chunks/registry.js +2 -2
- package/src/document/1.0.0/generateGithubReadme/build/chunks/usage.js +1 -1
- package/src/document/1.0.0/generateGithubReadme/build/index.js +23 -23
- package/src/document/{1.0.0/all/build/feature → 1.1.0/all/build/protocol}/index.js +23 -23
- package/src/document/1.1.0/all/index.js +4 -4
- package/src/document/1.1.0/all/write/index.js +3 -3
- package/src/document/1.1.0/chunks/build/class/class.js +2 -2
- package/src/document/1.1.0/chunks/build/class/functions.js +2 -2
- package/src/document/1.1.0/chunks/build/class/lib.js +2 -2
- package/src/document/1.1.0/chunks/build/class/seed.js +2 -2
- package/src/document/1.1.0/chunks/build/class/triggers.js +2 -2
- package/src/document/1.1.0/chunks/build/{feature → protocol}/afterInit.js +2 -2
- package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/beforeInit.js +2 -2
- package/src/document/1.1.0/chunks/build/{feature → protocol}/class.js +3 -3
- package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/config.js +2 -2
- package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/functions.js +2 -2
- package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/lib.js +2 -2
- package/src/document/1.1.0/chunks/build/{feature → protocol}/liveClasses.js +2 -2
- package/src/document/1.1.0/chunks/build/{feature → protocol}/schema.js +2 -2
- package/src/document/1.1.0/chunks/build/{feature → protocol}/seed.js +2 -2
- package/src/document/1.1.0/chunks/build/{feature → protocol}/system.js +2 -2
- package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/triggers.js +2 -2
- package/src/document/1.1.0/generateGithubReadme/build/chunks/dependencies/index.js +2 -2
- package/src/document/1.1.0/generateGithubReadme/build/chunks/footer.js +1 -1
- package/src/document/1.1.0/generateGithubReadme/build/chunks/githubTags.js +3 -3
- package/src/document/1.1.0/generateGithubReadme/build/chunks/registry.js +2 -2
- package/src/document/1.1.0/generateGithubReadme/build/chunks/usage.js +1 -1
- package/src/document/1.1.0/generateGithubReadme/build/index.js +23 -23
- package/src/document/gateway/all/index.js +2 -2
- package/src/document/gateway/generateGithubReadme/index.js +2 -2
- package/src/domain/{feature → protocol}/factory/absoluteModuleSrcPath.js +3 -3
- package/src/domain/protocol/factory/index.js +71 -0
- package/src/domain/protocol/factory/protocolPath.js +41 -0
- package/src/domain/{feature → protocol}/index.js +6 -6
- package/src/domain/{feature → protocol}/lib/instancesPathIdUniqueId.js +3 -3
- package/src/domain/protocolInstance/factory/getLoaderWithPayload.js +7 -0
- package/src/domain/{featureInstance → protocolInstance}/factory/index.js +7 -7
- package/src/domain/{featureInstance → protocolInstance}/index.js +16 -16
- package/src/domain/{featureLoader → protocolLoader}/base.js +9 -9
- package/src/domain/protocolLoader/lib/mergeClassProtocols.js +17 -0
- package/src/domain/{featureLoader → protocolLoader}/v1.0.0.js +66 -34
- package/src/domain/{featureLoader → protocolLoader}/v1.1.0.js +68 -31
- package/src/index.js +7 -7
- package/src/lib/adaptConfig/basic.js +59 -59
- package/src/manifest/access/index.js +1 -1
- package/src/manifest/data/1.0.0/class.json +3 -3
- package/src/manifest/data/1.0.0/enums.js +6 -6
- package/src/manifest/data/1.0.0/{feature.json → protocol.json} +5 -5
- package/src/manifest/data/1.1.0/class.json +3 -3
- package/src/manifest/data/1.1.0/enums.js +6 -6
- package/src/manifest/data/1.1.0/{feature.json → protocol.json} +4 -4
- package/src/manifest/extract/index.js +1 -1
- package/src/manifest/extract/templateDataForId.js +3 -3
- package/src/schema/build/buildProtocol/classStruct/extractProtocolsProtocols.js +29 -0
- package/src/schema/build/buildProtocol/classStruct/index.js +62 -0
- package/src/schema/build/{buildFeature/classStruct/featureInClassClassSchema.js → buildProtocol/classStruct/protocolInClassClassSchema.js} +7 -7
- package/src/schema/build/buildProtocol/extractClassesProtocol.js +49 -0
- package/src/schema/build/{buildFeature → buildProtocol}/index.js +40 -40
- package/src/schema/build/index.js +29 -29
- package/src/schema/build/lib/{getFeaturesLiveClasses.js → getProtocolsLiveClasses.js} +4 -4
- package/src/schema/build/lib/updateProtocolsExcerpt.js +24 -0
- package/src/schema/index.js +30 -30
- package/src/schema/validate/{handleFeature → handleProtocol}/computeVersions.js +2 -2
- package/src/schema/validate/handleProtocol/index.js +5 -0
- package/src/schema/validate/index.js +6 -6
- package/src/domain/feature/factory/featurePath.js +0 -41
- package/src/domain/feature/factory/index.js +0 -71
- package/src/domain/featureInstance/factory/getLoaderWithPayload.js +0 -7
- package/src/domain/featureLoader/lib/mergeClassFeatures.js +0 -17
- package/src/schema/build/buildFeature/classStruct/extractFeaturesFeatures.js +0 -29
- package/src/schema/build/buildFeature/classStruct/index.js +0 -62
- package/src/schema/build/buildFeature/extractClassesFeature.js +0 -49
- package/src/schema/build/lib/updateFeaturesExcerpt.js +0 -24
- package/src/schema/validate/handleFeature/index.js +0 -5
- /package/src/document/1.0.0/all/write/{feature → protocol}/index.js +0 -0
- /package/src/document/1.1.0/all/write/{feature → protocol}/index.js +0 -0
- /package/src/domain/{featureInstance → protocolInstance}/factory/instancesWithPath.js +0 -0
- /package/src/domain/{featureLoader → protocolLoader}/factory/getModule.js +0 -0
- /package/src/domain/{featureLoader → protocolLoader}/factory/index.js +0 -0
- /package/src/domain/{featureLoader → protocolLoader}/lib/importJSDefault.js +0 -0
- /package/src/domain/{featureLoader → protocolLoader}/lib/importJSONDefault.js +0 -0
- /package/src/domain/{featureLoader → protocolLoader}/lib/triggerItems.js +0 -0
- /package/src/lib/{adaptFeaturePayload.js → adaptProtocolPayload.js} +0 -0
- /package/src/lib/{cleanFeatures.js → cleanProtocols.js} +0 -0
- /package/src/lib/{featureApiVersion.js → protocolApiVersion.js} +0 -0
- /package/src/schema/build/{buildFeature → buildProtocol}/classStruct/preserveMostRestricted.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "root",
|
|
3
|
-
"name": "
|
|
4
|
-
"description": "
|
|
3
|
+
"name": "protocol",
|
|
4
|
+
"description": "protocol",
|
|
5
5
|
"routes": [
|
|
6
6
|
{
|
|
7
7
|
"type": "folder",
|
|
@@ -161,14 +161,14 @@
|
|
|
161
161
|
]
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
|
-
"id": "
|
|
164
|
+
"id": "protocols",
|
|
165
165
|
"routes": [
|
|
166
166
|
{
|
|
167
167
|
"type": "file",
|
|
168
168
|
"mimeTypes": [
|
|
169
169
|
"text/javascript"
|
|
170
170
|
],
|
|
171
|
-
"path": "
|
|
171
|
+
"path": "protocols"
|
|
172
172
|
}
|
|
173
173
|
]
|
|
174
174
|
}
|
|
@@ -500,4 +500,4 @@
|
|
|
500
500
|
]
|
|
501
501
|
}
|
|
502
502
|
]
|
|
503
|
-
}
|
|
503
|
+
}
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
"id": "
|
|
83
|
+
"id": "protocols",
|
|
84
84
|
"routes": [
|
|
85
85
|
{
|
|
86
86
|
"type": "file",
|
|
87
87
|
"mimeTypes": [
|
|
88
88
|
"text/javascript"
|
|
89
89
|
],
|
|
90
|
-
"path": "
|
|
90
|
+
"path": "protocols"
|
|
91
91
|
}
|
|
92
92
|
]
|
|
93
93
|
}
|
|
@@ -230,4 +230,4 @@
|
|
|
230
230
|
]
|
|
231
231
|
}
|
|
232
232
|
]
|
|
233
|
-
}
|
|
233
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const ProtocolEnum = {
|
|
2
2
|
Index: {
|
|
3
3
|
id: 'index'
|
|
4
4
|
},
|
|
@@ -57,8 +57,8 @@ export const FeatureEnum = {
|
|
|
57
57
|
id: 'index',
|
|
58
58
|
parents: ['class'],
|
|
59
59
|
},
|
|
60
|
-
|
|
61
|
-
id: '
|
|
60
|
+
Protocols: {
|
|
61
|
+
id: 'protocols',
|
|
62
62
|
parents: ['class']
|
|
63
63
|
},
|
|
64
64
|
},
|
|
@@ -166,8 +166,8 @@ export const ClassEnum = {
|
|
|
166
166
|
id: 'index',
|
|
167
167
|
parents: ['class']
|
|
168
168
|
},
|
|
169
|
-
|
|
170
|
-
id: '
|
|
169
|
+
Protocols: {
|
|
170
|
+
id: 'protocols',
|
|
171
171
|
parents: ['class']
|
|
172
172
|
},
|
|
173
173
|
},
|
|
@@ -261,7 +261,7 @@ export const SchemaEnum = {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
export const DataTemplateType = {
|
|
264
|
-
|
|
264
|
+
Protocol: 'protocol',
|
|
265
265
|
Class: 'class',
|
|
266
266
|
Schema: 'schema',
|
|
267
267
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "root",
|
|
3
|
-
"name": "
|
|
4
|
-
"description": "
|
|
3
|
+
"name": "protocol",
|
|
4
|
+
"description": "protocol",
|
|
5
5
|
"routes": [
|
|
6
6
|
{
|
|
7
7
|
"type": "folder",
|
|
@@ -167,14 +167,14 @@
|
|
|
167
167
|
]
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
|
-
"id": "
|
|
170
|
+
"id": "protocols",
|
|
171
171
|
"routes": [
|
|
172
172
|
{
|
|
173
173
|
"type": "file",
|
|
174
174
|
"mimeTypes": [
|
|
175
175
|
"text/javascript"
|
|
176
176
|
],
|
|
177
|
-
"path": "
|
|
177
|
+
"path": "protocols"
|
|
178
178
|
}
|
|
179
179
|
]
|
|
180
180
|
}
|
|
@@ -9,9 +9,9 @@ const __filename = fileURLToPath(import.meta.url)
|
|
|
9
9
|
const __dirname = dirname(__filename)
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
export default async ({ id, path:
|
|
12
|
+
export default async ({ id, path: protocolPath }) => {
|
|
13
13
|
let version = "1.0.0"
|
|
14
|
-
let index = await loadIndex(
|
|
14
|
+
let index = await loadIndex(protocolPath)
|
|
15
15
|
if (index && index.apiVersion) {
|
|
16
16
|
version = index.apiVersion
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ export default async ({ id, path: featurePath }) => {
|
|
|
19
19
|
let url = `${basePath}/${version}/${id}.json`
|
|
20
20
|
url = path.resolve(__dirname, url)
|
|
21
21
|
if (!(await checkFileExists(url))) {
|
|
22
|
-
throw { message: `Could not find template data ${id} at path ${
|
|
22
|
+
throw { message: `Could not find template data ${id} at path ${protocolPath}` }
|
|
23
23
|
}
|
|
24
24
|
let data = await importJSONAsync(url)
|
|
25
25
|
return data
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _ from 'underscore'
|
|
2
|
+
import adaptProtocolPayload from '../../../../lib/adaptProtocolPayload.js'
|
|
3
|
+
import cleanProtocols from '../../../../lib/cleanProtocols.js'
|
|
4
|
+
|
|
5
|
+
export default async ({
|
|
6
|
+
protocolsPayloads,
|
|
7
|
+
protocolFactory,
|
|
8
|
+
instancesPathId }) => {
|
|
9
|
+
|
|
10
|
+
let items = []
|
|
11
|
+
|
|
12
|
+
for (var i in protocolsPayloads) {
|
|
13
|
+
const protocolPayload = protocolsPayloads[i]
|
|
14
|
+
const protocol = await protocolFactory({
|
|
15
|
+
protocolPayload,
|
|
16
|
+
instancesPathId
|
|
17
|
+
})
|
|
18
|
+
//#TODO: protocol.loader
|
|
19
|
+
const ownProtocols = await protocol.loader.ownProtocols()
|
|
20
|
+
let a = (ownProtocols && ownProtocols.length) ? ownProtocols.map(adaptProtocolPayload) : null
|
|
21
|
+
if (a && a.length) {
|
|
22
|
+
items = items.concat(a)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
items = _.flatten(items.filter(a => a)).filter(a => a)
|
|
27
|
+
items = cleanProtocols(items)
|
|
28
|
+
return items
|
|
29
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import protocolInClassClassSchema from './protocolInClassClassSchema.js'
|
|
2
|
+
import adaptProtocolPayload from '../../../../lib/adaptProtocolPayload.js'
|
|
3
|
+
import extractProtocolProtocols from './extractProtocolsProtocols.js'
|
|
4
|
+
import cleanProtocols from '../../../../lib/cleanProtocols.js'
|
|
5
|
+
|
|
6
|
+
export default async ({
|
|
7
|
+
protocol,
|
|
8
|
+
classSchema,
|
|
9
|
+
protocolFactory,
|
|
10
|
+
instancesPathId
|
|
11
|
+
}) => {
|
|
12
|
+
|
|
13
|
+
const { className } = classSchema
|
|
14
|
+
|
|
15
|
+
//#TODO: protocol.loader
|
|
16
|
+
let protocolsPayloads = await protocol.loader.classProtocols({
|
|
17
|
+
className,
|
|
18
|
+
withProtocolsProtocols: false
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
if (!protocolsPayloads
|
|
22
|
+
|| !protocolsPayloads.length) {
|
|
23
|
+
return { classSchema }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protocolsPayloads = protocolsPayloads.map(adaptProtocolPayload)
|
|
27
|
+
|
|
28
|
+
if (!protocolsPayloads || !protocolsPayloads.length) {
|
|
29
|
+
return { classSchema }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let protocolsProtocols = await extractProtocolProtocols({
|
|
33
|
+
protocolsPayloads,
|
|
34
|
+
protocolFactory,
|
|
35
|
+
instancesPathId
|
|
36
|
+
})
|
|
37
|
+
protocolsPayloads = cleanProtocols([...protocolsPayloads, ...protocolsProtocols])
|
|
38
|
+
|
|
39
|
+
let _classSchema = { ...classSchema }
|
|
40
|
+
|
|
41
|
+
for (var i in protocolsPayloads) {
|
|
42
|
+
const protocolPayload = protocolsPayloads[i]
|
|
43
|
+
const protocol = await protocolFactory({
|
|
44
|
+
protocolPayload,
|
|
45
|
+
instancesPathId
|
|
46
|
+
})
|
|
47
|
+
_classSchema = await protocolInClassClassSchema({
|
|
48
|
+
protocol,
|
|
49
|
+
classSchema: _classSchema,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
//#TODO: protocol.loader
|
|
55
|
+
const _class = await protocol.loader.getClass({ className })
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
classSchema: _classSchema,
|
|
59
|
+
protocolsPayloads,
|
|
60
|
+
_class
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import preserveMostRestricted from './preserveMostRestricted.js'
|
|
2
2
|
|
|
3
3
|
export default async (props) => {
|
|
4
|
-
const { classSchema,
|
|
4
|
+
const { classSchema, protocol } = props
|
|
5
5
|
let _classSchema = { ...classSchema }
|
|
6
6
|
try {
|
|
7
|
-
//#TODO:
|
|
8
|
-
const _fields = await
|
|
7
|
+
//#TODO: protocol.loader
|
|
8
|
+
const _fields = await protocol.loader.schemaFields()
|
|
9
9
|
if (_fields) {
|
|
10
10
|
_classSchema.fields = {
|
|
11
11
|
..._classSchema.fields,
|
|
@@ -13,8 +13,8 @@ export default async (props) => {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
//#TODO:
|
|
17
|
-
const _indexes = await
|
|
16
|
+
//#TODO: protocol.loader
|
|
17
|
+
const _indexes = await protocol.loader.schemaIndexes()
|
|
18
18
|
if (_indexes) {
|
|
19
19
|
_classSchema.indexes = {
|
|
20
20
|
..._classSchema.indexes,
|
|
@@ -22,8 +22,8 @@ export default async (props) => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
//#TODO:
|
|
26
|
-
const _classLevelPermissions = await
|
|
25
|
+
//#TODO: protocol.loader
|
|
26
|
+
const _classLevelPermissions = await protocol.loader.schemaClassLevelPermissions()
|
|
27
27
|
let __classLevelPermissions
|
|
28
28
|
if (_classLevelPermissions && Object.keys(_classLevelPermissions).length) {
|
|
29
29
|
__classLevelPermissions = preserveMostRestricted([_classSchema.classLevelPermissions, _classLevelPermissions])
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _ from 'underscore'
|
|
2
|
+
|
|
3
|
+
export default async ({
|
|
4
|
+
protocolsPayloads,
|
|
5
|
+
protocolFactory,
|
|
6
|
+
extractProtocol,
|
|
7
|
+
updateProtocolsExcerpt,
|
|
8
|
+
instancesPathId }) => {
|
|
9
|
+
|
|
10
|
+
let protocols = []
|
|
11
|
+
|
|
12
|
+
for (var i in protocolsPayloads) {
|
|
13
|
+
const protocolPayload = protocolsPayloads[i]
|
|
14
|
+
|
|
15
|
+
const protocol = await protocolFactory({
|
|
16
|
+
protocolPayload,
|
|
17
|
+
instancesPathId,
|
|
18
|
+
// instancesPathId: _instancesPathId
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
if (protocol && protocol.extractionStatus === 2) {
|
|
22
|
+
protocols.push(protocol)
|
|
23
|
+
continue
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const extractedProtocolStruct = await extractProtocol({
|
|
27
|
+
protocolFactory,
|
|
28
|
+
updateProtocolsExcerpt,
|
|
29
|
+
protocol,
|
|
30
|
+
instancesPathId: [
|
|
31
|
+
...instancesPathId,
|
|
32
|
+
{ type: 'protocol', value: { id: protocolPayload.id } }
|
|
33
|
+
]
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
protocols.push(extractedProtocolStruct)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!protocols || !protocols.length) {
|
|
40
|
+
return []
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protocols = _.flatten(protocols)
|
|
44
|
+
protocols = protocols.filter(a => a)
|
|
45
|
+
protocols = _.flatten(_.flatten(protocols))
|
|
46
|
+
protocols = _.uniq(protocols, 'id')
|
|
47
|
+
|
|
48
|
+
return protocols
|
|
49
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import classStruct from './classStruct/index.js'
|
|
2
2
|
import _ from 'underscore'
|
|
3
|
-
import
|
|
3
|
+
import extractClassesProtocol from './extractClassesProtocol.js'
|
|
4
4
|
|
|
5
5
|
const perform = async ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
protocolFactory,
|
|
7
|
+
protocol,
|
|
8
|
+
updateProtocolsExcerpt,
|
|
9
9
|
instancesPathId = []
|
|
10
10
|
}) => {
|
|
11
11
|
|
|
12
12
|
const defaultResult = [
|
|
13
|
-
|
|
13
|
+
protocol
|
|
14
14
|
]
|
|
15
15
|
|
|
16
|
-
//#TODO:
|
|
17
|
-
if (!(await
|
|
18
|
-
console.log('
|
|
16
|
+
//#TODO: protocol.loader
|
|
17
|
+
if (!(await protocol.loader.isValid())) {
|
|
18
|
+
console.log('protocol not valid', protocol.id, protocol.loader.path)
|
|
19
19
|
return defaultResult
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
//#TODO:
|
|
23
|
-
const classesSchemas = await
|
|
22
|
+
//#TODO: protocol.loader
|
|
23
|
+
const classesSchemas = await protocol.loader.classesSchemas()
|
|
24
24
|
if (!classesSchemas) {
|
|
25
25
|
return defaultResult
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (protocol.id === 'app') {
|
|
29
29
|
await Servable.engine.formatAppClassesSchemas({ classesSchemas })
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
let adaptedClassesStructs = []
|
|
33
|
-
let
|
|
33
|
+
let classesProtocols = []
|
|
34
34
|
|
|
35
35
|
for (var i in classesSchemas) {
|
|
36
36
|
const classSchema = classesSchemas[i]
|
|
37
37
|
const adaptedClassStruct = await classStruct({
|
|
38
|
-
|
|
38
|
+
protocol,
|
|
39
39
|
classSchema,
|
|
40
|
-
|
|
40
|
+
protocolFactory,
|
|
41
41
|
instancesPathId: [
|
|
42
42
|
...instancesPathId,
|
|
43
43
|
{ type: 'class', value: { className: classSchema.className } }
|
|
@@ -45,19 +45,19 @@ const perform = async ({
|
|
|
45
45
|
})
|
|
46
46
|
adaptedClassesStructs = adaptedClassesStructs.concat(adaptedClassStruct)
|
|
47
47
|
|
|
48
|
-
let {
|
|
49
|
-
if (!
|
|
48
|
+
let { protocolsPayloads } = adaptedClassStruct
|
|
49
|
+
if (!protocolsPayloads || !protocolsPayloads.length) {
|
|
50
50
|
continue
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
//#TODO Move from uniq to
|
|
55
|
-
|
|
53
|
+
protocolsPayloads = protocolsPayloads.filter(a => (a && a.id !== protocol.id))
|
|
54
|
+
//#TODO Move from uniq to cleanprotocols
|
|
55
|
+
protocolsPayloads = _.uniq(protocolsPayloads, a => a.id)
|
|
56
56
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const classProtocols = await extractClassesProtocol({
|
|
58
|
+
protocolsPayloads,
|
|
59
|
+
protocolFactory,
|
|
60
|
+
updateProtocolsExcerpt,
|
|
61
61
|
instancesPathId: [
|
|
62
62
|
...instancesPathId,
|
|
63
63
|
{
|
|
@@ -65,41 +65,41 @@ const perform = async ({
|
|
|
65
65
|
value: { className: classSchema.className }
|
|
66
66
|
}
|
|
67
67
|
],
|
|
68
|
-
|
|
68
|
+
extractProtocol: perform
|
|
69
69
|
})
|
|
70
|
-
|
|
70
|
+
classesProtocols = classesProtocols.concat(classProtocols)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
await
|
|
73
|
+
await updateProtocolsExcerpt({ adaptedClassesStructs })
|
|
74
74
|
let ownClasses = adaptedClassesStructs.map(i => i.classSchema).filter(a => a)
|
|
75
75
|
let jsClasses = adaptedClassesStructs.map(i => i._class).filter(a => a)
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
if (!
|
|
80
|
-
//#TODO:
|
|
81
|
-
|
|
82
|
-
...
|
|
78
|
+
classesProtocols = _.uniq(classesProtocols, a => a.id)
|
|
79
|
+
if (!classesProtocols.length) {
|
|
80
|
+
//#TODO: protocol.schema
|
|
81
|
+
protocol.schema = {
|
|
82
|
+
...protocol.schema,
|
|
83
83
|
classes: {
|
|
84
84
|
managed: ownClasses,
|
|
85
85
|
all: ownClasses
|
|
86
86
|
},
|
|
87
87
|
jsClasses
|
|
88
88
|
}
|
|
89
|
-
return [
|
|
89
|
+
return [protocol]
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
//#TODO:
|
|
92
|
+
//#TODO: protocol.schema
|
|
93
93
|
let all = [...ownClasses]
|
|
94
|
-
|
|
94
|
+
classesProtocols.forEach(element => {
|
|
95
95
|
const { classes: { managed: _own = [], all: _all = [] } = {} } = element.schema
|
|
96
96
|
all = [...all, ..._all]
|
|
97
97
|
all = _.uniq(all, 'className')
|
|
98
98
|
})
|
|
99
99
|
|
|
100
|
-
//#TODO:
|
|
101
|
-
|
|
102
|
-
...
|
|
100
|
+
//#TODO: protocol.schema
|
|
101
|
+
protocol.schema = {
|
|
102
|
+
...protocol.schema,
|
|
103
103
|
classes: {
|
|
104
104
|
managed: ownClasses,
|
|
105
105
|
all
|
|
@@ -107,11 +107,11 @@ const perform = async ({
|
|
|
107
107
|
jsClasses
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
protocol.extractionStatus = 2
|
|
111
111
|
|
|
112
112
|
return [
|
|
113
|
-
|
|
114
|
-
...
|
|
113
|
+
protocol,
|
|
114
|
+
...classesProtocols
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import protocolFactory from "../../domain/protocol/factory/index.js"
|
|
2
|
+
import getProtocolsLiveClasses from "./lib/getProtocolsLiveClasses.js"
|
|
3
3
|
import adaptConfigBasic from "../../lib/adaptConfig/basic.js"
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import buildProtocol from './buildProtocol/index.js'
|
|
5
|
+
import updateProtocolsExcerpt from './lib/updateProtocolsExcerpt.js'
|
|
6
6
|
|
|
7
7
|
export default async ({ servableConfig }) => {
|
|
8
|
-
const {
|
|
8
|
+
const { rootProtocolPayload } = servableConfig
|
|
9
9
|
adaptConfigBasic({ servableConfig, live: false })
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
id:
|
|
14
|
-
type:
|
|
15
|
-
path:
|
|
16
|
-
version:
|
|
10
|
+
const protocolsCache = []
|
|
11
|
+
const appProtocol = await protocolFactory({
|
|
12
|
+
protocolPayload: {
|
|
13
|
+
id: rootProtocolPayload.id,
|
|
14
|
+
type: rootProtocolPayload.type,
|
|
15
|
+
path: rootProtocolPayload.path,
|
|
16
|
+
version: rootProtocolPayload.version
|
|
17
17
|
},
|
|
18
18
|
servableConfig,
|
|
19
|
-
|
|
19
|
+
protocolsCache,
|
|
20
20
|
instancesPathId: [
|
|
21
21
|
// { type: 'class', value: { className: '_root' } },
|
|
22
|
-
{ type: '
|
|
22
|
+
{ type: 'protocol', value: { id: 'app' } }
|
|
23
23
|
],
|
|
24
24
|
})
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const protocolsExcerpt = {}
|
|
27
|
+
const protocols = await buildProtocol({
|
|
28
|
+
protocol: appProtocol,
|
|
29
|
+
protocolFactory: async ({
|
|
30
|
+
protocolPayload,
|
|
31
31
|
instancesPathId
|
|
32
32
|
}) =>
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
protocolFactory({
|
|
34
|
+
protocolPayload,
|
|
35
35
|
servableConfig,
|
|
36
|
-
|
|
36
|
+
protocolsCache,
|
|
37
37
|
instancesPathId
|
|
38
38
|
}),
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
updateProtocolsExcerpt: async ({ adaptedClassesStructs }) =>
|
|
40
|
+
updateProtocolsExcerpt({ adaptedClassesStructs, protocolsExcerpt }),
|
|
41
41
|
instancesPathId: [
|
|
42
|
-
{ type: '
|
|
42
|
+
{ type: 'protocol', value: { id: 'app' } }
|
|
43
43
|
],
|
|
44
44
|
})
|
|
45
45
|
|
|
46
|
-
const liveClasses = await
|
|
46
|
+
const liveClasses = await getProtocolsLiveClasses({ protocols })
|
|
47
47
|
|
|
48
48
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
protocols,
|
|
50
|
+
protocolsExcerpt,
|
|
51
|
+
appProtocol,
|
|
52
52
|
liveClasses
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _ from 'underscore'
|
|
2
2
|
|
|
3
|
-
export default async ({
|
|
4
|
-
let items = (await Promise.all(
|
|
5
|
-
//#TODO:
|
|
6
|
-
const fn = await
|
|
3
|
+
export default async ({ protocols }) => {
|
|
4
|
+
let items = (await Promise.all(protocols.map(async protocol => {
|
|
5
|
+
//#TODO: protocol.loader
|
|
6
|
+
const fn = await protocol.loader.liveClasses()
|
|
7
7
|
if (!fn) {
|
|
8
8
|
return null
|
|
9
9
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
export default async ({
|
|
3
|
+
adaptedClassesStructs,
|
|
4
|
+
protocolsExcerpt }) => {
|
|
5
|
+
const candidates = adaptedClassesStructs.filter(a =>
|
|
6
|
+
(a && a.protocols && a.protocols.length))
|
|
7
|
+
|
|
8
|
+
if (!candidates || !candidates.length) {
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
candidates.forEach(adaptedClassesStruct => {
|
|
12
|
+
const { protocols, classSchema: { className } } = adaptedClassesStruct
|
|
13
|
+
protocols.forEach(protocol => {
|
|
14
|
+
if (!protocolsExcerpt[protocol.id]) {
|
|
15
|
+
protocolsExcerpt[protocol.id] = {
|
|
16
|
+
classes: []
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!protocolsExcerpt[protocol.id].classes.includes(className)) {
|
|
20
|
+
protocolsExcerpt[protocol.id].classes.push(className)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
}
|