attio-mcp 0.1.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/CHANGELOG.md +62 -0
- package/LICENSE +236 -0
- package/README.md +105 -0
- package/dist/api/attio-client.d.ts +25 -0
- package/dist/api/attio-client.d.ts.map +1 -0
- package/dist/api/attio-client.js +64 -0
- package/dist/api/attio-client.js.map +1 -0
- package/dist/api/attribute-types.d.ts +119 -0
- package/dist/api/attribute-types.d.ts.map +1 -0
- package/dist/api/attribute-types.js +320 -0
- package/dist/api/attribute-types.js.map +1 -0
- package/dist/api/client.d.ts +3 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +61 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/operations/batch.d.ts +55 -0
- package/dist/api/operations/batch.d.ts.map +1 -0
- package/dist/api/operations/batch.js +176 -0
- package/dist/api/operations/batch.js.map +1 -0
- package/dist/api/operations/crud.d.ts +61 -0
- package/dist/api/operations/crud.d.ts.map +1 -0
- package/dist/api/operations/crud.js +192 -0
- package/dist/api/operations/crud.js.map +1 -0
- package/dist/api/operations/index.d.ts +14 -0
- package/dist/api/operations/index.d.ts.map +1 -0
- package/dist/api/operations/index.js +18 -0
- package/dist/api/operations/index.js.map +1 -0
- package/dist/api/operations/lists.d.ts +66 -0
- package/dist/api/operations/lists.d.ts.map +1 -0
- package/dist/api/operations/lists.js +300 -0
- package/dist/api/operations/lists.js.map +1 -0
- package/dist/api/operations/notes.d.ts +29 -0
- package/dist/api/operations/notes.d.ts.map +1 -0
- package/dist/api/operations/notes.js +63 -0
- package/dist/api/operations/notes.js.map +1 -0
- package/dist/api/operations/retry.d.ts +48 -0
- package/dist/api/operations/retry.d.ts.map +1 -0
- package/dist/api/operations/retry.js +98 -0
- package/dist/api/operations/retry.js.map +1 -0
- package/dist/api/operations/search.d.ts +37 -0
- package/dist/api/operations/search.d.ts.map +1 -0
- package/dist/api/operations/search.js +186 -0
- package/dist/api/operations/search.js.map +1 -0
- package/dist/api/operations/tasks.d.ts +20 -0
- package/dist/api/operations/tasks.d.ts.map +1 -0
- package/dist/api/operations/tasks.js +87 -0
- package/dist/api/operations/tasks.js.map +1 -0
- package/dist/api/operations/types.d.ts +61 -0
- package/dist/api/operations/types.d.ts.map +1 -0
- package/dist/api/operations/types.js +10 -0
- package/dist/api/operations/types.js.map +1 -0
- package/dist/cli/commands/attributes.d.ts +34 -0
- package/dist/cli/commands/attributes.d.ts.map +1 -0
- package/dist/cli/commands/attributes.js +171 -0
- package/dist/cli/commands/attributes.js.map +1 -0
- package/dist/cli/discover.d.ts +3 -0
- package/dist/cli/discover.d.ts.map +1 -0
- package/dist/cli/discover.js +72 -0
- package/dist/cli/discover.js.map +1 -0
- package/dist/errors/api-errors.d.ts +191 -0
- package/dist/errors/api-errors.d.ts.map +1 -0
- package/dist/errors/api-errors.js +305 -0
- package/dist/errors/api-errors.js.map +1 -0
- package/dist/errors/company-errors.d.ts +40 -0
- package/dist/errors/company-errors.d.ts.map +1 -0
- package/dist/errors/company-errors.js +62 -0
- package/dist/errors/company-errors.js.map +1 -0
- package/dist/errors/value-match-error.d.ts +15 -0
- package/dist/errors/value-match-error.d.ts.map +1 -0
- package/dist/errors/value-match-error.js +40 -0
- package/dist/errors/value-match-error.js.map +1 -0
- package/dist/handlers/error-interceptor.d.ts +6 -0
- package/dist/handlers/error-interceptor.d.ts.map +1 -0
- package/dist/handlers/error-interceptor.js +17 -0
- package/dist/handlers/error-interceptor.js.map +1 -0
- package/dist/handlers/rate-limited-handler.d.ts +17 -0
- package/dist/handlers/rate-limited-handler.d.ts.map +1 -0
- package/dist/handlers/rate-limited-handler.js +126 -0
- package/dist/handlers/rate-limited-handler.js.map +1 -0
- package/dist/handlers/resources.d.ts +11 -0
- package/dist/handlers/resources.d.ts.map +1 -0
- package/dist/handlers/resources.js +109 -0
- package/dist/handlers/resources.js.map +1 -0
- package/dist/handlers/tool-configs/companies/attributes.d.ts +85 -0
- package/dist/handlers/tool-configs/companies/attributes.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/attributes.js +203 -0
- package/dist/handlers/tool-configs/companies/attributes.js.map +1 -0
- package/dist/handlers/tool-configs/companies/batch.d.ts +145 -0
- package/dist/handlers/tool-configs/companies/batch.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/batch.js +249 -0
- package/dist/handlers/tool-configs/companies/batch.js.map +1 -0
- package/dist/handlers/tool-configs/companies/crud.d.ts +103 -0
- package/dist/handlers/tool-configs/companies/crud.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/crud.js +157 -0
- package/dist/handlers/tool-configs/companies/crud.js.map +1 -0
- package/dist/handlers/tool-configs/companies/definitions.d.ts +5 -0
- package/dist/handlers/tool-configs/companies/definitions.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/definitions.js +9 -0
- package/dist/handlers/tool-configs/companies/definitions.js.map +1 -0
- package/dist/handlers/tool-configs/companies/formatters.d.ts +42 -0
- package/dist/handlers/tool-configs/companies/formatters.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/formatters.js +324 -0
- package/dist/handlers/tool-configs/companies/formatters.js.map +1 -0
- package/dist/handlers/tool-configs/companies/index.d.ts +642 -0
- package/dist/handlers/tool-configs/companies/index.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/index.js +86 -0
- package/dist/handlers/tool-configs/companies/index.js.map +1 -0
- package/dist/handlers/tool-configs/companies/notes.d.ts +61 -0
- package/dist/handlers/tool-configs/companies/notes.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/notes.js +109 -0
- package/dist/handlers/tool-configs/companies/notes.js.map +1 -0
- package/dist/handlers/tool-configs/companies/relationships.d.ts +137 -0
- package/dist/handlers/tool-configs/companies/relationships.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/relationships.js +163 -0
- package/dist/handlers/tool-configs/companies/relationships.js.map +1 -0
- package/dist/handlers/tool-configs/companies/search.d.ts +101 -0
- package/dist/handlers/tool-configs/companies/search.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/search.js +163 -0
- package/dist/handlers/tool-configs/companies/search.js.map +1 -0
- package/dist/handlers/tool-configs/companies/types.d.ts +6 -0
- package/dist/handlers/tool-configs/companies/types.d.ts.map +1 -0
- package/dist/handlers/tool-configs/companies/types.js +2 -0
- package/dist/handlers/tool-configs/companies/types.js.map +1 -0
- package/dist/handlers/tool-configs/index.d.ts +12 -0
- package/dist/handlers/tool-configs/index.d.ts.map +1 -0
- package/dist/handlers/tool-configs/index.js +12 -0
- package/dist/handlers/tool-configs/index.js.map +1 -0
- package/dist/handlers/tool-configs/lists.d.ts +459 -0
- package/dist/handlers/tool-configs/lists.d.ts.map +1 -0
- package/dist/handlers/tool-configs/lists.js +597 -0
- package/dist/handlers/tool-configs/lists.js.map +1 -0
- package/dist/handlers/tool-configs/paginated-people.d.ts +197 -0
- package/dist/handlers/tool-configs/paginated-people.d.ts.map +1 -0
- package/dist/handlers/tool-configs/paginated-people.js +256 -0
- package/dist/handlers/tool-configs/paginated-people.js.map +1 -0
- package/dist/handlers/tool-configs/people/activity-search.d.ts +98 -0
- package/dist/handlers/tool-configs/people/activity-search.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/activity-search.js +113 -0
- package/dist/handlers/tool-configs/people/activity-search.js.map +1 -0
- package/dist/handlers/tool-configs/people/advanced-search.d.ts +62 -0
- package/dist/handlers/tool-configs/people/advanced-search.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/advanced-search.js +74 -0
- package/dist/handlers/tool-configs/people/advanced-search.js.map +1 -0
- package/dist/handlers/tool-configs/people/crud.d.ts +63 -0
- package/dist/handlers/tool-configs/people/crud.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/crud.js +71 -0
- package/dist/handlers/tool-configs/people/crud.js.map +1 -0
- package/dist/handlers/tool-configs/people/date-search.d.ts +42 -0
- package/dist/handlers/tool-configs/people/date-search.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/date-search.js +93 -0
- package/dist/handlers/tool-configs/people/date-search.js.map +1 -0
- package/dist/handlers/tool-configs/people/formatters.d.ts +19 -0
- package/dist/handlers/tool-configs/people/formatters.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/formatters.js +98 -0
- package/dist/handlers/tool-configs/people/formatters.js.map +1 -0
- package/dist/handlers/tool-configs/people/index.d.ts +407 -0
- package/dist/handlers/tool-configs/people/index.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/index.js +30 -0
- package/dist/handlers/tool-configs/people/index.js.map +1 -0
- package/dist/handlers/tool-configs/people/notes.d.ts +38 -0
- package/dist/handlers/tool-configs/people/notes.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/notes.js +57 -0
- package/dist/handlers/tool-configs/people/notes.js.map +1 -0
- package/dist/handlers/tool-configs/people/relationships.d.ts +112 -0
- package/dist/handlers/tool-configs/people/relationships.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/relationships.js +173 -0
- package/dist/handlers/tool-configs/people/relationships.js.map +1 -0
- package/dist/handlers/tool-configs/people/search.d.ts +53 -0
- package/dist/handlers/tool-configs/people/search.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people/search.js +61 -0
- package/dist/handlers/tool-configs/people/search.js.map +1 -0
- package/dist/handlers/tool-configs/people-fix-complete.d.ts +6 -0
- package/dist/handlers/tool-configs/people-fix-complete.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people-fix-complete.js +76 -0
- package/dist/handlers/tool-configs/people-fix-complete.js.map +1 -0
- package/dist/handlers/tool-configs/people-fixed.d.ts +12 -0
- package/dist/handlers/tool-configs/people-fixed.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people-fixed.js +58 -0
- package/dist/handlers/tool-configs/people-fixed.js.map +1 -0
- package/dist/handlers/tool-configs/people-types.d.ts +32 -0
- package/dist/handlers/tool-configs/people-types.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people-types.js +5 -0
- package/dist/handlers/tool-configs/people-types.js.map +1 -0
- package/dist/handlers/tool-configs/people.d.ts +599 -0
- package/dist/handlers/tool-configs/people.d.ts.map +1 -0
- package/dist/handlers/tool-configs/people.js +817 -0
- package/dist/handlers/tool-configs/people.js.map +1 -0
- package/dist/handlers/tool-configs/prompts.d.ts +69 -0
- package/dist/handlers/tool-configs/prompts.d.ts.map +1 -0
- package/dist/handlers/tool-configs/prompts.js +90 -0
- package/dist/handlers/tool-configs/prompts.js.map +1 -0
- package/dist/handlers/tool-configs/rate-limited-people.d.ts +203 -0
- package/dist/handlers/tool-configs/rate-limited-people.d.ts.map +1 -0
- package/dist/handlers/tool-configs/rate-limited-people.js +44 -0
- package/dist/handlers/tool-configs/rate-limited-people.js.map +1 -0
- package/dist/handlers/tool-configs/records/index.d.ts +282 -0
- package/dist/handlers/tool-configs/records/index.d.ts.map +1 -0
- package/dist/handlers/tool-configs/records/index.js +277 -0
- package/dist/handlers/tool-configs/records/index.js.map +1 -0
- package/dist/handlers/tool-configs/records.d.ts +282 -0
- package/dist/handlers/tool-configs/records.d.ts.map +1 -0
- package/dist/handlers/tool-configs/records.js +277 -0
- package/dist/handlers/tool-configs/records.js.map +1 -0
- package/dist/handlers/tool-configs/resource-specific-tools.d.ts +15 -0
- package/dist/handlers/tool-configs/resource-specific-tools.d.ts.map +1 -0
- package/dist/handlers/tool-configs/resource-specific-tools.js +33 -0
- package/dist/handlers/tool-configs/resource-specific-tools.js.map +1 -0
- package/dist/handlers/tool-configs/tasks.d.ts +127 -0
- package/dist/handlers/tool-configs/tasks.d.ts.map +1 -0
- package/dist/handlers/tool-configs/tasks.js +95 -0
- package/dist/handlers/tool-configs/tasks.js.map +1 -0
- package/dist/handlers/tool-types.d.ts +47 -0
- package/dist/handlers/tool-types.d.ts.map +1 -0
- package/dist/handlers/tool-types.js +2 -0
- package/dist/handlers/tool-types.js.map +1 -0
- package/dist/handlers/tools/config-verifier.d.ts +27 -0
- package/dist/handlers/tools/config-verifier.d.ts.map +1 -0
- package/dist/handlers/tools/config-verifier.js +108 -0
- package/dist/handlers/tools/config-verifier.js.map +1 -0
- package/dist/handlers/tools/dispatcher/core.d.ts +12 -0
- package/dist/handlers/tools/dispatcher/core.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/core.js +276 -0
- package/dist/handlers/tools/dispatcher/core.js.map +1 -0
- package/dist/handlers/tools/dispatcher/formatting.d.ts +17 -0
- package/dist/handlers/tools/dispatcher/formatting.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/formatting.js +25 -0
- package/dist/handlers/tools/dispatcher/formatting.js.map +1 -0
- package/dist/handlers/tools/dispatcher/logging.d.ts +63 -0
- package/dist/handlers/tools/dispatcher/logging.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/logging.js +108 -0
- package/dist/handlers/tools/dispatcher/logging.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/batch.d.ts +29 -0
- package/dist/handlers/tools/dispatcher/operations/batch.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/batch.js +137 -0
- package/dist/handlers/tools/dispatcher/operations/batch.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/crud.d.ts +25 -0
- package/dist/handlers/tools/dispatcher/operations/crud.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/crud.js +110 -0
- package/dist/handlers/tools/dispatcher/operations/crud.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/details.d.ts +13 -0
- package/dist/handlers/tools/dispatcher/operations/details.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/details.js +52 -0
- package/dist/handlers/tools/dispatcher/operations/details.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/info.d.ts +25 -0
- package/dist/handlers/tools/dispatcher/operations/info.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/info.js +82 -0
- package/dist/handlers/tools/dispatcher/operations/info.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/lists.d.ts +62 -0
- package/dist/handlers/tools/dispatcher/operations/lists.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/lists.js +283 -0
- package/dist/handlers/tools/dispatcher/operations/lists.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/notes.d.ts +17 -0
- package/dist/handlers/tools/dispatcher/operations/notes.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/notes.js +102 -0
- package/dist/handlers/tools/dispatcher/operations/notes.js.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/search.d.ts +43 -0
- package/dist/handlers/tools/dispatcher/operations/search.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/operations/search.js +190 -0
- package/dist/handlers/tools/dispatcher/operations/search.js.map +1 -0
- package/dist/handlers/tools/dispatcher/validation.d.ts +27 -0
- package/dist/handlers/tools/dispatcher/validation.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher/validation.js +47 -0
- package/dist/handlers/tools/dispatcher/validation.js.map +1 -0
- package/dist/handlers/tools/dispatcher.d.ts +11 -0
- package/dist/handlers/tools/dispatcher.d.ts.map +1 -0
- package/dist/handlers/tools/dispatcher.js +15 -0
- package/dist/handlers/tools/dispatcher.js.map +1 -0
- package/dist/handlers/tools/error-types.d.ts +33 -0
- package/dist/handlers/tools/error-types.d.ts.map +1 -0
- package/dist/handlers/tools/error-types.js +21 -0
- package/dist/handlers/tools/error-types.js.map +1 -0
- package/dist/handlers/tools/formatters.d.ts +43 -0
- package/dist/handlers/tools/formatters.d.ts.map +1 -0
- package/dist/handlers/tools/formatters.js +170 -0
- package/dist/handlers/tools/formatters.js.map +1 -0
- package/dist/handlers/tools/index.d.ts +15 -0
- package/dist/handlers/tools/index.d.ts.map +1 -0
- package/dist/handlers/tools/index.js +34 -0
- package/dist/handlers/tools/index.js.map +1 -0
- package/dist/handlers/tools/registry.d.ts +1874 -0
- package/dist/handlers/tools/registry.d.ts.map +1 -0
- package/dist/handlers/tools/registry.js +103 -0
- package/dist/handlers/tools/registry.js.map +1 -0
- package/dist/health/http-server.d.ts +24 -0
- package/dist/health/http-server.d.ts.map +1 -0
- package/dist/health/http-server.js +106 -0
- package/dist/health/http-server.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +238 -0
- package/dist/index.js.map +1 -0
- package/dist/objects/base-operations.d.ts +41 -0
- package/dist/objects/base-operations.d.ts.map +1 -0
- package/dist/objects/base-operations.js +116 -0
- package/dist/objects/base-operations.js.map +1 -0
- package/dist/objects/batch-companies.d.ts +112 -0
- package/dist/objects/batch-companies.d.ts.map +1 -0
- package/dist/objects/batch-companies.js +347 -0
- package/dist/objects/batch-companies.js.map +1 -0
- package/dist/objects/companies/attributes.d.ts +83 -0
- package/dist/objects/companies/attributes.d.ts.map +1 -0
- package/dist/objects/companies/attributes.js +426 -0
- package/dist/objects/companies/attributes.js.map +1 -0
- package/dist/objects/companies/basic.d.ts +117 -0
- package/dist/objects/companies/basic.d.ts.map +1 -0
- package/dist/objects/companies/basic.js +367 -0
- package/dist/objects/companies/basic.js.map +1 -0
- package/dist/objects/companies/batch.d.ts +6 -0
- package/dist/objects/companies/batch.d.ts.map +1 -0
- package/dist/objects/companies/batch.js +6 -0
- package/dist/objects/companies/batch.js.map +1 -0
- package/dist/objects/companies/index.d.ts +13 -0
- package/dist/objects/companies/index.d.ts.map +1 -0
- package/dist/objects/companies/index.js +17 -0
- package/dist/objects/companies/index.js.map +1 -0
- package/dist/objects/companies/notes.d.ts +26 -0
- package/dist/objects/companies/notes.d.ts.map +1 -0
- package/dist/objects/companies/notes.js +199 -0
- package/dist/objects/companies/notes.js.map +1 -0
- package/dist/objects/companies/relationships.d.ts +41 -0
- package/dist/objects/companies/relationships.d.ts.map +1 -0
- package/dist/objects/companies/relationships.js +142 -0
- package/dist/objects/companies/relationships.js.map +1 -0
- package/dist/objects/companies/search.d.ts +158 -0
- package/dist/objects/companies/search.d.ts.map +1 -0
- package/dist/objects/companies/search.js +463 -0
- package/dist/objects/companies/search.js.map +1 -0
- package/dist/objects/companies/types.d.ts +27 -0
- package/dist/objects/companies/types.d.ts.map +1 -0
- package/dist/objects/companies/types.js +3 -0
- package/dist/objects/companies/types.js.map +1 -0
- package/dist/objects/lists.d.ts +148 -0
- package/dist/objects/lists.d.ts.map +1 -0
- package/dist/objects/lists.js +586 -0
- package/dist/objects/lists.js.map +1 -0
- package/dist/objects/paginated-people.d.ts +50 -0
- package/dist/objects/paginated-people.d.ts.map +1 -0
- package/dist/objects/paginated-people.js +171 -0
- package/dist/objects/paginated-people.js.map +1 -0
- package/dist/objects/people/basic.d.ts +90 -0
- package/dist/objects/people/basic.d.ts.map +1 -0
- package/dist/objects/people/basic.js +157 -0
- package/dist/objects/people/basic.js.map +1 -0
- package/dist/objects/people/batch.d.ts +24 -0
- package/dist/objects/people/batch.d.ts.map +1 -0
- package/dist/objects/people/batch.js +145 -0
- package/dist/objects/people/batch.js.map +1 -0
- package/dist/objects/people/index.d.ts +11 -0
- package/dist/objects/people/index.d.ts.map +1 -0
- package/dist/objects/people/index.js +17 -0
- package/dist/objects/people/index.js.map +1 -0
- package/dist/objects/people/notes.d.ts +20 -0
- package/dist/objects/people/notes.d.ts.map +1 -0
- package/dist/objects/people/notes.js +60 -0
- package/dist/objects/people/notes.js.map +1 -0
- package/dist/objects/people/relationships.d.ts +23 -0
- package/dist/objects/people/relationships.d.ts.map +1 -0
- package/dist/objects/people/relationships.js +116 -0
- package/dist/objects/people/relationships.js.map +1 -0
- package/dist/objects/people/search.d.ts +83 -0
- package/dist/objects/people/search.d.ts.map +1 -0
- package/dist/objects/people/search.js +286 -0
- package/dist/objects/people/search.js.map +1 -0
- package/dist/objects/people/types.d.ts +37 -0
- package/dist/objects/people/types.d.ts.map +1 -0
- package/dist/objects/people/types.js +71 -0
- package/dist/objects/people/types.js.map +1 -0
- package/dist/objects/people-write.d.ts +71 -0
- package/dist/objects/people-write.d.ts.map +1 -0
- package/dist/objects/people-write.js +261 -0
- package/dist/objects/people-write.js.map +1 -0
- package/dist/objects/records/formatters.d.ts +20 -0
- package/dist/objects/records/formatters.d.ts.map +1 -0
- package/dist/objects/records/formatters.js +47 -0
- package/dist/objects/records/formatters.js.map +1 -0
- package/dist/objects/records/index.d.ts +74 -0
- package/dist/objects/records/index.d.ts.map +1 -0
- package/dist/objects/records/index.js +374 -0
- package/dist/objects/records/index.js.map +1 -0
- package/dist/objects/records.d.ts +88 -0
- package/dist/objects/records.d.ts.map +1 -0
- package/dist/objects/records.js +432 -0
- package/dist/objects/records.js.map +1 -0
- package/dist/objects/tasks.d.ts +19 -0
- package/dist/objects/tasks.d.ts.map +1 -0
- package/dist/objects/tasks.js +23 -0
- package/dist/objects/tasks.js.map +1 -0
- package/dist/prompts/error-handler.d.ts +28 -0
- package/dist/prompts/error-handler.d.ts.map +1 -0
- package/dist/prompts/error-handler.js +47 -0
- package/dist/prompts/error-handler.js.map +1 -0
- package/dist/prompts/handlers.d.ts +49 -0
- package/dist/prompts/handlers.d.ts.map +1 -0
- package/dist/prompts/handlers.js +353 -0
- package/dist/prompts/handlers.js.map +1 -0
- package/dist/prompts/index.d.ts +11 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +15 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/templates/companies.d.ts +10 -0
- package/dist/prompts/templates/companies.d.ts.map +1 -0
- package/dist/prompts/templates/companies.js +128 -0
- package/dist/prompts/templates/companies.js.map +1 -0
- package/dist/prompts/templates/index.d.ts +42 -0
- package/dist/prompts/templates/index.d.ts.map +1 -0
- package/dist/prompts/templates/index.js +58 -0
- package/dist/prompts/templates/index.js.map +1 -0
- package/dist/prompts/templates/lists.d.ts +10 -0
- package/dist/prompts/templates/lists.d.ts.map +1 -0
- package/dist/prompts/templates/lists.js +127 -0
- package/dist/prompts/templates/lists.js.map +1 -0
- package/dist/prompts/templates/notes.d.ts +10 -0
- package/dist/prompts/templates/notes.d.ts.map +1 -0
- package/dist/prompts/templates/notes.js +119 -0
- package/dist/prompts/templates/notes.js.map +1 -0
- package/dist/prompts/templates/people.d.ts +10 -0
- package/dist/prompts/templates/people.d.ts.map +1 -0
- package/dist/prompts/templates/people.js +127 -0
- package/dist/prompts/templates/people.js.map +1 -0
- package/dist/prompts/types.d.ts +52 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +5 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/types/attio.d.ts +424 -0
- package/dist/types/attio.d.ts.map +1 -0
- package/dist/types/attio.js +116 -0
- package/dist/types/attio.js.map +1 -0
- package/dist/types/company-types.d.ts +52 -0
- package/dist/types/company-types.d.ts.map +1 -0
- package/dist/types/company-types.js +5 -0
- package/dist/types/company-types.js.map +1 -0
- package/dist/types/tool-types.d.ts +262 -0
- package/dist/types/tool-types.d.ts.map +1 -0
- package/dist/types/tool-types.js +6 -0
- package/dist/types/tool-types.js.map +1 -0
- package/dist/utils/api-fallback.d.ts +39 -0
- package/dist/utils/api-fallback.d.ts.map +1 -0
- package/dist/utils/api-fallback.js +94 -0
- package/dist/utils/api-fallback.js.map +1 -0
- package/dist/utils/attribute-mapping/attribute-mappers.d.ts +39 -0
- package/dist/utils/attribute-mapping/attribute-mappers.d.ts.map +1 -0
- package/dist/utils/attribute-mapping/attribute-mappers.js +394 -0
- package/dist/utils/attribute-mapping/attribute-mappers.js.map +1 -0
- package/dist/utils/attribute-mapping/filter-translator.d.ts +9 -0
- package/dist/utils/attribute-mapping/filter-translator.d.ts.map +1 -0
- package/dist/utils/attribute-mapping/filter-translator.js +104 -0
- package/dist/utils/attribute-mapping/filter-translator.js.map +1 -0
- package/dist/utils/attribute-mapping/index.d.ts +10 -0
- package/dist/utils/attribute-mapping/index.d.ts.map +1 -0
- package/dist/utils/attribute-mapping/index.js +12 -0
- package/dist/utils/attribute-mapping/index.js.map +1 -0
- package/dist/utils/attribute-mapping/legacy-maps.d.ts +11 -0
- package/dist/utils/attribute-mapping/legacy-maps.d.ts.map +1 -0
- package/dist/utils/attribute-mapping/legacy-maps.js +54 -0
- package/dist/utils/attribute-mapping/legacy-maps.js.map +1 -0
- package/dist/utils/attribute-mapping/mapping-utils.d.ts +90 -0
- package/dist/utils/attribute-mapping/mapping-utils.d.ts.map +1 -0
- package/dist/utils/attribute-mapping/mapping-utils.js +145 -0
- package/dist/utils/attribute-mapping/mapping-utils.js.map +1 -0
- package/dist/utils/auto-discovery.d.ts +22 -0
- package/dist/utils/auto-discovery.d.ts.map +1 -0
- package/dist/utils/auto-discovery.js +143 -0
- package/dist/utils/auto-discovery.js.map +1 -0
- package/dist/utils/cli-colors.d.ts +36 -0
- package/dist/utils/cli-colors.d.ts.map +1 -0
- package/dist/utils/cli-colors.js +35 -0
- package/dist/utils/cli-colors.js.map +1 -0
- package/dist/utils/config-loader.d.ts +41 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +167 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/config-migration.d.ts +140 -0
- package/dist/utils/config-migration.d.ts.map +1 -0
- package/dist/utils/config-migration.js +310 -0
- package/dist/utils/config-migration.js.map +1 -0
- package/dist/utils/date-utils.d.ts +63 -0
- package/dist/utils/date-utils.d.ts.map +1 -0
- package/dist/utils/date-utils.js +329 -0
- package/dist/utils/date-utils.js.map +1 -0
- package/dist/utils/debug-b2b-segment.d.ts +2 -0
- package/dist/utils/debug-b2b-segment.d.ts.map +1 -0
- package/dist/utils/debug-b2b-segment.js +67 -0
- package/dist/utils/debug-b2b-segment.js.map +1 -0
- package/dist/utils/domain-utils.d.ts +46 -0
- package/dist/utils/domain-utils.d.ts.map +1 -0
- package/dist/utils/domain-utils.js +143 -0
- package/dist/utils/domain-utils.js.map +1 -0
- package/dist/utils/dynamic-import.d.ts +33 -0
- package/dist/utils/dynamic-import.d.ts.map +1 -0
- package/dist/utils/dynamic-import.js +41 -0
- package/dist/utils/dynamic-import.js.map +1 -0
- package/dist/utils/error-enhancer.d.ts +23 -0
- package/dist/utils/error-enhancer.d.ts.map +1 -0
- package/dist/utils/error-enhancer.js +188 -0
- package/dist/utils/error-enhancer.js.map +1 -0
- package/dist/utils/error-handler.d.ts +89 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +336 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/filters/builders/activity.d.ts +13 -0
- package/dist/utils/filters/builders/activity.d.ts.map +1 -0
- package/dist/utils/filters/builders/activity.js +65 -0
- package/dist/utils/filters/builders/activity.js.map +1 -0
- package/dist/utils/filters/builders/basic.d.ts +13 -0
- package/dist/utils/filters/builders/basic.d.ts.map +1 -0
- package/dist/utils/filters/builders/basic.js +36 -0
- package/dist/utils/filters/builders/basic.js.map +1 -0
- package/dist/utils/filters/builders/complex.d.ts +31 -0
- package/dist/utils/filters/builders/complex.d.ts.map +1 -0
- package/dist/utils/filters/builders/complex.js +92 -0
- package/dist/utils/filters/builders/complex.js.map +1 -0
- package/dist/utils/filters/builders/date.d.ts +17 -0
- package/dist/utils/filters/builders/date.d.ts.map +1 -0
- package/dist/utils/filters/builders/date.js +51 -0
- package/dist/utils/filters/builders/date.js.map +1 -0
- package/dist/utils/filters/builders/index.d.ts +8 -0
- package/dist/utils/filters/builders/index.d.ts.map +1 -0
- package/dist/utils/filters/builders/index.js +8 -0
- package/dist/utils/filters/builders/index.js.map +1 -0
- package/dist/utils/filters/builders/numeric.d.ts +17 -0
- package/dist/utils/filters/builders/numeric.d.ts.map +1 -0
- package/dist/utils/filters/builders/numeric.js +61 -0
- package/dist/utils/filters/builders/numeric.js.map +1 -0
- package/dist/utils/filters/builders/text.d.ts +17 -0
- package/dist/utils/filters/builders/text.d.ts.map +1 -0
- package/dist/utils/filters/builders/text.js +47 -0
- package/dist/utils/filters/builders/text.js.map +1 -0
- package/dist/utils/filters/builders/types.d.ts +2 -0
- package/dist/utils/filters/builders/types.d.ts.map +1 -0
- package/dist/utils/filters/builders/types.js +2 -0
- package/dist/utils/filters/builders/types.js.map +1 -0
- package/dist/utils/filters/builders.d.ts +2 -0
- package/dist/utils/filters/builders.d.ts.map +1 -0
- package/dist/utils/filters/builders.js +2 -0
- package/dist/utils/filters/builders.js.map +1 -0
- package/dist/utils/filters/cache.d.ts +80 -0
- package/dist/utils/filters/cache.d.ts.map +1 -0
- package/dist/utils/filters/cache.js +212 -0
- package/dist/utils/filters/cache.js.map +1 -0
- package/dist/utils/filters/index.d.ts +51 -0
- package/dist/utils/filters/index.d.ts.map +1 -0
- package/dist/utils/filters/index.js +67 -0
- package/dist/utils/filters/index.js.map +1 -0
- package/dist/utils/filters/operators.d.ts +65 -0
- package/dist/utils/filters/operators.d.ts.map +1 -0
- package/dist/utils/filters/operators.js +214 -0
- package/dist/utils/filters/operators.js.map +1 -0
- package/dist/utils/filters/relationship.d.ts +81 -0
- package/dist/utils/filters/relationship.d.ts.map +1 -0
- package/dist/utils/filters/relationship.js +393 -0
- package/dist/utils/filters/relationship.js.map +1 -0
- package/dist/utils/filters/translators.d.ts +120 -0
- package/dist/utils/filters/translators.d.ts.map +1 -0
- package/dist/utils/filters/translators.js +397 -0
- package/dist/utils/filters/translators.js.map +1 -0
- package/dist/utils/filters/types.d.ts +77 -0
- package/dist/utils/filters/types.d.ts.map +1 -0
- package/dist/utils/filters/types.js +85 -0
- package/dist/utils/filters/types.js.map +1 -0
- package/dist/utils/filters/utils.d.ts +86 -0
- package/dist/utils/filters/utils.d.ts.map +1 -0
- package/dist/utils/filters/utils.js +142 -0
- package/dist/utils/filters/utils.js.map +1 -0
- package/dist/utils/filters/validation-utils.d.ts +123 -0
- package/dist/utils/filters/validation-utils.d.ts.map +1 -0
- package/dist/utils/filters/validation-utils.js +282 -0
- package/dist/utils/filters/validation-utils.js.map +1 -0
- package/dist/utils/filters/validators.d.ts +73 -0
- package/dist/utils/filters/validators.d.ts.map +1 -0
- package/dist/utils/filters/validators.js +311 -0
- package/dist/utils/filters/validators.js.map +1 -0
- package/dist/utils/json-serializer.d.ts +68 -0
- package/dist/utils/json-serializer.d.ts.map +1 -0
- package/dist/utils/json-serializer.js +235 -0
- package/dist/utils/json-serializer.js.map +1 -0
- package/dist/utils/logger.d.ts +226 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +323 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/numeric-utils.d.ts +27 -0
- package/dist/utils/numeric-utils.d.ts.map +1 -0
- package/dist/utils/numeric-utils.js +83 -0
- package/dist/utils/numeric-utils.js.map +1 -0
- package/dist/utils/pagination.d.ts +85 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +169 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/person-lookup.d.ts +35 -0
- package/dist/utils/person-lookup.d.ts.map +1 -0
- package/dist/utils/person-lookup.js +67 -0
- package/dist/utils/person-lookup.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +82 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +159 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/record-utils.d.ts +74 -0
- package/dist/utils/record-utils.d.ts.map +1 -0
- package/dist/utils/record-utils.js +312 -0
- package/dist/utils/record-utils.js.map +1 -0
- package/dist/utils/relationship-utils.d.ts +61 -0
- package/dist/utils/relationship-utils.d.ts.map +1 -0
- package/dist/utils/relationship-utils.js +242 -0
- package/dist/utils/relationship-utils.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +121 -0
- package/dist/utils/response-formatter.d.ts.map +1 -0
- package/dist/utils/response-formatter.js +188 -0
- package/dist/utils/response-formatter.js.map +1 -0
- package/dist/utils/uri-parser.d.ts +18 -0
- package/dist/utils/uri-parser.d.ts.map +1 -0
- package/dist/utils/uri-parser.js +31 -0
- package/dist/utils/uri-parser.js.map +1 -0
- package/dist/utils/validation.d.ts +59 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +264 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/utils/value-matcher.d.ts +58 -0
- package/dist/utils/value-matcher.d.ts.map +1 -0
- package/dist/utils/value-matcher.js +131 -0
- package/dist/utils/value-matcher.js.map +1 -0
- package/dist/validators/attribute-validator.d.ts +59 -0
- package/dist/validators/attribute-validator.d.ts.map +1 -0
- package/dist/validators/attribute-validator.js +531 -0
- package/dist/validators/attribute-validator.js.map +1 -0
- package/dist/validators/company/field_detector.d.ts +5 -0
- package/dist/validators/company/field_detector.d.ts.map +1 -0
- package/dist/validators/company/field_detector.js +95 -0
- package/dist/validators/company/field_detector.js.map +1 -0
- package/dist/validators/company/index.d.ts +26 -0
- package/dist/validators/company/index.d.ts.map +1 -0
- package/dist/validators/company/index.js +433 -0
- package/dist/validators/company/index.js.map +1 -0
- package/dist/validators/company/type_cache.d.ts +14 -0
- package/dist/validators/company/type_cache.d.ts.map +1 -0
- package/dist/validators/company/type_cache.js +28 -0
- package/dist/validators/company/type_cache.js.map +1 -0
- package/dist/validators/company/types.d.ts +8 -0
- package/dist/validators/company/types.d.ts.map +1 -0
- package/dist/validators/company/types.js +2 -0
- package/dist/validators/company/types.js.map +1 -0
- package/dist/validators/company-validator.d.ts +2 -0
- package/dist/validators/company-validator.d.ts.map +1 -0
- package/dist/validators/company-validator.js +2 -0
- package/dist/validators/company-validator.js.map +1 -0
- package/package.json +167 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utility for validating input data against schemas
|
|
3
|
+
*/
|
|
4
|
+
import { ErrorType } from './error-handler.js';
|
|
5
|
+
/**
|
|
6
|
+
* Result of a validation operation
|
|
7
|
+
*/
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
isValid: boolean;
|
|
10
|
+
errors: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Schema definition for validation
|
|
14
|
+
*/
|
|
15
|
+
export interface ValidationSchema {
|
|
16
|
+
type: string;
|
|
17
|
+
required?: string[];
|
|
18
|
+
properties?: Record<string, any>;
|
|
19
|
+
items?: ValidationSchema;
|
|
20
|
+
enum?: any[];
|
|
21
|
+
minLength?: number;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
minimum?: number;
|
|
24
|
+
maximum?: number;
|
|
25
|
+
pattern?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validates input data against a schema and returns the validation result
|
|
29
|
+
*
|
|
30
|
+
* @param input - Input data to validate
|
|
31
|
+
* @param schema - Schema to validate against
|
|
32
|
+
* @returns Validation result
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateInput(input: any, schema: ValidationSchema): ValidationResult;
|
|
35
|
+
/**
|
|
36
|
+
* Validates request parameters against a schema and returns a formatted error response if invalid
|
|
37
|
+
*
|
|
38
|
+
* @param input - Input data to validate
|
|
39
|
+
* @param schema - Schema to validate against
|
|
40
|
+
* @param errorFormatter - Function to format error response
|
|
41
|
+
* @returns Error response if invalid, null if valid
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateRequest(input: any, schema: ValidationSchema, errorFormatter: (error: Error, type: ErrorType, details: any) => any): any | null;
|
|
44
|
+
/**
|
|
45
|
+
* Validates that an ID string is valid and secure to use
|
|
46
|
+
*
|
|
47
|
+
* @param id - The ID to validate
|
|
48
|
+
* @returns True if the ID is valid, false otherwise
|
|
49
|
+
*/
|
|
50
|
+
export declare function isValidId(id: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Validates that a list ID is valid and safe to use
|
|
53
|
+
* Contains additional validation specific to Attio list IDs
|
|
54
|
+
*
|
|
55
|
+
* @param listId - The list ID to validate
|
|
56
|
+
* @returns True if the list ID is valid, false otherwise
|
|
57
|
+
*/
|
|
58
|
+
export declare function isValidListId(listId: string): boolean;
|
|
59
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA0OD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAOlB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,gBAAgB,EACxB,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,GAAG,GACnE,GAAG,GAAG,IAAI,CAYZ;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAuC7C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAkBrD"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utility for validating input data against schemas
|
|
3
|
+
*/
|
|
4
|
+
import { ErrorType } from './error-handler.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create a validation error message for a schema violation
|
|
7
|
+
*
|
|
8
|
+
* @param path - Path to the property with an error
|
|
9
|
+
* @param message - Error message for the violation
|
|
10
|
+
* @returns Formatted error message
|
|
11
|
+
*/
|
|
12
|
+
function formatError(path, message) {
|
|
13
|
+
return path ? `${path}: ${message}` : message;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validates that a value is of the expected type
|
|
17
|
+
*
|
|
18
|
+
* @param value - Value to validate
|
|
19
|
+
* @param expectedType - Expected type
|
|
20
|
+
* @param path - Path to the property
|
|
21
|
+
* @returns Error message if invalid, empty string if valid
|
|
22
|
+
*/
|
|
23
|
+
function validateType(value, expectedType, path) {
|
|
24
|
+
// Handle null/undefined
|
|
25
|
+
if (value === null || value === undefined) {
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
switch (expectedType) {
|
|
29
|
+
case 'string':
|
|
30
|
+
return typeof value === 'string'
|
|
31
|
+
? ''
|
|
32
|
+
: formatError(path, `Expected string, got ${typeof value}`);
|
|
33
|
+
case 'number':
|
|
34
|
+
return typeof value === 'number'
|
|
35
|
+
? ''
|
|
36
|
+
: formatError(path, `Expected number, got ${typeof value}`);
|
|
37
|
+
case 'boolean':
|
|
38
|
+
return typeof value === 'boolean'
|
|
39
|
+
? ''
|
|
40
|
+
: formatError(path, `Expected boolean, got ${typeof value}`);
|
|
41
|
+
case 'array':
|
|
42
|
+
return Array.isArray(value)
|
|
43
|
+
? ''
|
|
44
|
+
: formatError(path, `Expected array, got ${typeof value}`);
|
|
45
|
+
case 'object':
|
|
46
|
+
return typeof value === 'object' && !Array.isArray(value)
|
|
47
|
+
? ''
|
|
48
|
+
: formatError(path, `Expected object, got ${typeof value}`);
|
|
49
|
+
default:
|
|
50
|
+
return formatError(path, `Unknown type ${expectedType}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validates that a value matches the schema's constraints
|
|
55
|
+
*
|
|
56
|
+
* @param value - Value to validate
|
|
57
|
+
* @param schema - Schema to validate against
|
|
58
|
+
* @param path - Path to the property
|
|
59
|
+
* @returns Array of error messages
|
|
60
|
+
*/
|
|
61
|
+
function validateConstraints(value, schema, path) {
|
|
62
|
+
const errors = [];
|
|
63
|
+
// Skip validation for null/undefined values
|
|
64
|
+
if (value === null || value === undefined) {
|
|
65
|
+
return errors;
|
|
66
|
+
}
|
|
67
|
+
// Enum validation
|
|
68
|
+
if (schema.enum && !schema.enum.includes(value)) {
|
|
69
|
+
errors.push(formatError(path, `Value must be one of: ${schema.enum.join(', ')}`));
|
|
70
|
+
}
|
|
71
|
+
// String constraints
|
|
72
|
+
if (typeof value === 'string') {
|
|
73
|
+
if (schema.minLength !== undefined && value.length < schema.minLength) {
|
|
74
|
+
errors.push(formatError(path, `String must be at least ${schema.minLength} characters long`));
|
|
75
|
+
}
|
|
76
|
+
if (schema.maxLength !== undefined && value.length > schema.maxLength) {
|
|
77
|
+
errors.push(formatError(path, `String must be at most ${schema.maxLength} characters long`));
|
|
78
|
+
}
|
|
79
|
+
if (schema.pattern) {
|
|
80
|
+
const regex = new RegExp(schema.pattern);
|
|
81
|
+
if (!regex.test(value)) {
|
|
82
|
+
errors.push(formatError(path, `String must match pattern: ${schema.pattern}`));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Number constraints
|
|
87
|
+
if (typeof value === 'number') {
|
|
88
|
+
if (schema.minimum !== undefined && value < schema.minimum) {
|
|
89
|
+
errors.push(formatError(path, `Number must be greater than or equal to ${schema.minimum}`));
|
|
90
|
+
}
|
|
91
|
+
if (schema.maximum !== undefined && value > schema.maximum) {
|
|
92
|
+
errors.push(formatError(path, `Number must be less than or equal to ${schema.maximum}`));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Array constraints
|
|
96
|
+
if (Array.isArray(value) && schema.items) {
|
|
97
|
+
value.forEach((item, index) => {
|
|
98
|
+
const itemPath = path ? `${path}[${index}]` : `[${index}]`;
|
|
99
|
+
// Validate type
|
|
100
|
+
const itemSchema = schema.items;
|
|
101
|
+
const typeError = validateType(item, itemSchema.type, itemPath);
|
|
102
|
+
if (typeError) {
|
|
103
|
+
errors.push(typeError);
|
|
104
|
+
}
|
|
105
|
+
// Validate constraints recursively
|
|
106
|
+
const constraintErrors = validateConstraints(item, itemSchema, itemPath);
|
|
107
|
+
errors.push(...constraintErrors);
|
|
108
|
+
// Validate nested object or array
|
|
109
|
+
if ((itemSchema.type === 'object' || itemSchema.type === 'array') &&
|
|
110
|
+
item !== null &&
|
|
111
|
+
item !== undefined) {
|
|
112
|
+
const nestedErrors = validateValue(item, itemSchema, itemPath);
|
|
113
|
+
errors.push(...nestedErrors);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return errors;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validates a value against a schema
|
|
121
|
+
*
|
|
122
|
+
* @param value - Value to validate
|
|
123
|
+
* @param schema - Schema to validate against
|
|
124
|
+
* @param path - Path to the property
|
|
125
|
+
* @returns Array of error messages
|
|
126
|
+
*/
|
|
127
|
+
function validateValue(value, schema, path = '') {
|
|
128
|
+
const errors = [];
|
|
129
|
+
// Type validation
|
|
130
|
+
const typeError = validateType(value, schema.type, path);
|
|
131
|
+
if (typeError) {
|
|
132
|
+
errors.push(typeError);
|
|
133
|
+
return errors; // Don't continue validation if type is wrong
|
|
134
|
+
}
|
|
135
|
+
// Validate constraints
|
|
136
|
+
const constraintErrors = validateConstraints(value, schema, path);
|
|
137
|
+
errors.push(...constraintErrors);
|
|
138
|
+
// Object validation
|
|
139
|
+
if (schema.type === 'object' && schema.properties && value) {
|
|
140
|
+
// Required properties validation
|
|
141
|
+
if (schema.required) {
|
|
142
|
+
for (const requiredProp of schema.required) {
|
|
143
|
+
if (!(requiredProp in value)) {
|
|
144
|
+
errors.push(formatError(path ? `${path}.${requiredProp}` : requiredProp, 'Required property is missing'));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Property validation
|
|
149
|
+
if (schema.properties) {
|
|
150
|
+
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
151
|
+
if (propName in value) {
|
|
152
|
+
const propPath = path ? `${path}.${propName}` : propName;
|
|
153
|
+
const propValue = value[propName];
|
|
154
|
+
// Skip undefined/null for non-required fields
|
|
155
|
+
if ((propValue === undefined || propValue === null) &&
|
|
156
|
+
(!schema.required || !schema.required.includes(propName))) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const propErrors = validateValue(propValue, propSchema, propPath);
|
|
160
|
+
errors.push(...propErrors);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return errors;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Validates input data against a schema and returns the validation result
|
|
169
|
+
*
|
|
170
|
+
* @param input - Input data to validate
|
|
171
|
+
* @param schema - Schema to validate against
|
|
172
|
+
* @returns Validation result
|
|
173
|
+
*/
|
|
174
|
+
export function validateInput(input, schema) {
|
|
175
|
+
const errors = validateValue(input, schema);
|
|
176
|
+
return {
|
|
177
|
+
isValid: errors.length === 0,
|
|
178
|
+
errors,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Validates request parameters against a schema and returns a formatted error response if invalid
|
|
183
|
+
*
|
|
184
|
+
* @param input - Input data to validate
|
|
185
|
+
* @param schema - Schema to validate against
|
|
186
|
+
* @param errorFormatter - Function to format error response
|
|
187
|
+
* @returns Error response if invalid, null if valid
|
|
188
|
+
*/
|
|
189
|
+
export function validateRequest(input, schema, errorFormatter) {
|
|
190
|
+
const result = validateInput(input, schema);
|
|
191
|
+
if (!result.isValid) {
|
|
192
|
+
const error = new Error('Validation error: Invalid request parameters');
|
|
193
|
+
return errorFormatter(error, ErrorType.VALIDATION_ERROR, {
|
|
194
|
+
errors: result.errors,
|
|
195
|
+
input,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Validates that an ID string is valid and secure to use
|
|
202
|
+
*
|
|
203
|
+
* @param id - The ID to validate
|
|
204
|
+
* @returns True if the ID is valid, false otherwise
|
|
205
|
+
*/
|
|
206
|
+
export function isValidId(id) {
|
|
207
|
+
// Basic check for non-empty string
|
|
208
|
+
if (!id || typeof id !== 'string' || id.trim() === '') {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
// Check that the ID has a reasonable length
|
|
212
|
+
if (id.length < 3 || id.length > 100) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
// Check that the ID only contains valid characters
|
|
216
|
+
// Allowing alphanumeric, hyphens, and underscores
|
|
217
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(id)) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
// Check for dangerous patterns that could be used for injection
|
|
221
|
+
const dangerousPatterns = [
|
|
222
|
+
/--/, // SQL comment marker
|
|
223
|
+
/\/\*/, // SQL block comment start
|
|
224
|
+
/\*\//, // SQL block comment end
|
|
225
|
+
/\$\{/, // Template literal injection
|
|
226
|
+
/\.\./, // Path traversal
|
|
227
|
+
/\|\|/, // Command injection
|
|
228
|
+
/<script/i, // XSS attempt
|
|
229
|
+
/javascript:/i, // JavaScript protocol
|
|
230
|
+
/data:/i, // Data URL
|
|
231
|
+
/&#/, // HTML entities
|
|
232
|
+
/=/, // Assignment/parameter pollution
|
|
233
|
+
];
|
|
234
|
+
for (const pattern of dangerousPatterns) {
|
|
235
|
+
if (pattern.test(id)) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Validates that a list ID is valid and safe to use
|
|
243
|
+
* Contains additional validation specific to Attio list IDs
|
|
244
|
+
*
|
|
245
|
+
* @param listId - The list ID to validate
|
|
246
|
+
* @returns True if the list ID is valid, false otherwise
|
|
247
|
+
*/
|
|
248
|
+
export function isValidListId(listId) {
|
|
249
|
+
// First apply general ID validation
|
|
250
|
+
if (!isValidId(listId)) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
// Additional validation specific to list IDs
|
|
254
|
+
// Attio list IDs typically start with "list_" followed by alphanumeric characters
|
|
255
|
+
if (!/^list_[a-zA-Z0-9]+$/.test(listId)) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
// Ensure the ID isn't suspiciously long
|
|
259
|
+
if (listId.length > 50) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0B/C;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe;IAChD,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAChD,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,KAAU,EAAE,YAAoB,EAAE,IAAY;IAClE,wBAAwB;IACxB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,OAAO,KAAK,KAAK,QAAQ;gBAC9B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,wBAAwB,OAAO,KAAK,EAAE,CAAC,CAAC;QAEhE,KAAK,QAAQ;YACX,OAAO,OAAO,KAAK,KAAK,QAAQ;gBAC9B,CAAC,C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;IACxC,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface ValueMatch {
|
|
2
|
+
value: string;
|
|
3
|
+
similarity: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ValueMatchResult {
|
|
6
|
+
exactMatch?: string;
|
|
7
|
+
suggestions: ValueMatch[];
|
|
8
|
+
bestMatch?: ValueMatch;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for value matching behavior
|
|
12
|
+
*/
|
|
13
|
+
export interface ValueMatchConfig {
|
|
14
|
+
/** Minimum similarity score to consider a match (0-1) */
|
|
15
|
+
minSimilarity?: number;
|
|
16
|
+
/** Maximum number of suggestions to return */
|
|
17
|
+
maxSuggestions?: number;
|
|
18
|
+
/** Whether to use case-sensitive matching */
|
|
19
|
+
caseSensitive?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Find the best matching values from a list of valid options
|
|
23
|
+
*
|
|
24
|
+
* @param searchValue - The value to search for
|
|
25
|
+
* @param validValues - Array of valid values to match against
|
|
26
|
+
* @param config - Optional configuration for matching behavior
|
|
27
|
+
* @returns Match result with exact match or suggestions
|
|
28
|
+
*/
|
|
29
|
+
export declare function findBestValueMatch(searchValue: string, validValues: string[], config?: ValueMatchConfig): ValueMatchResult;
|
|
30
|
+
/**
|
|
31
|
+
* Format a value match error message with suggestions
|
|
32
|
+
*
|
|
33
|
+
* @param fieldName - The field being searched
|
|
34
|
+
* @param searchValue - The value that was searched for
|
|
35
|
+
* @param matchResult - The match result with suggestions
|
|
36
|
+
* @returns Formatted error message
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatValueMatchError(fieldName: string, searchValue: string, matchResult: ValueMatchResult): string;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a value contains a partial match
|
|
41
|
+
* Useful for "contains" type searches
|
|
42
|
+
*
|
|
43
|
+
* @param searchValue - The partial value to search for
|
|
44
|
+
* @param validValues - Array of valid values to check
|
|
45
|
+
* @param caseSensitive - Whether to use case-sensitive matching
|
|
46
|
+
* @returns Array of values that contain the search value
|
|
47
|
+
*/
|
|
48
|
+
export declare function findPartialMatches(searchValue: string, validValues: string[], caseSensitive?: boolean): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Get value suggestions for a field
|
|
51
|
+
* This could be extended to cache or fetch valid values from Attio
|
|
52
|
+
*
|
|
53
|
+
* @param fieldSlug - The field slug (e.g., 'type_persona')
|
|
54
|
+
* @param searchValue - The value being searched for
|
|
55
|
+
* @returns Array of suggested values or null if no suggestions available
|
|
56
|
+
*/
|
|
57
|
+
export declare function getValueSuggestions(fieldSlug: string, searchValue: string): Promise<ValueMatch[] | null>;
|
|
58
|
+
//# sourceMappingURL=value-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-matcher.d.ts","sourceRoot":"","sources":["../../src/utils/value-matcher.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,CAAC,EAAE,gBAAgB,GACxB,gBAAgB,CAyClB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,gBAAgB,GAC5B,MAAM,CAeR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,GAAE,OAAe,GAC7B,MAAM,EAAE,CASV;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,CA+B9B"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Value matching utilities for fuzzy matching field values
|
|
3
|
+
* Uses string-similarity for intelligent suggestions when exact matches fail
|
|
4
|
+
*/
|
|
5
|
+
import stringSimilarity from 'string-similarity';
|
|
6
|
+
const DEFAULT_CONFIG = {
|
|
7
|
+
minSimilarity: 0.4,
|
|
8
|
+
maxSuggestions: 3,
|
|
9
|
+
caseSensitive: false,
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Find the best matching values from a list of valid options
|
|
13
|
+
*
|
|
14
|
+
* @param searchValue - The value to search for
|
|
15
|
+
* @param validValues - Array of valid values to match against
|
|
16
|
+
* @param config - Optional configuration for matching behavior
|
|
17
|
+
* @returns Match result with exact match or suggestions
|
|
18
|
+
*/
|
|
19
|
+
export function findBestValueMatch(searchValue, validValues, config) {
|
|
20
|
+
const mergedConfig = { ...DEFAULT_CONFIG, ...config };
|
|
21
|
+
// Normalize for comparison if not case sensitive
|
|
22
|
+
const normalizedSearch = mergedConfig.caseSensitive
|
|
23
|
+
? searchValue
|
|
24
|
+
: searchValue.toLowerCase();
|
|
25
|
+
// Check for exact match first
|
|
26
|
+
const exactMatch = validValues.find((value) => {
|
|
27
|
+
const normalizedValue = mergedConfig.caseSensitive
|
|
28
|
+
? value
|
|
29
|
+
: value.toLowerCase();
|
|
30
|
+
return normalizedValue === normalizedSearch;
|
|
31
|
+
});
|
|
32
|
+
if (exactMatch) {
|
|
33
|
+
return {
|
|
34
|
+
exactMatch,
|
|
35
|
+
suggestions: [],
|
|
36
|
+
bestMatch: { value: exactMatch, similarity: 1.0 },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// No exact match, find similar values
|
|
40
|
+
const matches = stringSimilarity.findBestMatch(searchValue, validValues);
|
|
41
|
+
// Filter and sort suggestions by similarity
|
|
42
|
+
const suggestions = matches.ratings
|
|
43
|
+
.filter((rating) => rating.rating >= mergedConfig.minSimilarity)
|
|
44
|
+
.sort((a, b) => b.rating - a.rating)
|
|
45
|
+
.slice(0, mergedConfig.maxSuggestions)
|
|
46
|
+
.map((rating) => ({
|
|
47
|
+
value: rating.target,
|
|
48
|
+
similarity: rating.rating,
|
|
49
|
+
}));
|
|
50
|
+
return {
|
|
51
|
+
suggestions,
|
|
52
|
+
bestMatch: suggestions[0],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Format a value match error message with suggestions
|
|
57
|
+
*
|
|
58
|
+
* @param fieldName - The field being searched
|
|
59
|
+
* @param searchValue - The value that was searched for
|
|
60
|
+
* @param matchResult - The match result with suggestions
|
|
61
|
+
* @returns Formatted error message
|
|
62
|
+
*/
|
|
63
|
+
export function formatValueMatchError(fieldName, searchValue, matchResult) {
|
|
64
|
+
let message = `'${searchValue}' not found as '${fieldName}'.`;
|
|
65
|
+
if (matchResult.bestMatch && matchResult.bestMatch.similarity >= 0.7) {
|
|
66
|
+
message += ` Did you mean '${matchResult.bestMatch.value}'?`;
|
|
67
|
+
}
|
|
68
|
+
else if (matchResult.suggestions.length > 0) {
|
|
69
|
+
message += ' Did you mean one of these?';
|
|
70
|
+
matchResult.suggestions.forEach((suggestion) => {
|
|
71
|
+
message += `\n - ${suggestion.value} (${Math.round(suggestion.similarity * 100)}% match)`;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return message;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check if a value contains a partial match
|
|
78
|
+
* Useful for "contains" type searches
|
|
79
|
+
*
|
|
80
|
+
* @param searchValue - The partial value to search for
|
|
81
|
+
* @param validValues - Array of valid values to check
|
|
82
|
+
* @param caseSensitive - Whether to use case-sensitive matching
|
|
83
|
+
* @returns Array of values that contain the search value
|
|
84
|
+
*/
|
|
85
|
+
export function findPartialMatches(searchValue, validValues, caseSensitive = false) {
|
|
86
|
+
const normalizedSearch = caseSensitive
|
|
87
|
+
? searchValue
|
|
88
|
+
: searchValue.toLowerCase();
|
|
89
|
+
return validValues.filter((value) => {
|
|
90
|
+
const normalizedValue = caseSensitive ? value : value.toLowerCase();
|
|
91
|
+
return normalizedValue.includes(normalizedSearch);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get value suggestions for a field
|
|
96
|
+
* This could be extended to cache or fetch valid values from Attio
|
|
97
|
+
*
|
|
98
|
+
* @param fieldSlug - The field slug (e.g., 'type_persona')
|
|
99
|
+
* @param searchValue - The value being searched for
|
|
100
|
+
* @returns Array of suggested values or null if no suggestions available
|
|
101
|
+
*/
|
|
102
|
+
export async function getValueSuggestions(fieldSlug, searchValue) {
|
|
103
|
+
// This is where we could integrate with Attio API to fetch valid values
|
|
104
|
+
// For now, we'll use known values from our documentation
|
|
105
|
+
const knownValues = {
|
|
106
|
+
type_persona: [
|
|
107
|
+
'Plastic Surgeon',
|
|
108
|
+
'Medical Spa/Aesthetics',
|
|
109
|
+
'Dermatologist',
|
|
110
|
+
'Medical Practice',
|
|
111
|
+
'Wellness Center',
|
|
112
|
+
'Cosmetic Surgery',
|
|
113
|
+
'Aesthetic Medicine',
|
|
114
|
+
],
|
|
115
|
+
industry: [
|
|
116
|
+
'Healthcare',
|
|
117
|
+
'Technology',
|
|
118
|
+
'Finance',
|
|
119
|
+
'Education',
|
|
120
|
+
'Retail',
|
|
121
|
+
'Manufacturing',
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
const validValues = knownValues[fieldSlug];
|
|
125
|
+
if (!validValues) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const matchResult = findBestValueMatch(searchValue, validValues);
|
|
129
|
+
return matchResult.suggestions;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=value-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-matcher.js","sourceRoot":"","sources":["../../src/utils/value-matcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AAyBjD,MAAM,cAAc,GAAqB;IACvC,aAAa,EAAE,GAAG;IAClB,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,WAAmB,EACnB,WAAqB,EACrB,MAAyB;IAEzB,MAAM,YAAY,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IAEtD,iDAAiD;IACjD,MAAM,gBAAgB,GAAG,YAAY,CAAC,aAAa;QACjD,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;IAE9B,8BAA8B;IAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5C,MAAM,eAAe,GAAG,YAAY,CAAC,aAAa;YAChD,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO,eAAe,KAAK,gBAAgB,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE,CAAC;QACf,OAAO;YACL,UAAU;YACV,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE,K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|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation for Attio attribute types
|
|
3
|
+
* Provides validation and type conversion for attribute values
|
|
4
|
+
* to ensure they match Attio's expected types
|
|
5
|
+
*
|
|
6
|
+
* This module handles both validation and automatic type conversion
|
|
7
|
+
* for common data format mismatches, which is particularly useful for
|
|
8
|
+
* LLM-generated content where string representations of other data types
|
|
9
|
+
* are common.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Supported attribute types in Attio
|
|
13
|
+
*/
|
|
14
|
+
export type AttributeType = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'select' | 'record-reference';
|
|
15
|
+
/**
|
|
16
|
+
* Result of attribute validation
|
|
17
|
+
*/
|
|
18
|
+
export interface ValidationResult {
|
|
19
|
+
/** Whether the validation was successful */
|
|
20
|
+
valid: boolean;
|
|
21
|
+
/** The converted value (may differ from input if type conversion was applied) */
|
|
22
|
+
convertedValue?: any;
|
|
23
|
+
/** Error message if validation failed */
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Validates an attribute value against the expected type
|
|
28
|
+
*
|
|
29
|
+
* This function validates that a value matches the expected attribute type,
|
|
30
|
+
* and attempts to convert it when possible. It handles both strict validation
|
|
31
|
+
* and auto-conversion for common type mismatches.
|
|
32
|
+
*
|
|
33
|
+
* @param attributeName - The name of the attribute being validated
|
|
34
|
+
* @param value - The value to validate
|
|
35
|
+
* @param expectedType - The expected attribute type
|
|
36
|
+
* @returns Validation result with success status and optionally converted value
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Validate a string
|
|
40
|
+
* validateAttributeValue('company_name', 'Acme Inc', 'string')
|
|
41
|
+
* // Returns: { valid: true, convertedValue: 'Acme Inc' }
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Convert string to number
|
|
45
|
+
* validateAttributeValue('employee_count', '250', 'number')
|
|
46
|
+
* // Returns: { valid: true, convertedValue: 250 }
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // Convert string to boolean
|
|
50
|
+
* validateAttributeValue('is_active', 'yes', 'boolean')
|
|
51
|
+
* // Returns: { valid: true, convertedValue: true }
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Handle invalid values
|
|
55
|
+
* validateAttributeValue('revenue', 'not-a-number', 'number')
|
|
56
|
+
* // Returns: { valid: false, error: 'Invalid number value...' }
|
|
57
|
+
*/
|
|
58
|
+
export declare function validateAttributeValue(attributeName: string, value: any, expectedType: AttributeType): ValidationResult;
|
|
59
|
+
//# sourceMappingURL=attribute-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-validator.d.ts","sourceRoot":"","sources":["../../src/validators/attribute-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,kBAAkB,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,KAAK,EAAE,OAAO,CAAC;IACf,iFAAiF;IACjF,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,GAAG,EACV,YAAY,EAAE,aAAa,GAC1B,gBAAgB,CA4BlB"}
|