@tinyhumansai/tinyplace 0.1.0 → 0.1.1
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/package.json +2 -1
- package/src/api/a2a.ts +0 -50
- package/src/api/admin.ts +0 -95
- package/src/api/broadcasts.ts +0 -110
- package/src/api/channels.ts +0 -110
- package/src/api/directory.ts +0 -45
- package/src/api/escrow.ts +0 -163
- package/src/api/events.ts +0 -133
- package/src/api/explorer.ts +0 -48
- package/src/api/groups.ts +0 -64
- package/src/api/inbox.ts +0 -71
- package/src/api/keys.ts +0 -18
- package/src/api/ledger.ts +0 -28
- package/src/api/marketplace.ts +0 -165
- package/src/api/messages.ts +0 -23
- package/src/api/moderation.ts +0 -71
- package/src/api/payments.ts +0 -47
- package/src/api/pricing.ts +0 -122
- package/src/api/profiles.ts +0 -43
- package/src/api/registry.ts +0 -143
- package/src/api/reputation.ts +0 -60
- package/src/api/search.ts +0 -59
- package/src/api/stats.ts +0 -32
- package/src/auth.ts +0 -75
- package/src/client.ts +0 -120
- package/src/crypto.ts +0 -74
- package/src/http.ts +0 -147
- package/src/index.ts +0 -72
- package/src/local-signer.ts +0 -78
- package/src/signal/crypto.ts +0 -229
- package/src/signal/index.ts +0 -28
- package/src/signal/keys.ts +0 -54
- package/src/signal/memory-store.ts +0 -66
- package/src/signal/ratchet.ts +0 -162
- package/src/signal/session.ts +0 -189
- package/src/signal/store.ts +0 -49
- package/src/signal/x3dh.ts +0 -130
- package/src/signer.ts +0 -21
- package/src/types/broadcasts.ts +0 -81
- package/src/types/commerce.ts +0 -206
- package/src/types/directory.ts +0 -98
- package/src/types/escrow.ts +0 -163
- package/src/types/events.ts +0 -155
- package/src/types/explorer.ts +0 -152
- package/src/types/groups.ts +0 -62
- package/src/types/identity.ts +0 -113
- package/src/types/index.ts +0 -16
- package/src/types/ledger.ts +0 -78
- package/src/types/marketplace.ts +0 -166
- package/src/types/messaging.ts +0 -77
- package/src/types/payments.ts +0 -103
- package/src/types/profile.ts +0 -55
- package/src/types/reputation.ts +0 -98
- package/src/types/search.ts +0 -61
- package/src/types/social.ts +0 -186
- package/src/websocket.ts +0 -112
- package/tests/signal.test.ts +0 -353
- package/tests/staging.test.ts +0 -650
- package/tsconfig.json +0 -15
- package/vitest.config.ts +0 -7
package/src/api/events.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
Event,
|
|
4
|
-
EventAttendee,
|
|
5
|
-
EventPoll,
|
|
6
|
-
EventQueryParams,
|
|
7
|
-
EventQuestion,
|
|
8
|
-
EventRecording,
|
|
9
|
-
EventSeries,
|
|
10
|
-
EventStageMessage,
|
|
11
|
-
} from "../types/index.js";
|
|
12
|
-
|
|
13
|
-
export class EventsApi {
|
|
14
|
-
constructor(private readonly http: HttpClient) {}
|
|
15
|
-
|
|
16
|
-
list(params?: EventQueryParams): Promise<{ events: Array<Event> }> {
|
|
17
|
-
return this.http.get<{ events: Array<Event> }>("/events", params as Record<string, unknown>);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
create(event: Partial<Event>): Promise<Event> {
|
|
21
|
-
return this.http.postDirectoryAuth<Event>("/events", event);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get(eventId: string): Promise<Event> {
|
|
25
|
-
return this.http.get<Event>(`/events/${encodeURIComponent(eventId)}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
update(eventId: string, event: Partial<Event>): Promise<Event> {
|
|
29
|
-
return this.http.putDirectoryAuth<Event>(`/events/${encodeURIComponent(eventId)}`, event);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
remove(eventId: string): Promise<void> {
|
|
33
|
-
return this.http.deleteDirectoryAuth<void>(`/events/${encodeURIComponent(eventId)}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
rsvp(eventId: string, ticketType?: string): Promise<EventAttendee> {
|
|
37
|
-
return this.http.postDirectoryAuth<EventAttendee>(
|
|
38
|
-
`/events/${encodeURIComponent(eventId)}/rsvp`,
|
|
39
|
-
ticketType ? { ticketType } : undefined,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
cancelRsvp(eventId: string): Promise<void> {
|
|
44
|
-
return this.http.deleteDirectoryAuth<void>(`/events/${encodeURIComponent(eventId)}/rsvp`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
attendees(eventId: string): Promise<{ attendees: Array<EventAttendee> }> {
|
|
48
|
-
return this.http.getDirectoryAuth<{ attendees: Array<EventAttendee> }>(
|
|
49
|
-
`/events/${encodeURIComponent(eventId)}/attendees`,
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
removeAttendee(eventId: string, agentId: string): Promise<void> {
|
|
54
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
55
|
-
`/events/${encodeURIComponent(eventId)}/attendees/${encodeURIComponent(agentId)}`,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
invite(eventId: string, agentId: string): Promise<void> {
|
|
60
|
-
return this.http.postDirectoryAuth<void>(
|
|
61
|
-
`/events/${encodeURIComponent(eventId)}/invite`,
|
|
62
|
-
{ agentId },
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
start(eventId: string): Promise<Event> {
|
|
67
|
-
return this.http.postDirectoryAuth<Event>(`/events/${encodeURIComponent(eventId)}/start`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
end(eventId: string): Promise<Event> {
|
|
71
|
-
return this.http.postDirectoryAuth<Event>(`/events/${encodeURIComponent(eventId)}/end`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
getStage(eventId: string): Promise<{ messages: Array<EventStageMessage> }> {
|
|
75
|
-
return this.http.get<{ messages: Array<EventStageMessage> }>(
|
|
76
|
-
`/events/${encodeURIComponent(eventId)}/stage`,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
postToStage(
|
|
81
|
-
eventId: string,
|
|
82
|
-
body: { speaker?: string; message: string },
|
|
83
|
-
): Promise<EventStageMessage> {
|
|
84
|
-
return this.http.postDirectoryAuth<EventStageMessage>(
|
|
85
|
-
`/events/${encodeURIComponent(eventId)}/stage`,
|
|
86
|
-
body,
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
pauseStage(eventId: string): Promise<Event> {
|
|
91
|
-
return this.http.postDirectoryAuth<Event>(`/events/${encodeURIComponent(eventId)}/stage/pause`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
resumeStage(eventId: string): Promise<Event> {
|
|
95
|
-
return this.http.postDirectoryAuth<Event>(`/events/${encodeURIComponent(eventId)}/stage/resume`);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
questions(eventId: string): Promise<{ questions: Array<EventQuestion> }> {
|
|
99
|
-
return this.http.get<{ questions: Array<EventQuestion> }>(
|
|
100
|
-
`/events/${encodeURIComponent(eventId)}/questions`,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
polls(eventId: string): Promise<{ polls: Array<EventPoll> }> {
|
|
105
|
-
return this.http.get<{ polls: Array<EventPoll> }>(
|
|
106
|
-
`/events/${encodeURIComponent(eventId)}/polls`,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
recording(eventId: string): Promise<EventRecording> {
|
|
111
|
-
return this.http.get<EventRecording>(`/events/${encodeURIComponent(eventId)}/recording`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
listSeries(): Promise<{ series: Array<EventSeries> }> {
|
|
115
|
-
return this.http.get<{ series: Array<EventSeries> }>("/events/series");
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
createSeries(series: Partial<EventSeries>): Promise<EventSeries> {
|
|
119
|
-
return this.http.postDirectoryAuth<EventSeries>("/events/series", series);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
getSeries(seriesId: string): Promise<EventSeries> {
|
|
123
|
-
return this.http.get<EventSeries>(`/events/series/${encodeURIComponent(seriesId)}`);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
followSeries(seriesId: string): Promise<void> {
|
|
127
|
-
return this.http.postDirectoryAuth<void>(`/events/series/${encodeURIComponent(seriesId)}/follow`);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
unfollowSeries(seriesId: string): Promise<void> {
|
|
131
|
-
return this.http.deleteDirectoryAuth<void>(`/events/series/${encodeURIComponent(seriesId)}/follow`);
|
|
132
|
-
}
|
|
133
|
-
}
|
package/src/api/explorer.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { TinyVerseWebSocket } from "../websocket.js";
|
|
3
|
-
import type {
|
|
4
|
-
ExplorerAgentResponse,
|
|
5
|
-
ExplorerOverview,
|
|
6
|
-
ExplorerTransactionDetail,
|
|
7
|
-
ExplorerTransactionListResponse,
|
|
8
|
-
} from "../types/index.js";
|
|
9
|
-
|
|
10
|
-
export class ExplorerApi {
|
|
11
|
-
constructor(
|
|
12
|
-
private readonly http: HttpClient,
|
|
13
|
-
private readonly wsFactory?: (path: string) => TinyVerseWebSocket,
|
|
14
|
-
) {}
|
|
15
|
-
|
|
16
|
-
overview(): Promise<ExplorerOverview> {
|
|
17
|
-
return this.http.get<ExplorerOverview>("/explorer");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
listTransactions(params?: {
|
|
21
|
-
limit?: number;
|
|
22
|
-
offset?: number;
|
|
23
|
-
agent?: string;
|
|
24
|
-
status?: string;
|
|
25
|
-
type?: string;
|
|
26
|
-
}): Promise<ExplorerTransactionListResponse> {
|
|
27
|
-
return this.http.get<ExplorerTransactionListResponse>(
|
|
28
|
-
"/explorer/transactions",
|
|
29
|
-
params as Record<string, unknown>,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getTransaction(txId: string): Promise<ExplorerTransactionDetail> {
|
|
34
|
-
return this.http.get<ExplorerTransactionDetail>(
|
|
35
|
-
`/explorer/transactions/${encodeURIComponent(txId)}`,
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getAgent(agentId: string): Promise<ExplorerAgentResponse> {
|
|
40
|
-
return this.http.get<ExplorerAgentResponse>(
|
|
41
|
-
`/explorer/agents/${encodeURIComponent(agentId)}`,
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
live(): TinyVerseWebSocket | undefined {
|
|
46
|
-
return this.wsFactory?.("/explorer/live");
|
|
47
|
-
}
|
|
48
|
-
}
|
package/src/api/groups.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
GroupCreateRequest,
|
|
4
|
-
GroupMember,
|
|
5
|
-
GroupMetadata,
|
|
6
|
-
GroupQueryParams,
|
|
7
|
-
} from "../types/index.js";
|
|
8
|
-
|
|
9
|
-
export class GroupsApi {
|
|
10
|
-
constructor(private readonly http: HttpClient) {}
|
|
11
|
-
|
|
12
|
-
list(params?: GroupQueryParams): Promise<{ groups: Array<GroupMetadata> }> {
|
|
13
|
-
return this.http.get<{ groups: Array<GroupMetadata> }>(
|
|
14
|
-
"/directory/groups",
|
|
15
|
-
params as Record<string, unknown>,
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get(groupId: string): Promise<GroupMetadata> {
|
|
20
|
-
return this.http.get<GroupMetadata>(`/directory/groups/${encodeURIComponent(groupId)}`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
create(request: GroupCreateRequest): Promise<GroupMetadata> {
|
|
24
|
-
return this.http.postDirectoryAuth<GroupMetadata>("/directory/groups", request);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
members(groupId: string): Promise<{ members: Array<GroupMember> }> {
|
|
28
|
-
return this.http.get<{ members: Array<GroupMember> }>(
|
|
29
|
-
`/directory/groups/${encodeURIComponent(groupId)}/members`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
addMember(groupId: string, agentId: string): Promise<GroupMember> {
|
|
34
|
-
return this.http.postDirectoryAuth<GroupMember>(
|
|
35
|
-
`/directory/groups/${encodeURIComponent(groupId)}/members`,
|
|
36
|
-
{ agentId },
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
removeMember(groupId: string, agentId: string): Promise<void> {
|
|
41
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
42
|
-
`/directory/groups/${encodeURIComponent(groupId)}/members/${encodeURIComponent(agentId)}`,
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
join(groupId: string, agentId?: string): Promise<GroupMember> {
|
|
47
|
-
return this.http.postDirectoryAuth<GroupMember>(
|
|
48
|
-
`/directory/groups/${encodeURIComponent(groupId)}/join`,
|
|
49
|
-
agentId ? { agentId } : undefined,
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
approveMember(groupId: string, agentId: string): Promise<GroupMember> {
|
|
54
|
-
return this.http.postDirectoryAuth<GroupMember>(
|
|
55
|
-
`/directory/groups/${encodeURIComponent(groupId)}/members/${encodeURIComponent(agentId)}/approve`,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
rejectMember(groupId: string, agentId: string): Promise<void> {
|
|
60
|
-
return this.http.postDirectoryAuth<void>(
|
|
61
|
-
`/directory/groups/${encodeURIComponent(groupId)}/members/${encodeURIComponent(agentId)}/reject`,
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
package/src/api/inbox.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { TinyVerseWebSocket, TinyVerseWebSocketOptions } from "../websocket.js";
|
|
3
|
-
import type {
|
|
4
|
-
InboxCounts,
|
|
5
|
-
InboxItem,
|
|
6
|
-
InboxListResult,
|
|
7
|
-
InboxQueryParams,
|
|
8
|
-
} from "../types/index.js";
|
|
9
|
-
|
|
10
|
-
export class InboxApi {
|
|
11
|
-
constructor(
|
|
12
|
-
private readonly http: HttpClient,
|
|
13
|
-
private readonly wsFactory?: (path: string) => TinyVerseWebSocket,
|
|
14
|
-
) {}
|
|
15
|
-
|
|
16
|
-
list(params?: InboxQueryParams): Promise<InboxListResult> {
|
|
17
|
-
return this.http.getAuth<InboxListResult>("/inbox", params as Record<string, unknown>);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get(itemId: string): Promise<InboxItem> {
|
|
21
|
-
return this.http.getAuth<InboxItem>(`/inbox/${encodeURIComponent(itemId)}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
search(query: string): Promise<{ items: Array<InboxItem> }> {
|
|
25
|
-
return this.http.getAuth<{ items: Array<InboxItem> }>("/inbox/search", { q: query });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
counts(): Promise<InboxCounts> {
|
|
29
|
-
return this.http.getAuth<InboxCounts>("/inbox/counts");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
markRead(itemId: string): Promise<InboxItem> {
|
|
33
|
-
return this.http.put<InboxItem>(`/inbox/${encodeURIComponent(itemId)}/read`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
markReadBulk(itemIds: Array<string>): Promise<void> {
|
|
37
|
-
return this.http.put<void>("/inbox/read", { itemIds });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
markAllRead(): Promise<void> {
|
|
41
|
-
return this.http.put<void>("/inbox/read-all");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
archive(itemId: string): Promise<InboxItem> {
|
|
45
|
-
return this.http.put<InboxItem>(`/inbox/${encodeURIComponent(itemId)}/archive`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
archiveBulk(itemIds: Array<string>): Promise<void> {
|
|
49
|
-
return this.http.put<void>("/inbox/archive", { itemIds });
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
unarchive(itemId: string): Promise<InboxItem> {
|
|
53
|
-
return this.http.put<InboxItem>(`/inbox/${encodeURIComponent(itemId)}/unarchive`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
remove(itemId: string): Promise<void> {
|
|
57
|
-
return this.http.delete<void>(`/inbox/${encodeURIComponent(itemId)}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
removeBulk(itemIds: Array<string>): Promise<void> {
|
|
61
|
-
return this.http.delete<void>("/inbox", { itemIds });
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
clear(params?: { status?: string; type?: string }): Promise<void> {
|
|
65
|
-
return this.http.delete<void>("/inbox/clear");
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
stream(): TinyVerseWebSocket | undefined {
|
|
69
|
-
return this.wsFactory?.("/inbox/stream");
|
|
70
|
-
}
|
|
71
|
-
}
|
package/src/api/keys.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { KeyBundle, PreKeysRequest, SignedPreKeyRequest } from "../types/index.js";
|
|
3
|
-
|
|
4
|
-
export class KeysApi {
|
|
5
|
-
constructor(private readonly http: HttpClient) {}
|
|
6
|
-
|
|
7
|
-
getBundle(agentId: string): Promise<KeyBundle> {
|
|
8
|
-
return this.http.get<KeyBundle>(`/keys/${encodeURIComponent(agentId)}/bundle`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
uploadPreKeys(agentId: string, request: PreKeysRequest): Promise<void> {
|
|
12
|
-
return this.http.putDirectoryAuth<void>(`/keys/${encodeURIComponent(agentId)}/prekeys`, request);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
rotateSignedPreKey(agentId: string, request: SignedPreKeyRequest): Promise<void> {
|
|
16
|
-
return this.http.putDirectoryAuth<void>(`/keys/${encodeURIComponent(agentId)}/signed-prekey`, request);
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/api/ledger.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
LedgerListParams,
|
|
4
|
-
LedgerTransaction,
|
|
5
|
-
LedgerVerifyRequest,
|
|
6
|
-
LedgerVerifyResult,
|
|
7
|
-
} from "../types/index.js";
|
|
8
|
-
|
|
9
|
-
export class LedgerApi {
|
|
10
|
-
constructor(private readonly http: HttpClient) {}
|
|
11
|
-
|
|
12
|
-
list(params?: LedgerListParams): Promise<{ transactions: Array<LedgerTransaction> }> {
|
|
13
|
-
return this.http.get<{ transactions: Array<LedgerTransaction> }>(
|
|
14
|
-
"/ledger/transactions",
|
|
15
|
-
params as Record<string, unknown>,
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get(txId: string): Promise<LedgerTransaction> {
|
|
20
|
-
return this.http.get<LedgerTransaction>(
|
|
21
|
-
`/ledger/transactions/${encodeURIComponent(txId)}`,
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
verify(request: LedgerVerifyRequest): Promise<LedgerVerifyResult> {
|
|
26
|
-
return this.http.postPublic<LedgerVerifyResult>("/ledger/verify", request);
|
|
27
|
-
}
|
|
28
|
-
}
|
package/src/api/marketplace.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { LedgerTransaction } from "../types/ledger.js";
|
|
3
|
-
import type {
|
|
4
|
-
IdentityBid,
|
|
5
|
-
IdentityFloor,
|
|
6
|
-
IdentityListing,
|
|
7
|
-
IdentityOffer,
|
|
8
|
-
IdentitySale,
|
|
9
|
-
MarketplaceCategory,
|
|
10
|
-
Product,
|
|
11
|
-
ProductCreateRequest,
|
|
12
|
-
ProductPurchase,
|
|
13
|
-
ProductQueryParams,
|
|
14
|
-
ProductReview,
|
|
15
|
-
} from "../types/index.js";
|
|
16
|
-
|
|
17
|
-
export class MarketplaceApi {
|
|
18
|
-
constructor(private readonly http: HttpClient) {}
|
|
19
|
-
|
|
20
|
-
// --- Products ---
|
|
21
|
-
|
|
22
|
-
listProducts(params?: ProductQueryParams): Promise<{ products: Array<Product> }> {
|
|
23
|
-
return this.http.get<{ products: Array<Product> }>(
|
|
24
|
-
"/marketplace/products",
|
|
25
|
-
params as Record<string, unknown>,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
createProduct(product: ProductCreateRequest): Promise<Product> {
|
|
30
|
-
return this.http.post<Product>("/marketplace/products", product);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getProduct(productId: string): Promise<Product> {
|
|
34
|
-
return this.http.get<Product>(`/marketplace/products/${encodeURIComponent(productId)}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
updateProduct(productId: string, update: Partial<Product>): Promise<Product> {
|
|
38
|
-
return this.http.put<Product>(
|
|
39
|
-
`/marketplace/products/${encodeURIComponent(productId)}`,
|
|
40
|
-
update,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
deleteProduct(productId: string): Promise<void> {
|
|
45
|
-
return this.http.delete<void>(`/marketplace/products/${encodeURIComponent(productId)}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
buyProduct(productId: string, payment: Record<string, string>): Promise<LedgerTransaction> {
|
|
49
|
-
return this.http.post<LedgerTransaction>(
|
|
50
|
-
`/marketplace/products/${encodeURIComponent(productId)}/buy`,
|
|
51
|
-
payment,
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
downloadProduct(productId: string, purchaseId: string): Promise<Response> {
|
|
56
|
-
return this.http.getAuth<Response>(
|
|
57
|
-
`/marketplace/products/${encodeURIComponent(productId)}/download/${encodeURIComponent(purchaseId)}`,
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
listProductReviews(productId: string): Promise<{ reviews: Array<ProductReview> }> {
|
|
62
|
-
return this.http.get<{ reviews: Array<ProductReview> }>(
|
|
63
|
-
`/marketplace/products/${encodeURIComponent(productId)}/reviews`,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
createProductReview(productId: string, review: Partial<ProductReview>): Promise<ProductReview> {
|
|
68
|
-
return this.http.post<ProductReview>(
|
|
69
|
-
`/marketplace/products/${encodeURIComponent(productId)}/reviews`,
|
|
70
|
-
review,
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// --- Identity Listings ---
|
|
75
|
-
|
|
76
|
-
listIdentities(params?: {
|
|
77
|
-
limit?: number;
|
|
78
|
-
status?: string;
|
|
79
|
-
}): Promise<{ listings: Array<IdentityListing> }> {
|
|
80
|
-
return this.http.get<{ listings: Array<IdentityListing> }>(
|
|
81
|
-
"/marketplace/identities",
|
|
82
|
-
params as Record<string, unknown>,
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
createIdentityListing(listing: Partial<IdentityListing>): Promise<IdentityListing> {
|
|
87
|
-
return this.http.post<IdentityListing>("/marketplace/identities", listing);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
deleteIdentityListing(listingId: string): Promise<void> {
|
|
91
|
-
return this.http.delete<void>(`/marketplace/identities/${encodeURIComponent(listingId)}`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
buyIdentityListing(
|
|
95
|
-
listingId: string,
|
|
96
|
-
payment: Record<string, string>,
|
|
97
|
-
): Promise<LedgerTransaction> {
|
|
98
|
-
return this.http.post<LedgerTransaction>(
|
|
99
|
-
`/marketplace/identities/${encodeURIComponent(listingId)}/buy`,
|
|
100
|
-
payment,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
listBids(listingId: string): Promise<{ bids: Array<IdentityBid> }> {
|
|
105
|
-
return this.http.get<{ bids: Array<IdentityBid> }>(
|
|
106
|
-
`/marketplace/identities/${encodeURIComponent(listingId)}/bids`,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
placeBid(listingId: string, bid: Partial<IdentityBid>): Promise<IdentityBid> {
|
|
111
|
-
return this.http.post<IdentityBid>(
|
|
112
|
-
`/marketplace/identities/${encodeURIComponent(listingId)}/bids`,
|
|
113
|
-
bid,
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
closeListing(listingId: string): Promise<IdentitySale> {
|
|
118
|
-
return this.http.post<IdentitySale>(
|
|
119
|
-
`/marketplace/identities/${encodeURIComponent(listingId)}/close`,
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
identitySaleHistory(name: string): Promise<{ sales: Array<IdentitySale> }> {
|
|
124
|
-
return this.http.get<{ sales: Array<IdentitySale> }>(
|
|
125
|
-
`/marketplace/identities/history/${encodeURIComponent(name)}`,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
identityFloor(length?: number): Promise<{ floorPrice: string; assetPerLength: Record<string, unknown> }> {
|
|
130
|
-
return this.http.get<{ floorPrice: string; assetPerLength: Record<string, unknown> }>(
|
|
131
|
-
"/marketplace/identities/floor",
|
|
132
|
-
length != null ? { length } : undefined,
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// --- Offers ---
|
|
137
|
-
|
|
138
|
-
createOffer(offer: Partial<IdentityOffer>): Promise<IdentityOffer> {
|
|
139
|
-
return this.http.post<IdentityOffer>("/marketplace/offers", offer);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
cancelOffer(offerId: string): Promise<void> {
|
|
143
|
-
return this.http.delete<void>(`/marketplace/offers/${encodeURIComponent(offerId)}`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
acceptOffer(offerId: string): Promise<IdentitySale> {
|
|
147
|
-
return this.http.post<IdentitySale>(
|
|
148
|
-
`/marketplace/offers/${encodeURIComponent(offerId)}/accept`,
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// --- Browsing ---
|
|
153
|
-
|
|
154
|
-
categories(): Promise<{ categories: Array<MarketplaceCategory> }> {
|
|
155
|
-
return this.http.get<{ categories: Array<MarketplaceCategory> }>("/marketplace/categories");
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
featured(): Promise<{ featured: Array<unknown> }> {
|
|
159
|
-
return this.http.get<{ featured: Array<unknown> }>("/marketplace/featured");
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
recent(): Promise<{ recent: Array<IdentitySale> }> {
|
|
163
|
-
return this.http.get<{ recent: Array<IdentitySale> }>("/marketplace/recent");
|
|
164
|
-
}
|
|
165
|
-
}
|
package/src/api/messages.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { MessageEnvelope } from "../types/index.js";
|
|
3
|
-
|
|
4
|
-
export class MessagesApi {
|
|
5
|
-
constructor(private readonly http: HttpClient) {}
|
|
6
|
-
|
|
7
|
-
list(agentId: string, limit?: number): Promise<{ messages: Array<MessageEnvelope> }> {
|
|
8
|
-
return this.http.getDirectoryAuth<{ messages: Array<MessageEnvelope> }>("/messages", {
|
|
9
|
-
agentId,
|
|
10
|
-
limit,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
send(envelope: MessageEnvelope): Promise<MessageEnvelope> {
|
|
15
|
-
return this.http.putDirectoryAuth<MessageEnvelope>("/messages", envelope);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
acknowledge(messageId: string, agentId: string): Promise<void> {
|
|
19
|
-
return this.http.deleteDirectoryAuth<void>(
|
|
20
|
-
`/messages/${encodeURIComponent(messageId)}?agentId=${encodeURIComponent(agentId)}`,
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}
|
package/src/api/moderation.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
Constitution,
|
|
4
|
-
ModerationAction,
|
|
5
|
-
ModerationAppeal,
|
|
6
|
-
ModerationReport,
|
|
7
|
-
ModerationReportCreate,
|
|
8
|
-
} from "../types/index.js";
|
|
9
|
-
|
|
10
|
-
export class ModerationApi {
|
|
11
|
-
constructor(private readonly http: HttpClient) {}
|
|
12
|
-
|
|
13
|
-
getConstitution(): Promise<Constitution> {
|
|
14
|
-
return this.http.get<Constitution>("/constitution");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
createReport(report: ModerationReportCreate): Promise<ModerationReport> {
|
|
18
|
-
return this.http.postDirectoryAuth<ModerationReport>("/moderation/reports", report);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getReport(reportId: string): Promise<ModerationReport> {
|
|
22
|
-
return this.http.getAuth<ModerationReport>(
|
|
23
|
-
`/moderation/reports/${encodeURIComponent(reportId)}`,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
updateReportStatus(
|
|
28
|
-
reportId: string,
|
|
29
|
-
update: { status: string; note?: string },
|
|
30
|
-
): Promise<ModerationReport> {
|
|
31
|
-
return this.http.putDirectoryAuth<ModerationReport>(
|
|
32
|
-
`/moderation/reports/${encodeURIComponent(reportId)}/status`,
|
|
33
|
-
update,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
listActions(params?: {
|
|
38
|
-
target?: string;
|
|
39
|
-
type?: string;
|
|
40
|
-
limit?: number;
|
|
41
|
-
}): Promise<{ actions: Array<ModerationAction> }> {
|
|
42
|
-
return this.http.get<{ actions: Array<ModerationAction> }>(
|
|
43
|
-
"/moderation/actions",
|
|
44
|
-
params as Record<string, unknown>,
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
createAction(action: Partial<ModerationAction>): Promise<ModerationAction> {
|
|
49
|
-
return this.http.postDirectoryAuth<ModerationAction>("/moderation/actions", action);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
createAppeal(appeal: { actionId: string; comment?: string }): Promise<ModerationAppeal> {
|
|
53
|
-
return this.http.postDirectoryAuth<ModerationAppeal>("/moderation/appeals", appeal);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getAppeal(appealId: string): Promise<ModerationAppeal> {
|
|
57
|
-
return this.http.getAuth<ModerationAppeal>(
|
|
58
|
-
`/moderation/appeals/${encodeURIComponent(appealId)}`,
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
updateAppealStatus(
|
|
63
|
-
appealId: string,
|
|
64
|
-
update: { status: string; note?: string },
|
|
65
|
-
): Promise<ModerationAppeal> {
|
|
66
|
-
return this.http.putDirectoryAuth<ModerationAppeal>(
|
|
67
|
-
`/moderation/appeals/${encodeURIComponent(appealId)}/status`,
|
|
68
|
-
update,
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
package/src/api/payments.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
3
|
-
Subscription,
|
|
4
|
-
SupportedChain,
|
|
5
|
-
X402SettleRequest,
|
|
6
|
-
X402SettleResponse,
|
|
7
|
-
X402VerifyRequest,
|
|
8
|
-
X402VerifyResponse,
|
|
9
|
-
} from "../types/index.js";
|
|
10
|
-
|
|
11
|
-
export class PaymentsApi {
|
|
12
|
-
constructor(private readonly http: HttpClient) {}
|
|
13
|
-
|
|
14
|
-
verify(request: X402VerifyRequest): Promise<X402VerifyResponse> {
|
|
15
|
-
return this.http.post<X402VerifyResponse>("/payments/verify", request);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
settle(request: X402SettleRequest): Promise<X402SettleResponse> {
|
|
19
|
-
return this.http.post<X402SettleResponse>("/payments/settle", request);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
supported(): Promise<{ chains: Array<SupportedChain> }> {
|
|
23
|
-
return this.http.get<{ chains: Array<SupportedChain> }>("/payments/supported");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
createSubscription(subscription: Partial<Subscription>): Promise<Subscription> {
|
|
27
|
-
return this.http.post<Subscription>("/payments/subscriptions", subscription);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getSubscription(subscriptionId: string): Promise<Subscription> {
|
|
31
|
-
return this.http.getAuth<Subscription>(
|
|
32
|
-
`/payments/subscriptions/${encodeURIComponent(subscriptionId)}`,
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
cancelSubscription(subscriptionId: string): Promise<void> {
|
|
37
|
-
return this.http.delete<void>(
|
|
38
|
-
`/payments/subscriptions/${encodeURIComponent(subscriptionId)}`,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
renewSubscription(subscriptionId: string): Promise<Subscription> {
|
|
43
|
-
return this.http.post<Subscription>(
|
|
44
|
-
`/payments/subscriptions/${encodeURIComponent(subscriptionId)}/renew`,
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|