@mgamadeus/ddd-web 0.9.0 → 0.10.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 +1 -0
- package/CHANGELOG.md +12 -0
- package/dist/{chunk-TPFRUK5O.js → chunk-PZ6AAETR.js} +56 -2
- package/dist/chunk-PZ6AAETR.js.map +1 -0
- package/dist/codegen/cli.js +1 -1
- package/dist/codegen/index.d.ts +38 -2
- package/dist/codegen/index.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-TPFRUK5O.js.map +0 -1
package/dist/codegen/index.d.ts
CHANGED
|
@@ -166,6 +166,37 @@ 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
|
/**
|
|
@@ -343,6 +374,11 @@ interface SdkConfig {
|
|
|
343
374
|
* {@link ModelOptions}).
|
|
344
375
|
*/
|
|
345
376
|
models?: ModelOptions;
|
|
377
|
+
/**
|
|
378
|
+
* How the endpoints and their body argument are named: RTK codegen's names (default), a rule of verb and path, or
|
|
379
|
+
* your own function; the body as `requestBody` (see {@link EndpointOptions}).
|
|
380
|
+
*/
|
|
381
|
+
endpoints?: EndpointOptions;
|
|
346
382
|
/** tsconfig used for the final type check. Default `tsconfig.json` next to the config file. */
|
|
347
383
|
tsconfig?: string;
|
|
348
384
|
}
|
|
@@ -433,5 +469,5 @@ declare function loadSpec(source: string, timeoutMs?: number): Promise<OpenApiDo
|
|
|
433
469
|
*/
|
|
434
470
|
declare function validateSpec(doc: OpenApiDocument, source: string, logger: Logger): void;
|
|
435
471
|
|
|
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 };
|
|
472
|
+
export { SUPPORTED_CONTRACT, SdkGenerationError, broadInvalidation, buildEndpointNameFromPath, consoleLogger, defineConfig, generateSdk, linkSkills, loadConfig, loadSpec, silentLogger, validateSpec };
|
|
473
|
+
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-PZ6AAETR.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.10.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",
|