cvx-kit 0.1.10 → 0.1.12

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -0
  3. package/dist/contracts.d.mts +2 -1
  4. package/dist/contracts.mjs +1 -1
  5. package/dist/effect.d.mts +3 -2
  6. package/dist/effect.mjs +1 -1
  7. package/dist/index.d.mts +2 -1
  8. package/dist/index.mjs +1 -1
  9. package/dist/modules/contracts/binding.d.mts +14 -0
  10. package/dist/modules/contracts/binding.mjs +2 -0
  11. package/dist/modules/contracts/binding.mjs.map +1 -0
  12. package/dist/modules/contracts/domain.d.mts +59 -0
  13. package/dist/modules/contracts/domain.mjs +2 -0
  14. package/dist/modules/contracts/domain.mjs.map +1 -0
  15. package/dist/modules/effect/api-runtime.mjs +1 -1
  16. package/dist/modules/effect/auth.d.mts +43 -0
  17. package/dist/modules/effect/auth.mjs +2 -0
  18. package/dist/modules/effect/auth.mjs.map +1 -0
  19. package/dist/modules/effect/client.d.mts +1 -1
  20. package/dist/modules/effect/client.mjs +1 -1
  21. package/dist/modules/effect/command.d.mts +35 -1
  22. package/dist/modules/effect/command.mjs +1 -1
  23. package/dist/modules/effect/command.mjs.map +1 -1
  24. package/dist/modules/effect/crud.d.mts +6 -0
  25. package/dist/modules/effect/crud.mjs +1 -1
  26. package/dist/modules/effect/domain.d.mts +44 -0
  27. package/dist/modules/effect/domain.mjs +2 -0
  28. package/dist/modules/effect/domain.mjs.map +1 -0
  29. package/dist/modules/effect/operation.d.mts +4 -3
  30. package/dist/modules/effect/operation.mjs.map +1 -1
  31. package/dist/modules/effect/query.d.mts +23 -8
  32. package/dist/modules/effect/query.mjs +1 -1
  33. package/dist/modules/effect/query.mjs.map +1 -1
  34. package/dist/modules/effect/workflow.mjs +1 -1
  35. package/dist/modules/foundation/foundation.d.mts +108 -0
  36. package/dist/modules/foundation/foundation.mjs +2 -0
  37. package/dist/modules/foundation/foundation.mjs.map +1 -0
  38. package/dist/modules/foundation/operation.d.mts +121 -0
  39. package/dist/modules/foundation/operation.mjs +2 -0
  40. package/dist/modules/foundation/operation.mjs.map +1 -0
  41. package/dist/oxlint/ownership.mjs +1 -1
  42. package/dist/oxlint/ownership.mjs.map +1 -1
  43. package/dist/oxlint/reserved-files.d.mts +6 -0
  44. package/dist/oxlint/reserved-files.mjs +2 -0
  45. package/dist/oxlint/reserved-files.mjs.map +1 -0
  46. package/dist/oxlint.d.mts +1 -1
  47. package/dist/oxlint.mjs +1 -1
  48. package/dist/oxlint.mjs.map +1 -1
  49. package/docs/auth.md +131 -1
  50. package/docs/commands-legacy.md +3 -1
  51. package/docs/conventions.md +7 -3
  52. package/docs/domain-contracts.md +115 -0
  53. package/docs/effect.md +10 -2
  54. package/docs/llms.md +41 -20
  55. package/docs/oxlint.md +4 -0
  56. package/package.json +1 -1
  57. package/scripts/test-packed-auth.mjs +5 -1
  58. package/scripts/test-packed-effect.mjs +13 -0
  59. package/scripts/test-packed-oxlint.mjs +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cvx-kit",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Reusable Convex application kit: foundation kernels, approvals component, zod table boundaries, WorkOS-backed auth function constructors, and audited command protocol.",
5
5
  "keywords": [
6
6
  "component",
@@ -45,6 +45,10 @@ try {
45
45
  join(fixture, 'auth.ts'),
46
46
  readFileSync(join(root, 'test/auth-native-context-types.ts')),
47
47
  )
48
+ writeFileSync(
49
+ join(fixture, 'shared-auth.ts'),
50
+ readFileSync(join(root, 'test/effect-auth-types.ts')),
51
+ )
48
52
  writeFileSync(
49
53
  join(fixture, 'tsconfig.json'),
50
54
  JSON.stringify({
@@ -56,7 +60,7 @@ try {
56
60
  module: 'ESNext',
57
61
  moduleResolution: 'bundler',
58
62
  },
59
- include: ['auth.ts'],
63
+ include: ['auth.ts', 'shared-auth.ts'],
60
64
  }),
61
65
  )
62
66
  run('bun', ['install', '--ignore-scripts'], fixture)
@@ -54,6 +54,7 @@ function run(command, args, cwd) {
54
54
  function copyPublicTypeFixture(fixture, filename, publicImport) {
55
55
  const source = readFileSync(join(root, 'test', filename), 'utf8')
56
56
  .replaceAll(publicImport, 'cvx-kit/effect')
57
+ .replaceAll('../src/index', 'cvx-kit')
57
58
  .replaceAll('../src/errors', 'cvx-kit/errors')
58
59
  .replaceAll('../src/contracts', 'cvx-kit/contracts')
59
60
  .replaceAll('../src/idempotency', 'cvx-kit/idempotency')
@@ -126,6 +127,8 @@ function copyExtraTypeFixtures(fixture, paths) {
126
127
  }
127
128
 
128
129
  const legacyRuntime = `
130
+ import { createFoundation } from 'cvx-kit'
131
+ import { defineDomainContract } from 'cvx-kit/contracts'
129
132
  import { strict as assert } from 'node:assert'
130
133
  import { createRequire } from 'node:module'
131
134
  import { Foundation } from 'cvx-kit/components/foundation'
@@ -210,6 +213,10 @@ assert.equal(replay.kind, 'replay')
210
213
  assert.deepEqual(await decodeContract(idempotency.replayResult, replay.result), { value: 'final!' })
211
214
  assert.equal(authorizations, 2)
212
215
  assert.equal(ledger.length, 1)
216
+ const domain = defineDomainContract({ commands: { save: { input: z.string().transform(Number), result: z.number().transform(count => ({ count })), classification: 'business' } } })
217
+ const regular = createFoundation({ observability: { enabled: false, classifyError: () => ({ outcome: 'failed', errorCode: 'FAILED' }) }, writeAudit: () => undefined })
218
+ const domainCommands = regular.Command({ contract: domain, context: host => host, audit: () => null, operations: ({ command }) => ({ save: command.save({ handler: value => value + 1 }) }) })
219
+ assert.deepEqual(await domainCommands.exec('save', '2', {}), { count: 3 })
213
220
  `
214
221
 
215
222
  const legacyTypes = `
@@ -387,6 +394,9 @@ try {
387
394
  writeFileSync(join(fixture, 'legacy-types.ts'), legacyTypes)
388
395
  const typeFiles = [
389
396
  'legacy-types.ts',
397
+ copyPublicTypeFixture(fixture, 'domain-contract-types.ts', '../src/effect'),
398
+ copyPublicTypeFixture(fixture, 'domain-foundation-types.ts', '../src/effect'),
399
+ copyPublicTypeFixture(fixture, 'domain-contract-guide-types.ts', '../src/effect'),
390
400
  copyPublicTypeFixture(fixture, 'operation-neutral-types.ts', '../src/effect'),
391
401
  copyPublicTypeFixture(fixture, 'operation-agent-tools-types.ts', '../src/effect'),
392
402
  ]
@@ -394,8 +404,11 @@ try {
394
404
  if (withEffect) {
395
405
  for (const filename of [
396
406
  'effect-foundation-types.ts',
407
+ 'domain-effect-types.ts',
408
+ 'domain-exactness-types.ts',
397
409
  'effect-api-types.ts',
398
410
  'effect-api-zod-types.ts',
411
+ 'effect-auth-types.ts',
399
412
  'effect-registry-review-types.ts',
400
413
  'operation-contract-types.ts',
401
414
  'effect-schema-types.ts',
@@ -9,7 +9,7 @@ const root = join(import.meta.dirname, '..')
9
9
  const temporary = mkdtempSync(join(tmpdir(), 'cvx-kit-oxlint-'))
10
10
  const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
11
11
  const ruleNames = Object.keys(rules)
12
- assert.equal(ruleNames.length, 20)
12
+ assert.equal(ruleNames.length, 21)
13
13
 
14
14
  try {
15
15
  run('bun', ['pm', 'pack', '--destination', temporary, '--ignore-scripts'], root)