@oxy.so/contracts 1.0.1 → 1.1.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.
@@ -812,6 +812,7 @@ export declare const currentUserResponseSchema: z.ZodObject<{
812
812
  accountCategories?: ("news" | "politics" | "business" | "startup" | "finance" | "crypto" | "marketplace" | "retail" | "real_estate" | "agency" | "landlord" | "cooperative" | "architecture" | "technology" | "software" | "ai" | "security" | "automation" | "science" | "education" | "books" | "health" | "fitness" | "sports" | "gaming" | "music" | "film" | "podcast" | "art" | "photography" | "comedy" | "food" | "travel" | "fashion" | "home_garden" | "diy" | "automotive" | "animals" | "family" | "nonprofit" | "government" | "community" | "activism" | "environment" | "religion" | "other")[] | undefined;
813
813
  id?: string | undefined;
814
814
  publicKey?: string | undefined;
815
+ verified?: boolean | undefined;
815
816
  did?: string | undefined;
816
817
  verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
817
818
  _id?: string | undefined;
@@ -819,7 +820,6 @@ export declare const currentUserResponseSchema: z.ZodObject<{
819
820
  phone?: string | undefined;
820
821
  address?: string | undefined;
821
822
  birthday?: string | undefined;
822
- verified?: boolean | undefined;
823
823
  languages?: string[] | undefined;
824
824
  relationship?: UserRelationship | undefined;
825
825
  themePreference?: ThemePreference | undefined;
@@ -836,6 +836,7 @@ export declare const currentUserResponseSchema: z.ZodObject<{
836
836
  accountCategories?: ("news" | "politics" | "business" | "startup" | "finance" | "crypto" | "marketplace" | "retail" | "real_estate" | "agency" | "landlord" | "cooperative" | "architecture" | "technology" | "software" | "ai" | "security" | "automation" | "science" | "education" | "books" | "health" | "fitness" | "sports" | "gaming" | "music" | "film" | "podcast" | "art" | "photography" | "comedy" | "food" | "travel" | "fashion" | "home_garden" | "diy" | "automotive" | "animals" | "family" | "nonprofit" | "government" | "community" | "activism" | "environment" | "religion" | "other")[] | undefined;
837
837
  id?: string | undefined;
838
838
  publicKey?: string | undefined;
839
+ verified?: boolean | undefined;
839
840
  did?: string | undefined;
840
841
  verifiedDomains?: import("./identity").VerifiedDomain[] | undefined;
841
842
  _id?: string | undefined;
@@ -843,7 +844,6 @@ export declare const currentUserResponseSchema: z.ZodObject<{
843
844
  phone?: string | undefined;
844
845
  address?: string | undefined;
845
846
  birthday?: string | undefined;
846
- verified?: boolean | undefined;
847
847
  languages?: string[] | undefined;
848
848
  relationship?: UserRelationship | undefined;
849
849
  themePreference?: ThemePreference | undefined;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * These schemas describe ONLY the outer Oxy envelope that wraps a WebAuthn
5
5
  * ceremony request — the username the client is registering/authenticating as,
6
- * plus the device-session options every first-party sign-in accepts. The browser
6
+ * plus non-authoritative device metadata. The browser
7
7
  * `RegistrationResponseJSON` / `AuthenticationResponseJSON` payloads are NOT
8
8
  * mirrored here: they are validated by `@simplewebauthn/server` inside the route
9
9
  * (`verifyRegistrationResponse` / `verifyAuthenticationResponse`), which is the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/contracts",
3
- "version": "1.0.1",
3
+ "version": "1.1.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",
package/dist/cjs/links.js DELETED
@@ -1,68 +0,0 @@
1
- "use strict";
2
- /**
3
- * Link-preview / unfurl API contracts.
4
- *
5
- * SINGLE SOURCE OF TRUTH for the wire shape of Oxy's link-preview ("unfurl")
6
- * resolution surface: the single `GET` lookup and the `POST` batch lookup that
7
- * every app calls through the SDK so apps stop duplicating their own
8
- * link-metadata fetching. The API validates its OUTPUT against these schemas;
9
- * every consumer (`@oxy.so/core`'s link mixin and the apps that call it)
10
- * validates its INPUT against the same definitions, so producer and consumers
11
- * cannot drift.
12
- *
13
- * Design anchors:
14
- * - Oxy owns resolution. The `image` (and `favicon`) URLs a preview carries are
15
- * re-hosted on Oxy media (`cloud.oxy.so/<fileId>`), never raw remote URLs —
16
- * apps render them directly with no per-app proxy.
17
- * - Resolution is best-effort and asynchronous. A preview is `'resolved'` once
18
- * metadata is materialised, `'pending'` while a first-seen URL is being
19
- * fetched in the background, or `'empty'` when the target yielded no usable
20
- * metadata. `resolvedAt` (ISO datetime) is present only once `'resolved'`.
21
- * - The batch response is keyed by the REQUESTED url (the exact string the
22
- * caller sent), not the canonical/final URL, so a caller can always look its
23
- * own input back up; the canonical URL lives on `LinkPreview.url`.
24
- *
25
- * The `LinkPreview` / `LinkPreviewBatchResponse` exports are declared as explicit
26
- * `interface`s (with their runtime schemas annotated `z.ZodType<Interface>`),
27
- * following the same rationale as `UserNameResponse` in `./userResponse`: a
28
- * `z.infer<>` of a nested-object schema can degrade to `{}` under a consumer's
29
- * `moduleResolution: "node"` (node10) resolution. A literal interface emits the
30
- * field types verbatim in the `.d.ts` and survives BOTH `node` and `bundler`
31
- * resolution. The flat batch-request schema (no nested-object hazard) is inferred
32
- * via `z.infer<>`.
33
- *
34
- * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
35
- * `require()`).
36
- */
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.linkPreviewResponseSchema = exports.linkPreviewBatchResponseSchema = exports.linkPreviewBatchRequestSchema = exports.linkPreviewSchema = void 0;
39
- const zod_1 = require("zod");
40
- exports.linkPreviewSchema = zod_1.z.object({
41
- url: zod_1.z.string(),
42
- status: zod_1.z.enum(['resolved', 'pending', 'empty']),
43
- title: zod_1.z.string().optional(),
44
- description: zod_1.z.string().optional(),
45
- image: zod_1.z.string().optional(),
46
- siteName: zod_1.z.string().optional(),
47
- favicon: zod_1.z.string().optional(),
48
- resolvedAt: zod_1.z.string().optional(),
49
- });
50
- /* -------------------------------------------------------------------------- */
51
- /* Batch request / response */
52
- /* -------------------------------------------------------------------------- */
53
- /**
54
- * Request body for the batch unfurl endpoint. Between 1 and 50 URLs per call;
55
- * the server resolves each (returning a `'pending'` placeholder for any URL it
56
- * has not seen before and is fetching in the background).
57
- */
58
- exports.linkPreviewBatchRequestSchema = zod_1.z.object({
59
- urls: zod_1.z.array(zod_1.z.string().max(2048)).min(1).max(50),
60
- });
61
- exports.linkPreviewBatchResponseSchema = zod_1.z.object({
62
- data: zod_1.z.record(zod_1.z.string(), exports.linkPreviewSchema),
63
- });
64
- /**
65
- * Wire shape of the single-URL unfurl lookup (`GET`) — a bare
66
- * {@link LinkPreview}.
67
- */
68
- exports.linkPreviewResponseSchema = exports.linkPreviewSchema;
package/dist/esm/links.js DELETED
@@ -1,65 +0,0 @@
1
- /**
2
- * Link-preview / unfurl API contracts.
3
- *
4
- * SINGLE SOURCE OF TRUTH for the wire shape of Oxy's link-preview ("unfurl")
5
- * resolution surface: the single `GET` lookup and the `POST` batch lookup that
6
- * every app calls through the SDK so apps stop duplicating their own
7
- * link-metadata fetching. The API validates its OUTPUT against these schemas;
8
- * every consumer (`@oxy.so/core`'s link mixin and the apps that call it)
9
- * validates its INPUT against the same definitions, so producer and consumers
10
- * cannot drift.
11
- *
12
- * Design anchors:
13
- * - Oxy owns resolution. The `image` (and `favicon`) URLs a preview carries are
14
- * re-hosted on Oxy media (`cloud.oxy.so/<fileId>`), never raw remote URLs —
15
- * apps render them directly with no per-app proxy.
16
- * - Resolution is best-effort and asynchronous. A preview is `'resolved'` once
17
- * metadata is materialised, `'pending'` while a first-seen URL is being
18
- * fetched in the background, or `'empty'` when the target yielded no usable
19
- * metadata. `resolvedAt` (ISO datetime) is present only once `'resolved'`.
20
- * - The batch response is keyed by the REQUESTED url (the exact string the
21
- * caller sent), not the canonical/final URL, so a caller can always look its
22
- * own input back up; the canonical URL lives on `LinkPreview.url`.
23
- *
24
- * The `LinkPreview` / `LinkPreviewBatchResponse` exports are declared as explicit
25
- * `interface`s (with their runtime schemas annotated `z.ZodType<Interface>`),
26
- * following the same rationale as `UserNameResponse` in `./userResponse`: a
27
- * `z.infer<>` of a nested-object schema can degrade to `{}` under a consumer's
28
- * `moduleResolution: "node"` (node10) resolution. A literal interface emits the
29
- * field types verbatim in the `.d.ts` and survives BOTH `node` and `bundler`
30
- * resolution. The flat batch-request schema (no nested-object hazard) is inferred
31
- * 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
- export const linkPreviewSchema = z.object({
38
- url: z.string(),
39
- status: z.enum(['resolved', 'pending', 'empty']),
40
- title: z.string().optional(),
41
- description: z.string().optional(),
42
- image: z.string().optional(),
43
- siteName: z.string().optional(),
44
- favicon: z.string().optional(),
45
- resolvedAt: z.string().optional(),
46
- });
47
- /* -------------------------------------------------------------------------- */
48
- /* Batch request / response */
49
- /* -------------------------------------------------------------------------- */
50
- /**
51
- * Request body for the batch unfurl endpoint. Between 1 and 50 URLs per call;
52
- * the server resolves each (returning a `'pending'` placeholder for any URL it
53
- * has not seen before and is fetching in the background).
54
- */
55
- export const linkPreviewBatchRequestSchema = z.object({
56
- urls: z.array(z.string().max(2048)).min(1).max(50),
57
- });
58
- export const linkPreviewBatchResponseSchema = z.object({
59
- data: z.record(z.string(), linkPreviewSchema),
60
- });
61
- /**
62
- * Wire shape of the single-URL unfurl lookup (`GET`) — a bare
63
- * {@link LinkPreview}.
64
- */
65
- export const linkPreviewResponseSchema = linkPreviewSchema;
@@ -1,96 +0,0 @@
1
- /**
2
- * Link-preview / unfurl API contracts.
3
- *
4
- * SINGLE SOURCE OF TRUTH for the wire shape of Oxy's link-preview ("unfurl")
5
- * resolution surface: the single `GET` lookup and the `POST` batch lookup that
6
- * every app calls through the SDK so apps stop duplicating their own
7
- * link-metadata fetching. The API validates its OUTPUT against these schemas;
8
- * every consumer (`@oxy.so/core`'s link mixin and the apps that call it)
9
- * validates its INPUT against the same definitions, so producer and consumers
10
- * cannot drift.
11
- *
12
- * Design anchors:
13
- * - Oxy owns resolution. The `image` (and `favicon`) URLs a preview carries are
14
- * re-hosted on Oxy media (`cloud.oxy.so/<fileId>`), never raw remote URLs —
15
- * apps render them directly with no per-app proxy.
16
- * - Resolution is best-effort and asynchronous. A preview is `'resolved'` once
17
- * metadata is materialised, `'pending'` while a first-seen URL is being
18
- * fetched in the background, or `'empty'` when the target yielded no usable
19
- * metadata. `resolvedAt` (ISO datetime) is present only once `'resolved'`.
20
- * - The batch response is keyed by the REQUESTED url (the exact string the
21
- * caller sent), not the canonical/final URL, so a caller can always look its
22
- * own input back up; the canonical URL lives on `LinkPreview.url`.
23
- *
24
- * The `LinkPreview` / `LinkPreviewBatchResponse` exports are declared as explicit
25
- * `interface`s (with their runtime schemas annotated `z.ZodType<Interface>`),
26
- * following the same rationale as `UserNameResponse` in `./userResponse`: a
27
- * `z.infer<>` of a nested-object schema can degrade to `{}` under a consumer's
28
- * `moduleResolution: "node"` (node10) resolution. A literal interface emits the
29
- * field types verbatim in the `.d.ts` and survives BOTH `node` and `bundler`
30
- * resolution. The flat batch-request schema (no nested-object hazard) is inferred
31
- * 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
- /**
38
- * Resolution state of a {@link LinkPreview}.
39
- *
40
- * - `resolved` — metadata materialised; `resolvedAt` is present.
41
- * - `pending` — a first-seen URL is being fetched in the background; metadata
42
- * fields and `resolvedAt` may be absent. The caller may re-fetch shortly.
43
- * - `empty` — the target yielded no usable metadata (e.g. a bare binary, a
44
- * 404, or an opted-out host); the negative result is cached.
45
- */
46
- export type LinkPreviewStatus = 'resolved' | 'pending' | 'empty';
47
- /**
48
- * A single resolved (or in-flight) link preview.
49
- *
50
- * `url` is the canonical / final resolved URL (after redirects). The optional
51
- * metadata fields are present on a best-effort basis once `status` is
52
- * `'resolved'`. `image` and `favicon` are absolute Oxy-hosted
53
- * (`cloud.oxy.so/<fileId>`) URLs — render them directly, never proxy them.
54
- */
55
- export interface LinkPreview {
56
- /** Canonical / final resolved URL (after following redirects). */
57
- url: string;
58
- status: LinkPreviewStatus;
59
- title?: string;
60
- description?: string;
61
- /** Absolute Oxy-hosted (`cloud.oxy.so`) image URL. */
62
- image?: string;
63
- siteName?: string;
64
- /** Absolute Oxy-hosted (`cloud.oxy.so`) favicon URL. */
65
- favicon?: string;
66
- /** ISO 8601 datetime of resolution; absent while `status` is `'pending'`. */
67
- resolvedAt?: string;
68
- }
69
- export declare const linkPreviewSchema: z.ZodType<LinkPreview>;
70
- /**
71
- * Request body for the batch unfurl endpoint. Between 1 and 50 URLs per call;
72
- * the server resolves each (returning a `'pending'` placeholder for any URL it
73
- * has not seen before and is fetching in the background).
74
- */
75
- export declare const linkPreviewBatchRequestSchema: z.ZodObject<{
76
- urls: z.ZodArray<z.ZodString, "many">;
77
- }, "strip", z.ZodTypeAny, {
78
- urls: string[];
79
- }, {
80
- urls: string[];
81
- }>;
82
- export type LinkPreviewBatchRequest = z.infer<typeof linkPreviewBatchRequestSchema>;
83
- /**
84
- * Batch unfurl response. `data` is keyed by the REQUESTED url (the exact string
85
- * the caller sent in `urls`), so a caller can always look its own input back up;
86
- * the canonical/final URL is on each {@link LinkPreview}'s `url` field.
87
- */
88
- export interface LinkPreviewBatchResponse {
89
- data: Record<string, LinkPreview>;
90
- }
91
- export declare const linkPreviewBatchResponseSchema: z.ZodType<LinkPreviewBatchResponse>;
92
- /**
93
- * Wire shape of the single-URL unfurl lookup (`GET`) — a bare
94
- * {@link LinkPreview}.
95
- */
96
- export declare const linkPreviewResponseSchema: z.ZodType<LinkPreview, z.ZodTypeDef, LinkPreview>;