diff --git a/deno.json b/deno.json index e7b8f2b..f06a8e9 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@andyburke/fsdb", - "version": "1.1.0", + "version": "1.2.0", "license": "MIT", "exports": { ".": "./fsdb.ts", @@ -8,16 +8,16 @@ "./indexers": "./indexers.ts", "./organizers": "./organizers.ts" }, - "tasks": { "lint": "deno lint", "fmt": "deno fmt", "test": "cd tests && DENO_ENV=test FSDB_TEST_DATA_STORAGE_ROOT=./data/$(date --iso-8601=seconds) deno test --allow-env --allow-read --allow-write --fail-fast --trace-leaks ./", "fsdb": "deno run --allow-env --allow-read --allow-write cli.ts" }, - "fmt": { - "include": ["**/*.ts"], + "include": [ + "**/*.ts" + ], "options": { "useTabs": true, "lineWidth": 140, @@ -28,10 +28,16 @@ } }, "lint": { - "include": ["**/*.ts"], + "include": [ + "**/*.ts" + ], "rules": { - "tags": ["recommended"], - "exclude": ["no-explicit-any"] + "tags": [ + "recommended" + ], + "exclude": [ + "no-explicit-any" + ] } }, "imports": { diff --git a/indexers/symlinks.ts b/indexers/symlinks.ts index 200c9a6..bed90bd 100644 --- a/indexers/symlinks.ts +++ b/indexers/symlinks.ts @@ -14,6 +14,7 @@ interface FSDB_INDEXER_SYMLINKS_CONFIG_SHARED { id_field?: string; to_many?: boolean; organize?: (value: string) => string[]; + organize_id?: (value: string) => string[]; } interface FSDB_INDEXER_SYMLINKS_CONFIG_WITH_FIELD extends FSDB_INDEXER_SYMLINKS_CONFIG_SHARED { @@ -191,7 +192,11 @@ export class FSDB_INDEXER_SYMLINKS implements FSDB_INDEXER { continue; } - organized_paths.push(`${item_id}.json`); + if (this.config.organize_id) { + organized_paths.push(...this.config.organize_id(item_id)); + } else { + organized_paths.push(`${item_id}.json`); + } } const symlink_path = path.resolve(path.join(this.config.root, ...organized_paths));