@skyblock-finance/actions 0.0.1 → 0.0.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/source/schema.ts CHANGED
@@ -2,32 +2,25 @@ import { z } from 'zod'
2
2
 
3
3
  export const actionIoItemSchema = z
4
4
  .object({
5
- amount: z.number().int().finite(),
5
+ amount: z.number().finite(),
6
6
  id: z.string(),
7
7
  type: z.literal('item'),
8
8
  })
9
9
  .strict()
10
10
 
11
- export type ActionIoItem = z.output<typeof actionIoItemSchema>
11
+ export const actionIoCurrencySchema = z
12
+ .object({
13
+ amount: z.number().finite(),
14
+ id: z.enum(['bit', 'coin', 'gem', 'northStar', 'second', 'usd']),
15
+ type: z.literal('currency'),
16
+ })
17
+ .strict()
12
18
 
13
19
  export const actionIoSchema = z.discriminatedUnion('type', [
14
- z
15
- .object({
16
- amount: z.number().int().finite(),
17
- type: z.literal('bit'),
18
- })
19
- .strict(),
20
- z
21
- .object({
22
- amount: z.number().int().finite(),
23
- type: z.literal('coin'),
24
- })
25
- .strict(),
20
+ actionIoCurrencySchema,
26
21
  actionIoItemSchema,
27
22
  ])
28
23
 
29
- export type ActionIo = z.output<typeof actionIoSchema>
30
-
31
24
  export const actionPlaceSchema = z.discriminatedUnion('type', [
32
25
  z
33
26
  .object({
@@ -35,6 +28,12 @@ export const actionPlaceSchema = z.discriminatedUnion('type', [
35
28
  type: z.literal('npc'),
36
29
  })
37
30
  .strict(),
31
+ z
32
+ .object({
33
+ type: z.literal('website'),
34
+ url: z.string().url(),
35
+ })
36
+ .strict(),
38
37
  z
39
38
  .object({
40
39
  grid: z.array(actionIoItemSchema.nullable()).length(9),
@@ -50,5 +49,3 @@ export const actionSchema = z
50
49
  place: z.array(actionPlaceSchema),
51
50
  })
52
51
  .strict()
53
-
54
- export type Action = z.output<typeof actionSchema>
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod'
2
+ import {
3
+ actionIoCurrencySchema,
4
+ actionIoItemSchema,
5
+ actionIoSchema,
6
+ actionSchema,
7
+ } from './schema'
8
+
9
+ export type Action = z.output<typeof actionSchema>
10
+ export type ActionCurrency = z.output<typeof actionIoCurrencySchema.shape.id>
11
+ export type ActionIo = z.output<typeof actionIoSchema>
12
+ export type ActionIoCurrency = z.output<typeof actionIoCurrencySchema>
13
+ export type ActionIoItem = z.output<typeof actionIoItemSchema>