@voltro/plugin-social 0.0.0-stage → 0.88.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/CHANGELOG.md +24492 -0
- package/LICENSE +61 -0
- package/README.md +151 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +8333 -0
- package/dist/components.js +201 -0
- package/dist/contract.js +39 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +15 -0
- package/dist/eventProducer.d.ts +8 -0
- package/dist/eventProducer.js +19 -0
- package/dist/events.d.ts +22 -0
- package/dist/events.js +15 -0
- package/dist/index.d.ts +235 -0
- package/dist/index.js +134 -0
- package/dist/inspect.js +27 -0
- package/dist/port.d.ts +35 -0
- package/dist/port.js +4 -0
- package/dist/recent.entity.js +17 -0
- package/dist/relations.entity.js +29 -0
- package/dist/rpc.d.ts +150 -0
- package/dist/rpc.js +154 -0
- package/dist/rpcRoutes.js +69 -0
- package/dist/service.js +353 -0
- package/dist/settings.entity.js +19 -0
- package/dist/social-app/events/social.accepted.event.ts +1 -0
- package/dist/social-app/events/social.requested.event.ts +1 -0
- package/dist/social-app/subscribers/social.relations.subscribe.ts +4 -0
- package/dist/strategies.d.ts +85 -0
- package/dist/strategies.js +39 -0
- package/dist/testing.d.ts +122 -0
- package/dist/testing.js +85 -0
- package/dist/web.d.ts +162 -0
- package/dist/web.js +7 -0
- package/package.json +90 -4
package/dist/testing.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { socialError as e } from "./errors.js";
|
|
2
|
+
import { SocialBlockPort as t } from "./port.js";
|
|
3
|
+
import { distinctRecentPeers as n, mutualMatchSuggestions as r, recipientRequestPolicy as i, resolveSocialOptions as a } from "./strategies.js";
|
|
4
|
+
import { Effect as o, Layer as s, Result as c } from "effect";
|
|
5
|
+
// src/testing.ts
|
|
6
|
+
var l = (t = {}) => ({
|
|
7
|
+
isBlocked: () => o.fail(e("unavailable")),
|
|
8
|
+
blockPairs: () => o.fail(e("unavailable")),
|
|
9
|
+
canMessage: () => o.fail(e("unavailable")),
|
|
10
|
+
canInvite: () => o.fail(e("unavailable")),
|
|
11
|
+
recordRecent: () => o.fail(e("unavailable")),
|
|
12
|
+
...t
|
|
13
|
+
}), u = (e = {}) => s.sync(t, () => l(e)), d = u(), f = {
|
|
14
|
+
kind: "port",
|
|
15
|
+
tag: t,
|
|
16
|
+
fakeLayer: d,
|
|
17
|
+
probe: {
|
|
18
|
+
run: () => o.scoped(t.pipe(o.flatMap((e) => e.isBlocked({
|
|
19
|
+
type: "user",
|
|
20
|
+
id: "one",
|
|
21
|
+
tenantId: "tenant"
|
|
22
|
+
}, "two")), o.result, o.map((e) => c.isFailure(e) ? e.failure.code : e.success), o.provide(d))),
|
|
23
|
+
expected: "unavailable"
|
|
24
|
+
}
|
|
25
|
+
}, p = {
|
|
26
|
+
ownerId: "one",
|
|
27
|
+
requestsFrom: "nobody",
|
|
28
|
+
showOnline: !1,
|
|
29
|
+
showActivity: !1,
|
|
30
|
+
allowPartyInvites: "friends",
|
|
31
|
+
metadata: {}
|
|
32
|
+
}, m = [{
|
|
33
|
+
subjectId: "one",
|
|
34
|
+
mutualFriends: 2,
|
|
35
|
+
recentMatches: 0
|
|
36
|
+
}, {
|
|
37
|
+
subjectId: "two",
|
|
38
|
+
mutualFriends: 1,
|
|
39
|
+
recentMatches: 1
|
|
40
|
+
}], h = {
|
|
41
|
+
kind: "slot",
|
|
42
|
+
defaultImplementation: r,
|
|
43
|
+
defaultProbe: {
|
|
44
|
+
run: () => o.sync(() => r(m, 1).map((e) => e.subjectId)),
|
|
45
|
+
expected: ["two"]
|
|
46
|
+
},
|
|
47
|
+
overrideProbe: {
|
|
48
|
+
run: () => o.sync(() => a({ strategies: { suggestions: (e, t) => [...e].sort((e, t) => t.mutualFriends - e.mutualFriends).slice(0, t) } }).strategies.suggestions(m, 1).map((e) => e.subjectId)),
|
|
49
|
+
expected: ["one"]
|
|
50
|
+
}
|
|
51
|
+
}, g = {
|
|
52
|
+
kind: "slot",
|
|
53
|
+
defaultImplementation: i,
|
|
54
|
+
defaultProbe: {
|
|
55
|
+
run: () => o.sync(() => i({
|
|
56
|
+
settings: p,
|
|
57
|
+
mutualFriends: 0
|
|
58
|
+
})),
|
|
59
|
+
expected: !1
|
|
60
|
+
},
|
|
61
|
+
overrideProbe: {
|
|
62
|
+
run: () => o.sync(() => a({ strategies: { requestPolicy: () => !0 } }).strategies.requestPolicy({
|
|
63
|
+
settings: p,
|
|
64
|
+
mutualFriends: 0
|
|
65
|
+
})),
|
|
66
|
+
expected: !0
|
|
67
|
+
}
|
|
68
|
+
}, _ = {
|
|
69
|
+
ownerId: "one",
|
|
70
|
+
otherId: "two",
|
|
71
|
+
context: "match",
|
|
72
|
+
at: 1
|
|
73
|
+
}, v = {
|
|
74
|
+
kind: "slot",
|
|
75
|
+
defaultImplementation: n,
|
|
76
|
+
defaultProbe: {
|
|
77
|
+
run: () => o.sync(() => n(_)),
|
|
78
|
+
expected: !0
|
|
79
|
+
},
|
|
80
|
+
overrideProbe: {
|
|
81
|
+
run: () => o.sync(() => a({ strategies: { recentPolicy: () => !1 } }).strategies.recentPolicy(_)),
|
|
82
|
+
expected: !1
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export { u as fakeSocialBlockLayer, l as fakeSocialBlockService, d as socialBlockFakeLayer, f as socialBlockPortFixture, v as socialRecentPolicyFixture, g as socialRequestPolicyFixture, h as socialSuggestionsFixture };
|
package/dist/web.d.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SubscriptionState } from '@voltro/client';
|
|
3
|
+
|
|
4
|
+
/** Parent owns request state across closing/reopening. The component never replays an uncertain mutation. */
|
|
5
|
+
export declare const AddFriendDialog: ({ open, onOpenChange, query, onQueryChange, found, scopeKey, pending, error, labels, onFind, onRequest }: {
|
|
6
|
+
readonly open: boolean;
|
|
7
|
+
readonly onOpenChange: (open: boolean) => void;
|
|
8
|
+
readonly query: string;
|
|
9
|
+
readonly onQueryChange: (query: string) => void;
|
|
10
|
+
readonly found: FoundFriend | null | undefined;
|
|
11
|
+
readonly scopeKey: string;
|
|
12
|
+
readonly pending?: boolean;
|
|
13
|
+
readonly error?: unknown;
|
|
14
|
+
readonly labels?: AddFriendLabels;
|
|
15
|
+
readonly onFind: (query: string) => void;
|
|
16
|
+
readonly onRequest: (subjectId: string) => void;
|
|
17
|
+
}) => ReactNode;
|
|
18
|
+
|
|
19
|
+
export declare interface AddFriendLabels {
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly find: string;
|
|
24
|
+
readonly request: string;
|
|
25
|
+
readonly close: string;
|
|
26
|
+
readonly notFound: string;
|
|
27
|
+
readonly failed: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare const addFriendLabels: Readonly<Record<'en' | 'de', AddFriendLabels>>;
|
|
31
|
+
|
|
32
|
+
export declare interface FoundFriend extends Pick<FriendView, 'subjectId' | 'displayName' | 'tag'> {
|
|
33
|
+
readonly query: string;
|
|
34
|
+
readonly scopeKey: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export declare interface FriendActions {
|
|
38
|
+
readonly onInvite?: (subjectId: string) => void;
|
|
39
|
+
readonly onMessage?: (subjectId: string) => void;
|
|
40
|
+
readonly onProfile?: (subjectId: string) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Names/status must be server projections supplied by Players/Presence, never client-written roster metadata. */
|
|
44
|
+
export declare const FriendRow: ({ friend, labels, pending, onInvite, onMessage, onProfile }: {
|
|
45
|
+
readonly friend: FriendView;
|
|
46
|
+
readonly labels?: FriendsLabels;
|
|
47
|
+
readonly pending?: boolean;
|
|
48
|
+
} & FriendActions) => ReactNode;
|
|
49
|
+
|
|
50
|
+
export declare interface FriendsLabels {
|
|
51
|
+
readonly title: string;
|
|
52
|
+
readonly empty: string;
|
|
53
|
+
readonly loading: string;
|
|
54
|
+
readonly error: string;
|
|
55
|
+
readonly online: string;
|
|
56
|
+
readonly offline: string;
|
|
57
|
+
readonly unknown: string;
|
|
58
|
+
readonly invite: string;
|
|
59
|
+
readonly message: string;
|
|
60
|
+
readonly profile: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare const friendsLabels: Readonly<Record<'en' | 'de', FriendsLabels>>;
|
|
64
|
+
|
|
65
|
+
export declare const FriendsPanel: ({ friends, loading, error, pending, labels, ...actions }: FriendsPanelProps) => ReactNode;
|
|
66
|
+
|
|
67
|
+
export declare interface FriendsPanelProps extends FriendActions {
|
|
68
|
+
readonly friends: ReadonlyArray<FriendView>;
|
|
69
|
+
readonly loading?: boolean;
|
|
70
|
+
readonly error?: unknown;
|
|
71
|
+
readonly pending?: boolean;
|
|
72
|
+
readonly labels?: FriendsLabels;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare interface FriendView {
|
|
76
|
+
readonly subjectId: string;
|
|
77
|
+
readonly displayName: string;
|
|
78
|
+
readonly tag: string;
|
|
79
|
+
readonly online: boolean | null;
|
|
80
|
+
readonly activity: string | null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare const useBlockList: (apiName?: string) => SubscriptionState<readonly {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly fromId: string;
|
|
86
|
+
readonly toId: string;
|
|
87
|
+
readonly kind: "request" | "friend" | "block" | "favorite";
|
|
88
|
+
readonly createdAt: number;
|
|
89
|
+
readonly respondedAt: number | null;
|
|
90
|
+
readonly note: string | null;
|
|
91
|
+
readonly metadata: {
|
|
92
|
+
readonly [x: string]: unknown;
|
|
93
|
+
};
|
|
94
|
+
}[]>;
|
|
95
|
+
|
|
96
|
+
export declare const useFavoriteFriends: (apiName?: string) => SubscriptionState<readonly {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly fromId: string;
|
|
99
|
+
readonly toId: string;
|
|
100
|
+
readonly kind: "request" | "friend" | "block" | "favorite";
|
|
101
|
+
readonly createdAt: number;
|
|
102
|
+
readonly respondedAt: number | null;
|
|
103
|
+
readonly note: string | null;
|
|
104
|
+
readonly metadata: {
|
|
105
|
+
readonly [x: string]: unknown;
|
|
106
|
+
};
|
|
107
|
+
}[]>;
|
|
108
|
+
|
|
109
|
+
export declare const useFriendRequests: (apiName?: string) => SubscriptionState<readonly {
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly fromId: string;
|
|
112
|
+
readonly toId: string;
|
|
113
|
+
readonly kind: "request" | "friend" | "block" | "favorite";
|
|
114
|
+
readonly createdAt: number;
|
|
115
|
+
readonly respondedAt: number | null;
|
|
116
|
+
readonly note: string | null;
|
|
117
|
+
readonly metadata: {
|
|
118
|
+
readonly [x: string]: unknown;
|
|
119
|
+
};
|
|
120
|
+
}[]>;
|
|
121
|
+
|
|
122
|
+
export declare const useFriends: (apiName?: string) => SubscriptionState<readonly {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly fromId: string;
|
|
125
|
+
readonly toId: string;
|
|
126
|
+
readonly kind: "request" | "friend" | "block" | "favorite";
|
|
127
|
+
readonly createdAt: number;
|
|
128
|
+
readonly respondedAt: number | null;
|
|
129
|
+
readonly note: string | null;
|
|
130
|
+
readonly metadata: {
|
|
131
|
+
readonly [x: string]: unknown;
|
|
132
|
+
};
|
|
133
|
+
}[]>;
|
|
134
|
+
|
|
135
|
+
export declare const useRecentPlayers: (apiName?: string) => SubscriptionState<readonly {
|
|
136
|
+
readonly id: string;
|
|
137
|
+
readonly otherId: string;
|
|
138
|
+
readonly context: string;
|
|
139
|
+
readonly at: number;
|
|
140
|
+
readonly metadata: {
|
|
141
|
+
readonly [x: string]: unknown;
|
|
142
|
+
};
|
|
143
|
+
}[]>;
|
|
144
|
+
|
|
145
|
+
export declare const useSocialSettings: (apiName?: string) => SubscriptionState<{
|
|
146
|
+
readonly ownerId: string;
|
|
147
|
+
readonly requestsFrom: "anyone" | "friends-of-friends" | "nobody";
|
|
148
|
+
readonly showOnline: boolean;
|
|
149
|
+
readonly showActivity: boolean;
|
|
150
|
+
readonly allowPartyInvites: "anyone" | "friends";
|
|
151
|
+
readonly metadata: {
|
|
152
|
+
readonly [x: string]: unknown;
|
|
153
|
+
};
|
|
154
|
+
}>;
|
|
155
|
+
|
|
156
|
+
export declare const useSocialSuggestions: (apiName?: string) => SubscriptionState<readonly {
|
|
157
|
+
readonly subjectId: string;
|
|
158
|
+
readonly mutualFriends: number;
|
|
159
|
+
readonly recentMatches: number;
|
|
160
|
+
}[]>;
|
|
161
|
+
|
|
162
|
+
export { }
|
package/dist/web.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BASE_NAME as e } from "./rpc.js";
|
|
2
|
+
import { AddFriendDialog as t, FriendRow as n, FriendsPanel as r, addFriendLabels as i, friendsLabels as a } from "./components.js";
|
|
3
|
+
import { pluginTag as o } from "@voltro/protocol";
|
|
4
|
+
import { useSubscription as s } from "@voltro/client";
|
|
5
|
+
// src/web.ts
|
|
6
|
+
var c = (t = "app") => s(t, o(e, "friends"), {}), l = (t = "app") => s(t, o(e, "favorites"), {}), u = (t = "app") => s(t, o(e, "requests"), {}), d = (t = "app") => s(t, o(e, "blocked"), {}), f = (t = "app") => s(t, o(e, "recent"), {}), p = (t = "app") => s(t, o(e, "suggestions"), {}), m = (t = "app") => s(t, o(e, "settings"), {});
|
|
7
|
+
export { t as AddFriendDialog, n as FriendRow, r as FriendsPanel, i as addFriendLabels, a as friendsLabels, d as useBlockList, l as useFavoriteFriends, u as useFriendRequests, c as useFriends, f as useRecentPlayers, m as useSocialSettings, p as useSocialSuggestions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,92 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-social",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.88.0",
|
|
4
|
+
"description": "SQL-owned social graph with symmetric block admission and configurable policies",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"voltro",
|
|
7
|
+
"typescript",
|
|
8
|
+
"framework"
|
|
9
|
+
],
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
11
|
+
"homepage": "https://voltro.dev",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"email": "support@voltro.dev"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Voltro UG",
|
|
17
|
+
"url": "https://voltro.dev"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
"./errors": {
|
|
28
|
+
"types": "./dist/errors.d.ts",
|
|
29
|
+
"import": "./dist/errors.js",
|
|
30
|
+
"default": "./dist/errors.js"
|
|
31
|
+
},
|
|
32
|
+
"./rpc": {
|
|
33
|
+
"types": "./dist/rpc.d.ts",
|
|
34
|
+
"import": "./dist/rpc.js",
|
|
35
|
+
"default": "./dist/rpc.js"
|
|
36
|
+
},
|
|
37
|
+
"./port": {
|
|
38
|
+
"types": "./dist/port.d.ts",
|
|
39
|
+
"import": "./dist/port.js",
|
|
40
|
+
"default": "./dist/port.js"
|
|
41
|
+
},
|
|
42
|
+
"./strategies": {
|
|
43
|
+
"types": "./dist/strategies.d.ts",
|
|
44
|
+
"import": "./dist/strategies.js",
|
|
45
|
+
"default": "./dist/strategies.js"
|
|
46
|
+
},
|
|
47
|
+
"./testing": {
|
|
48
|
+
"types": "./dist/testing.d.ts",
|
|
49
|
+
"import": "./dist/testing.js",
|
|
50
|
+
"default": "./dist/testing.js"
|
|
51
|
+
},
|
|
52
|
+
"./web": {
|
|
53
|
+
"types": "./dist/web.d.ts",
|
|
54
|
+
"import": "./dist/web.js",
|
|
55
|
+
"default": "./dist/web.js"
|
|
56
|
+
},
|
|
57
|
+
"./events": {
|
|
58
|
+
"types": "./dist/events.d.ts",
|
|
59
|
+
"import": "./dist/events.js",
|
|
60
|
+
"default": "./dist/events.js"
|
|
61
|
+
},
|
|
62
|
+
"./events/server": {
|
|
63
|
+
"types": "./dist/eventProducer.d.ts",
|
|
64
|
+
"import": "./dist/eventProducer.js",
|
|
65
|
+
"default": "./dist/eventProducer.js"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"main": "./dist/index.js",
|
|
69
|
+
"module": "./dist/index.js",
|
|
70
|
+
"types": "./dist/index.d.ts",
|
|
71
|
+
"sideEffects": false,
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=24.0.0"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@voltro/protocol": "0.88.0",
|
|
77
|
+
"@voltro/database": "0.88.0",
|
|
78
|
+
"@voltro/client": "0.88.0",
|
|
79
|
+
"@voltro/runtime": "0.88.0",
|
|
80
|
+
"@voltro/plugin-ratelimit": "0.88.0",
|
|
81
|
+
"@voltro/kv": "0.88.0",
|
|
82
|
+
"@voltro/ui-shadcn": "0.88.0",
|
|
83
|
+
"@voltro/plugin-licensing": "0.88.0"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"effect": "4.1.0",
|
|
87
|
+
"react": "^19.0.0"
|
|
88
|
+
},
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"access": "public"
|
|
91
|
+
}
|
|
92
|
+
}
|