@openora/core 0.4.1-canary.34 → 0.4.1-canary.35
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/bin/migrate.mjs +55 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/schemas/events.js +10 -10
- package/dist/contracts/schemas/events.js.map +1 -1
- package/dist/pam/player-management/contract/index.js +1 -1
- package/dist/server/plugin-host/load-extensions.d.ts +2 -2
- package/dist/server/plugin-host/load-extensions.js +2 -2
- package/dist/server/plugin-host/load-plugins.d.ts +1 -1
- package/dist/server/plugin-host/load-plugins.d.ts.map +1 -1
- package/dist/server/plugin-host/load-plugins.js.map +1 -1
- package/{turbo-generators → generators}/src/config.ts +194 -97
- package/{turbo-generators → generators}/src/templates/contract.hbs +5 -4
- package/generators/src/templates/module/agents.hbs +17 -0
- package/{turbo-generators → generators}/src/templates/module/drizzle.config.hbs +5 -5
- package/generators/src/templates/module/index.hbs +5 -0
- package/generators/src/templates/module/migrate.hbs +17 -0
- package/{turbo-generators → generators}/src/templates/module/plugin.hbs +1 -3
- package/{turbo-generators → generators}/src/templates/module/router.hbs +5 -5
- package/generators/src/templates/module/schema.hbs +14 -0
- package/{turbo-generators → generators}/src/templates/module/service.hbs +6 -6
- package/package.json +44 -6
- package/turbo-generators/src/templates/module/agents.hbs +0 -26
- package/turbo-generators/src/templates/module/index.hbs +0 -5
- package/turbo-generators/src/templates/module/migrate.hbs +0 -15
- package/turbo-generators/src/templates/module/package.json.hbs +0 -62
- package/turbo-generators/src/templates/module/schema.hbs +0 -21
- package/turbo-generators/src/templates/module/tsconfig.json.hbs +0 -8
- /package/{turbo-generators → generators}/src/templates/adapter.hbs +0 -0
- /package/{turbo-generators → generators}/src/templates/adr.hbs +0 -0
- /package/{turbo-generators → generators}/src/templates/config.hbs +0 -0
- /package/{turbo-generators → generators}/src/templates/job-worker.hbs +0 -0
- /package/{turbo-generators → generators}/src/templates/plugin.hbs +0 -0
|
@@ -9,17 +9,17 @@ import { KycStatusSchema } from './player.js';
|
|
|
9
9
|
const authContextBase = ClientMetaSchema.partial();
|
|
10
10
|
const iamRoleEventBase = z
|
|
11
11
|
.object({ roleId: UuidSchema, actorId: UuidSchema })
|
|
12
|
-
.
|
|
12
|
+
.extend(authContextBase.shape);
|
|
13
13
|
const cmsPageEventBase = z
|
|
14
14
|
.object({ pageId: UuidSchema, actorId: UuidSchema })
|
|
15
|
-
.
|
|
15
|
+
.extend(authContextBase.shape);
|
|
16
16
|
const cmsBannerEventBase = z
|
|
17
17
|
.object({ bannerId: UuidSchema, actorId: UuidSchema })
|
|
18
|
-
.
|
|
18
|
+
.extend(authContextBase.shape);
|
|
19
19
|
const actorReasonBase = z.object({ actorId: UuidSchema, reason: z.string() });
|
|
20
20
|
const tagPlayerEventBase = actorReasonBase
|
|
21
21
|
.extend({ playerId: UuidSchema, tagKey: TagKeySchema })
|
|
22
|
-
.
|
|
22
|
+
.extend(authContextBase.shape);
|
|
23
23
|
const permissionLevelEntries = z.array(z.object({ resource: z.string(), level: PermissionLevelSchema }));
|
|
24
24
|
// Shared shape for every wallet money-movement event. Exact decimal string + currency.
|
|
25
25
|
const walletTxnBase = z.object({
|
|
@@ -87,17 +87,17 @@ export const domainEventSchemas = {
|
|
|
87
87
|
'wallet.withdrawal.completed': walletTxnBase,
|
|
88
88
|
// A player requested a withdrawal; funds are held (balance debited) and the
|
|
89
89
|
// request enters the back-office approval queue as `pending`.
|
|
90
|
-
'wallet.withdrawal.requested': walletTxnBase.
|
|
90
|
+
'wallet.withdrawal.requested': walletTxnBase.extend(authContextBase.shape),
|
|
91
91
|
// A payments admin approved a pending withdrawal; it moves to `processing` and
|
|
92
92
|
// is sent to the PSP/Fireblocks rail. `adminId` is the acting reviewer.
|
|
93
93
|
'wallet.withdrawal.approved': walletTxnBase
|
|
94
94
|
.extend({ adminId: UuidSchema })
|
|
95
|
-
.
|
|
95
|
+
.extend(authContextBase.shape),
|
|
96
96
|
// A payments admin rejected a pending withdrawal; held funds are returned to the
|
|
97
97
|
// player balance. `adminId` is the acting reviewer; `reason` is mandatory.
|
|
98
98
|
'wallet.withdrawal.rejected': walletTxnBase
|
|
99
99
|
.extend({ adminId: UuidSchema, reason: z.string() })
|
|
100
|
-
.
|
|
100
|
+
.extend(authContextBase.shape),
|
|
101
101
|
// An approved withdrawal failed at the PSP/Fireblocks rail; the held funds were
|
|
102
102
|
// returned to the player balance and the transaction moved to `failed`.
|
|
103
103
|
'wallet.withdrawal.failed': walletTxnBase.extend({ adminId: UuidSchema }),
|
|
@@ -182,7 +182,7 @@ export const domainEventSchemas = {
|
|
|
182
182
|
}),
|
|
183
183
|
'rg.cooling_off.activated': actorReasonBase
|
|
184
184
|
.extend({ userId: UuidSchema, exclusionId: UuidSchema, expiresAt: TimestampSchema })
|
|
185
|
-
.
|
|
185
|
+
.extend(authContextBase.shape),
|
|
186
186
|
'rg.self_exclusion.activated': actorReasonBase
|
|
187
187
|
.extend({
|
|
188
188
|
userId: UuidSchema,
|
|
@@ -190,10 +190,10 @@ export const domainEventSchemas = {
|
|
|
190
190
|
isPermanent: z.boolean(),
|
|
191
191
|
expiresAt: TimestampSchema.nullable(),
|
|
192
192
|
})
|
|
193
|
-
.
|
|
193
|
+
.extend(authContextBase.shape),
|
|
194
194
|
'rg.self_exclusion.lifted': actorReasonBase
|
|
195
195
|
.extend({ userId: UuidSchema, exclusionId: UuidSchema, kind: ExclusionKindSchema })
|
|
196
|
-
.
|
|
196
|
+
.extend(authContextBase.shape),
|
|
197
197
|
'rg.exclusion.login_blocked': authContextBase.extend({ userId: UuidSchema }),
|
|
198
198
|
// A player's KYC status changed. userId = subject player; actorId = the admin who
|
|
199
199
|
// acted, or null for system-driven changes (vendor decision, webhook, threshold
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/contracts/schemas/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAC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// Shared so the profile
|
|
1
|
+
// Shared so the profile module can derive from them too. See ADR-0021.
|
|
2
2
|
import { oc, populateContractRouterPaths } from '@orpc/contract';
|
|
3
3
|
import * as z from 'zod';
|
|
4
4
|
import { PlayerSchema, PlayerStatusSchema, KycStatusSchema, UuidSchema, TagKeySchema, PaginatedPlayerSearchArgsSchema, } from '@openora/core/contracts';
|
|
@@ -2,8 +2,8 @@ import type { PluginEntry } from './load-plugins.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Load the extensions.config.ts registry from disk and resolve plugin paths.
|
|
4
4
|
* Resolves via EXTENSIONS_CONFIG env var or walks up from process.cwd().
|
|
5
|
-
* Optional `filter` lets
|
|
6
|
-
*
|
|
5
|
+
* Optional `filter` lets a composition root drop entries before the service
|
|
6
|
+
* manifest is applied.
|
|
7
7
|
*/
|
|
8
8
|
export declare function loadExtensions(filter?: (entries: PluginEntry[]) => PluginEntry[]): Promise<PluginEntry[]>;
|
|
9
9
|
//# sourceMappingURL=load-extensions.d.ts.map
|
|
@@ -4,8 +4,8 @@ import { applyServiceManifest, parseServiceManifest } from './service-manifest.j
|
|
|
4
4
|
/**
|
|
5
5
|
* Load the extensions.config.ts registry from disk and resolve plugin paths.
|
|
6
6
|
* Resolves via EXTENSIONS_CONFIG env var or walks up from process.cwd().
|
|
7
|
-
* Optional `filter` lets
|
|
8
|
-
*
|
|
7
|
+
* Optional `filter` lets a composition root drop entries before the service
|
|
8
|
+
* manifest is applied.
|
|
9
9
|
*/
|
|
10
10
|
export async function loadExtensions(filter) {
|
|
11
11
|
const fromEnv = process.env['EXTENSIONS_CONFIG'];
|
|
@@ -4,7 +4,7 @@ import { ModuleRegistryImpl } from './module-registry.js';
|
|
|
4
4
|
export type PluginEntry = {
|
|
5
5
|
id: string;
|
|
6
6
|
path: string;
|
|
7
|
-
kind?: 'module' | 'infra'
|
|
7
|
+
kind?: 'module' | 'infra';
|
|
8
8
|
};
|
|
9
9
|
export declare function loadPlugins(entries: PluginEntry[], container: Container): Promise<ModuleRegistryImpl>;
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-plugins.d.ts","sourceRoot":"","sources":["../../../src/server/plugin-host/load-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"load-plugins.d.ts","sourceRoot":"","sources":["../../../src/server/plugin-host/load-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAKb,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC3B,CAAC;AA8DF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EAAE,EACtB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAuB7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAgBjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-plugins.js","sourceRoot":"","sources":["../../../src/server/plugin-host/load-plugins.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1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AE,CACzC,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;SACzB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACxC,GAAG,CACF,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,MAAM,CAAC,EAAE,mBAAmB,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,EAAE,CAC3F,CACJ,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,sDAAsD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAC1E,8EAA8E;YAC9E,yFAAyF;YACzF,sDAAsD,CACzD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -9,7 +9,7 @@ import type { PlopTypes } from '@turbo/gen';
|
|
|
9
9
|
// <type> ...`; AI agents call the same via the MCP `scaffold-*` tools. See the
|
|
10
10
|
// "How to add ..." sections in AGENTS.md.
|
|
11
11
|
//
|
|
12
|
-
// pnpm gen module <
|
|
12
|
+
// pnpm gen module <domain> <name> - business module (schema/service/router/plugin)
|
|
13
13
|
// pnpm gen route <module> <M> <p> - oRPC procedure + contract entry
|
|
14
14
|
// pnpm gen plugin <name> - overlay plugin
|
|
15
15
|
// pnpm gen adapter <name> <token> - overlay that rebinds a vendor adapter token
|
|
@@ -27,10 +27,9 @@ import type { PlopTypes } from '@turbo/gen';
|
|
|
27
27
|
// absolute path.
|
|
28
28
|
declare const require: NodeJS.Require;
|
|
29
29
|
const pkgDir = dirname(require.resolve('@openora/core/package.json'));
|
|
30
|
-
const tpl = (name: string): string => join(pkgDir, '
|
|
30
|
+
const tpl = (name: string): string => join(pkgDir, 'generators', 'src', 'templates', name);
|
|
31
31
|
|
|
32
32
|
const kebabRe = /^[a-z][a-z0-9-]*$/;
|
|
33
|
-
const MODULE_GROUPS = ['player', 'backoffice', 'platform'] as const;
|
|
34
33
|
|
|
35
34
|
// Plop hands actions an open `Answers` bag; read fields through these coercers.
|
|
36
35
|
type Answers = Record<string, unknown>;
|
|
@@ -46,8 +45,9 @@ const toCamel = (v: string): string =>
|
|
|
46
45
|
toKebab(v).replace(/-([a-z0-9])/g, (_, c: string) => c.toUpperCase());
|
|
47
46
|
|
|
48
47
|
const root = (): string => process.cwd();
|
|
49
|
-
// OSS monorepo
|
|
50
|
-
const
|
|
48
|
+
// The OSS monorepo owns the core source tree; a consumer repo only has overlays.
|
|
49
|
+
const coreSrc = (): string => join(root(), 'packages', 'core', 'src');
|
|
50
|
+
const isOssRepo = (): boolean => existsSync(join(coreSrc(), 'contracts'));
|
|
51
51
|
// extensions.config.ts lives at the repo root (both OSS and consumer repos).
|
|
52
52
|
const extensionsConfigPath = (): string => join(root(), 'extensions.config.ts');
|
|
53
53
|
const ossOnly = (gen: string): void => {
|
|
@@ -83,29 +83,8 @@ function registerExtension(id: string, importPath: string): string {
|
|
|
83
83
|
return `registered '${id}' in extensions.config.ts`;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function wireContractIndex(name: string): string {
|
|
87
|
-
const indexFile = join(root(), 'packages', 'contracts', 'orpc-contract', 'src', 'index.ts');
|
|
88
|
-
if (!existsSync(indexFile)) {
|
|
89
|
-
return 'no orpc-contract index (skipped)';
|
|
90
|
-
}
|
|
91
|
-
let src = readFileSync(indexFile, 'utf8');
|
|
92
|
-
if (src.includes(`from './${name}.js'`)) {
|
|
93
|
-
return `contract index already wires '${name}'`;
|
|
94
|
-
}
|
|
95
|
-
const camel = toCamel(name);
|
|
96
|
-
const contractName = `${camel}Contract`;
|
|
97
|
-
src = src.replace(/(^export\s)/m, `import { ${contractName} } from './${name}.js';\n\n$1`);
|
|
98
|
-
src = src.replace(
|
|
99
|
-
/(^export const contract)/m,
|
|
100
|
-
`export { ${contractName} } from './${name}.js';\n\n$1`,
|
|
101
|
-
);
|
|
102
|
-
src = src.replace(/^(\}\);)/m, ` ${camel}: ${contractName},\n$1`);
|
|
103
|
-
writeFileSync(indexFile, src);
|
|
104
|
-
return `wired '${camel}' into orpc-contract index`;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
86
|
function appendEventSchema(topic: string): string {
|
|
108
|
-
const file = join(
|
|
87
|
+
const file = join(coreSrc(), 'contracts', 'schemas', 'events.ts');
|
|
109
88
|
if (!existsSync(file)) {
|
|
110
89
|
return 'no events.ts (skipped)';
|
|
111
90
|
}
|
|
@@ -119,11 +98,155 @@ function appendEventSchema(topic: string): string {
|
|
|
119
98
|
return `added '${topic}' to domainEventSchemas`;
|
|
120
99
|
}
|
|
121
100
|
|
|
122
|
-
|
|
101
|
+
const ENGINE_ZONES = new Set(['contracts', 'server', 'react', 'common', 'testing', 'scripts']);
|
|
102
|
+
|
|
103
|
+
function listDomains(): string[] {
|
|
104
|
+
const src = coreSrc();
|
|
105
|
+
if (!existsSync(src)) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
return readdirSync(src)
|
|
109
|
+
.filter((name) => !ENGINE_ZONES.has(name))
|
|
110
|
+
.filter((name) => existsSync(join(src, name, 'index.ts')))
|
|
111
|
+
.sort();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function moduleDir(domain: string, name: string): string {
|
|
115
|
+
return join(coreSrc(), domain, name);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Appends a `export * as <slice> from ...` (or plugin re-export) line to a domain
|
|
120
|
+
* barrel, creating the barrel when the domain is brand new.
|
|
121
|
+
*/
|
|
122
|
+
function appendToBarrel(file: string, line: string, header: string): void {
|
|
123
|
+
if (!existsSync(file)) {
|
|
124
|
+
writeFileSync(file, `${header}\n${line}\n`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const src = readFileSync(file, 'utf8');
|
|
128
|
+
if (src.includes(line)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
writeFileSync(file, `${src.replace(/\n*$/, '\n')}${line}\n`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function wireDomainBarrels(domain: string, name: string): string {
|
|
135
|
+
const dir = join(coreSrc(), domain);
|
|
136
|
+
const camel = toCamel(name);
|
|
137
|
+
const contractLine = `export * as ${camel} from './${name}/contract/index.js';`;
|
|
138
|
+
appendToBarrel(
|
|
139
|
+
join(dir, 'index.ts'),
|
|
140
|
+
contractLine,
|
|
141
|
+
`// Public consumer surface of the ${domain} domain - isomorphic contract barrel only.`,
|
|
142
|
+
);
|
|
143
|
+
appendToBarrel(
|
|
144
|
+
join(dir, 'contracts.ts'),
|
|
145
|
+
contractLine,
|
|
146
|
+
`// Contract slices of the ${domain} domain.`,
|
|
147
|
+
);
|
|
148
|
+
appendToBarrel(
|
|
149
|
+
join(dir, 'server.ts'),
|
|
150
|
+
`export { default as ${camel}Plugin } from './${name}/plugin.js';`,
|
|
151
|
+
`// Server surface of the ${domain} domain - plugin entries for the composition root.`,
|
|
152
|
+
);
|
|
153
|
+
return `wired '${name}' into the ${domain} domain barrels`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const SUBPATH_TARGETS = [
|
|
157
|
+
{
|
|
158
|
+
subpath: (d: string, n: string) => `./${d}/contracts/${n}`,
|
|
159
|
+
dist: (d: string, n: string) => `./dist/${d}/${n}/contract/index`,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
subpath: (d: string, n: string) => `./${d}/schema/${n}`,
|
|
163
|
+
dist: (d: string, n: string) => `./dist/${d}/${n}/schema/index`,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
subpath: (d: string, n: string) => `./${d}/plugins/${n}`,
|
|
167
|
+
dist: (d: string, n: string) => `./dist/${d}/${n}/plugin`,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
subpath: (d: string, n: string) => `./${d}/migrate/${n}`,
|
|
171
|
+
dist: (d: string, n: string) => `./dist/${d}/${n}/migrate`,
|
|
172
|
+
},
|
|
173
|
+
] as const;
|
|
174
|
+
|
|
175
|
+
const DOMAIN_TARGETS = [
|
|
176
|
+
{ suffix: '', file: 'index' },
|
|
177
|
+
{ suffix: '/contracts', file: 'contracts' },
|
|
178
|
+
{ suffix: '/server', file: 'server' },
|
|
179
|
+
] as const;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Adds the module's subpaths to the @openora/core exports map - the package's
|
|
183
|
+
* public surface. `pnpm regen` mirrors them into the tsconfig paths.
|
|
184
|
+
*/
|
|
185
|
+
function wireCoreExports(domain: string, name: string): string {
|
|
186
|
+
const pkgFile = join(root(), 'packages', 'core', 'package.json');
|
|
187
|
+
const pkg = JSON.parse(readFileSync(pkgFile, 'utf8')) as {
|
|
188
|
+
exports: Record<string, Record<string, string>>;
|
|
189
|
+
};
|
|
190
|
+
const entry = (dist: string) => ({
|
|
191
|
+
types: `${dist}.d.ts`,
|
|
192
|
+
import: `${dist}.js`,
|
|
193
|
+
default: `${dist}.js`,
|
|
194
|
+
});
|
|
195
|
+
const added: string[] = [];
|
|
196
|
+
const put = (subpath: string, dist: string) => {
|
|
197
|
+
if (pkg.exports[subpath]) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
pkg.exports[subpath] = entry(dist);
|
|
201
|
+
added.push(subpath);
|
|
202
|
+
};
|
|
203
|
+
for (const { suffix, file } of DOMAIN_TARGETS) {
|
|
204
|
+
put(`./${domain}${suffix}`, `./dist/${domain}/${file}`);
|
|
205
|
+
}
|
|
206
|
+
for (const { subpath, dist } of SUBPATH_TARGETS) {
|
|
207
|
+
put(subpath(domain, name), dist(domain, name));
|
|
208
|
+
}
|
|
209
|
+
writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
210
|
+
return added.length > 0
|
|
211
|
+
? `added ${added.length} subpath(s) to @openora/core exports (${added.join(', ')})`
|
|
212
|
+
: 'no new @openora/core exports needed';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Registers the module's contract slice in the composition root so its routes
|
|
217
|
+
* reach the emitted OpenAPI spec and the typed client.
|
|
218
|
+
*/
|
|
219
|
+
function wireBuildContract(domain: string, name: string): string {
|
|
220
|
+
const file = join(root(), 'tools', 'gen', 'build-contract.ts');
|
|
221
|
+
if (!existsSync(file)) {
|
|
222
|
+
return 'no tools/gen/build-contract.ts (skipped)';
|
|
223
|
+
}
|
|
224
|
+
const camel = toCamel(name);
|
|
225
|
+
const contractName = `${camel}Contract`;
|
|
226
|
+
let src = readFileSync(file, 'utf8');
|
|
227
|
+
if (src.includes(contractName)) {
|
|
228
|
+
return `build-contract.ts already composes '${camel}'`;
|
|
229
|
+
}
|
|
230
|
+
const importLine = `import { ${contractName} } from '@openora/core/${domain}/contracts/${name}';`;
|
|
231
|
+
src = src.replace(/(\n\n\/\/ oxlint-disable-next-line)/, `\n${importLine}$1`);
|
|
232
|
+
src = src.replace(
|
|
233
|
+
/(const SLICES: Record<string, AnyContract> = \{)/,
|
|
234
|
+
`$1\n ${camel}: ${contractName},`,
|
|
235
|
+
);
|
|
236
|
+
writeFileSync(file, src);
|
|
237
|
+
return `composed '${camel}' in tools/gen/build-contract.ts`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function appendRoute(
|
|
241
|
+
domain: string,
|
|
242
|
+
moduleName: string,
|
|
243
|
+
method: string,
|
|
244
|
+
routePath: string,
|
|
245
|
+
): string {
|
|
123
246
|
const name = toKebab(moduleName);
|
|
124
|
-
const
|
|
125
|
-
if (!existsSync(
|
|
126
|
-
throw new Error(`
|
|
247
|
+
const dir = moduleDir(toKebab(domain), name);
|
|
248
|
+
if (!existsSync(dir)) {
|
|
249
|
+
throw new Error(`module '${name}' not found under packages/core/src/${toKebab(domain)}/`);
|
|
127
250
|
}
|
|
128
251
|
const proc = routePath
|
|
129
252
|
.replace(/^\//, '')
|
|
@@ -132,7 +255,7 @@ function appendRoute(moduleName: string, method: string, routePath: string): str
|
|
|
132
255
|
.replace(/\//g, '.')
|
|
133
256
|
.replace(/[^a-zA-Z0-9.]/g, '');
|
|
134
257
|
|
|
135
|
-
const contractFile = join(
|
|
258
|
+
const contractFile = join(dir, 'contract', 'index.ts');
|
|
136
259
|
if (existsSync(contractFile)) {
|
|
137
260
|
let c = readFileSync(contractFile, 'utf8');
|
|
138
261
|
const camel = toCamel(name);
|
|
@@ -143,7 +266,7 @@ function appendRoute(moduleName: string, method: string, routePath: string): str
|
|
|
143
266
|
}
|
|
144
267
|
}
|
|
145
268
|
|
|
146
|
-
const routerFile = join(
|
|
269
|
+
const routerFile = join(dir, 'router', 'index.ts');
|
|
147
270
|
let r = readFileSync(routerFile, 'utf8');
|
|
148
271
|
if (!r.includes(`${proc}: os.${proc}`)) {
|
|
149
272
|
const stub = `\n ${proc}: os.${proc}.handler(() => ({})),`;
|
|
@@ -155,81 +278,49 @@ function appendRoute(moduleName: string, method: string, routePath: string): str
|
|
|
155
278
|
|
|
156
279
|
export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
157
280
|
plop.setGenerator('module', {
|
|
158
|
-
description: 'New business module
|
|
281
|
+
description: 'New business module under packages/core/src/<domain>/<name>',
|
|
159
282
|
prompts: [
|
|
160
283
|
{
|
|
161
|
-
type: '
|
|
162
|
-
name: '
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// generated AGENTS.md / scaffold message.
|
|
166
|
-
message: 'Surface this add-on serves (metadata only):',
|
|
167
|
-
choices: [...MODULE_GROUPS],
|
|
284
|
+
type: 'input',
|
|
285
|
+
name: 'domain',
|
|
286
|
+
message: `Owning domain (existing: ${listDomains().join(', ')} - or a new kebab-case name):`,
|
|
287
|
+
validate: (v: string) => (kebabRe.test(v) ? true : 'use kebab-case'),
|
|
168
288
|
},
|
|
169
289
|
{
|
|
170
290
|
type: 'input',
|
|
171
291
|
name: 'name',
|
|
172
|
-
message: '
|
|
292
|
+
message: 'Module name (kebab-case):',
|
|
173
293
|
validate: (v: string) => (kebabRe.test(v) ? true : 'use kebab-case'),
|
|
174
294
|
},
|
|
175
295
|
],
|
|
176
296
|
actions: (data?: Answers): PlopTypes.ActionType[] => {
|
|
177
297
|
ossOnly('module');
|
|
178
298
|
const a = data ?? {};
|
|
179
|
-
const
|
|
299
|
+
const domain = toKebab(s(a, 'domain'));
|
|
300
|
+
const name = toKebab(s(a, 'name'));
|
|
301
|
+
a['domain'] = domain;
|
|
302
|
+
const base = `packages/core/src/${domain}/{{kebabCase name}}`;
|
|
303
|
+
const file = (rel: string, template: string): PlopTypes.ActionType => ({
|
|
304
|
+
type: 'add',
|
|
305
|
+
path: `${base}/${rel}`,
|
|
306
|
+
templateFile: tpl(template),
|
|
307
|
+
});
|
|
180
308
|
return [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
templateFile: tpl('module/schema.hbs'),
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
type: 'add',
|
|
198
|
-
path: `${base}/src/service/{{kebabCase name}}.service.ts`,
|
|
199
|
-
templateFile: tpl('module/service.hbs'),
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
type: 'add',
|
|
203
|
-
path: `${base}/src/router/index.ts`,
|
|
204
|
-
templateFile: tpl('module/router.hbs'),
|
|
205
|
-
},
|
|
206
|
-
{ type: 'add', path: `${base}/src/plugin.ts`, templateFile: tpl('module/plugin.hbs') },
|
|
207
|
-
{ type: 'add', path: `${base}/src/index.ts`, templateFile: tpl('module/index.hbs') },
|
|
208
|
-
{
|
|
209
|
-
type: 'add',
|
|
210
|
-
path: `${base}/src/migrate.ts`,
|
|
211
|
-
templateFile: tpl('module/migrate.hbs'),
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
type: 'add',
|
|
215
|
-
path: `${base}/drizzle.config.ts`,
|
|
216
|
-
templateFile: tpl('module/drizzle.config.hbs'),
|
|
217
|
-
},
|
|
218
|
-
{ type: 'add', path: `${base}/AGENTS.md`, templateFile: tpl('module/agents.hbs') },
|
|
219
|
-
{
|
|
220
|
-
type: 'add',
|
|
221
|
-
path: 'packages/contracts/orpc-contract/src/{{kebabCase name}}.ts',
|
|
222
|
-
templateFile: tpl('contract.hbs'),
|
|
223
|
-
},
|
|
224
|
-
// Core add-on: no `kind`, always loaded. Path points at the compiled plugin.
|
|
225
|
-
() =>
|
|
226
|
-
registerExtension(
|
|
227
|
-
toKebab(s(a, 'name')),
|
|
228
|
-
`./packages/addons/${toKebab(s(a, 'name'))}/dist/plugin.js`,
|
|
229
|
-
),
|
|
230
|
-
() => wireContractIndex(toKebab(s(a, 'name'))),
|
|
309
|
+
file('contract/index.ts', 'contract.hbs'),
|
|
310
|
+
file('schema/index.ts', 'module/schema.hbs'),
|
|
311
|
+
file('service/{{kebabCase name}}.service.ts', 'module/service.hbs'),
|
|
312
|
+
file('router/index.ts', 'module/router.hbs'),
|
|
313
|
+
file('plugin.ts', 'module/plugin.hbs'),
|
|
314
|
+
file('index.ts', 'module/index.hbs'),
|
|
315
|
+
file('migrate.ts', 'module/migrate.hbs'),
|
|
316
|
+
file('drizzle.config.ts', 'module/drizzle.config.hbs'),
|
|
317
|
+
file('AGENTS.md', 'module/agents.hbs'),
|
|
318
|
+
() => wireDomainBarrels(domain, name),
|
|
319
|
+
() => wireCoreExports(domain, name),
|
|
320
|
+
() => wireBuildContract(domain, name),
|
|
321
|
+
() => registerExtension(name, `./packages/core/dist/${domain}/${name}/plugin.js`),
|
|
231
322
|
() =>
|
|
232
|
-
`next: pnpm
|
|
323
|
+
`next: pnpm gen:drizzle (this module's migration history) && pnpm regen && pnpm verify`,
|
|
233
324
|
];
|
|
234
325
|
},
|
|
235
326
|
});
|
|
@@ -237,6 +328,12 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
|
237
328
|
plop.setGenerator('route', {
|
|
238
329
|
description: 'Add an oRPC procedure (contract entry + router handler) to a module',
|
|
239
330
|
prompts: [
|
|
331
|
+
{
|
|
332
|
+
type: 'input',
|
|
333
|
+
name: 'domain',
|
|
334
|
+
message: `Owning domain (${listDomains().join(', ')}):`,
|
|
335
|
+
validate: (v: string) => (v ? true : 'required'),
|
|
336
|
+
},
|
|
240
337
|
{
|
|
241
338
|
type: 'input',
|
|
242
339
|
name: 'module',
|
|
@@ -259,7 +356,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
|
259
356
|
actions: (data?: Answers): PlopTypes.ActionType[] => {
|
|
260
357
|
ossOnly('route');
|
|
261
358
|
const a = data ?? {};
|
|
262
|
-
return [() => appendRoute(s(a, 'module'), s(a, 'method'), s(a, 'path'))];
|
|
359
|
+
return [() => appendRoute(s(a, 'domain'), s(a, 'module'), s(a, 'method'), s(a, 'path'))];
|
|
263
360
|
},
|
|
264
361
|
});
|
|
265
362
|
|
|
@@ -341,7 +438,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
|
341
438
|
return [
|
|
342
439
|
{
|
|
343
440
|
type: 'add',
|
|
344
|
-
path: 'packages/contracts/
|
|
441
|
+
path: 'packages/core/src/contracts/schemas/config/{{kebabCase name}}.ts',
|
|
345
442
|
templateFile: tpl('config.hbs'),
|
|
346
443
|
},
|
|
347
444
|
];
|
|
@@ -349,7 +446,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
|
349
446
|
});
|
|
350
447
|
|
|
351
448
|
plop.setGenerator('event', {
|
|
352
|
-
description: 'Add a domain event payload to the
|
|
449
|
+
description: 'Add a domain event payload to the core contracts catalog',
|
|
353
450
|
prompts: [
|
|
354
451
|
{
|
|
355
452
|
type: 'input',
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { oc } from '@orpc/contract';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
+
import { TimestampSchema, UuidSchema } from '@openora/core/contracts';
|
|
3
4
|
|
|
4
5
|
// Canonical request/response shapes for the {{pascalCase name}} module. This is the
|
|
5
6
|
// single source of truth - the router validates against it, OpenAPI + the typed
|
|
6
7
|
// client are emitted from it. Derive related shapes with .pick()/.omit()/.extend()
|
|
7
|
-
// rather than re-typing fields. Promote anything shared across
|
|
8
|
-
// @openora/
|
|
8
|
+
// rather than re-typing fields. Promote anything shared across domains to
|
|
9
|
+
// @openora/core/contracts. This dir is isomorphic: Zod + @openora/core/contracts only.
|
|
9
10
|
export const {{pascalCase name}}Schema = z.object({
|
|
10
|
-
id:
|
|
11
|
-
|
|
11
|
+
id: UuidSchema,
|
|
12
|
+
createdAt: TimestampSchema,
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
export type {{pascalCase name}} = z.infer<typeof {{pascalCase name}}Schema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# {{kebabCase name}}
|
|
2
|
+
|
|
3
|
+
<!-- One paragraph: the business domain this module owns + the one design decision a reader must
|
|
4
|
+
know. No route/table/event listings - they live in `contract/`, `schema/`, `docs/catalog.json`
|
|
5
|
+
and drift here. Delete any section below that has nothing real to say. -->
|
|
6
|
+
|
|
7
|
+
## Invariants
|
|
8
|
+
|
|
9
|
+
<!-- Money/authz/idempotency/ordering rules the code enforces but a reader could miss. -->
|
|
10
|
+
|
|
11
|
+
## Extension points
|
|
12
|
+
|
|
13
|
+
<!-- Ports provided/consumed, events others may react to, what an overlay can rebind. -->
|
|
14
|
+
|
|
15
|
+
## Don't
|
|
16
|
+
|
|
17
|
+
<!-- Module-specific bans only - global rules are lint-enforced already. -->
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import { defineConfig } from 'drizzle-kit';
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
// sibling modules, but one journal per module so
|
|
6
|
-
//
|
|
4
|
+
// Own migration history + tracking table, co-located with the module's schema.
|
|
5
|
+
// One DB shared with sibling modules, but one journal per module so a module can
|
|
6
|
+
// be extracted to its own package without history surgery. See ADR-0020/0027.
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
dialect: 'postgresql',
|
|
9
9
|
casing: 'snake_case',
|
|
10
|
-
schema: ['./
|
|
10
|
+
schema: ['./schema/index.ts'],
|
|
11
11
|
out: './drizzle/migrations',
|
|
12
12
|
migrations: {
|
|
13
|
-
table: '
|
|
13
|
+
table: '__drizzle_migrations_{{snakeCase name}}',
|
|
14
14
|
schema: 'drizzle',
|
|
15
15
|
},
|
|
16
16
|
dbCredentials: {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Internal barrel of the {{pascalCase name}} module. The public consumer surface is the
|
|
2
|
+
// domain barrel (@openora/core/{{dashCase domain}}), which re-exports this module's
|
|
3
|
+
// contract/ slice; cross-domain table reads go through @openora/core/{{dashCase domain}}/schema/{{kebabCase name}}.
|
|
4
|
+
export { {{pascalCase name}}Service } from './service/{{kebabCase name}}.service.js';
|
|
5
|
+
export { create{{pascalCase name}}Router } from './router/index.js';
|