@kayjs/kay 1.108.0 → 1.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint.js +1790 -3751
- package/editors/zed/extension.toml +2 -2
- package/llms/action-protection.md +1 -1
- package/llms/actions-from-islands.md +4 -4
- package/llms/actions-refused-fields.md +4 -4
- package/llms/api-from-islands.md +6 -6
- package/llms/browser-only.md +2 -2
- package/llms/cdn-caching.md +1 -1
- package/llms/checks.md +1 -1
- package/llms/code-lints.md +1 -2
- package/llms/component-library-conventions.md +1 -1
- package/llms/components.md +4 -4
- package/llms/deprecated-lints.md +1 -6
- package/llms/effects.md +1 -1
- package/llms/errors.md +2 -2
- package/llms/events.md +1 -1
- package/llms/guards.md +1 -1
- package/llms/head.md +1 -1
- package/llms/hooks.md +2 -2
- package/llms/images.md +1 -1
- package/llms/island-and-form-lints.md +2 -1
- package/llms/island-sources.md +1 -1
- package/llms/islands-state-to-ids.md +2 -2
- package/llms/islands.md +4 -2
- package/llms/lints.md +1 -1
- package/llms/live-values.md +3 -3
- package/llms/local-collections.md +1 -1
- package/llms/locales.md +1 -1
- package/llms/mcp.md +2 -2
- package/llms/metrics.md +1 -1
- package/llms/navigation-from-code.md +6 -6
- package/llms/prerendering.md +1 -0
- package/llms/production.md +2 -2
- package/llms/project-new-and-add.md +1 -1
- package/llms/project.md +4 -4
- package/llms/proxy-and-security.md +1 -1
- package/llms/queues.md +1 -1
- package/llms/rate-limits.md +4 -4
- package/llms/rendering.md +1 -1
- package/llms/server-islands.md +2 -2
- package/llms/server.md +1 -1
- package/llms/stores.md +1 -1
- package/llms/styles-and-assets.md +1 -1
- package/llms/testing-mount.md +49 -0
- package/llms/testing.md +4 -45
- package/llms/upgrading-1-105-config.md +13 -13
- package/llms/upgrading-archive.md +42 -82
- package/llms/upgrading.md +91 -63
- package/llms/whats-new.md +9 -0
- package/llms.txt +5 -6
- package/package.json +6 -10
- package/src/build/route-sizes.ts +2 -3
- package/src/check/browser-global-reads.ts +2 -2
- package/src/check/config-objects.ts +1 -1
- package/src/check/diagnose.ts +0 -22
- package/src/check/export-homes.ts +1 -1
- package/src/check/guards.ts +3 -3
- package/src/check/index.ts +2 -7
- package/src/check/moved-keys.ts +1 -1
- package/src/check/project.ts +3 -8
- package/src/check/shadow-types.ts +0 -86
- package/src/commands/check.ts +2 -2
- package/src/commands/env.ts +25 -3
- package/src/compiler/ast.ts +18 -16
- package/src/compiler/browser.ts +2 -14
- package/src/compiler/class-items.ts +16 -0
- package/src/compiler/codegen.ts +8 -8
- package/src/compiler/deprecated-library.ts +0 -12
- package/src/compiler/deprecated-lints.ts +3 -495
- package/src/compiler/deprecated-ui-props.ts +5 -5
- package/src/compiler/errors.ts +2 -2
- package/src/compiler/fence-checks.ts +2 -121
- package/src/compiler/hand-parts.ts +55 -0
- package/src/compiler/helper-imports.ts +2 -2
- package/src/compiler/image-attributes.ts +1 -3
- package/src/compiler/index.ts +20 -21
- package/src/compiler/island-arguments.ts +8 -95
- package/src/compiler/island-cause.ts +7 -7
- package/src/compiler/island-declaration.ts +2 -8
- package/src/compiler/island-lints.ts +12 -0
- package/src/compiler/island-marker.ts +3 -3
- package/src/compiler/island-problems.ts +25 -0
- package/src/compiler/jsx-class.ts +1 -25
- package/src/compiler/jsx.ts +2 -2
- package/src/compiler/kay-exports.ts +0 -2
- package/src/compiler/link-flags.ts +9 -38
- package/src/compiler/lints.ts +7 -14
- package/src/compiler/markup.ts +23 -26
- package/src/compiler/module-signals.ts +2 -2
- package/src/compiler/names.ts +1 -1
- package/src/compiler/page-settings.ts +11 -0
- package/src/compiler/parser.ts +6 -8
- package/src/compiler/plan.ts +1 -3
- package/src/compiler/rewrite.ts +3 -18
- package/src/compiler/script-server.ts +8 -3
- package/src/compiler/validate.ts +3 -8
- package/src/config-loader.ts +14 -4
- package/src/config-resolve.ts +18 -142
- package/src/config-shape.ts +44 -34
- package/src/config.ts +10 -114
- package/src/dev/preload.ts +4 -1
- package/src/lsp/server.ts +4 -0
- package/src/migrate/markup.ts +4 -1
- package/src/runtime/action-call.ts +0 -8
- package/src/runtime/action-encode.ts +26 -0
- package/src/runtime/action-error.ts +3 -11
- package/src/runtime/action-protection.ts +2 -2
- package/src/runtime/action-run.ts +2 -27
- package/src/runtime/action-shared.ts +14 -37
- package/src/runtime/action-stream.ts +0 -1
- package/src/runtime/action.ts +1 -1
- package/src/runtime/call-result.ts +2 -10
- package/src/runtime/checks.ts +11 -11
- package/src/runtime/client.ts +2 -2
- package/src/runtime/core.ts +5 -23
- package/src/runtime/dom.ts +1 -1
- package/src/runtime/html.ts +1 -1
- package/src/runtime/i18n.client.ts +1 -4
- package/src/runtime/i18n.server.ts +1 -4
- package/src/runtime/i18n.ts +3 -3
- package/src/runtime/index.ts +2 -2
- package/src/runtime/island.server.ts +18 -5
- package/src/runtime/live-resource.server.ts +0 -1
- package/src/runtime/live-value.server.ts +2 -2
- package/src/runtime/live-value.shared.ts +7 -20
- package/src/runtime/live.ts +1 -12
- package/src/runtime/local-types.ts +1 -11
- package/src/runtime/local.ts +4 -14
- package/src/runtime/navigate-api.ts +2 -5
- package/src/runtime/navigation-state.ts +0 -12
- package/src/runtime/page-swap.ts +6 -6
- package/src/runtime/persist.ts +11 -3
- package/src/runtime/persisted.ts +4 -30
- package/src/runtime/presence.ts +6 -7
- package/src/runtime/query-param.ts +20 -12
- package/src/runtime/reactive.ts +3 -1
- package/src/runtime/refuse.ts +3 -17
- package/src/runtime/store-base.ts +4 -6
- package/src/runtime/swap-fetch.ts +1 -1
- package/src/runtime/values.ts +40 -23
- package/src/runtime/with-query.ts +9 -0
- package/src/server/action-hooks.ts +8 -8
- package/src/server/actions.ts +13 -14
- package/src/server/api-modules.ts +2 -3
- package/src/server/app-stages.ts +15 -33
- package/src/server/app.ts +10 -5
- package/src/server/auth-mails.ts +0 -2
- package/src/server/env-state.ts +40 -10
- package/src/server/flash.ts +1 -1
- package/src/server/guard-requirement.ts +4 -4
- package/src/server/image.ts +2 -2
- package/src/server/index.ts +0 -2
- package/src/server/job-context.ts +3 -3
- package/src/server/jobs-page.ts +1 -1
- package/src/server/jobs.ts +5 -9
- package/src/server/kept-exports.ts +0 -2
- package/src/server/kv.ts +11 -14
- package/src/server/library.ts +1 -3
- package/src/server/live.ts +2 -2
- package/src/server/mcp.ts +3 -9
- package/src/server/metrics.ts +2 -4
- package/src/server/page-settings.ts +10 -19
- package/src/server/prerender.ts +19 -2
- package/src/server/protection.ts +15 -18
- package/src/server/queue.ts +3 -6
- package/src/server/rate-limit.ts +0 -3
- package/src/server/render-document.ts +1 -1
- package/src/server/routes.ts +7 -3
- package/src/server/scope.ts +3 -2
- package/src/server/session.ts +5 -6
- package/src/server/setup.ts +1 -1
- package/src/server/signals.ts +17 -7
- package/src/server/signed.ts +1 -3
- package/src/server/source.ts +20 -4
- package/src/server/speculation.ts +1 -1
- package/src/server/storage.ts +3 -8
- package/src/server/validate.ts +1 -1
- package/src/server/vitals.ts +1 -3
- package/src/server/work-scope.ts +2 -4
- package/src/server/work.ts +1 -1
- package/src/server/workflow.ts +1 -1
- package/src/test/index.ts +2 -1
- package/src/test/site-actions.ts +16 -6
- package/src/test/site-keys.ts +10 -15
- package/src/test/site-socket.ts +1 -2
- package/src/test/site-types.ts +0 -8
- package/types/build/route-sizes.d.ts.map +1 -1
- package/types/check/diagnose.d.ts.map +1 -1
- package/types/check/index.d.ts +1 -2
- package/types/check/index.d.ts.map +1 -1
- package/types/check/project.d.ts.map +1 -1
- package/types/check/shadow-types.d.ts.map +1 -1
- package/types/commands/env.d.ts.map +1 -1
- package/types/compiler/ast.d.ts +1 -2
- package/types/compiler/ast.d.ts.map +1 -1
- package/types/compiler/browser.d.ts.map +1 -1
- package/types/compiler/class-items.d.ts +7 -0
- package/types/compiler/class-items.d.ts.map +1 -0
- package/types/compiler/deprecated-library.d.ts.map +1 -1
- package/types/compiler/deprecated-lints.d.ts +0 -551
- package/types/compiler/deprecated-lints.d.ts.map +1 -1
- package/types/compiler/deprecated-ui-props.d.ts +1 -8
- package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
- package/types/compiler/errors.d.ts +2 -2
- package/types/compiler/errors.d.ts.map +1 -1
- package/types/compiler/fence-checks.d.ts +0 -1
- package/types/compiler/fence-checks.d.ts.map +1 -1
- package/types/compiler/hand-parts.d.ts +7 -0
- package/types/compiler/hand-parts.d.ts.map +1 -0
- package/types/compiler/image-attributes.d.ts +0 -1
- package/types/compiler/image-attributes.d.ts.map +1 -1
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/island-arguments.d.ts +2 -11
- package/types/compiler/island-arguments.d.ts.map +1 -1
- package/types/compiler/island-cause.d.ts +1 -1
- package/types/compiler/island-cause.d.ts.map +1 -1
- package/types/compiler/island-declaration.d.ts +1 -3
- package/types/compiler/island-declaration.d.ts.map +1 -1
- package/types/compiler/island-lints.d.ts +10 -0
- package/types/compiler/island-lints.d.ts.map +1 -0
- package/types/compiler/island-problems.d.ts +7 -0
- package/types/compiler/island-problems.d.ts.map +1 -0
- package/types/compiler/jsx-class.d.ts +1 -2
- package/types/compiler/jsx-class.d.ts.map +1 -1
- package/types/compiler/kay-exports.d.ts.map +1 -1
- package/types/compiler/link-flags.d.ts +0 -6
- package/types/compiler/link-flags.d.ts.map +1 -1
- package/types/compiler/lints.d.ts +11 -563
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/markup.d.ts +1 -1
- package/types/compiler/markup.d.ts.map +1 -1
- package/types/compiler/module-signals.d.ts.map +1 -1
- package/types/compiler/names.d.ts.map +1 -1
- package/types/compiler/page-settings.d.ts +4 -0
- package/types/compiler/page-settings.d.ts.map +1 -1
- package/types/compiler/parser.d.ts.map +1 -1
- package/types/compiler/plan.d.ts.map +1 -1
- package/types/compiler/script-server.d.ts.map +1 -1
- package/types/compiler/validate.d.ts.map +1 -1
- package/types/config-loader.d.ts.map +1 -1
- package/types/config-resolve.d.ts.map +1 -1
- package/types/config-shape.d.ts +1 -1
- package/types/config-shape.d.ts.map +1 -1
- package/types/config.d.ts +5 -105
- package/types/config.d.ts.map +1 -1
- package/types/dev/preload.d.ts.map +1 -1
- package/types/lsp/server.d.ts.map +1 -1
- package/types/migrate/markup.d.ts.map +1 -1
- package/types/runtime/action-call.d.ts.map +1 -1
- package/types/runtime/action-encode.d.ts +1 -0
- package/types/runtime/action-encode.d.ts.map +1 -1
- package/types/runtime/action-error.d.ts +1 -2
- package/types/runtime/action-error.d.ts.map +1 -1
- package/types/runtime/action-run.d.ts.map +1 -1
- package/types/runtime/action-shared.d.ts +1 -27
- package/types/runtime/action-shared.d.ts.map +1 -1
- package/types/runtime/action-stream.d.ts.map +1 -1
- package/types/runtime/action.d.ts +1 -1
- package/types/runtime/action.d.ts.map +1 -1
- package/types/runtime/call-result.d.ts +0 -10
- package/types/runtime/call-result.d.ts.map +1 -1
- package/types/runtime/checks.d.ts +6 -9
- package/types/runtime/checks.d.ts.map +1 -1
- package/types/runtime/core.d.ts +2 -20
- package/types/runtime/core.d.ts.map +1 -1
- package/types/runtime/dom.d.ts +1 -1
- package/types/runtime/dom.d.ts.map +1 -1
- package/types/runtime/html.d.ts +1 -1
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/i18n.client.d.ts +0 -1
- package/types/runtime/i18n.client.d.ts.map +1 -1
- package/types/runtime/i18n.d.ts +1 -1
- package/types/runtime/i18n.d.ts.map +1 -1
- package/types/runtime/i18n.server.d.ts +0 -1
- package/types/runtime/i18n.server.d.ts.map +1 -1
- package/types/runtime/index.d.ts +2 -2
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/island.server.d.ts +1 -0
- package/types/runtime/island.server.d.ts.map +1 -1
- package/types/runtime/live-resource.server.d.ts.map +1 -1
- package/types/runtime/live-value.shared.d.ts +7 -15
- package/types/runtime/live-value.shared.d.ts.map +1 -1
- package/types/runtime/live.d.ts +0 -11
- package/types/runtime/live.d.ts.map +1 -1
- package/types/runtime/local-types.d.ts +0 -14
- package/types/runtime/local-types.d.ts.map +1 -1
- package/types/runtime/navigate-api.d.ts +0 -4
- package/types/runtime/navigate-api.d.ts.map +1 -1
- package/types/runtime/navigation-state.d.ts +0 -4
- package/types/runtime/navigation-state.d.ts.map +1 -1
- package/types/runtime/page-swap.d.ts.map +1 -1
- package/types/runtime/persist.d.ts +1 -0
- package/types/runtime/persist.d.ts.map +1 -1
- package/types/runtime/persisted.d.ts +0 -15
- package/types/runtime/persisted.d.ts.map +1 -1
- package/types/runtime/presence.d.ts +0 -2
- package/types/runtime/presence.d.ts.map +1 -1
- package/types/runtime/query-param.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +2 -1
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/refuse.d.ts +0 -7
- package/types/runtime/refuse.d.ts.map +1 -1
- package/types/runtime/store-base.d.ts +1 -2
- package/types/runtime/store-base.d.ts.map +1 -1
- package/types/runtime/values.d.ts +2 -1
- package/types/runtime/values.d.ts.map +1 -1
- package/types/runtime/with-query.d.ts +2 -0
- package/types/runtime/with-query.d.ts.map +1 -1
- package/types/server/action-hooks.d.ts +4 -4
- package/types/server/action-hooks.d.ts.map +1 -1
- package/types/server/actions.d.ts.map +1 -1
- package/types/server/api-modules.d.ts +0 -1
- package/types/server/api-modules.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +5 -13
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/app.d.ts +3 -8
- package/types/server/app.d.ts.map +1 -1
- package/types/server/auth-mails.d.ts +0 -5
- package/types/server/auth-mails.d.ts.map +1 -1
- package/types/server/env-state.d.ts +1 -0
- package/types/server/env-state.d.ts.map +1 -1
- package/types/server/guard-requirement.d.ts +0 -1
- package/types/server/guard-requirement.d.ts.map +1 -1
- package/types/server/image.d.ts +0 -1
- package/types/server/image.d.ts.map +1 -1
- package/types/server/index.d.ts +0 -2
- package/types/server/index.d.ts.map +1 -1
- package/types/server/job-context.d.ts +1 -1
- package/types/server/job-context.d.ts.map +1 -1
- package/types/server/jobs.d.ts +0 -4
- package/types/server/jobs.d.ts.map +1 -1
- package/types/server/kept-exports.d.ts.map +1 -1
- package/types/server/kv.d.ts +4 -4
- package/types/server/kv.d.ts.map +1 -1
- package/types/server/library.d.ts +1 -3
- package/types/server/library.d.ts.map +1 -1
- package/types/server/mcp.d.ts +0 -1
- package/types/server/mcp.d.ts.map +1 -1
- package/types/server/metrics.d.ts +0 -5
- package/types/server/metrics.d.ts.map +1 -1
- package/types/server/page-settings.d.ts +3 -3
- package/types/server/page-settings.d.ts.map +1 -1
- package/types/server/prerender.d.ts.map +1 -1
- package/types/server/protection.d.ts +6 -6
- package/types/server/protection.d.ts.map +1 -1
- package/types/server/queue.d.ts +1 -3
- package/types/server/queue.d.ts.map +1 -1
- package/types/server/rate-limit.d.ts +0 -2
- package/types/server/rate-limit.d.ts.map +1 -1
- package/types/server/routes.d.ts +1 -1
- package/types/server/routes.d.ts.map +1 -1
- package/types/server/scope.d.ts.map +1 -1
- package/types/server/session.d.ts +1 -1
- package/types/server/session.d.ts.map +1 -1
- package/types/server/signals.d.ts.map +1 -1
- package/types/server/signed.d.ts +0 -2
- package/types/server/signed.d.ts.map +1 -1
- package/types/server/source.d.ts +1 -1
- package/types/server/source.d.ts.map +1 -1
- package/types/server/storage.d.ts +0 -4
- package/types/server/storage.d.ts.map +1 -1
- package/types/server/vitals.d.ts +0 -1
- package/types/server/vitals.d.ts.map +1 -1
- package/types/server/work-scope.d.ts +0 -2
- package/types/server/work-scope.d.ts.map +1 -1
- package/types/server/workflow.d.ts +1 -1
- package/types/server/workflow.d.ts.map +1 -1
- package/types/test/index.d.ts.map +1 -1
- package/types/test/site-actions.d.ts +1 -1
- package/types/test/site-actions.d.ts.map +1 -1
- package/types/test/site-keys.d.ts +1 -1
- package/types/test/site-keys.d.ts.map +1 -1
- package/types/test/site-socket.d.ts +1 -1
- package/types/test/site-socket.d.ts.map +1 -1
- package/types/test/site-types.d.ts +0 -8
- package/types/test/site-types.d.ts.map +1 -1
- package/llms/deprecated-lints-1-105-libraries.md +0 -32
- package/llms/deprecated-lints-1-105.md +0 -58
- package/src/check/action-readers.ts +0 -115
- package/src/check/action-type.ts +0 -44
- package/src/check/ai-language.ts +0 -56
- package/src/check/app-hooks.ts +0 -90
- package/src/check/auth-methods.ts +0 -85
- package/src/check/auth-rate-limits.ts +0 -99
- package/src/check/call-result.ts +0 -242
- package/src/check/client-keys.ts +0 -10
- package/src/check/cms-options.ts +0 -81
- package/src/check/config-groups.ts +0 -22
- package/src/check/config-switches.ts +0 -38
- package/src/check/context-import.ts +0 -51
- package/src/check/env-files.ts +0 -31
- package/src/check/format-duration.ts +0 -75
- package/src/check/guard-options.ts +0 -58
- package/src/check/handler-events.ts +0 -149
- package/src/check/hook-context.ts +0 -94
- package/src/check/hook-names.ts +0 -104
- package/src/check/i18n-keys.ts +0 -50
- package/src/check/images-keys.ts +0 -54
- package/src/check/job-shapes.ts +0 -273
- package/src/check/link-flag-tests.ts +0 -130
- package/src/check/live-api.ts +0 -137
- package/src/check/mail-api.ts +0 -67
- package/src/check/one-state-api.ts +0 -357
- package/src/check/pages-options.ts +0 -35
- package/src/check/rate-enforce.ts +0 -53
- package/src/check/refusal-calls.ts +0 -185
- package/src/check/retired-lints.ts +0 -49
- package/src/check/route-keys.ts +0 -166
- package/src/check/secret-keys.ts +0 -83
- package/src/check/socket-frames.ts +0 -102
- package/src/check/source-readers.ts +0 -257
- package/src/check/store-ms.ts +0 -72
- package/src/check/store-names.ts +0 -88
- package/src/check/test-helpers.ts +0 -98
- package/src/check/ttl-names.ts +0 -142
- package/src/compiler/deprecated-ai-labels.ts +0 -97
- package/src/compiler/deprecated-ai-links.ts +0 -63
- package/src/compiler/deprecated-allow.ts +0 -50
- package/src/compiler/deprecated-auth-lints.ts +0 -14
- package/src/compiler/deprecated-auth-signed.ts +0 -29
- package/src/compiler/deprecated-children.ts +0 -66
- package/src/compiler/deprecated-image.ts +0 -116
- package/src/compiler/deprecated-island.ts +0 -155
- package/src/compiler/deprecated-lints-1-105.ts +0 -41
- package/src/compiler/deprecated-page.ts +0 -125
- package/src/compiler/deprecated-parts.ts +0 -22
- package/src/compiler/deprecated-typed-lints.ts +0 -23
- package/src/compiler/deprecated-ui-callbacks.ts +0 -66
- package/src/compiler/deprecated-ui-input.ts +0 -97
- package/src/compiler/deprecated-ui-items.ts +0 -47
- package/src/compiler/old-parts.ts +0 -84
- package/src/runtime/mount.compat.ts +0 -8
- package/src/server/moved-exports.ts +0 -17
- package/types/check/action-readers.d.ts +0 -3
- package/types/check/action-readers.d.ts.map +0 -1
- package/types/check/action-type.d.ts +0 -3
- package/types/check/action-type.d.ts.map +0 -1
- package/types/check/ai-language.d.ts +0 -3
- package/types/check/ai-language.d.ts.map +0 -1
- package/types/check/app-hooks.d.ts +0 -3
- package/types/check/app-hooks.d.ts.map +0 -1
- package/types/check/auth-methods.d.ts +0 -3
- package/types/check/auth-methods.d.ts.map +0 -1
- package/types/check/auth-rate-limits.d.ts +0 -3
- package/types/check/auth-rate-limits.d.ts.map +0 -1
- package/types/check/call-result.d.ts +0 -7
- package/types/check/call-result.d.ts.map +0 -1
- package/types/check/client-keys.d.ts +0 -3
- package/types/check/client-keys.d.ts.map +0 -1
- package/types/check/cms-options.d.ts +0 -3
- package/types/check/cms-options.d.ts.map +0 -1
- package/types/check/config-groups.d.ts +0 -3
- package/types/check/config-groups.d.ts.map +0 -1
- package/types/check/config-switches.d.ts +0 -3
- package/types/check/config-switches.d.ts.map +0 -1
- package/types/check/context-import.d.ts +0 -3
- package/types/check/context-import.d.ts.map +0 -1
- package/types/check/env-files.d.ts +0 -3
- package/types/check/env-files.d.ts.map +0 -1
- package/types/check/format-duration.d.ts +0 -5
- package/types/check/format-duration.d.ts.map +0 -1
- package/types/check/guard-options.d.ts +0 -3
- package/types/check/guard-options.d.ts.map +0 -1
- package/types/check/handler-events.d.ts +0 -9
- package/types/check/handler-events.d.ts.map +0 -1
- package/types/check/hook-context.d.ts +0 -3
- package/types/check/hook-context.d.ts.map +0 -1
- package/types/check/hook-names.d.ts +0 -3
- package/types/check/hook-names.d.ts.map +0 -1
- package/types/check/i18n-keys.d.ts +0 -3
- package/types/check/i18n-keys.d.ts.map +0 -1
- package/types/check/images-keys.d.ts +0 -3
- package/types/check/images-keys.d.ts.map +0 -1
- package/types/check/job-shapes.d.ts +0 -6
- package/types/check/job-shapes.d.ts.map +0 -1
- package/types/check/link-flag-tests.d.ts +0 -4
- package/types/check/link-flag-tests.d.ts.map +0 -1
- package/types/check/live-api.d.ts +0 -3
- package/types/check/live-api.d.ts.map +0 -1
- package/types/check/mail-api.d.ts +0 -3
- package/types/check/mail-api.d.ts.map +0 -1
- package/types/check/one-state-api.d.ts +0 -9
- package/types/check/one-state-api.d.ts.map +0 -1
- package/types/check/pages-options.d.ts +0 -3
- package/types/check/pages-options.d.ts.map +0 -1
- package/types/check/rate-enforce.d.ts +0 -3
- package/types/check/rate-enforce.d.ts.map +0 -1
- package/types/check/refusal-calls.d.ts +0 -3
- package/types/check/refusal-calls.d.ts.map +0 -1
- package/types/check/retired-lints.d.ts +0 -3
- package/types/check/retired-lints.d.ts.map +0 -1
- package/types/check/route-keys.d.ts +0 -3
- package/types/check/route-keys.d.ts.map +0 -1
- package/types/check/secret-keys.d.ts +0 -3
- package/types/check/secret-keys.d.ts.map +0 -1
- package/types/check/socket-frames.d.ts +0 -3
- package/types/check/socket-frames.d.ts.map +0 -1
- package/types/check/source-readers.d.ts +0 -3
- package/types/check/source-readers.d.ts.map +0 -1
- package/types/check/store-ms.d.ts +0 -3
- package/types/check/store-ms.d.ts.map +0 -1
- package/types/check/store-names.d.ts +0 -3
- package/types/check/store-names.d.ts.map +0 -1
- package/types/check/test-helpers.d.ts +0 -3
- package/types/check/test-helpers.d.ts.map +0 -1
- package/types/check/ttl-names.d.ts +0 -3
- package/types/check/ttl-names.d.ts.map +0 -1
- package/types/compiler/deprecated-ai-labels.d.ts +0 -5
- package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
- package/types/compiler/deprecated-ai-links.d.ts +0 -5
- package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
- package/types/compiler/deprecated-allow.d.ts +0 -5
- package/types/compiler/deprecated-allow.d.ts.map +0 -1
- package/types/compiler/deprecated-auth-lints.d.ts +0 -12
- package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
- package/types/compiler/deprecated-auth-signed.d.ts +0 -5
- package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
- package/types/compiler/deprecated-children.d.ts +0 -4
- package/types/compiler/deprecated-children.d.ts.map +0 -1
- package/types/compiler/deprecated-image.d.ts +0 -5
- package/types/compiler/deprecated-image.d.ts.map +0 -1
- package/types/compiler/deprecated-island.d.ts +0 -9
- package/types/compiler/deprecated-island.d.ts.map +0 -1
- package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
- package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
- package/types/compiler/deprecated-page.d.ts +0 -4
- package/types/compiler/deprecated-page.d.ts.map +0 -1
- package/types/compiler/deprecated-parts.d.ts +0 -3
- package/types/compiler/deprecated-parts.d.ts.map +0 -1
- package/types/compiler/deprecated-typed-lints.d.ts +0 -21
- package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
- package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-input.d.ts +0 -5
- package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-items.d.ts +0 -5
- package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
- package/types/compiler/old-parts.d.ts +0 -9
- package/types/compiler/old-parts.d.ts.map +0 -1
- package/types/runtime/mount.compat.d.ts +0 -7
- package/types/runtime/mount.compat.d.ts.map +0 -1
- package/types/server/moved-exports.d.ts +0 -12
- package/types/server/moved-exports.d.ts.map +0 -1
package/src/check/store-ms.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { CheckDiagnostic, CheckOptions } from '.'
|
|
2
|
-
import type { Node } from '../compiler/estree'
|
|
3
|
-
import { lintLevel } from '../compiler/lints'
|
|
4
|
-
import { importsOf, walk } from './ast'
|
|
5
|
-
import { evaluate, EXPRESSION } from './format-duration'
|
|
6
|
-
import { scan } from './renamed-exports'
|
|
7
|
-
|
|
8
|
-
const NEEDLE = /\bkv\b/
|
|
9
|
-
const FROM_SERVER = (source: string) => source === 'kay/server' || source === '@kayjs/kay/server'
|
|
10
|
-
const FROM_LIBRARY = (source: string) => source === 'kay/library' || source === '@kayjs/kay/library'
|
|
11
|
-
// The methods of a `Kv` that take a ttl, with its position.
|
|
12
|
-
const TTL_AT: Record<string, number> = { set: 2, once: 1 }
|
|
13
|
-
|
|
14
|
-
// A ttl of `kv(namespace).set(key, value, ms)` or `.once(key, ms)` written as milliseconds, a `Duration` since 1.105: `once(key, 60_000)` is `once(key, '60000ms')`.
|
|
15
|
-
// Found on a call chained to `kv(...)` or on a name bound once to it in the same file, with a number written as a literal or arithmetic of literals; one held in a variable is a type error in the editor.
|
|
16
|
-
export async function storeMs(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
|
|
17
|
-
if (lintLevel('deprecated-store-ms', options.lints) === 'allow')
|
|
18
|
-
return []
|
|
19
|
-
|
|
20
|
-
return scan(root, options, 'deprecated-store-ms', NEEDLE, ({ source, parsed, report }) => {
|
|
21
|
-
for (const { ast, base } of parsed) {
|
|
22
|
-
const makers = new Set([...importsOf(ast, FROM_SERVER, 'kv').locals, ...importsOf(ast, FROM_LIBRARY, 'kv').locals])
|
|
23
|
-
|
|
24
|
-
if (makers.size === 0)
|
|
25
|
-
continue
|
|
26
|
-
|
|
27
|
-
const isKv = (node: Node): boolean => node.type === 'CallExpression' && node.callee.type === 'Identifier' && makers.has(node.callee.name)
|
|
28
|
-
const declared = new Map<string, number>()
|
|
29
|
-
const kvs = new Set<string>()
|
|
30
|
-
|
|
31
|
-
walk(ast, (node: Node) => {
|
|
32
|
-
if (node.type !== 'VariableDeclarator' || node.id.type !== 'Identifier')
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
declared.set(node.id.name, (declared.get(node.id.name) ?? 0) + 1)
|
|
36
|
-
|
|
37
|
-
if (node.init !== null && node.init !== undefined && isKv(node.init))
|
|
38
|
-
kvs.add(node.id.name)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
// A name declared once in the file, so a shadowing local of the same name never takes a call that is not kv's.
|
|
42
|
-
const bound = new Set([...kvs].filter(name => declared.get(name) === 1))
|
|
43
|
-
|
|
44
|
-
walk(ast, (node: Node) => {
|
|
45
|
-
if (node.type !== 'CallExpression' || node.callee.type !== 'MemberExpression' || node.callee.computed || node.callee.property.type !== 'Identifier')
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
const at = TTL_AT[node.callee.property.name]
|
|
49
|
-
const { object } = node.callee
|
|
50
|
-
|
|
51
|
-
if (at === undefined || !(isKv(object) || (object.type === 'Identifier' && bound.has(object.name))))
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
const argument = node.arguments[at]
|
|
55
|
-
|
|
56
|
-
if (argument === undefined)
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
const start = base + argument.start
|
|
60
|
-
const end = base + argument.end
|
|
61
|
-
const text = source.slice(start, end)
|
|
62
|
-
|
|
63
|
-
if (!EXPRESSION.test(text))
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
const milliseconds = evaluate(text)
|
|
67
|
-
|
|
68
|
-
report(start, end, 'a `kv` ttl takes a duration with its unit since 1.105, not milliseconds', 'write the length with its unit, `kv(\'ns\').once(key, \'60000ms\')`', Number.isFinite(milliseconds) ? [{ start, end, text: `'${milliseconds}ms'` }] : null)
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
}
|
package/src/check/store-names.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { CheckDiagnostic, CheckOptions } from '.'
|
|
2
|
-
import type { Node, NodeOfType } from '../compiler/estree'
|
|
3
|
-
import type { Edit } from './renamed-exports'
|
|
4
|
-
import { lintLevel } from '../compiler/lints'
|
|
5
|
-
import { keyName } from '../compiler/object-literal'
|
|
6
|
-
import { renamePackages } from '../package-names'
|
|
7
|
-
import { importsOf, walk } from './ast'
|
|
8
|
-
import { renamedCallOptions } from './renamed-call-options'
|
|
9
|
-
import { renamedTypes, scan } from './renamed-exports'
|
|
10
|
-
|
|
11
|
-
const LINT = 'deprecated-store-names'
|
|
12
|
-
const NEEDLE = /\b(?:pgConversations|conversationTable|createConversationTable|sqliteConversations|conversations|pgLoader|sqliteLoader|PgLoaderOptions|SqliteLoaderOptions|openLists|createMailListTables|mailListTableNames|listStore|suppressionStore)\b/
|
|
13
|
-
const FROM_AI = (source: string) => renamePackages(source) === '@kayjs/ai'
|
|
14
|
-
const FROM_MAIL = (source: string) => renamePackages(source) === '@kayjs/mail'
|
|
15
|
-
const MAILER_KEYS = [['listStore', 'lists'], ['suppressionStore', 'suppressions']] as const
|
|
16
|
-
|
|
17
|
-
type Property = Extract<NodeOfType<'ObjectExpression'>['properties'][number], { type: 'Property' }>
|
|
18
|
-
|
|
19
|
-
// `listStore: x` as `store: { lists: x }`, a shorthand written out.
|
|
20
|
-
function moved(property: Property, old: string, part: string, base: number): Edit[] {
|
|
21
|
-
if (property.shorthand)
|
|
22
|
-
return [{ start: base + property.start, end: base + property.end, text: `store: { ${part}: ${old} }` }]
|
|
23
|
-
|
|
24
|
-
return [{ start: base + property.key.start, end: base + property.value.start, text: `store: { ${part}: ` }, { start: base + property.value.end, end: base + property.value.end, text: ' }' }]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// What kayjs-mail's `mailer()` takes as `store: { lists, suppressions }` since 1.105: `listStore` and `suppressionStore` still work until 1.108.
|
|
28
|
-
// A fix moves a lone one under `store`; both together, a spread or a `store` already there are reported with no fix, as they need the object rewritten.
|
|
29
|
-
async function mailerStores(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
|
|
30
|
-
return scan(root, options, LINT, NEEDLE, ({ parsed, report }) => {
|
|
31
|
-
for (const { ast, base } of parsed) {
|
|
32
|
-
const bound = ['mailer', 'mail'].map(name => ({ name, ...importsOf(ast, FROM_MAIL, name) })).filter(one => one.locals.size > 0 || one.namespaces.size > 0)
|
|
33
|
-
|
|
34
|
-
if (bound.length === 0)
|
|
35
|
-
continue
|
|
36
|
-
|
|
37
|
-
const isMailer = (callee: Node): boolean => bound.some(({ name, locals, namespaces }) => callee.type === 'Identifier'
|
|
38
|
-
? locals.has(callee.name)
|
|
39
|
-
: callee.type === 'MemberExpression' && !callee.computed && callee.object.type === 'Identifier' && namespaces.has(callee.object.name) && callee.property.type === 'Identifier' && callee.property.name === name)
|
|
40
|
-
|
|
41
|
-
walk(ast, (node) => {
|
|
42
|
-
const argument = node.type === 'CallExpression' && isMailer(node.callee) ? node.arguments[0] : undefined
|
|
43
|
-
|
|
44
|
-
if (argument?.type !== 'ObjectExpression')
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
const properties = argument.properties.filter((one): one is Property => one.type === 'Property')
|
|
48
|
-
const found = MAILER_KEYS.flatMap(([old, part]) => properties.filter(one => keyName(one) === old).map(property => ({ property, old, part })))
|
|
49
|
-
const alone = found.length === 1 && argument.properties.length === properties.length && !properties.some(one => keyName(one) === 'store')
|
|
50
|
-
|
|
51
|
-
for (const { property, old, part } of found) {
|
|
52
|
-
const edits = alone && !property.computed ? moved(property, old, part, base) : null
|
|
53
|
-
|
|
54
|
-
report(base + property.start, base + property.end, `\`${old}\` of \`mailer()\` is deprecated since 1.105: \`store: { ${part} }\` keeps the mailer's ${part === 'lists' ? 'lists' : 'bounces'} with the library's other stores`, `write \`store: { ${part} }\``, edits)
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// The names of kayjs-ai, kayjs-mail and kayjs-cms's stores and tables before 1.105, which one naming took over: `ai({ conversations })` is `ai({ store })`, `pgConversations` is `pgAi`, `sqliteConversations` `sqliteAi`, `createConversationTable` `createAiTables`, `conversationTable` `aiTables`, `openLists` `sqliteLists`, `createMailListTables` `createMailTables`, `mailListTableNames` `mailTables`, and cms's `pgLoader` and `sqliteLoader` are `pgCms` and `sqliteCms`.
|
|
62
|
-
// The imports and their uses are renamed, and so is the `conversations` key of `ai()`; the `listStore` and `suppressionStore` of `mailer()` move under `store`.
|
|
63
|
-
export async function storeNames(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
|
|
64
|
-
if (lintLevel(LINT, options.lints) === 'allow')
|
|
65
|
-
return []
|
|
66
|
-
|
|
67
|
-
const since = '1.105'
|
|
68
|
-
const until = '1.108'
|
|
69
|
-
|
|
70
|
-
return [
|
|
71
|
-
...await renamedTypes(root, options, {
|
|
72
|
-
lint: LINT,
|
|
73
|
-
modules: {
|
|
74
|
-
'@kayjs/ai/pg': { pgConversations: 'pgAi', createConversationTable: 'createAiTables', conversationTable: 'aiTables' },
|
|
75
|
-
'@kayjs/ai/sqlite': { sqliteConversations: 'sqliteAi' },
|
|
76
|
-
'@kayjs/mail/pg': { createMailListTables: 'createMailTables', mailListTableNames: 'mailTables' },
|
|
77
|
-
'@kayjs/mail/sqlite': { openLists: 'sqliteLists' },
|
|
78
|
-
'@kayjs/cms/pg': { pgLoader: 'pgCms', PgLoaderOptions: 'PgCmsOptions' },
|
|
79
|
-
'@kayjs/cms/sqlite': { sqliteLoader: 'sqliteCms', SqliteLoaderOptions: 'SqliteCmsOptions' },
|
|
80
|
-
},
|
|
81
|
-
needle: NEEDLE,
|
|
82
|
-
since,
|
|
83
|
-
until,
|
|
84
|
-
}),
|
|
85
|
-
...await renamedCallOptions(root, options, { lint: LINT, needle: NEEDLE, from: FROM_AI, calls: { ai: 0 }, renames: [['conversations', 'store']], since, of: '`ai()`' }),
|
|
86
|
-
...await mailerStores(root, options),
|
|
87
|
-
]
|
|
88
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type { CheckDiagnostic, CheckOptions } from '.'
|
|
2
|
-
import type { Node } from '../compiler/estree'
|
|
3
|
-
import { lintLevel } from '../compiler/lints'
|
|
4
|
-
import { importedName, importsOf, walk } from './ast'
|
|
5
|
-
import { scan } from './renamed-exports'
|
|
6
|
-
|
|
7
|
-
const NEEDLE = /\b(?:aiTest|mailTest|cmsTest|authTest|refusal|socketRefusal)\b/
|
|
8
|
-
const HELP = 'import `test` and call it with the site'
|
|
9
|
-
const FROM_KAY_TEST = (source: string) => source === 'kay/test'
|
|
10
|
-
|
|
11
|
-
// The entry of each library's `/test` that made its own `<name>Test` into `test`, and the names of a test site's methods that moved.
|
|
12
|
-
const ENTRIES: Record<string, Record<string, string>> = {
|
|
13
|
-
'@kayjs/ai/test': { aiTest: 'test' },
|
|
14
|
-
'@kayjs/mail/test': { mailTest: 'test' },
|
|
15
|
-
'@kayjs/cms/test': { cmsTest: 'test' },
|
|
16
|
-
'@kayjs/auth/test': { authTest: 'test' },
|
|
17
|
-
}
|
|
18
|
-
const METHODS: Record<string, string> = { refusal: 'expectRefused', socketRefusal: 'socket.refused' }
|
|
19
|
-
|
|
20
|
-
// `aiTest`, `mailTest`, `cmsTest` and `authTest` imported from a library's `/test` entry, `test` since 1.105 in each, and `site.refusal` and `site.socketRefusal` of a test site, `site.expectRefused` and `site.socket.refused`.
|
|
21
|
-
// Found in the TypeScript files and `.kay` files of the project: an import from the entry, whose fix keeps the local name (`test as mailTest`), and a call or read of the method on a name bound once to `testSite()` of `kay/test` or to a `.as()` of such a name, as `kay check` reads no types.
|
|
22
|
-
export async function testHelpers(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
|
|
23
|
-
if (lintLevel('deprecated-test-helpers', options.lints) === 'allow')
|
|
24
|
-
return []
|
|
25
|
-
|
|
26
|
-
return scan(root, options, 'deprecated-test-helpers', NEEDLE, ({ parsed, report }) => {
|
|
27
|
-
for (const { ast, base } of parsed) {
|
|
28
|
-
for (const statement of ast.body) {
|
|
29
|
-
if (statement.type !== 'ImportDeclaration' || !Object.hasOwn(ENTRIES, statement.source.value))
|
|
30
|
-
continue
|
|
31
|
-
|
|
32
|
-
const names = ENTRIES[statement.source.value]!
|
|
33
|
-
|
|
34
|
-
for (const specifier of statement.specifiers) {
|
|
35
|
-
if (specifier.type !== 'ImportSpecifier')
|
|
36
|
-
continue
|
|
37
|
-
|
|
38
|
-
const old = importedName(specifier)
|
|
39
|
-
|
|
40
|
-
if (!Object.hasOwn(names, old))
|
|
41
|
-
continue
|
|
42
|
-
|
|
43
|
-
const aliased = specifier.imported.start !== specifier.local.start
|
|
44
|
-
const edit = aliased
|
|
45
|
-
? { start: base + specifier.imported.start, end: base + specifier.imported.end, text: names[old]! }
|
|
46
|
-
: { start: base + specifier.start, end: base + specifier.end, text: `${names[old]!} as ${old}` }
|
|
47
|
-
|
|
48
|
-
report(base + specifier.start, base + specifier.end, `\`${old}\` of \`${statement.source.value}\` is \`${names[old]!}(site)\` since 1.105, as every library's test helper is`, HELP, [edit])
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const { locals } = importsOf(ast, FROM_KAY_TEST, 'testSite')
|
|
53
|
-
|
|
54
|
-
if (locals.size === 0)
|
|
55
|
-
continue
|
|
56
|
-
|
|
57
|
-
const sites = siteNames(ast, locals)
|
|
58
|
-
|
|
59
|
-
walk(ast, (node) => {
|
|
60
|
-
if (node.type !== 'MemberExpression' || node.computed || node.object.type !== 'Identifier' || node.property.type !== 'Identifier' || !sites.has(node.object.name) || !Object.hasOwn(METHODS, node.property.name))
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
const next = METHODS[node.property.name]!
|
|
64
|
-
|
|
65
|
-
report(base + node.property.start, base + node.property.end, `\`${node.property.name}\` of a test site is \`${next}\` since 1.105`, `write \`${next}\``, [{ start: base + node.property.start, end: base + node.property.end, text: next }])
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// The names a file binds to a test site: `const site = await testSite(...)`, and `const as = site.as(...)` of such a name.
|
|
72
|
-
function siteNames(ast: Parameters<typeof walk>[0], testSites: Set<string>): Set<string> {
|
|
73
|
-
const names = new Set<string>()
|
|
74
|
-
const bound: [string, Node][] = []
|
|
75
|
-
|
|
76
|
-
walk(ast, (node) => {
|
|
77
|
-
if (node.type === 'VariableDeclarator' && node.id.type === 'Identifier' && node.init)
|
|
78
|
-
bound.push([node.id.name, node.init])
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
// `as()` views are bound after their site, but a file may declare them in any order.
|
|
82
|
-
for (let grown = true; grown;) {
|
|
83
|
-
grown = false
|
|
84
|
-
|
|
85
|
-
for (const [name, init] of bound) {
|
|
86
|
-
const value = init.type === 'AwaitExpression' ? init.argument : init
|
|
87
|
-
|
|
88
|
-
const isSite = !names.has(name) && value.type === 'CallExpression' && ((value.callee.type === 'Identifier' && testSites.has(value.callee.name)) || (value.callee.type === 'MemberExpression' && !value.callee.computed && value.callee.object.type === 'Identifier' && names.has(value.callee.object.name) && value.callee.property.type === 'Identifier' && value.callee.property.name === 'as'))
|
|
89
|
-
|
|
90
|
-
if (isSite) {
|
|
91
|
-
names.add(name)
|
|
92
|
-
grown = true
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return names
|
|
98
|
-
}
|
package/src/check/ttl-names.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { CheckDiagnostic, CheckOptions } from '.'
|
|
2
|
-
import type { Node, NodeOfType } from '../compiler/estree'
|
|
3
|
-
import { lintLevel } from '../compiler/lints'
|
|
4
|
-
import { keyName } from '../compiler/object-literal'
|
|
5
|
-
import { importsOf, walk } from './ast'
|
|
6
|
-
import { scan } from './renamed-exports'
|
|
7
|
-
|
|
8
|
-
const NEEDLE = /\bmaxAge\b/
|
|
9
|
-
const FROM_SERVER = (source: string) => source === 'kay/server' || source === '@kayjs/kay/server'
|
|
10
|
-
// The calls whose options hold how long something lives, with the position of the options.
|
|
11
|
-
const CALLS: Record<string, { method: string, argument: number }> = { signed: { method: 'sign', argument: 2 }, files: { method: 'url', argument: 1 } }
|
|
12
|
-
// The functions taking the options as an argument, with its position: kay's `workChallenge(scope, options)` and kayjs-auth's `proofOfWork(options)`.
|
|
13
|
-
const FUNCTIONS: { name: string, from: (source: string) => boolean, argument: number }[] = [
|
|
14
|
-
{ name: 'workChallenge', from: FROM_SERVER, argument: 1 },
|
|
15
|
-
{ name: 'proofOfWork', from: source => source === '@kayjs/auth', argument: 0 },
|
|
16
|
-
]
|
|
17
|
-
const FROM_KAY = (source: string) => source === 'kay' || source === '@kayjs/kay'
|
|
18
|
-
// The option bags of `protect` that hold how long a challenge or a stamp stays good.
|
|
19
|
-
const BAGS = new Set(['proofOfWork', 'minTime'])
|
|
20
|
-
|
|
21
|
-
type Property = Extract<NodeOfType<'ObjectExpression'>['properties'][number], { type: 'Property' }>
|
|
22
|
-
type Report = (start: number, end: number, message: string, help: string, edits: { start: number, end: number, text: string }[] | null) => void
|
|
23
|
-
|
|
24
|
-
interface Bound {
|
|
25
|
-
base: number
|
|
26
|
-
report: Report
|
|
27
|
-
actions: Set<string>
|
|
28
|
-
actionNamespaces: Set<string>
|
|
29
|
-
methods: { method: string, argument: number, locals: Set<string> }[]
|
|
30
|
-
functions: { name: string, argument: number, locals: Set<string> }[]
|
|
31
|
-
fromAuth: boolean
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Reports the `maxAge` key of `object`, which says how long `of` lives; one beside a `ttl`, or a computed key, is reported with no fix.
|
|
35
|
-
function reportIn(bound: Bound, object: NodeOfType<'ObjectExpression'>, of: string): void {
|
|
36
|
-
const properties = object.properties.filter((property): property is Property => property.type === 'Property')
|
|
37
|
-
const old = properties.find(property => keyName(property) === 'maxAge')
|
|
38
|
-
|
|
39
|
-
if (old === undefined)
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
const { base } = bound
|
|
43
|
-
const fixable = !old.computed && !properties.some(property => keyName(property) === 'ttl')
|
|
44
|
-
const edits = fixable ? [old.shorthand ? { start: base + old.start, end: base + old.end, text: 'ttl: maxAge' } : { start: base + old.key.start, end: base + old.key.end, text: 'ttl' }] : null
|
|
45
|
-
|
|
46
|
-
bound.report(base + old.start, base + old.end, `\`maxAge\` of ${of} is deprecated since 1.105: how long it lives is \`ttl\`, as \`maxAge\` is kept for an HTTP header or a cookie`, 'write `ttl`', edits)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// `signed.sign(...)` and `files.url(...)`, the methods of an imported object.
|
|
50
|
-
function reportMethod(bound: Bound, node: NodeOfType<'CallExpression'>): void {
|
|
51
|
-
if (node.callee.type !== 'MemberExpression' || node.callee.computed || node.callee.object.type !== 'Identifier' || node.callee.property.type !== 'Identifier')
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
const { name } = node.callee.object
|
|
55
|
-
const property = node.callee.property.name
|
|
56
|
-
const call = bound.methods.find(one => one.locals.has(name) && one.method === property)
|
|
57
|
-
const written = call === undefined ? undefined : node.arguments[call.argument]
|
|
58
|
-
|
|
59
|
-
if (written?.type === 'ObjectExpression')
|
|
60
|
-
reportIn(bound, written, `\`${name}.${property}()\``)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// `workChallenge(...)` and `proofOfWork(...)`, imported functions.
|
|
64
|
-
function reportFunction(bound: Bound, node: NodeOfType<'CallExpression'>): void {
|
|
65
|
-
if (node.callee.type !== 'Identifier')
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
const { name } = node.callee
|
|
69
|
-
const found = bound.functions.find(one => one.locals.has(name))
|
|
70
|
-
const written = found === undefined ? undefined : node.arguments[found.argument]
|
|
71
|
-
|
|
72
|
-
if (written?.type === 'ObjectExpression')
|
|
73
|
-
reportIn(bound, written, `\`${found!.name}()\``)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// `data.maxAge.link` and `data.maxAge.code` in a template of kayjs-auth's mails.
|
|
77
|
-
function reportMailRead(bound: Bound, node: NodeOfType<'MemberExpression'>): void {
|
|
78
|
-
if (!bound.fromAuth || node.computed || node.property.type !== 'Identifier' || (node.property.name !== 'link' && node.property.name !== 'code'))
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
const { object } = node
|
|
82
|
-
|
|
83
|
-
if (object.type !== 'MemberExpression' || object.computed || object.property.type !== 'Identifier' || object.property.name !== 'maxAge')
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
const { property } = object
|
|
87
|
-
|
|
88
|
-
bound.report(bound.base + property.start, bound.base + property.end, '`maxAge` of a mail\'s data is deprecated since 1.105: how long its link and code work is `ttl`', 'write `ttl`', [{ start: bound.base + property.start, end: bound.base + property.end, text: 'ttl' }])
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// The `proofOfWork` and `minTime` bags of an action's `protect`.
|
|
92
|
-
function reportAction(bound: Bound, node: NodeOfType<'CallExpression'>): void {
|
|
93
|
-
const called = node.callee.type === 'Identifier' ? bound.actions.has(node.callee.name) : node.callee.type === 'MemberExpression' && !node.callee.computed && node.callee.object.type === 'Identifier' && bound.actionNamespaces.has(node.callee.object.name) && node.callee.property.type === 'Identifier' && node.callee.property.name === 'action'
|
|
94
|
-
|
|
95
|
-
if (!called)
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
for (const argument of node.arguments) {
|
|
99
|
-
const protect = argument.type === 'ObjectExpression' ? argument.properties.find((property): property is Property => property.type === 'Property' && !property.computed && keyName(property) === 'protect') : undefined
|
|
100
|
-
|
|
101
|
-
if (protect?.value.type !== 'ObjectExpression')
|
|
102
|
-
continue
|
|
103
|
-
|
|
104
|
-
for (const bag of protect.value.properties) {
|
|
105
|
-
if (bag.type === 'Property' && !bag.computed && BAGS.has(keyName(bag) ?? '') && bag.value.type === 'ObjectExpression')
|
|
106
|
-
reportIn(bound, bag.value, `\`${keyName(bag)!}\``)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// `maxAge` where it says how long something lives and no HTTP header or cookie is meant: `signed.sign(use, value, { maxAge })`, `files.url(key, { maxAge })`, `workChallenge(scope, { maxAge })`, kayjs-auth's `proofOfWork({ maxAge })`, the `proofOfWork` and `minTime` of an action's `protect` and the `maxAge.link` and `maxAge.code` of a kayjs-auth mail's data, `ttl` since 1.105, as `ttl` is the one word for how long data lives.
|
|
112
|
-
// The fix renames the key; one beside a `ttl`, or a computed key, is reported with no fix.
|
|
113
|
-
export async function ttlNames(root: string, options: CheckOptions): Promise<CheckDiagnostic[]> {
|
|
114
|
-
if (lintLevel('deprecated-ttl-names', options.lints) === 'allow')
|
|
115
|
-
return []
|
|
116
|
-
|
|
117
|
-
return scan(root, options, 'deprecated-ttl-names', NEEDLE, ({ parsed, report }) => {
|
|
118
|
-
for (const { ast, base } of parsed) {
|
|
119
|
-
const actions = importsOf(ast, FROM_KAY, 'action')
|
|
120
|
-
const bound: Bound = {
|
|
121
|
-
base,
|
|
122
|
-
report,
|
|
123
|
-
actions: actions.locals,
|
|
124
|
-
actionNamespaces: actions.namespaces,
|
|
125
|
-
methods: Object.entries(CALLS).map(([name, call]) => ({ ...call, locals: importsOf(ast, FROM_SERVER, name).locals })),
|
|
126
|
-
functions: FUNCTIONS.map(one => ({ ...one, locals: importsOf(ast, one.from, one.name).locals })),
|
|
127
|
-
fromAuth: ast.body.some(statement => statement.type === 'ImportDeclaration' && statement.source.value === '@kayjs/auth'),
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
walk(ast, (node: Node) => {
|
|
131
|
-
if (node.type === 'CallExpression') {
|
|
132
|
-
reportMethod(bound, node)
|
|
133
|
-
reportFunction(bound, node)
|
|
134
|
-
reportAction(bound, node)
|
|
135
|
-
}
|
|
136
|
-
else if (node.type === 'MemberExpression') {
|
|
137
|
-
reportMailRead(bound, node)
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { Details, ElementNode, Span } from './ast'
|
|
2
|
-
import type { Named } from './deprecated-ui-props'
|
|
3
|
-
|
|
4
|
-
// The keys of `labels` a `Chat` takes, as its messages (`ai.chat.<key>`) are keyed.
|
|
5
|
-
const CHAT_KEYS = ['field', 'started', 'send', 'stop', 'retry', 'thinking', 'error', 'sources', 'stopped', 'table', 'reasoning', 'running', 'done', 'failed', 'arguments', 'result', 'approval', 'allow', 'deny', 'allowed', 'denied', 'new', 'attach', 'remove', 'attachRefused', 'attachTooBig', 'attachFull', 'regenerate', 'edit', 'save', 'cancel', 'editEmpty', 'editBusy', 'record', 'transcribing', 'unheard', 'transcribeFailed', 'conversations', 'untitled', 'rename', 'delete', 'deleteConfirm', 'conflict', 'loadFailed', 'changeFailed', 'signedOut']
|
|
6
|
-
const LAUNCHER_KEYS = ['open', 'close', 'expand', 'collapse']
|
|
7
|
-
|
|
8
|
-
const IDENTIFIER = /^[A-Z_$][\w$]*$/i
|
|
9
|
-
const WHITESPACE = /\s/
|
|
10
|
-
|
|
11
|
-
// The two keys whose flat prop was named for what it said rather than for its message.
|
|
12
|
-
const RENAMED: Record<string, string> = { waitingLabel: 'thinking', failureLabel: 'error' }
|
|
13
|
-
|
|
14
|
-
// The flat props of each component, by the library's file, and the key of `labels` each is.
|
|
15
|
-
const FLAT: Record<string, ReadonlyMap<string, string>> = {
|
|
16
|
-
'ai/chat': flat(CHAT_KEYS),
|
|
17
|
-
'ai/chat-launcher': flat([...CHAT_KEYS, ...LAUNCHER_KEYS]),
|
|
18
|
-
'ai/chat-panel': flat(['open', 'close', 'new', 'expand', 'collapse']),
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function flat(keys: readonly string[]): ReadonlyMap<string, string> {
|
|
22
|
-
const props = new Map(keys.map(key => [`${key}Label`, key]))
|
|
23
|
-
|
|
24
|
-
for (const [prop, key] of Object.entries(RENAMED)) {
|
|
25
|
-
if (props.delete(`${key}Label`))
|
|
26
|
-
props.set(prop, key)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return props
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type Report = (span: Span, message: string, details: Details) => void
|
|
33
|
-
|
|
34
|
-
// The `<key>Label` props of a kayjs-ai chat component, `labels={{ key: ... }}` since 1.105: one object keyed as the messages are, in place of up to 45 props that each held one text. Found on a component bound to the library's file; the fix writes the first of them as `labels` holding every one, and offers none beside a `labels` already written or a bare `sendLabel` with no value.
|
|
35
|
-
export function deprecatedAiLabels(element: ElementNode, file: string, text: (span: Span) => string, report: Report): void {
|
|
36
|
-
const props = FLAT[file]
|
|
37
|
-
|
|
38
|
-
if (props === undefined)
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
const attributes = element.attributes.filter((attribute): attribute is Named => attribute.kind !== 'spread')
|
|
42
|
-
const old = attributes.filter(attribute => props.has(text(attribute.name)))
|
|
43
|
-
const first = old[0]
|
|
44
|
-
|
|
45
|
-
if (first === undefined)
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
const written = attributes.some(attribute => text(attribute.name) === 'labels')
|
|
49
|
-
const entries = old.map((attribute) => {
|
|
50
|
-
const key = props.get(text(attribute.name))!
|
|
51
|
-
const name = IDENTIFIER.test(key) ? key : JSON.stringify(key)
|
|
52
|
-
|
|
53
|
-
if (attribute.kind === 'static')
|
|
54
|
-
return { attribute, entry: `${name}: ${JSON.stringify(attribute.text)}`, end: attribute.value.end + 1 }
|
|
55
|
-
|
|
56
|
-
if (attribute.kind === 'expression') {
|
|
57
|
-
return attribute.shorthand
|
|
58
|
-
? { attribute, entry: `${name}: ${text(attribute.name)}`, end: attribute.shorthand.end }
|
|
59
|
-
: { attribute, entry: `${name}: ${text(attribute.expression).trim()}`, end: attribute.expression.end + 1 }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return undefined
|
|
63
|
-
})
|
|
64
|
-
const found = entries.filter(one => one !== undefined)
|
|
65
|
-
const message = `The \`<key>Label\` props of \`${element.name}\` are one \`labels\` object since 1.105, keyed as its messages are: \`labels={{ send: ... }}\``
|
|
66
|
-
|
|
67
|
-
if (written || found.length < entries.length)
|
|
68
|
-
report(first.name, message, { help: 'Move each into `labels`' })
|
|
69
|
-
else
|
|
70
|
-
report(first.name, message, { help: 'Write `labels`', fixes: [{ title: 'Write `labels`', safe: true, edits: edits(found, text) }] })
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// The first prop becomes `labels={{ ... }}` and each other one goes, with the blank before it.
|
|
74
|
-
function edits(entries: { attribute: Named, entry: string, end: number }[], text: (span: Span) => string): { start: number, end: number, text: string }[] {
|
|
75
|
-
const [first, ...rest] = entries
|
|
76
|
-
const object = `labels={{ ${entries.map(({ entry }) => entry).join(', ')} }}`
|
|
77
|
-
|
|
78
|
-
return [
|
|
79
|
-
{ start: start(first!.attribute), end: first!.end, text: object },
|
|
80
|
-
...rest.map(({ attribute, end }) => ({ start: blank(attribute, text), end, text: '' })),
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function start(attribute: Named): number {
|
|
85
|
-
return attribute.kind === 'expression' && attribute.shorthand ? attribute.shorthand.start : attribute.name.start
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Where the blank before an attribute begins, found in the text of its own line so a removal leaves the others as they were.
|
|
89
|
-
function blank(attribute: Named, text: (span: Span) => string): number {
|
|
90
|
-
const at = start(attribute)
|
|
91
|
-
let from = at
|
|
92
|
-
|
|
93
|
-
while (from > 0 && WHITESPACE.test(text({ start: from - 1, end: from })))
|
|
94
|
-
from--
|
|
95
|
-
|
|
96
|
-
return from
|
|
97
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { Details, ElementNode, Span } from './ast'
|
|
2
|
-
import type { Named } from './deprecated-ui-props'
|
|
3
|
-
|
|
4
|
-
type Report = (span: Span, message: string, details: Details) => void
|
|
5
|
-
|
|
6
|
-
const PLAIN_PATH = /^[\w$]+(?:\.[\w$]+)*$/
|
|
7
|
-
|
|
8
|
-
const MESSAGE = 'Which links open in a new tab is `newTab` since 1.105, as the links of kayjs-ui take it: `true`, `false` or `\'auto\'`, which opens a link to a page of this site in place'
|
|
9
|
-
|
|
10
|
-
// `Chat`'s `links` and `Sources`' `here`, `newTab` since 1.105: `links="apart"` is `newTab={true}`, `links="here"` and `here` are `newTab="auto"`. Found on a component bound to the library's file; the fix offers none beside a `newTab` already written, or a value it cannot read.
|
|
11
|
-
export function deprecatedAiLinks(element: ElementNode, file: string, text: (span: Span) => string, report: Report): void {
|
|
12
|
-
if (file !== 'ai/chat' && file !== 'ai/chat-sources')
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
const attributes = element.attributes.filter((attribute): attribute is Named => attribute.kind !== 'spread')
|
|
16
|
-
const old = attributes.find(attribute => text(attribute.name) === (file === 'ai/chat' ? 'links' : 'here'))
|
|
17
|
-
|
|
18
|
-
if (old === undefined)
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
const replacement = file === 'ai/chat' ? links(old) : here(old, text)
|
|
22
|
-
|
|
23
|
-
if (attributes.some(attribute => text(attribute.name) === 'newTab') || replacement === undefined) {
|
|
24
|
-
report(old.name, MESSAGE, { help: 'Write `newTab` and drop the old prop' })
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const start = old.kind === 'expression' && old.shorthand ? old.shorthand.start : old.name.start
|
|
30
|
-
const end = endOf(old)
|
|
31
|
-
|
|
32
|
-
report(old.name, MESSAGE, { help: 'Write `newTab`', fixes: [{ title: 'Write `newTab`', safe: true, edits: [{ start, end, text: replacement }] }] })
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function endOf(attribute: Named): number {
|
|
36
|
-
if (attribute.kind === 'static')
|
|
37
|
-
return attribute.value.end + 1
|
|
38
|
-
|
|
39
|
-
if (attribute.kind === 'expression')
|
|
40
|
-
return (attribute.shorthand ?? { end: attribute.expression.end + 1 }).end
|
|
41
|
-
|
|
42
|
-
return attribute.name.end
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const LINKS: Record<string, string> = { apart: 'newTab={true}', here: 'newTab="auto"' }
|
|
46
|
-
|
|
47
|
-
function links(attribute: Named): string | undefined {
|
|
48
|
-
return attribute.kind === 'static' ? LINKS[attribute.text] : undefined
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function here(attribute: Named, text: (span: Span) => string): string | undefined {
|
|
52
|
-
if (attribute.kind === 'boolean')
|
|
53
|
-
return 'newTab="auto"'
|
|
54
|
-
|
|
55
|
-
if (attribute.kind === 'expression') {
|
|
56
|
-
const value = attribute.shorthand ? text(attribute.name) : text(attribute.expression).trim()
|
|
57
|
-
|
|
58
|
-
// Anything but a name or a member path is parenthesised, so a conditional keeps its meaning under the new one.
|
|
59
|
-
return `newTab={${PLAIN_PATH.test(value) ? value : `(${value})`} ? 'auto' : true}`
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return undefined
|
|
63
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Diagnostic } from './ast'
|
|
2
|
-
import { allowComments } from './allow-comments'
|
|
3
|
-
import { positionAt } from './mapping'
|
|
4
|
-
|
|
5
|
-
// Lints that no longer exist, whose `// kay-allow` comment and `lints` entry are reported by their deprecation instead of as an unknown lint. They go with `deprecated-uncaught-await`, in 1.108.
|
|
6
|
-
export type RetiredLint = 'uncaught-await'
|
|
7
|
-
export const RETIRED_LINTS: ReadonlySet<string> = new Set<RetiredLint>(['uncaught-await'])
|
|
8
|
-
|
|
9
|
-
// A `// kay-allow uncaught-await` comment: an `await` with no `catch` renders the nearest `try`'s `catch`, or an alert, since 1.105, so there is nothing left to allow.
|
|
10
|
-
export function retiredAllowComments(source: string): Diagnostic[] {
|
|
11
|
-
const found: Diagnostic[] = []
|
|
12
|
-
|
|
13
|
-
for (const comment of allowComments(source)) {
|
|
14
|
-
const index = comment.names.findIndex(({ name }) => name === 'uncaught-await')
|
|
15
|
-
|
|
16
|
-
if (index === -1)
|
|
17
|
-
continue
|
|
18
|
-
|
|
19
|
-
const { name, start } = comment.names[index]!
|
|
20
|
-
const lineStart = source.lastIndexOf('\n', comment.start - 1) + 1
|
|
21
|
-
const newline = source.indexOf('\n', comment.start)
|
|
22
|
-
const lineEnd = newline === -1 ? source.length : newline
|
|
23
|
-
let edit: { start: number, end: number }
|
|
24
|
-
|
|
25
|
-
if (comment.names.length > 1) {
|
|
26
|
-
const next = comment.names[index + 1]
|
|
27
|
-
|
|
28
|
-
// The comma after the name goes with it, or the one before the last name.
|
|
29
|
-
edit = next ? { start, end: next.start } : { start: source.lastIndexOf(',', start), end: start + name.length }
|
|
30
|
-
}
|
|
31
|
-
else if (source.slice(lineStart, comment.start).trim() === '') {
|
|
32
|
-
edit = { start: lineStart, end: newline === -1 ? lineEnd : lineEnd + 1 }
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
edit = { start: lineStart + source.slice(lineStart, comment.start).trimEnd().length, end: lineEnd }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
found.push({
|
|
39
|
-
start,
|
|
40
|
-
end: start + name.length,
|
|
41
|
-
code: 'deprecated-uncaught-await',
|
|
42
|
-
checkOnly: true,
|
|
43
|
-
message: `\`uncaught-await\` is gone since 1.105 (line ${positionAt(source, start).line})`,
|
|
44
|
-
help: 'an `await` with no `catch` renders the `catch` of the `try` around it, or an alert, so the comment allows nothing: remove it',
|
|
45
|
-
fixes: [{ title: 'Remove the comment', safe: true, edits: [{ ...edit, text: '' }] }],
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return found
|
|
50
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Lint } from './lints'
|
|
2
|
-
|
|
3
|
-
// The deprecated lints of kayjs-auth's methods, apart from the others to keep the file short.
|
|
4
|
-
export const AUTH_LINTS = {
|
|
5
|
-
'deprecated-auth-methods': {
|
|
6
|
-
level: 'warn',
|
|
7
|
-
group: 'deprecated',
|
|
8
|
-
since: '1.105',
|
|
9
|
-
site: true,
|
|
10
|
-
summary: 'kayjs-auth\'s methods under the names they had before 1.105, when the verbs of a group differed and some methods sat on `auth` itself: every group lists with `list`, reads with `get`, writes with `create` and `update`, removes with `delete` and takes back with `revoke`. `organizations.members`, `invitations`, `myInvitations` and `invitation` are `listMembers`, `listInvitations`, `listMyInvitations` and `getInvitation`, `setMemberRoles` and `removeMember` are `updateMemberRoles` and `deleteMember`; `admin.roles` and `admin.auditLog` are `listRoles` and `listAuditLog`; `oauthServer.clients` is `listClients`; `passkeys.rename` is `passkeys.update`; `account.changeUsername`, `profile` and `saveProfile` are `updateUsername`, `getProfile` and `updateProfile`; `oauth.identities` and `providerToken` are `listIdentities` and `getProviderToken`; `magicLink.signInWithCode` is `email.signInWithCode`, the code being the email\'s. The methods on `auth` went into the group they belong to: `requireAdmin()` is `admin.require()`, `captchaRequired()` and `captchaChallenge()` are `captcha.required()` and `captcha.challenge()`, `provedLately()` and `reprove()` are `proof.recent()` and `proof.renew()`, `scopes()` and `hasScope()` are `tokens.scopes()` and `tokens.hasScope()`, and `oauthResource()`, `oauthOrigin()` and `oauthFixed()` are `oauthServer.resource()`, `origin()` and `fixed()`. The old names work until 1.108. Found on a call whose receiver is named `auth` (`ctx.locals.auth`, `locals.auth`), in the TypeScript files and `.kay` files of the project, a template expression excluded; the fix writes the new name.',
|
|
11
|
-
wrong: '// src/admin.ts\nexport async function members(auth: Auth, org: string) {\n await auth.requireAdmin()\n\n return auth.organizations.members(org)\n}',
|
|
12
|
-
right: '// src/admin.ts\nexport async function members(auth: Auth, org: string) {\n await auth.admin.require()\n\n return auth.organizations.listMembers(org)\n}',
|
|
13
|
-
},
|
|
14
|
-
} as const satisfies Record<string, Lint>
|