@openora/core 0.4.1-canary.34 → 0.4.1-canary.36
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/audit/plugin.d.ts.map +1 -1
- package/dist/audit/plugin.js +4 -2
- package/dist/audit/plugin.js.map +1 -1
- package/dist/casino/gaming/__tests__/gaming.service.test.js +18 -2
- package/dist/casino/gaming/__tests__/gaming.service.test.js.map +1 -1
- package/dist/casino/gaming/plugin.d.ts.map +1 -1
- package/dist/casino/gaming/plugin.js +3 -2
- package/dist/casino/gaming/plugin.js.map +1 -1
- package/dist/casino/gaming/router/index.d.ts.map +1 -1
- package/dist/casino/gaming/router/index.js +2 -2
- package/dist/casino/gaming/router/index.js.map +1 -1
- package/dist/casino/gaming/service/gaming.service.d.ts +4 -2
- package/dist/casino/gaming/service/gaming.service.d.ts.map +1 -1
- package/dist/casino/gaming/service/gaming.service.js +8 -2
- package/dist/casino/gaming/service/gaming.service.js.map +1 -1
- package/dist/compliance/__tests__/rg.contract.test.js +8 -1
- package/dist/compliance/__tests__/rg.contract.test.js.map +1 -1
- package/dist/compliance/__tests__/rg.router.test.js +35 -1
- package/dist/compliance/__tests__/rg.router.test.js.map +1 -1
- package/dist/compliance/__tests__/rg.service.test.js +73 -1
- package/dist/compliance/__tests__/rg.service.test.js.map +1 -1
- package/dist/compliance/contract/index.d.ts +26 -0
- package/dist/compliance/contract/index.d.ts.map +1 -1
- package/dist/compliance/contract/rg.d.ts +31 -0
- package/dist/compliance/contract/rg.d.ts.map +1 -1
- package/dist/compliance/contract/rg.js +8 -0
- package/dist/compliance/contract/rg.js.map +1 -1
- package/dist/compliance/plugin.d.ts.map +1 -1
- package/dist/compliance/plugin.js +2 -1
- package/dist/compliance/plugin.js.map +1 -1
- package/dist/compliance/router/index.d.ts +26 -0
- package/dist/compliance/router/index.d.ts.map +1 -1
- package/dist/compliance/router/index.js +4 -0
- package/dist/compliance/router/index.js.map +1 -1
- package/dist/compliance/service/rg.service.d.ts +11 -2
- package/dist/compliance/service/rg.service.d.ts.map +1 -1
- package/dist/compliance/service/rg.service.js +54 -12
- package/dist/compliance/service/rg.service.js.map +1 -1
- package/dist/contracts/adapters/admin-user-directory.d.ts +1 -0
- package/dist/contracts/adapters/admin-user-directory.d.ts.map +1 -1
- package/dist/contracts/adapters/admin-user-directory.js.map +1 -1
- package/dist/contracts/adapters/email-template.d.ts +15 -1
- package/dist/contracts/adapters/email-template.d.ts.map +1 -1
- package/dist/contracts/adapters/email-template.js +29 -0
- package/dist/contracts/adapters/email-template.js.map +1 -1
- package/dist/contracts/adapters/index.d.ts +2 -0
- package/dist/contracts/adapters/index.d.ts.map +1 -1
- package/dist/contracts/adapters/index.js +1 -0
- package/dist/contracts/adapters/index.js.map +1 -1
- package/dist/contracts/adapters/play-eligibility.d.ts +15 -0
- package/dist/contracts/adapters/play-eligibility.d.ts.map +1 -0
- package/dist/contracts/adapters/play-eligibility.js +3 -0
- package/dist/contracts/adapters/play-eligibility.js.map +1 -0
- package/dist/contracts/schemas/events.d.ts +9 -0
- package/dist/contracts/schemas/events.d.ts.map +1 -1
- package/dist/contracts/schemas/events.js +18 -11
- package/dist/contracts/schemas/events.js.map +1 -1
- package/dist/pam/identity/__tests__/play-eligibility.test.d.ts +2 -0
- package/dist/pam/identity/__tests__/play-eligibility.test.d.ts.map +1 -0
- package/dist/pam/identity/__tests__/play-eligibility.test.js +30 -0
- package/dist/pam/identity/__tests__/play-eligibility.test.js.map +1 -0
- package/dist/pam/identity/admin-user-directory.d.ts +2 -1
- package/dist/pam/identity/admin-user-directory.d.ts.map +1 -1
- package/dist/pam/identity/admin-user-directory.js +2 -3
- package/dist/pam/identity/admin-user-directory.js.map +1 -1
- package/dist/pam/identity/plugin.d.ts.map +1 -1
- package/dist/pam/identity/plugin.js +3 -1
- package/dist/pam/identity/plugin.js.map +1 -1
- package/dist/pam/identity/service/play-eligibility.service.d.ts +8 -0
- package/dist/pam/identity/service/play-eligibility.service.d.ts.map +1 -0
- package/dist/pam/identity/service/play-eligibility.service.js +21 -0
- package/dist/pam/identity/service/play-eligibility.service.js.map +1 -0
- 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/dist/wallet/__tests__/wallet-commands.service.test.js +21 -3
- package/dist/wallet/__tests__/wallet-commands.service.test.js.map +1 -1
- package/dist/wallet/plugin.d.ts.map +1 -1
- package/dist/wallet/plugin.js +2 -2
- package/dist/wallet/plugin.js.map +1 -1
- package/dist/wallet/service/wallet-commands.service.d.ts +4 -1
- package/dist/wallet/service/wallet-commands.service.d.ts.map +1 -1
- package/dist/wallet/service/wallet-commands.service.js +9 -1
- package/dist/wallet/service/wallet-commands.service.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-commands.service.test.js","sourceRoot":"","sources":["../../../src/wallet/__tests__/wallet-commands.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"wallet-commands.service.test.js","sourceRoot":"","sources":["../../../src/wallet/__tests__/wallet-commands.service.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAI/C,iGAAiG;AACjG,oGAAoG;AACpG,6BAA6B;AAC7B,SAAS,OAAO,CAAC,EAAE,SAAS,EAAE,aAAa,EAA8C;IACvF,MAAM,OAAO,GAAU,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG;QACV,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;SAC7E,CAAC;QACF,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,GA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,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,WAAW,EAAE,CAAC;oBAChC,OAAO,IAAI,MAAM,CAAC;gBACpB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,MAAM,CAAC;YACnB,CAAC;QACH,CAAC;QAED,MAAM,CAAC,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/wallet/plugin.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/wallet/plugin.ts"],"names":[],"mappings":";AAuBA,wBAyCG"}
|
package/dist/wallet/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { definePlugin, ADMIN_GUARD, EVENT_BUS, DRIZZLE } from '@openora/core/server';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
-
import { ADMIN_USER_DIRECTORY, ADMIN_WALLET_REPORTING, PAYMENT_ADAPTER, PAYMENT_WEBHOOK_VERIFIER, WALLET_COMMANDS, WALLET_READER, PLATFORM_CONFIG, RATE_LIMITER, PLAYER_TAGS, AUDIT_WRITER, } from '@openora/core/contracts';
|
|
3
|
+
import { ADMIN_USER_DIRECTORY, ADMIN_WALLET_REPORTING, PAYMENT_ADAPTER, PAYMENT_WEBHOOK_VERIFIER, WALLET_COMMANDS, WALLET_READER, PLATFORM_CONFIG, RATE_LIMITER, PLAYER_TAGS, PLAY_ELIGIBILITY, AUDIT_WRITER, } from '@openora/core/contracts';
|
|
4
4
|
import { WalletService } from './service/wallet.service.js';
|
|
5
5
|
import { WalletCommandsService } from './service/wallet-commands.service.js';
|
|
6
6
|
import { WalletReaderService } from './adapters/wallet-reader.service.js';
|
|
@@ -26,7 +26,7 @@ export default definePlugin({
|
|
|
26
26
|
return new HmacPaymentWebhookVerifier(webhookSecret);
|
|
27
27
|
});
|
|
28
28
|
// Other modules debit through this port within their own transaction (never importing wallet tables). See ADR-0016.
|
|
29
|
-
ctx.provide(WALLET_COMMANDS, () => new WalletCommandsService());
|
|
29
|
+
ctx.provide(WALLET_COMMANDS, (c) => new WalletCommandsService(c.get(PLAY_ELIGIBILITY)));
|
|
30
30
|
// Read-only queries for cross-module consumers (eg tag evaluation). Never exposes wallet internals.
|
|
31
31
|
ctx.provide(WALLET_READER, (c) => new WalletReaderService(c.get(DRIZZLE)));
|
|
32
32
|
ctx.provide(ADMIN_WALLET_REPORTING, (c) => new DrizzleAdminWalletReporting(c.get(DRIZZLE)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/wallet/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,eAAe,EACf,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM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AC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5F,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAC9B,kBAAkB,CAChB,IAAI,aAAa,CAAC;YAChB,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;YACvB,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;YACxB,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC;YAC/B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACtC,cAAc,EAAE,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS;YAC3E,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;YAC7D,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;SAC3B,CAAC,EACF,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAClB,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,EACnB,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,EACtB,CAAC,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAChC,CACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { WalletCommands, WalletDebitArgs, WalletDebitOutcome, WalletCreditArgs, WalletCreditOutcome } from '@openora/core/contracts';
|
|
1
|
+
import type { PlayEligibilityPort, WalletCommands, WalletDebitArgs, WalletDebitOutcome, WalletCreditArgs, WalletCreditOutcome } from '@openora/core/contracts';
|
|
2
2
|
export declare const WalletCommandAmountError: new (operation: string, amount: string) => Error;
|
|
3
|
+
export declare const WalletRgRestrictedError: new () => Error;
|
|
3
4
|
export declare class WalletCommandsService implements WalletCommands {
|
|
5
|
+
private readonly playEligibility;
|
|
6
|
+
constructor(playEligibility: PlayEligibilityPort);
|
|
4
7
|
private writeLedgerRow;
|
|
5
8
|
debit(tx: unknown, { userId, amount, type }: WalletDebitArgs): Promise<WalletDebitOutcome>;
|
|
6
9
|
credit(tx: unknown, { userId, amount, type }: WalletCreditArgs): Promise<WalletCreditOutcome>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-commands.service.d.ts","sourceRoot":"","sources":["../../../src/wallet/service/wallet-commands.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AAMjC,eAAO,MAAM,wBAAwB,kDAGpC,CAAC;AASF,qBAAa,qBAAsB,YAAW,cAAc;
|
|
1
|
+
{"version":3,"file":"wallet-commands.service.d.ts","sourceRoot":"","sources":["../../../src/wallet/service/wallet-commands.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AAMjC,eAAO,MAAM,wBAAwB,kDAGpC,CAAC;AASF,eAAO,MAAM,uBAAuB,iBAGnC,CAAC;AAEF,qBAAa,qBAAsB,YAAW,cAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,mBAAmB;IAGjE,OAAO,CAAC,cAAc;IAgBhB,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwC1F,MAAM,CACV,EAAE,EAAE,OAAO,EACX,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,gBAAgB,GACzC,OAAO,CAAC,mBAAmB,CAAC;CA0BhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDomainError } from '@openora/core/server';
|
|
1
|
+
import { createDomainError, makeConflictError } from '@openora/core/server';
|
|
2
2
|
import { and, eq, gte, sql } from 'drizzle-orm';
|
|
3
3
|
import { wallet, walletTransaction } from '../schema/index.js';
|
|
4
4
|
import { railFor } from './wallet.service.js';
|
|
@@ -10,7 +10,12 @@ export const WalletCommandAmountError = createDomainError('WalletCommandAmountEr
|
|
|
10
10
|
// (status `completed`, internal settlement so no provider ref) so gameplay shows in
|
|
11
11
|
// transaction history. The `balance >= amount` guard in the UPDATE makes concurrent
|
|
12
12
|
// debits safe (a lost race updates zero rows and we report the shortfall).
|
|
13
|
+
export const WalletRgRestrictedError = makeConflictError('WalletRgRestrictedError', 'wager is restricted by an active responsible-gambling exclusion');
|
|
13
14
|
export class WalletCommandsService {
|
|
15
|
+
playEligibility;
|
|
16
|
+
constructor(playEligibility) {
|
|
17
|
+
this.playEligibility = playEligibility;
|
|
18
|
+
}
|
|
14
19
|
// Completed, internal-settlement ledger row (no provider ref) shared by every gameplay move.
|
|
15
20
|
writeLedgerRow(txn, row, type, amount) {
|
|
16
21
|
return txn.insert(walletTransaction).values({
|
|
@@ -24,6 +29,9 @@ export class WalletCommandsService {
|
|
|
24
29
|
}
|
|
25
30
|
async debit(tx, { userId, amount, type }) {
|
|
26
31
|
const txn = tx;
|
|
32
|
+
if (type === 'bet' && (await this.playEligibility.isRestricted(userId))) {
|
|
33
|
+
throw new WalletRgRestrictedError();
|
|
34
|
+
}
|
|
27
35
|
// `loss` is informational (stake already left at bet time): 0-amount row, balance untouched. Every other debit is real money.
|
|
28
36
|
if (type !== 'loss' && Number(amount) <= 0) {
|
|
29
37
|
throw new WalletCommandAmountError('debit', amount);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-commands.service.js","sourceRoot":"","sources":["../../../src/wallet/service/wallet-commands.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet-commands.service.js","sourceRoot":"","sources":["../../../src/wallet/service/wallet-commands.service.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAkB,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CACvD,0BAA0B,EAC1B,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,SAAS,iCAAiC,MAAM,GAAG,CACrF,CAAC;AAEF,8EAA8E;AAC9E,iFAAiF;AACjF,mFAAmF;AACnF,qFAAqF;AACrF,oFAAoF;AACpF,oFAAoF;AACpF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CACtD,yBAAyB,EACzB,iEAAiE,CAClE,CAAC;AAEF,MAAM,OAAO,qBAAqB;IACH;IAA7B,YAA6B,eAAoC;QAApC,oBAAe,GAAf,eAAe,CAAqB;IAAG,CAAC;IAErE,6FAA6F;IACrF,cAAc,CACpB,GAAc,EACd,GAAqC,EACrC,IAA2B,EAC3B,MAAc;QAEd,OAAO,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC;YAC1C,QAAQ,EAAE,GAAG,CAAC,EAAE;YAChB,IAAI;YACJ,MAAM;YACN,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;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C;aACd,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,CAAA,GAAG,MAAM,CAAC,OAAO,MAAM,MAAM,WAAW,EAAE,CAAC;aAC7D,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;aAC5B,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAElD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -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';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Applies this module's own migration set against its own tracking table, so it
|
|
2
|
+
// never collides with sibling modules that share the database. SQL ships in the
|
|
3
|
+
// tarball ('files') and loads via an import.meta.url-relative path. See ADR-0020/0027.
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { runMigrations } from '@openora/core/server/migrate';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Apply the {{kebabCase name}} module migrations (idempotent: drizzle skips already-recorded ones).
|
|
9
|
+
*/
|
|
10
|
+
export function migrate(databaseUrl?: string) {
|
|
11
|
+
return runMigrations({
|
|
12
|
+
migrationsFolder: fileURLToPath(new URL('./drizzle/migrations', import.meta.url)),
|
|
13
|
+
migrationsTable: '__drizzle_migrations_{{snakeCase name}}',
|
|
14
|
+
migrationsSchema: 'drizzle',
|
|
15
|
+
...(databaseUrl ? { databaseUrl } : {}),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { definePlugin } from '@openora/
|
|
2
|
-
import { EVENT_BUS } from '@openora/core';
|
|
3
|
-
import { DRIZZLE } from '@openora/db';
|
|
1
|
+
import { definePlugin, EVENT_BUS, DRIZZLE } from '@openora/core/server';
|
|
4
2
|
import { {{pascalCase name}}Service } from './service/{{kebabCase name}}.service.js';
|
|
5
3
|
import { create{{pascalCase name}}Router } from './router/index.js';
|
|
6
4
|
|