@gscdump/contracts 4.6.0 → 4.8.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.
package/dist/schemas.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { siteHoldReasonSchema, userAllowanceNoticeDataSchema } from "./entitlements.mjs";
1
2
  import { coverageStatesPointSchema, indexingCaptureSchema } from "./indexing-coverage.mjs";
2
3
  import { GSCDUMP_ONBOARDING_CONTRACT_VERSION, accountNextActions, accountStatuses, analyticsNextActions, analyticsStatuses, indexingNextActions, indexingStatuses, lifecycleErrorCodes, propertyNextActions, propertyStatuses, querySourceModes, sitemapNextActions, sitemapStatuses } from "./onboarding.mjs";
3
4
  import { GSC_SEARCH_TYPES } from "./search-types.mjs";
@@ -469,6 +470,7 @@ const partnerLifecycleSiteSchema = z.object({
469
470
  progress: lifecycleProgressSchema,
470
471
  nextAction: z.enum(indexingNextActions)
471
472
  }).loose(),
473
+ hold: siteHoldReasonSchema.nullable().default(null),
472
474
  latestError: lifecycleErrorSchema.nullable(),
473
475
  lifecycleRevision: z.number(),
474
476
  updatedAt: z.string()
@@ -1467,7 +1469,15 @@ const partnerWebhookEnvelopeSchema = z.object({
1467
1469
  lifecycleRevision: z.number().int(),
1468
1470
  occurredAt: z.iso.datetime(),
1469
1471
  data: partnerWebhookDataSchema
1470
- }).loose();
1472
+ }).loose().superRefine((envelope, context) => {
1473
+ if (envelope.event !== "user.allowance.notice") return;
1474
+ const data = userAllowanceNoticeDataSchema.safeParse(envelope.data);
1475
+ for (const issue of data.error?.issues ?? []) context.addIssue({
1476
+ code: "custom",
1477
+ message: issue.message,
1478
+ path: ["data", ...issue.path]
1479
+ });
1480
+ });
1471
1481
  const analyticsEndpointSchemas = {
1472
1482
  analyticsWhoami: { response: whoamiResponseSchema },
1473
1483
  analyticsSites: { response: z.array(siteListItemSchema) },
package/dist/types.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { GscSearchType } from "./search-types.mjs";
2
+ import { UserAllowanceNoticeData } from "./entitlements.mjs";
2
3
  import { FileResolutionResponse } from "./file-resolution.mjs";
3
4
  import { CoverageStatesPoint, IndexingCapture } from "./indexing-coverage.mjs";
4
5
  import { AccountNextAction, AccountStatus, PartnerLifecycleAccount, PartnerLifecycleResponse, PartnerLifecycleSite } from "./onboarding.mjs";
@@ -1394,7 +1395,7 @@ export interface BindPartnerTeamCatalogResponse {
1394
1395
  bucket: string;
1395
1396
  namespace: string;
1396
1397
  }
1397
- export type CanonicalWebhookEventType = 'user.lifecycle.changed' | 'site.lifecycle.changed' | 'site.analytics.ready' | 'site.indexing.ready' | 'site.auth.failed' | 'job.failed';
1398
+ export type CanonicalWebhookEventType = 'user.lifecycle.changed' | 'site.lifecycle.changed' | 'site.analytics.ready' | 'site.indexing.ready' | 'site.auth.failed' | 'job.failed' | 'user.allowance.notice';
1398
1399
  export type WebhookEventType = CanonicalWebhookEventType;
1399
1400
  export interface WebhookEnvelope<TData extends Record<string, unknown> = Record<string, unknown>> {
1400
1401
  contractVersion: string;
@@ -1410,6 +1411,18 @@ export interface WebhookEnvelope<TData extends Record<string, unknown> = Record<
1410
1411
  data: TData;
1411
1412
  }
1412
1413
  export type PartnerWebhookData = Record<string, unknown>;
1414
+ /**
1415
+ * The `data` type of each canonical webhook event. An event with a typed
1416
+ * payload has its own entry; every other event carries `PartnerWebhookData`.
1417
+ */
1418
+ export type CanonicalWebhookEventData<TEvent extends CanonicalWebhookEventType> = TEvent extends 'user.allowance.notice' ? UserAllowanceNoticeData : PartnerWebhookData;
1419
+ /**
1420
+ * A parsed webhook envelope, discriminated on `event`. Narrow on `event` to
1421
+ * read a typed `data`, for example `UserAllowanceNoticeData`.
1422
+ */
1423
+ export type CanonicalWebhookEnvelope = { [TEvent in CanonicalWebhookEventType]: WebhookEnvelope<CanonicalWebhookEventData<TEvent>> & {
1424
+ event: TEvent;
1425
+ }; }[CanonicalWebhookEventType];
1413
1426
  export interface CreateWebhookEnvelopeOptions<TData extends Record<string, unknown> = Record<string, unknown>> {
1414
1427
  event: CanonicalWebhookEventType;
1415
1428
  partnerId: string;