From 7670faea5ed4944b0793f676773cc0c13267c918 Mon Sep 17 00:00:00 2001 From: Lance Pollard Date: Fri, 19 Jan 2024 02:29:29 -0800 Subject: [PATCH] begin reffactoring folder structure so i can see whats happening --- code/cli/task.ts | 6 +- code/node/{call => action}/compile.ts | 0 code/node/{call => action}/convert.ts | 0 code/node/{call => action}/format.ts | 0 code/node/index.ts | 2 +- code/shared/action/code/index.ts | 0 code/shared/action/compile/code.ts | 0 .../shared/action/convert/document/calibre.ts | 0 .../action/convert/document/libre-office.ts | 0 code/shared/action/convert/document/pandoc.ts | 0 .../action/convert/document/pdflatex.ts | 0 .../action/convert/image/image-magick.ts | 0 code/shared/action/convert/video/ffmpeg.ts | 0 code/shared/archive.ts | 6 +- code/shared/document.ts | 6 +- code/shared/image.ts | 11 +- code/shared/source/action/archive/index.ts | 40 + .../source => source/action/check}/file.ts | 0 .../action/compile/code.ts} | 0 code/shared/source/action/convert/archive.ts | 32 + .../source/action/convert/document/index.ts | 212 ++++ .../action/convert/font/index.ts} | 7 +- .../source/action/convert/image/index.ts | 61 ++ .../source/action/convert/video/index.ts | 137 +++ code/shared/source/action/extract/index.ts | 46 + .../action/format/code.ts} | 0 code/shared/source/action/index.ts | 16 + code/shared/source/action/inspect/index.ts | 27 + code/shared/source/action/remove/metadata.ts | 17 + code/shared/source/action/sanitize/code.ts | 13 + code/shared/source/action/slice/document.ts | 46 + .../shared/source/action/validate/document.ts | 17 + code/shared/source/action/verify/image.ts | 17 + code/shared/source/image.ts | 52 + code/shared/{type => }/source/index.ts | 11 +- code/shared/source/object/archive/index.ts | 6 + code/shared/source/object/assembly/index.ts | 6 + code/shared/source/object/calibre/index.ts | 180 ++++ .../object/clang-format/index.ts} | 10 +- .../object/clang-format}/style.all.type.json | 0 .../object/clang-format}/style.cpp.type.json | 0 .../object/clang-format}/style.java.type.json | 0 .../clang-format}/style.javascript.type.json | 0 .../object/clang-format}/style.objc.type.json | 0 .../object/exiftool}/exiftool.tag.json | 0 .../object/exiftool/index.ts} | 936 +----------------- .../ffmpeg}/ffmpeg.codecs.audio.keys.json | 0 .../object/ffmpeg}/ffmpeg.codecs.json | 0 .../ffmpeg}/ffmpeg.codecs.subtitle.keys.json | 0 .../ffmpeg}/ffmpeg.codecs.video.keys.json | 0 .../ffmpeg}/ffmpeg.decoders.audio.keys.json | 0 .../object/ffmpeg}/ffmpeg.decoders.json | 0 .../ffmpeg.decoders.subtitle.keys.json | 0 .../ffmpeg}/ffmpeg.decoders.video.keys.json | 0 .../ffmpeg}/ffmpeg.encoders.audio.keys.json | 0 .../object/ffmpeg}/ffmpeg.encoders.json | 0 .../ffmpeg.encoders.subtitle.keys.json | 0 .../ffmpeg}/ffmpeg.encoders.video.keys.json | 0 .../object/ffmpeg}/ffmpeg.filters.json | 0 .../object/ffmpeg}/ffmpeg.filters.keys.json | 0 .../object/ffmpeg}/ffmpeg.formats.json | 0 .../object/ffmpeg}/ffmpeg.formats.keys.json | 0 code/shared/source/object/ffmpeg/index.ts | 142 +++ code/shared/source/object/font/index.ts | 6 + .../image-magick.format.content.ts | 0 .../image-magick.format.input.json | 0 .../image-magick}/image-magick.format.json | 0 .../image-magick.format.output.json | 0 .../source/object/image-magick/index.ts | 745 ++++++++++++++ code/shared/source/object/index.ts | 16 + code/shared/source/object/inkscape/index.ts | 11 + .../source/object/libre-office/index.ts | 38 + code/shared/source/object/llvm/index.ts | 306 ++++++ .../object/llvm}/llvm.architecture.json | 0 .../data => source/object/llvm}/llvm.cpu.json | 0 .../object/llvm}/llvm.cpu.key.json | 0 .../object/llvm}/llvm.feature.json | 0 .../object/llvm}/llvm.feature.key.json | 0 code/shared/source/object/pandoc/index.ts | 208 ++++ code/shared/source/object/patool/index.ts | 40 + code/shared/source/object/puppeteer/index.ts | 26 + .../rubocop}/rubocop.config.airbnb.json | 0 .../rubocop}/rubocop.config.shopify.json | 0 .../data.ts => source/object/rust/index.ts} | 312 +----- code/shared/source/object/unarchiver/index.ts | 42 + code/shared/source/video.ts | 56 ++ code/shared/type/cast.ts | 86 +- code/shared/type/source/archive.ts | 201 ---- code/shared/type/source/call/convert.ts | 89 -- code/shared/type/source/code/index.ts | 3 - code/shared/type/source/document.ts | 733 -------------- code/shared/type/source/video.ts | 333 ------- code/shared/type/take.ts | 95 +- make/index.ts | 4 +- test/cli.sh | 8 +- 95 files changed, 2677 insertions(+), 2743 deletions(-) rename code/node/{call => action}/compile.ts (100%) rename code/node/{call => action}/convert.ts (100%) rename code/node/{call => action}/format.ts (100%) create mode 100644 code/shared/action/code/index.ts create mode 100644 code/shared/action/compile/code.ts create mode 100644 code/shared/action/convert/document/calibre.ts create mode 100644 code/shared/action/convert/document/libre-office.ts create mode 100644 code/shared/action/convert/document/pandoc.ts create mode 100644 code/shared/action/convert/document/pdflatex.ts create mode 100644 code/shared/action/convert/image/image-magick.ts create mode 100644 code/shared/action/convert/video/ffmpeg.ts create mode 100644 code/shared/source/action/archive/index.ts rename code/shared/{type/source => source/action/check}/file.ts (100%) rename code/shared/{type/source/code/compile.ts => source/action/compile/code.ts} (100%) create mode 100644 code/shared/source/action/convert/archive.ts create mode 100644 code/shared/source/action/convert/document/index.ts rename code/shared/{type/source/font.ts => source/action/convert/font/index.ts} (76%) create mode 100644 code/shared/source/action/convert/image/index.ts create mode 100644 code/shared/source/action/convert/video/index.ts create mode 100644 code/shared/source/action/extract/index.ts rename code/shared/{type/source/code/format.ts => source/action/format/code.ts} (100%) create mode 100644 code/shared/source/action/index.ts create mode 100644 code/shared/source/action/inspect/index.ts create mode 100644 code/shared/source/action/remove/metadata.ts create mode 100644 code/shared/source/action/sanitize/code.ts create mode 100644 code/shared/source/action/slice/document.ts create mode 100644 code/shared/source/action/validate/document.ts create mode 100644 code/shared/source/action/verify/image.ts create mode 100644 code/shared/source/image.ts rename code/shared/{type => }/source/index.ts (94%) create mode 100644 code/shared/source/object/archive/index.ts create mode 100644 code/shared/source/object/assembly/index.ts create mode 100644 code/shared/source/object/calibre/index.ts rename code/shared/{type/source/code.ts => source/object/clang-format/index.ts} (61%) rename code/shared/{type/source/data => source/object/clang-format}/style.all.type.json (100%) rename code/shared/{type/source/data => source/object/clang-format}/style.cpp.type.json (100%) rename code/shared/{type/source/data => source/object/clang-format}/style.java.type.json (100%) rename code/shared/{type/source/data => source/object/clang-format}/style.javascript.type.json (100%) rename code/shared/{type/source/data => source/object/clang-format}/style.objc.type.json (100%) rename code/shared/{type/source/data => source/object/exiftool}/exiftool.tag.json (100%) rename code/shared/{type/source/image.ts => source/object/exiftool/index.ts} (59%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.codecs.audio.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.codecs.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.codecs.subtitle.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.codecs.video.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.decoders.audio.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.decoders.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.decoders.subtitle.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.decoders.video.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.encoders.audio.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.encoders.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.encoders.subtitle.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.encoders.video.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.filters.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.filters.keys.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.formats.json (100%) rename code/shared/{type/source/data => source/object/ffmpeg}/ffmpeg.formats.keys.json (100%) create mode 100644 code/shared/source/object/ffmpeg/index.ts create mode 100644 code/shared/source/object/font/index.ts rename code/shared/{type/source/data => source/object/image-magick}/image-magick.format.content.ts (100%) rename code/shared/{type/source/data => source/object/image-magick}/image-magick.format.input.json (100%) rename code/shared/{type/source/data => source/object/image-magick}/image-magick.format.json (100%) rename code/shared/{type/source/data => source/object/image-magick}/image-magick.format.output.json (100%) create mode 100644 code/shared/source/object/image-magick/index.ts create mode 100644 code/shared/source/object/index.ts create mode 100644 code/shared/source/object/inkscape/index.ts create mode 100644 code/shared/source/object/libre-office/index.ts create mode 100644 code/shared/source/object/llvm/index.ts rename code/shared/{type/source/data => source/object/llvm}/llvm.architecture.json (100%) rename code/shared/{type/source/data => source/object/llvm}/llvm.cpu.json (100%) rename code/shared/{type/source/data => source/object/llvm}/llvm.cpu.key.json (100%) rename code/shared/{type/source/data => source/object/llvm}/llvm.feature.json (100%) rename code/shared/{type/source/data => source/object/llvm}/llvm.feature.key.json (100%) create mode 100644 code/shared/source/object/pandoc/index.ts create mode 100644 code/shared/source/object/patool/index.ts create mode 100644 code/shared/source/object/puppeteer/index.ts rename code/shared/{type/source/data => source/object/rubocop}/rubocop.config.airbnb.json (100%) rename code/shared/{type/source/data => source/object/rubocop}/rubocop.config.shopify.json (100%) rename code/shared/{type/source/code/data.ts => source/object/rust/index.ts} (51%) create mode 100644 code/shared/source/object/unarchiver/index.ts create mode 100644 code/shared/source/video.ts delete mode 100644 code/shared/type/source/archive.ts delete mode 100644 code/shared/type/source/call/convert.ts delete mode 100644 code/shared/type/source/code/index.ts delete mode 100644 code/shared/type/source/document.ts delete mode 100644 code/shared/type/source/video.ts diff --git a/code/cli/task.ts b/code/cli/task.ts index c362f83..39b1224 100644 --- a/code/cli/task.ts +++ b/code/cli/task.ts @@ -19,7 +19,7 @@ import { convert_font_with_font_forge, convert_image_with_image_magick, convert_video_with_ffmpeg, -} from '../shared/type/source/index.js' +} from '../shared/source/index.js' import { Form } from '@termsurf/form' import { FormatRustModel, @@ -43,7 +43,7 @@ import { useConvertFontWithFontForge, useConvertImageWithImageMagick, useConvertVideoWithFfmpeg, -} from '../node/call/convert.js' +} from '../node/action/convert.js' import { logOutput, logOutputError, @@ -58,7 +58,7 @@ import { } from './parse.js' import { formatRust } from '../node/code.js' import { inspectSystem } from '../node/system.js' -import { compile, compileInternal } from '../node/call/compile.js' +import { compile, compileInternal } from '../node/action/compile.js' export const CONVERT_KEY: Record = { i: { line: ['input', 'file', 'path'] }, diff --git a/code/node/call/compile.ts b/code/node/action/compile.ts similarity index 100% rename from code/node/call/compile.ts rename to code/node/action/compile.ts diff --git a/code/node/call/convert.ts b/code/node/action/convert.ts similarity index 100% rename from code/node/call/convert.ts rename to code/node/action/convert.ts diff --git a/code/node/call/format.ts b/code/node/action/format.ts similarity index 100% rename from code/node/call/format.ts rename to code/node/action/format.ts diff --git a/code/node/index.ts b/code/node/index.ts index edf7241..85e74ab 100644 --- a/code/node/index.ts +++ b/code/node/index.ts @@ -9,4 +9,4 @@ export * from './archive.js' export * from './font.js' export * from './net.js' -export * from './call/convert.js' +export * from './action/convert.js' diff --git a/code/shared/action/code/index.ts b/code/shared/action/code/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/compile/code.ts b/code/shared/action/compile/code.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/convert/document/calibre.ts b/code/shared/action/convert/document/calibre.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/convert/document/libre-office.ts b/code/shared/action/convert/document/libre-office.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/convert/document/pandoc.ts b/code/shared/action/convert/document/pandoc.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/convert/document/pdflatex.ts b/code/shared/action/convert/document/pdflatex.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/convert/image/image-magick.ts b/code/shared/action/convert/image/image-magick.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/action/convert/video/ffmpeg.ts b/code/shared/action/convert/video/ffmpeg.ts new file mode 100644 index 0000000..e69de29 diff --git a/code/shared/archive.ts b/code/shared/archive.ts index 02b632b..430b227 100644 --- a/code/shared/archive.ts +++ b/code/shared/archive.ts @@ -1,7 +1,7 @@ import { getCommand } from '../shared/index.js' import { ArchiveWithRar, - CompressWithZip, + ArchiveWithZip, ConvertArchive, DecompressWith7Z, DecompressWithUnarchiver, @@ -34,11 +34,11 @@ export function buildCommandToConvertArchive(input: ConvertArchive) { } return [ ...buildCommandToDecompressWithUnarchiver(decompressInput), - ...buildCommandToCompressWithZip(compressInput), + ...buildCommandToArchiveWithZip(compressInput), ] } -export function buildCommandToCompressWithZip(input: CompressWithZip) { +export function buildCommandToArchiveWithZip(input: ArchiveWithZip) { const cmd = getCommand(`zip`) cmd.list.push('-r', input.output.file.path, input.input.path) return [cmd] diff --git a/code/shared/document.ts b/code/shared/document.ts index 1137ddc..2cb327b 100644 --- a/code/shared/document.ts +++ b/code/shared/document.ts @@ -8,14 +8,12 @@ import { ConvertDocumentWithPandoc, SanitizeHtmlFromContentModel, ConvertLatexToPdfWithPdfLatex, - CheckIfPdfIsValidWithData, + ValidatePdfWithData, SlicePdfWithData, } from './type/index.js' import { getCommand } from './command.js' -export async function checkIfPdfIsValidWithData( - input: CheckIfPdfIsValidWithData, -) { +export async function validatePdfWithData(input: ValidatePdfWithData) { try { await PDFDocument.load(input.input.file.data as ArrayBuffer) return true diff --git a/code/shared/image.ts b/code/shared/image.ts index aeaa9a4..673246d 100644 --- a/code/shared/image.ts +++ b/code/shared/image.ts @@ -5,10 +5,9 @@ import { IMAGE_MAGICK_COLOR_SPACE_CONTENT, IMAGE_MAGICK_COMPRESSION_CONTENT, ConvertImageWithImageMagick, - ExtractMetadataFromImage, + InspectMetadataFromImage, WriteMetadataToImage, RemoveImageMetadata, - GenerateGifWithGifsicle, } from './type/index.js' import { getCommand } from './command.js' import _ from 'lodash' @@ -99,8 +98,8 @@ export function buildCommandToConvertImageWithImageMagick( return [cmd] } -export function buildCommandToExtractMetadataFromImage( - input: ExtractMetadataFromImage, +export function buildCommandToInspectMetadataFromImage( + input: InspectMetadataFromImage, ) { const cmd = getCommand('exiftool') cmd.list.push(`"${input.input.file.path}"`) @@ -239,9 +238,7 @@ export function buildCommandToRemoveImageMetadata( // return [cmd] // } -export function buildCommandToGenerateGifWithGifsicle( - input: GenerateGifWithGifsicle, -) { +export function buildCommandToGenerateGifWithGifsicle(input) { const cmd = getCommand('gifsicle') if (input.unoptimize) { diff --git a/code/shared/source/action/archive/index.ts b/code/shared/source/action/archive/index.ts new file mode 100644 index 0000000..5dbcc6a --- /dev/null +++ b/code/shared/source/action/archive/index.ts @@ -0,0 +1,40 @@ +import { Form } from '@termsurf/form' + +export const archive_with_rar: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + path: { like: 'string' }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { path: { like: 'string' } }, + }, + }, + }, + }, +} + +export const archive_with_zip: Form = { + form: 'form', + link: { + input: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { path: { like: 'string', name: { mark: 'o' } } }, + }, + }, + }, + }, +} diff --git a/code/shared/type/source/file.ts b/code/shared/source/action/check/file.ts similarity index 100% rename from code/shared/type/source/file.ts rename to code/shared/source/action/check/file.ts diff --git a/code/shared/type/source/code/compile.ts b/code/shared/source/action/compile/code.ts similarity index 100% rename from code/shared/type/source/code/compile.ts rename to code/shared/source/action/compile/code.ts diff --git a/code/shared/source/action/convert/archive.ts b/code/shared/source/action/convert/archive.ts new file mode 100644 index 0000000..38ad4d1 --- /dev/null +++ b/code/shared/source/action/convert/archive.ts @@ -0,0 +1,32 @@ +import { Form } from '@termsurf/form' + +export const convert_archive: Form = { + form: 'form', + link: { + temporary: { + link: { + directory: { + link: { + path: { like: 'string', name: { mark: 'm' } }, + }, + }, + }, + }, + input: { + link: { + format: { like: 'unarchiver_format', name: { mark: 'I' } }, + file: { + link: { path: { like: 'string' } }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { path: { like: 'string' } }, + }, + }, + }, + }, +} diff --git a/code/shared/source/action/convert/document/index.ts b/code/shared/source/action/convert/document/index.ts new file mode 100644 index 0000000..cb59f4b --- /dev/null +++ b/code/shared/source/action/convert/document/index.ts @@ -0,0 +1,212 @@ +import { Form } from '@termsurf/form' + +export const convert_document_with_jupyter: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + format: { like: 'string' }, + }, + }, + }, + }, + }, +} + +export const convert_document_with_libre_office: Form = { + form: 'form', + link: { + input: { + link: { + format: { + like: 'libre_office_input_format', + name: { mark: 'I' }, + }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + format: { + like: 'libre_office_output_format', + name: { mark: 'O' }, + }, + directory: { + link: { + path: { like: 'string', name: { mark: 'b' } }, + }, + }, + }, + }, + }, +} + +export const convert_latex_to_pdf_with_pdf_latex: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + output: { + link: { + directory: { + link: { + path: { like: 'string' }, + }, + }, + file: { + link: { + name: { like: 'string' }, + }, + }, + }, + }, + }, +} + +export const convert_document_with_calibre: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'calibre_input_format', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'calibre_output_format', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + }, + }, + }, +} + +export const convert_html_to_pdf_with_puppeteer: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + viewport: { + link: { + width: { like: 'natural_number', need: false }, + height: { like: 'natural_number', need: false }, + }, + }, + proxy: { like: 'string', need: false }, + waitUntil: { like: 'puppeteer_life_cycle_event', need: false }, + }, +} + +export const convert_html_to_png_with_puppeteer: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + viewport: { + link: { + width: { like: 'natural_number', need: false }, + height: { like: 'natural_number', need: false }, + }, + }, + proxy: { like: 'string', need: false }, + waitUntil: { like: 'puppeteer_life_cycle_event', need: false }, + }, +} + +export const convert_document_with_pandoc: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'pandoc_input_format', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + format: { + like: 'pandoc_output_format', + name: { mark: 'O' }, + }, + }, + }, + }, +} diff --git a/code/shared/type/source/font.ts b/code/shared/source/action/convert/font/index.ts similarity index 76% rename from code/shared/type/source/font.ts rename to code/shared/source/action/convert/font/index.ts index 9759f3e..bc9cab4 100644 --- a/code/shared/type/source/font.ts +++ b/code/shared/source/action/convert/font/index.ts @@ -1,9 +1,4 @@ -import { Form, List } from '@termsurf/form' - -export const font_format: List = { - form: 'list', - list: ['ttf', 'otf', 'woff2', 'woff', 'svg', 'eot', 'bmp'], -} +import { Form } from '@termsurf/form' export const convert_font_with_font_forge: Form = { form: 'form', diff --git a/code/shared/source/action/convert/image/index.ts b/code/shared/source/action/convert/image/index.ts new file mode 100644 index 0000000..3636c0d --- /dev/null +++ b/code/shared/source/action/convert/image/index.ts @@ -0,0 +1,61 @@ +import { Form } from '@termsurf/form' + +export const convert_image_with_image_magick: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + }, + }, + colorCount: { like: 'natural_number', need: false }, + colorMatrix: { + like: 'image_magic_color_matrix', + test: 'test_image_magic_color_matrix', + need: false, + }, + colorSpace: { like: 'image_magick_color_space', need: false }, + compare: { like: 'boolean', need: false }, + compression: { like: 'image_magick_compression', need: false }, + }, +} + +export const convert_ai_to_svg_with_inkscape: Form = { + form: 'form', + link: { + input: { + link: { + file: { + link: { + path: { like: 'string', need: false }, + }, + }, + }, + }, + output: { + link: { + file: { + link: { + path: { like: 'string' }, + format: { like: 'string' }, + }, + }, + }, + }, + }, +} diff --git a/code/shared/source/action/convert/video/index.ts b/code/shared/source/action/convert/video/index.ts new file mode 100644 index 0000000..9ec7bab --- /dev/null +++ b/code/shared/source/action/convert/video/index.ts @@ -0,0 +1,137 @@ +import { Form } from '@termsurf/form' + +export const convert_video_to_audio_with_ffmpeg: Form = { + form: 'form', + link: { + inputPath: { like: 'string' }, + outputPath: { like: 'string' }, + }, +} + +export const convert_video_with_ffmpeg_base: Form = { + form: 'form', + link: { + audioCodec: { like: 'ffmpeg_codec_audio', need: false }, + videoCodec: { like: 'ffmpeg_codec_video', need: false }, + audioBitRate: { like: 'integer', need: false }, + videoBitRate: { like: 'integer', need: false }, + frameRate: { like: 'integer', need: false }, + startTime: { + need: false, + case: [ + { like: 'integer', test: 'test_time_integer' }, + { like: 'string', test: 'test_time_string' }, + ], + }, + endTime: { + need: false, + case: [ + { like: 'integer', test: 'test_time_integer' }, + { like: 'string', test: 'test_time_string' }, + ], + }, + strict: { + like: 'ffmpeg_strict_option', + fall: 'strict', + need: false, + }, + overwrite: { + like: 'boolean', + need: false, + fall: false, + name: { mark: 'f' }, + }, + progress: { + like: 'boolean', + need: false, + fall: false, + name: { mark: 'p' }, + }, + scaleWidth: { like: 'integer', need: false }, + scaleHeight: { like: 'integer', need: false }, + audioChannels: { like: 'integer', need: false }, + audioSamplingFrequency: { like: 'integer', need: false }, + subtitleCodec: { like: 'ffmpeg_codec_subtitle', need: false }, + duration: { + need: false, + case: [ + { like: 'integer', test: 'test_time_integer' }, + { like: 'string', test: 'test_time_string' }, + ], + }, + rotation: { like: 'decimal', need: false }, + }, +} + +export const convert_video_with_ffmpeg: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + }, + }, + ...convert_video_with_ffmpeg_base.link, + }, +} + +export const convert_mp4_to_gif_with_ffmpeg: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + }, + }, + fps: { like: 'integer' }, + width: { like: 'integer' }, + startTime: { + case: [ + { like: 'integer', test: 'test_time_integer' }, + { like: 'string', test: 'test_time_string' }, + ], + }, + endTime: { + case: [ + { like: 'integer', test: 'test_time_integer' }, + { like: 'string', test: 'test_time_string' }, + ], + }, + duration: { + case: [ + { like: 'integer', test: 'test_time_integer' }, + { like: 'string', test: 'test_time_string' }, + ], + }, + }, +} diff --git a/code/shared/source/action/extract/index.ts b/code/shared/source/action/extract/index.ts new file mode 100644 index 0000000..7a51dff --- /dev/null +++ b/code/shared/source/action/extract/index.ts @@ -0,0 +1,46 @@ +import { Form } from '@termsurf/form' + +export const decompress_with_7z: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + path: { like: 'string' }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { path: { like: 'string' } }, + }, + }, + }, + }, +} + +export const decompress_with_unarchiver: Form = { + form: 'form', + link: { + output: { + link: { + overwrite: { like: 'boolean', fall: false, need: false }, + directory: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + input: { + link: { + password: { like: 'string', need: false }, + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { path: { like: 'string' } }, + }, + }, + }, + }, +} diff --git a/code/shared/type/source/code/format.ts b/code/shared/source/action/format/code.ts similarity index 100% rename from code/shared/type/source/code/format.ts rename to code/shared/source/action/format/code.ts diff --git a/code/shared/source/action/index.ts b/code/shared/source/action/index.ts new file mode 100644 index 0000000..0311421 --- /dev/null +++ b/code/shared/source/action/index.ts @@ -0,0 +1,16 @@ +export * from './compile/code.js' +export * from './archive/index.js' +export * from './extract/index.js' +export * from './convert/archive.js' +export * from './slice/document.js' +export * from './validate/document.js' +export * from './check/file.js' +export * from './convert/font/index.js' +export * from './convert/document/index.js' +export * from './convert/image/index.js' +export * from './remove/metadata.js' +export * from './inspect/index.js' +export * from './verify/image.js' +export * from './format/code.js' +export * from './sanitize/code.js' +export * from './convert/video/index.js' diff --git a/code/shared/source/action/inspect/index.ts b/code/shared/source/action/inspect/index.ts new file mode 100644 index 0000000..86148e6 --- /dev/null +++ b/code/shared/source/action/inspect/index.ts @@ -0,0 +1,27 @@ +import { Form } from '@termsurf/form' + +export const inspect_metadata_from_image: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + copyright: { like: 'string', need: false }, + creator: { like: 'string', need: false }, + license: { like: 'string', need: false }, + keywords: { like: 'string', list: true, need: false }, + artist: { like: 'string', need: false }, + originalDate: { like: 'date', need: false }, + allDates: { like: 'date', need: false }, + creationDate: { like: 'date', need: false }, + title: { like: 'string', need: false }, + description: { like: 'string', need: false }, + }, +} diff --git a/code/shared/source/action/remove/metadata.ts b/code/shared/source/action/remove/metadata.ts new file mode 100644 index 0000000..be802c2 --- /dev/null +++ b/code/shared/source/action/remove/metadata.ts @@ -0,0 +1,17 @@ +import { Form } from '@termsurf/form' + +export const remove_image_metadata: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + }, +} diff --git a/code/shared/source/action/sanitize/code.ts b/code/shared/source/action/sanitize/code.ts new file mode 100644 index 0000000..11aac52 --- /dev/null +++ b/code/shared/source/action/sanitize/code.ts @@ -0,0 +1,13 @@ +import { Form } from '@termsurf/form' + +export const sanitize_html_from_content: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + content: { like: 'string' }, + }, + }, + }, +} diff --git a/code/shared/source/action/slice/document.ts b/code/shared/source/action/slice/document.ts new file mode 100644 index 0000000..5153f0f --- /dev/null +++ b/code/shared/source/action/slice/document.ts @@ -0,0 +1,46 @@ +import { Form } from '@termsurf/form' + +export const slice_pdf_with_data: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + data: { like: 'ArrayBuffer' }, + }, + }, + }, + }, + startPage: { like: 'natural_number' }, + endPage: { like: 'natural_number' }, + }, +} + +export const slice_pdf: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + startPage: { like: 'natural_number', name: { mark: 'S' } }, + endPage: { like: 'natural_number', name: { mark: 'E' } }, + output: { + link: { + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + }, + }, + }, +} diff --git a/code/shared/source/action/validate/document.ts b/code/shared/source/action/validate/document.ts new file mode 100644 index 0000000..ec4f142 --- /dev/null +++ b/code/shared/source/action/validate/document.ts @@ -0,0 +1,17 @@ +import { Form } from '@termsurf/form' + +export const validate_pdf_with_data: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + data: { like: 'ArrayBuffer' }, + }, + }, + }, + }, + }, +} diff --git a/code/shared/source/action/verify/image.ts b/code/shared/source/action/verify/image.ts new file mode 100644 index 0000000..71d549c --- /dev/null +++ b/code/shared/source/action/verify/image.ts @@ -0,0 +1,17 @@ +import { Form } from '@termsurf/form' + +export const verify_image_with_image_magick: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'image_magick_format' }, + file: { + link: { + path: { like: 'string' }, + }, + }, + }, + }, + }, +} diff --git a/code/shared/source/image.ts b/code/shared/source/image.ts new file mode 100644 index 0000000..af1e79c --- /dev/null +++ b/code/shared/source/image.ts @@ -0,0 +1,52 @@ +// https://github.com/dlemstra/magick-wasm/tree/dcd3709394b90ea18fd03c50caa6694f2be92a99/src/enums + +import { Form } from '@termsurf/form' + +export const replace_image_color_with_image_magick: Form = { + form: 'form', + link: { + inputPath: { like: 'string' }, + outputPath: { like: 'string' }, + startColor: { like: 'string' }, + endColor: { like: 'string' }, + fuzz: { like: 'decimal' }, + }, +} + +export const resize_image_with_image_magick: Form = { + form: 'form', + link: { + inputPath: { like: 'string' }, + outputPath: { like: 'string' }, + width: { like: 'integer' }, + height: { like: 'integer' }, + stretch: { like: 'boolean' }, + gravity: { like: 'image_magick_gravity' }, + }, +} + +export const write_metadata_to_image: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + copyright: { like: 'string', need: false }, + creator: { like: 'string', need: false }, + license: { like: 'string', need: false }, + keywords: { like: 'string', list: true, need: false }, + artist: { like: 'string', need: false }, + originalDate: { like: 'date', need: false }, + allDates: { like: 'date', need: false }, + creationDate: { like: 'date', need: false }, + title: { like: 'string', need: false }, + description: { like: 'string', need: false }, + }, +} diff --git a/code/shared/type/source/index.ts b/code/shared/source/index.ts similarity index 94% rename from code/shared/type/source/index.ts rename to code/shared/source/index.ts index 8e6231d..6acf226 100644 --- a/code/shared/type/source/index.ts +++ b/code/shared/source/index.ts @@ -1,14 +1,11 @@ import { Form, List } from '@termsurf/form' -export * from './document.js' -export * from './code.js' -export * from './code/index.js' -export * from './font.js' +export * from './action/index.js' +export * from './object/index.js' + export * from './image.js' export * from './video.js' -export * from './archive.js' -export * from './file.js' -export * from '../code.js' +export * from '../type/code.js' export const build_format_input_output: Form = { form: 'form', diff --git a/code/shared/source/object/archive/index.ts b/code/shared/source/object/archive/index.ts new file mode 100644 index 0000000..9d5eab7 --- /dev/null +++ b/code/shared/source/object/archive/index.ts @@ -0,0 +1,6 @@ +import { Form, Hash, List } from '@termsurf/form' + +export const archive_format: List = { + form: 'list', + list: ['zip'], +} diff --git a/code/shared/source/object/assembly/index.ts b/code/shared/source/object/assembly/index.ts new file mode 100644 index 0000000..b45a305 --- /dev/null +++ b/code/shared/source/object/assembly/index.ts @@ -0,0 +1,6 @@ +import { List } from '@termsurf/form' + +export const assembly_syntax: List = { + form: 'list', + list: ['intel', 'att'], +} diff --git a/code/shared/source/object/calibre/index.ts b/code/shared/source/object/calibre/index.ts new file mode 100644 index 0000000..fd3d681 --- /dev/null +++ b/code/shared/source/object/calibre/index.ts @@ -0,0 +1,180 @@ +import { Hash, List } from '@termsurf/form' + +export const calibre_input_format: List = { + form: 'list', + list: [ + 'azw4', + 'chm', + 'comic', + 'djvu', + 'docx', + 'epub', + 'fb2', + 'htlz', + 'html', + 'lit', + 'lrf', + 'mobi', + 'odt', + 'pdb', + 'pdf', + 'pml', + 'rb', + 'rtf', + 'recipe', + 'snb', + 'tcr', + 'txt', + ], +} + +export const calibre_input_format_content: Hash = { + form: 'hash', + link: 'calibre_input_format', + bond: { + head: { like: 'string' }, + }, + hash: { + azw4: { head: 'AZW4' }, + chm: { head: 'CHM' }, + comic: { head: 'Comic' }, + djvu: { head: 'DJVU' }, + docx: { head: 'DOCX' }, + epub: { head: 'EPUB' }, + fb2: { head: 'FB2' }, + htlz: { head: 'HTLZ' }, + html: { head: 'HTML' }, + lit: { head: 'LIT' }, + lrf: { head: 'LRF' }, + mobi: { head: 'MOBI' }, + odt: { head: 'ODT' }, + pdb: { head: 'PDB' }, + pdf: { head: 'PDF' }, + pml: { head: 'PML' }, + rb: { head: 'RB' }, + rtf: { head: 'RTF' }, + recipe: { head: 'Recipe' }, + snb: { head: 'SNB' }, + tcr: { head: 'TCR' }, + txt: { head: 'TXT' }, + }, +} + +export const calibre_output_format: List = { + form: 'list', + list: [ + 'azw3', + 'docx', + 'epub', + 'fb2', + 'html', + 'htmlz', + 'lit', + 'lrf', + 'mobi', + 'oeb', + 'pdb', + 'pdf', + 'pml', + 'rb', + 'rtf', + 'snb', + 'tcr', + 'txt', + 'txtz', + ], +} + +export const calibre_output_format_content: Hash = { + form: 'hash', + link: 'calibre_output_format', + bond: { + head: { like: 'string' }, + }, + hash: { + azw3: { head: 'AZW3' }, + docx: { head: 'DOCX' }, + epub: { head: 'EPUB' }, + fb2: { head: 'FB2' }, + html: { head: 'HTML' }, + htmlz: { head: 'HTMLZ' }, + lit: { head: 'LIT' }, + lrf: { head: 'LRF' }, + mobi: { head: 'MOBI' }, + oeb: { head: 'OEB' }, + pdb: { head: 'PDB' }, + pdf: { head: 'PDF' }, + pml: { head: 'PML' }, + rb: { head: 'RB' }, + rtf: { head: 'RTF' }, + snb: { head: 'SNB' }, + tcr: { head: 'TCR' }, + txt: { head: 'TXT' }, + txtz: { head: 'TXTZ' }, + }, +} + +export const calibre_input_profile: List = { + form: 'list', + list: [ + 'cybookg3', + 'cybook_opus', + 'default', + 'hanlinv3', + 'hanlinv5', + 'illiad', + 'irexdr1000', + 'irexdr800', + 'kindle', + 'msreader', + 'mobipocket', + 'nook', + 'sony', + 'sony300', + 'sony900', + ], +} + +export const calibre_output_profile: List = { + form: 'list', + list: [ + 'cybookg3', + 'cybook_opus', + 'default', + 'generic_eink', + 'generic_eink_hd', + 'generic_eink_large', + 'hanlinv3', + 'hanlinv5', + 'illiad', + 'ipad', + 'ipad3', + 'irexdr1000', + 'irexdr800', + 'jetbook5', + 'kindle', + 'kindle_dx', + 'kindle_fire', + 'kindle_oasis', + 'kindle_pw', + 'kindle_pw3', + 'kindle_voyage', + 'kobo', + 'msreader', + 'mobipocket', + 'nook', + 'nook_color', + 'nook_hd_plus', + 'pocketbook_900', + 'pocketbook_pro_912', + 'galaxy', + 'sony', + 'sony300', + 'sony900', + 'sony-landscape', + 'sonyt3', + 'tablet', + ], +} + +// https://manpages.ubuntu.com/manpages/bionic/man1/ebook-convert.1.html diff --git a/code/shared/type/source/code.ts b/code/shared/source/object/clang-format/index.ts similarity index 61% rename from code/shared/type/source/code.ts rename to code/shared/source/object/clang-format/index.ts index 799b823..2c26b0d 100644 --- a/code/shared/type/source/code.ts +++ b/code/shared/source/object/clang-format/index.ts @@ -1,8 +1,8 @@ -import STYLE_CPP from './data/style.cpp.type.json' assert { type: 'json' } -import STYLE_JAVA from './data/style.java.type.json' assert { type: 'json' } -import STYLE_JAVASCRIPT from './data/style.javascript.type.json' assert { type: 'json' } -import STYLE_OBJC from './data/style.objc.type.json' assert { type: 'json' } -import STYLE_ALL from './data/style.all.type.json' assert { type: 'json' } +import STYLE_CPP from './style.cpp.type.json' assert { type: 'json' } +import STYLE_JAVA from './style.java.type.json' assert { type: 'json' } +import STYLE_JAVASCRIPT from './style.javascript.type.json' assert { type: 'json' } +import STYLE_OBJC from './style.objc.type.json' assert { type: 'json' } +import STYLE_ALL from './style.all.type.json' assert { type: 'json' } import { Form } from '@termsurf/form' export const clang_style_all: Form = { diff --git a/code/shared/type/source/data/style.all.type.json b/code/shared/source/object/clang-format/style.all.type.json similarity index 100% rename from code/shared/type/source/data/style.all.type.json rename to code/shared/source/object/clang-format/style.all.type.json diff --git a/code/shared/type/source/data/style.cpp.type.json b/code/shared/source/object/clang-format/style.cpp.type.json similarity index 100% rename from code/shared/type/source/data/style.cpp.type.json rename to code/shared/source/object/clang-format/style.cpp.type.json diff --git a/code/shared/type/source/data/style.java.type.json b/code/shared/source/object/clang-format/style.java.type.json similarity index 100% rename from code/shared/type/source/data/style.java.type.json rename to code/shared/source/object/clang-format/style.java.type.json diff --git a/code/shared/type/source/data/style.javascript.type.json b/code/shared/source/object/clang-format/style.javascript.type.json similarity index 100% rename from code/shared/type/source/data/style.javascript.type.json rename to code/shared/source/object/clang-format/style.javascript.type.json diff --git a/code/shared/type/source/data/style.objc.type.json b/code/shared/source/object/clang-format/style.objc.type.json similarity index 100% rename from code/shared/type/source/data/style.objc.type.json rename to code/shared/source/object/clang-format/style.objc.type.json diff --git a/code/shared/type/source/data/exiftool.tag.json b/code/shared/source/object/exiftool/exiftool.tag.json similarity index 100% rename from code/shared/type/source/data/exiftool.tag.json rename to code/shared/source/object/exiftool/exiftool.tag.json diff --git a/code/shared/type/source/image.ts b/code/shared/source/object/exiftool/index.ts similarity index 59% rename from code/shared/type/source/image.ts rename to code/shared/source/object/exiftool/index.ts index b4cfc36..06d473d 100644 --- a/code/shared/type/source/image.ts +++ b/code/shared/source/object/exiftool/index.ts @@ -1,876 +1,5 @@ -// https://github.com/dlemstra/magick-wasm/tree/dcd3709394b90ea18fd03c50caa6694f2be92a99/src/enums -import EXIFTOOL_TAG from './data/exiftool.tag.json' assert { type: 'json' } -import IMAGE_MAGICK_FORMAT from './data/image-magick.format.json' assert { type: 'json' } -import IMAGE_MAGICK_INPUT_FORMAT from './data/image-magick.format.input.json' assert { type: 'json' } -import IMAGE_MAGICK_OUTPUT_FORMAT from './data/image-magick.format.output.json' assert { type: 'json' } -import { Form, Hash, List } from '@termsurf/form' - -export const image_magick_input_format: List = { - form: 'list', - list: IMAGE_MAGICK_INPUT_FORMAT, -} - -export const image_magick_output_format: List = { - form: 'list', - list: IMAGE_MAGICK_OUTPUT_FORMAT, -} - -export const image_magick_format: List = { - form: 'list', - list: [ - '3fr', - '3g2', - '3gp', - 'aai', - 'ai', - 'apng', - 'art', - 'arw', - 'ashlar', - 'avi', - 'avif', - 'avs', - 'bayer', - 'bayera', - 'bgr', - 'bgra', - 'bgro', - 'bmp', - 'bmp2', - 'bmp3', - 'brf', - 'cal', - 'cals', - 'canvas', - 'caption', - 'cin', - 'cip', - 'clip', - 'cmyk', - 'cmyka', - 'cr2', - 'cr3', - 'crw', - 'cube', - 'cur', - 'cut', - 'data', - 'dcm', - 'dcr', - 'dcraw', - 'dcx', - 'dds', - 'dfont', - 'dng', - 'dpx', - 'dot', - 'dxt1', - 'dxt5', - 'epdf', - 'epi', - 'eps', - 'eps2', - 'eps3', - 'epsf', - 'epsi', - 'ept', - 'ept2', - 'ept3', - 'erf', - 'exr', - 'farbfeld', - 'fax', - 'ff', - 'file', - 'fits', - 'fl32', - 'flv', - 'fractal', - 'ftp', - 'ftxt', - 'fts', - 'g3', - 'g4', - 'gif', - 'gif87', - 'gradient', - 'gray', - 'graya', - 'group4', - 'hald', - 'hdr', - 'heic', - 'heif', - 'histogram', - 'hrz', - 'htm', - 'html', - 'http', - 'https', - 'icb', - 'ico', - 'icon', - 'iiq', - 'info', - 'inline', - 'ipl', - 'isobrl', - 'isobrl6', - 'j2c', - 'j2k', - 'jng', - 'jnx', - 'jp2', - 'jpc', - 'jpe', - 'jpeg', - 'jpg', - 'jpm', - 'jps', - 'jpt', - 'json', - 'jxl', - 'k25', - 'kdc', - 'label', - 'm2v', - 'm4v', - 'mac', - 'map', - 'mask', - 'mat', - 'matte', - 'mef', - 'miff', - 'mkv', - 'mng', - 'mono', - 'mov', - 'mp4', - 'mpc', - 'mpeg', - 'mpg', - 'mpo', - 'mrw', - 'msl', - 'msvg', - 'mtv', - 'mvg', - 'nef', - 'nrw', - 'null', - 'ora', - 'orf', - 'otb', - 'otf', - 'pal', - 'palm', - 'pam', - 'pango', - 'pattern', - 'pbm', - 'pcd', - 'pcds', - 'pcl', - 'pct', - 'pcx', - 'pdb', - 'pdf', - 'pdfa', - 'pef', - 'pes', - 'pfa', - 'pfb', - 'pfm', - 'pgm', - 'pgx', - 'phm', - 'picon', - 'pict', - 'pix', - 'pjpeg', - 'plasma', - 'png', - 'png00', - 'png24', - 'png32', - 'png48', - 'png64', - 'png8', - 'pnm', - 'ppm', - 'ps', - 'ps2', - 'ps3', - 'psb', - 'psd', - 'ptif', - 'pwp', - 'qoi', - 'raf', - 'ras', - 'raw', - 'rgb', - 'rgb565', - 'rgba', - 'rgbo', - 'rgf', - 'rla', - 'rle', - 'rmf', - 'rw2', - 'scr', - 'sct', - 'sfw', - 'sgi', - 'shtml', - 'six', - 'sixel', - 'sr2', - 'srf', - 'stegano', - 'strimg', - 'sun', - 'svg', - 'svgz', - 'text', - 'tga', - 'thumbnail', - 'tiff', - 'tiff64', - 'tile', - 'tim', - 'tm2', - 'ttc', - 'ttf', - 'txt', - 'ubrl', - 'ubrl6', - 'uil', - 'uyvy', - 'vda', - 'vicar', - 'vid', - 'viff', - 'vips', - 'vst', - 'wbmp', - 'webp', - 'webm', - 'wmv', - 'wpg', - 'x3f', - 'xbm', - 'xc', - 'xcf', - 'xpm', - 'xps', - 'xv', - 'yaml', - 'ycbcr', - 'ycbcra', - 'yuv', - ], -} - -export const image_magick_format_content: Hash = { - form: 'hash', - link: 'image_magick_format', - bond: { - head: { like: 'string' }, - note: { like: 'string', need: false }, - read: { like: 'boolean', need: false }, - write: { like: 'boolean', need: false }, - multiple: { like: 'boolean', need: false }, - supportsBlob: { like: 'boolean', need: false }, - }, - hash: IMAGE_MAGICK_FORMAT, -} - -export const image_magick_gravity: List = { - form: 'list', - list: [ - 'forget', - 'northwest', - 'north', - 'northeast', - 'west', - 'center', - 'east', - 'southwest', - 'south', - 'southeast', - ], -} - -export const replace_image_color_with_image_magick: Form = { - form: 'form', - link: { - inputPath: { like: 'string' }, - outputPath: { like: 'string' }, - startColor: { like: 'string' }, - endColor: { like: 'string' }, - fuzz: { like: 'decimal' }, - }, -} - -export const resize_image_with_image_magick: Form = { - form: 'form', - link: { - inputPath: { like: 'string' }, - outputPath: { like: 'string' }, - width: { like: 'integer' }, - height: { like: 'integer' }, - stretch: { like: 'boolean' }, - gravity: { like: 'image_magick_gravity' }, - }, -} - -export const image_magick_channel: List = { - form: 'list', - list: [ - 'red', - 'green', - 'blue', - 'alpha', - 'gray', - 'cyan', - 'magenta', - 'yellow', - 'black', - 'opacity', - 'index', - 'rgb', - 'rgba', - 'cmyk', - 'cmyka', - ], -} - -// https://imagemagick.org/script/command-line-options.php#channel -export const image_magick_channel_content: Hash = { - form: 'hash', - link: 'image_magick_channel', - bond: { - head: { like: 'string' }, - }, - hash: { - red: { head: 'Red' }, - green: { head: 'Green' }, - blue: { head: 'Blue' }, - alpha: { head: 'Alpha' }, - gray: { head: 'Gray' }, - cyan: { head: 'Cyan' }, - magenta: { head: 'Magenta' }, - yellow: { head: 'Yellow' }, - black: { head: 'Black' }, - opacity: { head: 'Opacity' }, - index: { head: 'Index' }, - rgb: { head: 'RGB' }, - rgba: { head: 'RGBA' }, - cmyk: { head: 'CMYK' }, - cmyka: { head: 'CMYKA' }, - }, -} - -export const image_magic_color_matrix: Form = { - form: 'form', - link: { - row: { like: 'natural_number' }, - column: { like: 'natural_number' }, - value: { like: 'decimal', list: true }, - }, -} - -export const image_magick_compression_content: Hash = { - form: 'hash', - link: 'image_magick_compression', - bond: { - head: { like: 'string' }, - }, - hash: { - none: { head: 'None' }, - bzip: { head: 'BZip' }, - fax: { head: 'Fax' }, - group4: { head: 'Group4' }, - jpeg: { head: 'JPEG' }, - jpeg2000: { head: 'JPEG2000' }, - lossless: { head: 'Lossless' }, - lzw: { head: 'LZW' }, - rle: { head: 'RLE' }, - zip: { head: 'Zip' }, - }, -} - -export const image_magick_compression: List = { - form: 'list', - list: [ - 'none', - 'bzip', - 'fax', - 'group4', - 'jpeg', - 'jpeg2000', - 'lossless', - 'lzw', - 'rle', - 'zip', - ], -} - -export const convert_image_with_image_magick: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - }, - }, - colorCount: { like: 'natural_number', need: false }, - colorMatrix: { - like: 'image_magic_color_matrix', - test: 'test_image_magic_color_matrix', - need: false, - }, - colorSpace: { like: 'image_magick_color_space', need: false }, - compare: { like: 'boolean', need: false }, - compression: { like: 'image_magick_compression', need: false }, - }, -} - -export const image_magick_color_space: List = { - form: 'list', - list: [ - 'cmy', - 'cmyk', - 'gray', - 'hcl', - 'hclp', - 'hsb', - 'hsi', - 'hsl', - 'hsv', - 'hwb', - 'jzazbz', - 'lab', - 'lchab', - 'lchuv', - 'lms', - 'log', - 'luv', - 'ohta', - 'oklab', - 'oklch', - 'rec601ycbcr', - 'rec709ycbcr', - 'rgb', - 'scrgb', - 'srgb', - 'transparent', - 'xyy', - 'xyz', - 'ycbcr', - 'ycc', - 'ydbdr', - 'yiq', - 'ypbpr', - 'yuv', - 'undefined', - ], -} - -export const image_magick_color_space_content: Hash = { - form: 'hash', - link: 'image_magick_color_space', - bond: { - head: { like: 'string' }, - note: { like: 'string', need: false }, - }, - hash: { - cmy: { head: 'CMY', note: 'Cyan, Magenta, Yellow' }, - cmyk: { head: 'CMYK', note: 'Cyan, Magenta, Yellow, Key (Black)' }, - gray: { head: 'Gray', note: 'Grayscale' }, - hcl: { head: 'HCL', note: 'Hue, Chroma, Lightness' }, - hclp: { head: 'HCLp', note: 'Hue, Chroma, Lightness (perceptual)' }, - hsb: { head: 'HSB', note: 'Hue, Saturation, Brightness' }, - hsi: { head: 'HSI', note: 'Hue, Saturation, Intensity' }, - hsl: { head: 'HSL', note: 'Hue, Saturation, Lightness' }, - hsv: { head: 'HSV', note: 'Hue, Saturation, Value' }, - hwb: { head: 'HWB', note: 'Hue, Whiteness, Blackness' }, - jzazbz: { - head: 'Jzazbz', - note: 'Jz, az, bz (a perceptually uniform colorspace)', - }, - lab: { head: 'Lab', note: 'CIELAB (Lab color space)' }, - lchab: { head: 'LCHab', note: 'Lightness, Chroma, Hue (CIELAB)' }, - lchuv: { head: 'LCHuv', note: 'Lightness, Chroma, Hue (CIELUV)' }, - lms: { - head: 'LMS', - note: 'Long, Medium, Short (a colorspace based on human vision)', - }, - log: { head: 'Log', note: 'Logarithmic color space' }, - luv: { head: 'Luv', note: 'CIELUV (Luv color space)' }, - ohta: { head: 'OHTA', note: 'Ohta color space' }, - oklab: { head: 'OkLab', note: 'OkLab color space' }, - oklch: { head: 'OkLCH', note: 'OkLCH color space' }, - rec601ycbcr: { - head: 'Rec601YCbCr', - note: 'ITU-R Rec. 601 YCbCr color space', - }, - rec709ycbcr: { - head: 'Rec709YCbCr', - note: 'ITU-R Rec. 709 YCbCr color space', - }, - rgb: { head: 'RGB', note: 'Red, Green, Blue' }, - scrgb: { - head: 'scRGB', - note: 'Standard-compliant RGB color space', - }, - srgb: { head: 'sRGB', note: 'Standard Red Green Blue color space' }, - transparent: { head: 'Transparent', note: 'Transparent color' }, - xyy: { - head: 'xyY', - note: 'Chromaticity coordinates and luminance', - }, - xyz: { head: 'XYZ', note: 'CIE 1931 XYZ color space' }, - ycbcr: { - head: 'YCbCr', - note: 'Luma (Y), Chroma Blue (Cb), Chroma Red (Cr)', - }, - ycc: { head: 'YCC', note: "Y'CbCr color space" }, - ydbdr: { - head: 'YDbDr', - note: 'Luma (Y), Blue-Difference (Db), Red-Difference (Dr)', - }, - yiq: { - head: 'YIQ', - note: 'Luma (Y), In-phase (I), Quadrature-phase (Q)', - }, - ypbpr: { head: 'YPbPr', note: 'Luma (Y), Blue (Pb), Red (Pr)' }, - yuv: { - head: 'YUV', - note: 'Luma (Y), Chrominance U (Cb), Chrominance V (Cr)', - }, - undefined: { head: 'Undefined' }, - }, -} - -// density -// w -// wxh -// depth - -// distort -// Affine -// RigidAffine -// AffineProjection -// ScaleRotateTranslate -// SRT -// Perspective -// PerspectiveProjection -// BilinearForward -// BilinearReverse -// Polynomial -// Arc -// Polar -// DePolar -// Barrel -// BarrelInverse -// Shepards -// Resize - -// channel -// All -// Sync -// Default -// A -// Alpha -// Black -// B -// Blue -// C -// Chroma -// Cyan -// Gray -// G -// Green -// H -// Hue -// K -// L -// Lightness -// Luminance -// M -// Magenta -// Meta -// Meta0 -// Meta1 -// Meta2 -// Meta3 -// Meta4 -// Meta5 -// Meta6 -// Meta7 -// Meta8 -// Meta9 -// Meta10 -// Meta11 -// Meta12 -// Meta13 -// Meta14 -// Meta15 -// Meta16 -// Meta17 -// Meta18 -// Meta19 -// Meta20 -// Meta21 -// R -// ReadMask -// Red -// S -// Saturation -// WriteMask -// Y -// Yellow -// 0 -// 1 -// 2 -// 3 -// 4 -// 5 -// 6 -// 7 -// 8 -// 9 -// 10 -// 11 -// 12 -// 13 -// 14 -// 15 -// 16 -// 17 -// 18 -// 19 -// 20 -// 21 -// 22 -// 23 -// 24 -// 25 -// 26 -// 27 -// 28 -// 29 -// 30 -// 31 - -// alpha -// Activate -// Associate -// Background -// Copy -// Deactivate -// Discrete -// Disassociate -// Extract -// Off -// On -// Opaque -// Remove -// Set -// Shape -// Transparent - -// loop n - -// mode -// Frame -// Unframe -// Concatenate - -// -motion-blur radius -// -motion-blur radius{xsigma}+angle - -// -negate -// Replace each pixel with its complementary color. - -// noise -// Gaussian -// Impulse -// Laplacian -// Multiplicative -// Poisson -// Random -// Uniform - -// opaque -// Change this color to the fill color within the image. - -// orient -// Specify orientation of a digital camera image. - -// bottom-left -// right-top -// bottom-right -// top-left -// left-bottom -// top-right -// left-top -// undefined -// right-bottom - -// paint radiuspx -// Simulate an oil painting. Each pixel is replaced by the most frequent color in a circular neighborhood whose width is specified with radius. - -// polaroid angle -// Simulate a Polaroid picture. - -// precision value - -// quality -// JPEG/MIFF/PNG compression level. - -// quantize colorspace -// Reduce colors using this colorspace. - -// quiet - -// resize geometry - -// rotational-blur angle -// Blur around the center of the image. - -// sepia-tone percent -// Simulate a sepia-toned photo. - -// sharpen radius - -// -sketch radius -// Simulate a pencil sketch. - -// swirl degrees -// Swirl image pixels about the center. - -// -tint value -// Tint the image with the fill color. - -// transparent color -// Make this color transparent within the image. - -// type -// Bilevel -// Grayscale -// GrayscaleAlpha -// Palette -// PaletteAlpha -// TrueColor -// TrueColorAlpha -// ColorSeparation -// ColorSeparationAlpha - -// unsharp radius -// Sharpen the image with an unsharp mask operator. - -// vignette radius{xsigma}{+-}x{+-}y{%} -// Soften the edges of the image in vignette style. - -// https://www.the-art-of-web.com/system/imagemagick-watermark/ - -// geometry - -// composite -// convert $inputFile $logoFile -gravity southeast -geometry +100+100 -format jpg -composite $outputFile -// - -// https://exiftool.org/TagNames/EXIF.html -// https://github.com/exif-js/exif-js -// https://exiftool.org/TagNames/PNG.html -// https://github.com/MikeKovarik/exifr - -export const extract_metadata_from_image: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - copyright: { like: 'string', need: false }, - creator: { like: 'string', need: false }, - license: { like: 'string', need: false }, - keywords: { like: 'string', list: true, need: false }, - artist: { like: 'string', need: false }, - originalDate: { like: 'date', need: false }, - allDates: { like: 'date', need: false }, - creationDate: { like: 'date', need: false }, - title: { like: 'string', need: false }, - description: { like: 'string', need: false }, - }, -} - -export const remove_image_metadata: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - }, -} - -export const write_metadata_to_image: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - copyright: { like: 'string', need: false }, - creator: { like: 'string', need: false }, - license: { like: 'string', need: false }, - keywords: { like: 'string', list: true, need: false }, - artist: { like: 'string', need: false }, - originalDate: { like: 'date', need: false }, - allDates: { like: 'date', need: false }, - creationDate: { like: 'date', need: false }, - title: { like: 'string', need: false }, - description: { like: 'string', need: false }, - }, -} +import EXIFTOOL_TAG from './exiftool.tag.json' assert { type: 'json' } +import { Hash } from '@termsurf/form' export const exiftool_image_format_content: Hash = { form: 'hash', @@ -1101,7 +230,6 @@ export const exiftool_image_format_content: Hash = { export const exiftool_tag_content: Hash = { form: 'hash', - bond: { head: { like: 'string' }, }, @@ -1447,63 +575,3 @@ export const exiftool_family_content: Hash = { i_tunes: { head: 'iTunes', family: [1] }, }, } - -export const convert_ai_to_svg_with_inkscape: Form = { - form: 'form', - link: { - input: { - link: { - file: { - link: { - path: { like: 'string', need: false }, - }, - }, - }, - }, - output: { - link: { - file: { - link: { - path: { like: 'string' }, - format: { like: 'string' }, - }, - }, - }, - }, - }, -} - -export const inkscape_import_format: List = { - form: 'list', - list: ['ai'], -} - -export const inkscape_export_format: List = { - form: 'list', - list: ['svg', 'png', 'ps', 'eps', 'pdf', 'emf', 'wmf', 'xaml'], -} - -export const generate_gif_with_gifsicle: Form = { - form: 'form', - link: { - width: { like: 'natural_number', need: false }, - height: { like: 'natural_number', need: false }, - unoptimize: { like: 'boolean', need: false }, - }, -} - -export const verify_image_with_image_magick: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'image_magick_format' }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - }, -} diff --git a/code/shared/type/source/data/ffmpeg.codecs.audio.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.codecs.audio.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.codecs.audio.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.codecs.audio.keys.json diff --git a/code/shared/type/source/data/ffmpeg.codecs.json b/code/shared/source/object/ffmpeg/ffmpeg.codecs.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.codecs.json rename to code/shared/source/object/ffmpeg/ffmpeg.codecs.json diff --git a/code/shared/type/source/data/ffmpeg.codecs.subtitle.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.codecs.subtitle.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.codecs.subtitle.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.codecs.subtitle.keys.json diff --git a/code/shared/type/source/data/ffmpeg.codecs.video.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.codecs.video.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.codecs.video.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.codecs.video.keys.json diff --git a/code/shared/type/source/data/ffmpeg.decoders.audio.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.decoders.audio.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.decoders.audio.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.decoders.audio.keys.json diff --git a/code/shared/type/source/data/ffmpeg.decoders.json b/code/shared/source/object/ffmpeg/ffmpeg.decoders.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.decoders.json rename to code/shared/source/object/ffmpeg/ffmpeg.decoders.json diff --git a/code/shared/type/source/data/ffmpeg.decoders.subtitle.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.decoders.subtitle.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.decoders.subtitle.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.decoders.subtitle.keys.json diff --git a/code/shared/type/source/data/ffmpeg.decoders.video.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.decoders.video.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.decoders.video.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.decoders.video.keys.json diff --git a/code/shared/type/source/data/ffmpeg.encoders.audio.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.encoders.audio.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.encoders.audio.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.encoders.audio.keys.json diff --git a/code/shared/type/source/data/ffmpeg.encoders.json b/code/shared/source/object/ffmpeg/ffmpeg.encoders.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.encoders.json rename to code/shared/source/object/ffmpeg/ffmpeg.encoders.json diff --git a/code/shared/type/source/data/ffmpeg.encoders.subtitle.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.encoders.subtitle.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.encoders.subtitle.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.encoders.subtitle.keys.json diff --git a/code/shared/type/source/data/ffmpeg.encoders.video.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.encoders.video.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.encoders.video.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.encoders.video.keys.json diff --git a/code/shared/type/source/data/ffmpeg.filters.json b/code/shared/source/object/ffmpeg/ffmpeg.filters.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.filters.json rename to code/shared/source/object/ffmpeg/ffmpeg.filters.json diff --git a/code/shared/type/source/data/ffmpeg.filters.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.filters.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.filters.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.filters.keys.json diff --git a/code/shared/type/source/data/ffmpeg.formats.json b/code/shared/source/object/ffmpeg/ffmpeg.formats.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.formats.json rename to code/shared/source/object/ffmpeg/ffmpeg.formats.json diff --git a/code/shared/type/source/data/ffmpeg.formats.keys.json b/code/shared/source/object/ffmpeg/ffmpeg.formats.keys.json similarity index 100% rename from code/shared/type/source/data/ffmpeg.formats.keys.json rename to code/shared/source/object/ffmpeg/ffmpeg.formats.keys.json diff --git a/code/shared/source/object/ffmpeg/index.ts b/code/shared/source/object/ffmpeg/index.ts new file mode 100644 index 0000000..097b536 --- /dev/null +++ b/code/shared/source/object/ffmpeg/index.ts @@ -0,0 +1,142 @@ +import { Form, Hash, List } from '@termsurf/form' +import FFMPEG_CODEC_AUDIO from './ffmpeg.codecs.audio.keys.json' assert { type: 'json' } +import FFMPEG_CODEC_CONTENT from './ffmpeg.codecs.json' assert { type: 'json' } +import FFMPEG_CODEC_SUBTITLE from './ffmpeg.codecs.subtitle.keys.json' assert { type: 'json' } +import FFMPEG_CODEC_VIDEO from './ffmpeg.codecs.video.keys.json' assert { type: 'json' } +import FFMPEG_DECODER_AUDIO from './ffmpeg.decoders.audio.keys.json' assert { type: 'json' } +import FFMPEG_DECODER_CONTENT from './ffmpeg.decoders.json' assert { type: 'json' } +import FFMPEG_DECODER_SUBTITLE from './ffmpeg.decoders.subtitle.keys.json' assert { type: 'json' } +import FFMPEG_DECODER_VIDEO from './ffmpeg.decoders.video.keys.json' assert { type: 'json' } +import FFMPEG_ENCODER_AUDIO from './ffmpeg.encoders.audio.keys.json' assert { type: 'json' } +import FFMPEG_ENCODER_CONTENT from './ffmpeg.encoders.json' assert { type: 'json' } +import FFMPEG_ENCODER_SUBTITLE from './ffmpeg.encoders.subtitle.keys.json' assert { type: 'json' } +import FFMPEG_ENCODER_VIDEO from './ffmpeg.encoders.video.keys.json' assert { type: 'json' } +import FFMPEG_FORMAT_CONTENT from './ffmpeg.formats.json' assert { type: 'json' } +import FFMPEG_FORMAT from './ffmpeg.formats.keys.json' assert { type: 'json' } + +export const ffmpeg_codec_audio: List = { + form: 'list', + list: FFMPEG_CODEC_AUDIO, +} +export const ffmpeg_codec_content: Hash = { + form: 'hash', + hash: FFMPEG_CODEC_CONTENT, + bond: { + label: { like: 'string' }, + type: { like: 'string', need: false }, + supportsDecoding: { like: 'boolean' }, + supportsEncoding: { like: 'boolean' }, + intraFrameOnly: { like: 'boolean' }, + lossy: { like: 'boolean' }, + lossless: { like: 'boolean' }, + }, +} + +export const ffmpeg_codec_subtitle: List = { + form: 'list', + list: FFMPEG_CODEC_SUBTITLE, +} + +export const ffmpeg_codec_video: List = { + form: 'list', + list: FFMPEG_CODEC_VIDEO, +} + +export const ffmpeg_decoder_audio: List = { + form: 'list', + list: FFMPEG_DECODER_AUDIO, +} + +export const ffmpeg_decoder_content: Hash = { + form: 'hash', + hash: FFMPEG_DECODER_CONTENT, + bond: { + label: { like: 'string' }, + type: { like: 'string' }, + frameLevelMultithreading: { like: 'boolean' }, + sliceLevelMultithreading: { like: 'boolean' }, + experimental: { like: 'boolean' }, + supportsDrawHorizontalBand: { like: 'boolean' }, + supportsDirectRenderingMethod1: { like: 'boolean' }, + }, +} + +export const ffmpeg_decoder_subtitle: List = { + form: 'list', + list: FFMPEG_DECODER_SUBTITLE, +} + +export const ffmpeg_decoder_video: List = { + form: 'list', + list: FFMPEG_DECODER_VIDEO, +} + +export const ffmpeg_encoder_audio: List = { + form: 'list', + list: FFMPEG_ENCODER_AUDIO, +} + +export const ffmpeg_encoder_content: Hash = { + form: 'hash', + hash: FFMPEG_ENCODER_CONTENT, + bond: { + label: { like: 'string' }, + type: { like: 'string' }, + frameLevelMultithreading: { like: 'boolean' }, + sliceLevelMultithreading: { like: 'boolean' }, + experimental: { like: 'boolean' }, + supportsDrawHorizontalBand: { like: 'boolean' }, + supportsDirectRenderingMethod1: { like: 'boolean' }, + }, +} + +export const ffmpeg_encoder_subtitle: List = { + form: 'list', + list: FFMPEG_ENCODER_SUBTITLE, +} + +export const ffmpeg_encoder_video: List = { + form: 'list', + list: FFMPEG_ENCODER_VIDEO, +} + +export const ffmpeg_format_content: Hash = { + form: 'hash', + hash: FFMPEG_FORMAT_CONTENT, + bond: { + label: { like: 'string' }, + supportsDemuxing: { like: 'boolean' }, + supportsMuxing: { like: 'boolean' }, + }, +} + +export const ffmpeg_format: List = { + form: 'list', + list: FFMPEG_FORMAT, +} + +export const ffmpeg_strict_option: List = { + form: 'list', + list: ['very', 'strict', 'normal', 'unofficial', 'experimental'], +} + +export const ffmpeg_strict_option_content: Hash = { + form: 'hash', + link: 'ffmpeg_strict_option', + bond: { + note: { like: 'string' }, + }, + hash: { + very: { + note: 'Strictly conform to a older more strict version of the spec or reference software.', + }, + strict: { + note: 'Strictly conform to all the things in the spec no matter what consequences.', + }, + normal: { note: '' }, + unofficial: { note: 'Allow unofficial extensions.' }, + experimental: { + note: 'Allow non standardized experimental things.', + }, + }, +} diff --git a/code/shared/source/object/font/index.ts b/code/shared/source/object/font/index.ts new file mode 100644 index 0000000..06b803e --- /dev/null +++ b/code/shared/source/object/font/index.ts @@ -0,0 +1,6 @@ +import { Form, List } from '@termsurf/form' + +export const font_format: List = { + form: 'list', + list: ['ttf', 'otf', 'woff2', 'woff', 'svg', 'eot', 'bmp'], +} diff --git a/code/shared/type/source/data/image-magick.format.content.ts b/code/shared/source/object/image-magick/image-magick.format.content.ts similarity index 100% rename from code/shared/type/source/data/image-magick.format.content.ts rename to code/shared/source/object/image-magick/image-magick.format.content.ts diff --git a/code/shared/type/source/data/image-magick.format.input.json b/code/shared/source/object/image-magick/image-magick.format.input.json similarity index 100% rename from code/shared/type/source/data/image-magick.format.input.json rename to code/shared/source/object/image-magick/image-magick.format.input.json diff --git a/code/shared/type/source/data/image-magick.format.json b/code/shared/source/object/image-magick/image-magick.format.json similarity index 100% rename from code/shared/type/source/data/image-magick.format.json rename to code/shared/source/object/image-magick/image-magick.format.json diff --git a/code/shared/type/source/data/image-magick.format.output.json b/code/shared/source/object/image-magick/image-magick.format.output.json similarity index 100% rename from code/shared/type/source/data/image-magick.format.output.json rename to code/shared/source/object/image-magick/image-magick.format.output.json diff --git a/code/shared/source/object/image-magick/index.ts b/code/shared/source/object/image-magick/index.ts new file mode 100644 index 0000000..be8c88e --- /dev/null +++ b/code/shared/source/object/image-magick/index.ts @@ -0,0 +1,745 @@ +import IMAGE_MAGICK_FORMAT from './image-magick.format.json' assert { type: 'json' } +import IMAGE_MAGICK_INPUT_FORMAT from './image-magick.format.input.json' assert { type: 'json' } +import IMAGE_MAGICK_OUTPUT_FORMAT from './image-magick.format.output.json' assert { type: 'json' } +import { Form, Hash, List } from '@termsurf/form' + +export const image_magick_input_format: List = { + form: 'list', + list: IMAGE_MAGICK_INPUT_FORMAT, +} + +export const image_magick_output_format: List = { + form: 'list', + list: IMAGE_MAGICK_OUTPUT_FORMAT, +} + +export const image_magick_format: List = { + form: 'list', + list: [ + '3fr', + '3g2', + '3gp', + 'aai', + 'ai', + 'apng', + 'art', + 'arw', + 'ashlar', + 'avi', + 'avif', + 'avs', + 'bayer', + 'bayera', + 'bgr', + 'bgra', + 'bgro', + 'bmp', + 'bmp2', + 'bmp3', + 'brf', + 'cal', + 'cals', + 'canvas', + 'caption', + 'cin', + 'cip', + 'clip', + 'cmyk', + 'cmyka', + 'cr2', + 'cr3', + 'crw', + 'cube', + 'cur', + 'cut', + 'data', + 'dcm', + 'dcr', + 'dcraw', + 'dcx', + 'dds', + 'dfont', + 'dng', + 'dpx', + 'dot', + 'dxt1', + 'dxt5', + 'epdf', + 'epi', + 'eps', + 'eps2', + 'eps3', + 'epsf', + 'epsi', + 'ept', + 'ept2', + 'ept3', + 'erf', + 'exr', + 'farbfeld', + 'fax', + 'ff', + 'file', + 'fits', + 'fl32', + 'flv', + 'fractal', + 'ftp', + 'ftxt', + 'fts', + 'g3', + 'g4', + 'gif', + 'gif87', + 'gradient', + 'gray', + 'graya', + 'group4', + 'hald', + 'hdr', + 'heic', + 'heif', + 'histogram', + 'hrz', + 'htm', + 'html', + 'http', + 'https', + 'icb', + 'ico', + 'icon', + 'iiq', + 'info', + 'inline', + 'ipl', + 'isobrl', + 'isobrl6', + 'j2c', + 'j2k', + 'jng', + 'jnx', + 'jp2', + 'jpc', + 'jpe', + 'jpeg', + 'jpg', + 'jpm', + 'jps', + 'jpt', + 'json', + 'jxl', + 'k25', + 'kdc', + 'label', + 'm2v', + 'm4v', + 'mac', + 'map', + 'mask', + 'mat', + 'matte', + 'mef', + 'miff', + 'mkv', + 'mng', + 'mono', + 'mov', + 'mp4', + 'mpc', + 'mpeg', + 'mpg', + 'mpo', + 'mrw', + 'msl', + 'msvg', + 'mtv', + 'mvg', + 'nef', + 'nrw', + 'null', + 'ora', + 'orf', + 'otb', + 'otf', + 'pal', + 'palm', + 'pam', + 'pango', + 'pattern', + 'pbm', + 'pcd', + 'pcds', + 'pcl', + 'pct', + 'pcx', + 'pdb', + 'pdf', + 'pdfa', + 'pef', + 'pes', + 'pfa', + 'pfb', + 'pfm', + 'pgm', + 'pgx', + 'phm', + 'picon', + 'pict', + 'pix', + 'pjpeg', + 'plasma', + 'png', + 'png00', + 'png24', + 'png32', + 'png48', + 'png64', + 'png8', + 'pnm', + 'ppm', + 'ps', + 'ps2', + 'ps3', + 'psb', + 'psd', + 'ptif', + 'pwp', + 'qoi', + 'raf', + 'ras', + 'raw', + 'rgb', + 'rgb565', + 'rgba', + 'rgbo', + 'rgf', + 'rla', + 'rle', + 'rmf', + 'rw2', + 'scr', + 'sct', + 'sfw', + 'sgi', + 'shtml', + 'six', + 'sixel', + 'sr2', + 'srf', + 'stegano', + 'strimg', + 'sun', + 'svg', + 'svgz', + 'text', + 'tga', + 'thumbnail', + 'tiff', + 'tiff64', + 'tile', + 'tim', + 'tm2', + 'ttc', + 'ttf', + 'txt', + 'ubrl', + 'ubrl6', + 'uil', + 'uyvy', + 'vda', + 'vicar', + 'vid', + 'viff', + 'vips', + 'vst', + 'wbmp', + 'webp', + 'webm', + 'wmv', + 'wpg', + 'x3f', + 'xbm', + 'xc', + 'xcf', + 'xpm', + 'xps', + 'xv', + 'yaml', + 'ycbcr', + 'ycbcra', + 'yuv', + ], +} + +export const image_magick_format_content: Hash = { + form: 'hash', + link: 'image_magick_format', + bond: { + head: { like: 'string' }, + note: { like: 'string', need: false }, + read: { like: 'boolean', need: false }, + write: { like: 'boolean', need: false }, + multiple: { like: 'boolean', need: false }, + supportsBlob: { like: 'boolean', need: false }, + }, + hash: IMAGE_MAGICK_FORMAT, +} + +export const image_magick_gravity: List = { + form: 'list', + list: [ + 'forget', + 'northwest', + 'north', + 'northeast', + 'west', + 'center', + 'east', + 'southwest', + 'south', + 'southeast', + ], +} + +export const image_magick_channel: List = { + form: 'list', + list: [ + 'red', + 'green', + 'blue', + 'alpha', + 'gray', + 'cyan', + 'magenta', + 'yellow', + 'black', + 'opacity', + 'index', + 'rgb', + 'rgba', + 'cmyk', + 'cmyka', + ], +} + +// https://imagemagick.org/script/command-line-options.php#channel +export const image_magick_channel_content: Hash = { + form: 'hash', + link: 'image_magick_channel', + bond: { + head: { like: 'string' }, + }, + hash: { + red: { head: 'Red' }, + green: { head: 'Green' }, + blue: { head: 'Blue' }, + alpha: { head: 'Alpha' }, + gray: { head: 'Gray' }, + cyan: { head: 'Cyan' }, + magenta: { head: 'Magenta' }, + yellow: { head: 'Yellow' }, + black: { head: 'Black' }, + opacity: { head: 'Opacity' }, + index: { head: 'Index' }, + rgb: { head: 'RGB' }, + rgba: { head: 'RGBA' }, + cmyk: { head: 'CMYK' }, + cmyka: { head: 'CMYKA' }, + }, +} + +export const image_magick_compression_content: Hash = { + form: 'hash', + link: 'image_magick_compression', + bond: { + head: { like: 'string' }, + }, + hash: { + none: { head: 'None' }, + bzip: { head: 'BZip' }, + fax: { head: 'Fax' }, + group4: { head: 'Group4' }, + jpeg: { head: 'JPEG' }, + jpeg2000: { head: 'JPEG2000' }, + lossless: { head: 'Lossless' }, + lzw: { head: 'LZW' }, + rle: { head: 'RLE' }, + zip: { head: 'Zip' }, + }, +} + +export const image_magick_compression: List = { + form: 'list', + list: [ + 'none', + 'bzip', + 'fax', + 'group4', + 'jpeg', + 'jpeg2000', + 'lossless', + 'lzw', + 'rle', + 'zip', + ], +} + +export const image_magick_color_space: List = { + form: 'list', + list: [ + 'cmy', + 'cmyk', + 'gray', + 'hcl', + 'hclp', + 'hsb', + 'hsi', + 'hsl', + 'hsv', + 'hwb', + 'jzazbz', + 'lab', + 'lchab', + 'lchuv', + 'lms', + 'log', + 'luv', + 'ohta', + 'oklab', + 'oklch', + 'rec601ycbcr', + 'rec709ycbcr', + 'rgb', + 'scrgb', + 'srgb', + 'transparent', + 'xyy', + 'xyz', + 'ycbcr', + 'ycc', + 'ydbdr', + 'yiq', + 'ypbpr', + 'yuv', + 'undefined', + ], +} + +export const image_magick_color_space_content: Hash = { + form: 'hash', + link: 'image_magick_color_space', + bond: { + head: { like: 'string' }, + note: { like: 'string', need: false }, + }, + hash: { + cmy: { head: 'CMY', note: 'Cyan, Magenta, Yellow' }, + cmyk: { head: 'CMYK', note: 'Cyan, Magenta, Yellow, Key (Black)' }, + gray: { head: 'Gray', note: 'Grayscale' }, + hcl: { head: 'HCL', note: 'Hue, Chroma, Lightness' }, + hclp: { head: 'HCLp', note: 'Hue, Chroma, Lightness (perceptual)' }, + hsb: { head: 'HSB', note: 'Hue, Saturation, Brightness' }, + hsi: { head: 'HSI', note: 'Hue, Saturation, Intensity' }, + hsl: { head: 'HSL', note: 'Hue, Saturation, Lightness' }, + hsv: { head: 'HSV', note: 'Hue, Saturation, Value' }, + hwb: { head: 'HWB', note: 'Hue, Whiteness, Blackness' }, + jzazbz: { + head: 'Jzazbz', + note: 'Jz, az, bz (a perceptually uniform colorspace)', + }, + lab: { head: 'Lab', note: 'CIELAB (Lab color space)' }, + lchab: { head: 'LCHab', note: 'Lightness, Chroma, Hue (CIELAB)' }, + lchuv: { head: 'LCHuv', note: 'Lightness, Chroma, Hue (CIELUV)' }, + lms: { + head: 'LMS', + note: 'Long, Medium, Short (a colorspace based on human vision)', + }, + log: { head: 'Log', note: 'Logarithmic color space' }, + luv: { head: 'Luv', note: 'CIELUV (Luv color space)' }, + ohta: { head: 'OHTA', note: 'Ohta color space' }, + oklab: { head: 'OkLab', note: 'OkLab color space' }, + oklch: { head: 'OkLCH', note: 'OkLCH color space' }, + rec601ycbcr: { + head: 'Rec601YCbCr', + note: 'ITU-R Rec. 601 YCbCr color space', + }, + rec709ycbcr: { + head: 'Rec709YCbCr', + note: 'ITU-R Rec. 709 YCbCr color space', + }, + rgb: { head: 'RGB', note: 'Red, Green, Blue' }, + scrgb: { + head: 'scRGB', + note: 'Standard-compliant RGB color space', + }, + srgb: { head: 'sRGB', note: 'Standard Red Green Blue color space' }, + transparent: { head: 'Transparent', note: 'Transparent color' }, + xyy: { + head: 'xyY', + note: 'Chromaticity coordinates and luminance', + }, + xyz: { head: 'XYZ', note: 'CIE 1931 XYZ color space' }, + ycbcr: { + head: 'YCbCr', + note: 'Luma (Y), Chroma Blue (Cb), Chroma Red (Cr)', + }, + ycc: { head: 'YCC', note: "Y'CbCr color space" }, + ydbdr: { + head: 'YDbDr', + note: 'Luma (Y), Blue-Difference (Db), Red-Difference (Dr)', + }, + yiq: { + head: 'YIQ', + note: 'Luma (Y), In-phase (I), Quadrature-phase (Q)', + }, + ypbpr: { head: 'YPbPr', note: 'Luma (Y), Blue (Pb), Red (Pr)' }, + yuv: { + head: 'YUV', + note: 'Luma (Y), Chrominance U (Cb), Chrominance V (Cr)', + }, + undefined: { head: 'Undefined' }, + }, +} + +// density +// w +// wxh +// depth + +// distort +// Affine +// RigidAffine +// AffineProjection +// ScaleRotateTranslate +// SRT +// Perspective +// PerspectiveProjection +// BilinearForward +// BilinearReverse +// Polynomial +// Arc +// Polar +// DePolar +// Barrel +// BarrelInverse +// Shepards +// Resize + +// channel +// All +// Sync +// Default +// A +// Alpha +// Black +// B +// Blue +// C +// Chroma +// Cyan +// Gray +// G +// Green +// H +// Hue +// K +// L +// Lightness +// Luminance +// M +// Magenta +// Meta +// Meta0 +// Meta1 +// Meta2 +// Meta3 +// Meta4 +// Meta5 +// Meta6 +// Meta7 +// Meta8 +// Meta9 +// Meta10 +// Meta11 +// Meta12 +// Meta13 +// Meta14 +// Meta15 +// Meta16 +// Meta17 +// Meta18 +// Meta19 +// Meta20 +// Meta21 +// R +// ReadMask +// Red +// S +// Saturation +// WriteMask +// Y +// Yellow +// 0 +// 1 +// 2 +// 3 +// 4 +// 5 +// 6 +// 7 +// 8 +// 9 +// 10 +// 11 +// 12 +// 13 +// 14 +// 15 +// 16 +// 17 +// 18 +// 19 +// 20 +// 21 +// 22 +// 23 +// 24 +// 25 +// 26 +// 27 +// 28 +// 29 +// 30 +// 31 + +// alpha +// Activate +// Associate +// Background +// Copy +// Deactivate +// Discrete +// Disassociate +// Extract +// Off +// On +// Opaque +// Remove +// Set +// Shape +// Transparent + +// loop n + +// mode +// Frame +// Unframe +// Concatenate + +// -motion-blur radius +// -motion-blur radius{xsigma}+angle + +// -negate +// Replace each pixel with its complementary color. + +// noise +// Gaussian +// Impulse +// Laplacian +// Multiplicative +// Poisson +// Random +// Uniform + +// opaque +// Change this color to the fill color within the image. + +// orient +// Specify orientation of a digital camera image. + +// bottom-left +// right-top +// bottom-right +// top-left +// left-bottom +// top-right +// left-top +// undefined +// right-bottom + +// paint radiuspx +// Simulate an oil painting. Each pixel is replaced by the most frequent color in a circular neighborhood whose width is specified with radius. + +// polaroid angle +// Simulate a Polaroid picture. + +// precision value + +// quality +// JPEG/MIFF/PNG compression level. + +// quantize colorspace +// Reduce colors using this colorspace. + +// quiet + +// resize geometry + +// rotational-blur angle +// Blur around the center of the image. + +// sepia-tone percent +// Simulate a sepia-toned photo. + +// sharpen radius + +// -sketch radius +// Simulate a pencil sketch. + +// swirl degrees +// Swirl image pixels about the center. + +// -tint value +// Tint the image with the fill color. + +// transparent color +// Make this color transparent within the image. + +// type +// Bilevel +// Grayscale +// GrayscaleAlpha +// Palette +// PaletteAlpha +// TrueColor +// TrueColorAlpha +// ColorSeparation +// ColorSeparationAlpha + +// unsharp radius +// Sharpen the image with an unsharp mask operator. + +// vignette radius{xsigma}{+-}x{+-}y{%} +// Soften the edges of the image in vignette style. + +// https://www.the-art-of-web.com/system/imagemagick-watermark/ + +// geometry + +// composite +// convert $inputFile $logoFile -gravity southeast -geometry +100+100 -format jpg -composite $outputFile +// + +// https://exiftool.org/TagNames/EXIF.html +// https://github.com/exif-js/exif-js +// https://exiftool.org/TagNames/PNG.html +// https://github.com/MikeKovarik/exifr + +export const image_magic_color_matrix: Form = { + form: 'form', + link: { + row: { like: 'natural_number' }, + column: { like: 'natural_number' }, + value: { like: 'decimal', list: true }, + }, +} diff --git a/code/shared/source/object/index.ts b/code/shared/source/object/index.ts new file mode 100644 index 0000000..379dc19 --- /dev/null +++ b/code/shared/source/object/index.ts @@ -0,0 +1,16 @@ +export * from './assembly/index.js' +export * from './rust/index.js' +export * from './llvm/index.js' +export * from './unarchiver/index.js' +export * from './patool/index.js' +export * from './archive/index.js' +export * from './calibre/index.js' +export * from './libre-office/index.js' +export * from './pandoc/index.js' +export * from './puppeteer/index.js' +export * from './font/index.js' +export * from './exiftool/index.js' +export * from './image-magick/index.js' +export * from './inkscape/index.js' +export * from './ffmpeg/index.js' +export * from './clang-format/index.js' diff --git a/code/shared/source/object/inkscape/index.ts b/code/shared/source/object/inkscape/index.ts new file mode 100644 index 0000000..e53d952 --- /dev/null +++ b/code/shared/source/object/inkscape/index.ts @@ -0,0 +1,11 @@ +import { List } from '@termsurf/form' + +export const inkscape_import_format: List = { + form: 'list', + list: ['ai'], +} + +export const inkscape_export_format: List = { + form: 'list', + list: ['svg', 'png', 'ps', 'eps', 'pdf', 'emf', 'wmf', 'xaml'], +} diff --git a/code/shared/source/object/libre-office/index.ts b/code/shared/source/object/libre-office/index.ts new file mode 100644 index 0000000..ce0b5b2 --- /dev/null +++ b/code/shared/source/object/libre-office/index.ts @@ -0,0 +1,38 @@ +import { List } from '@termsurf/form' + +export const libre_office_input_format: List = { + form: 'list', + list: [ + 'html', + 'mediawiki', + 'csv', + 'pptx', + 'ppt', + 'docx', + 'doc', + 'pdf', + 'wmf', + 'emf', + 'svg', + 'xlsx', + 'xls', + ], +} + +export const libre_office_output_format: List = { + form: 'list', + list: [ + 'html', + 'mediawiki', + 'csv', + 'pptx', + 'ppt', + 'wmf', + 'emf', + 'svg', + 'xlsx', + 'xls', + 'epub', + 'pdf', + ], +} diff --git a/code/shared/source/object/llvm/index.ts b/code/shared/source/object/llvm/index.ts new file mode 100644 index 0000000..1e4b955 --- /dev/null +++ b/code/shared/source/object/llvm/index.ts @@ -0,0 +1,306 @@ +import { Hash, List } from '@termsurf/form' +import LLVM_ARCHITECTURE_CONTENT from './llvm.architecture.json' assert { type: 'json' } +import LLVM_CPU_CONTENT from './llvm.cpu.json' assert { type: 'json' } +import LLVM_CPU from './llvm.cpu.key.json' assert { type: 'json' } +import LLVM_FEATURE_CONTENT from './llvm.feature.json' assert { type: 'json' } +import LLVM_FEATURE from './llvm.feature.key.json' assert { type: 'json' } + +export const llvm_cpu: List = { + form: 'list', + list: LLVM_CPU, +} + +export const llvm_cpu_content: Hash = { + form: 'hash', + link: 'llvm_cpu', + bond: { + host: { like: 'string' }, + note: { like: 'string' }, + }, + hash: LLVM_CPU_CONTENT, +} + +export const llvm_feature: List = { + form: 'list', + list: LLVM_FEATURE, +} + +export const llvm_feature_content: Hash = { + form: 'hash', + link: 'llvm_feature', + bond: { + host: { like: 'string' }, + note: { like: 'string' }, + }, + hash: LLVM_FEATURE_CONTENT, +} + +export const llvm_architecture: List = { + form: 'list', + list: [ + 'aarch64', + 'aarch64_32', + 'aarch64_be', + 'amdgcn', + 'arm', + 'arm64', + 'arm64_32', + 'armeb', + 'avr', + 'bpf', + 'bpfeb', + 'bpfel', + 'hexagon', + 'lanai', + 'mips', + 'mips64', + 'mips64el', + 'mipsel', + 'msp430', + 'nvptx', + 'nvptx64', + 'ppc32', + 'ppc64', + 'ppc64le', + 'r600', + 'riscv32', + 'riscv64', + 'sparc', + 'sparcel', + 'sparcv9', + 'systemz', + 'thumb', + 'thumbeb', + 'wasm32', + 'wasm64', + 'x86', + 'x86_64', + 'xcore', + ], +} + +export const llvm_optimization_level: List = { + form: 'list', + list: ['0', '1', '2', '3'], +} + +export const llvm_architecture_content: Hash = { + form: 'hash', + link: 'llvm_architecture', + bond: { + host: { like: 'string' }, + note: { like: 'string' }, + cpu: { like: 'string', list: true }, + feature: { like: 'string', list: true }, + }, + hash: { + aarch64: { + ...LLVM_ARCHITECTURE_CONTENT.aarch_64, + host: 'aarch64', + note: 'AArch64 (little endian)', + }, + aarch64_32: { + ...LLVM_ARCHITECTURE_CONTENT.aarch_64_32, + host: 'aarch64_32', + note: 'AArch64 (little endian ILP32)', + }, + aarch64_be: { + ...LLVM_ARCHITECTURE_CONTENT.aarch_64_be, + host: 'aarch64_be', + note: 'AArch64 (big endian)', + }, + amdgcn: { + ...LLVM_ARCHITECTURE_CONTENT.amdgcn, + host: 'amdgcn', + note: 'AMD GCN GPUs', + }, + arm: { + ...LLVM_ARCHITECTURE_CONTENT.arm, + host: 'arm', + note: 'ARM', + }, + arm64: { + ...LLVM_ARCHITECTURE_CONTENT.arm_64, + host: 'arm64', + note: 'ARM64 (little endian)', + }, + arm64_32: { + ...LLVM_ARCHITECTURE_CONTENT.arm_64_32, + host: 'arm64_32', + note: 'ARM64 (little endian ILP32)', + }, + armeb: { + ...LLVM_ARCHITECTURE_CONTENT.armeb, + host: 'armeb', + note: 'ARM (big endian)', + }, + avr: { + ...LLVM_ARCHITECTURE_CONTENT.avr, + host: 'avr', + note: 'Atmel AVR Microcontroller', + }, + bpf: { + ...LLVM_ARCHITECTURE_CONTENT.bpf, + host: 'bpf', + note: 'BPF (host endian)', + }, + bpfeb: { + ...LLVM_ARCHITECTURE_CONTENT.bpfeb, + host: 'bpfeb', + note: 'BPF (big endian)', + }, + bpfel: { + ...LLVM_ARCHITECTURE_CONTENT.bpfel, + host: 'bpfel', + note: 'BPF (little endian)', + }, + hexagon: { + ...LLVM_ARCHITECTURE_CONTENT.hexagon, + host: 'hexagon', + note: 'Hexagon', + }, + lanai: { + ...LLVM_ARCHITECTURE_CONTENT.lanai, + host: 'lanai', + note: 'Lanai', + }, + mips: { + ...LLVM_ARCHITECTURE_CONTENT.mips, + host: 'mips', + note: 'MIPS (32-bit big endian)', + }, + mips64: { + ...LLVM_ARCHITECTURE_CONTENT.mips_64, + host: 'mips64', + note: 'MIPS (64-bit big endian)', + }, + mips64el: { + ...LLVM_ARCHITECTURE_CONTENT.mips_64_el, + host: 'mips64el', + note: 'MIPS (64-bit little endian)', + }, + mipsel: { + ...LLVM_ARCHITECTURE_CONTENT.mipsel, + host: 'mipsel', + note: 'MIPS (32-bit little endian)', + }, + msp430: { + ...LLVM_ARCHITECTURE_CONTENT.msp_430, + host: 'msp430', + note: 'MSP430 [experimental]', + }, + nvptx: { + ...LLVM_ARCHITECTURE_CONTENT.nvptx, + host: 'nvptx', + note: 'NVIDIA PTX 32-bit', + }, + nvptx64: { + ...LLVM_ARCHITECTURE_CONTENT.nvptx_64, + host: 'nvptx64', + note: 'NVIDIA PTX 64-bit', + }, + ppc32: { + ...LLVM_ARCHITECTURE_CONTENT.ppc_32, + host: 'ppc32', + note: 'PowerPC 32', + }, + ppc64: { + ...LLVM_ARCHITECTURE_CONTENT.ppc_64, + host: 'ppc64', + note: 'PowerPC 64', + }, + ppc64le: { + ...LLVM_ARCHITECTURE_CONTENT.ppc_64_le, + host: 'ppc64le', + note: 'PowerPC 64 LE', + }, + r600: { + ...LLVM_ARCHITECTURE_CONTENT.r_600, + host: 'r600', + note: 'AMD GPUs HD2XXX-HD6XXX', + }, + riscv32: { + ...LLVM_ARCHITECTURE_CONTENT.riscv_32, + host: 'riscv32', + note: '32-bit RISC-V', + }, + riscv64: { + ...LLVM_ARCHITECTURE_CONTENT.riscv_64, + host: 'riscv64', + note: '64-bit RISC-V', + }, + sparc: { + ...LLVM_ARCHITECTURE_CONTENT.sparc, + host: 'sparc', + note: 'Sparc', + }, + sparcel: { + ...LLVM_ARCHITECTURE_CONTENT.sparcel, + host: 'sparcel', + note: 'Sparc LE', + }, + sparcv9: { + ...LLVM_ARCHITECTURE_CONTENT.sparcv_9, + host: 'sparcv9', + note: 'Sparc V9', + }, + systemz: { + ...LLVM_ARCHITECTURE_CONTENT.systemz, + host: 'systemz', + note: 'SystemZ', + }, + thumb: { + ...LLVM_ARCHITECTURE_CONTENT.thumb, + host: 'thumb', + note: 'Thumb', + }, + thumbeb: { + ...LLVM_ARCHITECTURE_CONTENT.thumbeb, + host: 'thumbeb', + note: 'Thumb (big endian)', + }, + wasm32: { + ...LLVM_ARCHITECTURE_CONTENT.wasm_32, + host: 'wasm32', + note: 'WebAssembly 32-bit', + }, + wasm64: { + ...LLVM_ARCHITECTURE_CONTENT.wasm_64, + host: 'wasm64', + note: 'WebAssembly 64-bit', + }, + x86: { + ...LLVM_ARCHITECTURE_CONTENT.x_86, + host: 'x86', + note: '32-bit X86: Pentium-Pro and above', + }, + x86_64: { + ...LLVM_ARCHITECTURE_CONTENT.x_86_64, + host: 'x86-64', + note: '64-bit X86: EM64T and AMD64', + }, + xcore: { + ...LLVM_ARCHITECTURE_CONTENT.xcore, + host: 'xcore', + note: 'XCore', + }, + }, +} + +export const backend_compilation_output: List = { + form: 'list', + list: ['assembly', 'llvm-ir', 'llvm-bitcode', 'binary'], +} + +export const backend_compilation_output_content: Hash = { + form: 'hash', + link: 'backend_compilation_output', + bond: { + extension: { like: 'string', need: false }, + }, + hash: { + assembly: { extension: 'asm' }, + llvm: { extension: 'll' }, + binary: {}, + }, +} diff --git a/code/shared/type/source/data/llvm.architecture.json b/code/shared/source/object/llvm/llvm.architecture.json similarity index 100% rename from code/shared/type/source/data/llvm.architecture.json rename to code/shared/source/object/llvm/llvm.architecture.json diff --git a/code/shared/type/source/data/llvm.cpu.json b/code/shared/source/object/llvm/llvm.cpu.json similarity index 100% rename from code/shared/type/source/data/llvm.cpu.json rename to code/shared/source/object/llvm/llvm.cpu.json diff --git a/code/shared/type/source/data/llvm.cpu.key.json b/code/shared/source/object/llvm/llvm.cpu.key.json similarity index 100% rename from code/shared/type/source/data/llvm.cpu.key.json rename to code/shared/source/object/llvm/llvm.cpu.key.json diff --git a/code/shared/type/source/data/llvm.feature.json b/code/shared/source/object/llvm/llvm.feature.json similarity index 100% rename from code/shared/type/source/data/llvm.feature.json rename to code/shared/source/object/llvm/llvm.feature.json diff --git a/code/shared/type/source/data/llvm.feature.key.json b/code/shared/source/object/llvm/llvm.feature.key.json similarity index 100% rename from code/shared/type/source/data/llvm.feature.key.json rename to code/shared/source/object/llvm/llvm.feature.key.json diff --git a/code/shared/source/object/pandoc/index.ts b/code/shared/source/object/pandoc/index.ts new file mode 100644 index 0000000..d487245 --- /dev/null +++ b/code/shared/source/object/pandoc/index.ts @@ -0,0 +1,208 @@ +import { Hash, List } from '@termsurf/form' + +export const pandoc_format_content: Hash = { + form: 'hash', + bond: { + head: { like: 'string' }, + }, + hash: { + bibtex: { head: 'BibTeX bibliography' }, + biblatex: { head: 'BibLaTeX bibliography' }, + bits: { head: 'BITS XML, alias for jats' }, + commonmark: { head: 'CommonMark Markdown' }, + commonmark_x: { head: 'CommonMark Markdown with extensions' }, + creole: { head: 'Creole 1.0' }, + csljson: { head: 'CSL JSON bibliography' }, + csv: { head: 'CSV table' }, + tsv: { head: 'TSV table' }, + docbook: { head: 'DocBook' }, + docx: { head: 'Word docx' }, + dokuwiki: { head: 'DokuWiki markup' }, + endnotexml: { head: 'EndNote XML bibliography' }, + epub: { head: 'EPUB' }, + fb2: { head: 'FictionBook2 e-book' }, + haddock: { head: 'Haddock markup' }, + html: { head: 'HTML' }, + ipynb: { head: 'Jupyter notebook' }, + jats: { head: 'JATS XML' }, + jira: { head: 'Jira/Confluence wiki markup' }, + json: { head: 'JSON version of native AST' }, + latex: { head: 'LaTeX' }, + markdown: { head: 'Pandoc Markdown' }, + markdown_mmd: { head: 'MultiMarkdown' }, + markdown_phpextra: { head: 'PHP Markdown Extra' }, + markdown_strict: { head: 'original unextended Markdown' }, + mediawiki: { head: 'MediaWiki markup' }, + man: { head: 'roff man' }, + muse: { head: 'Muse' }, + native: { head: 'Native Haskell' }, + opml: { head: 'OPML' }, + org: { head: 'Emacs Org mode' }, + ris: { head: 'RIS bibliography' }, + rtf: { head: 'Rich Text Format' }, + rst: { head: 'reStructuredText' }, + t2t: { head: 'txt2tags' }, + textile: { head: 'Textile' }, + tikiwiki: { head: 'TikiWiki markup' }, + twiki: { head: 'TWiki markup' }, + typst: { head: 'typst' }, + vimwiki: { head: 'Vimwiki' }, + asciidoc: { + head: 'modern AsciiDoc as interpreted by AsciiDoctor', + }, + asciidoc_legacy: { + head: 'AsciiDoc as interpreted by asciidoc-py', + }, + asciidoctor: { head: 'deprecated synonym for asciidoc' }, + beamer: { head: 'LaTeX beamer slide show' }, + chunkedhtml: { head: 'zip archive of multiple linked HTML files' }, + context: { head: 'ConTeXt' }, + docbook4: { head: 'DocBook 4' }, + docbook5: { head: 'DocBook 5' }, + epub3: { head: 'EPUB v3 book' }, + epub2: { head: 'EPUB v2' }, + gfm: { head: 'GitHub-Flavored Markdown' }, + html5: { head: 'HTML' }, + html4: { head: 'XHTML 1.0 Transitional' }, + icml: { head: 'InDesign ICML' }, + jats_archiving: { + head: 'JATS XML, Archiving and Interchange Tag Set', + }, + jats_articleauthoring: { + head: 'JATS XML, Article Authoring Tag Set', + }, + jats_publishing: { head: 'JATS XML, Journal Publishing Tag Set' }, + markua: { head: 'Markua' }, + ms: { head: 'roff ms' }, + odt: { head: 'OpenOffice text document' }, + opendocument: { head: 'OpenDocument' }, + pdf: { head: 'PDF' }, + plain: { head: 'Plain text' }, + pptx: { head: 'PowerPoint' }, + texinfo: { head: 'GNU Texinfo' }, + slideous: { head: 'Slideous HTML and JavaScript slide show' }, + slidy: { head: 'Slidy HTML and JavaScript slide show' }, + dzslides: { head: 'DZSlides HTML5 + JavaScript slide show' }, + revealjs: { head: 'reveal.js HTML5 + JavaScript slide show' }, + s5: { head: 'S5 HTML and JavaScript slide show' }, + tei: { head: 'TEI Simple' }, + xwiki: { head: 'XWiki markup' }, + zimwiki: { head: 'ZimWiki markup' }, + }, +} + +export const pandoc_output_format: List = { + form: 'list', + list: [ + 'asciidoc', + 'asciidoc_legacy', + 'asciidoctor', + 'beamer', + 'bibtex', + 'biblatex', + 'chunkedhtml', + 'commonmark', + 'commonmark_x', + 'context', + 'csljson', + 'docbook4', + 'docbook5', + 'docx', + 'dokuwiki', + 'epub3', + 'epub2', + 'fb2', + 'gfm', + 'haddock', + 'html5', + 'html4', + 'icml', + 'ipynb', + 'jats_archiving', + 'jats_articleauthoring', + 'jats_publishing', + 'jats', + 'jira', + 'json', + 'latex', + 'man', + 'markdown', + 'markdown_mmd', + 'markdown_phpextra', + 'markdown_strict', + 'markua', + 'mediawiki', + 'ms', + 'muse', + 'native', + 'odt', + 'opml', + 'opendocument', + 'org', + 'pdf', + 'plain', + 'pptx', + 'rst', + 'rtf', + 'texinfo', + 'textile', + 'slideous', + 'slidy', + 'dzslides', + 'revealjs', + 's5', + 'tei', + 'typst', + 'xwiki', + 'zimwiki', + ], +} + +export const pandoc_input_format: List = { + form: 'list', + list: [ + 'bibtex', + 'biblatex', + 'bits', + 'commonmark', + 'commonmark_x', + 'creole', + 'csljson', + 'csv', + 'tsv', + 'docbook', + 'docx', + 'dokuwiki', + 'endnotexml', + 'epub', + 'fb2', + 'gfm', + 'haddock', + 'html', + 'ipynb', + 'jats', + 'jira', + 'json', + 'latex', + 'markdown', + 'markdown_mmd', + 'markdown_phpextra', + 'markdown_strict', + 'mediawiki', + 'man', + 'muse', + 'native', + 'odt', + 'opml', + 'org', + 'ris', + 'rtf', + 'rst', + 't2t', + 'textile', + 'tikiwiki', + 'twiki', + 'typst', + 'vimwiki', + ], +} diff --git a/code/shared/source/object/patool/index.ts b/code/shared/source/object/patool/index.ts new file mode 100644 index 0000000..ba8a4b0 --- /dev/null +++ b/code/shared/source/object/patool/index.ts @@ -0,0 +1,40 @@ +import { List } from '@termsurf/form' + +export const patool_format: List = { + form: 'list', + list: [ + '7z', + 'ace', + 'adf', + 'alzip', + 'ape', + 'ar', + 'arc', + 'arj', + 'bzip2', + 'bzip3', + 'cab', + 'chm', + 'compress', + 'cpio', + 'deb', + 'dms', + 'flac', + 'gzip', + 'iso', + 'lrzip', + 'lzh', + 'lzip', + 'lzma', + 'lzop', + 'rpm', + 'rar', + 'rzip', + 'shn', + 'tar', + 'xz', + 'zip', + 'zoo', + 'zstandard', + ], +} diff --git a/code/shared/source/object/puppeteer/index.ts b/code/shared/source/object/puppeteer/index.ts new file mode 100644 index 0000000..953e058 --- /dev/null +++ b/code/shared/source/object/puppeteer/index.ts @@ -0,0 +1,26 @@ +import { Hash, List } from '@termsurf/form' + +export const puppeteer_life_cycle_event: List = { + form: 'list', + list: ['load', 'domcontentloaded', 'networkidle0', 'networkidle2'], +} + +export const puppeteer_life_cycle_event_content: Hash = { + form: 'hash', + link: 'puppeteer_life_cycle_event', + bond: { + note: { like: 'string' }, + }, + hash: { + load: { note: `Waits for the 'load' event.` }, + domcontentloaded: { + note: `Waits for the 'DOMContentLoaded' event.`, + }, + networkidle0: { + note: `Waits till there are no more than 0 network connections for at least 500 ms.`, + }, + networkidle2: { + note: `Waits till there are no more than 2 network connections for at least 500 ms.`, + }, + }, +} diff --git a/code/shared/type/source/data/rubocop.config.airbnb.json b/code/shared/source/object/rubocop/rubocop.config.airbnb.json similarity index 100% rename from code/shared/type/source/data/rubocop.config.airbnb.json rename to code/shared/source/object/rubocop/rubocop.config.airbnb.json diff --git a/code/shared/type/source/data/rubocop.config.shopify.json b/code/shared/source/object/rubocop/rubocop.config.shopify.json similarity index 100% rename from code/shared/type/source/data/rubocop.config.shopify.json rename to code/shared/source/object/rubocop/rubocop.config.shopify.json diff --git a/code/shared/type/source/code/data.ts b/code/shared/source/object/rust/index.ts similarity index 51% rename from code/shared/type/source/code/data.ts rename to code/shared/source/object/rust/index.ts index 78a5ad1..831ab23 100644 --- a/code/shared/type/source/code/data.ts +++ b/code/shared/source/object/rust/index.ts @@ -1,314 +1,4 @@ -import { Hash, List } from '@termsurf/form' -import LLVM_ARCHITECTURE_CONTENT from '../data/llvm.architecture.json' assert { type: 'json' } -import LLVM_CPU_CONTENT from '../data/llvm.cpu.json' assert { type: 'json' } -import LLVM_CPU from '../data/llvm.cpu.key.json' assert { type: 'json' } -import LLVM_FEATURE_CONTENT from '../data/llvm.feature.json' assert { type: 'json' } -import LLVM_FEATURE from '../data/llvm.feature.key.json' assert { type: 'json' } - -export const llvm_cpu: List = { - form: 'list', - list: LLVM_CPU, -} - -export const llvm_cpu_content: Hash = { - form: 'hash', - link: 'llvm_cpu', - bond: { - host: { like: 'string' }, - note: { like: 'string' }, - }, - hash: LLVM_CPU_CONTENT, -} - -export const llvm_feature: List = { - form: 'list', - list: LLVM_FEATURE, -} - -export const llvm_feature_content: Hash = { - form: 'hash', - link: 'llvm_feature', - bond: { - host: { like: 'string' }, - note: { like: 'string' }, - }, - hash: LLVM_FEATURE_CONTENT, -} - -export const llvm_architecture: List = { - form: 'list', - list: [ - 'aarch64', - 'aarch64_32', - 'aarch64_be', - 'amdgcn', - 'arm', - 'arm64', - 'arm64_32', - 'armeb', - 'avr', - 'bpf', - 'bpfeb', - 'bpfel', - 'hexagon', - 'lanai', - 'mips', - 'mips64', - 'mips64el', - 'mipsel', - 'msp430', - 'nvptx', - 'nvptx64', - 'ppc32', - 'ppc64', - 'ppc64le', - 'r600', - 'riscv32', - 'riscv64', - 'sparc', - 'sparcel', - 'sparcv9', - 'systemz', - 'thumb', - 'thumbeb', - 'wasm32', - 'wasm64', - 'x86', - 'x86_64', - 'xcore', - ], -} - -export const llvm_optimization_level: List = { - form: 'list', - list: ['0', '1', '2', '3'], -} - -export const llvm_architecture_content: Hash = { - form: 'hash', - link: 'llvm_architecture', - bond: { - host: { like: 'string' }, - note: { like: 'string' }, - cpu: { like: 'string', list: true }, - feature: { like: 'string', list: true }, - }, - hash: { - aarch64: { - ...LLVM_ARCHITECTURE_CONTENT.aarch_64, - host: 'aarch64', - note: 'AArch64 (little endian)', - }, - aarch64_32: { - ...LLVM_ARCHITECTURE_CONTENT.aarch_64_32, - host: 'aarch64_32', - note: 'AArch64 (little endian ILP32)', - }, - aarch64_be: { - ...LLVM_ARCHITECTURE_CONTENT.aarch_64_be, - host: 'aarch64_be', - note: 'AArch64 (big endian)', - }, - amdgcn: { - ...LLVM_ARCHITECTURE_CONTENT.amdgcn, - host: 'amdgcn', - note: 'AMD GCN GPUs', - }, - arm: { - ...LLVM_ARCHITECTURE_CONTENT.arm, - host: 'arm', - note: 'ARM', - }, - arm64: { - ...LLVM_ARCHITECTURE_CONTENT.arm_64, - host: 'arm64', - note: 'ARM64 (little endian)', - }, - arm64_32: { - ...LLVM_ARCHITECTURE_CONTENT.arm_64_32, - host: 'arm64_32', - note: 'ARM64 (little endian ILP32)', - }, - armeb: { - ...LLVM_ARCHITECTURE_CONTENT.armeb, - host: 'armeb', - note: 'ARM (big endian)', - }, - avr: { - ...LLVM_ARCHITECTURE_CONTENT.avr, - host: 'avr', - note: 'Atmel AVR Microcontroller', - }, - bpf: { - ...LLVM_ARCHITECTURE_CONTENT.bpf, - host: 'bpf', - note: 'BPF (host endian)', - }, - bpfeb: { - ...LLVM_ARCHITECTURE_CONTENT.bpfeb, - host: 'bpfeb', - note: 'BPF (big endian)', - }, - bpfel: { - ...LLVM_ARCHITECTURE_CONTENT.bpfel, - host: 'bpfel', - note: 'BPF (little endian)', - }, - hexagon: { - ...LLVM_ARCHITECTURE_CONTENT.hexagon, - host: 'hexagon', - note: 'Hexagon', - }, - lanai: { - ...LLVM_ARCHITECTURE_CONTENT.lanai, - host: 'lanai', - note: 'Lanai', - }, - mips: { - ...LLVM_ARCHITECTURE_CONTENT.mips, - host: 'mips', - note: 'MIPS (32-bit big endian)', - }, - mips64: { - ...LLVM_ARCHITECTURE_CONTENT.mips_64, - host: 'mips64', - note: 'MIPS (64-bit big endian)', - }, - mips64el: { - ...LLVM_ARCHITECTURE_CONTENT.mips_64_el, - host: 'mips64el', - note: 'MIPS (64-bit little endian)', - }, - mipsel: { - ...LLVM_ARCHITECTURE_CONTENT.mipsel, - host: 'mipsel', - note: 'MIPS (32-bit little endian)', - }, - msp430: { - ...LLVM_ARCHITECTURE_CONTENT.msp_430, - host: 'msp430', - note: 'MSP430 [experimental]', - }, - nvptx: { - ...LLVM_ARCHITECTURE_CONTENT.nvptx, - host: 'nvptx', - note: 'NVIDIA PTX 32-bit', - }, - nvptx64: { - ...LLVM_ARCHITECTURE_CONTENT.nvptx_64, - host: 'nvptx64', - note: 'NVIDIA PTX 64-bit', - }, - ppc32: { - ...LLVM_ARCHITECTURE_CONTENT.ppc_32, - host: 'ppc32', - note: 'PowerPC 32', - }, - ppc64: { - ...LLVM_ARCHITECTURE_CONTENT.ppc_64, - host: 'ppc64', - note: 'PowerPC 64', - }, - ppc64le: { - ...LLVM_ARCHITECTURE_CONTENT.ppc_64_le, - host: 'ppc64le', - note: 'PowerPC 64 LE', - }, - r600: { - ...LLVM_ARCHITECTURE_CONTENT.r_600, - host: 'r600', - note: 'AMD GPUs HD2XXX-HD6XXX', - }, - riscv32: { - ...LLVM_ARCHITECTURE_CONTENT.riscv_32, - host: 'riscv32', - note: '32-bit RISC-V', - }, - riscv64: { - ...LLVM_ARCHITECTURE_CONTENT.riscv_64, - host: 'riscv64', - note: '64-bit RISC-V', - }, - sparc: { - ...LLVM_ARCHITECTURE_CONTENT.sparc, - host: 'sparc', - note: 'Sparc', - }, - sparcel: { - ...LLVM_ARCHITECTURE_CONTENT.sparcel, - host: 'sparcel', - note: 'Sparc LE', - }, - sparcv9: { - ...LLVM_ARCHITECTURE_CONTENT.sparcv_9, - host: 'sparcv9', - note: 'Sparc V9', - }, - systemz: { - ...LLVM_ARCHITECTURE_CONTENT.systemz, - host: 'systemz', - note: 'SystemZ', - }, - thumb: { - ...LLVM_ARCHITECTURE_CONTENT.thumb, - host: 'thumb', - note: 'Thumb', - }, - thumbeb: { - ...LLVM_ARCHITECTURE_CONTENT.thumbeb, - host: 'thumbeb', - note: 'Thumb (big endian)', - }, - wasm32: { - ...LLVM_ARCHITECTURE_CONTENT.wasm_32, - host: 'wasm32', - note: 'WebAssembly 32-bit', - }, - wasm64: { - ...LLVM_ARCHITECTURE_CONTENT.wasm_64, - host: 'wasm64', - note: 'WebAssembly 64-bit', - }, - x86: { - ...LLVM_ARCHITECTURE_CONTENT.x_86, - host: 'x86', - note: '32-bit X86: Pentium-Pro and above', - }, - x86_64: { - ...LLVM_ARCHITECTURE_CONTENT.x_86_64, - host: 'x86-64', - note: '64-bit X86: EM64T and AMD64', - }, - xcore: { - ...LLVM_ARCHITECTURE_CONTENT.xcore, - host: 'xcore', - note: 'XCore', - }, - }, -} - -export const backend_compilation_output: List = { - form: 'list', - list: ['assembly', 'llvm-ir', 'llvm-bitcode', 'binary'], -} - -export const backend_compilation_output_content: Hash = { - form: 'hash', - link: 'backend_compilation_output', - bond: { - extension: { like: 'string', need: false }, - }, - hash: { - assembly: { extension: 'asm' }, - llvm: { extension: 'll' }, - binary: {}, - }, -} - -export const assembly_syntax: List = { - form: 'list', - list: ['intel', 'att'], -} +import { List } from '@termsurf/form' export const rust_output_format: List = { form: 'list', diff --git a/code/shared/source/object/unarchiver/index.ts b/code/shared/source/object/unarchiver/index.ts new file mode 100644 index 0000000..572cf1c --- /dev/null +++ b/code/shared/source/object/unarchiver/index.ts @@ -0,0 +1,42 @@ +import { Hash, List } from '@termsurf/form' + +export const unarchiver_format: List = { + form: 'list', + list: [ + 'zip', + 'rar', + '7z', + 'tar', + 'gzip', + 'bzip2', + 'lzma', + 'cab', + 'msi', + 'nsis', + 'exe', + 'iso', + ], +} + +// https://github.com/ashang/unar/blob/master/README.md +export const unarchiver_format_content: Hash = { + form: 'hash', + link: 'unarchiver_format', + bond: { + head: { like: 'string' }, + }, + hash: { + zip: { head: 'Zip' }, + rar: { head: 'RAR' }, + '7z': { head: '7z' }, + tar: { head: 'Tar' }, + gzip: { head: 'Gzip' }, + bzip2: { head: 'Bzip2' }, + lzma: { head: 'LZMA' }, + cab: { head: 'CAB' }, + msi: { head: 'MSI' }, + nsis: { head: 'NSIS' }, + exe: { head: 'EXE' }, + iso: { head: 'ISO' }, + }, +} diff --git a/code/shared/source/video.ts b/code/shared/source/video.ts new file mode 100644 index 0000000..d620d8c --- /dev/null +++ b/code/shared/source/video.ts @@ -0,0 +1,56 @@ +import { Form } from '@termsurf/form' + +export const remove_audio_from_video_with_ffmpeg: Form = { + form: 'form', + link: { + inputPath: { like: 'string' }, + outputPath: { like: 'string' }, + }, +} + +export const add_audio_to_video_with_ffmpeg: Form = { + form: 'form', + link: { + inputVideoPath: { like: 'string' }, + inputAudioPath: { like: 'string' }, + outputPath: { like: 'string' }, + audioCodec: { like: 'string', base: 'aac' }, + fit: { like: 'boolean' }, + }, +} + +export const compress_mp4_with_ffmpeg: Form = { + form: 'form', + link: { + input: { + link: { + format: { like: 'string', name: { mark: 'I' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'i' } }, + }, + }, + }, + }, + output: { + link: { + format: { like: 'string', name: { mark: 'O' } }, + file: { + link: { + path: { like: 'string', name: { mark: 'o' } }, + }, + }, + }, + }, + audioCodec: { + like: 'ffmpeg_codec_audio', + fall: 'aac', + need: false, + }, + videoCodec: { + like: 'ffmpeg_codec_video', + fall: 'h264', + need: false, + }, + }, +} diff --git a/code/shared/type/cast.ts b/code/shared/type/cast.ts index c3bd382..b28aa45 100644 --- a/code/shared/type/cast.ts +++ b/code/shared/type/cast.ts @@ -25,6 +25,18 @@ export type ArchiveWithRar = { } } +export type ArchiveWithZip = { + input: { + path: string + } + output: { + format: string + file: { + path: string + } + } +} + export const ASSEMBLY_SYNTAX = ['intel', 'att'] as const export type AssemblySyntax = (typeof ASSEMBLY_SYNTAX)[number] @@ -381,15 +393,6 @@ export type CheckFileTypeUsingMagicBytes = { } } -export type CheckIfPdfIsValidWithData = { - input: { - format: string - file: { - data: ArrayBuffer - } - } -} - export type ClangStyleAll = { basedOnStyle?: string alignAfterOpenBracket?: @@ -3532,18 +3535,6 @@ export type CompressMp4WithFfmpeg = { videoCodec?: FfmpegCodecVideo } -export type CompressWithZip = { - input: { - path: string - } - output: { - format: string - file: { - path: string - } - } -} - export type ConvertAiToSvgWithInkscape = { input: { file: { @@ -75383,25 +75374,6 @@ export const EXIFTOOL_TAG_CONTENT: ExiftoolTagContent = { }, } -export type ExtractMetadataFromImage = { - input: { - format: string - file: { - path: string - } - } - copyright?: string - creator?: string - license?: string - keywords?: Array - artist?: string - originalDate?: Date - allDates?: Date - creationDate?: Date - title?: string - description?: string -} - export const FFMPEG_CODEC_AUDIO = [ '4gv', '8svx_exp', @@ -92305,12 +92277,6 @@ export type FormatSwift = { } } -export type GenerateGifWithGifsicle = { - width?: number - height?: number - unoptimize?: boolean -} - export type ImageMagicColorMatrix = { row: number column: number @@ -95389,6 +95355,25 @@ export const INKSCAPE_IMPORT_FORMAT = ['ai'] as const export type InkscapeImportFormat = (typeof INKSCAPE_IMPORT_FORMAT)[number] +export type InspectMetadataFromImage = { + input: { + format: string + file: { + path: string + } + } + copyright?: string + creator?: string + license?: string + keywords?: Array + artist?: string + originalDate?: Date + allDates?: Date + creationDate?: Date + title?: string + description?: string +} + export const LIBRE_OFFICE_INPUT_FORMAT = [ 'html', 'mediawiki', @@ -108480,6 +108465,15 @@ export const UNARCHIVER_FORMAT_CONTENT: UnarchiverFormatContent = { }, } +export type ValidatePdfWithData = { + input: { + format: string + file: { + data: ArrayBuffer + } + } +} + export type VerifyImageWithImageMagick = { input: { format: ImageMagickFormat diff --git a/code/shared/type/source/archive.ts b/code/shared/type/source/archive.ts deleted file mode 100644 index 36e6074..0000000 --- a/code/shared/type/source/archive.ts +++ /dev/null @@ -1,201 +0,0 @@ -import { Form, Hash, List } from '@termsurf/form' - -export const decompress_with_7z: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - path: { like: 'string' }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { path: { like: 'string' } }, - }, - }, - }, - }, -} - -export const decompress_with_unarchiver: Form = { - form: 'form', - link: { - output: { - link: { - overwrite: { like: 'boolean', fall: false, need: false }, - directory: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - input: { - link: { - password: { like: 'string', need: false }, - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { path: { like: 'string' } }, - }, - }, - }, - }, -} - -export const archive_with_rar: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - path: { like: 'string' }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { path: { like: 'string' } }, - }, - }, - }, - }, -} - -export const unarchiver_format: List = { - form: 'list', - list: [ - 'zip', - 'rar', - '7z', - 'tar', - 'gzip', - 'bzip2', - 'lzma', - 'cab', - 'msi', - 'nsis', - 'exe', - 'iso', - ], -} - -// https://github.com/ashang/unar/blob/master/README.md -export const unarchiver_format_content: Hash = { - form: 'hash', - link: 'unarchiver_format', - bond: { - head: { like: 'string' }, - }, - hash: { - zip: { head: 'Zip' }, - rar: { head: 'RAR' }, - '7z': { head: '7z' }, - tar: { head: 'Tar' }, - gzip: { head: 'Gzip' }, - bzip2: { head: 'Bzip2' }, - lzma: { head: 'LZMA' }, - cab: { head: 'CAB' }, - msi: { head: 'MSI' }, - nsis: { head: 'NSIS' }, - exe: { head: 'EXE' }, - iso: { head: 'ISO' }, - }, -} - -export const archive_format: List = { - form: 'list', - list: ['zip'], -} - -export const convert_archive: Form = { - form: 'form', - link: { - temporary: { - link: { - directory: { - link: { - path: { like: 'string', name: { mark: 'm' } }, - }, - }, - }, - }, - input: { - link: { - format: { like: 'unarchiver_format', name: { mark: 'I' } }, - file: { - link: { path: { like: 'string' } }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { path: { like: 'string' } }, - }, - }, - }, - }, -} - -export const compress_with_zip: Form = { - form: 'form', - link: { - input: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { path: { like: 'string', name: { mark: 'o' } } }, - }, - }, - }, - }, -} - -export const patool_format: List = { - form: 'list', - list: [ - '7z', - 'ace', - 'adf', - 'alzip', - 'ape', - 'ar', - 'arc', - 'arj', - 'bzip2', - 'bzip3', - 'cab', - 'chm', - 'compress', - 'cpio', - 'deb', - 'dms', - 'flac', - 'gzip', - 'iso', - 'lrzip', - 'lzh', - 'lzip', - 'lzma', - 'lzop', - 'rpm', - 'rar', - 'rzip', - 'shn', - 'tar', - 'xz', - 'zip', - 'zoo', - 'zstandard', - ], -} diff --git a/code/shared/type/source/call/convert.ts b/code/shared/type/source/call/convert.ts deleted file mode 100644 index d641038..0000000 --- a/code/shared/type/source/call/convert.ts +++ /dev/null @@ -1,89 +0,0 @@ -import _ from 'lodash' -import fs from 'fs' -import { FFMPEG_FORMAT } from '../../cast' -import { convert_video_with_ffmpeg } from '../video' -import make from '@termsurf/form/host/make' -import { toPascalCase } from '@termsurf/form' - -const mesh: Record = { - convert_video_with_ffmpeg: without(convert_video_with_ffmpeg, [ - 'input.link.file.link.path', - 'input.link.file.link.format', - 'output.link.file.link.path', - 'output.link.file.link.format', - ]), -} - -const type: Record = {} - -FFMPEG_FORMAT.forEach(a => { - FFMPEG_FORMAT.forEach(b => { - if (a === b) { - return - } - - // if (a === 'mov' && b === 'mp4') { - type[String(a)] ??= {} - type[String(a)][String(b)] ??= {} - type[String(a)][String(b)].tool ??= {} - type[String(a)][String(b)].tool.list ??= {} - type[String(a)][String(b)].tool.list.ffmpeg = true - type[String(a)][String(b)].tool.base ??= {} - type[String(a)][String(b)].tool.base.ffmpeg = - 'convert_video_with_ffmpeg' - type[String(a)][String(b)].base = 'convert_video_with_ffmpeg' - // } - }) -}) - -make({ test: `../source/index.js`, mesh }).then(({ tree }) => { - // fs.writeFileSync(`./code/shared/type/index.ts`, tree.base as string) - // fs.writeFileSync(`./code/cli/type/link.ts`, tree.line) - - const text: Array = [tree.cast] - text.push('') - text.push(`export type Convert = {`) - for (const a in type) { - text.push(` "${a}": {`) - for (const b in type[a]) { - // console.log(a, b) - const bond = type[a][b] - text.push(` "${b}": {`) - if (bond.tool) { - text.push(` tool: {`) - text.push( - ` list: ${Object.keys(bond.tool.list) - .map(v => JSON.stringify(v)) - .join(' | ')}`, - ) - text.push(` base: {`) - Object.keys(bond.tool.base).forEach(t => { - text.push( - ` ${t}: ${toPascalCase(bond.tool.base[t])}`, - ) - }) - text.push(` }`) - text.push(` }`) - } - if (bond.base) { - text.push(` base: ${toPascalCase(bond.base)}`) - } - text.push(` }`) - } - text.push(` }`) - } - text.push(`}`) - - fs.writeFileSync( - `./code/shared/type/call/convert.cast.ts`, - text.join('\n'), - ) -}) - -function without(obj, paths: Array) { - const out = _.cloneDeep(obj) - paths.forEach(path => { - _.unset(out, path) - }) - return out -} diff --git a/code/shared/type/source/code/index.ts b/code/shared/type/source/code/index.ts deleted file mode 100644 index 2d4d459..0000000 --- a/code/shared/type/source/code/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './data.js' -export * from './compile.js' -export * from './format.js' diff --git a/code/shared/type/source/document.ts b/code/shared/type/source/document.ts deleted file mode 100644 index 347ff10..0000000 --- a/code/shared/type/source/document.ts +++ /dev/null @@ -1,733 +0,0 @@ -import { Form, Hash, List } from '@termsurf/form' - -export const libre_office_input_format: List = { - form: 'list', - list: [ - 'html', - 'mediawiki', - 'csv', - 'pptx', - 'ppt', - 'docx', - 'doc', - 'pdf', - 'wmf', - 'emf', - 'svg', - 'xlsx', - 'xls', - ], -} - -export const libre_office_output_format: List = { - form: 'list', - list: [ - 'html', - 'mediawiki', - 'csv', - 'pptx', - 'ppt', - 'wmf', - 'emf', - 'svg', - 'xlsx', - 'xls', - 'epub', - 'pdf', - ], -} - -export const pandoc_format_content: Hash = { - form: 'hash', - bond: { - head: { like: 'string' }, - }, - hash: { - bibtex: { head: 'BibTeX bibliography' }, - biblatex: { head: 'BibLaTeX bibliography' }, - bits: { head: 'BITS XML, alias for jats' }, - commonmark: { head: 'CommonMark Markdown' }, - commonmark_x: { head: 'CommonMark Markdown with extensions' }, - creole: { head: 'Creole 1.0' }, - csljson: { head: 'CSL JSON bibliography' }, - csv: { head: 'CSV table' }, - tsv: { head: 'TSV table' }, - docbook: { head: 'DocBook' }, - docx: { head: 'Word docx' }, - dokuwiki: { head: 'DokuWiki markup' }, - endnotexml: { head: 'EndNote XML bibliography' }, - epub: { head: 'EPUB' }, - fb2: { head: 'FictionBook2 e-book' }, - haddock: { head: 'Haddock markup' }, - html: { head: 'HTML' }, - ipynb: { head: 'Jupyter notebook' }, - jats: { head: 'JATS XML' }, - jira: { head: 'Jira/Confluence wiki markup' }, - json: { head: 'JSON version of native AST' }, - latex: { head: 'LaTeX' }, - markdown: { head: 'Pandoc Markdown' }, - markdown_mmd: { head: 'MultiMarkdown' }, - markdown_phpextra: { head: 'PHP Markdown Extra' }, - markdown_strict: { head: 'original unextended Markdown' }, - mediawiki: { head: 'MediaWiki markup' }, - man: { head: 'roff man' }, - muse: { head: 'Muse' }, - native: { head: 'Native Haskell' }, - opml: { head: 'OPML' }, - org: { head: 'Emacs Org mode' }, - ris: { head: 'RIS bibliography' }, - rtf: { head: 'Rich Text Format' }, - rst: { head: 'reStructuredText' }, - t2t: { head: 'txt2tags' }, - textile: { head: 'Textile' }, - tikiwiki: { head: 'TikiWiki markup' }, - twiki: { head: 'TWiki markup' }, - typst: { head: 'typst' }, - vimwiki: { head: 'Vimwiki' }, - asciidoc: { - head: 'modern AsciiDoc as interpreted by AsciiDoctor', - }, - asciidoc_legacy: { - head: 'AsciiDoc as interpreted by asciidoc-py', - }, - asciidoctor: { head: 'deprecated synonym for asciidoc' }, - beamer: { head: 'LaTeX beamer slide show' }, - chunkedhtml: { head: 'zip archive of multiple linked HTML files' }, - context: { head: 'ConTeXt' }, - docbook4: { head: 'DocBook 4' }, - docbook5: { head: 'DocBook 5' }, - epub3: { head: 'EPUB v3 book' }, - epub2: { head: 'EPUB v2' }, - gfm: { head: 'GitHub-Flavored Markdown' }, - html5: { head: 'HTML' }, - html4: { head: 'XHTML 1.0 Transitional' }, - icml: { head: 'InDesign ICML' }, - jats_archiving: { - head: 'JATS XML, Archiving and Interchange Tag Set', - }, - jats_articleauthoring: { - head: 'JATS XML, Article Authoring Tag Set', - }, - jats_publishing: { head: 'JATS XML, Journal Publishing Tag Set' }, - markua: { head: 'Markua' }, - ms: { head: 'roff ms' }, - odt: { head: 'OpenOffice text document' }, - opendocument: { head: 'OpenDocument' }, - pdf: { head: 'PDF' }, - plain: { head: 'Plain text' }, - pptx: { head: 'PowerPoint' }, - texinfo: { head: 'GNU Texinfo' }, - slideous: { head: 'Slideous HTML and JavaScript slide show' }, - slidy: { head: 'Slidy HTML and JavaScript slide show' }, - dzslides: { head: 'DZSlides HTML5 + JavaScript slide show' }, - revealjs: { head: 'reveal.js HTML5 + JavaScript slide show' }, - s5: { head: 'S5 HTML and JavaScript slide show' }, - tei: { head: 'TEI Simple' }, - xwiki: { head: 'XWiki markup' }, - zimwiki: { head: 'ZimWiki markup' }, - }, -} - -export const pandoc_output_format: List = { - form: 'list', - list: [ - 'asciidoc', - 'asciidoc_legacy', - 'asciidoctor', - 'beamer', - 'bibtex', - 'biblatex', - 'chunkedhtml', - 'commonmark', - 'commonmark_x', - 'context', - 'csljson', - 'docbook4', - 'docbook5', - 'docx', - 'dokuwiki', - 'epub3', - 'epub2', - 'fb2', - 'gfm', - 'haddock', - 'html5', - 'html4', - 'icml', - 'ipynb', - 'jats_archiving', - 'jats_articleauthoring', - 'jats_publishing', - 'jats', - 'jira', - 'json', - 'latex', - 'man', - 'markdown', - 'markdown_mmd', - 'markdown_phpextra', - 'markdown_strict', - 'markua', - 'mediawiki', - 'ms', - 'muse', - 'native', - 'odt', - 'opml', - 'opendocument', - 'org', - 'pdf', - 'plain', - 'pptx', - 'rst', - 'rtf', - 'texinfo', - 'textile', - 'slideous', - 'slidy', - 'dzslides', - 'revealjs', - 's5', - 'tei', - 'typst', - 'xwiki', - 'zimwiki', - ], -} - -export const pandoc_input_format: List = { - form: 'list', - list: [ - 'bibtex', - 'biblatex', - 'bits', - 'commonmark', - 'commonmark_x', - 'creole', - 'csljson', - 'csv', - 'tsv', - 'docbook', - 'docx', - 'dokuwiki', - 'endnotexml', - 'epub', - 'fb2', - 'gfm', - 'haddock', - 'html', - 'ipynb', - 'jats', - 'jira', - 'json', - 'latex', - 'markdown', - 'markdown_mmd', - 'markdown_phpextra', - 'markdown_strict', - 'mediawiki', - 'man', - 'muse', - 'native', - 'odt', - 'opml', - 'org', - 'ris', - 'rtf', - 'rst', - 't2t', - 'textile', - 'tikiwiki', - 'twiki', - 'typst', - 'vimwiki', - ], -} - -export const puppeteer_life_cycle_event: List = { - form: 'list', - list: ['load', 'domcontentloaded', 'networkidle0', 'networkidle2'], -} - -export const puppeteer_life_cycle_event_content: Hash = { - form: 'hash', - link: 'puppeteer_life_cycle_event', - bond: { - note: { like: 'string' }, - }, - hash: { - load: { note: `Waits for the 'load' event.` }, - domcontentloaded: { - note: `Waits for the 'DOMContentLoaded' event.`, - }, - networkidle0: { - note: `Waits till there are no more than 0 network connections for at least 500 ms.`, - }, - networkidle2: { - note: `Waits till there are no more than 2 network connections for at least 500 ms.`, - }, - }, -} - -export const convert_html_to_pdf_with_puppeteer: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - viewport: { - link: { - width: { like: 'natural_number', need: false }, - height: { like: 'natural_number', need: false }, - }, - }, - proxy: { like: 'string', need: false }, - waitUntil: { like: 'puppeteer_life_cycle_event', need: false }, - }, -} - -export const convert_html_to_png_with_puppeteer: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - viewport: { - link: { - width: { like: 'natural_number', need: false }, - height: { like: 'natural_number', need: false }, - }, - }, - proxy: { like: 'string', need: false }, - waitUntil: { like: 'puppeteer_life_cycle_event', need: false }, - }, -} - -export const convert_document_with_pandoc: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'pandoc_input_format', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - format: { - like: 'pandoc_output_format', - name: { mark: 'O' }, - }, - }, - }, - }, -} - -export const calibre_input_format: List = { - form: 'list', - list: [ - 'azw4', - 'chm', - 'comic', - 'djvu', - 'docx', - 'epub', - 'fb2', - 'htlz', - 'html', - 'lit', - 'lrf', - 'mobi', - 'odt', - 'pdb', - 'pdf', - 'pml', - 'rb', - 'rtf', - 'recipe', - 'snb', - 'tcr', - 'txt', - ], -} - -export const calibre_input_format_content: Hash = { - form: 'hash', - link: 'calibre_input_format', - bond: { - head: { like: 'string' }, - }, - hash: { - azw4: { head: 'AZW4' }, - chm: { head: 'CHM' }, - comic: { head: 'Comic' }, - djvu: { head: 'DJVU' }, - docx: { head: 'DOCX' }, - epub: { head: 'EPUB' }, - fb2: { head: 'FB2' }, - htlz: { head: 'HTLZ' }, - html: { head: 'HTML' }, - lit: { head: 'LIT' }, - lrf: { head: 'LRF' }, - mobi: { head: 'MOBI' }, - odt: { head: 'ODT' }, - pdb: { head: 'PDB' }, - pdf: { head: 'PDF' }, - pml: { head: 'PML' }, - rb: { head: 'RB' }, - rtf: { head: 'RTF' }, - recipe: { head: 'Recipe' }, - snb: { head: 'SNB' }, - tcr: { head: 'TCR' }, - txt: { head: 'TXT' }, - }, -} - -export const calibre_output_format: List = { - form: 'list', - list: [ - 'azw3', - 'docx', - 'epub', - 'fb2', - 'html', - 'htmlz', - 'lit', - 'lrf', - 'mobi', - 'oeb', - 'pdb', - 'pdf', - 'pml', - 'rb', - 'rtf', - 'snb', - 'tcr', - 'txt', - 'txtz', - ], -} - -export const calibre_output_format_content: Hash = { - form: 'hash', - link: 'calibre_output_format', - bond: { - head: { like: 'string' }, - }, - hash: { - azw3: { head: 'AZW3' }, - docx: { head: 'DOCX' }, - epub: { head: 'EPUB' }, - fb2: { head: 'FB2' }, - html: { head: 'HTML' }, - htmlz: { head: 'HTMLZ' }, - lit: { head: 'LIT' }, - lrf: { head: 'LRF' }, - mobi: { head: 'MOBI' }, - oeb: { head: 'OEB' }, - pdb: { head: 'PDB' }, - pdf: { head: 'PDF' }, - pml: { head: 'PML' }, - rb: { head: 'RB' }, - rtf: { head: 'RTF' }, - snb: { head: 'SNB' }, - tcr: { head: 'TCR' }, - txt: { head: 'TXT' }, - txtz: { head: 'TXTZ' }, - }, -} - -export const calibre_input_profile: List = { - form: 'list', - list: [ - 'cybookg3', - 'cybook_opus', - 'default', - 'hanlinv3', - 'hanlinv5', - 'illiad', - 'irexdr1000', - 'irexdr800', - 'kindle', - 'msreader', - 'mobipocket', - 'nook', - 'sony', - 'sony300', - 'sony900', - ], -} - -export const calibre_output_profile: List = { - form: 'list', - list: [ - 'cybookg3', - 'cybook_opus', - 'default', - 'generic_eink', - 'generic_eink_hd', - 'generic_eink_large', - 'hanlinv3', - 'hanlinv5', - 'illiad', - 'ipad', - 'ipad3', - 'irexdr1000', - 'irexdr800', - 'jetbook5', - 'kindle', - 'kindle_dx', - 'kindle_fire', - 'kindle_oasis', - 'kindle_pw', - 'kindle_pw3', - 'kindle_voyage', - 'kobo', - 'msreader', - 'mobipocket', - 'nook', - 'nook_color', - 'nook_hd_plus', - 'pocketbook_900', - 'pocketbook_pro_912', - 'galaxy', - 'sony', - 'sony300', - 'sony900', - 'sony-landscape', - 'sonyt3', - 'tablet', - ], -} - -// https://manpages.ubuntu.com/manpages/bionic/man1/ebook-convert.1.html - -export const convert_latex_to_pdf_with_pdf_latex: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - output: { - link: { - directory: { - link: { - path: { like: 'string' }, - }, - }, - file: { - link: { - name: { like: 'string' }, - }, - }, - }, - }, - }, -} - -export const convert_document_with_calibre: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'calibre_input_format', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'calibre_output_format', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - }, - }, - }, -} - -export const convert_document_with_libre_office: Form = { - form: 'form', - link: { - input: { - link: { - format: { - like: 'libre_office_input_format', - name: { mark: 'I' }, - }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - format: { - like: 'libre_office_output_format', - name: { mark: 'O' }, - }, - directory: { - link: { - path: { like: 'string', name: { mark: 'b' } }, - }, - }, - }, - }, - }, -} - -export const convert_document_with_jupyter: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string' }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - format: { like: 'string' }, - }, - }, - }, - }, - }, -} - -export const slice_pdf_with_data: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - data: { like: 'ArrayBuffer' }, - }, - }, - }, - }, - startPage: { like: 'natural_number' }, - endPage: { like: 'natural_number' }, - }, -} - -export const check_if_pdf_is_valid_with_data: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - data: { like: 'ArrayBuffer' }, - }, - }, - }, - }, - }, -} - -export const slice_pdf: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - startPage: { like: 'natural_number', name: { mark: 'S' } }, - endPage: { like: 'natural_number', name: { mark: 'E' } }, - output: { - link: { - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - }, - }, - }, -} - -export const sanitize_html_from_content: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - content: { like: 'string' }, - }, - }, - }, -} diff --git a/code/shared/type/source/video.ts b/code/shared/type/source/video.ts deleted file mode 100644 index 9ac9fec..0000000 --- a/code/shared/type/source/video.ts +++ /dev/null @@ -1,333 +0,0 @@ -import { Form, Hash, List } from '@termsurf/form' -import FFMPEG_CODEC_AUDIO from './data/ffmpeg.codecs.audio.keys.json' assert { type: 'json' } -import FFMPEG_CODEC_CONTENT from './data/ffmpeg.codecs.json' assert { type: 'json' } -import FFMPEG_CODEC_SUBTITLE from './data/ffmpeg.codecs.subtitle.keys.json' assert { type: 'json' } -import FFMPEG_CODEC_VIDEO from './data/ffmpeg.codecs.video.keys.json' assert { type: 'json' } -import FFMPEG_DECODER_AUDIO from './data/ffmpeg.decoders.audio.keys.json' assert { type: 'json' } -import FFMPEG_DECODER_CONTENT from './data/ffmpeg.decoders.json' assert { type: 'json' } -import FFMPEG_DECODER_SUBTITLE from './data/ffmpeg.decoders.subtitle.keys.json' assert { type: 'json' } -import FFMPEG_DECODER_VIDEO from './data/ffmpeg.decoders.video.keys.json' assert { type: 'json' } -import FFMPEG_ENCODER_AUDIO from './data/ffmpeg.encoders.audio.keys.json' assert { type: 'json' } -import FFMPEG_ENCODER_CONTENT from './data/ffmpeg.encoders.json' assert { type: 'json' } -import FFMPEG_ENCODER_SUBTITLE from './data/ffmpeg.encoders.subtitle.keys.json' assert { type: 'json' } -import FFMPEG_ENCODER_VIDEO from './data/ffmpeg.encoders.video.keys.json' assert { type: 'json' } -import FFMPEG_FORMAT_CONTENT from './data/ffmpeg.formats.json' assert { type: 'json' } -import FFMPEG_FORMAT from './data/ffmpeg.formats.keys.json' assert { type: 'json' } - -export const ffmpeg_codec_audio: List = { - form: 'list', - list: FFMPEG_CODEC_AUDIO, -} -export const ffmpeg_codec_content: Hash = { - form: 'hash', - hash: FFMPEG_CODEC_CONTENT, - bond: { - label: { like: 'string' }, - type: { like: 'string', need: false }, - supportsDecoding: { like: 'boolean' }, - supportsEncoding: { like: 'boolean' }, - intraFrameOnly: { like: 'boolean' }, - lossy: { like: 'boolean' }, - lossless: { like: 'boolean' }, - }, -} - -export const ffmpeg_codec_subtitle: List = { - form: 'list', - list: FFMPEG_CODEC_SUBTITLE, -} - -export const ffmpeg_codec_video: List = { - form: 'list', - list: FFMPEG_CODEC_VIDEO, -} - -export const ffmpeg_decoder_audio: List = { - form: 'list', - list: FFMPEG_DECODER_AUDIO, -} - -export const ffmpeg_decoder_content: Hash = { - form: 'hash', - hash: FFMPEG_DECODER_CONTENT, - bond: { - label: { like: 'string' }, - type: { like: 'string' }, - frameLevelMultithreading: { like: 'boolean' }, - sliceLevelMultithreading: { like: 'boolean' }, - experimental: { like: 'boolean' }, - supportsDrawHorizontalBand: { like: 'boolean' }, - supportsDirectRenderingMethod1: { like: 'boolean' }, - }, -} - -export const ffmpeg_decoder_subtitle: List = { - form: 'list', - list: FFMPEG_DECODER_SUBTITLE, -} - -export const ffmpeg_decoder_video: List = { - form: 'list', - list: FFMPEG_DECODER_VIDEO, -} - -export const ffmpeg_encoder_audio: List = { - form: 'list', - list: FFMPEG_ENCODER_AUDIO, -} - -export const ffmpeg_encoder_content: Hash = { - form: 'hash', - hash: FFMPEG_ENCODER_CONTENT, - bond: { - label: { like: 'string' }, - type: { like: 'string' }, - frameLevelMultithreading: { like: 'boolean' }, - sliceLevelMultithreading: { like: 'boolean' }, - experimental: { like: 'boolean' }, - supportsDrawHorizontalBand: { like: 'boolean' }, - supportsDirectRenderingMethod1: { like: 'boolean' }, - }, -} - -export const ffmpeg_encoder_subtitle: List = { - form: 'list', - list: FFMPEG_ENCODER_SUBTITLE, -} - -export const ffmpeg_encoder_video: List = { - form: 'list', - list: FFMPEG_ENCODER_VIDEO, -} - -export const ffmpeg_format_content: Hash = { - form: 'hash', - hash: FFMPEG_FORMAT_CONTENT, - bond: { - label: { like: 'string' }, - supportsDemuxing: { like: 'boolean' }, - supportsMuxing: { like: 'boolean' }, - }, -} - -export const ffmpeg_format: List = { - form: 'list', - list: FFMPEG_FORMAT, -} - -export const remove_audio_from_video_with_ffmpeg: Form = { - form: 'form', - link: { - inputPath: { like: 'string' }, - outputPath: { like: 'string' }, - }, -} - -export const add_audio_to_video_with_ffmpeg: Form = { - form: 'form', - link: { - inputVideoPath: { like: 'string' }, - inputAudioPath: { like: 'string' }, - outputPath: { like: 'string' }, - audioCodec: { like: 'string', base: 'aac' }, - fit: { like: 'boolean' }, - }, -} - -export const convert_video_to_audio_with_ffmpeg: Form = { - form: 'form', - link: { - inputPath: { like: 'string' }, - outputPath: { like: 'string' }, - }, -} - -export const convert_video_with_ffmpeg_base: Form = { - form: 'form', - link: { - audioCodec: { like: 'ffmpeg_codec_audio', need: false }, - videoCodec: { like: 'ffmpeg_codec_video', need: false }, - audioBitRate: { like: 'integer', need: false }, - videoBitRate: { like: 'integer', need: false }, - frameRate: { like: 'integer', need: false }, - startTime: { - need: false, - case: [ - { like: 'integer', test: 'test_time_integer' }, - { like: 'string', test: 'test_time_string' }, - ], - }, - endTime: { - need: false, - case: [ - { like: 'integer', test: 'test_time_integer' }, - { like: 'string', test: 'test_time_string' }, - ], - }, - strict: { - like: 'ffmpeg_strict_option', - fall: 'strict', - need: false, - }, - overwrite: { - like: 'boolean', - need: false, - fall: false, - name: { mark: 'f' }, - }, - progress: { - like: 'boolean', - need: false, - fall: false, - name: { mark: 'p' }, - }, - scaleWidth: { like: 'integer', need: false }, - scaleHeight: { like: 'integer', need: false }, - audioChannels: { like: 'integer', need: false }, - audioSamplingFrequency: { like: 'integer', need: false }, - subtitleCodec: { like: 'ffmpeg_codec_subtitle', need: false }, - duration: { - need: false, - case: [ - { like: 'integer', test: 'test_time_integer' }, - { like: 'string', test: 'test_time_string' }, - ], - }, - rotation: { like: 'decimal', need: false }, - }, -} - -export const convert_video_with_ffmpeg: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - }, - }, - ...convert_video_with_ffmpeg_base.link, - }, -} - -export const convert_mp4_to_gif_with_ffmpeg: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - }, - }, - fps: { like: 'integer' }, - width: { like: 'integer' }, - startTime: { - case: [ - { like: 'integer', test: 'test_time_integer' }, - { like: 'string', test: 'test_time_string' }, - ], - }, - endTime: { - case: [ - { like: 'integer', test: 'test_time_integer' }, - { like: 'string', test: 'test_time_string' }, - ], - }, - duration: { - case: [ - { like: 'integer', test: 'test_time_integer' }, - { like: 'string', test: 'test_time_string' }, - ], - }, - }, -} - -export const ffmpeg_strict_option: List = { - form: 'list', - list: ['very', 'strict', 'normal', 'unofficial', 'experimental'], -} - -export const ffmpeg_strict_option_content: Hash = { - form: 'hash', - link: 'ffmpeg_strict_option', - bond: { - note: { like: 'string' }, - }, - hash: { - very: { - note: 'Strictly conform to a older more strict version of the spec or reference software.', - }, - strict: { - note: 'Strictly conform to all the things in the spec no matter what consequences.', - }, - normal: { note: '' }, - unofficial: { note: 'Allow unofficial extensions.' }, - experimental: { - note: 'Allow non standardized experimental things.', - }, - }, -} - -export const compress_mp4_with_ffmpeg: Form = { - form: 'form', - link: { - input: { - link: { - format: { like: 'string', name: { mark: 'I' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'i' } }, - }, - }, - }, - }, - output: { - link: { - format: { like: 'string', name: { mark: 'O' } }, - file: { - link: { - path: { like: 'string', name: { mark: 'o' } }, - }, - }, - }, - }, - audioCodec: { - like: 'ffmpeg_codec_audio', - fall: 'aac', - need: false, - }, - videoCodec: { - like: 'ffmpeg_codec_video', - fall: 'h264', - need: false, - }, - }, -} diff --git a/code/shared/type/take.ts b/code/shared/type/take.ts index ba54a9c..6ad37b7 100644 --- a/code/shared/type/take.ts +++ b/code/shared/type/take.ts @@ -1,7 +1,7 @@ import { z } from 'zod' import * as Cast from './cast.js' import { MAKE, TEST } from '@termsurf/form' -import * as code from './source/index.js' +import * as code from './code.js' export const AddAudioToVideoWithFfmpegModel: z.ZodType = z.object({ @@ -30,6 +30,19 @@ export const ArchiveWithRarModel: z.ZodType = }), }) +export const ArchiveWithZipModel: z.ZodType = + z.object({ + input: z.object({ + path: z.string(), + }), + output: z.object({ + format: z.string(), + file: z.object({ + path: z.string(), + }), + }), + }) + export const AssemblySyntaxModel: z.ZodType = z.enum(Cast.ASSEMBLY_SYNTAX) @@ -156,16 +169,6 @@ export const CheckFileTypeUsingMagicBytesModel: z.ZodType = - z.object({ - input: z.object({ - format: z.string(), - file: z.object({ - data: z.instanceof(ArrayBuffer), - }), - }), - }) - export const ClangStyleAllModel: z.ZodType = z.object({ basedOnStyle: z.optional(z.string()), @@ -756,19 +759,6 @@ export const CompressMp4WithFfmpegModel: z.ZodType = ), }) -export const CompressWithZipModel: z.ZodType = - z.object({ - input: z.object({ - path: z.string(), - }), - output: z.object({ - format: z.string(), - file: z.object({ - path: z.string(), - }), - }), - }) - export const ConvertAiToSvgWithInkscapeModel: z.ZodType = z.object({ input: z.object({ @@ -1169,26 +1159,6 @@ export const ExiftoolImageFormatContentKeyModel: z.ZodType = z.enum(Cast.EXIFTOOL_TAG_CONTENT_KEY) -export const ExtractMetadataFromImageModel: z.ZodType = - z.object({ - input: z.object({ - format: z.string(), - file: z.object({ - path: z.string(), - }), - }), - copyright: z.optional(z.string()), - creator: z.optional(z.string()), - license: z.optional(z.string()), - keywords: z.optional(z.array(z.string())), - artist: z.optional(z.string()), - originalDate: z.optional(z.coerce.date()), - allDates: z.optional(z.coerce.date()), - creationDate: z.optional(z.coerce.date()), - title: z.optional(z.string()), - description: z.optional(z.string()), - }) - export const FfmpegCodecAudioModel: z.ZodType = z.enum(Cast.FFMPEG_CODEC_AUDIO) @@ -1396,13 +1366,6 @@ export const FormatSwiftModel: z.ZodType = z.object({ }), }) -export const GenerateGifWithGifsicleModel: z.ZodType = - z.object({ - width: z.optional(z.number().int().gte(0)), - height: z.optional(z.number().int().gte(0)), - unoptimize: z.optional(z.boolean()), - }) - export const ImageMagicColorMatrixModel: z.ZodType = z.object({ row: z.number().int().gte(0), @@ -1437,6 +1400,26 @@ export const InkscapeExportFormatModel: z.ZodType = export const InkscapeImportFormatModel: z.ZodType = z.enum(Cast.INKSCAPE_IMPORT_FORMAT) +export const InspectMetadataFromImageModel: z.ZodType = + z.object({ + input: z.object({ + format: z.string(), + file: z.object({ + path: z.string(), + }), + }), + copyright: z.optional(z.string()), + creator: z.optional(z.string()), + license: z.optional(z.string()), + keywords: z.optional(z.array(z.string())), + artist: z.optional(z.string()), + originalDate: z.optional(z.coerce.date()), + allDates: z.optional(z.coerce.date()), + creationDate: z.optional(z.coerce.date()), + title: z.optional(z.string()), + description: z.optional(z.string()), + }) + export const LibreOfficeInputFormatModel: z.ZodType = z.enum(Cast.LIBRE_OFFICE_INPUT_FORMAT) @@ -1555,6 +1538,16 @@ export const TaskModel: z.ZodType = z.enum(Cast.TASK) export const UnarchiverFormatModel: z.ZodType = z.enum(Cast.UNARCHIVER_FORMAT) +export const ValidatePdfWithDataModel: z.ZodType = + z.object({ + input: z.object({ + format: z.string(), + file: z.object({ + data: z.instanceof(ArrayBuffer), + }), + }), + }) + export const VerifyImageWithImageMagickModel: z.ZodType = z.object({ input: z.object({ diff --git a/make/index.ts b/make/index.ts index 3db6015..c238c8e 100644 --- a/make/index.ts +++ b/make/index.ts @@ -1,10 +1,10 @@ import make from '@termsurf/form/host/make' -import * as mesh from '~/code/shared/type/source/index.js' +import * as mesh from '~/code/shared/source/index.js' // import '~/code/shared/type/source/call/convert.js' import fs from 'fs' import _ from 'lodash' -make({ test: `./source/index.js`, mesh }).then(({ tree }) => { +make({ test: `./code.js`, mesh }).then(({ tree }) => { // fs.writeFileSync(`./code/shared/type/index.ts`, tree.base as string) fs.writeFileSync(`./code/shared/type/cast.ts`, tree.cast) fs.writeFileSync(`./code/shared/type/take.ts`, tree.take) diff --git a/test/cli.sh b/test/cli.sh index 7e00041..1275557 100755 --- a/test/cli.sh +++ b/test/cli.sh @@ -38,11 +38,11 @@ cp test/file/code/example.rs test/hold/example.rs alias task="pnpm tsx code/cli" # # convert and verify -# task convert -I png -O jpg -i test/file/image/fire.png -o test/hold/fire.jpg -# task verify jpg -i test/hold/fire.jpg +task convert -I png -O jpg -i test/file/image/fire.png -o test/hold/fire.jpg +task verify jpg -i test/hold/fire.jpg -# task convert -I cr2 -O jpg -i test/file/image/trees.cr2 -o test/hold/trees.jpg -# task verify jpg -i test/hold/trees.jpg +task convert -I cr2 -O jpg -i test/file/image/trees.cr2 -o test/hold/trees.jpg +task verify jpg -i test/hold/trees.jpg # # task convert -I rar -i test/file/archive/archive.rar -O zip -o test/hold/archive.rar.zip