theprogrammablemind_4wp 9.1.1-beta.13 → 9.1.1-beta.14

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/client.js CHANGED
@@ -1161,7 +1161,7 @@ const checkTemplate = (template) => {
1161
1161
  if (template.checks) {
1162
1162
  throw new Error("The 'checks' property should be in the 'test' property not the 'template' property")
1163
1163
  }
1164
- validProps([ 'fragments', 'configs' ], template.template, 'template.template')
1164
+ validProps(['fragments', 'configs'], template.template, 'template.template')
1165
1165
  }
1166
1166
 
1167
1167
  const checkTest = (testConfig) => {
package/package.json CHANGED
@@ -69,6 +69,6 @@
69
69
  "sort-json": "^2.0.0",
70
70
  "uuid": "^8.3.2"
71
71
  },
72
- "version": "9.1.1-beta.13",
72
+ "version": "9.1.1-beta.14",
73
73
  "license": "UNLICENSED"
74
74
  }
package/src/config.js CHANGED
@@ -865,6 +865,7 @@ class Config {
865
865
  async fixtures () {
866
866
  if (this.testConfig?.fixtures) {
867
867
  const args = {}
868
+ args.uuid = this._uuid
868
869
  configHelpers.setupArgs(args, this)
869
870
  return this.testConfig.fixtures(args)
870
871
  }
@@ -893,7 +894,7 @@ class Config {
893
894
 
894
895
  getPseudoConfig (uuid, config) {
895
896
  return {
896
- description: 'this is a pseudo config that has limited functionality due to being available in the initializer function context',
897
+ description: 'this is a pseudo config that has limited functionality due to being available in the initializer and fixtures function context',
897
898
  addAssociation: (...args) => this.addAssociation(...args),
898
899
  addAssociations: (...args) => this.addAssociations(...args),
899
900
  addBridge: (...args) => this.addBridge(...args, uuid),
@@ -2091,7 +2092,7 @@ class Config {
2091
2092
 
2092
2093
  get api () {
2093
2094
  if (this._stop_auto_rebuild) {
2094
- throw new Error("The API cannot be accessed until the auto rebuild is restarted")
2095
+ throw new Error('The API cannot be accessed until the auto rebuild is restarted')
2095
2096
  }
2096
2097
 
2097
2098
  if (this._api && this._api.multiApi) {
@@ -2121,8 +2122,20 @@ class Config {
2121
2122
  throw new Error(`Expected the argument to be an API constructor for ${this.name}.`)
2122
2123
  }
2123
2124
  const value = constructor()
2124
- if (!value.initialize) {
2125
- throw new Error(`Expected the API to have an initialize function for ${this.name}.`)
2125
+ if (this._apiKMs.length > 0) {
2126
+ for (const name of this._apiKMs) {
2127
+ const api = value[name]
2128
+ if (!api) {
2129
+ throw new Error(`The API for ${this.name} is not being provided by the API constructor.`)
2130
+ }
2131
+ if (!api.initialize) {
2132
+ throw new Error(`Expected the API for ${this.name} to have an initialize function.`)
2133
+ }
2134
+ }
2135
+ } else {
2136
+ if (!value.initialize) {
2137
+ throw new Error(`Expected the API to have an initialize function for ${this.name}.`)
2138
+ }
2126
2139
  }
2127
2140
 
2128
2141
  if (this._api && this._api.multiApi) {
@@ -2135,13 +2148,13 @@ class Config {
2135
2148
  return api
2136
2149
  }
2137
2150
  } else {
2138
- this._api = value
2139
2151
  this._apiConstructor = constructor
2140
- for (const name of this._apiKMs) {
2141
- if (this.name == name) {
2142
- continue
2152
+ if (this._apiKMs.length > 0) {
2153
+ for (const name of this._apiKMs) {
2154
+ this.km(name)._api = value[name]
2143
2155
  }
2144
- this.km(name).setApi(() => this._api)
2156
+ } else {
2157
+ this._api = value
2145
2158
  }
2146
2159
  await this.rebuild()
2147
2160
  }
@@ -2210,10 +2223,21 @@ class Config {
2210
2223
  // update uuid here set the uuid in the objects and add error checking
2211
2224
  cp.initializerFn = this.initializerFn
2212
2225
  cp.terminatorFn = this.terminatorFn
2213
- if (this._apiConstructor) {
2214
- cp._api = this._apiConstructor(cp)
2215
- cp._apiConstructor = this._apiConstructor
2216
- cp._apiKMs = this._apiKMs
2226
+ cp._apiKMs = this._apiKMs
2227
+ cp._apiConstructor = this._apiConstructor
2228
+ if (cp._apiConstructor) {
2229
+ if (this._apiKMs.length > 0) {
2230
+ const apis = cp._apiConstructor(cp)
2231
+ for (const name of this._apiKMs) {
2232
+ if (name == this.name) {
2233
+ cp._api = apis[name]
2234
+ } else {
2235
+ cp.km(name)._api = apis[name]
2236
+ }
2237
+ }
2238
+ } else {
2239
+ cp._api = cp._apiConstructor(cp)
2240
+ }
2217
2241
  }
2218
2242
  cp._namespace = this._namespace
2219
2243
  cp._eqClasses = this._eqClasses
@@ -2593,7 +2617,9 @@ class Config {
2593
2617
  const initAfterApis = []
2594
2618
  this.configs.forEach((km) => {
2595
2619
  const namespace = km.namespace
2596
- this.config.objects.namespaced[km._uuid] = {}
2620
+ this.config.objects.namespaced[km._uuid] = {
2621
+ km: km._uuid
2622
+ }
2597
2623
  const namespacedObjects = this.config.objects.namespaced[km._uuid]
2598
2624
  this.setupNamespace(km)
2599
2625
  // const aw = (word, def) => this.addWord(word, def)
@@ -85,6 +85,9 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
85
85
  args.objects = config.get('objects')
86
86
  args.getObjects = getObjects(args.objects)
87
87
  }
88
+ if (args.uuid) {
89
+ args.objects = args.getObjects(args.uuid)
90
+ }
88
91
  if (!hierarchy) {
89
92
  hierarchy = config.hierarchy
90
93
  }
@@ -249,7 +252,7 @@ const setupContexts = (rawContexts) => {
249
252
  let first = true
250
253
  const contexts = []
251
254
  contexts.push({ marker: 'controlStart', controlRemove: true })
252
- let previous;
255
+ let previous
253
256
  for (const context of rawContexts) {
254
257
  if (first) {
255
258
  first = false
@@ -337,9 +340,9 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
337
340
  if (contextPrime.controlRemove) {
338
341
  continue
339
342
  }
340
- let paraphrases = []
341
- let paraphrasesParenthesized = []
342
- let generatedParenthesized = []
343
+ const paraphrases = []
344
+ const paraphrasesParenthesized = []
345
+ const generatedParenthesized = []
343
346
  if (forTemplate) {
344
347
  // noop
345
348
  } else {