@mgamadeus/ddd-web 0.10.0 → 0.12.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.
@@ -4,7 +4,7 @@ import {
4
4
  consoleLogger,
5
5
  generateSdk,
6
6
  linkSkills
7
- } from "../chunk-PZ6AAETR.js";
7
+ } from "../chunk-J2RLNVKK.js";
8
8
 
9
9
  // src/codegen/cli.ts
10
10
  import { parseArgs } from "util";
@@ -203,10 +203,22 @@ interface ModelOptions {
203
203
  * `document`: a model is named and placed by its schema name as the document writes it — the last dot segment is
204
204
  * the model name, unchanged (`AIConversationMessage`, not `AiConversationMessage`), the segments before it are the
205
205
  * folders; a folder that happens to prefix the last segment never splits it (`…Messages.DelegationResults` stays
206
- * `DelegationResults` beside a `…Messages.Delegation` namespace). `rtk` (default): RTK codegen's names, placed by the
207
- * namespace registry.
206
+ * `DelegationResults` beside a `…Messages.Delegation` namespace). Every model file exports its own schema's name,
207
+ * also when another folder holds the same name (the path tells them apart; an importer aliases it). `rtk` (default):
208
+ * RTK codegen's names, placed by the namespace registry.
208
209
  */
209
210
  naming?: 'rtk' | 'document';
211
+ /**
212
+ * `all`: every schema an operation of the document reaches is written, also when `filterEndpoints` leaves its
213
+ * operations out of the api file (a models-only pass over all operations; their argument types are not written).
214
+ * `reachable` (default): the schemas of the generated endpoints.
215
+ */
216
+ scope?: 'reachable' | 'all';
217
+ /**
218
+ * `false`: no barrel `index.ts` in the models folder — the api file and the models import every model by its path.
219
+ * Default `true`. With `naming: 'document'` the barrel leaves out a model whose name another folder holds too.
220
+ */
221
+ index?: boolean;
210
222
  /**
211
223
  * `const`: an enum property becomes two exported objects in its model's file, `<Model><Property>` and
212
224
  * `<Model><Property>Strict` (`as const`), keyed by the enum values; the property is typed from the Strict object
@@ -214,6 +226,17 @@ interface ModelOptions {
214
226
  * union of RTK codegen. Needs `naming: 'document'` (the const names start with the document's model name).
215
227
  */
216
228
  enums?: 'union' | 'const';
229
+ /**
230
+ * With `enums: 'const'`: the property's type from the Strict object (`strict`, default: the union of the values) or
231
+ * from the plain object (`wide`: `(typeof X)[keyof typeof X]`, in effect `string`).
232
+ */
233
+ enumPropertyType?: 'strict' | 'wide';
234
+ /**
235
+ * `const` (with `enums: 'const'`): a string property named `objectType` (the class name a DDD write reads) gets a
236
+ * one-value enum const of its schema name with `\\` for `.` (`<Model>ObjectType` = `{ App_Domain_X: "App\\Domain\\X" }`)
237
+ * and is required. Default `document` (as declared).
238
+ */
239
+ objectType?: 'document' | 'const';
217
240
  /** `| null` beside a `$ref` whose property is nullable (RTK codegen drops it). Default `false`. */
218
241
  nullableRefs?: boolean;
219
242
  /**
@@ -11,7 +11,7 @@ import {
11
11
  loadSpec,
12
12
  silentLogger,
13
13
  validateSpec
14
- } from "../chunk-PZ6AAETR.js";
14
+ } from "../chunk-J2RLNVKK.js";
15
15
  export {
16
16
  SUPPORTED_CONTRACT,
17
17
  SdkGenerationError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgamadeus/ddd-web",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "TypeScript web client for backends built with mgamadeus/ddd, the DDD entity framework for Symfony and Doctrine (Composer/Packagist). Generates a typed RTK Query SDK from the backend's OpenAPI document, builds DDD QueryOptions (filters, orderBy, expand, select, paging) and handles JWT auth with token refresh.",
5
5
  "keywords": [
6
6
  "ddd",