mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
fix: reenable auto ID
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
const setLoadSchema = z.object({
|
const setLoadSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string().optional(),
|
||||||
name: z.string().optional(),
|
name: z.string().optional(),
|
||||||
script: z.string(),
|
script: z.string(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class LoadRepo extends EventEmitter<LoadRepoEvents> {
|
|||||||
public set = async (options: SetLoadOptions) => {
|
public set = async (options: SetLoadOptions) => {
|
||||||
const { database } = this.#options;
|
const { database } = this.#options;
|
||||||
const db = await database.instance;
|
const db = await database.instance;
|
||||||
const id = options.id || nanoid();
|
const id = options.id || `auto-id/${nanoid()}`;
|
||||||
const script = createHash('sha256').update(options.script).digest('hex');
|
const script = createHash('sha256').update(options.script).digest('hex');
|
||||||
const scriptDir = resolve(this.#options.config.files.data, 'scripts');
|
const scriptDir = resolve(this.#options.config.files.data, 'scripts');
|
||||||
await mkdir(scriptDir, { recursive: true });
|
await mkdir(scriptDir, { recursive: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user