@vxil/config 0.3.0 → 0.3.1

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 ADDED
@@ -0,0 +1,72 @@
1
+ # @vxil/config
2
+
3
+ `defineConfig()` — one typed source of truth for a whole Vxil backend.
4
+
5
+ A `vxil.config.ts` in your repo declares every feature you have enabled, your
6
+ CMS content model, your deployed functions, your secret *references* and your
7
+ seed data. `vxil push` compiles it to a manifest and applies it. Nothing in this
8
+ file is ever executed by Vxil — config is data.
9
+
10
+ ```bash
11
+ npm i -D @vxil/config
12
+ ```
13
+
14
+ > The CLI that reads this file is **`@vxil/cli`** (it installs the `vxil`
15
+ > command). The bare `vxil` package name is blocked on npm — never `npm i vxil`.
16
+
17
+ ## Use it
18
+
19
+ ```ts
20
+ // vxil.config.ts
21
+ import { defineConfig } from '@vxil/config';
22
+
23
+ export default defineConfig({
24
+ features: {
25
+ cms: { enabled: true },
26
+ files: { enabled: true },
27
+ notifications: { enabled: true, fromEmail: 'noreply@acme.com' },
28
+ },
29
+ cms: {
30
+ collections: {
31
+ posts: {
32
+ fields: {
33
+ title: { type: 'string', required: true, indexSlot: 's1' },
34
+ body: { type: 'text' },
35
+ },
36
+ },
37
+ },
38
+ },
39
+ });
40
+ ```
41
+
42
+ ```bash
43
+ npx @vxil/cli plan # dry-run diff against the live tenant
44
+ npx @vxil/cli push # apply, idempotent
45
+ npx @vxil/cli gen # emit the per-tenant typed client
46
+ ```
47
+
48
+ ## What it gives you
49
+
50
+ - **Real autocomplete.** `defineConfig` is a typed identity function: it returns
51
+ its argument verbatim, and the types come from
52
+ [`@vxil/feature-configs`](https://www.npmjs.com/package/@vxil/feature-configs),
53
+ the same schemas the platform validates against. A knob that does not exist is
54
+ a compile error in your editor, not a 422 at push time.
55
+ - **The whole backend in one file.** Features, the CMS content model (collections,
56
+ field types, index slots, uniqueness, lifecycle hook expressions), functions,
57
+ secret references and seed data — one declarative object.
58
+ - **Secrets by reference, never by value.** A config carries `secret:<name>`; the
59
+ value is set once with `vxil secrets set` and never lands in your repo.
60
+ - **Versioned, concurrent-safe applies.** Every push is an If-Match write against
61
+ an immutable config version, so two people (or a person and CI) cannot silently
62
+ clobber each other — and `vxil versions` / `vxil rollback` undo one.
63
+
64
+ ## Related
65
+
66
+ - [`@vxil/cli`](https://www.npmjs.com/package/@vxil/cli) — the `vxil` command.
67
+ - [`@vxil/feature-configs`](https://www.npmjs.com/package/@vxil/feature-configs) — the feature schemas and their `Static<>` types.
68
+ - [`@vxil/sdk`](https://www.npmjs.com/package/@vxil/sdk) — the typed runtime client.
69
+
70
+ Docs: [vxil.com](https://vxil.com) · Dashboard: [vxil.com/dashboard](https://vxil.com/dashboard)
71
+
72
+ MIT © techmaker.io
package/dist/index.d.ts CHANGED
@@ -76,7 +76,7 @@ export type CoversFieldAttrs<Covered extends FieldAttrName> = [
76
76
  export interface CollectionDef {
77
77
  singular?: string;
78
78
  fields: Record<string, FieldDef>;
79
- /** End-user owner-scoping (docs/end-user-principals-design.md §5.1): names an
79
+ /** End-user owner-scoping (https://vxil.com/docs/guide/09-security-and-multitenancy): names an
80
80
  * existing `string` field on this collection that holds the owner (end-user)
81
81
  * id. When set, the cms worker auto-scopes owned reads/writes to the VERIFIED
82
82
  * end-user principal in end-user mode (default-deny) — and is a no-op in
@@ -138,9 +138,9 @@ export interface FunctionDef {
138
138
  * functions:write, secrets:write rejected; payments:write / notifications:send /
139
139
  * users:* allowed as owner-granted business scopes). */
140
140
  scopes?: string[];
141
- /** tenant_secrets refs injected under KEK_FUNCTIONS (productization). */
141
+ /** Names of tenant secrets injected into the function at invoke time. */
142
142
  secrets?: string[];
143
- /** Outbound-Worker host allowlist (deny-by-default egress guard). */
143
+ /** Outbound host allowlist (deny-by-default egress guard). */
144
144
  egressAllow?: string[];
145
145
  limits?: {
146
146
  cpuMs?: number;
@@ -171,7 +171,7 @@ export interface SeedSpec {
171
171
  email?: string;
172
172
  }[];
173
173
  }
174
- /** The released API majors (docs/feature-versioning.md §3), a CLOSED union —
174
+ /** The released API majors (see https://vxil.com/docs/guide/12-going-to-production), a CLOSED union —
175
175
  * `'v1'` is the only released major, so `apiVersion: 'v2'` is a COMPILE error
176
176
  * until a v2 GAs. `defineConfig` also validates it at runtime against
177
177
  * `RELEASED_API_VERSIONS`. */
@@ -183,7 +183,7 @@ export declare const RELEASED_API_VERSIONS: readonly ApiVersion[];
183
183
  export interface VxilConfig {
184
184
  /** target environment label; resolved to a baseUrl by `vxil link` / `--env`. */
185
185
  env?: string;
186
- /** Pin the API major the CLI targets (default `'v1'`, docs/feature-versioning.md).
186
+ /** Pin the API major the CLI targets (default `'v1'`; see https://vxil.com/docs/guide/12-going-to-production).
187
187
  * Path-major, per-platform: a breaking change ships as a new major on a new
188
188
  * path with a ≥6-month deprecation window. `VXIL_API_VERSION` overrides this
189
189
  * for a one-off invocation. */
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export function defineConfig(c) {
9
9
  if (c.apiVersion !== undefined && !RELEASED_API_VERSIONS.includes(c.apiVersion)) {
10
10
  throw new Error(`vxil.config: apiVersion '${String(c.apiVersion)}' is not a released API major ` +
11
11
  `(released: ${RELEASED_API_VERSIONS.map((v) => `'${v}'`).join(', ')}). ` +
12
- 'A new major ships as a new path with its own deprecation window — see docs/feature-versioning.md.');
12
+ 'A new major ships as a new path with its own deprecation window — see https://vxil.com/docs/guide/12-going-to-production.');
13
13
  }
14
14
  return c;
15
15
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vxil/config",
3
- "version": "0.3.0",
4
- "description": "defineConfig() — one typed source of truth for a whole vxil backend (features + CMS schema + functions + secret refs + seed). INTERNAL workspace package: bundled into the published `vxil` package's `vxil/config` subpath, not published separately.",
3
+ "version": "0.3.1",
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",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "src"
23
23
  ],
24
24
  "dependencies": {
25
- "@vxil/feature-configs": "0.3.0"
25
+ "@vxil/feature-configs": "0.3.1"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
package/src/index.test.ts CHANGED
@@ -23,6 +23,6 @@ describe('defineConfig', () => {
23
23
  expect(() => defineConfig({ apiVersion: 'v2' as 'v1', features: {} }))
24
24
  .toThrow(/apiVersion 'v2' is not a released API major/);
25
25
  expect(() => defineConfig({ apiVersion: 'latest' as 'v1' }))
26
- .toThrow(/feature-versioning\.md/);
26
+ .toThrow(/docs\/guide\/12-going-to-production/);
27
27
  });
28
28
  });
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  // §7.3-consistent — config is DATA; the only tenant CODE that crosses into vxil
8
8
  // is (a) the Lane-A hook expressions (a closed sandbox) and (b) the functions/
9
9
  // sources (the paid, opt-in, egress-guarded crossing). Everything here is
10
- // declarative. See docs/vxil-cli-sdk-code-experience-design.md §3.
10
+ // declarative. See https://vxil.com/docs/guide/05-typed-sdk-and-cli.
11
11
  import type {
12
12
  NotificationsConfig, JobsConfig, AuthConfig, RateLimitsConfig, FilesConfig,
13
13
  WebhooksConfig, CommentsConfig, CmsConfig, McpConfig, RealtimeConfig,
@@ -98,7 +98,7 @@ export type CoversFieldAttrs<Covered extends FieldAttrName> =
98
98
  export interface CollectionDef {
99
99
  singular?: string;
100
100
  fields: Record<string, FieldDef>;
101
- /** End-user owner-scoping (docs/end-user-principals-design.md §5.1): names an
101
+ /** End-user owner-scoping (https://vxil.com/docs/guide/09-security-and-multitenancy): names an
102
102
  * existing `string` field on this collection that holds the owner (end-user)
103
103
  * id. When set, the cms worker auto-scopes owned reads/writes to the VERIFIED
104
104
  * end-user principal in end-user mode (default-deny) — and is a no-op in
@@ -150,9 +150,9 @@ export interface FunctionDef {
150
150
  * functions:write, secrets:write rejected; payments:write / notifications:send /
151
151
  * users:* allowed as owner-granted business scopes). */
152
152
  scopes?: string[];
153
- /** tenant_secrets refs injected under KEK_FUNCTIONS (productization). */
153
+ /** Names of tenant secrets injected into the function at invoke time. */
154
154
  secrets?: string[];
155
- /** Outbound-Worker host allowlist (deny-by-default egress guard). */
155
+ /** Outbound host allowlist (deny-by-default egress guard). */
156
156
  egressAllow?: string[];
157
157
  limits?: { cpuMs?: number; timeoutMs?: number; memoryMb?: number };
158
158
  enabled?: boolean;
@@ -173,7 +173,7 @@ export interface SeedSpec {
173
173
  users?: { id: string; email?: string }[];
174
174
  }
175
175
 
176
- /** The released API majors (docs/feature-versioning.md §3), a CLOSED union —
176
+ /** The released API majors (see https://vxil.com/docs/guide/12-going-to-production), a CLOSED union —
177
177
  * `'v1'` is the only released major, so `apiVersion: 'v2'` is a COMPILE error
178
178
  * until a v2 GAs. `defineConfig` also validates it at runtime against
179
179
  * `RELEASED_API_VERSIONS`. */
@@ -188,7 +188,7 @@ export interface VxilConfig {
188
188
  /** target environment label; resolved to a baseUrl by `vxil link` / `--env`. */
189
189
  env?: string;
190
190
 
191
- /** Pin the API major the CLI targets (default `'v1'`, docs/feature-versioning.md).
191
+ /** Pin the API major the CLI targets (default `'v1'`; see https://vxil.com/docs/guide/12-going-to-production).
192
192
  * Path-major, per-platform: a breaking change ships as a new major on a new
193
193
  * path with a ≥6-month deprecation window. `VXIL_API_VERSION` overrides this
194
194
  * for a one-off invocation. */
@@ -245,7 +245,7 @@ export function defineConfig(c: VxilConfig): VxilConfig {
245
245
  throw new Error(
246
246
  `vxil.config: apiVersion '${String(c.apiVersion)}' is not a released API major ` +
247
247
  `(released: ${RELEASED_API_VERSIONS.map((v) => `'${v}'`).join(', ')}). ` +
248
- 'A new major ships as a new path with its own deprecation window — see docs/feature-versioning.md.',
248
+ 'A new major ships as a new path with its own deprecation window — see https://vxil.com/docs/guide/12-going-to-production.',
249
249
  );
250
250
  }
251
251
  return c;