@friggframework/core 2.0.0--canary.671.dc3e89f.0 → 2.0.0--canary.670.2873d95.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/credential/repositories/credential-repository-documentdb.js +0 -34
- package/credential/repositories/credential-repository-interface.js +0 -15
- package/credential/repositories/credential-repository-mongo.js +0 -23
- package/credential/repositories/credential-repository-postgres.js +0 -28
- package/database/encryption/encryption-schema-registry.js +0 -6
- package/generated/prisma-mongodb/edge.js +4 -20
- package/generated/prisma-mongodb/index-browser.js +1 -17
- package/generated/prisma-mongodb/index.d.ts +95 -1543
- package/generated/prisma-mongodb/index.js +4 -20
- package/generated/prisma-mongodb/package.json +1 -1
- package/generated/prisma-mongodb/schema.prisma +0 -27
- package/generated/prisma-mongodb/wasm.js +4 -20
- package/generated/prisma-postgresql/edge.js +4 -20
- package/generated/prisma-postgresql/index-browser.js +1 -17
- package/generated/prisma-postgresql/index.d.ts +84 -1565
- package/generated/prisma-postgresql/index.js +4 -20
- package/generated/prisma-postgresql/package.json +1 -1
- package/generated/prisma-postgresql/schema.prisma +0 -26
- package/generated/prisma-postgresql/wasm.js +4 -20
- package/handlers/app-definition-loader.js +1 -3
- package/handlers/app-handler-helpers.js +3 -25
- package/handlers/middleware/admin-auth.js +1 -14
- package/handlers/routers/auth.js +3 -11
- package/handlers/routers/health.js +0 -10
- package/modules/requester/requester.js +2 -27
- package/package.json +5 -5
- package/prisma-mongodb/schema.prisma +0 -27
- package/prisma-postgresql/schema.prisma +0 -26
- package/credential/use-cases/credential-operations-for-user.js +0 -117
- package/credential/use-cases/reauthorize-credential-for-user.js +0 -66
- package/integrations/use-cases/integration-operations-for-user.js +0 -225
- package/management-api/create-management-api-router.js +0 -49
- package/management-api/error-response.js +0 -116
- package/management-api/management-api-config.js +0 -82
- package/management-api/meta-router.js +0 -57
- package/management-api/openapi/build-openapi.js +0 -144
- package/management-api/openapi/components.js +0 -362
- package/management-api/openapi/v1-operations.js +0 -83
- package/management-api/openapi/v2-operations.js +0 -248
- package/management-api/route-registry.js +0 -294
- package/management-api/test-support/http-client.js +0 -39
- package/management-api/use-cases/get-management-api-meta.js +0 -57
- package/management-api/v1-deprecation.js +0 -120
- package/management-api/v2/create-v2-router.js +0 -85
- package/management-api/v2/dependencies.js +0 -241
- package/management-api/v2/dto.js +0 -123
- package/management-api/v2/handlers/authorization.js +0 -93
- package/management-api/v2/handlers/credentials.js +0 -29
- package/management-api/v2/handlers/entities.js +0 -74
- package/management-api/v2/handlers/integrations.js +0 -125
- package/management-api/v2/handlers/proxy.js +0 -34
- package/management-api/v2/request.js +0 -54
- package/management-api/v2/test-support/fake-dependencies.js +0 -103
- package/modules/domain/authorization-session.js +0 -144
- package/modules/proxy/proxy-errors.js +0 -20
- package/modules/proxy/proxy-path.js +0 -179
- package/modules/proxy/proxy-policy.js +0 -248
- package/modules/repositories/authorization-session-repository-documentdb.js +0 -112
- package/modules/repositories/authorization-session-repository-factory.js +0 -31
- package/modules/repositories/authorization-session-repository-interface.js +0 -47
- package/modules/repositories/authorization-session-repository-prisma.js +0 -87
- package/modules/requester/proxy-request.js +0 -244
- package/modules/tests/doubles/in-memory-authorization-session-repository.js +0 -45
- package/modules/use-cases/entity-operations-for-user.js +0 -125
- package/modules/use-cases/entity-types.js +0 -91
- package/modules/use-cases/execute-entity-proxy-request.js +0 -239
- package/modules/use-cases/get-authorization-requirements.js +0 -100
- package/modules/use-cases/get-entity-module-for-user.js +0 -86
- package/modules/use-cases/multi-step-authorization.js +0 -302
- package/prisma-postgresql/migrations/20261003000000_add_authorization_session/migration.sql +0 -28
|
@@ -186,40 +186,6 @@ class CredentialRepositoryDocumentDB extends CredentialRepositoryInterface {
|
|
|
186
186
|
return this._mapCredential(decryptedCredential);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
/**
|
|
190
|
-
* All credentials owned by a user, newest first.
|
|
191
|
-
*
|
|
192
|
-
* @param {string} userId - User ID
|
|
193
|
-
* @returns {Promise<Array<Object>>} Credentials with string IDs
|
|
194
|
-
*/
|
|
195
|
-
async findCredentialsByUserId(userId) {
|
|
196
|
-
const userObjectId = toObjectId(userId);
|
|
197
|
-
if (!userObjectId) return [];
|
|
198
|
-
const docs = await findManyDrained(
|
|
199
|
-
this.prisma,
|
|
200
|
-
'Credential',
|
|
201
|
-
{ userId: userObjectId },
|
|
202
|
-
{ sort: { createdAt: -1 } }
|
|
203
|
-
);
|
|
204
|
-
const credentials = [];
|
|
205
|
-
for (const doc of docs) {
|
|
206
|
-
const decrypted = await this.encryptionService.decryptFields(
|
|
207
|
-
'Credential',
|
|
208
|
-
doc
|
|
209
|
-
);
|
|
210
|
-
credentials.push({
|
|
211
|
-
...this._mapCredential(decrypted),
|
|
212
|
-
id: fromObjectId(doc._id),
|
|
213
|
-
userId: fromObjectId(doc.userId) ?? doc.userId,
|
|
214
|
-
externalId: doc.externalId ?? null,
|
|
215
|
-
authIsValid: doc.authIsValid ?? null,
|
|
216
|
-
createdAt: doc.createdAt ?? null,
|
|
217
|
-
updatedAt: doc.updatedAt ?? null,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
return credentials;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
189
|
async updateCredential(credentialId, updates) {
|
|
224
190
|
const objectId = toObjectId(credentialId);
|
|
225
191
|
if (!objectId) return null;
|
|
@@ -80,21 +80,6 @@ class CredentialRepositoryInterface {
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* All credentials owned by a user, newest first.
|
|
85
|
-
*
|
|
86
|
-
* @param {string|number} userId - User ID (string from application layer)
|
|
87
|
-
* @returns {Promise<Array<Object>>} Credentials with string IDs, `createdAt`
|
|
88
|
-
* and `updatedAt`, and the (decrypted) data fields spread in, as
|
|
89
|
-
* findCredentialById returns them. Empty when the user has none.
|
|
90
|
-
* @abstract
|
|
91
|
-
*/
|
|
92
|
-
async findCredentialsByUserId(userId) {
|
|
93
|
-
throw new Error(
|
|
94
|
-
'Method findCredentialsByUserId must be implemented by subclass'
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
83
|
/**
|
|
99
84
|
* Update a credential by ID
|
|
100
85
|
*
|
|
@@ -188,29 +188,6 @@ class CredentialRepositoryMongo extends CredentialRepositoryInterface {
|
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
/**
|
|
192
|
-
* All credentials owned by a user, newest first.
|
|
193
|
-
*
|
|
194
|
-
* @param {string} userId - User ID
|
|
195
|
-
* @returns {Promise<Array<Object>>} Credentials with string IDs
|
|
196
|
-
*/
|
|
197
|
-
async findCredentialsByUserId(userId) {
|
|
198
|
-
if (!userId) return [];
|
|
199
|
-
const credentials = await this.prisma.credential.findMany({
|
|
200
|
-
where: { userId: String(userId) },
|
|
201
|
-
orderBy: { createdAt: 'desc' },
|
|
202
|
-
});
|
|
203
|
-
return credentials.map((credential) => ({
|
|
204
|
-
...(credential.data || {}),
|
|
205
|
-
id: credential.id,
|
|
206
|
-
userId: credential.userId,
|
|
207
|
-
externalId: credential.externalId,
|
|
208
|
-
authIsValid: credential.authIsValid,
|
|
209
|
-
createdAt: credential.createdAt,
|
|
210
|
-
updatedAt: credential.updatedAt,
|
|
211
|
-
}));
|
|
212
|
-
}
|
|
213
|
-
|
|
214
191
|
/**
|
|
215
192
|
* Update a credential by ID
|
|
216
193
|
* Replaces: Credential.findByIdAndUpdate(credentialId, { $set: updates })
|
|
@@ -205,34 +205,6 @@ class CredentialRepositoryPostgres extends CredentialRepositoryInterface {
|
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
/**
|
|
209
|
-
* All credentials owned by a user, newest first.
|
|
210
|
-
*
|
|
211
|
-
* @param {string} userId - User ID (string from application layer)
|
|
212
|
-
* @returns {Promise<Array<Object>>} Credentials with string IDs
|
|
213
|
-
*/
|
|
214
|
-
async findCredentialsByUserId(userId) {
|
|
215
|
-
let intUserId;
|
|
216
|
-
try {
|
|
217
|
-
intUserId = this._convertId(userId);
|
|
218
|
-
} catch {
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
|
-
const credentials = await this.prisma.credential.findMany({
|
|
222
|
-
where: { userId: intUserId },
|
|
223
|
-
orderBy: { createdAt: 'desc' },
|
|
224
|
-
});
|
|
225
|
-
return credentials.map((credential) => ({
|
|
226
|
-
...(credential.data || {}),
|
|
227
|
-
id: credential.id.toString(),
|
|
228
|
-
userId: credential.userId?.toString(),
|
|
229
|
-
externalId: credential.externalId,
|
|
230
|
-
authIsValid: credential.authIsValid,
|
|
231
|
-
createdAt: credential.createdAt,
|
|
232
|
-
updatedAt: credential.updatedAt,
|
|
233
|
-
}));
|
|
234
|
-
}
|
|
235
|
-
|
|
236
208
|
/**
|
|
237
209
|
* Update a credential by ID
|
|
238
210
|
*
|
|
@@ -39,12 +39,6 @@ const CORE_ENCRYPTION_SCHEMA = {
|
|
|
39
39
|
Token: {
|
|
40
40
|
fields: ['token'],
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
// Multi-step authorization (Management API v2): earlier steps can collect
|
|
44
|
-
// emails, usernames or one-time codes.
|
|
45
|
-
AuthorizationSession: {
|
|
46
|
-
fields: ['stepData'],
|
|
47
|
-
},
|
|
48
42
|
};
|
|
49
43
|
|
|
50
44
|
let customSchema = {};
|