theprogrammablemind_4wp 9.3.0-beta.2 → 9.3.0-beta.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/config.js +10 -1
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.3.0-beta.2",
72
+ "version": "9.3.0-beta.4",
73
73
  "license": "UNLICENSED"
74
74
  }
package/src/config.js CHANGED
@@ -2113,6 +2113,9 @@ class Config {
2113
2113
  if (this.name == name) {
2114
2114
  return this._api.constructor
2115
2115
  } else {
2116
+ if (!this.getConfig(name)) {
2117
+ throw new Error(`Config.apiBase: The requested KM '${name}' has not been loaded`)
2118
+ }
2116
2119
  return this.getConfig(name)._api.constructor
2117
2120
  }
2118
2121
  } else {
@@ -2147,7 +2150,12 @@ class Config {
2147
2150
  }
2148
2151
  }
2149
2152
 
2153
+ setApiKMs(apiKMs) {
2154
+ this._apiKMs = [...apiKMs]
2155
+ }
2156
+
2150
2157
  // constructors is a constructor
2158
+ // TODO fix Api to be API WTF
2151
2159
  async setApi (constructor) {
2152
2160
  if (typeof constructor !== 'function') {
2153
2161
  throw new Error(`Expected the argument to be an API constructor for ${this.name}.`)
@@ -2165,7 +2173,7 @@ class Config {
2165
2173
  }
2166
2174
  } else {
2167
2175
  if (!value.initialize) {
2168
- throw new Error(`Expected the API to have an initialize function for ${this.name}.`)
2176
+ throw new Error(`Expected the API to have an initialize function for ${this.name}. If you are trying to pass in multiple API configs at once use setApiKMs to set the names of the configs that you want set.`)
2169
2177
  }
2170
2178
  }
2171
2179
 
@@ -2182,6 +2190,7 @@ class Config {
2182
2190
  this._apiConstructor = constructor
2183
2191
  if (this._apiKMs.length > 0) {
2184
2192
  for (const name of this._apiKMs) {
2193
+ debugger
2185
2194
  this.km(name)._api = value[name]
2186
2195
  }
2187
2196
  } else {