corebasic 1.0.234 → 1.0.236
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/index.js +1 -0
- package/dist/libs/schemas.js +18 -0
- package/dist/libs/utils.js +4 -0
- package/index.ts +1 -0
- package/libs/schemas.ts +12 -0
- package/libs/utils.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,4 +7,5 @@ import * as Auth from './libs/auth.js';
|
|
|
7
7
|
import * as Features from './libs/features.js';
|
|
8
8
|
import * as Messaging from './libs/messaging.js';
|
|
9
9
|
import * as Compression from './libs/compression.js';
|
|
10
|
+
import './libs/schemas.js';
|
|
10
11
|
export { Elabase, Dip, Kafka, Utils, Session, Auth, Features, Messaging, Compression };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { readdir } from "node:fs/promises";
|
|
10
|
+
import * as Utils from './utils.js';
|
|
11
|
+
const g_this = globalThis;
|
|
12
|
+
g_this.Schemas ??= {};
|
|
13
|
+
for (const file of await readdir(Utils.PROJECT_ROOT_PATH)) {
|
|
14
|
+
if (file.endsWith(".ts") && file !== "index.ts") {
|
|
15
|
+
const schema = await import(__rewriteRelativeImportExtension(`${Utils.PROJECT_ROOT_PATH}/schemas/${file}`));
|
|
16
|
+
Object.assign(g_this.Schemas, schema.Schemas);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/libs/utils.js
CHANGED
|
@@ -7,6 +7,10 @@ export function log(...args) {
|
|
|
7
7
|
const res = args.map(arg => typeof arg === "object" ? JSON.stringify(arg, null, '\t') : arg);
|
|
8
8
|
console.log(...res);
|
|
9
9
|
}
|
|
10
|
+
let PROJECT_ROOT_URL = new URL('../../..', import.meta.url);
|
|
11
|
+
if (String(PROJECT_ROOT_URL).endsWith('node_modules/'))
|
|
12
|
+
PROJECT_ROOT_URL = new URL('..', PROJECT_ROOT_URL);
|
|
13
|
+
export const PROJECT_ROOT_PATH = String(PROJECT_ROOT_URL).endsWith("/") ? String(PROJECT_ROOT_URL).slice(0, -1) : String(PROJECT_ROOT_URL);
|
|
10
14
|
let UID_COUNTER = crypto.randomBytes(3).readUIntBE(0, 3);
|
|
11
15
|
const UID_PROCESS = crypto.randomBytes(5);
|
|
12
16
|
export function uid() {
|
package/index.ts
CHANGED
package/libs/schemas.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readdir } from "node:fs/promises"
|
|
2
|
+
import * as Utils from './utils.ts'
|
|
3
|
+
|
|
4
|
+
const g_this: any = globalThis as any
|
|
5
|
+
g_this.Schemas ??= {};
|
|
6
|
+
|
|
7
|
+
for (const file of await readdir(Utils.PROJECT_ROOT_PATH)) {
|
|
8
|
+
if (file.endsWith(".ts") && file !== "index.ts") {
|
|
9
|
+
const schema = await import(`${Utils.PROJECT_ROOT_PATH}/schemas/${file}`)
|
|
10
|
+
Object.assign(g_this.Schemas, schema.Schemas)
|
|
11
|
+
}
|
|
12
|
+
}
|
package/libs/utils.ts
CHANGED
|
@@ -11,6 +11,11 @@ export function log(...args: unknown[]): void {
|
|
|
11
11
|
console.log(...res)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
let PROJECT_ROOT_URL = new URL('../../..', import.meta.url)
|
|
15
|
+
if (String(PROJECT_ROOT_URL).endsWith('node_modules/'))
|
|
16
|
+
PROJECT_ROOT_URL = new URL('..', PROJECT_ROOT_URL)
|
|
17
|
+
export const PROJECT_ROOT_PATH: string = String(PROJECT_ROOT_URL).endsWith("/") ? String(PROJECT_ROOT_URL).slice(0, -1) : String(PROJECT_ROOT_URL)
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
let UID_COUNTER = crypto.randomBytes(3).readUIntBE(0, 3);
|
|
16
21
|
const UID_PROCESS = crypto.randomBytes(5);
|