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,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List operations for Attio
|
|
3
|
+
* Handles list management and list entry operations
|
|
4
|
+
*/
|
|
5
|
+
import { getAttioClient } from '../attio-client.js';
|
|
6
|
+
import { callWithRetry } from './retry.js';
|
|
7
|
+
import { processListEntries, transformFiltersToApiFormat, } from '../../utils/record-utils.js';
|
|
8
|
+
import { FilterValidationError } from '../../errors/api-errors.js';
|
|
9
|
+
import { executeWithListFallback } from '../../utils/api-fallback.js';
|
|
10
|
+
/**
|
|
11
|
+
* Gets all lists in the workspace
|
|
12
|
+
*
|
|
13
|
+
* @param objectSlug - Optional object type to filter lists by (e.g., 'companies', 'people')
|
|
14
|
+
* @param limit - Maximum number of lists to fetch (default: 20)
|
|
15
|
+
* @param retryConfig - Optional retry configuration
|
|
16
|
+
* @returns Array of list objects
|
|
17
|
+
*/
|
|
18
|
+
export async function getAllLists(objectSlug, limit = 20, retryConfig) {
|
|
19
|
+
const api = getAttioClient();
|
|
20
|
+
let path = `/lists?limit=${limit}`;
|
|
21
|
+
if (objectSlug) {
|
|
22
|
+
path += `&objectSlug=${objectSlug}`;
|
|
23
|
+
}
|
|
24
|
+
return callWithRetry(async () => {
|
|
25
|
+
try {
|
|
26
|
+
const response = await api.get(path);
|
|
27
|
+
return response.data.data || [];
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
// Let upstream handlers create specific, rich error objects.
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}, retryConfig);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets details for a specific list
|
|
37
|
+
*
|
|
38
|
+
* @param listId - The ID of the list
|
|
39
|
+
* @param retryConfig - Optional retry configuration
|
|
40
|
+
* @returns List details
|
|
41
|
+
*/
|
|
42
|
+
export async function getListDetails(listId, retryConfig) {
|
|
43
|
+
const api = getAttioClient();
|
|
44
|
+
const path = `/lists/${listId}`;
|
|
45
|
+
return callWithRetry(async () => {
|
|
46
|
+
try {
|
|
47
|
+
const response = await api.get(path);
|
|
48
|
+
return response.data.data || response.data;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
// Let upstream handlers create specific, rich error objects.
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}, retryConfig);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets entries in a list with pagination and filtering
|
|
58
|
+
*
|
|
59
|
+
* @param listId - The ID of the list
|
|
60
|
+
* @param limit - Maximum number of entries to fetch
|
|
61
|
+
* @param offset - Number of entries to skip
|
|
62
|
+
* @param filters - Optional filters to apply
|
|
63
|
+
* @param retryConfig - Optional retry configuration
|
|
64
|
+
* @returns Array of list entries
|
|
65
|
+
*/
|
|
66
|
+
export async function getListEntries(listId, limit, offset, filters, retryConfig) {
|
|
67
|
+
const api = getAttioClient();
|
|
68
|
+
// Input validation - make sure we have a valid listId
|
|
69
|
+
if (!listId) {
|
|
70
|
+
throw new Error('Invalid list ID: No ID provided');
|
|
71
|
+
}
|
|
72
|
+
// Coerce input parameters to ensure proper types
|
|
73
|
+
const safeLimit = typeof limit === 'number' ? limit : undefined;
|
|
74
|
+
const safeOffset = typeof offset === 'number' ? offset : undefined;
|
|
75
|
+
// Create request body with parameters and filters
|
|
76
|
+
const createRequestBody = () => {
|
|
77
|
+
// Start with base parameters
|
|
78
|
+
const body = {
|
|
79
|
+
expand: ['record'],
|
|
80
|
+
limit: safeLimit !== undefined ? safeLimit : 20, // Default to 20 if not specified
|
|
81
|
+
offset: safeOffset !== undefined ? safeOffset : 0, // Default to 0 if not specified
|
|
82
|
+
};
|
|
83
|
+
try {
|
|
84
|
+
// Use our shared utility to transform filters to API format
|
|
85
|
+
const filterObject = transformFiltersToApiFormat(filters, true);
|
|
86
|
+
// Add filter to body if it exists
|
|
87
|
+
if (filterObject.filter) {
|
|
88
|
+
body.filter = filterObject.filter;
|
|
89
|
+
// Log filter transformation for debugging in development
|
|
90
|
+
if (process.env.NODE_ENV === 'development') {
|
|
91
|
+
console.error('[getListEntries] Transformed filters:', {
|
|
92
|
+
originalFilters: JSON.stringify(filters),
|
|
93
|
+
transformedFilters: JSON.stringify(filterObject.filter),
|
|
94
|
+
useOrLogic: filters?.matchAny === true,
|
|
95
|
+
filterCount: filters?.filters?.length || 0,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
const error = err;
|
|
102
|
+
if (error instanceof FilterValidationError) {
|
|
103
|
+
// Log the problematic filters for debugging
|
|
104
|
+
if (process.env.NODE_ENV === 'development') {
|
|
105
|
+
console.error('[getListEntries] Filter validation error:', {
|
|
106
|
+
error: error.message,
|
|
107
|
+
providedFilters: JSON.stringify(filters),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// Rethrow with more context
|
|
111
|
+
throw new Error(`Filter validation failed: ${error.message}`);
|
|
112
|
+
}
|
|
113
|
+
throw error; // Rethrow other errors
|
|
114
|
+
}
|
|
115
|
+
return body;
|
|
116
|
+
};
|
|
117
|
+
// Enhanced logging function
|
|
118
|
+
const logOperation = (stage, details, isError = false) => {
|
|
119
|
+
if (process.env.NODE_ENV === 'development') {
|
|
120
|
+
const prefix = isError
|
|
121
|
+
? 'ERROR'
|
|
122
|
+
: stage.includes('failed')
|
|
123
|
+
? 'WARNING'
|
|
124
|
+
: 'INFO';
|
|
125
|
+
console.error(`[getListEntries] ${prefix} - ${stage}`, {
|
|
126
|
+
...details,
|
|
127
|
+
listId,
|
|
128
|
+
limit: safeLimit,
|
|
129
|
+
offset: safeOffset,
|
|
130
|
+
hasFilters: filters && filters.filters ? filters.filters.length > 0 : false,
|
|
131
|
+
timestamp: new Date().toISOString(),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
// Define a function to try all endpoints with proper retry logic
|
|
136
|
+
return callWithRetry(async () => {
|
|
137
|
+
return executeWithListFallback(api, { listId, filters, limit: safeLimit, offset: safeOffset }, createRequestBody, processListEntries, logOperation);
|
|
138
|
+
}, retryConfig);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Adds a record to a list
|
|
142
|
+
*
|
|
143
|
+
* @param listId - The ID of the list
|
|
144
|
+
* @param recordId - The ID of the record to add
|
|
145
|
+
* @param objectType - Optional object type ('companies', 'people', etc.)
|
|
146
|
+
* @param initialValues - Optional initial values for the list entry (e.g., stage)
|
|
147
|
+
* @param retryConfig - Optional retry configuration
|
|
148
|
+
* @returns The created list entry
|
|
149
|
+
*/
|
|
150
|
+
export async function addRecordToList(listId, recordId, objectType, initialValues, retryConfig) {
|
|
151
|
+
const api = getAttioClient();
|
|
152
|
+
const path = `/lists/${listId}/entries`;
|
|
153
|
+
// Input validation to ensure required parameters
|
|
154
|
+
if (!listId || typeof listId !== 'string') {
|
|
155
|
+
throw new Error('Invalid list ID: Must be a non-empty string');
|
|
156
|
+
}
|
|
157
|
+
if (!recordId || typeof recordId !== 'string') {
|
|
158
|
+
throw new Error('Invalid record ID: Must be a non-empty string');
|
|
159
|
+
}
|
|
160
|
+
// Default object type to 'companies' if not specified
|
|
161
|
+
const safeObjectType = objectType || 'companies';
|
|
162
|
+
return callWithRetry(async () => {
|
|
163
|
+
try {
|
|
164
|
+
// Construct proper API payload according to Attio API requirements
|
|
165
|
+
// The API expects parent_record_id, parent_object, and optionally entry_values
|
|
166
|
+
const payload = {
|
|
167
|
+
data: {
|
|
168
|
+
parent_record_id: recordId,
|
|
169
|
+
parent_object: safeObjectType,
|
|
170
|
+
// Only include entry_values if initialValues is provided
|
|
171
|
+
...(initialValues && { entry_values: initialValues }),
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
if (process.env.NODE_ENV === 'development') {
|
|
175
|
+
console.error(`[addRecordToList] Adding record to list at ${path}`);
|
|
176
|
+
console.error(`- List ID: ${listId}`);
|
|
177
|
+
console.error(`- Record ID: ${recordId}`);
|
|
178
|
+
console.error(`- Object Type: ${safeObjectType}`);
|
|
179
|
+
console.error(`- Initial Values: ${initialValues ? JSON.stringify(initialValues) : 'none'}`);
|
|
180
|
+
console.error(`- Request payload: ${JSON.stringify(payload)}`);
|
|
181
|
+
}
|
|
182
|
+
const response = await api.post(path, payload);
|
|
183
|
+
if (process.env.NODE_ENV === 'development') {
|
|
184
|
+
console.error(`[addRecordToList] Success: ${JSON.stringify(response.data)}`);
|
|
185
|
+
}
|
|
186
|
+
return response.data.data || response.data;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
// Enhanced error logging with detailed information
|
|
190
|
+
if (process.env.NODE_ENV === 'development') {
|
|
191
|
+
console.error(`[addRecordToList] Error adding record ${recordId} to list ${listId}:`, error.message || 'Unknown error');
|
|
192
|
+
console.error('Status:', error.response?.status);
|
|
193
|
+
console.error('Response data:', JSON.stringify(error.response?.data || {}));
|
|
194
|
+
// Add additional debug information for validation errors
|
|
195
|
+
if (error.response?.data?.validation_errors) {
|
|
196
|
+
console.error('Validation errors:', JSON.stringify(error.response.data.validation_errors));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Add more context to the error message
|
|
200
|
+
if (error.response?.status === 400) {
|
|
201
|
+
const validationErrors = error.response?.data?.validation_errors || [];
|
|
202
|
+
const errorDetails = validationErrors
|
|
203
|
+
.map((e) => `${e.path.join('.')}: ${e.message}`)
|
|
204
|
+
.join('; ');
|
|
205
|
+
throw new Error(`Validation error adding record to list: ${errorDetails || error.message}`);
|
|
206
|
+
}
|
|
207
|
+
// Let upstream handlers create specific, rich error objects.
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}, retryConfig);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Updates a list entry (e.g., changing stage)
|
|
214
|
+
*
|
|
215
|
+
* @param listId - The ID of the list
|
|
216
|
+
* @param entryId - The ID of the list entry to update
|
|
217
|
+
* @param attributes - The attributes to update (e.g., { stage: "Demo Scheduling" })
|
|
218
|
+
* @param retryConfig - Optional retry configuration
|
|
219
|
+
* @returns The updated list entry
|
|
220
|
+
*/
|
|
221
|
+
export async function updateListEntry(listId, entryId, attributes, retryConfig) {
|
|
222
|
+
const api = getAttioClient();
|
|
223
|
+
const path = `/lists/${listId}/entries/${entryId}`;
|
|
224
|
+
// Input validation
|
|
225
|
+
if (!listId || typeof listId !== 'string') {
|
|
226
|
+
throw new Error('Invalid list ID: Must be a non-empty string');
|
|
227
|
+
}
|
|
228
|
+
if (!entryId || typeof entryId !== 'string') {
|
|
229
|
+
throw new Error('Invalid entry ID: Must be a non-empty string');
|
|
230
|
+
}
|
|
231
|
+
if (!attributes ||
|
|
232
|
+
typeof attributes !== 'object' ||
|
|
233
|
+
Array.isArray(attributes)) {
|
|
234
|
+
throw new Error('Invalid attributes: Must be a non-empty object');
|
|
235
|
+
}
|
|
236
|
+
return callWithRetry(async () => {
|
|
237
|
+
try {
|
|
238
|
+
if (process.env.NODE_ENV === 'development') {
|
|
239
|
+
console.error(`[updateListEntry] Updating list entry at ${path}`);
|
|
240
|
+
console.error(`- List ID: ${listId}`);
|
|
241
|
+
console.error(`- Entry ID: ${entryId}`);
|
|
242
|
+
console.error(`- Attributes: ${JSON.stringify(attributes)}`);
|
|
243
|
+
}
|
|
244
|
+
// Attio API expects updates to list entries in the 'data.values' structure
|
|
245
|
+
// This follows the same pattern as record updates in crud.ts
|
|
246
|
+
const response = await api.patch(path, {
|
|
247
|
+
data: {
|
|
248
|
+
values: attributes,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
if (process.env.NODE_ENV === 'development') {
|
|
252
|
+
console.error(`[updateListEntry] Success: ${JSON.stringify(response.data)}`);
|
|
253
|
+
}
|
|
254
|
+
return response.data.data || response.data;
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
// Enhanced error logging with specific error types
|
|
258
|
+
if (process.env.NODE_ENV === 'development') {
|
|
259
|
+
console.error(`[updateListEntry] Error updating entry ${entryId} in list ${listId}:`, error.message || 'Unknown error');
|
|
260
|
+
console.error('Status:', error.response?.status);
|
|
261
|
+
console.error('Response data:', JSON.stringify(error.response?.data || {}));
|
|
262
|
+
}
|
|
263
|
+
// Add more specific error types based on status codes
|
|
264
|
+
if (error.response?.status === 404) {
|
|
265
|
+
throw new Error(`List entry ${entryId} not found in list ${listId}`);
|
|
266
|
+
}
|
|
267
|
+
else if (error.response?.status === 400) {
|
|
268
|
+
throw new Error(`Invalid attributes for list entry update: ${error.response?.data?.message || 'Bad request'}`);
|
|
269
|
+
}
|
|
270
|
+
else if (error.response?.status === 403) {
|
|
271
|
+
throw new Error(`Insufficient permissions to update list entry ${entryId} in list ${listId}`);
|
|
272
|
+
}
|
|
273
|
+
// Let upstream handlers create specific, rich error objects.
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
}, retryConfig);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Removes a record from a list
|
|
280
|
+
*
|
|
281
|
+
* @param listId - The ID of the list
|
|
282
|
+
* @param entryId - The ID of the list entry to remove
|
|
283
|
+
* @param retryConfig - Optional retry configuration
|
|
284
|
+
* @returns True if successful
|
|
285
|
+
*/
|
|
286
|
+
export async function removeRecordFromList(listId, entryId, retryConfig) {
|
|
287
|
+
const api = getAttioClient();
|
|
288
|
+
const path = `/lists/${listId}/entries/${entryId}`;
|
|
289
|
+
return callWithRetry(async () => {
|
|
290
|
+
try {
|
|
291
|
+
await api.delete(path);
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
// Let upstream handlers create specific, rich error objects.
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
}, retryConfig);
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../../src/api/operations/lists.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAOpD,OAAO,EAAE,aAAa,EAAe,MAAM,YAAY,CAAC;AAExD,OAAO,EACL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,UAAmB,EACnB,QAAgB,EAAE,EAClB,WAAkC;IAElC,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;IAC7B,IAAI,IAAI,GAAG,gBAAgB,KAAK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AAM,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,6DAA6D;YAC7D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EAAE,WAAW,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note operations for Attio objects
|
|
3
|
+
* Handles note creation and retrieval
|
|
4
|
+
*/
|
|
5
|
+
import { AttioNote, ResourceType } from '../../types/attio.js';
|
|
6
|
+
import { RetryConfig } from './retry.js';
|
|
7
|
+
/**
|
|
8
|
+
* Generic function to get notes for a specific record
|
|
9
|
+
*
|
|
10
|
+
* @param objectType - The type of parent object (people or companies)
|
|
11
|
+
* @param recordId - ID of the parent record
|
|
12
|
+
* @param limit - Maximum number of notes to return
|
|
13
|
+
* @param offset - Number of notes to skip
|
|
14
|
+
* @param retryConfig - Optional retry configuration
|
|
15
|
+
* @returns Array of notes
|
|
16
|
+
*/
|
|
17
|
+
export declare function getObjectNotes(objectType: ResourceType, recordId: string, limit?: number, offset?: number, retryConfig?: Partial<RetryConfig>): Promise<AttioNote[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Generic function to create a note for any object type
|
|
20
|
+
*
|
|
21
|
+
* @param objectType - The type of parent object (people or companies)
|
|
22
|
+
* @param recordId - ID of the parent record
|
|
23
|
+
* @param noteTitle - Title of the note
|
|
24
|
+
* @param noteText - Content of the note
|
|
25
|
+
* @param retryConfig - Optional retry configuration
|
|
26
|
+
* @returns Created note
|
|
27
|
+
*/
|
|
28
|
+
export declare function createObjectNote(objectType: ResourceType, recordId: string, noteTitle: string, noteText: string, retryConfig?: Partial<RetryConfig>): Promise<AttioNote>;
|
|
29
|
+
//# sourceMappingURL=notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../../src/api/operations/notes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,SAAS,EACT,YAAY,EAGb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAiB,WAAW,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,EAClB,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,SAAS,EAAE,CAAC,CAatB;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,SAAS,CAAC,CAqBpB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note operations for Attio objects
|
|
3
|
+
* Handles note creation and retrieval
|
|
4
|
+
*/
|
|
5
|
+
import { getAttioClient } from '../attio-client.js';
|
|
6
|
+
import { callWithRetry } from './retry.js';
|
|
7
|
+
/**
|
|
8
|
+
* Generic function to get notes for a specific record
|
|
9
|
+
*
|
|
10
|
+
* @param objectType - The type of parent object (people or companies)
|
|
11
|
+
* @param recordId - ID of the parent record
|
|
12
|
+
* @param limit - Maximum number of notes to return
|
|
13
|
+
* @param offset - Number of notes to skip
|
|
14
|
+
* @param retryConfig - Optional retry configuration
|
|
15
|
+
* @returns Array of notes
|
|
16
|
+
*/
|
|
17
|
+
export async function getObjectNotes(objectType, recordId, limit = 10, offset = 0, retryConfig) {
|
|
18
|
+
const api = getAttioClient();
|
|
19
|
+
const path = `/notes?limit=${limit}&offset=${offset}&parent_object=${objectType}&parent_record_id=${recordId}`;
|
|
20
|
+
return callWithRetry(async () => {
|
|
21
|
+
try {
|
|
22
|
+
const response = await api.get(path);
|
|
23
|
+
return response.data.data || [];
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
// Let upstream handlers create specific, rich error objects.
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}, retryConfig);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generic function to create a note for any object type
|
|
33
|
+
*
|
|
34
|
+
* @param objectType - The type of parent object (people or companies)
|
|
35
|
+
* @param recordId - ID of the parent record
|
|
36
|
+
* @param noteTitle - Title of the note
|
|
37
|
+
* @param noteText - Content of the note
|
|
38
|
+
* @param retryConfig - Optional retry configuration
|
|
39
|
+
* @returns Created note
|
|
40
|
+
*/
|
|
41
|
+
export async function createObjectNote(objectType, recordId, noteTitle, noteText, retryConfig) {
|
|
42
|
+
const api = getAttioClient();
|
|
43
|
+
const path = '/notes';
|
|
44
|
+
return callWithRetry(async () => {
|
|
45
|
+
try {
|
|
46
|
+
const response = await api.post(path, {
|
|
47
|
+
data: {
|
|
48
|
+
format: 'plaintext',
|
|
49
|
+
parent_object: objectType,
|
|
50
|
+
parent_record_id: recordId,
|
|
51
|
+
title: `[AI] ${noteTitle}`,
|
|
52
|
+
content: noteText,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return response.data.data || response.data;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// Let upstream handlers create specific, rich error objects.
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}, retryConfig);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.js","sourceRoot":"","sources":["../../../src/api/operations/notes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAOpD,OAAO,EAAE,aAAa,EAAe,MAAM,YAAY,CAAC;AAExD;;;;;;;;;GASG;A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DAA6D;YAC7D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EAAE,WAAW,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry logic for API operations
|
|
3
|
+
* Handles retryable errors with configurable backoff strategies
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for API call retry
|
|
7
|
+
*/
|
|
8
|
+
export interface RetryConfig {
|
|
9
|
+
/** Maximum number of retry attempts */
|
|
10
|
+
maxRetries: number;
|
|
11
|
+
/** Initial delay in milliseconds before the first retry */
|
|
12
|
+
initialDelay: number;
|
|
13
|
+
/** Maximum delay in milliseconds between retries */
|
|
14
|
+
maxDelay: number;
|
|
15
|
+
/** Whether to use exponential backoff for retry delays */
|
|
16
|
+
useExponentialBackoff: boolean;
|
|
17
|
+
/** HTTP status codes that should trigger a retry */
|
|
18
|
+
retryableStatusCodes: number[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Default retry configuration
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Calculate delay time for retry with optional exponential backoff
|
|
26
|
+
*
|
|
27
|
+
* @param attempt - Current attempt number (0-based)
|
|
28
|
+
* @param config - Retry configuration
|
|
29
|
+
* @returns Delay time in milliseconds
|
|
30
|
+
*/
|
|
31
|
+
export declare function calculateRetryDelay(attempt: number, config: RetryConfig): number;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if an error should trigger a retry
|
|
34
|
+
*
|
|
35
|
+
* @param error - Error to check
|
|
36
|
+
* @param config - Retry configuration
|
|
37
|
+
* @returns Whether the error should trigger a retry
|
|
38
|
+
*/
|
|
39
|
+
export declare function isRetryableError(error: any, config: RetryConfig): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Execute an API call with retry logic
|
|
42
|
+
*
|
|
43
|
+
* @param fn - Function that returns a promise for the API call
|
|
44
|
+
* @param config - Retry configuration
|
|
45
|
+
* @returns Promise that resolves with the API response
|
|
46
|
+
*/
|
|
47
|
+
export declare function callWithRetry<T>(fn: () => Promise<T>, config?: Partial<RetryConfig>): Promise<T>;
|
|
48
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/api/operations/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,qBAAqB,EAAE,OAAO,CAAC;IAC/B,oDAAoD;IACpD,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAMlC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,GAClB,MAAM,CAYR;AAYD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CASzE;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAChC,OAAO,CAAC,CAAC,CAAC,CA0CZ"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry logic for API operations
|
|
3
|
+
* Handles retryable errors with configurable backoff strategies
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Default retry configuration
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_RETRY_CONFIG = {
|
|
9
|
+
maxRetries: 3,
|
|
10
|
+
initialDelay: 1000, // 1 second
|
|
11
|
+
maxDelay: 10000, // 10 seconds
|
|
12
|
+
useExponentialBackoff: true,
|
|
13
|
+
retryableStatusCodes: [408, 429, 500, 502, 503, 504],
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Calculate delay time for retry with optional exponential backoff
|
|
17
|
+
*
|
|
18
|
+
* @param attempt - Current attempt number (0-based)
|
|
19
|
+
* @param config - Retry configuration
|
|
20
|
+
* @returns Delay time in milliseconds
|
|
21
|
+
*/
|
|
22
|
+
export function calculateRetryDelay(attempt, config) {
|
|
23
|
+
if (!config.useExponentialBackoff) {
|
|
24
|
+
return config.initialDelay;
|
|
25
|
+
}
|
|
26
|
+
// Exponential backoff with jitter
|
|
27
|
+
const exponentialDelay = config.initialDelay * Math.pow(2, attempt);
|
|
28
|
+
const jitter = Math.random() * 0.5 + 0.75; // Random value between 0.75 and 1.25
|
|
29
|
+
const delay = exponentialDelay * jitter;
|
|
30
|
+
// Cap at maximum delay
|
|
31
|
+
return Math.min(delay, config.maxDelay);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sleep for a specified duration
|
|
35
|
+
*
|
|
36
|
+
* @param ms - Duration in milliseconds
|
|
37
|
+
* @returns Promise that resolves after the specified duration
|
|
38
|
+
*/
|
|
39
|
+
function sleep(ms) {
|
|
40
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Determines if an error should trigger a retry
|
|
44
|
+
*
|
|
45
|
+
* @param error - Error to check
|
|
46
|
+
* @param config - Retry configuration
|
|
47
|
+
* @returns Whether the error should trigger a retry
|
|
48
|
+
*/
|
|
49
|
+
export function isRetryableError(error, config) {
|
|
50
|
+
// Network errors should be retried
|
|
51
|
+
if (!error.response) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
// Check if status code is in the retryable list
|
|
55
|
+
const statusCode = error.response.status;
|
|
56
|
+
return config.retryableStatusCodes.includes(statusCode);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Execute an API call with retry logic
|
|
60
|
+
*
|
|
61
|
+
* @param fn - Function that returns a promise for the API call
|
|
62
|
+
* @param config - Retry configuration
|
|
63
|
+
* @returns Promise that resolves with the API response
|
|
64
|
+
*/
|
|
65
|
+
export async function callWithRetry(fn, config = {}) {
|
|
66
|
+
// Merge with default config
|
|
67
|
+
const retryConfig = {
|
|
68
|
+
...DEFAULT_RETRY_CONFIG,
|
|
69
|
+
...config,
|
|
70
|
+
};
|
|
71
|
+
let attempt = 0;
|
|
72
|
+
let lastError;
|
|
73
|
+
while (attempt <= retryConfig.maxRetries) {
|
|
74
|
+
try {
|
|
75
|
+
return await fn();
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
lastError = error;
|
|
79
|
+
// Check if we should retry
|
|
80
|
+
if (attempt >= retryConfig.maxRetries ||
|
|
81
|
+
!isRetryableError(error, retryConfig)) {
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
// Calculate delay and wait before retrying
|
|
85
|
+
const delay = calculateRetryDelay(attempt, retryConfig);
|
|
86
|
+
await sleep(delay);
|
|
87
|
+
attempt++;
|
|
88
|
+
// Log retry attempt if in development
|
|
89
|
+
if (process.env.NODE_ENV === 'development') {
|
|
90
|
+
console.log(`Retrying API call (attempt ${attempt}/${retryConfig.maxRetries}) after ${delay}ms delay`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// This should never be reached due to the throw in the catch block,
|
|
95
|
+
// but TypeScript needs it for type safety
|
|
96
|
+
throw lastError;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/api/operations/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAk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IACzC,OAAO,MAAM,CAAC,oBAAoB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,EAAoB,EACpB,SAA+B,EAAE;IAEjC,4BAA4B;IAC5B,MAAM,WAAW,GAAgB;QAC/B,GAAG,oBAAoB;QACvB,GAAG,MAAM;KACV,CAAC;IAEF,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,SAAc,CAAC;IAEnB,OAAO,OAAO,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,CAAC;YAElB,2BAA2B;YAC3B,IACE,OAAO,IAAI,WAAW,CAAC,UAAU;gBACjC,CAAC,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,EACrC,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;YAED,2CAA2C;YAC3C,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YACxD,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;YAEnB,OAAO,EAAE,CAAC;YAEV,sCAAsC;YACtC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CACT,8BAA8B,OAAO,IAAI,WAAW,CAAC,UAAU,WAAW,KAAK,UAAU,CAC1F,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,0CAA0C;IAC1C,MAAM,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search operations for Attio objects
|
|
3
|
+
* Handles basic and advanced search functionality
|
|
4
|
+
*/
|
|
5
|
+
import { AttioRecord, ResourceType } from '../../types/attio.js';
|
|
6
|
+
import { RetryConfig } from './retry.js';
|
|
7
|
+
import { ListEntryFilters } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Generic function to search any object type by name, email, or phone (when applicable)
|
|
10
|
+
*
|
|
11
|
+
* @param objectType - The type of object to search (people or companies)
|
|
12
|
+
* @param query - Search query string
|
|
13
|
+
* @param retryConfig - Optional retry configuration
|
|
14
|
+
* @returns Array of matching records
|
|
15
|
+
*/
|
|
16
|
+
export declare function searchObject<T extends AttioRecord>(objectType: ResourceType, query: string, retryConfig?: Partial<RetryConfig>): Promise<T[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Generic function to search any object type with advanced filtering capabilities
|
|
19
|
+
*
|
|
20
|
+
* @param objectType - The type of object to search (people or companies)
|
|
21
|
+
* @param filters - Optional filters to apply
|
|
22
|
+
* @param limit - Maximum number of results to return (optional)
|
|
23
|
+
* @param offset - Number of results to skip (optional)
|
|
24
|
+
* @param retryConfig - Optional retry configuration
|
|
25
|
+
* @returns Array of matching records
|
|
26
|
+
*/
|
|
27
|
+
export declare function advancedSearchObject<T extends AttioRecord>(objectType: ResourceType, filters?: ListEntryFilters, limit?: number, offset?: number, retryConfig?: Partial<RetryConfig>): Promise<T[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Generic function to list any object type with pagination and sorting
|
|
30
|
+
*
|
|
31
|
+
* @param objectType - The type of object to list (people or companies)
|
|
32
|
+
* @param limit - Maximum number of results to return
|
|
33
|
+
* @param retryConfig - Optional retry configuration
|
|
34
|
+
* @returns Array of records
|
|
35
|
+
*/
|
|
36
|
+
export declare function listObjects<T extends AttioRecord>(objectType: ResourceType, limit?: number, retryConfig?: Partial<RetryConfig>): Promise<T[]>;
|
|
37
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/api/operations/search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,WAAW,EACX,YAAY,EAEb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAiB,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI9C;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,WAAW,EACtD,UAAU,EAAE,YAAY,EACxB,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,CAAC,EAAE,CAAC,CAsCd;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,WAAW,EAC9D,UAAU,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,gBAAgB,EAC1B,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,CAAC,EAAE,CAAC,CA0Gd;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,WAAW,EACrD,UAAU,EAAE,YAAY,EACxB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,CAAC,EAAE,CAAC,CAuBd"}
|