@arken/seer-protocol 0.1.2 → 0.1.3
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/.rush/temp/shrinkwrap-deps.json +246 -2
- package/area/area.models.ts +1 -1
- package/area/area.router.ts +3 -3
- package/area/area.schema.ts +1 -1
- package/area/area.types.ts +2 -3
- package/area/index.ts +0 -1
- package/asset/asset.models.ts +1 -1
- package/asset/asset.router.ts +2 -2
- package/asset/asset.schema.ts +5 -2
- package/asset/asset.types.ts +2 -3
- package/asset/index.ts +0 -1
- package/chain/chain.models.ts +1 -1
- package/chain/chain.router.ts +3 -3
- package/chain/chain.schema.ts +21 -6
- package/chain/chain.types.ts +2 -3
- package/chain/index.ts +0 -1
- package/character/character.models.ts +1 -1
- package/character/character.router.ts +3 -3
- package/character/character.schema.ts +5 -2
- package/character/character.types.ts +2 -3
- package/character/index.ts +0 -1
- package/chat/chat.models.ts +1 -1
- package/chat/chat.router.ts +2 -2
- package/chat/chat.schema.ts +5 -2
- package/chat/chat.types.ts +2 -3
- package/chat/index.ts +0 -1
- package/collection/collection.models.ts +1 -1
- package/collection/collection.router.ts +2 -2
- package/collection/collection.schema.ts +1 -1
- package/collection/collection.types.ts +2 -3
- package/collection/index.ts +0 -1
- package/core/core.models.ts +1 -1
- package/core/core.router.ts +4 -4
- package/core/core.schema.ts +123 -30
- package/core/core.types.ts +2 -3
- package/core/index.ts +0 -1
- package/evolution/evolution.router.ts +11 -11
- package/evolution/evolution.types.ts +1 -2
- package/evolution/index.ts +0 -1
- package/game/game.models.ts +1 -1
- package/game/game.router.ts +3 -3
- package/game/game.schema.ts +1 -1
- package/game/game.types.ts +2 -3
- package/game/index.ts +0 -1
- package/index.ts +39 -39
- package/infinite/index.ts +0 -1
- package/infinite/infinite.router.ts +1 -1
- package/infinite/infinite.types.ts +1 -2
- package/interface/index.ts +0 -1
- package/interface/interface.models.ts +1 -1
- package/interface/interface.router.ts +3 -3
- package/interface/interface.schema.ts +1 -1
- package/interface/interface.types.ts +2 -3
- package/isles/index.ts +0 -1
- package/isles/isles.router.ts +1 -1
- package/isles/isles.types.ts +1 -2
- package/item/index.ts +0 -1
- package/item/item.models.ts +1 -1
- package/item/item.router.ts +3 -3
- package/item/item.schema.ts +39 -9
- package/item/item.types.ts +2 -3
- package/job/index.ts +0 -1
- package/job/job.models.ts +1 -1
- package/job/job.router.ts +3 -3
- package/job/job.schema.ts +1 -1
- package/job/job.types.ts +2 -3
- package/market/index.ts +0 -1
- package/market/market.models.ts +1 -1
- package/market/market.router.ts +2 -2
- package/market/market.schema.ts +13 -4
- package/market/market.types.ts +2 -3
- package/oasis/index.ts +0 -1
- package/oasis/oasis.router.ts +3 -4
- package/oasis/oasis.types.ts +1 -2
- package/package.json +10 -4
- package/product/index.ts +0 -1
- package/product/product.models.ts +1 -1
- package/product/product.router.ts +2 -2
- package/product/product.schema.ts +50 -13
- package/product/product.types.ts +2 -3
- package/profile/index.ts +0 -1
- package/profile/profile.models.ts +1 -1
- package/profile/profile.router.ts +3 -3
- package/profile/profile.schema.ts +82 -19
- package/profile/profile.types.ts +2 -3
- package/raffle/index.ts +0 -1
- package/raffle/raffle.models.ts +1 -1
- package/raffle/raffle.router.ts +2 -2
- package/raffle/raffle.schema.ts +1 -1
- package/raffle/raffle.types.ts +2 -3
- package/skill/index.ts +0 -1
- package/skill/skill.models.ts +1 -1
- package/skill/skill.router.ts +3 -3
- package/skill/skill.schema.ts +17 -5
- package/skill/skill.types.ts +2 -3
- package/trek/index.ts +0 -1
- package/trek/trek.router.ts +1 -1
- package/tsconfig.json +25 -17
- package/types.ts +35 -54
- package/video/index.ts +0 -1
- package/video/video.models.ts +1 -1
- package/video/video.router.ts +3 -3
- package/video/video.schema.ts +1 -1
- package/video/video.types.ts +2 -3
package/item/item.schema.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z, ObjectId, Entity } from '
|
|
1
|
+
import { z, ObjectId, Entity } from '../schema';
|
|
2
2
|
|
|
3
3
|
export const ItemAttribute = Entity.merge(
|
|
4
4
|
z.object({
|
|
@@ -60,7 +60,10 @@ export const ItemAffix = Entity.merge(
|
|
|
60
60
|
isPrefix: z.boolean().default(false),
|
|
61
61
|
isSuffix: z.boolean().default(false),
|
|
62
62
|
isTitle: z.boolean().default(false),
|
|
63
|
-
weight: z
|
|
63
|
+
weight: z
|
|
64
|
+
.number()
|
|
65
|
+
.min(0)
|
|
66
|
+
.default(1),
|
|
64
67
|
typeIds: z.array(ObjectId).optional(),
|
|
65
68
|
rarityIds: z.array(ObjectId).optional(),
|
|
66
69
|
})
|
|
@@ -80,7 +83,10 @@ export const ItemSkin = Entity.merge(
|
|
|
80
83
|
|
|
81
84
|
export const ItemTransmute = Entity.merge(
|
|
82
85
|
z.object({
|
|
83
|
-
token: z
|
|
86
|
+
token: z
|
|
87
|
+
.string()
|
|
88
|
+
.max(500)
|
|
89
|
+
.min(1),
|
|
84
90
|
assetId: ObjectId,
|
|
85
91
|
itemId: ObjectId,
|
|
86
92
|
chainId: ObjectId.optional(),
|
|
@@ -104,17 +110,41 @@ export const Item = Entity.merge(
|
|
|
104
110
|
slotIds: z.array(ItemSlot.optional()),
|
|
105
111
|
setId: ItemSet.optional(),
|
|
106
112
|
attributes: z.array(ItemAttribute).optional(),
|
|
107
|
-
token: z
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
token: z
|
|
114
|
+
.string()
|
|
115
|
+
.max(500)
|
|
116
|
+
.min(1)
|
|
117
|
+
.optional(),
|
|
118
|
+
quantity: z
|
|
119
|
+
.number()
|
|
120
|
+
.int()
|
|
121
|
+
.nonnegative()
|
|
122
|
+
.default(1),
|
|
123
|
+
x: z
|
|
124
|
+
.number()
|
|
125
|
+
.int()
|
|
126
|
+
.nonnegative()
|
|
127
|
+
.optional(),
|
|
128
|
+
y: z
|
|
129
|
+
.number()
|
|
130
|
+
.int()
|
|
131
|
+
.nonnegative()
|
|
132
|
+
.optional(),
|
|
111
133
|
distribution: z
|
|
112
134
|
.enum(['Unknown', 'Found', 'Fundraiser', 'Claimed', 'Crafted', 'Airdrop', 'Reward', 'Farmed', 'Migration'])
|
|
113
135
|
.default('Unknown'),
|
|
114
136
|
// properties: z.record(z.any()).optional(),
|
|
115
137
|
// type: z.string().default('bag'), // stash, bag, equipment, etc.
|
|
116
138
|
items: z.array(z.lazy(() => Item)).default([]),
|
|
117
|
-
capacity: z
|
|
118
|
-
|
|
139
|
+
capacity: z
|
|
140
|
+
.number()
|
|
141
|
+
.int()
|
|
142
|
+
.nonnegative()
|
|
143
|
+
.default(60),
|
|
144
|
+
points: z
|
|
145
|
+
.number()
|
|
146
|
+
.int()
|
|
147
|
+
.nonnegative()
|
|
148
|
+
.default(0),
|
|
119
149
|
})
|
|
120
150
|
);
|
package/item/item.types.ts
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as schema from './item.schema';
|
|
5
|
-
import { Document, Model } from '
|
|
6
|
-
import type { RouterContext } from '
|
|
5
|
+
import { Document, Model } from '@arken/node/mongo';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
7
|
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
8
8
|
import type { Router } from './item.router';
|
|
9
9
|
|
|
10
10
|
export type * from './item.router';
|
|
11
|
-
export type * from './item.service';
|
|
12
11
|
export type { RouterContext };
|
|
13
12
|
|
|
14
13
|
export type Item = z.infer<typeof schema.Item>;
|
package/job/index.ts
CHANGED
package/job/job.models.ts
CHANGED
package/job/job.router.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { z as zod } from 'zod';
|
|
4
4
|
import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
5
|
-
import { customErrorFormatter, hasRole } from '
|
|
6
|
-
import type { RouterContext } from '
|
|
5
|
+
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
7
|
import { Job } from './job.schema';
|
|
8
|
-
import { Query } from '
|
|
8
|
+
import { Query } from '../schema';
|
|
9
9
|
|
|
10
10
|
export const z = zod;
|
|
11
11
|
export const t = initTRPC.context<RouterContext>().create();
|
package/job/job.schema.ts
CHANGED
package/job/job.types.ts
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as schema from './job.schema';
|
|
5
|
-
import { Document, Model } from '
|
|
6
|
-
import type { RouterContext } from '
|
|
5
|
+
import { Document, Model } from '@arken/node/mongo';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
7
|
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
8
8
|
import type { Router } from './job.router';
|
|
9
9
|
|
|
10
10
|
export type * from './job.router';
|
|
11
|
-
export type * from './job.service';
|
|
12
11
|
export type { RouterContext };
|
|
13
12
|
|
|
14
13
|
export type Job = z.infer<typeof schema.Job>;
|
package/market/index.ts
CHANGED
package/market/market.models.ts
CHANGED
package/market/market.router.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { z as zod } from 'zod';
|
|
4
4
|
import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
5
|
-
import { customErrorFormatter, hasRole } from '
|
|
6
|
-
import type { RouterContext } from '
|
|
5
|
+
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
7
|
import { Market, MarketPair, MarketExchange } from './market.schema';
|
|
8
8
|
|
|
9
9
|
export const z = zod;
|
package/market/market.schema.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z, Entity, ObjectId } from '
|
|
1
|
+
import { z, Entity, ObjectId } from '../schema';
|
|
2
2
|
|
|
3
3
|
export const Market = Entity.merge(
|
|
4
4
|
z.object({
|
|
@@ -23,7 +23,10 @@ export const MarketAnalysis = Entity.merge(
|
|
|
23
23
|
action: z.enum(['Buy', 'Sell']), // buy or sell action
|
|
24
24
|
asset: z.string().min(1), // the asset being traded (e.g., oil, Bitcoin)
|
|
25
25
|
signalType: z.string().min(1), // type of signal (e.g., news)
|
|
26
|
-
confidence: z
|
|
26
|
+
confidence: z
|
|
27
|
+
.number()
|
|
28
|
+
.min(0)
|
|
29
|
+
.max(100), // confidence level from 0 to 100
|
|
27
30
|
riskLevel: z.enum(['Low', 'Medium', 'High']), // risk level
|
|
28
31
|
timeFrame: z.enum(['Short-Term', 'Long-Term']), // investment time frame
|
|
29
32
|
source: z.string().min(1), // source of information (e.g., FinancialJuice, Ground News)
|
|
@@ -133,8 +136,14 @@ export const MarketStockSentiment = Entity.merge(
|
|
|
133
136
|
companyId: ObjectId,
|
|
134
137
|
sentiment: z.object({
|
|
135
138
|
label: z.enum(['Positive', 'Neutral', 'Negative']), // predefined sentiment labels
|
|
136
|
-
score: z
|
|
139
|
+
score: z
|
|
140
|
+
.number()
|
|
141
|
+
.min(0)
|
|
142
|
+
.max(1), // sentiment score as a confidence percentage
|
|
137
143
|
}),
|
|
138
|
-
confidence: z
|
|
144
|
+
confidence: z
|
|
145
|
+
.number()
|
|
146
|
+
.min(0)
|
|
147
|
+
.max(1), // overall confidence level for the analysis
|
|
139
148
|
})
|
|
140
149
|
);
|
package/market/market.types.ts
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as schema from './market.schema';
|
|
5
|
-
import { Document, Model } from '
|
|
6
|
-
import type { RouterContext } from '
|
|
5
|
+
import { Document, Model } from '@arken/node/mongo';
|
|
6
|
+
import type { RouterContext } from '../types';
|
|
7
7
|
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
8
8
|
import type { Router } from './market.router';
|
|
9
9
|
|
|
10
10
|
export type * from './market.router';
|
|
11
|
-
export type * from './market.service';
|
|
12
11
|
export type { RouterContext };
|
|
13
12
|
|
|
14
13
|
export type Market = z.infer<typeof schema.Market>;
|
package/oasis/index.ts
CHANGED
package/oasis/oasis.router.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z as zod } from 'zod';
|
|
2
2
|
import { initTRPC } from '@trpc/server';
|
|
3
3
|
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
4
|
-
import * as Arken from '@arken/node';
|
|
5
4
|
import { Query, getQueryInput, inferRouterOutputs, inferRouterInputs } from '@arken/node/schema';
|
|
6
|
-
import { RouterContext } from '
|
|
5
|
+
import { RouterContext, Core, Profile } from '../types';
|
|
7
6
|
|
|
8
7
|
export const z = zod;
|
|
9
8
|
export const t = initTRPC.context<RouterContext>().create();
|
|
@@ -15,7 +14,7 @@ export const createRouter = () =>
|
|
|
15
14
|
getPatrons: procedure
|
|
16
15
|
.use(hasRole('guest', t))
|
|
17
16
|
.use(customErrorFormatter(t))
|
|
18
|
-
.output(z.array(
|
|
17
|
+
.output(z.array(Profile.Schemas.Profile))
|
|
19
18
|
.query(({ input, ctx }) => (ctx.app.service.Oasis.getPatrons as any)(input, ctx)),
|
|
20
19
|
|
|
21
20
|
interact: t.procedure
|
|
@@ -55,7 +54,7 @@ export const createRouter = () =>
|
|
|
55
54
|
z: 1000,
|
|
56
55
|
},
|
|
57
56
|
},
|
|
58
|
-
] as
|
|
57
|
+
] as Core.Types.Object,
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
60
|
|
package/oasis/oasis.types.ts
CHANGED
|
@@ -3,8 +3,7 @@ import { Model, Document } from '@arken/node/mongo';
|
|
|
3
3
|
import * as schema from './oasis.schema';
|
|
4
4
|
|
|
5
5
|
export type * from './oasis.router';
|
|
6
|
-
export type
|
|
7
|
-
export type { RouterContext } from '../../types';
|
|
6
|
+
export type { RouterContext } from '../types';
|
|
8
7
|
|
|
9
8
|
// // Define types based on the schema
|
|
10
9
|
// export type Game = z.infer<typeof schema.Game>;
|
package/package.json
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arken/seer-protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm-run-all dist",
|
|
7
7
|
"clean": "del-cli ./build && make-dir ./build",
|
|
8
8
|
"dist": "npm-run-all clean tsc:*",
|
|
9
9
|
"publish": "npm publish --access=public",
|
|
10
|
-
"tsc:1": "rm -rf ./build && mkdir ./build && cp package.json ./build && NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 tsc"
|
|
10
|
+
"tsc:1": "rm -rf ./build && mkdir ./build && cp package.json ./build && NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 tsc --listFiles"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@arken/node": "^1.5.
|
|
13
|
+
"@arken/node": "^1.5.3",
|
|
14
14
|
"@arken/forge-protocol": "^0.1.1",
|
|
15
15
|
"@trpc/client": "11.0.0-rc.660",
|
|
16
16
|
"@trpc/server": "11.0.0-rc.660",
|
|
17
|
+
"make-dir-cli": "^3",
|
|
18
|
+
"jest": "^29",
|
|
19
|
+
"@types/jest": "^29",
|
|
20
|
+
"@types/node": "^20",
|
|
17
21
|
"zod": "^3",
|
|
18
22
|
"dotenv": "^16",
|
|
19
23
|
"lodash": "^4",
|
|
20
24
|
"dayjs": "^1"
|
|
21
25
|
},
|
|
22
|
-
"devDependencies": {
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"del-cli": "^5"
|
|
28
|
+
}
|
|
23
29
|
}
|
package/product/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z as zod } from 'zod';
|
|
2
2
|
import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
3
|
-
import { customErrorFormatter, hasRole } from '
|
|
4
|
-
import type { RouterContext } from '
|
|
3
|
+
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
4
|
+
import type { RouterContext } from '../types';
|
|
5
5
|
import { Product, ProductDLC, ProductBundle, ProductReview } from './product.schema';
|
|
6
6
|
|
|
7
7
|
export const z = zod;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z, ObjectId, Entity } from '
|
|
1
|
+
import { z, ObjectId, Entity } from '../schema';
|
|
2
2
|
|
|
3
3
|
// Extend the ProductMeta schema
|
|
4
4
|
const ProductMeta = z.object({
|
|
@@ -6,7 +6,10 @@ const ProductMeta = z.object({
|
|
|
6
6
|
members: z.array(ObjectId), // Array of Profile references
|
|
7
7
|
isProposal: z.boolean(),
|
|
8
8
|
price: z.number().nonnegative(),
|
|
9
|
-
oldPrice: z
|
|
9
|
+
oldPrice: z
|
|
10
|
+
.number()
|
|
11
|
+
.nonnegative()
|
|
12
|
+
.optional(),
|
|
10
13
|
images: z.record(z.string(), z.any()),
|
|
11
14
|
video: z.string().url(),
|
|
12
15
|
genre: z.string(),
|
|
@@ -18,7 +21,10 @@ const ProductMeta = z.object({
|
|
|
18
21
|
systemRequirements: z.array(z.any()), // Replace with actual SystemRequirement schema if available
|
|
19
22
|
tags: z.array(ObjectId), // Array of Tag references
|
|
20
23
|
type: z.string(),
|
|
21
|
-
downloads: z
|
|
24
|
+
downloads: z
|
|
25
|
+
.number()
|
|
26
|
+
.int()
|
|
27
|
+
.nonnegative(),
|
|
22
28
|
plans: z.array(z.any()), // Replace with actual ProductPlan schema if available
|
|
23
29
|
frequentlyTradedAssets: z.array(ObjectId), // Array of Asset references
|
|
24
30
|
saleBox: z.record(z.string(), z.any()),
|
|
@@ -32,15 +38,24 @@ const ProductMeta = z.object({
|
|
|
32
38
|
// Updated Product schema
|
|
33
39
|
export const Product = Entity.merge(
|
|
34
40
|
z.object({
|
|
35
|
-
shortDescription: z
|
|
41
|
+
shortDescription: z
|
|
42
|
+
.string()
|
|
43
|
+
.max(300)
|
|
44
|
+
.min(1),
|
|
36
45
|
content: z.string().min(1),
|
|
37
46
|
communityId: ObjectId,
|
|
38
|
-
type: z
|
|
47
|
+
type: z
|
|
48
|
+
.string()
|
|
49
|
+
.max(100)
|
|
50
|
+
.default('game'),
|
|
39
51
|
releaseDate: z.date().optional(),
|
|
40
52
|
sku: z.string().min(1),
|
|
41
53
|
categoryId: ObjectId.optional(),
|
|
42
54
|
price: z.number().nonnegative(),
|
|
43
|
-
discountPrice: z
|
|
55
|
+
discountPrice: z
|
|
56
|
+
.number()
|
|
57
|
+
.nonnegative()
|
|
58
|
+
.optional(),
|
|
44
59
|
currency: z.string().length(3),
|
|
45
60
|
images: z.array(z.string().url()).optional(),
|
|
46
61
|
videos: z.array(z.string().url()).optional(),
|
|
@@ -60,7 +75,10 @@ export const Product = Entity.merge(
|
|
|
60
75
|
z.object({
|
|
61
76
|
name: z.string(),
|
|
62
77
|
description: z.string().optional(),
|
|
63
|
-
icon: z
|
|
78
|
+
icon: z
|
|
79
|
+
.string()
|
|
80
|
+
.url()
|
|
81
|
+
.optional(),
|
|
64
82
|
})
|
|
65
83
|
)
|
|
66
84
|
.optional(),
|
|
@@ -68,7 +86,10 @@ export const Product = Entity.merge(
|
|
|
68
86
|
.array(
|
|
69
87
|
z.object({
|
|
70
88
|
userId: ObjectId,
|
|
71
|
-
rating: z
|
|
89
|
+
rating: z
|
|
90
|
+
.number()
|
|
91
|
+
.min(1)
|
|
92
|
+
.max(5),
|
|
72
93
|
comment: z.string().optional(),
|
|
73
94
|
createdDate: z.date().default(() => new Date()),
|
|
74
95
|
})
|
|
@@ -76,7 +97,11 @@ export const Product = Entity.merge(
|
|
|
76
97
|
.optional(),
|
|
77
98
|
cloudSave: z.boolean().default(false),
|
|
78
99
|
ugcSupport: z.boolean().default(false),
|
|
79
|
-
wishlistCount: z
|
|
100
|
+
wishlistCount: z
|
|
101
|
+
.number()
|
|
102
|
+
.int()
|
|
103
|
+
.nonnegative()
|
|
104
|
+
.default(0),
|
|
80
105
|
|
|
81
106
|
// Additional fields from Objection.js model
|
|
82
107
|
parentId: ObjectId.optional(),
|
|
@@ -95,7 +120,10 @@ export const ProductDLC = Entity.merge(
|
|
|
95
120
|
description: z.string().optional(),
|
|
96
121
|
gameId: ObjectId,
|
|
97
122
|
price: z.number().nonnegative(),
|
|
98
|
-
discountPrice: z
|
|
123
|
+
discountPrice: z
|
|
124
|
+
.number()
|
|
125
|
+
.nonnegative()
|
|
126
|
+
.optional(),
|
|
99
127
|
currency: z.string().length(3),
|
|
100
128
|
digitalContent: z
|
|
101
129
|
.array(
|
|
@@ -111,7 +139,10 @@ export const ProductDLC = Entity.merge(
|
|
|
111
139
|
z.object({
|
|
112
140
|
name: z.string(),
|
|
113
141
|
description: z.string().optional(),
|
|
114
|
-
icon: z
|
|
142
|
+
icon: z
|
|
143
|
+
.string()
|
|
144
|
+
.url()
|
|
145
|
+
.optional(),
|
|
115
146
|
})
|
|
116
147
|
)
|
|
117
148
|
.optional(),
|
|
@@ -125,7 +156,10 @@ export const ProductBundle = Entity.merge(
|
|
|
125
156
|
description: z.string().optional(),
|
|
126
157
|
products: z.array(ObjectId),
|
|
127
158
|
price: z.number().nonnegative(),
|
|
128
|
-
discountPrice: z
|
|
159
|
+
discountPrice: z
|
|
160
|
+
.number()
|
|
161
|
+
.nonnegative()
|
|
162
|
+
.optional(),
|
|
129
163
|
currency: z.string().length(3),
|
|
130
164
|
})
|
|
131
165
|
);
|
|
@@ -135,7 +169,10 @@ export const ProductReview = Entity.merge(
|
|
|
135
169
|
z.object({
|
|
136
170
|
userId: ObjectId,
|
|
137
171
|
productId: ObjectId,
|
|
138
|
-
rating: z
|
|
172
|
+
rating: z
|
|
173
|
+
.number()
|
|
174
|
+
.min(1)
|
|
175
|
+
.max(5),
|
|
139
176
|
comment: z.string().optional(),
|
|
140
177
|
})
|
|
141
178
|
);
|
package/product/product.types.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as schema from './product.schema';
|
|
3
|
-
import { Document, Model } from '
|
|
4
|
-
import type { RouterContext } from '
|
|
3
|
+
import { Document, Model } from '@arken/node/mongo';
|
|
4
|
+
import type { RouterContext } from '../types';
|
|
5
5
|
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
6
6
|
import type { Router } from './product.router';
|
|
7
7
|
|
|
8
8
|
export type * from './product.router';
|
|
9
|
-
export type * from './product.service';
|
|
10
9
|
export type { RouterContext };
|
|
11
10
|
|
|
12
11
|
export type Product = z.infer<typeof schema.Product>;
|
package/profile/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z as zod } from 'zod';
|
|
2
2
|
import { initTRPC, inferRouterInputs } from '@trpc/server';
|
|
3
|
-
import { customErrorFormatter, hasRole } from '
|
|
4
|
-
import type { RouterContext } from '
|
|
3
|
+
import { customErrorFormatter, hasRole } from '@arken/node/rpc';
|
|
4
|
+
import type { RouterContext } from '../types';
|
|
5
5
|
import { Profile } from './profile.schema';
|
|
6
|
-
import { Query, getQueryInput, getQueryOutput, inferRouterOutputs } from '
|
|
6
|
+
import { Query, getQueryInput, getQueryOutput, inferRouterOutputs } from '../schema';
|
|
7
7
|
|
|
8
8
|
export const z = zod;
|
|
9
9
|
export const t = initTRPC.context<RouterContext>().create();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// profile.schema.ts
|
|
2
2
|
//
|
|
3
|
-
import { z, ObjectId, Entity } from '
|
|
3
|
+
import { z, ObjectId, Entity } from '../schema';
|
|
4
4
|
import { Character } from '../character/character.schema';
|
|
5
5
|
import { Achievement, Badge } from '../core/core.schema';
|
|
6
6
|
|
|
@@ -44,7 +44,10 @@ const ServerDataSchema = z.object({
|
|
|
44
44
|
winRatio: z.number().optional(),
|
|
45
45
|
timeSpent: z.number().optional(),
|
|
46
46
|
winStreak: z.number().optional(),
|
|
47
|
-
averageLatency: z
|
|
47
|
+
averageLatency: z
|
|
48
|
+
.number()
|
|
49
|
+
.nullable()
|
|
50
|
+
.optional(),
|
|
48
51
|
killDeathRatio: z.number().optional(),
|
|
49
52
|
roundPointRatio: z.number().optional(),
|
|
50
53
|
});
|
|
@@ -59,21 +62,39 @@ export const Profile = Entity.merge(
|
|
|
59
62
|
telegramUserId: z.number().optional(),
|
|
60
63
|
interactions: z.number().default(0),
|
|
61
64
|
activityRating: z.number().default(0),
|
|
62
|
-
address: z
|
|
63
|
-
|
|
65
|
+
address: z
|
|
66
|
+
.string()
|
|
67
|
+
.max(100)
|
|
68
|
+
.optional(),
|
|
69
|
+
avatar: z
|
|
70
|
+
.string()
|
|
71
|
+
.max(100)
|
|
72
|
+
.optional(),
|
|
64
73
|
roleId: ObjectId.optional(),
|
|
65
|
-
privateKey: z
|
|
66
|
-
|
|
74
|
+
privateKey: z
|
|
75
|
+
.string()
|
|
76
|
+
.max(300)
|
|
77
|
+
.optional(),
|
|
78
|
+
signature: z
|
|
79
|
+
.string()
|
|
80
|
+
.max(200)
|
|
81
|
+
.optional(),
|
|
67
82
|
chainId: ObjectId.optional(),
|
|
68
83
|
teamId: ObjectId.optional(),
|
|
69
84
|
characterId: ObjectId.optional(),
|
|
70
85
|
isBanned: z.boolean().optional(),
|
|
71
86
|
banExpireDate: z.date().optional(),
|
|
72
87
|
banReason: z.string().optional(),
|
|
73
|
-
mode: z
|
|
88
|
+
mode: z
|
|
89
|
+
.string()
|
|
90
|
+
.default('gamer')
|
|
91
|
+
.optional(),
|
|
74
92
|
|
|
75
93
|
bio: z.string().optional(),
|
|
76
|
-
banner: z
|
|
94
|
+
banner: z
|
|
95
|
+
.string()
|
|
96
|
+
.url()
|
|
97
|
+
.optional(), // URL to the user's banner image
|
|
77
98
|
friends: z
|
|
78
99
|
.array(
|
|
79
100
|
z.object({
|
|
@@ -111,16 +132,55 @@ export const Profile = Entity.merge(
|
|
|
111
132
|
.optional(),
|
|
112
133
|
stats: z
|
|
113
134
|
.object({
|
|
114
|
-
gamesOwned: z
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
gamesOwned: z
|
|
136
|
+
.number()
|
|
137
|
+
.int()
|
|
138
|
+
.nonnegative()
|
|
139
|
+
.default(0),
|
|
140
|
+
playedMinutes: z
|
|
141
|
+
.number()
|
|
142
|
+
.nonnegative()
|
|
143
|
+
.default(0), // Total playtime in hours
|
|
144
|
+
leveledUpCount: z
|
|
145
|
+
.number()
|
|
146
|
+
.int()
|
|
147
|
+
.nonnegative()
|
|
148
|
+
.default(0),
|
|
149
|
+
xpEarnedCount: z
|
|
150
|
+
.number()
|
|
151
|
+
.int()
|
|
152
|
+
.nonnegative()
|
|
153
|
+
.default(0),
|
|
154
|
+
craftedItemCount: z
|
|
155
|
+
.number()
|
|
156
|
+
.int()
|
|
157
|
+
.nonnegative()
|
|
158
|
+
.default(0),
|
|
159
|
+
equippedItemCount: z
|
|
160
|
+
.number()
|
|
161
|
+
.int()
|
|
162
|
+
.nonnegative()
|
|
163
|
+
.default(0),
|
|
164
|
+
transferredInCount: z
|
|
165
|
+
.number()
|
|
166
|
+
.int()
|
|
167
|
+
.nonnegative()
|
|
168
|
+
.default(0),
|
|
169
|
+
transferredOutCount: z
|
|
170
|
+
.number()
|
|
171
|
+
.int()
|
|
172
|
+
.nonnegative()
|
|
173
|
+
.default(0),
|
|
174
|
+
marketTradeSoldCount: z
|
|
175
|
+
.number()
|
|
176
|
+
.int()
|
|
177
|
+
.nonnegative()
|
|
178
|
+
.default(0),
|
|
179
|
+
marketTradeListedCount: z
|
|
180
|
+
.number()
|
|
181
|
+
.int()
|
|
182
|
+
.nonnegative()
|
|
183
|
+
.default(0),
|
|
124
184
|
evolution: z
|
|
125
185
|
.object({
|
|
126
186
|
hashes: z.array(z.string()).default([]),
|
|
@@ -141,7 +201,10 @@ export const Profile = Entity.merge(
|
|
|
141
201
|
winRatio: z.number().optional(),
|
|
142
202
|
timeSpent: z.number().optional(),
|
|
143
203
|
winStreak: z.number().optional(),
|
|
144
|
-
averageLatency: z
|
|
204
|
+
averageLatency: z
|
|
205
|
+
.number()
|
|
206
|
+
.optional()
|
|
207
|
+
.nullable(),
|
|
145
208
|
killDeathRatio: z.number().optional(),
|
|
146
209
|
roundPointRatio: z.number().optional(),
|
|
147
210
|
})
|