@jskit-ai/agent-docs 0.1.257 → 0.1.258
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-extras/assistant-conversation.md +88 -35
- package/guide/agent/app-extras/assistant.md +28 -28
- package/guide/agent/app-setup/authentication.md +36 -17
- package/guide/agent/app-setup/database-layer.md +116 -17
- package/guide/agent/app-setup/existing-application-migration.md +29 -25
- package/guide/agent/app-setup/multi-homing.md +94 -48
- package/guide/agent/app-setup/run-an-accounts-hub.md +6 -4
- package/guide/agent/framework/client-features.md +496 -0
- package/guide/agent/framework/crud-operations.md +5 -5
- package/guide/agent/framework/translation.md +4 -3
- package/guide/agent/framework/typed-features.md +1104 -0
- package/guide/agent/framework/ui-operations.md +2 -2
- package/guide/agent/index.md +6 -1
- package/package.json +1 -1
- package/patterns/feature-package/PATTERN.md +104 -10
- package/patterns/feature-package/example/booking-engine/package.json +9 -4
- package/patterns/feature-package/example/booking-engine/src/server/BookingEngineFeature.js +24 -0
- package/patterns/feature-package/example/booking-engine/src/server/bookingAvailability.js +10 -0
- package/patterns/feature-package/example/booking-engine/src/server/bookingEngine.js +29 -0
- package/patterns/feature-package/example/booking-engine/src/server/bookingEngineActions.js +26 -0
- package/patterns/feature-package/example/booking-engine/src/server/inputSchemas.js +1 -2
- package/patterns/feature-package/example/booking-engine/src/server/types.js +12 -0
- package/patterns/feature-package/example/variations/AvailabilityEngineFeature.js +19 -0
- package/patterns/feature-package/example/variations/InvoiceRollupFeature.js +23 -0
- package/patterns/feature-package/example/variations/availabilityEngineActions.js +26 -0
- package/patterns/feature-package/example/variations/customKnexRepository.js +32 -26
- package/patterns/feature-package/example/variations/invoiceRollupActions.js +26 -0
- package/patterns/feature-package/example/variations/orchestratorService.js +24 -19
- package/patterns/feature-package/example/variations/types.js +7 -0
- package/patterns/minimal-foundation/PATTERN.md +30 -1
- package/patterns/minimal-foundation/example/AGENTS.md +14 -0
- package/patterns/minimal-foundation/example/bin/develop.js +10 -5
- package/patterns/minimal-foundation/example/eslint.config.mjs +21 -2
- package/patterns/minimal-foundation/example/package.json +5 -4
- package/patterns/minimal-foundation/example/playwright.config.mjs +1 -1
- package/patterns/minimal-foundation/example/server/lib/envFile.js +19 -0
- package/patterns/minimal-foundation/example/server/lib/loggerOptions.js +15 -0
- package/patterns/minimal-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/patterns/minimal-foundation/example/server.js +32 -29
- package/patterns/minimal-foundation/example/tests/server/smoke.test.js +2 -1
- package/patterns/shell-foundation/PATTERN.md +29 -0
- package/patterns/shell-foundation/example/AGENTS.md +14 -0
- package/patterns/shell-foundation/example/bin/develop.js +10 -5
- package/patterns/shell-foundation/example/eslint.config.mjs +21 -2
- package/patterns/shell-foundation/example/package.json +6 -5
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/patterns/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +1 -0
- package/patterns/shell-foundation/example/playwright.config.mjs +1 -1
- package/patterns/shell-foundation/example/server/lib/envFile.js +19 -0
- package/patterns/shell-foundation/example/server/lib/loggerOptions.js +15 -0
- package/patterns/shell-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/patterns/shell-foundation/example/server.js +32 -29
- package/patterns/shell-foundation/example/tests/server/smoke.test.js +2 -1
- package/reference/autogen/KERNEL_MAP.md +14 -8
- package/reference/autogen/PATTERN_INDEX.md +37 -37
- package/reference/autogen/README.md +2 -0
- package/reference/autogen/packages/agent-docs.md +70 -26
- package/reference/autogen/packages/agent-runtime.md +129 -0
- package/reference/autogen/packages/agent.md +149 -0
- package/reference/autogen/packages/architecture-inspector.md +97 -44
- package/reference/autogen/packages/assistant-core.md +786 -292
- package/reference/autogen/packages/assistant-runtime.md +182 -57
- package/reference/autogen/packages/assistant-voice-sherpa.md +4 -0
- package/reference/autogen/packages/assistant-voice.md +54 -8
- package/reference/autogen/packages/auth-core.md +44 -13
- package/reference/autogen/packages/auth-provider-local-core.md +86 -34
- package/reference/autogen/packages/auth-provider-local-db-core.md +1 -2
- package/reference/autogen/packages/auth-provider-oidc-core.md +10 -4
- package/reference/autogen/packages/auth-provider-supabase-core.md +52 -66
- package/reference/autogen/packages/auth-web.md +19 -11
- package/reference/autogen/packages/connectors-catalog.md +71 -43
- package/reference/autogen/packages/connectors-core.md +42 -4
- package/reference/autogen/packages/console-core.md +27 -14
- package/reference/autogen/packages/crud-core.md +178 -170
- package/reference/autogen/packages/database-runtime-mysql.md +0 -2
- package/reference/autogen/packages/database-runtime-postgres.md +0 -2
- package/reference/autogen/packages/database-runtime.md +39 -10
- package/reference/autogen/packages/http-runtime.md +79 -57
- package/reference/autogen/packages/json-rest-api-core.md +11 -8
- package/reference/autogen/packages/kernel.md +144 -83
- package/reference/autogen/packages/oidc-issuer-core.md +49 -20
- package/reference/autogen/packages/payments-core.md +20 -3
- package/reference/autogen/packages/realtime.md +47 -22
- package/reference/autogen/packages/resource-core.md +1 -1
- package/reference/autogen/packages/resource-crud-core.md +64 -26
- package/reference/autogen/packages/rewarded-core.md +47 -36
- package/reference/autogen/packages/shell-web.md +7 -10
- package/reference/autogen/packages/storage-runtime.md +6 -2
- package/reference/autogen/packages/uploads-runtime.md +10 -2
- package/reference/autogen/packages/users-core.md +73 -71
- package/reference/autogen/packages/workspaces-core.md +121 -106
- package/reference/autogen/packages/workspaces-web.md +1 -2
- package/reference/autogen/tooling/config-eslint.md +302 -0
- package/reference/autogen/tooling/jskit-catalog.md +28 -18
- package/reference/autogen/tooling/jskit-release.md +35 -20
- package/reference/autogen/tooling/testUtils.md +3 -1
- package/skills/jskit/SKILL.md +3 -2
- package/skills/jskit/references/app-operations.md +1 -1
- package/skills/jskit/references/client-features.md +491 -0
- package/skills/jskit/references/crud-form-actions.md +1 -1
- package/skills/jskit/references/crud-operations.md +7 -7
- package/skills/jskit/references/existing-application-migration.md +31 -27
- package/skills/jskit/references/heuristics/INDEX.md +5 -1
- package/skills/jskit/references/heuristics/child-cruds.md +1 -1
- package/skills/jskit/references/heuristics/client-features.md +66 -0
- package/skills/jskit/references/heuristics/client-requests.md +1 -1
- package/skills/jskit/references/heuristics/crud-authoring.md +12 -2
- package/skills/jskit/references/heuristics/crud-links.md +1 -1
- package/skills/jskit/references/heuristics/crud-repository-mapping.md +3 -3
- package/skills/jskit/references/heuristics/filters.md +1 -1
- package/skills/jskit/references/heuristics/live-actions.md +1 -1
- package/skills/jskit/references/heuristics/page-redirects.md +1 -1
- package/skills/jskit/references/heuristics/page-scaffolding.md +1 -1
- package/skills/jskit/references/heuristics/placements.md +1 -1
- package/skills/jskit/references/heuristics/row-policies.md +1 -1
- package/skills/jskit/references/heuristics/server-search.md +1 -1
- package/skills/jskit/references/heuristics/surfaces.md +1 -1
- package/skills/jskit/references/heuristics/typed-features.md +100 -0
- package/skills/jskit/references/heuristics/ui-contract.md +1 -1
- package/skills/jskit/references/heuristics/ui-testing.md +4 -4
- package/skills/jskit/references/material-3.md +2 -2
- package/skills/jskit/references/multi-homing.md +96 -50
- package/skills/jskit/references/pattern-index.md +37 -37
- package/skills/jskit/references/patterns/app/minimal-foundation/PATTERN.md +30 -1
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +14 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/develop.js +10 -5
- package/skills/jskit/references/patterns/app/minimal-foundation/example/eslint.config.mjs +21 -2
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +5 -4
- package/skills/jskit/references/patterns/app/minimal-foundation/example/playwright.config.mjs +1 -1
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/envFile.js +19 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/loggerOptions.js +15 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +32 -29
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/server/smoke.test.js +2 -1
- package/skills/jskit/references/patterns/app/shell-foundation/PATTERN.md +29 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +14 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/develop.js +10 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/eslint.config.mjs +21 -2
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +6 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/playwright.config.mjs +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/envFile.js +19 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/loggerOptions.js +15 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +32 -29
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/server/smoke.test.js +2 -1
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/ApplicationAiFeature.js +4 -2
- package/skills/jskit/references/patterns/auth/accounts-hub/PATTERN.md +2 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/accounts-hub/example/server/hubPaths.js +9 -3
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +25 -12
- package/skills/jskit/references/patterns/auth/auth-surface/example/tools/preview-identity +7 -1
- package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
- package/skills/jskit/references/patterns/connectors/ai-connections/PATTERN.md +16 -1
- package/skills/jskit/references/patterns/connectors/ai-connections/example/ai-model.js +12 -3
- package/skills/jskit/references/patterns/connectors/ai-connections/example/perplexity-answer.js +15 -4
- package/skills/jskit/references/patterns/connectors/api-key-connection/PATTERN.md +9 -1
- package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js +5 -2
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/PATTERN.md +13 -3
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/s3-transfer.js +14 -3
- package/skills/jskit/references/patterns/connectors/calendar-cli/PATTERN.md +8 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/knexfile.js +1 -1
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js +8 -4
- package/skills/jskit/references/patterns/connectors/event-delivery/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/connectors/firebase-messaging/PATTERN.md +10 -0
- package/skills/jskit/references/patterns/connectors/firebase-messaging/example/server/notifications.js +8 -0
- package/skills/jskit/references/patterns/connectors/google-ads-search/PATTERN.md +18 -7
- package/skills/jskit/references/patterns/connectors/google-ads-search/example/ads-setup.js +13 -5
- package/skills/jskit/references/patterns/connectors/oauth-connection/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/connectors/paddle-catalogue/PATTERN.md +11 -2
- package/skills/jskit/references/patterns/connectors/paddle-catalogue/example/create-products.js +5 -2
- package/skills/jskit/references/patterns/connectors/public-image/PATTERN.md +10 -1
- package/skills/jskit/references/patterns/connectors/public-image/example/logo-url.js +4 -1
- package/skills/jskit/references/patterns/connectors/redshift-queries/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/connectors/source-scanning/PATTERN.md +13 -2
- package/skills/jskit/references/patterns/connectors/source-scanning/example/source-scanner.js +9 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/PATTERN.md +102 -23
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/package.json +3 -2
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/types.js +5 -0
- package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +54 -1
- package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +16 -5
- package/skills/jskit/references/patterns/database/mysql-application/example/knexfile.js +2 -2
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +1 -1
- package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +16 -5
- package/skills/jskit/references/patterns/database/postgres-application/example/knexfile.js +2 -2
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +1 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/rewards/google-rewarded/example/GoogleRewardedDeliveryProvider.js +1 -1
- package/skills/jskit/references/patterns/rewards/google-rewarded/example/googlePublisherTag.js +5 -11
- package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +104 -10
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +9 -4
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/BookingEngineFeature.js +24 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/bookingAvailability.js +10 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/bookingEngine.js +29 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/bookingEngineActions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/inputSchemas.js +1 -2
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/types.js +12 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/AvailabilityEngineFeature.js +19 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupFeature.js +23 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/availabilityEngineActions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +32 -26
- package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceRollupActions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/orchestratorService.js +24 -19
- package/skills/jskit/references/patterns/server/feature-package/example/variations/types.js +7 -0
- package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +16 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -2
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/types.js +5 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +4 -3
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +2 -9
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/types.js +5 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +42 -17
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/WorkspaceInvitationsFeature.js +27 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/email/workspaceInviteEmail.js +11 -10
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/email/workspaceInviteMailer.js +27 -0
- package/skills/jskit/references/translation.md +5 -4
- package/skills/jskit/references/typed-features.md +1099 -0
- package/skills/jskit/references/ui-operations.md +3 -3
- package/patterns/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +0 -33
- package/patterns/feature-package/example/booking-engine/src/server/actions.js +0 -24
- package/patterns/feature-package/example/variations/AvailabilityEngineProvider.js +0 -31
- package/patterns/feature-package/example/variations/InvoiceRollupProvider.js +0 -36
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +0 -33
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/actions.js +0 -24
- package/skills/jskit/references/patterns/server/feature-package/example/variations/AvailabilityEngineProvider.js +0 -31
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupProvider.js +0 -36
|
@@ -24,8 +24,8 @@ Choose workspace creation policy, roles, invitation policy, expiry, email copy,
|
|
|
24
24
|
member permissions, personal-workspace behavior, and surface access rules.
|
|
25
25
|
|
|
26
26
|
In `workspaces` mode, `tenancyPolicy.workspace.autoProvision: true` gives every
|
|
27
|
-
user a personal workspace in addition to shared ones; the
|
|
28
|
-
`
|
|
27
|
+
user a personal workspace in addition to shared ones; the optional
|
|
28
|
+
`workspaces.personal-workspace-name` capability, a function of the user, names it. `workspaceSettings.defaults` sets
|
|
29
29
|
`invitesEnabled` and the colours (`lightPrimaryColor`, `darkPrimaryColor` and
|
|
30
30
|
the other palette fields) that new workspaces start with.
|
|
31
31
|
|
|
@@ -63,16 +63,16 @@ catalogue entries. Updating labels requires no database migration.
|
|
|
63
63
|
|
|
64
64
|
## Transactional invitation participation
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`fn({ invite, user }, { trx, context })`
|
|
70
|
-
expiry and activating membership in the
|
|
71
|
-
to every application owner and propagate
|
|
72
|
-
commits after the
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
unexpectedly missing application associations.
|
|
66
|
+
Provide one function as the optional `workspaces.invite-acceptance-participant`
|
|
67
|
+
capability, from a small application feature that requires only what its writes
|
|
68
|
+
need (it cannot require `workspaces.core`, which receives it). The built-in
|
|
69
|
+
`workspace.invite.redeem` action invokes `fn({ invite, user }, { trx, context })`
|
|
70
|
+
after validating the recipient, state and expiry and activating membership in the
|
|
71
|
+
uncommitted transaction. Forward `trx` to every application owner and propagate
|
|
72
|
+
failures. JSKIT marks accepted and commits after the function succeeds. Keep
|
|
73
|
+
external effects out of it. Without the capability, acceptance activates the
|
|
74
|
+
membership only. Allow ordinary invitations; reject stale, revoked, conflicting
|
|
75
|
+
or unexpectedly missing application associations.
|
|
76
76
|
|
|
77
77
|
Use `members.prepareInvite(workspace, actor,
|
|
78
78
|
payload, { trx, context })` in `repositories.workspaceInvites.withTransaction`
|
|
@@ -91,8 +91,8 @@ exception, or the normalized mailer result. Persistence is unchanged by delivery
|
|
|
91
91
|
failure. A provider may accept a message before failing; the application owns
|
|
92
92
|
receipts and retries. Keep tokens/URLs out of logs and use controlled mailers in tests.
|
|
93
93
|
|
|
94
|
-
`createInvite`, acceptance and refusal
|
|
95
|
-
borrowed `options.trx`. Use preparation followed by delivery after commit for
|
|
94
|
+
`createInvite`, acceptance and refusal own their managed transactions and
|
|
95
|
+
reject a borrowed `options.trx`. Use preparation followed by delivery after commit for
|
|
96
96
|
transactional creation; put related acceptance writes in the participant. Revocation may join
|
|
97
97
|
a managed transaction. Raw Knex/savepoint transactions cannot own resource
|
|
98
98
|
writes. Invitation mutations lock workspace then invitation rows, revalidate
|
|
@@ -115,9 +115,34 @@ authorization, identity/training linking, scope eligibility and required audit.
|
|
|
115
115
|
|
|
116
116
|
## Example files
|
|
117
117
|
|
|
118
|
-
`example/config/roles.js` is a concrete role catalogue
|
|
119
|
-
`
|
|
120
|
-
|
|
118
|
+
`example/config/roles.js` is a concrete role catalogue, set as the
|
|
119
|
+
application's `roleCatalog` config.
|
|
120
|
+
|
|
121
|
+
The invitation email comes from two optional `workspaces.core` capabilities,
|
|
122
|
+
which one small application feature provides:
|
|
123
|
+
`example/packages/main/src/server/WorkspaceInvitationsFeature.js`.
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
provides: {
|
|
127
|
+
inviteEmailTemplate: "workspaces.invite-email-template",
|
|
128
|
+
inviteMailer: "workspaces.invite-mailer"
|
|
129
|
+
},
|
|
130
|
+
setup({ env }) {
|
|
131
|
+
return {
|
|
132
|
+
inviteEmailTemplate: renderWorkspaceInviteEmail,
|
|
133
|
+
inviteMailer: createWorkspaceInviteMailer({ env })
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- `email/workspaceInviteEmail.js` is the renderer, a
|
|
139
|
+
`WorkspaceInviteEmailTemplate` returning `{ subject, text, html }`.
|
|
140
|
+
- `email/workspaceInviteMailer.js` is the mailer, a `WorkspaceInviteMailer`
|
|
141
|
+
whose `sendWorkspaceInvite` sends the rendered message over SMTP.
|
|
142
|
+
|
|
143
|
+
Without a renderer, workspaces-core uses its built-in email; without a mailer,
|
|
144
|
+
invitations are created and their delivery reports `mailer_unconfigured`. The
|
|
145
|
+
feature must not require `workspaces.core`, which receives both.
|
|
121
146
|
|
|
122
147
|
## Variation points
|
|
123
148
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineFeature } from "@jskit-ai/kernel/server/features";
|
|
2
|
+
import { renderWorkspaceInviteEmail } from "./email/workspaceInviteEmail.js";
|
|
3
|
+
import { createWorkspaceInviteMailer } from "./email/workspaceInviteMailer.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The application's invitation email: the renderer and the mailer that sends
|
|
7
|
+
* it, each filling one of workspaces-core's optional tokens.
|
|
8
|
+
*/
|
|
9
|
+
const WorkspaceInvitationsFeature = defineFeature({
|
|
10
|
+
id: "main.workspace-invitations",
|
|
11
|
+
requires: {
|
|
12
|
+
env: "runtime.env"
|
|
13
|
+
},
|
|
14
|
+
provides: {
|
|
15
|
+
inviteEmailTemplate: "workspaces.invite-email-template",
|
|
16
|
+
inviteMailer: "workspaces.invite-mailer"
|
|
17
|
+
},
|
|
18
|
+
/** @param {{ env: import("@jskit-ai/kernel/server/types").RuntimeEnv }} capabilities */
|
|
19
|
+
setup({ env }) {
|
|
20
|
+
return {
|
|
21
|
+
inviteEmailTemplate: renderWorkspaceInviteEmail,
|
|
22
|
+
inviteMailer: createWorkspaceInviteMailer({ env })
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { WorkspaceInvitationsFeature };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
1
|
+
/**
|
|
2
|
+
* The application's invitation email, provided as
|
|
3
|
+
* `workspaces.invite-email-template`. workspaces-core passes every field; the
|
|
4
|
+
* inviter is null when no one is signed in, and `roleLabel` is present only
|
|
5
|
+
* when the role catalogue names the role.
|
|
6
|
+
* @type {import("@jskit-ai/workspaces-core/server/types").WorkspaceInviteEmailTemplate}
|
|
7
|
+
*/
|
|
8
|
+
function renderWorkspaceInviteEmail({ inviteUrl, workspace, inviter, roleSid, roleLabel, expiresAt }) {
|
|
9
|
+
const workspaceName = workspace.name || workspace.slug;
|
|
10
|
+
const inviterName = inviter?.displayName || inviter?.email || "";
|
|
11
|
+
const roleName = roleLabel || roleSid;
|
|
11
12
|
const intro = inviterName
|
|
12
13
|
? `${inviterName} invited you to join ${workspaceName} as ${roleName}.`
|
|
13
14
|
: `You have been invited to join ${workspaceName} as ${roleName}.`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import nodemailer from "nodemailer";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The application's `workspaces.invite-mailer`: sends each rendered
|
|
5
|
+
* invitation through the SMTP server `SMTP_URL` names, from `MAIL_FROM`.
|
|
6
|
+
* @param {object} dependencies
|
|
7
|
+
* @param {import("@jskit-ai/kernel/server/types").RuntimeEnv} dependencies.env
|
|
8
|
+
* @returns {import("@jskit-ai/workspaces-core/server/types").WorkspaceInviteMailer}
|
|
9
|
+
*/
|
|
10
|
+
function createWorkspaceInviteMailer({ env }) {
|
|
11
|
+
const transport = nodemailer.createTransport(env.SMTP_URL);
|
|
12
|
+
|
|
13
|
+
async function sendWorkspaceInvite({ email, message }) {
|
|
14
|
+
const sent = await transport.sendMail({
|
|
15
|
+
from: env.MAIL_FROM,
|
|
16
|
+
to: email,
|
|
17
|
+
subject: message.subject,
|
|
18
|
+
text: message.text,
|
|
19
|
+
...(message.html ? { html: message.html } : {})
|
|
20
|
+
});
|
|
21
|
+
return { status: "sent", providerMessageId: sent.messageId };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return Object.freeze({ sendWorkspaceInvite });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { createWorkspaceInviteMailer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Generated from `packages/agent-docs/site/guide/framework/translation.md
|
|
1
|
+
<!-- Generated from `packages/agent-docs/site/guide/framework/translation.md`. -->
|
|
2
2
|
|
|
3
3
|
# Translating a JSKIT app
|
|
4
4
|
|
|
@@ -140,9 +140,10 @@ the English `message`:
|
|
|
140
140
|
`messageParams` for the exact sentence.
|
|
141
141
|
|
|
142
142
|
The client translates a code only when the English the server sent is JSKIT's
|
|
143
|
-
English for that code. An app's own sentence under
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
English for that code. An app's own sentence under JSKIT's shared code is shown
|
|
144
|
+
exactly as written, and so is any text whose code has no catalog entry. That is
|
|
145
|
+
why each refusal an app throws
|
|
146
|
+
[carries its own code](typed-features.md#refusals-carry-their-own-code).
|
|
146
147
|
|
|
147
148
|
App code that shows errors uses the same helper JSKIT's components use:
|
|
148
149
|
|