🌍

Code From Anywhere

Learn full stack Typescript and travel the world!

🐱

Dictionary

markdown-reader-web

📚 markdown-reader-web

markdown-reader-ui

api

This object contains an api function for every function in the backend

NB: only use this if you can access localStorage of the browser or the app. This means this won't work in node or in getStaticProps functions or so

api-types

api-related types needed for the api

api

This object contains an api function for every function in the backend

NB: only use this if you can access localStorage of the browser or the app. This means this won't work in node or in getStaticProps functions or so

operation

asset-functions-js

❌ No description set yet

Please set a description for this operation in OPERATION.md

This is a js operation. This means you cannot use any react or node, it's pure typescript, compiled to javascript, and can be used anywhere.

asset-input

📸 Asset Input

This component lets you easily add asset input that includes upload with the typerepo server standard (function-server)

Installation

Add the css to your web project: import "asset-input/css.css";

asset-type

All types related to asset upload

asset-view

📁 AssetView

AssetView shows an asset. Every file-format has a different way to be rendered.

augmented-words

auth-types

big-button

breadcrumbs

frontend component to show a file location in a nice way (breadcrumbs)

bundle-types

clickable-icon

code-types

convert-case

csv-util

database

Operation that can be used within any typerepo to interact with the fs-orm

fs-orm

ORM that lets you create a database with models that are stored on the file system in multiple formats that are easy to understand and well structured.

(typebase) database. Relies on sdk-db (where your models should be summarized)

fancy-loader

filename-conventions

Any functions and variables related to filename conventions

fs-orm

ORM that lets you create a database with models that are stored on the file system in multiple formats that are easy to understand and well structured.

fs-util

General purpose wrapper around node:fs and node:path that should be used instead of those, because it removes some of its painpoints, removes unneeded stuff, and adds some other useful functions.

fs-util-js

get-path

Useful functions to get paths within King OS.

Depends on sdk-operations, which makes it only work inside of a typerepo.

hotkeys

⌨️ hotkeys

Operation exposing any utility function related to hotkeys in the browser

js-util

k-explore

exploration functions for exploring files within King OS

Currently has a thin dependency on get-path

get-path

Useful functions to get paths within King OS.

Depends on sdk-operations, which makes it only work inside of a typerepo.

, but this can probably be removed to make this operation more general purpose (and work outside of King OS too)

key-value-markdown-js

labeled-button

language-types

log

Log a message with a special type

make-test

markdown

markdown

this uses react-markdown to render markdown in the browser with react...

This is a ui-esm operation. This means it's a ui operation that builds to javascript with ESM module resolving... It was based on this example: https://prateeksurana.me/blog/react-library-with-typescript/

markdown-parse-js

js-only operation containing all kinds of functions that help parsing markdown

markdown-reader-functions

markdown-reader-functions-js

markdown-reader-types

matter-types

model-types

name-conventions

Any functions and variables related to variable declaration naming conventions

nested-menu

next-a-link

parse-primitive

pluralize

KISS; fuck grammar

If we are going to apply grammar here, it becomes impossible to create typescript rules that can detect and convert plural/singular parameter names.

To pluralize any word we simply attach an "s" at the end

port-conventions

Any functions and variables related to port conventions

react-with-native

react-with-native-alert

Alert

TODO: NB: seems not to work right now in a new template! Fix it

react-with-native-form

react-with-native-form-asset-input

❌ No description set yet

Please set a description for this operation in OPERATION.md

react-with-native-form-inputs

react-with-native-router

react-with-native-select

react-with-native-store

react-with-native-ui

read-csv-file

read-json-file

read-kvmd-file

read-markdown-file

rest-util

schema-util

server-api-url

Operation that exports the api url that the api should be able to be found at, according to the users environment, the typerepo convention and your public environment variables.

simplified-schema-form

component that generates a form using react-with-native and a SimplifiedSchema

SimplifiedSchema

JSONSchema7 derivative that has the following capabilities and and characteristics...

  • does not include objects in objects that are also referenced to using xxxSlug or xxxId
  • recursively finds the references and expands them, unless the references are circular
  • easier to read
  • has all the information we need
  • is able to generate an object with values in the exact format the function needs it
  • is able to easily generate a form
. Can obtain any JSON object from the user.

text-or-binary

🗳 text or binary?

This operation provides handy functions to check whether the contents of a file are of a text or binary format...

This is a js operation. This means you cannot use any react or node, it's pure typescript, compiled to javascript, and can be used anywhere.

try-parse-json

ui-util

write-to-assets

Function to write anything to assets.

writer-input

Writer Input

component to create a writer input

This is a ui-esm operation. This means it's a ui operation that builds to javascript with ESM module resolving... It was based on this example: https://prateeksurana.me/blog/react-library-with-typescript/

writer-types

getStaticPaths

getStaticProps

progress

queryClient

AugmentedWordComponent

Dictionary

getPageTitle

utility function to get a title from a page

Header

Layout

MenuWrapper

TODO: This is a good start, but it can be generalised more.

pageKeys

pagesObject

pages

Search

This is shit....

{ useStore, StoreProvider }

apiWithConfig

This object contains a api function for every function in the backend

The difference from api

api

This object contains an api function for every function in the backend

NB: only use this if you can access localStorage of the browser or the app. This means this won't work in node or in getStaticProps functions or so

is that it allows you to also insert custom api configurations

AUTH_TOKEN_STORAGE_KEY

fn1

There is probably some doc-comments available for the function, maybe we can fix this with proxies to pass those comments... that would be insane.

fn2

fn3

getGetApiUrl

gets an api url for a context get api

returns something like [apiUrl]/[apiFunctionName][queryString]

queries

This object contains a react-query useQuery hook for every api function

sdkExample

untypedApiFunction

Used for calling the actual api for a function with some config

NB: this is not a typed function as we are just overwriting it so we don't need any inference on this

addToken

If previousToken is not present, will be generated randomly

ensureToken

Remove the token (if present), then add it again

getAssetDirectlyApiUrl

getExtensionFromAsset

Returns a preliminary filename, based on the Asset

Asset

Asset you can upload

This is not a database model, it can exist in properties of any db model or type interface.

Only alt and relativePath are stored, the other parameters are optionally required for uploading and user interfaces, and are not always there

NB: don't use this in your model, use StoredAsset instead.

getNameFromRelativePath

getNameWithTokenFromRelativePath

first gets the name from the relativePath

then ensures the token is attached (if not already there)

getPreferredExtensionFromType

Received files contain a "type" like "audio/mp3" or "image/jpeg", etc...

Here the extension is decided.

NB: we also need to convert the file itself in case of mp3

getReferencedAssetApiUrl

getTypeFromRelativePath

readableSize

removeTokenIfPresent

tokenPrefix

NB: any filename should not be expected to enter this as part of its name. Otherwise it breaks the code and the filename will be changed to the thing before this string.

NB: don't put any things inhere that are different, slugified, as the name will be slugified!

ASPECT_RATIO

AssetInput

Audio

base64UrltoBlob

Taken from https://github.com/mozmorris/react-webcam/issues/65#issuecomment-385126201

There are probably much better solutions

FileInput

import Icon from "./icon.svg";

getTypeFromFileBlob

HEIGHT

makeBackendAsset

MediaRecorderComponent

MediaRecorder

ReactMediaRecorder

SelectMedia

videoConstraints

VideoPreview

Video

WebcamCapture

WIDTH

AssetView

defaultClassName

InteractiveAsset

shows an Asset

Asset

Asset you can upload

This is not a database model, it can exist in properties of any db model or type interface.

Only alt and relativePath are stored, the other parameters are optionally required for uploading and user interfaces, and are not always there

NB: don't use this in your model, use StoredAsset instead.

with interactivity

  • Any file shows the name of the file, the size, and a link to open it in a new tab in the browser
  • Images show thumbnail
  • Audio show duration and amplitude
  • Video/screen show thumbnail and duration

cache

getAugmentedWordObject

getAugmentedWords

Gets all augmented words of the entire project

  • words with their definitions, if available (/dictionary?word=x)
  • functions, interfaces, variables, operations (/[operation-path]#name)
  • if this is a non-sensible-project, also bundles (/[docs-path])

getBundleAugmentedWords

NB: should only be executed if this is not a sensible-project, as it might not have BundleConfig

BundleConfig

Configuration options for bundles. Used with generateBundle

Everything in this model will be copied over to the created bundle, except for createBundleConfig and customisableBundleConfig.

otherwise

authorizationLevelReadonlyArray

authorizationLevelStringArray

BigButton

BreadCrumbs

Shows where we are in the filesystem

renderBreadCrumbs

ClickableIcon

Renders a simple clickable icon with some styling

Icon can be either an icon (Svg src) or emoji (string)

commentTypesConst

commentTypes

contentTypeConst

Improves the convention for parameter names that refer to models. probably it's better to do this: slug/id/index are reserved on every model, let's call them "Ref". modelNameRef refers to modelName. But what if you want to call it differently? Then you'd need to distinguish a prefix from the modelName. Let's do this with a underscore (no dash because underscore preserves ability to dotting on the object). If you want a reference to a user be called author, you'd name it author_userSlug.

TODO: reduce all TsInterfaces and functions into their parameters :D

dbStorageMethodsConst

dbStorageMethods

getExamples

getFunctionExersize

indexDbModelFolders

indexDbModels

All type interfaces that are used to index stuff, which are added to the database

NB: It's not handy to get this from the database because this is used to generate the database xD

markdownParseToMarkdownModelType

makes a markdownModelType from a markdownParse.

operationClassificationConst

parseMarkdownModelTimestamp

First tries to look at the frontmatter value, this is leading because it is what the user sees and the file system of the os could be inconsistent

If this frontmatter doesn't exist, the markdownParse is checked for a date. This should be information collected from the file system

If that doesn't succeed, sometimes we'll set it to the current timestamp

runEveryPeriodReadonlyArray

runEveryPeriodStringArray

tryParseDate

Tries to parse a date from a string

  • implements default behavior of new Date with a try catch
  • returns a unix timestamp (ms since 1970 AD)

TODO: put in a better location... date-util?

typescriptIndexModels

camelCase

capitalCase

capitaliseFirstLetter

convertCase

convertToTargetCasing

getDelimiter

humanCase

kebabCase

lowerCaseArray

converts any string to an array of lowercase words

format ["word1","word2","word3"] from a string of any casing.

nonCasingDelimiters

pascalCase

snakeCase

splitCasingDelimiters

test

csvItemArrayToCsvString

make csv string from a csv model type

exampleCsvItems

the same as exampleCsvString

exampleCsvString__OLD

exampleCsvString

exuivalent to exampleCsvItems

tryParseCsv

This function parses a CSV into the object it says it has in the header

dbConfig

db

generateCsvInstance

generateJsonSingleInstance

generateKvmdInstance

generateMarkdownInstance

generateSlugTestModel

getCli

getMergedQueryConfig

getRanomAge

get

main

migration

randomName

removeCli

runModelEndToEndTest

NB: we can't do a maketest because this thing relies on logging and we don't want to auto-run it

set

Can set a markdown item into a subfolder in the db model folder

testDb

a db is created with models from all different db storage methods

testOperationModels

Test if it can find all OperationIndex

OperationIndex

contains all calculated info about an operation that needs to be retreived often: some package-only things, but also a collection of all indexes of all files

should be able to be found in operaiton folder in /db/operation-index.json

, OperationConfig, PackageJson, TsConfig

updateCli

upsertCli

upsert

Takes stored data and an item

  • updates the data and sets some rows to "item" if the item is found (through the id or slug)
  • otherwise inserts

NB: this function works for any storage method except for key value markdown

FancyLoader

allowedSearchContentExtensions

buildFolderName

databaseFolderName

extensions

fileTypes

frontendOptionalFileSubExtensions

these special operations are generated, so should not be copied, but should be generated in the bundle after everything is copied

generatedFolders

getWriterType

Gets the writer type based on the extension

hasSubExtension

Returns true if a fileid includes one of the specified subextensions.

isGeneratedOperationName

isGeneratedOperation

isIndexableFileId

jsonExtensionsConst

jsonExtensions

markdownExtensionsConst

markdownExtensions

operationUnindexableNamesOrSubExtensions

projectRelativeGeneratedOperationsFolder

sourceFolderName

typescriptExtensionsConst

typescriptExtensions

addDefaultValues

Adds timestamps, id, and a slug IF these things are not already present

NB: slugs will be slugified here! NB: if there is a name present, slug will be added here!

NB: for kvmd storage, id will be set to a kebab-case of the name

NB: does not add the ModelLocation parameters

alterAny

low level function that alters data from any storage method at a certain location

comprises all dbStorageMethods

alterCsv

Alters a csv

alterJsonMultiple

Alters a json single file

alterJsonSingle

Alters a json single file

alterKeyValueMarkdown

alterMarkdown

Alters a markdown file

augmentItemWithReferencedDataRecursively

calculateOperationsObject

Needed in case of manual project root, otherwise use SDK!

Returns project relative operation base paths

categoryStackCalculated

createDb

Create your database by passing your models as a generic and some optional configuration

findParent

this location matches any category that equals the categorystack

getAugmentedData

Gets the stored data from any file with any storage method, and augments the modelLocation onto it...

Also augments the name, slug and categoryStackCalculated onto this if the dbStorageMethod is markdown

markdown
markdown

this uses react-markdown to render markdown in the browser with react...

This is a ui-esm operation. This means it's a ui operation that builds to javascript with ESM module resolving... It was based on this example: https://prateeksurana.me/blog/react-library-with-typescript/

or jsonSingle and if operationRelativePath is not set

getDatabaseFiles

This function gets the files that the data can be stored, by convention, based on the model and the config

Only returns the file paths that actually exist.

CONVENTION:

When searching for data, fs-orm

fs-orm

ORM that lets you create a database with models that are stored on the file system in multiple formats that are easy to understand and well structured.

will look in:

  • db/ in your project root
  • db/ in any operation

In these folders, fs-orm

fs-orm

ORM that lets you create a database with models that are stored on the file system in multiple formats that are easy to understand and well structured.

will search for files based on your storage method. @see DbStorageMethod for more info

Returns not only the file paths, but also where they were found (operationName, projectRelativePath, operationRelativePath)

getDatabaseRootFolder

Tries to get the root folder where the database folder can be found.

If an operationName is specified, this will be the operation base path If not, this will be the project root.

getDbFileLocation

Used by groupByFile

groupByFile

Used for set and upsert. Groups creation items into an object where keys are file paths and values are items that need to be stored

, which is used for set (and thus, also update) and upsert: determines the new file location.

Applies the convention to get the db-file-location of an item

Based on the merged config:

  • if operationRelativePath is specified, gets a filePath in the operation
  • if projectRelativePath is specified, gets a filepath in the project
  • otherwise gets the pattern and replaces "*" with the slug (or id if slug is not available)

Besides the absolute path, the operationName, projectRelativePath and operationRelativePath are also supplied.

NB: currently, the item's operationName, operationRelativePath or projectRelativePath is not taken into account. It will simply look at the convention to see where it should be saved, and apply the MergedQueryConfig...

getDbStorageMethodExtension

getDefaultLocationPattern

DB main storage convention

getItemModelLocation

getLength

Safely gets the length of something

getLocationPattern

Returns the pattern or an exact relative path that the file(s) should be stored at.

If a pattern contains a star at the place of the filename, it will search the folder recursively for all files with the extension in the pattern.

Returning relative path has no preceding slash

getMergedConfigOperationPath

getParentSlug

get a parent slug without the parent_xxxSlug reference (uses the categoryStackCalculated)

can be undefined if the item has no parent

getRootFolders

getWildcardDbFileLocations__OLD

If it all seems good, I can delete this. This is the old method of looking just in the folder itself, it's replaced by looking in all subfolders as well, recursively.

getWildcardDbFileLocations

groupByFile

Used for set

set

Can set a markdown item into a subfolder in the db model folder

and upsert. Groups creation items into an object where keys are file paths and values are items that need to be stored

makeStoringItem

maxConcurrency

mergeConfigs

removeKeyValueMarkdown

Takes stored data and a slug to remove

removeMultiple

Function that lets you remove items from one specific file, for any storage method

upsertItems

upsert an item into storage in any storage method

upsertKeyValueMarkdown

Takes stored data and an item

  • updates the data and sets some rows to "item" if the item is found (through the slug). this works almost the same as the regular upsert function

  • otherwise inserts, at the right category, in the right place in the array

BEWARE:

  • the categoryStackCalculated must be existing in the markdownfile.
  • you cannot insert a header, always insert an item with isHeaderCalculated:false

access

appendFile

canAccessSync

uses fs.access to determine if something can be accessed

Check File access constants for possible values of mode. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.W_OK | fs.constants.R_OK).

canAccess

uses fs.access to determine if something can be accessed

Check File access constants for possible values of mode. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.W_OK | fs.constants.R_OK).

canExecuteSync

File is executable to the calling process

canExecute

File is executable to the calling process

canReadSync

File is readable to the calling process

canRead

File is readable to the calling process

canSeeSync

File is visible to the calling process

canSee

File is visible to the calling process

canWriteSync

File is writable to the calling process

canWrite

File is writable to the calling process

chmod

chown

copyAllRelativeFiles

copy a bunch of relative files from one root folder to another

copyFile

cp

findAllMd

DEPRECATED: k-explore

k-explore

exploration functions for exploring files within King OS

Currently has a thin dependency on get-path, but this can probably be removed to make this operation more general purpose (and work outside of King OS too)

can be used

findFileNameCaseInsensitive

returns a path of a fileName

findFilesRecursively

Explores your files with many possibilities.

NB: this function only searches one basePath, while explore can do multiple

TODO: since this not only finds files but also explores them, naming should be exploreFilesRecursively, probably.

TODO: TextJson[] is a bit weird name for the resulting type interface...

findFiles

DEPRECATED:

SHOULD BE REPLACED

this is sensible-specific

findSensibleFiles

DEPRECATED:

this is sensible-specific

fsPromises

fs

NB: for some reason some of the graceful-fs functions aren't complete. For example, I can't seem to copy folders with cp from graceful-fs (cp)

For that one I added cpAsync.

getAllFoldersUntilFolder

NB: I already have this somewhere else but couldn't find it!

If the path is /a/random/path

The result of this function will be:

['/a', '/a/random', '/a/random/path']

getFileName

removes everything before the last slash to get file name

getFirstAvailableFilename

getFolder

if the path exists:

  • if the pathString is a folder, that is returned.
  • if the pathstring is not a folder, returns the pathstring without the file suffix

if the path doesn't exist: returns pathString witout last chunk (this would only work for file paths)

getLastFolder

removes everything after the last slash to get folder path

input: /Users/king/Documents/some/folder/xyz output: xyz

input: /Users/king/Documents/some/folder/xyz.txt output: folder

getOneFolderUpPath

Takes a folder path and returns a path that is one folder up

getPathCombinations

gets combinations for paths

input: [["operation1","operation2"], "db/value-export", ["index.ts","test.ts","cli.ts"]] output: ["operation1/db/value-export/index.ts","operation2/db/value-export/index.ts","operation1/db/value-export/test.ts","operation2/db/value-export/test.ts","operation1/db/value-export/cli.ts","operation2/db/value-export/cli.ts"]

gracefulFsConstants

gracefulFsPromises

importFromFiles

DEPRECATED:

works fine but this requires us to know exactly what we want from the file, so it requires a very clear convention. better would be to introspect the code and just require whatever's there returns T[] where every T is one of:

  • the default export (importStrategy "default")
  • the export with the name of the extension
  • an object with a subset of exports

isArrayGuard

DEPRECATED

mergeObjectsArray

TODO: find a way to return the correct type interface

mkdir

oneUp

Finds the number at the end of a filename and increases it If there is no number yet, concatenates '1' to a string

E.g.

  • hello-world becomes hello-world1
  • hello36 becomes hello37

parseMd

DEPRECATED: just use md-to-json-parse

parse a md file to all the needed info @param mdFilePath path to a md file @returns Md

path

readFileSync

readFile

readdirSync

readdir

realpath

removeAllExcept

Removes everything inside a folder except some files and folders that can, optionally, be ignored for removal. does not remove the folder itself

NB: make this work with subdirectories!

renameAndCreate

rename

rm

stat

watch

writeFileSync

writeFile

writeJsonToFile

write json to a file

makes the dir and file if they don't exist

writeStringToFile

write string to a file

makes the dir and file if they don't exist

writeToFiles

writes all values in an object to the file that should be specified as key of that value

getExtension

returns the extension of the filename or path WITHOUT dot

NB: not sure, but could be nice to replace this with path.extname(pathString)

getFolderJs

getSubExtension

isPathRelative

join

removeTrailingSlash

withoutExtension

removes extension from the filename

findFolderWhereMatch

recursive. goes up a folder until it finds a package.json

findOperationBasePathWithClassification

recursive. goes up until it finds a folder that's an operation

because it had to read the package.json anyway, it's returning the operation classification as well

findOperationBasePath

getAllPackageJsonDependencies

getCommonAncestor

Finds the common ancestor for two absolute pahts

getOperationClassification

Returns OperationClassification if it's an operation, or undefined if it's not

NB: don't confuse this with ProjectType or ImportClassification

getOperationPathParse

get all operation-related path information that can be inferred from the path

NB: currently it also looks up the operation name from its packagejson

getOperationPath

Gets a path of any operation in the project

TODO: IDEA: maybe auto-generate key-value JSON where keys are the package-names of all operations and values are paths of their locations in the file system. we can easily generate this ourselves, but maybe it's also easy to use the npm yarn workspace for this, although it may not be available in all circumstances, so better not rely on it. The advantage of this would be that this function becomes sync and is much more efficient. The disadvantage is that every time you move something or add something new, this indexation has to happen, otherwise it fails.

getOperationRelativePath

something like src/xxx/xxx/x.ts (no slash at start)

getPathParse

gets all kinds of information that can be inferred from any path (file or folder).

getPathsWithOperations

returns an array of all (absolute) paths containing operations

for a sensible project, that means /apps, /packages, /modules

for the OS project, that means /operations/tools and /operations/niches

getProjectRoot

returns project root folder path

recursive. goes up until it finds a folder that's the project root

if no source path is given, uses the directory name where the function is executed from as a starting point

getRelativeLinkPath

returns a relative link between two files

getRelativePath

gets the relative path from a specified root

will start with "/"

getRootPath

Gets project path, or a folder in the root that is convention

getSrcRelativeFileId

returns a file id (path without extension) relative to the src folder of an operation

e.g. "general" for src/general.ts

NB: assumes all src is in the src folder

NB: removes "/" in the beginning, if found

hasDependency

hasProjectRootFile

isOperation

Checks whether or not an absolute path contains an operation. The only check it's doing is that the folder must contain both a package.json as well as a tsconfig.json

isSensibleProject

isWorkspaceRoot

simple sync function to check if a folder is the root of a workspace (not operation but a workspace)

makeRelative

Makes a path relative using proper parsing

Resulting path will apply the paths conventions

  • no slash at the end
  • no slash at the beginning

osRootFoldersConst

can only be accessed in the OS

osRootFolders

projectRootFoldersConst

can be accessed in projects as well as in the OS

projectRootFolders

isAltB

⎇ B

isAltN

isAltO

isAltW

isCtrlBacktick

^ `

isCtrlP

^ P

isCtrlS

^ S

isCtrlSpace

^ `

useHotkey

hook that creates an eventlistener for keydown and cleans it up when needed

useHotkeys

hook that creates an eventlistener for keydown and cleans it up when needed

apply

sum([1, 2, 3]);

function that takes an array of functions and applies them one by one, on the value or the result of the previous function. Only possible if the type of the value stays the same.

concatenate

createEnum

creates an enum object from a readonly const array so you don't have to

const taskNames = ["a","b","c"] as const; type TaskNames = typeof taskNames[number]; const enummm = createEnum(taskNames); (value of enummm: { a: "a", b: "b", c: "c" })

createMappedObject

Creates a MappedObject of an array of any type. MappedObjects are great for increasing efficiency to get an item from an array. Especially useful when finds are needed on a specific key match for huge arrays. Instead of finding on the array you can simply get the right property from this object.

NB: Don't use this inside of render functions, it's a very slow function, the whole idea is that this makes it faster, so just do it once!

findLastIndex

finds the last index of an array where a certain filter holds true

getObjectFromParamsString

useful for cli's that only take strings. This creates an object from a string

input: "x:a, y:b, z:c" output: { x: "a", y: "b", z: "c" }

TODO: would be nice if we can validate this string immediately using a JSON SCHEMA

getObjectKeysArray

Handy function to get the keys of an object, but typed.

NB: The only difference from Object.keys is that this returns the keys in a typesafe manner

getParameterAtLocation

utility function to get a parameter inside of a nested object

getSubsetFromObject

takes an object and a subset of its keys and returns a subset of that object

input: { x: "a", y: "b", z: "c" } and ["x"]

output: { x: "a" }

groupByKey

key should be of type string!

input = [{path:"xyz"},{path:"xyz"},{path:"abc"}] groupByKey(input, "path") ouput: { xyz: [{path:"xyz"},{path:"xyz"}], abc: [{path:"abc"}]}

insertAt

Insert an array or item inside of an array before a certain index

Example:


const testArray = [1, 2, 3, 4, 5];
const result = insertAt(testArray, [99, 100], 2);
console.log({ testArray, result });

isAllTrue

checks if all items in an array are true

makeArray

if something is not an array, returns it as the first element of an array

if the input is undefined, an empty array will be returned.

NB: TODO: find out the workings of the array constructor (Array("any value")), because maybe it does something very similar. No need to have a dependency then if it's similar.

mapAsync

mapAsync makes it possible to map over an array async without having to do the promise.all afterwards

It saves a lot of lines of code, and makes it more readable Example usage:


const myNumbers = [1, 2, 3, 4, 5];

const doubleAsync = (num) => Promise.resolve(num + num);
const sqrtAsync = (sum) => Promise.resolve(sum * sum);
const halfAsync = (time) => Promise.resolve(time / 2);

const doubleSqrtHalfs = await mapAsync(myNumbers, doubleAsync)
.then((sums) => mapAsync(sums, sqrtAsync))
.then((times) => mapAsync(times, halfAsync));

mapItem

mapKeys

maps over all keys in an object and replaces them using a mapfn

mapMany

Lets you map over any array with a async function while setting a max. concurrency

Taken and improved from https://codeburst.io/async-map-with-limited-parallelism-in-node-js-2b91bd47af70

mapValuesSync

maps over all values in an object and replaces them using a mapfn

sync

mergeObjectParameters

merges two objects: a config object and a defaults object. If the config object has something missing, a default will be used from the defaults object.

In short: merges two objects, for every parameter, use the default as a fallback

DEPRECATED: in favor of mergeObjects

mergeObjects

merges multiple objects, overwriting the previous one with the next. Can be useful for configs where there are multiple layers of configs that overwrite each other.

Please note though, that only the root keys of the object are overwriting each other, so if there is nested datastructures, the last one with a specific key overwrites the previous ones copletely

Please note that you can provide partial objects as well, as long as you are sure that the final object is full, the type interface is correct.

Please note that if a latter object has a key which holds "undefined", it will NOT overwrite it. Anything else WILL

noEmptyString

objectMapAsync

Map an object asynchronously and return the same object with the mapped result in its values

Example usage:


const srcFileContentObject = {
"index.ts": indexString,
"public-local.ts": publicLocalTypescriptFileString,
"public.ts": publicTypescriptFileString,
};

const srcFileWriteSuccessObject = await objectMapAsync(srcFileContentObject, async (operationRelativeTypescriptFilePath,content)=>{

try {
await fs.writeFile(
path.join(operationBasePath, "src", operationRelativeTypescriptFilePath),
content,
"utf8"
);

return true;

} catch {
return false;
}

});

objectMapSync

maps over all values in an object and replaces them using a mapfn

Example usage:


const result = objectMapSync({ hello: "world", isTrue: true }, (key,value) => {
return `${value}123`;
});

objectValuesMap

not sure if this is the best way, but it does save some lines of code!

maps over an object's values with a map function

DEPRECATED in favour of objectMapSync and objectMapAsync

omitUndefinedValues

onlyUnique2

function that returns a filter function that can be used as a filter for any array. removes duplicates.

optionally takes a compare function that should return a "true" if two instances are equal. if you use this function, make sure to pass a generic of the type the items will have, in order to make this equality function type safe as well

putIndexAtIndex

Takes an item from an index of an array and put it somewhere at another index

removeIndexFromArray

removes an index from an array

example:

const exampleArray = ["a", "b", "c", "d", "e"];
console.log(removeIndexFromArray(exampleArray, 2)); //c should be removed

replaceLastOccurence

Replaces the last occerence of something in a string by something else

Example:

const result = replaceLastOccurence("theBestSlugSlugSlug", "Slug", "Slack");
console.log(result); // returns theBestSlugSlugSlack

NB: this is not the most efficient method, as it reverses the string by making it an array, twice. It can probably be done more efficiently by using String.lastIndexOf

reverseString

sumAllKeys

sums all keys of an array of objects, assuming the objects have the same datastructure and assuming the values contain either numbers or undefined

sumObjectParameters

sums all parameters in two objects together

sum

takeFirst

takes any type T or an array of T and returns T or the first of the array (which is T)

trimSlashes

Trims a slash on both sides in any path

arg1

arg2

benchmark

determineFileType

returns the file type or null if it's unknown

exploreGitRepoFolders

find all active git folders (folders having .git)

exploreMultiple

DEPRECATED: not sure if we still need it, look up usecases, can prob be replaced now

exploreOperationFolders

find all active operations (folders having package.json but also tsconfig.json)

returns folder path array

explorePreset

explore

This is the safe and friendly version of findFilesRecursively

findFilesRecursively

Explores your files with many possibilities.

NB: this function only searches one basePath, while explore can do multiple

TODO: since this not only finds files but also explores them, naming should be exploreFilesRecursively, probably.

TODO: TextJson[] is a bit weird name for the resulting type interface...

findAllDocsFolderPaths

Returns absolute paths for all docs folders (not the files inside)

findAllDotGitFolders

findAllFoldersWithName

findAllPackages

findAllTodoFolderPaths

getArgument

getContents

gets needed contents of file path, based on the extension

returns a markdownparse if it's markdown, a json parse for json, or a file content string for anything else

getOutline

isMatch

isSearchContentExtension

type checker for a string to be an extension that can be searched for

pathArrayIsOperation

Checks if pathArray contains a package.json and a tsconfig.json and thus should be an operation

Handy for cancelRecursionOn in explore

explore

This is the safe and friendly version of findFilesRecursively

exampleKeyValueMarkdownParse

exampleKvMdString

exampleLine

flattenMarkdownChunks

getKvmdItemsRecursively

recursively dives into the Chunk to get all kvmd items

NB: this doesn't have a reference to its parent yet, but this will be added in fs-orm on the fly because the key for that is based on the model name

getParagraphsRecursively

recursively dives into the Chunk to get all paragraphs inside

kvmdDataMap

DEPRECATED: probably never needed, unless I make it useful

mapper function to give a kvmd data object other parameters.

NB: not sure if this is useful. it would be useful if we could auto-generate the application of this function for multiple db models.

kvmdDataToString

parses KeyValueMarkdownModelType into a string which can be part of a new markdown file

NB: we need to know the previous line as well because the header we need to print depends on it

kvmdParseToMarkdownString

parses KeyValueMarkdownParse into a markdown string so it can be saved as a markdown file

markdownStringToKvmdParse

parses a key value md string (with support for headings and frontmatter)

parseKvmdLine

parses a kv md line with data into a key, value, and comment (if available)

if the key is an empty string, the line will return undefined

LabeledButton

DEBUG

if true, also shows debug messages

getCallerFileName

TODO: this is great. now also get the operationName. If the operationName appears in the config, for debug, show the log, otherwise don't show

options

special character combinations that make the console message be printed differently

parseTitle

TODO: Should parse a title from markdown

resetString

isResultOfInterface

TODO: need validate-json-schema. also this can be its own little package, as it can be used in many other places

not sure if this should be part of make-test at all, because we want operations to be able to operate independently without the os, right? so then it won't work because you don't always have indexes...

makeTest

create a test that is testable with runAllTests...

defaultExpandedMode

defaultMinimalMode

getRealSrc

Based on markdown info, gest the real source for an image

getUrlFromRelativeUrl

gets the renderable asset url from the relative url

getYoutubeId

header

MarkdownCodeblock

renderFrontmatter

Renders markdown frontmatter parameters (and optionally a spacer)

renderMarkdownChunk

renders a MarkdownChunk interface

renderMarkdownContent

renders a markdown striing (without frontmatter)

renderMarkdownParse

renders the MardkownParse interface (including frontmatter)

renderMarkdownTitle

renders a markdown title (level should be 1 for h1 and 6 for h6)

useOpenHashDetails

exampleMarkdownFileContents

getChunkParagraphsRecursively

Get all paragraphs (content values) recursively from a MarkdownChunk

getImplicitId

Implicit ids are a convention in markdown. A title gets an implicit id by removing spaces and making the title lowercase.

See https://stackoverflow.com/questions/6695439/how-to-link-to-a-named-anchor-in-multimarkdown

getMarkdownIntro

This function takes a markdown parse and gets the first paragraph and a title from it, if available.

Currently assumes that the first paragraph starts directly after the title or there is no title and the content is at the beginning.

TODO: It would be better to find the first paragraph based on the level.

getMarkdownParseParagraphs

Gets all paragraphs (recursively) from a MarkdownParse

getMarkdownReferencePaths

getMarkdownReferencesFromParagraph

Gets all markdown references from a paragraph

markdownParseToMarkdownString

mdContentParseRecursively

recursively parses a string containing markdown (without frontmatter) into a MarkdownChunk[]

Improve:

  • include the comment-type (TODO/NB/etc), both on a chunk level and on root level
  • parse paragraphs further around the assets

mdToJsonParse

makes a markdown parse from a markdown string

TODO: markdownStringToMarkdownParse is a better name. First make a refactor script for this, because it is too hard to rename stuff that is used a lot.

TODO: BUG: it doesn't take into account triple backticks! if there is markdown inside of the triple backticks, it can still be seen as main markdown. Triple backticks are stronger!

parseFrontmatterMarkdownString

splits a markdown string into its frontmatter object and the raw content (without frontmatter)

parseMarkdownParagraph

Parse markdown paragraph

Should split it up for every thing it encounters...

parseMdToChunks

should get chunks recursively. first just look for every h1 line. everything after the h1 line is the children until there's another h1 line, then do this recursivley for h2, h3, etc.

removeHeaderPrefix

removes header prefix (##### etc) and trims whats behind that

availableExtensions

copyStaticAssetsCli

copyStaticAssets

uses getMarkdownReferencePaths for all markdown files in the markdown-reader-ui and copies them into the markdown-reader-web/public folder, keeping the original folder structure.

NB: Removes all files in the public folder first.

To get a file from public assets after running this function, you need to get it from the projectRelativeFilePath, not the file relative, so you need to render it differently.

getAllMarkdownReaderPages

....? I should've commented this

const hasDocs = !!relativeDocsPages.find(

(x) => x.queryPath.toLowerCase() === "docs/readme"

);

if (!hasDocs) {

const hasRootReadme = fs.existsSync(path.join(projectRoot, "README.md"));

if (hasRootReadme) {

relativeDocsPages.unshift({

queryPath: "docs/readme",

filePath: "README.md",

isMenuItem: true,

});

}

}

Gets all pages of a bundle based on the fs and database

Pages it finds:

  • operation-readmes
  • multiple docs basePaths with all folders and markdown pages there in (/[project-relative-path])
  • /dictionary
  • all markdown model types we have in the db-sdk, optionally, depending on config

Requirements:

  • README should always be on top in a folder.
  • numbers and extensions are omitted from paths, but still connected to the right file
  • If the docs doesn't have a readme, the /docs/readme path shows the root readme.

Does not include AugmentedWord. Just the main pages, not with queries and hashes

Used to generate the menu

getFolderExplorationInfo

Gets exploration information about a folder

  • reads README.md in current folder
  • reads OPERATION.md in child folders, or README.md if that doesn't exist
  • gets an intro from those markdown files and returns that (uses getMarkdownIntro)

getMarkdownModelPages

Transforms all your markdown models into markdown reader pages

Steps:

  • Finds all markdown model types from the database config
  • Gets their basepaths according to fs-orm convention
  • Checks if they actually exist
  • Finds all markdown therein
  • Makess markdown reader pages out of them

getMarkdownPageInfo

If a markdown page is found, this function fetches all metadata needed to render that markdown page

getMarkdownReaderPages

Gets all markdownreader pages for multiple basePaths. Can add a prefix, can also remove the last folder of basePath from the suffix.

getMarkdownReaderQueryPaths

getOperationPages

getPublicMarkdownFilePaths

Returns all absolute markdown file paths within a basePath which are not drafts and which are not marked private (through frontmatter)

Readme is put on top!

getTodoPages

gets all todo pages as markdownreader pages

markdownReaderGetStaticPaths

Function that tells Next.js what the pages are that need to be statically generated

markdownReaderGetStaticProps

Fix operationBasePath not working error when building: log getStaticProps/getStaticPaths

putReadmeOnTop

Takes an array of items (explore

explore

This is the safe and friendly version of findFilesRecursively

results) and checks them to put readme at the start

DEPRECATED: After writing this, I found that explore

explore

This is the safe and friendly version of findFilesRecursively

also has readmeOnTop possibility, so this whole thing is not needed

removeExtensionsFromPath

  • Removes numbers from file or foldernames in a path.
  • Removes extension of files
  • Returns the new path without numbers and without extension

Works for files and folders

removeNumberPrefix

removes number prefixes from a file or folder name. Does not remove extension

defaults to untitled if the file or folder has no name after removing numbers.

shouldExposeMarkdownFile

markdown file should only be exposed if it doesn't say privacy: private or isDraft: true in your frontmatter.

stripReadmeFromFolder

To get the queryPath, we need to strip the README.md so we get the folder as URL instead of the attached README.md

getQueryPath

frontmatterParseToString

Parses frontmatter object into a frontmatter string

  • includes a newline at the end
  • string[] becomes a comma separated string TODO: maybe parse xxxAt values into human readable dates

getFrontmatterValueString

quotedOrNot

For now, simply quote a string if it contains commas

There are probably more edgecases that need to be fixed here

stringifyNewlines

generateId

24 characters of the alphabet provides 9E33 combinations, wont be possible to brute-force in centuries, even if there are billions of entries

generateRandomString

generateTime

languages

keys are the iso codes which will be saved in the db, the values are values which can be shown to the user in any UI

markdownModelTypeToMarkdownString

assetsFolders

generatedParameterNames

getAssetInputType

Convention parameters for assets: [name], [name]s, xyz[Name], xyz[Name]s

Different ways to name assets: image, video, audio, file or just asset, which is everything together

getParameterContentType

isCalculatedParameter

this is part of the database convention

isGeneratedParameterName

markdownTextParameterNames

Any parameter names that should render a textArea

parameterNames

Form input types

How do we show different UI's based on certain things we know about some parameter (name + type)? There are many things

  • All "image" or "xxxImage" should be Image + camera inputs
  • All "asset" or "xxxAsset" should be File inputs
  • All "recording" or "xxxAudio" should be mic inputs
  • All "position" or "xxxPosition" should be coordinates which should be pickable on the map
  • All "path" or "xxxPath" should be an input where you can select a relative path from project root or operation src root, depending on what we need. It needs to be clear what kind of paths are allowed, so we need to think about all the options and if we can all put that in the parameter name (would be best) or if we need to use the description...

passwordTextParameterNames

patternMatchers

referenceParameterNames

referencePluralParameterNames

getKeysAtPathFromNestedObject

Gets all children keys of a nested object at a certain (nested) location in the nested object

nestedObject should extend the NestedObject.

The reduce is a bit vague, I need to test this function further to make sure it does exactly what I want.

NestedMenuItem

General purpose NestedMenuItem

TODO: make style customizable

nestedMenuStoreInitialValues

NestedMenu

General purpose nested menu component

Please make sure that you also wrap your app with MenuStoreProvider, or this will crash...!

nestedPathObjectToNestedMenuRecursive

Transform a nested path object into a nested menu (MenuType), recursively

queryPathsArrayToNestedPathObject

Handy function to transform an array of querypaths into a nested menu, assuming you want to create a new sub-menu for every path

May also work for relative filePaths

Input:

["hello/world","hello/moon","hello/sun"]

Output:

{ "hello":{ "moon":null, "world":null, "sun":null } }

reduceQueryPathsRecursively

{ StoreProvider, useStore }

useExpanded

ALink

A simple wrapper around react-with-native A and next-link

All links you make with this component are SEO-ready

parsePrimitiveArray

parsePrimitiveBoolean

parsePrimitiveString

parsePrimitive

parses a string into the value it should be

if you provide a simplifiedSchema, that will be used to parse according to the shape of the schema

isPlural

isSingular

singularize

Removes the 's' if it is found at the end of the parameter name

ports

See https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers for available ports

Range 42000-42080 seems to have no ports. There are many more ranges

When creating a new app, ensure you not only define the port here, but also in

A

ActivityIndicator

Aside

Button

Div

Form

Form is just a html form on web. On react-native, it's a View

getTailwindModules

H2

I

Image

Input

joinClassNames

Label

Li

Nav

Ol

P

Pressable

button on web, pressable on react-native

PureAside

PureDiv

PureNav

Select

renders either a SelectDropdown or SelectDrawer, based on screensize

Span

Strong

Svg

TextArea

Text

text can be in multiple formats. most texts in data are probably just text but they can also contain markdown

if there is a data model with just a single text and it is clear from the name of the model what it should be, better call it either text or markdown.

Toggle

TouchableOpacity

button on web, pressable on react-native

trimClassName

in react-native not all classNames are supported

Ul

wrapInTextIfNeeded

NB: figure out a way to do the styles of the text right.

AlertContext

AlertProvider

useAlert

DataForm

DefaultInputContainer

DefaultTitle

errorOnField

getPlugin

GLOBAL_PROPERTY_PATH

inputClassWithoutWidth

isWeb

makeInputField

sameFieldArray

setConfig

InputSize

Inheritance of different button themes

InputTheme

Inheritance of different button themes

castToNumber

DateInput

CSS Modules, react-datepicker-cssmodules.css

DatetimeInput

defaultLatidue

defaultLongitude

defaultZoom

isNumber

LabelsInput

MapInput

NumberInput

PasswordInput

PhoneInput

SelectInput

SelectMultipleInput

StarsInput

TextAreaInput

TextInput

TimeInput

CSS Modules, react-datepicker-cssmodules.css

ToggleInput

useRouter

getRealValue

contextKey

contexts

createStoreProvider

Function to create the StoreProvider

NB: this function uses a local variable on the main scope of javascript in order to create the Context components dynamically. Beware!

createStore

One function is all you need to make a new store!

Example:


import { createStore } from "react-with-native-store";
import { TypeA, TypeB } from "your-types";

export const writerInitialValues: {
itemA: TypeA;
itemB: TypeB;
} = {
itemA: "",
itemB: {},
};
export const { useStore, StoreProvider } = createStore(writerInitialValues);


Simple as pie 🍰

createUseStore

Function to create a hook for accessing the store

debug

getContext

Gets the current word you are typing from a text and the cursor position.

Takes into account multiple word separators: tabs, newlines, and spaces.

getItem

If you don't have access to the useStore hook, maybe because you're doing something outside of react... you can directly use the storage with javascript using this function

getKey

setItem

If you don't have access to the useStore hook, maybe because you're doing something outside of react... you can directly use the storage with javascript using this function

BEWARE! Updating this won't update your react components!

StoreContextProvider

bareInputClass

inputClass

UI

readCsvFileSync

Reads and parses CSV file

specify a generic of what type of item the file contains an array of

readCsvFile

Reads and parses CSV file

specify a generic of what type of item the file contains an array of

readJsonFileSync

Reads and parses JSON file

make sure to specify what type the file contains as a generic!

readJsonFile

Reads and parses JSON file

make sure to specify what type the file contains as a generic!

readKvmdFile

Reads and parses a markdown file

test2

readMarkdownFileToModel

Reads a markdown absolute path to a MarkdownFile model

readMarkdownFile

Reads and parses a markdown file

bodyFromQueryString

converts a query string into an object that can be used as a body

getFirstQueryStrings

NB: doesn't work in node.

Query keys can be string or string[] or undefined.

This function takes only the first string if it's an array...

getQueryPart

creates a query-string with one key for all strings in an array

isValidEntry

toQueryString

returns something like ?x=a&y=b&z=c

findFirstCommentTypes

Tries to find tie first appearing special comment line and parses it and returns it as part of the CommentTypeObject

CommentTypeObject

Every CommentType can be a key in the SimplifiedSchema, if available.

getPossibleReferenceParameterNames

returns the reference parameterNames...

e.g.:

todos -> todoSlugs + todoIds
todo -> todoSlug + todoId

getProperties

Gets all the properties of a schema

getRefLink

gets the $ref from a schema and parses the interface name from it

getReferencableModels

based on the object properties in SimplifiedSchema, returns the model names that can be referenced

getReferenceParameterInfo

Takes a parameterName and returns information about it according to the convention {descriptorName}_{modelName}{referenceKey} where:

  • descriptorName with the suffixing underscore is optional
  • referenceKey can be slug, index, or id (or there plural variants)
  • modelName should refer to a database model

getSchemaItems

==========

Since JSONSchema7's property items is fairly hard to use, this function gets that property in an easier to use way.

getSchema

parses a JSONSchema7Definition to JSONSchema7|undefined so we can use it

simplifiedSchemaToTypeDefinitionString

Converts a simplifiedSchema definition back into a type interface string

With this, types can be generated in different ways

simplifySchema

Return a SimplifiedSchema by giving the JSONSchema7 schema, its name and a list of possible references in the JSONSchema.

A SimplifiedSchema is a data structure that allows you to easily define type interfaces that need to build out forms.

Todo

Dual types aren't done right yet. I probably don't look at anyOf yet, which makes it result in an empty object.

For example, this one is problematic:

INPUT:

{
"schema": {
"anyOf": [
{"type": "string"},
{"type": "array","items": {"type": "string"}}
]
},

Output:

{
"simplifiedSchema": {
"properties": [],
"type": "object"
},
}

To test this one, test npx rebuildOperation filename-conventions

apiUrl

hostname

isDev

localhostServer

runRemoteServer

ArrayForm

Component to render a parameter that holds an array

This is simply a wrapper around another SimplifiedSchemaForm

SimplifiedSchemaForm

Recursive component that renders a form for a SimplifiedSchema

where the onChange and values are slightly different

This component renders a SimplifiedSchemaForm

SimplifiedSchemaForm

Recursive component that renders a form for a SimplifiedSchema

for every item in the array, and adds buttons to insert/remove new items.

FormContainer

A FormContainer

FormContainer

A FormContainer is a simple container that can wrap your SimplifiedSchemaForm to give it a button that also sends when hitting enter on your keyboard. To achieve this, a <form> is created in this component.

Besides this, you can also add some texts, but styling is not possible to change for this component at this point (except for the form className). If you want a completely different style, it's probably better to build it yourself.

NB: TODO: There is a bug now where onSubmit gets called too often. Not sure how to fix this. Because of this, I'll simply remove the onSubmit action in the onsubmit for now, and prevent the default.

is a simple container that can wrap your SimplifiedSchemaForm to give it a button that also sends when hitting enter on your keyboard. To achieve this, a <form> is created in this component.

Besides this, you can also add some texts, but styling is not possible to change for this component at this point (except for the form className). If you want a completely different style, it's probably better to build it yourself.

NB: TODO: There is a bug now where onSubmit gets called too often. Not sure how to fix this. Because of this, I'll simply remove the onSubmit action in the onsubmit for now, and prevent the default.

getReferencedModelDataItem

ObjectForm

Component to render a parameter that holds an object

This is simply a wrapper around another SimplifiedSchemaForm where the onChange and values are slightly different

ReferenceInput

This component renders an input to select an item to reference from another model (or multiple)

renderParameterTitle

SimplifiedSchemaForm

Recursive component that renders a form for a SimplifiedSchema

useReferencableModelData

Hook to retreive ReferencableModelData to supply to SimplifiedSchemaForm

SimplifiedSchemaForm

Recursive component that renders a form for a SimplifiedSchema

.

Underwater, this calculates all referencableModelNames for a schema, and then it fetches the ReferencableItem[] for every one of those models, using react-query useQuery hooks

NB: be careful, not to change the simplifiedSchema after using this hook for the first time. This will change the amount of hooks and this can break react!

(it will give Error: Rendered more hooks than during the previous render)

binaryExtensions

List of binary file extensions

textExtensions

List of text file extensions

removeCommentsRegex

tryParseJson

if text isn't json, returns null

createCodeblockMarkdown

small util function to create a markdown for a string.

writeToAssets

Writes anything (string or json) the assets folder of the operation of the caller function of this function

Useful for testing

Completion

ContentEditableDivInput

Div that is contentEditable by default and has possibilities for color/style highlighting, autocomplete, subtexts and tooltips

ContextTextArea

depthFontSizes

DivContentEditable

editSubtextSubwordConfig

Interesting... In order to auto-generate a form for this, we need to combine the two into a simple function that does NOTHING. Why? Because we can't store it in the database, it is better to keep this in the frontend...

NB: DEPRECATED: TODO: function isn't used. Since the indexation didn't go right, the solution with a SimplifiedSchemaForm

SimplifiedSchemaForm

Recursive component that renders a form for a SimplifiedSchema

ended up being easier. Keeping it here because I need to fix the indexation nonetheless.

FrontmatterForm

Renders a form for frontmatter without save button

getSubtext

make a subtext text based on the text of a complete paragraph (may contain single newlines and other markdown stuff, but never double newlines)

Returns either the subtext string or a HTML string with a container around the subtext, depending on if you provide withContainer

getTextSegments

Iterates over all child-nodes in the editor, replaces text with a segment, and replaces nodes with a flat list of segments

Returns all textSegments in an array

getWriterTypeFromContent

isAugmentedWordMatch

isTypescript

only detect typescript if the string starts with import. must be improved later on. It would be great to be able to detect that it's a typescript file even if it contains syntax errors.

MarkdownCompletions

MarkdownParsePresentation

MarkdownView

MarkedParagraph

MarkedText

MarkedToken

Function that can be used to iterate over the marked parse and style every token, recursively

NB: this returns a regular react component, and should, for setting it as InnerHTML, be parsed with the ReactDOMServer

MAX_COMPLETIONS_AMOUNT

metaClickableClassName

omitSpecialCharactersFromStart

Omits all special characters from the start of a word for the first special character it finds. The other special characters found after that won't be trimmed.

parseTextContentToHtmlString

Returns a html string from a text string that can be rendered in the dom

NB: because we're parsing text from div.innerText, sometimes there are two newlines when there should be one break.

Three newlines means there should be two breaks...

SmartContentEditableDivInput

Uses ContentEditableDivInput, and attaches the Completions to it based on the content type. Also all other data required...

NB: TODO: once the autocomplete inside the contentEditable is done, these things should move inside of there. I need a component that has lots of UI/UX but isn't very smart. This will be able to be re-used in many usecases...

SpannedSentence

Needs to be done for every text that can have potential interactions

specialCharacters

SubtextContainer

Returns a string with HTML for the subtext container, given you already have

Subword

testAllContentEditableRenderComponents

Can be used to test all ContentEditableRenderComponents with example inputs

Instead you can also enable devmode and just check it on the live examples

testContentEditableRenderComponent

Creates an element from the markdown input, and then uses the toMarkdownString function to make it markdown again.

TODO: use

TitleContainer

container for any index instance that needs to be rendered in the explore page

trimAround

Removes x amount of characters from both sides of a word

trimLeft

Trims a character from a word at the left until that character is not found anymore (recursive)

TypescriptCompletions

In typescript, every word should be autocompletable with the typescript stuff, without backticks.

{ vscodeOpen }

WriterConfigForm

writerInitialValues

WriterInput

Writer input for any utf8 based text, file or no file

MyApp

useReactMediaRecorder

slugify

/**

  • this function does the same as kebabCase but it also does some more transformation on top
  • useful for making simple URLs and filenames. Kebacase is not enough
  • NB: this is no two way transformation. When slugifying something, information is lost and it cannot be converted back in the original name.
  • TODO: make the tranformations that are done here into smaller util functions and make a clean function that can be ran before running every casing conversion (maybe in a config) */

arrayGenerator

/**

  • NB: Do I really need this? Would be nice not to use generators. */

notEmpty

onlyUnique

/**

  • DEPRECATED: should refactor everything to use onlyUnique2 and call it onlyUnique again
  • to be used as a filter. removes duplicates */

worker

generatePassword

/**

  • generates a password. By default, uses a length of 14 */

isEmail

isObject

useNavigation

getChunkBegin

getChunkEnd

getEncoding

/**

  • Get the encoding of a buffer.
  • Checks the start, middle, and end of the buffer for characters that are unrecognized within UTF8 encoding.
  • History has shown that inspection at all three locations is necessary.
  • @returns Will be null if buffer was not provided. Otherwise will be either 'utf8' or 'binary' */

isBinary

/**

  • Determine if the filename and/or buffer is binary.
  • Determined by extension checks first (if filename is available), otherwise if unknown extension or no filename, will perform a slower buffer encoding detection.
  • This order is done, as extension checks are quicker, and also because encoding checks cannot guarantee accuracy for chars between utf8 and utf16.
  • The extension checks are performed using the resources https://github.com/bevry/textextensions and https://github.com/bevry/binaryextensions
  • @param filename The filename for the file/buffer if available
  • @param buffer The buffer for the file if available
  • @returns Will be null if neither filename nor buffer were provided. Otherwise will be a boolean value with the detection result. */

isFirstByteOf2ByteChar

isFirstByteOf3ByteChar

isFirstByteOf4ByteChar

isLaterByteOfUtf8

isText

/**

  • Determine if the filename and/or buffer is text.
  • Determined by extension checks first (if filename is available), otherwise if unknown extension or no filename, will perform a slower buffer encoding detection.
  • This order is done, as extension checks are quicker, and also because encoding checks cannot guarantee accuracy for chars between utf8 and utf16.
  • The extension checks are performed using the resources https://github.com/bevry/textextensions and https://github.com/bevry/binaryextensions
  • @param filename The filename for the file/buffer if available
  • @param buffer The buffer for the file if available
  • @returns Will be null if neither filename nor buffer were provided. Otherwise will be a boolean value with the detection result. */

AugmentedWord

AugmentedWords should have a small footprint since there can be many of them

Words with a specific affix (backticks, bolded, italic) will match against these.

Used to link automatically to functionNames, InterfaceNames, operation-names, words, and more..

NamedParameters<typeof AugmentedWordComponent>

NamedParameters<typeof Dictionary>

ApiConfig

NamedParameters<typeof fn1>

NamedParameters<typeof fn2>

NamedParameters<typeof fn3>

NamedParameters<typeof getGetApiUrl>

NamedParameters<typeof untypedApiFunction>

Asset

Asset you can upload

This is not a database model, it can exist in properties of any db model or type interface.

Only alt and relativePath are stored, the other parameters are optionally required for uploading and user interfaces, and are not always there

NB: don't use this in your model, use StoredAsset instead.

NamedParameters<typeof addToken>

NamedParameters<typeof ensureToken>

NamedParameters<typeof getAssetDirectlyApiUrl>

NamedParameters<typeof getExtensionFromAsset>

NamedParameters<typeof getNameFromRelativePath>

NamedParameters<typeof getNameWithTokenFromRelativePath>

NamedParameters<typeof getPreferredExtensionFromType>

NamedParameters<typeof getReferencedAssetApiUrl>

NamedParameters<typeof getTypeFromRelativePath>

NamedParameters<typeof readableSize>

NamedParameters<typeof removeTokenIfPresent>

MediaSourceEnum

google: remote image urls giphy: remote image urls unsplashed: remote image urls youtube: remote video urls (selectable as mp3, mp4, or url)

NamedParameters<typeof getTypeFromFileBlob>

NamedParameters<typeof makeBackendAsset>

NamedParameters<typeof SelectMedia>

AssetType

Possible Asset Types

BackendAsset

Part of the asset that should be sent to the backend. The rest should frontend-only

Some values are stored, some are not

CompressionConfig

CompressionOption

CompressionOption should be able to be applied on the model parameter through frontmatter

  • default (default option): Default King OS wide compression. User can make customize it within a sensible limit
  • none: no compression applied by default (user can optionally compress it)
  • high: compressed bigtime by default (user cannot make it be compressed less)
  • low: compressed just a little (user cannot make it be compressed less, but can optionally compress it more)

NewAssetType

Possible types for new asset upload in the frontend

UploadAssetBody

NB: other things like alt, final destination etc, should not be sent with the upload, but instead with the function

UploadAssetResult

NamedParameters<typeof AssetView>

NamedParameters<typeof getAugmentedWordObject>

NamedParameters<typeof getAugmentedWords>

NamedParameters<typeof getBundleAugmentedWords>

Authorization

AuthorizationLevel

AuthorizationLevel

AuthorizationLevel

AuthorizationLevel is a single Enum that can apply to privacy and authorization of text, functions, and data.

For files (ts, md, json, etc...):

  • write-create
  • write-update
  • write-delete
  • read
  • search (only search index)

For db model data subsets:

  • write-update
  • write-create
  • write-delete
  • read
  • search (only search index)

For functions:

  • execute

For functions, interfaces, variables:

  • read (reading docs only. for source, you need to provide the file auth)
  • search (only search index)
is a single Enum that can apply to privacy and authorization of text, functions, and data.

For files (ts, md, json, etc...):

  • write-create
  • write-update
  • write-delete
  • read
  • search (only search index)

For db model data subsets:

  • write-update
  • write-create
  • write-delete
  • read
  • search (only search index)

For functions:

  • execute

For functions, interfaces, variables:

  • read (reading docs only. for source, you need to provide the file auth)
  • search (only search index)

NamedParameters<typeof BreadCrumbs>

NamedParameters<typeof renderBreadCrumbs>

AppShell

BundleConfig

Configuration options for bundles. Used with generateBundle

Everything in this model will be copied over to the created bundle, except for createBundleConfig and customisableBundleConfig.

BundleMarkdownReaderConfig

CreateBundleConfig

CustomisableBundleConfig

configuration that can be applied when generating a new bundle

It can be put in the BundleConfig, but it can also be set manually for an individual Bundle Generation.

EnvironmentVariableObject

FinalBundleConfig

FinalCreateBundleConfig

CreateBundleConfig after applying the defaults

FinalCustomisableBundleConfig

FrontBackBundle

This type can specify a frontend and backend that belong to each other. it doesn't include all operations that the ui or server are dependent on, they are calculated separately

InformationStrategy

push (default): take needed information from project and push to bundle (removing the existing info)

pullReplace: pull bundle and keep its information intact, not taking anything new from the OS, replacing all the information we had from these models in the OS

pullMerge: pull bundle and use its information in conjunction with the information we had in the OS. This option will merge both information sources, removing duplicate IDs

ignore: don't put any data in the bundle!

Json

OperationName

later we can make this an enum! it can be auto-generated along with enums for the operation paths, and more things alike.

if it's an enum it will automatically be possible to select a value from it in the simplified schema form :D

besides simply having OperationName, we can have specific operation classification operation names:

  • JsOperationName (js)
  • NodeOperationName (node)
  • ServerOperationName (server)
  • AppShellOperationName (web, app, etc.)
  • UiOperationName (ui-es6 and ui-es5)

OperationPrivacy

ProjectRelativeFilePath

ProjectRelativeFolderPath

later this could be known by the frontend so it will render a ui to select a folder

We need to figure out how we can know all type types in between when getting the type definition schema, not only the final type. If I'm lucky there is a way to find it as a #ref in a consistent way.

PublicBundleConfig

ServerOperationName

Slug

use this for any identifier that's not an Id-type. Usually this is a kebab-case version of a written text, but it can also be a file path, for example.

SlugModelType

use this model for things with a name that have an unique slug that can be used to identify the model

AnyModelType

Parameters that every model will always have.

NB: TimeTypes (createdAt, updatedAt, etc.) are not always included because the kvmd-model doesn't have them.

NB: RelationTypes are also not always included for the same reason

CategorizedFilePaths

filepaths categorized based on the filetype. With king os there are only these filetypes:

  • code: ts, tsx
  • data: json
  • text: md, mdx

CategoryStack

CommentType

special line prefixes:

Developer related comments

  • TODO: for developer to know what to do
  • DISCUSSION: for developer to state that discussion is needed
  • IDEA: for developer to state ideas
  • LATER: for developer to mark as thing that needs to be done later
  • NB: for developer to add a note

Form related comments

  • TITLE: if available, will be used as title of form input (overwrites humanCase version of the property-name itself in that case)
  • SECTION: start a new section in the form from this point, the value behind here can be the title
  • DESCRIPTION: if available, will be used as description of the form input

CommentTypeObject

Every CommentType

CommentType

special line prefixes:

Developer related comments

  • TODO: for developer to know what to do
  • DISCUSSION: for developer to state that discussion is needed
  • IDEA: for developer to state ideas
  • LATER: for developer to mark as thing that needs to be done later
  • NB: for developer to add a note

Form related comments

  • TITLE: if available, will be used as title of form input (overwrites humanCase version of the property-name itself in that case)
  • SECTION: start a new section in the form from this point, the value behind here can be the title
  • DESCRIPTION: if available, will be used as description of the form input
can be a key in the SimplifiedSchema, if available.

CompilerOptions

Dataset

Model

Make subsets of models that can be used for authorising someone for a subset of data, or transfering (or filtering out) subsets of data to a bundle.

DatasetConfig

The part of dataset that can be used in certain functions

DatasetFilter

Can be better, see https://www.w3schools.com/js/js_comparisons.asp

DatasetSort

Sort by comparing the two values using the Array.sort method and Greater than and Less than operators.

DbStorageMethod

The following strategies are available to store the data.

  • jsonMultiple (default): stores the data in a json file which is an array of this data structure. This file will be located in db/[pluralized-kebab-case-model-name].json

  • jsonSingle: stores the data in a json file which is of this data structure (single object) These files will be located in db/[pluralized-kebab-case-model-name]/[instance-slug-or-id].json

  • markdown: stores the data in a markdown file. Takes "markdown" parameter as the main markdown. The other parameters are stored as front-matter. This these files will be located in db/[pluralized-kebab-case-model-name]/[instance-slug-or-id].md

  • keyValueMarkdown: stores the data in key value markdown format. This file will be located in db/[pluralized-kebab-case-model-name].md

  • csv: stores the data in a csv file (only possible for flat object datastructures). This file will be located in db/[pluralized-kebab-case-model-name].csv

Definitions:
  • [pluralized-kebab-case-model-name]: e.g. StudentUser becomes student-users
  • [instance-slug-or-id]: For all models with a slug parameter, the filename will be that slug of that instance. Otherwise, id will be used

DefaultModelType

Use this model by default

Downmatter

ExplorationDetails

FolderExploration

suggested type for menu is FolderExploration[]

NB: recursive!

FolderSummary

objective size measurements of all files in a folder

summary for a folder should contain file-summaries for different filetypes and an overal file summary

Frontmatter

Our version of frontmatter is a bit simpler than regular frontmatter

Not sure if this is a good idea, but it keeps it simple for our OS

all values parse in a similar way to csv

make sure that you use quotes if you want to store a string with commas, because commas in a parameter indicate that it is a string array

NB: string arrays are comma separated values, where you can put values with special characters in between quotes

FunctionExecution

Model for tests, examples, cache, and recent executions of any function

Requirement for tifo-stitching

Example:

const someFunction = (inputA: string, inputB:string):string => {

return ${inputA} != ${inputB} }

find this in the database after executing the function

const functionExecution1 = { .... functionName: "someFunction", inputParameters: ["hello", "world"], output: "hello != world", isTest: false, isExample: false, isResultFromCache: false, performance: [....], }

FunctionParameter

GeneralOperationIndex

Id

Should be an unique string By default, you can use generateId() to generate a random string of 16 characters. If you wish, you can also use any other string, as long as you are sure it's unique.

Background Info

azAZ09 characters are easy to copy and provide 62 characters. the goal of an id is to be unique.

the advantage of a random id compared to an numeric id starting with 1 with auto increment is that you can set them up decentralised.

the change of duplicate ids gets bigger once you make them shorter the change of finding an existing id gets bigger once you make them shorter

An Id with 12 characters would provide 3.22e21 combinations.

What is the change of duplicate ids? This depends on the amount of identifyable items in the data What is the change of guessing an id? This depends on speed of a brute force attack and the amount of available datapoints. If you can guess 10000 times per second, you can make 864.000.000 guesses. A billion guesses on a dataset of a billion datapoints yields 3226 correct ids on average.

Why make an id short? I don't know if there's an important reason.

All in all, I think we should make ids 24 characters by default. This would make it very easy to store, yet, with more than E42 combinations, make it nearly impossible to get duplication or brute force hits.

An id would look like this:

{
"id": "sk2EcW9AkZpksk2EcW9AkZpk"
}

Looks good to me! Don't think about it and just keep it simple. We can always migrate later to a bigger amount, but I don't see good reason to keep it smaller than this.

ImportClassification

node: node core packages like fs and path

react: react standard packages like react, react-native, expo, react-dom, etc.

package: packages from npm that are not classified as operations

operation: operations from our monorepo

internal: imports from other places in the same operation

NB: don't confuse this with OperationClassification

IndexModels

JSONSchema7Type

Primitive type

Language

all currently supported languages

Markdown

a string that is known to contain markdown.

MarkdownAssetType

type of asset that is being embedded

MarkdownChunk

MarkdownContentLevel

0 is a paragraph 1-6 is h1 until h6

MarkdownEmbed

Anything in the format ![alt](src)

NB: I need to be very clear how this one works

MarkdownHeader

MarkdownLink

Anything in the format [alt](href)

It needs to be clear how this works. There is a convention for this, and I should implement that as good as possible, and document it here

MarkdownModelType

Handy model type for storing stuff in a Markdown file.

1 markdown file will represent 1 MarkdownModelType extended instance

another option could be to parse the markdown file, but to KISS we are going to just return markdown with the full markdown content

TODO: see how this relates to MarkdownFile. Make this very clear!

MarkdownParagraph

MarkdownParse

MaybeInteface

at some point in processing we need this interface where definition can also be null

ModelInfo

used to show a list of models available in a menu structure

NamedParameters<typeof getExamples>

NamedParameters<typeof getFunctionExersize>

NamedParameters<typeof markdownParseToMarkdownModelType>

NamedParameters<typeof parseMarkdownModelTimestamp>

NamedParameters<typeof tryParseDate>

OperationClassification

Classification

TODO: think about what the differences are and how we need to change processes to make it all work good

Possible values
  • js: only js (no node) (well, ts of course, but it gets built into js)

  • ts: non-built ts code

  • node: includes other node packages, operations, core-imports, or globals.

  • server: exposes something on some port when it is ran and uses node code

  • web: has next.config.js and thus exposes something on some port when it is ran. next.js + react-based...

  • app: uses react-native and exposes something on some port when it is ran

  • DEPRECATED: ui-es6: uses react (with (native)), which main entry points to typescript es6 files (this ui package cannot be built, should be transpiled. highly discouraged, please use ui-es5, or, if needed, ui-esm)

  • ui-es5: ui which main entry points to javascript es5 files (this ui package can be built). don't import ESM packages in here, this won't work.

  • ui-esm: ui which builds to ESM module resolved Javascript. All packages that use ui-esm packages, need to be ui-esm, ui-es6, or web in order to work properly.

OperationConfig

anything configurable about the operation.

Of course we could make this live in operation.json or as a prop in package.json, but it would be better to make it work with a markdown file.

Let's try to use OPERATION.md

TODO: Make this work and make sure the operationconfig is parsed from this file using db.get("OperationConfig") as per convention.

OperationIndex

contains all calculated info about an operation that needs to be retreived often: some package-only things, but also a collection of all indexes of all files

should be able to be found in operaiton folder in /db/operation-index.json

OperationPathParse

PackageInfoObject

PackageJson

ParameterName

PathMetaData

All interesting metadata about any path (files and folders)

PathParse

object to represent a folder or file path in different ways

NB: doesn't include the absolute path so the indexes can be exported easily witout creating incorrect paths

PerformanceItem

Price

TLDR;EUROS

A price is a number indicating the relative cost. Absolute cost is calculated by many other factors

For now, we're going to keep it simple: 1 Price

Price

TLDR;EUROS

A price is a number indicating the relative cost. Absolute cost is calculated by many other factors

For now, we're going to keep it simple: 1 Price is equal to 1 Eurocent.

Later we can add all kinds of extra conversion:

  • currency support
  • king os currency
  • lower cost for poorer people

etc...

First we need to start making sales before we can add such complexity.

is equal to 1 Eurocent.

Later we can add all kinds of extra conversion:

  • currency support
  • king os currency
  • lower cost for poorer people

etc...

First we need to start making sales before we can add such complexity.

ProjectType

DEPRECATED: TODO: should use OperationClassification

RunEveryPeriodEnum

Used to specify functions that need to run every time with a specific interval

All times are at at the server timezone time

  • minute: every minute at 0 seconds
  • 5-mintues: every 5 minutes, starting at the first minute of the hour
  • quarter-hour: every 15 minutes, starting at the first minute of the hour
  • hour: every hour, starting at the first minute of the hour
  • 6-hours: every 6 hours, starting at midnight
  • midnight: every midnight (00:00:00)
  • week: every week at sundaynight (sunday, 1 second after 23:59:59 PM)
  • month: at the first second of the first day of the month (0:00:00)
  • 3-months: every start of the quarter: january 1st (0:00:00), april 1st, july 1st, october 1st
  • year: every new year at january 1st at 0:00:00

Schema

schema type interface we use in TsInterface

NB: don't export because this would make this type exist twice.

SensibleConfig

Sensible-global configurations

TODO: rename to typerepo

SimplifiedSchema

JSONSchema7 derivative that has the following capabilities and and characteristics...

  • does not include objects in objects that are also referenced to using xxxSlug or xxxId
  • recursively finds the references and expands them, unless the references are circular
  • easier to read
  • has all the information we need
  • is able to generate an object with values in the exact format the function needs it
  • is able to easily generate a form

SimplifiedSchemaItem

SimplifiedSchemaProperty

SimplifiedSchemaType

SizeSummary

type interface that can be used to summarize multiple files

SocialMediaCallToAction

A call to action suffix is a handy model that can be used to place under a postable. this way we are getting much more conversions from the traffic received on media

Stats

A fs.Stats object provides information about a file.

Objects returned from {@link stat } , {@link lstat } and {@link fstat } and their synchronous counterparts are of this type. If bigint in the options

options

special character combinations that make the console message be printed differently

passed to those methods is true, the numeric values will be bigint instead of number, and the object will contain additional nanosecond-precision properties suffixed with Ns.

console Stats { dev: 2114, ino: 48064969, mode: 33188, nlink: 1, uid: 85, gid: 100, rdev: 0, size: 527, blksize: 4096, blocks: 8, atimeMs: 1318289051000.1, mtimeMs: 1318289051000.1, ctimeMs: 1318289051000.1, birthtimeMs: 1318289051000.1, atime: Mon, 10 Oct 2011 23:24:11 GMT, mtime: Mon, 10 Oct 2011 23:24:11 GMT, ctime: Mon, 10 Oct 2011 23:24:11 GMT, birthtime: Mon, 10 Oct 2011 23:24:11 GMT }

bigint version:

console BigIntStats { dev: 2114n, ino: 48064969n, mode: 33188n, nlink: 1n, uid: 85n, gid: 100n, rdev: 0n, size: 527n, blksize: 4096n, blocks: 8n, atimeMs: 1318289051000n, mtimeMs: 1318289051000n, ctimeMs: 1318289051000n, birthtimeMs: 1318289051000n, atimeNs: 1318289051000000000n, mtimeNs: 1318289051000000000n, ctimeNs: 1318289051000000000n, birthtimeNs: 1318289051000000000n, atime: Mon, 10 Oct 2011 23:24:11 GMT, mtime: Mon, 10 Oct 2011 23:24:11 GMT, ctime: Mon, 10 Oct 2011 23:24:11 GMT, birthtime: Mon, 10 Oct 2011 23:24:11 GMT }

TextJson

TsBuildError

TsComment

comments are basically one-or-multi-line human content inside of typescript files, so it's a very important to do something useful with them.

The convention should be that single-line comments should start with that. This then becomes the type of the comment. You can also put multiple prefixes at the start.

Example:

// TODO: NB: this is a todo but its also important

Multiline comments can also have one or multiple types in their text, but they should not be split into multiple comments as the context could be needed some times.

There are also some other things comments can say about statements, but these should be inside the frontmatter, and are much more flexible.

  • classified[0-10] indicating level of classification. This way I can share subsets of the codebase, maybe...
  • privacy
  • ...?

NB: with the current setup we can also parse .md files as being a TsComment, keep it that way!

NB: comments are part of the code, so they should always be in English!

TsConfig

would be nice if we have a type interface for this, just like package.json for now just type the stuff we need

TsExport

TsFunction

Interface for arrow functions and normal functions

TsImport

TsIndexModelType

identifier of any index type interface

TsInterface

TODO: Just like parameters, this should be linted for. If you define an interface that's not declared here, that should ring a bell.

TsLintWarning

TsVariable

TypeCoverage

quantification of coverage of the specified type or subtypes in our database.

TypeInfo

all info that should always be collected when indexing any type interface

TypescriptIndex

Typescript file metadata (all indexes from typescript files, together)

WebMarkdownFile

Every markdown file meant for the web, should have these optional parameters that can be declared as its frontmatter

NB: This is not part of MarkdownModelType, because MarkdownModelType is very barebones general purpose, not only for the web!

WebsiteCallToAction

WebsiteHeader

Casing

NamedParameters<typeof camelCase>

NamedParameters<typeof capitalCase>

NamedParameters<typeof capitaliseFirstLetter>

NamedParameters<typeof convertCase>

NamedParameters<typeof convertToTargetCasing>

NamedParameters<typeof getDelimiter>

NamedParameters<typeof humanCase>

NamedParameters<typeof kebabCase>

NamedParameters<typeof lowerCaseArray>

NamedParameters<typeof pascalCase>

NamedParameters<typeof slugify>

NamedParameters<typeof snakeCase>

NamedParameters<typeof splitCasingDelimiters>

CsvItemType

NamedParameters<typeof tryParseCsv>

CustomQueryConfig

NB: the dbStorageMethod cannot be specified here because this is a static configuration per db-model and cannot be specified on a per-query basis.

Also you can't specify projectRelativePath and operationRelativePath. It should not be needed, you should specify the db storage locations in the createDb config.

NamedParameters<typeof getCli>

NamedParameters<typeof getMergedQueryConfig>

NamedParameters<typeof main>

NamedParameters<typeof test>

NamedParameters<typeof FancyLoader>

DropboxExtension

these filetypes should never be opened with explore. They should be processed and either indexed or converted. This creates a md or json with the proper metadata, which, in turn, can be explored.

FileType

JsonExtension

MarkdownExtension

NamedParameters<typeof getWriterType>

NamedParameters<typeof hasSubExtension>

NamedParameters<typeof isGeneratedOperation>

NamedParameters<typeof isGeneratedOperationName>

NamedParameters<typeof isIndexableFileId>

SearchableExtension

SearchLevel

TypescriptExtension

WriterType

Type of content that can be interpreted by the writer-input

writer-input
Writer Input

component to create a writer input

This is a ui-esm operation. This means it's a ui operation that builds to javascript with ESM module resolving... It was based on this example: https://prateeksurana.me/blog/react-library-with-typescript/

AnyModelObject

AugmentedAnyModelType

DbFileLocation

Object used to hand over all information about the location of a db-file in a structured way

DbQueryResult

TODO: return the inserted id or other reference

Result of any query except get. Will not always provide all parameters (depends on the type of query you do)

IncludeConfig

All possible ways to include items from references into a get query

IncludeDataObject

Include

KeyValueMarkdownModelType

handy model type for storing stuff in a KeyValue Markdown file. empty lines are omitted

all you need to specify in the kvmd is the key and the value, separated by ":"

NB: there can be a parent_modelNameSlug key exposed that should refer to the parent slug

MergedQueryConfig

ModelLocation

Parameters that tell you about the location an instance of a model. Models can be tied to an operation. They always have a projectRelativePath, and if they are tied to an operation, also an operationRelativePath.

NamedParameters<typeof augmentItemWithReferencedDataRecursively>

NamedParameters<typeof calculateOperationsObject>

NamedParameters<typeof findParent>

NamedParameters<typeof getAugmentedData>

NamedParameters<typeof getDatabaseFiles>

NamedParameters<typeof getDatabaseRootFolder>

NamedParameters<typeof getDbFileLocation>

NamedParameters<typeof getDbStorageMethodExtension>

NamedParameters<typeof getLocationPattern>

NamedParameters<typeof getParentSlug>

NamedParameters<typeof getWildcardDbFileLocations__OLD>

NamedParameters<typeof getWildcardDbFileLocations>

NamedParameters<typeof removeKeyValueMarkdown>

NamedParameters<typeof upsertKeyValueMarkdown>

NamedParameters<typeof upsert>

NamedParameters<typeof addDefaultValues>

NamedParameters<typeof createDb>

NamedParameters<typeof getDefaultLocationPattern>

NamedParameters<typeof getMergedConfigOperationPath>

NamedParameters<typeof getRootFolders>

QueryConfig

QueryConfig is set on 4 levels, which have increasing priority

  • hardcoded in fs-orm
  • when calling createDb, setting defaultQueryConfig
  • when calling createDb, setting modelQueryConfig
  • when running a query

Not all options are available when running a query.

RootDbFolder

UpsertKeyValueMarkdownItem

UpsertQueryConfig

Dir

A class representing a directory stream.

Created by {@link opendir } , {@link opendirSync } , or fsPromises.opendir().


try {   const dir = await opendir('./');   for await (const dirent of dir)     console.log(dirent.name); } catch (err) {   console.error(err); } ```

When using the async iterator, the `fs.Dir` object will be automatically closed after the iterator exits.

Dirent

A representation of a directory entry, which can be a file or a subdirectory within the directory, as returned by reading from an fs.Dir. The directory entry is a combination of the file name and file type pairs.

Additionally, when {@link readdir } or {@link readdirSync } is called with the withFileTypes option set to true, the resulting array is filled with fs.Dirent objects, rather than strings or Buffer s.

FolderPath

DEPRECATED: just use ParsedPath

Fs

all handy Fs types

MarkdownContent

NamedParameters<typeof findFileNameCaseInsensitive>

NamedParameters<typeof getFileName>

NamedParameters<typeof getFolder>

NamedParameters<typeof getLastFolder>

NamedParameters<typeof getPathCombinations>

NamedParameters<typeof parseMd>

NamedParameters<typeof removeAllExcept>

NamedParameters<typeof copyAllRelativeFiles>

NamedParameters<typeof getAllFoldersUntilFolder>

NamedParameters<typeof getFirstAvailableFilename>

NamedParameters<typeof getOneFolderUpPath>

NamedParameters<typeof oneUp>

NamedParameters<typeof renameAndCreate>

PathLike

Valid types for path values in "fs".

Path

unlike PathLike, this is only a string

For now, we don't have a clear convention whether or not this string should be absolute or anything.

UnixTimestamp

NamedParameters<typeof join>

NamedParameters<typeof findOperationBasePath>

NamedParameters<typeof findOperationBasePathWithClassification>

NamedParameters<typeof getAllPackageJsonDependencies>

NamedParameters<typeof getCommonAncestor>

NamedParameters<typeof getOperationClassification>

NamedParameters<typeof getOperationPath>

NamedParameters<typeof getOperationPathParse>

NamedParameters<typeof getOperationRelativePath>

NamedParameters<typeof getPathParse>

NamedParameters<typeof getPathsWithOperations>

NamedParameters<typeof getProjectRoot>

NamedParameters<typeof getRelativeLinkPath>

NamedParameters<typeof getRelativePath>

NamedParameters<typeof getSrcRelativeFileId>

NamedParameters<typeof hasDependency>

NamedParameters<typeof hasProjectRootFile>

NamedParameters<typeof isOperation>

NamedParameters<typeof isSensibleProject>

NamedParameters<typeof isWorkspaceRoot>

NamedParameters<typeof makeRelative>

NamedParameters<typeof concatenate>

NamedParameters<typeof getParameterAtLocation>

NamedParameters<typeof replaceLastOccurence>

NamedParameters<typeof reverseString>

NamedParameters<typeof trimSlashes>

NamedParameters<typeof benchmark>

NamedParameters<typeof exploreOperationFolders>

NamedParameters<typeof findAllDocsFolderPaths>

NamedParameters<typeof findAllFoldersWithName>

NamedParameters<typeof findAllPackages>

NamedParameters<typeof findAllTodoFolderPaths>

NamedParameters<typeof getArgument>

NamedParameters<typeof pathArrayIsOperation>

KeyValueMarkdownParse

NamedParameters<typeof flattenMarkdownChunks>

NamedParameters<typeof getKvmdItemsRecursively>

NamedParameters<typeof getParagraphsRecursively>

NamedParameters<typeof kvmdDataMap>

NamedParameters<typeof kvmdDataToString>

NamedParameters<typeof kvmdParseToMarkdownString>

NamedParameters<typeof markdownStringToKvmdParse>

NamedParameters<typeof parseKvmdLine>

CoreWordMatrixWord

KvmdWord

Should later be migrated to WordMatrix

WordMatrix

WordMatrix is a matrix that contains as much information about a word as possible in as many languages as possible. Easy to use for 1:1 translation

@see Language

MappedWordMatrix

Mapped Object for performance reasons

MarkdownWord

Should later be migrated to WordMatrix

WordMatrix

WordMatrix is a matrix that contains as much information about a word as possible in as many languages as possible. Easy to use for 1:1 translation

@see Language

NepaliEnglishTranslationMatrix

Statement

TokiPonaMatrix

DEPRECATED: to be migrated to WordMatrix

WordMatrix

WordMatrix is a matrix that contains as much information about a word as possible in as many languages as possible. Easy to use for 1:1 translation

@see Language

Translation

We could have a Translation model that collects any translation for any key for any model for any language. The original source text is still stored in the models itself, and every model has just one language.

If you want a markdown or text key to be translated, add {parameter}_TranslationId to the model. The translation can then be generated on-demand and improved afterwards.

Word

The goal of the words model is to provide a definition for every word we use, in any language.

DEPRECATED: Should be replaced with WordMatrix

WordMatrix

WordMatrix is a matrix that contains as much information about a word as possible in as many languages as possible. Easy to use for 1:1 translation

@see Language

WordCategory

Different ways to categorise a word semantically

WordCombination

Best way to combine words if you don't want to specify all language specific info for a new word. You can refer to words from the WordMatrix instead!

WordConjucation

In linguistics, conjugation is the creation of derived forms of a verb from its principal parts by inflection

Besides this, there are also other ways to alter a word to add/change meaning, this should be summed up using this enum.

WordInfo

WordLanguageInfo

Language specific word information

WordLanguageInfoObject

WordMatrix

WordMatrix is a matrix that contains as much information about a word as possible in as many languages as possible. Easy to use for 1:1 translation

@see Language

WordPriority

WordType

GlobalLogConfig

a logging configuration object that you can set using a file in the root of your operation or project.

LogConfig

LogType

how should it look and feel?

NamedParameters<typeof getCallerFileName>

NamedParameters<typeof log>

NamedParameters<typeof parseTitle>

OperationLogConfig

ProjectLogConfig

CodeblockMode

MarkdownParseRenderConfig

NamedParameters<typeof getRealSrc>

NamedParameters<typeof getUrlFromRelativeUrl>

NamedParameters<typeof MarkdownCodeblock>

NamedParameters<typeof renderFrontmatter>

NamedParameters<typeof renderMarkdownChunk>

NamedParameters<typeof renderMarkdownParse>

NamedParameters<typeof renderMarkdownTitle>

NamedParameters<typeof useOpenHashDetails>

MarkdownParagraphChunk

MarkdownParseConfig

MarkdownReference

NamedParameters<typeof getChunkParagraphsRecursively>

NamedParameters<typeof getImplicitId>

NamedParameters<typeof getMarkdownIntro>

NamedParameters<typeof getMarkdownParseParagraphs>

NamedParameters<typeof getMarkdownReferencePaths>

NamedParameters<typeof getMarkdownReferencesFromParagraph>

NamedParameters<typeof markdownParseToMarkdownString>

NamedParameters<typeof mdContentParseRecursively>

NamedParameters<typeof mdToJsonParse>

NamedParameters<typeof parseFrontmatterMarkdownString>

NamedParameters<typeof parseMarkdownParagraph>

NamedParameters<typeof parseMdToChunks>

NamedParameters<typeof removeHeaderPrefix>

GetStaticPathsContext

GetStaticPropsContext

MarkdownReaderPage

for markdown-reader-ui, the pages can be markdown files, but they can also be connected to models

NamedParameters<typeof copyStaticAssets>

NamedParameters<typeof copyStaticAssetsCli>

NamedParameters<typeof getAllMarkdownReaderPages>

NamedParameters<typeof getFolderExplorationInfo>

NamedParameters<typeof getMarkdownModelPages>

NamedParameters<typeof getMarkdownPageInfo>

NamedParameters<typeof getMarkdownReaderQueryPaths>

NamedParameters<typeof getOperationPages>

NamedParameters<typeof getPublicMarkdownFilePaths>

NamedParameters<typeof getTodoPages>

NamedParameters<typeof markdownReaderGetStaticPaths>

NamedParameters<typeof markdownReaderGetStaticProps>

NamedParameters<typeof removeExtensionsFromPath>

NamedParameters<typeof removeNumberPrefix>

NamedParameters<typeof shouldExposeMarkdownFile>

NestedPathObject

A different way to represent a path array in a nested object of folders

{ "folderName": { "file1": null, "file2": null }, "folderName2": { "file1": null, "file2": null } }

NamedParameters<typeof getQueryPath>

NextParsedUrlQuery

AugmentedWordObject

This datastructure is probably needed to make it more efficient.

Should be a lookup table for the querypath for every word

AugmentedWordTypeEnum

NB: can later be replaced with a string enum type: person, definition, variable, function, type interface, operation, bundle (but there may be much more)

MarkdownReaderPageProps

FrontmatterValue

MarkdownIndex

This could hold anything that we can index about a markdown-file

It should probably also be posted in the markdown file itself as "downmatter", if that's a good idea

NamedParameters<typeof frontmatterParseToString>

NamedParameters<typeof getFrontmatterValueString>

NamedParameters<typeof quotedOrNot>

NamedParameters<typeof stringifyNewlines>

CategoryModelType

TODO: make this be able to hold more than just the KV. If that's not really needed just throw this away...

Simple recursive data structure for hierarchical categories. Should be used to make any category model

Make sure, when extending this, to provide a reference xxxSlug and its content xxx as optional parameters to its parent categories.

E.g. for a CountryCategory, you should provide countryCategorySlug and countryCategory

CreatedAt

CreatedFirstAt

in some cases, data can be created before it was created in our system. In this case, use CreatedFirstAt if this information is important.

Credit

CsvModelType

Use this model for things you want to store in CSV format

TODO: add support for numbers, booleans, null, undefined

DeletedAt

Email

Euro

Index

used for md files. index is the line

KvmdLine

all things that can be parsed from a single line

NamedParameters<typeof generateId>

NamedParameters<typeof generatePassword>

NamedParameters<typeof generateRandomString>

NamedParameters<typeof generateTime>

NamedParameters<typeof isEmail>

NamedParameters<typeof markdownModelTypeToMarkdownString>

PhoneNumber

country code without +

RelationType

This probably doesn't work, but it would be great if it would. This way I'd like to say that any model can have keys that end with "Id". These keys should always refer to Ids from other models. Also, if a model has a key like this, it is inferred that there is also a key without the Id suffix which does or doesn't cointain the actual model specified by the id.

If this cannot be done in typescript, it can be convention, and we can create a linter for this.

Wooh!

const relations: RelationType = {
helloId: "hoi",
byeId: "bye",
};

The above seems to be working fine, so it IS possible!

TODO: think about it... should the name of the parameter be dependent on the strategy of how the model is stored? Maybe just call it all id, right? We can also make the index a string by just prepending a string to it.

ShouldNotBeStored

Parameters that should not be stored into the database

SlugModelProperties

Time

Time

Time can be stored in various ways but in my experience it is, again, best to keep it simple and just have one way to store time. I can think about this for hours, but my intuition goes towards using the same format as Date.now() because it is a very small format and is easy to read.

It is the amount of ms since 1970.

I could argue to store it in seconds since 1970 since there are few applications of doing ms, but maybe we do, and it's just 30% bigger. No problem.

Therefore, let's store all time values in the format Date.now()

TimeTypes

TimeTypes is often extended with modelTypes.

UpdatedAt

Url

valid url, can be validated

AssetInputType

NamedParameters<typeof getAssetInputType>

NamedParameters<typeof getParameterContentType>

NamedParameters<typeof isCalculatedParameter>

NamedParameters<typeof isGeneratedParameterName>

PatternMatcher

ExpandedObject

NamedParameters<typeof queryPathsArrayToNestedPathObject>

NamedParameters<typeof reduceQueryPathsRecursively>

NamedParameters<typeof useExpanded>

NamedParameters<typeof parsePrimitive>

NamedParameters<typeof parsePrimitiveArray>

NamedParameters<typeof parsePrimitiveBoolean>

NamedParameters<typeof parsePrimitiveString>

PrimitiveResult

NamedParameters<typeof isPlural>

NamedParameters<typeof isSingular>

NamedParameters<typeof pluralize>

NamedParameters<typeof singularize>

NamedParameters<typeof getTailwindModules>

NamedParameters<typeof joinClassNames>

NamedParameters<typeof Svg>

NamedParameters<typeof trimClassName>

NamedParameters<typeof wrapInTextIfNeeded>

SvgType

NamedParameters<typeof AlertProvider>

NamedParameters<typeof useAlert>

MapLocation

PluginInputType

Suggestion

ViewPort

NamedParameters<typeof useNavigation>

NamedParameters<typeof useRouter>

ID

NamedParameters<typeof getRealValue>

NamedParameters<typeof Select>

NamedParameters<typeof getItem>

NamedParameters<typeof setItem>

NamedParameters<typeof readCsvFile>

NamedParameters<typeof readCsvFileSync>

NamedParameters<typeof readJsonFile>

NamedParameters<typeof readJsonFileSync>

NamedParameters<typeof readKvmdFile>

NamedParameters<typeof test2>

NamedParameters<typeof readMarkdownFile>

NamedParameters<typeof getQueryPart>

JSONSchema7

JSONSchema7Definition

JSON Schema v7

NamedParameters<typeof findFirstCommentTypes>

NamedParameters<typeof getPossibleReferenceParameterNames>

NamedParameters<typeof getProperties>

NamedParameters<typeof getReferencableModels>

NamedParameters<typeof getReferenceParameterInfo>

NamedParameters<typeof getRefLink>

NamedParameters<typeof getSchema>

NamedParameters<typeof getSchemaItems>

NamedParameters<typeof simplifiedSchemaToTypeDefinitionString>

NamedParameters<typeof simplifySchema>

ReferenceParameterInfo

SchemaItem

SchemaProperty

NamedParameters<typeof getReferencedModelDataItem>

NamedParameters<typeof useReferencableModelData>

ReferencedModelDataItem

ReferenceItem

ReferenceItemsObject

EncodingOpts

NamedParameters<typeof getChunkBegin>

NamedParameters<typeof getChunkEnd>

NamedParameters<typeof getEncoding>

NamedParameters<typeof isBinary>

NamedParameters<typeof isFirstByteOf2ByteChar>

NamedParameters<typeof isFirstByteOf3ByteChar>

NamedParameters<typeof isFirstByteOf4ByteChar>

NamedParameters<typeof isLaterByteOfUtf8>

NamedParameters<typeof isText>

NamedParameters<typeof tryParseJson>

NamedParameters<typeof createCodeblockMarkdown>

NamedParameters<typeof writeToAssets>

NamedParameters<typeof Completion>

NamedParameters<typeof editSubtextSubwordConfig>

NamedParameters<typeof getContext>

NamedParameters<typeof getSubtext>

NamedParameters<typeof getWriterTypeFromContent>

NamedParameters<typeof isAugmentedWordMatch>

NamedParameters<typeof isTypescript>

NamedParameters<typeof MarkdownCompletions>

NamedParameters<typeof MarkdownParsePresentation>

NamedParameters<typeof MarkdownView>

NamedParameters<typeof MarkedToken>

NamedParameters<typeof omitSpecialCharactersFromStart>

NamedParameters<typeof SpannedSentence>

NamedParameters<typeof SubtextContainer>

NamedParameters<typeof Subword>

NamedParameters<typeof testAllContentEditableRenderComponents>

NamedParameters<typeof trimAround>

NamedParameters<typeof trimLeft>

NamedParameters<typeof TypescriptCompletions>

NamedParameters<typeof WriterConfigForm>

SubtextConfig

Configuration of what should be shown in the subtext

SubwordConfig

Configurate what should be shown about words

TextEditingContext

WriterConfigFormValue

SubtextRelatedThing

SubwordViewMode

WriterViewEnum