@mgamadeus/ddd-web 0.17.1 → 0.18.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/SKILL.md +9 -2
- package/.claude/skills/ddd-web-specialist/references/consumer.md +15 -0
- package/CHANGELOG.md +17 -0
- package/README.md +15 -0
- package/dist/{chunk-3V22MYDI.js → chunk-AGECBV52.js} +816 -606
- package/dist/chunk-AGECBV52.js.map +1 -0
- package/dist/codegen/cli.js +9 -2
- package/dist/codegen/cli.js.map +1 -1
- package/dist/codegen/index.d.ts +53 -2
- package/dist/codegen/index.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-3V22MYDI.js.map +0 -1
package/dist/codegen/cli.js
CHANGED
|
@@ -4,17 +4,18 @@ import {
|
|
|
4
4
|
consoleLogger,
|
|
5
5
|
generateSdk,
|
|
6
6
|
runSkillLinks
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-AGECBV52.js";
|
|
8
8
|
|
|
9
9
|
// src/codegen/cli.ts
|
|
10
10
|
import { parseArgs } from "util";
|
|
11
11
|
var HELP = `Usage:
|
|
12
|
-
ddd-web-sdk [options] Generate the
|
|
12
|
+
ddd-web-sdk [options] Generate the SDK (same as "ddd-web sdk")
|
|
13
13
|
ddd-web sdk [options]
|
|
14
14
|
ddd-web link-skills [options] Link the agent skills of every installed DDD package into .claude/skills/
|
|
15
15
|
|
|
16
16
|
SDK options:
|
|
17
17
|
--config <path> Config file (default: openapi-config.ts)
|
|
18
|
+
--mode <mode> default (DDD RTK Query), future, or legacy
|
|
18
19
|
--api <exportName> Generate only this api entry
|
|
19
20
|
--schema <url|file> Spec source for the selected api (overrides schemaFile)
|
|
20
21
|
--workspace <value> Value for config.workspace.envVar (alias: --subdomain)
|
|
@@ -64,6 +65,7 @@ async function main(argv) {
|
|
|
64
65
|
args,
|
|
65
66
|
options: {
|
|
66
67
|
config: { type: "string" },
|
|
68
|
+
mode: { type: "string" },
|
|
67
69
|
api: { type: "string" },
|
|
68
70
|
schema: { type: "string" },
|
|
69
71
|
workspace: { type: "string" },
|
|
@@ -79,8 +81,13 @@ async function main(argv) {
|
|
|
79
81
|
return 0;
|
|
80
82
|
}
|
|
81
83
|
const workspace = values.workspace ?? values.subdomain;
|
|
84
|
+
const { mode } = values;
|
|
85
|
+
if (mode !== void 0 && mode !== "default" && mode !== "future" && mode !== "legacy") {
|
|
86
|
+
throw new SdkGenerationError("SDK generator mode must be default, future, or legacy.");
|
|
87
|
+
}
|
|
82
88
|
await generateSdk({
|
|
83
89
|
...values.config ? { config: values.config } : {},
|
|
90
|
+
...mode ? { mode } : {},
|
|
84
91
|
...values.api ? { api: values.api } : {},
|
|
85
92
|
...values.schema ? { schema: values.schema } : {},
|
|
86
93
|
...workspace ? { workspace } : {},
|
package/dist/codegen/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/codegen/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from 'node:util';\nimport { generateSdk } from './generate';\nimport { runSkillLinks } from './link-skills';\nimport { consoleLogger, SdkGenerationError } from './log';\n\nconst HELP = `Usage:\n ddd-web-sdk [options] Generate the
|
|
1
|
+
{"version":3,"sources":["../../src/codegen/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from 'node:util';\nimport { generateSdk } from './generate';\nimport { runSkillLinks } from './link-skills';\nimport { consoleLogger, SdkGenerationError } from './log';\n\nconst HELP = `Usage:\n ddd-web-sdk [options] Generate the SDK (same as \"ddd-web sdk\")\n ddd-web sdk [options]\n ddd-web link-skills [options] Link the agent skills of every installed DDD package into .claude/skills/\n\nSDK options:\n --config <path> Config file (default: openapi-config.ts)\n --mode <mode> default (DDD RTK Query), future, or legacy\n --api <exportName> Generate only this api entry\n --schema <url|file> Spec source for the selected api (overrides schemaFile)\n --workspace <value> Value for config.workspace.envVar (alias: --subdomain)\n --skip-prettier Do not format the generated files\n --skip-tsc Do not run tsc --noEmit after generation\n -h, --help Show this help\n\nlink-skills options:\n --check Change nothing; exit 1 on missing, stale or broken links, clashes, generated links still\n tracked by git and edited vendor skills\n --dry-run Print what would change, change nothing\n --quiet Print only warnings and problems\n --root <dir> Repository root (default: nearest ancestor with .git, else with .claude; env DDD_SKILLS_ROOT)\n`;\n\nasync function main(argv: string[]): Promise<number> {\n const [first, ...rest] = argv;\n const command = first === 'sdk' || first === 'link-skills' || first === 'help' ? first : 'sdk';\n const args = command === first ? rest : argv;\n\n if (command === 'help') {\n process.stdout.write(HELP);\n return 0;\n }\n if (command === 'link-skills') {\n const { values: linkValues } = parseArgs({\n args,\n options: {\n check: { type: 'boolean' },\n 'dry-run': { type: 'boolean' },\n quiet: { type: 'boolean', short: 'q' },\n root: { type: 'string' },\n help: { type: 'boolean', short: 'h' },\n },\n strict: true,\n });\n if (linkValues.help) {\n process.stdout.write(HELP);\n return 0;\n }\n return runSkillLinks({\n ...(linkValues.root ? { root: linkValues.root } : {}),\n check: linkValues.check ?? false,\n dryRun: linkValues['dry-run'] ?? false,\n quiet: linkValues.quiet ?? false,\n }).exitCode;\n }\n\n const { values } = parseArgs({\n args,\n options: {\n config: { type: 'string' },\n mode: { type: 'string' },\n api: { type: 'string' },\n schema: { type: 'string' },\n workspace: { type: 'string' },\n subdomain: { type: 'string' },\n 'skip-prettier': { type: 'boolean' },\n 'skip-tsc': { type: 'boolean' },\n help: { type: 'boolean', short: 'h' },\n },\n strict: true,\n });\n if (values.help) {\n process.stdout.write(HELP);\n return 0;\n }\n const workspace = values.workspace ?? values.subdomain;\n const { mode } = values;\n if (mode !== undefined && mode !== 'default' && mode !== 'future' && mode !== 'legacy') {\n throw new SdkGenerationError('SDK generator mode must be default, future, or legacy.');\n }\n await generateSdk({\n ...(values.config ? { config: values.config } : {}),\n ...(mode ? { mode } : {}),\n ...(values.api ? { api: values.api } : {}),\n ...(values.schema ? { schema: values.schema } : {}),\n ...(workspace ? { workspace } : {}),\n skipPrettier: values['skip-prettier'] ?? false,\n skipTsc: values['skip-tsc'] ?? false,\n });\n return 0;\n}\n\nmain(process.argv.slice(2)).then(\n (code) => process.exit(code),\n (error: unknown) => {\n if (error instanceof SdkGenerationError || (error as { code?: string }).code === 'ERR_PARSE_ARGS_UNKNOWN_OPTION') {\n consoleLogger.error((error as Error).message);\n } else {\n consoleLogger.error(error instanceof Error ? (error.stack ?? error.message) : String(error));\n }\n process.exit(1);\n },\n);\n"],"mappings":";;;;;;;;;AACA,SAAS,iBAAiB;AAK1B,IAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBb,eAAe,KAAK,MAAiC;AACnD,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AACzB,QAAM,UAAU,UAAU,SAAS,UAAU,iBAAiB,UAAU,SAAS,QAAQ;AACzF,QAAM,OAAO,YAAY,QAAQ,OAAO;AAExC,MAAI,YAAY,QAAQ;AACtB,YAAQ,OAAO,MAAM,IAAI;AACzB,WAAO;AAAA,EACT;AACA,MAAI,YAAY,eAAe;AAC7B,UAAM,EAAE,QAAQ,WAAW,IAAI,UAAU;AAAA,MACvC;AAAA,MACA,SAAS;AAAA,QACP,OAAO,EAAE,MAAM,UAAU;AAAA,QACzB,WAAW,EAAE,MAAM,UAAU;AAAA,QAC7B,OAAO,EAAE,MAAM,WAAW,OAAO,IAAI;AAAA,QACrC,MAAM,EAAE,MAAM,SAAS;AAAA,QACvB,MAAM,EAAE,MAAM,WAAW,OAAO,IAAI;AAAA,MACtC;AAAA,MACA,QAAQ;AAAA,IACV,CAAC;AACD,QAAI,WAAW,MAAM;AACnB,cAAQ,OAAO,MAAM,IAAI;AACzB,aAAO;AAAA,IACT;AACA,WAAO,cAAc;AAAA,MACnB,GAAI,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,IAAI,CA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AAA,EACjC,CAAC;AACD,SAAO;AACT;AAEA,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE;AAAA,EAC1B,CAAC,SAAS,QAAQ,KAAK,IAAI;AAAA,EAC3B,CAAC,UAAmB;AAClB,QAAI,iBAAiB,sBAAuB,MAA4B,SAAS,iCAAiC;AAChH,oBAAc,MAAO,MAAgB,OAAO;AAAA,IAC9C,OAAO;AACL,oBAAc,MAAM,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,CAAC;AAAA,IAC7F;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
|
package/dist/codegen/index.d.ts
CHANGED
|
@@ -381,8 +381,24 @@ interface WorkspaceOptions {
|
|
|
381
381
|
/** Ask on a TTY when nothing else resolves it. Never asks without a TTY. Default `true`. */
|
|
382
382
|
prompt?: boolean;
|
|
383
383
|
}
|
|
384
|
+
type SdkGeneratorMode = 'default' | 'future' | 'legacy';
|
|
385
|
+
interface DelegatedGeneratorOptions<Output extends string> {
|
|
386
|
+
/** Base directory for generated files. Default ./src/generated-sdk; each mode and API has its own directory. */
|
|
387
|
+
outputDir?: string;
|
|
388
|
+
/** Options for the SDK generator outputs. DDD Web sets the output directories. Set mocks to {} to add them in future mode. */
|
|
389
|
+
outputs?: Partial<Record<Output, Record<string, unknown>>>;
|
|
390
|
+
}
|
|
391
|
+
type SdkGeneratorConfig = {
|
|
392
|
+
mode: 'default';
|
|
393
|
+
} | ({
|
|
394
|
+
mode: 'future';
|
|
395
|
+
} & DelegatedGeneratorOptions<'models' | 'client' | 'mocks'>) | ({
|
|
396
|
+
mode: 'legacy';
|
|
397
|
+
} & DelegatedGeneratorOptions<'models' | 'stores' | 'mocks'>);
|
|
384
398
|
interface SdkConfig {
|
|
385
399
|
apis: SdkApiConfig[];
|
|
400
|
+
/** Defaults to the built-in DDD RTK Query generator. Other modes use the consumer's SDK generator installation. */
|
|
401
|
+
generator?: SdkGeneratorConfig;
|
|
386
402
|
/** Directory of generated model files. Default `<dir of first outputFile>/../models`. */
|
|
387
403
|
modelsDir?: string;
|
|
388
404
|
/**
|
|
@@ -452,6 +468,8 @@ declare const broadInvalidation: InvalidationResolver;
|
|
|
452
468
|
interface GenerateSdkOptions {
|
|
453
469
|
/** Config file path (default `openapi-config.ts`, relative to `cwd`) or an inline config. */
|
|
454
470
|
config?: string | SdkConfig;
|
|
471
|
+
/** Override the config's SDK generator mode for this run. */
|
|
472
|
+
mode?: SdkGeneratorMode;
|
|
455
473
|
/** Base directory for a relative config path and for an inline config's relative paths. Default `process.cwd()`. */
|
|
456
474
|
cwd?: string;
|
|
457
475
|
/** Generate only the api with this `exportName` (or output file stem). */
|
|
@@ -469,10 +487,43 @@ interface GenerateSdkResult {
|
|
|
469
487
|
/** Absolute paths of all written files. */
|
|
470
488
|
files: string[];
|
|
471
489
|
modelsDir: string;
|
|
490
|
+
/** Model directories for each selected API in an opt-in mode. */
|
|
491
|
+
modelsByApi?: Record<string, string>;
|
|
472
492
|
typechecked: boolean;
|
|
473
493
|
}
|
|
474
494
|
declare function generateSdk(options?: GenerateSdkOptions): Promise<GenerateSdkResult>;
|
|
475
495
|
|
|
496
|
+
interface LegacySdkSource {
|
|
497
|
+
name: string;
|
|
498
|
+
file?: string;
|
|
499
|
+
url?: string;
|
|
500
|
+
onError?: string;
|
|
501
|
+
outputs: Record<string, Record<string, unknown>>;
|
|
502
|
+
}
|
|
503
|
+
interface GeneratorResult {
|
|
504
|
+
source: string;
|
|
505
|
+
ok: boolean;
|
|
506
|
+
skipped?: boolean;
|
|
507
|
+
error?: Error;
|
|
508
|
+
planned?: Array<{
|
|
509
|
+
dir: string;
|
|
510
|
+
files: Array<{
|
|
511
|
+
path: string;
|
|
512
|
+
content: string;
|
|
513
|
+
}>;
|
|
514
|
+
}>;
|
|
515
|
+
}
|
|
516
|
+
interface GenerateLegacySdkOptions {
|
|
517
|
+
/** Explicit sources and directories for an existing SDK layout, processed in the given order. */
|
|
518
|
+
sources: LegacySdkSource[];
|
|
519
|
+
cwd?: string;
|
|
520
|
+
dryRun?: boolean;
|
|
521
|
+
targetOptions?: Record<string, unknown>;
|
|
522
|
+
logger?: Logger;
|
|
523
|
+
}
|
|
524
|
+
/** Runs the legacy generator for an app that owns its spec sources and generated file layout. */
|
|
525
|
+
declare function generateLegacySdk(options: GenerateLegacySdkOptions): Promise<GeneratorResult[]>;
|
|
526
|
+
|
|
476
527
|
/** One entry of `.ddd-skills.json` → `skills`. */
|
|
477
528
|
interface SkillsManifestEntry {
|
|
478
529
|
package: string | null;
|
|
@@ -559,5 +610,5 @@ declare function loadSpec(source: string, timeoutMs?: number): Promise<OpenApiDo
|
|
|
559
610
|
*/
|
|
560
611
|
declare function validateSpec(doc: OpenApiDocument, source: string, logger: Logger): void;
|
|
561
612
|
|
|
562
|
-
export { SUPPORTED_CONTRACT, SdkGenerationError, broadInvalidation, buildEndpointNameFromPath, consoleLogger, defineConfig, findSkillsRepositoryRoot, generateSdk, linkSkills, loadConfig, loadSpec, runSkillLinks, silentLogger, validateSpec };
|
|
563
|
-
export type { EndpointNamingOperation, EndpointOptions, GenerateSdkOptions, GenerateSdkResult, HooksOptions, InvalidationOperation, InvalidationResolver, InvalidationTag, LinkSkillAction, LinkSkillsOptions, LinkSkillsResult, LoadedConfig, Logger, ModelOptions, OpenApiDocument, OperationMatcher, ResponseHandlerOverride, SdkApiConfig, SdkConfig, SideEffectsOverride, SkillLinksOptions, SkillLinksReport, SkillsManifest, SkillsManifestEntry, WorkspaceOptions };
|
|
613
|
+
export { SUPPORTED_CONTRACT, SdkGenerationError, broadInvalidation, buildEndpointNameFromPath, consoleLogger, defineConfig, findSkillsRepositoryRoot, generateLegacySdk, generateSdk, linkSkills, loadConfig, loadSpec, runSkillLinks, silentLogger, validateSpec };
|
|
614
|
+
export type { EndpointNamingOperation, EndpointOptions, GenerateLegacySdkOptions, GenerateSdkOptions, GenerateSdkResult, HooksOptions, InvalidationOperation, InvalidationResolver, InvalidationTag, LegacySdkSource, LinkSkillAction, LinkSkillsOptions, LinkSkillsResult, LoadedConfig, Logger, ModelOptions, OpenApiDocument, OperationMatcher, ResponseHandlerOverride, SdkApiConfig, SdkConfig, SdkGeneratorConfig, SdkGeneratorMode, SideEffectsOverride, SkillLinksOptions, SkillLinksReport, SkillsManifest, SkillsManifestEntry, WorkspaceOptions };
|
package/dist/codegen/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
consoleLogger,
|
|
7
7
|
defineConfig,
|
|
8
8
|
findSkillsRepositoryRoot,
|
|
9
|
+
generateLegacySdk,
|
|
9
10
|
generateSdk,
|
|
10
11
|
linkSkills,
|
|
11
12
|
loadConfig,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
runSkillLinks,
|
|
14
15
|
silentLogger,
|
|
15
16
|
validateSpec
|
|
16
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-AGECBV52.js";
|
|
17
18
|
export {
|
|
18
19
|
SUPPORTED_CONTRACT,
|
|
19
20
|
SdkGenerationError,
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
consoleLogger,
|
|
23
24
|
defineConfig,
|
|
24
25
|
findSkillsRepositoryRoot,
|
|
26
|
+
generateLegacySdk,
|
|
25
27
|
generateSdk,
|
|
26
28
|
linkSkills,
|
|
27
29
|
loadConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgamadeus/ddd-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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",
|