Skip to content

Commit 4a1a3c5

Browse files
committed
Better structures now
1 parent 5fef9e9 commit 4a1a3c5

42 files changed

Lines changed: 141 additions & 127 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/cli/jupiter/cli/command/command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
from jupiter.cli.command.rendering import RichConsoleProgressReporterFactory
1616
from jupiter.cli.session_storage import SessionInfo, SessionStorage
1717
from jupiter.cli.top_level_context import TopLevelContext
18-
from jupiter.core.component import (
18+
from jupiter.core.component import JupiterComponentProperties
19+
from jupiter.core.domain.app import (
1920
AppCore,
2021
AppDistribution,
2122
AppPlatform,
2223
AppShell,
23-
JupiterComponentProperties,
2424
)
2525
from jupiter.core.domain.crm import CRM
2626
from jupiter.core.domain.storage_engine import DomainStorageEngine, SearchStorageEngine
27+
from jupiter.core.global_properties import JupiterGlobalProperties
2728
from jupiter.core.use_cases.infra.use_cases import (
2829
AppGuestMutationUseCase,
2930
AppGuestMutationUseCaseContext,
@@ -36,7 +37,6 @@
3637
AppLoggedInReadonlyUseCaseContext,
3738
AppLoggedInUseCaseSession,
3839
)
39-
from jupiter.core.global_properties import JupiterGlobalProperties
4040
from jupiter.core.utils.progress_reporter import NoOpProgressReporterFactory
4141
from jupiter.framework_new.auth.auth_token_stamper import AuthTokenStamper
4242
from jupiter.framework_new.primitive import Primitive

src/cli/jupiter/cli/command/rendering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from contextlib import asynccontextmanager, contextmanager
88
from typing import Final
99

10-
from jupiter.core.component import AppComponent
10+
from jupiter.core.domain.app import AppComponent
1111
from jupiter.core.domain.application.gamification.user_score_overview import (
1212
UserScore,
1313
UserScoreOverview,

src/cli/jupiter/cli/jupiter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
from jupiter.cli.command.rendering import RichConsoleProgressReporterFactory
1313
from jupiter.cli.session_storage import SessionStorage
1414
from jupiter.cli.top_level_context import TopLevelContext
15-
from jupiter.core.component import (
15+
from jupiter.core.component import JupiterComponentProperties
16+
from jupiter.core.domain.app import (
1617
AppCore,
1718
AppDistribution,
1819
AppPlatform,
1920
AppShell,
20-
JupiterComponentProperties,
2121
)
22+
from jupiter.core.global_properties import build_global_properties
2223
from jupiter.core.impl.crm.noop import NoOpCRM
2324
from jupiter.core.impl.repository.sqlite.connection import SqliteConnection
2425
from jupiter.core.impl.repository.sqlite.domain.storage_engine import (
@@ -33,7 +34,6 @@
3334
LoadTopLevelInfoArgs,
3435
LoadTopLevelInfoUseCase,
3536
)
36-
from jupiter.core.global_properties import build_global_properties
3737
from jupiter.framework_new.auth.auth_token_stamper import AuthTokenStamper
3838
from jupiter.framework_new.persistent_mutation_use_case_recoder import (
3939
PersistentMutationUseCaseInvocationRecorder,

src/cli/jupiter/cli/migrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import asyncio
44

55
import jupiter.core.domain
6-
from jupiter.core.impl.repository.sqlite.connection import SqliteConnection
76
from jupiter.core.global_properties import build_global_properties
7+
from jupiter.core.impl.repository.sqlite.connection import SqliteConnection
88
from jupiter.framework_new.realms import ModuleExplorerRealmCodecRegistry
99

1010

src/core/jupiter/core/component.py

Lines changed: 9 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,83 +2,16 @@
22

33
from dataclasses import dataclass
44

5+
from jupiter.core.domain.app import (
6+
AppComponent,
7+
AppCore,
8+
AppDistribution,
9+
AppPlatform,
10+
AppShell,
11+
AppVersion,
12+
)
513
from jupiter.framework_new.component_properties import ComponentProperties
6-
from jupiter.framework_new.value import AtomicValue, EnumValue, enum_value, value
7-
8-
9-
@enum_value
10-
class AppComponent(EnumValue):
11-
"""The component of the app."""
12-
13-
_OLD_WEB = "web"
14-
_OLD_CLI = "cli"
15-
APP = "app"
16-
GC_CRON = "gc-cron"
17-
GEN_CRON = "gen-cron"
18-
STATS_CRON = "stats-cron"
19-
SCHEDULE_EXTERNAL_SYNC_CRON = "schedule-external-sync-cron"
20-
21-
22-
@enum_value
23-
class AppCore(EnumValue):
24-
"""A client facing application."""
25-
26-
CLI = "cli"
27-
WEBUI = "webui"
28-
29-
30-
@enum_value
31-
class AppShell(EnumValue):
32-
"""A shell that wraps a given app."""
33-
34-
CLI = "cli"
35-
BROWSER = "browser"
36-
DESKTOP_ELECTRON = "desktop-electron"
37-
MOBILE_CAPACITOR = "mobile-capacitor"
38-
PWA = "pwa"
39-
40-
41-
@enum_value
42-
class AppPlatform(EnumValue):
43-
"""The platform on which the app is running."""
44-
45-
DESKTOP_MACOS = "desktop-macos"
46-
MOBILE_IOS = "mobile-ios"
47-
MOBILE_ANDROID = "mobile-android"
48-
TABLET_IOS = "tablet-ios"
49-
TABLET_ANDROID = "tablet-android"
50-
51-
52-
@enum_value
53-
class AppDistribution(EnumValue):
54-
"""The distribution channel of the app."""
55-
56-
WEB = "web"
57-
MAC_WEB = "mac-web"
58-
MAC_STORE = "mac-store"
59-
APP_STORE = "app-store"
60-
GOOGLE_PLAY_STORE = "google-play-store"
61-
62-
63-
@enum_value
64-
class AppDistributionState(EnumValue):
65-
"""The distribution state of the app."""
66-
67-
READY = "ready"
68-
IN_REVIEW = "in-review"
69-
NOT_AVAILABLE = "not-available"
70-
71-
72-
@value
73-
class AppVersion(AtomicValue[str]):
74-
"""The version of the app."""
75-
76-
the_version: str
77-
78-
def __str__(self) -> str:
79-
"""Transform this to a string version."""
80-
return self.the_version
81-
14+
from jupiter.framework_new.value import EnumValue
8215

8316

8417
@dataclass(frozen=True)
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"""A client facing application."""
2+
3+
from jupiter.framework_new.value import AtomicValue, EnumValue, enum_value, value
4+
5+
6+
@enum_value
7+
class AppComponent(EnumValue):
8+
"""The component of the app."""
9+
10+
_OLD_WEB = "web"
11+
_OLD_CLI = "cli"
12+
APP = "app"
13+
GC_CRON = "gc-cron"
14+
GEN_CRON = "gen-cron"
15+
STATS_CRON = "stats-cron"
16+
SCHEDULE_EXTERNAL_SYNC_CRON = "schedule-external-sync-cron"
17+
18+
19+
@enum_value
20+
class AppCore(EnumValue):
21+
"""A client facing application."""
22+
23+
CLI = "cli"
24+
WEBUI = "webui"
25+
26+
27+
@enum_value
28+
class AppShell(EnumValue):
29+
"""A shell that wraps a given app."""
30+
31+
CLI = "cli"
32+
BROWSER = "browser"
33+
DESKTOP_ELECTRON = "desktop-electron"
34+
MOBILE_CAPACITOR = "mobile-capacitor"
35+
PWA = "pwa"
36+
37+
38+
@enum_value
39+
class AppPlatform(EnumValue):
40+
"""The platform on which the app is running."""
41+
42+
DESKTOP_MACOS = "desktop-macos"
43+
MOBILE_IOS = "mobile-ios"
44+
MOBILE_ANDROID = "mobile-android"
45+
TABLET_IOS = "tablet-ios"
46+
TABLET_ANDROID = "tablet-android"
47+
48+
49+
@enum_value
50+
class AppDistribution(EnumValue):
51+
"""The distribution channel of the app."""
52+
53+
WEB = "web"
54+
MAC_WEB = "mac-web"
55+
MAC_STORE = "mac-store"
56+
APP_STORE = "app-store"
57+
GOOGLE_PLAY_STORE = "google-play-store"
58+
59+
60+
@enum_value
61+
class AppDistributionState(EnumValue):
62+
"""The distribution state of the app."""
63+
64+
READY = "ready"
65+
IN_REVIEW = "in-review"
66+
NOT_AVAILABLE = "not-available"
67+
68+
69+
@value
70+
class AppVersion(AtomicValue[str]):
71+
"""The version of the app."""
72+
73+
the_version: str
74+
75+
def __str__(self) -> str:
76+
"""Transform this to a string version."""
77+
return self.the_version

src/core/jupiter/core/domain/app_version_decoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""App version decoder."""
22

3-
from jupiter.core.component import AppVersion
3+
from jupiter.core.domain.app import AppVersion
44
from jupiter.framework_new.errors import InputValidationError
55
from jupiter.framework_new.primitive import Primitive
66
from jupiter.framework_new.realms import (

src/core/jupiter/core/domain/application/gc/gc_log_entry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import abc
44

5-
from jupiter.core.component import AppComponent
5+
from jupiter.core.domain.app import AppComponent
66
from jupiter.core.domain.entity_summary import EntitySummary
77
from jupiter.core.domain.sync_target import SyncTarget
88
from jupiter.framework_new.base.entity_id import EntityId

src/core/jupiter/core/domain/application/gen/gen_log_entry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import abc
44

5-
from jupiter.core.component import AppComponent
5+
from jupiter.core.domain.app import AppComponent
66
from jupiter.core.domain.core.recurring_task_period import RecurringTaskPeriod
77
from jupiter.core.domain.entity_summary import EntitySummary
88
from jupiter.core.domain.sync_target import SyncTarget

src/core/jupiter/core/domain/application/stats/stats_log_entry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import abc
44

5-
from jupiter.core.component import AppComponent
5+
from jupiter.core.domain.app import AppComponent
66
from jupiter.core.domain.entity_summary import EntitySummary
77
from jupiter.core.domain.sync_target import SyncTarget
88
from jupiter.framework_new.base.adate import ADate

0 commit comments

Comments
 (0)