wiki-graph-core 0.3.1
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 +201 -0
- package/data/editor/clue_reviewer.jinja +410 -0
- package/data/editor/clue_reviewer_generator.jinja +428 -0
- package/data/editor/revision_feedback.jinja +5 -0
- package/data/editor/text_compressor.jinja +127 -0
- package/data/guaranteed/response_intent_classifier.jinja +8 -0
- package/data/help/commands/archive/next.jinja +29 -0
- package/data/help/commands/gc.jinja +38 -0
- package/data/help/commands/legacy/migrate.jinja +20 -0
- package/data/help/commands/legacy.jinja +19 -0
- package/data/help/commands/maintenance/chapter/add.jinja +41 -0
- package/data/help/commands/maintenance/chapter/list.jinja +33 -0
- package/data/help/commands/maintenance/chapter/move.jinja +36 -0
- package/data/help/commands/maintenance/chapter/remove.jinja +26 -0
- package/data/help/commands/maintenance/chapter/reset.jinja +29 -0
- package/data/help/commands/maintenance/chapter/set-source.jinja +34 -0
- package/data/help/commands/maintenance/chapter/set-summary.jinja +31 -0
- package/data/help/commands/maintenance/chapter/set-title.jinja +29 -0
- package/data/help/commands/maintenance/chapter/tree.jinja +58 -0
- package/data/help/commands/maintenance/chapter.jinja +59 -0
- package/data/help/commands/maintenance/cover.jinja +28 -0
- package/data/help/commands/maintenance/meta.jinja +55 -0
- package/data/help/commands/predicate.jinja +460 -0
- package/data/help/commands/root.jinja +83 -0
- package/data/help/commands/transform.jinja +34 -0
- package/data/help/commands/uri.jinja +274 -0
- package/data/help/topics/config.jinja +88 -0
- package/data/help/topics/format.jinja +72 -0
- package/data/help/topics/readiness.jinja +99 -0
- package/data/help/topics/recipe.jinja +151 -0
- package/data/help/topics/runtime.jinja +62 -0
- package/data/help/topics/uri.jinja +178 -0
- package/data/output/epub/cover.xhtml.jinja +13 -0
- package/data/output/epub/nav.xhtml.jinja +12 -0
- package/data/output/epub/package.opf.xml.jinja +39 -0
- package/data/output/epub/section.xhtml.jinja +12 -0
- package/data/topologization/book_coherence_extraction.jinja +223 -0
- package/data/topologization/chunk_extraction.jinja +233 -0
- package/data/topologization/evidence_choice.jinja +38 -0
- package/data/topologization/translate_chunks.jinja +138 -0
- package/data/topologization/user_focused_extraction.jinja +378 -0
- package/dist/archive/query/archive-view.d.ts +26 -0
- package/dist/archive/query/archive-view.js +4540 -0
- package/dist/archive/query/archive-view.js.map +1 -0
- package/dist/archive/query/continuation-cursor.d.ts +61 -0
- package/dist/archive/query/continuation-cursor.js +363 -0
- package/dist/archive/query/continuation-cursor.js.map +1 -0
- package/dist/archive/query/index.d.ts +29 -0
- package/dist/archive/query/index.js +63 -0
- package/dist/archive/query/index.js.map +1 -0
- package/dist/archive/query/lexical-search.d.ts +22 -0
- package/dist/archive/query/lexical-search.js +137 -0
- package/dist/archive/query/lexical-search.js.map +1 -0
- package/dist/archive/query/search-cache.d.ts +192 -0
- package/dist/archive/query/search-cache.js +1248 -0
- package/dist/archive/query/search-cache.js.map +1 -0
- package/dist/archive/search-index/index.d.ts +26 -0
- package/dist/archive/search-index/index.js +29 -0
- package/dist/archive/search-index/index.js.map +1 -0
- package/dist/archive/search-index/search-index.d.ts +26 -0
- package/dist/archive/search-index/search-index.js +555 -0
- package/dist/archive/search-index/search-index.js.map +1 -0
- package/dist/archive/search-index/search-tokenizer.d.ts +16 -0
- package/dist/archive/search-index/search-tokenizer.js +225 -0
- package/dist/archive/search-index/search-tokenizer.js.map +1 -0
- package/dist/common/cli-command.d.ts +4 -0
- package/dist/common/cli-command.js +7 -0
- package/dist/common/cli-command.js.map +1 -0
- package/dist/common/data-dir.d.ts +3 -0
- package/dist/common/data-dir.js +48 -0
- package/dist/common/data-dir.js.map +1 -0
- package/dist/common/language.d.ts +55 -0
- package/dist/common/language.js +208 -0
- package/dist/common/language.js.map +1 -0
- package/dist/common/llm-scope.d.ts +19 -0
- package/dist/common/llm-scope.js +31 -0
- package/dist/common/llm-scope.js.map +1 -0
- package/dist/common/logging.d.ts +22 -0
- package/dist/common/logging.js +141 -0
- package/dist/common/logging.js.map +1 -0
- package/dist/common/template.d.ts +8 -0
- package/dist/common/template.js +54 -0
- package/dist/common/template.js.map +1 -0
- package/dist/common/tinyld-language.d.ts +6 -0
- package/dist/common/tinyld-language.js +34 -0
- package/dist/common/tinyld-language.js.map +1 -0
- package/dist/common/wiki-graph-dir.d.ts +10 -0
- package/dist/common/wiki-graph-dir.js +41 -0
- package/dist/common/wiki-graph-dir.js.map +1 -0
- package/dist/common/wiki-graph-temp.d.ts +6 -0
- package/dist/common/wiki-graph-temp.js +21 -0
- package/dist/common/wiki-graph-temp.js.map +1 -0
- package/dist/common/wiki-graph-uri.d.ts +28 -0
- package/dist/common/wiki-graph-uri.js +171 -0
- package/dist/common/wiki-graph-uri.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.js +13 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/task-context.d.ts +41 -0
- package/dist/context/task-context.js +111 -0
- package/dist/context/task-context.js.map +1 -0
- package/dist/document/database.d.ts +30 -0
- package/dist/document/database.js +273 -0
- package/dist/document/database.js.map +1 -0
- package/dist/document/document.d.ts +153 -0
- package/dist/document/document.js +615 -0
- package/dist/document/document.js.map +1 -0
- package/dist/document/fragments.d.ts +63 -0
- package/dist/document/fragments.js +371 -0
- package/dist/document/fragments.js.map +1 -0
- package/dist/document/index.d.ts +13 -0
- package/dist/document/index.js +62 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/schema.d.ts +8 -0
- package/dist/document/schema.js +472 -0
- package/dist/document/schema.js.map +1 -0
- package/dist/document/shared-state-database.d.ts +9 -0
- package/dist/document/shared-state-database.js +193 -0
- package/dist/document/shared-state-database.js.map +1 -0
- package/dist/document/stores.d.ts +203 -0
- package/dist/document/stores.js +1678 -0
- package/dist/document/stores.js.map +1 -0
- package/dist/document/text-streams.d.ts +86 -0
- package/dist/document/text-streams.js +515 -0
- package/dist/document/text-streams.js.map +1 -0
- package/dist/document/types.d.ts +148 -0
- package/dist/document/types.js +69 -0
- package/dist/document/types.js.map +1 -0
- package/dist/editor/clue.d.ts +27 -0
- package/dist/editor/clue.js +158 -0
- package/dist/editor/clue.js.map +1 -0
- package/dist/editor/compressor.d.ts +18 -0
- package/dist/editor/compressor.js +68 -0
- package/dist/editor/compressor.js.map +1 -0
- package/dist/editor/editor.d.ts +39 -0
- package/dist/editor/editor.js +253 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/feedback.d.ts +16 -0
- package/dist/editor/feedback.js +104 -0
- package/dist/editor/feedback.js.map +1 -0
- package/dist/editor/index.d.ts +17 -0
- package/dist/editor/index.js +5 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/language-review.d.ts +14 -0
- package/dist/editor/language-review.js +35 -0
- package/dist/editor/language-review.js.map +1 -0
- package/dist/editor/log.d.ts +37 -0
- package/dist/editor/log.js +202 -0
- package/dist/editor/log.js.map +1 -0
- package/dist/editor/markup.d.ts +20 -0
- package/dist/editor/markup.js +294 -0
- package/dist/editor/markup.js.map +1 -0
- package/dist/editor/prompt-templates.d.ts +6 -0
- package/dist/editor/prompt-templates.js +11 -0
- package/dist/editor/prompt-templates.js.map +1 -0
- package/dist/editor/response.d.ts +5 -0
- package/dist/editor/response.js +31 -0
- package/dist/editor/response.js.map +1 -0
- package/dist/editor/review.d.ts +34 -0
- package/dist/editor/review.js +189 -0
- package/dist/editor/review.js.map +1 -0
- package/dist/editor/types.d.ts +31 -0
- package/dist/editor/types.js +21 -0
- package/dist/editor/types.js.map +1 -0
- package/dist/evidence-selection/anchor-resolver.d.ts +43 -0
- package/dist/evidence-selection/anchor-resolver.js +783 -0
- package/dist/evidence-selection/anchor-resolver.js.map +1 -0
- package/dist/evidence-selection/anchor-types.d.ts +27 -0
- package/dist/evidence-selection/anchor-types.js +1 -0
- package/dist/evidence-selection/anchor-types.js.map +1 -0
- package/dist/evidence-selection/index.d.ts +8 -0
- package/dist/evidence-selection/index.js +32 -0
- package/dist/evidence-selection/index.js.map +1 -0
- package/dist/evidence-selection/prompt.d.ts +18 -0
- package/dist/evidence-selection/prompt.js +54 -0
- package/dist/evidence-selection/prompt.js.map +1 -0
- package/dist/evidence-selection/quote-score.d.ts +29 -0
- package/dist/evidence-selection/quote-score.js +331 -0
- package/dist/evidence-selection/quote-score.js.map +1 -0
- package/dist/evidence-selection/selection-resolver.d.ts +19 -0
- package/dist/evidence-selection/selection-resolver.js +303 -0
- package/dist/evidence-selection/selection-resolver.js.map +1 -0
- package/dist/evidence-selection/text.d.ts +4 -0
- package/dist/evidence-selection/text.js +66 -0
- package/dist/evidence-selection/text.js.map +1 -0
- package/dist/evidence-selection/types.d.ts +36 -0
- package/dist/evidence-selection/types.js +1 -0
- package/dist/evidence-selection/types.js.map +1 -0
- package/dist/facade/app.d.ts +75 -0
- package/dist/facade/app.js +141 -0
- package/dist/facade/app.js.map +1 -0
- package/dist/facade/build-queue.d.ts +181 -0
- package/dist/facade/build-queue.js +1442 -0
- package/dist/facade/build-queue.js.map +1 -0
- package/dist/facade/chapter-build.d.ts +60 -0
- package/dist/facade/chapter-build.js +1020 -0
- package/dist/facade/chapter-build.js.map +1 -0
- package/dist/facade/chapter.d.ts +168 -0
- package/dist/facade/chapter.js +944 -0
- package/dist/facade/chapter.js.map +1 -0
- package/dist/facade/digest.d.ts +55 -0
- package/dist/facade/digest.js +168 -0
- package/dist/facade/digest.js.map +1 -0
- package/dist/facade/graph.d.ts +60 -0
- package/dist/facade/graph.js +203 -0
- package/dist/facade/graph.js.map +1 -0
- package/dist/facade/import.d.ts +49 -0
- package/dist/facade/import.js +262 -0
- package/dist/facade/import.js.map +1 -0
- package/dist/facade/index.d.ts +39 -0
- package/dist/facade/index.js +171 -0
- package/dist/facade/index.js.map +1 -0
- package/dist/facade/knowledge-graph-build.d.ts +75 -0
- package/dist/facade/knowledge-graph-build.js +897 -0
- package/dist/facade/knowledge-graph-build.js.map +1 -0
- package/dist/facade/llm-sampling.d.ts +11 -0
- package/dist/facade/llm-sampling.js +58 -0
- package/dist/facade/llm-sampling.js.map +1 -0
- package/dist/facade/types.d.ts +8 -0
- package/dist/facade/types.js +1 -0
- package/dist/facade/types.js.map +1 -0
- package/dist/facade/wiki-graph-archive.d.ts +41 -0
- package/dist/facade/wiki-graph-archive.js +130 -0
- package/dist/facade/wiki-graph-archive.js.map +1 -0
- package/dist/gc/files.d.ts +15 -0
- package/dist/gc/files.js +141 -0
- package/dist/gc/files.js.map +1 -0
- package/dist/gc/index.d.ts +2 -0
- package/dist/gc/index.js +5 -0
- package/dist/gc/index.js.map +1 -0
- package/dist/gc/lock.d.ts +3 -0
- package/dist/gc/lock.js +137 -0
- package/dist/gc/lock.js.map +1 -0
- package/dist/gc/runner.d.ts +9 -0
- package/dist/gc/runner.js +129 -0
- package/dist/gc/runner.js.map +1 -0
- package/dist/gc/tmp-gc.d.ts +5 -0
- package/dist/gc/tmp-gc.js +57 -0
- package/dist/gc/tmp-gc.js.map +1 -0
- package/dist/gc/types.d.ts +24 -0
- package/dist/gc/types.js +1 -0
- package/dist/gc/types.js.map +1 -0
- package/dist/gc.cjs +10041 -0
- package/dist/gc.cjs.map +1 -0
- package/dist/gc.d.cts +10 -0
- package/dist/gc.d.ts +2 -0
- package/dist/gc.js +5 -0
- package/dist/gc.js.map +1 -0
- package/dist/guaranteed/classifier.d.ts +10 -0
- package/dist/guaranteed/classifier.js +88 -0
- package/dist/guaranteed/classifier.js.map +1 -0
- package/dist/guaranteed/errors.d.ts +38 -0
- package/dist/guaranteed/errors.js +73 -0
- package/dist/guaranteed/errors.js.map +1 -0
- package/dist/guaranteed/index.d.ts +7 -0
- package/dist/guaranteed/index.js +21 -0
- package/dist/guaranteed/index.js.map +1 -0
- package/dist/guaranteed/request.d.ts +8 -0
- package/dist/guaranteed/request.js +206 -0
- package/dist/guaranteed/request.js.map +1 -0
- package/dist/guaranteed/response.d.ts +12 -0
- package/dist/guaranteed/response.js +98 -0
- package/dist/guaranteed/response.js.map +1 -0
- package/dist/guaranteed/types.d.ts +20 -0
- package/dist/guaranteed/types.js +1 -0
- package/dist/guaranteed/types.js.map +1 -0
- package/dist/index-B8NNnQ8P.d.ts +424 -0
- package/dist/index.cjs +34774 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2462 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +168 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy-sdpub/upgrade.d.ts +7 -0
- package/dist/legacy-sdpub/upgrade.js +795 -0
- package/dist/legacy-sdpub/upgrade.js.map +1 -0
- package/dist/llm/cache.d.ts +13 -0
- package/dist/llm/cache.js +35 -0
- package/dist/llm/cache.js.map +1 -0
- package/dist/llm/client.d.ts +26 -0
- package/dist/llm/client.js +572 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/context.d.ts +22 -0
- package/dist/llm/context.js +78 -0
- package/dist/llm/context.js.map +1 -0
- package/dist/llm/errors.d.ts +7 -0
- package/dist/llm/errors.js +12 -0
- package/dist/llm/errors.js.map +1 -0
- package/dist/llm/index.d.ts +7 -0
- package/dist/llm/index.js +17 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/request-log.d.ts +9 -0
- package/dist/llm/request-log.js +35 -0
- package/dist/llm/request-log.js.map +1 -0
- package/dist/llm/sampling.d.ts +11 -0
- package/dist/llm/sampling.js +67 -0
- package/dist/llm/sampling.js.map +1 -0
- package/dist/llm/types.d.ts +50 -0
- package/dist/llm/types.js +1 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/output/epub/archive.d.ts +9 -0
- package/dist/output/epub/archive.js +81 -0
- package/dist/output/epub/archive.js.map +1 -0
- package/dist/output/epub/book.d.ts +15 -0
- package/dist/output/epub/book.js +76 -0
- package/dist/output/epub/book.js.map +1 -0
- package/dist/output/epub/content.d.ts +9 -0
- package/dist/output/epub/content.js +35 -0
- package/dist/output/epub/content.js.map +1 -0
- package/dist/output/epub/index.d.ts +20 -0
- package/dist/output/epub/index.js +14 -0
- package/dist/output/epub/index.js.map +1 -0
- package/dist/output/epub/model.d.ts +24 -0
- package/dist/output/epub/model.js +1 -0
- package/dist/output/epub/model.js.map +1 -0
- package/dist/output/epub/navigation.d.ts +10 -0
- package/dist/output/epub/navigation.js +39 -0
- package/dist/output/epub/navigation.js.map +1 -0
- package/dist/output/epub/package.d.ts +17 -0
- package/dist/output/epub/package.js +29 -0
- package/dist/output/epub/package.js.map +1 -0
- package/dist/output/epub/shared.d.ts +4 -0
- package/dist/output/epub/shared.js +12 -0
- package/dist/output/epub/shared.js.map +1 -0
- package/dist/output/epub/templates.d.ts +35 -0
- package/dist/output/epub/templates.js +26 -0
- package/dist/output/epub/templates.js.map +1 -0
- package/dist/output/index.d.ts +14 -0
- package/dist/output/index.js +11 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/plain-text.d.ts +18 -0
- package/dist/output/plain-text.js +56 -0
- package/dist/output/plain-text.js.map +1 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +14 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/reporter.d.ts +10 -0
- package/dist/progress/reporter.js +79 -0
- package/dist/progress/reporter.js.map +1 -0
- package/dist/progress/tracker.d.ts +37 -0
- package/dist/progress/tracker.js +119 -0
- package/dist/progress/tracker.js.map +1 -0
- package/dist/progress/types.d.ts +28 -0
- package/dist/progress/types.js +1 -0
- package/dist/progress/types.js.map +1 -0
- package/dist/reader/attention/attention.d.ts +39 -0
- package/dist/reader/attention/attention.js +123 -0
- package/dist/reader/attention/attention.js.map +1 -0
- package/dist/reader/attention/index.d.ts +9 -0
- package/dist/reader/attention/index.js +5 -0
- package/dist/reader/attention/index.js.map +1 -0
- package/dist/reader/attention/wave-reflection.d.ts +21 -0
- package/dist/reader/attention/wave-reflection.js +153 -0
- package/dist/reader/attention/wave-reflection.js.map +1 -0
- package/dist/reader/attention/working-memory.d.ts +28 -0
- package/dist/reader/attention/working-memory.js +62 -0
- package/dist/reader/attention/working-memory.js.map +1 -0
- package/dist/reader/chunk-batch/extract.d.ts +13 -0
- package/dist/reader/chunk-batch/extract.js +14 -0
- package/dist/reader/chunk-batch/extract.js.map +1 -0
- package/dist/reader/chunk-batch/extractor.d.ts +17 -0
- package/dist/reader/chunk-batch/extractor.js +337 -0
- package/dist/reader/chunk-batch/extractor.js.map +1 -0
- package/dist/reader/chunk-batch/fragment-projection.d.ts +34 -0
- package/dist/reader/chunk-batch/fragment-projection.js +94 -0
- package/dist/reader/chunk-batch/fragment-projection.js.map +1 -0
- package/dist/reader/chunk-batch/index.d.ts +12 -0
- package/dist/reader/chunk-batch/index.js +13 -0
- package/dist/reader/chunk-batch/index.js.map +1 -0
- package/dist/reader/chunk-batch/language.d.ts +9 -0
- package/dist/reader/chunk-batch/language.js +23 -0
- package/dist/reader/chunk-batch/language.js.map +1 -0
- package/dist/reader/chunk-batch/parser.d.ts +94 -0
- package/dist/reader/chunk-batch/parser.js +640 -0
- package/dist/reader/chunk-batch/parser.js.map +1 -0
- package/dist/reader/chunk-batch/prompt-templates.d.ts +6 -0
- package/dist/reader/chunk-batch/prompt-templates.js +11 -0
- package/dist/reader/chunk-batch/prompt-templates.js.map +1 -0
- package/dist/reader/chunk-batch/types.d.ts +85 -0
- package/dist/reader/chunk-batch/types.js +1 -0
- package/dist/reader/chunk-batch/types.js.map +1 -0
- package/dist/reader/index.d.ts +13 -0
- package/dist/reader/index.js +7 -0
- package/dist/reader/index.js.map +1 -0
- package/dist/reader/reader.d.ts +37 -0
- package/dist/reader/reader.js +82 -0
- package/dist/reader/reader.js.map +1 -0
- package/dist/reader/segment/index.d.ts +2 -0
- package/dist/reader/segment/index.js +5 -0
- package/dist/reader/segment/index.js.map +1 -0
- package/dist/reader/segment/intl-segmenter.d.ts +5 -0
- package/dist/reader/segment/intl-segmenter.js +102 -0
- package/dist/reader/segment/intl-segmenter.js.map +1 -0
- package/dist/reader/segment/segment.d.ts +5 -0
- package/dist/reader/segment/segment.js +9 -0
- package/dist/reader/segment/segment.js.map +1 -0
- package/dist/reader/segment/types.d.ts +14 -0
- package/dist/reader/segment/types.js +1 -0
- package/dist/reader/segment/types.js.map +1 -0
- package/dist/reader/types.d.ts +29 -0
- package/dist/reader/types.js +1 -0
- package/dist/reader/types.js.map +1 -0
- package/dist/serial.d.ts +89 -0
- package/dist/serial.js +476 -0
- package/dist/serial.js.map +1 -0
- package/dist/source/adapter.d.ts +15 -0
- package/dist/source/adapter.js +1 -0
- package/dist/source/adapter.js.map +1 -0
- package/dist/source/epub/archive.d.ts +27 -0
- package/dist/source/epub/archive.js +189 -0
- package/dist/source/epub/archive.js.map +1 -0
- package/dist/source/epub/content.d.ts +22 -0
- package/dist/source/epub/content.js +183 -0
- package/dist/source/epub/content.js.map +1 -0
- package/dist/source/epub/document.d.ts +55 -0
- package/dist/source/epub/document.js +179 -0
- package/dist/source/epub/document.js.map +1 -0
- package/dist/source/epub/index.d.ts +10 -0
- package/dist/source/epub/index.js +6 -0
- package/dist/source/epub/index.js.map +1 -0
- package/dist/source/epub/navigation.d.ts +16 -0
- package/dist/source/epub/navigation.js +215 -0
- package/dist/source/epub/navigation.js.map +1 -0
- package/dist/source/epub/package.d.ts +33 -0
- package/dist/source/epub/package.js +237 -0
- package/dist/source/epub/package.js.map +1 -0
- package/dist/source/epub/xml.d.ts +16 -0
- package/dist/source/epub/xml.js +111 -0
- package/dist/source/epub/xml.js.map +1 -0
- package/dist/source/index.d.ts +12 -0
- package/dist/source/index.js +32 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/meta.d.ts +30 -0
- package/dist/source/meta.js +22 -0
- package/dist/source/meta.js.map +1 -0
- package/dist/source/plain-text.d.ts +16 -0
- package/dist/source/plain-text.js +86 -0
- package/dist/source/plain-text.js.map +1 -0
- package/dist/source/toc.d.ts +16 -0
- package/dist/source/toc.js +17 -0
- package/dist/source/toc.js.map +1 -0
- package/dist/source/types.d.ts +16 -0
- package/dist/source/types.js +1 -0
- package/dist/source/types.js.map +1 -0
- package/dist/topology/grouping.d.ts +15 -0
- package/dist/topology/grouping.js +18 -0
- package/dist/topology/grouping.js.map +1 -0
- package/dist/topology/index.d.ts +21 -0
- package/dist/topology/index.js +5 -0
- package/dist/topology/index.js.map +1 -0
- package/dist/topology/resource-segmentation.d.ts +13 -0
- package/dist/topology/resource-segmentation.js +111 -0
- package/dist/topology/resource-segmentation.js.map +1 -0
- package/dist/topology/segment-incision.d.ts +18 -0
- package/dist/topology/segment-incision.js +197 -0
- package/dist/topology/segment-incision.js.map +1 -0
- package/dist/topology/snake-detector.d.ts +13 -0
- package/dist/topology/snake-detector.js +520 -0
- package/dist/topology/snake-detector.js.map +1 -0
- package/dist/topology/snake-graph-builder.d.ts +14 -0
- package/dist/topology/snake-graph-builder.js +76 -0
- package/dist/topology/snake-graph-builder.js.map +1 -0
- package/dist/topology/topology.d.ts +29 -0
- package/dist/topology/topology.js +348 -0
- package/dist/topology/topology.js.map +1 -0
- package/dist/topology/weights.d.ts +10 -0
- package/dist/topology/weights.js +84 -0
- package/dist/topology/weights.js.map +1 -0
- package/dist/types-FVIqiLC9.d.cts +24 -0
- package/dist/utils/async-semaphore.d.ts +7 -0
- package/dist/utils/async-semaphore.js +40 -0
- package/dist/utils/async-semaphore.js.map +1 -0
- package/dist/utils/enum.d.ts +5 -0
- package/dist/utils/enum.js +18 -0
- package/dist/utils/enum.js.map +1 -0
- package/dist/utils/hash.d.ts +3 -0
- package/dist/utils/hash.js +132 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/node-error.d.ts +4 -0
- package/dist/utils/node-error.js +59 -0
- package/dist/utils/node-error.js.map +1 -0
- package/dist/wikg/archive-uri.d.ts +1 -0
- package/dist/wikg/archive-uri.js +37 -0
- package/dist/wikg/archive-uri.js.map +1 -0
- package/dist/wikg/archive.d.ts +28 -0
- package/dist/wikg/archive.js +496 -0
- package/dist/wikg/archive.js.map +1 -0
- package/dist/wikg/index.d.ts +31 -0
- package/dist/wikg/index.js +60 -0
- package/dist/wikg/index.js.map +1 -0
- package/dist/wikg/wikg-coordinator.d.ts +45 -0
- package/dist/wikg/wikg-coordinator.js +1687 -0
- package/dist/wikg/wikg-coordinator.js.map +1 -0
- package/dist/wikg/wiki-graph-archive-file.d.ts +42 -0
- package/dist/wikg/wiki-graph-archive-file.js +78 -0
- package/dist/wikg/wiki-graph-archive-file.js.map +1 -0
- package/dist/wikilink/index.d.ts +10 -0
- package/dist/wikilink/index.js +7 -0
- package/dist/wikilink/index.js.map +1 -0
- package/dist/wikilink/relation-discovery.d.ts +31 -0
- package/dist/wikilink/relation-discovery.js +477 -0
- package/dist/wikilink/relation-discovery.js.map +1 -0
- package/dist/wikilink/types.d.ts +23 -0
- package/dist/wikilink/types.js +1 -0
- package/dist/wikilink/types.js.map +1 -0
- package/dist/wikilink/window.d.ts +7 -0
- package/dist/wikilink/window.js +53 -0
- package/dist/wikilink/window.js.map +1 -0
- package/dist/wikimatch/enrichment.d.ts +10 -0
- package/dist/wikimatch/enrichment.js +55 -0
- package/dist/wikimatch/enrichment.js.map +1 -0
- package/dist/wikimatch/index.d.ts +16 -0
- package/dist/wikimatch/index.js +66 -0
- package/dist/wikimatch/index.js.map +1 -0
- package/dist/wikimatch/option-narrowing.d.ts +17 -0
- package/dist/wikimatch/option-narrowing.js +208 -0
- package/dist/wikimatch/option-narrowing.js.map +1 -0
- package/dist/wikimatch/options.d.ts +14 -0
- package/dist/wikimatch/options.js +155 -0
- package/dist/wikimatch/options.js.map +1 -0
- package/dist/wikimatch/policy-judge.d.ts +17 -0
- package/dist/wikimatch/policy-judge.js +430 -0
- package/dist/wikimatch/policy-judge.js.map +1 -0
- package/dist/wikimatch/range-suppression.d.ts +9 -0
- package/dist/wikimatch/range-suppression.js +27 -0
- package/dist/wikimatch/range-suppression.js.map +1 -0
- package/dist/wikimatch/surface-screening.d.ts +16 -0
- package/dist/wikimatch/surface-screening.js +168 -0
- package/dist/wikimatch/surface-screening.js.map +1 -0
- package/dist/wikimatch/surface-window.d.ts +6 -0
- package/dist/wikimatch/surface-window.js +44 -0
- package/dist/wikimatch/surface-window.js.map +1 -0
- package/dist/wikimatch/types.d.ts +151 -0
- package/dist/wikimatch/types.js +1 -0
- package/dist/wikimatch/types.js.map +1 -0
- package/dist/wikimatch/wikispine.d.ts +43 -0
- package/dist/wikimatch/wikispine.js +399 -0
- package/dist/wikimatch/wikispine.js.map +1 -0
- package/dist/wikimatch/window.d.ts +6 -0
- package/dist/wikimatch/window.js +83 -0
- package/dist/wikimatch/window.js.map +1 -0
- package/dist/wikimatch/words.d.ts +16 -0
- package/dist/wikimatch/words.js +66 -0
- package/dist/wikimatch/words.js.map +1 -0
- package/dist/wikipage/cache.d.ts +18 -0
- package/dist/wikipage/cache.js +404 -0
- package/dist/wikipage/cache.js.map +1 -0
- package/dist/wikipage/fetch-log.d.ts +17 -0
- package/dist/wikipage/fetch-log.js +143 -0
- package/dist/wikipage/fetch-log.js.map +1 -0
- package/dist/wikipage/index.d.ts +14 -0
- package/dist/wikipage/index.js +17 -0
- package/dist/wikipage/index.js.map +1 -0
- package/dist/wikipage/normalizer.d.ts +14 -0
- package/dist/wikipage/normalizer.js +147 -0
- package/dist/wikipage/normalizer.js.map +1 -0
- package/dist/wikipage/rate-limiter.d.ts +13 -0
- package/dist/wikipage/rate-limiter.js +84 -0
- package/dist/wikipage/rate-limiter.js.map +1 -0
- package/dist/wikipage/resolver.d.ts +26 -0
- package/dist/wikipage/resolver.js +325 -0
- package/dist/wikipage/resolver.js.map +1 -0
- package/dist/wikipage/types.d.ts +96 -0
- package/dist/wikipage/types.js +1 -0
- package/dist/wikipage/types.js.map +1 -0
- package/dist/wikipage/wikimedia-client.d.ts +48 -0
- package/dist/wikipage/wikimedia-client.js +397 -0
- package/dist/wikipage/wikimedia-client.js.map +1 -0
- package/dist/worker-BgQ0Xl8T.d.cts +181 -0
- package/dist/worker.cjs +5259 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +2 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +5 -0
- package/dist/worker.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var WikiGraphScope = /* @__PURE__ */ ((WikiGraphScope2) => {
|
|
2
|
+
WikiGraphScope2["EditorCompress"] = "serial-generation/editor-compress";
|
|
3
|
+
WikiGraphScope2["EditorReview"] = "serial-generation/editor-review";
|
|
4
|
+
WikiGraphScope2["EditorReviewGuide"] = "serial-generation/editor-review-guide";
|
|
5
|
+
WikiGraphScope2["ReaderChoice"] = "serial-generation/reader-choice";
|
|
6
|
+
WikiGraphScope2["ReaderExtraction"] = "serial-generation/reader-extraction";
|
|
7
|
+
return WikiGraphScope2;
|
|
8
|
+
})(WikiGraphScope || {});
|
|
9
|
+
const WIKI_GRAPH_SCOPES = Object.freeze([
|
|
10
|
+
"serial-generation/editor-compress" /* EditorCompress */,
|
|
11
|
+
"serial-generation/editor-review" /* EditorReview */,
|
|
12
|
+
"serial-generation/editor-review-guide" /* EditorReviewGuide */,
|
|
13
|
+
"serial-generation/reader-choice" /* ReaderChoice */,
|
|
14
|
+
"serial-generation/reader-extraction" /* ReaderExtraction */
|
|
15
|
+
]);
|
|
16
|
+
const WIKI_GRAPH_EDITOR_SCOPES = Object.freeze({
|
|
17
|
+
compress: "serial-generation/editor-compress" /* EditorCompress */,
|
|
18
|
+
review: "serial-generation/editor-review" /* EditorReview */,
|
|
19
|
+
reviewGuide: "serial-generation/editor-review-guide" /* EditorReviewGuide */
|
|
20
|
+
});
|
|
21
|
+
const WIKI_GRAPH_READER_SCOPES = Object.freeze({
|
|
22
|
+
choice: "serial-generation/reader-choice" /* ReaderChoice */,
|
|
23
|
+
extraction: "serial-generation/reader-extraction" /* ReaderExtraction */
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
WIKI_GRAPH_EDITOR_SCOPES,
|
|
27
|
+
WIKI_GRAPH_READER_SCOPES,
|
|
28
|
+
WIKI_GRAPH_SCOPES,
|
|
29
|
+
WikiGraphScope
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=llm-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common/llm-scope.ts"],"sourcesContent":["export enum WikiGraphScope {\n EditorCompress = \"serial-generation/editor-compress\",\n EditorReview = \"serial-generation/editor-review\",\n EditorReviewGuide = \"serial-generation/editor-review-guide\",\n ReaderChoice = \"serial-generation/reader-choice\",\n ReaderExtraction = \"serial-generation/reader-extraction\",\n}\n\nexport const WIKI_GRAPH_SCOPES = Object.freeze([\n WikiGraphScope.EditorCompress,\n WikiGraphScope.EditorReview,\n WikiGraphScope.EditorReviewGuide,\n WikiGraphScope.ReaderChoice,\n WikiGraphScope.ReaderExtraction,\n] as const);\n\nexport const WIKI_GRAPH_EDITOR_SCOPES = Object.freeze({\n compress: WikiGraphScope.EditorCompress,\n review: WikiGraphScope.EditorReview,\n reviewGuide: WikiGraphScope.EditorReviewGuide,\n});\n\nexport const WIKI_GRAPH_READER_SCOPES = Object.freeze({\n choice: WikiGraphScope.ReaderChoice,\n extraction: WikiGraphScope.ReaderExtraction,\n});\n"],"mappings":"AAAO,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,oBAAiB;AACjB,EAAAA,gBAAA,kBAAe;AACf,EAAAA,gBAAA,uBAAoB;AACpB,EAAAA,gBAAA,kBAAe;AACf,EAAAA,gBAAA,sBAAmB;AALT,SAAAA;AAAA,GAAA;AAQL,MAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAEH,MAAM,2BAA2B,OAAO,OAAO;AAAA,EACpD,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,aAAa;AACf,CAAC;AAEM,MAAM,2BAA2B,OAAO,OAAO;AAAA,EACpD,QAAQ;AAAA,EACR,YAAY;AACd,CAAC;","names":["WikiGraphScope"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Logger } from 'pino';
|
|
2
|
+
|
|
3
|
+
declare function withLoggingContext<T>(input: {
|
|
4
|
+
readonly operation: string;
|
|
5
|
+
readonly logDirPath?: string;
|
|
6
|
+
readonly verbose?: boolean;
|
|
7
|
+
}, operation: () => Promise<T>): Promise<T>;
|
|
8
|
+
declare function getLogger(bindings?: Record<string, unknown>): Logger;
|
|
9
|
+
declare function resolveArtifactPath(input: {
|
|
10
|
+
readonly category: string;
|
|
11
|
+
readonly fileName: string;
|
|
12
|
+
readonly logDirPath?: string;
|
|
13
|
+
}): string | undefined;
|
|
14
|
+
declare function allocateArtifactPath(input: {
|
|
15
|
+
readonly alwaysNumbered?: boolean;
|
|
16
|
+
readonly category: string;
|
|
17
|
+
readonly extension?: string;
|
|
18
|
+
readonly logDirPath?: string;
|
|
19
|
+
readonly prefix: string;
|
|
20
|
+
}): string | undefined;
|
|
21
|
+
|
|
22
|
+
export { allocateArtifactPath, getLogger, resolveArtifactPath, withLoggingContext };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
2
|
+
import { randomUUID } from "crypto";
|
|
3
|
+
import { existsSync, mkdirSync } from "fs";
|
|
4
|
+
import { dirname, join, resolve } from "path";
|
|
5
|
+
import pino, {
|
|
6
|
+
multistream
|
|
7
|
+
} from "pino";
|
|
8
|
+
import pretty from "pino-pretty";
|
|
9
|
+
const loggingContext = new AsyncLocalStorage();
|
|
10
|
+
const artifactCounters = /* @__PURE__ */ new Map();
|
|
11
|
+
const silentLogger = pino({ enabled: false });
|
|
12
|
+
async function withLoggingContext(input, operation) {
|
|
13
|
+
const rootLogDirPath = input.logDirPath === void 0 ? void 0 : resolve(input.logDirPath);
|
|
14
|
+
const runId = createRunId();
|
|
15
|
+
const runDirPath = rootLogDirPath === void 0 ? void 0 : join(rootLogDirPath, runId);
|
|
16
|
+
const artifactRootDirPath = runDirPath === void 0 ? void 0 : join(runDirPath, "artifacts");
|
|
17
|
+
if (runDirPath !== void 0) {
|
|
18
|
+
mkdirSync(runDirPath, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
const logger = createLogger({
|
|
21
|
+
operation: input.operation,
|
|
22
|
+
runId,
|
|
23
|
+
verbose: input.verbose ?? false,
|
|
24
|
+
...runDirPath === void 0 ? {} : { eventLogPath: join(runDirPath, "run.log") }
|
|
25
|
+
});
|
|
26
|
+
return await loggingContext.run(
|
|
27
|
+
{
|
|
28
|
+
artifactCounters: /* @__PURE__ */ new Map(),
|
|
29
|
+
logger,
|
|
30
|
+
runId,
|
|
31
|
+
...artifactRootDirPath === void 0 ? {} : { artifactRootDirPath },
|
|
32
|
+
...rootLogDirPath === void 0 ? {} : { rootLogDirPath }
|
|
33
|
+
},
|
|
34
|
+
operation
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function getLogger(bindings) {
|
|
38
|
+
const logger = loggingContext.getStore()?.logger ?? silentLogger;
|
|
39
|
+
return bindings === void 0 ? logger : logger.child(bindings);
|
|
40
|
+
}
|
|
41
|
+
function resolveArtifactPath(input) {
|
|
42
|
+
if (input.logDirPath === void 0) {
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
const rootLogDirPath = resolve(input.logDirPath);
|
|
46
|
+
const context = loggingContext.getStore();
|
|
47
|
+
if (context?.rootLogDirPath === rootLogDirPath && context.artifactRootDirPath !== void 0) {
|
|
48
|
+
const categoryDirPath = join(context.artifactRootDirPath, input.category);
|
|
49
|
+
mkdirSync(categoryDirPath, { recursive: true });
|
|
50
|
+
return join(categoryDirPath, input.fileName);
|
|
51
|
+
}
|
|
52
|
+
mkdirSync(rootLogDirPath, { recursive: true });
|
|
53
|
+
return join(rootLogDirPath, input.fileName);
|
|
54
|
+
}
|
|
55
|
+
function allocateArtifactPath(input) {
|
|
56
|
+
if (input.logDirPath === void 0) {
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
const rootLogDirPath = resolve(input.logDirPath);
|
|
60
|
+
const context = loggingContext.getStore();
|
|
61
|
+
const extension = input.extension ?? ".log";
|
|
62
|
+
const counterStore = context?.artifactCounters ?? artifactCounters;
|
|
63
|
+
const counterKey = `${rootLogDirPath}:${input.category}:${input.prefix}:${extension}`;
|
|
64
|
+
const nextIndex = counterStore.get(counterKey);
|
|
65
|
+
const startIndex = nextIndex === void 0 ? 1 : nextIndex + 1;
|
|
66
|
+
for (let index = startIndex; ; index += 1) {
|
|
67
|
+
const fileName = input.alwaysNumbered === true ? `${input.prefix}-${index}${extension}` : index === 1 ? `${input.prefix}${extension}` : `${input.prefix}-${index}${extension}`;
|
|
68
|
+
const resolvedPath = resolveArtifactPath({
|
|
69
|
+
category: input.category,
|
|
70
|
+
fileName,
|
|
71
|
+
logDirPath: input.logDirPath
|
|
72
|
+
});
|
|
73
|
+
if (resolvedPath === void 0) {
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
if (!existsSync(resolvedPath)) {
|
|
77
|
+
counterStore.set(counterKey, index);
|
|
78
|
+
return resolvedPath;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function createLogger(input) {
|
|
83
|
+
const streams = [];
|
|
84
|
+
if (input.eventLogPath !== void 0) {
|
|
85
|
+
mkdirSync(dirname(input.eventLogPath), { recursive: true });
|
|
86
|
+
streams.push({
|
|
87
|
+
level: "info",
|
|
88
|
+
stream: pretty(createPrettyOptions(input.eventLogPath))
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (input.verbose) {
|
|
92
|
+
streams.push({
|
|
93
|
+
level: "info",
|
|
94
|
+
stream: pretty(createPrettyOptions(process.stderr))
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (streams.length === 0) {
|
|
98
|
+
return silentLogger;
|
|
99
|
+
}
|
|
100
|
+
return pino(
|
|
101
|
+
{
|
|
102
|
+
base: null,
|
|
103
|
+
level: "info"
|
|
104
|
+
},
|
|
105
|
+
multistream(streams)
|
|
106
|
+
).child({
|
|
107
|
+
operation: input.operation,
|
|
108
|
+
runId: input.runId
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function createPrettyOptions(destination) {
|
|
112
|
+
return {
|
|
113
|
+
colorize: false,
|
|
114
|
+
destination,
|
|
115
|
+
ignore: "pid,hostname,operation,runId,component,scope,sessionId",
|
|
116
|
+
mkdir: typeof destination === "string",
|
|
117
|
+
singleLine: true,
|
|
118
|
+
sync: true,
|
|
119
|
+
translateTime: "SYS:yyyy-mm-dd HH:MM:ss"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function createRunId() {
|
|
123
|
+
const now = /* @__PURE__ */ new Date();
|
|
124
|
+
const year = String(now.getUTCFullYear());
|
|
125
|
+
const month = pad(now.getUTCMonth() + 1);
|
|
126
|
+
const day = pad(now.getUTCDate());
|
|
127
|
+
const hours = pad(now.getUTCHours());
|
|
128
|
+
const minutes = pad(now.getUTCMinutes());
|
|
129
|
+
const seconds = pad(now.getUTCSeconds());
|
|
130
|
+
return `${year}${month}${day}-${hours}${minutes}${seconds}-${randomUUID().slice(0, 8)}`;
|
|
131
|
+
}
|
|
132
|
+
function pad(value) {
|
|
133
|
+
return String(value).padStart(2, "0");
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
allocateArtifactPath,
|
|
137
|
+
getLogger,
|
|
138
|
+
resolveArtifactPath,
|
|
139
|
+
withLoggingContext
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common/logging.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"async_hooks\";\nimport { randomUUID } from \"crypto\";\nimport { existsSync, mkdirSync } from \"fs\";\nimport { dirname, join, resolve } from \"path\";\n\nimport pino, {\n multistream,\n type Logger as PinoLogger,\n type StreamEntry,\n} from \"pino\";\nimport pretty from \"pino-pretty\";\nimport type { PrettyOptions } from \"pino-pretty\";\n\ninterface LoggingContext {\n readonly artifactCounters: Map<string, number>;\n readonly artifactRootDirPath?: string;\n readonly logger: PinoLogger;\n readonly rootLogDirPath?: string;\n readonly runId: string;\n}\n\nconst loggingContext = new AsyncLocalStorage<LoggingContext>();\nconst artifactCounters = new Map<string, number>();\nconst silentLogger = pino({ enabled: false });\n\nexport async function withLoggingContext<T>(\n input: {\n readonly operation: string;\n readonly logDirPath?: string;\n readonly verbose?: boolean;\n },\n operation: () => Promise<T>,\n): Promise<T> {\n const rootLogDirPath =\n input.logDirPath === undefined ? undefined : resolve(input.logDirPath);\n const runId = createRunId();\n const runDirPath =\n rootLogDirPath === undefined ? undefined : join(rootLogDirPath, runId);\n const artifactRootDirPath =\n runDirPath === undefined ? undefined : join(runDirPath, \"artifacts\");\n\n if (runDirPath !== undefined) {\n mkdirSync(runDirPath, { recursive: true });\n }\n\n const logger = createLogger({\n operation: input.operation,\n runId,\n verbose: input.verbose ?? false,\n ...(runDirPath === undefined\n ? {}\n : { eventLogPath: join(runDirPath, \"run.log\") }),\n });\n\n return await loggingContext.run(\n {\n artifactCounters: new Map(),\n logger,\n runId,\n ...(artifactRootDirPath === undefined ? {} : { artifactRootDirPath }),\n ...(rootLogDirPath === undefined ? {} : { rootLogDirPath }),\n },\n operation,\n );\n}\n\nexport function getLogger(bindings?: Record<string, unknown>): PinoLogger {\n const logger = loggingContext.getStore()?.logger ?? silentLogger;\n\n return bindings === undefined ? logger : logger.child(bindings);\n}\n\nexport function resolveArtifactPath(input: {\n readonly category: string;\n readonly fileName: string;\n readonly logDirPath?: string;\n}): string | undefined {\n if (input.logDirPath === undefined) {\n return undefined;\n }\n\n const rootLogDirPath = resolve(input.logDirPath);\n const context = loggingContext.getStore();\n\n if (\n context?.rootLogDirPath === rootLogDirPath &&\n context.artifactRootDirPath !== undefined\n ) {\n const categoryDirPath = join(context.artifactRootDirPath, input.category);\n\n mkdirSync(categoryDirPath, { recursive: true });\n\n return join(categoryDirPath, input.fileName);\n }\n\n mkdirSync(rootLogDirPath, { recursive: true });\n\n return join(rootLogDirPath, input.fileName);\n}\n\nexport function allocateArtifactPath(input: {\n readonly alwaysNumbered?: boolean;\n readonly category: string;\n readonly extension?: string;\n readonly logDirPath?: string;\n readonly prefix: string;\n}): string | undefined {\n if (input.logDirPath === undefined) {\n return undefined;\n }\n\n const rootLogDirPath = resolve(input.logDirPath);\n const context = loggingContext.getStore();\n const extension = input.extension ?? \".log\";\n const counterStore = context?.artifactCounters ?? artifactCounters;\n const counterKey = `${rootLogDirPath}:${input.category}:${input.prefix}:${extension}`;\n const nextIndex = counterStore.get(counterKey);\n const startIndex = nextIndex === undefined ? 1 : nextIndex + 1;\n\n for (let index = startIndex; ; index += 1) {\n const fileName =\n input.alwaysNumbered === true\n ? `${input.prefix}-${index}${extension}`\n : index === 1\n ? `${input.prefix}${extension}`\n : `${input.prefix}-${index}${extension}`;\n const resolvedPath = resolveArtifactPath({\n category: input.category,\n fileName,\n logDirPath: input.logDirPath,\n });\n\n if (resolvedPath === undefined) {\n return undefined;\n }\n\n if (!existsSync(resolvedPath)) {\n counterStore.set(counterKey, index);\n return resolvedPath;\n }\n }\n}\n\nfunction createLogger(input: {\n readonly eventLogPath?: string;\n readonly operation: string;\n readonly runId: string;\n readonly verbose: boolean;\n}): PinoLogger {\n const streams: StreamEntry[] = [];\n\n if (input.eventLogPath !== undefined) {\n mkdirSync(dirname(input.eventLogPath), { recursive: true });\n streams.push({\n level: \"info\",\n stream: pretty(createPrettyOptions(input.eventLogPath)),\n });\n }\n\n if (input.verbose) {\n streams.push({\n level: \"info\",\n stream: pretty(createPrettyOptions(process.stderr)),\n });\n }\n\n if (streams.length === 0) {\n return silentLogger;\n }\n\n return pino(\n {\n base: null,\n level: \"info\",\n },\n multistream(streams),\n ).child({\n operation: input.operation,\n runId: input.runId,\n });\n}\n\nfunction createPrettyOptions(\n destination: string | NodeJS.WritableStream,\n): PrettyOptions {\n return {\n colorize: false,\n destination,\n ignore: \"pid,hostname,operation,runId,component,scope,sessionId\",\n mkdir: typeof destination === \"string\",\n singleLine: true,\n sync: true,\n translateTime: \"SYS:yyyy-mm-dd HH:MM:ss\",\n };\n}\n\nfunction createRunId(): string {\n const now = new Date();\n const year = String(now.getUTCFullYear());\n const month = pad(now.getUTCMonth() + 1);\n const day = pad(now.getUTCDate());\n const hours = pad(now.getUTCHours());\n const minutes = pad(now.getUTCMinutes());\n const seconds = pad(now.getUTCSeconds());\n\n return `${year}${month}${day}-${hours}${minutes}${seconds}-${randomUUID().slice(0, 8)}`;\n}\n\nfunction pad(value: number): string {\n return String(value).padStart(2, \"0\");\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { readFileSync, statSync } from "fs";
|
|
2
|
+
import { resolve, sep } from "path";
|
|
3
|
+
import { Environment, Loader } from "nunjucks";
|
|
4
|
+
const JINJA_EXTENSION_PATTERN = /\.jinja$/i;
|
|
5
|
+
const LEADING_DOT_SEGMENT_PATTERN = /^\.+\//;
|
|
6
|
+
const LEADING_SLASH_PATTERN = /^\/+/;
|
|
7
|
+
function createEnv(dirPath, options = {}) {
|
|
8
|
+
return new Environment(new DSTemplateLoader(resolve(dirPath)), {
|
|
9
|
+
autoescape: options.autoescape ?? true,
|
|
10
|
+
trimBlocks: options.trimBlocks ?? true
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
class DSTemplateLoader extends Loader {
|
|
14
|
+
#dirPath;
|
|
15
|
+
constructor(dirPath) {
|
|
16
|
+
super();
|
|
17
|
+
this.#dirPath = dirPath;
|
|
18
|
+
}
|
|
19
|
+
getSource(templateName) {
|
|
20
|
+
const normalizedTemplateName = normalizeTemplateName(templateName);
|
|
21
|
+
const targetPath = resolve(this.#dirPath, normalizedTemplateName);
|
|
22
|
+
assertWithinRoot(this.#dirPath, targetPath, normalizedTemplateName);
|
|
23
|
+
const source = readFileSync(targetPath, "utf8");
|
|
24
|
+
const modifiedTime = statSync(targetPath).mtimeMs;
|
|
25
|
+
return {
|
|
26
|
+
noCache: false,
|
|
27
|
+
path: targetPath,
|
|
28
|
+
src: source,
|
|
29
|
+
upToDate: () => statSync(targetPath).mtimeMs === modifiedTime
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function normalizeTemplateName(templateName) {
|
|
34
|
+
if (LEADING_DOT_SEGMENT_PATTERN.test(templateName)) {
|
|
35
|
+
throw new Error(`invalid path ${templateName}`);
|
|
36
|
+
}
|
|
37
|
+
const withoutLeadingSlash = templateName.replace(LEADING_SLASH_PATTERN, "");
|
|
38
|
+
const withoutExtension = withoutLeadingSlash.replace(
|
|
39
|
+
JINJA_EXTENSION_PATTERN,
|
|
40
|
+
""
|
|
41
|
+
);
|
|
42
|
+
return `${withoutExtension}.jinja`;
|
|
43
|
+
}
|
|
44
|
+
function assertWithinRoot(rootDirPath, targetPath, templateName) {
|
|
45
|
+
const rootPrefix = rootDirPath.endsWith(sep) ? rootDirPath : `${rootDirPath}${sep}`;
|
|
46
|
+
if (targetPath === rootDirPath || targetPath.startsWith(rootPrefix)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`cannot find ${templateName}`);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
createEnv
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common/template.ts"],"sourcesContent":["import { readFileSync, statSync } from \"fs\";\nimport { resolve, sep } from \"path\";\n\nimport { Environment, Loader, type LoaderSource } from \"nunjucks\";\n\nconst JINJA_EXTENSION_PATTERN = /\\.jinja$/i;\nconst LEADING_DOT_SEGMENT_PATTERN = /^\\.+\\//;\nconst LEADING_SLASH_PATTERN = /^\\/+/;\n\ntype LoaderSourceWithUpdateCheck = LoaderSource & {\n upToDate: () => boolean;\n};\n\nexport function createEnv(\n dirPath: string,\n options: {\n readonly autoescape?: boolean;\n readonly trimBlocks?: boolean;\n } = {},\n): Environment {\n return new Environment(new DSTemplateLoader(resolve(dirPath)), {\n autoescape: options.autoescape ?? true,\n trimBlocks: options.trimBlocks ?? true,\n });\n}\n\nclass DSTemplateLoader extends Loader {\n readonly #dirPath: string;\n\n public constructor(dirPath: string) {\n super();\n this.#dirPath = dirPath;\n }\n\n public getSource(templateName: string): LoaderSourceWithUpdateCheck {\n const normalizedTemplateName = normalizeTemplateName(templateName);\n const targetPath = resolve(this.#dirPath, normalizedTemplateName);\n\n assertWithinRoot(this.#dirPath, targetPath, normalizedTemplateName);\n\n const source = readFileSync(targetPath, \"utf8\");\n const modifiedTime = statSync(targetPath).mtimeMs;\n\n return {\n noCache: false,\n path: targetPath,\n src: source,\n upToDate: () => statSync(targetPath).mtimeMs === modifiedTime,\n };\n }\n}\n\nfunction normalizeTemplateName(templateName: string): string {\n if (LEADING_DOT_SEGMENT_PATTERN.test(templateName)) {\n throw new Error(`invalid path ${templateName}`);\n }\n\n const withoutLeadingSlash = templateName.replace(LEADING_SLASH_PATTERN, \"\");\n const withoutExtension = withoutLeadingSlash.replace(\n JINJA_EXTENSION_PATTERN,\n \"\",\n );\n\n return `${withoutExtension}.jinja`;\n}\n\nfunction assertWithinRoot(\n rootDirPath: string,\n targetPath: string,\n templateName: string,\n): void {\n const rootPrefix = rootDirPath.endsWith(sep)\n ? rootDirPath\n : `${rootDirPath}${sep}`;\n\n if (targetPath === rootDirPath || targetPath.startsWith(rootPrefix)) {\n return;\n }\n\n throw new Error(`cannot find ${templateName}`);\n}\n"],"mappings":"AAAA,SAAS,cAAc,gBAAgB;AACvC,SAAS,SAAS,WAAW;AAE7B,SAAS,aAAa,cAAiC;AAEvD,MAAM,0BAA0B;AAChC,MAAM,8BAA8B;AACpC,MAAM,wBAAwB;AAMvB,SAAS,UACd,SACA,UAGI,CAAC,GACQ;AACb,SAAO,IAAI,YAAY,IAAI,iBAAiB,QAAQ,OAAO,CAAC,GAAG;AAAA,IAC7D,YAAY,QAAQ,cAAc;AAAA,IAClC,YAAY,QAAQ,cAAc;AAAA,EACpC,CAAC;AACH;AAEA,MAAM,yBAAyB,OAAO;AAAA,EAC3B;AAAA,EAEF,YAAY,SAAiB;AAClC,UAAM;AACN,SAAK,WAAW;AAAA,EAClB;AAAA,EAEO,UAAU,cAAmD;AAClE,UAAM,yBAAyB,sBAAsB,YAAY;AACjE,UAAM,aAAa,QAAQ,KAAK,UAAU,sBAAsB;AAEhE,qBAAiB,KAAK,UAAU,YAAY,sBAAsB;AAElE,UAAM,SAAS,aAAa,YAAY,MAAM;AAC9C,UAAM,eAAe,SAAS,UAAU,EAAE;AAE1C,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,MACN,KAAK;AAAA,MACL,UAAU,MAAM,SAAS,UAAU,EAAE,YAAY;AAAA,IACnD;AAAA,EACF;AACF;AAEA,SAAS,sBAAsB,cAA8B;AAC3D,MAAI,4BAA4B,KAAK,YAAY,GAAG;AAClD,UAAM,IAAI,MAAM,gBAAgB,YAAY,EAAE;AAAA,EAChD;AAEA,QAAM,sBAAsB,aAAa,QAAQ,uBAAuB,EAAE;AAC1E,QAAM,mBAAmB,oBAAoB;AAAA,IAC3C;AAAA,IACA;AAAA,EACF;AAEA,SAAO,GAAG,gBAAgB;AAC5B;AAEA,SAAS,iBACP,aACA,YACA,cACM;AACN,QAAM,aAAa,YAAY,SAAS,GAAG,IACvC,cACA,GAAG,WAAW,GAAG,GAAG;AAExB,MAAI,eAAe,eAAe,WAAW,WAAW,UAAU,GAAG;AACnE;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,eAAe,YAAY,EAAE;AAC/C;","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { detect, validateISO2 } from "tinyld";
|
|
2
|
+
import { getLanguageCode } from "./language.js";
|
|
3
|
+
function detectLanguageCode(text) {
|
|
4
|
+
const normalizedText = text.trim();
|
|
5
|
+
if (normalizedText === "") {
|
|
6
|
+
return void 0;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return normalizeLanguageCode(detect(normalizedText));
|
|
10
|
+
} catch {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function getLanguageDetectionCode(language) {
|
|
15
|
+
return getLanguageCode(language);
|
|
16
|
+
}
|
|
17
|
+
function normalizeLanguageCode(languageCode) {
|
|
18
|
+
const normalizedLanguageCode = languageCode.trim().toLowerCase();
|
|
19
|
+
const directLanguageCode = validateISO2(normalizedLanguageCode);
|
|
20
|
+
if (directLanguageCode !== "") {
|
|
21
|
+
return directLanguageCode;
|
|
22
|
+
}
|
|
23
|
+
const baseLanguageCode = normalizedLanguageCode.split("-")[0];
|
|
24
|
+
if (baseLanguageCode === void 0) {
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
const validatedBaseLanguageCode = validateISO2(baseLanguageCode);
|
|
28
|
+
return validatedBaseLanguageCode === "" ? void 0 : validatedBaseLanguageCode;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
detectLanguageCode,
|
|
32
|
+
getLanguageDetectionCode
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=tinyld-language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common/tinyld-language.ts"],"sourcesContent":["import { detect, validateISO2 } from \"tinyld\";\n\nimport { getLanguageCode, type Language } from \"./language.js\";\n\nexport function detectLanguageCode(text: string): string | undefined {\n const normalizedText = text.trim();\n\n if (normalizedText === \"\") {\n return undefined;\n }\n\n try {\n return normalizeLanguageCode(detect(normalizedText));\n } catch {\n return undefined;\n }\n}\n\nexport function getLanguageDetectionCode(language: Language): string {\n return getLanguageCode(language);\n}\n\nfunction normalizeLanguageCode(languageCode: string): string | undefined {\n const normalizedLanguageCode = languageCode.trim().toLowerCase();\n const directLanguageCode = validateISO2(normalizedLanguageCode);\n\n if (directLanguageCode !== \"\") {\n return directLanguageCode;\n }\n\n const baseLanguageCode = normalizedLanguageCode.split(\"-\")[0];\n\n if (baseLanguageCode === undefined) {\n return undefined;\n }\n\n const validatedBaseLanguageCode = validateISO2(baseLanguageCode);\n\n return validatedBaseLanguageCode === \"\"\n ? undefined\n : validatedBaseLanguageCode;\n}\n"],"mappings":"AAAA,SAAS,QAAQ,oBAAoB;AAErC,SAAS,uBAAsC;AAExC,SAAS,mBAAmB,MAAkC;AACnE,QAAM,iBAAiB,KAAK,KAAK;AAEjC,MAAI,mBAAmB,IAAI;AACzB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,WAAO,sBAAsB,OAAO,cAAc,CAAC;AAAA,EACrD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,yBAAyB,UAA4B;AACnE,SAAO,gBAAgB,QAAQ;AACjC;AAEA,SAAS,sBAAsB,cAA0C;AACvE,QAAM,yBAAyB,aAAa,KAAK,EAAE,YAAY;AAC/D,QAAM,qBAAqB,aAAa,sBAAsB;AAE9D,MAAI,uBAAuB,IAAI;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,mBAAmB,uBAAuB,MAAM,GAAG,EAAE,CAAC;AAE5D,MAAI,qBAAqB,QAAW;AAClC,WAAO;AAAA,EACT;AAEA,QAAM,4BAA4B,aAAa,gBAAgB;AAE/D,SAAO,8BAA8B,KACjC,SACA;AACN;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function resolveWikiGraphHomeDirectoryPath(): string;
|
|
2
|
+
declare function resolveWikiGraphCoreDatabasePath(): string;
|
|
3
|
+
declare function resolveWikiGraphCacheDirectoryPath(): string;
|
|
4
|
+
declare function resolveWikiGraphCacheDatabasePath(): string;
|
|
5
|
+
declare function resolveWikiGraphJobsDirectoryPath(): string;
|
|
6
|
+
declare function resolveWikiGraphStagingDirectoryPath(): string;
|
|
7
|
+
declare function resolveWikiGraphTempRootDirectoryPath(): string;
|
|
8
|
+
declare function resolveWikiGraphLogsDirectoryPath(): string;
|
|
9
|
+
|
|
10
|
+
export { resolveWikiGraphCacheDatabasePath, resolveWikiGraphCacheDirectoryPath, resolveWikiGraphCoreDatabasePath, resolveWikiGraphHomeDirectoryPath, resolveWikiGraphJobsDirectoryPath, resolveWikiGraphLogsDirectoryPath, resolveWikiGraphStagingDirectoryPath, resolveWikiGraphTempRootDirectoryPath };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { homedir } from "os";
|
|
2
|
+
import { join, resolve } from "path";
|
|
3
|
+
function resolveWikiGraphHomeDirectoryPath() {
|
|
4
|
+
const localDataRootPath = process.env.WIKIGRAPH_STATE_DIR;
|
|
5
|
+
if (localDataRootPath !== void 0 && localDataRootPath.trim() !== "") {
|
|
6
|
+
return resolve(localDataRootPath);
|
|
7
|
+
}
|
|
8
|
+
return join(homedir(), ".wikigraph");
|
|
9
|
+
}
|
|
10
|
+
function resolveWikiGraphCoreDatabasePath() {
|
|
11
|
+
return join(resolveWikiGraphHomeDirectoryPath(), "core.sqlite");
|
|
12
|
+
}
|
|
13
|
+
function resolveWikiGraphCacheDirectoryPath() {
|
|
14
|
+
return join(resolveWikiGraphHomeDirectoryPath(), "cache");
|
|
15
|
+
}
|
|
16
|
+
function resolveWikiGraphCacheDatabasePath() {
|
|
17
|
+
return join(resolveWikiGraphCacheDirectoryPath(), "cache.sqlite");
|
|
18
|
+
}
|
|
19
|
+
function resolveWikiGraphJobsDirectoryPath() {
|
|
20
|
+
return join(resolveWikiGraphHomeDirectoryPath(), "jobs");
|
|
21
|
+
}
|
|
22
|
+
function resolveWikiGraphStagingDirectoryPath() {
|
|
23
|
+
return join(resolveWikiGraphHomeDirectoryPath(), "staging");
|
|
24
|
+
}
|
|
25
|
+
function resolveWikiGraphTempRootDirectoryPath() {
|
|
26
|
+
return join(resolveWikiGraphHomeDirectoryPath(), "tmp");
|
|
27
|
+
}
|
|
28
|
+
function resolveWikiGraphLogsDirectoryPath() {
|
|
29
|
+
return join(resolveWikiGraphHomeDirectoryPath(), "logs");
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
resolveWikiGraphCacheDatabasePath,
|
|
33
|
+
resolveWikiGraphCacheDirectoryPath,
|
|
34
|
+
resolveWikiGraphCoreDatabasePath,
|
|
35
|
+
resolveWikiGraphHomeDirectoryPath,
|
|
36
|
+
resolveWikiGraphJobsDirectoryPath,
|
|
37
|
+
resolveWikiGraphLogsDirectoryPath,
|
|
38
|
+
resolveWikiGraphStagingDirectoryPath,
|
|
39
|
+
resolveWikiGraphTempRootDirectoryPath
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=wiki-graph-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common/wiki-graph-dir.ts"],"sourcesContent":["import { homedir } from \"os\";\nimport { join, resolve } from \"path\";\n\nexport function resolveWikiGraphHomeDirectoryPath(): string {\n const localDataRootPath = process.env.WIKIGRAPH_STATE_DIR;\n\n if (localDataRootPath !== undefined && localDataRootPath.trim() !== \"\") {\n return resolve(localDataRootPath);\n }\n\n return join(homedir(), \".wikigraph\");\n}\n\nexport function resolveWikiGraphCoreDatabasePath(): string {\n return join(resolveWikiGraphHomeDirectoryPath(), \"core.sqlite\");\n}\n\nexport function resolveWikiGraphCacheDirectoryPath(): string {\n return join(resolveWikiGraphHomeDirectoryPath(), \"cache\");\n}\n\nexport function resolveWikiGraphCacheDatabasePath(): string {\n return join(resolveWikiGraphCacheDirectoryPath(), \"cache.sqlite\");\n}\n\nexport function resolveWikiGraphJobsDirectoryPath(): string {\n return join(resolveWikiGraphHomeDirectoryPath(), \"jobs\");\n}\n\nexport function resolveWikiGraphStagingDirectoryPath(): string {\n return join(resolveWikiGraphHomeDirectoryPath(), \"staging\");\n}\n\nexport function resolveWikiGraphTempRootDirectoryPath(): string {\n return join(resolveWikiGraphHomeDirectoryPath(), \"tmp\");\n}\n\nexport function resolveWikiGraphLogsDirectoryPath(): string {\n return join(resolveWikiGraphHomeDirectoryPath(), \"logs\");\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AAEvB,SAAS,oCAA4C;AAC1D,QAAM,oBAAoB,QAAQ,IAAI;AAEtC,MAAI,sBAAsB,UAAa,kBAAkB,KAAK,MAAM,IAAI;AACtE,WAAO,QAAQ,iBAAiB;AAAA,EAClC;AAEA,SAAO,KAAK,QAAQ,GAAG,YAAY;AACrC;AAEO,SAAS,mCAA2C;AACzD,SAAO,KAAK,kCAAkC,GAAG,aAAa;AAChE;AAEO,SAAS,qCAA6C;AAC3D,SAAO,KAAK,kCAAkC,GAAG,OAAO;AAC1D;AAEO,SAAS,oCAA4C;AAC1D,SAAO,KAAK,mCAAmC,GAAG,cAAc;AAClE;AAEO,SAAS,oCAA4C;AAC1D,SAAO,KAAK,kCAAkC,GAAG,MAAM;AACzD;AAEO,SAAS,uCAA+C;AAC7D,SAAO,KAAK,kCAAkC,GAAG,SAAS;AAC5D;AAEO,SAAS,wCAAgD;AAC9D,SAAO,KAAK,kCAAkC,GAAG,KAAK;AACxD;AAEO,SAAS,oCAA4C;AAC1D,SAAO,KAAK,kCAAkC,GAAG,MAAM;AACzD;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type WikiGraphTempCategory = "archive-open" | "archive-write" | "cli-output" | "sdpub-upgrade" | "stdin-create" | "url-create";
|
|
2
|
+
declare function resolveWikiGraphStateRootPath(): string;
|
|
3
|
+
declare function resolveWikiGraphTempDirectoryPath(category?: WikiGraphTempCategory): string;
|
|
4
|
+
declare function createWikiGraphTempDirectory(category: WikiGraphTempCategory): Promise<string>;
|
|
5
|
+
|
|
6
|
+
export { type WikiGraphTempCategory, createWikiGraphTempDirectory, resolveWikiGraphStateRootPath, resolveWikiGraphTempDirectoryPath };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { mkdir, mkdtemp } from "fs/promises";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { resolveWikiGraphTempRootDirectoryPath } from "./wiki-graph-dir.js";
|
|
4
|
+
function resolveWikiGraphStateRootPath() {
|
|
5
|
+
return resolveWikiGraphTempRootDirectoryPath();
|
|
6
|
+
}
|
|
7
|
+
function resolveWikiGraphTempDirectoryPath(category) {
|
|
8
|
+
const rootPath = resolveWikiGraphStateRootPath();
|
|
9
|
+
return category === void 0 ? rootPath : join(rootPath, category);
|
|
10
|
+
}
|
|
11
|
+
async function createWikiGraphTempDirectory(category) {
|
|
12
|
+
const rootPath = resolveWikiGraphTempDirectoryPath(category);
|
|
13
|
+
await mkdir(rootPath, { recursive: true });
|
|
14
|
+
return await mkdtemp(join(rootPath, `${category}-`));
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
createWikiGraphTempDirectory,
|
|
18
|
+
resolveWikiGraphStateRootPath,
|
|
19
|
+
resolveWikiGraphTempDirectoryPath
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=wiki-graph-temp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/common/wiki-graph-temp.ts"],"sourcesContent":["import { mkdir, mkdtemp } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { resolveWikiGraphTempRootDirectoryPath } from \"./wiki-graph-dir.js\";\n\nexport type WikiGraphTempCategory =\n | \"archive-open\"\n | \"archive-write\"\n | \"cli-output\"\n | \"sdpub-upgrade\"\n | \"stdin-create\"\n | \"url-create\";\n\nexport function resolveWikiGraphStateRootPath(): string {\n return resolveWikiGraphTempRootDirectoryPath();\n}\n\nexport function resolveWikiGraphTempDirectoryPath(\n category?: WikiGraphTempCategory,\n): string {\n const rootPath = resolveWikiGraphStateRootPath();\n\n return category === undefined ? rootPath : join(rootPath, category);\n}\n\nexport async function createWikiGraphTempDirectory(\n category: WikiGraphTempCategory,\n): Promise<string> {\n const rootPath = resolveWikiGraphTempDirectoryPath(category);\n\n await mkdir(rootPath, { recursive: true });\n return await mkdtemp(join(rootPath, `${category}-`));\n}\n"],"mappings":"AAAA,SAAS,OAAO,eAAe;AAC/B,SAAS,YAAY;AAErB,SAAS,6CAA6C;AAU/C,SAAS,gCAAwC;AACtD,SAAO,sCAAsC;AAC/C;AAEO,SAAS,kCACd,UACQ;AACR,QAAM,WAAW,8BAA8B;AAE/C,SAAO,aAAa,SAAY,WAAW,KAAK,UAAU,QAAQ;AACpE;AAEA,eAAsB,6BACpB,UACiB;AACjB,QAAM,WAAW,kCAAkC,QAAQ;AAE3D,QAAM,MAAM,UAAU,EAAE,WAAW,KAAK,CAAC;AACzC,SAAO,MAAM,QAAQ,KAAK,UAAU,GAAG,QAAQ,GAAG,CAAC;AACrD;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const WIKI_GRAPH_URI_PREFIX = "wikg://";
|
|
2
|
+
declare const WIKI_GRAPH_JOB_URI_PREFIX = "wikg://local/job";
|
|
3
|
+
declare const WIKI_GRAPH_ARCHIVE_EXTENSION = ".wikg";
|
|
4
|
+
interface LocatedWikiGraphUri {
|
|
5
|
+
readonly archivePath?: string;
|
|
6
|
+
readonly objectUri?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function isWikiGraphUri(value: string | undefined): value is string;
|
|
9
|
+
declare function isWikiGraphJobUri(value: string | undefined): value is string;
|
|
10
|
+
declare function parseLocatedWikiGraphUri(uri: string): LocatedWikiGraphUri;
|
|
11
|
+
declare function formatLocatedWikiGraphUri(archivePath: string, objectUri?: string): string;
|
|
12
|
+
declare function formatWikiGraphCommandUri(archivePath: string, objectUri?: string, cwd?: string): string;
|
|
13
|
+
declare function formatLocatedChapterUri(archivePath: string, chapterId: number): string;
|
|
14
|
+
declare function formatLocatedChapterResourceUri(archivePath: string, chapterId: number, resource: "source" | "summary" | "title"): string;
|
|
15
|
+
declare function formatLocatedChapterSourceCollectionUri(archivePath: string, chapterId: number): string;
|
|
16
|
+
declare function formatWikiGraphObjectUri(path: string, hash?: string): string;
|
|
17
|
+
declare function requireArchiveUri(uri: string): string;
|
|
18
|
+
declare function requireLocatedObjectUri(uri: string): {
|
|
19
|
+
readonly archivePath: string;
|
|
20
|
+
readonly objectUri: string;
|
|
21
|
+
};
|
|
22
|
+
declare function requireLocatedObjectOrArchiveUri(uri: string): {
|
|
23
|
+
readonly archivePath: string;
|
|
24
|
+
readonly objectUri?: string;
|
|
25
|
+
};
|
|
26
|
+
declare function formatWikiGraphUriExpectedError(value: string): string;
|
|
27
|
+
|
|
28
|
+
export { type LocatedWikiGraphUri, WIKI_GRAPH_ARCHIVE_EXTENSION, WIKI_GRAPH_JOB_URI_PREFIX, WIKI_GRAPH_URI_PREFIX, formatLocatedChapterResourceUri, formatLocatedChapterSourceCollectionUri, formatLocatedChapterUri, formatLocatedWikiGraphUri, formatWikiGraphCommandUri, formatWikiGraphObjectUri, formatWikiGraphUriExpectedError, isWikiGraphJobUri, isWikiGraphUri, parseLocatedWikiGraphUri, requireArchiveUri, requireLocatedObjectOrArchiveUri, requireLocatedObjectUri };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { isAbsolute, relative, resolve } from "path";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
const WIKI_GRAPH_URI_PREFIX = "wikg://";
|
|
4
|
+
const WIKI_GRAPH_JOB_URI_PREFIX = "wikg://local/job";
|
|
5
|
+
const WIKI_GRAPH_ARCHIVE_EXTENSION = ".wikg";
|
|
6
|
+
function isWikiGraphUri(value) {
|
|
7
|
+
return isWikiGraphUriPrefix(value);
|
|
8
|
+
}
|
|
9
|
+
function isWikiGraphJobUri(value) {
|
|
10
|
+
return isWikiGraphLocalJobUri(value);
|
|
11
|
+
}
|
|
12
|
+
function parseLocatedWikiGraphUri(uri) {
|
|
13
|
+
const prefix = getWikiGraphUriPrefix(uri);
|
|
14
|
+
if (prefix === void 0) {
|
|
15
|
+
throw new Error(formatWikiGraphUriExpectedError(uri));
|
|
16
|
+
}
|
|
17
|
+
const body = uri.slice(prefix.length);
|
|
18
|
+
const split = body.split("#", 2);
|
|
19
|
+
const path = split[0] ?? "";
|
|
20
|
+
const hash = split[1] ?? "";
|
|
21
|
+
const parts = path.split("/");
|
|
22
|
+
const archiveIndex = parts.findIndex(
|
|
23
|
+
(part) => part.endsWith(WIKI_GRAPH_ARCHIVE_EXTENSION)
|
|
24
|
+
);
|
|
25
|
+
if (archiveIndex < 0) {
|
|
26
|
+
return { objectUri: uri };
|
|
27
|
+
}
|
|
28
|
+
const archivePath = parts.slice(0, archiveIndex + 1).join("/");
|
|
29
|
+
const objectPath = parts.slice(archiveIndex + 1).join("/");
|
|
30
|
+
if (archivePath === "") {
|
|
31
|
+
throw new Error(`Invalid Wiki Graph archive URI: ${uri}`);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
archivePath: resolveArchivePath(archivePath),
|
|
35
|
+
...objectPath === "" ? {} : {
|
|
36
|
+
objectUri: formatWikiGraphObjectUri(
|
|
37
|
+
objectPath,
|
|
38
|
+
hash === "" ? void 0 : hash
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function resolveArchivePath(archivePath) {
|
|
44
|
+
if (archivePath.startsWith("~/")) {
|
|
45
|
+
return resolve(homedir(), archivePath.slice(2));
|
|
46
|
+
}
|
|
47
|
+
return resolve(archivePath);
|
|
48
|
+
}
|
|
49
|
+
function formatLocatedWikiGraphUri(archivePath, objectUri) {
|
|
50
|
+
const uriArchivePath = archivePath.replace(/\\/gu, "/");
|
|
51
|
+
if (objectUri === void 0 || objectUri === WIKI_GRAPH_URI_PREFIX) {
|
|
52
|
+
return `${WIKI_GRAPH_URI_PREFIX}${uriArchivePath}`;
|
|
53
|
+
}
|
|
54
|
+
return `${WIKI_GRAPH_URI_PREFIX}${uriArchivePath}/${stripWikiGraphUriPrefix(
|
|
55
|
+
objectUri
|
|
56
|
+
)}`;
|
|
57
|
+
}
|
|
58
|
+
function formatWikiGraphCommandUri(archivePath, objectUri, cwd = process.cwd()) {
|
|
59
|
+
return formatLocatedWikiGraphUri(
|
|
60
|
+
formatCommandArchivePath(archivePath, cwd),
|
|
61
|
+
objectUri
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
function formatCommandArchivePath(archivePath, cwd) {
|
|
65
|
+
const resolvedCwd = resolve(cwd);
|
|
66
|
+
const resolvedArchivePath = isAbsolute(archivePath) ? resolve(archivePath) : resolve(resolvedCwd, archivePath);
|
|
67
|
+
const relativeArchivePath = relative(resolvedCwd, resolvedArchivePath);
|
|
68
|
+
if (relativeArchivePath !== "" && !relativeArchivePath.startsWith("..") && !isAbsolute(relativeArchivePath)) {
|
|
69
|
+
return relativeArchivePath;
|
|
70
|
+
}
|
|
71
|
+
return resolvedArchivePath;
|
|
72
|
+
}
|
|
73
|
+
function formatLocatedChapterUri(archivePath, chapterId) {
|
|
74
|
+
return formatLocatedWikiGraphUri(
|
|
75
|
+
archivePath,
|
|
76
|
+
formatWikiGraphObjectUri(`chapter/${chapterId}`)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function formatLocatedChapterResourceUri(archivePath, chapterId, resource) {
|
|
80
|
+
return formatLocatedWikiGraphUri(
|
|
81
|
+
archivePath,
|
|
82
|
+
formatWikiGraphObjectUri(`chapter/${chapterId}/${resource}`)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function formatLocatedChapterSourceCollectionUri(archivePath, chapterId) {
|
|
86
|
+
return formatLocatedWikiGraphUri(
|
|
87
|
+
archivePath,
|
|
88
|
+
formatWikiGraphObjectUri(`chapter/${chapterId}/source`)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function formatWikiGraphObjectUri(path, hash) {
|
|
92
|
+
const normalizedPath = path.replace(/^\/+/u, "").replace(/\/+$/u, "");
|
|
93
|
+
return `${WIKI_GRAPH_URI_PREFIX}${normalizedPath}${hash === void 0 ? "" : `#${hash}`}`;
|
|
94
|
+
}
|
|
95
|
+
function requireArchiveUri(uri) {
|
|
96
|
+
const parsed = parseLocatedWikiGraphUri(uri);
|
|
97
|
+
if (parsed.archivePath === void 0 || parsed.objectUri !== void 0) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
`${formatWikiGraphUriExpectedError(uri)} Expected a .wikg archive locator.`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return parsed.archivePath;
|
|
103
|
+
}
|
|
104
|
+
function requireLocatedObjectUri(uri) {
|
|
105
|
+
const parsed = parseLocatedWikiGraphUri(uri);
|
|
106
|
+
if (parsed.archivePath === void 0 || parsed.objectUri === void 0) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`${formatWikiGraphUriExpectedError(uri)} Expected an object URI with a .wikg archive locator.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
archivePath: parsed.archivePath,
|
|
113
|
+
objectUri: parsed.objectUri
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function requireLocatedObjectOrArchiveUri(uri) {
|
|
117
|
+
const parsed = parseLocatedWikiGraphUri(uri);
|
|
118
|
+
if (parsed.archivePath === void 0) {
|
|
119
|
+
throw new Error(formatWikiGraphUriExpectedError(uri));
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
archivePath: parsed.archivePath,
|
|
123
|
+
...parsed.objectUri === void 0 ? {} : { objectUri: parsed.objectUri }
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function formatWikiGraphUriExpectedError(value) {
|
|
127
|
+
const example = value.endsWith(WIKI_GRAPH_ARCHIVE_EXTENSION) && value.startsWith("/") ? `${WIKI_GRAPH_URI_PREFIX}${value}` : "wikg:///absolute/path/book.wikg";
|
|
128
|
+
return [
|
|
129
|
+
`Expected a Wiki Graph URI with a .wikg archive locator: ${value}`,
|
|
130
|
+
`Example: ${example}`,
|
|
131
|
+
"See: wg help uri"
|
|
132
|
+
].join("\n");
|
|
133
|
+
}
|
|
134
|
+
function stripWikiGraphUriPrefix(uri) {
|
|
135
|
+
const prefix = getWikiGraphUriPrefix(uri);
|
|
136
|
+
if (prefix === void 0) {
|
|
137
|
+
throw new Error(`Expected a Wiki Graph object URI: ${uri}`);
|
|
138
|
+
}
|
|
139
|
+
return uri.slice(prefix.length).replace(/^\/+/u, "");
|
|
140
|
+
}
|
|
141
|
+
function getWikiGraphUriPrefix(uri) {
|
|
142
|
+
if (uri.startsWith(WIKI_GRAPH_URI_PREFIX)) {
|
|
143
|
+
return WIKI_GRAPH_URI_PREFIX;
|
|
144
|
+
}
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
function isWikiGraphUriPrefix(value) {
|
|
148
|
+
return value?.startsWith(WIKI_GRAPH_URI_PREFIX) === true;
|
|
149
|
+
}
|
|
150
|
+
function isWikiGraphLocalJobUri(value) {
|
|
151
|
+
return value === WIKI_GRAPH_JOB_URI_PREFIX || value?.startsWith(`${WIKI_GRAPH_JOB_URI_PREFIX}/`) === true;
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
WIKI_GRAPH_ARCHIVE_EXTENSION,
|
|
155
|
+
WIKI_GRAPH_JOB_URI_PREFIX,
|
|
156
|
+
WIKI_GRAPH_URI_PREFIX,
|
|
157
|
+
formatLocatedChapterResourceUri,
|
|
158
|
+
formatLocatedChapterSourceCollectionUri,
|
|
159
|
+
formatLocatedChapterUri,
|
|
160
|
+
formatLocatedWikiGraphUri,
|
|
161
|
+
formatWikiGraphCommandUri,
|
|
162
|
+
formatWikiGraphObjectUri,
|
|
163
|
+
formatWikiGraphUriExpectedError,
|
|
164
|
+
isWikiGraphJobUri,
|
|
165
|
+
isWikiGraphUri,
|
|
166
|
+
parseLocatedWikiGraphUri,
|
|
167
|
+
requireArchiveUri,
|
|
168
|
+
requireLocatedObjectOrArchiveUri,
|
|
169
|
+
requireLocatedObjectUri
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=wiki-graph-uri.js.map
|