Dictionary
codestorys-web
NB: this is an experimental part of typerepo!
function-server
Server that exposes all typerepo api functions wrapped into easily accessible endpoints.
markdown-reader-web
search-web
Search everywhere
NB: This is an experimental part of typerepo!
todo-web
NB: This is an experimental part of typerepo!
writer-web
✍️ writer-web
codestorys-node
collect-static-assets
sdk-api
sdk-api-keys
sdk-db
This operation is used to collect all typebase database models in the entire project, and export them, wrapped in a DbModels
interface. This is needed for creating a function that can access the entire database (see database operation)
sdk-env-private
This operation contains all private environment variables that can be used on the frontend and backend of your application(s).
Generated for bundles (to be set in BundleConfig), manually set for King OS.
NB: make sure not to import this in any frontend operations, because it may contain private keys and other secrets!
sdk-env-public
This operation contains all public environment variables that can be used on the frontend and backend of your application(s).
Generated for bundles (to be set in BundleConfig), manually set for King OS.
sdk-function-paths
sdk-interface-paths
sdk-js
operation that imports all js
functions and variables in the entire project (OS or bundle) and exports an object that has all of them.
can be generated
sdk-operations
Generated operation that exports an object that contains all names of all operations as keys, and all project relative paths to those operations as values.
Needed to find files more quickly in a more performant way.
When moving operations around, ensure to regenerate this to avoid conflicts.
sdk-ui
make-codestory
ai-functions-node
ai-types
all
This operation contains a lot of different functions that can help you to execute different things on all operations.
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-store
api-types
api-related types needed for the api operation
apps-menu
Please set a description for this operation in OPERATION.md
ask
asset-functions-js
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-functions-node
asset-input
This component lets you easily add asset input that includes upload with the typerepo
server standard (function-server)
Add the css to your web project: import "asset-input/css.css";
asset-type
All types related to asset upload
asset-view
AssetView
shows an asset. Every file-format has a different way to be rendered.
augmented-word-node
augmented-word-types
auth-types
authentication
big-button
breadcrumbs
frontend component to show a file location in a nice way (breadcrumbs)
browser-types
bundle-types
bundle-util
chatgpt-controller
child-process-helper
cleanup-typescript-database
Collection of functions to cleanup the typescript database (all typescript related models)
clickable-icon
code-types
comment-util
compile-typescript
context-menu
convert-case
cool-toast
csv-util
database
Operation that can be used within any typerepo to interact with the fs-orm (typebase) database. Relies on sdk-db (where your models should be summarized)
db-crud
db-recipes
Useful library of functions that wrap the fs-orm database.
TODO: should probably be split up further to differentiate between db-ui functions and a more general purpose library
db-util
docs-get-pages
encrypt-password
explore-project
explore-project explores the whole OS or project, so information about the project can be shown in a UI or used in another way
fancy-loader
ffmpeg-util
file-explorer-open
file-icons
Exposes funcitons to get a nice emoji file-icon for any file type
file-search
Exposes functions to easily create a file-search menu in your react-app
file-tabs
Open files as tabs so you can come back there...
file-writer
Please set a description for this operation in OPERATION.md
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/
filename-conventions
Any functions and variables related to filename conventions
find-all-dependency-operations
folder-get-updated-at
Get last updated file updatedAt time in whole folder, recursively
frontmatter-util
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
function-context-type
function-form
Component that lets you easily create a frontend form for any function in your project (both backend and frontend functions)
function-functions-node
function-server-endpoints
Wraps all functions found in sdk-api
and creates server
endpoints for them. Besides simply wrapping them into an endpoint, it also adds some extra layers to every function.
function-types
function-util
Exposes clis that make it possible to interact with all King OS functions through the CLI in different ways
generate-index
generate-sdk-operations
This operation contains different functions to generate all possible sdk operations according to the King OS convention.
Ensure to apply all King OS conventions when generating these operations, because otherwise they may contain typescript errors and this may result in runtime errors.
generative-functions-node
generative-ui
geo-types
get-all-operation-source-paths
returns src folder paths of all operations
get-imported-dependencies
get-imports-exports
get-package-json
get-package-source-paths
Returns an array of absolute file paths of (typescript) files in the src of your operation
get-path
Useful functions to get paths within King OS.
Depends on sdk-operations, which makes it only work inside of a typerepo.
get-ts-config
Gets the TsConfig given a path to an operation
hotkeys
Operation exposing any utility function related to hotkeys in the browser
index-typescript
This repo is used to generate the typescript index.
Some important conventions I'm applying:
-
The generated index doesn't know the absolute location, which makes it possible to move around the Project in the OS
-
The generated index only tells you information about this very operation. All links with other operations should be done in postprocessing
-
Every generated index has an
IndexId
is-online
is-system-busy
js-util
json-util
k-dev
CLI that starts a watcher that watches all your operations for changes and rebuilds the operation on every change (compiling and indexing the altered file(s))
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)
k-test
key-value-markdown-js
labeled-button
language-types
layout
lint
lock-system
lock-util
log
Log a message with a special type
make-file-type
exposes makeFileType
, a function that helped turning a path into a specific type. Was previously used for things like watching, but this is probably not needed anymore.
make-test
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-parsings
markdown-reader-functions
markdown-reader-functions-js
markdown-reader-types
markdown-types
marked-util
matter-types
measure-performance
menu
minify-build
model-types
name-conventions
Any functions and variables related to variable declaration naming conventions
nested-menu
nested-menu-types
new-template
Package to create a new King OS template (template or some other boilerplate)
next-a-link
next-paths
operation that helps you to render your own paths in a next project without using their pages convention
next-types
nodemon
one-by-one
operation-util
Operation with utility functions to calculate things about operations and alter operation-index.
parse-primitive
path-util
Gets insightful information about any file or folder (path)
peer-functions
peer-types
persona-functions-node
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
pm2-util
Wrapper around pm2 to easily manage proceses within King OS
port-conventions
Any functions and variables related to port conventions
prompt-components
puppeteer-utils
queue-types
react-with-native
HTML elements with React Native capabilities.
react-with-native-alert
TODO: NB: seems not to work right now in a new template! Fix it
react-with-native-form
Create forms, fast
react-with-native-form-asset-input
Please set a description for this operation in OPERATION.md
react-with-native-form-inputs
react-with-native-modal
react-with-native-notification
Makes it possible to receive notifications in both react and react-native.
react-with-native-router
react-with-native-select
react-with-native-store
Simple localStorage/asyncStorage-based and fully typed redux replacement with global persisted storage by default for react and react-native apps.
react-with-native-table
react-with-native-ui
Simple basic Tailwind class strings for sensible UI components
read-csv-file
read-json-file
read-kvmd-file
read-markdown-file
read-typescript-file
reader-ui
rebuild-operation
Operation that makes it possible to rebuild an operation (re-index, re-build, etc.)
recursive-types
recursive-util
rename-template-files
Rename template files to their original name
Useful when you want to apply a template to create a new starting point for something
rest-util
run-child-process
say
Operation that contains multiple functions that wrap the say cli on MacOS to let the device speak out text.
Can later be extended to wrap other clis or even api's.
Should also be extended to work on multiple operating systems.
schema-util
It's hard to work with them if you don't know what means what. In this operation I'll summarize everything and give examples.
search
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.
server-login
This operation exposes rudimentary functions to set cookies from the backend. We require cookies in order to authenticate a user for GET requests. Cookies are sent to the server for every request and are a safer way, because they are not part of the URL that can be found in the browser history.
This thing is far from finished, see todo/
for what needs to be done.
set-json-key
Useful functions to alter JSON files (can be used both with node or with a CLI)
share
short-markdown-parser-js
short-markdown-parser-node
short-markdown-types
short-markdown-writer-input
simplified-schema-form
component that generates a form using react-with-native and a SimplifiedSchema. Can obtain any JSON object from the user.
sms
social-media-types
I want a type interface collection that is able to collect all data from all social networks and put them together.
string-to-json
Parser functions to parse strings (that can be inputted in the command-line) into objects (that can be read in functions)
swipe-homepage
tabs
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.
time
import { setRandomTimezone } from "set-random-timezone";
To enable possibility to change the timezone in the OS, this is the actually correct time, assuming we are in timezone GMT+1
timeline
- find statements in markdown (
> xxx
) - find functions, interfaces, variables and show them
- find todos inside (doc) comments and the file around it
- find type build errors from typescript and the file around it
- show the above in a tik-tok kinda timeline that you can swipe (or click to enter the codebase)
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/
todo-types
types related to the upcoming todo-ui
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.
tooltip
Please set a description for this operation in OPERATION.md
try-parse-json
ts-morph-util
ui-util
use-on-screen
use-url-store
vscode-open
function to open a file in VSCode (wraps code
cli command)
watch-all
watch-folders
General purpose functions to watch folder(s) for changes on any operating system
watch-operations
Calls rebuildOperation for every filechange in every operation watched
watch-types
webpage-types
write-to-assets
Function to write anything to assets.
writer-functions
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
HomePage
Layout
progress
queryClient
executeCronFunction
NB: cron functions cannot have parameters
runFunctionServerCli
Argument:
- pass true if you want the server to be watching
- pass true true if you want the server to be watching and this is a restart (so don't launch things like browser)
- if you pass nothing, there will be no browser start and no watcher
runFunctionServerDevCli
runFunctionServerDev
runFunctionServer
runs sdk api server using "server" package.
server will be exposed on port 42000
scheduleCronJobs
scheduleObject
For every RunEveryPeriodEnum, this object provides the interval cronExpression
string for node-cron
startSearchWebIfAvailable
DbAndUpsert
This should catch all dbQueryPaths because those aren't default ones
DbLayout
fitViewOptions
Flow
FormTab
Uses <FunctionForm>
component
Executes the function directly or through API (depending on whether or not it is a node-only-function or bare JS)
Don't show this tab for JSX components
FunctionExecutionTable
FunctionLayout
FunctionPage
functionWebInitialValues
getAllSearchResults
Searches filepaths, then links to any ui-web
that has this file available as a page, or VSCode.
For this we need to get the MarkdownReaderPage
and other pages that are available in ui's and see the files they are linked to.
I want to be able to:
- search functions, interfaces, variables
- search operations
- search markdown files, anywhere
- search db-ui models
But there's more. To make a good serach...
TODO:
- gather everything i've made before about search
getTimelineItems
initialEdges
initialNodes
initialValues
mindspaces
quotes
ReaderPageLayout
SearchBar
searchGetStaticProps
SearchResultComponent
If you click on a site that up and running, it should startup via pm2 before being redirected there
SearchResultPage
{ StoreProvider, useStore }
Test
FileWriterPage
MyLayout
TodoMenuHeader
codestoriesGetPages
codestoriesGetStaticPaths
Function that tells Next.js what the pages are that need to be statically generated
codestoriesGetStaticProps
copyCopyPairs
copyReaderStaticAssets
findReaderStaticAssets
markdown-renderer turns a relative link into this: ?mdpath=x&relativePath=y
for static, we need to turn it into something similar, but we need to guarantee no file collisions. simple!
we can just take the project-relative file path of the asset, and put it in /public/images in next.js. the final url of the asset in public next.js then becomes images/[path/to/asset.jpg]
findStaticAssets
Returns the absolute paths of all static assets (embeds and links) in a markdown file of which the path is provided.
addCodestoryToSection
addModelName
findCodestories
Finds all mdfiles (absolute paths) in /text or /operations that have a frontmatterprop isCodestorytrue
makeCodespanMappedObject
makeCodestory
no real reason to do this from text to text, let's do path to path here
mapChunkRecursively
mapMarkdownParseSections
test
writeAllCodestoriesCli
Arguments:none
writeAllCodestories
writeCodespanDetails
addEmojiToEveryWord
Emojify++
addStatement
Adds Statement
addWord
Adds word either to the WordMatrix or to the WordCombination database model
biggestFunctionName
checkQueue
Cron that runs every minute for executing queue items.
Regular items: It will execute max MAX_REGULAR_ITEMS_AMOUNT
Browser items: You can set the amount of tabs it should have as a limit, and it will keep the tabs open afterwards, but after the thing is done it will just remove the item from the Queue.
Heavy items: functions with isHeavytrue inside. Will execute max 1 every minute if the system isn't busy already.
- sort on priority high first
- filter out internet items if we are offline
- find single heavy item if it's there and if we're not busy
- find up to N (amount tabs available) queue items that require browser
cleanup
controlChatGptWrapper
deletePromptResult
developersQuote
diaryToInstagram
documentationWriting
emojiAugmentation
Emojify
explainInDutch
explainInNepali
explainInPortuguese
explainLineByLine
Explain line-by-line
explain
🤔 Explain
fixGrammarAndSpellingMistakes
followUpQuestions
getCategoriesTest
getContextualPromptCategories
Pretty cool stuff!
I've shown a way to count all nested categories and make a child object based on that
TODO:
- Currently, only supports unique category names due to not checking the full stack
- needs to be formalised, generalised
Another, possibly more direct way, would be to traverse the filesystem, in the case of fs-orm, because we have files for every item in json-single.
getContextualPromptResultJsonFilePath
Calculates path where the result json index is supposed to be
getContextualPrompt
getObjectForkKeyRecursively
getToolFunctions
Returns all tool functions to the frontend
gptIdeasRegisterWithContext
TODO: move to gptideas backend package
haiku
Write a Haiku
hookOneliners
improveCode
investorPitch
Investor pitch
marcusAurelius
MAX_REGULAR_ITEMS_AMOUNT
opposite
outlineToInvestorPitch
poem
Write a poem
processChatGptPrompt
processPromptOnFile
function processPromptOnFile to execute processChatGptPrompt
for a file, so we don't need to store the whole file content and it can be executed later and still have the most recent file contents
In order to keep the file itself as a source of truth for its content, it's useful to have this because you can add this to the queue
processPromptOnFolderWithContext
function that can execute processPromptOnFile for all files in a folder, by just upserting the executions to the queue.
quiz
Quiz
removeAllFake
rickAndMortyRick
Ricktalk
rickAndMorty
Rick teaches Morty
setIsFavoritePromptResult
shouldAddToQueue
Checks if system is busy and if so, adds the task to queue
socratesAndSnoopDogg
storytelling
Write a story about this code and what's happening in there
summarizeMeetings
Endpoint that onboards users
toolFunctionWithContext
Function to be executed straight from the frontend, where details is replaced with actual parameters of the function you want to execute.
functionContext and functionName to be stripped out of the form
translateEverythingIntoHindi
translateEverythingPortuguese
translateEverything
translateToPortuguese
Translate to Portuguese
typescriptExplain
williamShakespear
writeContextualPromptSdk
writeCreatePromptCode
ye
Let Kanye West write a poem about your selection
yodafy
Let Yoda say your selection in his words
fileTypePerExtension
languageModels
allOperationsRemoveJsSrc
BEWARE! This removes all .d.ts, .js, and .d.ts.map files in your source folder!
allOperationsToMarkdown
clearAllTsDatabases
codeAll
opens all files in vscode
[debug]
[folderName, basePath]
forAllFiles
executes a command or callback for every file
in commands, $LOCATION is provided as env variable, and command is executed in the dir of the file
forAllFolders
executes a command or callback in every folder of a certain type. Supports git repos and operations now
getAllOperationClassifications
gitShipAllRepos
gitShipAllPackages
Just ships code everywhere to github, wherever there's a git folder and there are changes.
mdAllOperations
minifyAllOperations
minify all operations everywhere. optionally:
- enable the shell
- specify a basepath (tools by default)
publishAllOperations
Script to publish all packages everywhere (that also runs prepublish). Only src in git, only build in npm.
removeAllFiles
removes all files that have an exact match of the location (folders not because we use rm without -rf)
removeAllFoldersCli
removeAllFolders
removeAll
removes all xyz for a folder
make sure to specify which type you want.... folder or file most likely
renameAll
renames all files to a new name (optionally a func, based on the old path)
runScriptEverywhere
runs a package script in all tools operations
NB: uses npm insead of yarn, but for scripts this shouldn't matter
[script, startIndex]
[search]
setScriptEverywhere
set package.json script to another value in all operations in tools folder
[type, command, fileName, basePath, folderName, shellString]
API_CUSTOM_URL_KEY
API_NO_RESPONSE_TIME_KEY
Should contain a string unix timestamp of the last time the API had no response.
apiWithConfig
This object contains a api function for every function in the backend
The difference from api 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
apiStoreInitialValues
apiConventions
API conventions:
xyzGetApi
is only available via GET, the rest is only available with POST.xyzWithContext
is taking FunctionContext as its first parameterxyzWithContextRaw
is taking FunctionContext as its first parameter, and is expected to return the raw return type the function returns.
contextFunctionConventionSuffix
getFunctionConventionSuffix
rawFunctionConventionSuffix
AppsMenu
argumentsWithoutFlags
askOk
getArgumentOrAsk
addToken
If previousToken is not present, will be generated randomly
ensureToken
Remove the token (if present), then add it again
findAssetParametersRecursively
Recursively finds all asset parameters in an object (for example in a database model item)
getConversionInfoFromType
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
getExtensionFromAsset
Returns a preliminary filename, based on the Asset
getNameFromRelativePath
getNameWithTokenFromRelativePath
first gets the name from the relativePath
then ensures the token is attached (if not already there)
getReferencedAssetApiUrl
getTypeFromUrlOrPath
We are assuming the asset name and extsion appear at the end of the URL
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!
compressAsset
Audio, image, video can be compressed. This should be done to logical defaults, can be turned off, or can be specifically set to other dimensions using a doc-comment on the model.
- audio: bitrate
- video: fps and resolution
- image: resolution
Returns the new absolute path of the compressed asset (which can be the same as the initial path)
deleteReferencedAsset
downloadRemoteAsset
Download a remote asset to the assets
folder (temporary location)
used for:
- giphy
- google images
- unsplashed
- p2p
- youtube to mp3 picker
- youtube to mp4 picker
- project assets (via api)
findAbsoluteAssetPathFromReference
findAllProjectMedia
Media:png, mp4, mp3, zip, pdf
- finds all media in all
db
folders. Can be anywhere, so an explore will probably be best. - finds all media in every operation in any folder except for
node_modules
,db
,src
,build
, [anything]. (so mostly intodo
,docs
andassets
) - find all media in every other folder that is not an operation
Return all of this as project relative path array
getAssetDirectlyGetApi
Useful for getting assets directly, for example for the SelectMedia
component for project
-media
Requires more access rights
Run server without too much queue execution
-
Launch telebit on server startup
-
Expose GET ASSET DIRECTLY, publicly, temporarily (but require a passcode in that case). Passcode should match one of the values in [filepath].public
-
convert the absolute path into a HTTPS URL that can be used as imageUrl (this should be a function where you can specify to use a general purpose passcode, or a OTP, or a unique passcode)
-
have a function to remove the passcode.
getReferencedAssetGetApi
Function to get a referenced asset that has been referenced from any db-model or any ts, tsx or md file, anywhere in the project.
Assets should only be exposed if you have access to the model they are referenced in or to the md file they are referenced in.
Exposes all assets like /asset?path=/text/interests/programming/storage-of-data/best-storage-methods.md&asset=./audio-is-amazing.m4a
Assets are only exposed if they are referenced in a markdown file that is accessible to the user. So when looking up the asset, make sure there's a link to it via []()
or ![]()
in the markdown that is connected to it in the URL. If not, don't expose it!
This can be used for any ui that has the functions backend available.
The advantage is that we don't need to build it, this works in dev mode. there is no asset duplication.
since the name is getReferencedAssetGetApi this should be exposed on getReferencedAsset
IMPLEMENTATION NOW:
-
check referencing file to find the reference.
-
for markdown, typescript:
](./xyz)
-
for json:
"relativePath": "./xyz"
-
If this occurs, calculate abosolute asset path from referencing file folder + relative path
-
If this asset exists, expose it.
getStorageLocationInfo
returns the type of file the asset is referenced from, and the baseFolderPath
where the asset
should be stored
getTemporaryAssetsFolderPath
mediaExtensions
processAsset
Processes an asset by moving the file in the right location, if needed...
- Alt is kept, nothing to do with it
- Giving a different name will change the new path
- relativePath is checked if it exists (if temporaryDestination is undefined). It is used to obtain the extension.
- temporaryDestination must be checked. if it exists, must replace the file on relativePath calculated from name
After processing, this function should return a BackendAsset without the non-storable parameters
BEWARE: absoluteReferencingFilePath
, and for db-models also modelName
, need to be given here! Otherwise this won't work!
processItemAssets
processes all assets in an item and returns the new item
removeOldTemporaryAssets
All temporary assets that were created more than 24 hours ago and are still there, will be removed by this function.
This allows us to easily delete assets without concequences and also if the user closes a form without submitting it, these assets uploaded will go away.
This function should be executed using a daily CRON
serverDownloadReply
Returns a server.reply.download
or server.reply.file
but also sets the Content-Disposition
header correctly and the Content-Type
For this I finally ended up using builtin server.js stuff, we don't need to set those manually...
See https://serverjs.io/documentation/reply/#file- And https://serverjs.io/documentation/reply/#download-
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
NB: ensure to return the result of this function in your endpoint, otherwise it won't work
uploadAssetWithContext
Uploads an asset to the server, and puts it in a temporary location in the assets folder of function-server. It returns the filename of the file in the temporary location.
It can only be accessed through that random name. This random name has 32 characters so cannot be easily guessed. This should be secure enough. The file should be moved to the final destination in the actual function that needs the file.
NB: this function only works by providing a file as blobs under the "file" property name!
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
getSrc
InteractiveAsset
shows an Asset 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
itemGetBackendAssetUrl
Get remote url for a BackendAsset in an AugmentedAnyModelType
database model item.
If you provide an array it'll take the first asset.
ModelItemAssetView
useAssetInfo
useAsset
cache
getAugmentedWordObject
getAugmentedWords
Gets all augmented words of the entire project
- functions, interfaces, variables, operations (
/[operation-path]#name
) - if this is an OS-project, also bundles (
/[docs-path]
)
getBundleAugmentedWords
NB: should only be executed if this is not a sensible-project, as it might not have BundleConfig otherwise
AuthenticationMethodsCrud
LoginForm
LoginWrapper
ensures the auth-token is set
MeAuthenticationInfo
little component for in banner that shows your info on top, and links to signup/login etc
PersonProfileDetailsForm
PictureWithInfoDropdown
Dumb (presentational) component for a picture with info and a dropdown
PublicPersonComponent
PublicProfile
SignupForm
UpdateMeForm
BigButton
BreadCrumbs
Shows where we are in the filesystem
renderBreadCrumbs
getBundleSummary
Summarizes a bundle config so it can be used easily in things like explore project
getDbModelsForBundle
Gets all TsInterface's that are used in a bundle according to a BundleConfig
chatGPTAuth
detectChatGptPage
openAIChat
Send the propt to chatgpt and return the chatgpt response
execAsync
promises to exec something with response and success as result (Promised)
spawnAsync
i don't know if this is ever useful...
cleanupTsDatabase
From all Ts Index Models, removes the instances that refer to a ts file that doesn't exist anymore in the operation.
shouldDeleteTsModel
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
datasetConfigKeys
datasetFilterOperatorConst
NB: keys are made humanCase
and used in UI, so keep a readable name
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
modelViews
operationClassificationConst
runEveryPeriodReadonlyArray
runEveryPeriodStringArray
typescriptIndexModels
stripCommentEnd
only strip slahes for single-line comments
stripCommentStart
stripComment
parses comments (single line, multiline and doc) and removes the comment syntax
- removes slashes
- removes multiline comment prefix
- removes multiline comment suffix
- removes doccomment stars
example input: // comment
, output: comment
example input:
some
multiline
comment *~/
output:
some
multiline
comment
stripSlashes
stripStar
trimSurroundingNewlines
removes new lines at beginning and end
NB: This function uses a small recursion! I don't know if this is very efficient, but shouldn't be too deep!
NB: it should be noted that a newline apparently seems to be counting as a single character! Strange.
trim
getCompileErrors
gets compileErrors of an operation. if it has no errors, it also check all dependants to see if they have errors, possibly because we changed this one
- get buildErrors for all src files of current operation
- if build doesn't succeed, only check for build errors in current operation
- if build succeeds, check iffor build errors in all files in all operations that depend on this one. this means we need compile to be ran for every operation
TODO: Later, only check all build errors of all dependants if and only if an export blueprint (io) has changed and if this export was imported there
[ operationBasePath, operationManualProjectRoot, typerepoManualProjectRoot, ]
writeBuildErrors
ContextMenuItemComponent
useContextMenu
Use this if you want to render a context menu where the menu closes if you click one of the items.
Optionally, you can create a custom renderer for it.
id can be provided by the contextEvent.
useContextPopper
Use this hook if you want to create your own custom render that opens on the right location once the onContextMenu is fired.
useContext
Use this if you want to create a completely custom behavior from a context action. On top of the default onContextMenu behavior, this hook enables the possibility for a custom hold duration on mobile.
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
errorToast
infoToast
showStandardResponse
Useful to show if the api has a standard response
successToast
warningToast
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
, OperationConfig
, PackageJson
, TsConfig
testPerformance
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
CrudGrid
CrudTable
CrudTimeline
CrudTree
DatasetForm
dbCrudInitialValues
DbPage
defaultLimit
{ deleteDbModel }
{ getDbModel }
getPropertiesDataParameterNames
IndexInstanceContainer
container for any index instance that needs to be rendered in the explore page
{ isBetaEnabled }
ModelComponent
In the table headings, all xxxSlug, xxxId etc should be called xxx.
In the table values, all slugs and ids should show the name of the instance of the refered model.
It has to be possible to navigate to an id or slug using #[id] or #[slug]
in the URL, just add div ids to all rows
openWhatsapp
shimmer
SimplifiedSchemaFormDebug
sortToItem
SpaceCard
toBase64
{ upsertDbModel }
UpsertForm
TODO: Provide all the fetched data with hasMore
and fetchAll
to the SimplifiedJsonForm
UpsertPage
useInfiniteGetDbModel
useModelFromUrl
takes the model from the url
useUrl
cacheLookup
Wrapper function to cache any function and invalidate it, in some way
caching automatic cache invalidation if data sources are updated optimistic caching after cache invalidation
calculateOperatingSystemBundle
This function should calculate a giant bundle for the whole operating system. This should include everything, public.
Used to show the whole os as a bundle.
deleteDbModel
deletes an instance of an db data interface from the db in a typesafe way
functions
getCachedFunctions
TODO: it would probably be good to create a more general purpose caching function
getDatabaseMenu
Finds all relevant Db models to show in the menu
- for a bundleId, it gets all models from the bundleSummary
- for a bundled project (bundled) gets all models from the packages
- for the main project, gets all models from sdk-db directly
TODO: NB: the first and the second are not the same, so this needs to be cleaned up.
getDbModelMetadata
getDbModelNames
getDbModel
gets all instances of an db data interface from the db in a typesafe way
getFunctionIndex
finds function indexation from database
TODO: this should be used!
getNestedDatabaseMenu
TODO: support search for bundles (but this can be augmented word based)
getReferencableModelData
Get referencableModelData for a single DbModel.
NB: this does not get the items that can be referenced in that model!
For getting all required ReferencableModelData
for the prop in SimplifiedSchemaForm, use useGetReferencableModelData
.
hasDbRecipes
Simple function to test whether or not the DbRecipes endpoints are available. If it returns true through the api, the other ones are also available.
makeSrcRelativeFolder
gets a src relative folder path (so maybe "" for a file src/util.ts
or "util" for a file src/util/thing.ts
)
testFnWrapped
testFn
tsInterfaceToDbMenu
upsertDbModel
upserts an instance of an db data interface from the db in a typesafe way
validateInput
wrapper function that takes that data but also the interface of the function and validates the parameters before it executes the function.
validateResult
wrapper function that takes that data but also the interface of the function and validates the parameters before it executes the function.
wrapFunction
filterInterfacesFromOperationNames
getDbModelsFromOperations
availableExtensions
docsGetPages
getMarkdownReaderPages
Gets all markdownreader pages for multiple basePaths. Can add a prefix, can also remove the last folder of basePath from the suffix.
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!
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
comparePassword
Method to check if a raw password should be the same as the encrypted variant. Uses bcrypt
encryptPassword
Method to encrypt any password. Uses bcrypt
exploreOperation
for every package.json it finds, it explores the root, src, and docs.
- in src, index is ignored
- in docs, only md is found
- in the root, only md is found
- for every file in src, it shows and finds all functions, interfaces and variables, through the indexation from it
exploreProject
TODO: still needs to be cleaned up. It's a huge function now with many useful components. Split it up!
- explores all files and folders until it finds a package.json.
all items in the explore tree are clickable in the ui, and lead to different pages
- a folder leads to a summary of what the folder holds
- a operation leads to a summary of the operation
- a ts file leads to all functions, variables, and interfaces in that file
- a function, variable, or interface leads to specific pages for those things. the data, if available, is attached to the interfaces.
- a md file leads to the editing user interface (with context) of that file
- a json file leads to a CRUD for it...
In the end the data it generates should stay up to date, so it's important this exploration happens fast enough. The data involved is simply walking the filesystem once (a small subset of it) and opening some index files (fun)
LATER: some more things that would be useful:
- watching all files that are also explored for changes using some watcher
- if something changes, recalculating that part and pushing it to the UI, making the thing going over the line small so it'll be super fast, even over slow internet.
however, this is premature optimisation. on my m1, locally, it's probably fine to just recalculate every second ^^ and send a couple megabytes over the line.
getExplorationType
gets the exploration type from an absolute type
getFileWithExtension
getFolderExplorationDetails
getFrontmattersMappedObject
getInstanceNames
returns the paths of instances in a file, like functions, variables or interfaces
getProjectRelativePaths
get file paths within your project
getTodoPages
getTodoPages(): WebPage[]
function:
- use getProjectRelativePaths, map the result to a queryPath + file
- [operation-name]/[todo-relative-file-id] for operations
- [folder-name]/[todo-relative-file-id] for todos within folders
getTodoPaths
hasSameProjectPath
function that returns a filter function that can check if some object (that extends an TsIndexModelType) has the same relative file path from the project root
FancyLoader
[absolutePath]
compressConvert
Super useful wrapper around ffmpeg to do just all the stuff I want to do with it
TODO: fix fps, not implemented yet
compressImages
searches the folder recursively for all images and converts them to webp
compressMp4
Compress mp4 to very small
compressMp4sCli
compressMp4s
CLI syntax:
compressMp4s [basePath]
can also be relative path
convertToMp3
Uses ffmpeg to convert a file to mp3
Returns the new file path on success
convertToMp4
Uses ffmpeg to convert a file to mp3
Returns the new file path on success
fileExplorerOpen
getFileType
typeIcons
MatchingText
Component that highlights the matching text
PathSearchResults
fileTabsInitialValues
FileTabs
getActivePage
getOpenPageUrl
gets the url of the open page
- paths is a special query key that is expanded as path, not as query
- index page should be on /
renderIcon
useStore
NB: this is a useStore without a StoreProvider
, because I think I won't ever need the provider since I won't ever need this as the sole storage in any component/app. If I do, I should make a provider, but it's usually better to create the useStore and StoreProvider
in the component itself because it often comprises more than just this one.
OpenFileWriterPages
{ saveFileContents }
useFileWriter
Returns a filewriter for a project relative filePath with a function to save it
{ useGetFileContents }
{ useStore, StoreProvider }
WriterLayout
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
getFileTypeFromPath
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
movedFileSubextension
subextension indicating that a file has been moved to another location
For example, used in watchAppleMemos
operationUnindexableNamesOrSubExtensions
projectRelativeGeneratedOperationsFolder
sourceFolderName
temporaryConvertedSubextension
This is a temporary file for conversion with ffmpeg (see ffmpeg-util)
typescriptExtensionsConst
typescriptExtensions
findAllDependencyOperations
to be used when you need to know all dependencies for multiple operation names at once
TODO: NB: this breaks with circular dependencies
findDependantsRecursivelyTest
findDependantsRecursively
findDependants({
operationName: "js-util",
importName: "notEmpty",
returnOperationName: false,
}).then(console.log);
findDependants
finds all dependants of an operation or a specific import from that operation
normally returns the files where the operation or function is used, unless you specify to return the operationNames only.
findDependenciesRecursively
finds all dependencies of an operation name
findMonorepoExports
findMonorepoImports
finds all unique imports in an operation name
findMonorepoModules
finds all dependencies of an operation name
getDependencyObject
findAllDependencyOperations(["fs-orm"]).then(console.log);
how do I get a format like this?
const x = {
"fs-orm": ["js-util"],
"js-util": [],
}
getDependencyTree
getOldDependencyTree
getOperationDependencyReasons
[operationName]
test2
folderGetUpdatedAt
get last updated file updatedAt time in whole folder, recursively. only finds typescript files, ignores index.
frontmatterParseToString
Parses frontmatter object into a frontmatter string
frontmatterToObject
getFrontmatterValueString
markdownModelTypeToMarkdownString
objectToFrontmatter
parseFrontmatterString
Parse a string as stored in frontmatter back to the original string
quotedOrNot
For now, simply quote a string if it contains commas
There are probably more edgecases that need to be fixed here
stringifyNewlines
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 multiple file
alterJsonSingle
Alters a json single file
alterKeyValueMarkdown
alterMarkdown
Alters a markdown file
augmentItemWithReferencedDataRecursively
calculateOperationsObject
relative
Needed in case of manual project root, otherwise use SDK!
Returns project relative operation base paths
categoryStack
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 categoryStack
onto this if the dbStorageMethod
is markdown 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 will look in:
db/
in your project rootdb/
in any operation
In these folders, fs-orm 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, 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
NB: returns 3 things:
- false: no operation path
- undefined: operation path undefined
- path: the specific operation path
getParentSlug
get a parent slug without the parent_xxxSlug reference (uses the categoryStack)
can be undefined if the item has no parent
getRootFolders
Gets all root folders where db folders can be located inside of
NB: Before november '22, this function is quite slow if it needs to find all operation folders becuase this takes at least 60ms.
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 and upsert. Groups creation items into an object where keys are file paths and values are items that need to be stored
makeStoringItem
Three things need to happen in order to store an item
- keys that can be inferred from the file path are omitted
- referenced data is omitted
- calculated data is omitted
maxConcurrency
Crashes for upsert at 1024 on m2. It would be good to find a way to ensure we never crash here, or at least report where the out of memory bug came from.
maxQueryTimeSeconds
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 categoryStack must be existing in the markdownfile.
- you cannot insert a header, always insert an item with
isHeaderCalculated:false
waitForLockfile
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
findFileNameCaseInsensitive
returns a path of a fileName
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
getFolderSizeObject
returns an object with all sizes of all folders and files, recursively
getFolderSize
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
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
becomeshello-world1
hello36
becomeshello37
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
updateSingleNestedJsonFile
Uses mergeNestedObject on a JSON file
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)
getFileOrFolderName
getFolderJs
getSubExtension
Provide a filename including its extension, to get the subextension.
isPathRelative
join
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
removeTrailingSlash
withoutExtension
removes extension from the filename
withoutSubExtensions
Removes all subextensions from the filename (if any) including main extension.
Only returns everything before the first dot (.)
FunctionForm
FunctionForm is a very easy way to create a frontend component that is connected with an api that is connected with a function on your backend (that can do anything)
All you need to provide is a TsFunction
This component only works if your api is up-to-date and your function is succesfully indexed using typerepo
. For authentication, the api convention is used. See the api docs.
@see TsFunction
getFunctionExecutions
getFunctionQueryPaths
Calculate all required query paths for the function UI menu...
- bundles + main project as root folders (
["main project", ...bundleNames]
) - per folder all operations it contains, nested, in the project relative folder where it should be ending up
- per operation all functions it contains, nested, relative to the src folder. not file, only folders should become menu
Example:
- main
- modules
- packages
- db-ui
- components
<IndexInstanceContainer>
<Layout>
<UpsertForm>
- hooks
useGetDbModelQuery
useReferencableModelDataQuery
- pages
- Page
- Page
- Page
- getPageTitle
- generated
- himalayajeep-functions
- apps
- bundle A
- bundle B
NB: if possible, rename the menu items if the items in a folder are not unique (use file-name to replace item name if this happens)
getPublicBundleConfig
getSrcRelativeFolderPath
getTsFunction
Uses the sdk-function-paths
sdk to the indexation of any function in the project.
calculateDeviceName
executeFunctionWithParameters
steps for someone to use the API
- auth
- cache lookup
- input validation
- running function
- store cache
- store performance
- returning result
TODO: make it possible to return result BEFORE storing cache and performance. we probably need to use the server.reply for this, which makes this function unusable in any other setting than an api, so let's make it optional
functionGetEndpoints
routes to post and execute operation functions
functionPostEndpoints
routes to post and execute operation functions
getAuthorizationInfo
returns AuthorizationInfo
for a device + function
isGetEndpoint
privateAuthToken
savePageVisit
storeFunctionExecution
wrapper function that stores execution-speed in an object with FunctionPerformance
data-structure. Store this using db.push
if it adds value
.
upsertDevice
Returns device with all attached (logged in) Persons, and currentPersonCalculated
Either finds the device and updates it according to the new request metadata, or creates a new device.
Should never return undefined
if the database functions...
TODO: Use cookies (https://serverjs.io/documentation/reply/#cookie-) to login
Needed for having authToken
with GET as well in a safe manner (e.g. for images)
chat
converse
this is the yo
cli. takes a message
doCli
executeSdkFunction
exportsArray
getCachedExportedFunctions
getMenu
getParametersAndExecute
getParameters
getSdkFunctionPaths
listen
generates structured operations based on unstructured instructions
This is huge. we need to start somewhere though. Plan:
- all operations can be formatted as a word[] with specified order
- all words can have synonyms
- some operations can have aliases or different word orders that would mean the exact same
- speech to text is a prerequisite for speaking out instructions
- text to speech is already there
With this in place, we can define a structured way to do things.
- find the right operation to apply
- every parameter needs to be filled in (or use default) or we need to use a preset (from previous input logs). this can be some sort of conversation
- the opo (operation output) can be added to context, if needed
- the opi (operation input) can be added to presets, if needed
Can you imagine that? I am creating a script that runs all the time and listens and responds to anything I say. My own Siri, but much more powerful. It seems hard, but if you look at it, it's actually just a different UI for all the things I already have. Among other things, it will make it possible to work while doing anything.
The power lies in being able to recursively ask for all the parameters. if you provide a new operation instead of a value, it will ask for all its parameters in order to continue.
This conversation could actually be used to generate code! It's kind of context.reverse().map(createTsLine);
In fact, if we can make that, we can maybe even reverse code into conversations as well! This is insanely powerful.
message
wordArray
generateNamedIndex
Generates an index.ts file based on named statements in the operation. Also generates test array. Not used currently.
NB: This overwrites the indexfile of the operation in the src folder! Make sure you don't have anything there still.. All functions should be in other filenames.
Should be ran every time an operation changes
generateSimpleIndex
generates operation index and writes it to index.ts in src of the operation.
NB: This overwrites the indexfile of the operation in the src folder! Make sure you don't have anything there still.. All functions should be in other filenames.
Should be ran every time an operation changes
isTestFn
mapToImportStatement
generateDbSdkCli
generateDbSdk
generateEnvSdksCli
generateEnvSdks
generates sdk-env-public and sdk-env-private
returns the paths of the geneated operations
generateFunctionPathsSdk
generateFunctionSdksCli
generateFunctionSdks
Creates
- sdk-api + sdk-api-keys (for all exposed functions)
- sdk-js (functions that can be executed anywhere)
- sdk-ui (functions that use JSX)
Overwrites them if they already exist with minimal interruption time of the system
generateInterfacePathsSdkCli
generateInterfacePathsSdk
sdk-function-paths
indexes all operations and builds an object containing all operations.
generateOperationsSdkCli
generateOperationsSdk
sdk-operations indexes all operations and builds an object containing all operations.
generateSdkApiCli
generateSdkApiWatcher
generateSdkApi
generateSdkOperationsCli
generateSdkOperations
(re)generates all sdk operations for any project
getFunctionSdksContent
getSdkDescription
Gets a description of any sdk operation from the assets
getSdkFunctionsPerClassification
returns all sdk functions grouped by operation classification
isNonUiOperationBuild
isRegenerating
newEnvSdk
As a full stack app we need a good solution for environment variables that need to be accessible anywhere and can be customized, some gitignore'd, some not. Some public, some only in the backend.
conifg:
- public (local, remote) = sdk-env-public
- private (local, remote) = sdk-env-private
This information will be fetched from the bundleconfig
newFunctionKeysSdkOperation
newFunctionSdkOperation
Uses an array of functions to create an operation that imports all those functions and exports an object where all those functions have been comprised
tsFunctionIsIndexable
The path of the function should be indexed by generateSimpleIndex, otherwise we can't import it either!
tsFunctionIsSdkable
updateClassifications
augmentMarkdown
Now that I've written this all down, it seems to be a quite an expensive operation, but we never need to do it for ensire websites, just for one page, and the result can easily be cached. I need to write a regex function that matches all text from a list of searchterms in markdown except if it's part of a link or image, and reduce the matches, creating a new markdown string every time. I think there are algorithms though that are more efficient because if there are like thousands of matches on a 2mb text, the thing would take much longer. Maybe it's more efficient to split up the text in smaller pieces and do the regex for every piece individually. This would have a limitation that you can't select cross-section, but I don't think that's my usecase anyway. If we later add support for making statements about a chapter or subsection and stuff like that, this limitation can also be resolved.
Augments markdown in many ways for multiple purposes.
- Parse the markdown instead of showing the results as React buttons. The link to "#" alt can become the same as a nice AugmentedWord hover, when it's found to be a selection result, we can highlight the selection whenever we hover over a link with that same text as alt as well, and add that hover as a note at the end of the selection.
- ensure the parse parses WordCombination, WordMatrix, Statement, AugmentedWord, and ContextualPromptResult. It's a lot of work, but definitely worth it. Should be parsed as
- remove the parsing of everything in the markdown render. This is also the end of sending AugmentedWords to the frontend
LATER:
- CTA's, headers, footers, ads (check how I was planning to get those at codestorys-node or so)
- Word frequency occurency styling
- Subtexts and subwords
canSeeFileContent
canSeeFile
TODO: use something like this to ensure we have the type safety and not work with strings >.<
import { frontmatterToObject } from "frontmatter-util";
import webMarkdownFileTsInterface from "markdown-types/db/ts-interfaces/webmarkdownfile.json";
expandFrontmatter
findClosestAbsolutePath
getContextualPromptResults
Gets all contextualPromptResults, but only if specific things are true
- For any prompt we have for this filetype: get it from the database
- For prompts about a folder: path/to/folder/.index/prompt-results.json
- For prompts about a file or a selection thereof: path/to/folder/.index/[filename]/prompt-results.json
NB: the slug of the ones in index should be the ID, and does not need to be set by the user, because we cannot guarantee that it's no duplicate.
getContextualPromptsArray
Wrapper around the database to support the usecase of storing a file in a custom location for contextualPrompts.
getContextualPrompts
Returns all contextual prompts for the selection and for the page with the right context type
getFirstFile
Gets the first file in a directory:
Either readme or index, or the first file it finds.
getFolderRelativeScopeDbFilePath
Function to centralise the convention of the db file location of a scoped prompt
getReaderPageProps
NB: this thing doesn't know about the basepath, it allows any path in the project.
Idea: would it be easy to allow for path outside of project as well?
makeMarkdownLink
function that writes markdown for a text + url + alt. This may differ per platform in the end, for now I'll use my own: ["text"(alt)](url)
readerPageGetStaticPaths
NB: I can't do this with a fallback , because next.js doesn't include my docs folder into the bundle.
A solution could be to add the docs folder into the next.js folder or copy it...
https://github.com/vercel/next.js/discussions/32236?sort=new#discussioncomment-3029649
Ther are other workarounds here to make sure it ends up in the bundle.
readerPageGetStaticProps
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.
FileActions
generativeWebInitialValues
Menu
"wise"
component that lets you render a menu easily, including search
TODO:
- provide menu with NestedWebPage
[]
NavButton
PromptButton
ReaderPageNext
ReaderPage to export for next project. Uses either the props from the next server, or if they're available, the props from the query.
ReaderPage
SelectionPrompts
setConfig
SettingsPage
useAdmin
Useful hook to make a static site dynamic for administrator
useFileActions
useQueryPath
Returns the queryPath of your URL without everything after ? and #
useVariantResult
VariantSelector
getAllOperationSourcePaths
returns src folder paths of all operations
getImportedDependencies
DEPRECATED: should use generated index files with imports instead!
gets all imported packages (dependencies) in a project doesn't take into account the fact that someone can set up a rule for absolute imports within the package. this assumes that any absolute package comes from node_modules.
getPackage
only the first part
isAbsoluteImport
calculatePackageJsonDependencies
Calculates new packageJson dependencies object based on imports found in the whole operation.
For monorepo modules, uses the version inside its packagejson (Uses the database to obtain the package.json)
Generated packages are not added to dependencies. Instead a config is added saying this operation only works within a monorepo since it has generated operation deps that are not on the npm registry
For external modules, uses the version that was already present in dependencies, or uses "*"
Also keeps the dependencies that were already there, nothing is removed.
CONCURRENTLY_INDEXED_FILES_AMOUNT
findAndWriteImportsExports
takes an operation base path and finds all imports and exports in all the files, and writes it to the ts-imports/ts-exports indexes
NB: has a side effect: it also updates the package.json to include all needed dependencies.
getDefaultSymbolType
gets type of a symbol and if the type has a generic, without recursing.
getExportSpecifierNames
getExportSymbolTypeRecursive
gets type of exportSymbols. recurses if it's an exportsymbol
TODO: NB: exports that come from a destructured initialiser aren't found! fix it
getImportSpecifiersWithNames
get the ImportSpecifier(s) of with a certain name.
getImportsExportsTest
getImportsExports
Uses ts-morph to get all exports inside all files in a project or an array of source files. Doesn't use index, it actually looks in all files except index, so some of them may not be exported from the package itself depending on your indexing strategy!
NB: uses a lot of memory!
#performance
getPackageNameFromAbsoluteImport
parses the absolute import name into the actual package name
- removes internal navigation in the package (everything after the package name)
- assumes packages don't have slashes in their names, execpt that it takes into account scoped packages (e.g.
@company/package
) - removes things that come before any column (
:
) e.g.node:fs
becomes fs
getSymbolDeclarationsOfKind
getSymbolTypeDeclarations
getTypeFromImportSpecifierRecursive
Recursive function that gets the type specifier from an import specifier
isAbsoluteImportBuiltin
returns true if the absolute import is built in into node
isImportFromOptionalFile
returns true if the import was found in an optional file, e.g. this import is not always included in the bundle, so should not be a dependency
isImportGenerated
[operationBasePath, manualProjectRoot]
writeResult
getOperationBins
returns array of bins. by convention, these bins should also be exported from operation index file
getOperationPackageName
getPackageJson
getPackageSourcePaths
Returns an array of absolute file paths of (typescript) files in the src of your operation
TODO: we need a way to explore these glob patterns inside of tsConfig.include. until then, just assume we use "src" as the only folder
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
getOperationClassificationObject
getOperationClassification
Returns OperationClassification if it's an operation, or undefined if it's not
NB: don't confuse this with 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
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 bundled 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
getSubExtensions
hasDependency
hasProjectRootFile
isBundle
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
isUiOperation
isWorkspaceRoot
simple sync function to check if a folder is the root of a workspace (not operation but a workspace)
osRootFoldersConst
can only be accessed in the OS
osRootFolders
packageCompilesTs
projectRootFoldersConst
can be accessed in projects as well as in the OS
projectRootFolders
tsconfigCompilesEsm
getTsConfig
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
ajvMap
cli
definitions
findAndUpsertTsInterfaces
findCommentTypes
returns all types that are found as start of a line in the comment (capitalised, with a ":" behind)
generateSchema
If existing schema is not stale, just require it. Otherwise, generate it for a file
NB: The createGenerator
function finds also imported TsInterfaces, which leads to duplicate TsInterfaces. With pushing the interfaces to the slug filename, this is no problem though, there should not be any duplication!
getAllComments
gets all leading comments and trailing comments raw text, put together, separated with newlines
getDbStorageMethod
Gets db storage method for indexation
- Frontmatter overrules everything
- Special extensions are looked at
getFrontmatterDbStorageMethod
if isDbModel is specifically set to false, this will return null (which means this should overwrite other things)
getFrontmatterFunctionParameters
getIndexId
getMaxIndentationDepth
gets the maximum indentation depth of any piece of code
does this simply by splitting up the piece of code into lines and checking the indentation of every line, finding the highest one.
assumes an indentation contains 2 spaces.
getMinMaxValidation
getNumberOfLines
getObjectSchema
getParamSchema
getParametersFromInterfaces
getPossibleRefs
getSizeSummary
gets a size summary for a file path
Does not calculate this for files that are too big (bigger than 1MB)
getSpecialExtensionDbStorageMethod
returns undefined if there is not a special extension. if there is, it returns the dbStorageMethod
getTsStatements
Gets functions and variables from a tsmorph sourcefile
getTypeInfo
takes a ts morph type and returns all info about it
if available, a schema should be provided about the type because it's hard to infer it (probably buggy)
getValidatedOperationPathParse
hasTypescriptFileChanged
indexImportsExportsForFilePath
indexTypescriptFilePath
Index a single typescript file
indexTypescriptFile
indexTypescript
Creates a typescript file index in 3 steps
- Introspects the file
- Calculates all needed information about it
- Saves the result to /db/******.json in the operation root
NB: Build errors are done separately as this is done operation-wide, everything else is done for each file
NB: I don't think this is super efficient, because the project is taken to just index a single file. It's probably better to pass the project and the sourcefile in here, right?
TODO: if a typescript file starst with a comment before any statements (but possibly after the #!/usr/bin/env xyz
statement), this should be indexed as the main file comment... This can be shown when opening the file in the admin... It should also check if there is an associated md file for that in src, so that can also be added in the index.
isPrimitive
export const getDefinitions = () => definitions;
export const getClass = (name) => allClasses[name];
makeTsComment
this is actually a fundamental part of the OS. How should comments be structured?
I think, in general, that we should make it look as much as possible at markdown, because it should always be able to have markdown anyway.
removeTypescriptIndex
schemaToTsInterface
make a tsInterface from a schema generated from the file
symbols
toSnack
tryCreateSchema
Try because sometimes generateSchema fails
typeToSchema
calculates the schema of a type
this is great for types inside of parameters of variables that are not declared separately, however, it's probably not as good as vega's json schema generator... therefore, it would be great to always prefer vega's way above this.
NB: this method throws sometimes if it can't find some stuff, so make sure to try/catch it.
TODO: Test and improve this one
fetchWithTimeout
isOnline
Fetches google.com to check if we have an internet connection
isSystemBusy
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
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. MappedObject
s 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!
destructureOptionalObject
Easy way to destructure your object even if it may be undefined
or null
.
Have you ever had a function with an optional configuration parameter, but you want to access all its properties? It's a hassle. This function lets you turn doSomething
into doSomethingBetter
. Check the code.
const doSomething = (config?: { a: string; b: boolean; c: number }) => {
const a = config?.a;
const b = config?.b;
const c = config?.c;
return "something" + a + b + c;
};
const doSomethingBetter = (config?: { a: string; b: boolean; c: number }) => {
const { a, b, c } = destructureOptionalObject(config);
return "something" + a + b + c;
};
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"}]}
hasAllLetters
all letters of b can be found in a, in order (but other letters in between are allowed)
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
isArrayEqual
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
mergeNestedObjectTest
mergeNestedObject
type X = IsOptional<string|undefined>;
Merges an object into an object, ensuring typesafety. The second object needs to be a recursive subset of the first.
LIMITATION: When you set a value to undefined, ensure that it is allowed by the original object, we are not checking for this!
TODO: is it possible to remove this type unsafety? It would be nice to only be able to set it to undefined if that is allowed by T. Not sure if it's possible to check the difference bewteen a key not being present and a key being present and the value being undefined... Look it up!
Example:
const testObject: {
a: string;
b: number;
c: { x: string; y: number; z: { a: string; b: number; c: { x: "wow" } } };
} = {
a: "lol",
b: 8,
c: { x: "lol", y: 88, z: { a: "wow", b: 888, c: { x: "wow" } } },
};
const result = mergeNestedObject(testObject, {
c: { z: { c: { x: undefined }, b: 999 } },
});
console.dir({ testObject, result }, { depth: 10 });
result will be: { a: 'lol', b: 8, c: { x: 'lol', y: 88, z: { a: 'wow', b: 999, c: { x: undefined } } }
}
It's great, because you can't make any type mistakes, and your code becomes much shorter for altering an object
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
mergeObjectsArray
TODO: find a way to return the correct type interface
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
onlyDuplicates
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
pickRandomArrayItem
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
removeOptionalKeysFromObjectStrings
removeOptionalKeysFromObject
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
NB: Tried, but doesn't work, probably because it only invalidates cache for one file, not all the files that are required by that file... we need a separate process
const requireWithoutCache = (filePath: string) => {
delete require.cache[path.resolve(filePath)];
return require(filePath);
};
example function that can be tested
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
getSimpleJsonString
stringifies simple json things if the json is one of them, otherwise returns undefined
devCli
The dev-cli runs the dev command which watches your operations with restarts
You can specify a customManualProjectRoot, which can be a relative or absolute path. If relative, it will use your cwd with the relative path to make an absolute path, that will in turn be passed to the dev function.
dev
Running this function will start a watcher that watches all your operations for changes and rebuilds the operation on every change (compiling and indexing the altered file(s))
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
findAllDocsFolderPaths
Returns absolute paths for all docs folders (not the files inside)
findAllDotGitFolders
findAllFoldersWithName
findAllPackages
findAllTodoFolderPaths
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...
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
getFolderTypescriptFiles
getOutline
low-level function that gets the outline for MarkdownParse
NB: with books usually the pages are referred in the outline. Since that depends on the font size and dimensions, this cannot be done straight from the markdown parse. Eventually we probably need to check the made pdf for its content, maybe there is even a pdf feature that creates an outline for you. There must be more people having this problem.
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
[operationName, manualProjectRoot]
runTestsForOperation
runTestsForOperation(operationName) runs all tests that can be found in an operation. nicely logs and returns which funtions are working or not and why
this assumes the index file exports all tests under the test
constant, which should be done using this framework
this also assumes your tests are exported from build/index.js (which means you need to build your code, not transpile, so it's not possible for every type of operation)
runTests
run tests and log the results.
input: Test
output: isAllValid (boolean)
exampleKeyValueMarkdownParse
exampleKvMdString
exampleLine
flattenMarkdownChunks
Flatten markdown content into an array of paragraphs
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
AuthenticationLayout
Layout that includes default pages and header for authentication
Header
LayoutGrid
Style for creating a grid for the layout that is mobile friendly and has menu support
I run into this problem all the time
https://stackoverflow.com/questions/71616561/css-tailwind-grid-height-100vh-not-working
final solution came from here
Unfortunately, I can't seem to hide stuff anymore for some reason on non-mobile. "lg:flex hidden" just doesn't work, just hides!
My elegant solution was to just use visible/invisible and make the mobile layout hover over the invisible one in case of a small screen, it works!
PingApi
timeBeforeNotOffline
preIndexLint
Should be a collection of small functions that check if all conventions are used and if there isn't used anything that should NOT be used. this can later become a linter. make sure to research how eslint works first
Plan:
- just use my own sdk's as much as possible to provide some handy convention checks in a package
- later integrate this into vscode, i'm sure this is how it's done
this lint can be done before indexation
maximumLockTime
isLocked
lock
either creates the lockfile if it didn't exist or it will update it with new updatedAt and status. If status isn't set, status will be removed
unlock
NB: don't provide the path to the lockfile but the path to the file that the lock should be removed from
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
sendMail
Sends email(s) using sendgrid
Ensure your OS config is there
makeFileType
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 asset
getUrlFromRelativeUrl
gets the renderable asset url from the relative url
getYoutubeId
HtmlHeader
MarkdownCodeblock
MarkdownContentRender
MarkdownContent
Parameter
In markdown, if you wish to refer to a parameter, you can backtick it and put a "." in front. You can also add a value to it if you wish, by adding the ":" and the value afterwards.
renderFrontmatter
Renders markdown frontmatter parameters (and optionally a spacer)
renderMarkdownChunk
renders a MarkdownChunk interface
renderMarkdownContent
Renders a markdown string (without frontmatter)
TODO:
- Show selection prompt-results In renderMarkdownContent, augment the alineas with the ContextualPromptResult. Would be great to see the results when hovering over the selected thing, or maybe showing it with a button, or inline, even.
renderMarkdownParse
renders the MardkownParse interface (including frontmatter)
renderMarkdownTitle
renders a markdown title (level should be 1 for h1 and 6 for h6)
useOpenHashDetails
chunkToStringRecursively
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
markdownParseToMarkdownStringFromContent
markdownParseToMarkdownString
NB: this just uses RAW!
Use markdownParseToMarkdownStringFromContent
for the real deal
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
addDependantCount
Double arrow function to get the count for the item
bundleFolderWithMarkdown
Finds all md files in a folder and creates a single MarkdownParse
handy for creating a single documentation file or other things that have to include multiple markdown files in a structured way
NB: it recursively structures the files and folders with headings
bundleToBookMarkdown
Input: BundleConfig (one or more folder(s), readme, operations with a docs folder)
Output should be all md files concatenated in the right order with the right titles
bundleToMarkdown
creates a summary for a whole bundle
NB: Related to bundleToBookMd
concatMarkdownFiles
createMinimizedSectionMarkdown
createMinimizedSection
deployToVercel
NB: Obviously, this is not the right place for this function, but none of these functions are properly located yet...
should deploy any bundle or next project folder project to Vercel by first creating and pushing it into git, and then creating it in vercel through their api
should return an url where the project will be served and the estimated time when it will be live
emailMarkdownParse
should email a markdown parse to some email (or multiple)
flattenNestedObject
Flattens a nested object by returning an object that hasa the nested path as the key and the leaf as the value
TODO: Finish, if needed. seems hard!
generateStaticSite
generates static site from a markdown file, with a menu on the right by default
uses next.js
because it is static, the markdown can be in the frontend assets and there is no need for a backend
getJsonSchemaSummary
Generates short markdown summary
getMarkdownContents
getMergedMarkdownOutlineUrl
getOperationSummary
Summarises operation into useful information about it. Especially useful for generating docs.
getPublicMarkdownNestedPathObject
Recursively searches a folder for public markdown files, and returns a NestedObject
with the keys being the file or folder names, and the leafs being the absolute file paths.
File and folder names are stripped (number prefixes are removed, )
example:
{
"README": "path/path/README.md"
"folder1":{
"README": "path/path/folder1/REAMDE.md"
"file1": "path/path/folder1/file1.md",
}
}
getTitlesRecursively
helper function to get a nested array of the titles and its subtitles
getTypeDescriptorRecursive
Returns a single line descriptor of the type of a json schema. Can be used in markdown tables.
isConventionFileStatement
isUpperCase
makeOutlineMarkdownString
makePropertiesTable
markdownChunkToMarkdownStringRecursive
markdownChunksToMarkdownStringRecursive
markdownToSayable
all mp3s should be stored in a separate location because we don't need them in the file system and we don't reference them, as they are data that is located by convention. all markdowns should have a linked TextToSpeechAudio[]
which is auto updated every time dev is ran. TextToSpeechAudio
also includes infromation about the duration
, voice
and more...
a bigger md.mp3 file is auto-created for every markdown file that concatenates all sayable
audio pieces in the right order, but also includes the audio pieces in between.
mdToPdf
Have function mdToPdf like the vscode plugin. Probably exists.
However, may be good to do it myself since I want different renderings
mergeMarkdownParse
Merges multiple markdown parses to create a new markdown parse
noNewlines
Replaces newlines with a
operationRadio
randomly plays mp3 summaries of operations on the project
operationToMarkdown
converts an operation and all its contents into a flat markdown file that contains the needed information. configurable.
markdown for reading (so there are no links)
printNestedTitles
helper function (recursive) that prints nested titles with .. as prefix and a newline after every title
TODO: allow for numbering titles
should print any file using a preconfigured printer (which can be local or remote. if remote and there is no connection, it should save the task for later)
this function maybe needs "generateStaticSite"
projectToMarkdown
summarizes the whole OS project into a markdown string
propertyToTableRow
sayablesToMp3
Creates a single audiofile of a Sayable[] and stores that in a configured location
selectRandomOperation
selects a random operation
simplifiedSchemaToMarkdownString
Should render a string with one or more markdown tables to represent the simplifiedSchema
statementItemToMarkdown
tsFunctionToMarkdownString
TsFunction:
- name and operation
- size
- description (doc-comment)
- input, output
tsInterfaceToMarkdownString
properties, their type, and their description
use simplifiedJsonSchema, but split up nested things into multiple tables (ive written a thing for splitting up nested objects before, use that)
tsVariableToMarkdownString
upMarkdownChunkLevelRecursively
Ups the levels of the markdownChunk array, recursively.
Can be useful for merging multiple markdown sources
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.
docsGetStaticPaths
Function that tells Next.js what the pages are that need to be statically generated
docsGetStaticProps
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
getChildren
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
getMarkdownReaderQueryPaths
getOperationPages
getReaderTodoPages
gets all todo pages as markdownreader pages
markdownReaderGetStaticPaths
Function that tells Next.js what the pages are that need to be statically generated
markdownReaderGetStaticPropsFromPages
Takes the routes and pages you want to show, and returns the MarkdownReaderPageProps you need to render the reader page.
markdownReaderGetStaticProps
putReadmeOnTop
Takes an array of items (explore results) and checks them to put readme at the start
DEPRECATED: After writing this, I found that explore also has readmeOnTop
possibility, so this whole thing is not needed
getQueryPath
markdownParseToMarkdownModelType
makes a markdownModelType from a markdownParse.
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
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?
findCodeblocks
find all codespans
findCodespans
find all codespans
findEmbedsTest
findEmbeds
find all embedded assets
findLinks
find all links
flattenMarkdownString
find all items that match a token, recursively in all nested things
flattenMarkedTokenRecursive
Recursively flatten a marked token and return something if a find function is met
cleanupTimer
Ensure you run this after finishing the measurement, or you'll run into memory leaks!
generateUniqueId
Bit annoying that we need to use all model-types here xD.
TODO: Let's extrahere this
getNewPerformance
Function that lets you measure performance inside any function with ease.
Usage:
Firstly, make a performance array, and a unique execution id, and start the measurement, like so:
import { generateUniqueId, getNewPerformance, PerformanceItem, cleanupTimer } from "measure-performance";
at the start of your function
const executionId = generateUniqueId();
const performance: (PerformanceItem | undefined)[] = [];
getNewPerformance("start", executionId, true)
After that, push a new performance item at every step you want to measure. Provide your label describing what happened before this (the step you are measuring).
performance.push(getNewPerformance("your label", executionId));
At the end of your function, you can view your performance array by printing it on the console (or store it somewhere if you like)
Don't forget to run cleanupTimer, or you'll run into memory leaks!
cleanupTimer(executionId);
timer
TODO: This stores into memory. May cause memory leaks in the long run if not cleaned up!
getLegacyMenu
minifyBuild
takes an operation name or build folder path, then explores all ts files in src folder, finds the matching js file in the build folder, and executes terser from dependency, not from cli
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
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
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
getRealItemRecursive
getTitle
NestedMenuItem
TODO:
- tooltip support
nestedMenuStoreInitialValues
NestedMenu
General purpose nested menu component
Please make sure that you also wrap your app with MenuStoreProvider
, or this will crash...!
useExpanded
getAvailableOperationName
returns folder name
finds the first foldername that is available in this folder but also there is nowhere an operation already with this name
there is also getAvailableFolderPath for non-operation folders
newOperationCli
newOperation also works as CLI
example: newOperation [operation-name] [type]
in the folder where you want to create it. Optionally you can specify the type of operation as the second argument of the CLI
Arguments (all optional):
- name: string
- type: OperationClassification
- description: string
- destinationPath: string
newOperationWithFiles
Creates a new operation with files with content
Returns the final operation base path (or undefined if something went wrong)
NB: relative paths must be relative to OPERATION ROOT, not src root! They must also lead to files in src, this thing is still buggy otherwise!
TODO: Remove the buggyness
newOperation
This cli creates the correct tsconfig.json, package.json, .gitignore, folder setup, so you can get started immedeately.
Returns either the operationBasePath
of the created operation, or undefined if something went wrong
newTemplateCli
newTemplate can be used as CLI:
Arguments:
- type (required): a folder from
new-template/assets/templates
- destinationPath (optional): path where the template should be copied to (uses
cwd
by default)
newTemplate
Returns either the basePath
of the created template, or undefined if something went wrong
ALink
A simple wrapper around react-with-native A and next-link
All links you make with this component are SEO-ready
getFullPath
gets a path string from next.js
router.query
.
getLastPathsChunk
returns the last chunk of the path
usePath
uses useRouter
from next.js
to get the lastChunk and the fullPath
out of the paths
. Assumes you have a page in your next.js project called [...paths]
.
oneByOne
for every item in an array, executes an async callback, one by one. promises an array of the results of every callback once it's done
getDependenciesSummary
getOperationMetaData
gets a whole bunch of metadata about an operation, mainly filepath related, but it also reads the operation index json file
recalculateOperationIndexJson
Recalculates some operation indexable things and updates that into the database
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
calculatePathMetaData
for folders: finds all files used for calculation and uses sumPathMetaData to create a new PathMetaData. for files: just calculates the path metadata
categorizeFiles
explores files in an operation within a specified location or from a specified type
getFolderSummary
calculates folder summary from a categorized file paths object
getPathMainComment
export const sumFolderSummary = ( firstFolderSummary: FolderSummary, secondFolderSummary: FolderSummary ): FolderSummary => { const folderSummaryKeys = Object.keys( firstFolderSummary ) as (keyof FolderSummary)[]; const sum = mergeObjectsArray( folderSummaryKeys.map((keyName) => { return { [keyName]: sumAllKeys([ firstFolderSummary[keyName], secondFolderSummary[keyName], ],["bytes","characters","lines","numberOfFiles"]), }; }) ) as FolderSummary;
return sum; };
takes all PathMetaData of an array that contains all child files, and merges them, taking the newest update date, the earliest created-date, and summing size
export const sumFileGeneralMetaData = async ( childrenMetaDataArray: PathGeneralMetaData[] ): Promise<PathGeneralMetaData | null> => { const sum = childrenMetaDataArray.reduce( (sumMetaData, pathMetaData: PathGeneralMetaData) => { const newPathMetaData: PathGeneralMetaData = { createdAt: !sumMetaData || pathMetaData.createdAt < sumMetaData.createdAt ? pathMetaData.createdAt : sumMetaData.createdAt, updatedAt: !sumMetaData || pathMetaData.updatedAt > sumMetaData.updatedAt ? pathMetaData.updatedAt : sumMetaData.updatedAt, sizes: !sumMetaData ? pathMetaData.sizes : sumFolderSummary(sumMetaData.sizes, pathMetaData.sizes), };
return newPathMetaData; }, null as PathGeneralMetaData | null );
return sum; };
sumSizeSummary
addPeerMessage
addPeer
TODO:
augmentDevice
deviceGetAppsCalculated
getAllAppOperations
Gets all app operations from all packageJsons from the database. Adds isOnline to it on the fly by checking if it can connect to the port or not
getAugmentedPersons
getFirstEmoji
getNestedPathObject
getPeerMessages
getPeerPeople
Get persons with devices that have papi and their apps calculated, sorted
getPeersFromPeersRecursively
getPublicFolderNestedPathObjectFromPeer
Peer = { name: "22.2.2.2.2.2", slug: "22-22-22-22" }
getPublicFolderNestedPathObject
getPublicPeers
isPortUsed
Checks if a port is used or not
lateFetchPeerMessageSync
Should sync messages from all peers that are online into your database
ping
proactivePushAddPeerMessage
Adds a message to your own peer messages database, but also to the db of all your peers that are online currently
removePeer
TODO: connect with peoples
sortDevices
Only works if isOnlineCalculated is set (using augmentDevice)
Sorts device: first favorite, then online, then offline
updatePeer
Update one of your peers
achievements
developers
englishMethod
levelNames
publicPersonKeys
Can be seen for every person, without authentication
NB: I wish it were possible to ensure these keys exist on the person here, but we can't validate that while still keeping it a const I guess
getPrimaryPersona
isPlural
isSingular
singularize
Removes the 's' if it is found at the end of the parameter name
appPrefix
deleteAppCli
Arguments
- Operation Name
deleteApp
Deletes an app from the pm2
TODO: for some reason it says error: Error: process or namespace not found
even though it certainly exists. I can't figure out why it's not working.
listAppsCli
Arguments:none
listApps
Lists the apps in pm2
logApp
logTableObject
pm2ConnectDisconnect
Function that lets you connect, execute a pm2 action, and disconnect after
pm2Connect
restartAppCli
Arguments
- Operation Name
restartApp
Restarts an app with pm2
startAppCli
Arguments
- Operation Name
- isDev (true)
startApp
stopAllAppsExceptCli
Arguments: operation names that you don't want to stop
stopAllAppsExcept
Stops all apps except some specified ones
stopAppsCli
Arguments
- Operation Names to stop
stopApps
Stops an app with pm2
TODO: for some reason i'm getting TypeError: Cannot read properties of undefined (reading '_operate')
and I can't find why because all other commands mostly work and I'm doing it the same way.
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
ContextualPromptResultsTab
Visual to show the different prompt results. Probably deprecated, probably better to show it in a more structured way.
FilePromptSelect
Component that shows a selectbox for different prompts that can be applied on this file
processPrompt
Main function to process a prompt. For now it calls processChatGptPrompt
api and shows an alert afterwards with the result. In some cases we may want to process the prompt differently, e.g. storing it in a queue.
usePromptResultAlert
Recursive hook that calls its own function if you click "respond", which creates an additional item in the thread
browserLunchOptions
browserSession
clickOnSpanTag
it takes the current page and span text and its click on the text span
delay
Handling the new page by checking all browser tabs and if exist then return the existing one for reuse or create new one
facebookLogin
takes facebook credentials and login to facebook
foundOrNotXpath
Utility function that always returns a boolean instead of throwing an error. XPath version.
foundOrNot
Utility function that always returns a boolean instead of throwing an error.
getBrowserPageById
getBrowserTabs
getBrowser
getChromeExecutablePath
getConnectedBrowsers
getIdlePage
getNewPage
gmailLogin
Helps to login into gmail account
isCaptchaExist
logConsoleIfDebug
Utility function to log console only if a Debug flag is set. If the flag is not set, doesn't print anything.
openMultiTabs
openNewBrowserOnChildProcess
openNewBrowser
openPage
racePromises
Typescript
retryClickAndWaitSelector
Utility function that loops waiting a second and checking if selector showed up. Fails if it takes more than 30 seconds.
this is good to use instead of page.waitForTimeout + page.waitForSelector
retryWaitSelector
Utility function that loops waiting a second and checking if selector showed up. Fails if it takes more than 30 seconds.
this is good to use instead of page.waitForTimeout + page.waitForSelector
runBrowser
setBrowserPageIdle
setBrowserSession
setInnerHtml
Help to set the html element on the provided selector
setInputValue
solveReptcha
trueClick
Utility function to call the element onclick event directly. Success when clicking is improved over puppeteer page.click('selector')
twitterLogin
Method that help to login into twitter
typeInTheInputField
Help to type in the field in given selector by setting value
typeOnTheTargetWithXpathSelector
Help to type in the input field using x-path
waitMilliseconds
Utility functions to wait millisseconds. eg: 3000 waits 3 seconds
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
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
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
ModalContext
ModalProvider
{ Provider }
useModalState
useModal
ToastContainer
toast
title is only shown on native
useRouter
getRealValue
useSelectMultiple
Create a value selector in a single line of code, including its state!
useSelect
Create a value selector in a single line of code, including its state!
const [SelectView, view, setView] = useSelect(views);
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.
getItemSync
ONLY web
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
getColumns
gets all columns you can present based on a modelname, the interfaces of that model, and the data
renderColumn
Skeleton
TableHeadItem
TableRow
Table
tdClassName
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!
readProjectRelativeJsonFile
readKvmdFile
Reads and parses a markdown file
readMarkdownFileToModel
Reads a markdown absolute path to a WebMarkdownFile model
Attaches default calls to action and header
readMarkdownFile
Reads and parses a markdown file
getFolderTypescriptIndex
get a Typescript index for all that is found in a folder
getOperationIndexModel
readTypescriptFile
Reads and parses a markdown file
uniqueNames
AugmentedWordComponent
Dictionary
DocsReaderLayout
ReaderPageContent
This is rendering a WebMarkdownFile and optionally navigation.
ReaderPageHeader
clearTsDatabase
Clears all typescript indexation models, and removes all indexation from the oprations
TODO: test first, not sure about the Operation one
cwdProjectRoot
executeCommandQuietUnlessFail
Executes a command without showing the result, unless the command fails, then it will log the output.,
exitIfProcessDependenciesChanged
exits the process if our own dependencies change
generateJsonSchemas
generates schemas for db models
Is done every time you run rebuildOperation and generateSdkOperations
TODO: there are some problems with references that cannot be found with references to generic types... This can probably be solved, but it's not going to be easy!
IDEA:
- find all referencing definitions in the main schema
- find those in all other interfaces
- recursively find references in those as well
- if you can't find the reference, remove the reference and replace type to "any" (add WARNING to description "reference not found")
This will result in a valid schema that has no unresolved references
TODO: apply Storage
TODO: apply Array
TODO: apply special config conventions (MergedDbConfig) like tsconfig.json and package.json
TODO: Make a validator that validates the whole database to this schema.
getAllDbModels
getFileIds
gets all identifiers of files, which are the relative path to a file without the extension
getIndexFileIds
gets identifiers of ts and tsx files, which are the relative path to a file without the extension
getSrcIds
gets identifiers of ts and tsx files, which are the relative path to a file without the extension
in order for them to be unique, we assume here that there's never a file with the ts extension when there's also a tsx file in the same folder with the same name. This would create duplicate ids.
isOperationBuildNeeded
returns a boolean indicating whether or not the operation should be able to be built, based on the OperationClassification
isRebuildingProcessUpdated
isSdkOperation
[isUpdatedString]
manualProjectRoot
rebuildAllOperations
Rebuilds all operations that are needed to be rebuilt
rebuildOperationCli
rebuildOperation CLI syntax:
rebuildOperation [...operations]
Operations can be a list of differnt operation names you want to rebuild. It's also possible to specify a relative path instead of an operation name.
for example:
rebuildOperation ./packages/operation-x
would rebuild operation-x
in your packages folder
another handy one is rebuildOperation .
because it will rebuild the operation in your current folder.
rebuildOperation
This function rebuilds an operation and re-indexes (part of) its files.
shouldSkip
if you don't force it, there's an operation index, there's an index folder, the src has not been touched since hte last indexation, and there's a buildfolder (if needed), then the rebuildOperation can be skipped
thisProjectRoot
yarnBuild
Builds and minifies the src
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.
getMenuPagesObject
makeNestedObjectFromQueryPathObject
mapChildObjectRecursive
maps a ChildObject and all it's children, recursively
nestedObjectToChildObject
if T is an object, provide __check as one of its properties, to make it possible to check that it's a leaf. This property will be omitted in the ChildObject array
nestedPathObjectToNestedMenuRecursive
Transform a nested path object into a nested menu (MenuType), recursively
nestifyQueryPathObjectRecursive
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
findTemplates
isEqualArray
As long as there are no .template files present in the template folder that DONT need to be changed, it is fine. If there are, we should warn people.
renameTemplateFiles
renameTemplateToNormalFile
renameToTemplateFile
templateExtension
bodyFromQueryString
converts a query string into an object that can be used as a body
getFirstQueryStrings
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
[argument]
runChildProcess
spawns a child process and returns its output after it's done
sayDutch
sayLanguage
sayNepali
saySomething
TODO: do research what else is out there
say [-v voice] [-r rate] [-o outfile [aud io format options] | -n name:port | -a device] [-f f ile | string ...]
DESCRIPTION This tool uses the Speech Synthesis manager to convert input text to audible speech and either play it through the sound output device chosen in System Preferences or save it to an AIFF file.
for usage, see man say
shorthands
textToMp3
findFirstCommentTypes
Tries to find tie first appearing special comment line and parses it and returns it as part of the CommentTypeObject
getDataParameterNames
Finds all the data parameter names that might be there on an item, based on the item object keys and the convention
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.
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
example
findSentenceMatches
finds matches of a searchMessage in an array, looking at the individual words.
if your search matches some words in a sentence, it's a match, as long as all your words you entered are also a word in the sentence
NB: this could be augmented with things like synonyms and translation
magicalRecursiveReducer
Reduces an object with children of its own type according to a baseMatcher.
The object only gets returned if the children have a match (or their children, etc) or if the object itself is a match. If the object itself is a match, its children will also be edited to filter out non-matching things
NB: Not finished yet (see todo).
Also not sure if the final UX is really as great and performant as I wish, so it may be easier to simply have a separate search for files and global (just like vscode has)
searchRecursiveObjectArray
apiUrl
customApiUrl
hostname
isDev
localhostServer
realCustomApiUrl
remoteServer
NEEDED FOR MULTI DEPLOYMENTS (passionfruit)
runRemoteServer
addAuthenticationMethod
sends an email or sms, or already confirms in case of emailPassword
core function for addPersonAuthenticationMethod
and addDeviceAuthenticatedMethod
addDeviceAuthenticationMethodConfirm
adds an authenticatedMethod
to Device after the OTP is correct
For now, only handles methods phoneNumber
and email
TODO: extrahere the core into addAuthenticationMethodConfirm
and use it in this one and make also addPersonAuthenticationMethodConfirm
addDeviceAuthenticationMethodWithContext
returns new function context with added authenticationmethod
addPersonAuthenticationMethodWithContext
findAuthenticatedPersonWithHandle
Check if the handle is already taken by some person in the system
findLoggedinPersonsWithContext
This finds all persons you should be logged in as according to all your device's Authentication Methods.
Does not update your device to add the found persons.
getMeWithContext
Get all relevant information about yourself, including all persons that are attached to you.
NB: probably need to omit some fields later, but for now it's fine
getPublicPerson
getPublicPersons
isPhoneNumber
TODO: Implement this
isValidPassword
loginWithContext
attaches the Device with authToken
to a Person once all required authenticationMethods are provided. If not, it needs to return the required authenticationMethods so the user can attach those to the device until loggin is successful.
loginWithPasswordWithContext
Login with username and password
- Adds an username/password combo as auth-method to the device,
- Checks the persons to match the auth
- In case of match, moves the method to the person and connects the device
logoutWithContext
Uses cookies (https://serverjs.io/documentation/reply/#cookie-) to logout
Needed for having authToken
with GET as well in a safe manner (e.g. for images)
removeDeviceAuthenticationMethodWithContext
removes an authenticatedMethod
from Device
Usually the authentication methods are an attempt to login into a new account, so if you remove something it doesnt have impact on the accounts you already logged into, because these authentications are not stored on the device but on the person.
We can therefore remove it without much validation
removePersonAuthenticationMethodWithContext
removes an authenticationMethod
from Person from currentPerson from authenticated device
signupWithContext
Creates a new Person for a Device. Adds that person to the Device.
- Can only be done with at least one authenticationMethod
- Can only be done if authentication is not applied on an existing person already.
- Function is wrappable
signupWithPasswordWithContext
For now only username/pass is supported due to direct verification
This function makes an authenticationmethod for the device and then signs up by creating a person for it and attaching it to the device.
switchCurrentPersonWithContext
updateMeWithContext
setJsonKey
npx setjsonkey [json-path] key1.key2.[index/latest/push].key3 "value"
collect arguments 1 2 and 3 find file (arg1) in path, import json (or start with empty object in a new file) reduce keys (arg2) to go deeper into the object and create keys as they don't exist make sure it works with arrays too convert value string (arg3) to number, boolean if they seem to be like that
Share
and
Shareable
useAllText
useLastSelection
useProjectRelativeScreenshot
Use https://www.npmjs.com/package/use-react-screenshot to get a blob of any component with the click a button
Upload the blob immediately using processAsset, which will result in a file in the file system.
useScreenshot
import { useScreenshot } from "use-react-screenshot";
todo: take this thing over
findAudioWithViewsArray
markdownParseToShortMarkdown
shortMarkdownToMarkdownParse
augmentShortMarkdown
fetchVoicesTest
fetchVoices
generateAugmentedShortMarkdownTest
generateAugmentedShortMarkdown
The first step is to ensure that this would actually work. It needs to generate the MP3s and refer to them correctly in the file.
getOrGenerateShortMarkdown
MINIMUM_DURATION_MS
parseDialogue
uberduckApiKey
uberduckGetPath
uberduckSecret
uberduckSpeak
voiceCloneDialogue
ShortMarkdownPlayer
ShortMarkdownSlide
Duration is required, and either title or viewPath must be there
ShortStudio
the newer one, eventually to replace ContextTextArea
useMultiAudio
- Implement a component that preloads all audios for the
ShortMarkdown
and lets you play one with a callback (look at https://stackoverflow.com/questions/47686345/playing-sound-in-react-js) - If slide has audio belonging to it, find it and play it. Start at certain point, depending on which part you are at.
- Select the correct audio for every slide, and get the API url for it. Load it in into an
<audio>
element once you go to the slide.
ArrayForm
Component to render a parameter that holds an array
This is simply a wrapper around another SimplifiedSchemaForm where the onChange
and values
are slightly different
This component renders a SimplifiedSchemaForm for every item in the array, and adds buttons to insert/remove new items.
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.
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.
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
)
useTsInterfaceForm
hook to create a form for a TsInterface
import { useTsInterfaceForm } from "simplified-schema-form";
import DatasetConfigJson from "code-types/db/ts-interfaces/datasetconfig.json";
import { DatasetConfig, TsInterface } from "code-types";
import { Storing } from "model-types";
in your component:
const initialValue:DatasetConfig = {} as any;
const [Form, value, onChange] = useTsInterfaceForm(DatasetConfigJson as Storing<TsInterface>,initialValue);
sendDailyAlarmSms
sendSms
Send sms
Requires OS Config to have Twilio sid and auth token.
Reqruired options: to
and body
to
is not required, but will overwrite the one you specified in your OsConfig
objectStringToJson
takes an object string and parses it to JSON
Instead of requiring objects to be in JSON format, they can be in the following format:
key1: value, key2: another value, key3: 9, key4: false, key5: null, key6: { subkey: true, subkey2: 0 }
NB: you can have objects in parameters of objects by surrounding the same syntax with {
and }
parseIfJson
if it's a string with a parsable JSON inside, parse it and return the object/array
parsePrimitiveJson
parses a string to a string, number, boolean, null or undefined.
optionally you can chooose to force a type...
TODO: figure out how I can do this without ts-ignores
stringToJson
takes any string, and parses it to JSON
if you provide (nested) objects, make sure to use the following format:
key1: value, key2: another value, key3: 9, key4: false, key5: null, key6: { subkey: true, subkey2: 0 }
SwipeHomepage
This homepage component assumes you provide it some CTA's (ideally 2 or 3) and some items.
- The items will be swipable
- The logo should be available in
public/logo.png
tabsStoreInitialValues
Tabs
Container for tabs
binaryExtensions
List of binary file extensions
textExtensions
List of text file extensions
Timeline
todoPagesConfigRecencysConst
todoPagesConfigRecencys
DEFAULT_HOVER_TIMEOUT_MS
Tooltip
removeCommentsRegex
tryParseJson
if text isn't json, returns null
getAllTsMorphSourceFiles
getHasGeneric
returns a boolean indicating whether an interface or type has one or more generic arguments
getTsMorphProject
returns a ts-morph Project given a operationFolderPath, if a tsconfig.json can be found
createCodeblockMarkdown
small util function to create a markdown for a string.
useCustomUrlStore
Hook to store simple data in the URL
I spent the last 4 hours on this: I think it's pretty useful. It's a hook that makes it possible to use your URL as a state store. It works with arrays and single values of strings, booleans and numbers. It's a drop in replacement of useStore or useState. The advantage is that the user can share the URL which will also share their state. Usage in a component looks like this:
const [name, setName] = useUrl("name");
I was looking for ways to make the api more straightforward, especially the stuff in useUrl seems a bit messy. However, I couldn't find any way to make it better. Any tips are welcome!
TODO: make it work in react-native as well, either via a wrapper around useStore or via using the react-navigation param-store
import {useCustomUrlStore}from "use-url-store";
export const useUrl = <T extends keyof typeof queryStore>(queryKey: T) => {
const queryStore = {
"type-index-type": useCustomUrlStore<string | undefined>("type-index-type", {
type: "string",
}),
"has-comment-types": useCustomUrlStore<string[]>("has-comment-types", {
type: "string",
isArray: true,
}),
"interface-is-db-model": useCustomUrlStore<boolean>("interface-is-db-model", {
type: "boolean",
}),
path: useCustomUrlStore<string | undefined>("path", { type: "string" }),
name: useCustomUrlStore<string | undefined>("name", { type: "string" }),
type: useCustomUrlStore<string | undefined>("type", { type: "string" }),
};
return queryStore[queryKey];
};
getOpenableFilePath
vscodeOpen
opens a file in vscode through the "code" cli
watchAllCli
Runs watchAll.
watchAll
👁 👁 Finds all watchers within typerepo and ensures they all start watching their watch
getSubInfo
getSubName
initiateWatch
isClientOk
checks if watchman client is ok. ends client if it's not ok
isStillPending
checks if pending has items every 5 seconds, resolves after it hasnt
this is a handy thing to have in util, but it can also probably be much more simple
noPending
pending
pickWatcher
based on your os, pick either chokidar or fswatch
uniqueAppKey
watchFoldersChokidar
watches folder paths and executes a callback when something changes in one of them
uses fs.watch
watchFoldersFs
watches folder paths and executes a callback when something changes in one of them
uses fs.watch
watchFolders
watches folder paths and executes a callback when something changes in one of them
TODO: check fs/promises.watch, that seems like a simple alternative of this! Could it be? Could it remove the need for watchman?
exitIfOperationsChange
every 5 seconds compares if the operationsourcepaths have changed. If so, exits the process
gitCommitAllCron
const pushPosition = async () => { const position = await getLocation(); if (position) { push("Position", { ...position, createdAt: Date.now(), updatedAt: Date.now(), createdFirstAt: Date.now(), deletedAt: 0, id: generateId(), }); } };
const pushLight = async () => { const light = 1; if (light) { push("Light", { id: generateId(), createdFirstAt: Date.now(), createdAt: Date.now(), updatedAt: Date.now(), deletedAt: 0, light, }); } };
const watchLocation = async () => { pushPosition(); setInterval(() => { pushPosition(); }, 60000); };
const watchLight = async () => { pushLight(); setInterval(() => { pushLight(); }, 60000); };
watchOperations
watches all operations and does much more
crudPageToWebPages
functionFormPageToWebPage
writeToAssets
Writes anything (string or json) the assets folder of the operation of the caller function of this function
Useful for testing
copyPath
deleteFileOrFolder
getFileContents
Gets the contents of a file in the project
getFrontmatterSchema
Gets the frontmatterSchema of any markdown model. This should contain all elements that are required to be in the frontmatter of the markdown
getWriterWebPagesMenu
getWriterWebPages
movePath
newFile
newFolder
processAssetUpload
Used for the markdown reader to immediately process a asset upload. If we want to validate this, it would be good to allow a second parameter that checks if you have access to the file
renameFileOrFolder
saveFileContents
trashFileOrFolder
NB: only would work with an ESM module, but I don't have time for this now. Later this could replace deleteFileOrFolder
updateFrontmatter
Update frontmatter from a markdownfile by overwriting it, keeping old values that you don't change
If you provide a folder as projectRelativePath, it stores it to README.md in that folder, even if that doens't exist.
add
The ultimate typescript database stores data in typescript
Completion
ContentEditableDivInput
Div that is contentEditable
by default and has possibilities for color/style highlighting, autocomplete, subtexts and tooltips
ContextTextArea
TextArea with ability to enhance personal database and execute prompts
QUESTION:
How to make color highlighting?
I guess we need to wrap all words with a span and make it contenteditable, so we can create a editor where we are styling all words that are written
We can then also change the value of the word if you are NOT editing that word.
So you would only see the true value of a word when your cursor is on that word
TODO:
- replace the textarea with a div contenteditable
- make selectionStart and selectionEnd still working (on the original text)
- whenever you stop editing a word, it needs to be wrapped with a span and styled with a function taking that word and returning a style
- whenver you start a new word through a separator, an empty span should be created
- the span of the current word being edited must have a location (x,y). get that exact location so we can render an autocompletion intellisense
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 ended up being easier. Keeping it here because I need to fix the indexation nonetheless.
EditWriterInput
the newer one, eventually to replace ContextTextArea
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 ContentEditableRenderComponent
s 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
getTypescriptErrorsFromFiles
/**
- uses official typescript compiler to check all given files for compilation errors */
fileSlugify
/**
- Slugification for filepaths in specific */
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) */
handleExplicitValidation
hasDefinition
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
byteCount
/**
- This function will return the byte size of any UTF-8 string you pass to it. */
isObject
Modal
useNavigation
useIsInViewport
setKeyAtLocation
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
ifbuffer
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 neitherfilename
norbuffer
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 neitherfilename
norbuffer
were provided. Otherwise will be a boolean value with the detection result. */
useOnScreen
/**
- checks wheter or not a certain element is in the browsers screen view, or not. */
makeSubscription
MarkdownReaderPageProps
NamedParameters<typeof HomePage>
NamedParameters<typeof executeCronFunction>
NamedParameters<typeof runFunctionServer>
NamedParameters<typeof runFunctionServerCli>
NamedParameters<typeof runFunctionServerDev>
NamedParameters<typeof runFunctionServerDevCli>
NamedParameters<typeof scheduleCronJobs>
NamedParameters<typeof startSearchWebIfAvailable>
TsFunction
Interface for arrow functions and normal functions
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: [....], }
NamedParameters<typeof FormTab>
NamedParameters<typeof FunctionExecutionTable>
NamedParameters<typeof FunctionLayout>
NamedParameters<typeof FunctionPage>
NamedParameters<typeof getAllSearchResults>
NamedParameters<typeof SearchResultComponent>
NamedParameters<typeof SearchResultPage>
QueryPageProps
SearchResult
NamedParameters<typeof MyLayout>
NamedParameters<typeof TodoMenuHeader>
GetStaticPathsContext
GetStaticPropsContext
NamedParameters<typeof codestoriesGetPages>
NamedParameters<typeof codestoriesGetStaticPaths>
NamedParameters<typeof codestoriesGetStaticProps>
CopyPair
NamedParameters<typeof copyCopyPairs>
NamedParameters<typeof copyReaderStaticAssets>
NamedParameters<typeof findReaderStaticAssets>
NamedParameters<typeof findStaticAssets>
ReaderWebPage
specifically always a markdown page
CodespanItemInfo
NamedParameters<typeof addCodestoryToSection>
NamedParameters<typeof findCodestories>
NamedParameters<typeof makeCodespanMappedObject>
NamedParameters<typeof makeCodestory>
NamedParameters<typeof test>
NamedParameters<typeof writeAllCodestories>
NamedParameters<typeof writeAllCodestoriesCli>
NamedParameters<typeof writeCodespanDetails>
AuthenticationMethodMethod
Username + password should be the default
Email OTP, phone number OTP (sms or call or whatsapp), should be optional 2FA methods
All others can also act as authentication methods, but the token shouldn't be stored
BackendAsset
Part of the asset that should be sent to the backend. The rest should frontend-only
Some values are stored, some are not
ContextualPrompt
Model for prompting information from third party sources
FileType
FunctionContext
Should be attached as first argument of the function, if the name of the function is in the format of:
xyzWithContext
: attaches all contextxyzWithContextRaw
: attaches all context, api returns just the result of the function without wrapping it in theRealApiReturnType
. Needed in case you have a different server.jsserver.reply
For more info see apiConvention
NamedParameters<typeof addEmojiToEveryWord>
NamedParameters<typeof addStatement>
NamedParameters<typeof addWord>
NamedParameters<typeof biggestFunctionName>
NamedParameters<typeof checkQueue>
NamedParameters<typeof cleanup>
NamedParameters<typeof controlChatGptWrapper>
NamedParameters<typeof deletePromptResult>
NamedParameters<typeof developersQuote>
NamedParameters<typeof diaryToInstagram>
NamedParameters<typeof documentationWriting>
NamedParameters<typeof emojiAugmentation>
NamedParameters<typeof explain>
NamedParameters<typeof explainInDutch>
NamedParameters<typeof explainInNepali>
NamedParameters<typeof explainInPortuguese>
NamedParameters<typeof explainLineByLine>
NamedParameters<typeof fixGrammarAndSpellingMistakes>
NamedParameters<typeof followUpQuestions>
NamedParameters<typeof getCategoriesTest>
NamedParameters<typeof getContextualPrompt>
NamedParameters<typeof getContextualPromptCategories>
NamedParameters<typeof getContextualPromptResultJsonFilePath>
NamedParameters<typeof getObjectForkKeyRecursively>
NamedParameters<typeof getToolFunctions>
NamedParameters<typeof gptIdeasRegisterWithContext>
NamedParameters<typeof haiku>
NamedParameters<typeof hookOneliners>
NamedParameters<typeof improveCode>
NamedParameters<typeof investorPitch>
NamedParameters<typeof marcusAurelius>
NamedParameters<typeof opposite>
NamedParameters<typeof outlineToInvestorPitch>
NamedParameters<typeof poem>
NamedParameters<typeof processChatGptPrompt>
NamedParameters<typeof processPromptOnFile>
NamedParameters<typeof processPromptOnFolderWithContext>
NamedParameters<typeof quiz>
NamedParameters<typeof removeAllFake>
NamedParameters<typeof rickAndMorty>
NamedParameters<typeof rickAndMortyRick>
NamedParameters<typeof setIsFavoritePromptResult>
NamedParameters<typeof shouldAddToQueue>
NamedParameters<typeof socratesAndSnoopDogg>
NamedParameters<typeof storytelling>
NamedParameters<typeof summarizeMeetings>
NamedParameters<typeof toolFunctionWithContext>
NamedParameters<typeof translateEverything>
NamedParameters<typeof translateEverythingIntoHindi>
NamedParameters<typeof translateEverythingPortuguese>
NamedParameters<typeof translateToPortuguese>
NamedParameters<typeof typescriptExplain>
NamedParameters<typeof williamShakespear>
NamedParameters<typeof writeContextualPromptSdk>
NamedParameters<typeof writeCreatePromptCode>
NamedParameters<typeof ye>
NamedParameters<typeof yodafy>
ProcessPromptProps
StackCount
AiDataset
AI datasets example: https://pile.eleuther.ai/
AiDemoApp
AiModel
CategoryChildObject
ContextualContent
ContextualPromptInfo
To be appended to the generated typescript
ContextualPromptResult
A result from a contextual prompt. Doesn't include the full context, for that you can find all results for a certain thread
ContextualPromptsObject
DefaultModelType
Use this model by default
FolderContent
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
GptIdeasUser
LanguageModelEnum
ProcessPromptFunctionResult
Same result to be expected from executing prompt for any language model
PromptFunction
Special kind of function that executes a prompt with the use of a language model
ReaderProps
This is what we need on the page level. There are many subtleties to it, but this is the core
SlugModelType
use this model for things with a name that have an unique slug that can be used to identify the model
NamedParameters<typeof allOperationsRemoveJsSrc>
NamedParameters<typeof allOperationsToMarkdown>
NamedParameters<typeof clearAllTsDatabases>
NamedParameters<typeof codeAll>
NamedParameters<typeof getAllOperationClassifications>
NamedParameters<typeof mdAllOperations>
NamedParameters<typeof minifyAllOperations>
NamedParameters<typeof removeAllFiles>
NamedParameters<typeof removeAllFolders>
NamedParameters<typeof removeAllFoldersCli>
NamedParameters<typeof runScriptEverywhere>
NamedParameters<typeof setScriptEverywhere>
ApiConfig
NamedParameters<typeof fn1>
NamedParameters<typeof fn2>
NamedParameters<typeof fn3>
NamedParameters<typeof getGetApiUrl>
NamedParameters<typeof untypedApiFunction>
ApiStoreType
NamedParameters<typeof AppsMenu>
NamedParameters<typeof ask>
NamedParameters<typeof askOk>
NamedParameters<typeof getArgumentOrAsk>
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.
AssetInputType
AssetParameter
NamedParameters<typeof addToken>
NamedParameters<typeof ensureToken>
NamedParameters<typeof findAssetParametersRecursively>
NamedParameters<typeof getConversionInfoFromType>
NamedParameters<typeof getExtensionFromAsset>
NamedParameters<typeof getNameFromRelativePath>
NamedParameters<typeof getNameWithTokenFromRelativePath>
NamedParameters<typeof getReferencedAssetApiUrl>
NamedParameters<typeof getTypeFromUrlOrPath>
NamedParameters<typeof readableSize>
NamedParameters<typeof removeTokenIfPresent>
CompressionConfig
NamedParameters<typeof compressAsset>
NamedParameters<typeof downloadRemoteAsset>
NamedParameters<typeof deleteReferencedAsset>
NamedParameters<typeof findAbsoluteAssetPathFromReference>
NamedParameters<typeof findAllProjectMedia>
NamedParameters<typeof getStorageLocationInfo>
NamedParameters<typeof getTemporaryAssetsFolderPath>
NamedParameters<typeof processAsset>
NamedParameters<typeof removeOldTemporaryAssets>
NamedParameters<typeof serverDownloadReply>
NamedParameters<typeof uploadAssetWithContext>
ReceivedFile
This is the format that I receive for a file with server.js, even though they say it's a formidable.file, which it's not...
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
Later, maybe also support: "markdown","json","typescript"
CompressionOption
CompressionOption should be able to be applied on the model parameter through frontmatter
- default (default option): Default OS wide compression. User can make customize it within a logical 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
AugmentedAnyModelType
NamedParameters<typeof AssetView>
NamedParameters<typeof getSrc>
NamedParameters<typeof itemGetBackendAssetUrl>
NamedParameters<typeof useAsset>
NamedParameters<typeof useAssetInfo>
NamedParameters<typeof getAugmentedWordObject>
NamedParameters<typeof getAugmentedWords>
NamedParameters<typeof getBundleAugmentedWords>
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..
TODO: This is a much more general purpose thing than just markdown-reader-types
. Move to it's own package
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)
Authorization
Authorization helps you provide certain access to files, data, functionality, and code. Authorization can be provided custom, or by indexation. The indexation of the codebase and text-files overwrites the custom authorization in the Group
-model.
For files (ts, md, json, etc...):
- canWriteCreate
- canWriteUpdate
- canWriteDelete
- canRead
- canSearch (only search index)
For db model data subsets:
- canWriteUpdate
- canWriteCreate
- canWriteDelete
- canRead
- canSearch (only search index)
For functions:
- canExecute
For functions, interfaces, variables:
- canRead (reading docs only. for source, you need to provide the file auth)
- canSearch (only search index)
AuthorizationModel
Authorization model for indexed authorizations
Don't edit this! If you wish to add authorizations to a group, either edit the code or text-files, or provide custom authorizations to the Group
.
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.
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.
Device
A Device that accesses any King OS api.
A device can be connected to a person. A person can have multiple Devices.
A Device does not necissarily have King OS installed themselves, they can also be a visitor to another King OS app of someone else.
NamedParameters<typeof AuthenticationMethodsCrud>
NamedParameters<typeof LoginForm>
NamedParameters<typeof LoginWrapper>
NamedParameters<typeof MeAuthenticationInfo>
NamedParameters<typeof PersonProfileDetailsForm>
NamedParameters<typeof PublicPersonComponent>
NamedParameters<typeof PublicProfile>
NamedParameters<typeof SignupForm>
NamedParameters<typeof UpdateMeForm>
PersonInfo
PersonProfileDetails
Things the user can fill in about themselves on their profile
PublicPerson
NamedParameters<typeof BreadCrumbs>
NamedParameters<typeof renderBreadCrumbs>
BrowserPage
BrowserSession
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.
BundleSummary
NamedParameters<typeof getBundleSummary>
NamedParameters<typeof getDbModelsForBundle>
LoginResponse
NamedParameters<typeof chatGPTAuth>
NamedParameters<typeof detectChatGptPage>
NamedParameters<typeof openAIChat>
OpenAIChatProps
OpenAIChatResponseType
Page
Page provides methods to interact with a single tab or {@link https://developer.chrome.com/extensions/background_pages | extension background page } in Chromium.
:::note
One Browser instance might have multiple Page instances.
:::
ExecOptions
NamedParameters<typeof execAsync>
NamedParameters<typeof spawnAsync>
SpawnOptionsWithoutStdio
NamedParameters<typeof cleanupTsDatabase>
NamedParameters<typeof shouldDeleteTsModel>
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!
TsExport
TsImport
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
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
ApiFunction
TODO: rename to StandardFunction
, it's not just for the API
ApiFunctionParameters
CategorizedFilePaths
filepaths categorized based on the filetype. With king os there are only these filetypes:
- code: ts, tsx
- data: json
- text: md, mdx
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 can be a key in the SimplifiedSchema, if available.
CommitInfo
CompilerOptions
ContributorPersonInfo
DatasetConfig
The part of dataset that can be used in certain functions
DatasetConfigKey
DatasetConfigShape
DatasetFilter
Can be better, see https://www.w3schools.com/js/js_comparisons.asp
DatasetFilterOperator
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
- [pluralized-kebab-case-model-name]: e.g.
StudentUser
becomesstudent-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
ExplorationDetails
FileContentInfo
Stuff you can find by reading the file
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
FunctionClassification
-
react
: The core library that should always be used that wraps react and react native. -
dumb
: Presentational components that only care about how things look, and have no idea about the type of information that they will contain (data-agnostic), nor their context they're used in. -
smart
: Presentational components that may contain getters and setters for global state. This means they're still easy enough to set up, but -
wise
: stateful components that use the backend as well to do things. for example, simplified-schema-form -
genius
: blocks of components that have certain functionality. Example: file-writer orcrud
FunctionParameter
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
Markdown
a string that is known to contain markdown.
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
ModelView
ModelViewEnum
Models should be able to be shown in multiple different views:
- Table: useful to show models with much details
- Grid: useful to show models with a visual aspect and less details
- Timeline: useful to show text-related models
- Tree: useful to show a hierarchy
NamedParameters<typeof getExamples>
NamedParameters<typeof getFunctionExersize>
Operation
Model for typerepo
operations. Stored in package.json
in every package (compatible with regular npm package.json data structure). An Operation is a NPM Package that applies the typerepo
convention.
TODO: add a validation to package.json files for the whole project, to ensure i can apply fs-orm convention
OperationClassification
OperationClassification tells you to what kind of environment the operation can be exposed to. It tells you things about how it will be built. There are three categories: Full stack, frontend only, and backend only. The aim is to do as much as possible in the full stack realm so it can be reused anywhere. If that is not possible, ui-esm
is preferred for the frontend, or node-esm
for things that require backend.
TODO: It would be great to learn more about this topic and see if I can make more cross-environment packages. A great use case would be to create a wrapper around the current fs-orm to enable using it at the frontend too.
FULL STACK
-
cjs
: only js (no node) (well, ts of course, but it gets built into common js) -
ts
: non-built typescript code (needs to be transpiled, not recommended)
TODO: esm
: builds to ESM module resolved Javascript
FRONTEND ONLY (cannot be used within backend-only operations)
-
ui-web
: has next.config.js and thus exposes something on some port when it is ran. next.js + react-based... -
ui-app
: uses react-native and exposes something on some port when it is ran -
ui-ts
: uses react (with (native)), which main entry points to typescript es6 files (this ui package cannot be built, should be transpiled. Primarily used for big ui libraries tied to aui-web
andui-app
for convenience. For other things, it is highly discouraged, please useui-cjs
orui-esm
) -
ui-cjs
: ui which main entry points to javascript es5 files (this ui package can be built). don't import ESM packages in here, this may give problems. -
ui-esm
: ui which builds to ESM module resolved Javascript. All packages that useui-esm
packages, need to beui-esm
,ui-es6
,ui-web
, orui-app
in order to work properly. It seems to have difficulties using this inui-cjs
BACKEND ONLY (cannot be used within frontend-only operations)
node-cjs
: includes other node packages, operations, core-imports, and globals.
TODO: node-esm
: Typescript package that is built to ESM Javascript which also includes all node packages, operations, core-imports and globals.
TODO: node-ts
: transpilable node package
server-cjs
: exposes something on some port when it is ran and uses node code
Operations will be classified automatically. It is good to remember that:
- It will be classified as UI if
isUiOperation
resolves to true - It will be classified as Node if Operation has a (dev)dependency on
@types/node
. - Otherwise, it will be classified as base typescript (full stack)
- It will be classified to an ESM operation if
tsconfigCompilesEsm
resolves to true. - It will be classified to a TS operation if
packageCompilesTs
resolves to true - In order for it to be classified as a server, you must set
isNodeServer
to true in the operation config object of Operation
OperationPathParse
OperationRepositoryInfo
PackageInfoObject
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
PathStats
Information which can be found by fs.stat
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 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.
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 seconds5-mintues
: every 5 minutes, starting at the first minute of the hourquarter-hour
: every 15 minutes, starting at the first minute of the hourhour
: every hour, starting at the first minute of the hour6-hours
: every 6 hours, starting at midnightmidnight
: 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 1styear
: 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.
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
TsConfig
would be nice if we have a type interface for this, just like package.json for now just type the stuff we need
TsFunctionIndex
TsIndexModelType
identifier of any index type interface
TsInterfaceProperties
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
TypescriptFile
IDEA: What if we could make a custom db storage method for a typescript file, so you can read and write typescript with the database?
The first thing I can do, is to generate all typescript stuff using a model like this:
Later, I can read a typescript file with a rust parser to get it into this model again.
This is actually super useful for metacoding and coding GUI's
Also a great start for making my own programming language ;)
There are multiple ways of describing a typescript file I guess. This is one of them. Another one could be a definition where you put the required context in the statements and types themselves.
TypescriptIndex
Typescript file metadata (all indexes from typescript files, together)
TypescriptScopeContent
TypescriptScopeContext
TypescriptScopeStatementContext
TypescriptScopeTypeContext
NamedParameters<typeof stripComment>
NamedParameters<typeof stripCommentEnd>
NamedParameters<typeof stripCommentStart>
NamedParameters<typeof stripSlashes>
NamedParameters<typeof stripStar>
NamedParameters<typeof trim>
NamedParameters<typeof trimSurroundingNewlines>
NamedParameters<typeof getCompileErrors>
NamedParameters<typeof getTypescriptErrorsFromFiles>
NamedParameters<typeof writeBuildErrors>
PackageJson
Casing
NamedParameters<typeof camelCase>
NamedParameters<typeof capitalCase>
NamedParameters<typeof capitaliseFirstLetter>
NamedParameters<typeof convertCase>
NamedParameters<typeof convertToTargetCasing>
NamedParameters<typeof fileSlugify>
NamedParameters<typeof getDelimiter>
NamedParameters<typeof humanCase>
NamedParameters<typeof kebabCase>
NamedParameters<typeof lowerCaseArray>
NamedParameters<typeof pascalCase>
NamedParameters<typeof slugify>
NamedParameters<typeof snakeCase>
NamedParameters<typeof splitCasingDelimiters>
NamedParameters<typeof errorToast>
NamedParameters<typeof infoToast>
NamedParameters<typeof showStandardResponse>
NamedParameters<typeof successToast>
NamedParameters<typeof warningToast>
StandardizedApiReturnType
Handy type interface for rendering response
CsvItemType
NamedParameters<typeof tryParseCsv>
CsvModelType
Use this model for things you want to store in CSV format
TODO: add support for numbers, booleans, null, undefined
CsvTestModel
DefaultTestModel
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
KvmdTestModel
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!
MarkdownTestModel
NamedParameters<typeof generateCsvInstance>
NamedParameters<typeof generateJsonSingleInstance>
NamedParameters<typeof generateKvmdInstance>
NamedParameters<typeof generateMarkdownInstance>
NamedParameters<typeof generateSlugTestModel>
NamedParameters<typeof get>
NamedParameters<typeof getCli>
NamedParameters<typeof getRanomAge>
NamedParameters<typeof main>
NamedParameters<typeof migration>
NamedParameters<typeof randomName>
NamedParameters<typeof removeCli>
NamedParameters<typeof set>
NamedParameters<typeof testOperationModels>
NamedParameters<typeof testPerformance>
NamedParameters<typeof updateCli>
NamedParameters<typeof upsert>
NamedParameters<typeof upsertCli>
SlugTestModel
TestModels
DbCrudStore
NamedParameters<typeof DatasetForm>
NamedParameters<typeof getPropertiesDataParameterNames>
NamedParameters<typeof ModelComponent>
NamedParameters<typeof openWhatsapp>
NamedParameters<typeof SearchBar>
NamedParameters<typeof shimmer>
NamedParameters<typeof SimplifiedSchemaFormDebug>
NamedParameters<typeof sortToItem>
NamedParameters<typeof toBase64>
NamedParameters<typeof UpsertForm>
NamedParameters<typeof UpsertPage>
NamedParameters<typeof useInfiniteGetDbModel>
NamedParameters<typeof useModelFromUrl>
SchemaProperty
CacheLookupResult
NamedParameters<typeof cacheLookup>
NamedParameters<typeof calculateOperatingSystemBundle>
NamedParameters<typeof getCachedFunctions>
NamedParameters<typeof getDatabaseMenu>
NamedParameters<typeof getDbModelMetadata>
NamedParameters<typeof getDbModelNames>
NamedParameters<typeof getFunctionIndex>
NamedParameters<typeof getNestedDatabaseMenu>
NamedParameters<typeof hasDbRecipes>
NamedParameters<typeof makeSrcRelativeFolder>
NamedParameters<typeof tsInterfaceToDbMenu>
NamedParameters<typeof filterInterfacesFromOperationNames>
NamedParameters<typeof getDbModelsFromOperations>
NamedParameters<typeof docsGetPages>
NamedParameters<typeof getPublicMarkdownFilePaths>
NamedParameters<typeof removeExtensionsFromPath>
NamedParameters<typeof removeNumberPrefix>
NamedParameters<typeof shouldExposeMarkdownFile>
NamedParameters<typeof stripReadmeFromFolder>
NamedParameters<typeof comparePassword>
NamedParameters<typeof encryptPassword>
NamedParameters<typeof exploreOperation>
NamedParameters<typeof exploreProject>
NamedParameters<typeof getExplorationType>
NamedParameters<typeof getFileWithExtension>
NamedParameters<typeof getFolderExplorationDetails>
NamedParameters<typeof getFrontmattersMappedObject>
NamedParameters<typeof getInstanceNames>
NamedParameters<typeof getProjectRelativePaths>
NamedParameters<typeof getTodoPages>
NamedParameters<typeof getTodoPaths>
NamedParameters<typeof hasSameProjectPath>
RelativePathType
TodoPagesConfig
NamedParameters<typeof FancyLoader>
NamedParameters<typeof compressConvert>
NamedParameters<typeof compressImages>
NamedParameters<typeof compressImagesCli>
NamedParameters<typeof compressMp4>
NamedParameters<typeof compressMp4sCli>
NamedParameters<typeof convertToMp3>
NamedParameters<typeof convertToMp4>
NamedParameters<typeof fileExplorerOpen>
NamedParameters<typeof getFileType>
TypeIconEnum
NamedParameters<typeof MatchingText>
NamedParameters<typeof PathSearchResults>
FileTabsStoreType
NamedParameters<typeof OpenFileWriterPages>
PagesObjectShape
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.
JsonExtension
MarkdownExtension
NamedParameters<typeof getFileTypeFromPath>
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
DependencyTree
DependencyTreeChildObject
Gives a clear overview of why an operation requires every dependency
NamedParameters<typeof findDependantsRecursivelyTest>
NamedParameters<typeof findMonorepoExports>
NamedParameters<typeof findMonorepoImports>
NamedParameters<typeof getDependencyTree>
NamedParameters<typeof getOldDependencyTree>
NamedParameters<typeof getOperationDependencyReasons>
NamedParameters<typeof test2>
NamedParameters<typeof folderGetUpdatedAt>
FrontmatterParse
FrontmatterValue
NamedParameters<typeof frontmatterParseToString>
NamedParameters<typeof frontmatterToObject>
NamedParameters<typeof getFrontmatterValueString>
NamedParameters<typeof markdownModelTypeToMarkdownString>
NamedParameters<typeof objectToFrontmatter>
NamedParameters<typeof parseFrontmatterString>
NamedParameters<typeof quotedOrNot>
NamedParameters<typeof stringifyNewlines>
AnyModelObject
CategoryStack
Taken from the location in the folder of the db-model.
NB: Changing this value when updating/upserting, changes where the item is located!
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.
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
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 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 addDefaultValues>
NamedParameters<typeof calculateOperationsObject>
NamedParameters<typeof createDb>
NamedParameters<typeof getDefaultLocationPattern>
NamedParameters<typeof getMergedConfigOperationPath>
NamedParameters<typeof getRootFolders>
NamedParameters<typeof waitForLockfile>
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
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 getFolderSize>
NamedParameters<typeof getFolderSizeObject>
NamedParameters<typeof getOneFolderUpPath>
NamedParameters<typeof oneUp>
NamedParameters<typeof renameAndCreate>
NamedParameters<typeof updateSingleNestedJsonFile>
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.
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 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 }
UnixTimestamp
NamedParameters<typeof join>
NamedParameters<typeof makeRelative>
Group
NamedParameters<typeof getFunctionExecutions>
NamedParameters<typeof getFunctionQueryPaths>
NamedParameters<typeof getPublicBundleConfig>
NamedParameters<typeof getSrcRelativeFolderPath>
NamedParameters<typeof getTsFunction>
AuthorizationInfo
IPInfo
Information that is inferred from an IP
IResult
NamedParameters<typeof calculateDeviceName>
NamedParameters<typeof getAuthorizationInfo>
NamedParameters<typeof isGetEndpoint>
NamedParameters<typeof savePageVisit>
NamedParameters<typeof storeFunctionExecution>
FunctionData
FnMatch
NamedParameters<typeof chat>
NamedParameters<typeof converse>
NamedParameters<typeof doCli>
NamedParameters<typeof executeSdkFunction>
NamedParameters<typeof getCachedExportedFunctions>
NamedParameters<typeof getMenu>
NamedParameters<typeof getParameters>
NamedParameters<typeof getParametersAndExecute>
NamedParameters<typeof getSdkFunctionPaths>
NamedParameters<typeof listen>
ImportStatement
NamedParameters<typeof generateNamedIndex>
NamedParameters<typeof generateSimpleIndex>
NamedParameters<typeof isTestFn>
NamedParameters<typeof mapToImportStatement>
FunctionsPerClassification
relative
NamedParameters<typeof generateDbSdk>
NamedParameters<typeof generateDbSdkCli>
NamedParameters<typeof generateEnvSdks>
NamedParameters<typeof generateEnvSdksCli>
NamedParameters<typeof generateFunctionPathsSdk>
NamedParameters<typeof generateFunctionSdks>
NamedParameters<typeof generateFunctionSdksCli>
NamedParameters<typeof generateInterfacePathsSdk>
NamedParameters<typeof generateInterfacePathsSdkCli>
NamedParameters<typeof generateOperationsSdk>
NamedParameters<typeof generateOperationsSdkCli>
NamedParameters<typeof generateSdkApi>
NamedParameters<typeof generateSdkApiCli>
NamedParameters<typeof generateSdkApiWatcher>
NamedParameters<typeof generateSdkOperations>
NamedParameters<typeof generateSdkOperationsCli>
NamedParameters<typeof getFunctionSdksContent>
NamedParameters<typeof getSdkDescription>
NamedParameters<typeof getSdkFunctionsPerClassification>
NamedParameters<typeof isNonUiOperationBuild>
NamedParameters<typeof newEnvSdk>
NamedParameters<typeof newFunctionKeysSdkOperation>
NamedParameters<typeof newFunctionSdkOperation>
NamedParameters<typeof tsFunctionIsIndexable>
NamedParameters<typeof tsFunctionIsSdkable>
NamedParameters<typeof updateClassifications>
OperationClassificationObject
WatchEventType
Different event types for the watcher of the file system (chokidar)
- add: a file got created
- addDir: a folder got created
- change: a file changed
- unlink: a file got removed
- unlinkDir: a folder got removed
NamedParameters<typeof canSeeFile>
NamedParameters<typeof canSeeFileContent>
NamedParameters<typeof expandFrontmatter>
NamedParameters<typeof findClosestAbsolutePath>
NamedParameters<typeof getContextualPromptResults>
NamedParameters<typeof getContextualPrompts>
NamedParameters<typeof getContextualPromptsArray>
NamedParameters<typeof getFirstFile>
NamedParameters<typeof getFolderRelativeScopeDbFilePath>
NamedParameters<typeof getReaderPageProps>
NamedParameters<typeof readerPageGetStaticPaths>
NamedParameters<typeof readerPageGetStaticProps>
NamedParameters<typeof Dataset>
NamedParameters<typeof FileActions>
NamedParameters<typeof Menu>
NamedParameters<typeof PromptButton>
NamedParameters<typeof ReaderPage>
NamedParameters<typeof ReaderPageNext>
NamedParameters<typeof setConfig>
NamedParameters<typeof SettingsPage>
NamedParameters<typeof useAdmin>
NamedParameters<typeof useFileActions>
NamedParameters<typeof useQueryPath>
NamedParameters<typeof useVariantResult>
NamedParameters<typeof VariantSelector>
Address
The old location interface I made up had multiple references, but I don't think this is needed. We can simply use the category interface
export interface Location extends SlugModelType { continent_locationSlug: Slug; country_locationSlug?: Slug; regionProvinceState_locationSlug?: Slug; city_locationSlug?: Slug; }
Area
in the UI this should be a special input type, where you can draw a polygon or circles on the map and the center will be calculated
Circle
City
Country
DistantObject
Location
locations are hierarchically categorized pieces of information.
a city can refer to the area, the area can refer the the country, the country to the continent, etc.
there are multiple ways to categorize it, but this depends on the application.
Polygon
Position
SpacePosition
IDK HOW TO DO DIS :(
NamedParameters<typeof getAllOperationSourcePaths>
NamedParameters<typeof getImportedDependencies>
NamedParameters<typeof getPackage>
NamedParameters<typeof isAbsoluteImport>
NamedParameters<typeof calculatePackageJsonDependencies>
NamedParameters<typeof findAndWriteImportsExports>
NamedParameters<typeof getImportsExportsTest>
NamedParameters<typeof getPackageNameFromAbsoluteImport>
NamedParameters<typeof isAbsoluteImportBuiltin>
NamedParameters<typeof isImportFromOptionalFile>
NamedParameters<typeof isImportGenerated>
NamedParameters<typeof writeResult>
NamedParameters<typeof getOperationBins>
NamedParameters<typeof getOperationPackageName>
NamedParameters<typeof getPackageJson>
NamedParameters<typeof getPackageSourcePaths>
ModuleKind
ModuleResolutionKind
NamedParameters<typeof findOperationBasePath>
NamedParameters<typeof findOperationBasePathWithClassification>
NamedParameters<typeof getAllPackageJsonDependencies>
NamedParameters<typeof getCommonAncestor>
NamedParameters<typeof getOperationClassification>
NamedParameters<typeof getOperationClassificationObject>
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 getSubExtensions>
NamedParameters<typeof hasDependency>
NamedParameters<typeof hasProjectRootFile>
NamedParameters<typeof isBundle>
NamedParameters<typeof isOperation>
NamedParameters<typeof isUiOperation>
NamedParameters<typeof isWorkspaceRoot>
NamedParameters<typeof packageCompilesTs>
NamedParameters<typeof tsconfigCompilesEsm>
NamedParameters<typeof getTsConfig>
CommentRange
CompleteOperationPathParse
Config
JSONSchema7
MorphInterfaceInfo
NamedParameters<typeof cli>
NamedParameters<typeof findCommentTypes>
NamedParameters<typeof generateSchema>
NamedParameters<typeof getDbStorageMethod>
NamedParameters<typeof getFrontmatterDbStorageMethod>
NamedParameters<typeof getIndexId>
NamedParameters<typeof getMaxIndentationDepth>
NamedParameters<typeof getNumberOfLines>
NamedParameters<typeof getParametersFromInterfaces>
NamedParameters<typeof getPossibleRefs>
NamedParameters<typeof getSizeSummary>
NamedParameters<typeof getSpecialExtensionDbStorageMethod>
NamedParameters<typeof getValidatedOperationPathParse>
NamedParameters<typeof hasDefinition>
NamedParameters<typeof hasTypescriptFileChanged>
NamedParameters<typeof indexTypescript>
NamedParameters<typeof indexTypescriptFile>
NamedParameters<typeof makeTsComment>
NamedParameters<typeof schemaToTsInterface>
NamedParameters<typeof tryCreateSchema>
Project
Project that holds source files.
NamedParameters<typeof fetchWithTimeout>
NamedParameters<typeof isOnline>
NamedParameters<typeof isSystemBusy>
NamedParameters<typeof concatenate>
NamedParameters<typeof getParameterAtLocation>
NamedParameters<typeof hasAllLetters>
NamedParameters<typeof isArrayEqual>
NamedParameters<typeof mergeNestedObjectTest>
NamedParameters<typeof replaceLastOccurence>
NamedParameters<typeof reverseString>
NamedParameters<typeof trimSlashes>
O
NamedParameters<typeof getSimpleJsonString>
NamedParameters<typeof dev>
NamedParameters<typeof devCli>
NamedParameters<typeof benchmark>
NamedParameters<typeof exploreOperationFolders>
NamedParameters<typeof findAllDocsFolderPaths>
NamedParameters<typeof findAllFoldersWithName>
NamedParameters<typeof findAllPackages>
NamedParameters<typeof findAllTodoFolderPaths>
NamedParameters<typeof getArgument>
NamedParameters<typeof getFolderTypescriptFiles>
NamedParameters<typeof pathArrayIsOperation>
NamedParameters<typeof runTestsForOperation>
NamedParameters<typeof sum>
KeyValueMarkdownParse
MarkdownChunk
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
Language
all currently supported languages
MappedWordMatrix
Mapped Object for performance reasons
MarkdownWord
Should later be migrated to WordMatrix
NepaliEnglishTranslationMatrix
Statement
Statement model:
Motivation:
- create a database of the belief system of one or multiple entities (Person, Algorithm, species, etc.)
- use this belief system for fact-checking, differentiative checking, value checking, and more.
TokiPonaMatrix
DEPRECATED: to be migrated to WordMatrix
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
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
NamedParameters<typeof Header>
NamedParameters<typeof PingApi>
NamedParameters<typeof preIndexLint>
LockInfo
NamedParameters<typeof isLocked>
NamedParameters<typeof lock>
NamedParameters<typeof unlock>
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
MailDataFromOptional
From is optional for sending an email because it will be filled in by the OsConfig default.
NamedParameters<typeof sendMail>
NamedParameters<typeof makeFileType>
CodeblockMode
MarkdownParse
MarkdownParseRenderConfig
NamedParameters<typeof getRealSrc>
NamedParameters<typeof getUrlFromRelativeUrl>
NamedParameters<typeof getYoutubeId>
NamedParameters<typeof MarkdownCodeblock>
NamedParameters<typeof MarkdownContent>
NamedParameters<typeof MarkdownContentRender>
NamedParameters<typeof Parameter>
NamedParameters<typeof renderFrontmatter>
NamedParameters<typeof renderMarkdownChunk>
NamedParameters<typeof renderMarkdownContent>
NamedParameters<typeof renderMarkdownParse>
NamedParameters<typeof renderMarkdownTitle>
NamedParameters<typeof useOpenHashDetails>
MarkdownParagraphChunk
MarkdownParseConfig
MarkdownReference
NamedParameters<typeof chunkToStringRecursively>
NamedParameters<typeof getChunkParagraphsRecursively>
NamedParameters<typeof getImplicitId>
NamedParameters<typeof getMarkdownIntro>
NamedParameters<typeof getMarkdownParseParagraphs>
NamedParameters<typeof getMarkdownReferencePaths>
NamedParameters<typeof getMarkdownReferencesFromParagraph>
NamedParameters<typeof markdownParseToMarkdownString>
NamedParameters<typeof markdownParseToMarkdownStringFromContent>
NamedParameters<typeof mdContentParseRecursively>
NamedParameters<typeof mdToJsonParse>
NamedParameters<typeof parseFrontmatterMarkdownString>
NamedParameters<typeof parseMarkdownParagraph>
NamedParameters<typeof parseMdToChunks>
NamedParameters<typeof removeHeaderPrefix>
DependantCountObject
interface that lets us count the amount of dependant files in different item types
JsonPart
MergedMarkdownOutlineUrl
NamedParameters<typeof addDependantCount>
NamedParameters<typeof bundleFolderWithMarkdown>
NamedParameters<typeof bundleToBookMarkdown>
NamedParameters<typeof bundleToMarkdown>
NamedParameters<typeof concatMarkdownFiles>
NamedParameters<typeof createMinimizedSection>
NamedParameters<typeof createMinimizedSectionMarkdown>
NamedParameters<typeof deployToVercel>
NamedParameters<typeof emailMarkdownParse>
NamedParameters<typeof generateStaticSite>
NamedParameters<typeof getJsonSchemaSummary>
NamedParameters<typeof getMarkdownContents>
NamedParameters<typeof getMergedMarkdownOutlineUrl>
NamedParameters<typeof getOperationSummary>
NamedParameters<typeof getOutline>
NamedParameters<typeof getPublicMarkdownNestedPathObject>
NamedParameters<typeof getTitlesRecursively>
NamedParameters<typeof getTypeDescriptorRecursive>
NamedParameters<typeof isConventionFileStatement>
NamedParameters<typeof isUpperCase>
NamedParameters<typeof makeOutlineMarkdownString>
NamedParameters<typeof makePropertiesTable>
NamedParameters<typeof markdownChunksToMarkdownStringRecursive>
NamedParameters<typeof markdownChunkToMarkdownStringRecursive>
NamedParameters<typeof markdownToSayable>
NamedParameters<typeof mdToPdf>
NamedParameters<typeof mergeMarkdownParse>
NamedParameters<typeof noNewlines>
NamedParameters<typeof operationRadio>
NamedParameters<typeof operationToMarkdown>
NamedParameters<typeof print>
NamedParameters<typeof printNestedTitles>
NamedParameters<typeof projectToMarkdown>
NamedParameters<typeof propertyToTableRow>
NamedParameters<typeof sayablesToMp3>
NamedParameters<typeof selectRandomOperation>
NamedParameters<typeof simplifiedSchemaToMarkdownString>
NamedParameters<typeof statementItemToMarkdown>
NamedParameters<typeof tsFunctionToMarkdownString>
NamedParameters<typeof tsInterfaceToMarkdownString>
NamedParameters<typeof tsVariableToMarkdownString>
NamedParameters<typeof upMarkdownChunkLevelRecursively>
NestedTitle
OperationSummary
Sayable
GOAL:
- distribute read only (and audio only) material of my codebase
- it is also a fundament for other applications in the future
StatementItem
MarkdownCallToAction
NamedParameters<typeof copyStaticAssets>
NamedParameters<typeof copyStaticAssetsCli>
NamedParameters<typeof docsGetStaticPaths>
NamedParameters<typeof docsGetStaticProps>
NamedParameters<typeof getAllMarkdownReaderPages>
NamedParameters<typeof getChildren>
NamedParameters<typeof getFolderExplorationInfo>
NamedParameters<typeof getMarkdownModelPages>
NamedParameters<typeof getMarkdownPageInfo>
NamedParameters<typeof getMarkdownReaderQueryPaths>
NamedParameters<typeof getOperationPages>
NamedParameters<typeof getReaderTodoPages>
NamedParameters<typeof markdownReaderGetStaticPaths>
NamedParameters<typeof markdownReaderGetStaticProps>
NamedParameters<typeof markdownReaderGetStaticPropsFromPages>
NamedParameters<typeof getQueryPath>
ParsedUrlQuery
NestedWebPage
Only used for menu, so can be undefined because it shouldn't be available
ReaderPageContentProps
CreatorMarkdownFile
CreatorMarkdownProperties
ExtendedMarkdownProperties
Some properties for on any MarkdownModelType model that are quite general purpose and yet aren't included into the MarkdownModel
because we may not always want them.
MarkdownContentLevel
0 is a paragraph 1-6 is h1 until h6
MarkdownEmbed
Anything in the format 
NB: I need to be very clear how this one works
MarkdownHeader
MarkdownIndex
Every time a markdown file comes in (watcher), can we do some default functions and GPT for it.
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
MarkdownParagraph
NamedParameters<typeof markdownParseToMarkdownModelType>
NamedParameters<typeof parseMarkdownModelTimestamp>
NamedParameters<typeof tryParseDate>
PostableProperties
Postable
is not extending a modeltype anymore, it can be attached to any MarkdownModelType model
TextJson
TODO: Rename
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!
WebMarkdownProperties
WebsiteHeader
WebsiteHeaderProperties
NamedParameters<typeof findCodeblocks>
NamedParameters<typeof findCodespans>
NamedParameters<typeof findEmbeds>
NamedParameters<typeof findEmbedsTest>
NamedParameters<typeof findLinks>
NamedParameters<typeof cleanupTimer>
NamedParameters<typeof generateUniqueId>
NamedParameters<typeof getNewPerformance>
NamedParameters<typeof minifyBuild>
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
DeletedAt
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>
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
NamedParameters<typeof getAssetInputType>
NamedParameters<typeof getParameterContentType>
NamedParameters<typeof isCalculatedParameter>
NamedParameters<typeof isGeneratedParameterName>
PatternMatcher
ExpandedObject
NamedParameters<typeof useExpanded>
NamedParameters<typeof getAvailableOperationName>
NamedParameters<typeof newOperation>
NamedParameters<typeof newOperationCli>
NamedParameters<typeof newOperationWithFiles>
NamedParameters<typeof newTemplate>
NamedParameters<typeof newTemplateCli>
NamedParameters<typeof getFullPath>
NamedParameters<typeof getLastPathsChunk>
NamedParameters<typeof usePath>
PreviewData
NamedParameters<typeof nodemon>
NamedParameters<typeof getDependenciesSummary>
NamedParameters<typeof getOperationMetaData>
NamedParameters<typeof recalculateOperationIndexJson>
OperationMetaData
NamedParameters<typeof parsePrimitive>
NamedParameters<typeof parsePrimitiveArray>
NamedParameters<typeof parsePrimitiveBoolean>
NamedParameters<typeof parsePrimitiveString>
PrimitiveResult
NamedParameters<typeof byteCount>
NamedParameters<typeof getFolderSummary>
NamedParameters<typeof sumSizeSummary>
NamedParameters<typeof calculatePathMetaData>
NamedParameters<typeof categorizeFiles>
NamedParameters<typeof getPathMainComment>
NamedParameters<typeof addPeer>
NamedParameters<typeof addPeerMessage>
NamedParameters<typeof augmentDevice>
NamedParameters<typeof deviceGetAppsCalculated>
NamedParameters<typeof getAllAppOperations>
NamedParameters<typeof getAugmentedPersons>
NamedParameters<typeof getFirstEmoji>
NamedParameters<typeof getNestedPathObject>
NamedParameters<typeof getPeerMessages>
NamedParameters<typeof getPeerPeople>
NamedParameters<typeof getPeersFromPeersRecursively>
NamedParameters<typeof getPublicFolderNestedPathObject>
NamedParameters<typeof getPublicFolderNestedPathObjectFromPeer>
NamedParameters<typeof getPublicPeers>
NamedParameters<typeof isPortUsed>
NamedParameters<typeof lateFetchPeerMessageSync>
NamedParameters<typeof ping>
NamedParameters<typeof proactivePushAddPeerMessage>
NamedParameters<typeof removePeer>
NamedParameters<typeof sortDevices>
NamedParameters<typeof updatePeer>
Person
Model to describe a human person. This model gathers and stores all persons around the world, except for yourself. Kind of a user-like model...
The data inside this model is coming from the Person itself but also from the owner of the OS server. It should be possible for the person to automatically push information into any of their instances on any server, but the OS owner can augment this.
NB: This is a DefaultModelType, which means name and slug need not to be unique, but it is highly preferred.
Achievement
AppOperation
AuthenticationMethod
Developer
HandleObject
can be used on multiple models.
IBrowser
NB: copied from ua-parser-js ^1.0.32 because they weren't indexed
ICPU
IDevice
IEngine
Interest
IOS
MediaCredential
PageVisit
Any visit tracked based on a server request
NB: TODO: it might occur that a page fetches multiple api endpoints, which will create duplicate data here. How do I fix that?
PeerMessage
DEPRECTATED: should be replaced by MediaPost. MediaPost can have many channels, and this is just one of them
Persona
Highly private model.
Configuration for a person identity that you say that is you.
As a OS user you can have multiple personas between which you can easily switch.
The difference from Person is that Person stores other people, whereas Persona stores different identities you give to yourself.
NB: brands should also be able to be personas, and since some brands are shared between people, you should be able to share Persona's with other Persons into their OS...
Persona: A persona, depending on the context, is the public image of one's personality, the social role that one adopts, or simply a fictional character. The word derives from Latin, where it originally referred to a theatrical mask. On the social web, users develop virtual personas as online identities. (Wikipedia)
PersonInformation
categorisation model for informormation about a person
- the keys are the things you want to store
- the values are the descriptions of the thing to be stored
- the categories can organise the things you want to store better
PersonInformationValue
key value data storage model for information about a person
- the filename must identify the person this is about (
personSlug
) - the categories are the different people and the person information categories
- the keys are the person information datapoints
- the values are the values of the datapoints that you stored about this user
Example:
the file person-information-values/abraham-lincoln.md
could contain something like this:
# life
born: 11-01-1777
died: 20-12-1812
# identification
firstName: Abraham
lastName: Lincoln
NB: It's not going to be easy to keep this model in sync with the model it relies on!
TODO: figure out if this kan be a KeyValueMarkdownModelType or MarkdownModelType
PersonPlatformConnection
Forgive the long name, but this model connects the user with the people they have a connection with on specific platforms
e.g. John Doe is connected with me on LinkedIn with the handle johndoe123
Not sure if this is the best way to do this, there may be limitations... For example, both I and the other person can have multiple social media accounts on a single platform
PersonSocialMedia
media (mediums) that a person uses, e.g. linkedin, twitter, whatsapp, sms, calling, and irl
Platform
Collection of platforms that can be found on the internet
e.g. linkedin would have userUrlPrefix: https://linkedin.com/in/
and userUrlSuffix:""
PublicPersonKeys
NamedParameters<typeof getPrimaryPersona>
NamedParameters<typeof isPlural>
NamedParameters<typeof isSingular>
NamedParameters<typeof pluralize>
NamedParameters<typeof singularize>
NamedParameters<typeof deleteApp>
NamedParameters<typeof deleteAppCli>
NamedParameters<typeof listApps>
NamedParameters<typeof listAppsCli>
NamedParameters<typeof logApp>
NamedParameters<typeof logTableObject>
NamedParameters<typeof pm2Connect>
NamedParameters<typeof restartApp>
NamedParameters<typeof restartAppCli>
NamedParameters<typeof startApp>
NamedParameters<typeof startAppCli>
NamedParameters<typeof stopAllAppsExcept>
NamedParameters<typeof stopAllAppsExceptCli>
NamedParameters<typeof stopApps>
NamedParameters<typeof stopAppsCli>
NamedParameters<typeof ContextualPromptResultsTab>
NamedParameters<typeof FilePromptSelect>
Browser
A Browser is created when Puppeteer connects to a Chromium instance, either through {@link PuppeteerNode.launch } or {@link Puppeteer.connect } .
FacebookLoginPropsType
GmailLoginPropsType
NamedParameters<typeof getChromeExecutablePath>
NamedParameters<typeof clickOnSpanTag>
NamedParameters<typeof delay>
NamedParameters<typeof facebookLogin>
NamedParameters<typeof foundOrNot>
NamedParameters<typeof foundOrNotXpath>
NamedParameters<typeof getBrowser>
NamedParameters<typeof getBrowserPageById>
NamedParameters<typeof getBrowserTabs>
NamedParameters<typeof getConnectedBrowsers>
NamedParameters<typeof getIdlePage>
NamedParameters<typeof getNewPage>
NamedParameters<typeof gmailLogin>
NamedParameters<typeof isCaptchaExist>
NamedParameters<typeof logConsoleIfDebug>
NamedParameters<typeof openMultiTabs>
NamedParameters<typeof openNewBrowser>
NamedParameters<typeof openNewBrowserOnChildProcess>
NamedParameters<typeof openPage>
NamedParameters<typeof racePromises>
NamedParameters<typeof retryClickAndWaitSelector>
NamedParameters<typeof retryWaitSelector>
NamedParameters<typeof runBrowser>
NamedParameters<typeof setBrowserPageIdle>
NamedParameters<typeof setBrowserSession>
NamedParameters<typeof setInnerHtml>
NamedParameters<typeof solveReptcha>
NamedParameters<typeof trueClick>
NamedParameters<typeof twitterLogin>
NamedParameters<typeof typeInTheInputField>
NamedParameters<typeof typeOnTheTargetWithXpathSelector>
NamedParameters<typeof waitMilliseconds>
NewPageProps
OpenMultiTabProps
Queue
Model for a Queue system so you can execute functions when ram/internet is available
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 Modal>
NamedParameters<typeof ModalProvider>
NamedParameters<typeof useModal>
NamedParameters<typeof useModalState>
NamedParameters<typeof useNavigation>
NamedParameters<typeof useRouter>
ID
NamedParameters<typeof getItem>
NamedParameters<typeof getItemSync>
NamedParameters<typeof setItem>
NamedParameters<typeof readCsvFile>
NamedParameters<typeof readCsvFileSync>
NamedParameters<typeof readJsonFile>
NamedParameters<typeof readJsonFileSync>
NamedParameters<typeof readProjectRelativeJsonFile>
NamedParameters<typeof readKvmdFile>
NamedParameters<typeof readMarkdownFile>
NamedParameters<typeof readMarkdownFileToModel>
IndexFilter
NamedParameters<typeof getFolderTypescriptIndex>
NamedParameters<typeof getOperationIndexModel>
NamedParameters<typeof readTypescriptFile>
NamedParameters<typeof uniqueNames>
FilePage
NamedParameters<typeof AugmentedWordComponent>
NamedParameters<typeof Dictionary>
NamedParameters<typeof DocsReaderLayout>
NamedParameters<typeof Layout>
NamedParameters<typeof ReaderPageContent>
NamedParameters<typeof ReaderPageHeader>
NamedParameters<typeof clearTsDatabase>
NamedParameters<typeof executeCommandQuietUnlessFail>
NamedParameters<typeof exitIfProcessDependenciesChanged>
NamedParameters<typeof generateJsonSchemas>
NamedParameters<typeof getAllDbModels>
NamedParameters<typeof getFileIds>
NamedParameters<typeof getIndexFileIds>
NamedParameters<typeof getSrcIds>
NamedParameters<typeof isOperationBuildNeeded>
NamedParameters<typeof isSdkOperation>
NamedParameters<typeof rebuildAllOperations>
NamedParameters<typeof rebuildOperation>
NamedParameters<typeof rebuildOperationCli>
NamedParameters<typeof shouldSkip>
NamedParameters<typeof yarnBuild>
NamedParameters<typeof getMenuPagesObject>
NamedParameters<typeof queryPathsArrayToNestedPathObject>
NamedParameters<typeof reduceQueryPathsRecursively>
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 findTemplates>
NamedParameters<typeof isEqualArray>
NamedParameters<typeof renameTemplateFiles>
NamedParameters<typeof renameTemplateToNormalFile>
NamedParameters<typeof renameToTemplateFile>
NamedParameters<typeof bodyFromQueryString>
NamedParameters<typeof getFirstQueryStrings>
NamedParameters<typeof getQueryPart>
NamedParameters<typeof isValidEntry>
NamedParameters<typeof toQueryString>
QueryableObject
NamedParameters<typeof runChildProcess>
NamedParameters<typeof sayDutch>
NamedParameters<typeof sayLanguage>
NamedParameters<typeof sayNepali>
NamedParameters<typeof saySomething>
NamedParameters<typeof textToMp3>
SayLanguageEnum
SayOptions
JSONSchema7Definition
JSON Schema v7
NamedParameters<typeof findFirstCommentTypes>
NamedParameters<typeof getDataParameterNames>
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
NamedParameters<typeof addAuthenticationMethod>
NamedParameters<typeof addDeviceAuthenticationMethodConfirm>
NamedParameters<typeof addDeviceAuthenticationMethodWithContext>
NamedParameters<typeof addPersonAuthenticationMethodWithContext>
NamedParameters<typeof findAuthenticatedPersonWithHandle>
NamedParameters<typeof findLoggedinPersonsWithContext>
NamedParameters<typeof getMeWithContext>
NamedParameters<typeof getPublicPerson>
NamedParameters<typeof getPublicPersons>
NamedParameters<typeof isPhoneNumber>
NamedParameters<typeof isValidPassword>
NamedParameters<typeof loginWithContext>
NamedParameters<typeof loginWithPasswordWithContext>
NamedParameters<typeof logoutWithContext>
NamedParameters<typeof removeDeviceAuthenticationMethodWithContext>
NamedParameters<typeof removePersonAuthenticationMethodWithContext>
NamedParameters<typeof signupWithContext>
NamedParameters<typeof signupWithPasswordWithContext>
NamedParameters<typeof switchCurrentPersonWithContext>
NamedParameters<typeof updateMeWithContext>
SignupPersonData
NamedParameters<typeof setJsonKey>
NamedParameters<typeof setKeyAtLocation>
NamedParameters<typeof Share>
NamedParameters<typeof useAllText>
NamedParameters<typeof useLastSelection>
NamedParameters<typeof useProjectRelativeScreenshot>
NamedParameters<typeof useScreenshot>
NamedParameters<typeof findAudioWithViewsArray>
NamedParameters<typeof markdownParseToShortMarkdown>
NamedParameters<typeof shortMarkdownToMarkdownParse>
AudioWithViews
DialogueSentence
NamedParameters<typeof augmentShortMarkdown>
NamedParameters<typeof fetchVoices>
NamedParameters<typeof fetchVoicesTest>
NamedParameters<typeof generateAugmentedShortMarkdown>
NamedParameters<typeof generateAugmentedShortMarkdownTest>
NamedParameters<typeof getOrGenerateShortMarkdown>
NamedParameters<typeof parseDialogue>
NamedParameters<typeof uberduckGetPath>
NamedParameters<typeof uberduckSpeak>
NamedParameters<typeof voiceCloneDialogue>
ShortMarkdown
AudioTrackItem
ViewEmbed
NamedParameters<typeof ShortMarkdownPlayer>
NamedParameters<typeof useMultiAudio>
NamedParameters<typeof getReferencedModelDataItem>
NamedParameters<typeof useReferencableModelData>
ReferencedModelDataItem
ReferenceItem
ReferenceItemsObject
NamedParameters<typeof sendDailyAlarmSms>
NamedParameters<typeof sendSms>
MediaChannel
channel where messages can be posted to
examples:
- facebook group
- slack channel
- whatsapp pm
- facebook pm
MediaPlatformEnum
MediaPost
Post/message on any medium.
SocialMediaPostTypeReturnType
JSONValue
NamedParameters<typeof objectStringToJson>
NamedParameters<typeof parseIfJson>
NamedParameters<typeof parsePrimitiveJson>
NamedParameters<typeof stringToJson>
NamedParameters<typeof SwipeHomepage>
SwipeItem
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 time>
ReviewSummary
SelfSprintReview
GOAL:
- provide a good way for freelancers and students to self-assess
- structure the data to provide tools for self-analysis
TODO: PREREQUISITE:
- auth layer
- p2p
- create a model-agnostic-ui that renders this type of models nicely (many checkmarks, some sliders, some descriptions). can simply be converted into text for the most part
- make the DB crud component
- which also allows extra columns
- which also has an option to use the model-agnostic-ui
- add Datasets support to DB crud
- make sure the form shows nicely
- slider component and convention
- show description by ensuring that, if the trimmed description is an empty string, it shows everything on all lines after, until the next variable
- monetisation
THOUGHTS:
- this was just one hour of work, and it kind of is a product (given I make all the general purpose prerequisites). I can make it a bundle that devs can install and BOOM! you got a SaaS... just charge 1$ per entry xD
- think about other things that can be assessed, can/should they be automated too? not only for teams, also for intimate groups of people to assess private things, also for yourself completely
- if I have more things like this, which are basically scoring sheets, I can easily reuse the statistics part of the UI that I make for this
TODO: CUSTOM:
- make a
ui-web
operation that has just this crud (or add to the Todo UI) - add nice flow for showing the "coder of the week"
- add a column to share an item on social media if it's your own (may be super reusable too)
- later add things like summaries, history, comparisons, insights (but do it as generic as possible)
- later provide more auto-filled datapoints (xyzIndexed) for different things
- later let user auto-share things with the marketstack xD
SpecialKvmdModelType
Should be a model that can be taken from the database like kvmd, but for parsing, it needs its own parse methods (from and to json)
These methods can be given in the configuration of createDb.
These methods can be found.
Todo
The Todo KVMD model parses a TodoFile to find individual todos, their status, category, and more structured metadata.
Can be chosen to be used for a TodoFile to create an alternative UI
TodoFiles can be parsed to find this datastructure
Will be great for insights.
TodoFile
Any markdown file in the todo folder should become this model
TodoFileProperties
TodoOffer
Freelancers can offer their services for a todofile
TodoOfferStatus
Status of an offer to do some todolist
offered
: offer placed, has not been accepted yet. freelancer can still edit offer or remove itrejected
: offer can be rejected by admin (before accepting)canceled
: freelancer and admin can cancel an previously accepted offeraccepted
: offer is accepted by admintodo
: freelancer has said it still needs to be donedoing
freelancer has said it's in progressdone
freelancer said it's doneapproved
approved by admin, offer should become archived
TodoPriority
NamedParameters<typeof tryParseJson>
NamedParameters<typeof getAllTsMorphSourceFiles>
NamedParameters<typeof getTsMorphProject>
NamedParameters<typeof createCodeblockMarkdown>
CustomUrlStoreConfig
NamedParameters<typeof useCustomUrlStore>
NamedParameters<typeof getOpenableFilePath>
NamedParameters<typeof vscodeOpen>
OpenableFile
NamedParameters<typeof watchAll>
NamedParameters<typeof watchAllCli>
NamedParameters<typeof pickWatcher>
NamedParameters<typeof exitIfOperationsChange>
NamedParameters<typeof gitCommitAllCron>
NamedParameters<typeof watchOperations>
CrudPage
Data needed to make a WebPage
CustomWebPage
different kinds of WebPages
FileWebPage
FunctionFormPage
Data needed to make a WebPage
NamedParameters<typeof crudPageToWebPages>
NamedParameters<typeof functionFormPageToWebPage>
WriterWebPage
NamedParameters<typeof writeToAssets>
NamedParameters<typeof copyPath>
NamedParameters<typeof deleteFileOrFolder>
NamedParameters<typeof getFileContents>
NamedParameters<typeof getWriterWebPages>
NamedParameters<typeof getWriterWebPagesMenu>
NamedParameters<typeof movePath>
NamedParameters<typeof newFile>
NamedParameters<typeof newFolder>
NamedParameters<typeof processAssetUpload>
NamedParameters<typeof renameFileOrFolder>
NamedParameters<typeof saveFileContents>
NamedParameters<typeof trashFileOrFolder>
NamedParameters<typeof updateFrontmatter>
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 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
Dictionary
codestorys-web
NB: this is an experimental part of typerepo!
function-server
Server that exposes all typerepo api functions wrapped into easily accessible endpoints.
markdown-reader-web
search-web
Search everywhere
NB: This is an experimental part of typerepo!
todo-web
NB: This is an experimental part of typerepo!
writer-web
✍️ writer-web
codestorys-node
collect-static-assets
sdk-api
sdk-api-keys
sdk-db
This operation is used to collect all typebase database models in the entire project, and export them, wrapped in a DbModels
interface. This is needed for creating a function that can access the entire database (see database operation)
sdk-env-private
This operation contains all private environment variables that can be used on the frontend and backend of your application(s).
Generated for bundles (to be set in BundleConfig), manually set for King OS.
NB: make sure not to import this in any frontend operations, because it may contain private keys and other secrets!
sdk-env-public
This operation contains all public environment variables that can be used on the frontend and backend of your application(s).
Generated for bundles (to be set in BundleConfig), manually set for King OS.
sdk-function-paths
sdk-interface-paths
sdk-js
operation that imports all js
functions and variables in the entire project (OS or bundle) and exports an object that has all of them.
can be generated
sdk-operations
Generated operation that exports an object that contains all names of all operations as keys, and all project relative paths to those operations as values.
Needed to find files more quickly in a more performant way.
When moving operations around, ensure to regenerate this to avoid conflicts.
sdk-ui
make-codestory
ai-functions-node
ai-types
all
This operation contains a lot of different functions that can help you to execute different things on all operations.
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-store
api-types
api-related types needed for the api operation
apps-menu
Please set a description for this operation in OPERATION.md
ask
asset-functions-js
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-functions-node
asset-input
This component lets you easily add asset input that includes upload with the typerepo
server standard (function-server)
Add the css to your web project: import "asset-input/css.css";
asset-type
All types related to asset upload
asset-view
AssetView
shows an asset. Every file-format has a different way to be rendered.
augmented-word-node
augmented-word-types
auth-types
authentication
big-button
breadcrumbs
frontend component to show a file location in a nice way (breadcrumbs)
browser-types
bundle-types
bundle-util
chatgpt-controller
child-process-helper
cleanup-typescript-database
Collection of functions to cleanup the typescript database (all typescript related models)
clickable-icon
code-types
comment-util
compile-typescript
context-menu
convert-case
cool-toast
csv-util
database
Operation that can be used within any typerepo to interact with the fs-orm (typebase) database. Relies on sdk-db (where your models should be summarized)
db-crud
db-recipes
Useful library of functions that wrap the fs-orm database.
TODO: should probably be split up further to differentiate between db-ui functions and a more general purpose library
db-util
docs-get-pages
encrypt-password
explore-project
explore-project explores the whole OS or project, so information about the project can be shown in a UI or used in another way
fancy-loader
ffmpeg-util
file-explorer-open
file-icons
Exposes funcitons to get a nice emoji file-icon for any file type
file-search
Exposes functions to easily create a file-search menu in your react-app
file-tabs
Open files as tabs so you can come back there...
file-writer
Please set a description for this operation in OPERATION.md
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/
filename-conventions
Any functions and variables related to filename conventions
find-all-dependency-operations
folder-get-updated-at
Get last updated file updatedAt time in whole folder, recursively
frontmatter-util
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
function-context-type
function-form
Component that lets you easily create a frontend form for any function in your project (both backend and frontend functions)
function-functions-node
function-server-endpoints
Wraps all functions found in sdk-api
and creates server
endpoints for them. Besides simply wrapping them into an endpoint, it also adds some extra layers to every function.
function-types
function-util
Exposes clis that make it possible to interact with all King OS functions through the CLI in different ways
generate-index
generate-sdk-operations
This operation contains different functions to generate all possible sdk operations according to the King OS convention.
Ensure to apply all King OS conventions when generating these operations, because otherwise they may contain typescript errors and this may result in runtime errors.
generative-functions-node
generative-ui
geo-types
get-all-operation-source-paths
returns src folder paths of all operations
get-imported-dependencies
get-imports-exports
get-package-json
get-package-source-paths
Returns an array of absolute file paths of (typescript) files in the src of your operation
get-path
Useful functions to get paths within King OS.
Depends on sdk-operations, which makes it only work inside of a typerepo.
get-ts-config
Gets the TsConfig given a path to an operation
hotkeys
Operation exposing any utility function related to hotkeys in the browser
index-typescript
This repo is used to generate the typescript index.
Some important conventions I'm applying:
-
The generated index doesn't know the absolute location, which makes it possible to move around the Project in the OS
-
The generated index only tells you information about this very operation. All links with other operations should be done in postprocessing
-
Every generated index has an
IndexId
is-online
is-system-busy
js-util
json-util
k-dev
CLI that starts a watcher that watches all your operations for changes and rebuilds the operation on every change (compiling and indexing the altered file(s))
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)
k-test
key-value-markdown-js
labeled-button
language-types
layout
lint
lock-system
lock-util
log
Log a message with a special type
make-file-type
exposes makeFileType
, a function that helped turning a path into a specific type. Was previously used for things like watching, but this is probably not needed anymore.
make-test
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-parsings
markdown-reader-functions
markdown-reader-functions-js
markdown-reader-types
markdown-types
marked-util
matter-types
measure-performance
menu
minify-build
model-types
name-conventions
Any functions and variables related to variable declaration naming conventions
nested-menu
nested-menu-types
new-template
Package to create a new King OS template (template or some other boilerplate)
next-a-link
next-paths
operation that helps you to render your own paths in a next project without using their pages convention
next-types
nodemon
one-by-one
operation-util
Operation with utility functions to calculate things about operations and alter operation-index.
parse-primitive
path-util
Gets insightful information about any file or folder (path)
peer-functions
peer-types
persona-functions-node
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
pm2-util
Wrapper around pm2 to easily manage proceses within King OS
port-conventions
Any functions and variables related to port conventions
prompt-components
puppeteer-utils
queue-types
react-with-native
HTML elements with React Native capabilities.
react-with-native-alert
TODO: NB: seems not to work right now in a new template! Fix it
react-with-native-form
Create forms, fast
react-with-native-form-asset-input
Please set a description for this operation in OPERATION.md
react-with-native-form-inputs
react-with-native-modal
react-with-native-notification
Makes it possible to receive notifications in both react and react-native.
react-with-native-router
react-with-native-select
react-with-native-store
Simple localStorage/asyncStorage-based and fully typed redux replacement with global persisted storage by default for react and react-native apps.
react-with-native-table
react-with-native-ui
Simple basic Tailwind class strings for sensible UI components
read-csv-file
read-json-file
read-kvmd-file
read-markdown-file
read-typescript-file
reader-ui
rebuild-operation
Operation that makes it possible to rebuild an operation (re-index, re-build, etc.)
recursive-types
recursive-util
rename-template-files
Rename template files to their original name
Useful when you want to apply a template to create a new starting point for something
rest-util
run-child-process
say
Operation that contains multiple functions that wrap the say cli on MacOS to let the device speak out text.
Can later be extended to wrap other clis or even api's.
Should also be extended to work on multiple operating systems.
schema-util
It's hard to work with them if you don't know what means what. In this operation I'll summarize everything and give examples.
search
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.
server-login
This operation exposes rudimentary functions to set cookies from the backend. We require cookies in order to authenticate a user for GET requests. Cookies are sent to the server for every request and are a safer way, because they are not part of the URL that can be found in the browser history.
This thing is far from finished, see todo/
for what needs to be done.
set-json-key
Useful functions to alter JSON files (can be used both with node or with a CLI)
share
short-markdown-parser-js
short-markdown-parser-node
short-markdown-types
short-markdown-writer-input
simplified-schema-form
component that generates a form using react-with-native and a SimplifiedSchema. Can obtain any JSON object from the user.
sms
social-media-types
I want a type interface collection that is able to collect all data from all social networks and put them together.
string-to-json
Parser functions to parse strings (that can be inputted in the command-line) into objects (that can be read in functions)
swipe-homepage
tabs
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.
time
import { setRandomTimezone } from "set-random-timezone";
To enable possibility to change the timezone in the OS, this is the actually correct time, assuming we are in timezone GMT+1
timeline
- find statements in markdown (
> xxx
) - find functions, interfaces, variables and show them
- find todos inside (doc) comments and the file around it
- find type build errors from typescript and the file around it
- show the above in a tik-tok kinda timeline that you can swipe (or click to enter the codebase)
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/
todo-types
types related to the upcoming todo-ui
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.
tooltip
Please set a description for this operation in OPERATION.md
try-parse-json
ts-morph-util
ui-util
use-on-screen
use-url-store
vscode-open
function to open a file in VSCode (wraps code
cli command)
watch-all
watch-folders
General purpose functions to watch folder(s) for changes on any operating system
watch-operations
Calls rebuildOperation for every filechange in every operation watched
watch-types
webpage-types
write-to-assets
Function to write anything to assets.
writer-functions
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
HomePage
Layout
progress
queryClient
executeCronFunction
NB: cron functions cannot have parameters
runFunctionServerCli
Argument:
- pass true if you want the server to be watching
- pass true true if you want the server to be watching and this is a restart (so don't launch things like browser)
- if you pass nothing, there will be no browser start and no watcher
runFunctionServerDevCli
runFunctionServerDev
runFunctionServer
runs sdk api server using "server" package.
server will be exposed on port 42000
scheduleCronJobs
scheduleObject
For every RunEveryPeriodEnum, this object provides the interval cronExpression
string for node-cron
startSearchWebIfAvailable
DbAndUpsert
This should catch all dbQueryPaths because those aren't default ones
DbLayout
fitViewOptions
Flow
FormTab
Uses <FunctionForm>
component
Executes the function directly or through API (depending on whether or not it is a node-only-function or bare JS)
Don't show this tab for JSX components
FunctionExecutionTable
FunctionLayout
FunctionPage
functionWebInitialValues
getAllSearchResults
Searches filepaths, then links to any ui-web
that has this file available as a page, or VSCode.
For this we need to get the MarkdownReaderPage
and other pages that are available in ui's and see the files they are linked to.
I want to be able to:
- search functions, interfaces, variables
- search operations
- search markdown files, anywhere
- search db-ui models
But there's more. To make a good serach...
TODO:
- gather everything i've made before about search
getTimelineItems
initialEdges
initialNodes
initialValues
mindspaces
quotes
ReaderPageLayout
SearchBar
searchGetStaticProps
SearchResultComponent
If you click on a site that up and running, it should startup via pm2 before being redirected there
SearchResultPage
{ StoreProvider, useStore }
Test
FileWriterPage
MyLayout
TodoMenuHeader
codestoriesGetPages
codestoriesGetStaticPaths
Function that tells Next.js what the pages are that need to be statically generated
codestoriesGetStaticProps
copyCopyPairs
copyReaderStaticAssets
findReaderStaticAssets
markdown-renderer turns a relative link into this: ?mdpath=x&relativePath=y
for static, we need to turn it into something similar, but we need to guarantee no file collisions. simple!
we can just take the project-relative file path of the asset, and put it in /public/images in next.js. the final url of the asset in public next.js then becomes images/[path/to/asset.jpg]
findStaticAssets
Returns the absolute paths of all static assets (embeds and links) in a markdown file of which the path is provided.
addCodestoryToSection
addModelName
findCodestories
Finds all mdfiles (absolute paths) in /text or /operations that have a frontmatterprop isCodestorytrue
makeCodespanMappedObject
makeCodestory
no real reason to do this from text to text, let's do path to path here
mapChunkRecursively
mapMarkdownParseSections
test
writeAllCodestoriesCli
Arguments:none
writeAllCodestories
writeCodespanDetails
addEmojiToEveryWord
Emojify++
addStatement
Adds Statement
addWord
Adds word either to the WordMatrix or to the WordCombination database model
biggestFunctionName
checkQueue
Cron that runs every minute for executing queue items.
Regular items: It will execute max MAX_REGULAR_ITEMS_AMOUNT
Browser items: You can set the amount of tabs it should have as a limit, and it will keep the tabs open afterwards, but after the thing is done it will just remove the item from the Queue.
Heavy items: functions with isHeavytrue inside. Will execute max 1 every minute if the system isn't busy already.
- sort on priority high first
- filter out internet items if we are offline
- find single heavy item if it's there and if we're not busy
- find up to N (amount tabs available) queue items that require browser
cleanup
controlChatGptWrapper
deletePromptResult
developersQuote
diaryToInstagram
documentationWriting
emojiAugmentation
Emojify
explainInDutch
explainInNepali
explainInPortuguese
explainLineByLine
Explain line-by-line
explain
🤔 Explain
fixGrammarAndSpellingMistakes
followUpQuestions
getCategoriesTest
getContextualPromptCategories
Pretty cool stuff!
I've shown a way to count all nested categories and make a child object based on that
TODO:
- Currently, only supports unique category names due to not checking the full stack
- needs to be formalised, generalised
Another, possibly more direct way, would be to traverse the filesystem, in the case of fs-orm, because we have files for every item in json-single.
getContextualPromptResultJsonFilePath
Calculates path where the result json index is supposed to be
getContextualPrompt
getObjectForkKeyRecursively
getToolFunctions
Returns all tool functions to the frontend
gptIdeasRegisterWithContext
TODO: move to gptideas backend package
haiku
Write a Haiku
hookOneliners
improveCode
investorPitch
Investor pitch
marcusAurelius
MAX_REGULAR_ITEMS_AMOUNT
opposite
outlineToInvestorPitch
poem
Write a poem
processChatGptPrompt
processPromptOnFile
function processPromptOnFile to execute processChatGptPrompt
for a file, so we don't need to store the whole file content and it can be executed later and still have the most recent file contents
In order to keep the file itself as a source of truth for its content, it's useful to have this because you can add this to the queue
processPromptOnFolderWithContext
function that can execute processPromptOnFile for all files in a folder, by just upserting the executions to the queue.
quiz
Quiz
removeAllFake
rickAndMortyRick
Ricktalk
rickAndMorty
Rick teaches Morty
setIsFavoritePromptResult
shouldAddToQueue
Checks if system is busy and if so, adds the task to queue
socratesAndSnoopDogg
storytelling
Write a story about this code and what's happening in there
summarizeMeetings
Endpoint that onboards users
toolFunctionWithContext
Function to be executed straight from the frontend, where details is replaced with actual parameters of the function you want to execute.
functionContext and functionName to be stripped out of the form
translateEverythingIntoHindi
translateEverythingPortuguese
translateEverything
translateToPortuguese
Translate to Portuguese
typescriptExplain
williamShakespear
writeContextualPromptSdk
writeCreatePromptCode
ye
Let Kanye West write a poem about your selection
yodafy
Let Yoda say your selection in his words
fileTypePerExtension
languageModels
allOperationsRemoveJsSrc
BEWARE! This removes all .d.ts, .js, and .d.ts.map files in your source folder!
allOperationsToMarkdown
clearAllTsDatabases
codeAll
opens all files in vscode
[debug]
[folderName, basePath]
forAllFiles
executes a command or callback for every file
in commands, $LOCATION is provided as env variable, and command is executed in the dir of the file
forAllFolders
executes a command or callback in every folder of a certain type. Supports git repos and operations now
getAllOperationClassifications
gitShipAllRepos
gitShipAllPackages
Just ships code everywhere to github, wherever there's a git folder and there are changes.
mdAllOperations
minifyAllOperations
minify all operations everywhere. optionally:
- enable the shell
- specify a basepath (tools by default)
publishAllOperations
Script to publish all packages everywhere (that also runs prepublish). Only src in git, only build in npm.
removeAllFiles
removes all files that have an exact match of the location (folders not because we use rm without -rf)
removeAllFoldersCli
removeAllFolders
removeAll
removes all xyz for a folder
make sure to specify which type you want.... folder or file most likely
renameAll
renames all files to a new name (optionally a func, based on the old path)
runScriptEverywhere
runs a package script in all tools operations
NB: uses npm insead of yarn, but for scripts this shouldn't matter
[script, startIndex]
[search]
setScriptEverywhere
set package.json script to another value in all operations in tools folder
[type, command, fileName, basePath, folderName, shellString]
API_CUSTOM_URL_KEY
API_NO_RESPONSE_TIME_KEY
Should contain a string unix timestamp of the last time the API had no response.
apiWithConfig
This object contains a api function for every function in the backend
The difference from api 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
apiStoreInitialValues
apiConventions
API conventions:
xyzGetApi
is only available via GET, the rest is only available with POST.xyzWithContext
is taking FunctionContext as its first parameterxyzWithContextRaw
is taking FunctionContext as its first parameter, and is expected to return the raw return type the function returns.
contextFunctionConventionSuffix
getFunctionConventionSuffix
rawFunctionConventionSuffix
AppsMenu
argumentsWithoutFlags
askOk
getArgumentOrAsk
addToken
If previousToken is not present, will be generated randomly
ensureToken
Remove the token (if present), then add it again
findAssetParametersRecursively
Recursively finds all asset parameters in an object (for example in a database model item)
getConversionInfoFromType
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
getExtensionFromAsset
Returns a preliminary filename, based on the Asset
getNameFromRelativePath
getNameWithTokenFromRelativePath
first gets the name from the relativePath
then ensures the token is attached (if not already there)
getReferencedAssetApiUrl
getTypeFromUrlOrPath
We are assuming the asset name and extsion appear at the end of the URL
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!
compressAsset
Audio, image, video can be compressed. This should be done to logical defaults, can be turned off, or can be specifically set to other dimensions using a doc-comment on the model.
- audio: bitrate
- video: fps and resolution
- image: resolution
Returns the new absolute path of the compressed asset (which can be the same as the initial path)
deleteReferencedAsset
downloadRemoteAsset
Download a remote asset to the assets
folder (temporary location)
used for:
- giphy
- google images
- unsplashed
- p2p
- youtube to mp3 picker
- youtube to mp4 picker
- project assets (via api)
findAbsoluteAssetPathFromReference
findAllProjectMedia
Media:png, mp4, mp3, zip, pdf
- finds all media in all
db
folders. Can be anywhere, so an explore will probably be best. - finds all media in every operation in any folder except for
node_modules
,db
,src
,build
, [anything]. (so mostly intodo
,docs
andassets
) - find all media in every other folder that is not an operation
Return all of this as project relative path array
getAssetDirectlyGetApi
Useful for getting assets directly, for example for the SelectMedia
component for project
-media
Requires more access rights
Run server without too much queue execution
-
Launch telebit on server startup
-
Expose GET ASSET DIRECTLY, publicly, temporarily (but require a passcode in that case). Passcode should match one of the values in [filepath].public
-
convert the absolute path into a HTTPS URL that can be used as imageUrl (this should be a function where you can specify to use a general purpose passcode, or a OTP, or a unique passcode)
-
have a function to remove the passcode.
getReferencedAssetGetApi
Function to get a referenced asset that has been referenced from any db-model or any ts, tsx or md file, anywhere in the project.
Assets should only be exposed if you have access to the model they are referenced in or to the md file they are referenced in.
Exposes all assets like /asset?path=/text/interests/programming/storage-of-data/best-storage-methods.md&asset=./audio-is-amazing.m4a
Assets are only exposed if they are referenced in a markdown file that is accessible to the user. So when looking up the asset, make sure there's a link to it via []()
or ![]()
in the markdown that is connected to it in the URL. If not, don't expose it!
This can be used for any ui that has the functions backend available.
The advantage is that we don't need to build it, this works in dev mode. there is no asset duplication.
since the name is getReferencedAssetGetApi this should be exposed on getReferencedAsset
IMPLEMENTATION NOW:
-
check referencing file to find the reference.
-
for markdown, typescript:
](./xyz)
-
for json:
"relativePath": "./xyz"
-
If this occurs, calculate abosolute asset path from referencing file folder + relative path
-
If this asset exists, expose it.
getStorageLocationInfo
returns the type of file the asset is referenced from, and the baseFolderPath
where the asset
should be stored
getTemporaryAssetsFolderPath
mediaExtensions
processAsset
Processes an asset by moving the file in the right location, if needed...
- Alt is kept, nothing to do with it
- Giving a different name will change the new path
- relativePath is checked if it exists (if temporaryDestination is undefined). It is used to obtain the extension.
- temporaryDestination must be checked. if it exists, must replace the file on relativePath calculated from name
After processing, this function should return a BackendAsset without the non-storable parameters
BEWARE: absoluteReferencingFilePath
, and for db-models also modelName
, need to be given here! Otherwise this won't work!
processItemAssets
processes all assets in an item and returns the new item
removeOldTemporaryAssets
All temporary assets that were created more than 24 hours ago and are still there, will be removed by this function.
This allows us to easily delete assets without concequences and also if the user closes a form without submitting it, these assets uploaded will go away.
This function should be executed using a daily CRON
serverDownloadReply
Returns a server.reply.download
or server.reply.file
but also sets the Content-Disposition
header correctly and the Content-Type
For this I finally ended up using builtin server.js stuff, we don't need to set those manually...
See https://serverjs.io/documentation/reply/#file- And https://serverjs.io/documentation/reply/#download-
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
NB: ensure to return the result of this function in your endpoint, otherwise it won't work
uploadAssetWithContext
Uploads an asset to the server, and puts it in a temporary location in the assets folder of function-server. It returns the filename of the file in the temporary location.
It can only be accessed through that random name. This random name has 32 characters so cannot be easily guessed. This should be secure enough. The file should be moved to the final destination in the actual function that needs the file.
NB: this function only works by providing a file as blobs under the "file" property name!
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
getSrc
InteractiveAsset
shows an Asset 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
itemGetBackendAssetUrl
Get remote url for a BackendAsset in an AugmentedAnyModelType
database model item.
If you provide an array it'll take the first asset.
ModelItemAssetView
useAssetInfo
useAsset
cache
getAugmentedWordObject
getAugmentedWords
Gets all augmented words of the entire project
- functions, interfaces, variables, operations (
/[operation-path]#name
) - if this is an OS-project, also bundles (
/[docs-path]
)
getBundleAugmentedWords
NB: should only be executed if this is not a sensible-project, as it might not have BundleConfig otherwise
AuthenticationMethodsCrud
LoginForm
LoginWrapper
ensures the auth-token is set
MeAuthenticationInfo
little component for in banner that shows your info on top, and links to signup/login etc
PersonProfileDetailsForm
PictureWithInfoDropdown
Dumb (presentational) component for a picture with info and a dropdown
PublicPersonComponent
PublicProfile
SignupForm
UpdateMeForm
BigButton
BreadCrumbs
Shows where we are in the filesystem
renderBreadCrumbs
getBundleSummary
Summarizes a bundle config so it can be used easily in things like explore project
getDbModelsForBundle
Gets all TsInterface's that are used in a bundle according to a BundleConfig
chatGPTAuth
detectChatGptPage
openAIChat
Send the propt to chatgpt and return the chatgpt response
execAsync
promises to exec something with response and success as result (Promised)
spawnAsync
i don't know if this is ever useful...
cleanupTsDatabase
From all Ts Index Models, removes the instances that refer to a ts file that doesn't exist anymore in the operation.
shouldDeleteTsModel
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
datasetConfigKeys
datasetFilterOperatorConst
NB: keys are made humanCase
and used in UI, so keep a readable name
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
modelViews
operationClassificationConst
runEveryPeriodReadonlyArray
runEveryPeriodStringArray
typescriptIndexModels
stripCommentEnd
only strip slahes for single-line comments
stripCommentStart
stripComment
parses comments (single line, multiline and doc) and removes the comment syntax
- removes slashes
- removes multiline comment prefix
- removes multiline comment suffix
- removes doccomment stars
example input: // comment
, output: comment
example input:
some
multiline
comment *~/
output:
some
multiline
comment
stripSlashes
stripStar
trimSurroundingNewlines
removes new lines at beginning and end
NB: This function uses a small recursion! I don't know if this is very efficient, but shouldn't be too deep!
NB: it should be noted that a newline apparently seems to be counting as a single character! Strange.
trim
getCompileErrors
gets compileErrors of an operation. if it has no errors, it also check all dependants to see if they have errors, possibly because we changed this one
- get buildErrors for all src files of current operation
- if build doesn't succeed, only check for build errors in current operation
- if build succeeds, check iffor build errors in all files in all operations that depend on this one. this means we need compile to be ran for every operation
TODO: Later, only check all build errors of all dependants if and only if an export blueprint (io) has changed and if this export was imported there
[ operationBasePath, operationManualProjectRoot, typerepoManualProjectRoot, ]
writeBuildErrors
ContextMenuItemComponent
useContextMenu
Use this if you want to render a context menu where the menu closes if you click one of the items.
Optionally, you can create a custom renderer for it.
id can be provided by the contextEvent.
useContextPopper
Use this hook if you want to create your own custom render that opens on the right location once the onContextMenu is fired.
useContext
Use this if you want to create a completely custom behavior from a context action. On top of the default onContextMenu behavior, this hook enables the possibility for a custom hold duration on mobile.
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
errorToast
infoToast
showStandardResponse
Useful to show if the api has a standard response
successToast
warningToast
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
, OperationConfig
, PackageJson
, TsConfig
testPerformance
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
CrudGrid
CrudTable
CrudTimeline
CrudTree
DatasetForm
dbCrudInitialValues
DbPage
defaultLimit
{ deleteDbModel }
{ getDbModel }
getPropertiesDataParameterNames
IndexInstanceContainer
container for any index instance that needs to be rendered in the explore page
{ isBetaEnabled }
ModelComponent
In the table headings, all xxxSlug, xxxId etc should be called xxx.
In the table values, all slugs and ids should show the name of the instance of the refered model.
It has to be possible to navigate to an id or slug using #[id] or #[slug]
in the URL, just add div ids to all rows
openWhatsapp
shimmer
SimplifiedSchemaFormDebug
sortToItem
SpaceCard
toBase64
{ upsertDbModel }
UpsertForm
TODO: Provide all the fetched data with hasMore
and fetchAll
to the SimplifiedJsonForm
UpsertPage
useInfiniteGetDbModel
useModelFromUrl
takes the model from the url
useUrl
cacheLookup
Wrapper function to cache any function and invalidate it, in some way
caching automatic cache invalidation if data sources are updated optimistic caching after cache invalidation
calculateOperatingSystemBundle
This function should calculate a giant bundle for the whole operating system. This should include everything, public.
Used to show the whole os as a bundle.
deleteDbModel
deletes an instance of an db data interface from the db in a typesafe way
functions
getCachedFunctions
TODO: it would probably be good to create a more general purpose caching function
getDatabaseMenu
Finds all relevant Db models to show in the menu
- for a bundleId, it gets all models from the bundleSummary
- for a bundled project (bundled) gets all models from the packages
- for the main project, gets all models from sdk-db directly
TODO: NB: the first and the second are not the same, so this needs to be cleaned up.
getDbModelMetadata
getDbModelNames
getDbModel
gets all instances of an db data interface from the db in a typesafe way
getFunctionIndex
finds function indexation from database
TODO: this should be used!
getNestedDatabaseMenu
TODO: support search for bundles (but this can be augmented word based)
getReferencableModelData
Get referencableModelData for a single DbModel.
NB: this does not get the items that can be referenced in that model!
For getting all required ReferencableModelData
for the prop in SimplifiedSchemaForm, use useGetReferencableModelData
.
hasDbRecipes
Simple function to test whether or not the DbRecipes endpoints are available. If it returns true through the api, the other ones are also available.
makeSrcRelativeFolder
gets a src relative folder path (so maybe "" for a file src/util.ts
or "util" for a file src/util/thing.ts
)
testFnWrapped
testFn
tsInterfaceToDbMenu
upsertDbModel
upserts an instance of an db data interface from the db in a typesafe way
validateInput
wrapper function that takes that data but also the interface of the function and validates the parameters before it executes the function.
validateResult
wrapper function that takes that data but also the interface of the function and validates the parameters before it executes the function.
wrapFunction
filterInterfacesFromOperationNames
getDbModelsFromOperations
availableExtensions
docsGetPages
getMarkdownReaderPages
Gets all markdownreader pages for multiple basePaths. Can add a prefix, can also remove the last folder of basePath from the suffix.
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!
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
comparePassword
Method to check if a raw password should be the same as the encrypted variant. Uses bcrypt
encryptPassword
Method to encrypt any password. Uses bcrypt
exploreOperation
for every package.json it finds, it explores the root, src, and docs.
- in src, index is ignored
- in docs, only md is found
- in the root, only md is found
- for every file in src, it shows and finds all functions, interfaces and variables, through the indexation from it
exploreProject
TODO: still needs to be cleaned up. It's a huge function now with many useful components. Split it up!
- explores all files and folders until it finds a package.json.
all items in the explore tree are clickable in the ui, and lead to different pages
- a folder leads to a summary of what the folder holds
- a operation leads to a summary of the operation
- a ts file leads to all functions, variables, and interfaces in that file
- a function, variable, or interface leads to specific pages for those things. the data, if available, is attached to the interfaces.
- a md file leads to the editing user interface (with context) of that file
- a json file leads to a CRUD for it...
In the end the data it generates should stay up to date, so it's important this exploration happens fast enough. The data involved is simply walking the filesystem once (a small subset of it) and opening some index files (fun)
LATER: some more things that would be useful:
- watching all files that are also explored for changes using some watcher
- if something changes, recalculating that part and pushing it to the UI, making the thing going over the line small so it'll be super fast, even over slow internet.
however, this is premature optimisation. on my m1, locally, it's probably fine to just recalculate every second ^^ and send a couple megabytes over the line.
getExplorationType
gets the exploration type from an absolute type
getFileWithExtension
getFolderExplorationDetails
getFrontmattersMappedObject
getInstanceNames
returns the paths of instances in a file, like functions, variables or interfaces
getProjectRelativePaths
get file paths within your project
getTodoPages
getTodoPages(): WebPage[]
function:
- use getProjectRelativePaths, map the result to a queryPath + file
- [operation-name]/[todo-relative-file-id] for operations
- [folder-name]/[todo-relative-file-id] for todos within folders
getTodoPaths
hasSameProjectPath
function that returns a filter function that can check if some object (that extends an TsIndexModelType) has the same relative file path from the project root
FancyLoader
[absolutePath]
compressConvert
Super useful wrapper around ffmpeg to do just all the stuff I want to do with it
TODO: fix fps, not implemented yet
compressImages
searches the folder recursively for all images and converts them to webp
compressMp4
Compress mp4 to very small
compressMp4sCli
compressMp4s
CLI syntax:
compressMp4s [basePath]
can also be relative path
convertToMp3
Uses ffmpeg to convert a file to mp3
Returns the new file path on success
convertToMp4
Uses ffmpeg to convert a file to mp3
Returns the new file path on success
fileExplorerOpen
getFileType
typeIcons
MatchingText
Component that highlights the matching text
PathSearchResults
fileTabsInitialValues
FileTabs
getActivePage
getOpenPageUrl
gets the url of the open page
- paths is a special query key that is expanded as path, not as query
- index page should be on /
renderIcon
useStore
NB: this is a useStore without a StoreProvider
, because I think I won't ever need the provider since I won't ever need this as the sole storage in any component/app. If I do, I should make a provider, but it's usually better to create the useStore and StoreProvider
in the component itself because it often comprises more than just this one.
OpenFileWriterPages
{ saveFileContents }
useFileWriter
Returns a filewriter for a project relative filePath with a function to save it
{ useGetFileContents }
{ useStore, StoreProvider }
WriterLayout
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
getFileTypeFromPath
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
movedFileSubextension
subextension indicating that a file has been moved to another location
For example, used in watchAppleMemos
operationUnindexableNamesOrSubExtensions
projectRelativeGeneratedOperationsFolder
sourceFolderName
temporaryConvertedSubextension
This is a temporary file for conversion with ffmpeg (see ffmpeg-util)
typescriptExtensionsConst
typescriptExtensions
findAllDependencyOperations
to be used when you need to know all dependencies for multiple operation names at once
TODO: NB: this breaks with circular dependencies
findDependantsRecursivelyTest
findDependantsRecursively
findDependants({
operationName: "js-util",
importName: "notEmpty",
returnOperationName: false,
}).then(console.log);
findDependants
finds all dependants of an operation or a specific import from that operation
normally returns the files where the operation or function is used, unless you specify to return the operationNames only.
findDependenciesRecursively
finds all dependencies of an operation name
findMonorepoExports
findMonorepoImports
finds all unique imports in an operation name
findMonorepoModules
finds all dependencies of an operation name
getDependencyObject
findAllDependencyOperations(["fs-orm"]).then(console.log);
how do I get a format like this?
const x = {
"fs-orm": ["js-util"],
"js-util": [],
}
getDependencyTree
getOldDependencyTree
getOperationDependencyReasons
[operationName]
test2
folderGetUpdatedAt
get last updated file updatedAt time in whole folder, recursively. only finds typescript files, ignores index.
frontmatterParseToString
Parses frontmatter object into a frontmatter string
frontmatterToObject
getFrontmatterValueString
markdownModelTypeToMarkdownString
objectToFrontmatter
parseFrontmatterString
Parse a string as stored in frontmatter back to the original string
quotedOrNot
For now, simply quote a string if it contains commas
There are probably more edgecases that need to be fixed here
stringifyNewlines
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 multiple file
alterJsonSingle
Alters a json single file
alterKeyValueMarkdown
alterMarkdown
Alters a markdown file
augmentItemWithReferencedDataRecursively
calculateOperationsObject
relative
Needed in case of manual project root, otherwise use SDK!
Returns project relative operation base paths
categoryStack
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 categoryStack
onto this if the dbStorageMethod
is markdown 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 will look in:
db/
in your project rootdb/
in any operation
In these folders, fs-orm 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.