From 308ac62eb834f612d1cefae8066898f35dbdfa51 Mon Sep 17 00:00:00 2001 From: saul Date: Mon, 1 Apr 2024 10:16:37 +1300 Subject: [PATCH] Move extend datastore to utils. --- packages/daemon/src/common/entry-tracker.ts | 2 +- packages/daemon/src/common/index.ts | 2 +- packages/daemon/src/modules/filesystem/setup.ts | 2 +- packages/daemon/test/modules/base.spec.ts | 2 +- packages/{daemon/src/utils.ts => utils/src/extend-datastore.ts} | 0 packages/utils/src/index.ts | 1 + 6 files changed, 5 insertions(+), 4 deletions(-) rename packages/{daemon/src/utils.ts => utils/src/extend-datastore.ts} (100%) diff --git a/packages/daemon/src/common/entry-tracker.ts b/packages/daemon/src/common/entry-tracker.ts index b9284639..f24afc03 100644 --- a/packages/daemon/src/common/entry-tracker.ts +++ b/packages/daemon/src/common/entry-tracker.ts @@ -3,7 +3,7 @@ import { Key, type Datastore } from 'interface-datastore' import { sha256 } from 'multiformats/hashes/sha2' import { compare as uint8ArrayCompare } from 'uint8arrays/compare' import type { KeyvalueDB, Pair } from '@/interface.js' -import { extendDatastore } from '@/utils.js' +import { extendDatastore } from '@organicdesign/db-utils' // Get the hash data from raw data. const hashEntry = async (entry: unknown): Promise => { diff --git a/packages/daemon/src/common/index.ts b/packages/daemon/src/common/index.ts index abc795da..7b9fe54a 100644 --- a/packages/daemon/src/common/index.ts +++ b/packages/daemon/src/common/index.ts @@ -23,7 +23,7 @@ import { Sneakernet } from './sneakernet/index.js' import { createTick } from './tick.js' import type { KeyvalueDB } from '@/interface.js' import { createLogger } from '@/logger.js' -import { extendDatastore } from '@/utils.js' +import { extendDatastore } from '@organicdesign/db-utils' interface Setup { socket: string diff --git a/packages/daemon/src/modules/filesystem/setup.ts b/packages/daemon/src/modules/filesystem/setup.ts index b6a1d26a..f03ad95d 100644 --- a/packages/daemon/src/modules/filesystem/setup.ts +++ b/packages/daemon/src/modules/filesystem/setup.ts @@ -4,7 +4,7 @@ import createUploadManager from './upload-operations.js' import type { Context, Config } from './index.js' import type { Components } from '@/common/interface.js' import type { CID } from 'multiformats/cid' -import { extendDatastore } from '@/utils.js' +import { extendDatastore } from '@organicdesign/db-utils' export default async (components: Components, config: Config): Promise => { const { groups, datastore, blockstore, welo } = components diff --git a/packages/daemon/test/modules/base.spec.ts b/packages/daemon/test/modules/base.spec.ts index dbccc8b5..6c7a90f6 100644 --- a/packages/daemon/test/modules/base.spec.ts +++ b/packages/daemon/test/modules/base.spec.ts @@ -10,7 +10,7 @@ import { CID } from 'multiformats/cid' import { fromString as uint8ArrayFromString } from 'uint8arrays' import { mkTestPath } from '../utils/paths.js' import setup from '@/common/index.js' -import { extendDatastore } from '@/utils.js' +import { extendDatastore } from '@organicdesign/db-utils' const parseStr = (data: string): Uint8Array => uint8ArrayFromString(data, 'base64') const testPath = mkTestPath('base') diff --git a/packages/daemon/src/utils.ts b/packages/utils/src/extend-datastore.ts similarity index 100% rename from packages/daemon/src/utils.ts rename to packages/utils/src/extend-datastore.ts diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 68af5a22..eb999488 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,5 +1,6 @@ import selectChunkerFunc from './select-chunker.js' +export { extendDatastore } from './extend-datastore.js' export { exporter } from './exporter.js' export { importer } from './importer.js' export type * from './interface.js'