@oxyhq/contracts 0.13.1 → 0.14.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,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
+ });
package/dist/cjs/index.js CHANGED
@@ -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.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = 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 = 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 = 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; } });
@@ -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(),
@@ -56,7 +57,7 @@ exports.userNameSchema = zod_1.z
56
57
  *
57
58
  * `.passthrough()` keeps the large tail of profile fields
58
59
  * (`privacySettings`, `locations`, `links`, `linksMetadata`, `bio`,
59
- * `description`, `language`, `verified`, timestamps, …) available to callers
60
+ * `description`, `languages`, `verified`, timestamps, …) available to callers
60
61
  * that need them without enumerating every nested shape here — the load-bearing
61
62
  * identity/display fields are the ones we pin precisely.
62
63
  */
@@ -78,7 +79,13 @@ exports.userResponseSchema = zod_1.z
78
79
  color: zod_1.z.string().nullable().optional(),
79
80
  name: exports.userNameSchema,
80
81
  verified: zod_1.z.boolean().optional(),
81
- language: zod_1.z.string().optional(),
82
+ /**
83
+ * The account's languages as full BCP-47 locales (`language-REGION`,
84
+ * e.g. `es-ES`, `en-US`, `pt-BR`), ordered with the PRIMARY (UI) locale
85
+ * first. `languages[0]` is the primary locale — there is no singular
86
+ * `language` field.
87
+ */
88
+ languages: zod_1.z.array(zod_1.z.string()).optional(),
82
89
  /**
83
90
  * The account's self-sovereign identifier
84
91
  * (`did:web:<FEDERATION_DOMAIN>:u:<userId>`). Surfaced as a `User`
@@ -90,6 +97,11 @@ exports.userResponseSchema = zod_1.z
90
97
  * entry; present only when the account has verified at least one domain.
91
98
  */
92
99
  verifiedDomains: zod_1.z.array(identity_1.verifiedDomainSchema).optional(),
100
+ /**
101
+ * Real-estate / team taxonomy for `kind: 'organization'` accounts.
102
+ * Absent on personal, project, and bot accounts.
103
+ */
104
+ organizationCategory: accountGraph_1.organizationCategorySchema.optional(),
93
105
  })
94
106
  .passthrough();
95
107
  exports.userProfileUpdateSchema = zod_1.z
@@ -120,7 +132,12 @@ exports.userProfileUpdateSchema = zod_1.z
120
132
  id: zod_1.z.string().optional(),
121
133
  }))
122
134
  .optional(),
123
- language: zod_1.z.string().optional(),
135
+ /**
136
+ * Ordered account locales (`language-REGION`), primary first. Replaces
137
+ * the eliminated singular `language`; `languages[0]` is the primary UI
138
+ * locale.
139
+ */
140
+ languages: zod_1.z.array(zod_1.z.string()).optional(),
124
141
  accountExpiresAfterInactivityDays: zod_1.z.number().nullable().optional(),
125
142
  notificationPreferences: zod_1.z.record(zod_1.z.unknown()).optional(),
126
143
  userPreferences: zod_1.z.record(zod_1.z.unknown()).optional(),