Skip to content

17455 components veriff #17536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

17455 components veriff #17536

wants to merge 2 commits into from

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Jul 8, 2025

Resolves #17455

Summary by CodeRabbit

  • New Features

    • Added the ability to create a new verification session with Veriff, supporting detailed personal, document, and address information.
    • Introduced an action to retrieve the decision for a specific Veriff verification session using a session ID.
  • Enhancements

    • Improved Veriff integration with a robust API client for session creation and decision retrieval.
    • Added support for gender, marital status, document types, and ID card type options.
  • Chores

    • Updated package dependencies and version for the Veriff integration.

Actions
 - Create Verification Decision
 - Find A Decision
@luancazarine luancazarine linked an issue Jul 8, 2025 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Jul 8, 2025

Walkthrough

New modules and actions were added to the Veriff integration, including the ability to create a verification session and retrieve a decision by session ID. Supporting utility and constants modules were introduced, and the Veriff app client was refactored to implement API calls. The package version and dependencies were also updated.

Changes

File(s) Change Summary
components/veriff/actions/create-verification/create-verification.mjs Added new action to create a Veriff verification session with multiple input properties.
components/veriff/actions/find-a-decision/find-a-decision.mjs Added new action to retrieve a decision for a session ID, including HMAC signature handling.
components/veriff/common/constants.mjs Introduced constants for API URLs, event types, status values, and option arrays.
components/veriff/common/utils.mjs Added utility function for parsing JSON objects from strings/arrays.
components/veriff/package.json Updated package version to 0.1.0 and added @pipedream/platform dependency.
components/veriff/veriff.app.mjs Refactored app client: removed unused code, added API methods for session creation and decision lookup.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CreateVerificationAction
    participant VeriffApp
    participant VeriffAPI

    User->>CreateVerificationAction: Provide verification details
    CreateVerificationAction->>VeriffApp: createVerificationSession(data)
    VeriffApp->>VeriffAPI: POST /sessions (with data)
    VeriffAPI-->>VeriffApp: Verification session response
    VeriffApp-->>CreateVerificationAction: Response
    CreateVerificationAction-->>User: Session info
Loading
sequenceDiagram
    participant User
    participant FindDecisionAction
    participant VeriffApp
    participant VeriffAPI

    User->>FindDecisionAction: Provide session ID
    FindDecisionAction->>VeriffApp: getSessionDecision({ sessionId, headers })
    VeriffApp->>VeriffAPI: GET /sessions/{sessionId}/decision (with HMAC signature)
    VeriffAPI-->>VeriffApp: Decision response
    VeriffApp-->>FindDecisionAction: Response
    FindDecisionAction-->>User: Decision info
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement "create-verification" action (create session via API) [#17455]
Implement "find-a-decision" action (fetch decision by session ID) [#17455]
Use correct Veriff API endpoints and authentication [#17455]
Provide supporting utilities and constants for Veriff workflows [#17455]

Poem

A bunny hops with code anew,
Veriff sessions now in view.
Decisions found with just an ID,
Constants, helpers—hoppily!
Version bumped, dependencies tight,
This rabbit’s work is pure delight.
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/veriff/actions/find-a-decision/find-a-decision.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

components/veriff/actions/create-verification/create-verification.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

components/veriff/common/constants.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

  • 2 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Jul 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jul 8, 2025 9:10pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 8, 2025 9:10pm

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
components/veriff/common/utils.mjs (1)

1-1: Consider renaming for better clarity.

The function name parseObject might be misleading since it can handle arrays and other types. Consider renaming to parseJson or parseJsonSafely for better clarity.

-export const parseObject = (obj) => {
+export const parseJson = (obj) => {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aca5029 and 8f35a7d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • components/veriff/actions/create-verification/create-verification.mjs (1 hunks)
  • components/veriff/actions/find-a-decision/find-a-decision.mjs (1 hunks)
  • components/veriff/common/constants.mjs (1 hunks)
  • components/veriff/common/utils.mjs (1 hunks)
  • components/veriff/package.json (2 hunks)
  • components/veriff/veriff.app.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
components/veriff/common/constants.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/veriff/package.json (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
components/veriff/veriff.app.mjs (1)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
components/veriff/actions/create-verification/create-verification.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (12)
components/veriff/common/constants.mjs (1)

1-66: Well-structured constants module with good organization.

The constants are properly organized with consistent naming conventions and good separation of concerns. The BASE_URL uses HTTPS which is appropriate for security.

components/veriff/package.json (2)

3-3: Appropriate version bump for new features.

The version update from 0.0.1 to 0.1.0 follows semantic versioning correctly for the addition of new functionality.


15-17: Correct dependency declaration.

The @pipedream/platform dependency is properly declared and the version constraint ^3.1.0 is appropriate for Pipedream components.

components/veriff/common/utils.mjs (1)

1-24: Well-implemented JSON parsing utility with good error handling.

The function correctly handles multiple input types (arrays, strings, other types) and includes proper error handling with try-catch blocks.

components/veriff/actions/find-a-decision/find-a-decision.mjs (2)

19-22: Correct HMAC signature implementation.

The HMAC SHA-256 signature generation using the secret key and session ID is implemented correctly and follows standard authentication practices.


4-35: Well-structured Pipedream action with proper authentication.

The action follows Pipedream conventions correctly, includes appropriate prop definitions, and implements the authentication flow properly with the HMAC signature.

components/veriff/veriff.app.mjs (3)

7-25: Well-implemented API client with proper structure.

The helper methods _baseUrl(), _headers(), and _makeRequest() are well-structured and follow common API client patterns. The authentication implementation using $auth.api_key is correct for Pipedream components.


26-40: Clean public method implementations.

The createVerificationSession() and getSessionDecision() methods are well-implemented with appropriate HTTP methods and clean parameter handling.


7-8: Ignore BASE_URL constant suggestion for Veriff

  • No components/veriff/common/constants.mjs or BASE_URL definition exists for this component.
  • components/veriff/veriff.app.mjs intentionally uses this.$auth.api_url to build ${this.$auth.api_url}/v1, allowing the API endpoint to be configured via Pipedream’s auth settings.
  • No action required.

Likely an incorrect or invalid review comment.

components/veriff/actions/create-verification/create-verification.mjs (3)

1-3: LGTM! Imports are properly structured.

The imports correctly reference the constants, utility functions, and app client from their respective modules.


5-10: LGTM! Action configuration follows best practices.

The action configuration is well-defined with appropriate key, name, description with documentation link, version, and type.


125-161: LGTM! Run method implementation is well-structured.

The run method correctly:

  • Calls the app's createVerificationSession method
  • Structures the data according to the API requirements
  • Uses the parseObject utility for consents
  • Provides appropriate success feedback
  • Returns the response

The nested data structure properly organizes personal, document, and address information as expected by the Veriff API.

Comment on lines +61 to +64
ID_CARD_TYPE_OPTIONS: [
"CE",
"TI",
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the completeness of ID card type options.

The ID_CARD_TYPE_OPTIONS only contains two values ("CE" and "TI"). Please verify this is complete according to the Veriff API documentation, as it seems quite limited compared to the other option arrays.


🌐 Web query:

What are the supported ID card types for the Veriff identity verification API?

💡 Result:

Veriff's identity verification API supports a wide range of government-issued identity documents from over 230 countries and territories. This includes more than 12,000 document specimens, such as passports, national ID cards, driver's licenses, and residence permits. (veriff.com)

The API is designed to automatically recognize and process various document types, including those in Latin-based, Cyrillic, Japanese, and Arabic scripts. This extensive support ensures that Veriff can verify identities globally, accommodating diverse document formats and languages. (veriff.com)

For a comprehensive list of supported document types and to ensure compatibility with specific ID cards, you can refer to Veriff's official documentation or contact their support team for detailed information.

Citations:


Ensure ID_CARD_TYPE_OPTIONS covers all supported Veriff document types

The array at components/veriff/common/constants.mjs (lines 61–64) currently only includes "CE" and "TI", but Veriff’s API recognizes a broad set of ID documents (passports, national ID cards, driver’s licenses, residence permits, etc.). Please update this constant to reflect all relevant ID card types your integration needs (or consider fetching the list dynamically from Veriff’s docs/API).

• File: components/veriff/common/constants.mjs
Lines: 61–64

ID_CARD_TYPE_OPTIONS: [
  // replace these two placeholders…
  "CE",
  "TI",
  // …with the full set of required ID document codes
],
🤖 Prompt for AI Agents
In components/veriff/common/constants.mjs at lines 61 to 64, the
ID_CARD_TYPE_OPTIONS array currently only includes "CE" and "TI", which is
incomplete. Update this array to include all supported Veriff document types
required by your integration, such as passports, national ID cards, driver’s
licenses, residence permits, etc. Alternatively, implement logic to fetch this
list dynamically from Veriff’s API or documentation to ensure it stays current.

Comment on lines +94 to +99
firstIssue: {
type: "string",
label: "First Issue",
description: "Date of first issue of the document (YYYY-MM-DD)",
optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add input validation for first issue date format.

The first issue field expects "YYYY-MM-DD" format but lacks validation to ensure users provide the correct format.

Consider adding validation to ensure the date format is correct:

 firstIssue: {
   type: "string",
   label: "First Issue",
   description: "Date of first issue of the document (YYYY-MM-DD)",
+  pattern: "^\\d{4}-\\d{2}-\\d{2}$",
   optional: true,
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
firstIssue: {
type: "string",
label: "First Issue",
description: "Date of first issue of the document (YYYY-MM-DD)",
optional: true,
},
firstIssue: {
type: "string",
label: "First Issue",
description: "Date of first issue of the document (YYYY-MM-DD)",
pattern: "^\\d{4}-\\d{2}-\\d{2}$",
optional: true,
},
🤖 Prompt for AI Agents
In components/veriff/actions/create-verification/create-verification.mjs around
lines 94 to 99, the firstIssue field lacks validation to ensure the date is in
"YYYY-MM-DD" format. Add a validation function or regex pattern to check the
input matches this date format and integrate it into the field definition to
prevent invalid date entries.

Comment on lines +75 to +80
number: {
type: "string",
label: "Document Number",
description: "Document number, [a-zA-Z0-9] characters only",
optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add input validation for document number format.

The document number field specifies "[a-zA-Z0-9] characters only" but lacks validation to enforce this constraint.

Consider adding validation to ensure the document number format is correct:

 number: {
   type: "string",
   label: "Document Number",
   description: "Document number, [a-zA-Z0-9] characters only",
+  pattern: "^[a-zA-Z0-9]+$",
   optional: true,
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
number: {
type: "string",
label: "Document Number",
description: "Document number, [a-zA-Z0-9] characters only",
optional: true,
},
number: {
type: "string",
label: "Document Number",
description: "Document number, [a-zA-Z0-9] characters only",
pattern: "^[a-zA-Z0-9]+$",
optional: true,
},
🤖 Prompt for AI Agents
In components/veriff/actions/create-verification/create-verification.mjs around
lines 75 to 80, the document number field lacks validation to enforce the
allowed character set [a-zA-Z0-9]. Add a validation function or regex pattern to
check that the input contains only alphanumeric characters and integrate this
validation into the field definition to reject invalid inputs.

Comment on lines +50 to +55
dateOfBirth: {
type: "string",
label: "Date of Birth",
description: "Person's date of birth (YYYY-MM-DD)",
optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add input validation for date format.

The date of birth field expects "YYYY-MM-DD" format but lacks validation to ensure users provide the correct format.

Consider adding validation to ensure the date format is correct:

 dateOfBirth: {
   type: "string",
   label: "Date of Birth",
   description: "Person's date of birth (YYYY-MM-DD)",
+  pattern: "^\\d{4}-\\d{2}-\\d{2}$",
   optional: true,
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
dateOfBirth: {
type: "string",
label: "Date of Birth",
description: "Person's date of birth (YYYY-MM-DD)",
optional: true,
},
dateOfBirth: {
type: "string",
label: "Date of Birth",
description: "Person's date of birth (YYYY-MM-DD)",
pattern: "^\\d{4}-\\d{2}-\\d{2}$",
optional: true,
},
🤖 Prompt for AI Agents
In components/veriff/actions/create-verification/create-verification.mjs around
lines 50 to 55, the dateOfBirth field lacks validation to ensure the input
matches the expected "YYYY-MM-DD" format. Add a validation function or regex
pattern to check the date string format and reject or flag inputs that do not
conform to this pattern, ensuring only correctly formatted dates are accepted.

Comment on lines +81 to +86
country: {
type: "string",
label: "Country",
description: "Document issuing country (ISO 3166-1 alpha-2)",
optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add input validation for country code format.

The country field expects "ISO 3166-1 alpha-2" format but lacks validation to ensure users provide valid country codes.

Consider adding validation to ensure the country code format is correct:

 country: {
   type: "string",
   label: "Country",
   description: "Document issuing country (ISO 3166-1 alpha-2)",
+  pattern: "^[A-Z]{2}$",
   optional: true,
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
country: {
type: "string",
label: "Country",
description: "Document issuing country (ISO 3166-1 alpha-2)",
optional: true,
},
country: {
type: "string",
label: "Country",
description: "Document issuing country (ISO 3166-1 alpha-2)",
pattern: "^[A-Z]{2}$",
optional: true,
},
🤖 Prompt for AI Agents
In components/veriff/actions/create-verification/create-verification.mjs around
lines 81 to 86, the country field lacks validation to ensure the input matches
the ISO 3166-1 alpha-2 format. Add a validation function or regex pattern to
check that the country code is exactly two uppercase letters, and integrate this
validation into the field definition to reject invalid inputs.

Comment on lines +118 to +123
consents: {
type: "string[]",
label: "Consents",
description: "Array of objects listing the type of consent given. Optional, should be only included for features that require consent",
optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Clarify the consents data type and structure.

The consents field is defined as string[] but is processed with parseObject() on line 153, which suggests it might be a JSON string rather than an array.

Consider clarifying the data type and providing an example:

 consents: {
-  type: "string[]",
+  type: "string",
   label: "Consents",
-  description: "Array of objects listing the type of consent given. Optional, should be only included for features that require consent",
+  description: "JSON string representing an array of objects listing the type of consent given. Example: `[{\"type\": \"data_processing\", \"given\": true}]`. Optional, should be only included for features that require consent",
   optional: true,
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
consents: {
type: "string[]",
label: "Consents",
description: "Array of objects listing the type of consent given. Optional, should be only included for features that require consent",
optional: true,
},
consents: {
type: "string",
label: "Consents",
description: "JSON string representing an array of objects listing the type of consent given. Example: `[{\"type\": \"data_processing\", \"given\": true}]`. Optional, should be only included for features that require consent",
optional: true,
},
🤖 Prompt for AI Agents
In components/veriff/actions/create-verification/create-verification.mjs around
lines 118 to 123, the consents field is declared as a string array but is parsed
as an object later, indicating a mismatch. Update the consents field type to
"string" to reflect it being a JSON string, and clarify in the description that
it should be a JSON string representing an array of consent objects. Optionally,
add an example of the expected JSON string format to improve clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] veriff
1 participant