@t0.labs/daxta 0.4.7 → 0.4.8

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 CHANGED
@@ -49,13 +49,14 @@ pnpm dlx @t0.labs/daxta install
49
49
  npx @t0.labs/daxta install
50
50
  ```
51
51
 
52
- Kurulum sırasında sorulur: Nest entry, test script, docs folder order (`role-resource` / `resource-role`), `{id}` fold, example label stili.
52
+ Kurulum sırasında sorulur: Nest entry, test script, docs folder order (`role-resource` / `resource-role`), `{id}` fold, example label stili.
53
+ `DAXTA_DOCS=true` otomatik `.env`’e yazılır (yoksa oluşturulur).
53
54
 
54
55
  Sonra:
55
56
 
56
57
  ```bash
57
- pnpm run test:integration # test bitince Docs ready
58
- DAXTA_DOCS=true pnpm start:dev # app portunda /docs
58
+ pnpm run test:integration # test bitince Docs ready
59
+ pnpm start:dev # app portunda /docs (DAXTA_DOCS already set)
59
60
  ```
60
61
 
61
62
  ```ts
@@ -101,7 +102,7 @@ Required vs optional DTO fields
101
102
  Same idea as Nest Swagger’s “don’t call `setup` in prod”:
102
103
 
103
104
  ```bash
104
- DAXTA_DOCS=true # mount /docs
105
+ DAXTA_DOCS=true # mount /docs (install writes this)
105
106
  DAXTA_DOCS=false # no-op (must still be set)
106
107
  # unset / empty → throws — make the choice explicit
107
108
  ```
@@ -129,10 +130,39 @@ Company-wide choices (saved in `daxta.config.ts`):
129
130
  | --- | --- |
130
131
  | `treeLayout` | `role-resource` (`v1 › admin › baskets`) or `resource-role` (`v1 › baskets › admin`) — sidebar **and** OpenAPI export path keys |
131
132
  | `treeSkipParams` | Don’t nest folders under `{id}` (recommended `true`) |
133
+ | `envPresets` | Multi-base Try-it presets (`local` / `staging` / `production` + optional variables) |
132
134
  | `exampleLabelStyle` | OpenAPI example labels: `status-title-case` / `status-case` / `full` |
133
135
 
134
136
  OpenAPI export remaps path keys to match the sidebar tree. Real URLs are kept on `x-daxta-url-path` when the layout differs (e.g. `/v1/admin/baskets` → export `/v1/baskets/admin`).
135
137
 
138
+ ### Try-it env / headers (persisted)
139
+
140
+ Env **presets** (multi-base) + header groups are editable in the docs UI.
141
+
142
+ Define company defaults in `daxta.config.ts`:
143
+
144
+ ```ts
145
+ envPresets: {
146
+ local: { baseUrl: 'http://localhost:3000' },
147
+ staging: { baseUrl: 'https://api.staging.example.com' },
148
+ production: { baseUrl: 'https://api.example.com', variables: { apiKey: '' } },
149
+ },
150
+ ```
151
+
152
+ - Docs picker shows each preset with its own `baseUrl` + variables + header groups
153
+ - Serving the app only auto-fills **local** (or sole) preset — staging/production URLs are not overwritten
154
+ - First `daxta build` seeds `daxta/viewer-store.json` from `envPresets` if the file is missing
155
+ - Runtime edits still persist via `GET/PUT {docsPath}/env.json`
156
+
157
+ Sidebar: expand the chevron on an endpoint to list recorded examples underneath; click one to open it in the workbench.
158
+
159
+ Export: the download button opens a picker (All / None / Success only) so the OpenAPI JSON only includes the selected examples.
160
+
161
+ For Postman-friendly fills, export can bake the **active Try-it env + header group** into the OpenAPI (`servers` + header `example`s). Two modes:
162
+
163
+ - **Resolved values** — literals in the OpenAPI (import with parameter generation = Example)
164
+ - **Postman `{{variables}}`** — placeholders in OpenAPI + a companion `.postman_environment.json`
165
+
136
166
  Example label (`status-title-case`):
137
167
 
138
168
  ```text