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,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date related filter builders.
|
|
3
|
+
*/
|
|
4
|
+
// External imports
|
|
5
|
+
import { FilterValidationError } from '../../../errors/api-errors.js';
|
|
6
|
+
import { resolveDateRange } from '../../date-utils.js';
|
|
7
|
+
// Internal imports
|
|
8
|
+
import { FilterConditionType, ATTRIBUTES, } from './types.js';
|
|
9
|
+
import { validateDateRange } from '../validators.js';
|
|
10
|
+
/**
|
|
11
|
+
* Creates a date range filter for a specific attribute.
|
|
12
|
+
*/
|
|
13
|
+
export function createDateRangeFilter(attributeSlug, dateRange) {
|
|
14
|
+
try {
|
|
15
|
+
const validated = validateDateRange(dateRange);
|
|
16
|
+
const resolved = resolveDateRange(validated);
|
|
17
|
+
const filters = [];
|
|
18
|
+
if (resolved.start) {
|
|
19
|
+
filters.push({
|
|
20
|
+
attribute: { slug: attributeSlug },
|
|
21
|
+
condition: FilterConditionType.GREATER_THAN_OR_EQUALS,
|
|
22
|
+
value: resolved.start,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (resolved.end) {
|
|
26
|
+
filters.push({
|
|
27
|
+
attribute: { slug: attributeSlug },
|
|
28
|
+
condition: FilterConditionType.LESS_THAN_OR_EQUALS,
|
|
29
|
+
value: resolved.end,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return { filters, matchAny: false };
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
+
throw new FilterValidationError(`Failed to create date range filter: ${message}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates a filter for records based on their creation date.
|
|
41
|
+
*/
|
|
42
|
+
export function createCreatedDateFilter(dateRange) {
|
|
43
|
+
return createDateRangeFilter(ATTRIBUTES.CREATED_AT, dateRange);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a filter for records based on their last modification date.
|
|
47
|
+
*/
|
|
48
|
+
export function createModifiedDateFilter(dateRange) {
|
|
49
|
+
return createDateRangeFilter(ATTRIBUTES.UPDATED_AT, dateRange);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../src/utils/filters/builders/date.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mBAAmB;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,mBAAmB;AACnB,OAAO,EACL,mBAAmB,EAInB,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ED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAoB;IAEpB,OAAO,qBAAqB,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters/builders/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/filters/builders/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numeric range filter builders.
|
|
3
|
+
*/
|
|
4
|
+
import { ListEntryFilters, NumericRange } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a numeric filter for a specific attribute.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createNumericFilter(attributeSlug: string, range: NumericRange): ListEntryFilters;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a filter for employee count.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createEmployeeCountFilter(range: NumericRange): ListEntryFilters;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a filter for annual revenue.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createRevenueFilter(range: NumericRange): ListEntryFilters;
|
|
17
|
+
//# sourceMappingURL=numeric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters/builders/numeric.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAGL,gBAAgB,EAChB,YAAY,EAEb,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,YAAY,GAClB,gBAAgB,CA0ClB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,YAAY,GAClB,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,gBAAgB,CAEzE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Numeric range filter builders.
|
|
3
|
+
*/
|
|
4
|
+
// External imports
|
|
5
|
+
import { FilterValidationError } from '../../../errors/api-errors.js';
|
|
6
|
+
// Internal imports
|
|
7
|
+
import { FilterConditionType, ATTRIBUTES, } from './types.js';
|
|
8
|
+
import { validateNumericRange } from '../validators.js';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a numeric filter for a specific attribute.
|
|
11
|
+
*/
|
|
12
|
+
export function createNumericFilter(attributeSlug, range) {
|
|
13
|
+
try {
|
|
14
|
+
const validatedRange = validateNumericRange(range);
|
|
15
|
+
if (validatedRange.equals !== undefined) {
|
|
16
|
+
return {
|
|
17
|
+
filters: [
|
|
18
|
+
{
|
|
19
|
+
attribute: { slug: attributeSlug },
|
|
20
|
+
condition: FilterConditionType.EQUALS,
|
|
21
|
+
value: validatedRange.equals,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
matchAny: false,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const filters = [];
|
|
28
|
+
if (validatedRange.min !== undefined) {
|
|
29
|
+
filters.push({
|
|
30
|
+
attribute: { slug: attributeSlug },
|
|
31
|
+
condition: FilterConditionType.GREATER_THAN_OR_EQUALS,
|
|
32
|
+
value: validatedRange.min,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (validatedRange.max !== undefined) {
|
|
36
|
+
filters.push({
|
|
37
|
+
attribute: { slug: attributeSlug },
|
|
38
|
+
condition: FilterConditionType.LESS_THAN_OR_EQUALS,
|
|
39
|
+
value: validatedRange.max,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return { filters, matchAny: false };
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
46
|
+
throw new FilterValidationError(`Failed to create numeric filter: ${message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a filter for employee count.
|
|
51
|
+
*/
|
|
52
|
+
export function createEmployeeCountFilter(range) {
|
|
53
|
+
return createNumericFilter(ATTRIBUTES.EMPLOYEE_COUNT, range);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates a filter for annual revenue.
|
|
57
|
+
*/
|
|
58
|
+
export function createRevenueFilter(range) {
|
|
59
|
+
return createNumericFilter(ATTRIBUTES.REVENUE, range);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=numeric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric.js","sourceRoot":"","sources":["../../../../src/utils/filters/builders/numeric.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mBAAmB;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,mBAAmB;AACnB,OAAO,EACL,mBAAmB,EAInB,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,aAAqB,EACrB,KAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,oBAAoB,CAAC,KAAK,CAA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K,CAAC,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAmB;IACrD,OAAO,mBAAmB,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text based filter builders.
|
|
3
|
+
*/
|
|
4
|
+
import { FilterConditionType, ListEntryFilters } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a phone number filter.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPhoneFilter(phoneCondition: FilterConditionType, phoneValue?: string): ListEntryFilters;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an email filter.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createEmailFilter(emailCondition: FilterConditionType, emailValue?: string): ListEntryFilters;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a filter for a specific industry.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createIndustryFilter(industry: string, condition?: FilterConditionType): ListEntryFilters;
|
|
17
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters/builders/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,mBAAmB,EACnC,UAAU,CAAC,EAAE,MAAM,GAClB,gBAAgB,CAelB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,mBAAmB,EACnC,UAAU,CAAC,EAAE,MAAM,GAClB,gBAAgB,CAelB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,mBAAgD,GAC1D,gBAAgB,CAOlB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text based filter builders.
|
|
3
|
+
*/
|
|
4
|
+
// Internal imports
|
|
5
|
+
import { FilterConditionType, ATTRIBUTES, } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a phone number filter.
|
|
8
|
+
*/
|
|
9
|
+
export function createPhoneFilter(phoneCondition, phoneValue) {
|
|
10
|
+
const filter = {
|
|
11
|
+
attribute: { slug: ATTRIBUTES.PHONE },
|
|
12
|
+
condition: phoneCondition,
|
|
13
|
+
value: phoneValue,
|
|
14
|
+
};
|
|
15
|
+
if (phoneCondition === FilterConditionType.IS_EMPTY ||
|
|
16
|
+
phoneCondition === FilterConditionType.IS_NOT_EMPTY) {
|
|
17
|
+
delete filter.value;
|
|
18
|
+
}
|
|
19
|
+
return { filters: [filter], matchAny: false };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates an email filter.
|
|
23
|
+
*/
|
|
24
|
+
export function createEmailFilter(emailCondition, emailValue) {
|
|
25
|
+
const filter = {
|
|
26
|
+
attribute: { slug: ATTRIBUTES.EMAIL },
|
|
27
|
+
condition: emailCondition,
|
|
28
|
+
value: emailValue,
|
|
29
|
+
};
|
|
30
|
+
if (emailCondition === FilterConditionType.IS_EMPTY ||
|
|
31
|
+
emailCondition === FilterConditionType.IS_NOT_EMPTY) {
|
|
32
|
+
delete filter.value;
|
|
33
|
+
}
|
|
34
|
+
return { filters: [filter], matchAny: false };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a filter for a specific industry.
|
|
38
|
+
*/
|
|
39
|
+
export function createIndustryFilter(industry, condition = FilterConditionType.EQUALS) {
|
|
40
|
+
return {
|
|
41
|
+
filters: [
|
|
42
|
+
{ attribute: { slug: ATTRIBUTES.INDUSTRY }, condition, value: industry },
|
|
43
|
+
],
|
|
44
|
+
matchAny: false,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=text.js.map
|
|
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AE,EAAE,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE;SACzE;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters/builders/types.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/utils/filters/builders/types.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/builders.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../../../src/utils/filters/builders.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caching layer for filters, especially relationship-based filters
|
|
3
|
+
* Provides an in-memory LRU cache for expensive filter operations
|
|
4
|
+
*/
|
|
5
|
+
import { ListEntryFilters } from '../../api/operations/index.js';
|
|
6
|
+
import { ResourceType, RelationshipType } from '../../types/attio.js';
|
|
7
|
+
/**
|
|
8
|
+
* Key structure for relationship filter cache
|
|
9
|
+
*/
|
|
10
|
+
interface RelationshipFilterCacheKey {
|
|
11
|
+
relationshipType: RelationshipType;
|
|
12
|
+
sourceType: ResourceType;
|
|
13
|
+
targetType: ResourceType;
|
|
14
|
+
targetFilterHash: string;
|
|
15
|
+
listId?: string;
|
|
16
|
+
isNested?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets a cached relationship filter if available
|
|
20
|
+
*
|
|
21
|
+
* @param key - Filter cache key
|
|
22
|
+
* @returns Cached filter or undefined if not found
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCachedRelationshipFilter(key: RelationshipFilterCacheKey): ListEntryFilters | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Caches a relationship filter result
|
|
27
|
+
*
|
|
28
|
+
* @param key - Filter cache key
|
|
29
|
+
* @param filter - Filter to cache
|
|
30
|
+
*/
|
|
31
|
+
export declare function cacheRelationshipFilter(key: RelationshipFilterCacheKey, filter: ListEntryFilters): void;
|
|
32
|
+
/**
|
|
33
|
+
* Gets a cached list membership filter if available
|
|
34
|
+
*
|
|
35
|
+
* @param listId - ID of the list
|
|
36
|
+
* @param resourceType - Type of records (people or companies)
|
|
37
|
+
* @returns Cached filter or undefined if not found
|
|
38
|
+
*/
|
|
39
|
+
export declare function getCachedListFilter(listId: string, resourceType: ResourceType): ListEntryFilters | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Caches a list membership filter result
|
|
42
|
+
*
|
|
43
|
+
* @param listId - ID of the list
|
|
44
|
+
* @param resourceType - Type of records (people or companies)
|
|
45
|
+
* @param filter - Filter to cache
|
|
46
|
+
*/
|
|
47
|
+
export declare function cacheListFilter(listId: string, resourceType: ResourceType, filter: ListEntryFilters): void;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a hash of filter configuration to use as part of the cache key
|
|
50
|
+
*
|
|
51
|
+
* @param filters - Filter configuration to hash
|
|
52
|
+
* @returns String representation of the filter for caching
|
|
53
|
+
*/
|
|
54
|
+
export declare function hashFilters(filters: ListEntryFilters): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get statistics for the relationship filter cache
|
|
57
|
+
*
|
|
58
|
+
* @returns Cache statistics
|
|
59
|
+
*/
|
|
60
|
+
export declare function getRelationshipCacheStats(): {
|
|
61
|
+
size: number;
|
|
62
|
+
maxSize: number;
|
|
63
|
+
ttlMs: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Get statistics for the list membership cache
|
|
67
|
+
*
|
|
68
|
+
* @returns Cache statistics
|
|
69
|
+
*/
|
|
70
|
+
export declare function getListCacheStats(): {
|
|
71
|
+
size: number;
|
|
72
|
+
maxSize: number;
|
|
73
|
+
ttlMs: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Clear all caches
|
|
77
|
+
*/
|
|
78
|
+
export declare function clearAllCaches(): void;
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA4JtE;;GAEG;AACH,UAAU,0BAA0B;IAClC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,UAAU,EAAE,YAAY,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAsBD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,0BAA0B,GAC9B,gBAAgB,GAAG,SAAS,CAE9B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,0BAA0B,EAC/B,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,GACzB,gBAAgB,GAAG,SAAS,CAG9B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAGN;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAG7D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAEA;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAEA;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAGrC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LRU Cache implementation with time-based expiration
|
|
3
|
+
*/
|
|
4
|
+
class LRUCache {
|
|
5
|
+
cache;
|
|
6
|
+
maxSize;
|
|
7
|
+
ttlMs;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new LRU cache
|
|
10
|
+
*
|
|
11
|
+
* @param maxSize - Maximum number of entries to store
|
|
12
|
+
* @param ttlMs - Time to live in milliseconds
|
|
13
|
+
*/
|
|
14
|
+
constructor(maxSize, ttlMs) {
|
|
15
|
+
this.cache = new Map();
|
|
16
|
+
this.maxSize = maxSize;
|
|
17
|
+
this.ttlMs = ttlMs;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate a string key from any object
|
|
21
|
+
*
|
|
22
|
+
* @param key - Key object to stringify
|
|
23
|
+
* @returns String representation
|
|
24
|
+
*/
|
|
25
|
+
getKeyString(key) {
|
|
26
|
+
return JSON.stringify(key);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get a value from the cache
|
|
30
|
+
*
|
|
31
|
+
* @param key - Cache key
|
|
32
|
+
* @returns Cached value or undefined if not found or expired
|
|
33
|
+
*/
|
|
34
|
+
get(key) {
|
|
35
|
+
const keyString = this.getKeyString(key);
|
|
36
|
+
const entry = this.cache.get(keyString);
|
|
37
|
+
// Return undefined if no entry or entry is expired
|
|
38
|
+
if (!entry || Date.now() - entry.timestamp > this.ttlMs) {
|
|
39
|
+
if (entry) {
|
|
40
|
+
// Remove expired entry
|
|
41
|
+
this.cache.delete(keyString);
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
// Update hit count
|
|
46
|
+
entry.hits++;
|
|
47
|
+
return entry.value;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Store a value in the cache
|
|
51
|
+
*
|
|
52
|
+
* @param key - Cache key
|
|
53
|
+
* @param value - Value to cache
|
|
54
|
+
*/
|
|
55
|
+
set(key, value) {
|
|
56
|
+
// Clean up expired entries first
|
|
57
|
+
this.cleanExpired();
|
|
58
|
+
const keyString = this.getKeyString(key);
|
|
59
|
+
// If we're at capacity and the key doesn't already exist,
|
|
60
|
+
// remove the least recently used item
|
|
61
|
+
if (this.cache.size >= this.maxSize && !this.cache.has(keyString)) {
|
|
62
|
+
this.evictLRU();
|
|
63
|
+
}
|
|
64
|
+
// Add or update the cache
|
|
65
|
+
this.cache.set(keyString, {
|
|
66
|
+
value,
|
|
67
|
+
timestamp: Date.now(),
|
|
68
|
+
hits: 1,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Remove all expired entries from the cache
|
|
73
|
+
*/
|
|
74
|
+
cleanExpired() {
|
|
75
|
+
const now = Date.now();
|
|
76
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
77
|
+
if (now - entry.timestamp > this.ttlMs) {
|
|
78
|
+
this.cache.delete(key);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Remove the least recently used entry from the cache
|
|
84
|
+
*/
|
|
85
|
+
evictLRU() {
|
|
86
|
+
let lruKey = null;
|
|
87
|
+
let lowestHits = Infinity;
|
|
88
|
+
let oldestTimestamp = Infinity;
|
|
89
|
+
// Find the entry with lowest hit count, or oldest if tied
|
|
90
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
91
|
+
if (entry.hits < lowestHits ||
|
|
92
|
+
(entry.hits === lowestHits && entry.timestamp < oldestTimestamp)) {
|
|
93
|
+
lruKey = key;
|
|
94
|
+
lowestHits = entry.hits;
|
|
95
|
+
oldestTimestamp = entry.timestamp;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Remove the LRU entry
|
|
99
|
+
if (lruKey) {
|
|
100
|
+
this.cache.delete(lruKey);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Clear the entire cache
|
|
105
|
+
*/
|
|
106
|
+
clear() {
|
|
107
|
+
this.cache.clear();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get the current size of the cache
|
|
111
|
+
*/
|
|
112
|
+
get size() {
|
|
113
|
+
return this.cache.size;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get statistics about the cache
|
|
117
|
+
*/
|
|
118
|
+
getStats() {
|
|
119
|
+
return {
|
|
120
|
+
size: this.cache.size,
|
|
121
|
+
maxSize: this.maxSize,
|
|
122
|
+
ttlMs: this.ttlMs,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Cache for relationship filters with a 5-minute TTL
|
|
128
|
+
*/
|
|
129
|
+
const relationshipFilterCache = new LRUCache(100, // Store up to 100 filter configurations
|
|
130
|
+
5 * 60 * 1000 // 5 minutes TTL
|
|
131
|
+
);
|
|
132
|
+
/**
|
|
133
|
+
* Cache for list membership filters with a longer 15-minute TTL
|
|
134
|
+
* since list membership changes less frequently
|
|
135
|
+
*/
|
|
136
|
+
const listMembershipCache = new LRUCache(50, // Store up to 50 list filters
|
|
137
|
+
15 * 60 * 1000 // 15 minutes TTL
|
|
138
|
+
);
|
|
139
|
+
/**
|
|
140
|
+
* Gets a cached relationship filter if available
|
|
141
|
+
*
|
|
142
|
+
* @param key - Filter cache key
|
|
143
|
+
* @returns Cached filter or undefined if not found
|
|
144
|
+
*/
|
|
145
|
+
export function getCachedRelationshipFilter(key) {
|
|
146
|
+
return relationshipFilterCache.get(key);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Caches a relationship filter result
|
|
150
|
+
*
|
|
151
|
+
* @param key - Filter cache key
|
|
152
|
+
* @param filter - Filter to cache
|
|
153
|
+
*/
|
|
154
|
+
export function cacheRelationshipFilter(key, filter) {
|
|
155
|
+
relationshipFilterCache.set(key, filter);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Gets a cached list membership filter if available
|
|
159
|
+
*
|
|
160
|
+
* @param listId - ID of the list
|
|
161
|
+
* @param resourceType - Type of records (people or companies)
|
|
162
|
+
* @returns Cached filter or undefined if not found
|
|
163
|
+
*/
|
|
164
|
+
export function getCachedListFilter(listId, resourceType) {
|
|
165
|
+
const key = `${listId}:${resourceType}`;
|
|
166
|
+
return listMembershipCache.get(key);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Caches a list membership filter result
|
|
170
|
+
*
|
|
171
|
+
* @param listId - ID of the list
|
|
172
|
+
* @param resourceType - Type of records (people or companies)
|
|
173
|
+
* @param filter - Filter to cache
|
|
174
|
+
*/
|
|
175
|
+
export function cacheListFilter(listId, resourceType, filter) {
|
|
176
|
+
const key = `${listId}:${resourceType}`;
|
|
177
|
+
listMembershipCache.set(key, filter);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Creates a hash of filter configuration to use as part of the cache key
|
|
181
|
+
*
|
|
182
|
+
* @param filters - Filter configuration to hash
|
|
183
|
+
* @returns String representation of the filter for caching
|
|
184
|
+
*/
|
|
185
|
+
export function hashFilters(filters) {
|
|
186
|
+
// This is a simple hash function, but it's sufficient for caching purposes
|
|
187
|
+
return JSON.stringify(filters);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get statistics for the relationship filter cache
|
|
191
|
+
*
|
|
192
|
+
* @returns Cache statistics
|
|
193
|
+
*/
|
|
194
|
+
export function getRelationshipCacheStats() {
|
|
195
|
+
return relationshipFilterCache.getStats();
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get statistics for the list membership cache
|
|
199
|
+
*
|
|
200
|
+
* @returns Cache statistics
|
|
201
|
+
*/
|
|
202
|
+
export function getListCacheStats() {
|
|
203
|
+
return listMembershipCache.getStats();
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Clear all caches
|
|
207
|
+
*/
|
|
208
|
+
export function clearAllCaches() {
|
|
209
|
+
relationshipFilterCache.clear();
|
|
210
|
+
listMembershipCache.clear();
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/utils/filters/cache.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,QAAQ;IACJ,KAAK,CAA6B;IACzB,OAAO,CAAS;IAChB,KAAK,CAAS;IAE/B;;;;;OAKG;IACH,YAAY,OAAe,EAAE,KAAa;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAAC,GAAM;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,GAAM;QACR,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAExC,mDAAmD;QACnD,IAAI,CAAC,KAAK,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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central export point for all filter-related functionality
|
|
3
|
+
* Maintains backward compatibility while providing organized module structure
|
|
4
|
+
*/
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export * from './validators.js';
|
|
7
|
+
export * from './builders.js';
|
|
8
|
+
export * from './translators.js';
|
|
9
|
+
export * from './operators.js';
|
|
10
|
+
export * from './utils.js';
|
|
11
|
+
export * from './cache.js';
|
|
12
|
+
export * from './relationship.js';
|
|
13
|
+
import { transformFiltersToApiFormat } from './translators.js';
|
|
14
|
+
import { validateFilterStructure } from './validators.js';
|
|
15
|
+
import { createEqualsFilter, createContainsFilter, combineWithAnd, combineWithOr } from './builders.js';
|
|
16
|
+
export declare const Basic: {
|
|
17
|
+
validateFilterStructure: typeof validateFilterStructure;
|
|
18
|
+
transformFiltersToApiFormat: typeof transformFiltersToApiFormat;
|
|
19
|
+
createEqualsFilter: typeof createEqualsFilter;
|
|
20
|
+
createContainsFilter: typeof createContainsFilter;
|
|
21
|
+
combineWithAnd: typeof combineWithAnd;
|
|
22
|
+
combineWithOr: typeof combineWithOr;
|
|
23
|
+
};
|
|
24
|
+
import { createDateRangeFilter, createCreatedDateFilter, createModifiedDateFilter, createNumericFilter, createRevenueFilter, createEmployeeCountFilter } from './builders.js';
|
|
25
|
+
export declare const Range: {
|
|
26
|
+
createDateRangeFilter: typeof createDateRangeFilter;
|
|
27
|
+
createCreatedDateFilter: typeof createCreatedDateFilter;
|
|
28
|
+
createModifiedDateFilter: typeof createModifiedDateFilter;
|
|
29
|
+
createNumericFilter: typeof createNumericFilter;
|
|
30
|
+
createRevenueFilter: typeof createRevenueFilter;
|
|
31
|
+
createEmployeeCountFilter: typeof createEmployeeCountFilter;
|
|
32
|
+
};
|
|
33
|
+
import { createActivityFilter, createLastInteractionFilter } from './builders.js';
|
|
34
|
+
export declare const Activity: {
|
|
35
|
+
createActivityFilter: typeof createActivityFilter;
|
|
36
|
+
createLastInteractionFilter: typeof createLastInteractionFilter;
|
|
37
|
+
};
|
|
38
|
+
import { applyRateLimit, createPeopleByCompanyFilter, createCompaniesByPeopleFilter, createRecordsByListFilter, createPeopleByCompanyListFilter, createCompaniesByPeopleListFilter, createRecordsByNotesFilter } from './relationship.js';
|
|
39
|
+
export declare const Relationship: {
|
|
40
|
+
applyRateLimit: typeof applyRateLimit;
|
|
41
|
+
createPeopleByCompanyFilter: typeof createPeopleByCompanyFilter;
|
|
42
|
+
createCompaniesByPeopleFilter: typeof createCompaniesByPeopleFilter;
|
|
43
|
+
createRecordsByListFilter: typeof createRecordsByListFilter;
|
|
44
|
+
createPeopleByCompanyListFilter: typeof createPeopleByCompanyListFilter;
|
|
45
|
+
createCompaniesByPeopleListFilter: typeof createCompaniesByPeopleListFilter;
|
|
46
|
+
createRecordsByNotesFilter: typeof createRecordsByNotesFilter;
|
|
47
|
+
};
|
|
48
|
+
import { combineFiltersWithAnd, combineFiltersWithOr } from './builders.js';
|
|
49
|
+
export { transformFiltersToApiFormat, createEqualsFilter, createContainsFilter, combineFiltersWithAnd, combineFiltersWithOr, createDateRangeFilter, createCreatedDateFilter, createModifiedDateFilter, createNumericFilter, createRevenueFilter, createEmployeeCountFilter, createLastInteractionFilter, createActivityFilter, createPeopleByCompanyFilter, createCompaniesByPeopleFilter, createRecordsByListFilter, createPeopleByCompanyListFilter, createCompaniesByPeopleListFilter, createRecordsByNotesFilter, };
|
|
50
|
+
export { ATTRIBUTES as FILTER_ATTRIBUTES } from './types.js';
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,eAAe,CAAC;AAG9B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,gBAAgB,CAAC;AAG/B,c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