cvx-kit 0.2.0 → 2.0.0-beta.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/README.md +556 -99
- package/dist/agent-tools.d.mts +39 -26
- package/dist/agent-tools.mjs +1 -1
- package/dist/agent-tools.mjs.map +1 -1
- package/dist/auth.d.mts +120 -308
- package/dist/auth.mjs +1 -1
- package/dist/auth.mjs.map +1 -1
- package/dist/components/approvals/_generated/api.d.mts +7 -9
- package/dist/components/approvals/_generated/api.mjs.map +1 -1
- package/dist/components/approvals/_generated/component.d.mts +1 -4
- package/dist/components/approvals/_generated/dataModel.d.mts +5 -8
- package/dist/components/approvals/_generated/server.d.mts +12 -15
- package/dist/components/approvals/_generated/server.mjs.map +1 -1
- package/dist/components/approvals/audit.d.mts +8 -9
- package/dist/components/approvals/audit.mjs +1 -1
- package/dist/components/approvals/audit.mjs.map +1 -1
- package/dist/components/approvals/client.d.mts +11 -12
- package/dist/components/approvals/client.mjs +1 -1
- package/dist/components/approvals/client.mjs.map +1 -1
- package/dist/components/approvals/constants.d.mts +30 -31
- package/dist/components/approvals/constants.mjs.map +1 -1
- package/dist/components/approvals/convex.config.d.mts +0 -2
- package/dist/components/approvals/convex.config.mjs.map +1 -1
- package/dist/components/approvals/decisions.d.mts +13 -17
- package/dist/components/approvals/decisions.mjs +1 -1
- package/dist/components/approvals/decisions.mjs.map +1 -1
- package/dist/components/approvals/functions.d.mts +3 -4
- package/dist/components/approvals/functions.mjs +1 -1
- package/dist/components/approvals/functions.mjs.map +1 -1
- package/dist/components/approvals/health.d.mts +2 -3
- package/dist/components/approvals/health.mjs.map +1 -1
- package/dist/components/approvals/requests.d.mts +114 -131
- package/dist/components/approvals/requests.mjs +1 -1
- package/dist/components/approvals/requests.mjs.map +1 -1
- package/dist/components/approvals/schema.d.ts +106 -315
- package/dist/components/approvals/schema.js +1 -1
- package/dist/components/approvals/validators.d.mts +323 -395
- package/dist/components/approvals/validators.mjs +1 -1
- package/dist/components/approvals/validators.mjs.map +1 -1
- package/dist/components/approvals/workflow.d.mts +4 -5
- package/dist/components/approvals/workflow.mjs +1 -1
- package/dist/components/approvals/workflow.mjs.map +1 -1
- package/dist/components/approvals/workflow_steps.d.mts +16 -17
- package/dist/components/approvals/workflow_steps.mjs +1 -1
- package/dist/components/approvals/workflow_steps.mjs.map +1 -1
- package/dist/components/foundation/_generated/api.d.mts +6 -8
- package/dist/components/foundation/_generated/api.mjs.map +1 -1
- package/dist/components/foundation/_generated/component.d.mts +1 -4
- package/dist/components/foundation/_generated/dataModel.d.mts +5 -8
- package/dist/components/foundation/_generated/server.d.mts +12 -15
- package/dist/components/foundation/_generated/server.mjs.map +1 -1
- package/dist/components/foundation/client.d.mts +45 -38
- package/dist/components/foundation/client.mjs +1 -1
- package/dist/components/foundation/client.mjs.map +1 -1
- package/dist/components/foundation/convex.config.d.mts +0 -2
- package/dist/components/foundation/convex.config.mjs.map +1 -1
- package/dist/components/foundation/functions.d.mts +2 -3
- package/dist/components/foundation/functions.mjs.map +1 -1
- package/dist/components/foundation/modules/command/command.d.mts +65 -17
- package/dist/components/foundation/modules/command/command.mjs +1 -1
- package/dist/components/foundation/modules/command/command.mjs.map +1 -1
- package/dist/components/foundation/modules/command/lifecycle.d.mts +78 -0
- package/dist/components/foundation/modules/command/lifecycle.mjs +2 -0
- package/dist/components/foundation/modules/command/lifecycle.mjs.map +1 -0
- package/dist/components/foundation/modules/observability/observability.d.mts +13 -6
- package/dist/components/foundation/modules/observability/observability.mjs +1 -1
- package/dist/components/foundation/modules/observability/observability.mjs.map +1 -1
- package/dist/components/foundation/modules/query/query.d.mts +11 -12
- package/dist/components/foundation/modules/query/query.mjs +1 -1
- package/dist/components/foundation/modules/query/query.mjs.map +1 -1
- package/dist/components/foundation/operation.d.mts +72 -0
- package/dist/components/foundation/operation.mjs +2 -0
- package/dist/components/foundation/operation.mjs.map +1 -0
- package/dist/components/foundation/result.d.mts +7 -8
- package/dist/components/foundation/result.mjs.map +1 -1
- package/dist/components/foundation/schema.d.ts +0 -2
- package/dist/components/foundation/telemetry.d.mts +2 -3
- package/dist/components/foundation/telemetry.mjs +1 -1
- package/dist/components/foundation/telemetry.mjs.map +1 -1
- package/dist/contracts.d.mts +5 -0
- package/dist/contracts.mjs +1 -0
- package/dist/crud.d.mts +185 -27
- package/dist/crud.mjs +1 -1
- package/dist/crud.mjs.map +1 -1
- package/dist/effect.d.mts +16 -0
- package/dist/effect.mjs +1 -0
- package/dist/errors.d.mts +6 -6
- package/dist/errors.mjs +1 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/filters.d.mts +4 -0
- package/dist/filters.mjs +1 -0
- package/dist/idempotency.d.mts +2 -0
- package/dist/idempotency.mjs +1 -0
- package/dist/index.d.mts +14 -7
- package/dist/index.mjs +1 -1
- package/dist/json-schema.d.mts +40 -0
- package/dist/json-schema.mjs +2 -0
- package/dist/json-schema.mjs.map +1 -0
- package/dist/k/compile.d.mts +17 -0
- package/dist/k/compile.mjs +2 -0
- package/dist/k/compile.mjs.map +1 -0
- package/dist/k/dates.d.mts +23 -0
- package/dist/k/dates.mjs +2 -0
- package/dist/k/dates.mjs.map +1 -0
- package/dist/k/formats.d.mts +24 -0
- package/dist/k/formats.mjs +2 -0
- package/dist/k/formats.mjs.map +1 -0
- package/dist/k/index.d.mts +32 -0
- package/dist/k/index.mjs +2 -0
- package/dist/k/index.mjs.map +1 -0
- package/dist/k/issues.d.mts +31 -0
- package/dist/k/issues.mjs +2 -0
- package/dist/k/issues.mjs.map +1 -0
- package/dist/k/kinds.d.mts +81 -0
- package/dist/k/kinds.mjs +2 -0
- package/dist/k/kinds.mjs.map +1 -0
- package/dist/k/object.d.mts +43 -0
- package/dist/k/object.mjs +2 -0
- package/dist/k/object.mjs.map +1 -0
- package/dist/k/parse.d.mts +29 -0
- package/dist/k/parse.mjs +2 -0
- package/dist/k/parse.mjs.map +1 -0
- package/dist/k/schema.d.mts +100 -0
- package/dist/k/schema.mjs +2 -0
- package/dist/k/schema.mjs.map +1 -0
- package/dist/k/standard.d.mts +8 -0
- package/dist/k/standard.mjs +2 -0
- package/dist/k/standard.mjs.map +1 -0
- package/dist/k/types.d.mts +64 -0
- package/dist/k/types.mjs +1 -0
- package/dist/k.d.mts +8 -0
- package/dist/k.mjs +1 -0
- package/dist/middleware.d.mts +8 -11
- package/dist/middleware.mjs +1 -1
- package/dist/middleware.mjs.map +1 -1
- package/dist/modules/contracts/binding.d.mts +23 -0
- package/dist/modules/contracts/binding.mjs +2 -0
- package/dist/modules/contracts/binding.mjs.map +1 -0
- package/dist/modules/contracts/contract.d.mts +67 -0
- package/dist/modules/contracts/contract.mjs +2 -0
- package/dist/modules/contracts/contract.mjs.map +1 -0
- package/dist/modules/contracts/convex.d.mts +18 -0
- package/dist/modules/contracts/convex.mjs +2 -0
- package/dist/modules/contracts/convex.mjs.map +1 -0
- package/dist/modules/contracts/domain.d.mts +62 -0
- package/dist/modules/contracts/domain.mjs +2 -0
- package/dist/modules/contracts/domain.mjs.map +1 -0
- package/dist/modules/contracts/errors.d.mts +737 -0
- package/dist/modules/contracts/errors.mjs +2 -0
- package/dist/modules/contracts/errors.mjs.map +1 -0
- package/dist/modules/contracts/exposure.d.mts +103 -0
- package/dist/modules/contracts/exposure.mjs +2 -0
- package/dist/modules/contracts/exposure.mjs.map +1 -0
- package/dist/modules/contracts/idempotency.d.mts +85 -0
- package/dist/modules/contracts/idempotency.mjs +2 -0
- package/dist/modules/contracts/idempotency.mjs.map +1 -0
- package/dist/modules/contracts/lazy.d.mts +6 -0
- package/dist/modules/contracts/lazy.mjs +2 -0
- package/dist/modules/contracts/lazy.mjs.map +1 -0
- package/dist/modules/contracts/standard.d.mts +17 -0
- package/dist/modules/contracts/standard.mjs +2 -0
- package/dist/modules/contracts/standard.mjs.map +1 -0
- package/dist/modules/contracts/workflow.d.mts +165 -0
- package/dist/modules/contracts/workflow.mjs +2 -0
- package/dist/modules/contracts/workflow.mjs.map +1 -0
- package/dist/modules/effect/action.d.mts +63 -0
- package/dist/modules/effect/action.mjs +2 -0
- package/dist/modules/effect/action.mjs.map +1 -0
- package/dist/modules/effect/agent-tools.d.mts +2 -0
- package/dist/modules/effect/agent-tools.mjs +1 -0
- package/dist/modules/effect/api-runtime.d.mts +36 -0
- package/dist/modules/effect/api-runtime.mjs +2 -0
- package/dist/modules/effect/api-runtime.mjs.map +1 -0
- package/dist/modules/effect/api.d.mts +46 -0
- package/dist/modules/effect/api.mjs +2 -0
- package/dist/modules/effect/api.mjs.map +1 -0
- package/dist/modules/effect/auth.d.mts +46 -0
- package/dist/modules/effect/auth.mjs +2 -0
- package/dist/modules/effect/auth.mjs.map +1 -0
- package/dist/modules/effect/client.d.mts +15 -0
- package/dist/modules/effect/client.mjs +1 -0
- package/dist/modules/effect/command.d.mts +108 -0
- package/dist/modules/effect/command.mjs +2 -0
- package/dist/modules/effect/command.mjs.map +1 -0
- package/dist/modules/effect/crud.d.mts +885 -0
- package/dist/modules/effect/crud.mjs +2 -0
- package/dist/modules/effect/crud.mjs.map +1 -0
- package/dist/modules/effect/domain.d.mts +82 -0
- package/dist/modules/effect/domain.mjs +2 -0
- package/dist/modules/effect/domain.mjs.map +1 -0
- package/dist/modules/effect/errors.d.mts +13 -0
- package/dist/modules/effect/errors.mjs +2 -0
- package/dist/modules/effect/errors.mjs.map +1 -0
- package/dist/modules/effect/failure-audit.d.mts +48 -0
- package/dist/modules/effect/failure-audit.mjs +2 -0
- package/dist/modules/effect/failure-audit.mjs.map +1 -0
- package/dist/modules/effect/failures.d.mts +21 -0
- package/dist/modules/effect/failures.mjs +2 -0
- package/dist/modules/effect/failures.mjs.map +1 -0
- package/dist/modules/effect/foundation.d.mts +23 -0
- package/dist/modules/effect/foundation.mjs +2 -0
- package/dist/modules/effect/foundation.mjs.map +1 -0
- package/dist/modules/effect/idempotency.d.mts +29 -0
- package/dist/modules/effect/idempotency.mjs +2 -0
- package/dist/modules/effect/idempotency.mjs.map +1 -0
- package/dist/modules/effect/input.d.mts +10 -0
- package/dist/modules/effect/input.mjs +2 -0
- package/dist/modules/effect/input.mjs.map +1 -0
- package/dist/modules/effect/normalize.d.mts +7 -0
- package/dist/modules/effect/normalize.mjs +2 -0
- package/dist/modules/effect/normalize.mjs.map +1 -0
- package/dist/modules/effect/operation.d.mts +148 -0
- package/dist/modules/effect/operation.mjs +2 -0
- package/dist/modules/effect/operation.mjs.map +1 -0
- package/dist/modules/effect/query.d.mts +90 -0
- package/dist/modules/effect/query.mjs +2 -0
- package/dist/modules/effect/query.mjs.map +1 -0
- package/dist/modules/effect/schema.d.mts +30 -0
- package/dist/modules/effect/schema.mjs +2 -0
- package/dist/modules/effect/schema.mjs.map +1 -0
- package/dist/modules/effect/scope.d.mts +25 -0
- package/dist/modules/effect/scope.mjs +2 -0
- package/dist/modules/effect/scope.mjs.map +1 -0
- package/dist/modules/effect/workflow.d.mts +75 -0
- package/dist/modules/effect/workflow.mjs +2 -0
- package/dist/modules/effect/workflow.mjs.map +1 -0
- package/dist/modules/foundation/foundation.d.mts +108 -0
- package/dist/modules/foundation/foundation.mjs +2 -0
- package/dist/modules/foundation/foundation.mjs.map +1 -0
- package/dist/modules/foundation/operation.d.mts +139 -0
- package/dist/modules/foundation/operation.mjs +2 -0
- package/dist/modules/foundation/operation.mjs.map +1 -0
- package/dist/namespace.d.mts +104 -0
- package/dist/namespace.mjs +2 -0
- package/dist/namespace.mjs.map +1 -0
- package/dist/oxlint/architecture.d.mts +23 -0
- package/dist/oxlint/architecture.mjs +2 -0
- package/dist/oxlint/architecture.mjs.map +1 -0
- package/dist/oxlint/ast.d.mts +51 -0
- package/dist/oxlint/ast.mjs +2 -0
- package/dist/oxlint/ast.mjs.map +1 -0
- package/dist/oxlint/components.d.mts +4 -0
- package/dist/oxlint/components.mjs +2 -0
- package/dist/oxlint/components.mjs.map +1 -0
- package/dist/oxlint/ownership.d.mts +59 -0
- package/dist/oxlint/ownership.mjs +2 -0
- package/dist/oxlint/ownership.mjs.map +1 -0
- package/dist/oxlint/reserved-files.d.mts +4 -0
- package/dist/oxlint/reserved-files.mjs +2 -0
- package/dist/oxlint/reserved-files.mjs.map +1 -0
- package/dist/oxlint.d.mts +9 -0
- package/dist/oxlint.mjs +2 -0
- package/dist/oxlint.mjs.map +1 -0
- package/dist/querying/cursors.d.mts +94 -0
- package/dist/querying/cursors.mjs +2 -0
- package/dist/querying/cursors.mjs.map +1 -0
- package/dist/querying/execution.d.mts +40 -0
- package/dist/querying/execution.mjs +2 -0
- package/dist/querying/execution.mjs.map +1 -0
- package/dist/querying/failures.d.mts +11 -0
- package/dist/querying/failures.mjs +2 -0
- package/dist/querying/failures.mjs.map +1 -0
- package/dist/querying/filter-boundary.d.mts +25 -0
- package/dist/querying/filter-boundary.mjs +2 -0
- package/dist/querying/filter-boundary.mjs.map +1 -0
- package/dist/querying/filters.d.mts +180 -0
- package/dist/querying/filters.mjs +2 -0
- package/dist/querying/filters.mjs.map +1 -0
- package/dist/querying/planner.d.mts +61 -0
- package/dist/querying/planner.mjs +2 -0
- package/dist/querying/planner.mjs.map +1 -0
- package/dist/querying/relationships.d.mts +58 -0
- package/dist/querying/relationships.mjs +2 -0
- package/dist/querying/relationships.mjs.map +1 -0
- package/dist/querying/search.d.mts +69 -0
- package/dist/querying/search.mjs +2 -0
- package/dist/querying/search.mjs.map +1 -0
- package/dist/querying/security.d.mts +123 -0
- package/dist/querying/security.mjs +2 -0
- package/dist/querying/security.mjs.map +1 -0
- package/dist/querying/shared/ast.d.mts +26 -0
- package/dist/querying/shared/ast.mjs +2 -0
- package/dist/querying/shared/ast.mjs.map +1 -0
- package/dist/querying/shared/contract.d.mts +98 -0
- package/dist/querying/shared/contract.mjs +2 -0
- package/dist/querying/shared/contract.mjs.map +1 -0
- package/dist/querying/shared/evaluate.d.mts +5 -0
- package/dist/querying/shared/evaluate.mjs +2 -0
- package/dist/querying/shared/evaluate.mjs.map +1 -0
- package/dist/querying/shared/filters.d.mts +65 -0
- package/dist/querying/shared/filters.mjs +2 -0
- package/dist/querying/shared/filters.mjs.map +1 -0
- package/dist/querying/shared/native-json.d.mts +7 -0
- package/dist/querying/shared/native-json.mjs +2 -0
- package/dist/querying/shared/native-json.mjs.map +1 -0
- package/dist/querying/shared/page.d.mts +20 -0
- package/dist/querying/shared/page.mjs +2 -0
- package/dist/querying/shared/page.mjs.map +1 -0
- package/dist/querying.d.mts +82 -0
- package/dist/querying.mjs +2 -0
- package/dist/querying.mjs.map +1 -0
- package/dist/react/failures.d.mts +24 -0
- package/dist/react/failures.mjs +2 -0
- package/dist/react/failures.mjs.map +1 -0
- package/dist/react/optimistic.d.mts +46 -0
- package/dist/react/optimistic.mjs +2 -0
- package/dist/react/optimistic.mjs.map +1 -0
- package/dist/react/pagination-state.d.mts +39 -0
- package/dist/react/pagination-state.mjs +2 -0
- package/dist/react/pagination-state.mjs.map +1 -0
- package/dist/react/use-command.d.mts +22 -0
- package/dist/react/use-command.mjs +2 -0
- package/dist/react/use-command.mjs.map +1 -0
- package/dist/react/use-paginated-list.d.mts +34 -0
- package/dist/react/use-paginated-list.mjs +2 -0
- package/dist/react/use-paginated-list.mjs.map +1 -0
- package/dist/react.d.mts +6 -0
- package/dist/react.mjs +1 -0
- package/dist/registration.d.mts +65 -0
- package/dist/registration.mjs +2 -0
- package/dist/registration.mjs.map +1 -0
- package/dist/relations-public.d.mts +2 -0
- package/dist/relations-public.mjs +1 -0
- package/dist/relations.d.mts +274 -0
- package/dist/relations.mjs +2 -0
- package/dist/relations.mjs.map +1 -0
- package/dist/state-machine.d.mts +1 -4
- package/dist/state-machine.mjs.map +1 -1
- package/dist/table.d.mts +222 -0
- package/dist/table.mjs +2 -0
- package/dist/table.mjs.map +1 -0
- package/dist/tenancy.d.mts +6 -8
- package/dist/tenancy.mjs +1 -1
- package/dist/tenancy.mjs.map +1 -1
- package/dist/triggers.d.mts +12 -10
- package/dist/triggers.mjs +1 -1
- package/dist/triggers.mjs.map +1 -1
- package/dist/webhooks.d.mts +22 -112
- package/dist/webhooks.mjs +1 -1
- package/dist/webhooks.mjs.map +1 -1
- package/dist/workflow.d.mts +2 -0
- package/dist/workflow.mjs +1 -0
- package/dist/zod.d.mts +30 -0
- package/dist/zod.mjs +2 -0
- package/dist/zod.mjs.map +1 -0
- package/package.json +145 -33
- package/src/test.ts +9 -17
- package/CHANGELOG.md +0 -145
- package/ROADMAP.md +0 -126
- package/dist/zod-table.d.mts +0 -175
- package/dist/zod-table.mjs +0 -2
- package/dist/zod-table.mjs.map +0 -1
- package/docs/agent-tools.md +0 -41
- package/docs/approvals.md +0 -200
- package/docs/architecture.md +0 -124
- package/docs/auth.md +0 -218
- package/docs/commands.md +0 -278
- package/docs/conventions.md +0 -291
- package/docs/crud.md +0 -62
- package/docs/llms.md +0 -220
- package/docs/maintainability.md +0 -124
- package/docs/migration.md +0 -351
- package/docs/plans/2026-08-14-001-feat-v0.1.0-feature-set-plan.md +0 -461
- package/docs/plans/2026-08-21-0930-feat-resolve-organization-hook-plan.md +0 -178
- package/docs/tenancy.md +0 -179
- package/docs/triggers.md +0 -75
- package/docs/upgrading.md +0 -175
- package/docs/webhooks.md +0 -58
- package/docs/zod-table.md +0 -173
- package/scripts/convex-config-bridge.mjs +0 -55
- package/scripts/extract-changelog.mjs +0 -29
- package/scripts/smoke-packed-components.mjs +0 -374
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Convex's CLI discovers a packaged component only when its definition file
|
|
2
|
-
// is literally named `convex.config.js` (see DEFINITION_FILENAME_JS in the
|
|
3
|
-
// convex CLI). vp pack emits .mjs, so this postbuild step materializes the
|
|
4
|
-
// compiled definition as convex.config.js in each component's dist directory.
|
|
5
|
-
import {
|
|
6
|
-
readFileSync,
|
|
7
|
-
readdirSync,
|
|
8
|
-
renameSync,
|
|
9
|
-
rmSync,
|
|
10
|
-
writeFileSync,
|
|
11
|
-
} from 'node:fs'
|
|
12
|
-
import { dirname, join } from 'node:path'
|
|
13
|
-
import { fileURLToPath } from 'node:url'
|
|
14
|
-
|
|
15
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
16
|
-
|
|
17
|
-
for (const component of ['foundation', 'approvals']) {
|
|
18
|
-
const directory = join(root, 'dist', 'components', component)
|
|
19
|
-
const config = readFileSync(join(directory, 'convex.config.mjs'), 'utf8')
|
|
20
|
-
.replace(/\/\/# sourceMappingURL=.*\n?/, '')
|
|
21
|
-
writeFileSync(join(directory, 'convex.config.js'), config)
|
|
22
|
-
|
|
23
|
-
// Component implementations are discovered from schema.ts/schema.js only.
|
|
24
|
-
// Keeping schema.mjs beside schema.js is also invalid because Convex
|
|
25
|
-
// canonicalizes both extensions to the same module path.
|
|
26
|
-
const schema = readFileSync(join(directory, 'schema.mjs'), 'utf8').replace(
|
|
27
|
-
/\/\/# sourceMappingURL=.*\n?/,
|
|
28
|
-
'',
|
|
29
|
-
)
|
|
30
|
-
writeFileSync(join(directory, 'schema.js'), schema)
|
|
31
|
-
for (const filename of readdirSync(directory)) {
|
|
32
|
-
if (!filename.endsWith('.mjs')) continue
|
|
33
|
-
const path = join(directory, filename)
|
|
34
|
-
const source = readFileSync(path, 'utf8')
|
|
35
|
-
const bridged = source.replaceAll('./schema.mjs', './schema.js')
|
|
36
|
-
if (bridged !== source) writeFileSync(path, bridged)
|
|
37
|
-
}
|
|
38
|
-
renameSync(join(directory, 'schema.d.mts'), join(directory, 'schema.d.ts'))
|
|
39
|
-
const dataModelDeclaration = join(
|
|
40
|
-
directory,
|
|
41
|
-
'_generated',
|
|
42
|
-
'dataModel.d.mts',
|
|
43
|
-
)
|
|
44
|
-
writeFileSync(
|
|
45
|
-
dataModelDeclaration,
|
|
46
|
-
readFileSync(dataModelDeclaration, 'utf8').replace(
|
|
47
|
-
'../schema.mjs',
|
|
48
|
-
'../schema.js',
|
|
49
|
-
),
|
|
50
|
-
)
|
|
51
|
-
rmSync(join(directory, 'schema.mjs'))
|
|
52
|
-
rmSync(join(directory, 'schema.mjs.map'))
|
|
53
|
-
console.log(`bridged dist/components/${component}/convex.config.js`)
|
|
54
|
-
console.log(`bridged dist/components/${component}/schema.js`)
|
|
55
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Extracts one version's section from CHANGELOG.md (Keep a Changelog form).
|
|
2
|
-
// Usage: node scripts/extract-changelog.mjs 0.1.0 [outfile]
|
|
3
|
-
// Used by the release workflow for GitHub Release notes, and runnable
|
|
4
|
-
// locally BEFORE tagging to verify extraction (see the release plan).
|
|
5
|
-
import { readFileSync, writeFileSync } from 'node:fs'
|
|
6
|
-
|
|
7
|
-
const version = process.argv[2]
|
|
8
|
-
if (!version) {
|
|
9
|
-
console.error('usage: extract-changelog.mjs <version> [outfile]')
|
|
10
|
-
process.exit(1)
|
|
11
|
-
}
|
|
12
|
-
const changelog = readFileSync(new URL('../CHANGELOG.md', import.meta.url), 'utf8')
|
|
13
|
-
const pattern = new RegExp(
|
|
14
|
-
String.raw`^## \[${version.replace(/\./g, String.raw`\.`)}\][^\n]*\n([\s\S]*?)(?=^## \[|\Z)`,
|
|
15
|
-
'm',
|
|
16
|
-
)
|
|
17
|
-
const match = changelog.match(pattern)
|
|
18
|
-
if (!match) {
|
|
19
|
-
console.error(`CHANGELOG.md has no section for version ${version}`)
|
|
20
|
-
process.exit(1)
|
|
21
|
-
}
|
|
22
|
-
const notes = match[1].trim()
|
|
23
|
-
if (!notes) {
|
|
24
|
-
console.error(`CHANGELOG.md section for ${version} is empty`)
|
|
25
|
-
process.exit(1)
|
|
26
|
-
}
|
|
27
|
-
const outfile = process.argv[3]
|
|
28
|
-
if (outfile) writeFileSync(outfile, `${notes}\n`)
|
|
29
|
-
else process.stdout.write(`${notes}\n`)
|
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process'
|
|
2
|
-
import {
|
|
3
|
-
copyFileSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
mkdtempSync,
|
|
6
|
-
readFileSync,
|
|
7
|
-
rmSync,
|
|
8
|
-
writeFileSync,
|
|
9
|
-
} from 'node:fs'
|
|
10
|
-
import { tmpdir } from 'node:os'
|
|
11
|
-
import { join } from 'node:path'
|
|
12
|
-
|
|
13
|
-
const installer = process.argv[2] ?? 'bun'
|
|
14
|
-
if (installer !== 'bun' && installer !== 'npm') {
|
|
15
|
-
throw new Error('Usage: smoke-packed-components.mjs [bun|npm]')
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const root = join(import.meta.dirname, '..')
|
|
19
|
-
const temporaryRoot = mkdtempSync(join(tmpdir(), 'cvx-kit-smoke-'))
|
|
20
|
-
const fixture = join(temporaryRoot, 'fixture')
|
|
21
|
-
const packageVersion = JSON.parse(
|
|
22
|
-
readFileSync(join(root, 'package.json'), 'utf8'),
|
|
23
|
-
).version
|
|
24
|
-
const tarball = join(temporaryRoot, `cvx-kit-${packageVersion}.tgz`)
|
|
25
|
-
|
|
26
|
-
function run(command, args, cwd = fixture) {
|
|
27
|
-
return execFileSync(command, args, {
|
|
28
|
-
cwd,
|
|
29
|
-
encoding: 'utf8',
|
|
30
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
31
|
-
env: { ...process.env, CONVEX_AGENT_MODE: 'anonymous' },
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function runStreaming(command, args, cwd = fixture) {
|
|
36
|
-
execFileSync(command, args, {
|
|
37
|
-
cwd,
|
|
38
|
-
stdio: 'inherit',
|
|
39
|
-
env: { ...process.env, CONVEX_AGENT_MODE: 'anonymous' },
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function runConvex(...args) {
|
|
44
|
-
return run('node', [
|
|
45
|
-
join(fixture, 'node_modules', 'convex', 'bin', 'main.js'),
|
|
46
|
-
...args,
|
|
47
|
-
])
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function write(relativePath, contents) {
|
|
51
|
-
const path = join(fixture, relativePath)
|
|
52
|
-
writeFileSync(path, contents)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function step(label, callback) {
|
|
56
|
-
console.log(`smoke step: ${label}`)
|
|
57
|
-
return callback()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
run(
|
|
62
|
-
'bun',
|
|
63
|
-
['pm', 'pack', '--destination', temporaryRoot, '--ignore-scripts'],
|
|
64
|
-
root,
|
|
65
|
-
)
|
|
66
|
-
mkdirSync(join(fixture, 'convex'), { recursive: true })
|
|
67
|
-
write(
|
|
68
|
-
'package.json',
|
|
69
|
-
JSON.stringify(
|
|
70
|
-
{
|
|
71
|
-
private: true,
|
|
72
|
-
type: 'module',
|
|
73
|
-
dependencies: {
|
|
74
|
-
'cvx-kit': `file:${tarball}`,
|
|
75
|
-
convex: '1.43.0',
|
|
76
|
-
zod: '4.4.3',
|
|
77
|
-
},
|
|
78
|
-
devDependencies: {
|
|
79
|
-
'vite-plus': '0.2.8',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
null,
|
|
83
|
-
2,
|
|
84
|
-
),
|
|
85
|
-
)
|
|
86
|
-
write(
|
|
87
|
-
'packed-test-helper.test.ts',
|
|
88
|
-
`import { describe, expect, it } from 'vite-plus/test'
|
|
89
|
-
import { registerApprovals, registerFoundation } from 'cvx-kit/test'
|
|
90
|
-
|
|
91
|
-
describe('packed cvx-kit test helpers', () => {
|
|
92
|
-
it('registers both compiled component bundles and their discoverable schemas', () => {
|
|
93
|
-
const registrations = []
|
|
94
|
-
const testRuntime = {
|
|
95
|
-
registerComponent(name, schema, modules) {
|
|
96
|
-
registrations.push({ name, schema, modules })
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
registerApprovals(testRuntime)
|
|
101
|
-
registerFoundation(testRuntime)
|
|
102
|
-
|
|
103
|
-
expect(registrations.map(({ name }) => name)).toEqual(['approvals', 'foundation'])
|
|
104
|
-
expect(Object.keys(registrations[0].schema.tables).sort()).toEqual([
|
|
105
|
-
'approvalDecisions',
|
|
106
|
-
'approvalRuns',
|
|
107
|
-
])
|
|
108
|
-
expect(Object.keys(registrations[0].modules)).toContain(
|
|
109
|
-
'../dist/components/approvals/health.mjs',
|
|
110
|
-
)
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
`,
|
|
114
|
-
)
|
|
115
|
-
write(
|
|
116
|
-
'convex/convex.config.ts',
|
|
117
|
-
`import { defineApp } from 'convex/server'
|
|
118
|
-
import approvals from 'cvx-kit/components/approvals/convex.config'
|
|
119
|
-
import foundation from 'cvx-kit/components/foundation/convex.config'
|
|
120
|
-
|
|
121
|
-
const app = defineApp()
|
|
122
|
-
app.use(approvals)
|
|
123
|
-
app.use(foundation)
|
|
124
|
-
export default app
|
|
125
|
-
`,
|
|
126
|
-
)
|
|
127
|
-
write(
|
|
128
|
-
'convex/smoke.ts',
|
|
129
|
-
`import { approvalCallbackArgs } from 'cvx-kit/components/approvals'
|
|
130
|
-
import { createFunctionHandle, paginationOptsValidator } from 'convex/server'
|
|
131
|
-
import { v } from 'convex/values'
|
|
132
|
-
import { components, internal } from './_generated/api'
|
|
133
|
-
import { internalMutation, mutation, query } from './_generated/server'
|
|
134
|
-
|
|
135
|
-
export const applyDecision = internalMutation({
|
|
136
|
-
args: approvalCallbackArgs,
|
|
137
|
-
returns: v.null(),
|
|
138
|
-
handler: (_ctx, input) => {
|
|
139
|
-
if (input.decision?.evidence[0]?.stepKey !== 'releaseDecision') {
|
|
140
|
-
throw new Error('Missing callback decision step key')
|
|
141
|
-
}
|
|
142
|
-
return null
|
|
143
|
-
},
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
export const rejectDecision = internalMutation({
|
|
147
|
-
args: approvalCallbackArgs,
|
|
148
|
-
returns: v.null(),
|
|
149
|
-
handler: () => null,
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
export const health = query({
|
|
153
|
-
args: {},
|
|
154
|
-
returns: v.any(),
|
|
155
|
-
handler: (ctx) => ctx.runQuery(components.approvals.health.check, {}),
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
export const foundationHealth = query({
|
|
159
|
-
args: {},
|
|
160
|
-
returns: v.literal('ready'),
|
|
161
|
-
handler: (ctx) => ctx.runQuery(components.foundation.functions.status, {}),
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
export const start = mutation({
|
|
165
|
-
args: { resourceRef: v.optional(v.string()) },
|
|
166
|
-
returns: v.object({ runId: v.string() }),
|
|
167
|
-
handler: async (ctx, args) => {
|
|
168
|
-
const approvedHandle = await createFunctionHandle(internal.smoke.applyDecision)
|
|
169
|
-
const rejectedHandle = await createFunctionHandle(internal.smoke.rejectDecision)
|
|
170
|
-
return ctx.runMutation(components.approvals.requests.start, {
|
|
171
|
-
scopeRef: 'smoke',
|
|
172
|
-
resourceType: 'release',
|
|
173
|
-
resourceRef: args.resourceRef ?? 'packed-component',
|
|
174
|
-
requester: { actorRef: 'requester', capabilities: [] },
|
|
175
|
-
workflow: {
|
|
176
|
-
schemaVersion: 1,
|
|
177
|
-
compatibilityKey: 'packedSmoke',
|
|
178
|
-
name: 'packedSmoke',
|
|
179
|
-
steps: [
|
|
180
|
-
{
|
|
181
|
-
kind: 'decision',
|
|
182
|
-
key: 'releaseDecision',
|
|
183
|
-
decisions: ['approved', 'rejected'],
|
|
184
|
-
quorum: { kind: 'count', approvals: 1 },
|
|
185
|
-
makerChecker: true,
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
kind: 'branch',
|
|
189
|
-
key: 'routeDecision',
|
|
190
|
-
approvedStepKey: 'applyDecision',
|
|
191
|
-
rejectedStepKey: 'rejectDecision',
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
kind: 'mutation',
|
|
195
|
-
key: 'applyDecision',
|
|
196
|
-
callback: { kind: 'mutation', handle: approvedHandle, retry: false },
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
kind: 'mutation',
|
|
200
|
-
key: 'rejectDecision',
|
|
201
|
-
callback: { kind: 'mutation', handle: rejectedHandle, retry: false },
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
},
|
|
205
|
-
})
|
|
206
|
-
},
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
export const list = query({
|
|
210
|
-
args: {
|
|
211
|
-
paginationOpts: paginationOptsValidator,
|
|
212
|
-
state: v.optional(v.union(v.literal('pending'), v.literal('approved'))),
|
|
213
|
-
},
|
|
214
|
-
returns: v.any(),
|
|
215
|
-
handler: (ctx, args) => ctx.runQuery(components.approvals.requests.list, {
|
|
216
|
-
scopeRef: 'smoke',
|
|
217
|
-
...args,
|
|
218
|
-
}),
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
export const decide = mutation({
|
|
222
|
-
args: { runId: v.string() },
|
|
223
|
-
returns: v.any(),
|
|
224
|
-
handler: (ctx, args) => ctx.runMutation(components.approvals.decisions.decide, {
|
|
225
|
-
runId: args.runId,
|
|
226
|
-
decision: 'approved',
|
|
227
|
-
actor: { actorRef: 'approver', capabilities: [] },
|
|
228
|
-
compatibilityKey: 'packedSmoke',
|
|
229
|
-
}),
|
|
230
|
-
})
|
|
231
|
-
|
|
232
|
-
export const history = query({
|
|
233
|
-
args: { runId: v.string() },
|
|
234
|
-
returns: v.any(),
|
|
235
|
-
handler: (ctx, args) => ctx.runQuery(components.approvals.decisions.list, args),
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
export const status = query({
|
|
239
|
-
args: { runId: v.string() },
|
|
240
|
-
returns: v.any(),
|
|
241
|
-
handler: (ctx, args) => ctx.runQuery(components.approvals.requests.status, {
|
|
242
|
-
...args,
|
|
243
|
-
compatibilityKey: 'packedSmoke',
|
|
244
|
-
}),
|
|
245
|
-
})
|
|
246
|
-
`,
|
|
247
|
-
)
|
|
248
|
-
|
|
249
|
-
if (installer === 'bun') {
|
|
250
|
-
copyFileSync(join(root, 'bun.lock'), join(fixture, 'bun.lock'))
|
|
251
|
-
}
|
|
252
|
-
if (installer === 'bun')
|
|
253
|
-
step('install with bun', () =>
|
|
254
|
-
runStreaming('bun', ['install', '--ignore-scripts']),
|
|
255
|
-
)
|
|
256
|
-
else
|
|
257
|
-
step('install with npm', () =>
|
|
258
|
-
runStreaming('npm', ['install', '--ignore-scripts']),
|
|
259
|
-
)
|
|
260
|
-
if (installer === 'bun')
|
|
261
|
-
step('test helper with bun', () =>
|
|
262
|
-
runStreaming('bunx', ['vp', 'test', 'run', 'packed-test-helper.test.ts']),
|
|
263
|
-
)
|
|
264
|
-
else
|
|
265
|
-
step('test helper with npm', () =>
|
|
266
|
-
runStreaming('npx', ['vp', 'test', 'run', 'packed-test-helper.test.ts']),
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
step('deploy Convex fixture', () =>
|
|
270
|
-
runConvex('dev', '--once', '--typecheck=disable'),
|
|
271
|
-
)
|
|
272
|
-
const health = JSON.parse(runConvex('run', 'smoke:health'))
|
|
273
|
-
if (health.status !== 'ready' || health.schemaVersion !== 1) {
|
|
274
|
-
throw new Error(
|
|
275
|
-
`Unexpected approvals health response: ${JSON.stringify(health)}`,
|
|
276
|
-
)
|
|
277
|
-
}
|
|
278
|
-
const foundationHealth = JSON.parse(
|
|
279
|
-
runConvex('run', 'smoke:foundationHealth'),
|
|
280
|
-
)
|
|
281
|
-
if (foundationHealth !== 'ready') {
|
|
282
|
-
throw new Error(
|
|
283
|
-
`Unexpected foundation health response: ${JSON.stringify(foundationHealth)}`,
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
const { runId } = JSON.parse(runConvex('run', 'smoke:start'))
|
|
287
|
-
const { runId: secondRunId } = JSON.parse(
|
|
288
|
-
runConvex(
|
|
289
|
-
'run',
|
|
290
|
-
'smoke:start',
|
|
291
|
-
JSON.stringify({ resourceRef: 'packed-component-2' }),
|
|
292
|
-
),
|
|
293
|
-
)
|
|
294
|
-
const firstPage = JSON.parse(
|
|
295
|
-
runConvex(
|
|
296
|
-
'run',
|
|
297
|
-
'smoke:list',
|
|
298
|
-
JSON.stringify({
|
|
299
|
-
state: 'pending',
|
|
300
|
-
paginationOpts: { cursor: null, numItems: 1 },
|
|
301
|
-
}),
|
|
302
|
-
),
|
|
303
|
-
)
|
|
304
|
-
if (firstPage.page.length !== 1 || firstPage.page[0]._id !== secondRunId) {
|
|
305
|
-
throw new Error(`Unexpected first approval page: ${JSON.stringify(firstPage)}`)
|
|
306
|
-
}
|
|
307
|
-
const secondPage = JSON.parse(
|
|
308
|
-
runConvex(
|
|
309
|
-
'run',
|
|
310
|
-
'smoke:list',
|
|
311
|
-
JSON.stringify({
|
|
312
|
-
state: 'pending',
|
|
313
|
-
paginationOpts: {
|
|
314
|
-
cursor: firstPage.continueCursor,
|
|
315
|
-
numItems: 10,
|
|
316
|
-
},
|
|
317
|
-
}),
|
|
318
|
-
),
|
|
319
|
-
)
|
|
320
|
-
if (
|
|
321
|
-
secondPage.page.length !== 1 ||
|
|
322
|
-
secondPage.page[0]._id !== runId ||
|
|
323
|
-
secondPage.page[0]._id === firstPage.page[0]._id
|
|
324
|
-
) {
|
|
325
|
-
throw new Error(
|
|
326
|
-
`Unexpected continuation approval page: ${JSON.stringify(secondPage)}`,
|
|
327
|
-
)
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
let decision
|
|
331
|
-
let lastError
|
|
332
|
-
for (let attempt = 0; attempt < 10; attempt += 1) {
|
|
333
|
-
try {
|
|
334
|
-
decision = JSON.parse(
|
|
335
|
-
runConvex('run', 'smoke:decide', JSON.stringify({ runId })),
|
|
336
|
-
)
|
|
337
|
-
break
|
|
338
|
-
} catch (error) {
|
|
339
|
-
lastError = error
|
|
340
|
-
const currentStatus = JSON.parse(
|
|
341
|
-
runConvex('run', 'smoke:status', JSON.stringify({ runId })),
|
|
342
|
-
)
|
|
343
|
-
if (currentStatus.state === 'approved') {
|
|
344
|
-
decision = currentStatus
|
|
345
|
-
break
|
|
346
|
-
}
|
|
347
|
-
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
if (!decision) throw lastError
|
|
351
|
-
if (decision.state !== 'approved') {
|
|
352
|
-
throw new Error(`Unexpected decision response: ${JSON.stringify(decision)}`)
|
|
353
|
-
}
|
|
354
|
-
const history = JSON.parse(
|
|
355
|
-
runConvex('run', 'smoke:history', JSON.stringify({ runId })),
|
|
356
|
-
)
|
|
357
|
-
if (history.length !== 1 || history[0].decision !== 'approved') {
|
|
358
|
-
throw new Error(`Unexpected approval history: ${JSON.stringify(history)}`)
|
|
359
|
-
}
|
|
360
|
-
let status
|
|
361
|
-
for (let attempt = 0; attempt < 20; attempt += 1) {
|
|
362
|
-
status = JSON.parse(
|
|
363
|
-
runConvex('run', 'smoke:status', JSON.stringify({ runId })),
|
|
364
|
-
)
|
|
365
|
-
if (status.execution?.type === 'completed') break
|
|
366
|
-
await new Promise((resolve) => setTimeout(resolve, 500))
|
|
367
|
-
}
|
|
368
|
-
if (status?.execution?.type !== 'completed') {
|
|
369
|
-
throw new Error(`Approval callback did not complete: ${JSON.stringify(status)}`)
|
|
370
|
-
}
|
|
371
|
-
console.log(`packed component smoke passed with ${installer}`)
|
|
372
|
-
} finally {
|
|
373
|
-
rmSync(temporaryRoot, { recursive: true, force: true })
|
|
374
|
-
}
|