@owlmeans/create-app 0.1.18-rc.8 → 0.1.19-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -5
- package/THIRD-PARTY-NOTICES.txt +24 -0
- package/build/args/types.d.ts +9 -0
- package/build/args/types.d.ts.map +1 -0
- package/build/args/types.js +2 -0
- package/build/args/types.js.map +1 -0
- package/build/args.d.ts +3 -20
- package/build/args.d.ts.map +1 -1
- package/build/args.js +121 -88
- package/build/args.js.map +1 -1
- package/build/bin.js +3 -3
- package/build/bin.js.map +1 -1
- package/build/consts.d.ts +6 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +6 -0
- package/build/consts.js.map +1 -0
- package/build/consts.local.d.ts +12 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +49 -0
- package/build/consts.local.js.map +1 -0
- package/build/index.d.ts +11 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -2
- package/build/index.js.map +1 -1
- package/build/naming/types.d.ts +14 -0
- package/build/naming/types.d.ts.map +1 -0
- package/build/naming/types.js +2 -0
- package/build/naming/types.js.map +1 -0
- package/build/naming.d.ts +4 -0
- package/build/naming.d.ts.map +1 -0
- package/build/naming.js +18 -0
- package/build/naming.js.map +1 -0
- package/build/run.d.ts +1 -1
- package/build/run.d.ts.map +1 -1
- package/build/run.js +23 -17
- package/build/run.js.map +1 -1
- package/build/scaffold.d.ts +8 -0
- package/build/scaffold.d.ts.map +1 -0
- package/build/scaffold.js +19 -0
- package/build/scaffold.js.map +1 -0
- package/build/template/types.d.ts +16 -0
- package/build/template/types.d.ts.map +1 -0
- package/build/template/types.js +2 -0
- package/build/template/types.js.map +1 -0
- package/build/template.d.ts +3 -16
- package/build/template.d.ts.map +1 -1
- package/build/template.js +69 -52
- package/build/template.js.map +1 -1
- package/build/types.d.ts +61 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +8 -6
- package/template/AGENTS.md +61 -2
- package/template/README.bare.md +70 -0
- package/template/README.md +9 -60
- package/template/_agents/scripts/link-skills.sh +327 -15
- package/template/_agents/skills/agent-memory/SKILL.md +12 -11
- package/template/_agents/skills/getting-started/SKILL.md +38 -79
- package/template/_agents/skills/logging/SKILL.md +41 -0
- package/template/_agents/skills/memory-promotion/SKILL.md +10 -4
- package/template/_agents/skills/memory-recompact/SKILL.md +15 -14
- package/template/_agents/skills/owlmeans-code-structure/SKILL.md +188 -0
- package/template/_agents/skills/owlmeans-code-structure/parts/code-structure-reference.md +125 -0
- package/template/_agents/skills/reuse-code/SKILL.md +56 -10
- package/template/_agents/skills/self-education/SKILL.md +25 -5
- package/template/_agents/skills/skill-authoring/SKILL.md +132 -14
- package/template/_bare.json +24 -0
- package/template/_gitignore +8 -0
- package/template/bunfig.toml +2 -0
- package/template/package.json +3 -2
- package/template/sources/api/package.json +5 -4
- package/template/sources/api/src/app/session/add.ts +6 -17
- package/template/sources/api/src/app/session/list.ts +6 -12
- package/template/sources/api/src/app/session/remove.ts +6 -15
- package/template/sources/api/src/config.ts +7 -0
- package/template/sources/api/src/context.bare.ts +11 -0
- package/template/sources/api/src/context.ts +0 -4
- package/template/sources/api/src/entrypoints.bare.ts +4 -0
- package/template/sources/api/src/entrypoints.ts +13 -0
- package/template/sources/api/src/index.ts +8 -2
- package/template/sources/api/src/models/session/types.ts +14 -0
- package/template/sources/api/src/models/session.ts +43 -0
- package/template/sources/api/src/types.bare.ts +5 -0
- package/template/sources/common/package.json +8 -8
- package/template/sources/common/src/config.ts +2 -1
- package/template/sources/common/src/consts.bare.ts +8 -0
- package/template/sources/common/src/consts.ts +0 -14
- package/template/sources/common/src/entrypoints.bare.ts +14 -0
- package/template/sources/common/src/entrypoints.ts +60 -0
- package/template/sources/common/src/index.bare.ts +3 -0
- package/template/sources/common/src/index.ts +1 -1
- package/template/sources/common/src/schemas.ts +7 -7
- package/template/sources/web/THIRD-PARTY-NOTICES.txt +24 -0
- package/template/sources/web/index.html +3 -1
- package/template/sources/web/package.json +33 -32
- package/template/sources/web/src/components/ui/dropdown-menu.tsx +257 -0
- package/template/sources/web/src/config.ts +8 -0
- package/template/sources/web/src/consts.ts +15 -0
- package/template/sources/web/src/context.bare.ts +13 -0
- package/template/sources/web/src/context.ts +1 -7
- package/template/sources/web/src/entrypoints.bare.ts +13 -0
- package/template/sources/web/src/entrypoints.ts +16 -0
- package/template/sources/web/src/index.css +1 -1
- package/template/sources/web/src/index.tsx +2 -2
- package/template/sources/web/src/layout/main.tsx +7 -2
- package/template/sources/web/src/nav.bare.ts +24 -0
- package/template/sources/web/src/nav.ts +3 -8
- package/template/sources/web/src/screens/home.bare.tsx +17 -0
- package/template/sources/web/src/screens/session.tsx +14 -16
- package/template/sources/web/src/vite-env.d.ts +8 -0
- package/template/sources/web/vite.config.ts +4 -2
- package/template/CLAUDE.md +0 -13
- package/template/sources/api/src/modules.ts +0 -11
- package/template/sources/common/src/modules.ts +0 -26
- package/template/sources/web/src/modules.ts +0 -22
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { makeContext as makeBasicContext, useContext as useBasicContext } from '@owlmeans/web-panel'
|
|
2
2
|
import { appendStateResource } from '@owlmeans/state'
|
|
3
3
|
import type { Config, Context } from './types.js'
|
|
4
|
-
|
|
5
|
-
/** The alias the session items are stored under. Screens address the store by it, never by path. */
|
|
6
|
-
export const SESSION_STATE = 'session-items'
|
|
4
|
+
import { SESSION_STATE } from './consts.js'
|
|
7
5
|
|
|
8
6
|
export const useContext = (): Context => useBasicContext<Config, Context>()
|
|
9
7
|
|
|
@@ -15,9 +13,5 @@ export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T =
|
|
|
15
13
|
// the app in a module of its own.
|
|
16
14
|
appendStateResource<C, T>(context, SESSION_STATE)
|
|
17
15
|
|
|
18
|
-
// A child context has to inherit THIS factory, not the layer's. Without the line, a derived
|
|
19
|
-
// context is built without the resource registered above and every lookup on it throws.
|
|
20
|
-
context.makeContext = makeContext as typeof context.makeContext
|
|
21
|
-
|
|
22
16
|
return context
|
|
23
17
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { bindAll, bindScreen, entrypoints as baseEntrypoints, handler } from '@owlmeans/web-panel'
|
|
2
|
+
import { appProtocols } from '__APP_SLUG__-common'
|
|
3
|
+
import { MainLayout } from './layout/main.js'
|
|
4
|
+
import { HomeScreen } from './screens/home.js'
|
|
5
|
+
|
|
6
|
+
/** Local browser bindings for shared API and screen protocols. */
|
|
7
|
+
export const appBindings = [
|
|
8
|
+
...baseEntrypoints,
|
|
9
|
+
...bindAll(appProtocols.api),
|
|
10
|
+
// BASE renders the shared layout; HOME is its default child.
|
|
11
|
+
bindScreen(appProtocols.web.base, handler(MainLayout)),
|
|
12
|
+
bindScreen(appProtocols.web.home, handler(HomeScreen)),
|
|
13
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { bindAll, bindScreen, entrypoints as baseEntrypoints, handler } from '@owlmeans/web-panel'
|
|
2
|
+
import { appProtocols } from '__APP_SLUG__-common'
|
|
3
|
+
import { MainLayout } from './layout/main.js'
|
|
4
|
+
import { AboutScreen } from './screens/about.js'
|
|
5
|
+
import { HomeScreen } from './screens/home.js'
|
|
6
|
+
import { SessionScreen } from './screens/session.js'
|
|
7
|
+
|
|
8
|
+
/** Local browser bindings for shared API and screen protocols. */
|
|
9
|
+
export const appBindings = [
|
|
10
|
+
...baseEntrypoints,
|
|
11
|
+
...bindAll(appProtocols.api),
|
|
12
|
+
bindScreen(appProtocols.web.base, handler(MainLayout)),
|
|
13
|
+
bindScreen(appProtocols.web.home, handler(HomeScreen)),
|
|
14
|
+
bindScreen(appProtocols.web.session, handler(SessionScreen)),
|
|
15
|
+
bindScreen(appProtocols.web.about, handler(AboutScreen)),
|
|
16
|
+
]
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* scan by default — so the classes that exist ONLY inside @owlmeans/web-panel components
|
|
6
6
|
* (the navigation shell, the footer) would never reach the stylesheet. This line adds them.
|
|
7
7
|
*/
|
|
8
|
-
@source "../../../node_modules/@owlmeans/web-panel/
|
|
8
|
+
@source "../../../node_modules/@owlmeans/web-panel/src";
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* shadcn / Tailwind v4 design tokens (new-york, neutral). The app owns these — they
|
|
@@ -2,12 +2,12 @@ import './index.css'
|
|
|
2
2
|
import { APP_API, APP_WEB } from '__APP_SLUG__-common'
|
|
3
3
|
import config from './config.js'
|
|
4
4
|
import { makeContext } from './context.js'
|
|
5
|
-
import {
|
|
5
|
+
import { appBindings } from './entrypoints.js'
|
|
6
6
|
import { render } from './render.js'
|
|
7
7
|
import type { Config, Context } from './types.js'
|
|
8
8
|
|
|
9
9
|
const context = makeContext<Config, Context>(config)
|
|
10
|
-
context.registerEntrypoints(
|
|
10
|
+
context.registerEntrypoints(appBindings)
|
|
11
11
|
|
|
12
12
|
context.serviceRoute(APP_WEB, true)
|
|
13
13
|
context.serviceRoute(APP_API, true)
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { FC, PropsWithChildren } from 'react'
|
|
2
2
|
import { NavLayout } from '@owlmeans/web-panel'
|
|
3
|
-
import {
|
|
3
|
+
import { navConfig } from '@/nav'
|
|
4
|
+
import { footerLinks } from '@/consts'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The application shell. `NavLayout` renders the header with the section menu, the side menu
|
|
7
8
|
* of the active section (hidden when that section has a single screen), the content, and the
|
|
8
9
|
* footer — the screen arrives as `children`.
|
|
10
|
+
*
|
|
11
|
+
* The page width comes from the shell, which applies it to the header, the content and the
|
|
12
|
+
* footer alike; set `containerClassName` to change it for all three at once, never a width on
|
|
13
|
+
* the content alone.
|
|
9
14
|
*/
|
|
10
15
|
export const MainLayout: FC<PropsWithChildren> = ({ children }) => (
|
|
11
|
-
<NavLayout nav={navConfig} title="__APP_NAME__" footer={footerLinks}
|
|
16
|
+
<NavLayout nav={navConfig} title="__APP_NAME__" footer={footerLinks}>
|
|
12
17
|
{children}
|
|
13
18
|
</NavLayout>
|
|
14
19
|
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HOME } from '@owlmeans/web-panel'
|
|
2
|
+
import type { PanelNavConfig, PanelNavLink } from '@owlmeans/web-panel'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The application's navigation, as data.
|
|
6
|
+
*
|
|
7
|
+
* Sections are the top menu; their items are the side menu of whichever section is active.
|
|
8
|
+
* A section holding ONE item renders no side menu at all — which is why the single-screen
|
|
9
|
+
* shell below shows none. Labels here are literal; drop them to fall back on the panel i18n
|
|
10
|
+
* keys (`nav.<section>` / `modules.<alias>`) instead.
|
|
11
|
+
*/
|
|
12
|
+
export const navConfig: PanelNavConfig = {
|
|
13
|
+
sections: [
|
|
14
|
+
{ name: 'home', label: 'Home', items: [{ alias: HOME, label: 'Overview' }] },
|
|
15
|
+
],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// The platform/owner credit — "Powered by OwlMeans" and the copyright the platform delivers — is
|
|
19
|
+
// rendered by the shell itself (`NavLayout`'s `Footer`) and is never a footer link: an app link
|
|
20
|
+
// list is places IN the app, and the credit is not one of those.
|
|
21
|
+
export const footerLinks: PanelNavLink[] = [
|
|
22
|
+
{ href: '/THIRD-PARTY-NOTICES.txt', label: 'Third-party notices' },
|
|
23
|
+
{ alias: HOME, label: '__APP_NAME__' },
|
|
24
|
+
]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HOME } from '@owlmeans/web-panel'
|
|
2
|
-
import type { PanelNavConfig, PanelNavLink } from '@owlmeans/web-panel'
|
|
1
|
+
import { HOME, type PanelNavConfig } from '@owlmeans/web-panel'
|
|
3
2
|
import { web } from '__APP_SLUG__-common'
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -15,14 +14,10 @@ export const navConfig: PanelNavConfig = {
|
|
|
15
14
|
{ name: 'home', label: 'Home', items: [{ alias: HOME, label: 'Overview' }] },
|
|
16
15
|
{
|
|
17
16
|
name: 'demo', label: 'Demo', items: [
|
|
18
|
-
{ alias: web.session, label: 'Session' },
|
|
19
|
-
{ alias: web.about, label: 'About' },
|
|
17
|
+
{ alias: web.session.alias, label: 'Session' },
|
|
18
|
+
{ alias: web.about.alias, label: 'About' },
|
|
20
19
|
]
|
|
21
20
|
},
|
|
22
21
|
],
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export const footerLinks: PanelNavLink[] = [
|
|
26
|
-
{ alias: HOME, label: '__APP_NAME__' },
|
|
27
|
-
{ href: 'https://owlmeans.com', label: 'OwlMeans', open: true },
|
|
28
|
-
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC } from 'react'
|
|
2
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
|
3
|
+
|
|
4
|
+
export const HomeScreen: FC = () => (
|
|
5
|
+
<Card>
|
|
6
|
+
<CardHeader>
|
|
7
|
+
<CardTitle>__APP_NAME__</CardTitle>
|
|
8
|
+
<CardDescription>__APP_DESCRIPTION__</CardDescription>
|
|
9
|
+
</CardHeader>
|
|
10
|
+
<CardContent>
|
|
11
|
+
<p className="text-sm text-muted-foreground">
|
|
12
|
+
Screens live in <code>src/screens</code>, the menu that reaches them in
|
|
13
|
+
{' '}<code>src/nav.ts</code>, and the routes they hang off in <code>src/entrypoints.ts</code>.
|
|
14
|
+
</p>
|
|
15
|
+
</CardContent>
|
|
16
|
+
</Card>
|
|
17
|
+
)
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { useEffect, useState, type FC } from 'react'
|
|
2
|
-
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
3
2
|
import { useStoreList } from '@owlmeans/client'
|
|
4
3
|
import { session, type SessionItem } from '__APP_SLUG__-common'
|
|
5
|
-
import {
|
|
4
|
+
import { useContext } from '../context.js'
|
|
5
|
+
import { SESSION_ID_KEY, SESSION_STATE } from '../consts.js'
|
|
6
6
|
import { Button } from '@/components/ui/button'
|
|
7
7
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
8
8
|
import { Input } from '@/components/ui/input'
|
|
9
9
|
|
|
10
|
-
const SID_KEY = '__APP_SLUG__-sid'
|
|
11
|
-
|
|
12
10
|
const sessionId = (): string => {
|
|
13
|
-
let sid = localStorage.getItem(
|
|
11
|
+
let sid = localStorage.getItem(SESSION_ID_KEY)
|
|
14
12
|
if (sid == null) {
|
|
15
13
|
sid = crypto.randomUUID()
|
|
16
|
-
localStorage.setItem(
|
|
14
|
+
localStorage.setItem(SESSION_ID_KEY, sid)
|
|
17
15
|
}
|
|
18
16
|
return sid
|
|
19
17
|
}
|
|
@@ -33,15 +31,15 @@ export const SessionScreen: FC = () => {
|
|
|
33
31
|
*/
|
|
34
32
|
const items = useStoreList<SessionItem>({ query: {}, resource: SESSION_STATE })
|
|
35
33
|
|
|
36
|
-
// The server is the source of truth; the store is what the screen reads. Fetch once,
|
|
37
|
-
// what came back
|
|
34
|
+
// The server is the source of truth; the store is what the screen reads. Fetch once, install
|
|
35
|
+
// what came back, and let the subscription render it. `replace` rather than a save per item:
|
|
36
|
+
// the endpoint answers with the session's whole set, so an item removed on another tab has to
|
|
37
|
+
// leave the store too, and one write wakes the subscribers once instead of once per record.
|
|
38
38
|
const load = async () => {
|
|
39
|
-
const
|
|
40
|
-
.entrypoint
|
|
39
|
+
const data = await ctx
|
|
40
|
+
.entrypoint(session.list)
|
|
41
41
|
.call({ params: { sid } })
|
|
42
|
-
|
|
43
|
-
await store.save(item)
|
|
44
|
-
}
|
|
42
|
+
await store.replace(data ?? [])
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
useEffect(() => { void load() }, [])
|
|
@@ -50,8 +48,8 @@ export const SessionScreen: FC = () => {
|
|
|
50
48
|
if (text.trim() === '') return
|
|
51
49
|
setBusy(true)
|
|
52
50
|
try {
|
|
53
|
-
const
|
|
54
|
-
.entrypoint
|
|
51
|
+
const item = await ctx
|
|
52
|
+
.entrypoint(session.add)
|
|
55
53
|
.call({ params: { sid }, body: { text } })
|
|
56
54
|
setText('')
|
|
57
55
|
if (item != null) {
|
|
@@ -64,7 +62,7 @@ export const SessionScreen: FC = () => {
|
|
|
64
62
|
|
|
65
63
|
const remove = async (id: string) => {
|
|
66
64
|
await ctx
|
|
67
|
-
.entrypoint
|
|
65
|
+
.entrypoint(session.remove)
|
|
68
66
|
.call({ params: { sid, id } })
|
|
69
67
|
await store.delete(id)
|
|
70
68
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
/** `debug` | `info` | `warn` | `error` | `silent`. Default: `debug` under `vite`, `info` in a build. */
|
|
5
|
+
readonly VITE_LOG_LEVEL?: string
|
|
6
|
+
/** Scopes forced to debug whatever the level is, e.g. `session,i18n` or `*`. */
|
|
7
|
+
readonly VITE_LOG_DEBUG?: string
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { createThirdPartyNoticesPlugin } from '@owlmeans/dep-config/notices'
|
|
1
2
|
import { defineConfig } from 'vite'
|
|
2
3
|
import react from '@vitejs/plugin-react'
|
|
3
|
-
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
4
4
|
import tailwindcss from '@tailwindcss/vite'
|
|
5
5
|
import path from 'path'
|
|
6
6
|
|
|
@@ -14,13 +14,15 @@ const owlMeansSingletons = [
|
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
export default defineConfig({
|
|
17
|
-
plugins: [
|
|
17
|
+
plugins: [createThirdPartyNoticesPlugin({ root: import.meta.dirname, additionalPackages: ['tailwindcss'] }), react(), tailwindcss()],
|
|
18
18
|
server: {
|
|
19
19
|
port: 3001,
|
|
20
20
|
host: '0.0.0.0',
|
|
21
21
|
strictPort: true,
|
|
22
22
|
},
|
|
23
23
|
resolve: {
|
|
24
|
+
// Vite resolves the `paths` of tsconfig.json itself since 8.
|
|
25
|
+
tsconfigPaths: true,
|
|
24
26
|
alias: [
|
|
25
27
|
{ find: '@', replacement: path.resolve(__dirname, 'src') },
|
|
26
28
|
],
|
package/template/CLAUDE.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
@AGENTS.md
|
|
2
|
-
|
|
3
|
-
## Claude Code bridge
|
|
4
|
-
|
|
5
|
-
All guidance lives in `AGENTS.md` (imported above) and in skills under
|
|
6
|
-
`.agents/skills/<name>/SKILL.md` — the single canonical location shared with Copilot
|
|
7
|
-
and Codex. `.claude/skills/` holds only generated per-skill symlinks (gitignored
|
|
8
|
-
except `.gitkeep`); the committed `SessionStart` hook runs
|
|
9
|
-
`sh .agents/scripts/link-skills.sh` to (re)create them each session.
|
|
10
|
-
|
|
11
|
-
- Never author files under `.claude/skills/` — write skills in `.agents/skills/`.
|
|
12
|
-
- After creating, renaming, or deleting a skill, re-run
|
|
13
|
-
`sh .agents/scripts/link-skills.sh` so this session picks it up.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { elevate, modules } from '@owlmeans/server-app'
|
|
2
|
-
import { session, sessionModules } from '__APP_SLUG__-common'
|
|
3
|
-
import * as handlers from './app/session/index.js'
|
|
4
|
-
|
|
5
|
-
// Attach handler implementations to the shared entrypoint declarations.
|
|
6
|
-
elevate(sessionModules, session.base)
|
|
7
|
-
elevate(sessionModules, session.list, handlers.list)
|
|
8
|
-
elevate(sessionModules, session.add, handlers.add)
|
|
9
|
-
elevate(sessionModules, session.remove, handlers.remove)
|
|
10
|
-
|
|
11
|
-
export const appModules = [...modules, ...sessionModules]
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { body, entrypoint, filter, params } from '@owlmeans/entrypoint'
|
|
2
|
-
import { route, RouteMethod } from '@owlmeans/route'
|
|
3
|
-
import { session } from './consts.js'
|
|
4
|
-
import { AddItemSchema, ItemParamsSchema, SessionParamsSchema } from './schemas.js'
|
|
5
|
-
import type { AddItemPayload, ItemParams, SessionParams } from './types.js'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Shared entrypoint declarations. The api elevates these with handlers; the web
|
|
9
|
-
* elevates them with screen components and calls them. Routes resolve under the
|
|
10
|
-
* api service `base` (`/api`), so e.g. `session.list` → `GET /api/session/:sid/items`.
|
|
11
|
-
*/
|
|
12
|
-
export const sessionModules = [
|
|
13
|
-
entrypoint(route(session.base, '/session')),
|
|
14
|
-
entrypoint(
|
|
15
|
-
route(session.list, '/:sid/items', { parent: session.base, method: RouteMethod.GET }),
|
|
16
|
-
filter(params<SessionParams>(SessionParamsSchema)),
|
|
17
|
-
),
|
|
18
|
-
entrypoint(
|
|
19
|
-
route(session.add, '/:sid/items', { parent: session.base, method: RouteMethod.POST }),
|
|
20
|
-
filter(params<SessionParams>(SessionParamsSchema, body<AddItemPayload>(AddItemSchema))),
|
|
21
|
-
),
|
|
22
|
-
entrypoint(
|
|
23
|
-
route(session.remove, '/:sid/items/:id', { parent: session.base, method: RouteMethod.DELETE }),
|
|
24
|
-
filter(params<ItemParams>(ItemParamsSchema)),
|
|
25
|
-
),
|
|
26
|
-
]
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BASE, elevate, entrypoint, frontend, handler, HOME, modules as baseModules, route } from '@owlmeans/web-panel'
|
|
2
|
-
import { session, sessionModules, web } from '__APP_SLUG__-common'
|
|
3
|
-
import { MainLayout } from './layout/main.js'
|
|
4
|
-
import { AboutScreen } from './screens/about.js'
|
|
5
|
-
import { HomeScreen } from './screens/home.js'
|
|
6
|
-
import { SessionScreen } from './screens/session.js'
|
|
7
|
-
|
|
8
|
-
const modules = [...baseModules, ...sessionModules]
|
|
9
|
-
|
|
10
|
-
// Backend entrypoints — elevated without a component so the client can call them.
|
|
11
|
-
elevate(modules, session.base)
|
|
12
|
-
elevate(modules, session.list)
|
|
13
|
-
elevate(modules, session.add)
|
|
14
|
-
elevate(modules, session.remove)
|
|
15
|
-
|
|
16
|
-
// Frontend layout + screens. BASE renders the shared layout; HOME is its default child.
|
|
17
|
-
modules.push(entrypoint(route(BASE, '/', frontend()), handler(MainLayout)))
|
|
18
|
-
modules.push(entrypoint(route(HOME, '/', frontend({ default: true, parent: BASE })), handler(HomeScreen)))
|
|
19
|
-
modules.push(entrypoint(route(web.session, '/session', frontend({ parent: BASE })), handler(SessionScreen)))
|
|
20
|
-
modules.push(entrypoint(route(web.about, '/about', frontend({ parent: BASE })), handler(AboutScreen)))
|
|
21
|
-
|
|
22
|
-
export const appModules = modules
|