@misofm/musicos 0.1.0 → 0.3.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 +98 -19
- package/dist/client.d.ts +27 -26
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +58 -51
- package/dist/client.js.map +1 -1
- package/dist/deployments.d.ts +11 -2
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +15 -1
- package/dist/deployments.js.map +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +17 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +6 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +0 -5
- package/dist/events.js.map +1 -1
- package/dist/execute.d.ts +1 -48
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +5 -106
- package/dist/execute.js.map +1 -1
- package/dist/internal.d.ts +45 -6
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/queries.d.ts +38 -62
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +240 -266
- package/dist/queries.js.map +1 -1
- package/dist/transactions.d.ts +2 -1
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js.map +1 -1
- package/dist/types.d.ts +129 -79
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +169 -1
- package/dist/types.js.map +1 -1
- package/dist/view.d.ts +3 -2
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +19 -6
- package/dist/view.js.map +1 -1
- package/package.json +8 -1
- package/src/client.ts +78 -98
- package/src/deployments.ts +16 -1
- package/src/errors.ts +30 -0
- package/src/events.ts +1 -1
- package/src/execute.ts +5 -133
- package/src/internal.ts +17 -23
- package/src/queries.ts +386 -424
- package/src/transactions.ts +2 -1
- package/src/types.ts +59 -48
- package/src/view.ts +23 -9
package/src/internal.ts
CHANGED
|
@@ -6,20 +6,14 @@
|
|
|
6
6
|
// Mappers from the generated BCS-parse output (snake_case, with @mysten/bcs
|
|
7
7
|
// conventions: enums as `{ $kind, [Variant]: payload }`, tuples as arrays,
|
|
8
8
|
// VecMap as `{ contents: [{ key, value }] }`, u64/u256 as strings, Address as
|
|
9
|
-
// hex) into the
|
|
10
|
-
//
|
|
11
|
-
//
|
|
9
|
+
// hex) into the camelCase constructor-input shape of the public `Schema.Class`
|
|
10
|
+
// domain types in `./types`. These mappers return plain objects, not schema
|
|
11
|
+
// instances — `queries.ts` runs the mapped output through `decodeBcs` (which
|
|
12
|
+
// calls `Schema.decodeUnknownEffect`) to validate and construct the actual
|
|
13
|
+
// class instance. This is the single boundary between codegen output and the
|
|
14
|
+
// public API, so when the generated shapes change, type errors surface here.
|
|
12
15
|
//
|
|
13
16
|
|
|
14
|
-
import type {
|
|
15
|
-
BPS,
|
|
16
|
-
Composition,
|
|
17
|
-
Recording,
|
|
18
|
-
Release as ReleaseType,
|
|
19
|
-
Track,
|
|
20
|
-
TrackState,
|
|
21
|
-
} from "./types.ts";
|
|
22
|
-
|
|
23
17
|
// === Mappers ===
|
|
24
18
|
|
|
25
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -28,7 +22,7 @@ type Parsed = any;
|
|
|
28
22
|
// === Primitives ===
|
|
29
23
|
|
|
30
24
|
/** `BPS` is a Move tuple struct `(u16)`, parsed as `[number]`. */
|
|
31
|
-
export function mapBps(d: Parsed):
|
|
25
|
+
export function mapBps(d: Parsed): { value: number } {
|
|
32
26
|
return { value: Number(Array.isArray(d) ? d[0] : d) };
|
|
33
27
|
}
|
|
34
28
|
|
|
@@ -42,37 +36,37 @@ export function mapState(
|
|
|
42
36
|
|
|
43
37
|
// === Objects ===
|
|
44
38
|
|
|
45
|
-
export function mapComposition(id: string, d: Parsed)
|
|
39
|
+
export function mapComposition(id: string, d: Parsed) {
|
|
46
40
|
return {
|
|
47
41
|
id,
|
|
48
42
|
state: mapState(d.state),
|
|
49
|
-
title: d.title,
|
|
43
|
+
title: d.title as string,
|
|
50
44
|
royaltyRate: mapBps(d.royalty_rate),
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
export function mapRecording(id: string, d: Parsed)
|
|
48
|
+
export function mapRecording(id: string, d: Parsed) {
|
|
55
49
|
return {
|
|
56
50
|
id,
|
|
57
51
|
state: mapState(d.state),
|
|
58
|
-
compositionId: d.composition_id,
|
|
52
|
+
compositionId: d.composition_id as string,
|
|
59
53
|
};
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
export function mapTrack(d: Parsed)
|
|
56
|
+
export function mapTrack(d: Parsed) {
|
|
63
57
|
return {
|
|
64
|
-
state: (d.state?.$kind ?? "Unassigned") as
|
|
65
|
-
compositionId: d.composition_id,
|
|
66
|
-
recordingId: d.recording_id,
|
|
58
|
+
state: (d.state?.$kind ?? "Unassigned") as "Unassigned" | "Assigned",
|
|
59
|
+
compositionId: d.composition_id as string,
|
|
60
|
+
recordingId: d.recording_id as string,
|
|
67
61
|
splitBps: mapBps(d.split_bps),
|
|
68
62
|
};
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
export function mapRelease(id: string, d: Parsed)
|
|
65
|
+
export function mapRelease(id: string, d: Parsed) {
|
|
72
66
|
return {
|
|
73
67
|
id,
|
|
74
68
|
state: mapState(d.state),
|
|
75
|
-
title: d.title,
|
|
69
|
+
title: d.title as string,
|
|
76
70
|
tracks: (d.tracks ?? []).map(mapTrack),
|
|
77
71
|
};
|
|
78
72
|
}
|