@skyblock-finance/actions 0.9.0 → 0.10.0
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/data/$schema.json +103 -0
- package/data/forging.json +167 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/data.d.ts +2 -46
- package/dist/data.js +9 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -3
- package/dist/npcs.d.ts +1 -1
- package/dist/npcs.js +23 -23
- package/dist/schema.d.ts +91 -3
- package/dist/schema.js +41 -19
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
- package/source/data.test.ts +44 -18
- package/source/data.ts +10 -6
- package/source/index.ts +13 -8
- package/source/npcs.ts +24 -24
- package/source/schema.ts +60 -36
- package/source/types.ts +5 -0
package/source/schema.ts
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
import { z } from 'zod/v4'
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})
|
|
9
|
-
.strict()
|
|
3
|
+
export const actionIoCrystalSchema = z.strictObject({
|
|
4
|
+
amount: z.number(),
|
|
5
|
+
id: z.string(),
|
|
6
|
+
type: z.literal('crystal'),
|
|
7
|
+
})
|
|
10
8
|
|
|
11
|
-
export const actionIoCurrencySchema = z
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
export const actionIoCurrencySchema = z.strictObject({
|
|
10
|
+
amount: z.number(),
|
|
11
|
+
id: z.enum([
|
|
12
|
+
'bit',
|
|
13
|
+
'coin',
|
|
14
|
+
'copper',
|
|
15
|
+
'gem',
|
|
16
|
+
'forge-second',
|
|
17
|
+
'north-star',
|
|
18
|
+
'pest',
|
|
19
|
+
'second',
|
|
20
|
+
'usd',
|
|
21
|
+
]),
|
|
22
|
+
type: z.literal('currency'),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const actionIoItemSchema = z.strictObject({
|
|
26
|
+
amount: z.number(),
|
|
27
|
+
id: z.string(),
|
|
28
|
+
type: z.literal('item'),
|
|
29
|
+
})
|
|
27
30
|
|
|
28
31
|
export const actionIoSchema = z.discriminatedUnion('type', [
|
|
32
|
+
actionIoCrystalSchema,
|
|
29
33
|
actionIoCurrencySchema,
|
|
30
34
|
actionIoItemSchema,
|
|
31
35
|
])
|
|
@@ -51,6 +55,9 @@ export const actionPlaceSchema = z.discriminatedUnion('type', [
|
|
|
51
55
|
right: actionIoItemSchema,
|
|
52
56
|
type: z.literal('anvil'),
|
|
53
57
|
}),
|
|
58
|
+
z.strictObject({
|
|
59
|
+
type: z.literal('forge'),
|
|
60
|
+
}),
|
|
54
61
|
z.strictObject({
|
|
55
62
|
id: npcIdSchema,
|
|
56
63
|
type: z.literal('npc'),
|
|
@@ -65,17 +72,34 @@ export const actionPlaceSchema = z.discriminatedUnion('type', [
|
|
|
65
72
|
}),
|
|
66
73
|
])
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
/**
|
|
76
|
+
* NOTE: This schema uses uppercase to align 1-to-1 with the Skyblock Items API's requirements format.
|
|
77
|
+
*/
|
|
78
|
+
export const actionRequirementSchema = z.discriminatedUnion('type', [
|
|
79
|
+
z.strictObject({
|
|
80
|
+
collection: z.enum(['GEMSTONE' /* to be added as-needed */]),
|
|
81
|
+
tier: z.int().min(1).max(10),
|
|
82
|
+
type: z.literal('COLLECTION'),
|
|
83
|
+
}),
|
|
84
|
+
z.strictObject({
|
|
85
|
+
level: z.int().min(1).max(60),
|
|
86
|
+
skill: z.enum(['MINING' /* to be added as-needed */]),
|
|
87
|
+
type: z.literal('SKILL'),
|
|
88
|
+
}),
|
|
89
|
+
z.strictObject({
|
|
90
|
+
tier: z.int().min(1).max(10),
|
|
91
|
+
type: z.literal('HEART_OF_THE_MOUNTAIN'),
|
|
92
|
+
}),
|
|
93
|
+
])
|
|
94
|
+
|
|
95
|
+
export const actionSchema = z.strictObject({
|
|
96
|
+
inputs: z.array(actionIoSchema),
|
|
97
|
+
outputs: z.array(actionIoSchema),
|
|
98
|
+
place: z.array(actionPlaceSchema),
|
|
99
|
+
requirements: z.array(actionRequirementSchema).optional(),
|
|
100
|
+
})
|
|
75
101
|
|
|
76
|
-
export const actionDefinitionSchema = z
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
81
|
-
.strict()
|
|
102
|
+
export const actionDefinitionSchema = z.strictObject({
|
|
103
|
+
$schema: z.string().optional(),
|
|
104
|
+
actions: z.array(actionSchema),
|
|
105
|
+
})
|
package/source/types.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod/v4'
|
|
2
|
+
|
|
2
3
|
import {
|
|
4
|
+
actionIoCrystalSchema,
|
|
3
5
|
actionIoCurrencySchema,
|
|
4
6
|
actionIoItemSchema,
|
|
5
7
|
actionIoSchema,
|
|
8
|
+
actionRequirementSchema,
|
|
6
9
|
actionSchema,
|
|
7
10
|
npcIdSchema,
|
|
8
11
|
} from './schema'
|
|
@@ -10,6 +13,8 @@ import {
|
|
|
10
13
|
export type Action = z.output<typeof actionSchema>
|
|
11
14
|
export type ActionCurrency = z.output<typeof actionIoCurrencySchema.shape.id>
|
|
12
15
|
export type ActionIo = z.output<typeof actionIoSchema>
|
|
16
|
+
export type ActionIoCrystal = z.output<typeof actionIoCrystalSchema>
|
|
13
17
|
export type ActionIoCurrency = z.output<typeof actionIoCurrencySchema>
|
|
14
18
|
export type ActionIoItem = z.output<typeof actionIoItemSchema>
|
|
19
|
+
export type ActionRequirement = z.output<typeof actionRequirementSchema>
|
|
15
20
|
export type NpcId = z.output<typeof npcIdSchema>
|