@openora/core 0.4.1-canary.74 → 0.4.1-canary.76
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/dist/.tsbuildinfo +1 -1
- package/dist/analytics/contract/financial.d.ts +1 -2
- package/dist/analytics/contract/financial.d.ts.map +1 -1
- package/dist/analytics/contract/financial.js +2 -4
- package/dist/analytics/contract/financial.js.map +1 -1
- package/dist/contracts/schemas/__tests__/common-schemas.test.js +6 -3
- package/dist/contracts/schemas/__tests__/common-schemas.test.js.map +1 -1
- package/dist/contracts/schemas/common.d.ts +2 -0
- package/dist/contracts/schemas/common.d.ts.map +1 -1
- package/dist/contracts/schemas/common.js +8 -2
- package/dist/contracts/schemas/common.js.map +1 -1
- package/dist/engagement/social-transfers/drizzle/migrations/0001_fearless_molecule_man.sql +5 -0
- package/dist/engagement/social-transfers/drizzle/migrations/meta/0001_snapshot.json +287 -0
- package/dist/engagement/social-transfers/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/engagement/social-transfers/schema/index.d.ts.map +1 -1
- package/dist/engagement/social-transfers/schema/index.js +6 -5
- package/dist/engagement/social-transfers/schema/index.js.map +1 -1
- package/dist/pam/tag/__tests__/tag.service.int.test.js +5 -0
- package/dist/pam/tag/__tests__/tag.service.int.test.js.map +1 -1
- package/dist/server/db/__tests__/query-helpers.test.js +12 -1
- package/dist/server/db/__tests__/query-helpers.test.js.map +1 -1
- package/dist/server/db/index.d.ts +1 -1
- package/dist/server/db/index.d.ts.map +1 -1
- package/dist/server/db/index.js +1 -1
- package/dist/server/db/index.js.map +1 -1
- package/dist/server/db/query-helpers.d.ts +1 -0
- package/dist/server/db/query-helpers.d.ts.map +1 -1
- package/dist/server/db/query-helpers.js +12 -0
- package/dist/server/db/query-helpers.js.map +1 -1
- package/dist/wallet/__tests__/wallet-auto-rule.router.int.test.js +7 -3
- package/dist/wallet/__tests__/wallet-auto-rule.router.int.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-auto-withdrawal-config.router.int.test.js +12 -9
- package/dist/wallet/__tests__/wallet-auto-withdrawal-config.router.int.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-auto-withdrawal.int.test.js +5 -5
- package/dist/wallet/__tests__/wallet-auto-withdrawal.int.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet-webhook.router.int.test.js +3 -3
- package/dist/wallet/__tests__/wallet-webhook.router.int.test.js.map +1 -1
- package/dist/wallet/__tests__/wallet.router.int.test.js +5 -2
- package/dist/wallet/__tests__/wallet.router.int.test.js.map +1 -1
- package/dist/wallet/drizzle/migrations/0007_bouncy_swordsman.sql +17 -0
- package/dist/wallet/drizzle/migrations/meta/0007_snapshot.json +723 -0
- package/dist/wallet/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/wallet/schema/index.d.ts +109 -0
- package/dist/wallet/schema/index.d.ts.map +1 -1
- package/dist/wallet/schema/index.js +19 -6
- package/dist/wallet/schema/index.js.map +1 -1
- package/dist/wallet/service/wallet.service.d.ts.map +1 -1
- package/dist/wallet/service/wallet.service.js +5 -4
- package/dist/wallet/service/wallet.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
export
|
|
3
|
-
export type SignedMoneyAmount = z.infer<typeof SignedMoneyAmountSchema>;
|
|
2
|
+
export { SignedMoneyAmountSchema, type SignedMoneyAmount } from '@openora/core/contracts';
|
|
4
3
|
export declare const MoneyByCurrencyRailSchema: z.ZodObject<{
|
|
5
4
|
currency: z.ZodString;
|
|
6
5
|
rail: z.ZodNullable<z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial.d.ts","sourceRoot":"","sources":["../../../src/analytics/contract/financial.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"financial.d.ts","sourceRoot":"","sources":["../../../src/analytics/contract/financial.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAUzB,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE1F,eAAO,MAAM,yBAAyB;;;;;;;iBAIpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,2BAA2B;;;;iBAEtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;iBAG1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,uBAAuB;;;;;;;;;iBAGlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAU7B,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { oc } from '@orpc/contract';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
-
import { CurrencyCodeSchema, DateRangeSchema, GranularitySchema, MoneyAmountSchema, WalletRailSchema, } from '@openora/core/contracts';
|
|
4
|
-
export
|
|
5
|
-
.string()
|
|
6
|
-
.regex(/^-?\d+(\.\d{1,8})?$/, 'must be a decimal string with at most 8 decimal places');
|
|
3
|
+
import { CurrencyCodeSchema, DateRangeSchema, GranularitySchema, MoneyAmountSchema, SignedMoneyAmountSchema, WalletRailSchema, } from '@openora/core/contracts';
|
|
4
|
+
export { SignedMoneyAmountSchema } from '@openora/core/contracts';
|
|
7
5
|
export const MoneyByCurrencyRailSchema = z.object({
|
|
8
6
|
currency: CurrencyCodeSchema,
|
|
9
7
|
rail: WalletRailSchema.nullable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial.js","sourceRoot":"","sources":["../../../src/analytics/contract/financial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,
|
|
1
|
+
{"version":3,"file":"financial.js","sourceRoot":"","sources":["../../../src/analytics/contract/financial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uBAAuB,EAA0B,MAAM,yBAAyB,CAAC;AAE1F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,kBAAkB;IAC5B,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,iBAAiB;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,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CAAC,sBAAsB,CAAC;IAEjC,GAAG,EAAE,EAAE;SACJ,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;SAC1D,KAAK,CAAC,uBAAuB,CAAC;SAC9B,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;CACpC,CAAC"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
2
|
import { MoneyAmountSchema } from '../common.js';
|
|
3
3
|
describe('MoneyAmountSchema', () => {
|
|
4
|
+
it('round-trips a 1-wei ETH amount (18-decimal precision)', () => {
|
|
5
|
+
expect(MoneyAmountSchema.parse('0.000000000000000001')).toBe('0.000000000000000001');
|
|
6
|
+
expect(MoneyAmountSchema.parse('21000000.123456789012345678')).toBe('21000000.123456789012345678');
|
|
7
|
+
});
|
|
4
8
|
it('round-trips an 8-decimal-place crypto amount (BTC-level precision)', () => {
|
|
5
9
|
expect(MoneyAmountSchema.parse('0.00000001')).toBe('0.00000001');
|
|
6
|
-
expect(MoneyAmountSchema.parse('21000000.12345678')).toBe('21000000.12345678');
|
|
7
10
|
});
|
|
8
11
|
it('still accepts a plain 2-decimal fiat amount', () => {
|
|
9
12
|
expect(MoneyAmountSchema.parse('19.99')).toBe('19.99');
|
|
10
13
|
expect(MoneyAmountSchema.parse('0')).toBe('0');
|
|
11
14
|
});
|
|
12
|
-
it('rejects more than
|
|
13
|
-
expect(MoneyAmountSchema.safeParse('0.
|
|
15
|
+
it('rejects more than 18 decimal places and a negative amount', () => {
|
|
16
|
+
expect(MoneyAmountSchema.safeParse('0.0000000000000000001').success).toBe(false);
|
|
14
17
|
expect(MoneyAmountSchema.safeParse('-1').success).toBe(false);
|
|
15
18
|
});
|
|
16
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-schemas.test.js","sourceRoot":"","sources":["../../../../src/contracts/schemas/__tests__/common-schemas.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"common-schemas.test.js","sourceRoot":"","sources":["../../../../src/contracts/schemas/__tests__/common-schemas.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACrF,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CACjE,6BAA6B,CAC9B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjF,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -15,6 +15,8 @@ export declare const ClientMetaSchema: z.ZodObject<{
|
|
|
15
15
|
userAgent: z.ZodNullable<z.ZodString>;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
export type ClientMeta = z.infer<typeof ClientMetaSchema>;
|
|
18
|
+
export declare const MONEY_SCALE = 18;
|
|
19
|
+
export declare const MONEY_PRECISION = 38;
|
|
18
20
|
export declare const MoneyAmountSchema: z.ZodString;
|
|
19
21
|
export type MoneyAmount = z.infer<typeof MoneyAmountSchema>;
|
|
20
22
|
export declare const AUTH_GUARD_REASONS: readonly ["missing_request_context", "authentication_required", "admin_required", "permission_denied"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/contracts/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,eAAe,kBAAmB,CAAC;AAEhD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,eAAO,MAAM,aAAa;;iBAA+B,CAAC;AAC1D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,iBAAiB;;iBAAmC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC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,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -7,9 +7,15 @@ export const ClientMetaSchema = z.object({
|
|
|
7
7
|
ip: z.string().nullable(),
|
|
8
8
|
userAgent: z.string().nullable(),
|
|
9
9
|
});
|
|
10
|
+
// The platform is crypto-first: ETH and most ERC-20s carry 18 decimals, so a balance has
|
|
11
|
+
// to round-trip 0.000000000000000001. Every money column builds its numeric(p,s) from
|
|
12
|
+
// these two constants and both regexes below derive from MONEY_SCALE, so the DB column
|
|
13
|
+
// and the contract can never drift into truncating each other.
|
|
14
|
+
export const MONEY_SCALE = 18;
|
|
15
|
+
export const MONEY_PRECISION = 38;
|
|
10
16
|
export const MoneyAmountSchema = z
|
|
11
17
|
.string()
|
|
12
|
-
.regex(
|
|
18
|
+
.regex(new RegExp(`^\\d+(\\.\\d{1,${MONEY_SCALE}})?$`), `must be a non-negative decimal string with at most ${MONEY_SCALE} decimal places`);
|
|
13
19
|
export const AUTH_GUARD_REASONS = [
|
|
14
20
|
'missing_request_context',
|
|
15
21
|
'authentication_required',
|
|
@@ -22,5 +28,5 @@ export const AuthGuardReasonSchema = z.enum(AUTH_GUARD_REASONS);
|
|
|
22
28
|
// for a balance/threshold/ledger amount, which stay non-negative (MoneyAmountSchema).
|
|
23
29
|
export const SignedMoneyAmountSchema = z
|
|
24
30
|
.string()
|
|
25
|
-
.regex(
|
|
31
|
+
.regex(new RegExp(`^-?\\d+(\\.\\d{1,${MONEY_SCALE}})?$`), `must be a decimal string (optionally negative) with at most ${MONEY_SCALE} decimal places`);
|
|
26
32
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/contracts/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACnC,MAAM,CAAC,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,CAAC,CAAC;AAGH,yFAAyF;AACzF,sFAAsF;AACtF,uFAAuF;AACvF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,EAAE;KACR,KAAK,CACJ,IAAI,MAAM,CAAC,kBAAkB,WAAW,MAAM,CAAC,EAC/C,sDAAsD,WAAW,iBAAiB,CACnF,CAAC;AAGJ,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,yBAAyB;IACzB,yBAAyB;IACzB,gBAAgB;IAChB,mBAAmB;CACX,CAAC;AACX,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAGhE,wFAAwF;AACxF,yFAAyF;AACzF,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,EAAE;KACR,KAAK,CACJ,IAAI,MAAM,CAAC,oBAAoB,WAAW,MAAM,CAAC,EACjD,+DAA+D,WAAW,iBAAiB,CAC5F,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
ALTER TABLE "player_donate" ALTER COLUMN "amount" SET DATA TYPE numeric(38, 18);--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "player_gift" ALTER COLUMN "amount" SET DATA TYPE numeric(38, 18);--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "player_rain" ALTER COLUMN "amount" SET DATA TYPE numeric(38, 18);--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "player_rain" ALTER COLUMN "per_recipient" SET DATA TYPE numeric(38, 18);--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "player_rain_receiver" ALTER COLUMN "amount" SET DATA TYPE numeric(38, 18);
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "51e9e515-ecce-444e-a494-04456bebc142",
|
|
3
|
+
"prevId": "f2a9b9cb-6eba-4596-960b-1bbc7809b899",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.player_donate": {
|
|
8
|
+
"name": "player_donate",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uuid",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true,
|
|
16
|
+
"default": "gen_random_uuid()"
|
|
17
|
+
},
|
|
18
|
+
"sender_id": {
|
|
19
|
+
"name": "sender_id",
|
|
20
|
+
"type": "uuid",
|
|
21
|
+
"primaryKey": false,
|
|
22
|
+
"notNull": true
|
|
23
|
+
},
|
|
24
|
+
"sender_username": {
|
|
25
|
+
"name": "sender_username",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true
|
|
29
|
+
},
|
|
30
|
+
"recipient_id": {
|
|
31
|
+
"name": "recipient_id",
|
|
32
|
+
"type": "uuid",
|
|
33
|
+
"primaryKey": false,
|
|
34
|
+
"notNull": true
|
|
35
|
+
},
|
|
36
|
+
"recipient_username": {
|
|
37
|
+
"name": "recipient_username",
|
|
38
|
+
"type": "text",
|
|
39
|
+
"primaryKey": false,
|
|
40
|
+
"notNull": true
|
|
41
|
+
},
|
|
42
|
+
"amount": {
|
|
43
|
+
"name": "amount",
|
|
44
|
+
"type": "numeric(38, 18)",
|
|
45
|
+
"primaryKey": false,
|
|
46
|
+
"notNull": true
|
|
47
|
+
},
|
|
48
|
+
"currency": {
|
|
49
|
+
"name": "currency",
|
|
50
|
+
"type": "text",
|
|
51
|
+
"primaryKey": false,
|
|
52
|
+
"notNull": true
|
|
53
|
+
},
|
|
54
|
+
"room_id": {
|
|
55
|
+
"name": "room_id",
|
|
56
|
+
"type": "uuid",
|
|
57
|
+
"primaryKey": false,
|
|
58
|
+
"notNull": false
|
|
59
|
+
},
|
|
60
|
+
"created_at": {
|
|
61
|
+
"name": "created_at",
|
|
62
|
+
"type": "timestamp with time zone",
|
|
63
|
+
"primaryKey": false,
|
|
64
|
+
"notNull": true,
|
|
65
|
+
"default": "now()"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"indexes": {},
|
|
69
|
+
"foreignKeys": {},
|
|
70
|
+
"compositePrimaryKeys": {},
|
|
71
|
+
"uniqueConstraints": {},
|
|
72
|
+
"policies": {},
|
|
73
|
+
"checkConstraints": {},
|
|
74
|
+
"isRLSEnabled": false
|
|
75
|
+
},
|
|
76
|
+
"public.player_gift": {
|
|
77
|
+
"name": "player_gift",
|
|
78
|
+
"schema": "",
|
|
79
|
+
"columns": {
|
|
80
|
+
"id": {
|
|
81
|
+
"name": "id",
|
|
82
|
+
"type": "uuid",
|
|
83
|
+
"primaryKey": true,
|
|
84
|
+
"notNull": true,
|
|
85
|
+
"default": "gen_random_uuid()"
|
|
86
|
+
},
|
|
87
|
+
"message_id": {
|
|
88
|
+
"name": "message_id",
|
|
89
|
+
"type": "uuid",
|
|
90
|
+
"primaryKey": false,
|
|
91
|
+
"notNull": true
|
|
92
|
+
},
|
|
93
|
+
"sender_id": {
|
|
94
|
+
"name": "sender_id",
|
|
95
|
+
"type": "uuid",
|
|
96
|
+
"primaryKey": false,
|
|
97
|
+
"notNull": true
|
|
98
|
+
},
|
|
99
|
+
"sender_username": {
|
|
100
|
+
"name": "sender_username",
|
|
101
|
+
"type": "text",
|
|
102
|
+
"primaryKey": false,
|
|
103
|
+
"notNull": true
|
|
104
|
+
},
|
|
105
|
+
"amount": {
|
|
106
|
+
"name": "amount",
|
|
107
|
+
"type": "numeric(38, 18)",
|
|
108
|
+
"primaryKey": false,
|
|
109
|
+
"notNull": true
|
|
110
|
+
},
|
|
111
|
+
"currency": {
|
|
112
|
+
"name": "currency",
|
|
113
|
+
"type": "text",
|
|
114
|
+
"primaryKey": false,
|
|
115
|
+
"notNull": true
|
|
116
|
+
},
|
|
117
|
+
"room_id": {
|
|
118
|
+
"name": "room_id",
|
|
119
|
+
"type": "uuid",
|
|
120
|
+
"primaryKey": false,
|
|
121
|
+
"notNull": false
|
|
122
|
+
},
|
|
123
|
+
"claimed_by": {
|
|
124
|
+
"name": "claimed_by",
|
|
125
|
+
"type": "uuid",
|
|
126
|
+
"primaryKey": false,
|
|
127
|
+
"notNull": false
|
|
128
|
+
},
|
|
129
|
+
"claimed_by_username": {
|
|
130
|
+
"name": "claimed_by_username",
|
|
131
|
+
"type": "text",
|
|
132
|
+
"primaryKey": false,
|
|
133
|
+
"notNull": false
|
|
134
|
+
},
|
|
135
|
+
"claimed_at": {
|
|
136
|
+
"name": "claimed_at",
|
|
137
|
+
"type": "timestamp with time zone",
|
|
138
|
+
"primaryKey": false,
|
|
139
|
+
"notNull": false
|
|
140
|
+
},
|
|
141
|
+
"created_at": {
|
|
142
|
+
"name": "created_at",
|
|
143
|
+
"type": "timestamp with time zone",
|
|
144
|
+
"primaryKey": false,
|
|
145
|
+
"notNull": true,
|
|
146
|
+
"default": "now()"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"indexes": {},
|
|
150
|
+
"foreignKeys": {},
|
|
151
|
+
"compositePrimaryKeys": {},
|
|
152
|
+
"uniqueConstraints": {},
|
|
153
|
+
"policies": {},
|
|
154
|
+
"checkConstraints": {},
|
|
155
|
+
"isRLSEnabled": false
|
|
156
|
+
},
|
|
157
|
+
"public.player_rain": {
|
|
158
|
+
"name": "player_rain",
|
|
159
|
+
"schema": "",
|
|
160
|
+
"columns": {
|
|
161
|
+
"id": {
|
|
162
|
+
"name": "id",
|
|
163
|
+
"type": "uuid",
|
|
164
|
+
"primaryKey": true,
|
|
165
|
+
"notNull": true,
|
|
166
|
+
"default": "gen_random_uuid()"
|
|
167
|
+
},
|
|
168
|
+
"sender_id": {
|
|
169
|
+
"name": "sender_id",
|
|
170
|
+
"type": "uuid",
|
|
171
|
+
"primaryKey": false,
|
|
172
|
+
"notNull": true
|
|
173
|
+
},
|
|
174
|
+
"amount": {
|
|
175
|
+
"name": "amount",
|
|
176
|
+
"type": "numeric(38, 18)",
|
|
177
|
+
"primaryKey": false,
|
|
178
|
+
"notNull": true
|
|
179
|
+
},
|
|
180
|
+
"per_recipient": {
|
|
181
|
+
"name": "per_recipient",
|
|
182
|
+
"type": "numeric(38, 18)",
|
|
183
|
+
"primaryKey": false,
|
|
184
|
+
"notNull": true
|
|
185
|
+
},
|
|
186
|
+
"currency": {
|
|
187
|
+
"name": "currency",
|
|
188
|
+
"type": "text",
|
|
189
|
+
"primaryKey": false,
|
|
190
|
+
"notNull": true
|
|
191
|
+
},
|
|
192
|
+
"room_id": {
|
|
193
|
+
"name": "room_id",
|
|
194
|
+
"type": "uuid",
|
|
195
|
+
"primaryKey": false,
|
|
196
|
+
"notNull": false
|
|
197
|
+
},
|
|
198
|
+
"recipient_count": {
|
|
199
|
+
"name": "recipient_count",
|
|
200
|
+
"type": "integer",
|
|
201
|
+
"primaryKey": false,
|
|
202
|
+
"notNull": true
|
|
203
|
+
},
|
|
204
|
+
"created_at": {
|
|
205
|
+
"name": "created_at",
|
|
206
|
+
"type": "timestamp with time zone",
|
|
207
|
+
"primaryKey": false,
|
|
208
|
+
"notNull": true,
|
|
209
|
+
"default": "now()"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"indexes": {},
|
|
213
|
+
"foreignKeys": {},
|
|
214
|
+
"compositePrimaryKeys": {},
|
|
215
|
+
"uniqueConstraints": {},
|
|
216
|
+
"policies": {},
|
|
217
|
+
"checkConstraints": {},
|
|
218
|
+
"isRLSEnabled": false
|
|
219
|
+
},
|
|
220
|
+
"public.player_rain_receiver": {
|
|
221
|
+
"name": "player_rain_receiver",
|
|
222
|
+
"schema": "",
|
|
223
|
+
"columns": {
|
|
224
|
+
"id": {
|
|
225
|
+
"name": "id",
|
|
226
|
+
"type": "uuid",
|
|
227
|
+
"primaryKey": true,
|
|
228
|
+
"notNull": true,
|
|
229
|
+
"default": "gen_random_uuid()"
|
|
230
|
+
},
|
|
231
|
+
"rain_id": {
|
|
232
|
+
"name": "rain_id",
|
|
233
|
+
"type": "uuid",
|
|
234
|
+
"primaryKey": false,
|
|
235
|
+
"notNull": true
|
|
236
|
+
},
|
|
237
|
+
"recipient_id": {
|
|
238
|
+
"name": "recipient_id",
|
|
239
|
+
"type": "uuid",
|
|
240
|
+
"primaryKey": false,
|
|
241
|
+
"notNull": true
|
|
242
|
+
},
|
|
243
|
+
"amount": {
|
|
244
|
+
"name": "amount",
|
|
245
|
+
"type": "numeric(38, 18)",
|
|
246
|
+
"primaryKey": false,
|
|
247
|
+
"notNull": true
|
|
248
|
+
},
|
|
249
|
+
"created_at": {
|
|
250
|
+
"name": "created_at",
|
|
251
|
+
"type": "timestamp with time zone",
|
|
252
|
+
"primaryKey": false,
|
|
253
|
+
"notNull": true,
|
|
254
|
+
"default": "now()"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"indexes": {},
|
|
258
|
+
"foreignKeys": {
|
|
259
|
+
"player_rain_receiver_rain_id_player_rain_id_fk": {
|
|
260
|
+
"name": "player_rain_receiver_rain_id_player_rain_id_fk",
|
|
261
|
+
"tableFrom": "player_rain_receiver",
|
|
262
|
+
"tableTo": "player_rain",
|
|
263
|
+
"columnsFrom": ["rain_id"],
|
|
264
|
+
"columnsTo": ["id"],
|
|
265
|
+
"onDelete": "no action",
|
|
266
|
+
"onUpdate": "no action"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"compositePrimaryKeys": {},
|
|
270
|
+
"uniqueConstraints": {},
|
|
271
|
+
"policies": {},
|
|
272
|
+
"checkConstraints": {},
|
|
273
|
+
"isRLSEnabled": false
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"enums": {},
|
|
277
|
+
"schemas": {},
|
|
278
|
+
"sequences": {},
|
|
279
|
+
"roles": {},
|
|
280
|
+
"policies": {},
|
|
281
|
+
"views": {},
|
|
282
|
+
"_meta": {
|
|
283
|
+
"columns": {},
|
|
284
|
+
"schemas": {},
|
|
285
|
+
"tables": {}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engagement/social-transfers/schema/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engagement/social-transfers/schema/index.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAarB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC;AAExD,2HAA2H;AAC3H,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,YAAY,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC;AAExD,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,YAAY,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { pgTable, uuid, text, decimal, integer, timestamp } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { MONEY_PRECISION, MONEY_SCALE } from '@openora/core/contracts';
|
|
2
3
|
/**
|
|
3
4
|
* Claimable gift card: sender is debited on send, first other player to claim
|
|
4
5
|
* wins the credit. This module owns the gift persistence table.
|
|
@@ -11,7 +12,7 @@ export const playerGift = pgTable('player_gift', {
|
|
|
11
12
|
messageId: uuid().notNull(),
|
|
12
13
|
senderId: uuid().notNull(),
|
|
13
14
|
senderUsername: text().notNull(),
|
|
14
|
-
amount: decimal({ precision:
|
|
15
|
+
amount: decimal({ precision: MONEY_PRECISION, scale: MONEY_SCALE }).notNull(),
|
|
15
16
|
currency: text().notNull(),
|
|
16
17
|
roomId: uuid(),
|
|
17
18
|
claimedBy: uuid(),
|
|
@@ -26,7 +27,7 @@ export const playerDonate = pgTable('player_donate', {
|
|
|
26
27
|
senderUsername: text().notNull(),
|
|
27
28
|
recipientId: uuid().notNull(),
|
|
28
29
|
recipientUsername: text().notNull(),
|
|
29
|
-
amount: decimal({ precision:
|
|
30
|
+
amount: decimal({ precision: MONEY_PRECISION, scale: MONEY_SCALE }).notNull(),
|
|
30
31
|
currency: text().notNull(),
|
|
31
32
|
roomId: uuid(),
|
|
32
33
|
createdAt: timestamp({ withTimezone: true }).notNull().defaultNow(),
|
|
@@ -40,8 +41,8 @@ export const playerDonate = pgTable('player_donate', {
|
|
|
40
41
|
export const playerRain = pgTable('player_rain', {
|
|
41
42
|
id: uuid().primaryKey().defaultRandom(),
|
|
42
43
|
senderId: uuid().notNull(),
|
|
43
|
-
amount: decimal({ precision:
|
|
44
|
-
perRecipient: decimal({ precision:
|
|
44
|
+
amount: decimal({ precision: MONEY_PRECISION, scale: MONEY_SCALE }).notNull(),
|
|
45
|
+
perRecipient: decimal({ precision: MONEY_PRECISION, scale: MONEY_SCALE }).notNull(),
|
|
45
46
|
currency: text().notNull(),
|
|
46
47
|
roomId: uuid(),
|
|
47
48
|
recipientCount: integer().notNull(),
|
|
@@ -54,7 +55,7 @@ export const playerRainReceiver = pgTable('player_rain_receiver', {
|
|
|
54
55
|
.notNull()
|
|
55
56
|
.references(() => playerRain.id),
|
|
56
57
|
recipientId: uuid().notNull(),
|
|
57
|
-
amount: decimal({ precision:
|
|
58
|
+
amount: decimal({ precision: MONEY_PRECISION, scale: MONEY_SCALE }).notNull(),
|
|
58
59
|
createdAt: timestamp({ withTimezone: true }).notNull().defaultNow(),
|
|
59
60
|
});
|
|
60
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engagement/social-transfers/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engagement/social-transfers/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE;IAC/C,EAAE,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,CAA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@@ -539,6 +539,11 @@ describe('TagService.replacePlayerTag (real PG)', () => {
|
|
|
539
539
|
assignActorUserId: actorId,
|
|
540
540
|
};
|
|
541
541
|
const otherArgs = { ...args, assignReason: 'player level set to 2' };
|
|
542
|
+
// Both replaces must actually overlap at the DB for one of them to lose. The seeds
|
|
543
|
+
// above leave a single warm connection in the pool, so without this the second call
|
|
544
|
+
// pays a TCP connect + startup handshake and can begin only after the first has
|
|
545
|
+
// already committed - a legitimate sequential replace, and both succeed.
|
|
546
|
+
await Promise.all([playerTagsOf(p.id), playerTagsOf(p.id)]);
|
|
542
547
|
const results = await Promise.allSettled([
|
|
543
548
|
svc.replacePlayerTag(args),
|
|
544
549
|
svc.replacePlayerTag(otherArgs),
|