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,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module translators
|
|
3
|
+
*
|
|
4
|
+
* Filter translation utilities for converting between formats
|
|
5
|
+
* Handles transformation between MCP filter format and Attio API format
|
|
6
|
+
*
|
|
7
|
+
* This module provides:
|
|
8
|
+
* - MCP to Attio API format transformation
|
|
9
|
+
* - Support for AND/OR logical operators
|
|
10
|
+
* - Operator conversion utilities
|
|
11
|
+
* - Attribute name transformations
|
|
12
|
+
* - Reverse transformation (API to MCP)
|
|
13
|
+
*/
|
|
14
|
+
// External dependencies
|
|
15
|
+
import { FilterValidationError, FilterErrorCategory, } from '../../errors/api-errors.js';
|
|
16
|
+
// Internal module dependencies
|
|
17
|
+
import { FilterConditionType, FIELD_SPECIAL_HANDLING, } from './types.js';
|
|
18
|
+
import { validateFilterStructure } from './validators.js';
|
|
19
|
+
import { validateFilters, collectInvalidFilters, formatInvalidFiltersError, ERROR_MESSAGES, getFilterExample, } from './validation-utils.js';
|
|
20
|
+
/**
|
|
21
|
+
* Transforms list entry filters to the format expected by the Attio API
|
|
22
|
+
*
|
|
23
|
+
* This is the main transformation function that converts MCP filter specifications
|
|
24
|
+
* into the format expected by the Attio API. It handles both AND and OR logical
|
|
25
|
+
* operators and provides comprehensive validation.
|
|
26
|
+
*
|
|
27
|
+
* **Key Features:**
|
|
28
|
+
* - Validates filter structure using centralized validation utilities
|
|
29
|
+
* - Supports both AND logic (default) and OR logic (matchAny: true)
|
|
30
|
+
* - Handles empty filter arrays gracefully (returns empty object)
|
|
31
|
+
* - Preserves filter condition types and values
|
|
32
|
+
* - Provides detailed error messages with examples on validation failure
|
|
33
|
+
*
|
|
34
|
+
* @param filters - Filter configuration from the MCP API (may have optional filters array)
|
|
35
|
+
* @param validateConditions - Whether to validate condition types against known Attio API operators
|
|
36
|
+
* @returns Transformed filter object for Attio API, or empty object if no valid filters
|
|
37
|
+
* @throws FilterValidationError if validation fails with consistent error messages and examples
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Simple filter with a single condition
|
|
41
|
+
* const simpleFilter = {
|
|
42
|
+
* filters: [
|
|
43
|
+
* {
|
|
44
|
+
* attribute: { slug: 'name' },
|
|
45
|
+
* condition: 'contains',
|
|
46
|
+
* value: 'Company Inc'
|
|
47
|
+
* }
|
|
48
|
+
* ]
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* // Filter with OR logic between conditions
|
|
52
|
+
* const orFilter = {
|
|
53
|
+
* filters: [
|
|
54
|
+
* {
|
|
55
|
+
* attribute: { slug: 'name' },
|
|
56
|
+
* condition: 'contains',
|
|
57
|
+
* value: 'Inc'
|
|
58
|
+
* },
|
|
59
|
+
* {
|
|
60
|
+
* attribute: { slug: 'industry' },
|
|
61
|
+
* condition: 'equals',
|
|
62
|
+
* value: 'Technology'
|
|
63
|
+
* }
|
|
64
|
+
* ],
|
|
65
|
+
* matchAny: true // Use OR logic
|
|
66
|
+
* };
|
|
67
|
+
*
|
|
68
|
+
* // Filter with multiple conditions (AND logic by default)
|
|
69
|
+
* const multipleFilter = {
|
|
70
|
+
* filters: [
|
|
71
|
+
* {
|
|
72
|
+
* attribute: { slug: 'name' },
|
|
73
|
+
* condition: 'contains',
|
|
74
|
+
* value: 'Inc'
|
|
75
|
+
* },
|
|
76
|
+
* {
|
|
77
|
+
* attribute: { slug: 'website' },
|
|
78
|
+
* condition: 'contains',
|
|
79
|
+
* value: '.com'
|
|
80
|
+
* }
|
|
81
|
+
* ]
|
|
82
|
+
* };
|
|
83
|
+
*/
|
|
84
|
+
export function transformFiltersToApiFormat(filters, validateConditions = true) {
|
|
85
|
+
// Handle undefined/null filters gracefully
|
|
86
|
+
if (!filters) {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
// Check if filters has a filters property and it's an array
|
|
90
|
+
if (!('filters' in filters) || !Array.isArray(filters.filters)) {
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
// If filters array is empty, return empty result
|
|
94
|
+
if (filters.filters.length === 0) {
|
|
95
|
+
return {};
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
// Use the central validation utility for consistent error messages
|
|
99
|
+
const validatedFilters = validateFilters(filters, validateConditions);
|
|
100
|
+
// Check if filters array exists and handle undefined case
|
|
101
|
+
if (!validatedFilters.filters || validatedFilters.filters.length === 0) {
|
|
102
|
+
if (process.env.NODE_ENV === 'development') {
|
|
103
|
+
console.log('[transformFiltersToApiFormat] Empty or undefined filters array provided, returning empty result');
|
|
104
|
+
}
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
// Check if this is a FilterValidationError
|
|
110
|
+
if (error instanceof FilterValidationError) {
|
|
111
|
+
// For condition validation errors when validateConditions is true, re-throw
|
|
112
|
+
if (validateConditions &&
|
|
113
|
+
(error.message.includes('Invalid condition') ||
|
|
114
|
+
error.message.includes('Invalid filter condition'))) {
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
// For structure errors (missing properties), return empty result instead of throwing
|
|
118
|
+
if (process.env.NODE_ENV === 'development') {
|
|
119
|
+
console.log('[transformFiltersToApiFormat] Validation failed, returning empty result:', error);
|
|
120
|
+
}
|
|
121
|
+
return {};
|
|
122
|
+
}
|
|
123
|
+
// Re-throw non-FilterValidationError errors
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
// Re-validate for the actual processing (this should not throw since we already validated)
|
|
127
|
+
const validatedFilters = validateFilters(filters, validateConditions);
|
|
128
|
+
// Determine if we need to use the $or operator based on matchAny
|
|
129
|
+
// matchAny: true = use $or logic, matchAny: false (or undefined) = use standard AND logic
|
|
130
|
+
const useOrLogic = validatedFilters.matchAny === true;
|
|
131
|
+
if (process.env.NODE_ENV === 'development') {
|
|
132
|
+
console.log(`[transformFiltersToApiFormat] Using ${useOrLogic ? 'OR' : 'AND'} logic for filters`);
|
|
133
|
+
console.log(`[transformFiltersToApiFormat] Processing ${validatedFilters.filters.length} filter conditions`);
|
|
134
|
+
}
|
|
135
|
+
// For OR logic, we need a completely different structure with filter objects in an array
|
|
136
|
+
if (useOrLogic) {
|
|
137
|
+
return createOrFilterStructure(validatedFilters.filters, validateConditions);
|
|
138
|
+
}
|
|
139
|
+
// Standard AND logic
|
|
140
|
+
return createAndFilterStructure(validatedFilters.filters, validateConditions);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Creates an OR filter structure for the API
|
|
144
|
+
*
|
|
145
|
+
* @param filters - Array of filters to combine with OR logic
|
|
146
|
+
* @param validateConditions - Whether to validate condition types
|
|
147
|
+
* @returns Filter object with $or structure
|
|
148
|
+
* @throws FilterValidationError for invalid filter structures or when all filters are invalid
|
|
149
|
+
*/
|
|
150
|
+
function createOrFilterStructure(filters, validateConditions) {
|
|
151
|
+
const orConditions = [];
|
|
152
|
+
// Use centralized validation utility to collect invalid filters with consistent messages
|
|
153
|
+
const invalidFilters = collectInvalidFilters(filters, validateConditions);
|
|
154
|
+
// Log invalid filters in development mode
|
|
155
|
+
if (invalidFilters.length > 0 && process.env.NODE_ENV === 'development') {
|
|
156
|
+
console.warn('[createOrFilterStructure] Found invalid filters:', invalidFilters.map((f) => `Index ${f.index}: ${f.reason}`));
|
|
157
|
+
}
|
|
158
|
+
// If all filters are invalid, throw a descriptive error with example
|
|
159
|
+
if (invalidFilters.length === filters.length) {
|
|
160
|
+
const errorDetails = formatInvalidFiltersError(invalidFilters);
|
|
161
|
+
let errorMessage = `${ERROR_MESSAGES.ALL_FILTERS_INVALID} ${errorDetails}`;
|
|
162
|
+
// Add example of valid OR filter structure
|
|
163
|
+
errorMessage +=
|
|
164
|
+
'\n\nExample of valid OR filter structure: \n' + getFilterExample('or');
|
|
165
|
+
throw new FilterValidationError(errorMessage, FilterErrorCategory.TRANSFORMATION);
|
|
166
|
+
}
|
|
167
|
+
// Process valid filters
|
|
168
|
+
filters.forEach((filter, index) => {
|
|
169
|
+
// Skip if this filter was found invalid
|
|
170
|
+
if (invalidFilters.some((invalid) => invalid.index === index)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
// Debug log each filter
|
|
174
|
+
if (process.env.NODE_ENV === 'development') {
|
|
175
|
+
console.log(`[createOrFilterStructure] Processing filter ${index}:`, {
|
|
176
|
+
attribute: filter.attribute,
|
|
177
|
+
condition: filter.condition,
|
|
178
|
+
value: filter.value,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const { slug } = filter.attribute;
|
|
182
|
+
// Create a condition object for this individual filter
|
|
183
|
+
const condition = {};
|
|
184
|
+
// Check for special case handling
|
|
185
|
+
if (FIELD_SPECIAL_HANDLING[slug] &&
|
|
186
|
+
FIELD_SPECIAL_HANDLING[slug].useShorthandFormat) {
|
|
187
|
+
// For special fields that need shorthand format
|
|
188
|
+
if (process.env.NODE_ENV === 'development') {
|
|
189
|
+
console.log(`[OR Logic] Using shorthand filter format for field ${slug}`);
|
|
190
|
+
}
|
|
191
|
+
// Direct value assignment for shorthand format
|
|
192
|
+
condition[slug] = filter.value;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Standard operator handling for normal fields
|
|
196
|
+
const operator = filter.condition;
|
|
197
|
+
// Create the condition with operator
|
|
198
|
+
condition[slug] = {
|
|
199
|
+
[`$${operator}`]: filter.value,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
// Add to the OR conditions array
|
|
203
|
+
orConditions.push(condition);
|
|
204
|
+
});
|
|
205
|
+
// Return the $or structure with valid conditions
|
|
206
|
+
if (orConditions.length > 0) {
|
|
207
|
+
return {
|
|
208
|
+
filter: { $or: orConditions },
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// This shouldn't happen given the earlier check, but just in case
|
|
212
|
+
return {};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Creates an AND filter structure for the API
|
|
216
|
+
*
|
|
217
|
+
* @param filters - Array of filters to combine with AND logic
|
|
218
|
+
* @param validateConditions - Whether to validate condition types
|
|
219
|
+
* @returns Filter object with standard AND structure
|
|
220
|
+
* @throws FilterValidationError for invalid filter structures or when all filters are invalid
|
|
221
|
+
*/
|
|
222
|
+
function createAndFilterStructure(filters, validateConditions) {
|
|
223
|
+
const apiFilter = {};
|
|
224
|
+
// Use centralized validation utility to collect invalid filters with consistent messages
|
|
225
|
+
const invalidFilters = collectInvalidFilters(filters, validateConditions);
|
|
226
|
+
// Log invalid filters in development mode
|
|
227
|
+
if (invalidFilters.length > 0 && process.env.NODE_ENV === 'development') {
|
|
228
|
+
console.warn('[createAndFilterStructure] Found invalid filters:', invalidFilters.map((f) => `Index ${f.index}: ${f.reason}`));
|
|
229
|
+
}
|
|
230
|
+
// If all filters are invalid, throw a descriptive error with example
|
|
231
|
+
if (invalidFilters.length === filters.length) {
|
|
232
|
+
const errorDetails = formatInvalidFiltersError(invalidFilters);
|
|
233
|
+
let errorMessage = `${ERROR_MESSAGES.ALL_FILTERS_INVALID} ${errorDetails}`;
|
|
234
|
+
// Add example of valid filter structure for AND logic (multiple conditions)
|
|
235
|
+
errorMessage +=
|
|
236
|
+
'\n\nExample of valid filter structure with multiple conditions: \n' +
|
|
237
|
+
getFilterExample('multiple');
|
|
238
|
+
throw new FilterValidationError(errorMessage, FilterErrorCategory.TRANSFORMATION);
|
|
239
|
+
}
|
|
240
|
+
// Process valid filters
|
|
241
|
+
let hasValidFilters = false;
|
|
242
|
+
filters.forEach((filter, index) => {
|
|
243
|
+
// Skip if this filter was found invalid
|
|
244
|
+
if (invalidFilters.some((invalid) => invalid.index === index)) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
// Debug log each filter
|
|
248
|
+
if (process.env.NODE_ENV === 'development') {
|
|
249
|
+
console.log(`[createAndFilterStructure] Processing filter ${index}:`, {
|
|
250
|
+
attribute: filter.attribute,
|
|
251
|
+
condition: filter.condition,
|
|
252
|
+
value: filter.value,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
const { slug } = filter.attribute;
|
|
256
|
+
// Check for special case handling
|
|
257
|
+
if (FIELD_SPECIAL_HANDLING[slug] &&
|
|
258
|
+
FIELD_SPECIAL_HANDLING[slug].useShorthandFormat) {
|
|
259
|
+
// For special fields that need shorthand format
|
|
260
|
+
if (process.env.NODE_ENV === 'development') {
|
|
261
|
+
console.log(`[AND Logic] Using shorthand filter format for field ${slug}`);
|
|
262
|
+
}
|
|
263
|
+
// Direct value assignment for shorthand format
|
|
264
|
+
if (!apiFilter[slug]) {
|
|
265
|
+
apiFilter[slug] = filter.value;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
console.warn(`Multiple filters for ${slug} using shorthand format will overwrite previous values`);
|
|
269
|
+
apiFilter[slug] = filter.value;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// Standard operator handling for normal fields
|
|
274
|
+
const operator = filter.condition;
|
|
275
|
+
// Initialize attribute entry if needed for operator-based filtering
|
|
276
|
+
if (!apiFilter[slug]) {
|
|
277
|
+
apiFilter[slug] = {};
|
|
278
|
+
}
|
|
279
|
+
// Add operator with $ prefix as required by Attio API
|
|
280
|
+
apiFilter[slug][`$${operator}`] = filter.value;
|
|
281
|
+
}
|
|
282
|
+
hasValidFilters = true;
|
|
283
|
+
});
|
|
284
|
+
// Return the filter object only if valid filters were found
|
|
285
|
+
return hasValidFilters ? { filter: apiFilter } : {};
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Converts a single filter operator to API format
|
|
289
|
+
*
|
|
290
|
+
* @param operator - The operator to convert (e.g., 'equals', 'contains')
|
|
291
|
+
* @returns The operator in API format (e.g., '$equals', '$contains')
|
|
292
|
+
*/
|
|
293
|
+
export function convertOperatorToApiFormat(operator) {
|
|
294
|
+
// Ensure the operator starts with $ for Attio API format
|
|
295
|
+
return operator.startsWith('$') ? operator : `$${operator}`;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Transforms attribute names if they require special handling
|
|
299
|
+
*
|
|
300
|
+
* @param attributeSlug - The attribute slug to transform
|
|
301
|
+
* @returns The transformed attribute name
|
|
302
|
+
*/
|
|
303
|
+
export function transformAttributeName(attributeSlug) {
|
|
304
|
+
// Special transformations for certain attributes
|
|
305
|
+
if (attributeSlug === 'relationship') {
|
|
306
|
+
return '$relationship';
|
|
307
|
+
}
|
|
308
|
+
return attributeSlug;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Processes a filter value for API submission
|
|
312
|
+
* Handles any special value transformations needed
|
|
313
|
+
*
|
|
314
|
+
* @param value - The value to process
|
|
315
|
+
* @param condition - The filter condition being used
|
|
316
|
+
* @returns The processed value
|
|
317
|
+
*/
|
|
318
|
+
export function processFilterValue(value, condition) {
|
|
319
|
+
// Empty conditions should not have a value
|
|
320
|
+
if (condition === FilterConditionType.IS_EMPTY ||
|
|
321
|
+
condition === FilterConditionType.IS_NOT_EMPTY ||
|
|
322
|
+
condition === FilterConditionType.IS_SET ||
|
|
323
|
+
condition === FilterConditionType.IS_NOT_SET) {
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
// Return value as-is for other conditions
|
|
327
|
+
return value;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Transforms a simple filter to API format
|
|
331
|
+
*
|
|
332
|
+
* @param filter - The filter to transform
|
|
333
|
+
* @returns API-formatted filter object
|
|
334
|
+
*/
|
|
335
|
+
export function transformSingleFilterToApi(filter) {
|
|
336
|
+
if (!validateFilterStructure(filter)) {
|
|
337
|
+
throw new FilterValidationError('Invalid filter structure', FilterErrorCategory.STRUCTURE);
|
|
338
|
+
}
|
|
339
|
+
const { slug } = filter.attribute;
|
|
340
|
+
const apiOperator = convertOperatorToApiFormat(filter.condition);
|
|
341
|
+
const value = processFilterValue(filter.value, filter.condition);
|
|
342
|
+
return {
|
|
343
|
+
[slug]: {
|
|
344
|
+
[apiOperator]: value,
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Converts API filter format back to MCP filter format
|
|
350
|
+
* Useful for debugging and reverse transformation
|
|
351
|
+
*
|
|
352
|
+
* @param apiFilter - API format filter
|
|
353
|
+
* @returns MCP format filters
|
|
354
|
+
*/
|
|
355
|
+
export function transformApiFormatToFilters(apiFilter) {
|
|
356
|
+
const filters = [];
|
|
357
|
+
// Check for $or structure
|
|
358
|
+
if (apiFilter.$or && Array.isArray(apiFilter.$or)) {
|
|
359
|
+
// Handle OR logic
|
|
360
|
+
apiFilter.$or.forEach((condition) => {
|
|
361
|
+
if (condition && typeof condition === 'object') {
|
|
362
|
+
Object.entries(condition).forEach(([slug, conditions]) => {
|
|
363
|
+
if (conditions && typeof conditions === 'object') {
|
|
364
|
+
Object.entries(conditions).forEach(([operator, value]) => {
|
|
365
|
+
filters.push({
|
|
366
|
+
attribute: { slug },
|
|
367
|
+
condition: operator.replace('$', ''),
|
|
368
|
+
value,
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
return {
|
|
376
|
+
filters,
|
|
377
|
+
matchAny: true,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
// Handle standard AND logic
|
|
381
|
+
Object.entries(apiFilter).forEach(([slug, conditions]) => {
|
|
382
|
+
if (conditions && typeof conditions === 'object') {
|
|
383
|
+
Object.entries(conditions).forEach(([operator, value]) => {
|
|
384
|
+
filters.push({
|
|
385
|
+
attribute: { slug },
|
|
386
|
+
condition: operator.replace('$', ''),
|
|
387
|
+
value,
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
return {
|
|
393
|
+
filters,
|
|
394
|
+
matchAny: false,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=translators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translators.js","sourceRoot":"","sources":["../../../src/utils/filters/translators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,wBAAwB;AACxB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,+BAA+B;AAC/B,OAAO,EAIL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACd,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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-0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module types
|
|
3
|
+
*
|
|
4
|
+
* Consolidated filter type definitions for Attio API
|
|
5
|
+
* Central location for all filter-related interfaces, types, enums, and constants
|
|
6
|
+
*
|
|
7
|
+
* This module provides:
|
|
8
|
+
* - Type definitions for filters and filter configurations
|
|
9
|
+
* - Attribute constants for consistent field references
|
|
10
|
+
* - Error types specific to filter operations
|
|
11
|
+
* - Enums and interfaces from external dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { FilterConditionType, DateRange, NumericRange, InteractionType, ActivityFilter, RelationshipType, ResourceType } from '../../types/attio.js';
|
|
14
|
+
import { ListEntryFilter, ListEntryFilters } from '../../api/operations/types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Attribute constants for better code readability and consistency
|
|
17
|
+
*/
|
|
18
|
+
export declare const ATTRIBUTES: {
|
|
19
|
+
CREATED_AT: string;
|
|
20
|
+
UPDATED_AT: string;
|
|
21
|
+
LAST_INTERACTION: string;
|
|
22
|
+
INTERACTION_TYPE: string;
|
|
23
|
+
EMAIL: string;
|
|
24
|
+
PHONE: string;
|
|
25
|
+
NAME: string;
|
|
26
|
+
WEBSITE: string;
|
|
27
|
+
INDUSTRY: string;
|
|
28
|
+
REVENUE: string;
|
|
29
|
+
EMPLOYEE_COUNT: string;
|
|
30
|
+
LIST_ID: string;
|
|
31
|
+
NOTE_CONTENT: string;
|
|
32
|
+
RELATIONSHIP: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Type for the Attio API filter object format
|
|
36
|
+
* Represents the structure expected by Attio API endpoints
|
|
37
|
+
*/
|
|
38
|
+
export type AttioApiFilter = {
|
|
39
|
+
[attributeSlug: string]: {
|
|
40
|
+
[condition: string]: any;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Error type for rate-limiting on relationship queries
|
|
45
|
+
*/
|
|
46
|
+
export declare class RelationshipRateLimitError extends Error {
|
|
47
|
+
readonly relationshipType: string;
|
|
48
|
+
readonly resetTime: number;
|
|
49
|
+
readonly msUntilReset: number;
|
|
50
|
+
constructor(message: string, relationshipType: string, resetTime: number, msUntilReset: number);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Configuration for a relationship-based filter
|
|
54
|
+
*/
|
|
55
|
+
export interface RelationshipFilterConfig {
|
|
56
|
+
sourceType: ResourceType;
|
|
57
|
+
targetType: ResourceType;
|
|
58
|
+
relationshipType: RelationshipType;
|
|
59
|
+
targetFilters: ListEntryFilters;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Special case field-operator mappings and handling flags
|
|
63
|
+
*/
|
|
64
|
+
export declare const FIELD_SPECIAL_HANDLING: Record<string, any>;
|
|
65
|
+
/**
|
|
66
|
+
* Valid interaction types for activity filtering
|
|
67
|
+
*/
|
|
68
|
+
export declare const VALID_INTERACTION_TYPES: Set<InteractionType>;
|
|
69
|
+
/**
|
|
70
|
+
* Common filter operation types
|
|
71
|
+
*/
|
|
72
|
+
export type FilterOperation = 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'in' | 'not_in' | 'is_empty' | 'not_empty';
|
|
73
|
+
/**
|
|
74
|
+
* Export reusable filter-related types from dependencies
|
|
75
|
+
*/
|
|
76
|
+
export { FilterConditionType, type DateRange, type NumericRange, InteractionType, type ActivityFilter, RelationshipType, ResourceType, type ListEntryFilter, type ListEntryFilters, };
|
|
77
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9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
|
|
2
|
+
* @module types
|
|
3
|
+
*
|
|
4
|
+
* Consolidated filter type definitions for Attio API
|
|
5
|
+
* Central location for all filter-related interfaces, types, enums, and constants
|
|
6
|
+
*
|
|
7
|
+
* This module provides:
|
|
8
|
+
* - Type definitions for filters and filter configurations
|
|
9
|
+
* - Attribute constants for consistent field references
|
|
10
|
+
* - Error types specific to filter operations
|
|
11
|
+
* - Enums and interfaces from external dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { FilterConditionType, InteractionType, RelationshipType, ResourceType, } from '../../types/attio.js';
|
|
14
|
+
/**
|
|
15
|
+
* Attribute constants for better code readability and consistency
|
|
16
|
+
*/
|
|
17
|
+
export const ATTRIBUTES = {
|
|
18
|
+
CREATED_AT: 'created_at',
|
|
19
|
+
UPDATED_AT: 'updated_at',
|
|
20
|
+
LAST_INTERACTION: 'last_interaction',
|
|
21
|
+
INTERACTION_TYPE: 'interaction_type',
|
|
22
|
+
EMAIL: 'email',
|
|
23
|
+
PHONE: 'phone',
|
|
24
|
+
NAME: 'name',
|
|
25
|
+
WEBSITE: 'website',
|
|
26
|
+
INDUSTRY: 'industry',
|
|
27
|
+
REVENUE: 'annual_revenue',
|
|
28
|
+
EMPLOYEE_COUNT: 'employee_count',
|
|
29
|
+
LIST_ID: 'list_id',
|
|
30
|
+
NOTE_CONTENT: 'note_content',
|
|
31
|
+
RELATIONSHIP: '$relationship',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Error type for rate-limiting on relationship queries
|
|
35
|
+
*/
|
|
36
|
+
export class RelationshipRateLimitError extends Error {
|
|
37
|
+
relationshipType;
|
|
38
|
+
resetTime;
|
|
39
|
+
msUntilReset;
|
|
40
|
+
constructor(message, relationshipType, resetTime, msUntilReset) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.relationshipType = relationshipType;
|
|
43
|
+
this.resetTime = resetTime;
|
|
44
|
+
this.msUntilReset = msUntilReset;
|
|
45
|
+
this.name = 'RelationshipRateLimitError';
|
|
46
|
+
// This line is needed to properly capture the stack trace
|
|
47
|
+
Object.setPrototypeOf(this, RelationshipRateLimitError.prototype);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Special case field-operator mappings and handling flags
|
|
52
|
+
*/
|
|
53
|
+
export const FIELD_SPECIAL_HANDLING = {
|
|
54
|
+
// Special handling for B2B Segment field (type_persona)
|
|
55
|
+
type_persona: {
|
|
56
|
+
in: 'contains_any',
|
|
57
|
+
contains_any: 'contains_any',
|
|
58
|
+
not_empty: 'not_empty',
|
|
59
|
+
operators: ['in', 'contains_any', 'not_empty'],
|
|
60
|
+
allowStringValue: true,
|
|
61
|
+
disableDebugLogging: true,
|
|
62
|
+
},
|
|
63
|
+
// Other fields can be added here as needed
|
|
64
|
+
segment: {
|
|
65
|
+
in: 'contains_any',
|
|
66
|
+
contains_any: 'contains_any',
|
|
67
|
+
operators: ['in', 'contains_any'],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Valid interaction types for activity filtering
|
|
72
|
+
*/
|
|
73
|
+
export const VALID_INTERACTION_TYPES = new Set([
|
|
74
|
+
InteractionType.EMAIL,
|
|
75
|
+
InteractionType.CALENDAR,
|
|
76
|
+
InteractionType.PHONE,
|
|
77
|
+
InteractionType.MEETING,
|
|
78
|
+
InteractionType.CUSTOM,
|
|
79
|
+
InteractionType.ANY,
|
|
80
|
+
]);
|
|
81
|
+
/**
|
|
82
|
+
* Export reusable filter-related types from dependencies
|
|
83
|
+
*/
|
|
84
|
+
export { FilterConditionType, InteractionType, RelationshipType, ResourceType, };
|
|
85
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/filters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,mBAAmB,EAGnB,eAAe,EAEf,gBAAgB,EAChB,YAAY,GACb,MA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AAC,IAAI,EAAE,cAAc,CAAC;KAClC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAkB;IAC9D,eAAe,CAAC,KAAK;IACrB,eAAe,CAAC,QAAQ;IACxB,eAAe,CAAC,KAAK;IACrB,eAAe,CAAC,OAAO;IACvB,eAAe,CAAC,MAAM;IACtB,eAAe,CAAC,GAAG;CACpB,CAAC,CAAC;AAmBH;;GAEG;AACH,OAAO,EACL,mBAAmB,EAGnB,eAAe,EAEf,gBAAgB,EAChB,YAAY,GAGb,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General filter utility functions
|
|
3
|
+
* Consolidates utilities from filter-utils.ts and filter-utils-additions.ts
|
|
4
|
+
*/
|
|
5
|
+
import { DateRange, NumericRange, FilterConditionType } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a filter for records based on their creation date
|
|
8
|
+
*
|
|
9
|
+
* @param dateRange - Date range specification
|
|
10
|
+
* @returns Configured filter object
|
|
11
|
+
*/
|
|
12
|
+
export declare function createCreatedDateFilter(dateRange: DateRange): import("./types.js").ListEntryFilters;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a filter for records based on their last modification date
|
|
15
|
+
*
|
|
16
|
+
* @param dateRange - Date range specification
|
|
17
|
+
* @returns Configured filter object
|
|
18
|
+
*/
|
|
19
|
+
export declare function createModifiedDateFilter(dateRange: DateRange): import("./types.js").ListEntryFilters;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a filter for B2B Segment (type_persona)
|
|
22
|
+
*
|
|
23
|
+
* @param value - B2B Segment value to filter by
|
|
24
|
+
* @returns Configured filter object
|
|
25
|
+
*/
|
|
26
|
+
export declare function createB2BSegmentFilter(value: string): {
|
|
27
|
+
filters: {
|
|
28
|
+
attribute: {
|
|
29
|
+
slug: string;
|
|
30
|
+
};
|
|
31
|
+
condition: FilterConditionType;
|
|
32
|
+
value: string;
|
|
33
|
+
}[];
|
|
34
|
+
matchAny: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Validates if a value falls within a numeric range
|
|
38
|
+
*
|
|
39
|
+
* @param value - The value to check
|
|
40
|
+
* @param range - The numeric range to validate against
|
|
41
|
+
* @returns True if value is within range
|
|
42
|
+
*/
|
|
43
|
+
export declare function isInNumericRange(value: number, range: NumericRange): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if a date string falls within a date range
|
|
46
|
+
*
|
|
47
|
+
* @param dateStr - ISO date string to check
|
|
48
|
+
* @param range - Date range to validate against
|
|
49
|
+
* @returns True if date is within range
|
|
50
|
+
*/
|
|
51
|
+
export declare function isInDateRange(dateStr: string, range: DateRange): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Debug logging for filter operations
|
|
54
|
+
*
|
|
55
|
+
* @param operation - The operation being performed
|
|
56
|
+
* @param details - Additional details to log
|
|
57
|
+
*/
|
|
58
|
+
export declare function debugFilterLog(operation: string, details: any): void;
|
|
59
|
+
/**
|
|
60
|
+
* Determines if a filter attribute represents a date field
|
|
61
|
+
*
|
|
62
|
+
* @param attributeSlug - The attribute slug to check
|
|
63
|
+
* @returns True if the attribute is a date field
|
|
64
|
+
*/
|
|
65
|
+
export declare function isDateAttribute(attributeSlug: string): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Determines if a filter attribute represents a numeric field
|
|
68
|
+
*
|
|
69
|
+
* @param attributeSlug - The attribute slug to check
|
|
70
|
+
* @returns True if the attribute is a numeric field
|
|
71
|
+
*/
|
|
72
|
+
export declare function isNumericAttribute(attributeSlug: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Determines if a filter attribute represents a text field
|
|
75
|
+
*
|
|
76
|
+
* @param attributeSlug - The attribute slug to check
|
|
77
|
+
* @returns True if the attribute is a text field
|
|
78
|
+
*/
|
|
79
|
+
export declare function isTextAttribute(attributeSlug: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Helper function to extract attribute mappings as needed
|
|
82
|
+
* Re-exports builder functions as utilities for backward compatibility
|
|
83
|
+
*/
|
|
84
|
+
import { createDateRangeFilter, createEqualsFilter, createContainsFilter } from './builders.js';
|
|
85
|
+
export { createDateRangeFilter, createEqualsFilter, createContainsFilter };
|
|
86
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,SAAS,EACT,YAAY,EAEZ,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAGpB;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,yCAE3D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,yCAE5D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM;;;;;;;;;EAYnD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAc5E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAexE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI,CAIpE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAQ9D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAU9D;AAED;;;GAGG;AACH,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,CAAC"}
|