From 8fb92089b1f30e300df086e750c9d1ced79f1e9a Mon Sep 17 00:00:00 2001 From: Brian Joseph Petro Date: Thu, 19 Dec 2024 20:02:16 -0500 Subject: [PATCH] adapter pattern cleanup --- smart-environment/default.config.js | 8 ++++---- smart-sources/README.md | 6 +++--- smart-sources/test/ajson_multi_file.test.js | 6 +++--- smart-sources/test/old-tests (needs review)/_env.js | 6 +++--- smart-sources/test/sqlite.test.js | 6 +++--- smart-templates/test/_env.js | 1 - 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/smart-environment/default.config.js b/smart-environment/default.config.js index da463e46..c9ad3212 100644 --- a/smart-environment/default.config.js +++ b/smart-environment/default.config.js @@ -1,7 +1,7 @@ import { SmartSources, SmartBlocks, SmartSource, SmartBlock } from 'smart-sources'; import { AjsonMultiFileCollectionDataAdapter } from "smart-collections/adapters/ajson_multi_file"; -import { SourceAdapter } from "smart-sources/adapters/_adapter.js"; -import { MarkdownSourceAdapter } from "smart-sources/adapters/markdown.js"; +import { SourceContentAdapter } from "smart-sources/adapters/_adapter.js"; +import { MarkdownSourceContentAdapter } from "smart-sources/adapters/markdown_source.js"; import { SmartEmbedModel } from 'smart-embed-model'; export const smart_env_config = { env_data_dir: '.smart-env', @@ -11,8 +11,8 @@ export const smart_env_config = { class: SmartSources, data_adapter: AjsonMultiFileCollectionDataAdapter, source_adapters: { - "md": MarkdownSourceAdapter, - "default": SourceAdapter, + "md": MarkdownSourceContentAdapter, + "default": SourceContentAdapter, } }, smart_blocks: SmartBlocks, diff --git a/smart-sources/README.md b/smart-sources/README.md index 24debf2b..d6b4aff6 100644 --- a/smart-sources/README.md +++ b/smart-sources/README.md @@ -95,9 +95,9 @@ The `SmartBlock` class extends `SmartEntity` and represents an individual block Smart Sources uses adapters to handle different types of content. The main adapters are: -- `SourceAdapter`: Base adapter class for handling source operations. -- `MarkdownSourceAdapter`: Specializes in handling Markdown files. -- `PDFSourceAdapter`: Handles PDF files, extracting content into well-formed markdown. +- `SourceContentAdapter`: Base adapter class for handling source operations. +- `MarkdownSourceContentAdapter`: Specializes in handling Markdown files. +- `PDFSourceContentAdapter`: Handles PDF files, extracting content into well-formed markdown. Adapters provide a consistent interface for various operations on different content types. diff --git a/smart-sources/test/ajson_multi_file.test.js b/smart-sources/test/ajson_multi_file.test.js index becaf72f..a1a5302f 100644 --- a/smart-sources/test/ajson_multi_file.test.js +++ b/smart-sources/test/ajson_multi_file.test.js @@ -3,7 +3,7 @@ import { SmartEnv } from '../../smart-environment/smart_env.js'; import { SmartFs } from '../../smart-fs/smart_fs.js'; import { NodeFsSmartFsAdapter } from '../../smart-fs/adapters/node_fs.js'; import { SmartSettings } from '../../smart-settings/smart_settings.js'; -import { MarkdownSourceAdapter } from '../adapters/markdown.js'; +import { MarkdownSourceContentAdapter } from '../adapters/markdown_source.js'; import { SmartSources } from '../smart_sources.js'; import { SmartSource } from '../smart_source.js'; import { SmartBlocks } from '../smart_blocks.js'; @@ -33,8 +33,8 @@ class TestMultiFileSourceMain { class: SmartSources, data_adapter: AjsonMultiFileSourceDataAdapter, source_adapters: { - default: MarkdownSourceAdapter, - md: MarkdownSourceAdapter, + default: MarkdownSourceContentAdapter, + md: MarkdownSourceContentAdapter, } }, smart_blocks: { diff --git a/smart-sources/test/old-tests (needs review)/_env.js b/smart-sources/test/old-tests (needs review)/_env.js index 0803b9f8..d477af8d 100644 --- a/smart-sources/test/old-tests (needs review)/_env.js +++ b/smart-sources/test/old-tests (needs review)/_env.js @@ -1,7 +1,7 @@ import { JsonSingleFileCollectionDataAdapter } from '../../smart-collections/adapters/json_single_file.js'; import { SmartFsTestAdapter } from '../../smart-fs/adapters/_test.js'; import { SourceTestAdapter } from '../adapters/_test.js'; -import { MarkdownSourceAdapter } from '../adapters/markdown.js'; +import { MarkdownSourceContentAdapter } from '../adapters/markdown_source.js'; import { SmartSource } from '../smart_source.js'; import { SmartSources } from '../smart_sources.js'; import { SmartBlock } from '../smart_block.js'; @@ -46,8 +46,8 @@ class TestMain { data_adapter: JsonSingleFileCollectionDataAdapter, source_adapters: { test: SourceTestAdapter, - md: MarkdownSourceAdapter, - default: MarkdownSourceAdapter + md: MarkdownSourceContentAdapter, + default: MarkdownSourceContentAdapter }, }, smart_blocks: SmartBlocks, diff --git a/smart-sources/test/sqlite.test.js b/smart-sources/test/sqlite.test.js index 16023d8e..a164887c 100644 --- a/smart-sources/test/sqlite.test.js +++ b/smart-sources/test/sqlite.test.js @@ -3,7 +3,7 @@ import { SmartEnv } from '../../smart-environment/smart_env.js'; import { SmartFs } from '../../smart-fs/smart_fs.js'; import { NodeFsSmartFsAdapter } from '../../smart-fs/adapters/node_fs.js'; import { SmartSettings } from '../../smart-settings/smart_settings.js'; -import { MarkdownSourceAdapter } from '../adapters/markdown.js'; +import { MarkdownSourceContentAdapter } from '../adapters/markdown_source.js'; import { SmartSources } from '../smart_sources.js'; import { SmartSource } from '../smart_source.js'; import { SmartBlocks } from '../smart_blocks.js'; @@ -33,8 +33,8 @@ class TestMultiFileSourceMain { class: SmartSources, data_adapter: SqliteSourceDataAdapter, source_adapters: { - default: MarkdownSourceAdapter, - md: MarkdownSourceAdapter, + default: MarkdownSourceContentAdapter, + md: MarkdownSourceContentAdapter, } }, smart_blocks: { diff --git a/smart-templates/test/_env.js b/smart-templates/test/_env.js index 1c9f454c..19cac719 100644 --- a/smart-templates/test/_env.js +++ b/smart-templates/test/_env.js @@ -1,6 +1,5 @@ import { JsonSingleFileCollectionDataAdapter } from '../../smart-collections/adapters/json_single_file.js'; import { SourceTestAdapter } from 'smart-sources/adapters/_test.js'; -import { MarkdownSourceAdapter } from 'smart-sources/adapters/markdown.js'; import { SmartSources, SmartSource, SmartBlocks, SmartBlock } from 'smart-sources'; import { SmartEnv } from '../../smart-environment/smart_env.js'; import { SmartEmbedModel } from '../../smart-embed-model-v1/smart_embed_model.js';