corebasic 1.0.203 → 1.0.204

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/libs/dip.js CHANGED
@@ -17,6 +17,7 @@ export const globalMeta = Elabase.globalMeta
17
17
  export const companyMeta = Elabase.companyMeta
18
18
  export const outletMeta = Elabase.outletMeta
19
19
  export const customMeta = Elabase.customMeta
20
+ export const schema = Elabase.schema
20
21
 
21
22
  export const shard_stats = Elabase.shard_stats
22
23
  export let config = Elabase.config
package/libs/elabase.js CHANGED
@@ -219,6 +219,21 @@ export function batchSubmit(batch_id, arg) {
219
219
  })
220
220
  }
221
221
 
222
+ const SCHEMAS_JSON_PROMISES = {}
223
+ export const schema = async (name) => {
224
+ // Cache the loading promise right away so parallel requests share it
225
+ if (!SCHEMAS_JSON_PROMISES[name])
226
+ SCHEMAS_JSON_PROMISES[name] = Utils.fileToJson(new URL('../../..', import.meta.url), `schemas/${name}.json`)
227
+
228
+ try {
229
+ const schema = await SCHEMAS_JSON_PROMISES[name];
230
+ return structuredClone(schema)
231
+ } catch (e) {
232
+ // Delete the broken promise from cache so a retry can occur later
233
+ delete SCHEMAS_JSON_PROMISES[name]
234
+ throw {message: `Error: Failed to load schema ${name} in Dip`}
235
+ }
236
+ }
222
237
 
223
238
  const COLLECTIONS_JSON = await (async () => {
224
239
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.203",
4
+ "version": "1.0.204",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {