theprogrammablemind_4wp 7.5.8-beta.25 → 7.5.8-beta.26

Sign up to get free protection for your applications and to get access to all the features.
package/client.js CHANGED
@@ -1215,7 +1215,9 @@ entodicton.knowledgeModule( {
1215
1215
  `
1216
1216
  */
1217
1217
 
1218
- const build = async ({ config, target, template, errorHandler = defaultErrorHandler }) => {
1218
+ const rebuildTemplate = async ({ config, target, template, errorHandler = defaultErrorHandler }) => {
1219
+ debugger
1220
+ // config = config.base()
1219
1221
  const accumulators = {
1220
1222
  resultss: [],
1221
1223
  fragments: [],
@@ -1934,7 +1936,7 @@ module.exports = {
1934
1936
  w,
1935
1937
  // submitBug,
1936
1938
  ensureTestFile,
1937
- build,
1939
+ rebuildTemplate,
1938
1940
  processContext,
1939
1941
  processContexts,
1940
1942
  runTests,
package/index.js CHANGED
@@ -23,5 +23,6 @@ module.exports = {
23
23
  Generator,
24
24
  Digraph,
25
25
  flattens: flattens.flattens,
26
+ flatten: flattens.flatten,
26
27
  unflatten: unflatten.unflatten
27
28
  }
package/package.json CHANGED
@@ -63,6 +63,6 @@
63
63
  "json-stable-stringify": "^1.0.1",
64
64
  "node-fetch": "^2.6.1"
65
65
  },
66
- "version": "7.5.8-beta.25",
66
+ "version": "7.5.8-beta.26",
67
67
  "license": "ISC"
68
68
  }
package/src/config.js CHANGED
@@ -564,8 +564,8 @@ const multiApiImpl = (initializer) => {
564
564
  initializer(config, api)
565
565
  const name = api.getName()
566
566
  multiApi.apis[name] = api
567
- api.objects = config.get('objects')
568
- api.config = () => config
567
+ // api.objects = config.get('objects')
568
+ // api.config = () => config
569
569
  multiApi.current = name
570
570
  },
571
571
 
@@ -576,11 +576,13 @@ const multiApiImpl = (initializer) => {
576
576
  }
577
577
  },
578
578
 
579
+ /*
579
580
  set objects (value) {
580
581
  for (const key in Object.keys(this.apis)) {
581
582
  this.apis[key].objects = value
582
583
  }
583
584
  },
585
+ */
584
586
 
585
587
  // "product1": apiInstance(testData1),
586
588
  apis: {
@@ -598,7 +600,19 @@ class Config {
598
600
  return config_toServer(config)
599
601
  }
600
602
 
601
- getPseudoConfig(uuid, config) {
603
+ base () {
604
+ const base = new Config()
605
+ for (let km of this.configs.reverse()) {
606
+ if (km.isSelf) {
607
+ continue
608
+ }
609
+ console.log(km.config.name)
610
+ base.add(km.config)
611
+ }
612
+
613
+ }
614
+
615
+ getPseudoConfig (uuid, config) {
602
616
  return {
603
617
  description: "this is a pseudo config that has limited functionality due to being available in the initializer function context",
604
618
  addAssociation: (...args) => this.addAssociation(...args),
@@ -612,6 +626,9 @@ class Config {
612
626
  addSemantic: (...args) => this.addSemantic(...args, uuid, config.name),
613
627
  addWord: (...args) => this.addWord(...args, uuid),
614
628
 
629
+ getHierarchy: (...args) => this.config.hierarchy,
630
+ getBridges: (...args) => this.config.bridges,
631
+
615
632
  addArgs: (...args) => this.addArgs(...args),
616
633
  getBridge: (...args) => this.getBridge(...args),
617
634
  fragment: (...args) => this.fragment(...args),
@@ -887,7 +904,7 @@ class Config {
887
904
  // TODO fix beforeQuery
888
905
  template = { fragments: [], queries: [], ...template }
889
906
  template.fragments = template.fragments.concat(this.dynamicFragments)
890
- client.build({ config: this, target: this.name, beforeQuery: () => {}, template, ...options })
907
+ client.rebuildTemplate({ config: this, target: this.name, beforeQuery: () => {}, template, ...options })
891
908
  } else {
892
909
  // no change
893
910
  // this.initInstances.push({ ...instance, name: config.name })
@@ -1588,11 +1605,13 @@ class Config {
1588
1605
  this._api.add(this, this._api, value)
1589
1606
  } else {
1590
1607
  this._api = _.cloneDeep(value)
1608
+ /*
1591
1609
  if (this._api) {
1592
- this._api.objects = this.config.objects
1593
- this._api.config = () => this
1594
- this._api.uuid = this._uuid
1610
+ // this._api.objects = this.config.objects
1611
+ // this._api.config = () => this
1612
+ // this._api.uuid = this._uuid
1595
1613
  }
1614
+ */
1596
1615
  this.rebuild()
1597
1616
  }
1598
1617
  }
@@ -1682,6 +1701,9 @@ class Config {
1682
1701
  runtime.fs.writeFileSync(fn, JSON.stringify(this.config, 0, 2))
1683
1702
  }
1684
1703
 
1704
+ copy (options = { callInitializers: true }) {
1705
+ }
1706
+
1685
1707
  copy (options = { callInitializers: true }) {
1686
1708
  this.valid()
1687
1709
  const cp = new Config()
@@ -1724,25 +1746,38 @@ class Config {
1724
1746
  }
1725
1747
  cp.mapUUIDs(map)
1726
1748
 
1749
+ if (cp._uuid == 'concept2') {
1750
+ // debugger
1751
+ }
1727
1752
  if (options.callInitializers) {
1728
1753
  cp.rebuild(options)
1729
- }
1730
- if (cp._api) {
1731
- cp._api.objects = cp.config.objects
1732
- cp._api.config = () => (cp instanceof Config) ? cp : cp.config
1733
- cp._api.uuid = cp._uuid
1734
- }
1754
+ } else {
1755
+ // this mess is for duplicate into a KM after resetToOne was called
1756
+ /*
1757
+ if (cp._api) {
1758
+ // cp._api.objects = cp.config.objects
1759
+ // cp._api.config = () => (cp instanceof Config) ? cp : cp.config
1760
+ // cp._api.uuid = cp._uuid
1761
+ }
1762
+ */
1735
1763
 
1736
- if (!cp.config.objects) {
1737
- cp.config.objects = { namespaced: {} }
1738
- } else if (!cp.config.objects.namespaced) {
1739
- cp.config.objects.namespaced = {}
1764
+ if (!cp.config.objects) {
1765
+ cp.config.objects = { namespaced: {} }
1766
+ } else if (!cp.config.objects.namespaced) {
1767
+ cp.config.objects.namespaced = {}
1768
+ }
1769
+ cp.configs.forEach((km) => {
1770
+ // const namespace = km.namespace
1771
+ cp.config.objects.namespaced[km._uuid] = {}
1772
+ })
1773
+ /*
1774
+ if (cp._uuid == 'concept2') {
1775
+ if (!cp.api.objects.defaultTypesForHierarchy) {
1776
+ debugger
1777
+ }
1778
+ }
1779
+ */
1740
1780
  }
1741
- cp.configs.forEach((km) => {
1742
- // const namespace = km.namespace
1743
- cp.config.objects.namespaced[km._uuid] = {}
1744
- })
1745
-
1746
1781
  cp.valid()
1747
1782
  return cp
1748
1783
  }
@@ -1844,17 +1879,21 @@ class Config {
1844
1879
  const objects = {}
1845
1880
  if (config instanceof Config) {
1846
1881
  this.get('objects').namespaced[config._uuid] = objects
1882
+ /*
1847
1883
  if (config._api) {
1848
- config._api.objects = objects
1849
- config._api.config = () => this
1884
+ // config._api.objects = objects
1885
+ // config._api.config = () => this
1850
1886
  }
1887
+ */
1851
1888
  config.initializerFn(setupInitializerFNArgs(this, { testConfig: config, currentConfig: config, objects, namespace, uuid }))
1852
1889
  } else {
1853
1890
  this.get('objects').namespaced[this._uuid] = objects
1891
+ /*
1854
1892
  if (config._api) {
1855
- config._api.objects = objects
1856
- config._api.config = () => this
1893
+ // config._api.objects = objects
1894
+ // config._api.config = () => this
1857
1895
  }
1896
+ */
1858
1897
  this.initializerFn(setupInitializerFNArgs(this, { testConfig: this, currentConfig: this, objects, namespace, uuid }))
1859
1898
  }
1860
1899
  })
@@ -1885,12 +1924,14 @@ class Config {
1885
1924
  // const baseConfig = args.baseConfig
1886
1925
  const currentConfig = args.currentConfig
1887
1926
 
1927
+ /*
1888
1928
  if (currentConfig.api) {
1889
- currentConfig.api.objects = args.objects
1929
+ // currentConfig.api.objects = args.objects
1890
1930
  // GREG42 currentConfig.api.config = () => this
1891
- currentConfig.api.config = () => args.baseConfig
1892
- currentConfig.api.uuid = currentConfig._uuid
1931
+ // currentConfig.api.config = () => args.baseConfig
1932
+ // currentConfig.api.uuid = currentConfig._uuid
1893
1933
  }
1934
+ */
1894
1935
  // this.instances.forEach( (instance) => client.processInstance(this, instance) )
1895
1936
  // greg55
1896
1937
  if (args.isAfterApi) {
@@ -2129,13 +2170,15 @@ class Config {
2129
2170
 
2130
2171
  const currentConfig = args.currentConfig
2131
2172
 
2173
+ /*
2132
2174
  if (args.currentConfig.api) {
2133
- args.currentConfig.api.objects = args.objects
2175
+ // args.currentConfig.api.objects = args.objects
2134
2176
  // TODO assign pseudo config?
2135
- args.currentConfig.api.config = () => args.baseConfig
2136
- args.currentConfig.api.uuid = args.currentConfig._uuid
2177
+ // args.currentConfig.api.config = () => args.baseConfig
2178
+ // args.currentConfig.api.uuid = args.currentConfig._uuid
2137
2179
  args.currentConfig.wasInitialized = true
2138
2180
  }
2181
+ */
2139
2182
  // debugger
2140
2183
  // greg55
2141
2184
  config.initializerFn(args, { dontCallFn: true })
@@ -2143,16 +2186,17 @@ class Config {
2143
2186
  if (config._api) {
2144
2187
  if (config._api.initialize) {
2145
2188
  // reverse the list
2146
- inits.unshift( () => config._api.initialize({ config: this, km: kmFn, api: config._api }) )
2189
+ // TODO sync up the args with initialize of config
2190
+ inits.unshift( () => config._api.initialize({ config: this, km: kmFn, ...args, api: config._api }) )
2147
2191
  // config._api.initialize({ config, api: config._api })
2148
2192
  } else {
2149
2193
  if (interleaved) {
2150
2194
  inits.unshift(null)
2151
2195
  }
2152
2196
  }
2153
- config._api.objects = namespacedObjects
2154
- config._api.config = () => this
2155
- config._api.uuid = config._uuid
2197
+ // config._api.objects = namespacedObjects
2198
+ // config._api.config = () => this
2199
+ // config._api.uuid = config._uuid
2156
2200
  } else {
2157
2201
  if (interleaved) {
2158
2202
  inits.unshift(null)