@@ -0,0 +1,2 @@ | |||||
*.ts | |||||
tsconfig.json |
@@ -0,0 +1,3 @@ | |||||
# Zeichen - Core | |||||
Library for authoring Zeichen plugins and themes. |
@@ -0,0 +1,11 @@ | |||||
{ | |||||
"name": "zeichen-core", | |||||
"description": "Library for authoring Zeichen plugins and themes.", | |||||
"version": "0.1.0", | |||||
"devDependencies": { | |||||
"typescript": "^4.0.3" | |||||
}, | |||||
"scripts": { | |||||
"build": "tsc **/*.ts" | |||||
} | |||||
} |
@@ -0,0 +1,5 @@ | |||||
export type State = { | |||||
currentUserId: string, | |||||
} | |||||
export type Plugin<T = {}> = (config: T) => (state: State) => void |
@@ -0,0 +1,16 @@ | |||||
export default interface Storage<T> { | |||||
queryItems(): Promise<T[]> | |||||
saveItem(item: T): Promise<void> | |||||
deleteItem(item: T): Promise<boolean> | |||||
} | |||||
export interface Collection<T> { | |||||
items: T[], | |||||
lastModifiedBy: string, | |||||
lastModifiedAt: Date, | |||||
} | |||||
export type Serializer<T = unknown> = (t: T) => string | |||||
export type Deserializer<T = unknown> = (s: string) => T | |||||
export class OutOfSyncError {} |
@@ -0,0 +1,28 @@ | |||||
{ | |||||
"compilerOptions": { | |||||
"target": "es6", | |||||
"lib": [ | |||||
"dom", | |||||
"dom.iterable", | |||||
"esnext" | |||||
], | |||||
"skipLibCheck": true, | |||||
"esModuleInterop": true, | |||||
"allowSyntheticDefaultImports": true, | |||||
"forceConsistentCasingInFileNames": true, | |||||
"module": "esnext", | |||||
"moduleResolution": "node", | |||||
"declaration": true, | |||||
"declarationDir": "./dist", | |||||
"emitDeclarationOnly": true, | |||||
"sourceMap": true, | |||||
"strict": false | |||||
}, | |||||
"exclude": [ | |||||
"node_modules", | |||||
"**/*.test.ts" | |||||
], | |||||
"include": [ | |||||
"**/*.ts" | |||||
] | |||||
} |