@mgamadeus/ddd-web 0.9.0 → 0.11.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.
- package/.claude/skills/ddd-web-specialist/references/consumer.md +2 -1
- package/CHANGELOG.md +32 -0
- package/dist/{chunk-TPFRUK5O.js → chunk-XXMTSCOZ.js} +142 -25
- package/dist/chunk-XXMTSCOZ.js.map +1 -0
- package/dist/codegen/cli.js +1 -1
- package/dist/codegen/index.d.ts +57 -4
- package/dist/codegen/index.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-TPFRUK5O.js.map +0 -1
package/dist/codegen/cli.js
CHANGED
package/dist/codegen/index.d.ts
CHANGED
|
@@ -166,16 +166,53 @@ interface OpenApiDocument {
|
|
|
166
166
|
[key: string]: unknown;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
/** One operation an endpoint name is chosen for. */
|
|
170
|
+
interface EndpointNamingOperation {
|
|
171
|
+
method: HttpMethod;
|
|
172
|
+
/** OpenAPI path, e.g. `/api/client/ai/conversations/{locationId}/list`. */
|
|
173
|
+
path: string;
|
|
174
|
+
operation: OpenApiOperation;
|
|
175
|
+
}
|
|
176
|
+
/** How the generator names the endpoints and their body argument. Every option is off by default. */
|
|
177
|
+
interface EndpointOptions {
|
|
178
|
+
/**
|
|
179
|
+
* The endpoint names (and so the hook names):
|
|
180
|
+
* - `rtk` (default): RTK codegen's names (the operation's `operationId`, else verb and path).
|
|
181
|
+
* - `path`: a pure function of verb and path — the prefix (`stripPathPrefix`) is cut; every `{param}/` is cut out
|
|
182
|
+
* and only the LAST one cut is kept; the rest is split on `/ _ - .`, each piece capitalised, the verb in front,
|
|
183
|
+
* the first letter lowered; `By<LastInner>` is appended; a trailing `{param}` becomes `By<Param>` where it
|
|
184
|
+
* stands. `POST /api/client/ai/conversations/{locationId}/purposed/{purposeName}` →
|
|
185
|
+
* `postClientAiConversationsPurposedByPurposeNameByLocationId`.
|
|
186
|
+
* - a function returning the name (a JavaScript identifier) per operation.
|
|
187
|
+
*/
|
|
188
|
+
naming?: 'rtk' | 'path' | ((operation: EndpointNamingOperation) => string);
|
|
189
|
+
/** The prefix `naming: 'path'` cuts from a path. Default `/^\/(?:app\/)?api(?=\/)/` (`/api` or `/app/api`). */
|
|
190
|
+
stripPathPrefix?: string | RegExp;
|
|
191
|
+
/**
|
|
192
|
+
* `requestBody`: the request body is the argument's `requestBody` property, whatever its schema is called (a DTO
|
|
193
|
+
* class that moves keeps the name). `rtk` (default): the camel-cased schema name.
|
|
194
|
+
*/
|
|
195
|
+
bodyArg?: 'rtk' | 'requestBody';
|
|
196
|
+
}
|
|
197
|
+
/** The endpoint name of `naming: 'path'` (see {@link EndpointOptions.naming}). */
|
|
198
|
+
declare function buildEndpointNameFromPath(method: string, path: string, stripPathPrefix?: string | RegExp): string;
|
|
199
|
+
|
|
169
200
|
/** How the generator writes the models of the document's component schemas. Every option is off by default. */
|
|
170
201
|
interface ModelOptions {
|
|
171
202
|
/**
|
|
172
203
|
* `document`: a model is named and placed by its schema name as the document writes it — the last dot segment is
|
|
173
204
|
* the model name, unchanged (`AIConversationMessage`, not `AiConversationMessage`), the segments before it are the
|
|
174
205
|
* folders; a folder that happens to prefix the last segment never splits it (`…Messages.DelegationResults` stays
|
|
175
|
-
* `DelegationResults` beside a `…Messages.Delegation` namespace).
|
|
176
|
-
*
|
|
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.
|
|
177
209
|
*/
|
|
178
210
|
naming?: 'rtk' | 'document';
|
|
211
|
+
/**
|
|
212
|
+
* `false`: no barrel `index.ts` in the models folder — the api file and the models import every model by its path.
|
|
213
|
+
* Default `true`. With `naming: 'document'` the barrel leaves out a model whose name another folder holds too.
|
|
214
|
+
*/
|
|
215
|
+
index?: boolean;
|
|
179
216
|
/**
|
|
180
217
|
* `const`: an enum property becomes two exported objects in its model's file, `<Model><Property>` and
|
|
181
218
|
* `<Model><Property>Strict` (`as const`), keyed by the enum values; the property is typed from the Strict object
|
|
@@ -183,6 +220,17 @@ interface ModelOptions {
|
|
|
183
220
|
* union of RTK codegen. Needs `naming: 'document'` (the const names start with the document's model name).
|
|
184
221
|
*/
|
|
185
222
|
enums?: 'union' | 'const';
|
|
223
|
+
/**
|
|
224
|
+
* With `enums: 'const'`: the property's type from the Strict object (`strict`, default: the union of the values) or
|
|
225
|
+
* from the plain object (`wide`: `(typeof X)[keyof typeof X]`, in effect `string`).
|
|
226
|
+
*/
|
|
227
|
+
enumPropertyType?: 'strict' | 'wide';
|
|
228
|
+
/**
|
|
229
|
+
* `const` (with `enums: 'const'`): a string property named `objectType` (the class name a DDD write reads) gets a
|
|
230
|
+
* one-value enum const of its schema name with `\\` for `.` (`<Model>ObjectType` = `{ App_Domain_X: "App\\Domain\\X" }`)
|
|
231
|
+
* and is required. Default `document` (as declared).
|
|
232
|
+
*/
|
|
233
|
+
objectType?: 'document' | 'const';
|
|
186
234
|
/** `| null` beside a `$ref` whose property is nullable (RTK codegen drops it). Default `false`. */
|
|
187
235
|
nullableRefs?: boolean;
|
|
188
236
|
/**
|
|
@@ -343,6 +391,11 @@ interface SdkConfig {
|
|
|
343
391
|
* {@link ModelOptions}).
|
|
344
392
|
*/
|
|
345
393
|
models?: ModelOptions;
|
|
394
|
+
/**
|
|
395
|
+
* How the endpoints and their body argument are named: RTK codegen's names (default), a rule of verb and path, or
|
|
396
|
+
* your own function; the body as `requestBody` (see {@link EndpointOptions}).
|
|
397
|
+
*/
|
|
398
|
+
endpoints?: EndpointOptions;
|
|
346
399
|
/** tsconfig used for the final type check. Default `tsconfig.json` next to the config file. */
|
|
347
400
|
tsconfig?: string;
|
|
348
401
|
}
|
|
@@ -433,5 +486,5 @@ declare function loadSpec(source: string, timeoutMs?: number): Promise<OpenApiDo
|
|
|
433
486
|
*/
|
|
434
487
|
declare function validateSpec(doc: OpenApiDocument, source: string, logger: Logger): void;
|
|
435
488
|
|
|
436
|
-
export { SUPPORTED_CONTRACT, SdkGenerationError, broadInvalidation, consoleLogger, defineConfig, generateSdk, linkSkills, loadConfig, loadSpec, silentLogger, validateSpec };
|
|
437
|
-
export type { GenerateSdkOptions, GenerateSdkResult, HooksOptions, InvalidationOperation, InvalidationResolver, InvalidationTag, LinkSkillAction, LinkSkillsOptions, LinkSkillsResult, LoadedConfig, Logger, ModelOptions, OpenApiDocument, OperationMatcher, ResponseHandlerOverride, SdkApiConfig, SdkConfig, SideEffectsOverride, WorkspaceOptions };
|
|
489
|
+
export { SUPPORTED_CONTRACT, SdkGenerationError, broadInvalidation, buildEndpointNameFromPath, consoleLogger, defineConfig, generateSdk, linkSkills, loadConfig, loadSpec, silentLogger, validateSpec };
|
|
490
|
+
export type { EndpointNamingOperation, EndpointOptions, GenerateSdkOptions, GenerateSdkResult, HooksOptions, InvalidationOperation, InvalidationResolver, InvalidationTag, LinkSkillAction, LinkSkillsOptions, LinkSkillsResult, LoadedConfig, Logger, ModelOptions, OpenApiDocument, OperationMatcher, ResponseHandlerOverride, SdkApiConfig, SdkConfig, SideEffectsOverride, WorkspaceOptions };
|
package/dist/codegen/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
SUPPORTED_CONTRACT,
|
|
3
3
|
SdkGenerationError,
|
|
4
4
|
broadInvalidation,
|
|
5
|
+
buildEndpointNameFromPath,
|
|
5
6
|
consoleLogger,
|
|
6
7
|
defineConfig,
|
|
7
8
|
generateSdk,
|
|
@@ -10,11 +11,12 @@ import {
|
|
|
10
11
|
loadSpec,
|
|
11
12
|
silentLogger,
|
|
12
13
|
validateSpec
|
|
13
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-XXMTSCOZ.js";
|
|
14
15
|
export {
|
|
15
16
|
SUPPORTED_CONTRACT,
|
|
16
17
|
SdkGenerationError,
|
|
17
18
|
broadInvalidation,
|
|
19
|
+
buildEndpointNameFromPath,
|
|
18
20
|
consoleLogger,
|
|
19
21
|
defineConfig,
|
|
20
22
|
generateSdk,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgamadeus/ddd-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|