@grantjs/schema 1.20.1 → 1.20.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantjs/schema",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,6 +48,30 @@ export type EventIdentityKey = (typeof EVENT_IDENTITY_KEYS)[number];
48
48
  /** Identity-only projection of an internal `before` snapshot (see `EVENT_IDENTITY_KEYS`). */
49
49
  export type EventIdentity = Partial<Record<EventIdentityKey, string | number | boolean | null>>;
50
50
 
51
+ /**
52
+ * The source-system key a CDM import attached to a user in one project, as carried in
53
+ * `data.before.externalKeys`. A pseudonymous identifier: it means something only next to
54
+ * the importing system's own data. Never an e-mail address, a name or a hash.
55
+ */
56
+ export interface EventExternalKey {
57
+ projectId: string;
58
+ externalKey: string;
59
+ }
60
+
61
+ /**
62
+ * The event types whose external `data.before` carries `externalKeys`. The projection
63
+ * copies the list for these types only, and only the entries of the receiving
64
+ * subscription's project.
65
+ */
66
+ export const EXTERNAL_KEY_EVENT_TYPES = ['user.deleted', 'project.user_removed'] as const;
67
+
68
+ /**
69
+ * An external `data.before`: the identity keys, plus `externalKeys` on the types in
70
+ * `EXTERNAL_KEY_EVENT_TYPES` (`[]` when the user has no key in the receiving project;
71
+ * absent on Grant older than v1.20.2).
72
+ */
73
+ export type ExternalEventBefore = EventIdentity & { externalKeys?: EventExternalKey[] };
74
+
51
75
  /**
52
76
  * `data` as delivered to webhook consumers: `after` and `delta` redacted, `before`
53
77
  * reduced to the identity of the entity or pivot the event is about. Absent when
@@ -55,7 +79,7 @@ export type EventIdentity = Partial<Record<EventIdentityKey, string | number | b
55
79
  */
56
80
  export interface ExternalEventData {
57
81
  after?: Record<string, unknown> | null;
58
- before?: EventIdentity | null;
82
+ before?: ExternalEventBefore | null;
59
83
  delta?: Record<string, { from: unknown; to: unknown }> | null;
60
84
  }
61
85