@jskit-ai/agent-docs 0.1.148 → 0.1.150
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/guide/agent/app-setup/existing-application-migration.md +8 -6
- package/guide/agent/app-setup/initial-scaffolding.md +26 -7
- package/guide/agent/app-setup/quickstart.md +9 -6
- package/guide/agent/framework/application-operations.md +91 -0
- package/guide/agent/framework/crud-operations.md +83 -0
- package/guide/agent/framework/material-3.md +112 -0
- package/guide/agent/framework/ui-operations.md +78 -0
- package/guide/agent/index.md +13 -3
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/PATTERN.md +5 -0
- package/patterns/minimal-foundation/example/AGENTS.md +8 -8
- package/patterns/minimal-foundation/example/package.json +4 -5
- package/patterns/minimal-foundation/example/vite.config.mjs +0 -1
- package/patterns/shell-foundation/PATTERN.md +5 -0
- package/patterns/shell-foundation/example/AGENTS.md +8 -8
- package/patterns/shell-foundation/example/package.json +5 -6
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/patterns/shell-foundation/example/vite.config.mjs +0 -1
- package/reference/autogen/PATTERN_INDEX.md +61 -61
- package/reference/autogen/tooling/testUtils.md +1 -1
- package/skills/jskit/SKILL.md +8 -5
- package/skills/jskit/references/app-operations.md +12 -11
- package/skills/jskit/references/crud-operations.md +10 -6
- package/skills/jskit/references/existing-application-migration.md +9 -12
- package/skills/jskit/references/material-3.md +2 -0
- package/skills/jskit/references/pattern-index.md +61 -61
- package/skills/jskit/references/patterns/app/minimal-foundation/PATTERN.md +105 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/.nvmrc +1 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +17 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/Procfile +2 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/app.json +14 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/develop.js +71 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/server.js +8 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/config/public.js +40 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/config/server.js +1 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/config/surfaceAccessPolicies.js +3 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/eslint.config.mjs +19 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/favicon.svg +7 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/gitignore +9 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/index.html +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/jsconfig.json +8 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +62 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/packages/main/package.json +42 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/packages/main/src/shared/index.js +10 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/packages/main/src/shared/schemas/index.js +22 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/playwright.config.mjs +31 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/runtimeEnv.js +45 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/surfaceRuntime.js +10 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +195 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/App.vue +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/main.js +85 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/pages/home/index.vue +48 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/pages/home.vue +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/src/views/NotFound.vue +13 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/client/smoke.vitest.js +7 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/e2e/base-shell.spec.ts +23 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/server/smoke.test.js +16 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/vite.config.mjs +80 -0
- package/skills/jskit/references/patterns/app/shell-foundation/PATTERN.md +111 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/.nvmrc +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +17 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/Procfile +2 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/app.json +14 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/develop.js +71 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/server.js +8 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/config/public.js +40 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/config/server.js +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/config/surfaceAccessPolicies.js +3 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/eslint.config.mjs +19 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/favicon.svg +7 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/gitignore +9 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/index.html +13 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/jsconfig.json +8 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +64 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +56 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/client/index.js +9 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +18 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/shared/index.js +10 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/shared/schemas/index.js +22 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/playwright.config.mjs +31 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/runtimeEnv.js +45 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/surfaceRuntime.js +10 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +195 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/App.vue +11 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/ShellLayout.vue +12 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/MenuLinkItem.vue +30 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/SurfaceAwareMenuLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/TabLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/error.js +19 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/main.js +85 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/index.vue +116 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/settings/general/index.vue +40 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/settings/index.vue +7 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home/settings.vue +109 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/pages/home.vue +20 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/placement.js +56 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/placementTopology.js +149 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/src/views/NotFound.vue +13 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/client/smoke.vitest.js +7 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/e2e/adaptive-shell.spec.ts +10 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/e2e/base-shell.spec.ts +23 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/server/smoke.test.js +16 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/vite.config.mjs +80 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/PATTERN.md +77 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/config/public.js +19 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/config/server.js +9 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/pages/admin/assistant/index.vue +7 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/pages/admin/settings/assistant/index.vue +7 -0
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/placement.js +38 -0
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +90 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/login.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/reset-password.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/pages/auth/signout.vue +17 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/runtime/authGuardRuntime.js +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/runtime/authHttpClient.js +1 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/runtime/useSignOut.js +1 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/LoginView.vue +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/ResetPasswordView.vue +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/src/views/auth/SignOutView.vue +7 -0
- package/skills/jskit/references/patterns/auth/auth-surface/example/tools/preview-identity +5 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/PATTERN.md +67 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/.env.example +4 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/config/server.js +11 -0
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +7 -0
- package/skills/jskit/references/patterns/console/console-surface/PATTERN.md +58 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console/index.vue +62 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console/settings/index.vue +17 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console/settings.vue +95 -0
- package/skills/jskit/references/patterns/console/console-surface/example/src/pages/console.vue +20 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/PATTERN.md +88 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookEditPage.vue +54 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookFormFields.vue +52 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +54 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookNewPage.vue +45 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookViewPage.vue +50 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/formFields.js +31 -0
- package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/listExtensions.js +9 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/PATTERN.md +160 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/migrations/20260815000000_books.cjs +22 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/package.json +41 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/BooksFeature.js +13 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/bookResource.js +83 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +102 -0
- package/skills/jskit/references/patterns/crud/resource-contract/example/bookResource.js +87 -0
- package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +80 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/.env.example +5 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/.github/workflows/verify.yml +39 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/knexfile.js +11 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +13 -0
- package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +3 -0
- package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +80 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/.env.example +5 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/.github/workflows/verify.yml +38 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/knexfile.js +11 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +13 -0
- package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +3 -0
- package/skills/jskit/references/patterns/mobile/android-application/PATTERN.md +71 -0
- package/skills/jskit/references/patterns/mobile/android-application/example/capacitor.config.json +10 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +69 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/.env.example +1 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +8 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/src/placement.js +17 -0
- package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +108 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +48 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +33 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/actions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/inputSchemas.js +19 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/AvailabilityEngineProvider.js +31 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupProvider.js +36 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +34 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/orchestratorService.js +23 -0
- package/skills/jskit/references/patterns/shell/application-shell/PATTERN.md +66 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/expected-existing/src/App.vue +13 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/expected-existing/src/pages/home/index.vue +48 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/expected-existing/src/pages/home.vue +13 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/App.vue +11 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/ShellLayout.vue +13 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/MenuLinkItem.vue +30 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/SurfaceAwareMenuLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/TabLinkItem.vue +42 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/error.js +19 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/index.vue +106 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/settings/general/index.vue +40 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/settings/index.vue +7 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home/settings.vue +109 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/pages/home.vue +20 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/placement.js +56 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/src/placementTopology.js +149 -0
- package/skills/jskit/references/patterns/shell/application-shell/example/tests/e2e/adaptive-shell.spec.ts +10 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/PATTERN.md +76 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/packages/main/src/client/providers/MainClientProvider.js +14 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/components/SyncStatusElement.vue +16 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports/activity.vue +8 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports/index.vue +7 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports/overview.vue +8 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/pages/home/reports.vue +33 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/placement.js +52 -0
- package/skills/jskit/references/patterns/ui/page-and-placement/example/src/placementTopology.js +29 -0
- package/skills/jskit/references/patterns/users/account-settings/PATTERN.md +61 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsNotificationsSection.vue +81 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsPreferencesSection.vue +151 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/components/account/settings/AccountSettingsProfileSection.vue +120 -0
- package/skills/jskit/references/patterns/users/account-settings/example/src/pages/account/index.vue +17 -0
- package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +64 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +42 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/UsersFeature.js +13 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/shared/userResource.js +69 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +43 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +22 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/index.js +1 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/shared/userResource.js +56 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +60 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/config/roles.js +27 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/email/workspaceInviteEmail.js +23 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +63 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/packages/main/src/client/components/AccountPendingInvitesCue.vue +106 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/packages/main/src/client/components/AccountSettingsInvitesSection.vue +7 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/components/WorkspaceNotFoundCard.vue +53 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/composables/useWorkspaceNotFoundState.js +41 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/admin/members/index.vue +7 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/admin/workspace/settings/index.vue +23 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/admin/workspace/settings.vue +95 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/pages/invite/[token].vue +7 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/admin/index.vue +85 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/admin/root.vue +20 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/app/index.vue +46 -0
- package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/surfaces/app/root.vue +20 -0
- package/skills/jskit/references/ui-operations.md +5 -3
- package/templates/app/AGENTS.md +8 -8
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: crud/resource-contract
|
|
3
|
+
title: Owner-scoped CRUD resource contract
|
|
4
|
+
summary: Define an authenticated application resource whose records belong to the current user.
|
|
5
|
+
keywords: authenticated, crud, database, owner-scoped, resource, user
|
|
6
|
+
requires: @jskit-ai/resource-crud-core
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Owner-scoped CRUD resource contract
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
Use this pattern when an authenticated application stores records that belong
|
|
14
|
+
to one user and standard list, view, create, patch, and delete behaviour fits
|
|
15
|
+
the product.
|
|
16
|
+
|
|
17
|
+
The example is intentionally a normal source file. Copy it directly when the
|
|
18
|
+
shape fits, adapt its fields and language for another entity, or read it as a
|
|
19
|
+
reference for `defineCrudResource()`.
|
|
20
|
+
|
|
21
|
+
## Do not use when
|
|
22
|
+
|
|
23
|
+
Do not use this pattern for public records, workspace-owned records, inherited
|
|
24
|
+
ownership, composite identities, or a domain whose operations do not match
|
|
25
|
+
normal CRUD behaviour. Select a pattern matching the real ownership and
|
|
26
|
+
operation model instead of changing `autofilter` merely to make a test pass.
|
|
27
|
+
|
|
28
|
+
## Product decisions
|
|
29
|
+
|
|
30
|
+
Know these decisions before adapting the example:
|
|
31
|
+
|
|
32
|
+
- whether records truly belong to the current user
|
|
33
|
+
- which fields are required, optional, nullable, searchable, or hidden
|
|
34
|
+
- whether a value is free text or a constrained vocabulary
|
|
35
|
+
- which operations the product actually exposes
|
|
36
|
+
- the user-facing success and failure language
|
|
37
|
+
|
|
38
|
+
Those decisions come from the product conversation or existing application,
|
|
39
|
+
not from a JSKIT questionnaire.
|
|
40
|
+
|
|
41
|
+
## Invariants
|
|
42
|
+
|
|
43
|
+
- The persisted table has a normal single-column primary key.
|
|
44
|
+
- User ownership is represented by a non-null `user_id` column.
|
|
45
|
+
- The resource's hidden `userId` field maps to that ownership column.
|
|
46
|
+
- `autofilter: "user"` is used only for genuine current-user ownership.
|
|
47
|
+
- Output, create, and patch participation is explicit on each product field.
|
|
48
|
+
- Temporal database values use the declared storage serializer.
|
|
49
|
+
- The source-controlled migration and resource contract agree.
|
|
50
|
+
- Server policy tests prove that one user cannot read or mutate another user's
|
|
51
|
+
records.
|
|
52
|
+
|
|
53
|
+
## Framework APIs
|
|
54
|
+
|
|
55
|
+
The example uses `defineCrudResource()` from
|
|
56
|
+
`@jskit-ai/resource-crud-core/shared/crudResource`. That API derives the normal
|
|
57
|
+
CRUD operation validators from one readable field contract.
|
|
58
|
+
|
|
59
|
+
Higher layers should consume this resource through JSKIT's CRUD service,
|
|
60
|
+
repository, route, and UI APIs. They should not rebuild field validators or
|
|
61
|
+
serialize requests independently.
|
|
62
|
+
|
|
63
|
+
## Example files
|
|
64
|
+
|
|
65
|
+
- `example/bookResource.js` is a complete resource contract for personal book
|
|
66
|
+
records.
|
|
67
|
+
|
|
68
|
+
The example deliberately uses a concrete domain. Rename and edit normal source
|
|
69
|
+
rather than feeding it through placeholder interpolation.
|
|
70
|
+
|
|
71
|
+
## Variation points
|
|
72
|
+
|
|
73
|
+
Safe adaptations include:
|
|
74
|
+
|
|
75
|
+
- namespace and table name
|
|
76
|
+
- product fields and validation
|
|
77
|
+
- searchable fields and default sort
|
|
78
|
+
- enabled CRUD operations
|
|
79
|
+
- user-facing messages
|
|
80
|
+
- lookup relationships supported by the resource APIs
|
|
81
|
+
|
|
82
|
+
Changing ownership, access, identity, or persistence architecture selects a
|
|
83
|
+
different pattern and requires corresponding policy and migration evidence.
|
|
84
|
+
|
|
85
|
+
## Verification
|
|
86
|
+
|
|
87
|
+
- Import the resource and prove all intended operations exist.
|
|
88
|
+
- Validate representative accepted and rejected field values.
|
|
89
|
+
- Rebuild the table from source-controlled migrations in a disposable database.
|
|
90
|
+
- Run positive current-user CRUD tests.
|
|
91
|
+
- Run negative cross-user read and mutation tests.
|
|
92
|
+
- Run the application's focused tests and broad verifier at sign-off.
|
|
93
|
+
|
|
94
|
+
## Avoid
|
|
95
|
+
|
|
96
|
+
- generator provenance or scaffold-shape metadata
|
|
97
|
+
- a field-by-field questionnaire
|
|
98
|
+
- a live table as the only source of schema truth
|
|
99
|
+
- app-specific request serializers that duplicate the resource contract
|
|
100
|
+
- hidden ownership aliases other than the framework's explicit ownership field
|
|
101
|
+
- durable receipts recording that this pattern was copied
|
|
102
|
+
- changing an installed baseline migration instead of adding a new migration
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defineCrudResource } from "@jskit-ai/resource-crud-core/shared/crudResource";
|
|
2
|
+
|
|
3
|
+
const bookResource = defineCrudResource({
|
|
4
|
+
namespace: "books",
|
|
5
|
+
tableName: "books",
|
|
6
|
+
apiAccess: "authenticated",
|
|
7
|
+
schema: {
|
|
8
|
+
userId: {
|
|
9
|
+
type: "id",
|
|
10
|
+
required: true,
|
|
11
|
+
hidden: true,
|
|
12
|
+
operations: {}
|
|
13
|
+
},
|
|
14
|
+
title: {
|
|
15
|
+
type: "string",
|
|
16
|
+
maxLength: 255,
|
|
17
|
+
required: true,
|
|
18
|
+
search: true,
|
|
19
|
+
operations: {
|
|
20
|
+
output: { required: true },
|
|
21
|
+
create: { required: true },
|
|
22
|
+
patch: { required: false }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
author: {
|
|
26
|
+
type: "string",
|
|
27
|
+
maxLength: 255,
|
|
28
|
+
required: true,
|
|
29
|
+
search: true,
|
|
30
|
+
operations: {
|
|
31
|
+
output: { required: true },
|
|
32
|
+
create: { required: true },
|
|
33
|
+
patch: { required: false }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
notes: {
|
|
37
|
+
type: "string",
|
|
38
|
+
maxLength: 65535,
|
|
39
|
+
nullable: true,
|
|
40
|
+
search: true,
|
|
41
|
+
operations: {
|
|
42
|
+
output: { required: true },
|
|
43
|
+
create: { required: false },
|
|
44
|
+
patch: { required: false }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
createdAt: {
|
|
48
|
+
type: "dateTime",
|
|
49
|
+
temporalPrecision: 0,
|
|
50
|
+
default: "now()",
|
|
51
|
+
storage: { writeSerializer: "datetime-utc" },
|
|
52
|
+
operations: {
|
|
53
|
+
output: { required: true }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
updatedAt: {
|
|
57
|
+
type: "dateTime",
|
|
58
|
+
temporalPrecision: 0,
|
|
59
|
+
default: "now()",
|
|
60
|
+
storage: { writeSerializer: "datetime-utc" },
|
|
61
|
+
operations: {
|
|
62
|
+
output: { required: true }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
searchSchema: {
|
|
67
|
+
id: { type: "id", actualField: "id" },
|
|
68
|
+
q: {
|
|
69
|
+
type: "string",
|
|
70
|
+
oneOf: ["title", "author", "notes"],
|
|
71
|
+
filterOperator: "like",
|
|
72
|
+
splitBy: " ",
|
|
73
|
+
matchAll: true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
defaultSort: ["-createdAt"],
|
|
77
|
+
autofilter: "user",
|
|
78
|
+
messages: {
|
|
79
|
+
validation: "Fix invalid values and try again.",
|
|
80
|
+
saveSuccess: "Book saved.",
|
|
81
|
+
saveError: "Unable to save this book.",
|
|
82
|
+
deleteSuccess: "Book deleted.",
|
|
83
|
+
deleteError: "Unable to delete this book."
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export { bookResource };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: database/mysql-application
|
|
3
|
+
title: MySQL application database
|
|
4
|
+
summary: Configure a JSKIT application for MySQL with a fixed driver, ordinary environment values, and rebuildable Knex migrations.
|
|
5
|
+
keywords: database, knex, mariadb, migrations, mysql, mysql2
|
|
6
|
+
requires: @jskit-ai/database-runtime-mysql
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# MySQL application database
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
Use this pattern when an application deliberately chooses MySQL or MariaDB.
|
|
14
|
+
Install `@jskit-ai/database-runtime-mysql`; its normal npm dependencies provide
|
|
15
|
+
the database runtime, Knex, and `mysql2` without a package-setup wizard.
|
|
16
|
+
|
|
17
|
+
## Do not use when
|
|
18
|
+
|
|
19
|
+
Do not use this pattern for PostgreSQL, a database-neutral library, or a service
|
|
20
|
+
that does not own its database connection. Do not install both JSKIT drivers
|
|
21
|
+
unless the application genuinely selects between them at runtime.
|
|
22
|
+
|
|
23
|
+
## Product decisions
|
|
24
|
+
|
|
25
|
+
Decide the database name, credentials, host, deployment secret source, backup
|
|
26
|
+
policy, and application migrations. Those are application and environment
|
|
27
|
+
decisions, not framework questions.
|
|
28
|
+
|
|
29
|
+
## Invariants
|
|
30
|
+
|
|
31
|
+
- The application depends directly on the selected JSKIT driver.
|
|
32
|
+
- Credentials stay outside Git.
|
|
33
|
+
- `knexfile.js` fixes `mysql2`; a single-driver application does not require
|
|
34
|
+
`DB_CLIENT`.
|
|
35
|
+
- Schema changes are ordinary immutable migrations.
|
|
36
|
+
- The current package graph, environment, and migrations are authoritative.
|
|
37
|
+
|
|
38
|
+
## Framework APIs
|
|
39
|
+
|
|
40
|
+
Use `createKnexMigrationConfigFromApp()` from
|
|
41
|
+
`@jskit-ai/database-runtime/server/knexMigrationConfig`. The running JSKIT
|
|
42
|
+
application automatically selects the sole installed database driver, while
|
|
43
|
+
Knex discovers package-owned migrations from the installed dependency graph.
|
|
44
|
+
|
|
45
|
+
## Example files
|
|
46
|
+
|
|
47
|
+
`example/package.json` contains the runtime dependency and database scripts.
|
|
48
|
+
`example/knexfile.js` loads an optional local `.env` and fixes the MySQL dialect.
|
|
49
|
+
`example/scripts/prepare-database.js` is the portable migrate-then-seed
|
|
50
|
+
entrypoint for managed sessions and deployments. `example/.env.example` names
|
|
51
|
+
the five connection values without a secret.
|
|
52
|
+
|
|
53
|
+
## Variation points
|
|
54
|
+
|
|
55
|
+
Change scripts, migration location, connection values, and secret injection to
|
|
56
|
+
fit the application. Supply `DATABASE_URL` instead of individual values when
|
|
57
|
+
the environment owns a URL. Add `DB_CLIENT=mysql2` only when a shared external
|
|
58
|
+
tool explicitly needs a dialect selector. When the product needs initial data,
|
|
59
|
+
import one idempotent app-owned seed function in `prepare-database.js` and pass
|
|
60
|
+
it as `seed` to `prepareDatabaseFromApp()`.
|
|
61
|
+
|
|
62
|
+
## Verification
|
|
63
|
+
|
|
64
|
+
- Install dependencies once with `npm install`.
|
|
65
|
+
- Run `npm run db:prepare` against a fresh disposable database.
|
|
66
|
+
- Run `npm run db:migrate:status` and the application verification command.
|
|
67
|
+
- Exercise one transaction and one negative connection case.
|
|
68
|
+
- When a seed exists, run `db:prepare` twice and require the second run to be safe.
|
|
69
|
+
|
|
70
|
+
`example/.github/workflows/verify.yml` is a normal app-owned CI workflow with
|
|
71
|
+
an explicit MariaDB service. Adapt it as source rather than generating it from
|
|
72
|
+
package metadata.
|
|
73
|
+
|
|
74
|
+
## Avoid
|
|
75
|
+
|
|
76
|
+
- framework questionnaires for credentials
|
|
77
|
+
- generated `.env` secrets
|
|
78
|
+
- depending on a live schema as the source contract
|
|
79
|
+
- a second driver installed “just in case”
|
|
80
|
+
- migration receipts, provenance, replay logs, or generator ownership
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Verify
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
verify:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
services:
|
|
11
|
+
mariadb:
|
|
12
|
+
image: mariadb:11.4
|
|
13
|
+
env:
|
|
14
|
+
MARIADB_DATABASE: app_test
|
|
15
|
+
MARIADB_USER: app_test
|
|
16
|
+
MARIADB_PASSWORD: app_test_password
|
|
17
|
+
MARIADB_ROOT_PASSWORD: root_test_password
|
|
18
|
+
ports:
|
|
19
|
+
- 3306:3306
|
|
20
|
+
options: >-
|
|
21
|
+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
|
|
22
|
+
--health-interval=10s
|
|
23
|
+
--health-timeout=5s
|
|
24
|
+
--health-retries=10
|
|
25
|
+
env:
|
|
26
|
+
DB_HOST: 127.0.0.1
|
|
27
|
+
DB_PORT: 3306
|
|
28
|
+
DB_NAME: app_test
|
|
29
|
+
DB_USER: app_test
|
|
30
|
+
DB_PASSWORD: app_test_password
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version-file: .nvmrc
|
|
36
|
+
cache: npm
|
|
37
|
+
- run: npm ci
|
|
38
|
+
- run: npm run db:migrate
|
|
39
|
+
- run: npm run verify
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createKnexMigrationConfigFromApp } from "@jskit-ai/database-runtime/server/knexMigrationConfig";
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
process.loadEnvFile?.(".env");
|
|
5
|
+
} catch (error) {
|
|
6
|
+
if (error?.code !== "ENOENT") {
|
|
7
|
+
throw error;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default await createKnexMigrationConfigFromApp({ client: "mysql2" });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"type": "module",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"db:prepare": "node ./scripts/prepare-database.js",
|
|
6
|
+
"db:migrate": "knex --knexfile ./knexfile.js migrate:latest",
|
|
7
|
+
"db:migrate:rollback": "knex --knexfile ./knexfile.js migrate:rollback",
|
|
8
|
+
"db:migrate:status": "knex --knexfile ./knexfile.js migrate:list"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@jskit-ai/database-runtime-mysql": "0.1.176"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: database/postgres-application
|
|
3
|
+
title: PostgreSQL application database
|
|
4
|
+
summary: Configure a JSKIT application for PostgreSQL with a fixed driver, ordinary environment values, and rebuildable Knex migrations.
|
|
5
|
+
keywords: database, knex, migrations, pg, postgres, postgresql
|
|
6
|
+
requires: @jskit-ai/database-runtime-postgres
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# PostgreSQL application database
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
Use this pattern when an application deliberately chooses PostgreSQL. Install
|
|
14
|
+
`@jskit-ai/database-runtime-postgres`; its normal npm dependencies provide the
|
|
15
|
+
database runtime, Knex, and `pg` without a package-setup wizard.
|
|
16
|
+
|
|
17
|
+
## Do not use when
|
|
18
|
+
|
|
19
|
+
Do not use this pattern for MySQL, a database-neutral library, or a service that
|
|
20
|
+
does not own its database connection. Do not install both JSKIT drivers unless
|
|
21
|
+
the application genuinely selects between them at runtime.
|
|
22
|
+
|
|
23
|
+
## Product decisions
|
|
24
|
+
|
|
25
|
+
Decide the database name, credentials, host, deployment secret source, backup
|
|
26
|
+
policy, and application migrations. Those are application and environment
|
|
27
|
+
decisions, not framework questions.
|
|
28
|
+
|
|
29
|
+
## Invariants
|
|
30
|
+
|
|
31
|
+
- The application depends directly on the selected JSKIT driver.
|
|
32
|
+
- Credentials stay outside Git.
|
|
33
|
+
- `knexfile.js` fixes `pg`; a single-driver application does not require
|
|
34
|
+
`DB_CLIENT`.
|
|
35
|
+
- Schema changes are ordinary immutable migrations.
|
|
36
|
+
- The current package graph, environment, and migrations are authoritative.
|
|
37
|
+
|
|
38
|
+
## Framework APIs
|
|
39
|
+
|
|
40
|
+
Use `createKnexMigrationConfigFromApp()` from
|
|
41
|
+
`@jskit-ai/database-runtime/server/knexMigrationConfig`. The running JSKIT
|
|
42
|
+
application automatically selects the sole installed database driver, while
|
|
43
|
+
Knex discovers package-owned migrations from the installed dependency graph.
|
|
44
|
+
|
|
45
|
+
## Example files
|
|
46
|
+
|
|
47
|
+
`example/package.json` contains the runtime dependency and database scripts.
|
|
48
|
+
`example/knexfile.js` loads an optional local `.env` and fixes the PostgreSQL
|
|
49
|
+
dialect. `example/scripts/prepare-database.js` is the portable
|
|
50
|
+
migrate-then-seed entrypoint for managed sessions and deployments.
|
|
51
|
+
`example/.env.example` names the five connection values without a secret.
|
|
52
|
+
|
|
53
|
+
## Variation points
|
|
54
|
+
|
|
55
|
+
Change scripts, migration location, connection values, and secret injection to
|
|
56
|
+
fit the application. Supply `DATABASE_URL` instead of individual values when
|
|
57
|
+
the environment owns a URL. Add `DB_CLIENT=pg` only when a shared external tool
|
|
58
|
+
explicitly needs a dialect selector. When the product needs initial data,
|
|
59
|
+
import one idempotent app-owned seed function in `prepare-database.js` and pass
|
|
60
|
+
it as `seed` to `prepareDatabaseFromApp()`.
|
|
61
|
+
|
|
62
|
+
## Verification
|
|
63
|
+
|
|
64
|
+
- Install dependencies once with `npm install`.
|
|
65
|
+
- Run `npm run db:prepare` against a fresh disposable database.
|
|
66
|
+
- Run `npm run db:migrate:status` and the application verification command.
|
|
67
|
+
- Exercise one transaction and one negative connection case.
|
|
68
|
+
- When a seed exists, run `db:prepare` twice and require the second run to be safe.
|
|
69
|
+
|
|
70
|
+
`example/.github/workflows/verify.yml` is a normal app-owned CI workflow with
|
|
71
|
+
an explicit PostgreSQL service. Adapt it as source rather than generating it
|
|
72
|
+
from package metadata.
|
|
73
|
+
|
|
74
|
+
## Avoid
|
|
75
|
+
|
|
76
|
+
- framework questionnaires for credentials
|
|
77
|
+
- generated `.env` secrets
|
|
78
|
+
- depending on a live schema as the source contract
|
|
79
|
+
- a second driver installed “just in case”
|
|
80
|
+
- migration receipts, provenance, replay logs, or generator ownership
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Verify
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
verify:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
services:
|
|
11
|
+
postgres:
|
|
12
|
+
image: postgres:17
|
|
13
|
+
env:
|
|
14
|
+
POSTGRES_DB: app_test
|
|
15
|
+
POSTGRES_USER: app_test
|
|
16
|
+
POSTGRES_PASSWORD: app_test_password
|
|
17
|
+
ports:
|
|
18
|
+
- 5432:5432
|
|
19
|
+
options: >-
|
|
20
|
+
--health-cmd="pg_isready -U app_test -d app_test"
|
|
21
|
+
--health-interval=10s
|
|
22
|
+
--health-timeout=5s
|
|
23
|
+
--health-retries=10
|
|
24
|
+
env:
|
|
25
|
+
DB_HOST: 127.0.0.1
|
|
26
|
+
DB_PORT: 5432
|
|
27
|
+
DB_NAME: app_test
|
|
28
|
+
DB_USER: app_test
|
|
29
|
+
DB_PASSWORD: app_test_password
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version-file: .nvmrc
|
|
35
|
+
cache: npm
|
|
36
|
+
- run: npm ci
|
|
37
|
+
- run: npm run db:migrate
|
|
38
|
+
- run: npm run verify
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createKnexMigrationConfigFromApp } from "@jskit-ai/database-runtime/server/knexMigrationConfig";
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
process.loadEnvFile?.(".env");
|
|
5
|
+
} catch (error) {
|
|
6
|
+
if (error?.code !== "ENOENT") {
|
|
7
|
+
throw error;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default await createKnexMigrationConfigFromApp({ client: "pg" });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"type": "module",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"db:prepare": "node ./scripts/prepare-database.js",
|
|
6
|
+
"db:migrate": "knex --knexfile ./knexfile.js migrate:latest",
|
|
7
|
+
"db:migrate:rollback": "knex --knexfile ./knexfile.js migrate:rollback",
|
|
8
|
+
"db:migrate:status": "knex --knexfile ./knexfile.js migrate:list"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@jskit-ai/database-runtime-postgres": "0.1.175"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: mobile/android-application
|
|
3
|
+
title: Capacitor Android application
|
|
4
|
+
summary: Wrap a JSKIT web application in a Capacitor Android shell using native Capacitor and Android commands.
|
|
5
|
+
keywords: android, capacitor, device, mobile, native, shell, webview
|
|
6
|
+
requires: @jskit-ai/mobile-capacitor, @capacitor/android, @capacitor/app, @capacitor/cli
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Capacitor Android application
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
Use this pattern when the same JSKIT application should run inside a Capacitor
|
|
14
|
+
Android shell and the product accepts a WebView-based native application.
|
|
15
|
+
|
|
16
|
+
## Do not use when
|
|
17
|
+
|
|
18
|
+
Do not use this pattern for a browser-only app, for a native UI product, or when
|
|
19
|
+
the target platform is not supported by the selected Capacitor packages.
|
|
20
|
+
|
|
21
|
+
## Product decisions
|
|
22
|
+
|
|
23
|
+
Choose the stable application id, display name, built web directory, callback
|
|
24
|
+
URLs, development server policy, and native permissions before creating the
|
|
25
|
+
Android project.
|
|
26
|
+
|
|
27
|
+
## Framework APIs
|
|
28
|
+
|
|
29
|
+
Install the declared npm packages normally. Adapt `example/capacitor.config.json`
|
|
30
|
+
into valid JSON, then use Capacitor directly:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
npx cap add android
|
|
34
|
+
npm run build
|
|
35
|
+
npx cap sync android
|
|
36
|
+
npx cap run android
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use `adb devices`, `adb reverse`, Android Studio, and Gradle directly for device
|
|
40
|
+
selection, tunnelling, diagnostics, and release builds. JSKIT does not wrap
|
|
41
|
+
those tools in another command language.
|
|
42
|
+
|
|
43
|
+
## Example files
|
|
44
|
+
|
|
45
|
+
`example/capacitor.config.json` shows the small Capacitor configuration shape.
|
|
46
|
+
Replace its obvious values directly; it is not an interpolation template.
|
|
47
|
+
|
|
48
|
+
## Variation points
|
|
49
|
+
|
|
50
|
+
Change application id/name, build directory, development server, callback URLs,
|
|
51
|
+
plugins, native permissions, and platform-specific release configuration.
|
|
52
|
+
|
|
53
|
+
## Invariants
|
|
54
|
+
|
|
55
|
+
- `webDir` is the actual output of the application's production build.
|
|
56
|
+
- Development origins are explicit and never leak into release configuration.
|
|
57
|
+
- Browser navigation that leaves the app uses the package's public mobile
|
|
58
|
+
routing capability.
|
|
59
|
+
- Native projects and signing configuration are ordinary app-owned source.
|
|
60
|
+
|
|
61
|
+
## Verification
|
|
62
|
+
|
|
63
|
+
Build the web application, sync Android, launch on an explicit device, test
|
|
64
|
+
callback routing and external links, then build the native release variant.
|
|
65
|
+
|
|
66
|
+
## Avoid
|
|
67
|
+
|
|
68
|
+
- hidden device selection
|
|
69
|
+
- checking secrets or signing keys into source
|
|
70
|
+
- a JSKIT-specific wrapper around Capacitor, adb, or Gradle
|
|
71
|
+
- generated-operation receipts
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: realtime/realtime-application
|
|
3
|
+
title: Realtime application
|
|
4
|
+
summary: Add JSKIT realtime events with an optional Redis backplane and an explicit shell status contribution.
|
|
5
|
+
keywords: redis, realtime, socket.io, sockets, status, websocket
|
|
6
|
+
requires: @jskit-ai/realtime, @jskit-ai/shell-web
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Realtime application
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
Use this pattern when the product needs server-to-client events or live query
|
|
14
|
+
refresh. Install the realtime package normally, then add only the product's
|
|
15
|
+
listeners and desired shell contribution.
|
|
16
|
+
|
|
17
|
+
## Do not use when
|
|
18
|
+
|
|
19
|
+
Do not add realtime merely to poll less often, or before event ownership and
|
|
20
|
+
delivery semantics are clear. A single-process application does not need Redis.
|
|
21
|
+
|
|
22
|
+
## Product decisions
|
|
23
|
+
|
|
24
|
+
Decide which events are public contracts, their scopes and payloads, reconnect
|
|
25
|
+
behavior, whether a connection indicator belongs in the UI, and whether the
|
|
26
|
+
deployment needs a Redis backplane.
|
|
27
|
+
|
|
28
|
+
## Invariants
|
|
29
|
+
|
|
30
|
+
- Empty `REALTIME_REDIS_URL` means the in-process adapter.
|
|
31
|
+
- Redis credentials stay outside Git.
|
|
32
|
+
- Listeners are registered through the public provider seams.
|
|
33
|
+
- The status indicator is an explicit app placement, not a source mutation.
|
|
34
|
+
- Event payloads do not become an undocumented second API.
|
|
35
|
+
|
|
36
|
+
## Framework APIs
|
|
37
|
+
|
|
38
|
+
Server features declare their successful domain events on their actions. The
|
|
39
|
+
installed `RealtimeProvider` delivers only events with an explicit realtime
|
|
40
|
+
name and audience. Client features use `RealtimeClientProvider` and the public
|
|
41
|
+
listener registration helpers from `@jskit-ai/realtime`. Use the normal shell
|
|
42
|
+
placement registry for the optional status component.
|
|
43
|
+
|
|
44
|
+
## Example files
|
|
45
|
+
|
|
46
|
+
`example/package.json` declares realtime and shell runtime packages.
|
|
47
|
+
`example/.env.example` documents the optional Redis input.
|
|
48
|
+
`example/src/placement.js` adds the standard connection indicator explicitly.
|
|
49
|
+
|
|
50
|
+
## Variation points
|
|
51
|
+
|
|
52
|
+
Omit the placement when the product does not need a visible connection state.
|
|
53
|
+
Change event listeners, Redis provisioning, and client invalidation behavior to
|
|
54
|
+
match the product. Keep transport retry policy in the realtime runtime.
|
|
55
|
+
|
|
56
|
+
## Verification
|
|
57
|
+
|
|
58
|
+
- Test in-process delivery without Redis.
|
|
59
|
+
- When Redis is selected, test delivery across two server processes.
|
|
60
|
+
- Disconnect and reconnect a browser and verify recovery behavior.
|
|
61
|
+
- Confirm the status contribution renders in compact and expanded shells.
|
|
62
|
+
|
|
63
|
+
## Avoid
|
|
64
|
+
|
|
65
|
+
- prompting for optional Redis configuration during package installation
|
|
66
|
+
- appending source into placement files
|
|
67
|
+
- leaking Redis values to client config
|
|
68
|
+
- generic “data changed” payloads with no scope
|
|
69
|
+
- receipts, provenance, or mutation history
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
REALTIME_REDIS_URL=
|