From 94632dbc07f4239090462f67f5b8890ad4e07b0d Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Wed, 19 Jun 2024 16:47:07 +0200 Subject: [PATCH] refactor(chore): :recycle: delete import map for local path due to workspace errors --- .env.example | 1 + deno.json | 7 ------- mod.ts | 4 ++-- src/db/mod.ts | 4 ++-- src/models/mod.ts | 18 +++++++----------- src/models/src/credential.ts | 8 ++++---- src/models/src/group.ts | 8 ++++---- src/models/src/machine.ts | 10 +++++----- src/models/src/ressource.ts | 6 +++--- src/models/src/service.ts | 10 +++++----- src/models/src/user.ts | 14 +++++++------- src/models/utils/avatar.ts | 2 +- src/models/utils/ref.ts | 6 +++--- utils.ts | 2 +- 14 files changed, 45 insertions(+), 55 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9e9a2b4 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +DB_PATH = './db.sqlite' \ No newline at end of file diff --git a/deno.json b/deno.json index d75ff84..3a1fc05 100644 --- a/deno.json +++ b/deno.json @@ -14,13 +14,6 @@ "semiColons": false }, "imports": { - "@/": "./", - "@models": "./src/models/mod.ts", - "@models/": "./src/models/src/", - "@api": "./src/api/server.ts", - "@api/": "./src/api/", - "@db": "./src/db/mod.ts", - "@db/": "./src/db/", "@std/json": "jsr:@std/json@^0.223.0" }, "exclude": [ diff --git a/mod.ts b/mod.ts index 88c157b..ebba693 100644 --- a/mod.ts +++ b/mod.ts @@ -1,2 +1,2 @@ -export * from '@models' -export { Db } from '@db' +export * from './src/models/mod.ts' +export { Db } from './src/db/mod.ts' diff --git a/src/db/mod.ts b/src/db/mod.ts index 8f201a3..511a71c 100644 --- a/src/db/mod.ts +++ b/src/db/mod.ts @@ -6,8 +6,8 @@ import { type Ressource, Service, User, -} from '@models' -import type { CredentialCategory } from '@models/credential.ts' +} from '../models/mod.ts' +import type { CredentialCategory } from '../models/src/credential.ts' //!TODO link ressources (get, list) //!TODO Purge unused ressources (delete) diff --git a/src/models/mod.ts b/src/models/mod.ts index 1acabbe..d6200e4 100644 --- a/src/models/mod.ts +++ b/src/models/mod.ts @@ -1,11 +1,7 @@ -export { - Ref, - type RefResolver, - type RefString, -} from '@/src/models/utils/ref.ts' -export { Credential } from '@models/credential.ts' -export { Group } from '@models/group.ts' -export { Machine } from '@models/machine.ts' -export type { Ressource } from '@models/ressource.ts' -export { Service } from '@models/service.ts' -export { User } from '@models/user.ts' +export { Ref, type RefResolver, type RefString } from './utils/ref.ts' +export { Credential } from './src/credential.ts' +export { Group } from './src/group.ts' +export { Machine } from './src/machine.ts' +export type { Ressource } from './src/ressource.ts' +export { Service } from './src/service.ts' +export { User } from './src/user.ts' diff --git a/src/models/src/credential.ts b/src/models/src/credential.ts index b638800..43b0265 100644 --- a/src/models/src/credential.ts +++ b/src/models/src/credential.ts @@ -1,7 +1,7 @@ -import type { Base64String, ToJson, UUID } from '@/types.ts' -import { Ressource } from '@models/ressource.ts' -import type { Ref } from '@models' -import { Avatar } from '@/src/models/utils/avatar.ts' +import type { Base64String, ToJson, UUID } from '../../../types.ts' +import { Ressource } from './ressource.ts' +import type { Ref } from '../utils/ref.ts' +import { Avatar } from '../utils/avatar.ts' export class Credential extends Ressource { static fromJSON( diff --git a/src/models/src/group.ts b/src/models/src/group.ts index ba6a8d2..9da55cd 100644 --- a/src/models/src/group.ts +++ b/src/models/src/group.ts @@ -1,7 +1,7 @@ -import type { Posix, ToJson, UUID } from '@/types.ts' -import { Ressource } from '@models/ressource.ts' -import { Ref } from '@models' -import { Avatar } from '@/src/models/utils/avatar.ts' +import type { Posix, ToJson, UUID } from '../../../types.ts' +import { Ressource } from './ressource.ts' +import { Ref } from '../utils/ref.ts' +import { Avatar } from '../utils/avatar.ts' export class Group extends Ressource { static fromJSON( diff --git a/src/models/src/machine.ts b/src/models/src/machine.ts index e74dbd8..0ba4990 100644 --- a/src/models/src/machine.ts +++ b/src/models/src/machine.ts @@ -1,8 +1,8 @@ -import { Ref } from '@/src/models/utils/ref.ts' -import type { ToJson, UrlString } from '@/types.ts' -import type { Group } from '@models/group.ts' -import { Ressource } from '@models/ressource.ts' -import { Avatar } from '@/src/models/utils/avatar.ts' +import { Ref } from '../utils/ref.ts' +import type { ToJson, UrlString } from '../../../types.ts' +import type { Group } from './group.ts' +import { Ressource } from './ressource.ts' +import { Avatar } from '../utils/avatar.ts' export class Machine extends Ressource { static fromJSON( diff --git a/src/models/src/ressource.ts b/src/models/src/ressource.ts index c7a23bf..4ae58c4 100644 --- a/src/models/src/ressource.ts +++ b/src/models/src/ressource.ts @@ -1,6 +1,6 @@ -import { Ref } from '@/src/models/utils/ref.ts' -import type { DateString, ToJson, UrlString, UUID } from '@/types.ts' -import { regex } from '@/utils.ts' +import { Ref } from '../utils/ref.ts' +import type { DateString, ToJson, UrlString, UUID } from '../../../types.ts' +import { regex } from '../../../utils.ts' export class Ressource { static fromJSON( diff --git a/src/models/src/service.ts b/src/models/src/service.ts index aa38b8e..d4ec190 100644 --- a/src/models/src/service.ts +++ b/src/models/src/service.ts @@ -1,8 +1,8 @@ -import { Ref } from '@/src/models/utils/ref.ts' -import type { ToJson, UrlString } from '@/types.ts' -import type { Group } from '@models/group.ts' -import { Ressource } from '@models/ressource.ts' -import { Avatar } from '@/src/models/utils/avatar.ts' +import { Ref } from '../utils/ref.ts' +import type { ToJson, UrlString } from '../../../types.ts' +import type { Group } from './group.ts' +import { Ressource } from './ressource.ts' +import { Avatar } from '../utils/avatar.ts' export class Service extends Ressource { static fromJSON( diff --git a/src/models/src/user.ts b/src/models/src/user.ts index bcd9955..775d180 100644 --- a/src/models/src/user.ts +++ b/src/models/src/user.ts @@ -1,10 +1,10 @@ -import { Ref } from '@/src/models/utils/ref.ts' -import type { Login, MailAddress, Posix, ToJson } from '@/types.ts' -import { regex, toLogin } from '@/utils.ts' -import type { Credential, CredentialCategory } from '@models/credential.ts' -import type { Group } from '@models/group.ts' -import { Ressource } from '@models/ressource.ts' -import { Avatar } from '@/src/models/utils/avatar.ts' +import { Ref } from '../utils/ref.ts' +import type { Login, MailAddress, Posix, ToJson } from '../../../types.ts' +import { regex, toLogin } from '../../../utils.ts' +import type { Credential, CredentialCategory } from './credential.ts' +import type { Group } from './group.ts' +import { Ressource } from './ressource.ts' +import { Avatar } from '../utils/avatar.ts' export class User extends Ressource { static fromJSON(json: ToJson): User { diff --git a/src/models/utils/avatar.ts b/src/models/utils/avatar.ts index 11f3f42..cdeaef9 100644 --- a/src/models/utils/avatar.ts +++ b/src/models/utils/avatar.ts @@ -1,4 +1,4 @@ -import type { UrlString } from '@/types.ts' +import type { UrlString } from '../../../types.ts' export class Avatar { static fromEmoji(emoji: string): UrlString { diff --git a/src/models/utils/ref.ts b/src/models/utils/ref.ts index 7b0a316..8475e0d 100644 --- a/src/models/utils/ref.ts +++ b/src/models/utils/ref.ts @@ -1,5 +1,5 @@ -import type { Db } from '@/mod.ts' -import type { UUID } from '@/types.ts' +import type { Db } from '../../db/mod.ts' +import type { UUID } from '../../../types.ts' import { Credential, Group, @@ -7,7 +7,7 @@ import { type Ressource, Service, User, -} from '@models' +} from '../mod.ts' export type RefString = | `@ref/${T['type']}#${UUID}` diff --git a/utils.ts b/utils.ts index 7171cb2..bff2afc 100644 --- a/utils.ts +++ b/utils.ts @@ -1,4 +1,4 @@ -import type { Login } from '@/types.ts' +import type { Login } from './types.ts' export function toLogin({ firstname,