@oxyhq/contracts 0.8.0 → 0.9.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.
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Device-first bootstrap & token contracts (auth centralization, wave 1).
3
+ *
4
+ * SINGLE SOURCE OF TRUTH for the wire shape of the new device-first session
5
+ * bootstrap: the top-level `#oxy_boot=…` fragment the API hands back from
6
+ * `GET /auth/device/bootstrap`, the token bundle a boot code / web-session
7
+ * fast-path exchanges into, the persisted-refresh rotation, the native
8
+ * device-token issuance, the IdP chooser's device-resolve, and the first-party
9
+ * password login result (2FA arm vs. session arm). The API validates its OUTPUT
10
+ * against these schemas; every consumer (`@oxyhq/core`'s device-boot mixin, the
11
+ * SDK cold boot, the IdP chooser) validates its INPUT against the same
12
+ * definitions, so producer and consumers cannot drift.
13
+ *
14
+ * Design anchors (from the auth-centralization plan):
15
+ * - The bootstrap fragment carries NO tokens and NO deviceId — only a
16
+ * `state` echo (CSRF), a `reason`, a short-lived single-use `code`, and an
17
+ * opaque `deviceToken`. Tokens are obtained by exchanging the `code` at
18
+ * `POST /auth/device/exchange` (origin-bound GETDEL burn).
19
+ * - Refresh is ONE rotating, single-use family shared by web and native.
20
+ * - `loginResult` mirrors what `POST /auth/login` returns today
21
+ * (`buildSessionAuthResponse` in the API's `session.controller.ts`): either a
22
+ * 2FA challenge (`{ twoFactorRequired: true, loginToken }`) or a session
23
+ * payload. The session arm matches `SessionAuthResponse` EXACTLY, plus an
24
+ * optional `refreshToken` the new server adds for the persisted-refresh lane.
25
+ *
26
+ * Nested-object response shapes are declared as explicit `interface`s with the
27
+ * runtime schema annotated `z.ZodType<Interface>` — the same rationale as
28
+ * `identity.ts` / `userResponse.ts`: a `z.infer<>` of a nested object schema can
29
+ * degrade to `{}` under a consumer's `moduleResolution: "node"` (node10), so the
30
+ * load-bearing shapes are pinned by literal interfaces. Flat request/response
31
+ * shapes (no nested-object hazard) are inferred via `z.infer<>`.
32
+ *
33
+ * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
34
+ * `require()`).
35
+ */
36
+ import { z } from 'zod';
37
+ import { type UserResponse } from './userResponse';
38
+ /**
39
+ * Why the bootstrap hop resolved the way it did.
40
+ * - `session` — the device cookie resolved an active session; a `code` is
41
+ * present to exchange for tokens.
42
+ * - `no_session` — the device is known but has no active session; no `code`.
43
+ * - `new_device` — first contact; the cookie was just planted, no session yet.
44
+ */
45
+ export declare const deviceBootReasonSchema: z.ZodEnum<["session", "no_session", "new_device"]>;
46
+ export type DeviceBootReason = z.infer<typeof deviceBootReasonSchema>;
47
+ /**
48
+ * The `#oxy_boot=<json>` fragment `GET /auth/device/bootstrap` appends to the
49
+ * `return_to` URL. Carries the CSRF `state` echo, the resolution `reason`, an
50
+ * optional single-use exchange `code` (present iff `reason === 'session'`), and
51
+ * the opaque `deviceToken`. NEVER carries tokens or a deviceId.
52
+ */
53
+ export declare const deviceBootFragmentSchema: z.ZodObject<{
54
+ v: z.ZodLiteral<1>;
55
+ state: z.ZodString;
56
+ reason: z.ZodEnum<["session", "no_session", "new_device"]>;
57
+ code: z.ZodOptional<z.ZodString>;
58
+ deviceToken: z.ZodString;
59
+ }, "strip", z.ZodTypeAny, {
60
+ reason: "session" | "no_session" | "new_device";
61
+ v: 1;
62
+ state: string;
63
+ deviceToken: string;
64
+ code?: string | undefined;
65
+ }, {
66
+ reason: "session" | "no_session" | "new_device";
67
+ v: 1;
68
+ state: string;
69
+ deviceToken: string;
70
+ code?: string | undefined;
71
+ }>;
72
+ export type DeviceBootFragment = z.infer<typeof deviceBootFragmentSchema>;
73
+ /** Request body for `POST /auth/device/exchange` — the single-use boot code. */
74
+ export declare const deviceExchangeRequestSchema: z.ZodObject<{
75
+ code: z.ZodString;
76
+ }, "strip", z.ZodTypeAny, {
77
+ code: string;
78
+ }, {
79
+ code: string;
80
+ }>;
81
+ export type DeviceExchangeRequest = z.infer<typeof deviceExchangeRequestSchema>;
82
+ /**
83
+ * The token bundle returned by `POST /auth/device/exchange` and
84
+ * `POST /auth/device/web-session` — the freshly-minted access token, its
85
+ * rotating refresh-family head, the owning `sessionId`, and the full canonical
86
+ * user object. `expiresAt` is an ISO string.
87
+ */
88
+ export interface AuthTokenBundle {
89
+ sessionId: string;
90
+ accessToken: string;
91
+ refreshToken: string;
92
+ expiresAt: string;
93
+ user: UserResponse;
94
+ }
95
+ export declare const authTokenBundleSchema: z.ZodType<AuthTokenBundle>;
96
+ /** Request body for `POST /auth/refresh-token` — the current refresh token. */
97
+ export declare const tokenRefreshRequestSchema: z.ZodObject<{
98
+ refreshToken: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ refreshToken: string;
101
+ }, {
102
+ refreshToken: string;
103
+ }>;
104
+ export type TokenRefreshRequest = z.infer<typeof tokenRefreshRequestSchema>;
105
+ /**
106
+ * Wire shape of `POST /auth/refresh-token`: the rotated (single-use) family —
107
+ * a new access token, the next refresh token, the new access-token expiry, and
108
+ * the owning session id. `expiresAt` is an ISO string.
109
+ */
110
+ export declare const tokenRefreshResponseSchema: z.ZodObject<{
111
+ accessToken: z.ZodString;
112
+ refreshToken: z.ZodString;
113
+ expiresAt: z.ZodString;
114
+ sessionId: z.ZodString;
115
+ }, "strip", z.ZodTypeAny, {
116
+ expiresAt: string;
117
+ accessToken: string;
118
+ sessionId: string;
119
+ refreshToken: string;
120
+ }, {
121
+ expiresAt: string;
122
+ accessToken: string;
123
+ sessionId: string;
124
+ refreshToken: string;
125
+ }>;
126
+ export type TokenRefreshResponse = z.infer<typeof tokenRefreshResponseSchema>;
127
+ /**
128
+ * Wire shape of `POST /auth/device/token` — issues (or rotates) the opaque
129
+ * device token for the native channel. The deviceId is taken from the bearer
130
+ * JWT claims server-side; only the token comes back.
131
+ */
132
+ export declare const deviceTokenIssueResponseSchema: z.ZodObject<{
133
+ deviceToken: z.ZodString;
134
+ }, "strip", z.ZodTypeAny, {
135
+ deviceToken: string;
136
+ }, {
137
+ deviceToken: string;
138
+ }>;
139
+ export type DeviceTokenIssueResponse = z.infer<typeof deviceTokenIssueResponseSchema>;
140
+ /**
141
+ * `POST /auth/login` when the account has 2FA enabled: a short-lived login
142
+ * token to be presented at the 2FA challenge, and no session yet.
143
+ */
144
+ export interface LoginTwoFactorRequired {
145
+ twoFactorRequired: true;
146
+ loginToken: string;
147
+ }
148
+ /**
149
+ * `POST /auth/login` when authentication completed in one step. Matches the
150
+ * API's `SessionAuthResponse` EXACTLY (`buildSessionAuthResponse`), plus the
151
+ * optional `refreshToken` the persisted-refresh lane adds. `user` is the
152
+ * truncated session-user shape the login endpoint emits (NOT the full
153
+ * `userResponseSchema`).
154
+ */
155
+ export interface LoginSessionResult {
156
+ sessionId: string;
157
+ deviceId: string;
158
+ expiresAt: string;
159
+ accessToken?: string;
160
+ refreshToken?: string;
161
+ user: {
162
+ id: string;
163
+ username?: string;
164
+ avatar?: string;
165
+ };
166
+ }
167
+ /** The discriminated outcome of `POST /auth/login`. */
168
+ export type LoginResult = LoginTwoFactorRequired | LoginSessionResult;
169
+ export declare const loginResultSchema: z.ZodType<LoginResult>;
170
+ /**
171
+ * Request body for `POST /auth/device/resolve` (X-Oxy-Internal, called by the
172
+ * IdP chooser) — the device key the chooser read from the first-party
173
+ * `oxy_device` cookie.
174
+ */
175
+ export declare const deviceResolveRequestSchema: z.ZodObject<{
176
+ deviceKey: z.ZodString;
177
+ }, "strip", z.ZodTypeAny, {
178
+ deviceKey: string;
179
+ }, {
180
+ deviceKey: string;
181
+ }>;
182
+ export type DeviceResolveRequest = z.infer<typeof deviceResolveRequestSchema>;
183
+ /** One account resolved for the IdP chooser from a device's session set. */
184
+ export interface DeviceResolveAccount {
185
+ user: UserResponse;
186
+ sessionId: string;
187
+ accessToken: string;
188
+ expiresAt: string;
189
+ }
190
+ /**
191
+ * Wire shape of `POST /auth/device/resolve` — the device's active account id
192
+ * (or `null` when signed out of all) plus every account signed in on the
193
+ * device. Replaces the IdP's `/auth/refresh-all` chooser feed.
194
+ */
195
+ export interface DeviceResolveResponse {
196
+ activeAccountId: string | null;
197
+ accounts: DeviceResolveAccount[];
198
+ }
199
+ export declare const deviceResolveResponseSchema: z.ZodType<DeviceResolveResponse>;
@@ -5,14 +5,14 @@ export declare const sessionAccountSchema: z.ZodObject<{
5
5
  authuser: z.ZodNumber;
6
6
  operatedByUserId: z.ZodOptional<z.ZodString>;
7
7
  }, "strip", z.ZodTypeAny, {
8
- accountId: string;
9
- sessionId: string;
10
8
  authuser: number;
9
+ sessionId: string;
10
+ accountId: string;
11
11
  operatedByUserId?: string | undefined;
12
12
  }, {
13
- accountId: string;
14
- sessionId: string;
15
13
  authuser: number;
14
+ sessionId: string;
15
+ accountId: string;
16
16
  operatedByUserId?: string | undefined;
17
17
  }>;
18
18
  export declare const deviceSessionStateSchema: z.ZodObject<{
@@ -23,14 +23,14 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
23
23
  authuser: z.ZodNumber;
24
24
  operatedByUserId: z.ZodOptional<z.ZodString>;
25
25
  }, "strip", z.ZodTypeAny, {
26
- accountId: string;
27
- sessionId: string;
28
26
  authuser: number;
27
+ sessionId: string;
28
+ accountId: string;
29
29
  operatedByUserId?: string | undefined;
30
30
  }, {
31
- accountId: string;
32
- sessionId: string;
33
31
  authuser: number;
32
+ sessionId: string;
33
+ accountId: string;
34
34
  operatedByUserId?: string | undefined;
35
35
  }>, "many">;
36
36
  activeAccountId: z.ZodNullable<z.ZodString>;
@@ -38,24 +38,24 @@ export declare const deviceSessionStateSchema: z.ZodObject<{
38
38
  updatedAt: z.ZodNumber;
39
39
  }, "strip", z.ZodTypeAny, {
40
40
  updatedAt: number;
41
- deviceId: string;
42
41
  accounts: {
43
- accountId: string;
44
- sessionId: string;
45
42
  authuser: number;
43
+ sessionId: string;
44
+ accountId: string;
46
45
  operatedByUserId?: string | undefined;
47
46
  }[];
47
+ deviceId: string;
48
48
  activeAccountId: string | null;
49
49
  revision: number;
50
50
  }, {
51
51
  updatedAt: number;
52
- deviceId: string;
53
52
  accounts: {
54
- accountId: string;
55
- sessionId: string;
56
53
  authuser: number;
54
+ sessionId: string;
55
+ accountId: string;
57
56
  operatedByUserId?: string | undefined;
58
57
  }[];
58
+ deviceId: string;
59
59
  activeAccountId: string | null;
60
60
  revision: number;
61
61
  }>;
@@ -78,14 +78,14 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
78
78
  authuser: z.ZodNumber;
79
79
  operatedByUserId: z.ZodOptional<z.ZodString>;
80
80
  }, "strip", z.ZodTypeAny, {
81
- accountId: string;
82
- sessionId: string;
83
81
  authuser: number;
82
+ sessionId: string;
83
+ accountId: string;
84
84
  operatedByUserId?: string | undefined;
85
85
  }, {
86
- accountId: string;
87
- sessionId: string;
88
86
  authuser: number;
87
+ sessionId: string;
88
+ accountId: string;
89
89
  operatedByUserId?: string | undefined;
90
90
  }>, "many">;
91
91
  activeAccountId: z.ZodNullable<z.ZodString>;
@@ -93,24 +93,24 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
93
93
  updatedAt: z.ZodNumber;
94
94
  }, "strip", z.ZodTypeAny, {
95
95
  updatedAt: number;
96
- deviceId: string;
97
96
  accounts: {
98
- accountId: string;
99
- sessionId: string;
100
97
  authuser: number;
98
+ sessionId: string;
99
+ accountId: string;
101
100
  operatedByUserId?: string | undefined;
102
101
  }[];
102
+ deviceId: string;
103
103
  activeAccountId: string | null;
104
104
  revision: number;
105
105
  }, {
106
106
  updatedAt: number;
107
- deviceId: string;
108
107
  accounts: {
109
- accountId: string;
110
- sessionId: string;
111
108
  authuser: number;
109
+ sessionId: string;
110
+ accountId: string;
112
111
  operatedByUserId?: string | undefined;
113
112
  }[];
113
+ deviceId: string;
114
114
  activeAccountId: string | null;
115
115
  revision: number;
116
116
  }>;
@@ -127,13 +127,13 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
127
127
  }, "strip", z.ZodTypeAny, {
128
128
  state: {
129
129
  updatedAt: number;
130
- deviceId: string;
131
130
  accounts: {
132
- accountId: string;
133
- sessionId: string;
134
131
  authuser: number;
132
+ sessionId: string;
133
+ accountId: string;
135
134
  operatedByUserId?: string | undefined;
136
135
  }[];
136
+ deviceId: string;
137
137
  activeAccountId: string | null;
138
138
  revision: number;
139
139
  };
@@ -144,13 +144,13 @@ export declare const deviceSessionSyncSchema: z.ZodObject<{
144
144
  }, {
145
145
  state: {
146
146
  updatedAt: number;
147
- deviceId: string;
148
147
  accounts: {
149
- accountId: string;
150
- sessionId: string;
151
148
  authuser: number;
149
+ sessionId: string;
150
+ accountId: string;
152
151
  operatedByUserId?: string | undefined;
153
152
  }[];
153
+ deviceId: string;
154
154
  activeAccountId: string | null;
155
155
  revision: number;
156
156
  };
@@ -15,8 +15,8 @@ export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, }
15
15
  export type { ApplicationTypeContract, PublicApplicationResponse, SessionStatusResponse, } from './sessionStatus';
16
16
  export { fedcmTokenPayloadSchema, } from './fedcmToken';
17
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';
18
+ export { recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, appAffinityEventTypeSchema, appAffinityEventSchema, appAffinityEventsIngestSchema, } from './recommendations';
19
+ export type { RecommendationExcludeType, RecommendationBoost, RecommendationSignalWeights, RecommendationRequest, RecommendationCount, RecommendationItem, RecommendationResponse, AppEndorsementInput, AppInterestInput, AppUserSignalIngest, AppAffinityEventType, AppAffinityEvent, AppAffinityEventsIngest, } from './recommendations';
20
20
  export { verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportBundleSchema, } from './identity';
21
21
  export type { VerificationMethod, Secp256k1VerificationMethod, MultikeyVerificationMethod, DidService, DidDocument, SignedRecordEnvelope, VerifiedDomain, DomainVerificationRequest, DomainVerificationInstructions, AuthMethodEntry, AuthMethodsResponse, ExportAttestation, ExportBundle, } from './identity';
22
22
  export { oxySignedRecordTypeSchema, } from './oxyRecordTypes';
@@ -29,3 +29,5 @@ export { linkPreviewSchema, linkPreviewBatchRequestSchema, linkPreviewBatchRespo
29
29
  export type { LinkPreviewStatus, LinkPreview, LinkPreviewBatchRequest, LinkPreviewBatchResponse, } from './links';
30
30
  export { sessionAccountSchema, deviceSessionStateSchema, activeTokenSchema, deviceSessionSyncSchema, } from './deviceSession';
31
31
  export type { SessionAccount, DeviceSessionState, ActiveToken, DeviceSessionSync, } from './deviceSession';
32
+ export { deviceBootReasonSchema, deviceBootFragmentSchema, deviceExchangeRequestSchema, authTokenBundleSchema, tokenRefreshRequestSchema, tokenRefreshResponseSchema, deviceTokenIssueResponseSchema, loginResultSchema, deviceResolveRequestSchema, deviceResolveResponseSchema, } from './deviceBoot';
33
+ export type { DeviceBootReason, DeviceBootFragment, DeviceExchangeRequest, AuthTokenBundle, TokenRefreshRequest, TokenRefreshResponse, DeviceTokenIssueResponse, LoginTwoFactorRequired, LoginSessionResult, LoginResult, DeviceResolveRequest, DeviceResolveAccount, DeviceResolveResponse, } from './deviceBoot';
@@ -47,6 +47,7 @@ export declare const recommendationSignalWeightsSchema: z.ZodObject<{
47
47
  interest: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
48
48
  appBoost: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
49
49
  repCandidate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
50
+ affinity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
50
51
  }, "strip", z.ZodTypeAny, {
51
52
  verified?: number | undefined;
52
53
  graph?: number | undefined;
@@ -55,6 +56,7 @@ export declare const recommendationSignalWeightsSchema: z.ZodObject<{
55
56
  interest?: number | undefined;
56
57
  appBoost?: number | undefined;
57
58
  repCandidate?: number | undefined;
59
+ affinity?: number | undefined;
58
60
  }, {
59
61
  verified?: number | undefined;
60
62
  graph?: number | undefined;
@@ -63,6 +65,7 @@ export declare const recommendationSignalWeightsSchema: z.ZodObject<{
63
65
  interest?: number | undefined;
64
66
  appBoost?: number | undefined;
65
67
  repCandidate?: number | undefined;
68
+ affinity?: number | undefined;
66
69
  }>;
67
70
  export type RecommendationSignalWeights = z.infer<typeof recommendationSignalWeightsSchema>;
68
71
  /**
@@ -100,6 +103,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
100
103
  interest: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
101
104
  appBoost: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
102
105
  repCandidate: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
106
+ affinity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
103
107
  }, "strip", z.ZodTypeAny, {
104
108
  verified?: number | undefined;
105
109
  graph?: number | undefined;
@@ -108,6 +112,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
108
112
  interest?: number | undefined;
109
113
  appBoost?: number | undefined;
110
114
  repCandidate?: number | undefined;
115
+ affinity?: number | undefined;
111
116
  }, {
112
117
  verified?: number | undefined;
113
118
  graph?: number | undefined;
@@ -116,6 +121,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
116
121
  interest?: number | undefined;
117
122
  appBoost?: number | undefined;
118
123
  repCandidate?: number | undefined;
124
+ affinity?: number | undefined;
119
125
  }>>;
120
126
  }, "strip", z.ZodTypeAny, {
121
127
  clientId?: string | undefined;
@@ -136,6 +142,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
136
142
  interest?: number | undefined;
137
143
  appBoost?: number | undefined;
138
144
  repCandidate?: number | undefined;
145
+ affinity?: number | undefined;
139
146
  } | undefined;
140
147
  }, {
141
148
  clientId?: string | undefined;
@@ -156,6 +163,7 @@ export declare const recommendationRequestSchema: z.ZodObject<{
156
163
  interest?: number | undefined;
157
164
  appBoost?: number | undefined;
158
165
  repCandidate?: number | undefined;
166
+ affinity?: number | undefined;
159
167
  } | undefined;
160
168
  }>;
161
169
  export type RecommendationRequest = z.infer<typeof recommendationRequestSchema>;
@@ -443,3 +451,92 @@ export declare const appUserSignalIngestSchema: z.ZodEffects<z.ZodObject<{
443
451
  }[] | undefined;
444
452
  }>;
445
453
  export type AppUserSignalIngest = z.infer<typeof appUserSignalIngestSchema>;
454
+ /**
455
+ * The directed interaction types a consuming app may report between two users.
456
+ * Each type carries a server-side default weight (see the API's
457
+ * `AFFINITY_EVENT_WEIGHTS`); a caller may override the applied weight per event.
458
+ */
459
+ export declare const appAffinityEventTypeSchema: z.ZodEnum<["like", "reply", "boost", "follow", "mention", "profile_view", "quote", "repost"]>;
460
+ export type AppAffinityEventType = z.infer<typeof appAffinityEventTypeSchema>;
461
+ /**
462
+ * One directed interaction event: `fromUserId` interacted with `toUserId`
463
+ * (`type`) at `occurredAt`. The Oxy affinity-graph folds these into a per-app,
464
+ * time-decayed directed affinity edge (`fromUserId → toUserId`).
465
+ *
466
+ * - `weight` (optional) overrides the per-type default weight for this event.
467
+ * - `occurredAt` (optional, ISO) is the event time; absent means "now" at ingest.
468
+ * - `eventId` (optional) makes an event idempotent — a repeated `eventId` for the
469
+ * same application is folded at most once (bounded dedup window).
470
+ */
471
+ export declare const appAffinityEventSchema: z.ZodObject<{
472
+ fromUserId: z.ZodString;
473
+ toUserId: z.ZodString;
474
+ type: z.ZodEnum<["like", "reply", "boost", "follow", "mention", "profile_view", "quote", "repost"]>;
475
+ weight: z.ZodOptional<z.ZodNumber>;
476
+ occurredAt: z.ZodOptional<z.ZodString>;
477
+ eventId: z.ZodOptional<z.ZodString>;
478
+ }, "strip", z.ZodTypeAny, {
479
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
480
+ fromUserId: string;
481
+ toUserId: string;
482
+ weight?: number | undefined;
483
+ occurredAt?: string | undefined;
484
+ eventId?: string | undefined;
485
+ }, {
486
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
487
+ fromUserId: string;
488
+ toUserId: string;
489
+ weight?: number | undefined;
490
+ occurredAt?: string | undefined;
491
+ eventId?: string | undefined;
492
+ }>;
493
+ export type AppAffinityEvent = z.infer<typeof appAffinityEventSchema>;
494
+ /**
495
+ * Request body for `POST /app-signals/events` (service token, `signals:write`).
496
+ *
497
+ * A non-empty batch (1..1000) of directed interaction events for the requesting
498
+ * application. Self-edges (`fromUserId === toUserId`) are dropped server-side.
499
+ */
500
+ export declare const appAffinityEventsIngestSchema: z.ZodObject<{
501
+ events: z.ZodArray<z.ZodObject<{
502
+ fromUserId: z.ZodString;
503
+ toUserId: z.ZodString;
504
+ type: z.ZodEnum<["like", "reply", "boost", "follow", "mention", "profile_view", "quote", "repost"]>;
505
+ weight: z.ZodOptional<z.ZodNumber>;
506
+ occurredAt: z.ZodOptional<z.ZodString>;
507
+ eventId: z.ZodOptional<z.ZodString>;
508
+ }, "strip", z.ZodTypeAny, {
509
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
510
+ fromUserId: string;
511
+ toUserId: string;
512
+ weight?: number | undefined;
513
+ occurredAt?: string | undefined;
514
+ eventId?: string | undefined;
515
+ }, {
516
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
517
+ fromUserId: string;
518
+ toUserId: string;
519
+ weight?: number | undefined;
520
+ occurredAt?: string | undefined;
521
+ eventId?: string | undefined;
522
+ }>, "many">;
523
+ }, "strip", z.ZodTypeAny, {
524
+ events: {
525
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
526
+ fromUserId: string;
527
+ toUserId: string;
528
+ weight?: number | undefined;
529
+ occurredAt?: string | undefined;
530
+ eventId?: string | undefined;
531
+ }[];
532
+ }, {
533
+ events: {
534
+ type: "like" | "reply" | "boost" | "follow" | "mention" | "profile_view" | "quote" | "repost";
535
+ fromUserId: string;
536
+ toUserId: string;
537
+ weight?: number | undefined;
538
+ occurredAt?: string | undefined;
539
+ eventId?: string | undefined;
540
+ }[];
541
+ }>;
542
+ export type AppAffinityEventsIngest = z.infer<typeof appAffinityEventsIngestSchema>;
@@ -419,9 +419,9 @@ export declare const refreshAllAccountSchema: z.ZodObject<{
419
419
  }, z.ZodTypeAny, "passthrough">>;
420
420
  }, "strip", z.ZodTypeAny, {
421
421
  expiresAt: string;
422
- sessionId: string;
423
422
  authuser: number;
424
423
  accessToken: string;
424
+ sessionId: string;
425
425
  user: {
426
426
  name: UserNameResponse;
427
427
  id?: string | undefined;
@@ -443,9 +443,9 @@ export declare const refreshAllAccountSchema: z.ZodObject<{
443
443
  };
444
444
  }, {
445
445
  expiresAt: string;
446
- sessionId: string;
447
446
  authuser: number;
448
447
  accessToken: string;
448
+ sessionId: string;
449
449
  user: {
450
450
  name: UserNameResponse;
451
451
  id?: string | undefined;
@@ -568,9 +568,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
568
568
  }, z.ZodTypeAny, "passthrough">>;
569
569
  }, "strip", z.ZodTypeAny, {
570
570
  expiresAt: string;
571
- sessionId: string;
572
571
  authuser: number;
573
572
  accessToken: string;
573
+ sessionId: string;
574
574
  user: {
575
575
  name: UserNameResponse;
576
576
  id?: string | undefined;
@@ -592,9 +592,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
592
592
  };
593
593
  }, {
594
594
  expiresAt: string;
595
- sessionId: string;
596
595
  authuser: number;
597
596
  accessToken: string;
597
+ sessionId: string;
598
598
  user: {
599
599
  name: UserNameResponse;
600
600
  id?: string | undefined;
@@ -618,9 +618,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
618
618
  }, "strip", z.ZodTypeAny, {
619
619
  accounts: {
620
620
  expiresAt: string;
621
- sessionId: string;
622
621
  authuser: number;
623
622
  accessToken: string;
623
+ sessionId: string;
624
624
  user: {
625
625
  name: UserNameResponse;
626
626
  id?: string | undefined;
@@ -644,9 +644,9 @@ export declare const refreshAllResponseSchema: z.ZodObject<{
644
644
  }, {
645
645
  accounts: {
646
646
  expiresAt: string;
647
- sessionId: string;
648
647
  authuser: number;
649
648
  accessToken: string;
649
+ sessionId: string;
650
650
  user: {
651
651
  name: UserNameResponse;
652
652
  id?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",