generated from redte-ch/redte.ch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c91fba
commit 0448a3f
Showing
82 changed files
with
658 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"name": "@redtech/maisonquiroga", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"license": "AGPL-3.0-or-later", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
|
@@ -15,6 +16,7 @@ | |
"check:eslint": "eslint .", | ||
"check:prettier": "prettylint .", | ||
"check:stylelint": "stylelint '**/*.{css,astro,svelte}'", | ||
"check:todo": "leasot src/**/*.ts", | ||
"dev": "astro dev", | ||
"format": "run-s format:eslint format:prettier format:stylelint", | ||
"format:eslint": "yarn check:eslint --fix", | ||
|
@@ -55,6 +57,8 @@ | |
"eslint-plugin-tailwindcss": "^3.17.4", | ||
"fontaine": "^0.5.0", | ||
"husky": "^9.1.4", | ||
"leasot": "^14.4.0", | ||
"lowdb": "^7.0.1", | ||
"neostandard": "^0.11.2", | ||
"npm-run-all2": "^6.2.2", | ||
"postcss": "^8.4.41", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Lowdb adapter | ||
* | ||
* @module lowdb | ||
* @todo Move types to {@link to &/ports.ts} | ||
*/ | ||
|
||
import type { Data, Load } from '&/ports.ts' | ||
|
||
import { Low } from 'lowdb' | ||
import { JSONFile } from 'lowdb/node' | ||
|
||
import { map } from '$/utils/adt/maybe.ts' | ||
import { compose } from '$/utils/fun/compose.ts' | ||
|
||
/** Connection to a database. */ | ||
type Conn<A> = Low<A> | ||
|
||
/** | ||
* Generic connect function. | ||
* | ||
* @typeParam A | ||
* @param {string} path - The path used to establish the connection. | ||
* @returns The connection object of type Conn<A>. | ||
*/ | ||
type Connect<A> = (path: string) => Conn<A> | ||
|
||
/** Connect to a database. */ | ||
const connect: Connect<Data> = (path) => new Low<Data>(new JSONFile(path), {}) | ||
|
||
/** | ||
* Read a value from a given connection. | ||
* | ||
* @typeParam A | ||
* @param {Conn<A>} conn - The connection to read the value from. | ||
* @returns A function that when called, returns a Promise. | ||
* @todo {@link null} here is an implementation detail leaked from {@link Low} | ||
*/ | ||
type Read<A> = (conn: Readonly<Conn<A>>) => () => Promise<A | null> | ||
|
||
/** Read a value from a given connection. */ | ||
const read: Read<Data> = (conn) => async () => await conn.adapter.read() | ||
|
||
/** | ||
* An indeterminacy, returning a {@link Promise}. | ||
* | ||
* @note We may think of a {@link Indet} as a "fp-ts/Task" or an | ||
* "effect-ts/Effect".For us, it is less about what is to be done, as to what | ||
* is to be known. That is, how the future unfolds, so to speak. | ||
* @see {@link https://fr.hegel.net/f111.htm} | ||
* @todo Make this a generic type. | ||
* | ||
* @todo Implement for {@link Maybe}. | ||
* | ||
* @todo Implement for {@link Result} (alias Either). | ||
*/ | ||
export type Indet<A> = () => Promise<A> | ||
|
||
/** A determinacy, resolving an indeterminacy. */ | ||
export type Det<A, B, C> = (f: A) => (g: Indet<B>) => Indet<C> | ||
|
||
/** A determinacy, resolving an indeterminacy. */ | ||
const det: Det<Read<Data>, Conn<Data>, Data | null> = (f) => (g) => { | ||
return async () => { | ||
const result = await g() | ||
return result ? await f(result)() : null | ||
} | ||
} | ||
|
||
/** Load data for the database. */ | ||
export const load: Load<Data> = map(compose([det, read, connect])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Infrastructure ports. | ||
* | ||
* @module ports | ||
*/ | ||
|
||
import type { Just, Maybe } from '$/types.ts' | ||
|
||
/** Data read from a database. */ | ||
export type Data = { | ||
[key: Readonly<string>]: { | ||
[key: Readonly<string>]: { | ||
[key: Readonly<string>]: Readonly<string> | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Load data from a database. | ||
* | ||
* @param {Just<string>} path - The path from which to load the value. | ||
* @returns {Maybe<Data>} - The value loaded from the database. | ||
*/ | ||
export type Load<Data> = (path: Just<string>) => Maybe<Data> |
6 changes: 4 additions & 2 deletions
6
src/app/stores/CityStore.ts → src/adapters/stores/CityStore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/app/stores/CountryStore.ts → src/adapters/stores/CountryStore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/app/stores/GeoCoordinatesStore.ts → src/adapters/stores/GeoCoordinatesStore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/app/stores/PostalAddressStore.ts → src/adapters/stores/PostalAddressStore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/ui/components/Header.astro → src/adapters/ui/prouns/Header.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
src/ui/screens/Home.astro → src/adapters/ui/screens/Home.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.