@vxil/config 0.8.1 → 0.8.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxil/config",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Typed vxil.config.ts authoring for the vxil backend platform — defineConfig, feature and cms field definitions (published for @vxil/cli).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://vxil.com",
@@ -19,7 +19,8 @@
19
19
  },
20
20
  "files": [
21
21
  "dist",
22
- "src"
22
+ "src",
23
+ "!src/**/*.test.ts"
23
24
  ],
24
25
  "dependencies": {
25
26
  "@vxil/feature-configs": "0.7.1"
@@ -1,24 +0,0 @@
1
- // A `vxil.config.ts` may write any SUBSET of a nested feature bag; the server
2
- // defaults the rest. This file is COMPILED by the package typecheck, so a
3
- // regression to a shallow Partial fails `tsc`, not just a runtime assertion
4
- // (the 2026-09-19 cvskit dry-run found the guide's own skeleton red under tsc).
5
- import { describe, expect, it } from 'vitest';
6
- import type { DeepPartial, VxilConfig } from './index.js';
7
-
8
- const partial: VxilConfig = {
9
- features: {
10
- auth: { otp: { enabled: true }, anonymous: { enabled: true } },
11
- files: { ttl: { enabled: true, defaultExpiresInSeconds: 2592000 } },
12
- ai: { defaults: { model: 'x' } },
13
- cms: { limits: { maxItemsPerCollection: 5 } },
14
- },
15
- };
16
-
17
- describe('DeepPartial', () => {
18
- it('accepts partially-written nested bags (compile-time) and leaves arrays alone', () => {
19
- type T = DeepPartial<{ a: { b: number; c: string }; list: string[] }>;
20
- const v: T = { a: { b: 1 }, list: ['x'] };
21
- expect(v.a?.b).toBe(1);
22
- expect(partial.features?.auth?.otp?.enabled).toBe(true);
23
- });
24
- });
package/src/index.test.ts DELETED
@@ -1,52 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import {
3
- assertIndexedFields, CMS_INDEXED_FIELD_BUDGET, collection, defineConfig, field, RELEASED_API_VERSIONS,
4
- } from './index.js';
5
-
6
- describe('defineConfig', () => {
7
- it('is an identity function (returns its argument verbatim)', () => {
8
- const cfg = { features: { cms: {} } };
9
- expect(defineConfig(cfg)).toBe(cfg);
10
- });
11
-
12
- it('accepts the released apiVersion', () => {
13
- const cfg = defineConfig({ apiVersion: 'v1', features: {} });
14
- expect(cfg.apiVersion).toBe('v1');
15
- expect(RELEASED_API_VERSIONS).toEqual(['v1']);
16
- });
17
-
18
- it('accepts a config without apiVersion (optional; defaults to v1 at the CLI)', () => {
19
- expect(() => defineConfig({ features: {} })).not.toThrow();
20
- });
21
-
22
- it('throws on an unreleased apiVersion (fail-fast, actionable message)', () => {
23
- // A JS caller (no compile gate) or a stale generated value must be rejected
24
- // at load, not silently 404 every request.
25
- expect(() => defineConfig({ apiVersion: 'v2' as 'v1', features: {} }))
26
- .toThrow(/apiVersion 'v2' is not a released API major/);
27
- expect(() => defineConfig({ apiVersion: 'latest' as 'v1' }))
28
- .toThrow(/docs\/guide\/12-going-to-production/);
29
- });
30
- });
31
-
32
- describe('indexed fields (PERF-26b) — define-time checks', () => {
33
- it('accepts up to four unslotted indexed fields', () => {
34
- const c = collection({ fields: {
35
- a: field('string', { indexed: true }), b: field('int', { indexed: true }),
36
- c: field('bool', { indexed: true }), d: field('string', { indexed: true }),
37
- e: field('string', { indexSlot: 's1' }),
38
- } });
39
- expect(Object.keys(c.fields)).toHaveLength(5);
40
- expect(CMS_INDEXED_FIELD_BUDGET).toBe(4);
41
- });
42
-
43
- it('refuses a fifth, indexed + indexSlot, and a computed indexed field', () => {
44
- expect(() => defineConfig({ cms: { collections: { posts: { fields: Object.fromEntries(
45
- ['a', 'b', 'c', 'd', 'e'].map((k) => [k, field('string', { indexed: true })]),
46
- ) } } } })).toThrow(/at most 4 per collection/);
47
- expect(() => collection({ fields: { a: field('string', { indexed: true, indexSlot: 's1' }) } }))
48
- .toThrow(/already indexes equality/);
49
- expect(() => assertIndexedFields('posts', { fields: { a: field('string', { indexed: true, computed: true }) } }))
50
- .toThrow(/computed/);
51
- });
52
- });