corebasic 1.0.214 → 1.0.215
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/dist/libs/elabase.js +5 -2
- package/libs/elabase.ts +6 -2
- package/package.json +1 -1
package/dist/libs/elabase.js
CHANGED
|
@@ -179,11 +179,14 @@ export function batchSubmit(batch_id, arg) {
|
|
|
179
179
|
return result;
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
+
let PROJECT_ROOT_URL = new URL('../../..', import.meta.url);
|
|
183
|
+
if (String(PROJECT_ROOT_URL).endsWith('node_modules/'))
|
|
184
|
+
PROJECT_ROOT_URL = new URL('..', PROJECT_ROOT_URL);
|
|
182
185
|
const SCHEMAS_JSON_PROMISES = {};
|
|
183
186
|
export const schema = async (name) => {
|
|
184
187
|
// Cache the loading promise right away so parallel requests share it
|
|
185
188
|
if (!SCHEMAS_JSON_PROMISES[name])
|
|
186
|
-
SCHEMAS_JSON_PROMISES[name] = Utils.fileToJson(
|
|
189
|
+
SCHEMAS_JSON_PROMISES[name] = Utils.fileToJson(PROJECT_ROOT_URL, `schemas/${name}.json`);
|
|
187
190
|
try {
|
|
188
191
|
const schema = await SCHEMAS_JSON_PROMISES[name];
|
|
189
192
|
return structuredClone(schema);
|
|
@@ -196,7 +199,7 @@ export const schema = async (name) => {
|
|
|
196
199
|
};
|
|
197
200
|
const COLLECTIONS_JSON = await (async () => {
|
|
198
201
|
try {
|
|
199
|
-
return await Utils.fileToJson(
|
|
202
|
+
return await Utils.fileToJson(PROJECT_ROOT_URL, 'collections.json');
|
|
200
203
|
}
|
|
201
204
|
catch (e) {
|
|
202
205
|
console.error(e);
|
package/libs/elabase.ts
CHANGED
|
@@ -219,11 +219,15 @@ export function batchSubmit(batch_id, arg) {
|
|
|
219
219
|
})
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
let PROJECT_ROOT_URL = new URL('../../..', import.meta.url)
|
|
223
|
+
if (String(PROJECT_ROOT_URL).endsWith('node_modules/'))
|
|
224
|
+
PROJECT_ROOT_URL = new URL('..', PROJECT_ROOT_URL)
|
|
225
|
+
|
|
222
226
|
const SCHEMAS_JSON_PROMISES = {}
|
|
223
227
|
export const schema = async (name) => {
|
|
224
228
|
// Cache the loading promise right away so parallel requests share it
|
|
225
229
|
if (!SCHEMAS_JSON_PROMISES[name])
|
|
226
|
-
SCHEMAS_JSON_PROMISES[name] = Utils.fileToJson(
|
|
230
|
+
SCHEMAS_JSON_PROMISES[name] = Utils.fileToJson(PROJECT_ROOT_URL, `schemas/${name}.json`)
|
|
227
231
|
|
|
228
232
|
try {
|
|
229
233
|
const schema = await SCHEMAS_JSON_PROMISES[name];
|
|
@@ -237,7 +241,7 @@ export const schema = async (name) => {
|
|
|
237
241
|
|
|
238
242
|
const COLLECTIONS_JSON = await (async () => {
|
|
239
243
|
try {
|
|
240
|
-
return await Utils.fileToJson(
|
|
244
|
+
return await Utils.fileToJson(PROJECT_ROOT_URL, 'collections.json')
|
|
241
245
|
} catch(e) {
|
|
242
246
|
console.error(e)
|
|
243
247
|
console.warn("Warn: Dip Failed to load collections.json. Semantics, topology and legality enforcement is not active")
|