@arken/node 1.5.1 → 1.5.2
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/db.ts +76 -1
- package/index.ts +351 -18
- package/package.json +3 -3
- package/tsconfig.json +33 -2
- package/util.ts +1 -0
- package/modules/area/area.models.ts +0 -15
- package/modules/area/area.router.ts +0 -74
- package/modules/area/area.schema.ts +0 -22
- package/modules/area/area.service.ts +0 -124
- package/modules/area/area.types.ts +0 -26
- package/modules/area/index.ts +0 -5
- package/modules/asset/asset.models.ts +0 -59
- package/modules/asset/asset.router.ts +0 -55
- package/modules/asset/asset.schema.ts +0 -27
- package/modules/asset/asset.service.ts +0 -85
- package/modules/asset/asset.types.ts +0 -22
- package/modules/asset/index.ts +0 -5
- package/modules/chain/chain.models.ts +0 -50
- package/modules/chain/chain.router.ts +0 -104
- package/modules/chain/chain.schema.ts +0 -52
- package/modules/chain/chain.service.ts +0 -167
- package/modules/chain/chain.types.ts +0 -24
- package/modules/chain/index.ts +0 -5
- package/modules/character/character.models.ts +0 -174
- package/modules/character/character.router.ts +0 -314
- package/modules/character/character.schema.ts +0 -147
- package/modules/character/character.service.ts +0 -876
- package/modules/character/character.types.ts +0 -64
- package/modules/character/index.ts +0 -5
- package/modules/chat/chat.models.ts +0 -43
- package/modules/chat/chat.router.ts +0 -67
- package/modules/chat/chat.schema.ts +0 -36
- package/modules/chat/chat.service.ts +0 -128
- package/modules/chat/chat.types.ts +0 -20
- package/modules/chat/index.ts +0 -5
- package/modules/collection/collection.models.ts +0 -76
- package/modules/collection/collection.router.ts +0 -91
- package/modules/collection/collection.schema.ts +0 -90
- package/modules/collection/collection.service.ts +0 -192
- package/modules/collection/collection.types.ts +0 -36
- package/modules/collection/index.ts +0 -5
- package/modules/core/core.models.ts +0 -1380
- package/modules/core/core.router.ts +0 -1781
- package/modules/core/core.schema.ts +0 -847
- package/modules/core/core.service.ts +0 -2824
- package/modules/core/core.types.ts +0 -340
- package/modules/core/index.ts +0 -5
- package/modules/core/mail/applyPatchesOrMail.ts +0 -568
- package/modules/core/mail/mailClaimablePatchesBatch.ts +0 -381
- package/modules/game/game.models.ts +0 -53
- package/modules/game/game.router.ts +0 -110
- package/modules/game/game.schema.ts +0 -23
- package/modules/game/game.service.ts +0 -143
- package/modules/game/game.types.ts +0 -28
- package/modules/game/index.ts +0 -5
- package/modules/interface/index.ts +0 -5
- package/modules/interface/interface.canonicalize.ts +0 -279
- package/modules/interface/interface.models.ts +0 -40
- package/modules/interface/interface.router.ts +0 -175
- package/modules/interface/interface.schema.ts +0 -59
- package/modules/interface/interface.service.ts +0 -356
- package/modules/interface/interface.types.ts +0 -25
- package/modules/item/index.ts +0 -5
- package/modules/item/item.models.ts +0 -124
- package/modules/item/item.router.ts +0 -103
- package/modules/item/item.schema.ts +0 -120
- package/modules/item/item.service.ts +0 -167
- package/modules/item/item.types.ts +0 -74
- package/modules/job/index.ts +0 -5
- package/modules/job/job.models.ts +0 -14
- package/modules/job/job.router.ts +0 -44
- package/modules/job/job.schema.ts +0 -9
- package/modules/job/job.service.ts +0 -243
- package/modules/job/job.types.ts +0 -23
- package/modules/market/index.ts +0 -5
- package/modules/market/market.models.ts +0 -113
- package/modules/market/market.router.ts +0 -73
- package/modules/market/market.schema.ts +0 -140
- package/modules/market/market.service.ts +0 -122
- package/modules/market/market.types.ts +0 -56
- package/modules/product/index.ts +0 -5
- package/modules/product/product.models.ts +0 -166
- package/modules/product/product.router.ts +0 -93
- package/modules/product/product.schema.ts +0 -149
- package/modules/product/product.service.ts +0 -160
- package/modules/product/product.types.ts +0 -33
- package/modules/profile/index.ts +0 -5
- package/modules/profile/profile.models.ts +0 -214
- package/modules/profile/profile.router.ts +0 -72
- package/modules/profile/profile.schema.ts +0 -156
- package/modules/profile/profile.service.ts +0 -149
- package/modules/profile/profile.types.ts +0 -22
- package/modules/raffle/index.ts +0 -5
- package/modules/raffle/raffle.models.ts +0 -44
- package/modules/raffle/raffle.router.ts +0 -90
- package/modules/raffle/raffle.schema.ts +0 -32
- package/modules/raffle/raffle.service.ts +0 -167
- package/modules/raffle/raffle.types.ts +0 -30
- package/modules/skill/index.ts +0 -5
- package/modules/skill/skill.models.ts +0 -16
- package/modules/skill/skill.router.ts +0 -201
- package/modules/skill/skill.schema.ts +0 -40
- package/modules/skill/skill.service.ts +0 -390
- package/modules/skill/skill.types.ts +0 -33
- package/modules/video/index.ts +0 -5
- package/modules/video/video.models.ts +0 -25
- package/modules/video/video.router.ts +0 -143
- package/modules/video/video.schema.ts +0 -46
- package/modules/video/video.service.ts +0 -274
- package/modules/video/video.types.ts +0 -33
- package/util/db/index.ts +0 -7
- package/util/db/isPostgresError.ts +0 -9
- package/util/db/isUniqueConstraintViolation.ts +0 -3
- package/util/db.ts +0 -62
- package/util/index.ts +0 -351
- /package/{util/api.ts → api.ts} +0 -0
- /package/{util/array.ts → array.ts} +0 -0
- /package/{util/browser.ts → browser.ts} +0 -0
- /package/{util/codebase.ts → codebase.ts} +0 -0
- /package/{util/config.ts → config.ts} +0 -0
- /package/{util/decoder.test.ts → decoder.test.ts} +0 -0
- /package/{util/decoder.ts → decoder.ts} +0 -0
- /package/{util/format.ts → format.ts} +0 -0
- /package/{util/guid.ts → guid.ts} +0 -0
- /package/{util/json.ts → json.ts} +0 -0
- /package/{util/log.ts → log.ts} +0 -0
- /package/{util/math.ts → math.ts} +0 -0
- /package/{util/merkle.ts → merkle.ts} +0 -0
- /package/{util/mongo.ts → mongo.ts} +0 -0
- /package/{util/number.ts → number.ts} +0 -0
- /package/{util/object.ts → object.ts} +0 -0
- /package/{util/otp.ts → otp.ts} +0 -0
- /package/{util/physics.ts → physics.ts} +0 -0
- /package/{util/process.ts → process.ts} +0 -0
- /package/{util/rpc.ts → rpc.ts} +0 -0
- /package/{util/seer.ts → seer.ts} +0 -0
- /package/{util/string.ts → string.ts} +0 -0
- /package/{util/text.ts → text.ts} +0 -0
- /package/{util/time → time}/date.ts +0 -0
- /package/{util/time → time}/fancyTimeFormat.ts +0 -0
- /package/{util/time → time}/index.ts +0 -0
- /package/{util/time → time}/now.ts +0 -0
- /package/{util/types → types}/mongo.d.ts +0 -0
- /package/{util/web3 → web3}/httpProvider.ts +0 -0
- /package/{util/web3.ts → web3.ts} +0 -0
- /package/{util/websocket.ts → websocket.ts} +0 -0
- /package/{util/zk.ts → zk.ts} +0 -0
- /package/{util/zod.ts → zod.ts} +0 -0
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
// module/collection.service.ts
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
CollectibleCollection,
|
|
5
|
-
CollectibleCardBox,
|
|
6
|
-
CollectibleCardPack,
|
|
7
|
-
CollectibleCard,
|
|
8
|
-
Router,
|
|
9
|
-
RouterInput,
|
|
10
|
-
RouterOutput,
|
|
11
|
-
RouterContext,
|
|
12
|
-
} from './collection.types';
|
|
13
|
-
|
|
14
|
-
export class Service {
|
|
15
|
-
async getCollectibleCollection(
|
|
16
|
-
input: RouterInput['getCollectibleCollection'],
|
|
17
|
-
ctx: RouterContext
|
|
18
|
-
): Promise<RouterOutput['getCollectibleCollection']> {
|
|
19
|
-
if (!input) throw new Error('Input should not be void');
|
|
20
|
-
console.log('Collection.Service.getCollectibleCollection', input.collectibleCollectionId);
|
|
21
|
-
|
|
22
|
-
const collectibleCollection = await ctx.app.model.CollectibleCollection.findById(input.collectibleCollectionId)
|
|
23
|
-
.lean()
|
|
24
|
-
.exec();
|
|
25
|
-
if (!collectibleCollection) throw new Error('CollectibleCollection not found');
|
|
26
|
-
|
|
27
|
-
return collectibleCollection as CollectibleCollection;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async createCollectibleCollection(
|
|
31
|
-
input: RouterInput['createCollectibleCollection'],
|
|
32
|
-
ctx: RouterContext
|
|
33
|
-
): Promise<RouterOutput['createCollectibleCollection']> {
|
|
34
|
-
if (!input) throw new Error('Input should not be void');
|
|
35
|
-
console.log('Collection.Service.createCollectibleCollection', input.name);
|
|
36
|
-
|
|
37
|
-
const collectibleCollection = await ctx.app.model.CollectibleCollection.create(input);
|
|
38
|
-
return collectibleCollection as CollectibleCollection;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async updateCollectibleCollection(
|
|
42
|
-
input: RouterInput['updateCollectibleCollection'],
|
|
43
|
-
ctx: RouterContext
|
|
44
|
-
): Promise<RouterOutput['updateCollectibleCollection']> {
|
|
45
|
-
if (!input) throw new Error('Input should not be void');
|
|
46
|
-
console.log('Collection.Service.updateCollectibleCollection', input.collectibleCollectionId, input.data);
|
|
47
|
-
|
|
48
|
-
const updatedCollectibleCollection = await ctx.app.model.CollectibleCollection.findByIdAndUpdate(
|
|
49
|
-
input.collectibleCollectionId,
|
|
50
|
-
input.data,
|
|
51
|
-
{ new: true }
|
|
52
|
-
)
|
|
53
|
-
.lean()
|
|
54
|
-
.exec();
|
|
55
|
-
if (!updatedCollectibleCollection) throw new Error('CollectibleCollection update failed');
|
|
56
|
-
|
|
57
|
-
return updatedCollectibleCollection as CollectibleCollection;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async getCollectibleCardBox(
|
|
61
|
-
input: RouterInput['getCollectibleCardBox'],
|
|
62
|
-
ctx: RouterContext
|
|
63
|
-
): Promise<RouterOutput['getCollectibleCardBox']> {
|
|
64
|
-
if (!input) throw new Error('Input should not be void');
|
|
65
|
-
console.log('Collection.Service.getCollectibleCardBox', input.collectibleCardBoxId);
|
|
66
|
-
|
|
67
|
-
const collectibleCardBox = await ctx.app.model.CollectibleCardBox.findById(input.collectibleCardBoxId)
|
|
68
|
-
.lean()
|
|
69
|
-
.exec();
|
|
70
|
-
if (!collectibleCardBox) throw new Error('CollectibleCardBox not found');
|
|
71
|
-
|
|
72
|
-
return collectibleCardBox as CollectibleCardBox;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async createCollectibleCardBox(
|
|
76
|
-
input: RouterInput['createCollectibleCardBox'],
|
|
77
|
-
ctx: RouterContext
|
|
78
|
-
): Promise<RouterOutput['createCollectibleCardBox']> {
|
|
79
|
-
if (!input) throw new Error('Input should not be void');
|
|
80
|
-
console.log('Collection.Service.createCollectibleCardBox', input.name);
|
|
81
|
-
|
|
82
|
-
const collectibleCardBox = await ctx.app.model.CollectibleCardBox.create(input);
|
|
83
|
-
return collectibleCardBox as CollectibleCardBox;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async updateCollectibleCardBox(
|
|
87
|
-
input: RouterInput['updateCollectibleCardBox'],
|
|
88
|
-
ctx: RouterContext
|
|
89
|
-
): Promise<RouterOutput['updateCollectibleCardBox']> {
|
|
90
|
-
if (!input) throw new Error('Input should not be void');
|
|
91
|
-
console.log('Collection.Service.updateCollectibleCardBox', input.collectibleCardBoxId, input.data);
|
|
92
|
-
|
|
93
|
-
const updatedCollectibleCardBox = await ctx.app.model.CollectibleCardBox.findByIdAndUpdate(
|
|
94
|
-
input.collectibleCardBoxId,
|
|
95
|
-
input.data,
|
|
96
|
-
{ new: true }
|
|
97
|
-
)
|
|
98
|
-
.lean()
|
|
99
|
-
.exec();
|
|
100
|
-
if (!updatedCollectibleCardBox) throw new Error('CollectibleCardBox update failed');
|
|
101
|
-
|
|
102
|
-
return updatedCollectibleCardBox as CollectibleCardBox;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async getCollectibleCardPack(
|
|
106
|
-
input: RouterInput['getCollectibleCardPack'],
|
|
107
|
-
ctx: RouterContext
|
|
108
|
-
): Promise<RouterOutput['getCollectibleCardPack']> {
|
|
109
|
-
if (!input) throw new Error('Input should not be void');
|
|
110
|
-
console.log('Collection.Service.getCollectibleCardPack', input.collectibleCardPackId);
|
|
111
|
-
|
|
112
|
-
const collectibleCardPack = await ctx.app.model.CollectibleCardPack.findById(input.collectibleCardPackId)
|
|
113
|
-
.lean()
|
|
114
|
-
.exec();
|
|
115
|
-
if (!collectibleCardPack) throw new Error('CollectibleCardPack not found');
|
|
116
|
-
|
|
117
|
-
return collectibleCardPack as CollectibleCardPack;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async createCollectibleCardPack(
|
|
121
|
-
input: RouterInput['createCollectibleCardPack'],
|
|
122
|
-
ctx: RouterContext
|
|
123
|
-
): Promise<RouterOutput['createCollectibleCardPack']> {
|
|
124
|
-
if (!input) throw new Error('Input should not be void');
|
|
125
|
-
console.log('Collection.Service.createCollectibleCardPack', input.name);
|
|
126
|
-
|
|
127
|
-
const collectibleCardPack = await ctx.app.model.CollectibleCardPack.create(input);
|
|
128
|
-
return collectibleCardPack as CollectibleCardPack;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
async updateCollectibleCardPack(
|
|
132
|
-
input: RouterInput['updateCollectibleCardPack'],
|
|
133
|
-
ctx: RouterContext
|
|
134
|
-
): Promise<RouterOutput['updateCollectibleCardPack']> {
|
|
135
|
-
if (!input) throw new Error('Input should not be void');
|
|
136
|
-
console.log('Collection.Service.updateCollectibleCardPack', input.collectibleCardPackId, input.data);
|
|
137
|
-
|
|
138
|
-
const updatedCollectibleCardPack = await ctx.app.model.CollectibleCardPack.findByIdAndUpdate(
|
|
139
|
-
input.collectibleCardPackId,
|
|
140
|
-
input.data,
|
|
141
|
-
{ new: true }
|
|
142
|
-
)
|
|
143
|
-
.lean()
|
|
144
|
-
.exec();
|
|
145
|
-
if (!updatedCollectibleCardPack) throw new Error('CollectibleCardPack update failed');
|
|
146
|
-
|
|
147
|
-
return updatedCollectibleCardPack as CollectibleCardPack;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
async getCollectibleCard(
|
|
151
|
-
input: RouterInput['getCollectibleCard'],
|
|
152
|
-
ctx: RouterContext
|
|
153
|
-
): Promise<RouterOutput['getCollectibleCard']> {
|
|
154
|
-
if (!input) throw new Error('Input should not be void');
|
|
155
|
-
console.log('Collection.Service.getCollectibleCard', input.collectibleCardId);
|
|
156
|
-
|
|
157
|
-
const collectibleCard = await ctx.app.model.CollectibleCard.findById(input.collectibleCardId).lean().exec();
|
|
158
|
-
if (!collectibleCard) throw new Error('CollectibleCard not found');
|
|
159
|
-
|
|
160
|
-
return collectibleCard as CollectibleCard;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async createCollectibleCard(
|
|
164
|
-
input: RouterInput['createCollectibleCard'],
|
|
165
|
-
ctx: RouterContext
|
|
166
|
-
): Promise<RouterOutput['createCollectibleCard']> {
|
|
167
|
-
if (!input) throw new Error('Input should not be void');
|
|
168
|
-
console.log('Collection.Service.createCollectibleCard', input.name);
|
|
169
|
-
|
|
170
|
-
const collectibleCard = await ctx.app.model.CollectibleCard.create(input);
|
|
171
|
-
return collectibleCard as CollectibleCard;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
async updateCollectibleCard(
|
|
175
|
-
input: RouterInput['updateCollectibleCard'],
|
|
176
|
-
ctx: RouterContext
|
|
177
|
-
): Promise<RouterOutput['updateCollectibleCard']> {
|
|
178
|
-
if (!input) throw new Error('Input should not be void');
|
|
179
|
-
console.log('Collection.Service.updateCollectibleCard', input.collectibleCardId, input.data);
|
|
180
|
-
|
|
181
|
-
const updatedCollectibleCard = await ctx.app.model.CollectibleCard.findByIdAndUpdate(
|
|
182
|
-
input.collectibleCardId,
|
|
183
|
-
input.data,
|
|
184
|
-
{ new: true }
|
|
185
|
-
)
|
|
186
|
-
.lean()
|
|
187
|
-
.exec();
|
|
188
|
-
if (!updatedCollectibleCard) throw new Error('CollectibleCard update failed');
|
|
189
|
-
|
|
190
|
-
return updatedCollectibleCard as CollectibleCard;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// module/collection.types.ts
|
|
2
|
-
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import * as schema from './collection.schema';
|
|
5
|
-
import { Document, Model } from '../../util/mongo';
|
|
6
|
-
import exp from 'constants';
|
|
7
|
-
|
|
8
|
-
export type * from './collection.router';
|
|
9
|
-
export type * from './collection.service';
|
|
10
|
-
export type { RouterContext } from '../../types';
|
|
11
|
-
|
|
12
|
-
export type CollectibleCollection = z.infer<typeof schema.CollectibleCollection>;
|
|
13
|
-
export type CollectibleCardBox = z.infer<typeof schema.CollectibleCardBox>;
|
|
14
|
-
export type CollectibleCardPack = z.infer<typeof schema.CollectibleCardPack>;
|
|
15
|
-
export type CollectibleCard = z.infer<typeof schema.CollectibleCard>;
|
|
16
|
-
export type Card = z.infer<typeof schema.Card>;
|
|
17
|
-
export type Set = z.infer<typeof schema.Set>;
|
|
18
|
-
export type Series = z.infer<typeof schema.Series>;
|
|
19
|
-
|
|
20
|
-
export type CollectibleCollectionDocument = CollectibleCollection & Document;
|
|
21
|
-
export type CollectibleCardBoxDocument = CollectibleCardBox & Document;
|
|
22
|
-
export type CollectibleCardPackDocument = CollectibleCardPack & Document;
|
|
23
|
-
export type CollectibleCardDocument = CollectibleCard & Document;
|
|
24
|
-
export type CardDocument = Card & Document;
|
|
25
|
-
export type SetDocument = Set & Document;
|
|
26
|
-
export type SeriesDocument = Series & Document;
|
|
27
|
-
|
|
28
|
-
export type Mappings = {
|
|
29
|
-
CollectibleCollection: Model<CollectibleCollectionDocument>;
|
|
30
|
-
CollectibleCardBox: Model<CollectibleCardBoxDocument>;
|
|
31
|
-
CollectibleCardPack: Model<CollectibleCardPackDocument>;
|
|
32
|
-
CollectibleCard: Model<CollectibleCardDocument>;
|
|
33
|
-
Card: Model<CardDocument>;
|
|
34
|
-
Set: Model<SetDocument>;
|
|
35
|
-
Series: Model<SeriesDocument>;
|
|
36
|
-
};
|