@misofm/sdk 0.2.1 → 0.4.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 +68 -5
- package/dist/auth.d.ts +73 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +193 -0
- package/dist/auth.js.map +1 -0
- package/dist/contracts/miso_drop/drop.d.ts +550 -0
- package/dist/contracts/miso_drop/drop.d.ts.map +1 -0
- package/dist/contracts/miso_drop/drop.js +523 -0
- package/dist/contracts/miso_drop/drop.js.map +1 -0
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +3 -0
- package/dist/contracts.js.map +1 -1
- package/dist/drop.d.ts +120 -0
- package/dist/drop.d.ts.map +1 -0
- package/dist/drop.js +152 -0
- package/dist/drop.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/read/artist.d.ts +24 -0
- package/dist/read/artist.d.ts.map +1 -0
- package/dist/read/artist.js +114 -0
- package/dist/read/artist.js.map +1 -0
- package/dist/read/catalog.d.ts +63 -0
- package/dist/read/catalog.d.ts.map +1 -0
- package/dist/read/catalog.js +252 -0
- package/dist/read/catalog.js.map +1 -0
- package/dist/read/client.d.ts +36 -0
- package/dist/read/client.d.ts.map +1 -0
- package/dist/read/client.js +46 -0
- package/dist/read/client.js.map +1 -0
- package/dist/read/config.d.ts +83 -0
- package/dist/read/config.d.ts.map +1 -0
- package/dist/read/config.js +76 -0
- package/dist/read/config.js.map +1 -0
- package/dist/read/genres.d.ts +7 -0
- package/dist/read/genres.d.ts.map +1 -0
- package/dist/read/genres.js +38 -0
- package/dist/read/genres.js.map +1 -0
- package/dist/read/index.d.ts +12 -0
- package/dist/read/index.d.ts.map +1 -0
- package/dist/read/index.js +23 -0
- package/dist/read/index.js.map +1 -0
- package/dist/read/internal/scalars.d.ts +23 -0
- package/dist/read/internal/scalars.d.ts.map +1 -0
- package/dist/read/internal/scalars.js +56 -0
- package/dist/read/internal/scalars.js.map +1 -0
- package/dist/read/internal/walrus.d.ts +4 -0
- package/dist/read/internal/walrus.d.ts.map +1 -0
- package/dist/read/internal/walrus.js +23 -0
- package/dist/read/internal/walrus.js.map +1 -0
- package/dist/read/receipts.d.ts +22 -0
- package/dist/read/receipts.d.ts.map +1 -0
- package/dist/read/receipts.js +233 -0
- package/dist/read/receipts.js.map +1 -0
- package/dist/read/types.d.ts +279 -0
- package/dist/read/types.d.ts.map +1 -0
- package/dist/read/types.js +21 -0
- package/dist/read/types.js.map +1 -0
- package/dist/read/wallet.d.ts +58 -0
- package/dist/read/wallet.d.ts.map +1 -0
- package/dist/read/wallet.js +325 -0
- package/dist/read/wallet.js.map +1 -0
- package/dist/read/works.d.ts +31 -0
- package/dist/read/works.d.ts.map +1 -0
- package/dist/read/works.js +106 -0
- package/dist/read/works.js.map +1 -0
- package/package.json +19 -2
- package/src/auth.ts +275 -0
- package/src/contracts/miso_drop/drop.ts +798 -0
- package/src/contracts.ts +4 -0
- package/src/drop.ts +266 -0
- package/src/index.ts +5 -0
- package/src/read/artist.ts +136 -0
- package/src/read/catalog.ts +293 -0
- package/src/read/client.ts +79 -0
- package/src/read/config.ts +164 -0
- package/src/read/genres.ts +37 -0
- package/src/read/index.ts +53 -0
- package/src/read/internal/scalars.ts +57 -0
- package/src/read/internal/walrus.ts +32 -0
- package/src/read/receipts.ts +266 -0
- package/src/read/types.ts +361 -0
- package/src/read/wallet.ts +360 -0
- package/src/read/works.ts +164 -0
package/dist/drop.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { ClientWithCoreApi } from "@mysten/sui/client";
|
|
2
|
+
import type { TxThunk } from "./transactions.ts";
|
|
3
|
+
/** Pricing policy: pay exactly `amount` (fixed) or at least `amount` (floor). */
|
|
4
|
+
export type DropPrice = {
|
|
5
|
+
kind: "fixed" | "floor";
|
|
6
|
+
amount: bigint | number | string;
|
|
7
|
+
};
|
|
8
|
+
export interface CreateDropParams {
|
|
9
|
+
/** The `Release` object the drop sells copies of — also the drop's derivation
|
|
10
|
+
* parent and the home of the live-drop pointer. */
|
|
11
|
+
releaseId: string;
|
|
12
|
+
/** The release's `ReleaseAdminCap` — authorizes the drop. */
|
|
13
|
+
releaseAdminCapId: string;
|
|
14
|
+
/** Fixed or floor price, in the currency's smallest unit. */
|
|
15
|
+
price: DropPrice;
|
|
16
|
+
/** The `Currency` type argument, e.g. `0x2::sui::SUI`. */
|
|
17
|
+
currencyType: string;
|
|
18
|
+
/** Copies this edition may ever sell; `null`/omitted = uncapped (an open edition). */
|
|
19
|
+
maxSupply?: bigint | number | null;
|
|
20
|
+
/** Unix ms the sale opens. Default 0 (open immediately). */
|
|
21
|
+
startTimestampMs?: bigint | number;
|
|
22
|
+
/** Unix ms the sale closes; `null`/omitted = evergreen. */
|
|
23
|
+
endTimestampMs?: bigint | number | null;
|
|
24
|
+
misoDropPackageId: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates and shares a release's FIRST drop — edition 0. A release's edition
|
|
28
|
+
* sequence can only ever start once; later terms changes go through `newEdition`.
|
|
29
|
+
* The `Clock` is auto-supplied by the generated binding.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createDrop(p: CreateDropParams): TxThunk;
|
|
32
|
+
export interface NewEditionParams {
|
|
33
|
+
/** The `Release` whose drop is being superseded. */
|
|
34
|
+
releaseId: string;
|
|
35
|
+
/** The release's CURRENT drop — consumed (destroyed) by this call. */
|
|
36
|
+
oldDropId: string;
|
|
37
|
+
/** The current drop's `Currency` type. */
|
|
38
|
+
oldCurrencyType: string;
|
|
39
|
+
/** The release's `ReleaseAdminCap`. */
|
|
40
|
+
releaseAdminCapId: string;
|
|
41
|
+
/** The successor's price. */
|
|
42
|
+
price: DropPrice;
|
|
43
|
+
/** The successor's `Currency` type (may differ from the old one). */
|
|
44
|
+
currencyType: string;
|
|
45
|
+
/** Successor's supply cap; `null`/omitted = uncapped. */
|
|
46
|
+
maxSupply?: bigint | number | null;
|
|
47
|
+
/** Unix ms the successor opens. Default 0 (open immediately). */
|
|
48
|
+
startTimestampMs?: bigint | number;
|
|
49
|
+
/** Unix ms the successor closes; `null`/omitted = evergreen. */
|
|
50
|
+
endTimestampMs?: bigint | number | null;
|
|
51
|
+
misoDropPackageId: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Opens edition n+1 of a release's drop, CONSUMING the current one — the one way to
|
|
55
|
+
* change price, currency, cap, or window (or start a fresh run after a sell-out).
|
|
56
|
+
* Serial numbers restart at 1 for the new edition. The `Clock` is auto-supplied.
|
|
57
|
+
*/
|
|
58
|
+
export declare function newEdition(p: NewEditionParams): TxThunk;
|
|
59
|
+
export interface BuyRecordParams {
|
|
60
|
+
/** The shared `Drop<Currency>` to buy from. */
|
|
61
|
+
dropId: string;
|
|
62
|
+
/** Buyer's `Coin<Currency>` object ids to pay from — merged, then split to `amount`. */
|
|
63
|
+
paymentCoinIds: string[];
|
|
64
|
+
/** Amount to pay in the currency's smallest unit (exact for `fixed`, ≥ for `floor`). */
|
|
65
|
+
amount: bigint | number | string;
|
|
66
|
+
/** The drop's `Currency` type, e.g. `0x2::sui::SUI`. */
|
|
67
|
+
currencyType: string;
|
|
68
|
+
/** The `miso_record` `Settings` shared object (authorizes the mint). */
|
|
69
|
+
settingsId: string;
|
|
70
|
+
/** Where to send the bought `Record` (usually the buyer). */
|
|
71
|
+
recipient: string;
|
|
72
|
+
misoDropPackageId: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Buys one record from a drop: merges the buyer's payment coins, splits the exact
|
|
76
|
+
* price, calls `buy`, and sends the minted `Record` to `recipient`. The buyer selects
|
|
77
|
+
* which of their coins to spend (see the app's coin selection); this builder only
|
|
78
|
+
* assembles the PTB. The `Clock` is auto-supplied.
|
|
79
|
+
*/
|
|
80
|
+
export declare function buyRecord(p: BuyRecordParams): TxThunk;
|
|
81
|
+
/** A parsed drop, in the shape the featured-drop card renders. */
|
|
82
|
+
export interface DropView {
|
|
83
|
+
id: string;
|
|
84
|
+
releaseId: string;
|
|
85
|
+
edition: number;
|
|
86
|
+
price: {
|
|
87
|
+
kind: "fixed" | "floor";
|
|
88
|
+
amount: bigint;
|
|
89
|
+
};
|
|
90
|
+
/** `null` = uncapped (an open edition). */
|
|
91
|
+
maxSupply: bigint | null;
|
|
92
|
+
quantitySold: bigint;
|
|
93
|
+
startTimestampMs: bigint;
|
|
94
|
+
/** `null` = evergreen. */
|
|
95
|
+
endTimestampMs: bigint | null;
|
|
96
|
+
/** The drop's `Currency` type, parsed from its object type tag (`null` if unavailable). */
|
|
97
|
+
currencyType: string | null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Fetches and parses a shared `Drop` object, or `null` if it doesn't exist.
|
|
101
|
+
*
|
|
102
|
+
* NOTE: this deliberately deviates from the core-getter convention in
|
|
103
|
+
* `./queries.ts` (throw on missing object). Consumers probe pasted or stored
|
|
104
|
+
* drop ids — a party's featured drop, a superseded edition — where "no such
|
|
105
|
+
* drop" is a normal state, so absence is `null` and only transport failures throw.
|
|
106
|
+
*/
|
|
107
|
+
export declare function getDrop(client: ClientWithCoreApi, dropId: string): Promise<DropView | null>;
|
|
108
|
+
export interface GetCurrentDropParams {
|
|
109
|
+
/** The release whose live drop to resolve. */
|
|
110
|
+
releaseId: string;
|
|
111
|
+
misoDropPackageId: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolves a release's LIVE drop through the `CurrentDropKey` pointer on the
|
|
115
|
+
* release's UID, or `null` if the release has never dropped. Superseded drops are
|
|
116
|
+
* destroyed, so this — not derived-address probing — is how the current edition is
|
|
117
|
+
* found.
|
|
118
|
+
*/
|
|
119
|
+
export declare function getCurrentDrop(client: ClientWithCoreApi, p: GetCurrentDropParams): Promise<DropView | null>;
|
|
120
|
+
//# sourceMappingURL=drop.d.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C;CAC7B;AASD;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAuCjG;AASD,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAgBjH"}
|
package/dist/drop.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { deriveDynamicFieldID } from "@mysten/sui/utils";
|
|
4
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
5
|
+
import { isNotFound } from "./queries.js";
|
|
6
|
+
import * as drop from "./contracts/miso_drop/drop.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates and shares a release's FIRST drop — edition 0. A release's edition
|
|
9
|
+
* sequence can only ever start once; later terms changes go through `newEdition`.
|
|
10
|
+
* The `Clock` is auto-supplied by the generated binding.
|
|
11
|
+
*/
|
|
12
|
+
export function createDrop(p) {
|
|
13
|
+
return (tx) => {
|
|
14
|
+
const terms = buildTerms(tx, p);
|
|
15
|
+
tx.add(drop._new({
|
|
16
|
+
package: p.misoDropPackageId,
|
|
17
|
+
arguments: [p.releaseId, p.releaseAdminCapId, terms.price, terms.supply, terms.window],
|
|
18
|
+
typeArguments: [p.currencyType],
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Opens edition n+1 of a release's drop, CONSUMING the current one — the one way to
|
|
24
|
+
* change price, currency, cap, or window (or start a fresh run after a sell-out).
|
|
25
|
+
* Serial numbers restart at 1 for the new edition. The `Clock` is auto-supplied.
|
|
26
|
+
*/
|
|
27
|
+
export function newEdition(p) {
|
|
28
|
+
return (tx) => {
|
|
29
|
+
const terms = buildTerms(tx, p);
|
|
30
|
+
tx.add(drop.newEdition({
|
|
31
|
+
package: p.misoDropPackageId,
|
|
32
|
+
arguments: [p.releaseId, p.oldDropId, p.releaseAdminCapId, terms.price, terms.supply, terms.window],
|
|
33
|
+
typeArguments: [p.oldCurrencyType, p.currencyType],
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Builds the three on-chain term values (`Price`, `Supply`, `Window`) from the flat
|
|
38
|
+
* facade params — the flat shape stays the public API; the enums are a wire detail. */
|
|
39
|
+
function buildTerms(tx, p) {
|
|
40
|
+
const pkg = { package: p.misoDropPackageId };
|
|
41
|
+
const makePrice = p.price.kind === "fixed" ? drop.newFixedPrice : drop.newFloorPrice;
|
|
42
|
+
const price = tx.add(makePrice({ ...pkg, arguments: [BigInt(p.price.amount)] }));
|
|
43
|
+
const supply = p.maxSupply == null
|
|
44
|
+
? tx.add(drop.newUncappedSupply({ ...pkg, arguments: [] }))
|
|
45
|
+
: tx.add(drop.newCappedSupply({ ...pkg, arguments: [BigInt(p.maxSupply)] }));
|
|
46
|
+
const start = BigInt(p.startTimestampMs ?? 0);
|
|
47
|
+
const window = p.endTimestampMs == null
|
|
48
|
+
? tx.add(drop.newUnboundedWindow({ ...pkg, arguments: [start] }))
|
|
49
|
+
: tx.add(drop.newBoundedWindow({ ...pkg, arguments: [start, BigInt(p.endTimestampMs)] }));
|
|
50
|
+
return { price, supply, window };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Buys one record from a drop: merges the buyer's payment coins, splits the exact
|
|
54
|
+
* price, calls `buy`, and sends the minted `Record` to `recipient`. The buyer selects
|
|
55
|
+
* which of their coins to spend (see the app's coin selection); this builder only
|
|
56
|
+
* assembles the PTB. The `Clock` is auto-supplied.
|
|
57
|
+
*/
|
|
58
|
+
export function buyRecord(p) {
|
|
59
|
+
return (tx) => {
|
|
60
|
+
const [first, ...rest] = p.paymentCoinIds;
|
|
61
|
+
if (!first)
|
|
62
|
+
throw new Error("buyRecord: no payment coins provided");
|
|
63
|
+
const primary = tx.object(first);
|
|
64
|
+
if (rest.length > 0)
|
|
65
|
+
tx.mergeCoins(primary, rest.map((id) => tx.object(id)));
|
|
66
|
+
const [payment] = tx.splitCoins(primary, [tx.pure.u64(BigInt(p.amount))]);
|
|
67
|
+
const record = tx.add(drop.buy({
|
|
68
|
+
package: p.misoDropPackageId,
|
|
69
|
+
arguments: [p.dropId, payment, p.settingsId],
|
|
70
|
+
typeArguments: [p.currencyType],
|
|
71
|
+
}));
|
|
72
|
+
tx.transferObjects([record], p.recipient);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** Extracts `CURRENCY` from a `…::drop::Drop<CURRENCY>` type tag. */
|
|
76
|
+
function currencyFromType(type) {
|
|
77
|
+
if (!type)
|
|
78
|
+
return null;
|
|
79
|
+
const lt = type.indexOf("<");
|
|
80
|
+
return lt >= 0 && type.endsWith(">") ? type.slice(lt + 1, -1) : null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fetches and parses a shared `Drop` object, or `null` if it doesn't exist.
|
|
84
|
+
*
|
|
85
|
+
* NOTE: this deliberately deviates from the core-getter convention in
|
|
86
|
+
* `./queries.ts` (throw on missing object). Consumers probe pasted or stored
|
|
87
|
+
* drop ids — a party's featured drop, a superseded edition — where "no such
|
|
88
|
+
* drop" is a normal state, so absence is `null` and only transport failures throw.
|
|
89
|
+
*/
|
|
90
|
+
export async function getDrop(client, dropId) {
|
|
91
|
+
let content;
|
|
92
|
+
let type;
|
|
93
|
+
try {
|
|
94
|
+
const { object } = await client.core.getObject({ objectId: dropId, include: { content: true } });
|
|
95
|
+
content = object?.content;
|
|
96
|
+
type = object?.type;
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
if (isNotFound(e))
|
|
100
|
+
return null;
|
|
101
|
+
throw e;
|
|
102
|
+
}
|
|
103
|
+
if (!content)
|
|
104
|
+
return null;
|
|
105
|
+
const d = drop.Drop.parse(content);
|
|
106
|
+
const price = d.price;
|
|
107
|
+
const isFixed = price.$kind === "Fixed" || price.Fixed != null;
|
|
108
|
+
const amount = (isFixed ? price.Fixed?.amount : price.Floor?.amount) ?? "0";
|
|
109
|
+
const supply = d.supply;
|
|
110
|
+
const capped = supply.$kind === "Capped" || supply.Capped != null;
|
|
111
|
+
const window = d.window;
|
|
112
|
+
const bounded = window.$kind === "Bounded" || window.Bounded != null;
|
|
113
|
+
return {
|
|
114
|
+
id: dropId,
|
|
115
|
+
releaseId: d.release_id,
|
|
116
|
+
edition: d.edition,
|
|
117
|
+
price: { kind: isFixed ? "fixed" : "floor", amount: BigInt(amount) },
|
|
118
|
+
maxSupply: capped ? BigInt(supply.Capped?.max ?? "0") : null,
|
|
119
|
+
quantitySold: BigInt(d.quantity_sold),
|
|
120
|
+
startTimestampMs: BigInt((bounded ? window.Bounded?.start_timestamp_ms : window.Unbounded?.start_timestamp_ms) ?? "0"),
|
|
121
|
+
endTimestampMs: bounded ? BigInt(window.Bounded?.end_timestamp_ms ?? "0") : null,
|
|
122
|
+
currencyType: currencyFromType(type),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// The release's `CurrentDropKey` dynamic field holds a bare `ID`; the field object
|
|
126
|
+
// serializes as `Field { id, name: CurrentDropKey (unit), value: ID }`.
|
|
127
|
+
const CurrentDropField = bcs.struct("Field", { id: bcs.Address, name: bcs.bool(), value: bcs.Address });
|
|
128
|
+
// Unit-struct key bytes (single `0x00` for the dummy bool field).
|
|
129
|
+
const CURRENT_DROP_KEY_BYTES = drop.CurrentDropKey.serialize([false]).toBytes();
|
|
130
|
+
/**
|
|
131
|
+
* Resolves a release's LIVE drop through the `CurrentDropKey` pointer on the
|
|
132
|
+
* release's UID, or `null` if the release has never dropped. Superseded drops are
|
|
133
|
+
* destroyed, so this — not derived-address probing — is how the current edition is
|
|
134
|
+
* found.
|
|
135
|
+
*/
|
|
136
|
+
export async function getCurrentDrop(client, p) {
|
|
137
|
+
const fieldId = deriveDynamicFieldID(p.releaseId, `${p.misoDropPackageId}::drop::CurrentDropKey`, CURRENT_DROP_KEY_BYTES);
|
|
138
|
+
let content;
|
|
139
|
+
try {
|
|
140
|
+
const { object } = await client.core.getObject({ objectId: fieldId, include: { content: true } });
|
|
141
|
+
content = object?.content;
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
if (isNotFound(e))
|
|
145
|
+
return null;
|
|
146
|
+
throw e;
|
|
147
|
+
}
|
|
148
|
+
if (!content)
|
|
149
|
+
return null;
|
|
150
|
+
return getDrop(client, CurrentDropField.parse(content).value);
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=drop.js.map
|
package/dist/drop.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop.js","sourceRoot":"","sources":["../src/drop.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAUtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AAwBtD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,CAAmB;IAC5C,OAAO,CAAC,EAAE,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAChC,EAAE,CAAC,GAAG,CACJ,IAAI,CAAC,IAAI,CAAC;YACR,OAAO,EAAE,CAAC,CAAC,iBAAiB;YAC5B,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,KAAK,CAAC,K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AAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAClG,OAAO,GAAG,MAAM,EAAE,OAAO,CAAC;IAC5B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,UAAU,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/B,MAAM,CAAC,CAAC;IACV,CAAC;IACD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./share.ts";
|
|
|
7
7
|
export * from "./share-template.ts";
|
|
8
8
|
export * from "./release-graph.ts";
|
|
9
9
|
export * from "./catalog.ts";
|
|
10
|
+
export * as read from "./read/index.ts";
|
|
10
11
|
export * from "./credits.ts";
|
|
11
12
|
export * from "./cover.ts";
|
|
12
13
|
export * from "./extensions/royalty-pool.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAK7B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAIxC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAG7C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,10 @@ export * from "./share.js";
|
|
|
31
31
|
export * from "./share-template.js";
|
|
32
32
|
export * from "./release-graph.js";
|
|
33
33
|
export * from "./catalog.js";
|
|
34
|
+
// High-level, JSON-safe platform projections used directly by clients and by
|
|
35
|
+
// the thin HTTP read service. Namespaced because these composed view types are
|
|
36
|
+
// intentionally distinct from the lower-level contract views above.
|
|
37
|
+
export * as read from "./read/index.js";
|
|
34
38
|
// First-party extensions — attached to a protocol work via its cap-gated
|
|
35
39
|
// `uid_mut` hook.
|
|
36
40
|
export * from "./credits.js";
|
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,sCAAsC;AACtC,EAAE;AACF,6EAA6E;AAC7E,oEAAoE;AACpE,EAAE;AACF,+EAA+E;AAC/E,oFAAoF;AACpF,8EAA8E;AAC9E,4EAA4E;AAC5E,kEAAkE;AAClE,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AACjF,qCAAqC;AACrC,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E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AAI,MAAM,iBAAiB,CAAC;AAExC,yEAAyE;AACzE,kBAAkB;AAClB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAE7C,sEAAsE;AACtE,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { MisoClient } from "./client.ts";
|
|
2
|
+
import type { ArtistProfile, FeaturedRelease, PartySummary } from "./types.ts";
|
|
3
|
+
/** Optional sub-resources — read only when asked for. */
|
|
4
|
+
export type ArtistInclude = "roles" | "tags";
|
|
5
|
+
export interface GetArtistOptions {
|
|
6
|
+
include?: readonly ArtistInclude[];
|
|
7
|
+
}
|
|
8
|
+
/** Public avatar URL for a party (served from the API's R2 lane; 404 when unset). */
|
|
9
|
+
export declare function partyAvatarUrl(apiBaseUrl: string, partyId: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* An artist page, fully resolved. Throws only if the PARTY itself can't be read —
|
|
12
|
+
* every extension is optional by design (a party with no profile set is a new
|
|
13
|
+
* party, not a broken one), so each decoration read falls back to its empty value.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getArtistProfile(client: MisoClient, partyId: string, options?: GetArtistOptions): Promise<ArtistProfile>;
|
|
16
|
+
/** Name + kind for many parties at once. Ids that don't resolve are omitted. */
|
|
17
|
+
export declare function getPartySummaries(client: MisoClient, ids: readonly string[]): Promise<PartySummary[]>;
|
|
18
|
+
/**
|
|
19
|
+
* The party's pinned pressing, resolved through to its release and cover.
|
|
20
|
+
* `null` — a successful empty — when nothing is pinned or the pin is dangling
|
|
21
|
+
* (the pressing it named has since been superseded and destroyed).
|
|
22
|
+
*/
|
|
23
|
+
export declare function getFeaturedRelease(client: MisoClient, partyId: string): Promise<FeaturedRelease | null>;
|
|
24
|
+
//# sourceMappingURL=artist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artist.d.ts","sourceRoot":"","sources":["../../src/read/artist.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5F,yDAAyD;AACzD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CACpC;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAuCxB;AAYD,gFAAgF;AAChF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAO3G;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA0B7G"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// Artist reads: a `Party` plus every extension attached to its UID.
|
|
5
|
+
//
|
|
6
|
+
// The artist page is the clearest case for this whole layer. Its data lives in
|
|
7
|
+
// EIGHT separate dynamic fields, each its own package, each its own read — party,
|
|
8
|
+
// profile, ctas, genres, links, roles, tags, featured. miso-app fanned all eight
|
|
9
|
+
// out from the browser (`lib/party-queries.ts`, plus a second identical fan-out in
|
|
10
|
+
// `PartyEditSheet`). Here they are one call, resolved once, cached once.
|
|
11
|
+
//
|
|
12
|
+
// `roles` and `tags` are opt-in via `include`: only the owner's edit sheet reads
|
|
13
|
+
// them, and leaving them out of the public read keeps the hot path to six.
|
|
14
|
+
import { resolveGenreNames } from "./genres.js";
|
|
15
|
+
import { readReleaseCover } from "./catalog.js";
|
|
16
|
+
import { getDrop } from "../drop.js";
|
|
17
|
+
import { getReleaseById } from "@misonetwork/sdk";
|
|
18
|
+
import { getReleaseCredits } from "../credits.js";
|
|
19
|
+
/** Public avatar URL for a party (served from the API's R2 lane; 404 when unset). */
|
|
20
|
+
export function partyAvatarUrl(apiBaseUrl, partyId) {
|
|
21
|
+
return `${apiBaseUrl.replace(/\/$/, "")}/media/avatar/${partyId}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An artist page, fully resolved. Throws only if the PARTY itself can't be read —
|
|
25
|
+
* every extension is optional by design (a party with no profile set is a new
|
|
26
|
+
* party, not a broken one), so each decoration read falls back to its empty value.
|
|
27
|
+
*/
|
|
28
|
+
export async function getArtistProfile(client, partyId, options = {}) {
|
|
29
|
+
const include = new Set(options.include ?? []);
|
|
30
|
+
const { party } = client.sui;
|
|
31
|
+
const [profile, ctas, genreIds, links, roles, tags] = await Promise.all([
|
|
32
|
+
party.getProfile(partyId).catch(() => null),
|
|
33
|
+
party.getCtas(partyId).catch(() => []),
|
|
34
|
+
party.getGenres(partyId).catch(() => []),
|
|
35
|
+
party.getLinks(partyId).catch(() => []),
|
|
36
|
+
include.has("roles") ? party.getRoles(partyId).catch(() => []) : Promise.resolve(undefined),
|
|
37
|
+
include.has("tags") ? party.getTags(partyId).catch(() => []) : Promise.resolve(undefined),
|
|
38
|
+
]);
|
|
39
|
+
// The party read is the one that may legitimately fail (no such party), so it
|
|
40
|
+
// is awaited on its own rather than being swallowed by the batch above.
|
|
41
|
+
const entity = await party.getPartyById(partyId);
|
|
42
|
+
const [genres, members] = await Promise.all([
|
|
43
|
+
resolveGenreNames(client, genreIds),
|
|
44
|
+
resolveMembers(client, entity.kind === "group" ? (entity.members ?? []) : []),
|
|
45
|
+
]);
|
|
46
|
+
return {
|
|
47
|
+
id: entity.id,
|
|
48
|
+
kind: entity.kind,
|
|
49
|
+
name: entity.name,
|
|
50
|
+
createdAtMs: entity.createdAtMs,
|
|
51
|
+
bioShort: profile?.bioShort ?? null,
|
|
52
|
+
bioLong: profile?.bioLong ?? null,
|
|
53
|
+
country: profile?.country ?? null,
|
|
54
|
+
languages: profile?.languages ?? [],
|
|
55
|
+
genres,
|
|
56
|
+
links: links.map((l) => ({ platform: l.platform, value: l.value, url: l.url })),
|
|
57
|
+
ctas: ctas.map((c) => ({ label: c.label, url: c.url })),
|
|
58
|
+
members,
|
|
59
|
+
...(roles !== undefined ? { roles } : {}),
|
|
60
|
+
...(tags !== undefined ? { tags } : {}),
|
|
61
|
+
avatarUrl: partyAvatarUrl(client.config.apiBaseUrl, entity.id),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Group members with names resolved. A member that fails to read is dropped. */
|
|
65
|
+
async function resolveMembers(client, memberIds) {
|
|
66
|
+
if (memberIds.length === 0)
|
|
67
|
+
return [];
|
|
68
|
+
const parties = await client.sui.party.getPartiesByIds([...memberIds]).catch(() => ({}));
|
|
69
|
+
return memberIds.flatMap((id) => {
|
|
70
|
+
const p = parties[id];
|
|
71
|
+
return p ? [{ id, name: p.name }] : [];
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Name + kind for many parties at once. Ids that don't resolve are omitted. */
|
|
75
|
+
export async function getPartySummaries(client, ids) {
|
|
76
|
+
if (ids.length === 0)
|
|
77
|
+
return [];
|
|
78
|
+
const parties = await client.sui.party.getPartiesByIds([...ids]);
|
|
79
|
+
return ids.flatMap((id) => {
|
|
80
|
+
const p = parties[id];
|
|
81
|
+
return p ? [{ id, name: p.name, kind: p.kind }] : [];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The party's pinned pressing, resolved through to its release and cover.
|
|
86
|
+
* `null` — a successful empty — when nothing is pinned or the pin is dangling
|
|
87
|
+
* (the pressing it named has since been superseded and destroyed).
|
|
88
|
+
*/
|
|
89
|
+
export async function getFeaturedRelease(client, partyId) {
|
|
90
|
+
const pressingId = await client.sui.party.getFeaturedDrop(partyId);
|
|
91
|
+
if (!pressingId)
|
|
92
|
+
return null;
|
|
93
|
+
const pressing = await getDrop(client.protocol, pressingId);
|
|
94
|
+
if (!pressing)
|
|
95
|
+
return null;
|
|
96
|
+
const [release, cover, credits, entity] = await Promise.all([
|
|
97
|
+
getReleaseById(client.protocol, pressing.releaseId),
|
|
98
|
+
readReleaseCover(client, pressing.releaseId),
|
|
99
|
+
getReleaseCredits(client.protocol, pressing.releaseId, client.config.protocol.releaseCredits).catch(() => null),
|
|
100
|
+
client.sui.party.getPartyById(partyId),
|
|
101
|
+
]);
|
|
102
|
+
// The artist line prefers the release's own PRIMARY credits and falls back to
|
|
103
|
+
// the party whose page this is — a release with no credits set still shows an
|
|
104
|
+
// artist, which is the behavior the featured card has always had.
|
|
105
|
+
const primary = (credits ?? []).filter((c) => c.roles.includes("Primary")).map((c) => c.displayName);
|
|
106
|
+
return {
|
|
107
|
+
pressingId,
|
|
108
|
+
releaseId: pressing.releaseId,
|
|
109
|
+
title: release.title,
|
|
110
|
+
artist: primary.length ? primary.join(", ") : entity.name,
|
|
111
|
+
coverUrl: cover?.still.url ?? null,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=artist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artist.js","sourceRoot":"","sources":["../../src/read/artist.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AACtC,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,mFAAmF;AACnF,yEAAyE;AACzE,EAAE;AACF,iFAAiF;AACjF,2E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,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QAC/G,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC;KACvC,CAAC,CAAC;IAEH,8EAA8E;IAC9E,8EAA8E;IAC9E,kEAAkE;IAClE,MAAM,OAAO,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAErG,OAAO;QACL,UAAU;QACV,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI;QACzD,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { MisoClient } from "./client.ts";
|
|
2
|
+
import type { Cover, Credit, Currency, DiscoverItem, DropPreview, PressingDetail, RecordAlbum, ReleaseDetail, TrackCredits } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Symbol + decimals for a coin type. FakeUsd (the testnet dollar) is 6dp; SUI is
|
|
5
|
+
* 9dp; anything else falls back to its module name at 9dp, which is the Sui
|
|
6
|
+
* default and the honest guess for a coin we have no table entry for.
|
|
7
|
+
*/
|
|
8
|
+
export declare function currencyInfo(type: string | null): Currency;
|
|
9
|
+
/** The release's PRIMARY credits, in chain order — a release's artist line. */
|
|
10
|
+
export declare function primaryArtistNames(credits: Credit[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* A release's cover, trying the current `release_cover_art` package and then each
|
|
13
|
+
* legacy one in turn.
|
|
14
|
+
*
|
|
15
|
+
* Covers set before the cover_art package split live under a different
|
|
16
|
+
* `CoverArtKey` TYPE (different package address), so a current-package read
|
|
17
|
+
* simply misses them rather than failing. Ported verbatim from miso-app's
|
|
18
|
+
* `lib/pressing.ts:readReleaseCover`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readReleaseCover(client: MisoClient, releaseId: string): Promise<Cover | null>;
|
|
21
|
+
/**
|
|
22
|
+
* A release with its cover, credits, and resolved tracklist.
|
|
23
|
+
*
|
|
24
|
+
* Identity (the release object) is HARD — a failure here is a failed read.
|
|
25
|
+
* Decoration (cover, credits) is SOFT: a release with no cover extension set is a
|
|
26
|
+
* normal state, not a broken page, so those reads swallow their errors. That
|
|
27
|
+
* split is inherited from `lib/drops.ts` and is what keeps a half-configured
|
|
28
|
+
* release renderable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getReleaseDetail(client: MisoClient, releaseId: string): Promise<ReleaseDetail>;
|
|
31
|
+
/**
|
|
32
|
+
* Per-track credits for a release, keyed by recording id. A track with no credits
|
|
33
|
+
* set maps to an empty entry rather than being absent, so a caller can tell
|
|
34
|
+
* "nothing credited" from "no such track".
|
|
35
|
+
*/
|
|
36
|
+
export declare function getTrackCredits(client: MisoClient, releaseId: string): Promise<Record<string, TrackCredits>>;
|
|
37
|
+
/** Everything the pressing buy page renders. `null` when no such pressing exists. */
|
|
38
|
+
export declare function getPressingDetail(client: MisoClient, pressingId: string): Promise<PressingDetail | null>;
|
|
39
|
+
/**
|
|
40
|
+
* The confirmation preview behind "paste a pressing id to pin it". Verifies the
|
|
41
|
+
* object really is a `Drop` before spending reads on it — a release id or a
|
|
42
|
+
* record id pasted by mistake must come back as `null`, not as a half-built card.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getDropPreview(client: MisoClient, dropId: string): Promise<DropPreview | null>;
|
|
45
|
+
/**
|
|
46
|
+
* The records currently on sale.
|
|
47
|
+
*
|
|
48
|
+
* Configured by RELEASE id, never by drop id: a release id is permanent, while a
|
|
49
|
+
* drop is superseded (and the old `Drop` destroyed) whenever a new edition opens.
|
|
50
|
+
* Following the release's `CurrentDropKey` pointer keeps this list pointing at the
|
|
51
|
+
* live edition without anyone touching the config.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getDiscoverShelf(client: MisoClient): Promise<DiscoverItem[]>;
|
|
54
|
+
/**
|
|
55
|
+
* A record's parent release. Both live `Record` struct layouts expose it — card
|
|
56
|
+
* checkout's `{ release_id, number }` and the SDK view's
|
|
57
|
+
* `{ release_id, edition, variant }` — so we probe both spellings.
|
|
58
|
+
*
|
|
59
|
+
* This answer is IMMUTABLE for the life of the record, which is what lets the
|
|
60
|
+
* endpoint in front of it cache for a year.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getRecordAlbum(client: MisoClient, recordId: string): Promise<RecordAlbum | null>;
|
|
63
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/read/catalog.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,KAAK,EACV,KAAK,EAEL,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,cAAc,EAGd,WAAW,EACX,aAAa,EACb,YAAY,EAGb,MAAM,YAAY,CAAC;AAoBpB;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAK1D;AA8BD,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE9D;AAkBD;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAOnG;AAID;;;;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