diff options
Diffstat (limited to 'packages/shared/src')
-rw-r--r-- | packages/shared/src/index.ts | 14 | ||||
-rw-r--r-- | packages/shared/src/stores/Config.ts | 5 | ||||
-rw-r--r-- | packages/shared/src/stores/Profile.ts | 32 | ||||
-rw-r--r-- | packages/shared/src/stores/Service.ts | 37 |
4 files changed, 88 insertions, 0 deletions
diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 6383f63..9f4e9b3 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts | |||
@@ -33,6 +33,20 @@ export type { | |||
33 | export { config } from './stores/Config'; | 33 | export { config } from './stores/Config'; |
34 | 34 | ||
35 | export type { | 35 | export type { |
36 | Profile, | ||
37 | ProfileSnapshotIn, | ||
38 | ProfileSnapshotOut, | ||
39 | } from './stores/Profile'; | ||
40 | export { profile } from './stores/Profile'; | ||
41 | |||
42 | export type { | ||
43 | Service, | ||
44 | ServiceSnapshotIn, | ||
45 | ServiceSnapshotOut, | ||
46 | } from './stores/Service'; | ||
47 | export { service } from './stores/Service'; | ||
48 | |||
49 | export type { | ||
36 | SharedStore, | 50 | SharedStore, |
37 | SharedStoreListener, | 51 | SharedStoreListener, |
38 | SharedStoreSnapshotIn, | 52 | SharedStoreSnapshotIn, |
diff --git a/packages/shared/src/stores/Config.ts b/packages/shared/src/stores/Config.ts index 1d98a33..1d97e7d 100644 --- a/packages/shared/src/stores/Config.ts +++ b/packages/shared/src/stores/Config.ts | |||
@@ -22,7 +22,12 @@ import { Instance, types, SnapshotIn, SnapshotOut } from 'mobx-state-tree'; | |||
22 | 22 | ||
23 | import { themeSource } from '../schemas'; | 23 | import { themeSource } from '../schemas'; |
24 | 24 | ||
25 | import { profile } from './Profile'; | ||
26 | import { service } from './Service'; | ||
27 | |||
25 | export const config = types.model('Config', { | 28 | export const config = types.model('Config', { |
29 | profiles: types.array(profile), | ||
30 | services: types.array(service), | ||
26 | themeSource: types.optional(types.enumeration(themeSource.options), 'system'), | 31 | themeSource: types.optional(types.enumeration(themeSource.options), 'system'), |
27 | }); | 32 | }); |
28 | 33 | ||
diff --git a/packages/shared/src/stores/Profile.ts b/packages/shared/src/stores/Profile.ts new file mode 100644 index 0000000..88a0f4d --- /dev/null +++ b/packages/shared/src/stores/Profile.ts | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2021-2022 Kristóf Marussy <kristof@marussy.com> | ||
3 | * | ||
4 | * This file is part of Sophie. | ||
5 | * | ||
6 | * Sophie is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU Affero General Public License as | ||
8 | * published by the Free Software Foundation, version 3. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU Affero General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Affero General Public License | ||
16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | * SPDX-License-Identifier: AGPL-3.0-only | ||
19 | */ | ||
20 | |||
21 | import { Instance, types, SnapshotIn, SnapshotOut } from 'mobx-state-tree'; | ||
22 | |||
23 | export const profile = types.model('Profile', { | ||
24 | id: types.identifier, | ||
25 | name: types.string, | ||
26 | }); | ||
27 | |||
28 | export interface Profile extends Instance<typeof profile> {} | ||
29 | |||
30 | export interface ProfileSnapshotIn extends SnapshotIn<typeof profile> {} | ||
31 | |||
32 | export interface ProfileSnapshotOut extends SnapshotOut<typeof profile> {} | ||
diff --git a/packages/shared/src/stores/Service.ts b/packages/shared/src/stores/Service.ts new file mode 100644 index 0000000..ed2cd9a --- /dev/null +++ b/packages/shared/src/stores/Service.ts | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2021-2022 Kristóf Marussy <kristof@marussy.com> | ||
3 | * | ||
4 | * This file is part of Sophie. | ||
5 | * | ||
6 | * Sophie is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU Affero General Public License as | ||
8 | * published by the Free Software Foundation, version 3. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU Affero General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Affero General Public License | ||
16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | * SPDX-License-Identifier: AGPL-3.0-only | ||
19 | */ | ||
20 | |||
21 | import { Instance, types, SnapshotIn, SnapshotOut } from 'mobx-state-tree'; | ||
22 | |||
23 | import { profile } from './Profile'; | ||
24 | |||
25 | export const service = types.model('Service', { | ||
26 | id: types.identifier, | ||
27 | name: types.string, | ||
28 | profile: types.reference(profile), | ||
29 | // TODO: Remove this once recipes are added. | ||
30 | url: types.string, | ||
31 | }); | ||
32 | |||
33 | export interface Service extends Instance<typeof service> {} | ||
34 | |||
35 | export interface ServiceSnapshotIn extends SnapshotIn<typeof service> {} | ||
36 | |||
37 | export interface ServiceSnapshotOut extends SnapshotOut<typeof service> {} | ||