@aopslab/domain-dm-docman 0.1.2
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/LICENSE +202 -0
- package/NOTICE +6 -0
- package/README.md +26 -0
- package/dist/application/errors/AssetServiceError.d.ts +20 -0
- package/dist/application/errors/AssetServiceError.js +13 -0
- package/dist/application/errors/AssetVersionServiceError.d.ts +20 -0
- package/dist/application/errors/AssetVersionServiceError.js +13 -0
- package/dist/application/errors/DocumentGroupServiceError.d.ts +20 -0
- package/dist/application/errors/DocumentGroupServiceError.js +16 -0
- package/dist/application/errors/DocumentSectionLinkServiceError.d.ts +20 -0
- package/dist/application/errors/DocumentSectionLinkServiceError.js +16 -0
- package/dist/application/errors/DocumentServiceError.d.ts +20 -0
- package/dist/application/errors/DocumentServiceError.js +16 -0
- package/dist/application/errors/DocumentVersionServiceError.d.ts +20 -0
- package/dist/application/errors/DocumentVersionServiceError.js +16 -0
- package/dist/application/errors/EmbedServiceError.d.ts +20 -0
- package/dist/application/errors/EmbedServiceError.js +16 -0
- package/dist/application/errors/PageEmbedLinkServiceError.d.ts +20 -0
- package/dist/application/errors/PageEmbedLinkServiceError.js +16 -0
- package/dist/application/errors/PageServiceError.d.ts +20 -0
- package/dist/application/errors/PageServiceError.js +16 -0
- package/dist/application/errors/PageSnippetLinkServiceError.d.ts +20 -0
- package/dist/application/errors/PageSnippetLinkServiceError.js +16 -0
- package/dist/application/errors/PageVersionServiceError.d.ts +20 -0
- package/dist/application/errors/PageVersionServiceError.js +16 -0
- package/dist/application/errors/SectionPageLinkServiceError.d.ts +20 -0
- package/dist/application/errors/SectionPageLinkServiceError.js +16 -0
- package/dist/application/errors/SectionServiceError.d.ts +20 -0
- package/dist/application/errors/SectionServiceError.js +16 -0
- package/dist/application/errors/SnippetServiceError.d.ts +20 -0
- package/dist/application/errors/SnippetServiceError.js +16 -0
- package/dist/application/errors/index.d.ts +1 -0
- package/dist/application/errors/index.js +1 -0
- package/dist/application/factories/RepositoryFactoryAsset.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryAsset.js +7 -0
- package/dist/application/factories/RepositoryFactoryAssetVersion.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryAssetVersion.js +7 -0
- package/dist/application/factories/RepositoryFactoryDocument.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryDocument.js +7 -0
- package/dist/application/factories/RepositoryFactoryDocumentGroup.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryDocumentGroup.js +7 -0
- package/dist/application/factories/RepositoryFactoryDocumentIndexEntry.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryDocumentIndexEntry.js +7 -0
- package/dist/application/factories/RepositoryFactoryDocumentSectionLink.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryDocumentSectionLink.js +7 -0
- package/dist/application/factories/RepositoryFactoryDocumentVersion.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryDocumentVersion.js +7 -0
- package/dist/application/factories/RepositoryFactoryEmbed.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryEmbed.js +7 -0
- package/dist/application/factories/RepositoryFactoryPage.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryPage.js +7 -0
- package/dist/application/factories/RepositoryFactoryPageEmbedLink.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryPageEmbedLink.js +7 -0
- package/dist/application/factories/RepositoryFactoryPageSnippetLink.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryPageSnippetLink.js +7 -0
- package/dist/application/factories/RepositoryFactoryPageVersion.d.ts +4 -0
- package/dist/application/factories/RepositoryFactoryPageVersion.js +7 -0
- package/dist/application/factories/RepositoryFactorySection.d.ts +4 -0
- package/dist/application/factories/RepositoryFactorySection.js +7 -0
- package/dist/application/factories/RepositoryFactorySectionPageLink.d.ts +4 -0
- package/dist/application/factories/RepositoryFactorySectionPageLink.js +7 -0
- package/dist/application/factories/RepositoryFactorySnippet.d.ts +4 -0
- package/dist/application/factories/RepositoryFactorySnippet.js +7 -0
- package/dist/application/factories/ServiceAssetBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceAssetBuilder.js +80 -0
- package/dist/application/factories/ServiceAssetFactory.d.ts +11 -0
- package/dist/application/factories/ServiceAssetFactory.js +15 -0
- package/dist/application/factories/ServiceAssetVersionBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceAssetVersionBuilder.js +80 -0
- package/dist/application/factories/ServiceAssetVersionFactory.d.ts +11 -0
- package/dist/application/factories/ServiceAssetVersionFactory.js +15 -0
- package/dist/application/factories/ServiceDocumentBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceDocumentBuilder.js +83 -0
- package/dist/application/factories/ServiceDocumentFactory.d.ts +11 -0
- package/dist/application/factories/ServiceDocumentFactory.js +15 -0
- package/dist/application/factories/ServiceDocumentGroupBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceDocumentGroupBuilder.js +83 -0
- package/dist/application/factories/ServiceDocumentGroupFactory.d.ts +11 -0
- package/dist/application/factories/ServiceDocumentGroupFactory.js +15 -0
- package/dist/application/factories/ServiceDocumentSectionLinkBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceDocumentSectionLinkBuilder.js +83 -0
- package/dist/application/factories/ServiceDocumentSectionLinkFactory.d.ts +11 -0
- package/dist/application/factories/ServiceDocumentSectionLinkFactory.js +15 -0
- package/dist/application/factories/ServiceDocumentVersionBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceDocumentVersionBuilder.js +83 -0
- package/dist/application/factories/ServiceDocumentVersionFactory.d.ts +11 -0
- package/dist/application/factories/ServiceDocumentVersionFactory.js +15 -0
- package/dist/application/factories/ServiceEmbedBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceEmbedBuilder.js +83 -0
- package/dist/application/factories/ServiceEmbedFactory.d.ts +11 -0
- package/dist/application/factories/ServiceEmbedFactory.js +15 -0
- package/dist/application/factories/ServicePageBuilder.d.ts +30 -0
- package/dist/application/factories/ServicePageBuilder.js +83 -0
- package/dist/application/factories/ServicePageEmbedLinkBuilder.d.ts +30 -0
- package/dist/application/factories/ServicePageEmbedLinkBuilder.js +83 -0
- package/dist/application/factories/ServicePageEmbedLinkFactory.d.ts +11 -0
- package/dist/application/factories/ServicePageEmbedLinkFactory.js +15 -0
- package/dist/application/factories/ServicePageFactory.d.ts +11 -0
- package/dist/application/factories/ServicePageFactory.js +15 -0
- package/dist/application/factories/ServicePageSnippetLinkBuilder.d.ts +30 -0
- package/dist/application/factories/ServicePageSnippetLinkBuilder.js +83 -0
- package/dist/application/factories/ServicePageSnippetLinkFactory.d.ts +11 -0
- package/dist/application/factories/ServicePageSnippetLinkFactory.js +15 -0
- package/dist/application/factories/ServicePageVersionBuilder.d.ts +34 -0
- package/dist/application/factories/ServicePageVersionBuilder.js +121 -0
- package/dist/application/factories/ServicePageVersionFactory.d.ts +11 -0
- package/dist/application/factories/ServicePageVersionFactory.js +15 -0
- package/dist/application/factories/ServiceSectionBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceSectionBuilder.js +83 -0
- package/dist/application/factories/ServiceSectionFactory.d.ts +11 -0
- package/dist/application/factories/ServiceSectionFactory.js +15 -0
- package/dist/application/factories/ServiceSectionPageLinkBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceSectionPageLinkBuilder.js +83 -0
- package/dist/application/factories/ServiceSectionPageLinkFactory.d.ts +11 -0
- package/dist/application/factories/ServiceSectionPageLinkFactory.js +15 -0
- package/dist/application/factories/ServiceSnippetBuilder.d.ts +30 -0
- package/dist/application/factories/ServiceSnippetBuilder.js +83 -0
- package/dist/application/factories/ServiceSnippetFactory.d.ts +11 -0
- package/dist/application/factories/ServiceSnippetFactory.js +15 -0
- package/dist/application/factories/drizzleDialect.d.ts +16 -0
- package/dist/application/factories/drizzleDialect.js +36 -0
- package/dist/application/factories/index.d.ts +43 -0
- package/dist/application/factories/index.js +44 -0
- package/dist/application/ports/inbound/IAssetServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IAssetServicePort.js +1 -0
- package/dist/application/ports/inbound/IAssetVersionServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IAssetVersionServicePort.js +1 -0
- package/dist/application/ports/inbound/IDocumentGroupServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IDocumentGroupServicePort.js +1 -0
- package/dist/application/ports/inbound/IDocumentSectionLinkServicePort.d.ts +16 -0
- package/dist/application/ports/inbound/IDocumentSectionLinkServicePort.js +1 -0
- package/dist/application/ports/inbound/IDocumentServicePort.d.ts +300 -0
- package/dist/application/ports/inbound/IDocumentServicePort.js +1 -0
- package/dist/application/ports/inbound/IDocumentVersionServicePort.d.ts +106 -0
- package/dist/application/ports/inbound/IDocumentVersionServicePort.js +1 -0
- package/dist/application/ports/inbound/IEmbedServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IEmbedServicePort.js +1 -0
- package/dist/application/ports/inbound/IPageEmbedLinkServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IPageEmbedLinkServicePort.js +1 -0
- package/dist/application/ports/inbound/IPageServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IPageServicePort.js +1 -0
- package/dist/application/ports/inbound/IPageSnippetLinkServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IPageSnippetLinkServicePort.js +1 -0
- package/dist/application/ports/inbound/IPageVersionServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/IPageVersionServicePort.js +1 -0
- package/dist/application/ports/inbound/ISectionPageLinkServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/ISectionPageLinkServicePort.js +1 -0
- package/dist/application/ports/inbound/ISectionServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/ISectionServicePort.js +1 -0
- package/dist/application/ports/inbound/ISnippetServicePort.d.ts +14 -0
- package/dist/application/ports/inbound/ISnippetServicePort.js +1 -0
- package/dist/application/ports/inbound/index.d.ts +14 -0
- package/dist/application/ports/inbound/index.js +15 -0
- package/dist/application/ports/repository-ports/IRepositoryPortAsset.d.ts +5 -0
- package/dist/application/ports/repository-ports/IRepositoryPortAsset.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortAssetVersion.d.ts +5 -0
- package/dist/application/ports/repository-ports/IRepositoryPortAssetVersion.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocument.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocument.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentGroup.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentGroup.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentIndexEntry.d.ts +5 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentIndexEntry.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentSectionLink.d.ts +21 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentSectionLink.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentVersion.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortDocumentVersion.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortEmbed.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortEmbed.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPage.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPage.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPageEmbedLink.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPageEmbedLink.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPageSnippetLink.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPageSnippetLink.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPageVersion.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortPageVersion.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortSection.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortSection.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortSectionPageLink.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortSectionPageLink.js +1 -0
- package/dist/application/ports/repository-ports/IRepositoryPortSnippet.d.ts +10 -0
- package/dist/application/ports/repository-ports/IRepositoryPortSnippet.js +1 -0
- package/dist/application/ports/repository-ports/index.d.ts +15 -0
- package/dist/application/ports/repository-ports/index.js +16 -0
- package/dist/application/services/documentCascadeDelete.d.ts +47 -0
- package/dist/application/services/documentCascadeDelete.js +202 -0
- package/dist/application/services/documentComposeSupport.d.ts +30 -0
- package/dist/application/services/documentComposeSupport.js +285 -0
- package/dist/application/services/documentIndexSupport.d.ts +7 -0
- package/dist/application/services/documentIndexSupport.js +28 -0
- package/dist/application/services/documentPublishSupport.d.ts +14 -0
- package/dist/application/services/documentPublishSupport.js +39 -0
- package/dist/application/services/documentRetrievalAiSupport.d.ts +21 -0
- package/dist/application/services/documentRetrievalAiSupport.js +114 -0
- package/dist/application/services/index.d.ts +14 -0
- package/dist/application/services/index.js +15 -0
- package/dist/application/services/service.asset.d.ts +25 -0
- package/dist/application/services/service.asset.js +58 -0
- package/dist/application/services/service.assetVersion.d.ts +25 -0
- package/dist/application/services/service.assetVersion.js +58 -0
- package/dist/application/services/service.document.d.ts +167 -0
- package/dist/application/services/service.document.js +2860 -0
- package/dist/application/services/service.documentGroup.d.ts +25 -0
- package/dist/application/services/service.documentGroup.js +58 -0
- package/dist/application/services/service.documentSectionLink.d.ts +27 -0
- package/dist/application/services/service.documentSectionLink.js +69 -0
- package/dist/application/services/service.documentVersion.d.ts +66 -0
- package/dist/application/services/service.documentVersion.js +715 -0
- package/dist/application/services/service.embed.d.ts +25 -0
- package/dist/application/services/service.embed.js +58 -0
- package/dist/application/services/service.page.d.ts +25 -0
- package/dist/application/services/service.page.js +58 -0
- package/dist/application/services/service.pageEmbedLink.d.ts +25 -0
- package/dist/application/services/service.pageEmbedLink.js +58 -0
- package/dist/application/services/service.pageSnippetLink.d.ts +25 -0
- package/dist/application/services/service.pageSnippetLink.js +58 -0
- package/dist/application/services/service.pageVersion.d.ts +31 -0
- package/dist/application/services/service.pageVersion.js +114 -0
- package/dist/application/services/service.section.d.ts +25 -0
- package/dist/application/services/service.section.js +58 -0
- package/dist/application/services/service.sectionPageLink.d.ts +25 -0
- package/dist/application/services/service.sectionPageLink.js +58 -0
- package/dist/application/services/service.snippet.d.ts +25 -0
- package/dist/application/services/service.snippet.js +58 -0
- package/dist/application/services/service.zod-validation.d.ts +11 -0
- package/dist/application/services/service.zod-validation.js +14 -0
- package/dist/domain/domain.d.ts +8 -0
- package/dist/domain/domain.js +9 -0
- package/dist/domain/dto/index.d.ts +1 -0
- package/dist/domain/dto/index.js +1 -0
- package/dist/domain/index.d.ts +4 -0
- package/dist/domain/index.js +4 -0
- package/dist/domain/models/asset/IbmAsset.d.ts +5 -0
- package/dist/domain/models/asset/IbmAsset.js +18 -0
- package/dist/domain/models/asset/index.d.ts +2 -0
- package/dist/domain/models/asset/index.js +2 -0
- package/dist/domain/models/asset/zod.schema.d.ts +39 -0
- package/dist/domain/models/asset/zod.schema.js +22 -0
- package/dist/domain/models/assetVersion/IbmAssetVersion.d.ts +6 -0
- package/dist/domain/models/assetVersion/IbmAssetVersion.js +25 -0
- package/dist/domain/models/assetVersion/index.d.ts +2 -0
- package/dist/domain/models/assetVersion/index.js +2 -0
- package/dist/domain/models/assetVersion/zod.schema.d.ts +71 -0
- package/dist/domain/models/assetVersion/zod.schema.js +37 -0
- package/dist/domain/models/document/IbmDocument.d.ts +8 -0
- package/dist/domain/models/document/IbmDocument.js +30 -0
- package/dist/domain/models/document/index.d.ts +2 -0
- package/dist/domain/models/document/index.js +2 -0
- package/dist/domain/models/document/zod.schema.d.ts +157 -0
- package/dist/domain/models/document/zod.schema.js +31 -0
- package/dist/domain/models/documentGroup/IbmDocumentGroup.d.ts +5 -0
- package/dist/domain/models/documentGroup/IbmDocumentGroup.js +17 -0
- package/dist/domain/models/documentGroup/index.d.ts +2 -0
- package/dist/domain/models/documentGroup/index.js +2 -0
- package/dist/domain/models/documentGroup/zod.schema.d.ts +27 -0
- package/dist/domain/models/documentGroup/zod.schema.js +22 -0
- package/dist/domain/models/documentIndexEntry/IbmDocumentIndexEntry.d.ts +6 -0
- package/dist/domain/models/documentIndexEntry/IbmDocumentIndexEntry.js +50 -0
- package/dist/domain/models/documentIndexEntry/index.d.ts +2 -0
- package/dist/domain/models/documentIndexEntry/index.js +2 -0
- package/dist/domain/models/documentIndexEntry/zod.schema.d.ts +112 -0
- package/dist/domain/models/documentIndexEntry/zod.schema.js +55 -0
- package/dist/domain/models/documentSectionLink/IbmDocumentSectionLink.d.ts +5 -0
- package/dist/domain/models/documentSectionLink/IbmDocumentSectionLink.js +23 -0
- package/dist/domain/models/documentSectionLink/index.d.ts +2 -0
- package/dist/domain/models/documentSectionLink/index.js +2 -0
- package/dist/domain/models/documentSectionLink/zod.schema.d.ts +65 -0
- package/dist/domain/models/documentSectionLink/zod.schema.js +80 -0
- package/dist/domain/models/documentVersion/IbmDocumentVersion.d.ts +8 -0
- package/dist/domain/models/documentVersion/IbmDocumentVersion.js +25 -0
- package/dist/domain/models/documentVersion/index.d.ts +2 -0
- package/dist/domain/models/documentVersion/index.js +2 -0
- package/dist/domain/models/documentVersion/zod.schema.d.ts +75 -0
- package/dist/domain/models/documentVersion/zod.schema.js +26 -0
- package/dist/domain/models/embed/IbmEmbed.d.ts +5 -0
- package/dist/domain/models/embed/IbmEmbed.js +19 -0
- package/dist/domain/models/embed/index.d.ts +2 -0
- package/dist/domain/models/embed/index.js +2 -0
- package/dist/domain/models/embed/zod.schema.d.ts +39 -0
- package/dist/domain/models/embed/zod.schema.js +24 -0
- package/dist/domain/models/index.d.ts +15 -0
- package/dist/domain/models/index.js +16 -0
- package/dist/domain/models/page/IbmPage.d.ts +8 -0
- package/dist/domain/models/page/IbmPage.js +20 -0
- package/dist/domain/models/page/index.d.ts +2 -0
- package/dist/domain/models/page/index.js +2 -0
- package/dist/domain/models/page/zod.schema.d.ts +57 -0
- package/dist/domain/models/page/zod.schema.js +21 -0
- package/dist/domain/models/pageEmbedLink/IbmPageEmbedLink.d.ts +5 -0
- package/dist/domain/models/pageEmbedLink/IbmPageEmbedLink.js +14 -0
- package/dist/domain/models/pageEmbedLink/index.d.ts +2 -0
- package/dist/domain/models/pageEmbedLink/index.js +2 -0
- package/dist/domain/models/pageEmbedLink/zod.schema.d.ts +21 -0
- package/dist/domain/models/pageEmbedLink/zod.schema.js +19 -0
- package/dist/domain/models/pageSnippetLink/IbmPageSnippetLink.d.ts +5 -0
- package/dist/domain/models/pageSnippetLink/IbmPageSnippetLink.js +15 -0
- package/dist/domain/models/pageSnippetLink/index.d.ts +2 -0
- package/dist/domain/models/pageSnippetLink/index.js +2 -0
- package/dist/domain/models/pageSnippetLink/zod.schema.d.ts +23 -0
- package/dist/domain/models/pageSnippetLink/zod.schema.js +20 -0
- package/dist/domain/models/pageVersion/IbmPageVersion.d.ts +8 -0
- package/dist/domain/models/pageVersion/IbmPageVersion.js +23 -0
- package/dist/domain/models/pageVersion/index.d.ts +2 -0
- package/dist/domain/models/pageVersion/index.js +2 -0
- package/dist/domain/models/pageVersion/zod.schema.d.ts +77 -0
- package/dist/domain/models/pageVersion/zod.schema.js +24 -0
- package/dist/domain/models/section/IbmSection.d.ts +8 -0
- package/dist/domain/models/section/IbmSection.js +20 -0
- package/dist/domain/models/section/index.d.ts +2 -0
- package/dist/domain/models/section/index.js +2 -0
- package/dist/domain/models/section/zod.schema.d.ts +57 -0
- package/dist/domain/models/section/zod.schema.js +21 -0
- package/dist/domain/models/sectionPageLink/IbmSectionPageLink.d.ts +5 -0
- package/dist/domain/models/sectionPageLink/IbmSectionPageLink.js +18 -0
- package/dist/domain/models/sectionPageLink/index.d.ts +2 -0
- package/dist/domain/models/sectionPageLink/index.js +2 -0
- package/dist/domain/models/sectionPageLink/zod.schema.d.ts +29 -0
- package/dist/domain/models/sectionPageLink/zod.schema.js +23 -0
- package/dist/domain/models/snippet/IbmSnippet.d.ts +5 -0
- package/dist/domain/models/snippet/IbmSnippet.js +17 -0
- package/dist/domain/models/snippet/index.d.ts +2 -0
- package/dist/domain/models/snippet/index.js +2 -0
- package/dist/domain/models/snippet/zod.schema.d.ts +27 -0
- package/dist/domain/models/snippet/zod.schema.js +22 -0
- package/dist/domain/types.d.ts +1 -0
- package/dist/domain/types.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/infrastructure/db/asset/drizzle/drizzle.mapper.asset.d.ts +31 -0
- package/dist/infrastructure/db/asset/drizzle/drizzle.mapper.asset.js +6 -0
- package/dist/infrastructure/db/asset/drizzle/drizzle.schema.asset.d.ts +250 -0
- package/dist/infrastructure/db/asset/drizzle/drizzle.schema.asset.js +24 -0
- package/dist/infrastructure/db/asset/drizzle/drizzle.schema.asset.sqlite.d.ts +272 -0
- package/dist/infrastructure/db/asset/drizzle/drizzle.schema.asset.sqlite.js +25 -0
- package/dist/infrastructure/db/asset/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/asset/drizzle/index.js +2 -0
- package/dist/infrastructure/db/assetVersion/drizzle/drizzle.mapper.assetVersion.d.ts +45 -0
- package/dist/infrastructure/db/assetVersion/drizzle/drizzle.mapper.assetVersion.js +6 -0
- package/dist/infrastructure/db/assetVersion/drizzle/drizzle.schema.assetVersion.d.ts +371 -0
- package/dist/infrastructure/db/assetVersion/drizzle/drizzle.schema.assetVersion.js +30 -0
- package/dist/infrastructure/db/assetVersion/drizzle/drizzle.schema.assetVersion.sqlite.d.ts +397 -0
- package/dist/infrastructure/db/assetVersion/drizzle/drizzle.schema.assetVersion.sqlite.js +31 -0
- package/dist/infrastructure/db/assetVersion/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/assetVersion/drizzle/index.js +2 -0
- package/dist/infrastructure/db/document/drizzle/drizzle.mapper.document.d.ts +98 -0
- package/dist/infrastructure/db/document/drizzle/drizzle.mapper.document.js +6 -0
- package/dist/infrastructure/db/document/drizzle/drizzle.schema.document.d.ts +394 -0
- package/dist/infrastructure/db/document/drizzle/drizzle.schema.document.js +34 -0
- package/dist/infrastructure/db/document/drizzle/drizzle.schema.document.sqlite.d.ts +424 -0
- package/dist/infrastructure/db/document/drizzle/drizzle.schema.document.sqlite.js +35 -0
- package/dist/infrastructure/db/document/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/document/drizzle/index.js +2 -0
- package/dist/infrastructure/db/documentGroup/drizzle/drizzle.mapper.documentGroup.d.ts +29 -0
- package/dist/infrastructure/db/documentGroup/drizzle/drizzle.mapper.documentGroup.js +6 -0
- package/dist/infrastructure/db/documentGroup/drizzle/drizzle.schema.documentGroup.d.ts +233 -0
- package/dist/infrastructure/db/documentGroup/drizzle/drizzle.schema.documentGroup.js +22 -0
- package/dist/infrastructure/db/documentGroup/drizzle/drizzle.schema.documentGroup.sqlite.d.ts +253 -0
- package/dist/infrastructure/db/documentGroup/drizzle/drizzle.schema.documentGroup.sqlite.js +23 -0
- package/dist/infrastructure/db/documentGroup/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/documentGroup/drizzle/index.js +2 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/drizzle.mapper.documentIndexEntry.d.ts +95 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/drizzle.mapper.documentIndexEntry.js +12 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/drizzle.schema.documentIndexEntry.d.ts +792 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/drizzle.schema.documentIndexEntry.js +57 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/drizzle.schema.documentIndexEntry.sqlite.d.ts +854 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/drizzle.schema.documentIndexEntry.sqlite.js +58 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/documentIndexEntry/drizzle/index.js +2 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/drizzle.mapper.documentSectionLink.d.ts +41 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/drizzle.mapper.documentSectionLink.js +12 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/drizzle.schema.documentSectionLink.d.ts +335 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/drizzle.schema.documentSectionLink.js +29 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/drizzle.schema.documentSectionLink.sqlite.d.ts +357 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/drizzle.schema.documentSectionLink.sqlite.js +30 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/documentSectionLink/drizzle/index.js +2 -0
- package/dist/infrastructure/db/documentVersion/drizzle/drizzle.mapper.documentVersion.d.ts +54 -0
- package/dist/infrastructure/db/documentVersion/drizzle/drizzle.mapper.documentVersion.js +7 -0
- package/dist/infrastructure/db/documentVersion/drizzle/drizzle.schema.documentVersion.d.ts +301 -0
- package/dist/infrastructure/db/documentVersion/drizzle/drizzle.schema.documentVersion.js +30 -0
- package/dist/infrastructure/db/documentVersion/drizzle/drizzle.schema.documentVersion.sqlite.d.ts +323 -0
- package/dist/infrastructure/db/documentVersion/drizzle/drizzle.schema.documentVersion.sqlite.js +27 -0
- package/dist/infrastructure/db/documentVersion/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/documentVersion/drizzle/index.js +2 -0
- package/dist/infrastructure/db/domain-naming.d.ts +2 -0
- package/dist/infrastructure/db/domain-naming.js +57 -0
- package/dist/infrastructure/db/embed/drizzle/drizzle.mapper.embed.d.ts +33 -0
- package/dist/infrastructure/db/embed/drizzle/drizzle.mapper.embed.js +5 -0
- package/dist/infrastructure/db/embed/drizzle/drizzle.schema.embed.d.ts +267 -0
- package/dist/infrastructure/db/embed/drizzle/drizzle.schema.embed.js +24 -0
- package/dist/infrastructure/db/embed/drizzle/drizzle.schema.embed.sqlite.d.ts +291 -0
- package/dist/infrastructure/db/embed/drizzle/drizzle.schema.embed.sqlite.js +25 -0
- package/dist/infrastructure/db/embed/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/embed/drizzle/index.js +2 -0
- package/dist/infrastructure/db/page/drizzle/drizzle.mapper.page.d.ts +44 -0
- package/dist/infrastructure/db/page/drizzle/drizzle.mapper.page.js +5 -0
- package/dist/infrastructure/db/page/drizzle/drizzle.schema.page.d.ts +218 -0
- package/dist/infrastructure/db/page/drizzle/drizzle.schema.page.js +20 -0
- package/dist/infrastructure/db/page/drizzle/drizzle.schema.page.sqlite.d.ts +234 -0
- package/dist/infrastructure/db/page/drizzle/drizzle.schema.page.sqlite.js +21 -0
- package/dist/infrastructure/db/page/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/page/drizzle/index.js +2 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/drizzle.mapper.pageEmbedLink.d.ts +23 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/drizzle.mapper.pageEmbedLink.js +5 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/drizzle.schema.pageEmbedLink.d.ts +180 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/drizzle.schema.pageEmbedLink.js +18 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/drizzle.schema.pageEmbedLink.sqlite.d.ts +194 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/drizzle.schema.pageEmbedLink.sqlite.js +19 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/pageEmbedLink/drizzle/index.js +2 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/drizzle.mapper.pageSnippetLink.d.ts +25 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/drizzle.mapper.pageSnippetLink.js +7 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/drizzle.schema.pageSnippetLink.d.ts +197 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/drizzle.schema.pageSnippetLink.js +19 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/drizzle.schema.pageSnippetLink.sqlite.d.ts +211 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/drizzle.schema.pageSnippetLink.sqlite.js +20 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/pageSnippetLink/drizzle/index.js +2 -0
- package/dist/infrastructure/db/pageVersion/drizzle/drizzle.mapper.pageVersion.d.ts +50 -0
- package/dist/infrastructure/db/pageVersion/drizzle/drizzle.mapper.pageVersion.js +6 -0
- package/dist/infrastructure/db/pageVersion/drizzle/drizzle.schema.pageVersion.d.ts +271 -0
- package/dist/infrastructure/db/pageVersion/drizzle/drizzle.schema.pageVersion.js +23 -0
- package/dist/infrastructure/db/pageVersion/drizzle/drizzle.schema.pageVersion.sqlite.d.ts +289 -0
- package/dist/infrastructure/db/pageVersion/drizzle/drizzle.schema.pageVersion.sqlite.js +24 -0
- package/dist/infrastructure/db/pageVersion/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/pageVersion/drizzle/index.js +2 -0
- package/dist/infrastructure/db/section/drizzle/drizzle.mapper.section.d.ts +44 -0
- package/dist/infrastructure/db/section/drizzle/drizzle.mapper.section.js +5 -0
- package/dist/infrastructure/db/section/drizzle/drizzle.schema.section.d.ts +216 -0
- package/dist/infrastructure/db/section/drizzle/drizzle.schema.section.js +20 -0
- package/dist/infrastructure/db/section/drizzle/drizzle.schema.section.sqlite.d.ts +234 -0
- package/dist/infrastructure/db/section/drizzle/drizzle.schema.section.sqlite.js +21 -0
- package/dist/infrastructure/db/section/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/section/drizzle/index.js +2 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/drizzle.mapper.sectionPageLink.d.ts +31 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/drizzle.mapper.sectionPageLink.js +7 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/drizzle.schema.sectionPageLink.d.ts +248 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/drizzle.schema.sectionPageLink.js +22 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/drizzle.schema.sectionPageLink.sqlite.d.ts +264 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/drizzle.schema.sectionPageLink.sqlite.js +23 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/sectionPageLink/drizzle/index.js +2 -0
- package/dist/infrastructure/db/snippet/drizzle/drizzle.mapper.snippet.d.ts +29 -0
- package/dist/infrastructure/db/snippet/drizzle/drizzle.mapper.snippet.js +5 -0
- package/dist/infrastructure/db/snippet/drizzle/drizzle.schema.snippet.d.ts +233 -0
- package/dist/infrastructure/db/snippet/drizzle/drizzle.schema.snippet.js +22 -0
- package/dist/infrastructure/db/snippet/drizzle/drizzle.schema.snippet.sqlite.d.ts +253 -0
- package/dist/infrastructure/db/snippet/drizzle/drizzle.schema.snippet.sqlite.js +23 -0
- package/dist/infrastructure/db/snippet/drizzle/index.d.ts +2 -0
- package/dist/infrastructure/db/snippet/drizzle/index.js +2 -0
- package/dist/infrastructure/repositories/asset/drizzle/AssetDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/asset/drizzle/AssetDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/asset/drizzle/AssetDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/asset/drizzle/AssetDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/assetVersion/drizzle/AssetVersionDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/assetVersion/drizzle/AssetVersionDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/assetVersion/drizzle/AssetVersionDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/assetVersion/drizzle/AssetVersionDrizzleSqliteRepo.js +12 -0
- package/dist/infrastructure/repositories/document/drizzle/DocumentDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/document/drizzle/DocumentDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/document/drizzle/DocumentDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/document/drizzle/DocumentDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/documentGroup/drizzle/DocumentGroupDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/documentGroup/drizzle/DocumentGroupDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/documentGroup/drizzle/DocumentGroupDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/documentGroup/drizzle/DocumentGroupDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/documentIndexEntry/drizzle/DocumentIndexEntryDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/documentIndexEntry/drizzle/DocumentIndexEntryDrizzleRepo.js +12 -0
- package/dist/infrastructure/repositories/documentIndexEntry/drizzle/DocumentIndexEntryDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/documentIndexEntry/drizzle/DocumentIndexEntryDrizzleSqliteRepo.js +12 -0
- package/dist/infrastructure/repositories/documentSectionLink/drizzle/DocumentSectionLinkDrizzleRepo.d.ts +15 -0
- package/dist/infrastructure/repositories/documentSectionLink/drizzle/DocumentSectionLinkDrizzleRepo.js +41 -0
- package/dist/infrastructure/repositories/documentSectionLink/drizzle/DocumentSectionLinkDrizzleSqliteRepo.d.ts +15 -0
- package/dist/infrastructure/repositories/documentSectionLink/drizzle/DocumentSectionLinkDrizzleSqliteRepo.js +40 -0
- package/dist/infrastructure/repositories/documentVersion/drizzle/DocumentVersionDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/documentVersion/drizzle/DocumentVersionDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/documentVersion/drizzle/DocumentVersionDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/documentVersion/drizzle/DocumentVersionDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/embed/drizzle/EmbedDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/embed/drizzle/EmbedDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/embed/drizzle/EmbedDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/embed/drizzle/EmbedDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/index.d.ts +30 -0
- package/dist/infrastructure/repositories/index.js +31 -0
- package/dist/infrastructure/repositories/page/drizzle/PageDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/page/drizzle/PageDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/page/drizzle/PageDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/page/drizzle/PageDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/pageEmbedLink/drizzle/PageEmbedLinkDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/pageEmbedLink/drizzle/PageEmbedLinkDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/pageEmbedLink/drizzle/PageEmbedLinkDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/pageEmbedLink/drizzle/PageEmbedLinkDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/pageSnippetLink/drizzle/PageSnippetLinkDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/pageSnippetLink/drizzle/PageSnippetLinkDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/pageSnippetLink/drizzle/PageSnippetLinkDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/pageSnippetLink/drizzle/PageSnippetLinkDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/pageVersion/drizzle/PageVersionDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/pageVersion/drizzle/PageVersionDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/pageVersion/drizzle/PageVersionDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/pageVersion/drizzle/PageVersionDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/section/drizzle/SectionDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/section/drizzle/SectionDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/section/drizzle/SectionDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/section/drizzle/SectionDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/sectionPageLink/drizzle/SectionPageLinkDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/sectionPageLink/drizzle/SectionPageLinkDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/sectionPageLink/drizzle/SectionPageLinkDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/sectionPageLink/drizzle/SectionPageLinkDrizzleSqliteRepo.js +8 -0
- package/dist/infrastructure/repositories/snippet/drizzle/SnippetDrizzleRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/snippet/drizzle/SnippetDrizzleRepo.js +8 -0
- package/dist/infrastructure/repositories/snippet/drizzle/SnippetDrizzleSqliteRepo.d.ts +12 -0
- package/dist/infrastructure/repositories/snippet/drizzle/SnippetDrizzleSqliteRepo.js +8 -0
- package/dist/public/factories/index.d.ts +2 -0
- package/dist/public/factories/index.js +2 -0
- package/dist/public/index.d.ts +5 -0
- package/dist/public/index.js +5 -0
- package/dist/public/models/index.d.ts +3 -0
- package/dist/public/models/index.js +4 -0
- package/dist/public/ports/index.d.ts +1 -0
- package/dist/public/ports/index.js +2 -0
- package/dist/public/repository-ports/index.d.ts +1 -0
- package/dist/public/repository-ports/index.js +2 -0
- package/dist/public/services/index.d.ts +1 -0
- package/dist/public/services/index.js +2 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const DOCMAN_COMPOSE_SOURCE_FORMATS: readonly ["md", "mdx"];
|
|
2
|
+
export type DocmanComposeSourceFormat = (typeof DOCMAN_COMPOSE_SOURCE_FORMATS)[number];
|
|
3
|
+
export type ParsedDocmanAssetReferenceToken = {
|
|
4
|
+
token: string;
|
|
5
|
+
ref: string;
|
|
6
|
+
version: number | null;
|
|
7
|
+
};
|
|
8
|
+
export type DocmanComposeSourceContentParts = {
|
|
9
|
+
modulePreamble?: string;
|
|
10
|
+
body: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function isDocmanComposeSourceFormat(value: unknown): value is DocmanComposeSourceFormat;
|
|
13
|
+
export declare function resolveDocmanComposeSourceFormat(value: unknown): DocmanComposeSourceFormat | null;
|
|
14
|
+
export declare function reduceDocmanComposeFormats(values: Iterable<unknown>): {
|
|
15
|
+
format: DocmanComposeSourceFormat;
|
|
16
|
+
formats: DocmanComposeSourceFormat[];
|
|
17
|
+
};
|
|
18
|
+
export declare function listDocmanAssetReferenceTokens(content: string): ParsedDocmanAssetReferenceToken[];
|
|
19
|
+
export declare function replaceDocmanAssetReferenceTokens(content: string, resolver: (token: ParsedDocmanAssetReferenceToken) => string): string;
|
|
20
|
+
export declare function normalizeDocmanComposeSourceContent(format: DocmanComposeSourceFormat, content: string): string;
|
|
21
|
+
export declare function splitDocmanComposeSourceContent(format: DocmanComposeSourceFormat, content: string): DocmanComposeSourceContentParts;
|
|
22
|
+
/**
|
|
23
|
+
* Strip a stored title's legacy heading prefix when the renderer is about to
|
|
24
|
+
* prepend a freshly computed outline number. Mirrors the desktop UI helper
|
|
25
|
+
* `formatDocmanDisplayTitle` (apps/aops-desktop/src/pages/docman/lib/docman-display-title.ts):
|
|
26
|
+
* returns the raw title untouched when there is no computed number, when the
|
|
27
|
+
* computed number stringifies to '0', when the title is empty, or when
|
|
28
|
+
* stripping would leave an empty string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function stripLeadingNumericPrefixForRender(title: unknown, computedNumber: unknown): string;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { parseDocmanAssetReference, resolveDocmanPageSourceFormat, } from '@aopslab/domain-core-docman';
|
|
2
|
+
export const DOCMAN_COMPOSE_SOURCE_FORMATS = ['md', 'mdx'];
|
|
3
|
+
const DOCMAN_ASSET_REFERENCE_TOKEN_RE = /(asset:\/\/[A-Za-z0-9][A-Za-z0-9._:-]*(?:@[0-9]+)?)/g;
|
|
4
|
+
const MDX_MODULE_LINE_RE = /^\s*(?:import|export)\b/;
|
|
5
|
+
export function isDocmanComposeSourceFormat(value) {
|
|
6
|
+
return value === 'md' || value === 'mdx';
|
|
7
|
+
}
|
|
8
|
+
export function resolveDocmanComposeSourceFormat(value) {
|
|
9
|
+
if (typeof value !== 'string')
|
|
10
|
+
return null;
|
|
11
|
+
const normalized = value.trim().toLowerCase();
|
|
12
|
+
if (!normalized)
|
|
13
|
+
return null;
|
|
14
|
+
const sourceFormat = resolveDocmanPageSourceFormat(normalized);
|
|
15
|
+
if (normalized !== sourceFormat)
|
|
16
|
+
return null;
|
|
17
|
+
return isDocmanComposeSourceFormat(sourceFormat) ? sourceFormat : null;
|
|
18
|
+
}
|
|
19
|
+
export function reduceDocmanComposeFormats(values) {
|
|
20
|
+
const seen = new Set();
|
|
21
|
+
for (const value of values) {
|
|
22
|
+
const format = resolveDocmanComposeSourceFormat(value);
|
|
23
|
+
if (format)
|
|
24
|
+
seen.add(format);
|
|
25
|
+
}
|
|
26
|
+
const formats = [...seen].sort((left, right) => left.localeCompare(right));
|
|
27
|
+
return {
|
|
28
|
+
format: formats.includes('mdx') ? 'mdx' : 'md',
|
|
29
|
+
formats: formats.length > 0 ? formats : ['md'],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function listDocmanAssetReferenceTokens(content) {
|
|
33
|
+
const text = String(content ?? '');
|
|
34
|
+
if (!text)
|
|
35
|
+
return [];
|
|
36
|
+
const byToken = new Map();
|
|
37
|
+
forEachDocmanAssetReferenceTokenOutsideMarkdownCode(text, (token) => {
|
|
38
|
+
if (!token || byToken.has(token))
|
|
39
|
+
return;
|
|
40
|
+
const parsed = parseDocmanAssetReferenceToken(token);
|
|
41
|
+
if (!parsed)
|
|
42
|
+
return;
|
|
43
|
+
byToken.set(token, parsed);
|
|
44
|
+
});
|
|
45
|
+
return [...byToken.values()];
|
|
46
|
+
}
|
|
47
|
+
export function replaceDocmanAssetReferenceTokens(content, resolver) {
|
|
48
|
+
const text = String(content ?? '');
|
|
49
|
+
if (!text)
|
|
50
|
+
return text;
|
|
51
|
+
return mapDocmanAssetReferenceTokensOutsideMarkdownCode(text, (token) => {
|
|
52
|
+
const parsed = parseDocmanAssetReferenceToken(token);
|
|
53
|
+
if (!parsed)
|
|
54
|
+
return token;
|
|
55
|
+
return resolver(parsed);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function normalizeDocmanComposeSourceContent(format, content) {
|
|
59
|
+
const text = String(content ?? '');
|
|
60
|
+
if (format !== 'mdx' || !text)
|
|
61
|
+
return text;
|
|
62
|
+
return text;
|
|
63
|
+
}
|
|
64
|
+
export function splitDocmanComposeSourceContent(format, content) {
|
|
65
|
+
const text = String(content ?? '');
|
|
66
|
+
if (format !== 'mdx' || !text) {
|
|
67
|
+
return { body: text };
|
|
68
|
+
}
|
|
69
|
+
const lines = text.split(/\r?\n/);
|
|
70
|
+
let index = 0;
|
|
71
|
+
const moduleLines = [];
|
|
72
|
+
while (index < lines.length) {
|
|
73
|
+
const current = String(lines[index] ?? '');
|
|
74
|
+
if (!current.trim()) {
|
|
75
|
+
if (moduleLines.length > 0 && moduleLines[moduleLines.length - 1] !== '') {
|
|
76
|
+
moduleLines.push('');
|
|
77
|
+
}
|
|
78
|
+
index += 1;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (!MDX_MODULE_LINE_RE.test(current)) {
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
const statementStart = index;
|
|
85
|
+
index += 1;
|
|
86
|
+
while (index < lines.length) {
|
|
87
|
+
const statementLine = String(lines[index - 1] ?? '').trim();
|
|
88
|
+
if (!statementLine || statementLine.endsWith(';'))
|
|
89
|
+
break;
|
|
90
|
+
const nextLine = String(lines[index] ?? '');
|
|
91
|
+
index += 1;
|
|
92
|
+
if (!nextLine.trim())
|
|
93
|
+
break;
|
|
94
|
+
if (String(nextLine).trim().endsWith(';'))
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
moduleLines.push(...lines.slice(statementStart, index));
|
|
98
|
+
while (index < lines.length && !String(lines[index] ?? '').trim()) {
|
|
99
|
+
if (moduleLines[moduleLines.length - 1] !== '') {
|
|
100
|
+
moduleLines.push('');
|
|
101
|
+
}
|
|
102
|
+
index += 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const modulePreamble = moduleLines.join('\n').trim();
|
|
106
|
+
return {
|
|
107
|
+
modulePreamble: modulePreamble || undefined,
|
|
108
|
+
body: lines.slice(index).join('\n').trimStart(),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function parseDocmanAssetReferenceToken(token) {
|
|
112
|
+
const normalized = String(token ?? '').trim();
|
|
113
|
+
const parsed = parseDocmanAssetReference(normalized);
|
|
114
|
+
if (!parsed)
|
|
115
|
+
return null;
|
|
116
|
+
return {
|
|
117
|
+
token: normalized,
|
|
118
|
+
ref: parsed.assetUid,
|
|
119
|
+
version: Number.isInteger(parsed.version) && Number(parsed.version) > 0 ? Number(parsed.version) : null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function forEachDocmanAssetReferenceTokenOutsideMarkdownCode(text, visitor) {
|
|
123
|
+
for (const segment of listDocmanTextSegmentsOutsideMarkdownCode(text)) {
|
|
124
|
+
const matches = segment.matchAll(DOCMAN_ASSET_REFERENCE_TOKEN_RE);
|
|
125
|
+
for (const match of matches) {
|
|
126
|
+
const token = String(match[1] ?? '').trim();
|
|
127
|
+
if (token)
|
|
128
|
+
visitor(token);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function mapDocmanAssetReferenceTokensOutsideMarkdownCode(text, mapper) {
|
|
133
|
+
const ranges = listMarkdownCodeRanges(text);
|
|
134
|
+
if (ranges.length === 0) {
|
|
135
|
+
return text.replace(DOCMAN_ASSET_REFERENCE_TOKEN_RE, (token) => mapper(token));
|
|
136
|
+
}
|
|
137
|
+
let cursor = 0;
|
|
138
|
+
let next = '';
|
|
139
|
+
for (const range of ranges) {
|
|
140
|
+
if (cursor < range.start) {
|
|
141
|
+
next += text.slice(cursor, range.start).replace(DOCMAN_ASSET_REFERENCE_TOKEN_RE, (token) => mapper(token));
|
|
142
|
+
}
|
|
143
|
+
next += text.slice(range.start, range.end);
|
|
144
|
+
cursor = range.end;
|
|
145
|
+
}
|
|
146
|
+
if (cursor < text.length) {
|
|
147
|
+
next += text.slice(cursor).replace(DOCMAN_ASSET_REFERENCE_TOKEN_RE, (token) => mapper(token));
|
|
148
|
+
}
|
|
149
|
+
return next;
|
|
150
|
+
}
|
|
151
|
+
function listDocmanTextSegmentsOutsideMarkdownCode(text) {
|
|
152
|
+
const ranges = listMarkdownCodeRanges(text);
|
|
153
|
+
if (ranges.length === 0)
|
|
154
|
+
return [text];
|
|
155
|
+
const segments = [];
|
|
156
|
+
let cursor = 0;
|
|
157
|
+
for (const range of ranges) {
|
|
158
|
+
if (cursor < range.start) {
|
|
159
|
+
segments.push(text.slice(cursor, range.start));
|
|
160
|
+
}
|
|
161
|
+
cursor = range.end;
|
|
162
|
+
}
|
|
163
|
+
if (cursor < text.length) {
|
|
164
|
+
segments.push(text.slice(cursor));
|
|
165
|
+
}
|
|
166
|
+
return segments;
|
|
167
|
+
}
|
|
168
|
+
function listMarkdownCodeRanges(text) {
|
|
169
|
+
if (!text)
|
|
170
|
+
return [];
|
|
171
|
+
const ranges = [];
|
|
172
|
+
const length = text.length;
|
|
173
|
+
let index = 0;
|
|
174
|
+
let fencedStart = -1;
|
|
175
|
+
let fencedMarker = '';
|
|
176
|
+
let inlineStart = -1;
|
|
177
|
+
let inlineTicks = 0;
|
|
178
|
+
while (index < length) {
|
|
179
|
+
if (fencedStart >= 0) {
|
|
180
|
+
if (isLineStart(text, index)) {
|
|
181
|
+
const fence = readFenceMarkerAt(text, index);
|
|
182
|
+
if (fence && fence.marker[0] === fencedMarker[0] && fence.marker.length >= fencedMarker.length) {
|
|
183
|
+
const lineEnd = readLineEnd(text, index);
|
|
184
|
+
ranges.push({ start: fencedStart, end: lineEnd });
|
|
185
|
+
fencedStart = -1;
|
|
186
|
+
fencedMarker = '';
|
|
187
|
+
index = lineEnd;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
index += 1;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (inlineStart >= 0) {
|
|
195
|
+
const tickCount = readBacktickRunLength(text, index);
|
|
196
|
+
if (tickCount === inlineTicks) {
|
|
197
|
+
ranges.push({ start: inlineStart, end: index + tickCount });
|
|
198
|
+
inlineStart = -1;
|
|
199
|
+
inlineTicks = 0;
|
|
200
|
+
index += tickCount;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
index += 1;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (isLineStart(text, index)) {
|
|
207
|
+
const fence = readFenceMarkerAt(text, index);
|
|
208
|
+
if (fence) {
|
|
209
|
+
fencedStart = index;
|
|
210
|
+
fencedMarker = fence.marker;
|
|
211
|
+
index = fence.contentStart;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const tickCount = readBacktickRunLength(text, index);
|
|
216
|
+
if (tickCount > 0) {
|
|
217
|
+
inlineStart = index;
|
|
218
|
+
inlineTicks = tickCount;
|
|
219
|
+
index += tickCount;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
index += 1;
|
|
223
|
+
}
|
|
224
|
+
if (inlineStart >= 0) {
|
|
225
|
+
ranges.push({ start: inlineStart, end: length });
|
|
226
|
+
}
|
|
227
|
+
if (fencedStart >= 0) {
|
|
228
|
+
ranges.push({ start: fencedStart, end: length });
|
|
229
|
+
}
|
|
230
|
+
return ranges;
|
|
231
|
+
}
|
|
232
|
+
function isLineStart(text, index) {
|
|
233
|
+
return index <= 0 || text[index - 1] === '\n';
|
|
234
|
+
}
|
|
235
|
+
function readLineEnd(text, index) {
|
|
236
|
+
const newlineIndex = text.indexOf('\n', index);
|
|
237
|
+
return newlineIndex >= 0 ? newlineIndex + 1 : text.length;
|
|
238
|
+
}
|
|
239
|
+
function readBacktickRunLength(text, index) {
|
|
240
|
+
if (text[index] !== '`')
|
|
241
|
+
return 0;
|
|
242
|
+
let cursor = index;
|
|
243
|
+
while (cursor < text.length && text[cursor] === '`') {
|
|
244
|
+
cursor += 1;
|
|
245
|
+
}
|
|
246
|
+
return cursor - index;
|
|
247
|
+
}
|
|
248
|
+
function readFenceMarkerAt(text, index) {
|
|
249
|
+
let cursor = index;
|
|
250
|
+
let indentation = 0;
|
|
251
|
+
while (cursor < text.length && indentation < 4 && (text[cursor] === ' ' || text[cursor] === '\t')) {
|
|
252
|
+
cursor += 1;
|
|
253
|
+
indentation += 1;
|
|
254
|
+
}
|
|
255
|
+
const fenceChar = text[cursor];
|
|
256
|
+
if (fenceChar !== '`' && fenceChar !== '~')
|
|
257
|
+
return null;
|
|
258
|
+
let markerEnd = cursor;
|
|
259
|
+
while (markerEnd < text.length && text[markerEnd] === fenceChar) {
|
|
260
|
+
markerEnd += 1;
|
|
261
|
+
}
|
|
262
|
+
const marker = text.slice(cursor, markerEnd);
|
|
263
|
+
if (marker.length < 3)
|
|
264
|
+
return null;
|
|
265
|
+
return { marker, contentStart: markerEnd };
|
|
266
|
+
}
|
|
267
|
+
const LEADING_NUMERIC_PREFIX_PATTERN = /^\s*\d+(?:\.\d+)*[.)]?\s+/;
|
|
268
|
+
/**
|
|
269
|
+
* Strip a stored title's legacy heading prefix when the renderer is about to
|
|
270
|
+
* prepend a freshly computed outline number. Mirrors the desktop UI helper
|
|
271
|
+
* `formatDocmanDisplayTitle` (apps/aops-desktop/src/pages/docman/lib/docman-display-title.ts):
|
|
272
|
+
* returns the raw title untouched when there is no computed number, when the
|
|
273
|
+
* computed number stringifies to '0', when the title is empty, or when
|
|
274
|
+
* stripping would leave an empty string.
|
|
275
|
+
*/
|
|
276
|
+
export function stripLeadingNumericPrefixForRender(title, computedNumber) {
|
|
277
|
+
const rawTitle = String(title ?? '').trim();
|
|
278
|
+
if (!rawTitle)
|
|
279
|
+
return rawTitle;
|
|
280
|
+
const number = String(computedNumber ?? '').trim();
|
|
281
|
+
if (!number || number === '0')
|
|
282
|
+
return rawTitle;
|
|
283
|
+
const stripped = rawTitle.replace(LEADING_NUMERIC_PREFIX_PATTERN, '').trim();
|
|
284
|
+
return stripped || rawTitle;
|
|
285
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DOCMAN_DOCUMENT_INDEX_BUILD_ACTOR = "docman.index.build";
|
|
2
|
+
export declare function normalizeDocmanDocumentIndexLocale(value: unknown): string;
|
|
3
|
+
export declare function slugifyDocmanDocumentIndexPart(value: unknown, fallback: string): string;
|
|
4
|
+
export declare function buildDocmanDocumentAnchor(documentIdentity: unknown): string;
|
|
5
|
+
export declare function buildDocmanSectionAnchor(sectionIdentity: unknown, linkId: unknown): string;
|
|
6
|
+
export declare function buildDocmanPageAnchor(pageIdentity: unknown, linkId: unknown): string;
|
|
7
|
+
export declare function buildDocmanDocumentIndexFingerprint(value: unknown): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
export const DOCMAN_DOCUMENT_INDEX_BUILD_ACTOR = 'docman.index.build';
|
|
3
|
+
function normalizeNonEmpty(value) {
|
|
4
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
5
|
+
}
|
|
6
|
+
export function normalizeDocmanDocumentIndexLocale(value) {
|
|
7
|
+
return normalizeNonEmpty(value);
|
|
8
|
+
}
|
|
9
|
+
export function slugifyDocmanDocumentIndexPart(value, fallback) {
|
|
10
|
+
const normalized = normalizeNonEmpty(value).toLowerCase();
|
|
11
|
+
const slug = normalized
|
|
12
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
13
|
+
.replace(/^-+/, '')
|
|
14
|
+
.replace(/-+$/, '');
|
|
15
|
+
return slug || fallback;
|
|
16
|
+
}
|
|
17
|
+
export function buildDocmanDocumentAnchor(documentIdentity) {
|
|
18
|
+
return `document-${slugifyDocmanDocumentIndexPart(documentIdentity, 'document')}`;
|
|
19
|
+
}
|
|
20
|
+
export function buildDocmanSectionAnchor(sectionIdentity, linkId) {
|
|
21
|
+
return `section-${slugifyDocmanDocumentIndexPart(sectionIdentity, 'section')}-${slugifyDocmanDocumentIndexPart(linkId, 'link')}`;
|
|
22
|
+
}
|
|
23
|
+
export function buildDocmanPageAnchor(pageIdentity, linkId) {
|
|
24
|
+
return `page-${slugifyDocmanDocumentIndexPart(pageIdentity, 'page')}-${slugifyDocmanDocumentIndexPart(linkId, 'link')}`;
|
|
25
|
+
}
|
|
26
|
+
export function buildDocmanDocumentIndexFingerprint(value) {
|
|
27
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DocmanPublishTarget } from '../ports/inbound/IDocumentServicePort.js';
|
|
2
|
+
export declare const DOCMAN_PUBLISH_TARGETS: readonly ["markdown", "html"];
|
|
3
|
+
export type DocmanPublishDeliveryKind = 'inline-text';
|
|
4
|
+
export type DocmanPublishTargetDescriptor = {
|
|
5
|
+
target: DocmanPublishTarget;
|
|
6
|
+
deliveryKind: DocmanPublishDeliveryKind;
|
|
7
|
+
mediaType: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function listDocmanPublishTargets(): DocmanPublishTarget[];
|
|
10
|
+
export declare function formatDocmanPublishTargets(): string;
|
|
11
|
+
export declare function isDocmanPublishTarget(value: unknown): value is DocmanPublishTarget;
|
|
12
|
+
export declare function resolveDocmanPublishTarget(value: unknown): DocmanPublishTarget | null;
|
|
13
|
+
export declare function resolveDocmanPublishTargetDescriptor(value: unknown): DocmanPublishTargetDescriptor | null;
|
|
14
|
+
export declare function getDocmanPublishTargetDescriptor(target: DocmanPublishTarget): DocmanPublishTargetDescriptor;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const DOCMAN_PUBLISH_TARGETS = ['markdown', 'html'];
|
|
2
|
+
const DOCMAN_PUBLISH_TARGET_DESCRIPTOR_MAP = {
|
|
3
|
+
markdown: {
|
|
4
|
+
target: 'markdown',
|
|
5
|
+
deliveryKind: 'inline-text',
|
|
6
|
+
mediaType: 'text/markdown; charset=utf-8',
|
|
7
|
+
},
|
|
8
|
+
html: {
|
|
9
|
+
target: 'html',
|
|
10
|
+
deliveryKind: 'inline-text',
|
|
11
|
+
mediaType: 'text/html; charset=utf-8',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export function listDocmanPublishTargets() {
|
|
15
|
+
return [...DOCMAN_PUBLISH_TARGETS];
|
|
16
|
+
}
|
|
17
|
+
export function formatDocmanPublishTargets() {
|
|
18
|
+
return listDocmanPublishTargets().join(', ');
|
|
19
|
+
}
|
|
20
|
+
export function isDocmanPublishTarget(value) {
|
|
21
|
+
return resolveDocmanPublishTarget(value) !== null;
|
|
22
|
+
}
|
|
23
|
+
export function resolveDocmanPublishTarget(value) {
|
|
24
|
+
if (typeof value !== 'string')
|
|
25
|
+
return null;
|
|
26
|
+
const normalized = value.trim().toLowerCase();
|
|
27
|
+
if (!normalized)
|
|
28
|
+
return null;
|
|
29
|
+
return normalized === 'markdown' || normalized === 'html'
|
|
30
|
+
? normalized
|
|
31
|
+
: null;
|
|
32
|
+
}
|
|
33
|
+
export function resolveDocmanPublishTargetDescriptor(value) {
|
|
34
|
+
const target = resolveDocmanPublishTarget(value);
|
|
35
|
+
return target ? getDocmanPublishTargetDescriptor(target) : null;
|
|
36
|
+
}
|
|
37
|
+
export function getDocmanPublishTargetDescriptor(target) {
|
|
38
|
+
return DOCMAN_PUBLISH_TARGET_DESCRIPTOR_MAP[target];
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type DocmanEmbeddingProviderResult = {
|
|
2
|
+
provider: string;
|
|
3
|
+
model: string;
|
|
4
|
+
dimensions: number;
|
|
5
|
+
vectors: number[][];
|
|
6
|
+
};
|
|
7
|
+
export type DocmanEmbeddingProvider = {
|
|
8
|
+
provider: string;
|
|
9
|
+
model: string;
|
|
10
|
+
dimensions?: number;
|
|
11
|
+
embedMany(input: {
|
|
12
|
+
texts: readonly string[];
|
|
13
|
+
}): Promise<DocmanEmbeddingProviderResult>;
|
|
14
|
+
};
|
|
15
|
+
export declare function buildDocmanEmbeddingHash(value: string): string;
|
|
16
|
+
export declare function serializeDocmanEmbeddingVector(vector: readonly number[]): string;
|
|
17
|
+
export declare function parseDocmanEmbeddingVector(value: unknown): number[] | undefined;
|
|
18
|
+
export declare function cosineSimilarity(left: readonly number[], right: readonly number[]): number;
|
|
19
|
+
export declare function buildDocmanLocalHashVector(value: string, dimensions?: number): number[];
|
|
20
|
+
export declare function createDocmanLocalHashEmbeddingProvider(): DocmanEmbeddingProvider;
|
|
21
|
+
export declare function resolveDocmanDefaultEmbeddingProvider(): DocmanEmbeddingProvider;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
const DOCMAN_LOCAL_EMBEDDING_PROVIDER = 'docman-local-hash-v1';
|
|
3
|
+
const DOCMAN_LOCAL_EMBEDDING_MODEL = 'hash-256';
|
|
4
|
+
const DOCMAN_LOCAL_EMBEDDING_DIMENSIONS = 256;
|
|
5
|
+
function normalizeText(value) {
|
|
6
|
+
return String(value ?? '').replace(/\s+/g, ' ').trim();
|
|
7
|
+
}
|
|
8
|
+
function normalizeEmbeddingText(value) {
|
|
9
|
+
return normalizeText(value).toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
function buildStableBucket(seed, dimensions) {
|
|
12
|
+
const digest = createHash('sha1').update(seed).digest();
|
|
13
|
+
const index = digest.readUInt32BE(0) % dimensions;
|
|
14
|
+
const sign = digest[4] % 2 === 0 ? 1 : -1;
|
|
15
|
+
return { index, sign };
|
|
16
|
+
}
|
|
17
|
+
function normalizeVector(input) {
|
|
18
|
+
const magnitude = Math.sqrt(input.reduce((sum, value) => sum + value * value, 0));
|
|
19
|
+
if (!Number.isFinite(magnitude) || magnitude <= 0) {
|
|
20
|
+
return Array.from({ length: input.length }, () => 0);
|
|
21
|
+
}
|
|
22
|
+
return input.map((value) => Number((value / magnitude).toFixed(8)));
|
|
23
|
+
}
|
|
24
|
+
function listWordTokens(value) {
|
|
25
|
+
return [...new Set(value.split(/\s+/).map((token) => token.trim()).filter(Boolean))];
|
|
26
|
+
}
|
|
27
|
+
function listCharacterNgrams(value, size = 3) {
|
|
28
|
+
const compact = value.replace(/\s+/g, ' ');
|
|
29
|
+
if (compact.length < size) {
|
|
30
|
+
return compact ? [compact] : [];
|
|
31
|
+
}
|
|
32
|
+
const output = new Set();
|
|
33
|
+
for (let index = 0; index <= compact.length - size; index += 1) {
|
|
34
|
+
output.add(compact.slice(index, index + size));
|
|
35
|
+
}
|
|
36
|
+
return [...output];
|
|
37
|
+
}
|
|
38
|
+
export function buildDocmanEmbeddingHash(value) {
|
|
39
|
+
return createHash('sha256').update(normalizeEmbeddingText(value)).digest('hex');
|
|
40
|
+
}
|
|
41
|
+
export function serializeDocmanEmbeddingVector(vector) {
|
|
42
|
+
return JSON.stringify(vector.map((value) => Number(Number(value).toFixed(8))));
|
|
43
|
+
}
|
|
44
|
+
export function parseDocmanEmbeddingVector(value) {
|
|
45
|
+
const raw = normalizeText(value);
|
|
46
|
+
if (!raw)
|
|
47
|
+
return undefined;
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(raw);
|
|
50
|
+
if (!Array.isArray(parsed) || parsed.length === 0)
|
|
51
|
+
return undefined;
|
|
52
|
+
const numbers = parsed
|
|
53
|
+
.map((entry) => Number(entry))
|
|
54
|
+
.filter((entry) => Number.isFinite(entry));
|
|
55
|
+
return numbers.length === parsed.length && numbers.length > 0 ? numbers : undefined;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function cosineSimilarity(left, right) {
|
|
62
|
+
if (!left.length || !right.length || left.length !== right.length)
|
|
63
|
+
return 0;
|
|
64
|
+
let sum = 0;
|
|
65
|
+
let leftMagnitude = 0;
|
|
66
|
+
let rightMagnitude = 0;
|
|
67
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
68
|
+
const leftValue = Number(left[index] ?? 0);
|
|
69
|
+
const rightValue = Number(right[index] ?? 0);
|
|
70
|
+
sum += leftValue * rightValue;
|
|
71
|
+
leftMagnitude += leftValue * leftValue;
|
|
72
|
+
rightMagnitude += rightValue * rightValue;
|
|
73
|
+
}
|
|
74
|
+
if (leftMagnitude <= 0 || rightMagnitude <= 0)
|
|
75
|
+
return 0;
|
|
76
|
+
return sum / Math.sqrt(leftMagnitude * rightMagnitude);
|
|
77
|
+
}
|
|
78
|
+
export function buildDocmanLocalHashVector(value, dimensions = DOCMAN_LOCAL_EMBEDDING_DIMENSIONS) {
|
|
79
|
+
const normalized = normalizeEmbeddingText(value);
|
|
80
|
+
if (!normalized) {
|
|
81
|
+
return Array.from({ length: dimensions }, () => 0);
|
|
82
|
+
}
|
|
83
|
+
const vector = Array.from({ length: dimensions }, () => 0);
|
|
84
|
+
const tokens = listWordTokens(normalized);
|
|
85
|
+
const ngrams = listCharacterNgrams(normalized, 3);
|
|
86
|
+
for (const token of tokens) {
|
|
87
|
+
const { index, sign } = buildStableBucket(`token:${token}`, dimensions);
|
|
88
|
+
vector[index] += 2.4 * sign;
|
|
89
|
+
}
|
|
90
|
+
for (const ngram of ngrams) {
|
|
91
|
+
const { index, sign } = buildStableBucket(`ngram:${ngram}`, dimensions);
|
|
92
|
+
vector[index] += 0.8 * sign;
|
|
93
|
+
}
|
|
94
|
+
return normalizeVector(vector);
|
|
95
|
+
}
|
|
96
|
+
export function createDocmanLocalHashEmbeddingProvider() {
|
|
97
|
+
return {
|
|
98
|
+
provider: DOCMAN_LOCAL_EMBEDDING_PROVIDER,
|
|
99
|
+
model: DOCMAN_LOCAL_EMBEDDING_MODEL,
|
|
100
|
+
dimensions: DOCMAN_LOCAL_EMBEDDING_DIMENSIONS,
|
|
101
|
+
async embedMany(input) {
|
|
102
|
+
const texts = Array.isArray(input.texts) ? input.texts : [];
|
|
103
|
+
return {
|
|
104
|
+
provider: DOCMAN_LOCAL_EMBEDDING_PROVIDER,
|
|
105
|
+
model: DOCMAN_LOCAL_EMBEDDING_MODEL,
|
|
106
|
+
dimensions: DOCMAN_LOCAL_EMBEDDING_DIMENSIONS,
|
|
107
|
+
vectors: texts.map((text) => buildDocmanLocalHashVector(text)),
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export function resolveDocmanDefaultEmbeddingProvider() {
|
|
113
|
+
return createDocmanLocalHashEmbeddingProvider();
|
|
114
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './service.document.js';
|
|
2
|
+
export * from './service.documentGroup.js';
|
|
3
|
+
export * from './service.documentVersion.js';
|
|
4
|
+
export * from './service.section.js';
|
|
5
|
+
export * from './service.page.js';
|
|
6
|
+
export * from './service.pageVersion.js';
|
|
7
|
+
export * from './service.documentSectionLink.js';
|
|
8
|
+
export * from './service.sectionPageLink.js';
|
|
9
|
+
export * from './service.snippet.js';
|
|
10
|
+
export * from './service.pageSnippetLink.js';
|
|
11
|
+
export * from './service.asset.js';
|
|
12
|
+
export * from './service.assetVersion.js';
|
|
13
|
+
export * from './service.embed.js';
|
|
14
|
+
export * from './service.pageEmbedLink.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Auto-generated by xf-gen
|
|
2
|
+
export * from './service.document.js';
|
|
3
|
+
export * from './service.documentGroup.js';
|
|
4
|
+
export * from './service.documentVersion.js';
|
|
5
|
+
export * from './service.section.js';
|
|
6
|
+
export * from './service.page.js';
|
|
7
|
+
export * from './service.pageVersion.js';
|
|
8
|
+
export * from './service.documentSectionLink.js';
|
|
9
|
+
export * from './service.sectionPageLink.js';
|
|
10
|
+
export * from './service.snippet.js';
|
|
11
|
+
export * from './service.pageSnippetLink.js';
|
|
12
|
+
export * from './service.asset.js';
|
|
13
|
+
export * from './service.assetVersion.js';
|
|
14
|
+
export * from './service.embed.js';
|
|
15
|
+
export * from './service.pageEmbedLink.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { XfLogger } from '@aopslab/xf-logger';
|
|
3
|
+
import { DbQueryOptions } from '@aopslab/xf-db';
|
|
4
|
+
import type { IRepositoryPortAsset } from '../ports/repository-ports/index.js';
|
|
5
|
+
import type { IAssetServicePort } from '../ports/inbound/index.js';
|
|
6
|
+
import { AssetServiceError } from '../errors/AssetServiceError.js';
|
|
7
|
+
import { IbmAsset, IbmAssetInsert } from '../../domain/models/index.js';
|
|
8
|
+
export interface AssetServiceDependencies {
|
|
9
|
+
}
|
|
10
|
+
export interface AssetServiceOptions {
|
|
11
|
+
assetRepository: IRepositoryPortAsset;
|
|
12
|
+
serviceDependencies?: Partial<AssetServiceDependencies>;
|
|
13
|
+
logger?: XfLogger;
|
|
14
|
+
locale?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class AssetService implements IAssetServicePort {
|
|
17
|
+
private readonly assetRepository;
|
|
18
|
+
private readonly logger?;
|
|
19
|
+
constructor(options: AssetServiceOptions);
|
|
20
|
+
getById(id: string, options?: DbQueryOptions<IbmAsset>): Effect.Effect<IbmAsset | null, AssetServiceError>;
|
|
21
|
+
create(data: IbmAssetInsert): Effect.Effect<IbmAsset, AssetServiceError>;
|
|
22
|
+
listAssets(filter?: Partial<IbmAsset>, options?: DbQueryOptions<IbmAsset>): Effect.Effect<IbmAsset[], AssetServiceError>;
|
|
23
|
+
updateAsset(id: string, patch: Partial<IbmAsset>): Effect.Effect<IbmAsset, AssetServiceError>;
|
|
24
|
+
removeAsset(id: string): Effect.Effect<void, AssetServiceError>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { pipe } from 'effect/Function';
|
|
3
|
+
import { validateInput, XfErrorFactory, effectErrorInfo } from '@aopslab/xf-core';
|
|
4
|
+
import { mapDbError } from '@aopslab/xf-db';
|
|
5
|
+
import { assetZodSchemaInsert } from '../../domain/models/index.js';
|
|
6
|
+
import { validateBmInputWithSchema } from './service.zod-validation.js';
|
|
7
|
+
export class AssetService {
|
|
8
|
+
assetRepository;
|
|
9
|
+
logger;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.assetRepository = options.assetRepository;
|
|
12
|
+
this.logger = options.logger?.child({ module: this.constructor.name });
|
|
13
|
+
}
|
|
14
|
+
getById(id, options) {
|
|
15
|
+
const stage = 'AssetService::getById';
|
|
16
|
+
return pipe(validateInput(id, 'id', { stage }), Effect.flatMap((entityId) => this.assetRepository.findById(entityId, options).pipe(Effect.mapError(mapDbError({ stage, operation: 'findById', factory: XfErrorFactory.notFound })))), Effect.tapError((e) => Effect.sync(() => {
|
|
17
|
+
const info = effectErrorInfo(e);
|
|
18
|
+
this.logger?.error({ error: info.unwrapped, stage }, 'Error in getById');
|
|
19
|
+
})));
|
|
20
|
+
}
|
|
21
|
+
create(data) {
|
|
22
|
+
const stage = 'AssetService::create';
|
|
23
|
+
return pipe(validateInput(data, 'data', { stage }), Effect.flatMap((input) => validateBmInputWithSchema({
|
|
24
|
+
input,
|
|
25
|
+
schema: assetZodSchemaInsert,
|
|
26
|
+
stage,
|
|
27
|
+
operation: 'AssetService::create.assetZodSchemaInsert',
|
|
28
|
+
field: 'data',
|
|
29
|
+
})), Effect.flatMap((input) => this.assetRepository.create(input).pipe(Effect.mapError(mapDbError({ stage, operation: 'create', factory: XfErrorFactory.createFailed })))));
|
|
30
|
+
}
|
|
31
|
+
listAssets(filter = {}, options) {
|
|
32
|
+
const stage = 'AssetService::listAssets';
|
|
33
|
+
return pipe(validateInput(filter, 'filter', { stage }), Effect.flatMap((matchEq) => this.assetRepository.find({ matchEq, options }).pipe(Effect.mapError(mapDbError({ stage, operation: 'find', factory: XfErrorFactory.notFound })))), Effect.tapError((e) => Effect.sync(() => {
|
|
34
|
+
const info = effectErrorInfo(e);
|
|
35
|
+
this.logger?.error({ error: info.unwrapped, stage }, 'Error in listAssets');
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
updateAsset(id, patch) {
|
|
39
|
+
const stage = 'AssetService::updateAsset';
|
|
40
|
+
if (!patch || Object.keys(patch).length === 0) {
|
|
41
|
+
return Effect.fail(XfErrorFactory.inputRequired({ field: 'patch', stage }));
|
|
42
|
+
}
|
|
43
|
+
return pipe(validateInput(id, 'id', { stage }), Effect.flatMap((entityId) => validateBmInputWithSchema({
|
|
44
|
+
input: patch,
|
|
45
|
+
schema: assetZodSchemaInsert.partial().strict(),
|
|
46
|
+
stage,
|
|
47
|
+
operation: 'AssetService::updateAsset.assetZodSchemaInsert.patch',
|
|
48
|
+
field: 'patch',
|
|
49
|
+
}).pipe(Effect.map(() => entityId))), Effect.flatMap((entityId) => this.assetRepository.patchById(entityId, patch).pipe(Effect.mapError(mapDbError({ stage, operation: 'patchById', factory: XfErrorFactory.upsertFailed })))), Effect.tapError((e) => Effect.sync(() => {
|
|
50
|
+
const info = effectErrorInfo(e);
|
|
51
|
+
this.logger?.error({ error: info.unwrapped, stage }, 'Error in updateAsset');
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
54
|
+
removeAsset(id) {
|
|
55
|
+
const stage = 'AssetService::removeAsset';
|
|
56
|
+
return pipe(validateInput(id, 'id', { stage }), Effect.flatMap((entityId) => this.assetRepository.deleteById(entityId).pipe(Effect.mapError(mapDbError({ stage, operation: 'deleteById', factory: XfErrorFactory.upsertFailed })))), Effect.map(() => undefined));
|
|
57
|
+
}
|
|
58
|
+
}
|