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,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for domain extraction and validation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Extracts domain from various input formats
|
|
6
|
+
*
|
|
7
|
+
* @param input - Input string that may contain a domain, URL, or email
|
|
8
|
+
* @returns Extracted domain or null if no valid domain found
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* extractDomain("https://example.com/path") // Returns "example.com"
|
|
12
|
+
* extractDomain("john@example.com") // Returns "example.com"
|
|
13
|
+
* extractDomain("example.com") // Returns "example.com"
|
|
14
|
+
* extractDomain("company name") // Returns null
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function extractDomain(input) {
|
|
18
|
+
if (!input || typeof input !== 'string') {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
// Clean up input
|
|
22
|
+
const cleanInput = input.trim().toLowerCase();
|
|
23
|
+
// Check for email format
|
|
24
|
+
const emailMatch = cleanInput.match(/^[^\s@]+@([^\s@]+\.[^\s@]+)$/);
|
|
25
|
+
if (emailMatch) {
|
|
26
|
+
return emailMatch[1];
|
|
27
|
+
}
|
|
28
|
+
// Check for URL format
|
|
29
|
+
try {
|
|
30
|
+
const url = new URL(cleanInput.startsWith('http') ? cleanInput : `https://${cleanInput}`);
|
|
31
|
+
const hostname = url.hostname;
|
|
32
|
+
// Validate that hostname looks like a domain
|
|
33
|
+
if (isValidDomain(hostname)) {
|
|
34
|
+
return normalizeDomain(hostname);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
// Not a valid URL, continue with other checks
|
|
39
|
+
}
|
|
40
|
+
// Check if input is already a domain
|
|
41
|
+
if (isValidDomain(cleanInput)) {
|
|
42
|
+
return normalizeDomain(cleanInput);
|
|
43
|
+
}
|
|
44
|
+
// Try to extract domain from text that might contain a domain
|
|
45
|
+
const domainPattern = /(?:https?:\/\/)?(?:www\.)?([a-zA-Z0-9-]+\.[a-zA-Z]{2,})/;
|
|
46
|
+
const match = cleanInput.match(domainPattern);
|
|
47
|
+
if (match && isValidDomain(match[1])) {
|
|
48
|
+
return normalizeDomain(match[1]);
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validates if a string is a valid domain format
|
|
54
|
+
*
|
|
55
|
+
* @param domain - Domain string to validate
|
|
56
|
+
* @returns True if domain appears valid
|
|
57
|
+
*/
|
|
58
|
+
export function isValidDomain(domain) {
|
|
59
|
+
if (!domain || typeof domain !== 'string') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
// Basic domain validation
|
|
63
|
+
const domainRegex = /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/;
|
|
64
|
+
return domainRegex.test(domain) && domain.length <= 253;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Normalizes domain for consistent matching
|
|
68
|
+
*
|
|
69
|
+
* @param domain - Domain to normalize
|
|
70
|
+
* @returns Normalized domain
|
|
71
|
+
*/
|
|
72
|
+
export function normalizeDomain(domain) {
|
|
73
|
+
if (!domain) {
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
return domain
|
|
77
|
+
.trim()
|
|
78
|
+
.toLowerCase()
|
|
79
|
+
.replace(/^www\./, '');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Checks if a query likely contains a domain
|
|
83
|
+
*
|
|
84
|
+
* @param query - Search query to analyze
|
|
85
|
+
* @returns True if query appears to contain domain information
|
|
86
|
+
*/
|
|
87
|
+
export function hasDomainIndicators(query) {
|
|
88
|
+
if (!query) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const indicators = [
|
|
92
|
+
/\.(com|org|net|edu|gov|mil|io|co|ai|tech|app|dev|xyz)/i,
|
|
93
|
+
/@[a-zA-Z0-9-]+\./,
|
|
94
|
+
/https?:\/\//,
|
|
95
|
+
/www\./,
|
|
96
|
+
];
|
|
97
|
+
return indicators.some((pattern) => pattern.test(query));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Extracts multiple potential domains from a query
|
|
101
|
+
*
|
|
102
|
+
* @param query - Query that may contain multiple domains
|
|
103
|
+
* @returns Array of extracted domains
|
|
104
|
+
*/
|
|
105
|
+
export function extractAllDomains(query) {
|
|
106
|
+
if (!query) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const domains = [];
|
|
110
|
+
// Extract email domains
|
|
111
|
+
const emailMatches = query.match(/[^\s@]+@([^\s@]+\.[^\s@]+)/g);
|
|
112
|
+
if (emailMatches) {
|
|
113
|
+
emailMatches.forEach((email) => {
|
|
114
|
+
const domain = extractDomain(email);
|
|
115
|
+
if (domain) {
|
|
116
|
+
domains.push(domain);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Extract URL domains
|
|
121
|
+
const urlMatches = query.match(/https?:\/\/[^\s]+/g);
|
|
122
|
+
if (urlMatches) {
|
|
123
|
+
urlMatches.forEach((url) => {
|
|
124
|
+
const domain = extractDomain(url);
|
|
125
|
+
if (domain) {
|
|
126
|
+
domains.push(domain);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Extract standalone domains (including subdomains)
|
|
131
|
+
const domainMatches = query.match(/(?:^|\s|,)([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,})(?=\s|,|$)/g);
|
|
132
|
+
if (domainMatches) {
|
|
133
|
+
domainMatches.forEach((match) => {
|
|
134
|
+
const domain = extractDomain(match.trim().replace(/^[,\s]+/, ''));
|
|
135
|
+
if (domain) {
|
|
136
|
+
domains.push(domain);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// Remove duplicates and normalize
|
|
141
|
+
return [...new Set(domains.map(normalizeDomain))];
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=domain-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-utils.js","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB;IACjB,MAAM,UAAU,GAAG,KAAK,CA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UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,UAAU,EAAE,CAAC;QACf,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACzB,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oDAAoD;IACpD,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAC/B,wEAAwE,CACzE,CAAC;IACF,IAAI,aAAa,EAAE,CAAC;QAClB,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC9B,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;YAClE,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kCAAkC;IAClC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for dynamically importing ES modules
|
|
3
|
+
*
|
|
4
|
+
* This module provides a wrapper around the dynamic import() function to make it easier to
|
|
5
|
+
* work with ES modules in a Node.js environment that may be transitioning from CommonJS.
|
|
6
|
+
* It helps address common compatibility issues that arise when mixing module systems,
|
|
7
|
+
* such as "require is not defined in ES module scope" errors.
|
|
8
|
+
*
|
|
9
|
+
* Use cases:
|
|
10
|
+
* 1. Loading modules at runtime based on configuration
|
|
11
|
+
* 2. Conditional loading of modules to improve startup performance
|
|
12
|
+
* 3. Handling imports that may not be available in all environments
|
|
13
|
+
* 4. Supporting both CommonJS and ES module imports in the same codebase
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Dynamically imports a module in an environment-agnostic way
|
|
17
|
+
*
|
|
18
|
+
* This function wraps the standard dynamic import() with error handling and logging.
|
|
19
|
+
* It can be used to load both ES modules and CommonJS modules in an ES module context.
|
|
20
|
+
*
|
|
21
|
+
* @param moduleName - Name of the module to import (e.g., 'handlebars', './config.js')
|
|
22
|
+
* @returns Promise resolving to the imported module
|
|
23
|
+
* @throws Error if the module cannot be imported
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Load a module dynamically
|
|
27
|
+
* const handlebars = await dynamicImport('handlebars');
|
|
28
|
+
*
|
|
29
|
+
* // Use with destructuring
|
|
30
|
+
* const { compile, registerHelper } = await dynamicImport('handlebars');
|
|
31
|
+
*/
|
|
32
|
+
export declare function dynamicImport(moduleName: string): Promise<any>;
|
|
33
|
+
//# sourceMappingURL=dynamic-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-import.d.ts","sourceRoot":"","sources":["../../src/utils/dynamic-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAWpE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for dynamically importing ES modules
|
|
3
|
+
*
|
|
4
|
+
* This module provides a wrapper around the dynamic import() function to make it easier to
|
|
5
|
+
* work with ES modules in a Node.js environment that may be transitioning from CommonJS.
|
|
6
|
+
* It helps address common compatibility issues that arise when mixing module systems,
|
|
7
|
+
* such as "require is not defined in ES module scope" errors.
|
|
8
|
+
*
|
|
9
|
+
* Use cases:
|
|
10
|
+
* 1. Loading modules at runtime based on configuration
|
|
11
|
+
* 2. Conditional loading of modules to improve startup performance
|
|
12
|
+
* 3. Handling imports that may not be available in all environments
|
|
13
|
+
* 4. Supporting both CommonJS and ES module imports in the same codebase
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Dynamically imports a module in an environment-agnostic way
|
|
17
|
+
*
|
|
18
|
+
* This function wraps the standard dynamic import() with error handling and logging.
|
|
19
|
+
* It can be used to load both ES modules and CommonJS modules in an ES module context.
|
|
20
|
+
*
|
|
21
|
+
* @param moduleName - Name of the module to import (e.g., 'handlebars', './config.js')
|
|
22
|
+
* @returns Promise resolving to the imported module
|
|
23
|
+
* @throws Error if the module cannot be imported
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Load a module dynamically
|
|
27
|
+
* const handlebars = await dynamicImport('handlebars');
|
|
28
|
+
*
|
|
29
|
+
* // Use with destructuring
|
|
30
|
+
* const { compile, registerHelper } = await dynamicImport('handlebars');
|
|
31
|
+
*/
|
|
32
|
+
export async function dynamicImport(moduleName) {
|
|
33
|
+
try {
|
|
34
|
+
return await import(moduleName);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(`Error importing module ${moduleName}:`, error);
|
|
38
|
+
throw new Error(`Failed to import module "${moduleName}": ${error.message || 'Unknown error'}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=dynamic-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-import.js","sourceRoot":"","sources":["../../src/utils/dynamic-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAkB;IACpD,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,0BAA0B,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9D,MAAM,IAAI,KAAK,CACb,4BAA4B,UAAU,MACpC,KAAK,CAAC,OAAO,IAAI,eACnB,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhance an API error with value suggestions if applicable
|
|
3
|
+
*/
|
|
4
|
+
export declare function enhanceApiError(error: any): Error;
|
|
5
|
+
/**
|
|
6
|
+
* Check if an error is a value mismatch that we can enhance
|
|
7
|
+
*/
|
|
8
|
+
export declare function isValueMismatchError(error: any): {
|
|
9
|
+
isMismatch: boolean;
|
|
10
|
+
fieldSlug?: string;
|
|
11
|
+
searchValue?: string;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Get valid values for a field (if known)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getKnownFieldValues(fieldSlug: string): string[] | null;
|
|
18
|
+
/**
|
|
19
|
+
* Add or update known field values
|
|
20
|
+
* This could be populated from Attio API discovery
|
|
21
|
+
*/
|
|
22
|
+
export declare function updateKnownFieldValues(fieldSlug: string, values: string[]): void;
|
|
23
|
+
//# sourceMappingURL=error-enhancer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-enhancer.d.ts","sourceRoot":"","sources":["../../src/utils/error-enhancer.ts"],"names":[],"mappings":"AAmLA;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,CAiEjD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG;IAChD,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAiCA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAEtE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EAAE,GACf,IAAI,CAEN"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhances API errors with helpful suggestions for value mismatches
|
|
3
|
+
*/
|
|
4
|
+
import { ValueMatchError } from '../errors/value-match-error.js';
|
|
5
|
+
import { findBestValueMatch, } from './value-matcher.js';
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
// Known valid values for select fields - this should ideally come from Attio API
|
|
8
|
+
const KNOWN_FIELD_VALUES = {
|
|
9
|
+
type_persona: [
|
|
10
|
+
'Plastic Surgeon',
|
|
11
|
+
'Medical Spa/Aesthetics',
|
|
12
|
+
'Dermatologist',
|
|
13
|
+
'Medical Practice',
|
|
14
|
+
'Wellness Center',
|
|
15
|
+
'Cosmetic Surgery',
|
|
16
|
+
'Aesthetic Medicine',
|
|
17
|
+
'Primary Care',
|
|
18
|
+
'Specialist',
|
|
19
|
+
'Hospital',
|
|
20
|
+
'Clinic',
|
|
21
|
+
],
|
|
22
|
+
industry: [
|
|
23
|
+
'Healthcare',
|
|
24
|
+
'Technology',
|
|
25
|
+
'Finance',
|
|
26
|
+
'Education',
|
|
27
|
+
'Retail',
|
|
28
|
+
'Manufacturing',
|
|
29
|
+
'Hospitality',
|
|
30
|
+
'Real Estate',
|
|
31
|
+
'Professional Services',
|
|
32
|
+
],
|
|
33
|
+
stage: [
|
|
34
|
+
'Lead',
|
|
35
|
+
'Prospect',
|
|
36
|
+
'Opportunity',
|
|
37
|
+
'Customer',
|
|
38
|
+
'Churned',
|
|
39
|
+
'Qualified',
|
|
40
|
+
'Engaged',
|
|
41
|
+
'Negotiation',
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Parse API error to extract context
|
|
46
|
+
*/
|
|
47
|
+
function parseApiError(error) {
|
|
48
|
+
console.error(`[enhancer-parseApiError] --- ENTERING parseApiError ---`);
|
|
49
|
+
console.error(`[enhancer-parseApiError] error type: ${typeof error}, constructor: ${error
|
|
50
|
+
?.constructor?.name}`);
|
|
51
|
+
if (error && typeof error === 'object') {
|
|
52
|
+
console.error(`[enhancer-parseApiError] error keys: ${JSON.stringify(Object.keys(error))}`);
|
|
53
|
+
console.error(`[enhancer-parseApiError] error.message from input: ${error.message}`);
|
|
54
|
+
}
|
|
55
|
+
const isAxios = axios.isAxiosError(error);
|
|
56
|
+
console.error(`[enhancer-parseApiError] Step 1: axios.isAxiosError(error) result: ${isAxios}`);
|
|
57
|
+
let responseExists = false;
|
|
58
|
+
let responseDataExists = false;
|
|
59
|
+
let responseDataContent = 'N/A';
|
|
60
|
+
if (isAxios && error.response) {
|
|
61
|
+
responseExists = true;
|
|
62
|
+
console.error(`[enhancer-parseApiError] Step 2: error.response exists. Keys: ${JSON.stringify(Object.keys(error.response))}`);
|
|
63
|
+
if (error.response.data) {
|
|
64
|
+
responseDataExists = true;
|
|
65
|
+
try {
|
|
66
|
+
responseDataContent = JSON.stringify(error.response.data);
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
responseDataContent = 'Error stringifying response.data';
|
|
70
|
+
}
|
|
71
|
+
console.error(`[enhancer-parseApiError] Step 3: error.response.data exists. Type: ${typeof error
|
|
72
|
+
.response.data}, Content: ${responseDataContent}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
console.error(`[enhancer-parseApiError] Step 3: error.response.data is FALSY.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.error(`[enhancer-parseApiError] Step 2: error.response is FALSY or not an Axios error for this check.`);
|
|
80
|
+
console.error(`[enhancer-parseApiError] Step 3: error.response.data is FALSY (because error.response was not available).`);
|
|
81
|
+
}
|
|
82
|
+
console.error(`[enhancer-parseApiError] FINAL CHECK BEFORE CONDITION: isAxios=${isAxios}, responseExists=${responseExists}, responseDataExists=${responseDataExists}`);
|
|
83
|
+
if (isAxios &&
|
|
84
|
+
responseExists &&
|
|
85
|
+
responseDataExists &&
|
|
86
|
+
error.response &&
|
|
87
|
+
error.response.data) {
|
|
88
|
+
console.error(`[enhancer-parseApiError] --- CONDITION MET --- Processing error.response.data...`);
|
|
89
|
+
const data = error.response.data;
|
|
90
|
+
const message = typeof data.message === 'string' ? data.message : '';
|
|
91
|
+
const pathArray = Array.isArray(data.path) && data.path.length > 0 ? data.path : [];
|
|
92
|
+
const path = typeof pathArray[0] === 'string' ? pathArray[0] : undefined;
|
|
93
|
+
console.error(`[enhancer-parseApiError] Extracted from data: message='${message}', path='${path}'`);
|
|
94
|
+
if (message.includes('Unknown select option name') ||
|
|
95
|
+
message.includes('Unknown multi-select option names')) {
|
|
96
|
+
const valueMatch = message.match(/constraint: (.*)/);
|
|
97
|
+
const extractedValue = valueMatch && typeof valueMatch[1] === 'string'
|
|
98
|
+
? valueMatch[1].split(',')[0].trim()
|
|
99
|
+
: undefined;
|
|
100
|
+
console.error(`[enhancer-parseApiError] --- RETURNING ValueMismatch context: field='${path}', value='${extractedValue}' ---`);
|
|
101
|
+
return {
|
|
102
|
+
fieldSlug: path,
|
|
103
|
+
searchValue: extractedValue,
|
|
104
|
+
errorMessage: message,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
console.error(`[enhancer-parseApiError] --- RETURNING Non-ValueMismatch Axios context: field='${path}' ---`);
|
|
108
|
+
return { fieldSlug: path, errorMessage: message };
|
|
109
|
+
}
|
|
110
|
+
console.error(`[enhancer-parseApiError] --- CONDITION NOT MET ---`);
|
|
111
|
+
const genericErrorMessage = error && typeof error.message === 'string'
|
|
112
|
+
? error.message
|
|
113
|
+
: 'Unknown error';
|
|
114
|
+
console.error(`[enhancer-parseApiError] Returning generic message: '${genericErrorMessage}'`);
|
|
115
|
+
return { errorMessage: genericErrorMessage };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Enhance an API error with value suggestions if applicable
|
|
119
|
+
*/
|
|
120
|
+
export function enhanceApiError(error) {
|
|
121
|
+
console.error('[enhancer] Called with error type:', error?.constructor?.name, '. Is Axios Error:', error?.isAxiosError);
|
|
122
|
+
console.error('[enhancer] Attempting to enhance error. Message property:', error?.message, '. ResponseData property:', JSON.stringify(error?.response?.data));
|
|
123
|
+
const mismatchCheck = isValueMismatchError(error);
|
|
124
|
+
console.error('[enhancer] Mismatch check result:', JSON.stringify(mismatchCheck));
|
|
125
|
+
if (mismatchCheck.isMismatch &&
|
|
126
|
+
mismatchCheck.fieldSlug &&
|
|
127
|
+
mismatchCheck.searchValue) {
|
|
128
|
+
const fieldSlug = mismatchCheck.fieldSlug;
|
|
129
|
+
const searchValue = mismatchCheck.searchValue;
|
|
130
|
+
const knownValues = KNOWN_FIELD_VALUES[fieldSlug]; // Already checked in isValueMismatchError, but good for clarity
|
|
131
|
+
console.error(`[enhancer] Value mismatch confirmed for field: ${fieldSlug}, value: ${searchValue}.`);
|
|
132
|
+
if (knownValues) {
|
|
133
|
+
console.error(`[enhancer] Attempting to find best match for '${searchValue}' in known values for '${fieldSlug}'.`);
|
|
134
|
+
const matchResult = findBestValueMatch(searchValue, knownValues);
|
|
135
|
+
console.error('[enhancer] Match result from findBestValueMatch:', JSON.stringify(matchResult));
|
|
136
|
+
console.error('[enhancer] Returning NEW ValueMatchError');
|
|
137
|
+
return new ValueMatchError(fieldSlug, searchValue, matchResult, error // Pass original Axios error for reference
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
console.error('[enhancer] No value mismatch, or field/value not actionable. Error message from mismatchCheck:', mismatchCheck.errorMessage);
|
|
143
|
+
}
|
|
144
|
+
console.error('[enhancer] No specific enhancement applied. Returning original error.');
|
|
145
|
+
return error; // Fallback: return original error if not enhanced
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Check if an error is a value mismatch that we can enhance
|
|
149
|
+
*/
|
|
150
|
+
export function isValueMismatchError(error) {
|
|
151
|
+
const context = parseApiError(error);
|
|
152
|
+
console.error('[enhancer-isValueMismatchError] Context from parseApiError:', JSON.stringify(context));
|
|
153
|
+
if (context.fieldSlug &&
|
|
154
|
+
context.searchValue &&
|
|
155
|
+
KNOWN_FIELD_VALUES[context.fieldSlug]) {
|
|
156
|
+
const knownValues = KNOWN_FIELD_VALUES[context.fieldSlug];
|
|
157
|
+
if (knownValues &&
|
|
158
|
+
!knownValues.some((v) => v.toLowerCase() === context.searchValue?.toLowerCase())) {
|
|
159
|
+
console.error(`[enhancer-isValueMismatchError] Mismatch found for field '${context.fieldSlug}', value '${context.searchValue}'.`);
|
|
160
|
+
return {
|
|
161
|
+
isMismatch: true,
|
|
162
|
+
fieldSlug: context.fieldSlug,
|
|
163
|
+
searchValue: context.searchValue,
|
|
164
|
+
errorMessage: context.errorMessage,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
console.error('[enhancer-isValueMismatchError] No mismatch or field/value not in KNOWN_FIELD_VALUES.');
|
|
169
|
+
return { isMismatch: false, errorMessage: context.errorMessage };
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get valid values for a field (if known)
|
|
173
|
+
*/
|
|
174
|
+
export function getKnownFieldValues(fieldSlug) {
|
|
175
|
+
return KNOWN_FIELD_VALUES[fieldSlug] || null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Add or update known field values
|
|
179
|
+
* This could be populated from Attio API discovery
|
|
180
|
+
*/
|
|
181
|
+
export function updateKnownFieldValues(fieldSlug, values) {
|
|
182
|
+
KNOWN_FIELD_VALUES[fieldSlug] = values;
|
|
183
|
+
}
|
|
184
|
+
// Remove locally defined ValueMatchResult and similarity functions if they were causing issues
|
|
185
|
+
// interface ValueMatchResult { ... }
|
|
186
|
+
// function similarity(...) { ... }
|
|
187
|
+
// function editDistance(...) { ... }
|
|
188
|
+
//# sourceMappingURL=error-enhancer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-enhancer.js","sourceRoot":"","sources":["../../src/utils/error-enhancer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,kBAAkB,GAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,iFAAiF;AACjF,MAAM,kBAAkB,GAA6B;IACnD,YAAY,EAAE;QACZ,iBAAiB;QACjB,wBAAwB;QACxB,eAAe;QACf,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB;QAClB,oBAAoB;QACpB,cAAc;QACd,YAAY;QACZ,UAAU;QACV,QAAQ;KACT;IACD,QAAQ,EAAE;QACR,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,QAAQ;QACR,eAAe;QACf,aAAa;QACb,aAAa;QACb,uBAAuB;KACxB;IACD,KAAK,EAAE;QACL,MAAM;QACN,UAAU;QACV,aAAa;QACb,UAAU;QACV,SAAS;QACT,WAAW;QACX,SAAS;QACT,aAAa;KACd;CACF,CAAC;AAWF;;GAEG;AACH,SAAS,aAAa,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;IACzE,OAAO,CAAC,KAAK,CACX,wCAAwC,OAAO,KAAK,kBAAkB,KAAK;QACzE,EAAE,WAAW,EAAE,IAAI,EAAE,CACxB,CAAC;IAEF,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,CAAC,KAAK,CACX,wCAAwC,IAAI,CAAC,SAAS,CACpD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CACnB,EAAE,CACJ,CAAC;QACF,OAAO,CAAC,KAAK,CACX,sDAAsD,KAAK,CAAC,OAAO,EAAE,CACtE,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,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,OAAO,CAAC,KAAK,CACX,6DAA6D,OAAO,CAAC,SAAS,aAAa,OAAO,CAAC,WAAW,IAAI,CACnH,CAAC;YACF,OAAO;gBACL,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,YAAY,EAAE,OAAO,CAAC,YAAY;aACnC,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,CAAC,KAAK,CACX,uFAAuF,CACxF,CAAC;IACF,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,MAAgB;IAEhB,kBAAkB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;AACzC,CAAC;AAED,+FAA+F;AAC/F,qCAAqC;AACrC,mCAAmC;AACnC,qCAAqC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utility for creating consistent error responses
|
|
3
|
+
*/
|
|
4
|
+
import { AttioErrorResponse } from '../types/attio.js';
|
|
5
|
+
/**
|
|
6
|
+
* Enum for categorizing different types of errors
|
|
7
|
+
*/
|
|
8
|
+
export declare enum ErrorType {
|
|
9
|
+
VALIDATION_ERROR = "validation_error",
|
|
10
|
+
API_ERROR = "api_error",
|
|
11
|
+
AUTHENTICATION_ERROR = "authentication_error",
|
|
12
|
+
RATE_LIMIT_ERROR = "rate_limit_error",
|
|
13
|
+
NETWORK_ERROR = "network_error",
|
|
14
|
+
NOT_FOUND_ERROR = "not_found_error",
|
|
15
|
+
SERVER_ERROR = "server_error",
|
|
16
|
+
PARAMETER_ERROR = "parameter_error",
|
|
17
|
+
SERIALIZATION_ERROR = "serialization_error",
|
|
18
|
+
FORMAT_ERROR = "format_error",
|
|
19
|
+
UNKNOWN_ERROR = "unknown_error"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface for error details with improved type safety
|
|
23
|
+
*/
|
|
24
|
+
export interface ErrorDetails {
|
|
25
|
+
code: number;
|
|
26
|
+
message: string;
|
|
27
|
+
type: ErrorType;
|
|
28
|
+
details?: {
|
|
29
|
+
status?: number;
|
|
30
|
+
method?: string;
|
|
31
|
+
path?: string;
|
|
32
|
+
detail?: string;
|
|
33
|
+
responseData?: Record<string, any>;
|
|
34
|
+
originalError?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Custom error class for Attio API errors
|
|
40
|
+
*/
|
|
41
|
+
export declare class AttioApiError extends Error {
|
|
42
|
+
status: number;
|
|
43
|
+
detail: string;
|
|
44
|
+
path: string;
|
|
45
|
+
method: string;
|
|
46
|
+
responseData: any;
|
|
47
|
+
type: ErrorType;
|
|
48
|
+
constructor(message: string, status: number, detail: string, path: string, method: string, type?: ErrorType, responseData?: any);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates a specific API error based on status code and context
|
|
52
|
+
*
|
|
53
|
+
* @param status - HTTP status code
|
|
54
|
+
* @param path - API path
|
|
55
|
+
* @param method - HTTP method
|
|
56
|
+
* @param responseData - Response data from API
|
|
57
|
+
* @returns Appropriate error instance
|
|
58
|
+
*/
|
|
59
|
+
export declare function createAttioError(error: any): Error;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a specific API error based on status code and context
|
|
62
|
+
*
|
|
63
|
+
* @param status - HTTP status code
|
|
64
|
+
* @param path - API path
|
|
65
|
+
* @param method - HTTP method
|
|
66
|
+
* @param responseData - Response data from API
|
|
67
|
+
* @returns Appropriate error instance
|
|
68
|
+
*/
|
|
69
|
+
export declare function createApiError(status: number, path: string, method: string, responseData?: any): Error;
|
|
70
|
+
/**
|
|
71
|
+
* Format an error into a standardized response based on error type
|
|
72
|
+
*
|
|
73
|
+
* @param error - The error to format
|
|
74
|
+
* @param type - The error type
|
|
75
|
+
* @param details - Additional error details
|
|
76
|
+
* @returns Formatted error response
|
|
77
|
+
*/
|
|
78
|
+
export declare function formatErrorResponse(error: Error, type?: ErrorType, details?: any): any;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a detailed error response for API errors, suitable for returning to MCP clients
|
|
81
|
+
*
|
|
82
|
+
* @param error - The caught error
|
|
83
|
+
* @param url - The API URL that was called
|
|
84
|
+
* @param method - The HTTP method used
|
|
85
|
+
* @param responseData - Any response data received
|
|
86
|
+
* @returns Formatted error result
|
|
87
|
+
*/
|
|
88
|
+
export declare function createErrorResult(error: Error | any, url: string, method: string, responseData?: AttioErrorResponse): any;
|
|
89
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,oBAAY,SAAS;IACnB,gBAAgB,qBAAqB;IACrC,SAAS,cAAc;IACvB,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM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