@oxyhq/contracts 0.13.2 → 0.14.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deviceHubTicketRedeemResponseSchema = exports.deviceHubTicketRedeemRequestSchema = exports.deviceHubTicketIssueResponseSchema = exports.deviceHubTicketIssueRequestSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = void 0;
3
+ exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = 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(),
@@ -72,3 +72,44 @@ exports.deviceHubTicketRedeemResponseSchema = zod_1.z.object({
72
72
  deviceId: zod_1.z.string().min(1),
73
73
  deviceSecret: zod_1.z.string().min(1),
74
74
  });
75
+ /* -------------------------------------------------------------------------- */
76
+ /* Instant cross-app session sync (token-free socket signal) */
77
+ /* -------------------------------------------------------------------------- */
78
+ /**
79
+ * Name of the token-free Socket.IO event emitted to room `user:<userId>` on
80
+ * every DeviceSession mutation that changes what is signed in for that user.
81
+ *
82
+ * This is a pure SIGNAL — it carries NO access token, NO deviceSecret and NO
83
+ * account bodies. A client that receives it re-fetches its authenticated
84
+ * session/account state (`GET /session/device/state`, `GET /accounts`). Unlike
85
+ * `session_state` (scoped to `device:<deviceId>`, i.e. a single origin), this
86
+ * reaches ALL of a user's connected sockets across their devices/origins so
87
+ * every Oxy app reflects an add / switch / signout instantly.
88
+ */
89
+ exports.SESSION_ACCOUNTS_CHANGED_EVENT = 'session_accounts_changed';
90
+ /**
91
+ * Why the signed-in set changed:
92
+ * - `login` — a brand-new session was minted for the user (QR / cross-app authorize)
93
+ * - `add` — an account was registered onto a device set
94
+ * - `switch` — the active account on a device changed
95
+ * - `signout` — one or all accounts were signed out of a device
96
+ * - `revoke` — a dead/revoked account was healed out of a device set
97
+ */
98
+ exports.sessionAccountsChangedReasonSchema = zod_1.z.enum([
99
+ 'login',
100
+ 'add',
101
+ 'switch',
102
+ 'signout',
103
+ 'revoke',
104
+ ]);
105
+ /**
106
+ * Payload of {@link SESSION_ACCOUNTS_CHANGED_EVENT}. `revision` is the mutated
107
+ * DeviceSession revision for device-scoped reasons (`add`/`switch`/`signout`/
108
+ * `revoke`); for `login` (no device mutation at emit time) it is `0`. The
109
+ * payload is deliberately minimal and secret-free — the client refetches.
110
+ */
111
+ exports.sessionAccountsChangedEventSchema = zod_1.z.object({
112
+ userId: zod_1.z.string(),
113
+ revision: zod_1.z.number().int().nonnegative(),
114
+ reason: exports.sessionAccountsChangedReasonSchema,
115
+ });
package/dist/cjs/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
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;
15
+ exports.loginResultSchema = exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = 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
16
  var accountGraph_1 = require("./accountGraph");
17
17
  Object.defineProperty(exports, "ORGANIZATION_CATEGORIES", { enumerable: true, get: function () { return accountGraph_1.ORGANIZATION_CATEGORIES; } });
18
18
  Object.defineProperty(exports, "organizationCategorySchema", { enumerable: true, get: function () { return accountGraph_1.organizationCategorySchema; } });
@@ -106,6 +106,9 @@ Object.defineProperty(exports, "deviceHubTicketIssueRequestSchema", { enumerable
106
106
  Object.defineProperty(exports, "deviceHubTicketIssueResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketIssueResponseSchema; } });
107
107
  Object.defineProperty(exports, "deviceHubTicketRedeemRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketRedeemRequestSchema; } });
108
108
  Object.defineProperty(exports, "deviceHubTicketRedeemResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketRedeemResponseSchema; } });
109
+ Object.defineProperty(exports, "SESSION_ACCOUNTS_CHANGED_EVENT", { enumerable: true, get: function () { return deviceSession_1.SESSION_ACCOUNTS_CHANGED_EVENT; } });
110
+ Object.defineProperty(exports, "sessionAccountsChangedReasonSchema", { enumerable: true, get: function () { return deviceSession_1.sessionAccountsChangedReasonSchema; } });
111
+ Object.defineProperty(exports, "sessionAccountsChangedEventSchema", { enumerable: true, get: function () { return deviceSession_1.sessionAccountsChangedEventSchema; } });
109
112
  var deviceBoot_1 = require("./deviceBoot");
110
113
  // Schemas
111
114
  Object.defineProperty(exports, "loginResultSchema", { enumerable: true, get: function () { return deviceBoot_1.loginResultSchema; } });
@@ -57,7 +57,7 @@ exports.userNameSchema = zod_1.z
57
57
  *
58
58
  * `.passthrough()` keeps the large tail of profile fields
59
59
  * (`privacySettings`, `locations`, `links`, `linksMetadata`, `bio`,
60
- * `description`, `language`, `verified`, timestamps, …) available to callers
60
+ * `description`, `languages`, `verified`, timestamps, …) available to callers
61
61
  * that need them without enumerating every nested shape here — the load-bearing
62
62
  * identity/display fields are the ones we pin precisely.
63
63
  */
@@ -79,7 +79,13 @@ exports.userResponseSchema = zod_1.z
79
79
  color: zod_1.z.string().nullable().optional(),
80
80
  name: exports.userNameSchema,
81
81
  verified: zod_1.z.boolean().optional(),
82
- 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(),
83
89
  /**
84
90
  * The account's self-sovereign identifier
85
91
  * (`did:web:<FEDERATION_DOMAIN>:u:<userId>`). Surfaced as a `User`
@@ -126,7 +132,12 @@ exports.userProfileUpdateSchema = zod_1.z
126
132
  id: zod_1.z.string().optional(),
127
133
  }))
128
134
  .optional(),
129
- 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(),
130
141
  accountExpiresAfterInactivityDays: zod_1.z.number().nullable().optional(),
131
142
  notificationPreferences: zod_1.z.record(zod_1.z.unknown()).optional(),
132
143
  userPreferences: zod_1.z.record(zod_1.z.unknown()).optional(),