@grantjs/schema 1.20.1 → 1.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantjs/schema",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
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
 
@@ -1491,6 +1491,7 @@ export type ProjectSyncJobQuery = {
1491
1491
  passwordsUpdated: number;
1492
1492
  passwordsUnchanged: number;
1493
1493
  passwordsSkippedExisting: number;
1494
+ usersSkippedTombstoned: number;
1494
1495
  warnings: Array<string>;
1495
1496
  } | null;
1496
1497
  };
@@ -8165,6 +8166,7 @@ export const ProjectSyncJobDocument = {
8165
8166
  { kind: 'Field', name: { kind: 'Name', value: 'passwordsUpdated' } },
8166
8167
  { kind: 'Field', name: { kind: 'Name', value: 'passwordsUnchanged' } },
8167
8168
  { kind: 'Field', name: { kind: 'Name', value: 'passwordsSkippedExisting' } },
8169
+ { kind: 'Field', name: { kind: 'Name', value: 'usersSkippedTombstoned' } },
8168
8170
  { kind: 'Field', name: { kind: 'Name', value: 'warnings' } },
8169
8171
  ],
8170
8172
  },
@@ -3404,6 +3404,7 @@ export type SyncProjectResultResolvers<
3404
3404
  userRolesAssigned?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
3405
3405
  userTagsLinked?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
3406
3406
  usersCreated?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
3407
+ usersSkippedTombstoned?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
3407
3408
  warnings?: Resolver<Array<ResolversTypes['String']>, ParentType, ContextType>;
3408
3409
  }>;
3409
3410
 
@@ -453,6 +453,11 @@ export type CdmKeyResolverInput = {
453
453
  * import/export.
454
454
  */
455
455
  findBy?: InputMaybe<CdmFindBy>;
456
+ /**
457
+ * Only with `findBy: key`: an existing, live Grant user this key is, reused instead of creating one and marked
458
+ * with the key for this project. Refused for a missing, deleted or already-imported-under-another-key user.
459
+ */
460
+ grantUserId?: InputMaybe<Scalars['ID']['input']>;
456
461
  ifMissing?: InputMaybe<CdmIfMissing>;
457
462
  /**
458
463
  * Identifier value. For `findBy: email`, Grant normalizes this to lowercase
@@ -3797,6 +3802,11 @@ export type SyncProjectResult = {
3797
3802
  userRolesAssigned: Scalars['Int']['output'];
3798
3803
  userTagsLinked: Scalars['Int']['output'];
3799
3804
  usersCreated: Scalars['Int']['output'];
3805
+ /**
3806
+ * Document users not created because the person deleted this imported identity; their
3807
+ * membership, credential and API keys were not written either.
3808
+ */
3809
+ usersSkippedTombstoned: Scalars['Int']['output'];
3800
3810
  warnings: Array<Scalars['String']['output']>;
3801
3811
  };
3802
3812
 
@@ -29,6 +29,7 @@ query ProjectSyncJob($id: ID!, $scope: Scope!, $jobId: ID!) {
29
29
  passwordsUpdated
30
30
  passwordsUnchanged
31
31
  passwordsSkippedExisting
32
+ usersSkippedTombstoned
32
33
  warnings
33
34
  }
34
35
  warnings
@@ -53,6 +53,11 @@ input CdmKeyResolverInput {
53
53
  """
54
54
  findBy: CdmFindBy
55
55
  ifMissing: CdmIfMissing
56
+ """
57
+ Only with `findBy: key`: an existing, live Grant user this key is, reused instead of creating one and marked
58
+ with the key for this project. Refused for a missing, deleted or already-imported-under-another-key user.
59
+ """
60
+ grantUserId: ID
56
61
  }
57
62
 
58
63
  """
@@ -51,6 +51,11 @@ type SyncProjectResult {
51
51
  reset in Grant, not imported.
52
52
  """
53
53
  passwordsSkippedExisting: Int!
54
+ """
55
+ Document users not created because the person deleted this imported identity; their
56
+ membership, credential and API keys were not written either.
57
+ """
58
+ usersSkippedTombstoned: Int!
54
59
  resourcesCreated: Int!
55
60
  permissionsCreated: Int!
56
61
  tagsCreated: Int!