@jskit-ai/agent-docs 0.1.330 → 0.1.332
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/realtime.md +11 -3
- package/guide/agent/app-setup/authentication.md +29 -24
- package/guide/agent/app-setup/initial-scaffolding.md +10 -9
- package/guide/agent/app-setup/more-than-one-server.md +111 -0
- package/guide/agent/app-setup/multi-homing.md +2 -2
- package/guide/agent/app-setup/package-with-nix.md +60 -15
- package/guide/agent/app-setup/upgrading-jskit.md +36 -1
- package/guide/agent/framework/data-access.md +9 -3
- package/guide/agent/framework/environments.md +174 -0
- package/guide/agent/framework/sanity-checks.md +3 -3
- package/guide/agent/framework/security-pass.md +7 -5
- package/guide/agent/index.md +6 -2
- package/package.json +1 -1
- package/patterns/feature-package/example/booking-engine/package.json +1 -1
- package/patterns/minimal-foundation/example/.env.example +8 -0
- package/patterns/minimal-foundation/example/AGENTS.md +7 -5
- package/patterns/minimal-foundation/example/bin/develop.js +2 -0
- package/patterns/minimal-foundation/example/package.json +6 -6
- package/patterns/shell-foundation/example/.env.example +8 -0
- package/patterns/shell-foundation/example/AGENTS.md +7 -5
- package/patterns/shell-foundation/example/bin/develop.js +2 -0
- package/patterns/shell-foundation/example/package.json +7 -7
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/reference/autogen/KERNEL_MAP.md +10 -11
- package/reference/autogen/PATTERN_INDEX.md +38 -38
- package/reference/autogen/packages/auth-core.md +2 -2
- package/reference/autogen/packages/auth-provider-local-core.md +9 -9
- package/reference/autogen/packages/auth-provider-oidc-core.md +1 -1
- package/reference/autogen/packages/auth-provider-supabase-core.md +2 -2
- package/reference/autogen/packages/connectors-core.md +2 -2
- package/reference/autogen/packages/kernel.md +32 -27
- package/reference/autogen/packages/oidc-issuer-core.md +4 -4
- package/reference/autogen/packages/payments-core.md +1 -1
- package/reference/autogen/packages/shell-web.md +13 -13
- package/reference/autogen/packages/storage-runtime.md +6 -0
- package/reference/autogen/packages/workspaces-core.md +4 -4
- package/reference/autogen/tooling/jskit-catalog.md +6 -1
- package/skills/jskit/SKILL.md +2 -1
- package/skills/jskit/references/data-access.md +9 -3
- package/skills/jskit/references/environments.md +169 -0
- package/skills/jskit/references/heuristics/INDEX.md +1 -1
- package/skills/jskit/references/multi-homing.md +2 -2
- package/skills/jskit/references/package-with-nix.md +60 -15
- package/skills/jskit/references/pattern-index.md +38 -38
- package/skills/jskit/references/patterns/app/minimal-foundation/example/.env.example +8 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +7 -5
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/develop.js +2 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +6 -6
- package/skills/jskit/references/patterns/app/shell-foundation/example/.env.example +8 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +7 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/develop.js +2 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +7 -7
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
- 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/api-key-connection/PATTERN.md +4 -1
- package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js +3 -3
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/.env.example +1 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -4
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js +3 -1
- package/skills/jskit/references/patterns/connectors/firebase-messaging/example/server/notifications.js +3 -3
- package/skills/jskit/references/patterns/connectors/oauth-connection/PATTERN.md +3 -1
- package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/realtime/realtime-application/example/.env.example +1 -0
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
- package/skills/jskit/references/sanity-checks.md +3 -3
- package/skills/jskit/references/security-pass.md +7 -5
- package/guide/agent/framework/side-effects.md +0 -77
- package/skills/jskit/references/side-effects.md +0 -72
|
@@ -49,12 +49,12 @@ Exports
|
|
|
49
49
|
- `resolveLocalAuthConfig({ appRoot, env, fileBackend, emailRecovery, emailConfirmationSender = false })`
|
|
50
50
|
Local functions
|
|
51
51
|
- `resolveStoreDir(env, appRoot)`
|
|
52
|
-
- `resolveSessionSecret(env, { storeDir,
|
|
53
|
-
- `resolveSecondFactorKey(env, {
|
|
54
|
-
- `resolveSetupCode(env, {
|
|
55
|
-
- `resolveAppPublicUrl(env, { emailRecovery, emailedConfirmation, oauthEnabled,
|
|
56
|
-
- `resolveRecoveryDelivery(env, { emailRecovery,
|
|
57
|
-
- `resolveConfirmationDelivery(env, { emailConfirmationSender,
|
|
52
|
+
- `resolveSessionSecret(env, { storeDir, isDeployed })`
|
|
53
|
+
- `resolveSecondFactorKey(env, { isDeployed, sessionSecret })`
|
|
54
|
+
- `resolveSetupCode(env, { isDeployed })`
|
|
55
|
+
- `resolveAppPublicUrl(env, { emailRecovery, emailedConfirmation, oauthEnabled, deployedSecondFactor })`
|
|
56
|
+
- `resolveRecoveryDelivery(env, { emailRecovery, isDeployed })`
|
|
57
|
+
- `resolveConfirmationDelivery(env, { emailConfirmationSender, isDeployed, selfRegistration })`
|
|
58
58
|
- `resolvePasswordMinLength(env)`
|
|
59
59
|
|
|
60
60
|
### `src/server/lib/deliveries.js`
|
|
@@ -68,7 +68,6 @@ Exports
|
|
|
68
68
|
- `confirmEveryRegistrationByLink()`
|
|
69
69
|
- `createLocalEmailConfirmation({ backend, config, confirmationMode, confirmationSender, deliveries, firstAccountSetup, invitationContextResolver, logger, passwords, profileProjector, sessions })`
|
|
70
70
|
- `createLoggedConfirmationSender(logger)`
|
|
71
|
-
- `createSimulatedConfirmationSender(logger)`
|
|
72
71
|
Local functions
|
|
73
72
|
- `emailTakenError()`
|
|
74
73
|
- `confirmationInvalidError()`
|
|
@@ -173,7 +172,6 @@ Exports
|
|
|
173
172
|
Exports
|
|
174
173
|
- `createLocalPasswordFlows({ backend, config, deliveries, passwords, profileProjector, recoverySender, sessions })`
|
|
175
174
|
- `createLoggedRecoverySender(logger)`
|
|
176
|
-
- `createSimulatedRecoverySender(logger)`
|
|
177
175
|
|
|
178
176
|
### `src/server/lib/passwords.js`
|
|
179
177
|
Exports
|
|
@@ -235,7 +233,7 @@ Exports
|
|
|
235
233
|
|
|
236
234
|
### `src/server/lib/sessions.js`
|
|
237
235
|
Exports
|
|
238
|
-
- `cookieOptions({
|
|
236
|
+
- `cookieOptions({ isDeployed, cookieSameSite }, maxAge)`
|
|
239
237
|
- `createLocalSessions({ appProfileProjection, backend, config, profileProjector })`
|
|
240
238
|
- `safeRequestCookies(request)`
|
|
241
239
|
Local functions
|
|
@@ -274,6 +272,8 @@ Local functions
|
|
|
274
272
|
### `src/server/providers/AuthLocalProvider.js`
|
|
275
273
|
Exports
|
|
276
274
|
- `AuthLocalProvider`
|
|
275
|
+
Local functions
|
|
276
|
+
- `sendAsAppEnvironmentSays({ env, logger, sender, name })`
|
|
277
277
|
|
|
278
278
|
### `src/server/types.js`
|
|
279
279
|
Exports
|
|
@@ -28,7 +28,7 @@ Local functions
|
|
|
28
28
|
- `text(value)`
|
|
29
29
|
- `parseAddress(value, name)`
|
|
30
30
|
- `resolveAppName(appRoot)`
|
|
31
|
-
- `resolveSessionSecret(env, { appRoot,
|
|
31
|
+
- `resolveSessionSecret(env, { appRoot, isDeployed })`
|
|
32
32
|
|
|
33
33
|
### `src/server/lib/index.js`
|
|
34
34
|
Exports
|
|
@@ -25,8 +25,8 @@ Exports
|
|
|
25
25
|
### `src/server/lib/authCookies.js`
|
|
26
26
|
Exports
|
|
27
27
|
- `safeRequestCookies(request)`
|
|
28
|
-
- `cookieOptions(
|
|
29
|
-
- `cookieClearOptions(
|
|
28
|
+
- `cookieOptions(isDeployed, maxAge)`
|
|
29
|
+
- `cookieClearOptions(isDeployed)`
|
|
30
30
|
|
|
31
31
|
### `src/server/lib/authenticatedProfile.js`
|
|
32
32
|
Exports
|
|
@@ -22,7 +22,7 @@ Local functions
|
|
|
22
22
|
|
|
23
23
|
### `src/server/connectionService.js`
|
|
24
24
|
Exports
|
|
25
|
-
- `createConnectionService({ configuration, providers, resolveReference, store, authorize, executionMode = "application", fetchImpl = globalThis.fetch, now = Date.now,
|
|
25
|
+
- `createConnectionService({ configuration, providers, resolveReference, store, authorize, executionMode = "application", fetchImpl = globalThis.fetch, now = Date.now, appEnv, logger = console })`
|
|
26
26
|
Local functions
|
|
27
27
|
- `publicConnection(connection)`
|
|
28
28
|
- `connectionMatches(connection, integration, providerId, registration)`
|
|
@@ -94,7 +94,7 @@ Exports
|
|
|
94
94
|
Exports
|
|
95
95
|
- `SIMULATED_RESULT`
|
|
96
96
|
- `connectionProvider(definition, integration)`
|
|
97
|
-
- `createProviderRequests({ fetchImpl, now, resolveReference,
|
|
97
|
+
- `createProviderRequests({ fetchImpl, now, resolveReference, appEnv, logger = console })`
|
|
98
98
|
- `operationRequest(operation, input, settings, providerData)`
|
|
99
99
|
- `requireOperationScope(operation, scopes, message, { messageCode })`
|
|
100
100
|
- `tokenResponse(provider, response, details)`
|
|
@@ -64,6 +64,16 @@ Exports
|
|
|
64
64
|
- `resolveLinkPath`
|
|
65
65
|
- `normalizePathname`
|
|
66
66
|
|
|
67
|
+
### `shared/support/appEnvironment.js`
|
|
68
|
+
Exports
|
|
69
|
+
- `APP_ENV_KEY`
|
|
70
|
+
- `APP_ENVIRONMENTS`
|
|
71
|
+
- `APP_ENVIRONMENT_META_NAME`
|
|
72
|
+
- `appEnvironment(env)`
|
|
73
|
+
- `isDeployed(env)`
|
|
74
|
+
- `pageAppEnvironment(documentObject = globalThis.document)`
|
|
75
|
+
- `withAppEnvironmentMeta(html, environment)`
|
|
76
|
+
|
|
67
77
|
### `shared/support/clientBuild.js`
|
|
68
78
|
Exports
|
|
69
79
|
- `CLIENT_BUILD_META_NAME`
|
|
@@ -215,17 +225,6 @@ Exports
|
|
|
215
225
|
Local functions
|
|
216
226
|
- `normalizePlacementRenderers(value = {})`
|
|
217
227
|
|
|
218
|
-
### `shared/support/sideEffects.js`
|
|
219
|
-
Exports
|
|
220
|
-
- `SIDE_EFFECTS_ENV_KEY`
|
|
221
|
-
- `SIDE_EFFECTS_LIVE`
|
|
222
|
-
- `SIDE_EFFECTS_META_NAME`
|
|
223
|
-
- `SIDE_EFFECTS_SIMULATE`
|
|
224
|
-
- `pageSideEffectsMode(documentObject = globalThis.document)`
|
|
225
|
-
- `resolveSideEffectsMode(env)`
|
|
226
|
-
- `sideEffectsAreLive(env)`
|
|
227
|
-
- `withSideEffectsMeta(html, mode)`
|
|
228
|
-
|
|
229
228
|
### `shared/support/silentLogger.js`
|
|
230
229
|
Exports
|
|
231
230
|
- `silentLogger`
|
|
@@ -780,6 +779,12 @@ Exports
|
|
|
780
779
|
Exports
|
|
781
780
|
- `compileRouteValidator`
|
|
782
781
|
|
|
782
|
+
### `server/http/appEnvironmentPage.js`
|
|
783
|
+
Exports
|
|
784
|
+
- `registerAppEnvironmentPage(fastify, { env })`
|
|
785
|
+
- `type RuntimeEnv`
|
|
786
|
+
- `type RuntimeFastify`
|
|
787
|
+
|
|
783
788
|
### `server/http/capabilityHttpRuntime.js`
|
|
784
789
|
Exports
|
|
785
790
|
- `createCapabilityHttpRuntime({ fastify, actions })`
|
|
@@ -947,12 +952,6 @@ Local functions
|
|
|
947
952
|
- `resolveContentSecurityPolicyHeaders(settings)`
|
|
948
953
|
- `resolveSecurityHeaders({ config, env })`
|
|
949
954
|
|
|
950
|
-
### `server/http/sideEffectsPage.js`
|
|
951
|
-
Exports
|
|
952
|
-
- `registerSideEffectsPage(fastify, { env })`
|
|
953
|
-
- `type RuntimeEnv`
|
|
954
|
-
- `type RuntimeFastify`
|
|
955
|
-
|
|
956
955
|
### `server/http/trustedProxies.js`
|
|
957
956
|
Exports
|
|
958
957
|
- `DEFAULT_TRUSTED_PROXIES`
|
|
@@ -1029,6 +1028,22 @@ Exports
|
|
|
1029
1028
|
Local functions
|
|
1030
1029
|
- `matchesGlobalUiPath(pathname, globalUiPaths)`
|
|
1031
1030
|
|
|
1031
|
+
### `server/runtime/appEnvironment.js`
|
|
1032
|
+
Exports
|
|
1033
|
+
- `STAGING_ORIGINAL_TO_HEADER`
|
|
1034
|
+
- `assertAppEnvironment(env)`
|
|
1035
|
+
- `assertDevelopmentOnlySettings(env, names)`
|
|
1036
|
+
- `deliverMessage({ env, logger, channel, to, summary, details = {}, send })`
|
|
1037
|
+
- `logAppEnvironment(logger, env)`
|
|
1038
|
+
- `logSideEffect(logger, environment, { kind, summary, details = {}, reason = "" })`
|
|
1039
|
+
- `markStagingEmail(email, originalTo)`
|
|
1040
|
+
- `type RuntimeEnv`
|
|
1041
|
+
- `type RuntimeLogger`
|
|
1042
|
+
- `type AppEnvironment`
|
|
1043
|
+
Local functions
|
|
1044
|
+
- `stagingAddress(env, kind)`
|
|
1045
|
+
- `escapeHtml(value)`
|
|
1046
|
+
|
|
1032
1047
|
### `server/runtime/BootstrapProvider.js`
|
|
1033
1048
|
Exports
|
|
1034
1049
|
- `BootstrapProvider`
|
|
@@ -1097,11 +1112,6 @@ Exports
|
|
|
1097
1112
|
- `safePathnameFromRequest(request)`
|
|
1098
1113
|
- `resolveClientIpAddress(request)`
|
|
1099
1114
|
|
|
1100
|
-
### `server/runtime/runtimeMode.js`
|
|
1101
|
-
Exports
|
|
1102
|
-
- `assertDevelopmentOnlySettings(env, names)`
|
|
1103
|
-
- `isProductionEnv(env)`
|
|
1104
|
-
|
|
1105
1115
|
### `server/runtime/serviceAuthorization.js`
|
|
1106
1116
|
Exports
|
|
1107
1117
|
- `requireAuth(source = {}, options = {})`
|
|
@@ -1111,11 +1121,6 @@ Local functions
|
|
|
1111
1121
|
- `normalizeRequireAuthOptions(options = {})`
|
|
1112
1122
|
- `requireAuthenticatedActor(context = {}, options = {})`
|
|
1113
1123
|
|
|
1114
|
-
### `server/runtime/sideEffects.js`
|
|
1115
|
-
Exports
|
|
1116
|
-
- `logSideEffectsMode(logger, env)`
|
|
1117
|
-
- `logSimulatedSideEffect(logger, { kind, summary, details = {} })`
|
|
1118
|
-
|
|
1119
1124
|
### `server/support/appConfig.js`
|
|
1120
1125
|
Exports
|
|
1121
1126
|
- `resolveMobileConfig(appConfig)`
|
|
@@ -68,11 +68,11 @@ Exports
|
|
|
68
68
|
- `resolveHubDevAuth(env)`
|
|
69
69
|
Local functions
|
|
70
70
|
- `text(value)`
|
|
71
|
-
- `resolveIssuer(env,
|
|
71
|
+
- `resolveIssuer(env, deployed)`
|
|
72
72
|
- `readOrCreateDevSecret(appRoot)`
|
|
73
|
-
- `resolveSecret(env, {
|
|
73
|
+
- `resolveSecret(env, { deployed, appRoot })`
|
|
74
74
|
- `parseDevOriginPatterns(value)`
|
|
75
|
-
- `resolveMail(env, {
|
|
75
|
+
- `resolveMail(env, { deployed })`
|
|
76
76
|
- `resolveGoogle(env)`
|
|
77
77
|
|
|
78
78
|
### `src/server/crypto.js`
|
|
@@ -181,7 +181,7 @@ Local functions
|
|
|
181
181
|
### `src/server/mailer.js`
|
|
182
182
|
Exports
|
|
183
183
|
- `composeMessage({ heading, body, actionLabel, actionUrl, footer })`
|
|
184
|
-
- `createMailer({ mail,
|
|
184
|
+
- `createMailer({ mail, env, logger, fetchImpl })`
|
|
185
185
|
|
|
186
186
|
### `src/server/oidcProvider.js`
|
|
187
187
|
Exports
|
|
@@ -23,7 +23,7 @@ Local functions
|
|
|
23
23
|
|
|
24
24
|
### `src/server/checkout.js`
|
|
25
25
|
Exports
|
|
26
|
-
- `createPaymentCheckoutService({ adapter, store, payments, merchantScope, returnUrl, authorize,
|
|
26
|
+
- `createPaymentCheckoutService({ adapter, store, payments, merchantScope, returnUrl, authorize, appEnv })`
|
|
27
27
|
|
|
28
28
|
### `src/server/errors.js`
|
|
29
29
|
Exports
|
|
@@ -22,6 +22,14 @@ Exports
|
|
|
22
22
|
Exports
|
|
23
23
|
- `inspectVueArchitecture`
|
|
24
24
|
|
|
25
|
+
### `src/client/appEnvironment/appEnvironmentBanner.js`
|
|
26
|
+
Exports
|
|
27
|
+
- `APP_ENVIRONMENT_BANNER_ID`
|
|
28
|
+
- `createAppEnvironmentBannerRuntime(options)`
|
|
29
|
+
- `installAppEnvironmentBanner({ documentObject = pageDocument(), environment = pageAppEnvironment(documentObject) } = {})`
|
|
30
|
+
Local functions
|
|
31
|
+
- `removeNothing()`
|
|
32
|
+
|
|
25
33
|
### `src/client/asyncModuleRecovery/index.js`
|
|
26
34
|
Exports
|
|
27
35
|
- `NO_SHELL_ASYNC_MODULE_RECOVERY_RUNTIME`
|
|
@@ -566,14 +574,6 @@ Exports
|
|
|
566
574
|
Local functions
|
|
567
575
|
- `isPullRefreshQuery(query)`
|
|
568
576
|
|
|
569
|
-
### `src/client/sideEffects/testCopyBanner.js`
|
|
570
|
-
Exports
|
|
571
|
-
- `TEST_COPY_BANNER_ID`
|
|
572
|
-
- `createTestCopyBannerRuntime(options)`
|
|
573
|
-
- `installTestCopyBanner({ documentObject = pageDocument(), mode = pageSideEffectsMode(documentObject) } = {})`
|
|
574
|
-
Local functions
|
|
575
|
-
- `removeNothing()`
|
|
576
|
-
|
|
577
577
|
### `src/client/stores/useShellErrorPresentationStore.js`
|
|
578
578
|
Exports
|
|
579
579
|
- `useShellErrorPresentationStore`
|
|
@@ -806,23 +806,23 @@ Exports
|
|
|
806
806
|
Exports
|
|
807
807
|
- None
|
|
808
808
|
|
|
809
|
-
### `fixtures/
|
|
809
|
+
### `fixtures/app-environment-banner/src/main.js`
|
|
810
810
|
Exports
|
|
811
811
|
- None
|
|
812
812
|
|
|
813
|
-
### `fixtures/
|
|
813
|
+
### `fixtures/app-environment-banner/vite.config.mjs`
|
|
814
814
|
Exports
|
|
815
815
|
- None
|
|
816
816
|
|
|
817
|
-
### `fixtures/production-build/
|
|
817
|
+
### `fixtures/production-build/src/App.vue`
|
|
818
818
|
Exports
|
|
819
819
|
- None
|
|
820
820
|
|
|
821
|
-
### `fixtures/
|
|
821
|
+
### `fixtures/production-build/src/main.js`
|
|
822
822
|
Exports
|
|
823
823
|
- None
|
|
824
824
|
|
|
825
|
-
### `fixtures/
|
|
825
|
+
### `fixtures/production-build/vite.config.mjs`
|
|
826
826
|
Exports
|
|
827
827
|
- None
|
|
828
828
|
|
|
@@ -26,11 +26,17 @@ Exports
|
|
|
26
26
|
Exports
|
|
27
27
|
- `STORAGE_DRIVER_ENV_KEY`
|
|
28
28
|
- `STORAGE_FS_BASE_PATH_ENV_KEY`
|
|
29
|
+
- `STORAGE_S3_ACCESS_KEY_ID_ENV_KEY`
|
|
30
|
+
- `STORAGE_S3_BUCKET_ENV_KEY`
|
|
31
|
+
- `STORAGE_S3_ENDPOINT_ENV_KEY`
|
|
32
|
+
- `STORAGE_S3_REGION_ENV_KEY`
|
|
33
|
+
- `STORAGE_S3_SECRET_ACCESS_KEY_ENV_KEY`
|
|
29
34
|
- `DEFAULT_STORAGE_DRIVER`
|
|
30
35
|
- `normalizeStorageDriver(value)`
|
|
31
36
|
- `createStorageBinding({ env, appRoot })`
|
|
32
37
|
Local functions
|
|
33
38
|
- `resolveFsBasePath(fsBasePath, appRoot)`
|
|
39
|
+
- `createS3Driver(env)`
|
|
34
40
|
|
|
35
41
|
### `src/server/types.js`
|
|
36
42
|
Exports
|
|
@@ -204,6 +204,10 @@ Local functions
|
|
|
204
204
|
Exports
|
|
205
205
|
- `registerWorkspaceDirectoryRoutes(router, { config, workspaceSelfCreateEnabled })`
|
|
206
206
|
|
|
207
|
+
### `src/server/workspaceMembers/appEnvironmentInviteMailer.js`
|
|
208
|
+
Exports
|
|
209
|
+
- `createAppEnvironmentInviteMailer({ env, logger, mailer })`
|
|
210
|
+
|
|
207
211
|
### `src/server/workspaceMembers/defaultWorkspaceInviteEmail.js`
|
|
208
212
|
Exports
|
|
209
213
|
- `formatInviteExpiry(expiresAt, locale, timeZone)`
|
|
@@ -211,10 +215,6 @@ Exports
|
|
|
211
215
|
Local functions
|
|
212
216
|
- `escapeHtml(value)`
|
|
213
217
|
|
|
214
|
-
### `src/server/workspaceMembers/simulatedWorkspaceInviteMailer.js`
|
|
215
|
-
Exports
|
|
216
|
-
- `createSimulatedWorkspaceInviteMailer(logger)`
|
|
217
|
-
|
|
218
218
|
### `src/server/workspaceMembers/unconfiguredWorkspaceInviteMailer.js`
|
|
219
219
|
Exports
|
|
220
220
|
- `buildMailerUnconfiguredDelivery()`
|
|
@@ -294,9 +294,10 @@ Exports
|
|
|
294
294
|
Local functions
|
|
295
295
|
- `isObject(value)`
|
|
296
296
|
- `scriptEnvironment({ app, envFile })`
|
|
297
|
-
- `scriptOf(app, name)`
|
|
297
|
+
- `scriptOf(app, name, { optional = false } = {})`
|
|
298
298
|
- `replaceWithScript({ app, shell, envFile, name, first })`
|
|
299
299
|
- `check({ envFile, wait })`
|
|
300
|
+
- `chownTo(user, file)`
|
|
300
301
|
- `prepare({ settings, envFile, user })`
|
|
301
302
|
- `npmCache(list, cache)`
|
|
302
303
|
- `isCliEntrypoint(argvPath = process.argv[1])`
|
|
@@ -417,6 +418,10 @@ Local functions
|
|
|
417
418
|
- `exportedTableResources(namespace, isTableResource)`
|
|
418
419
|
- `keyText({ tableName, columns, referencedTableName, referencedColumns })`
|
|
419
420
|
|
|
421
|
+
### `scripts/test-environment.mjs`
|
|
422
|
+
Exports
|
|
423
|
+
- `useTestAppEnvironment(env, command)`
|
|
424
|
+
|
|
420
425
|
### `scripts/test-file-stop.mjs`
|
|
421
426
|
Exports
|
|
422
427
|
- `STOPPED_PREFIX`
|
package/skills/jskit/SKILL.md
CHANGED
|
@@ -50,7 +50,8 @@ manifests, migrations, tests, and runtime behaviour are the evidence.
|
|
|
50
50
|
- [multi-homing](references/multi-homing.md) for workspaces or invitations.
|
|
51
51
|
- [translation](references/translation.md) for languages, translated texts
|
|
52
52
|
or error codes.
|
|
53
|
-
- [
|
|
53
|
+
- [environments](references/environments.md) before code that sends email, messages or payments, or that
|
|
54
|
+
depends on where the app runs (APP_ENV).
|
|
54
55
|
- [Nix packaging](references/package-with-nix.md) to package an app for a host
|
|
55
56
|
that runs apps only as Nix packages, built with no network access.
|
|
56
57
|
- For creation, foundation patterns, or package selection, read
|
|
@@ -1021,9 +1021,15 @@ that finds the deciding rows directly, since on MySQL and MariaDB a locking
|
|
|
1021
1021
|
subquery locks every row it examines. The rows a subquery examines are the
|
|
1022
1022
|
rows its plan walks, not the rows it returns: one that reads through another
|
|
1023
1023
|
table by a link (a module's definition by its id) and narrows to the caller's
|
|
1024
|
-
owner after the walk locks the rows of every owner its index range crosses
|
|
1025
|
-
|
|
1026
|
-
|
|
1024
|
+
owner after the walk locks the rows of every owner its index range crosses,
|
|
1025
|
+
and the planner may scan a nested table whole when the caller's owner holds
|
|
1026
|
+
most of its rows. Give each nested read a filter on the owner's columns that an
|
|
1027
|
+
index leads with, and on MySQL and MariaDB name that index:
|
|
1028
|
+
`ownTable(name).forceIndex(index)`, or `forceIndex(index)` on a `joinSource()`'s
|
|
1029
|
+
`query`, makes the read use that index on its table, so it examines only the
|
|
1030
|
+
owner's range. It takes plain index names and sets the hint once; PostgreSQL
|
|
1031
|
+
and SQLite have no index hints, and there it throws a `TypeError`. Or keep the
|
|
1032
|
+
walk out of the lock: lock the rows, then check the linked
|
|
1027
1033
|
rows with a read of their own. `claim` keeps its policy's subqueries
|
|
1028
1034
|
plain reads. Rows
|
|
1029
1035
|
of several owners are never locked in one statement over a join, which on
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<!-- Generated from `packages/agent-docs/site/guide/framework/environments.md`. -->
|
|
2
|
+
|
|
3
|
+
# Environments
|
|
4
|
+
|
|
5
|
+
Where an application runs is one environment variable, `APP_ENV`, with four
|
|
6
|
+
values. Everything JSKIT does differently by place reads it: what the
|
|
7
|
+
application sends, the development shortcuts, the security headers and the
|
|
8
|
+
banner on each page. `NODE_ENV` decides nothing else: it only picks optimised
|
|
9
|
+
builds, and staging and production set it to `production`.
|
|
10
|
+
|
|
11
|
+
| `APP_ENV` | Where | Email and SMS | Push, webhooks, connector writes | Payments | Development shortcuts | Banner |
|
|
12
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
13
|
+
| `development` | a developer's machine, a session, a preview | logged | logged | sandbox only | allowed | "Development" |
|
|
14
|
+
| `test` | automated test runs | logged | logged | sandbox only | allowed | "Test" |
|
|
15
|
+
| `staging` | a deployed copy for checking the application | only to `STAGING_EMAIL_TO` and `STAGING_SMS_TO`; logged when unset | logged | sandbox only | refused | "Staging" |
|
|
16
|
+
| `production` | the application serving real people | sent | sent | live | refused | none |
|
|
17
|
+
|
|
18
|
+
The development shortcuts are dev sign-in (`AUTH_DEV_BYPASS_ENABLED`), cookies
|
|
19
|
+
without `Secure`, links in answers (`AUTH_LOCAL_RECOVERY_DEV_OUTPUT`), a first
|
|
20
|
+
account without a setup code, test databases, and a server that refuses to
|
|
21
|
+
start over a role grant no action requires (staging and production log it
|
|
22
|
+
instead). Staging and production add HSTS and the content security policy, and
|
|
23
|
+
need production's secrets, such as `AUTH_LOCAL_SESSION_SECRET` and a sender for
|
|
24
|
+
the emails they send.
|
|
25
|
+
|
|
26
|
+
## Who sets what
|
|
27
|
+
|
|
28
|
+
The host sets `APP_ENV`; a request never chooses it. JSKIT's own commands set
|
|
29
|
+
it where they own the run.
|
|
30
|
+
|
|
31
|
+
| Who | `APP_ENV` | `NODE_ENV` | `STAGING_EMAIL_TO`, `STAGING_SMS_TO` |
|
|
32
|
+
| --- | --- | --- | --- |
|
|
33
|
+
| `npm run develop`, `npm run dev` on a developer's machine | `development`, set by the scripts | unset | unset |
|
|
34
|
+
| A hosted session or preview | `development` | unset | unset |
|
|
35
|
+
| `jskit test` and the browser test servers | `test`, set by JSKIT | anything | unset |
|
|
36
|
+
| A build-check machine that starts the packaged build to see it start and answer health | `staging` | `production` | unset, so everything is logged |
|
|
37
|
+
| A staging server | `staging` | `production` | the testers' inbox and phone |
|
|
38
|
+
| A production server | `production` | `production` | ignored |
|
|
39
|
+
|
|
40
|
+
A server started with `npm start` reads `APP_ENV` from its environment, or from
|
|
41
|
+
`.env` (`APP_ENV=development` on a developer's machine; the foundations'
|
|
42
|
+
`.env.example` says so). A host puts both variables in the server's
|
|
43
|
+
environment, beside its other settings:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
APP_ENV=staging NODE_ENV=production STAGING_EMAIL_TO=qa@example.com npm start
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`jskit test` and the browser test servers run as `APP_ENV=test` whatever the
|
|
50
|
+
shell says, and refuse to run where `APP_ENV` is `staging` or `production`.
|
|
51
|
+
|
|
52
|
+
## Starting refuses what is not clear
|
|
53
|
+
|
|
54
|
+
A server stops at startup, saying what to do, when:
|
|
55
|
+
|
|
56
|
+
- `APP_ENV` is missing: `APP_ENV is not set. Set APP_ENV to development, test,
|
|
57
|
+
staging or production: development on a developer's machine or in a preview,
|
|
58
|
+
staging or production (with NODE_ENV=production) on a server.`
|
|
59
|
+
- `APP_ENV` is anything else: `APP_ENV is "dev", which is not an environment
|
|
60
|
+
JSKIT knows. Set APP_ENV to development, test, staging or production.`
|
|
61
|
+
- `APP_ENV` is `staging` or `production` and `NODE_ENV` is not `production`:
|
|
62
|
+
`APP_ENV is staging, so NODE_ENV must be production, and it is not set. Set
|
|
63
|
+
NODE_ENV=production: it only picks optimised builds, and APP_ENV decides
|
|
64
|
+
everything else.`
|
|
65
|
+
- `SIDE_EFFECTS`, which `APP_ENV` replaced, is set: `SIDE_EFFECTS was replaced
|
|
66
|
+
by APP_ENV: remove SIDE_EFFECTS. APP_ENV=production acts for real; staging
|
|
67
|
+
sends email and SMS only to STAGING_EMAIL_TO and STAGING_SMS_TO; development
|
|
68
|
+
and test only log.`
|
|
69
|
+
- A development-only setting is set in staging or production, for example
|
|
70
|
+
`AUTH_LOCAL_RECOVERY_DEV_OUTPUT is for development only and APP_ENV is
|
|
71
|
+
staging. Remove it from the staging environment.`
|
|
72
|
+
|
|
73
|
+
It then logs one line saying where it runs and what that means, such as
|
|
74
|
+
`APP_ENV is staging: email goes only to qa@example.com (STAGING_EMAIL_TO), SMS
|
|
75
|
+
is logged (STAGING_SMS_TO is not set); …`.
|
|
76
|
+
|
|
77
|
+
## Staging's test addresses
|
|
78
|
+
|
|
79
|
+
Staging is production's code and settings with nobody real at the other end.
|
|
80
|
+
`STAGING_EMAIL_TO` is one address, such as the testers' shared inbox; every
|
|
81
|
+
email goes there instead of to its recipient. The email's first line, in its
|
|
82
|
+
text and HTML, says `Staging: this email was for ada@example.com.`, it carries
|
|
83
|
+
an `X-Staging-Original-To` header, and the log says
|
|
84
|
+
`Staging: the password reset email to ada@example.com was sent to
|
|
85
|
+
qa@example.com (STAGING_EMAIL_TO) instead.` `STAGING_SMS_TO` is one phone
|
|
86
|
+
number, and SMS goes there the same way. Unset, each is logged as development
|
|
87
|
+
logs it, with what a tester needs, such as its link. Push notifications,
|
|
88
|
+
webhooks and connector writes are always logged in staging, and live payments
|
|
89
|
+
are refused there, as everywhere but production.
|
|
90
|
+
|
|
91
|
+
## What JSKIT does
|
|
92
|
+
|
|
93
|
+
- Every HTML page the server sends, and every page the Vite development server
|
|
94
|
+
sends, names its environment in a `jskit-app-environment` meta tag. The
|
|
95
|
+
shell (`@jskit-ai/shell-web`) shows a small "Development", "Test" or
|
|
96
|
+
"Staging" banner from it, with no application code, and none in production.
|
|
97
|
+
The banner never takes a click or a tap. Screen readers read it as a note,
|
|
98
|
+
with a sentence such as "Development: emails and messages are logged, not
|
|
99
|
+
sent; payments use the sandbox." as its description. It has no label, so a
|
|
100
|
+
browser test's `getByLabel("Email")` never finds it.
|
|
101
|
+
- Local-password emails (confirmation and password reset) with an installed
|
|
102
|
+
sender go out as the table says. In staging the sender gets
|
|
103
|
+
`STAGING_EMAIL_TO` as `email` and the person's address as `originalEmail`,
|
|
104
|
+
which its email should show (`markStagingEmail` does). An application that
|
|
105
|
+
confirms new accounts at once while its email isn't set up uses
|
|
106
|
+
`auth.local.confirmation-mode`, which applies everywhere (see
|
|
107
|
+
[Authentication](/guide/app-setup/authentication)).
|
|
108
|
+
- Workspace invitations with a provided mailer go out as the table says, the
|
|
109
|
+
staging copy marked with whom it was for. A logged invitation answers
|
|
110
|
+
`status: "simulated"`, and the inviter copies the link.
|
|
111
|
+
- Accounts-hub email goes out as the table says.
|
|
112
|
+
- Connector operations that act on the world (send an email or message, post,
|
|
113
|
+
book or cancel, charge, invoice, trigger another system's events) are marked
|
|
114
|
+
`sideEffect`. Outside production they are checked like real ones, then
|
|
115
|
+
logged, and `invoke` answers `{ simulated: true }`. Reads run for real.
|
|
116
|
+
`createConnectorsFeature` reads `APP_ENV` itself; give
|
|
117
|
+
`createConnectionService` and `createPaymentCheckoutService`
|
|
118
|
+
`appEnv: appEnvironment(env)`, which they require.
|
|
119
|
+
- Payment checkout and the billing portal in the live payment environment are
|
|
120
|
+
refused outside production with `payment_sandbox_only`; the sandbox
|
|
121
|
+
environment works everywhere.
|
|
122
|
+
|
|
123
|
+
Supabase sends its own authentication emails from Supabase's servers; JSKIT
|
|
124
|
+
cannot redirect them. Point development and staging at a separate Supabase
|
|
125
|
+
project.
|
|
126
|
+
|
|
127
|
+
## The application's own side effects
|
|
128
|
+
|
|
129
|
+
Code the application writes that reaches the world follows the same rule. Send
|
|
130
|
+
email and SMS through `deliverMessage`, which sends, redirects or logs each as
|
|
131
|
+
`APP_ENV` says; log anything else outside production with `logSideEffect`.
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
import { deliverMessage, logSideEffect, markStagingEmail } from "@jskit-ai/kernel/server/runtime/appEnvironment";
|
|
135
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
136
|
+
|
|
137
|
+
function sendReminder({ env, logger, mailer }, message) {
|
|
138
|
+
return deliverMessage({
|
|
139
|
+
env,
|
|
140
|
+
logger,
|
|
141
|
+
channel: "email",
|
|
142
|
+
to: message.to,
|
|
143
|
+
summary: `the reminder to ${message.to}`,
|
|
144
|
+
details: { subject: message.subject },
|
|
145
|
+
send: (to, { originalTo }) => mailer.send(markStagingEmail({ ...message, to }, originalTo))
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function notifyDevice({ env, logger, push }, notification) {
|
|
150
|
+
const appEnv = appEnvironment(env);
|
|
151
|
+
if (appEnv !== "production") {
|
|
152
|
+
logSideEffect(logger, appEnv, {
|
|
153
|
+
kind: "push notification",
|
|
154
|
+
summary: `the reminder to device ${notification.deviceId}`,
|
|
155
|
+
details: { deviceId: notification.deviceId }
|
|
156
|
+
});
|
|
157
|
+
return { simulated: true };
|
|
158
|
+
}
|
|
159
|
+
return push.send(notification);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- Read `env` from the `runtime.env` capability, never a request.
|
|
164
|
+
- A configured driver or key (`EMAIL_DRIVER=ses`, a live payment key) does not
|
|
165
|
+
make anything real; only `APP_ENV=production` does.
|
|
166
|
+
- Test each environment the code treats differently. A test that proves a real
|
|
167
|
+
sender against a fake transport passes `APP_ENV: "production"` (and
|
|
168
|
+
`NODE_ENV: "production"` when it starts a whole server), and a staging test
|
|
169
|
+
sets `STAGING_EMAIL_TO` and checks that only that address received it.
|
|
@@ -50,5 +50,5 @@ How to use it:
|
|
|
50
50
|
- [typed-features.md](./typed-features.md)
|
|
51
51
|
- client features, composable, `use<Name>`, Vue component, client provider, props, emits, `inject`, `provide`, `ref`, `reactive`, `watch`, `addEventListener`, `setInterval`, module state, `Object.freeze` on a composable, `?.()` in a template, `jskit/typed-inject`, `jskit/collaborator-props`, `jskit/fixed-result-shape`, `jskit/released-listeners`, `jskit/no-module-state`, `jskit/no-frozen-vue-state`, `clientFeaturesConfig`, `shared resource:`
|
|
52
52
|
- [client-features.md](./client-features.md)
|
|
53
|
-
- sanity checks, is this sane, query count that grows with the rows, a list that stops at 20 or 100 rows, `createDocument()` per row of a batch, `jskit test`, one file at a time, test database preparation, `TEST_DB_NAME`, `mode: "patch"`, a route `rateLimit` nothing tests, `input.workspaceId`, a refactor or consolidation that drops behaviour, a JSKIT update, a changed theme or Vuetify default, `jskit.surface` with a parent, an assistant tool's output contract, a screen that renders everything, feedback covering an action, `
|
|
53
|
+
- sanity checks, is this sane, query count that grows with the rows, a list that stops at 20 or 100 rows, `createDocument()` per row of a batch, `jskit test`, one file at a time, test database preparation, `TEST_DB_NAME`, `mode: "patch"`, a route `rateLimit` nothing tests, `input.workspaceId`, a refactor or consolidation that drops behaviour, a JSKIT update, a changed theme or Vuetify default, `jskit.surface` with a parent, an assistant tool's output contract, a screen that renders everything, feedback covering an action, `APP_ENV=staging` or `production`, a production start
|
|
54
54
|
- [Sanity checks](../sanity-checks.md)
|
|
@@ -228,8 +228,8 @@ To send invitation email, provide the optional `workspaces.invite-mailer`
|
|
|
228
228
|
capability from one of the application's providers. Without one, invitations
|
|
229
229
|
are still created and delivery reports `mailer_unconfigured`. After **Send
|
|
230
230
|
invite**, the Members panel's notice follows the delivery status: `sent` says
|
|
231
|
-
the invite was sent; `simulated` (
|
|
232
|
-
|
|
231
|
+
the invite was sent; `simulated` (logged outside production, see
|
|
232
|
+
[Environments](environments.md)) and `mailer_unconfigured` say no email was sent; `held` says email
|
|
233
233
|
isn't set up yet, so the invite will be sent once it is; `failed` is a warning
|
|
234
234
|
that the email failed. Each of those four points to the invite link, which
|
|
235
235
|
the panel shows under the form with its **Copy** button. For a status the
|