@oxyhq/contracts 0.1.1 → 0.2.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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/fedcmToken.js +49 -0
- package/dist/cjs/index.js +16 -1
- package/dist/cjs/recommendations.js +125 -0
- package/dist/cjs/userResponse.js +0 -11
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/fedcmToken.js +46 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/recommendations.js +122 -0
- package/dist/esm/userResponse.js +0 -11
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/fedcmToken.d.ts +59 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/recommendations.d.ts +445 -0
- package/dist/types/userResponse.d.ts +50 -435
- package/package.json +2 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical contract for the FedCM ID-token JWT payload.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the decoded claims of the HS256 ID token the auth
|
|
5
|
+
* IdP (`auth.oxy.so`) signs and `POST /fedcm/exchange` consumes. The API decodes
|
|
6
|
+
* the JWT, verifies its signature, then validates the resulting claim object
|
|
7
|
+
* against this schema before trusting any field — a malformed payload (e.g. a
|
|
8
|
+
* forged token whose signature happened to match but whose body is the wrong
|
|
9
|
+
* shape) is rejected at the boundary instead of being cast and used.
|
|
10
|
+
*
|
|
11
|
+
* Validation philosophy — match the existing exchange behaviour exactly:
|
|
12
|
+
* - This schema validates the STRUCTURAL shape of the decoded claims only
|
|
13
|
+
* (types of the fields, not their presence or business-rule validity).
|
|
14
|
+
* - `sub` / `aud` / `nonce` / `iss` / `exp` presence + value checks remain in
|
|
15
|
+
* `fedcm.service.exchangeIdToken`, which returns the specific
|
|
16
|
+
* `missing_required_fields` / `invalid_issuer` / `token_expired` errors. So
|
|
17
|
+
* every field is `.optional()` here: a token missing `nonce` must still reach
|
|
18
|
+
* the `missing_required_fields` branch, not be rejected as a malformed token.
|
|
19
|
+
* - `.passthrough()` preserves any additional claims the IdP may add without a
|
|
20
|
+
* coordinated contract bump.
|
|
21
|
+
*
|
|
22
|
+
* Faithful to the producer:
|
|
23
|
+
* - `packages/auth/server/index.ts` `mintSessionForClient` — builds the
|
|
24
|
+
* assertion with `iss` (central issuer), `sub` (user id), `aud` (RP origin),
|
|
25
|
+
* `exp` / `iat` (numeric epoch seconds), and `nonce` (the server-minted,
|
|
26
|
+
* origin-bound nonce).
|
|
27
|
+
*
|
|
28
|
+
* Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
|
|
29
|
+
* `require()`).
|
|
30
|
+
*/
|
|
31
|
+
import { z } from 'zod';
|
|
32
|
+
/**
|
|
33
|
+
* Decoded FedCM ID-token claims. Every field is optional because presence is
|
|
34
|
+
* enforced downstream (see module doc); the schema's job is to guarantee that
|
|
35
|
+
* any present claim has the correct primitive type before it is read.
|
|
36
|
+
*/
|
|
37
|
+
export declare const fedcmTokenPayloadSchema: z.ZodObject<{
|
|
38
|
+
iss: z.ZodOptional<z.ZodString>;
|
|
39
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
40
|
+
aud: z.ZodOptional<z.ZodString>;
|
|
41
|
+
exp: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
iat: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
45
|
+
iss: z.ZodOptional<z.ZodString>;
|
|
46
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
47
|
+
aud: z.ZodOptional<z.ZodString>;
|
|
48
|
+
exp: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
iat: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
52
|
+
iss: z.ZodOptional<z.ZodString>;
|
|
53
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
54
|
+
aud: z.ZodOptional<z.ZodString>;
|
|
55
|
+
exp: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
iat: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
59
|
+
export type FedcmTokenPayload = z.infer<typeof fedcmTokenPayloadSchema>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,3 +13,7 @@ export { userNameSchema, userResponseSchema, userProfileUpdateSchema, refreshAll
|
|
|
13
13
|
export type { UserNameResponse, UserResponse, UserProfileUpdate, RefreshAllAccountResponse, RefreshAllResponseContract, CurrentUserResponseContract, DeviceSessionAccountResponse, DeviceSessionsResponseContract, } from './userResponse';
|
|
14
14
|
export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, } from './sessionStatus';
|
|
15
15
|
export type { ApplicationTypeContract, PublicApplicationResponse, SessionStatusResponse, } from './sessionStatus';
|
|
16
|
+
export { fedcmTokenPayloadSchema, } from './fedcmToken';
|
|
17
|
+
export type { FedcmTokenPayload, } from './fedcmToken';
|
|
18
|
+
export { recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, } from './recommendations';
|
|
19
|
+
export type { RecommendationExcludeType, RecommendationBoost, RecommendationSignalWeights, RecommendationRequest, RecommendationCount, RecommendationItem, RecommendationResponse, AppEndorsementInput, AppInterestInput, AppUserSignalIngest, } from './recommendations';
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommendation-engine API contracts.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the wire shape of the reputation-weighted
|
|
5
|
+
* profile-recommendation surface (`POST /profiles/recommendations`) and the
|
|
6
|
+
* cross-app signal-ingest endpoint (`POST /app-signals/ingest`). The API
|
|
7
|
+
* validates its INPUT/OUTPUT against these schemas; consumer SDKs validate the
|
|
8
|
+
* same definitions, so the producer and every consumer cannot drift.
|
|
9
|
+
*
|
|
10
|
+
* Platform-agnostic — zod is the only runtime dependency (no react / react-native
|
|
11
|
+
* / expo, ESM-safe).
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
/** User-type filters a caller may exclude from the recommendation surface. */
|
|
15
|
+
export declare const recommendationExcludeTypeSchema: z.ZodEnum<["federated", "agent", "automated"]>;
|
|
16
|
+
export type RecommendationExcludeType = z.infer<typeof recommendationExcludeTypeSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* A caller-supplied editorial boost. `userIds` are nudged up (or down, for a
|
|
19
|
+
* negative weight) in the ranking; the optional `reason` is for audit/telemetry
|
|
20
|
+
* only and never surfaced to end users. Boost members still pass the eligibility
|
|
21
|
+
* gate — a boost cannot resurrect a private/restricted/ineligible account.
|
|
22
|
+
*/
|
|
23
|
+
export declare const recommendationBoostSchema: z.ZodObject<{
|
|
24
|
+
userIds: z.ZodArray<z.ZodString, "many">;
|
|
25
|
+
weight: z.ZodNumber;
|
|
26
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
userIds: string[];
|
|
29
|
+
weight: number;
|
|
30
|
+
reason?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
userIds: string[];
|
|
33
|
+
weight: number;
|
|
34
|
+
reason?: string | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
export type RecommendationBoost = z.infer<typeof recommendationBoostSchema>;
|
|
37
|
+
/**
|
|
38
|
+
* Per-request overrides for the scoring signal weights. Every key is optional
|
|
39
|
+
* and clamped server-side to the resolved weight profile's allowed range — a
|
|
40
|
+
* caller can re-weight signals but never escape the profile's bounds.
|
|
41
|
+
*/
|
|
42
|
+
export declare const recommendationSignalWeightsSchema: z.ZodObject<{
|
|
43
|
+
graph: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
44
|
+
completeness: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
45
|
+
verified: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
46
|
+
curation: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
47
|
+
interest: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
48
|
+
appBoost: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
49
|
+
repCandidate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
verified?: number | undefined;
|
|
52
|
+
graph?: number | undefined;
|
|
53
|
+
completeness?: number | undefined;
|
|
54
|
+
curation?: number | undefined;
|
|
55
|
+
interest?: number | undefined;
|
|
56
|
+
appBoost?: number | undefined;
|
|
57
|
+
repCandidate?: number | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
verified?: number | undefined;
|
|
60
|
+
graph?: number | undefined;
|
|
61
|
+
completeness?: number | undefined;
|
|
62
|
+
curation?: number | undefined;
|
|
63
|
+
interest?: number | undefined;
|
|
64
|
+
appBoost?: number | undefined;
|
|
65
|
+
repCandidate?: number | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export type RecommendationSignalWeights = z.infer<typeof recommendationSignalWeightsSchema>;
|
|
68
|
+
/**
|
|
69
|
+
* Request body for `POST /profiles/recommendations`.
|
|
70
|
+
*
|
|
71
|
+
* `clientId` selects the per-app weight profile (the Application `_id`); when
|
|
72
|
+
* omitted the default profile is used. `excludeIds` removes accounts the caller
|
|
73
|
+
* has already seen/handled; `boosts` and `signalWeights` let the caller bias the
|
|
74
|
+
* ranking within server-enforced bounds.
|
|
75
|
+
*/
|
|
76
|
+
export declare const recommendationRequestSchema: z.ZodObject<{
|
|
77
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
78
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
excludeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["federated", "agent", "automated"]>, "many">>;
|
|
81
|
+
excludeIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
82
|
+
boosts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
83
|
+
userIds: z.ZodArray<z.ZodString, "many">;
|
|
84
|
+
weight: z.ZodNumber;
|
|
85
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
userIds: string[];
|
|
88
|
+
weight: number;
|
|
89
|
+
reason?: string | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
userIds: string[];
|
|
92
|
+
weight: number;
|
|
93
|
+
reason?: string | undefined;
|
|
94
|
+
}>, "many">>;
|
|
95
|
+
signalWeights: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
graph: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
97
|
+
completeness: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
98
|
+
verified: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
99
|
+
curation: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
100
|
+
interest: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
101
|
+
appBoost: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
102
|
+
repCandidate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
verified?: number | undefined;
|
|
105
|
+
graph?: number | undefined;
|
|
106
|
+
completeness?: number | undefined;
|
|
107
|
+
curation?: number | undefined;
|
|
108
|
+
interest?: number | undefined;
|
|
109
|
+
appBoost?: number | undefined;
|
|
110
|
+
repCandidate?: number | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
verified?: number | undefined;
|
|
113
|
+
graph?: number | undefined;
|
|
114
|
+
completeness?: number | undefined;
|
|
115
|
+
curation?: number | undefined;
|
|
116
|
+
interest?: number | undefined;
|
|
117
|
+
appBoost?: number | undefined;
|
|
118
|
+
repCandidate?: number | undefined;
|
|
119
|
+
}>>;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
clientId?: string | undefined;
|
|
122
|
+
limit?: number | undefined;
|
|
123
|
+
offset?: number | undefined;
|
|
124
|
+
excludeTypes?: ("federated" | "agent" | "automated")[] | undefined;
|
|
125
|
+
excludeIds?: string[] | undefined;
|
|
126
|
+
boosts?: {
|
|
127
|
+
userIds: string[];
|
|
128
|
+
weight: number;
|
|
129
|
+
reason?: string | undefined;
|
|
130
|
+
}[] | undefined;
|
|
131
|
+
signalWeights?: {
|
|
132
|
+
verified?: number | undefined;
|
|
133
|
+
graph?: number | undefined;
|
|
134
|
+
completeness?: number | undefined;
|
|
135
|
+
curation?: number | undefined;
|
|
136
|
+
interest?: number | undefined;
|
|
137
|
+
appBoost?: number | undefined;
|
|
138
|
+
repCandidate?: number | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
clientId?: string | undefined;
|
|
142
|
+
limit?: number | undefined;
|
|
143
|
+
offset?: number | undefined;
|
|
144
|
+
excludeTypes?: ("federated" | "agent" | "automated")[] | undefined;
|
|
145
|
+
excludeIds?: string[] | undefined;
|
|
146
|
+
boosts?: {
|
|
147
|
+
userIds: string[];
|
|
148
|
+
weight: number;
|
|
149
|
+
reason?: string | undefined;
|
|
150
|
+
}[] | undefined;
|
|
151
|
+
signalWeights?: {
|
|
152
|
+
verified?: number | undefined;
|
|
153
|
+
graph?: number | undefined;
|
|
154
|
+
completeness?: number | undefined;
|
|
155
|
+
curation?: number | undefined;
|
|
156
|
+
interest?: number | undefined;
|
|
157
|
+
appBoost?: number | undefined;
|
|
158
|
+
repCandidate?: number | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
}>;
|
|
161
|
+
export type RecommendationRequest = z.infer<typeof recommendationRequestSchema>;
|
|
162
|
+
/** Follower/following counts attached to a recommendation item. */
|
|
163
|
+
export declare const recommendationCountSchema: z.ZodObject<{
|
|
164
|
+
followers: z.ZodNumber;
|
|
165
|
+
following: z.ZodNumber;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
followers: number;
|
|
168
|
+
following: number;
|
|
169
|
+
}, {
|
|
170
|
+
followers: number;
|
|
171
|
+
following: number;
|
|
172
|
+
}>;
|
|
173
|
+
export type RecommendationCount = z.infer<typeof recommendationCountSchema>;
|
|
174
|
+
/**
|
|
175
|
+
* A single recommended profile.
|
|
176
|
+
*
|
|
177
|
+
* `name` reuses the canonical {@link userNameSchema} so `name.displayName` is the
|
|
178
|
+
* already-resolved server-side value. `score` and `matchedSignals` are present
|
|
179
|
+
* only on the scored (v2) path; `mutualCount` and `_count` are always present.
|
|
180
|
+
*/
|
|
181
|
+
export declare const recommendationItemSchema: z.ZodObject<{
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
username: z.ZodOptional<z.ZodString>;
|
|
184
|
+
name: z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>;
|
|
185
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
189
|
+
mutualCount: z.ZodNumber;
|
|
190
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
matchedSignals: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
192
|
+
isFederated: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
isAutomated: z.ZodOptional<z.ZodBoolean>;
|
|
195
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
196
|
+
_count: z.ZodObject<{
|
|
197
|
+
followers: z.ZodNumber;
|
|
198
|
+
following: z.ZodNumber;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
followers: number;
|
|
201
|
+
following: number;
|
|
202
|
+
}, {
|
|
203
|
+
followers: number;
|
|
204
|
+
following: number;
|
|
205
|
+
}>;
|
|
206
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
207
|
+
id: z.ZodString;
|
|
208
|
+
username: z.ZodOptional<z.ZodString>;
|
|
209
|
+
name: z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>;
|
|
210
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
211
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
214
|
+
mutualCount: z.ZodNumber;
|
|
215
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
matchedSignals: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
217
|
+
isFederated: z.ZodOptional<z.ZodBoolean>;
|
|
218
|
+
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
isAutomated: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
221
|
+
_count: z.ZodObject<{
|
|
222
|
+
followers: z.ZodNumber;
|
|
223
|
+
following: z.ZodNumber;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
followers: number;
|
|
226
|
+
following: number;
|
|
227
|
+
}, {
|
|
228
|
+
followers: number;
|
|
229
|
+
following: number;
|
|
230
|
+
}>;
|
|
231
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
232
|
+
id: z.ZodString;
|
|
233
|
+
username: z.ZodOptional<z.ZodString>;
|
|
234
|
+
name: z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>;
|
|
235
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
236
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
237
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
238
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
239
|
+
mutualCount: z.ZodNumber;
|
|
240
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
matchedSignals: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
242
|
+
isFederated: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
244
|
+
isAutomated: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
246
|
+
_count: z.ZodObject<{
|
|
247
|
+
followers: z.ZodNumber;
|
|
248
|
+
following: z.ZodNumber;
|
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
followers: number;
|
|
251
|
+
following: number;
|
|
252
|
+
}, {
|
|
253
|
+
followers: number;
|
|
254
|
+
following: number;
|
|
255
|
+
}>;
|
|
256
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
257
|
+
export type RecommendationItem = z.infer<typeof recommendationItemSchema>;
|
|
258
|
+
/** Wire shape of the recommendation response — an array of items. */
|
|
259
|
+
export declare const recommendationResponseSchema: z.ZodArray<z.ZodObject<{
|
|
260
|
+
id: z.ZodString;
|
|
261
|
+
username: z.ZodOptional<z.ZodString>;
|
|
262
|
+
name: z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>;
|
|
263
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
264
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
265
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
266
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
267
|
+
mutualCount: z.ZodNumber;
|
|
268
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
matchedSignals: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
270
|
+
isFederated: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
isAutomated: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
274
|
+
_count: z.ZodObject<{
|
|
275
|
+
followers: z.ZodNumber;
|
|
276
|
+
following: z.ZodNumber;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
followers: number;
|
|
279
|
+
following: number;
|
|
280
|
+
}, {
|
|
281
|
+
followers: number;
|
|
282
|
+
following: number;
|
|
283
|
+
}>;
|
|
284
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
285
|
+
id: z.ZodString;
|
|
286
|
+
username: z.ZodOptional<z.ZodString>;
|
|
287
|
+
name: z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>;
|
|
288
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
289
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
290
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
291
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
292
|
+
mutualCount: z.ZodNumber;
|
|
293
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
matchedSignals: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
295
|
+
isFederated: z.ZodOptional<z.ZodBoolean>;
|
|
296
|
+
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
297
|
+
isAutomated: z.ZodOptional<z.ZodBoolean>;
|
|
298
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
299
|
+
_count: z.ZodObject<{
|
|
300
|
+
followers: z.ZodNumber;
|
|
301
|
+
following: z.ZodNumber;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
followers: number;
|
|
304
|
+
following: number;
|
|
305
|
+
}, {
|
|
306
|
+
followers: number;
|
|
307
|
+
following: number;
|
|
308
|
+
}>;
|
|
309
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
310
|
+
id: z.ZodString;
|
|
311
|
+
username: z.ZodOptional<z.ZodString>;
|
|
312
|
+
name: z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>;
|
|
313
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
314
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
315
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
317
|
+
mutualCount: z.ZodNumber;
|
|
318
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
matchedSignals: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
320
|
+
isFederated: z.ZodOptional<z.ZodBoolean>;
|
|
321
|
+
isAgent: z.ZodOptional<z.ZodBoolean>;
|
|
322
|
+
isAutomated: z.ZodOptional<z.ZodBoolean>;
|
|
323
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
324
|
+
_count: z.ZodObject<{
|
|
325
|
+
followers: z.ZodNumber;
|
|
326
|
+
following: z.ZodNumber;
|
|
327
|
+
}, "strip", z.ZodTypeAny, {
|
|
328
|
+
followers: number;
|
|
329
|
+
following: number;
|
|
330
|
+
}, {
|
|
331
|
+
followers: number;
|
|
332
|
+
following: number;
|
|
333
|
+
}>;
|
|
334
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
335
|
+
export type RecommendationResponse = z.infer<typeof recommendationResponseSchema>;
|
|
336
|
+
/** One endorsement edge an app reports: `ownerId` endorses `memberId`. */
|
|
337
|
+
export declare const appEndorsementInputSchema: z.ZodObject<{
|
|
338
|
+
ownerId: z.ZodString;
|
|
339
|
+
memberId: z.ZodString;
|
|
340
|
+
op: z.ZodDefault<z.ZodEnum<["add", "remove"]>>;
|
|
341
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
ownerId: string;
|
|
344
|
+
memberId: string;
|
|
345
|
+
op: "add" | "remove";
|
|
346
|
+
sourceId?: string | undefined;
|
|
347
|
+
}, {
|
|
348
|
+
ownerId: string;
|
|
349
|
+
memberId: string;
|
|
350
|
+
op?: "add" | "remove" | undefined;
|
|
351
|
+
sourceId?: string | undefined;
|
|
352
|
+
}>;
|
|
353
|
+
export type AppEndorsementInput = z.infer<typeof appEndorsementInputSchema>;
|
|
354
|
+
/** One interest signal an app reports: how interested `userId` is in a topic. */
|
|
355
|
+
export declare const appInterestInputSchema: z.ZodObject<{
|
|
356
|
+
userId: z.ZodString;
|
|
357
|
+
interestScore: z.ZodNumber;
|
|
358
|
+
}, "strip", z.ZodTypeAny, {
|
|
359
|
+
userId: string;
|
|
360
|
+
interestScore: number;
|
|
361
|
+
}, {
|
|
362
|
+
userId: string;
|
|
363
|
+
interestScore: number;
|
|
364
|
+
}>;
|
|
365
|
+
export type AppInterestInput = z.infer<typeof appInterestInputSchema>;
|
|
366
|
+
/**
|
|
367
|
+
* Request body for `POST /app-signals/ingest` (service token, `signals:write`).
|
|
368
|
+
*
|
|
369
|
+
* At least one of `endorsements` / `interests` must be non-empty — an ingest
|
|
370
|
+
* with neither is a no-op and rejected so a misconfigured caller is surfaced
|
|
371
|
+
* rather than silently succeeding.
|
|
372
|
+
*/
|
|
373
|
+
export declare const appUserSignalIngestSchema: z.ZodEffects<z.ZodObject<{
|
|
374
|
+
endorsements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
375
|
+
ownerId: z.ZodString;
|
|
376
|
+
memberId: z.ZodString;
|
|
377
|
+
op: z.ZodDefault<z.ZodEnum<["add", "remove"]>>;
|
|
378
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
379
|
+
}, "strip", z.ZodTypeAny, {
|
|
380
|
+
ownerId: string;
|
|
381
|
+
memberId: string;
|
|
382
|
+
op: "add" | "remove";
|
|
383
|
+
sourceId?: string | undefined;
|
|
384
|
+
}, {
|
|
385
|
+
ownerId: string;
|
|
386
|
+
memberId: string;
|
|
387
|
+
op?: "add" | "remove" | undefined;
|
|
388
|
+
sourceId?: string | undefined;
|
|
389
|
+
}>, "many">>;
|
|
390
|
+
interests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
391
|
+
userId: z.ZodString;
|
|
392
|
+
interestScore: z.ZodNumber;
|
|
393
|
+
}, "strip", z.ZodTypeAny, {
|
|
394
|
+
userId: string;
|
|
395
|
+
interestScore: number;
|
|
396
|
+
}, {
|
|
397
|
+
userId: string;
|
|
398
|
+
interestScore: number;
|
|
399
|
+
}>, "many">>;
|
|
400
|
+
}, "strip", z.ZodTypeAny, {
|
|
401
|
+
endorsements?: {
|
|
402
|
+
ownerId: string;
|
|
403
|
+
memberId: string;
|
|
404
|
+
op: "add" | "remove";
|
|
405
|
+
sourceId?: string | undefined;
|
|
406
|
+
}[] | undefined;
|
|
407
|
+
interests?: {
|
|
408
|
+
userId: string;
|
|
409
|
+
interestScore: number;
|
|
410
|
+
}[] | undefined;
|
|
411
|
+
}, {
|
|
412
|
+
endorsements?: {
|
|
413
|
+
ownerId: string;
|
|
414
|
+
memberId: string;
|
|
415
|
+
op?: "add" | "remove" | undefined;
|
|
416
|
+
sourceId?: string | undefined;
|
|
417
|
+
}[] | undefined;
|
|
418
|
+
interests?: {
|
|
419
|
+
userId: string;
|
|
420
|
+
interestScore: number;
|
|
421
|
+
}[] | undefined;
|
|
422
|
+
}>, {
|
|
423
|
+
endorsements?: {
|
|
424
|
+
ownerId: string;
|
|
425
|
+
memberId: string;
|
|
426
|
+
op: "add" | "remove";
|
|
427
|
+
sourceId?: string | undefined;
|
|
428
|
+
}[] | undefined;
|
|
429
|
+
interests?: {
|
|
430
|
+
userId: string;
|
|
431
|
+
interestScore: number;
|
|
432
|
+
}[] | undefined;
|
|
433
|
+
}, {
|
|
434
|
+
endorsements?: {
|
|
435
|
+
ownerId: string;
|
|
436
|
+
memberId: string;
|
|
437
|
+
op?: "add" | "remove" | undefined;
|
|
438
|
+
sourceId?: string | undefined;
|
|
439
|
+
}[] | undefined;
|
|
440
|
+
interests?: {
|
|
441
|
+
userId: string;
|
|
442
|
+
interestScore: number;
|
|
443
|
+
}[] | undefined;
|
|
444
|
+
}>;
|
|
445
|
+
export type AppUserSignalIngest = z.infer<typeof appUserSignalIngestSchema>;
|