calmlens 0.29.2 → 0.30.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.
Files changed (80) hide show
  1. package/bin/calmlens.js +16 -17
  2. package/cjs/{BrowserUpload-CCXt4DAY.js → BrowserUpload-BNeTp6eF.js} +1 -1
  3. package/{esm/BrowserUpload-CeGsM9h1.d.ts → cjs/BrowserUpload-DS6KT6o_.d.ts} +2 -2
  4. package/cjs/{CalmLensAppClient-D-BD_Ny1.d.ts → CalmLensAppClient-B4vzxEzg.d.ts} +1 -1
  5. package/cjs/{CalmLensAppClient-ea-qXkmD.js → CalmLensAppClient-ClqGwUbl.js} +2 -2
  6. package/cjs/{CalmLensConnection-BrySN2M3.js → CalmLensConnection-og0jh-Fw.js} +1 -1
  7. package/{esm/CalmLensServerClient-BYN_N0lt.d.ts → cjs/CalmLensServerClient-BJl2Hsxr.d.ts} +12 -8
  8. package/cjs/{CalmLensServerClient-FD7H7KvL.js → CalmLensServerClient-KsXM77rO.js} +18 -17
  9. package/cjs/{CalmLensTypes-C2blKgTu.d.ts → CalmLensTypes-fAgF0_lq.d.ts} +206 -6
  10. package/cjs/{Classification-CMM2tZpJ-IdIh63n0.d.ts → Classification-DbXUPSvH-C0o2t4mg.d.ts} +15 -30
  11. package/{esm/Core-CNmoxDCW.d.ts → cjs/Core-DL531ZPG.d.ts} +2 -2
  12. package/cjs/{Core-DMFa3EUp.js → Core-eDiPpil9.js} +2 -2
  13. package/cjs/{ModerationContextLimits-1XP4ZTQk.js → ModerationContextLimits-BVBkcgSU.js} +1 -1
  14. package/{esm/ReactUpload-kqEe6gcN.d.ts → cjs/ReactUpload-BoS0lr7U.d.ts} +1 -1
  15. package/cjs/{ReactUpload-gaeiPSeH.js → ReactUpload-DAPAzAwY.js} +1 -1
  16. package/{esm/TestTriggers-CFnel6a9.d.ts → cjs/TestTriggers-CLjF01NU.d.ts} +1 -1
  17. package/cjs/{UploadController-CyPTBuZg.js → UploadController-BElzwMic.js} +1 -1
  18. package/{esm/WebhookPayload-DZWlnvcY.d.ts → cjs/WebhookPayload-DlGoY_db.d.ts} +11 -7
  19. package/cjs/app.d.ts +6 -6
  20. package/cjs/app.js +2 -2
  21. package/cjs/elements.d.ts +4 -4
  22. package/cjs/elements.js +4 -4
  23. package/cjs/{index-Dl2qwS8L.d.ts → index-ChrzzIRt.d.ts} +3 -3
  24. package/cjs/index.d.ts +5 -5
  25. package/cjs/index.js +1 -1
  26. package/cjs/react-native.d.ts +2 -2
  27. package/cjs/react-native.js +4 -4
  28. package/cjs/react.d.ts +4 -4
  29. package/cjs/react.js +5 -5
  30. package/cjs/server.d.ts +12 -12
  31. package/cjs/server.js +3 -3
  32. package/cjs/test-inputs.d.ts +1 -1
  33. package/cjs/testing.d.ts +12 -8
  34. package/cjs/testing.js +21 -19
  35. package/cjs/{ui-DNP1uWQy.js → ui-COjb2Hx6.js} +2 -2
  36. package/cjs/{ui-BtmJC-f9.d.ts → ui-DpZOLeVs.d.ts} +2 -2
  37. package/cjs/ui.d.ts +2 -2
  38. package/cjs/ui.js +3 -3
  39. package/cjs/vue.d.ts +5 -5
  40. package/cjs/vue.js +4 -4
  41. package/esm/{BrowserUpload-Bu6eWqQS.js → BrowserUpload-BCmj5eGu.js} +1 -1
  42. package/{cjs/BrowserUpload-CeGsM9h1.d.ts → esm/BrowserUpload-DS6KT6o_.d.ts} +2 -2
  43. package/esm/{CalmLensAppClient-D-BD_Ny1.d.ts → CalmLensAppClient-B4vzxEzg.d.ts} +1 -1
  44. package/esm/{CalmLensAppClient-xp-fH6Lz.js → CalmLensAppClient-DcPVLn2y.js} +2 -2
  45. package/esm/{CalmLensConnection-DwG5yBk2.js → CalmLensConnection-Pm-g6a1l.js} +1 -1
  46. package/{cjs/CalmLensServerClient-BYN_N0lt.d.ts → esm/CalmLensServerClient-BJl2Hsxr.d.ts} +12 -8
  47. package/esm/{CalmLensServerClient-CKlNBBo3.js → CalmLensServerClient-C2HGsjkT.js} +17 -16
  48. package/esm/{CalmLensTypes-C2blKgTu.d.ts → CalmLensTypes-fAgF0_lq.d.ts} +206 -6
  49. package/esm/{Classification-CMM2tZpJ-IdIh63n0.d.ts → Classification-DbXUPSvH-C0o2t4mg.d.ts} +15 -30
  50. package/{cjs/Core-CNmoxDCW.d.ts → esm/Core-DL531ZPG.d.ts} +2 -2
  51. package/esm/{Core-DnCeTmvS.js → Core-KYgLJ0eb.js} +2 -2
  52. package/esm/{ModerationContextLimits-CtAyz60h.js → ModerationContextLimits-DmjWgTBa.js} +1 -1
  53. package/{cjs/ReactUpload-kqEe6gcN.d.ts → esm/ReactUpload-BoS0lr7U.d.ts} +1 -1
  54. package/esm/{ReactUpload-D30YlRui.js → ReactUpload-QW_RNxFp.js} +1 -1
  55. package/{cjs/TestTriggers-CFnel6a9.d.ts → esm/TestTriggers-CLjF01NU.d.ts} +1 -1
  56. package/esm/{UploadController-DENryQ8H.js → UploadController-Civ7QPwT.js} +1 -1
  57. package/{cjs/WebhookPayload-DZWlnvcY.d.ts → esm/WebhookPayload-DlGoY_db.d.ts} +11 -7
  58. package/esm/app.d.ts +6 -6
  59. package/esm/app.js +2 -2
  60. package/esm/elements.d.ts +4 -4
  61. package/esm/elements.js +4 -4
  62. package/esm/{index-Dl2qwS8L.d.ts → index-ChrzzIRt.d.ts} +3 -3
  63. package/esm/index.d.ts +5 -5
  64. package/esm/index.js +1 -1
  65. package/esm/react-native.d.ts +2 -2
  66. package/esm/react-native.js +4 -4
  67. package/esm/react.d.ts +4 -4
  68. package/esm/react.js +5 -5
  69. package/esm/server.d.ts +12 -12
  70. package/esm/server.js +3 -3
  71. package/esm/test-inputs.d.ts +1 -1
  72. package/esm/testing.d.ts +12 -8
  73. package/esm/testing.js +21 -19
  74. package/esm/{ui-DUEBbRJ0.js → ui-BVXgDCO2.js} +2 -2
  75. package/esm/{ui-BtmJC-f9.d.ts → ui-DpZOLeVs.d.ts} +2 -2
  76. package/esm/ui.d.ts +2 -2
  77. package/esm/ui.js +3 -3
  78. package/esm/vue.d.ts +5 -5
  79. package/esm/vue.js +4 -4
  80. package/package.json +1 -1
package/bin/calmlens.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { readFile as readFile2 } from "node:fs/promises";
4
4
  import { parseArgs } from "node:util";
5
5
  // package.json
6
- var version = "0.29.2";
6
+ var version = "0.30.0";
7
7
 
8
8
  // src/contract/ModerationCategories-CHFRoeWV.js
9
9
  var CLASSIFICATION_CATEGORIES = [
@@ -2994,7 +2994,7 @@ class CalmLensServerClient {
2994
2994
  list: (options = {}, requestOptions) => this.#paginate("events.list", options, requestOptions, ({ types, ...query }) => this.#send("events.list", requestOptions, "GET", `${this.#projectPath}/events`, {
2995
2995
  query: { ...query, types: types?.length ? types.join(",") : undefined }
2996
2996
  })),
2997
- retrieveAsset: async (event, requestOptions) => event.assetId ? this.assets.retrieve({ assetId: event.assetId }, requestOptions) : null
2997
+ retrieveAsset: async (event, requestOptions) => event.resource?.kind === "asset" ? this.assets.retrieve({ assetId: event.resource.id }, requestOptions) : null
2998
2998
  };
2999
2999
  }
3000
3000
  get folders() {
@@ -19042,8 +19042,7 @@ var toWebhookEventPayload = (event) => ({
19042
19042
  severity: event.severity,
19043
19043
  title: event.title,
19044
19044
  description: event.description ?? null,
19045
- assetId: event.assetId ?? null,
19046
- assetSequence: event.assetSequence ?? null,
19045
+ resource: event.resource ?? null,
19047
19046
  facts: event.facts,
19048
19047
  createdAt: event.createdAt
19049
19048
  });
@@ -19162,20 +19161,20 @@ var unavailableWarning = (unavailableTypes) => [
19162
19161
  ""
19163
19162
  ].join(`
19164
19163
  `);
19165
- var inAssetOrder = (events) => {
19166
- const byAsset = new Map;
19164
+ var inResourceOrder = (events) => {
19165
+ const byResource = new Map;
19167
19166
  for (const event of events)
19168
- if (event.assetId)
19169
- byAsset.set(event.assetId, [...byAsset.get(event.assetId) ?? [], event]);
19170
- for (const assetEvents of byAsset.values())
19171
- assetEvents.sort((a, b) => (a.assetSequence ?? 0) - (b.assetSequence ?? 0));
19167
+ if (event.resource)
19168
+ byResource.set(event.resource.id, [...byResource.get(event.resource.id) ?? [], event]);
19169
+ for (const resourceEvents of byResource.values())
19170
+ resourceEvents.sort((a, b) => (a.resource?.sequence ?? 0) - (b.resource?.sequence ?? 0));
19172
19171
  const next = new Map;
19173
19172
  return events.map((event) => {
19174
- if (!event.assetId)
19173
+ if (!event.resource)
19175
19174
  return event;
19176
- const index = next.get(event.assetId) ?? 0;
19177
- next.set(event.assetId, index + 1);
19178
- return byAsset.get(event.assetId)[index];
19175
+ const index = next.get(event.resource.id) ?? 0;
19176
+ next.set(event.resource.id, index + 1);
19177
+ return byResource.get(event.resource.id)[index];
19179
19178
  });
19180
19179
  };
19181
19180
  var listen = async (options) => {
@@ -19194,7 +19193,7 @@ var listen = async (options) => {
19194
19193
  if (failures > 0)
19195
19194
  log(`${formatTime(new Date)} Reconnected to CalmLens.`);
19196
19195
  failures = 0;
19197
- for (const event of inAssetOrder(page.items)) {
19196
+ for (const event of inResourceOrder(page.items)) {
19198
19197
  if (eventTypes.size > 0 && !eventTypes.has(event.type))
19199
19198
  continue;
19200
19199
  await deliverEvent(event, { ...options, log });
@@ -19354,8 +19353,8 @@ Commands:
19354
19353
  receives, so listen and trigger need no API key or project ID.
19355
19354
  logout Revoke and forget the key from login.
19356
19355
  listen Forward your project's events to a local webhook handler with the same flat
19357
- body (id, projectId, actor, type, severity, title, description, assetId,
19358
- assetSequence, facts, createdAt) and headers (x-calmlens-delivery,
19356
+ body (id, projectId, actor, type, severity, title, description, resource,
19357
+ facts, createdAt) and headers (x-calmlens-delivery,
19359
19358
  x-calmlens-timestamp, x-calmlens-signature: v1=...) as real deliveries. No
19360
19359
  public URL needed. Like real deliveries, network errors, timeouts, 408, 425, 429
19361
19360
  and 5xx responses are retried, up to 7 attempts with the same delivery ID, here
@@ -1,4 +1,4 @@
1
- const require_UploadController = require("./UploadController-CyPTBuZg.js");
1
+ const require_UploadController = require("./UploadController-BElzwMic.js");
2
2
  // src/ui/BrowserUpload.ts
3
3
  /** Creates an upload queue for the browser components, such as one a form starts on submit. */
4
4
  const createUploadController = (options) => require_UploadController.createUploadController(options);
@@ -1,5 +1,5 @@
1
- import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-CNmoxDCW.js";
2
- import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-kqEe6gcN.js";
1
+ import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-DL531ZPG.js";
2
+ import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-BoS0lr7U.js";
3
3
  type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
4
4
  type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
5
5
  type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
@@ -1,4 +1,4 @@
1
- import { $t as UploadPresetSubmitAssetOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, O as CalmLensAppClientOptions, Yt as UploadAssetPartOptions, en as UploadedAsset, kt as RequestOptions } from "./CalmLensTypes-C2blKgTu.js";
1
+ import { $t as UploadPresetSubmitAssetOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, O as CalmLensAppClientOptions, Yt as UploadAssetPartOptions, en as UploadedAsset, kt as RequestOptions } from "./CalmLensTypes-fAgF0_lq.js";
2
2
  declare const inspectSymbol: unique symbol;
3
3
  /**
4
4
  * The CalmLens client for browsers and React Native apps. It uploads through an upload preset,
@@ -1,6 +1,6 @@
1
1
  const require_CalmLensError = require("./CalmLensError-DPHJaVjX.js");
2
- const require_ModerationContextLimits = require("./ModerationContextLimits-1XP4ZTQk.js");
3
- const require_CalmLensConnection = require("./CalmLensConnection-BrySN2M3.js");
2
+ const require_ModerationContextLimits = require("./ModerationContextLimits-BVBkcgSU.js");
3
+ const require_CalmLensConnection = require("./CalmLensConnection-og0jh-Fw.js");
4
4
  // src/client/CalmLensAppClient.ts
5
5
  const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
6
6
  /** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
@@ -1,5 +1,5 @@
1
1
  const require_CalmLensError = require("./CalmLensError-DPHJaVjX.js");
2
- const require_ModerationContextLimits = require("./ModerationContextLimits-1XP4ZTQk.js");
2
+ const require_ModerationContextLimits = require("./ModerationContextLimits-BVBkcgSU.js");
3
3
  // src/contract/AssetPayload.js
4
4
  const bufferInputToBytes = (value) => {
5
5
  if (value instanceof ArrayBuffer) return new Uint8Array(value);
@@ -1,6 +1,6 @@
1
- import { d as HashListEntry, u as HashList } from "./Classification-CMM2tZpJ-IdIh63n0.js";
2
- import { $ as FolderPage, At as ResetPolicyOptions, B as CreateHashListOptions, D as BatchAssetsResponse, Dt as RequestAssetReviewOptions, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SetPolicyAutomaticUpdatesOptions, G as DeleteAssetOptions, Gt as UpdateLensOptions, Ht as UpdateAssetOptions, I as ClassifyTextOptions, In as AssetSearchQuery, It as SignAssetUrlOptions, J as EnsureLensesOptions, Jt as UpgradePolicyOptions, K as DeleteMetadataFieldOptions, Kt as UpdatePolicyOptions, Lt as SignUploadTokenOptions, M as CdnAssetUrlOptions, Mn as Policy, Mt as RetrieveAssetOptions, Nt as RetryAssetOptions, P as CdnServeOptions, Q as FolderIdOptions, Qt as UploadPresetPage, Rn as AssetInfo, Rt as SignedAssetUrl, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateFolderOptions, V as CreateLensOptions, Vt as SubmitAssetOptions, W as DecideAssetOptions, Wt as UpdateHashListOptions, X as EnsureUploadPresetsOptions, Y as EnsureMetadataFieldsOptions, Yt as UploadAssetPartOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetIdOptions, _ as AssetPage, _t as ListLensesOptions, b as AssetTimelinePage, bn as MetadataFieldsResource, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetrieveAssetByExternalIdOptions, k as CalmLensServerClientOptions, kt as RequestOptions, ln as GetEventsResponse, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, pt as ListEventsOptions, q as EnsureLensOptions, qt as UpdateProjectSettingsOptions, r as Asset, rn as WaitForAssetDecisionOptions, rt as HashListIdOptions, sn as AssetReviewRequest, st as Lens, t as AddHashListEntryOptions, tn as VerifyWebhookSignatureOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vt as ListPoliciesOptions, wt as PolicyIdOptions, xn as ProjectSettingsResource, xt as MoveFolderOptions, yn as Folder, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SignedUploadToken } from "./CalmLensTypes-C2blKgTu.js";
3
- import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-DZWlnvcY.js";
1
+ import { c as HashList, l as HashListEntry } from "./Classification-DbXUPSvH-C0o2t4mg.js";
2
+ import { $ as FolderPage, At as ResetPolicyOptions, B as CreateHashListOptions, Bn as AssetInfo, Cn as ProjectSettingsResource, D as BatchAssetsResponse, Dt as RequestAssetReviewOptions, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SetPolicyAutomaticUpdatesOptions, G as DeleteAssetOptions, Gt as UpdateLensOptions, Ht as UpdateAssetOptions, I as ClassifyTextOptions, It as SignAssetUrlOptions, J as EnsureLensesOptions, Jt as UpgradePolicyOptions, K as DeleteMetadataFieldOptions, Kt as UpdatePolicyOptions, Lt as SignUploadTokenOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, Nt as RetryAssetOptions, P as CdnServeOptions, Pn as Policy, Q as FolderIdOptions, Qt as UploadPresetPage, Rn as AssetSearchQuery, Rt as SignedAssetUrl, Sn as MetadataFieldsResource, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateFolderOptions, V as CreateLensOptions, Vt as SubmitAssetOptions, W as DecideAssetOptions, Wt as UpdateHashListOptions, X as EnsureUploadPresetsOptions, Y as EnsureMetadataFieldsOptions, Yt as UploadAssetPartOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetIdOptions, _ as AssetPage, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetrieveAssetByExternalIdOptions, k as CalmLensServerClientOptions, kt as RequestOptions, ln as GetEventsResponse, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, pt as ListEventsOptions, q as EnsureLensOptions, qt as UpdateProjectSettingsOptions, r as Asset, rn as WaitForAssetDecisionOptions, rt as HashListIdOptions, sn as AssetReviewRequest, st as Lens, t as AddHashListEntryOptions, tn as VerifyWebhookSignatureOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vt as ListPoliciesOptions, wt as PolicyIdOptions, xn as Folder, xt as MoveFolderOptions, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SignedUploadToken } from "./CalmLensTypes-fAgF0_lq.js";
3
+ import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-DlGoY_db.js";
4
4
  interface TransportRequest {
5
5
  /** The client method sending the request, such as `assets.retrieve`, for hooks and logs. */
6
6
  operation?: string;
@@ -242,13 +242,17 @@ declare class CalmLensServerClient {
242
242
  list: (options?: ListEventsOptions, requestOptions?: RequestOptions) => ListPromise<GetEventsResponse>;
243
243
  /**
244
244
  * Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
245
- * parsed webhook delivery; events carry only the asset's ID. Resolves to `null` for an
246
- * event that isn't about an asset, and rejects with `asset/not-found` once the asset is
247
- * deleted. The asset's `eventSequence` orders it against events: an event with a higher
248
- * `assetSequence` happened after this state, one with an equal or lower one is reflected in it.
245
+ * parsed webhook delivery; events carry only the asset's ID, in `resource`. Resolves to
246
+ * `null` for an event that isn't about an asset, and rejects with `asset/not-found` once the
247
+ * asset is deleted. The asset's `sequence` orders it against events: an event with a higher
248
+ * `resource.sequence` happened after this state, one with an equal or lower one is reflected
249
+ * in it.
249
250
  */
250
251
  retrieveAsset: (event: {
251
- readonly assetId?: string | null;
252
+ readonly resource?: {
253
+ readonly kind: string;
254
+ readonly id: string;
255
+ } | null;
252
256
  }, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset> | null>;
253
257
  };
254
258
  get folders(): {
@@ -1,6 +1,6 @@
1
1
  const require_CalmLensError = require("./CalmLensError-DPHJaVjX.js");
2
- const require_ModerationContextLimits = require("./ModerationContextLimits-1XP4ZTQk.js");
3
- const require_CalmLensConnection = require("./CalmLensConnection-BrySN2M3.js");
2
+ const require_ModerationContextLimits = require("./ModerationContextLimits-BVBkcgSU.js");
3
+ const require_CalmLensConnection = require("./CalmLensConnection-og0jh-Fw.js");
4
4
  const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
5
5
  // src/contract/JsonUtils.js
6
6
  const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
@@ -153,8 +153,8 @@ const isOptional = (value, type, nullable) => value === void 0 || nullable && va
153
153
  */
154
154
  const isWebhookEvent = (value) => {
155
155
  if (!isObject(value) || typeof value.id !== "string" || typeof value.type !== "string" || typeof value.projectId !== "string" || typeof value.createdAt !== "number") return false;
156
- const { severity, title, description, assetId, assetSequence, facts } = value;
157
- return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && isOptional(assetId, "string", true) && isOptional(assetSequence, "number", true) && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
156
+ const { severity, title, description, resource, facts } = value;
157
+ return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && (resource === void 0 || resource === null || isObject(resource) && typeof resource.kind === "string" && typeof resource.id === "string" && typeof resource.sequence === "number") && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
158
158
  };
159
159
  /**
160
160
  * The value of one of an event's facts, by key, or `undefined` when the event doesn't carry it.
@@ -178,13 +178,13 @@ const getEventFacts = (event) => {
178
178
  */
179
179
  const isTestWebhookEvent = (event) => Array.isArray(event?.facts) && event.facts.some((fact) => fact?.key === "test" && fact.value === true);
180
180
  /**
181
- * Whether to apply `event` after `lastSequence`, the highest `assetSequence` you have applied for
182
- * its asset (`null` or `undefined` when none). Deliveries can arrive out of order: an event about
183
- * an asset is newer only with a higher `assetSequence`, so a retried or repeated delivery of an
184
- * earlier one returns `false`. Events that aren't about an asset have no sequence and are always
185
- * new. Store the event's `assetSequence` per `assetId` once you have applied it.
181
+ * Whether to apply `event` after `lastSequence`, the highest `resource.sequence` you have applied
182
+ * for its resource (`null` or `undefined` when none). Deliveries can arrive out of order: an event
183
+ * about a resource is newer only with a higher sequence, so a retried or repeated delivery of an
184
+ * earlier one returns `false`. Events about no resource have no sequence and are always new.
185
+ * Store the event's `resource.sequence` per `resource.id` once you have applied it.
186
186
  */
187
- const isNewerAssetEvent = (event, lastSequence) => event.assetSequence === null || event.assetSequence === void 0 || lastSequence === null || lastSequence === void 0 || event.assetSequence > lastSequence;
187
+ const isNewerEvent = (event, lastSequence) => !event.resource || lastSequence === null || lastSequence === void 0 || event.resource.sequence > lastSequence;
188
188
  // src/client/ServedAssetInfo.ts
189
189
  function parseServedAssetInfo(header) {
190
190
  if (!header) return void 0;
@@ -688,12 +688,13 @@ sign: async (options) => {
688
688
  } })),
689
689
  /**
690
690
  * Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
691
- * parsed webhook delivery; events carry only the asset's ID. Resolves to `null` for an
692
- * event that isn't about an asset, and rejects with `asset/not-found` once the asset is
693
- * deleted. The asset's `eventSequence` orders it against events: an event with a higher
694
- * `assetSequence` happened after this state, one with an equal or lower one is reflected in it.
691
+ * parsed webhook delivery; events carry only the asset's ID, in `resource`. Resolves to
692
+ * `null` for an event that isn't about an asset, and rejects with `asset/not-found` once the
693
+ * asset is deleted. The asset's `sequence` orders it against events: an event with a higher
694
+ * `resource.sequence` happened after this state, one with an equal or lower one is reflected
695
+ * in it.
695
696
  */
696
- retrieveAsset: async (event, requestOptions) => event.assetId ? this.assets.retrieve({ assetId: event.assetId }, requestOptions) : null
697
+ retrieveAsset: async (event, requestOptions) => event.resource?.kind === "asset" ? this.assets.retrieve({ assetId: event.resource.id }, requestOptions) : null
697
698
  };
698
699
  }
699
700
  get folders() {
@@ -997,10 +998,10 @@ Object.defineProperty(exports, "getEventFacts", {
997
998
  return getEventFacts;
998
999
  }
999
1000
  });
1000
- Object.defineProperty(exports, "isNewerAssetEvent", {
1001
+ Object.defineProperty(exports, "isNewerEvent", {
1001
1002
  enumerable: true,
1002
1003
  get: function() {
1003
- return isNewerAssetEvent;
1004
+ return isNewerEvent;
1004
1005
  }
1005
1006
  });
1006
1007
  Object.defineProperty(exports, "isTestWebhookEvent", {