@oxy.so/contracts 6.7.0 → 6.9.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.
@@ -32,9 +32,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.signedRecordEnvelopeCheck = exports.externalIdentityReferenceCheck = exports.loginResultCheck = exports.isLoopbackOrigin = exports.executeAgentKeyOperationCheck = exports.agentVerifyRequestCheck = exports.agentProofClaimsCheck = exports.agentKeyOperationResultCheck = exports.agentKeyOperationCheck = exports.agentKeyOperationChallengeCheck = exports.agentKeyListResponseCheck = exports.agentChallengeRequestCheck = exports.AGENT_PROOF_TTL_MS = exports.AGENT_PROOF_AUDIENCE = exports.AGENT_PROOF_ACTIONS = exports.ACCOUNT_AUTH_METHODS = exports.emailVerificationStartResponseCheck = exports.emailVerificationConfirmResponseCheck = exports.emailTicketCheck = exports.emailAddressCheck = exports.EMAIL_VERIFICATION_PURPOSES = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_LENGTH = exports.isPlainTextTitle = exports.accountTitleCheck = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = exports.newlyAddedRetiredCategories = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.isOperatorSwitchTargetKind = exports.isMemberOperatedKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.MAX_ACCOUNT_CATEGORIES = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.parseContract = exports.formatCheckPath = exports.checkContract = exports.ContractCheckError = void 0;
34
34
  exports.organizationCurationResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimInputCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationCheck = exports.organizationBatchCheck = exports.createOrganizationCheck = exports.ORGANIZATION_TYPES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.canonicalJson = exports.buildIdentityProofMessage = exports.IDENTITY_PROOF_VERSION = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_ERROR_CODES = exports.parseIdentityLinkQrPayload = exports.identityLinkStateCheck = exports.identityLinkCreateResponseCheck = exports.buildIdentityLinkQrPayload = exports.IDENTITY_LINK_STATUSES = exports.IDENTITY_LINK_QR_PREFIX = exports.sessionAccountsChangedEventCheck = exports.deviceTokenMintResponseCheck = exports.deviceSessionSyncCheck = exports.deviceSessionStateCheck = exports.deviceRegisterResponseCheck = exports.deviceJoinResponseCheck = exports.deviceJoinCodeResponseCheck = exports.holderContextEvidenceV1ResponseCheck = exports.holderContextEvidenceV1RequestCheck = exports.deviceContextTokenV1ResponseCheck = exports.deviceContextTokenV1RequestCheck = exports.deviceBackgroundCredentialResponseCheck = exports.activeTokenCheck = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceDirectorySyncCheck = exports.deviceDirectoryCheck = exports.deviceActivateResponseCheck = exports.normalizeDomainName = exports.DOMAIN_NAME_MAX_LENGTH = void 0;
35
- exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISION_CHANGED_EVENT = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionRenewalRequestCheck = exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = void 0;
36
- exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.SIGN_IN_IDENTIFIER_MAX_LENGTH = exports.SECOND_FACTOR_CODE_MAX_LENGTH = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = void 0;
37
- exports.isLanguageTag = exports.hasCampaignControlCharacters = exports.CAMPAIGN_CLICK_ID_MAX_LENGTH = exports.CAMPAIGN_LABEL_MAX_LENGTH = exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = void 0;
35
+ exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISION_CHANGED_EVENT = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionPortalResponseCheck = exports.productSubscriptionPortalRequestCheck = exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = void 0;
36
+ exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.SIGN_IN_IDENTIFIER_MAX_LENGTH = exports.SECOND_FACTOR_CODE_MAX_LENGTH = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = void 0;
37
+ exports.isLanguageTag = exports.hasCampaignControlCharacters = exports.CAMPAIGN_CLICK_ID_MAX_LENGTH = exports.CAMPAIGN_LABEL_MAX_LENGTH = exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = void 0;
38
38
  var check_1 = require("./check");
39
39
  Object.defineProperty(exports, "ContractCheckError", { enumerable: true, get: function () { return check_1.ContractCheckError; } });
40
40
  Object.defineProperty(exports, "checkContract", { enumerable: true, get: function () { return check_1.checkContract; } });
@@ -164,7 +164,8 @@ Object.defineProperty(exports, "personalPlanCheckoutResultCheck", { enumerable:
164
164
  Object.defineProperty(exports, "productPlanCatalogueCheck", { enumerable: true, get: function () { return products_1.productPlanCatalogueCheck; } });
165
165
  Object.defineProperty(exports, "productPlanCheckoutRequestCheck", { enumerable: true, get: function () { return products_1.productPlanCheckoutRequestCheck; } });
166
166
  Object.defineProperty(exports, "productSubscriptionCancellationResultCheck", { enumerable: true, get: function () { return products_1.productSubscriptionCancellationResultCheck; } });
167
- Object.defineProperty(exports, "productSubscriptionRenewalRequestCheck", { enumerable: true, get: function () { return products_1.productSubscriptionRenewalRequestCheck; } });
167
+ Object.defineProperty(exports, "productSubscriptionPortalRequestCheck", { enumerable: true, get: function () { return products_1.productSubscriptionPortalRequestCheck; } });
168
+ Object.defineProperty(exports, "productSubscriptionPortalResponseCheck", { enumerable: true, get: function () { return products_1.productSubscriptionPortalResponseCheck; } });
168
169
  Object.defineProperty(exports, "productSubscriptionsResponseCheck", { enumerable: true, get: function () { return products_1.productSubscriptionsResponseCheck; } });
169
170
  Object.defineProperty(exports, "subjectProductAccessCheck", { enumerable: true, get: function () { return products_1.subjectProductAccessCheck; } });
170
171
  Object.defineProperty(exports, "subjectProductAccessQueryCheck", { enumerable: true, get: function () { return products_1.subjectProductAccessQueryCheck; } });
@@ -6,7 +6,7 @@
6
6
  * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.productSubscriptionCancellationResultCheck = exports.cancelProductSubscriptionCheck = exports.subscriptionCreditGrantsResponseCheck = exports.productSubscriptionsResponseCheck = exports.personalPlanCheckoutResultCheck = exports.productSubscriptionRenewalRequestCheck = exports.productPlanCheckoutRequestCheck = exports.personalPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCatalogueCheck = exports.subjectProductAccessCheck = exports.subjectProductAccessQueryCheck = void 0;
9
+ exports.productSubscriptionCancellationResultCheck = exports.cancelProductSubscriptionCheck = exports.subscriptionCreditGrantsResponseCheck = exports.productSubscriptionsResponseCheck = exports.personalPlanCheckoutResultCheck = exports.productSubscriptionPortalResponseCheck = exports.productSubscriptionPortalRequestCheck = exports.productPlanCheckoutRequestCheck = exports.personalPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCatalogueCheck = exports.subjectProductAccessCheck = exports.subjectProductAccessQueryCheck = void 0;
10
10
  const check_1 = require("./check");
11
11
  const identifier = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(160));
12
12
  const displayName = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(100));
@@ -100,11 +100,8 @@ const checkoutRequestShape = {
100
100
  };
101
101
  exports.personalPlanCheckoutRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)(checkoutRequestShape));
102
102
  exports.productPlanCheckoutRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({ ...checkoutRequestShape, productId: identifier }));
103
- exports.productSubscriptionRenewalRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({
104
- expectedSubjectAccountId: oxyAccountId,
105
- sourceId: identifier,
106
- idempotencyKey: actionKey,
107
- }));
103
+ exports.productSubscriptionPortalRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({ expectedSubjectAccountId: oxyAccountId, sourceId: identifier }));
104
+ exports.productSubscriptionPortalResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({ url: (0, check_1.string)(check_1.url, (0, check_1.startsWith)('https://')) }));
108
105
  exports.personalPlanCheckoutResultCheck = (0, check_1.exact)()((0, check_1.discriminatedUnion)('state', {
109
106
  unconfigured: (0, check_1.strictObject)({
110
107
  state: (0, check_1.literal)('unconfigured'),
@@ -135,7 +132,7 @@ exports.productSubscriptionsResponseCheck = (0, check_1.exact)()((0, check_1.str
135
132
  period: billingPeriod,
136
133
  cancelAtPeriodEnd: check_1.boolean,
137
134
  canCancel: check_1.boolean,
138
- canRenew: (0, check_1.optional)(check_1.boolean),
135
+ canManage: (0, check_1.optional)(check_1.boolean),
139
136
  offers: (0, check_1.array)((0, check_1.strictObject)({
140
137
  segmentId: identifier,
141
138
  offerId: identifier,
@@ -38,8 +38,30 @@ exports.resolveExternalIdentityResponseSchema = zod_1.z
38
38
  externalIdentity: exports.externalIdentityReferenceSchema.extend({ userId: zod_1.z.string() }),
39
39
  externalIdentities: zod_1.z.array(exports.externalIdentityReferenceSchema),
40
40
  redirectedUserIds: zod_1.z.array(zod_1.z.string()),
41
+ /**
42
+ * The source document Oxy fetched and verified for THIS answer: the
43
+ * ActivityPub actor (`id` is `externalIdentity.actorUri`) or the atproto
44
+ * `app.bsky.actor.getProfile` view (`did` is it). Present only when this
45
+ * request fetched the source — an `actorUri` resolve always does — and
46
+ * absent when the answer came from the registry. It is what the source
47
+ * said, bound to the actor by Oxy's verification, so a caller reads the
48
+ * fields Oxy does not keep (banner, counts, profile fields, flags, inbox and
49
+ * keys) from it instead of fetching the source again. Untrusted text: Oxy's
50
+ * own profile (`user`) is the normalized name, bio and avatar.
51
+ */
52
+ sourceDocument: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
41
53
  })
42
54
  .superRefine((value, context) => {
55
+ const document = value.sourceDocument;
56
+ if (document &&
57
+ (value.externalIdentity.protocol === 'atproto' ? document.did : document.id) !==
58
+ value.externalIdentity.actorUri) {
59
+ context.addIssue({
60
+ code: zod_1.z.ZodIssueCode.custom,
61
+ path: ['sourceDocument'],
62
+ message: 'Source document does not name the resolved actor',
63
+ });
64
+ }
43
65
  if (value.externalIdentity.userId !== value.user.id) {
44
66
  context.addIssue({
45
67
  code: zod_1.z.ZodIssueCode.custom,
@@ -29,7 +29,7 @@ exports.productSubscriptionSummarySchema = zod_1.z
29
29
  period,
30
30
  cancelAtPeriodEnd: zod_1.z.boolean(),
31
31
  canCancel: zod_1.z.boolean(),
32
- canRenew: zod_1.z.boolean().optional(),
32
+ canManage: zod_1.z.boolean().optional(),
33
33
  offers: zod_1.z.array(zod_1.z
34
34
  .object({
35
35
  segmentId: id,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.productSubscriptionRenewalRequestSchema = exports.productPlanCheckoutRequestSchema = exports.personalPlanCheckoutResultSchema = exports.personalPlanCheckoutRequestSchema = void 0;
3
+ exports.productSubscriptionPortalResponseSchema = exports.productSubscriptionPortalRequestSchema = exports.productPlanCheckoutRequestSchema = exports.personalPlanCheckoutResultSchema = exports.personalPlanCheckoutRequestSchema = void 0;
4
4
  const numberChecks_1 = require("../numberChecks");
5
5
  const stringChecks_1 = require("../stringChecks");
6
6
  const zod_1 = require("zod");
@@ -51,10 +51,14 @@ exports.productPlanCheckoutRequestSchema = exports.personalPlanCheckoutRequestSc
51
51
  productId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(160)),
52
52
  })
53
53
  .strict();
54
- exports.productSubscriptionRenewalRequestSchema = zod_1.z
54
+ /** Open the payment provider's customer portal for one named source the caller pays for. */
55
+ exports.productSubscriptionPortalRequestSchema = zod_1.z
55
56
  .object({
56
57
  expectedSubjectAccountId: identifiers_1.oxyAccountIdSchema,
57
58
  sourceId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(160)),
58
- idempotencyKey: exports.personalPlanCheckoutRequestSchema.shape.idempotencyKey,
59
59
  })
60
60
  .strict();
61
+ /** A short-lived portal URL; it opens the provider's page and grants nothing. */
62
+ exports.productSubscriptionPortalResponseSchema = zod_1.z
63
+ .object({ url: zod_1.z.string().check((0, stringChecks_1.urlCheck)()).startsWith('https://') })
64
+ .strict();
@@ -29,7 +29,7 @@ export { SESSION_ACCOUNTS_CHANGED_EVENT, activeTokenCheck, deviceBackgroundCrede
29
29
  export { IDENTITY_LINK_QR_PREFIX, IDENTITY_LINK_STATUSES, buildIdentityLinkQrPayload, identityLinkCreateResponseCheck, identityLinkStateCheck, parseIdentityLinkQrPayload, } from './identityLink.js';
30
30
  export { IDENTITY_ERROR_CODES, IDENTITY_PROOF_ACTIONS, IDENTITY_PROOF_ACTION_VALUES, IDENTITY_PROOF_AUDIENCE, IDENTITY_PROOF_CHALLENGE_TTL_MS, IDENTITY_PROOF_DOMAIN, IDENTITY_PROOF_VERSION, buildIdentityProofMessage, canonicalJson, } from './identityProof.js';
31
31
  export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CLAIM_STATUSES, ORGANIZATION_ERROR_CODES, ORGANIZATION_NAME_MAX_LENGTH, ORGANIZATION_STATUSES, ORGANIZATION_TYPES, createOrganizationCheck, organizationBatchCheck, organizationCheck, organizationClaimCheck, organizationClaimDetailCheck, organizationClaimInputCheck, organizationClaimListCheck, organizationClaimReviewCheck, organizationCurationResultCheck, organizationExternalCheck, organizationExternalResolutionCheck, organizationImportBatchResultCheck, organizationListCheck, organizationNameCheck, updateOrganizationCheck, } from './organizations.js';
32
- export { cancelProductSubscriptionCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionRenewalRequestCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products.js';
32
+ export { cancelProductSubscriptionCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products.js';
33
33
  export { recommendationRequestCheck } from './recommendations.js';
34
34
  export { isFullReputationBalance } from './reputation.js';
35
35
  export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety.js';
@@ -97,11 +97,8 @@ const checkoutRequestShape = {
97
97
  };
98
98
  export const personalPlanCheckoutRequestCheck = exact()(strictObject(checkoutRequestShape));
99
99
  export const productPlanCheckoutRequestCheck = exact()(strictObject({ ...checkoutRequestShape, productId: identifier }));
100
- export const productSubscriptionRenewalRequestCheck = exact()(strictObject({
101
- expectedSubjectAccountId: oxyAccountId,
102
- sourceId: identifier,
103
- idempotencyKey: actionKey,
104
- }));
100
+ export const productSubscriptionPortalRequestCheck = exact()(strictObject({ expectedSubjectAccountId: oxyAccountId, sourceId: identifier }));
101
+ export const productSubscriptionPortalResponseCheck = exact()(strictObject({ url: string(url, startsWith('https://')) }));
105
102
  export const personalPlanCheckoutResultCheck = exact()(discriminatedUnion('state', {
106
103
  unconfigured: strictObject({
107
104
  state: literal('unconfigured'),
@@ -132,7 +129,7 @@ export const productSubscriptionsResponseCheck = exact()(strictObject({
132
129
  period: billingPeriod,
133
130
  cancelAtPeriodEnd: boolean,
134
131
  canCancel: boolean,
135
- canRenew: optional(boolean),
132
+ canManage: optional(boolean),
136
133
  offers: array(strictObject({
137
134
  segmentId: identifier,
138
135
  offerId: identifier,
@@ -35,8 +35,30 @@ export const resolveExternalIdentityResponseSchema = z
35
35
  externalIdentity: externalIdentityReferenceSchema.extend({ userId: z.string() }),
36
36
  externalIdentities: z.array(externalIdentityReferenceSchema),
37
37
  redirectedUserIds: z.array(z.string()),
38
+ /**
39
+ * The source document Oxy fetched and verified for THIS answer: the
40
+ * ActivityPub actor (`id` is `externalIdentity.actorUri`) or the atproto
41
+ * `app.bsky.actor.getProfile` view (`did` is it). Present only when this
42
+ * request fetched the source — an `actorUri` resolve always does — and
43
+ * absent when the answer came from the registry. It is what the source
44
+ * said, bound to the actor by Oxy's verification, so a caller reads the
45
+ * fields Oxy does not keep (banner, counts, profile fields, flags, inbox and
46
+ * keys) from it instead of fetching the source again. Untrusted text: Oxy's
47
+ * own profile (`user`) is the normalized name, bio and avatar.
48
+ */
49
+ sourceDocument: z.record(z.string(), z.unknown()).optional(),
38
50
  })
39
51
  .superRefine((value, context) => {
52
+ const document = value.sourceDocument;
53
+ if (document &&
54
+ (value.externalIdentity.protocol === 'atproto' ? document.did : document.id) !==
55
+ value.externalIdentity.actorUri) {
56
+ context.addIssue({
57
+ code: z.ZodIssueCode.custom,
58
+ path: ['sourceDocument'],
59
+ message: 'Source document does not name the resolved actor',
60
+ });
61
+ }
40
62
  if (value.externalIdentity.userId !== value.user.id) {
41
63
  context.addIssue({
42
64
  code: z.ZodIssueCode.custom,
@@ -26,7 +26,7 @@ export const productSubscriptionSummarySchema = z
26
26
  period,
27
27
  cancelAtPeriodEnd: z.boolean(),
28
28
  canCancel: z.boolean(),
29
- canRenew: z.boolean().optional(),
29
+ canManage: z.boolean().optional(),
30
30
  offers: z.array(z
31
31
  .object({
32
32
  segmentId: id,
@@ -48,10 +48,14 @@ export const productPlanCheckoutRequestSchema = personalPlanCheckoutRequestSchem
48
48
  productId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
49
49
  })
50
50
  .strict();
51
- export const productSubscriptionRenewalRequestSchema = z
51
+ /** Open the payment provider's customer portal for one named source the caller pays for. */
52
+ export const productSubscriptionPortalRequestSchema = z
52
53
  .object({
53
54
  expectedSubjectAccountId: oxyAccountIdSchema,
54
55
  sourceId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
55
- idempotencyKey: personalPlanCheckoutRequestSchema.shape.idempotencyKey,
56
56
  })
57
57
  .strict();
58
+ /** A short-lived portal URL; it opens the provider's page and grants nothing. */
59
+ export const productSubscriptionPortalResponseSchema = z
60
+ .object({ url: z.string().check(urlCheck()).startsWith('https://') })
61
+ .strict();
@@ -29,7 +29,7 @@ export { SESSION_ACCOUNTS_CHANGED_EVENT, activeTokenCheck, deviceBackgroundCrede
29
29
  export { IDENTITY_LINK_QR_PREFIX, IDENTITY_LINK_STATUSES, buildIdentityLinkQrPayload, identityLinkCreateResponseCheck, identityLinkStateCheck, parseIdentityLinkQrPayload, } from './identityLink';
30
30
  export { IDENTITY_ERROR_CODES, IDENTITY_PROOF_ACTIONS, IDENTITY_PROOF_ACTION_VALUES, IDENTITY_PROOF_AUDIENCE, IDENTITY_PROOF_CHALLENGE_TTL_MS, IDENTITY_PROOF_DOMAIN, IDENTITY_PROOF_VERSION, buildIdentityProofMessage, canonicalJson, } from './identityProof';
31
31
  export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CLAIM_STATUSES, ORGANIZATION_ERROR_CODES, ORGANIZATION_NAME_MAX_LENGTH, ORGANIZATION_STATUSES, ORGANIZATION_TYPES, createOrganizationCheck, organizationBatchCheck, organizationCheck, organizationClaimCheck, organizationClaimDetailCheck, organizationClaimInputCheck, organizationClaimListCheck, organizationClaimReviewCheck, organizationCurationResultCheck, organizationExternalCheck, organizationExternalResolutionCheck, organizationImportBatchResultCheck, organizationListCheck, organizationNameCheck, updateOrganizationCheck, } from './organizations';
32
- export { cancelProductSubscriptionCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionRenewalRequestCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products';
32
+ export { cancelProductSubscriptionCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products';
33
33
  export { recommendationRequestCheck } from './recommendations';
34
34
  export { isFullReputationBalance } from './reputation';
35
35
  export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety';
@@ -99,10 +99,12 @@ export declare const productPlanCheckoutRequestCheck: Check<{
99
99
  idempotencyKey: string;
100
100
  productId: string;
101
101
  }>;
102
- export declare const productSubscriptionRenewalRequestCheck: Check<{
102
+ export declare const productSubscriptionPortalRequestCheck: Check<{
103
103
  expectedSubjectAccountId: string & import("zod").$brand<"OxyAccountId">;
104
104
  sourceId: string;
105
- idempotencyKey: string;
105
+ }>;
106
+ export declare const productSubscriptionPortalResponseCheck: Check<{
107
+ url: string;
106
108
  }>;
107
109
  export declare const personalPlanCheckoutResultCheck: Check<{
108
110
  state: "unconfigured";
@@ -144,7 +146,7 @@ export declare const productSubscriptionsResponseCheck: Check<{
144
146
  displayName: string;
145
147
  }[];
146
148
  }[];
147
- canRenew?: boolean | undefined;
149
+ canManage?: boolean | undefined;
148
150
  }[];
149
151
  }>;
150
152
  export declare const subscriptionCreditGrantsResponseCheck: Check<{
@@ -163,6 +163,7 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodObject<{
163
163
  sourceUserId: z.ZodString;
164
164
  }, z.core.$strip>>;
165
165
  redirectedUserIds: z.ZodArray<z.ZodString>;
166
+ sourceDocument: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
166
167
  }, z.core.$strip>;
167
168
  export declare const lookupExternalIdentitiesRequestSchema: z.ZodObject<{
168
169
  identifiers: z.ZodArray<z.ZodString>;
@@ -18,7 +18,7 @@ export declare const productSubscriptionSummarySchema: z.ZodObject<{
18
18
  }, z.core.$strict>;
19
19
  cancelAtPeriodEnd: z.ZodBoolean;
20
20
  canCancel: z.ZodBoolean;
21
- canRenew: z.ZodOptional<z.ZodBoolean>;
21
+ canManage: z.ZodOptional<z.ZodBoolean>;
22
22
  offers: z.ZodArray<z.ZodObject<{
23
23
  segmentId: z.ZodString;
24
24
  offerId: z.ZodString;
@@ -58,7 +58,7 @@ export declare const productSubscriptionsResponseSchema: z.ZodObject<{
58
58
  }, z.core.$strict>;
59
59
  cancelAtPeriodEnd: z.ZodBoolean;
60
60
  canCancel: z.ZodBoolean;
61
- canRenew: z.ZodOptional<z.ZodBoolean>;
61
+ canManage: z.ZodOptional<z.ZodBoolean>;
62
62
  offers: z.ZodArray<z.ZodObject<{
63
63
  segmentId: z.ZodString;
64
64
  offerId: z.ZodString;
@@ -35,9 +35,14 @@ export declare const productPlanCheckoutRequestSchema: z.ZodObject<{
35
35
  productId: z.ZodString;
36
36
  }, z.core.$strict>;
37
37
  export type ProductPlanCheckoutRequest = z.infer<typeof productPlanCheckoutRequestSchema>;
38
- export declare const productSubscriptionRenewalRequestSchema: z.ZodObject<{
38
+ /** Open the payment provider's customer portal for one named source the caller pays for. */
39
+ export declare const productSubscriptionPortalRequestSchema: z.ZodObject<{
39
40
  expectedSubjectAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
40
41
  sourceId: z.ZodString;
41
- idempotencyKey: z.ZodString;
42
42
  }, z.core.$strict>;
43
- export type ProductSubscriptionRenewalRequest = z.infer<typeof productSubscriptionRenewalRequestSchema>;
43
+ export type ProductSubscriptionPortalRequest = z.infer<typeof productSubscriptionPortalRequestSchema>;
44
+ /** A short-lived portal URL; it opens the provider's page and grants nothing. */
45
+ export declare const productSubscriptionPortalResponseSchema: z.ZodObject<{
46
+ url: z.ZodString;
47
+ }, z.core.$strict>;
48
+ export type ProductSubscriptionPortalResponse = z.infer<typeof productSubscriptionPortalResponseSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/contracts",
3
- "version": "6.7.0",
3
+ "version": "6.9.0",
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",
@@ -89,6 +89,6 @@
89
89
  "@types/node": "^26.6.6",
90
90
  "jest": "^30.5.2",
91
91
  "typescript": "~6.0.3",
92
- "@oxy.so/bloom": "17.4.0"
92
+ "@oxy.so/bloom": "17.8.1"
93
93
  }
94
94
  }