@friggframework/core 2.0.0-next.82 → 2.0.0-next.83

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.
@@ -206,6 +206,28 @@ class ProcessAuthorizationCallback {
206
206
  });
207
207
 
208
208
  if (existingEntity) {
209
+ // Repoint the entity's credentialId when re-auth produced a
210
+ // different credential than the one currently linked. This
211
+ // happens when the user re-authenticates against a different
212
+ // workspace/account of the same provider — `upsertCredential`
213
+ // matches/creates a credential keyed by externalId, but
214
+ // findEntity matches the entity by its own externalId, leaving
215
+ // the entity still linked to the prior workspace's credential
216
+ // unless we explicitly update the link.
217
+ const existingCredentialId = existingEntity.credential?.id;
218
+ if (
219
+ credentialId &&
220
+ String(existingCredentialId) !== String(credentialId)
221
+ ) {
222
+ console.log(
223
+ `[Frigg] Repointing entity ${existingEntity.id} credentialId ${existingCredentialId} -> ${credentialId} after re-auth`
224
+ );
225
+ const updated = await this.moduleRepository.updateEntity(
226
+ existingEntity.id,
227
+ { credential: credentialId }
228
+ );
229
+ if (updated) return updated;
230
+ }
209
231
  return existingEntity;
210
232
  }
211
233
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0-next.82",
4
+ "version": "2.0.0-next.83",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -38,9 +38,9 @@
38
38
  }
39
39
  },
40
40
  "devDependencies": {
41
- "@friggframework/eslint-config": "2.0.0-next.82",
42
- "@friggframework/prettier-config": "2.0.0-next.82",
43
- "@friggframework/test": "2.0.0-next.82",
41
+ "@friggframework/eslint-config": "2.0.0-next.83",
42
+ "@friggframework/prettier-config": "2.0.0-next.83",
43
+ "@friggframework/test": "2.0.0-next.83",
44
44
  "@prisma/client": "^6.17.0",
45
45
  "@types/lodash": "4.17.15",
46
46
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "765f34d4ea2b2861f4a1723f8b319bfef9a5aea8"
83
+ "gitHead": "e01d96a234ebb71582e5f1f2e6d53bfe8bf8ce33"
84
84
  }