@oxyhq/contracts 0.9.0 → 0.9.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.
@@ -44,31 +44,55 @@ import { type UserResponse } from './userResponse';
44
44
  */
45
45
  export declare const deviceBootReasonSchema: z.ZodEnum<["session", "no_session", "new_device"]>;
46
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<{
47
+ export declare const deviceBootFragmentSchema: z.ZodDiscriminatedUnion<"reason", [z.ZodObject<{
48
+ reason: z.ZodLiteral<"session">;
49
+ code: z.ZodString;
54
50
  v: z.ZodLiteral<1>;
55
51
  state: z.ZodString;
56
- reason: z.ZodEnum<["session", "no_session", "new_device"]>;
57
- code: z.ZodOptional<z.ZodString>;
58
52
  deviceToken: z.ZodString;
59
53
  }, "strip", z.ZodTypeAny, {
60
- reason: "session" | "no_session" | "new_device";
54
+ code: string;
55
+ reason: "session";
61
56
  v: 1;
62
57
  state: string;
63
58
  deviceToken: string;
64
- code?: string | undefined;
65
59
  }, {
66
- reason: "session" | "no_session" | "new_device";
60
+ code: string;
61
+ reason: "session";
67
62
  v: 1;
68
63
  state: string;
69
64
  deviceToken: string;
70
- code?: string | undefined;
71
- }>;
65
+ }>, z.ZodObject<{
66
+ reason: z.ZodLiteral<"no_session">;
67
+ v: z.ZodLiteral<1>;
68
+ state: z.ZodString;
69
+ deviceToken: z.ZodString;
70
+ }, "strip", z.ZodTypeAny, {
71
+ reason: "no_session";
72
+ v: 1;
73
+ state: string;
74
+ deviceToken: string;
75
+ }, {
76
+ reason: "no_session";
77
+ v: 1;
78
+ state: string;
79
+ deviceToken: string;
80
+ }>, z.ZodObject<{
81
+ reason: z.ZodLiteral<"new_device">;
82
+ v: z.ZodLiteral<1>;
83
+ state: z.ZodString;
84
+ deviceToken: z.ZodString;
85
+ }, "strip", z.ZodTypeAny, {
86
+ reason: "new_device";
87
+ v: 1;
88
+ state: string;
89
+ deviceToken: string;
90
+ }, {
91
+ reason: "new_device";
92
+ v: 1;
93
+ state: string;
94
+ deviceToken: string;
95
+ }>]>;
72
96
  export type DeviceBootFragment = z.infer<typeof deviceBootFragmentSchema>;
73
97
  /** Request body for `POST /auth/device/exchange` — the single-use boot code. */
74
98
  export declare const deviceExchangeRequestSchema: z.ZodObject<{
@@ -93,6 +117,37 @@ export interface AuthTokenBundle {
93
117
  user: UserResponse;
94
118
  }
95
119
  export declare const authTokenBundleSchema: z.ZodType<AuthTokenBundle>;
120
+ /**
121
+ * The `*.oxy.so` same-site fast path returns a `reason`-discriminated result:
122
+ * a full session (the device cookie resolved an active session) OR a
123
+ * signed-out arm (the device is known / was just planted). BOTH arms carry the
124
+ * rotated opaque `deviceToken` to persist — the deviceToken is device-level
125
+ * attribution, not session-level, so it is refreshed even when signed out.
126
+ *
127
+ * IMPORTANT: the success arm nests the token bundle under `session` — it is
128
+ * NOT a bare {@link AuthTokenBundle}. That distinction is load-bearing for the
129
+ * consumer (`@oxyhq/core`'s cold boot uses `result.session` and persists the
130
+ * `deviceToken` from the SAME envelope).
131
+ */
132
+ /**
133
+ * Success arm: an active session resolved from the same-site device cookie.
134
+ */
135
+ export interface WebSessionSession {
136
+ reason: 'session';
137
+ session: AuthTokenBundle;
138
+ deviceToken: string;
139
+ }
140
+ /**
141
+ * Signed-out arm: the device is known (or freshly planted) but has no active
142
+ * session. Carries only the rotated `deviceToken`.
143
+ */
144
+ export interface WebSessionNoSession {
145
+ reason: 'no_session' | 'new_device';
146
+ deviceToken: string;
147
+ }
148
+ /** The `reason`-discriminated outcome of `POST /auth/device/web-session`. */
149
+ export type WebSessionResult = WebSessionSession | WebSessionNoSession;
150
+ export declare const webSessionResultSchema: z.ZodType<WebSessionResult>;
96
151
  /** Request body for `POST /auth/refresh-token` — the current refresh token. */
97
152
  export declare const tokenRefreshRequestSchema: z.ZodObject<{
98
153
  refreshToken: z.ZodString;
@@ -29,5 +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';
32
+ export { deviceBootReasonSchema, deviceBootFragmentSchema, deviceExchangeRequestSchema, authTokenBundleSchema, webSessionResultSchema, tokenRefreshRequestSchema, tokenRefreshResponseSchema, deviceTokenIssueResponseSchema, loginResultSchema, deviceResolveRequestSchema, deviceResolveResponseSchema, } from './deviceBoot';
33
+ export type { DeviceBootReason, DeviceBootFragment, DeviceExchangeRequest, AuthTokenBundle, WebSessionResult, WebSessionSession, WebSessionNoSession, TokenRefreshRequest, TokenRefreshResponse, DeviceTokenIssueResponse, LoginTwoFactorRequired, LoginSessionResult, LoginResult, DeviceResolveRequest, DeviceResolveAccount, DeviceResolveResponse, } from './deviceBoot';
@@ -189,7 +189,6 @@ export declare const userProfileUpdateSchema: z.ZodObject<{
189
189
  phone: z.ZodOptional<z.ZodString>;
190
190
  address: z.ZodOptional<z.ZodString>;
191
191
  birthday: z.ZodOptional<z.ZodString>;
192
- location: z.ZodOptional<z.ZodString>;
193
192
  locations: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
194
193
  links: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
195
194
  linksMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -236,7 +235,6 @@ export declare const userProfileUpdateSchema: z.ZodObject<{
236
235
  phone: z.ZodOptional<z.ZodString>;
237
236
  address: z.ZodOptional<z.ZodString>;
238
237
  birthday: z.ZodOptional<z.ZodString>;
239
- location: z.ZodOptional<z.ZodString>;
240
238
  locations: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
241
239
  links: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
242
240
  linksMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -283,7 +281,6 @@ export declare const userProfileUpdateSchema: z.ZodObject<{
283
281
  phone: z.ZodOptional<z.ZodString>;
284
282
  address: z.ZodOptional<z.ZodString>;
285
283
  birthday: z.ZodOptional<z.ZodString>;
286
- location: z.ZodOptional<z.ZodString>;
287
284
  locations: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
288
285
  links: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
289
286
  linksMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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",