@tinyhumansai/tinyplace 0.1.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/dist/api/a2a.d.ts +28 -0
- package/dist/api/a2a.js +21 -0
- package/dist/api/admin.d.ts +38 -0
- package/dist/api/admin.js +49 -0
- package/dist/api/broadcasts.d.ts +32 -0
- package/dist/api/broadcasts.js +51 -0
- package/dist/api/channels.d.ts +43 -0
- package/dist/api/channels.js +57 -0
- package/dist/api/directory.d.ts +15 -0
- package/dist/api/directory.js +26 -0
- package/dist/api/escrow.d.ts +47 -0
- package/dist/api/escrow.js +76 -0
- package/dist/api/events.d.ts +45 -0
- package/dist/api/events.js +77 -0
- package/dist/api/explorer.d.ts +19 -0
- package/dist/api/explorer.js +21 -0
- package/dist/api/groups.d.ts +19 -0
- package/dist/api/groups.js +32 -0
- package/dist/api/inbox.d.ts +27 -0
- package/dist/api/inbox.js +48 -0
- package/dist/api/keys.d.ts +9 -0
- package/dist/api/keys.js +14 -0
- package/dist/api/ledger.d.ts +11 -0
- package/dist/api/ledger.js +14 -0
- package/dist/api/marketplace.d.ts +53 -0
- package/dist/api/marketplace.js +81 -0
- package/dist/api/messages.d.ts +11 -0
- package/dist/api/messages.js +17 -0
- package/dist/api/moderation.d.ts +30 -0
- package/dist/api/moderation.js +32 -0
- package/dist/api/payments.d.ts +15 -0
- package/dist/api/payments.js +26 -0
- package/dist/api/pricing.d.ts +69 -0
- package/dist/api/pricing.js +60 -0
- package/dist/api/profiles.d.ts +18 -0
- package/dist/api/profiles.js +23 -0
- package/dist/api/registry.d.ts +26 -0
- package/dist/api/registry.js +87 -0
- package/dist/api/reputation.d.ts +24 -0
- package/dist/api/reputation.js +29 -0
- package/dist/api/search.d.ts +46 -0
- package/dist/api/search.js +41 -0
- package/dist/api/stats.d.ts +11 -0
- package/dist/api/stats.js +20 -0
- package/dist/auth.d.ts +16 -0
- package/dist/auth.js +36 -0
- package/dist/client.d.ts +63 -0
- package/dist/client.js +73 -0
- package/dist/crypto.d.ts +12 -0
- package/dist/crypto.js +49 -0
- package/dist/http.d.ts +30 -0
- package/dist/http.js +101 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +32 -0
- package/dist/local-signer.d.ts +15 -0
- package/dist/local-signer.js +51 -0
- package/dist/signal/crypto.d.ts +29 -0
- package/dist/signal/crypto.js +156 -0
- package/dist/signal/index.d.ts +11 -0
- package/dist/signal/index.js +6 -0
- package/dist/signal/keys.d.ts +14 -0
- package/dist/signal/keys.js +36 -0
- package/dist/signal/memory-store.d.ts +21 -0
- package/dist/signal/memory-store.js +50 -0
- package/dist/signal/ratchet.d.ts +12 -0
- package/dist/signal/ratchet.js +106 -0
- package/dist/signal/session.d.ts +17 -0
- package/dist/signal/session.js +117 -0
- package/dist/signal/store.d.ts +36 -0
- package/dist/signal/store.js +6 -0
- package/dist/signal/x3dh.d.ts +18 -0
- package/dist/signal/x3dh.js +86 -0
- package/dist/signer.d.ts +13 -0
- package/dist/signer.js +9 -0
- package/dist/types/broadcasts.d.ts +74 -0
- package/dist/types/broadcasts.js +1 -0
- package/dist/types/commerce.d.ts +183 -0
- package/dist/types/commerce.js +1 -0
- package/dist/types/directory.d.ts +88 -0
- package/dist/types/directory.js +1 -0
- package/dist/types/escrow.d.ts +129 -0
- package/dist/types/escrow.js +1 -0
- package/dist/types/events.d.ts +137 -0
- package/dist/types/events.js +1 -0
- package/dist/types/explorer.d.ts +133 -0
- package/dist/types/explorer.js +1 -0
- package/dist/types/groups.d.ts +56 -0
- package/dist/types/groups.js +1 -0
- package/dist/types/identity.d.ts +94 -0
- package/dist/types/identity.js +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.js +16 -0
- package/dist/types/ledger.d.ts +57 -0
- package/dist/types/ledger.js +1 -0
- package/dist/types/marketplace.d.ts +141 -0
- package/dist/types/marketplace.js +1 -0
- package/dist/types/messaging.d.ts +67 -0
- package/dist/types/messaging.js +1 -0
- package/dist/types/payments.d.ts +88 -0
- package/dist/types/payments.js +1 -0
- package/dist/types/profile.d.ts +49 -0
- package/dist/types/profile.js +1 -0
- package/dist/types/reputation.d.ts +90 -0
- package/dist/types/reputation.js +1 -0
- package/dist/types/search.d.ts +56 -0
- package/dist/types/search.js +1 -0
- package/dist/types/social.d.ts +158 -0
- package/dist/types/social.js +1 -0
- package/dist/websocket.d.ts +26 -0
- package/dist/websocket.js +83 -0
- package/package.json +30 -0
- package/src/api/a2a.ts +50 -0
- package/src/api/admin.ts +95 -0
- package/src/api/broadcasts.ts +110 -0
- package/src/api/channels.ts +110 -0
- package/src/api/directory.ts +45 -0
- package/src/api/escrow.ts +163 -0
- package/src/api/events.ts +133 -0
- package/src/api/explorer.ts +48 -0
- package/src/api/groups.ts +64 -0
- package/src/api/inbox.ts +71 -0
- package/src/api/keys.ts +18 -0
- package/src/api/ledger.ts +28 -0
- package/src/api/marketplace.ts +165 -0
- package/src/api/messages.ts +23 -0
- package/src/api/moderation.ts +71 -0
- package/src/api/payments.ts +47 -0
- package/src/api/pricing.ts +122 -0
- package/src/api/profiles.ts +43 -0
- package/src/api/registry.ts +143 -0
- package/src/api/reputation.ts +60 -0
- package/src/api/search.ts +59 -0
- package/src/api/stats.ts +32 -0
- package/src/auth.ts +75 -0
- package/src/client.ts +120 -0
- package/src/crypto.ts +74 -0
- package/src/http.ts +147 -0
- package/src/index.ts +72 -0
- package/src/local-signer.ts +78 -0
- package/src/signal/crypto.ts +229 -0
- package/src/signal/index.ts +28 -0
- package/src/signal/keys.ts +54 -0
- package/src/signal/memory-store.ts +66 -0
- package/src/signal/ratchet.ts +162 -0
- package/src/signal/session.ts +189 -0
- package/src/signal/store.ts +49 -0
- package/src/signal/x3dh.ts +130 -0
- package/src/signer.ts +21 -0
- package/src/types/broadcasts.ts +81 -0
- package/src/types/commerce.ts +206 -0
- package/src/types/directory.ts +98 -0
- package/src/types/escrow.ts +163 -0
- package/src/types/events.ts +155 -0
- package/src/types/explorer.ts +152 -0
- package/src/types/groups.ts +62 -0
- package/src/types/identity.ts +113 -0
- package/src/types/index.ts +16 -0
- package/src/types/ledger.ts +78 -0
- package/src/types/marketplace.ts +166 -0
- package/src/types/messaging.ts +77 -0
- package/src/types/payments.ts +103 -0
- package/src/types/profile.ts +55 -0
- package/src/types/reputation.ts +98 -0
- package/src/types/search.ts +61 -0
- package/src/types/social.ts +186 -0
- package/src/websocket.ts +112 -0
- package/tests/signal.test.ts +353 -0
- package/tests/staging.test.ts +650 -0
- package/tsconfig.json +15 -0
- package/vitest.config.ts +7 -0
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
}
|