@misonetwork/sdk 0.1.0 → 0.2.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/README.md +1 -17
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -8
- package/src/index.ts +0 -1
- package/dist/schemas.d.ts +0 -99
- package/dist/schemas.d.ts.map +0 -1
- package/dist/schemas.js +0 -76
- package/dist/schemas.js.map +0 -1
- package/src/schemas.ts +0 -96
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ TypeScript SDK for the [Miso](https://github.com/misonetwork/miso-protocol) prot
|
|
|
4
4
|
|
|
5
5
|
This package mirrors the on-chain ABI of the [`misonetwork/miso-protocol`](https://github.com/misonetwork/miso-protocol) Move package (plus its first-party extensions), regenerated from the live Move source via `bun run codegen`.
|
|
6
6
|
|
|
7
|
-
Miso is a permissionless on-chain music protocol that models compositions, recordings, and releases — and their associated rights and royalties — as Sui objects. This SDK provides typed queries, composable transaction builders, BCS event parsers,
|
|
7
|
+
Miso is a permissionless on-chain music protocol that models compositions, recordings, and releases — and their associated rights and royalties — as Sui objects. This SDK provides typed queries, composable transaction builders, BCS event parsers, extension helpers (credits, cover art, royalty pools), and a client extension.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -553,22 +553,6 @@ const rejected = client.miso.parse.dealRejectedEvent(bcsBytes); // { dealId, rel
|
|
|
553
553
|
|
|
554
554
|
The same functions are exported standalone as `parseCompositionPublishedEvent`, etc.
|
|
555
555
|
|
|
556
|
-
## Validation Schemas
|
|
557
|
-
|
|
558
|
-
Zod schemas for validating Miso domain types and parsed events:
|
|
559
|
-
|
|
560
|
-
```ts
|
|
561
|
-
import {
|
|
562
|
-
CompositionSchema, RecordingSchema, ReleaseSchema, TrackSchema,
|
|
563
|
-
CompositionStateSchema, RecordingStateSchema, ReleaseStateSchema,
|
|
564
|
-
CompositionPublishedEventSchema, CompositionRoyaltySetEventSchema,
|
|
565
|
-
RecordingPublishedEventSchema, ReleasePublishedEventSchema,
|
|
566
|
-
DealCreatedEventSchema, DealAcceptedEventSchema, DealRejectedEventSchema,
|
|
567
|
-
} from "@misonetwork/sdk/schemas";
|
|
568
|
-
|
|
569
|
-
const result = RecordingSchema.safeParse(data);
|
|
570
|
-
```
|
|
571
|
-
|
|
572
556
|
## Types
|
|
573
557
|
|
|
574
558
|
All Miso domain types are exported:
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAG5B,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAE5B,sEAAsE;AACtE,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misonetwork/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Typed query helpers and transaction builders for the Miso protocol core on Sui.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -76,10 +76,6 @@
|
|
|
76
76
|
"types": "./dist/types.d.ts",
|
|
77
77
|
"default": "./dist/types.js"
|
|
78
78
|
},
|
|
79
|
-
"./schemas": {
|
|
80
|
-
"types": "./dist/schemas.d.ts",
|
|
81
|
-
"default": "./dist/schemas.js"
|
|
82
|
-
},
|
|
83
79
|
"./parsers": {
|
|
84
80
|
"types": "./dist/parsers.d.ts",
|
|
85
81
|
"default": "./dist/parsers.js"
|
|
@@ -104,8 +100,5 @@
|
|
|
104
100
|
"@mysten/sui": "^2.4.0",
|
|
105
101
|
"typescript": "^5"
|
|
106
102
|
},
|
|
107
|
-
"dependencies": {
|
|
108
|
-
"zod": "^4.3.6"
|
|
109
|
-
},
|
|
110
103
|
"main": "./dist/index.js"
|
|
111
104
|
}
|
package/src/index.ts
CHANGED
package/dist/schemas.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const CompositionStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
-
type: z.ZodLiteral<"Initialized">;
|
|
4
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
-
type: z.ZodLiteral<"Published">;
|
|
6
|
-
timestampMs: z.ZodNumber;
|
|
7
|
-
}, z.core.$strip>], "type">;
|
|
8
|
-
export declare const CompositionSchema: z.ZodObject<{
|
|
9
|
-
id: z.ZodString;
|
|
10
|
-
state: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
-
type: z.ZodLiteral<"Initialized">;
|
|
12
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
-
type: z.ZodLiteral<"Published">;
|
|
14
|
-
timestampMs: z.ZodNumber;
|
|
15
|
-
}, z.core.$strip>], "type">;
|
|
16
|
-
title: z.ZodString;
|
|
17
|
-
royaltyRate: z.ZodObject<{
|
|
18
|
-
value: z.ZodNumber;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
export declare const CompositionPublishedEventSchema: z.ZodObject<{
|
|
22
|
-
compositionId: z.ZodString;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
export declare const CompositionRoyaltySetEventSchema: z.ZodObject<{
|
|
25
|
-
royaltyRateBps: z.ZodNumber;
|
|
26
|
-
}, z.core.$strip>;
|
|
27
|
-
export declare const RecordingStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
28
|
-
type: z.ZodLiteral<"Initialized">;
|
|
29
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
-
type: z.ZodLiteral<"Published">;
|
|
31
|
-
timestampMs: z.ZodNumber;
|
|
32
|
-
}, z.core.$strip>], "type">;
|
|
33
|
-
export declare const RecordingSchema: z.ZodObject<{
|
|
34
|
-
id: z.ZodString;
|
|
35
|
-
state: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
-
type: z.ZodLiteral<"Initialized">;
|
|
37
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
-
type: z.ZodLiteral<"Published">;
|
|
39
|
-
timestampMs: z.ZodNumber;
|
|
40
|
-
}, z.core.$strip>], "type">;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
export declare const RecordingPublishedEventSchema: z.ZodObject<{
|
|
43
|
-
recordingId: z.ZodString;
|
|
44
|
-
}, z.core.$strip>;
|
|
45
|
-
export declare const TrackSchema: z.ZodObject<{
|
|
46
|
-
state: z.ZodEnum<{
|
|
47
|
-
Unassigned: "Unassigned";
|
|
48
|
-
Assigned: "Assigned";
|
|
49
|
-
}>;
|
|
50
|
-
recordingId: z.ZodString;
|
|
51
|
-
splitBps: z.ZodObject<{
|
|
52
|
-
value: z.ZodNumber;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
export declare const ReleaseStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
56
|
-
type: z.ZodLiteral<"Initialized">;
|
|
57
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
-
type: z.ZodLiteral<"Published">;
|
|
59
|
-
timestampMs: z.ZodNumber;
|
|
60
|
-
}, z.core.$strip>], "type">;
|
|
61
|
-
export declare const ReleaseSchema: z.ZodObject<{
|
|
62
|
-
id: z.ZodString;
|
|
63
|
-
state: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
64
|
-
type: z.ZodLiteral<"Initialized">;
|
|
65
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
-
type: z.ZodLiteral<"Published">;
|
|
67
|
-
timestampMs: z.ZodNumber;
|
|
68
|
-
}, z.core.$strip>], "type">;
|
|
69
|
-
title: z.ZodString;
|
|
70
|
-
tracks: z.ZodArray<z.ZodObject<{
|
|
71
|
-
state: z.ZodEnum<{
|
|
72
|
-
Unassigned: "Unassigned";
|
|
73
|
-
Assigned: "Assigned";
|
|
74
|
-
}>;
|
|
75
|
-
recordingId: z.ZodString;
|
|
76
|
-
splitBps: z.ZodObject<{
|
|
77
|
-
value: z.ZodNumber;
|
|
78
|
-
}, z.core.$strip>;
|
|
79
|
-
}, z.core.$strip>>;
|
|
80
|
-
}, z.core.$strip>;
|
|
81
|
-
export declare const ReleasePublishedEventSchema: z.ZodObject<{
|
|
82
|
-
releaseId: z.ZodString;
|
|
83
|
-
}, z.core.$strip>;
|
|
84
|
-
export declare const DealCreatedEventSchema: z.ZodObject<{
|
|
85
|
-
dealId: z.ZodString;
|
|
86
|
-
releaseId: z.ZodString;
|
|
87
|
-
trackSplitBps: z.ZodObject<{
|
|
88
|
-
value: z.ZodNumber;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
}, z.core.$strip>;
|
|
91
|
-
export declare const DealAcceptedEventSchema: z.ZodObject<{
|
|
92
|
-
dealId: z.ZodString;
|
|
93
|
-
releaseId: z.ZodString;
|
|
94
|
-
}, z.core.$strip>;
|
|
95
|
-
export declare const DealRejectedEventSchema: z.ZodObject<{
|
|
96
|
-
dealId: z.ZodString;
|
|
97
|
-
releaseId: z.ZodString;
|
|
98
|
-
}, z.core.$strip>;
|
|
99
|
-
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/schemas.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,sBAAsB;;;;;2BAGjC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAK5B,CAAC;AAEH,eAAO,MAAM,+BAA+B;;iBAE1C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;iBAE3C,CAAC;AAMH,eAAO,MAAM,oBAAoB;;;;;2BAG/B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;iBAG1B,CAAC;AAEH,eAAO,MAAM,6BAA6B;;iBAExC,CAAC;AAMH,eAAO,MAAM,WAAW;;;;;;;;;iBAItB,CAAC;AAMH,eAAO,MAAM,kBAAkB;;;;;2BAG7B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,2BAA2B;;iBAEtC,CAAC;AAMH,eAAO,MAAM,sBAAsB;;;;;;iBAIjC,CAAC;AAOH,eAAO,MAAM,uBAAuB;;;iBAAoC,CAAC;AAEzE,eAAO,MAAM,uBAAuB;;;iBAAoC,CAAC"}
|
package/dist/schemas.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Miso Labs, Inc.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { isValidSuiObjectId } from "@mysten/sui/utils";
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Composition
|
|
7
|
-
// ============================================================================
|
|
8
|
-
export const CompositionStateSchema = z.discriminatedUnion("type", [
|
|
9
|
-
z.object({ type: z.literal("Initialized") }),
|
|
10
|
-
z.object({ type: z.literal("Published"), timestampMs: z.number().int().min(0) }),
|
|
11
|
-
]);
|
|
12
|
-
export const CompositionSchema = z.object({
|
|
13
|
-
id: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
14
|
-
state: CompositionStateSchema,
|
|
15
|
-
title: z.string().min(1, "Composition title cannot be empty"),
|
|
16
|
-
royaltyRate: z.object({ value: z.number().int().min(0).max(2000) }),
|
|
17
|
-
});
|
|
18
|
-
export const CompositionPublishedEventSchema = z.object({
|
|
19
|
-
compositionId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
20
|
-
});
|
|
21
|
-
export const CompositionRoyaltySetEventSchema = z.object({
|
|
22
|
-
royaltyRateBps: z.number().int().min(0).max(2000),
|
|
23
|
-
});
|
|
24
|
-
// ============================================================================
|
|
25
|
-
// Recording
|
|
26
|
-
// ============================================================================
|
|
27
|
-
export const RecordingStateSchema = z.discriminatedUnion("type", [
|
|
28
|
-
z.object({ type: z.literal("Initialized") }),
|
|
29
|
-
z.object({ type: z.literal("Published"), timestampMs: z.number().int().min(0) }),
|
|
30
|
-
]);
|
|
31
|
-
export const RecordingSchema = z.object({
|
|
32
|
-
id: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
33
|
-
state: RecordingStateSchema,
|
|
34
|
-
});
|
|
35
|
-
export const RecordingPublishedEventSchema = z.object({
|
|
36
|
-
recordingId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
37
|
-
});
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// Track
|
|
40
|
-
// ============================================================================
|
|
41
|
-
export const TrackSchema = z.object({
|
|
42
|
-
state: z.enum(["Unassigned", "Assigned"]),
|
|
43
|
-
recordingId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
44
|
-
splitBps: z.object({ value: z.number().int().min(0).max(10000) }),
|
|
45
|
-
});
|
|
46
|
-
// ============================================================================
|
|
47
|
-
// Release
|
|
48
|
-
// ============================================================================
|
|
49
|
-
export const ReleaseStateSchema = z.discriminatedUnion("type", [
|
|
50
|
-
z.object({ type: z.literal("Initialized") }),
|
|
51
|
-
z.object({ type: z.literal("Published"), timestampMs: z.number().int().min(0) }),
|
|
52
|
-
]);
|
|
53
|
-
export const ReleaseSchema = z.object({
|
|
54
|
-
id: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
55
|
-
state: ReleaseStateSchema,
|
|
56
|
-
title: z.string().min(1, "Release title cannot be empty"),
|
|
57
|
-
tracks: z.array(TrackSchema).max(255, "Release cannot have more than 255 tracks"),
|
|
58
|
-
});
|
|
59
|
-
export const ReleasePublishedEventSchema = z.object({
|
|
60
|
-
releaseId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
61
|
-
});
|
|
62
|
-
// ============================================================================
|
|
63
|
-
// Deal Events
|
|
64
|
-
// ============================================================================
|
|
65
|
-
export const DealCreatedEventSchema = z.object({
|
|
66
|
-
dealId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
67
|
-
releaseId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
68
|
-
trackSplitBps: z.object({ value: z.number().int().min(0).max(10000) }),
|
|
69
|
-
});
|
|
70
|
-
const dealLifecycleEventShape = {
|
|
71
|
-
dealId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
72
|
-
releaseId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
73
|
-
};
|
|
74
|
-
export const DealAcceptedEventSchema = z.object(dealLifecycleEventShape);
|
|
75
|
-
export const DealRejectedEventSchema = z.object(dealLifecycleEventShape);
|
|
76
|
-
//# sourceMappingURL=schemas.js.map
|
package/dist/schemas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACjE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;IAC5C,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;CACjF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,kBAAkB,EAAE,uBAAuB,CAAC;IAClE,KAAK,EAAE,sBAAsB;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAA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/src/schemas.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Miso Labs, Inc.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { isValidSuiObjectId } from "@mysten/sui/utils";
|
|
6
|
-
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Composition
|
|
9
|
-
// ============================================================================
|
|
10
|
-
|
|
11
|
-
export const CompositionStateSchema = z.discriminatedUnion("type", [
|
|
12
|
-
z.object({ type: z.literal("Initialized") }),
|
|
13
|
-
z.object({ type: z.literal("Published"), timestampMs: z.number().int().min(0) }),
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
export const CompositionSchema = z.object({
|
|
17
|
-
id: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
18
|
-
state: CompositionStateSchema,
|
|
19
|
-
title: z.string().min(1, "Composition title cannot be empty"),
|
|
20
|
-
royaltyRate: z.object({ value: z.number().int().min(0).max(2000) }),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export const CompositionPublishedEventSchema = z.object({
|
|
24
|
-
compositionId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export const CompositionRoyaltySetEventSchema = z.object({
|
|
28
|
-
royaltyRateBps: z.number().int().min(0).max(2000),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// Recording
|
|
33
|
-
// ============================================================================
|
|
34
|
-
|
|
35
|
-
export const RecordingStateSchema = z.discriminatedUnion("type", [
|
|
36
|
-
z.object({ type: z.literal("Initialized") }),
|
|
37
|
-
z.object({ type: z.literal("Published"), timestampMs: z.number().int().min(0) }),
|
|
38
|
-
]);
|
|
39
|
-
|
|
40
|
-
export const RecordingSchema = z.object({
|
|
41
|
-
id: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
42
|
-
state: RecordingStateSchema,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export const RecordingPublishedEventSchema = z.object({
|
|
46
|
-
recordingId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// ============================================================================
|
|
50
|
-
// Track
|
|
51
|
-
// ============================================================================
|
|
52
|
-
|
|
53
|
-
export const TrackSchema = z.object({
|
|
54
|
-
state: z.enum(["Unassigned", "Assigned"]),
|
|
55
|
-
recordingId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
56
|
-
splitBps: z.object({ value: z.number().int().min(0).max(10000) }),
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// ============================================================================
|
|
60
|
-
// Release
|
|
61
|
-
// ============================================================================
|
|
62
|
-
|
|
63
|
-
export const ReleaseStateSchema = z.discriminatedUnion("type", [
|
|
64
|
-
z.object({ type: z.literal("Initialized") }),
|
|
65
|
-
z.object({ type: z.literal("Published"), timestampMs: z.number().int().min(0) }),
|
|
66
|
-
]);
|
|
67
|
-
|
|
68
|
-
export const ReleaseSchema = z.object({
|
|
69
|
-
id: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
70
|
-
state: ReleaseStateSchema,
|
|
71
|
-
title: z.string().min(1, "Release title cannot be empty"),
|
|
72
|
-
tracks: z.array(TrackSchema).max(255, "Release cannot have more than 255 tracks"),
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
export const ReleasePublishedEventSchema = z.object({
|
|
76
|
-
releaseId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// ============================================================================
|
|
80
|
-
// Deal Events
|
|
81
|
-
// ============================================================================
|
|
82
|
-
|
|
83
|
-
export const DealCreatedEventSchema = z.object({
|
|
84
|
-
dealId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
85
|
-
releaseId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
86
|
-
trackSplitBps: z.object({ value: z.number().int().min(0).max(10000) }),
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const dealLifecycleEventShape = {
|
|
90
|
-
dealId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
91
|
-
releaseId: z.string().refine(isValidSuiObjectId, "Invalid Sui object ID"),
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const DealAcceptedEventSchema = z.object(dealLifecycleEventShape);
|
|
95
|
-
|
|
96
|
-
export const DealRejectedEventSchema = z.object(dealLifecycleEventShape);
|