@friggframework/core 2.0.0--canary.580.9716b6d.0 → 2.0.0--canary.5ff5209.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.
@@ -507,7 +507,8 @@ function setEntityRoutes(router, authenticateUser, useCases) {
507
507
  const params = checkRequiredParams(req.query, ['entityType']);
508
508
  const module = await getModuleInstanceFromType.execute(
509
509
  userId,
510
- params.entityType
510
+ params.entityType,
511
+ { state: req.query.state }
511
512
  );
512
513
  const areRequirementsValid =
513
514
  module.validateAuthorizationRequirements();
package/modules/module.js CHANGED
@@ -20,8 +20,9 @@ class Module extends Delegate {
20
20
  * @param {Object} params.definition The definition of the Api Module
21
21
  * @param {string} params.userId The user id
22
22
  * @param {Object} params.entity The entity record from the database
23
+ * @param {string} [params.state] Optional OAuth state value forwarded to the API client (round-trips through the OAuth provider).
23
24
  */
24
- constructor({ definition, userId = null, entity: entityObj = null }) {
25
+ constructor({ definition, userId = null, entity: entityObj = null, state = null }) {
25
26
  super({ definition, userId, entity: entityObj });
26
27
 
27
28
  this.validateDefinition(definition);
@@ -46,6 +47,7 @@ class Module extends Delegate {
46
47
  const apiParams = {
47
48
  ...this.definition.env,
48
49
  delegate: this,
50
+ ...(state ? { state } : {}),
49
51
  ...(this.credential?.data
50
52
  ? this.apiParamsFromCredential(this.credential.data)
51
53
  : {}), // Handle case when credential is undefined
@@ -13,8 +13,10 @@ class GetModuleInstanceFromType {
13
13
  * Retrieve a Module instance for a given user and entity/module type.
14
14
  * @param {string} userId
15
15
  * @param {string} type – human-readable module/entity type (e.g. "Hubspot")
16
+ * @param {Object} [options]
17
+ * @param {string} [options.state] – optional OAuth state value to be forwarded to the API client (round-trips through the OAuth provider).
16
18
  */
17
- async execute(userId, type) {
19
+ async execute(userId, type, options = {}) {
18
20
  const moduleDefinition = this.moduleDefinitions.find(
19
21
  (def) => def.getName() === type
20
22
  );
@@ -24,6 +26,7 @@ class GetModuleInstanceFromType {
24
26
  return new Module({
25
27
  userId,
26
28
  definition: moduleDefinition,
29
+ state: options.state,
27
30
  });
28
31
  }
29
32
  }
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--canary.580.9716b6d.0",
4
+ "version": "2.0.0--canary.5ff5209.0",
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--canary.580.9716b6d.0",
42
- "@friggframework/prettier-config": "2.0.0--canary.580.9716b6d.0",
43
- "@friggframework/test": "2.0.0--canary.580.9716b6d.0",
41
+ "@friggframework/eslint-config": "2.0.0--canary.5ff5209.0",
42
+ "@friggframework/prettier-config": "2.0.0--canary.5ff5209.0",
43
+ "@friggframework/test": "2.0.0--canary.5ff5209.0",
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": "9716b6d61164b122128921fcdbed420549a0fe44"
83
+ "gitHead": "5ff5209460d3a908810fe53b5ff07eacccde963e"
84
84
  }