@servable/tools 1.3.1 → 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.
Files changed (114) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/src/config/candidates/index.js +5 -5
  4. package/src/config/candidates/{featureCandidates → protocolCandidates}/index.js +5 -5
  5. package/src/config/validate/index.js +2 -2
  6. package/src/config/validate/{feature → protocol}/index.js +1 -1
  7. package/src/document/{1.1.0/all/build/feature → 1.0.0/all/build/protocol}/index.js +23 -23
  8. package/src/document/1.0.0/all/index.js +4 -4
  9. package/src/document/1.0.0/all/write/index.js +3 -3
  10. package/src/document/1.0.0/chunks/build/class/class.js +2 -2
  11. package/src/document/1.0.0/chunks/build/class/functions.js +2 -2
  12. package/src/document/1.0.0/chunks/build/class/lib.js +2 -2
  13. package/src/document/1.0.0/chunks/build/class/seed.js +2 -2
  14. package/src/document/1.0.0/chunks/build/class/triggers.js +2 -2
  15. package/src/document/1.0.0/chunks/build/{feature → protocol}/afterInit.js +2 -2
  16. package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/beforeInit.js +2 -2
  17. package/src/document/1.0.0/chunks/build/{feature → protocol}/class.js +3 -3
  18. package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/config.js +2 -2
  19. package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/functions.js +2 -2
  20. package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/lib.js +2 -2
  21. package/src/document/1.0.0/chunks/build/{feature → protocol}/liveClasses.js +2 -2
  22. package/src/document/1.0.0/chunks/build/{feature → protocol}/schema.js +2 -2
  23. package/src/document/1.0.0/chunks/build/{feature → protocol}/seed.js +2 -2
  24. package/src/document/1.0.0/chunks/build/{feature → protocol}/system.js +2 -2
  25. package/src/document/{1.1.0/chunks/build/feature → 1.0.0/chunks/build/protocol}/triggers.js +2 -2
  26. package/src/document/1.0.0/generateGithubReadme/build/chunks/dependencies/index.js +2 -2
  27. package/src/document/1.0.0/generateGithubReadme/build/chunks/footer.js +1 -1
  28. package/src/document/1.0.0/generateGithubReadme/build/chunks/githubTags.js +3 -3
  29. package/src/document/1.0.0/generateGithubReadme/build/chunks/registry.js +2 -2
  30. package/src/document/1.0.0/generateGithubReadme/build/chunks/usage.js +1 -1
  31. package/src/document/1.0.0/generateGithubReadme/build/index.js +23 -23
  32. package/src/document/{1.0.0/all/build/feature → 1.1.0/all/build/protocol}/index.js +23 -23
  33. package/src/document/1.1.0/all/index.js +4 -4
  34. package/src/document/1.1.0/all/write/index.js +3 -3
  35. package/src/document/1.1.0/chunks/build/class/class.js +2 -2
  36. package/src/document/1.1.0/chunks/build/class/functions.js +2 -2
  37. package/src/document/1.1.0/chunks/build/class/lib.js +2 -2
  38. package/src/document/1.1.0/chunks/build/class/seed.js +2 -2
  39. package/src/document/1.1.0/chunks/build/class/triggers.js +2 -2
  40. package/src/document/1.1.0/chunks/build/{feature → protocol}/afterInit.js +2 -2
  41. package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/beforeInit.js +2 -2
  42. package/src/document/1.1.0/chunks/build/{feature → protocol}/class.js +3 -3
  43. package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/config.js +2 -2
  44. package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/functions.js +2 -2
  45. package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/lib.js +2 -2
  46. package/src/document/1.1.0/chunks/build/{feature → protocol}/liveClasses.js +2 -2
  47. package/src/document/1.1.0/chunks/build/{feature → protocol}/schema.js +2 -2
  48. package/src/document/1.1.0/chunks/build/{feature → protocol}/seed.js +2 -2
  49. package/src/document/1.1.0/chunks/build/{feature → protocol}/system.js +2 -2
  50. package/src/document/{1.0.0/chunks/build/feature → 1.1.0/chunks/build/protocol}/triggers.js +2 -2
  51. package/src/document/1.1.0/generateGithubReadme/build/chunks/dependencies/index.js +2 -2
  52. package/src/document/1.1.0/generateGithubReadme/build/chunks/footer.js +1 -1
  53. package/src/document/1.1.0/generateGithubReadme/build/chunks/githubTags.js +3 -3
  54. package/src/document/1.1.0/generateGithubReadme/build/chunks/registry.js +2 -2
  55. package/src/document/1.1.0/generateGithubReadme/build/chunks/usage.js +1 -1
  56. package/src/document/1.1.0/generateGithubReadme/build/index.js +23 -23
  57. package/src/document/gateway/all/index.js +2 -2
  58. package/src/document/gateway/generateGithubReadme/index.js +2 -2
  59. package/src/domain/{feature → protocol}/factory/absoluteModuleSrcPath.js +3 -3
  60. package/src/domain/protocol/factory/index.js +71 -0
  61. package/src/domain/protocol/factory/protocolPath.js +41 -0
  62. package/src/domain/{feature → protocol}/index.js +6 -6
  63. package/src/domain/{feature → protocol}/lib/instancesPathIdUniqueId.js +3 -3
  64. package/src/domain/protocolInstance/factory/getLoaderWithPayload.js +7 -0
  65. package/src/domain/{featureInstance → protocolInstance}/factory/index.js +7 -7
  66. package/src/domain/{featureInstance → protocolInstance}/index.js +16 -16
  67. package/src/domain/{featureLoader → protocolLoader}/base.js +9 -9
  68. package/src/domain/protocolLoader/lib/mergeClassProtocols.js +17 -0
  69. package/src/domain/{featureLoader → protocolLoader}/v1.0.0.js +24 -24
  70. package/src/domain/{featureLoader → protocolLoader}/v1.1.0.js +26 -26
  71. package/src/index.js +7 -7
  72. package/src/lib/adaptConfig/basic.js +59 -59
  73. package/src/manifest/access/index.js +1 -1
  74. package/src/manifest/data/1.0.0/class.json +3 -3
  75. package/src/manifest/data/1.0.0/enums.js +6 -6
  76. package/src/manifest/data/1.0.0/{feature.json → protocol.json} +5 -5
  77. package/src/manifest/data/1.1.0/class.json +3 -3
  78. package/src/manifest/data/1.1.0/enums.js +6 -6
  79. package/src/manifest/data/1.1.0/{feature.json → protocol.json} +4 -4
  80. package/src/manifest/extract/index.js +1 -1
  81. package/src/manifest/extract/templateDataForId.js +3 -3
  82. package/src/schema/build/buildProtocol/classStruct/extractProtocolsProtocols.js +29 -0
  83. package/src/schema/build/buildProtocol/classStruct/index.js +62 -0
  84. package/src/schema/build/{buildFeature/classStruct/featureInClassClassSchema.js → buildProtocol/classStruct/protocolInClassClassSchema.js} +7 -7
  85. package/src/schema/build/buildProtocol/extractClassesProtocol.js +49 -0
  86. package/src/schema/build/{buildFeature → buildProtocol}/index.js +40 -40
  87. package/src/schema/build/index.js +29 -29
  88. package/src/schema/build/lib/{getFeaturesLiveClasses.js → getProtocolsLiveClasses.js} +4 -4
  89. package/src/schema/build/lib/updateProtocolsExcerpt.js +24 -0
  90. package/src/schema/index.js +30 -30
  91. package/src/schema/validate/{handleFeature → handleProtocol}/computeVersions.js +2 -2
  92. package/src/schema/validate/handleProtocol/index.js +5 -0
  93. package/src/schema/validate/index.js +6 -6
  94. package/src/domain/feature/factory/featurePath.js +0 -41
  95. package/src/domain/feature/factory/index.js +0 -71
  96. package/src/domain/featureInstance/factory/getLoaderWithPayload.js +0 -7
  97. package/src/domain/featureLoader/lib/mergeClassFeatures.js +0 -17
  98. package/src/schema/build/buildFeature/classStruct/extractFeaturesFeatures.js +0 -29
  99. package/src/schema/build/buildFeature/classStruct/index.js +0 -62
  100. package/src/schema/build/buildFeature/extractClassesFeature.js +0 -49
  101. package/src/schema/build/lib/updateFeaturesExcerpt.js +0 -24
  102. package/src/schema/validate/handleFeature/index.js +0 -5
  103. /package/src/document/1.0.0/all/write/{feature → protocol}/index.js +0 -0
  104. /package/src/document/1.1.0/all/write/{feature → protocol}/index.js +0 -0
  105. /package/src/domain/{featureInstance → protocolInstance}/factory/instancesWithPath.js +0 -0
  106. /package/src/domain/{featureLoader → protocolLoader}/factory/getModule.js +0 -0
  107. /package/src/domain/{featureLoader → protocolLoader}/factory/index.js +0 -0
  108. /package/src/domain/{featureLoader → protocolLoader}/lib/importJSDefault.js +0 -0
  109. /package/src/domain/{featureLoader → protocolLoader}/lib/importJSONDefault.js +0 -0
  110. /package/src/domain/{featureLoader → protocolLoader}/lib/triggerItems.js +0 -0
  111. /package/src/lib/{adaptFeaturePayload.js → adaptProtocolPayload.js} +0 -0
  112. /package/src/lib/{cleanFeatures.js → cleanProtocols.js} +0 -0
  113. /package/src/lib/{featureApiVersion.js → protocolApiVersion.js} +0 -0
  114. /package/src/schema/build/{buildFeature → buildProtocol}/classStruct/preserveMostRestricted.js +0 -0
@@ -1,22 +1,22 @@
1
1
  import BaseClass from './base.js'
2
2
 
3
3
  import directories from '../../lib/directories.js'
4
- import cleanFeatures from '../../lib/cleanFeatures.js'
5
- import mergeClassFeatures from './lib/mergeClassFeatures.js'
4
+ import cleanProtocols from '../../lib/cleanProtocols.js'
5
+ import mergeClassProtocols from './lib/mergeClassProtocols.js'
6
6
 
7
7
  import importJSONAsync from '../../lib/importJSONAsync.js'
8
8
  import directoryGlob from '../../lib/directoryGlob.js'
9
9
 
10
10
  import checkFileExists from '../../lib/checkFileExists.js'
11
11
  import directoryFilesRecursive from '../../lib/directoryFilesRecursive.js'
12
- import { FeatureEnum } from '../../manifest/data/1.0.0/enums.js'
12
+ import { ProtocolEnum } from '../../manifest/data/1.0.0/enums.js'
13
13
 
14
14
  import triggerItems from './lib/triggerItems.js'
15
15
  import fs from 'fs'
16
16
  import fspath from 'path'
17
17
  import semver from 'semver'
18
18
 
19
- export default class FeatureLoaderV1_1_0 extends BaseClass {
19
+ export default class ProtocolLoaderV1_1_0 extends BaseClass {
20
20
 
21
21
  // #region class
22
22
 
@@ -245,40 +245,40 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
245
245
  }
246
246
 
247
247
 
248
- async classFeatures({ className, withFeaturesFeatures = false }) {
248
+ async classProtocols({ className, withProtocolsProtocols = false }) {
249
249
  const cacheKey = 'class'
250
- // //console.log('classFeatures>', className, 'enter')
250
+ // //console.log('classProtocols>', className, 'enter')
251
251
  if (this._valueInCache(cacheKey)) {
252
252
  return this._valueInCache(cacheKey)
253
253
  }
254
254
  const items = []
255
255
  const seedMode = await this.classSeedMode({ className })
256
- // //console.log('classFeatures>', className, 'seedmode', seedMode)
256
+ // //console.log('classProtocols>', className, 'seedmode', seedMode)
257
257
  if (seedMode === 'auto') {
258
258
  items.push({ id: 'servableautoseedable' })
259
259
  }
260
260
  const _class = await this.getClass({ className })
261
261
  if (!_class) {
262
- //console.log('classFeatures>', className, 'no _class')
262
+ //console.log('classProtocols>', className, 'no _class')
263
263
  return items
264
264
  }
265
265
 
266
- let data = mergeClassFeatures({ items, _class, withFeaturesFeatures })
267
- const path = `${this.path}/models/${className.toLowerCase()}/features.js`
266
+ let data = mergeClassProtocols({ items, _class, withProtocolsProtocols })
267
+ const path = `${this.path}/models/${className.toLowerCase()}/protocols.js`
268
268
 
269
269
  if ((await checkFileExists(path))) {
270
270
 
271
271
  let _data = (await import(path)).default
272
- // //console.log('classFeatures>', className, '_data', _data)
272
+ // //console.log('classProtocols>', className, '_data', _data)
273
273
  _data = _data ? _data : []
274
274
  data = [...data,
275
275
  ..._data]
276
276
  }
277
277
 
278
278
  //this.cache[cacheKey] = data
279
- data = cleanFeatures(data)
279
+ data = cleanProtocols(data)
280
280
  // result = _.uniq(result, a => a.id)
281
- // //console.log('classFeatures>', className, 'finaldata', data)
281
+ // //console.log('classProtocols>', className, 'finaldata', data)
282
282
  return data
283
283
  }
284
284
 
@@ -361,7 +361,7 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
361
361
  return 'manual'
362
362
  }
363
363
 
364
- //Auto not handled yet for features
364
+ //Auto not handled yet for protocols
365
365
  // _path = `${seedFolder}/transformer.js`
366
366
  // if (await checkFileExists(_path)) {
367
367
  // return 'auto'
@@ -497,7 +497,7 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
497
497
  let path = `${schemaPath}/classes.js`
498
498
 
499
499
  if ((await checkFileExists(path))) {
500
- const classes = await (await import(path)).default({ feature: this.featureInstance })
500
+ const classes = await (await import(path)).default({ protocol: this.protocolInstance })
501
501
  // this.cache['classes'] = classes
502
502
  return classes
503
503
  }
@@ -554,7 +554,7 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
554
554
  async schemaRaw(props = {}) {
555
555
  const { ad } = props
556
556
  const a = await this._accessManifestItem({
557
- item: FeatureEnum.Schema,
557
+ item: ProtocolEnum.Schema,
558
558
  })
559
559
  // const cacheKey = 'schemaIndexes'
560
560
  // if (this.valueInCache(cacheKey)) {
@@ -563,13 +563,13 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
563
563
 
564
564
  const schemaPath = await this._schemaPath()
565
565
 
566
- //#TODO: A dynamic schema needs features to be instantiated per class as to avoid class defintion collusions and edge case.
566
+ //#TODO: A dynamic schema needs protocols to be instantiated per class as to avoid class defintion collusions and edge case.
567
567
  // let path = `${schemaPath}/index.js`
568
568
 
569
569
  // if ((await checkFileExists(path))) {
570
570
  // let data = (await import(path)).default
571
- // //#TODO: don't use up feature params
572
- // data = await data({ ...props, params: this.featureInstance.params })
571
+ // //#TODO: don't use up protocol params
572
+ // data = await data({ ...props, params: this.protocolInstance.params })
573
573
  // return data
574
574
  // }
575
575
 
@@ -605,8 +605,8 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
605
605
  }
606
606
 
607
607
  async _schemaPath() {
608
- //let version = this.currentFeatureVersion ? this.currentFeatureVersion : this.featureInstanceVersion
609
- let version = this.featureInstance.version
608
+ //let version = this.currentProtocolVersion ? this.currentProtocolVersion : this.protocolInstanceVersion
609
+ let version = this.protocolInstance.version
610
610
  let versions = await this.schemaVersions()
611
611
 
612
612
  if (!version) {
@@ -677,13 +677,13 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
677
677
 
678
678
 
679
679
 
680
- async ownFeatures() {
681
- const cacheKey = 'ownFeatures'
680
+ async ownProtocols() {
681
+ const cacheKey = 'ownProtocols'
682
682
  if (this._valueInCache(cacheKey)) {
683
683
  return this._valueInCache(cacheKey)
684
684
  }
685
685
 
686
- let path = `${this.path}/target/features.js`
686
+ let path = `${this.path}/target/protocols.js`
687
687
  if (!(await checkFileExists(path))) {
688
688
  return null
689
689
  }
@@ -694,8 +694,8 @@ export default class FeatureLoaderV1_1_0 extends BaseClass {
694
694
  return data
695
695
  }
696
696
 
697
- async ownFeaturesClass() {
698
- const cacheKey = 'ownFeaturesClass'
697
+ async ownProtocolsClass() {
698
+ const cacheKey = 'ownProtocolsClass'
699
699
  if (this._valueInCache(cacheKey)) {
700
700
  return this._valueInCache(cacheKey)
701
701
  }
package/src/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import extractFeature from './manifest/extract/index.js'
1
+ import extractProtocol from './manifest/extract/index.js'
2
2
  import accessManifest from './manifest/access/index.js'
3
3
  import * as ManifestEnums from './manifest/data/1.0.0/enums.js'
4
4
  import * as ManifestEnumsV1_1_0 from './manifest/data/1.0.0/enums.js'
5
5
 
6
6
  import buildSchema from './schema/build/index.js'
7
7
  import validateSchema from './schema/validate/index.js'
8
- // import validateFeature from './lib/config/validate/feature/index.js'
9
- import cleanFeatures from './lib/cleanFeatures.js'
8
+ // import validateProtocol from './lib/config/validate/protocol/index.js'
9
+ import cleanProtocols from './lib/cleanProtocols.js'
10
10
 
11
11
 
12
- import documentFeature from './document/gateway/all/index.js'
12
+ import documentProtocol from './document/gateway/all/index.js'
13
13
  import generateGithubReadme from './document/gateway/generateGithubReadme/index.js'
14
14
 
15
15
  import Servable from './domain/servable/index.js'
@@ -17,13 +17,13 @@ const Domain = { Servable }
17
17
 
18
18
  export {
19
19
  accessManifest,
20
- documentFeature,
21
- extractFeature,
20
+ documentProtocol,
21
+ extractProtocol,
22
22
  ManifestEnums,
23
23
  ManifestEnumsV1_1_0,
24
24
  buildSchema,
25
25
  validateSchema,
26
- cleanFeatures,
26
+ cleanProtocols,
27
27
  generateGithubReadme,
28
28
  Domain
29
29
  }
@@ -8,78 +8,78 @@ const __dirname = dirname(__filename)
8
8
 
9
9
 
10
10
  export default ({ servableConfig }) => {
11
- if (servableConfig.adaptedBasic) {
12
- return
13
- }
14
- // const __filename = callerPath({ depth: 1 })
15
- // let __dirname = dirname(__filename)
16
- // __dirname = __dirname.split('file://')[1]
17
-
18
- // if (!servableConfig.nodeModulesPath) {
19
- // servableConfig.nodeModulesPath = path.resolve(__dirname, `../node_modules`)
20
- // }
21
-
22
- if (!servableConfig.distribution) {
23
- servableConfig.distribution = {
24
- enabled: false,
25
- }
11
+ if (servableConfig.adaptedBasic) {
12
+ return
13
+ }
14
+ // const __filename = callerPath({ depth: 1 })
15
+ // let __dirname = dirname(__filename)
16
+ // __dirname = __dirname.split('file://')[1]
17
+
18
+ // if (!servableConfig.nodeModulesPath) {
19
+ // servableConfig.nodeModulesPath = path.resolve(__dirname, `../node_modules`)
20
+ // }
21
+
22
+ if (!servableConfig.distribution) {
23
+ servableConfig.distribution = {
24
+ enabled: false,
26
25
  }
26
+ }
27
27
 
28
- if (!servableConfig.distribution.databaseURI) {
29
- servableConfig.distribution.databaseURI = process.env.SERVABLE_UTILS_DATABASE_URI
30
- }
28
+ if (!servableConfig.distribution.databaseURI) {
29
+ servableConfig.distribution.databaseURI = process.env.SERVABLE_UTILS_DATABASE_URI
30
+ }
31
31
 
32
32
 
33
- if (!servableConfig.system) {
34
- servableConfig.system = {}
35
- }
33
+ if (!servableConfig.system) {
34
+ servableConfig.system = {}
35
+ }
36
36
 
37
- if (!servableConfig.system.docker) {
38
- servableConfig.system.docker = {
39
- enabled: true,
40
- environments: ['development']
41
- }
37
+ if (!servableConfig.system.docker) {
38
+ servableConfig.system.docker = {
39
+ enabled: true,
40
+ environments: ['development']
42
41
  }
42
+ }
43
43
 
44
- if (!servableConfig.features) {
45
- servableConfig.features = {}
46
- }
44
+ if (!servableConfig.protocols) {
45
+ servableConfig.protocols = {}
46
+ }
47
47
 
48
- if (!servableConfig.features.local || !servableConfig.features.local.length) {
49
- servableConfig.features.local = [
50
- path.resolve('', 'lib/features')
51
- ]
52
- }
53
-
54
- servableConfig.features.local = [
55
- path.resolve(__dirname, `../../features`),
56
- ...servableConfig.features.local,
48
+ if (!servableConfig.protocols.local || !servableConfig.protocols.local.length) {
49
+ servableConfig.protocols.local = [
50
+ path.resolve('', 'lib/protocols')
57
51
  ]
58
-
59
- if (!servableConfig.rootFeaturePayload) {
60
- servableConfig.rootFeaturePayload = {
61
- type: 'app',
62
- id: 'app',
63
- // path: path.resolve(__dirname, "./app")
64
- path: path.resolve('', 'lib/app')
65
- }
52
+ }
53
+
54
+ servableConfig.protocols.local = [
55
+ path.resolve(__dirname, `../../protocols`),
56
+ ...servableConfig.protocols.local,
57
+ ]
58
+
59
+ if (!servableConfig.rootProtocolPayload) {
60
+ servableConfig.rootProtocolPayload = {
61
+ type: 'app',
62
+ id: 'app',
63
+ // path: path.resolve(__dirname, "./app")
64
+ path: path.resolve('', 'lib/app')
66
65
  }
66
+ }
67
67
 
68
- if (!servableConfig.rootFeaturePayload.path) {
69
- servableConfig.rootFeaturePayload = {
70
- ...servableConfig.rootFeaturePayload,
71
- path: path.resolve('', 'lib/app')
72
- // path: path.resolve(__dirname, "./app")
73
- }
68
+ if (!servableConfig.rootProtocolPayload.path) {
69
+ servableConfig.rootProtocolPayload = {
70
+ ...servableConfig.rootProtocolPayload,
71
+ path: path.resolve('', 'lib/app')
72
+ // path: path.resolve(__dirname, "./app")
74
73
  }
74
+ }
75
75
 
76
- if (!servableConfig.rootFeaturePayload.id || !servableConfig.rootFeaturePayload.type) {
77
- servableConfig.rootFeaturePayload = {
78
- ...servableConfig.rootFeaturePayload,
79
- id: 'app',
80
- type: 'app',
81
- }
76
+ if (!servableConfig.rootProtocolPayload.id || !servableConfig.rootProtocolPayload.type) {
77
+ servableConfig.rootProtocolPayload = {
78
+ ...servableConfig.rootProtocolPayload,
79
+ id: 'app',
80
+ type: 'app',
82
81
  }
82
+ }
83
83
 
84
- servableConfig.adaptedBasic = true
84
+ servableConfig.adaptedBasic = true
85
85
  }
@@ -8,7 +8,7 @@ export default async ({
8
8
  variant,
9
9
  mimeType,
10
10
  item,
11
- type = DataTemplateType.Feature,
11
+ type = DataTemplateType.Protocol,
12
12
  formatData = true,
13
13
  extraction: _extraction
14
14
  }) => {
@@ -80,14 +80,14 @@
80
80
  ]
81
81
  },
82
82
  {
83
- "id": "features",
83
+ "id": "protocols",
84
84
  "routes": [
85
85
  {
86
86
  "type": "file",
87
87
  "mimeTypes": [
88
88
  "text/javascript"
89
89
  ],
90
- "path": "features"
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 FeatureEnum = {
1
+ export const ProtocolEnum = {
2
2
  Index: {
3
3
  id: 'index'
4
4
  },
@@ -51,8 +51,8 @@ export const FeatureEnum = {
51
51
  id: 'index',
52
52
  parents: ['class'],
53
53
  },
54
- Features: {
55
- id: 'features',
54
+ Protocols: {
55
+ id: 'protocols',
56
56
  parents: ['class']
57
57
  },
58
58
  },
@@ -154,8 +154,8 @@ export const ClassEnum = {
154
154
  id: 'index',
155
155
  parents: ['class']
156
156
  },
157
- Features: {
158
- id: 'features',
157
+ Protocols: {
158
+ id: 'protocols',
159
159
  parents: ['class']
160
160
  },
161
161
  },
@@ -249,7 +249,7 @@ export const SchemaEnum = {
249
249
  }
250
250
 
251
251
  export const DataTemplateType = {
252
- Feature: 'feature',
252
+ Protocol: 'protocol',
253
253
  Class: 'class',
254
254
  Schema: 'schema',
255
255
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "root",
3
- "name": "feature",
4
- "description": "feature",
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": "features",
164
+ "id": "protocols",
165
165
  "routes": [
166
166
  {
167
167
  "type": "file",
168
168
  "mimeTypes": [
169
169
  "text/javascript"
170
170
  ],
171
- "path": "features"
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": "features",
83
+ "id": "protocols",
84
84
  "routes": [
85
85
  {
86
86
  "type": "file",
87
87
  "mimeTypes": [
88
88
  "text/javascript"
89
89
  ],
90
- "path": "features"
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 FeatureEnum = {
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
- Features: {
61
- id: 'features',
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
- Features: {
170
- id: 'features',
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
- Feature: 'feature',
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": "feature",
4
- "description": "feature",
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": "features",
170
+ "id": "protocols",
171
171
  "routes": [
172
172
  {
173
173
  "type": "file",
174
174
  "mimeTypes": [
175
175
  "text/javascript"
176
176
  ],
177
- "path": "features"
177
+ "path": "protocols"
178
178
  }
179
179
  ]
180
180
  }
@@ -5,7 +5,7 @@ import ServableClass from "../../domain/servable/index.js"
5
5
 
6
6
  export default async ({
7
7
  path,
8
- dataTemplateType = DataTemplateType.Feature
8
+ dataTemplateType = DataTemplateType.Protocol
9
9
  }) => {
10
10
  const reference = {}
11
11
  if (!global.Servable) {
@@ -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: featurePath }) => {
12
+ export default async ({ id, path: protocolPath }) => {
13
13
  let version = "1.0.0"
14
- let index = await loadIndex(featurePath)
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 ${featurePath}` }
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
+ }