@oxyhq/contracts 0.13.0 → 0.13.2
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/accountGraph.js +48 -0
- package/dist/cjs/deviceSession.js +23 -1
- package/dist/cjs/index.js +11 -6
- package/dist/cjs/userResponse.js +7 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/accountGraph.js +45 -0
- package/dist/esm/deviceSession.js +22 -0
- package/dist/esm/index.js +3 -5
- package/dist/esm/userResponse.js +7 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/accountGraph.d.ts +83 -0
- package/dist/types/deviceSession.d.ts +45 -0
- package/dist/types/identity.d.ts +4 -4
- package/dist/types/index.d.ts +5 -5
- package/dist/types/sessionStatus.d.ts +6 -6
- package/dist/types/userResponse.d.ts +93 -11
- package/package.json +1 -1
- package/dist/cjs/fedcmToken.js +0 -66
- package/dist/esm/fedcmToken.js +0 -63
- package/dist/types/fedcmToken.d.ts +0 -90
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Account graph wire contracts — organization taxonomy and create-account input.
|
|
4
|
+
*
|
|
5
|
+
* `organizationCategory` classifies `kind: 'organization'` accounts (agency,
|
|
6
|
+
* cooperative, landlord, …) without polluting `User.kind`. Meaningful only when
|
|
7
|
+
* `kind === 'organization'`.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createAccountRequestSchema = exports.organizationCategorySchema = exports.ORGANIZATION_CATEGORIES = void 0;
|
|
11
|
+
const zod_1 = require("zod");
|
|
12
|
+
exports.ORGANIZATION_CATEGORIES = [
|
|
13
|
+
'agency',
|
|
14
|
+
'cooperative',
|
|
15
|
+
'landlord',
|
|
16
|
+
'other',
|
|
17
|
+
];
|
|
18
|
+
exports.organizationCategorySchema = zod_1.z.enum(exports.ORGANIZATION_CATEGORIES);
|
|
19
|
+
const accountNameSchema = zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
first: zod_1.z.string().trim().max(100).optional(),
|
|
22
|
+
last: zod_1.z.string().trim().max(100).optional(),
|
|
23
|
+
})
|
|
24
|
+
.optional();
|
|
25
|
+
/**
|
|
26
|
+
* POST /accounts — create a non-personal account under the caller's tree.
|
|
27
|
+
* `organizationCategory` is accepted only when `kind` is `organization`.
|
|
28
|
+
*/
|
|
29
|
+
exports.createAccountRequestSchema = zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
parentAccountId: zod_1.z.string().trim().min(1).optional(),
|
|
32
|
+
kind: zod_1.z.enum(['organization', 'project', 'bot']),
|
|
33
|
+
username: zod_1.z.string().trim().min(1).max(100),
|
|
34
|
+
name: accountNameSchema,
|
|
35
|
+
bio: zod_1.z.string().trim().max(500).optional(),
|
|
36
|
+
avatar: zod_1.z.string().optional(),
|
|
37
|
+
description: zod_1.z.string().trim().max(1000).optional(),
|
|
38
|
+
organizationCategory: exports.organizationCategorySchema.optional(),
|
|
39
|
+
})
|
|
40
|
+
.superRefine((data, ctx) => {
|
|
41
|
+
if (data.organizationCategory !== undefined && data.kind !== 'organization') {
|
|
42
|
+
ctx.addIssue({
|
|
43
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
44
|
+
message: 'organizationCategory applies only when kind is organization',
|
|
45
|
+
path: ['organizationCategory'],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = void 0;
|
|
3
|
+
exports.deviceHubTicketRedeemResponseSchema = exports.deviceHubTicketRedeemRequestSchema = exports.deviceHubTicketIssueResponseSchema = exports.deviceHubTicketIssueRequestSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.sessionAccountSchema = zod_1.z.object({
|
|
6
6
|
accountId: zod_1.z.string(),
|
|
@@ -50,3 +50,25 @@ exports.deviceTokenMintResponseSchema = zod_1.z.object({
|
|
|
50
50
|
nextDeviceSecret: zod_1.z.string(),
|
|
51
51
|
state: exports.deviceSessionStateSchema,
|
|
52
52
|
});
|
|
53
|
+
/* -------------------------------------------------------------------------- */
|
|
54
|
+
/* Hub ticket — server-side cross-origin device credential sync */
|
|
55
|
+
/* -------------------------------------------------------------------------- */
|
|
56
|
+
/** Request body for `POST /session/device/hub-ticket`. */
|
|
57
|
+
exports.deviceHubTicketIssueRequestSchema = zod_1.z.object({
|
|
58
|
+
returnOrigin: zod_1.z.string().min(1),
|
|
59
|
+
});
|
|
60
|
+
/** Response from `POST /session/device/hub-ticket`. */
|
|
61
|
+
exports.deviceHubTicketIssueResponseSchema = zod_1.z.object({
|
|
62
|
+
ticket: zod_1.z.string().min(1),
|
|
63
|
+
expiresIn: zod_1.z.number().int().positive(),
|
|
64
|
+
});
|
|
65
|
+
/** Request body for `POST /session/device/redeem-ticket`. */
|
|
66
|
+
exports.deviceHubTicketRedeemRequestSchema = zod_1.z.object({
|
|
67
|
+
ticket: zod_1.z.string().min(1),
|
|
68
|
+
returnOrigin: zod_1.z.string().min(1),
|
|
69
|
+
});
|
|
70
|
+
/** Response from `POST /session/device/redeem-ticket`. */
|
|
71
|
+
exports.deviceHubTicketRedeemResponseSchema = zod_1.z.object({
|
|
72
|
+
deviceId: zod_1.z.string().min(1),
|
|
73
|
+
deviceSecret: zod_1.z.string().min(1),
|
|
74
|
+
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @oxyhq/contracts — single source of truth for API request/response contracts.
|
|
4
4
|
*
|
|
5
5
|
* Zod schemas plus their inferred types, shared by the backend (`@oxyhq/api`)
|
|
6
|
-
* and the client SDKs (`@oxyhq/core`, `@oxyhq/
|
|
6
|
+
* and the client SDKs (`@oxyhq/core`, `@oxyhq/services`). The
|
|
7
7
|
* producer validates its output and every consumer validates its input against
|
|
8
8
|
* exactly the same definitions, so the wire shape cannot drift.
|
|
9
9
|
*
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
* expo, no `require()` in the ESM build.
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
15
|
-
exports.loginResultSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = exports.linkPreviewResponseSchema = exports.linkPreviewBatchResponseSchema = exports.linkPreviewBatchRequestSchema = exports.linkPreviewSchema = exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = void 0;
|
|
14
|
+
exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = exports.logPageResponseSchema = exports.chainHeadResponseSchema = exports.oxySignedRecordTypeSchema = exports.exportBundleSchema = exports.exportAttestationSchema = exports.authMethodsResponseSchema = exports.authMethodEntrySchema = exports.domainVerificationInstructionsSchema = exports.domainVerificationRequestSchema = exports.verifiedDomainSchema = exports.signedRecordEnvelopeSchema = exports.didDocumentSchema = exports.didServiceSchema = exports.verificationMethodSchema = exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = exports.sessionStatusSchema = exports.publicApplicationSchema = exports.applicationTypeSchema = exports.safeParseContract = exports.resolveUserId = exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.userNameSchema = exports.createAccountRequestSchema = exports.organizationCategorySchema = exports.ORGANIZATION_CATEGORIES = void 0;
|
|
15
|
+
exports.loginResultSchema = exports.deviceHubTicketRedeemResponseSchema = exports.deviceHubTicketRedeemRequestSchema = exports.deviceHubTicketIssueResponseSchema = exports.deviceHubTicketIssueRequestSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = exports.linkPreviewResponseSchema = exports.linkPreviewBatchResponseSchema = exports.linkPreviewBatchRequestSchema = exports.linkPreviewSchema = exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = void 0;
|
|
16
|
+
var accountGraph_1 = require("./accountGraph");
|
|
17
|
+
Object.defineProperty(exports, "ORGANIZATION_CATEGORIES", { enumerable: true, get: function () { return accountGraph_1.ORGANIZATION_CATEGORIES; } });
|
|
18
|
+
Object.defineProperty(exports, "organizationCategorySchema", { enumerable: true, get: function () { return accountGraph_1.organizationCategorySchema; } });
|
|
19
|
+
Object.defineProperty(exports, "createAccountRequestSchema", { enumerable: true, get: function () { return accountGraph_1.createAccountRequestSchema; } });
|
|
16
20
|
var userResponse_1 = require("./userResponse");
|
|
17
21
|
// Schemas
|
|
18
22
|
Object.defineProperty(exports, "userNameSchema", { enumerable: true, get: function () { return userResponse_1.userNameSchema; } });
|
|
@@ -29,9 +33,6 @@ var sessionStatus_1 = require("./sessionStatus");
|
|
|
29
33
|
Object.defineProperty(exports, "applicationTypeSchema", { enumerable: true, get: function () { return sessionStatus_1.applicationTypeSchema; } });
|
|
30
34
|
Object.defineProperty(exports, "publicApplicationSchema", { enumerable: true, get: function () { return sessionStatus_1.publicApplicationSchema; } });
|
|
31
35
|
Object.defineProperty(exports, "sessionStatusSchema", { enumerable: true, get: function () { return sessionStatus_1.sessionStatusSchema; } });
|
|
32
|
-
var fedcmToken_1 = require("./fedcmToken");
|
|
33
|
-
// Schemas
|
|
34
|
-
Object.defineProperty(exports, "fedcmTokenPayloadSchema", { enumerable: true, get: function () { return fedcmToken_1.fedcmTokenPayloadSchema; } });
|
|
35
36
|
var recommendations_1 = require("./recommendations");
|
|
36
37
|
// Schemas
|
|
37
38
|
Object.defineProperty(exports, "recommendationExcludeTypeSchema", { enumerable: true, get: function () { return recommendations_1.recommendationExcludeTypeSchema; } });
|
|
@@ -101,6 +102,10 @@ Object.defineProperty(exports, "activeTokenSchema", { enumerable: true, get: fun
|
|
|
101
102
|
Object.defineProperty(exports, "deviceSessionSyncSchema", { enumerable: true, get: function () { return deviceSession_1.deviceSessionSyncSchema; } });
|
|
102
103
|
Object.defineProperty(exports, "deviceTokenMintRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceTokenMintRequestSchema; } });
|
|
103
104
|
Object.defineProperty(exports, "deviceTokenMintResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceTokenMintResponseSchema; } });
|
|
105
|
+
Object.defineProperty(exports, "deviceHubTicketIssueRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketIssueRequestSchema; } });
|
|
106
|
+
Object.defineProperty(exports, "deviceHubTicketIssueResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketIssueResponseSchema; } });
|
|
107
|
+
Object.defineProperty(exports, "deviceHubTicketRedeemRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketRedeemRequestSchema; } });
|
|
108
|
+
Object.defineProperty(exports, "deviceHubTicketRedeemResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketRedeemResponseSchema; } });
|
|
104
109
|
var deviceBoot_1 = require("./deviceBoot");
|
|
105
110
|
// Schemas
|
|
106
111
|
Object.defineProperty(exports, "loginResultSchema", { enumerable: true, get: function () { return deviceBoot_1.loginResultSchema; } });
|
package/dist/cjs/userResponse.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* This package (`@oxyhq/contracts`) is the dedicated, zero-dependency home for
|
|
14
14
|
* these contracts so the backend (`@oxyhq/api`) and the client SDKs
|
|
15
|
-
* (`@oxyhq/core`, `@oxyhq/
|
|
15
|
+
* (`@oxyhq/core`, `@oxyhq/services`) can all depend on it without
|
|
16
16
|
* the backend having to depend on a client SDK to obtain its schemas.
|
|
17
17
|
*
|
|
18
18
|
* Faithful to the producers:
|
|
@@ -35,6 +35,7 @@ exports.resolveUserId = resolveUserId;
|
|
|
35
35
|
exports.safeParseContract = safeParseContract;
|
|
36
36
|
const zod_1 = require("zod");
|
|
37
37
|
const identity_1 = require("./identity");
|
|
38
|
+
const accountGraph_1 = require("./accountGraph");
|
|
38
39
|
exports.userNameSchema = zod_1.z
|
|
39
40
|
.object({
|
|
40
41
|
first: zod_1.z.string().optional(),
|
|
@@ -90,6 +91,11 @@ exports.userResponseSchema = zod_1.z
|
|
|
90
91
|
* entry; present only when the account has verified at least one domain.
|
|
91
92
|
*/
|
|
92
93
|
verifiedDomains: zod_1.z.array(identity_1.verifiedDomainSchema).optional(),
|
|
94
|
+
/**
|
|
95
|
+
* Real-estate / team taxonomy for `kind: 'organization'` accounts.
|
|
96
|
+
* Absent on personal, project, and bot accounts.
|
|
97
|
+
*/
|
|
98
|
+
organizationCategory: accountGraph_1.organizationCategorySchema.optional(),
|
|
93
99
|
})
|
|
94
100
|
.passthrough();
|
|
95
101
|
exports.userProfileUpdateSchema = zod_1.z
|