@topogram/template-todo 0.1.30

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.
Files changed (85) hide show
  1. package/README.md +91 -0
  2. package/implementation/README.md +9 -0
  3. package/implementation/backend/reference.js +206 -0
  4. package/implementation/backend/repository-reference.js +74 -0
  5. package/implementation/backend/repository-renderers.js +442 -0
  6. package/implementation/index.js +53 -0
  7. package/implementation/runtime/check-renderers.js +215 -0
  8. package/implementation/runtime/checks.js +120 -0
  9. package/implementation/runtime/reference.js +92 -0
  10. package/implementation/web/reference.js +51 -0
  11. package/implementation/web/renderers.js +1223 -0
  12. package/implementation/web/screens-reference.js +15 -0
  13. package/package.json +31 -0
  14. package/topogram/actors/actor-user.tg +6 -0
  15. package/topogram/capabilities/cap-complete-task.tg +12 -0
  16. package/topogram/capabilities/cap-create-project.tg +11 -0
  17. package/topogram/capabilities/cap-create-task.tg +14 -0
  18. package/topogram/capabilities/cap-create-user.tg +11 -0
  19. package/topogram/capabilities/cap-delete-task.tg +12 -0
  20. package/topogram/capabilities/cap-download-task-export.tg +10 -0
  21. package/topogram/capabilities/cap-export-tasks.tg +11 -0
  22. package/topogram/capabilities/cap-get-project.tg +11 -0
  23. package/topogram/capabilities/cap-get-task-export-job.tg +11 -0
  24. package/topogram/capabilities/cap-get-task.tg +11 -0
  25. package/topogram/capabilities/cap-get-user.tg +11 -0
  26. package/topogram/capabilities/cap-list-projects.tg +11 -0
  27. package/topogram/capabilities/cap-list-tasks.tg +11 -0
  28. package/topogram/capabilities/cap-list-users.tg +11 -0
  29. package/topogram/capabilities/cap-update-project.tg +12 -0
  30. package/topogram/capabilities/cap-update-task.tg +12 -0
  31. package/topogram/capabilities/cap-update-user.tg +12 -0
  32. package/topogram/components/component-ui-task-board.tg +33 -0
  33. package/topogram/components/component-ui-task-calendar.tg +30 -0
  34. package/topogram/components/component-ui-task-summary.tg +23 -0
  35. package/topogram/components/component-ui-task-table.tg +34 -0
  36. package/topogram/decisions/decision-task-ownership.tg +9 -0
  37. package/topogram/docs/glossary/user.md +22 -0
  38. package/topogram/docs/journeys/task-creation-and-ownership.md +57 -0
  39. package/topogram/entities/entity-project.tg +28 -0
  40. package/topogram/entities/entity-task.tg +38 -0
  41. package/topogram/entities/entity-user.tg +24 -0
  42. package/topogram/enums/enum-export-job-status.tg +3 -0
  43. package/topogram/enums/enum-project-status.tg +3 -0
  44. package/topogram/enums/enum-task-priority.tg +3 -0
  45. package/topogram/enums/enum-task-status.tg +3 -0
  46. package/topogram/operations/operation-task-creation-monitoring.tg +10 -0
  47. package/topogram/projections/proj-api.tg +177 -0
  48. package/topogram/projections/proj-db-postgres.tg +55 -0
  49. package/topogram/projections/proj-db-sqlite.tg +47 -0
  50. package/topogram/projections/proj-ui-shared.tg +133 -0
  51. package/topogram/projections/proj-ui-web-react.tg +92 -0
  52. package/topogram/projections/proj-ui-web.tg +92 -0
  53. package/topogram/rules/rule-no-task-creation-in-archived-project.tg +10 -0
  54. package/topogram/rules/rule-only-active-users-may-own-tasks.tg +10 -0
  55. package/topogram/shapes/shape-input-complete-task.tg +11 -0
  56. package/topogram/shapes/shape-input-create-project.tg +6 -0
  57. package/topogram/shapes/shape-input-create-task.tg +6 -0
  58. package/topogram/shapes/shape-input-create-user.tg +6 -0
  59. package/topogram/shapes/shape-input-delete-task.tg +10 -0
  60. package/topogram/shapes/shape-input-export-tasks.tg +13 -0
  61. package/topogram/shapes/shape-input-get-project.tg +10 -0
  62. package/topogram/shapes/shape-input-get-task-export-job.tg +10 -0
  63. package/topogram/shapes/shape-input-get-task.tg +10 -0
  64. package/topogram/shapes/shape-input-get-user.tg +10 -0
  65. package/topogram/shapes/shape-input-list-projects.tg +11 -0
  66. package/topogram/shapes/shape-input-list-tasks.tg +14 -0
  67. package/topogram/shapes/shape-input-list-users.tg +11 -0
  68. package/topogram/shapes/shape-input-update-project.tg +14 -0
  69. package/topogram/shapes/shape-input-update-task.tg +16 -0
  70. package/topogram/shapes/shape-input-update-user.tg +13 -0
  71. package/topogram/shapes/shape-output-project-card.tg +6 -0
  72. package/topogram/shapes/shape-output-project-detail.tg +6 -0
  73. package/topogram/shapes/shape-output-task-card.tg +19 -0
  74. package/topogram/shapes/shape-output-task-detail.tg +6 -0
  75. package/topogram/shapes/shape-output-task-export-callback.tg +14 -0
  76. package/topogram/shapes/shape-output-task-export-job.tg +13 -0
  77. package/topogram/shapes/shape-output-task-export-status.tg +17 -0
  78. package/topogram/shapes/shape-output-user-card.tg +6 -0
  79. package/topogram/shapes/shape-output-user-detail.tg +6 -0
  80. package/topogram/terms/term-user.tg +5 -0
  81. package/topogram/verifications/verification-create-task-policy.tg +15 -0
  82. package/topogram/verifications/verification-runtime-smoke.tg +16 -0
  83. package/topogram/verifications/verification-task-runtime-flow.tg +31 -0
  84. package/topogram-template.json +11 -0
  85. package/topogram.project.json +53 -0
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # Topogram Todo Template
2
+
3
+ Topogram template package for starting a generated Todo app.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ topogram template list
9
+ topogram catalog show todo
10
+ topogram new ./todo-app --template todo --catalog github:attebury/topograms/topograms.catalog.json
11
+ cd ./todo-app
12
+ npm install
13
+ npm run doctor
14
+ npm run check
15
+ npm run generate
16
+ npm run verify
17
+ ```
18
+
19
+ The public start path is the `todo` catalog alias. The catalog resolves that
20
+ alias to the current `@topogram/template-todo` package version.
21
+
22
+ This template includes executable implementation provider JavaScript under `implementation/`.
23
+ `topogram new` copies that code but does not execute it; `topogram generate`
24
+ may load it later after local trust metadata is recorded. Use it as trusted code
25
+ from the `@topogram` package scope.
26
+
27
+ The Topogram source includes reusable UI components for task summary metrics,
28
+ task tables, task boards, and task calendars. `proj_ui_shared` owns their
29
+ screen and region placement through `ui_components`, so SvelteKit and React web
30
+ projections inherit the same component contract metadata.
31
+
32
+ ## Runtime Semantics
33
+
34
+ This template owns the Todo product semantics for the generated SvelteKit,
35
+ Hono, and Postgres app. Runtime checks are intentionally template-specific, not
36
+ engine tests.
37
+
38
+ The full generated runtime check exercises bearer-demo auth and lifecycle
39
+ behavior. Manager/admin endpoints such as export read/download/delete require
40
+ `TOPOGRAM_AUTH_ROLES=manager` and `TOPOGRAM_AUTH_ADMIN=true`; web-facing checks
41
+ still verify user-scoped behavior with the sample auth environment.
42
+
43
+ ## Verification
44
+
45
+ ```bash
46
+ npm run pack:check
47
+ ```
48
+
49
+ See [`CONSUMER_PROOF.md`](./CONSUMER_PROOF.md) for the verification standard
50
+ this repo must keep before publishing the template package.
51
+
52
+ This runs reusable template conformance with `topogram template check`, packs
53
+ the template, creates a disposable starter with `topogram new --template
54
+ <tarball>`, installs the starter, runs `npm run doctor`, runs `npm run source:status`,
55
+ runs `npm run template:detach:dry-run`, runs `npm run check`, runs `npm run generate`,
56
+ runs the generated app compile check, and verifies the generated app sentinel. This package-level smoke
57
+ test intentionally uses the packed tarball directly; consumer-facing creation
58
+ is verified in `topogram-demo-todo` through the `todo` catalog alias.
59
+
60
+ By default the smoke test installs the `@topogram/cli` version pinned in
61
+ `topogram-cli.version`. Override it with:
62
+
63
+ ```bash
64
+ TOPOGRAM_CLI_PACKAGE_SPEC=/path/to/attebury-topogram-0.3.2.tgz npm run pack:check
65
+ ```
66
+
67
+ ## Release
68
+
69
+ ```bash
70
+ npm run release:prepare -- 0.1.2
71
+ npm run release:check
72
+ npm run pack:check
73
+ ```
74
+
75
+ Commit the updated package metadata, then publish with the `Publish Template Package` GitHub Actions workflow. The workflow publishes the committed version and can create a `topogram-template-todo-v<version>` tag.
76
+
77
+ After publishing a template version, update the catalog from this repo instead
78
+ of hand-editing the `todo` entry:
79
+
80
+ ```bash
81
+ npm run catalog:update -- ../topograms/topograms.catalog.json
82
+ ```
83
+
84
+ The script verifies `package.json` and `topogram-template.json` agree, then
85
+ updates only the catalog entry with `id: "todo"` and package
86
+ `@topogram/template-todo`. Use `--check` when you only want to verify
87
+ the catalog is already aligned:
88
+
89
+ ```bash
90
+ npm run catalog:update -- ../topograms/topograms.catalog.json --check
91
+ ```
@@ -0,0 +1,9 @@
1
+ # Web API DB Implementation
2
+
3
+ This folder holds template implementation details used by the current generated app bundle.
4
+
5
+ Examples include:
6
+
7
+ - seed data
8
+ - runtime metadata
9
+ - backend and web reference implementation choices
@@ -0,0 +1,206 @@
1
+ export const TODO_BACKEND_REFERENCE = {
2
+ serviceName: "topogram-todo-server",
3
+ renderSeedScript() {
4
+ const reference = TODO_BACKEND_REFERENCE;
5
+ const serializedTasks = JSON.stringify(reference.demo.tasks, null, 2).replace(/"NOW"/g, "now");
6
+ return `import { PrismaClient } from "@prisma/client";
7
+
8
+ const prisma = new PrismaClient();
9
+
10
+ const demoUserId = process.env.TOPOGRAM_DEMO_USER_ID || "${reference.demo.userId}";
11
+ const demoProjectId = process.env.TOPOGRAM_DEMO_CONTAINER_ID || "${reference.demo.projectId}";
12
+ const demoTaskId = process.env.TOPOGRAM_DEMO_PRIMARY_ID || "${reference.demo.taskId}";
13
+
14
+ async function main() {
15
+ const now = new Date();
16
+
17
+ await prisma.user.upsert({
18
+ where: { email: "${reference.demo.user.email}" },
19
+ update: {
20
+ display_name: "${reference.demo.user.displayName}",
21
+ is_active: true
22
+ },
23
+ create: {
24
+ id: demoUserId,
25
+ email: "${reference.demo.user.email}",
26
+ display_name: "${reference.demo.user.displayName}",
27
+ is_active: true,
28
+ created_at: now
29
+ }
30
+ });
31
+
32
+ await prisma.project.upsert({
33
+ where: { name: "${reference.demo.project.name}" },
34
+ update: {
35
+ status: "${reference.demo.project.status}",
36
+ description: "${reference.demo.project.description}",
37
+ owner_id: demoUserId
38
+ },
39
+ create: {
40
+ id: demoProjectId,
41
+ name: "${reference.demo.project.name}",
42
+ description: "${reference.demo.project.description}",
43
+ status: "${reference.demo.project.status}",
44
+ owner_id: demoUserId,
45
+ created_at: now
46
+ }
47
+ });
48
+
49
+ const tasks = ${serializedTasks};
50
+
51
+ for (const task of tasks) {
52
+ await prisma.task.upsert({
53
+ where: { id: task.id },
54
+ update: {
55
+ title: task.title,
56
+ description: task.description,
57
+ status: task.status,
58
+ priority: task.priority,
59
+ owner_id: demoUserId,
60
+ project_id: demoProjectId,
61
+ completed_at: task.completed_at,
62
+ due_at: task.due_at,
63
+ updated_at: now
64
+ },
65
+ create: {
66
+ id: task.id,
67
+ title: task.title,
68
+ description: task.description,
69
+ status: task.status,
70
+ priority: task.priority,
71
+ owner_id: demoUserId,
72
+ project_id: demoProjectId,
73
+ created_at: now,
74
+ updated_at: now,
75
+ completed_at: task.completed_at,
76
+ due_at: task.due_at
77
+ }
78
+ });
79
+ }
80
+
81
+ console.log(JSON.stringify({
82
+ ok: true,
83
+ demoUserId,
84
+ demoProjectId,
85
+ demoTaskId,
86
+ seededTaskCount: tasks.length
87
+ }, null, 2));
88
+ }
89
+
90
+ main()
91
+ .catch((error) => {
92
+ console.error(error);
93
+ process.exitCode = 1;
94
+ })
95
+ .finally(async () => {
96
+ await prisma.$disconnect();
97
+ });
98
+ `;
99
+ },
100
+ demo: {
101
+ userId: "11111111-1111-4111-8111-111111111111",
102
+ projectId: "22222222-2222-4222-8222-222222222222",
103
+ taskId: "33333333-3333-4333-8333-333333333333",
104
+ user: {
105
+ email: "demo.user@topogram.local",
106
+ displayName: "Demo User"
107
+ },
108
+ project: {
109
+ name: "Demo Project",
110
+ description: "Seeded demo project for the generated Todo runtime",
111
+ status: "active"
112
+ },
113
+ tasks: [
114
+ {
115
+ id: "33333333-3333-4333-8333-333333333333",
116
+ title: "Seeded Demo Task",
117
+ description: "This task was created by the generated demo seed script.",
118
+ priority: "high",
119
+ status: "active",
120
+ completed_at: null,
121
+ due_at: null
122
+ },
123
+ {
124
+ id: "33333333-3333-4333-8333-333333333334",
125
+ title: "Plan release notes",
126
+ description: "Collect the key v0.1 highlights for the generated app bundle.",
127
+ priority: "medium",
128
+ status: "draft",
129
+ completed_at: null,
130
+ due_at: null
131
+ },
132
+ {
133
+ id: "33333333-3333-4333-8333-333333333335",
134
+ title: "Review generated OpenAPI",
135
+ description: "Check that the latest OpenAPI output matches the shipped runtime.",
136
+ priority: "high",
137
+ status: "active",
138
+ completed_at: null,
139
+ due_at: null
140
+ },
141
+ {
142
+ id: "33333333-3333-4333-8333-333333333336",
143
+ title: "Write onboarding guide",
144
+ description: "Summarize the golden path for a new team adopting the generated stack.",
145
+ priority: "medium",
146
+ status: "active",
147
+ completed_at: null,
148
+ due_at: null
149
+ },
150
+ {
151
+ id: "33333333-3333-4333-8333-333333333337",
152
+ title: "Verify local process profile",
153
+ description: "Confirm the no-Docker environment profile still works after recent changes.",
154
+ priority: "low",
155
+ status: "completed",
156
+ completed_at: "NOW",
157
+ due_at: null
158
+ },
159
+ {
160
+ id: "33333333-3333-4333-8333-333333333338",
161
+ title: "Create export fixtures",
162
+ description: "Seed a few realistic export records for smoke testing.",
163
+ priority: "medium",
164
+ status: "draft",
165
+ completed_at: null,
166
+ due_at: null
167
+ },
168
+ {
169
+ id: "33333333-3333-4333-8333-333333333339",
170
+ title: "Polish generated homepage",
171
+ description: "Improve the first-run experience with direct seeded shortcuts.",
172
+ priority: "low",
173
+ status: "completed",
174
+ completed_at: "NOW",
175
+ due_at: null
176
+ },
177
+ {
178
+ id: "33333333-3333-4333-8333-333333333340",
179
+ title: "Audit runtime smoke checks",
180
+ description: "Expand smoke coverage for core task actions.",
181
+ priority: "high",
182
+ status: "active",
183
+ completed_at: null,
184
+ due_at: null
185
+ },
186
+ {
187
+ id: "33333333-3333-4333-8333-333333333341",
188
+ title: "Draft deployment checklist",
189
+ description: "Capture the minimum steps for shipping the generated app.",
190
+ priority: "medium",
191
+ status: "draft",
192
+ completed_at: null,
193
+ due_at: null
194
+ },
195
+ {
196
+ id: "33333333-3333-4333-8333-333333333342",
197
+ title: "Capture user feedback",
198
+ description: "Collect notes from the first walkthrough of the generated UX.",
199
+ priority: "high",
200
+ status: "active",
201
+ completed_at: null,
202
+ due_at: null
203
+ }
204
+ ]
205
+ }
206
+ };
@@ -0,0 +1,74 @@
1
+ export const TODO_BACKEND_REPOSITORY_REFERENCE = {
2
+ capabilityIds: [
3
+ "cap_get_project",
4
+ "cap_list_projects",
5
+ "cap_create_project",
6
+ "cap_update_project",
7
+ "cap_get_user",
8
+ "cap_list_users",
9
+ "cap_create_user",
10
+ "cap_update_user",
11
+ "cap_get_task",
12
+ "cap_list_tasks",
13
+ "cap_create_task",
14
+ "cap_update_task",
15
+ "cap_complete_task",
16
+ "cap_delete_task",
17
+ "cap_export_tasks",
18
+ "cap_get_task_export_job"
19
+ ],
20
+ preconditionCapabilityIds: [
21
+ "cap_update_task",
22
+ "cap_complete_task",
23
+ "cap_delete_task"
24
+ ],
25
+ preconditionResource: {
26
+ variableName: "currentTask",
27
+ repositoryMethod: "getTask",
28
+ inputField: "task_id",
29
+ versionField: "updated_at"
30
+ },
31
+ downloadCapabilityId: "cap_download_task_export",
32
+ repositoryInterfaceName: "TodoRepository",
33
+ prismaRepositoryClassName: "PrismaTodoRepository",
34
+ drizzleRepositoryClassName: "DrizzleTodoRepository",
35
+ dependencyName: "todoRepository",
36
+ lookupBindings: [
37
+ {
38
+ entityId: "entity_project",
39
+ route: "/lookups/projects",
40
+ repositoryMethod: "listProjectOptions"
41
+ },
42
+ {
43
+ entityId: "entity_user",
44
+ route: "/lookups/users",
45
+ repositoryMethod: "listUserOptions"
46
+ }
47
+ ],
48
+ export: {
49
+ filename: "task-export.zip",
50
+ contentType: "application/zip"
51
+ },
52
+ drizzleHint: "Use the Prisma profile for the runnable Todo runtime or fill in the Drizzle query logic here.",
53
+ drizzleSchemaImports: ["tasksTable", "projectsTable", "usersTable"],
54
+ additionalTypeNames: [
55
+ "DownloadTaskExportInput",
56
+ "DownloadTaskExportResult",
57
+ "MarkExportJobCompletedInput",
58
+ "MarkExportJobCompletedResult",
59
+ "LookupOption"
60
+ ],
61
+ additionalTypeDeclarations: [
62
+ `export interface DownloadTaskExportInput {\n job_id: string;\n}`,
63
+ `export interface DownloadTaskExportResult {\n body: Uint8Array;\n contentType: string;\n filename: string;\n}`,
64
+ `export interface LookupOption {\n value: string;\n label: string;\n}`,
65
+ `export interface MarkExportJobCompletedInput {\n job_id: string;\n state: string;\n download_url?: string;\n error_message?: string;\n}`,
66
+ `export interface MarkExportJobCompletedResult {\n job_id: string;\n state: string;\n}`
67
+ ],
68
+ additionalInterfaceMethods: [
69
+ "listProjectOptions(): Promise<LookupOption[]>;",
70
+ "listUserOptions(): Promise<LookupOption[]>;",
71
+ "downloadTaskExport(input: DownloadTaskExportInput): Promise<DownloadTaskExportResult>;",
72
+ "markExportJobCompleted(input: MarkExportJobCompletedInput): Promise<MarkExportJobCompletedResult>;"
73
+ ]
74
+ };