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,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core attribute mapping functions for translating human-readable attribute names to API slugs
|
|
3
|
+
*/
|
|
4
|
+
import { loadMappingConfig } from '../config-loader.js';
|
|
5
|
+
import { LEGACY_ATTRIBUTE_MAP } from './legacy-maps.js';
|
|
6
|
+
import { createCaseInsensitiveMap, lookupCaseInsensitive, lookupNormalized, createNormalizedMap, createAggressiveNormalizedMap, lookupAggressiveNormalized, handleSpecialCases, } from './mapping-utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Converts a value to a boolean based on common string representations
|
|
9
|
+
*
|
|
10
|
+
* @param value - The value to convert to boolean
|
|
11
|
+
* @returns Boolean representation of the value
|
|
12
|
+
*/
|
|
13
|
+
export function convertToBoolean(value) {
|
|
14
|
+
if (typeof value === 'boolean')
|
|
15
|
+
return value;
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
const lowerValue = value.toLowerCase();
|
|
18
|
+
if (['true', 'yes', 'y', '1'].includes(lowerValue))
|
|
19
|
+
return true;
|
|
20
|
+
if (['false', 'no', 'n', '0'].includes(lowerValue))
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === 'number')
|
|
24
|
+
return !isNaN(value) && value !== 0;
|
|
25
|
+
// If we can't determine, return the original value as boolean
|
|
26
|
+
return Boolean(value);
|
|
27
|
+
}
|
|
28
|
+
// Error class for attribute mapping errors
|
|
29
|
+
export class AttributeMappingError extends Error {
|
|
30
|
+
details;
|
|
31
|
+
constructor(message, details = {}) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.details = details;
|
|
34
|
+
this.name = 'AttributeMappingError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Cache the config to avoid repeatedly loading from disk
|
|
38
|
+
let cachedConfig = null;
|
|
39
|
+
// Cache for case-insensitive lookups
|
|
40
|
+
const caseInsensitiveCaches = {};
|
|
41
|
+
// Cache for normalized lookups (spaces removed, case insensitive)
|
|
42
|
+
const normalizedCaches = {};
|
|
43
|
+
/**
|
|
44
|
+
* Initialize lookup caches for faster mapping
|
|
45
|
+
*
|
|
46
|
+
* @param config The configuration to create caches for
|
|
47
|
+
*/
|
|
48
|
+
function initializeLookupCaches(config) {
|
|
49
|
+
// Create case-insensitive lookup maps
|
|
50
|
+
caseInsensitiveCaches.common = createCaseInsensitiveMap(config.mappings.attributes.common);
|
|
51
|
+
caseInsensitiveCaches.custom = createCaseInsensitiveMap(config.mappings.attributes.custom);
|
|
52
|
+
caseInsensitiveCaches.objects = createCaseInsensitiveMap(config.mappings.objects);
|
|
53
|
+
caseInsensitiveCaches.lists = createCaseInsensitiveMap(config.mappings.lists);
|
|
54
|
+
caseInsensitiveCaches.legacy = createCaseInsensitiveMap(LEGACY_ATTRIBUTE_MAP);
|
|
55
|
+
// Create normalized lookup maps for fuzzy matching
|
|
56
|
+
normalizedCaches.legacy = createNormalizedMap(LEGACY_ATTRIBUTE_MAP);
|
|
57
|
+
// Create maps for object-specific attributes
|
|
58
|
+
for (const [objectType, mappings] of Object.entries(config.mappings.attributes.objects)) {
|
|
59
|
+
caseInsensitiveCaches[`objects.${objectType}`] =
|
|
60
|
+
createCaseInsensitiveMap(mappings);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets the mapping configuration, loading it from disk if necessary
|
|
65
|
+
*/
|
|
66
|
+
function getConfig() {
|
|
67
|
+
// Always reload the config in test environment to get fresh mocks
|
|
68
|
+
if (!cachedConfig || process.env.NODE_ENV === 'test') {
|
|
69
|
+
try {
|
|
70
|
+
cachedConfig = loadMappingConfig();
|
|
71
|
+
// Initialize lookup caches for faster access
|
|
72
|
+
initializeLookupCaches(cachedConfig);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Failed to load mapping configuration:', error);
|
|
76
|
+
// Create a simple config using the legacy map for backward compatibility
|
|
77
|
+
cachedConfig = {
|
|
78
|
+
version: '1.0',
|
|
79
|
+
mappings: {
|
|
80
|
+
attributes: {
|
|
81
|
+
common: { ...LEGACY_ATTRIBUTE_MAP },
|
|
82
|
+
objects: {},
|
|
83
|
+
custom: {},
|
|
84
|
+
},
|
|
85
|
+
objects: {},
|
|
86
|
+
lists: {},
|
|
87
|
+
relationships: {},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
// Initialize with fallback configuration
|
|
91
|
+
initializeLookupCaches(cachedConfig);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return cachedConfig;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Invalidates the configuration cache, forcing a reload on next access
|
|
98
|
+
* This is useful for testing and when configuration files change
|
|
99
|
+
*/
|
|
100
|
+
export function invalidateConfigCache() {
|
|
101
|
+
cachedConfig = null;
|
|
102
|
+
// Reset all lookup caches
|
|
103
|
+
Object.keys(caseInsensitiveCaches).forEach((key) => {
|
|
104
|
+
delete caseInsensitiveCaches[key];
|
|
105
|
+
});
|
|
106
|
+
Object.keys(normalizedCaches).forEach((key) => {
|
|
107
|
+
delete normalizedCaches[key];
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Attempts snake case conversion and lookup for attribute mapping.
|
|
112
|
+
* This function safely converts snake_case attributes to Display Case format
|
|
113
|
+
* and looks them up in the mapping caches without causing infinite recursion.
|
|
114
|
+
*
|
|
115
|
+
* @param attributeName - The snake_case attribute name to convert and lookup
|
|
116
|
+
* @returns The mapped slug if found, or undefined if no mapping exists
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // For input "b2b_segment", converts to "B2b Segment" and looks up mapping
|
|
121
|
+
* const result = trySnakeCaseConversion("b2b_segment"); // Returns "type_persona"
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
function trySnakeCaseConversion(attributeName) {
|
|
125
|
+
// Guard conditions to prevent infinite recursion
|
|
126
|
+
// Skip if name already contains spaces or has no underscores to convert
|
|
127
|
+
if (attributeName.includes(' ') || !attributeName.includes('_')) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
// Convert snake_case to Display Case (e.g., "b2b_segment" -> "B2b Segment")
|
|
132
|
+
const potentialDisplayName = attributeName
|
|
133
|
+
.replace(/_/g, ' ')
|
|
134
|
+
.replace(/(\w)(\w*)/g, (_, first, rest) => first.toUpperCase() + rest);
|
|
135
|
+
// Additional safety check: if conversion results in same string, avoid lookup
|
|
136
|
+
if (potentialDisplayName === attributeName) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
// Use direct cache lookups to avoid recursive getAttributeSlug calls
|
|
140
|
+
// This prevents infinite recursion while maintaining mapping functionality
|
|
141
|
+
// Try special cases first (highest priority)
|
|
142
|
+
let result = handleSpecialCases(potentialDisplayName);
|
|
143
|
+
if (result)
|
|
144
|
+
return result;
|
|
145
|
+
// Try cache lookups in order of priority
|
|
146
|
+
if (caseInsensitiveCaches.common) {
|
|
147
|
+
result = lookupCaseInsensitive(caseInsensitiveCaches.common, potentialDisplayName);
|
|
148
|
+
if (result)
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
if (caseInsensitiveCaches.custom) {
|
|
152
|
+
result = lookupCaseInsensitive(caseInsensitiveCaches.custom, potentialDisplayName);
|
|
153
|
+
if (result)
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
if (caseInsensitiveCaches.legacy) {
|
|
157
|
+
result = lookupCaseInsensitive(caseInsensitiveCaches.legacy, potentialDisplayName);
|
|
158
|
+
if (result)
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
// Graceful error handling: log warning but don't throw
|
|
165
|
+
console.warn(`[attribute-mappers] Error in snake case conversion for "${attributeName}": ${err}`);
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Looks up a human-readable attribute name and returns the corresponding slug
|
|
171
|
+
*
|
|
172
|
+
* @param attributeName - The user-provided attribute name
|
|
173
|
+
* @param objectType - Optional object type for object-specific mappings
|
|
174
|
+
* @returns The slug if found, or the original attributeName if not mapped
|
|
175
|
+
*/
|
|
176
|
+
export function getAttributeSlug(attributeName, objectType) {
|
|
177
|
+
if (!attributeName)
|
|
178
|
+
return attributeName;
|
|
179
|
+
try {
|
|
180
|
+
// First check for special cases that commonly need to be handled
|
|
181
|
+
const specialCaseResult = handleSpecialCases(attributeName);
|
|
182
|
+
if (specialCaseResult) {
|
|
183
|
+
if (process.env.NODE_ENV === 'development') {
|
|
184
|
+
console.log(`[attribute-mappers] Special case match: "${attributeName}" -> "${specialCaseResult}"`);
|
|
185
|
+
}
|
|
186
|
+
return specialCaseResult;
|
|
187
|
+
}
|
|
188
|
+
// Make sure config is loaded (in case we haven't initialized caches yet)
|
|
189
|
+
const config = getConfig();
|
|
190
|
+
// Ensure at least the basic lookup caches exist (this can happen if called before initialization)
|
|
191
|
+
if (!caseInsensitiveCaches.common ||
|
|
192
|
+
!caseInsensitiveCaches.custom ||
|
|
193
|
+
!caseInsensitiveCaches.legacy) {
|
|
194
|
+
// Initialize lookup caches if missing
|
|
195
|
+
initializeLookupCaches(config);
|
|
196
|
+
}
|
|
197
|
+
// Create aggressive normalized caches if they don't exist
|
|
198
|
+
if (!normalizedCaches.aggressiveLegacy) {
|
|
199
|
+
normalizedCaches.aggressiveLegacy =
|
|
200
|
+
createAggressiveNormalizedMap(LEGACY_ATTRIBUTE_MAP);
|
|
201
|
+
}
|
|
202
|
+
let result;
|
|
203
|
+
// TIER 1: Check object-specific mappings if objectType is provided (exact matches)
|
|
204
|
+
if (objectType) {
|
|
205
|
+
const cacheKey = `objects.${objectType}`;
|
|
206
|
+
// Make sure this object-specific cache exists
|
|
207
|
+
if (!caseInsensitiveCaches[cacheKey] &&
|
|
208
|
+
config.mappings.attributes.objects[objectType]) {
|
|
209
|
+
caseInsensitiveCaches[cacheKey] = createCaseInsensitiveMap(config.mappings.attributes.objects[objectType]);
|
|
210
|
+
}
|
|
211
|
+
const objectSpecificCache = caseInsensitiveCaches[cacheKey];
|
|
212
|
+
if (objectSpecificCache) {
|
|
213
|
+
result = lookupCaseInsensitive(objectSpecificCache, attributeName);
|
|
214
|
+
if (result) {
|
|
215
|
+
if (process.env.NODE_ENV === 'development') {
|
|
216
|
+
console.log(`[attribute-mappers] Object-specific case-insensitive match for ${objectType}: "${attributeName}" -> "${result}"`);
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// TIER 2: Check custom and common mappings with case-insensitive lookup
|
|
223
|
+
result = lookupCaseInsensitive(caseInsensitiveCaches.custom, attributeName);
|
|
224
|
+
if (result) {
|
|
225
|
+
if (process.env.NODE_ENV === 'development') {
|
|
226
|
+
console.log(`[attribute-mappers] Custom case-insensitive match: "${attributeName}" -> "${result}"`);
|
|
227
|
+
}
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
result = lookupCaseInsensitive(caseInsensitiveCaches.common, attributeName);
|
|
231
|
+
if (result) {
|
|
232
|
+
if (process.env.NODE_ENV === 'development') {
|
|
233
|
+
console.log(`[attribute-mappers] Common case-insensitive match: "${attributeName}" -> "${result}"`);
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
// TIER 3: Legacy mapping with case-insensitive lookup
|
|
238
|
+
result = lookupCaseInsensitive(caseInsensitiveCaches.legacy, attributeName);
|
|
239
|
+
if (result) {
|
|
240
|
+
if (process.env.NODE_ENV === 'development') {
|
|
241
|
+
console.log(`[attribute-mappers] Legacy case-insensitive match: "${attributeName}" -> "${result}"`);
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
// TIER 4: Try normalized lookup (removes spaces, case-insensitive)
|
|
246
|
+
// Create normalized caches for object-specific mappings if they don't exist
|
|
247
|
+
if (objectType) {
|
|
248
|
+
const normalizedCacheKey = `normalized.objects.${objectType}`;
|
|
249
|
+
if (!normalizedCaches[normalizedCacheKey] &&
|
|
250
|
+
config.mappings.attributes.objects[objectType]) {
|
|
251
|
+
normalizedCaches[normalizedCacheKey] = createNormalizedMap(config.mappings.attributes.objects[objectType]);
|
|
252
|
+
}
|
|
253
|
+
const normalizedObjectSpecificCache = normalizedCaches[normalizedCacheKey];
|
|
254
|
+
if (normalizedObjectSpecificCache) {
|
|
255
|
+
result = lookupNormalized(normalizedObjectSpecificCache, attributeName);
|
|
256
|
+
if (result) {
|
|
257
|
+
if (process.env.NODE_ENV === 'development') {
|
|
258
|
+
console.log(`[attribute-mappers] Object-specific normalized match for ${objectType}: "${attributeName}" -> "${result}"`);
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// Check common and custom normalized caches
|
|
265
|
+
if (!normalizedCaches.common) {
|
|
266
|
+
normalizedCaches.common = createNormalizedMap(config.mappings.attributes.common);
|
|
267
|
+
}
|
|
268
|
+
if (!normalizedCaches.custom) {
|
|
269
|
+
normalizedCaches.custom = createNormalizedMap(config.mappings.attributes.custom);
|
|
270
|
+
}
|
|
271
|
+
result = lookupNormalized(normalizedCaches.custom, attributeName);
|
|
272
|
+
if (result) {
|
|
273
|
+
if (process.env.NODE_ENV === 'development') {
|
|
274
|
+
console.log(`[attribute-mappers] Custom normalized match: "${attributeName}" -> "${result}"`);
|
|
275
|
+
}
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
result = lookupNormalized(normalizedCaches.common, attributeName);
|
|
279
|
+
if (result) {
|
|
280
|
+
if (process.env.NODE_ENV === 'development') {
|
|
281
|
+
console.log(`[attribute-mappers] Common normalized match: "${attributeName}" -> "${result}"`);
|
|
282
|
+
}
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
// Check legacy normalized
|
|
286
|
+
if (!normalizedCaches.legacy) {
|
|
287
|
+
normalizedCaches.legacy = createNormalizedMap(LEGACY_ATTRIBUTE_MAP);
|
|
288
|
+
}
|
|
289
|
+
result = lookupNormalized(normalizedCaches.legacy, attributeName);
|
|
290
|
+
if (result) {
|
|
291
|
+
if (process.env.NODE_ENV === 'development') {
|
|
292
|
+
console.log(`[attribute-mappers] Legacy normalized match: "${attributeName}" -> "${result}"`);
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
// TIER 5: Aggressive normalization (removes all non-alphanumeric characters)
|
|
297
|
+
result = lookupAggressiveNormalized(normalizedCaches.aggressiveLegacy, attributeName);
|
|
298
|
+
if (result) {
|
|
299
|
+
if (process.env.NODE_ENV === 'development') {
|
|
300
|
+
console.log(`[attribute-mappers] Aggressive normalized match: "${attributeName}" -> "${result}"`);
|
|
301
|
+
}
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
// TIER 6: Snake case conversion fallback (last resort)
|
|
305
|
+
result = trySnakeCaseConversion(attributeName);
|
|
306
|
+
if (result && result !== attributeName) {
|
|
307
|
+
if (process.env.NODE_ENV === 'development') {
|
|
308
|
+
console.log(`[attribute-mappers] Snake case conversion match: "${attributeName}" -> "${result}"`);
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
// If there's an error with the config, log detailed error and suggestions
|
|
315
|
+
const errorMsg = error instanceof AttributeMappingError
|
|
316
|
+
? `${error.message} - ${JSON.stringify(error.details)}`
|
|
317
|
+
: `Error using config for attribute mapping: ${error}`;
|
|
318
|
+
console.error(errorMsg);
|
|
319
|
+
console.warn('Falling back to legacy behavior. Check your configuration files for errors.');
|
|
320
|
+
// Try special cases as a last resort, even if there was an error earlier
|
|
321
|
+
const specialCaseResult = handleSpecialCases(attributeName);
|
|
322
|
+
if (specialCaseResult) {
|
|
323
|
+
console.log(`[attribute-mappers] Special case match after error: "${attributeName}" -> "${specialCaseResult}"`);
|
|
324
|
+
return specialCaseResult;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// Log that no match was found for easier debugging
|
|
328
|
+
if (process.env.NODE_ENV === 'development') {
|
|
329
|
+
console.warn(`[attribute-mappers] No mapping found for attribute: "${attributeName}"`);
|
|
330
|
+
}
|
|
331
|
+
// If no match found, return the original
|
|
332
|
+
return attributeName;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Gets the slug for an object type (e.g., "Companies" -> "companies")
|
|
336
|
+
*
|
|
337
|
+
* @param objectName - The human-readable object name
|
|
338
|
+
* @returns The corresponding slug, or a normalized version of the original name if not found
|
|
339
|
+
*/
|
|
340
|
+
export function getObjectSlug(objectName) {
|
|
341
|
+
if (!objectName)
|
|
342
|
+
return objectName;
|
|
343
|
+
try {
|
|
344
|
+
// Make sure config is loaded (in case we haven't initialized caches yet)
|
|
345
|
+
const config = getConfig();
|
|
346
|
+
// Ensure the lookup caches exist (this can happen if called before initialization)
|
|
347
|
+
if (!caseInsensitiveCaches.objects) {
|
|
348
|
+
// Initialize lookup caches if missing
|
|
349
|
+
initializeLookupCaches(config);
|
|
350
|
+
}
|
|
351
|
+
// Use case-insensitive lookup
|
|
352
|
+
const result = lookupCaseInsensitive(caseInsensitiveCaches.objects, objectName);
|
|
353
|
+
if (result)
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
// If there's an error with the config, fall back to simple normalization
|
|
358
|
+
console.error('Error using config for object mapping:', error);
|
|
359
|
+
console.warn('Check your configuration files for errors in the objects section.');
|
|
360
|
+
}
|
|
361
|
+
// If no match is found, convert to lowercase and remove spaces as a fallback
|
|
362
|
+
return objectName.toLowerCase().replace(/\s+/g, '_');
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Gets the slug for a list name
|
|
366
|
+
*
|
|
367
|
+
* @param listName - The human-readable list name
|
|
368
|
+
* @returns The corresponding slug, or the original name if not found
|
|
369
|
+
*/
|
|
370
|
+
export function getListSlug(listName) {
|
|
371
|
+
if (!listName)
|
|
372
|
+
return listName;
|
|
373
|
+
try {
|
|
374
|
+
// Make sure config is loaded (in case we haven't initialized caches yet)
|
|
375
|
+
const config = getConfig();
|
|
376
|
+
// Ensure the lookup caches exist (this can happen if called before initialization)
|
|
377
|
+
if (!caseInsensitiveCaches.lists) {
|
|
378
|
+
// Initialize lookup caches if missing
|
|
379
|
+
initializeLookupCaches(config);
|
|
380
|
+
}
|
|
381
|
+
// Use case-insensitive lookup
|
|
382
|
+
const result = lookupCaseInsensitive(caseInsensitiveCaches.lists, listName);
|
|
383
|
+
if (result)
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
// If there's an error with the config, fall back to simple normalization
|
|
388
|
+
console.error('Error using config for list mapping:', error);
|
|
389
|
+
console.warn('Check your configuration files for errors in the lists section.');
|
|
390
|
+
}
|
|
391
|
+
// If no match is found, return the original
|
|
392
|
+
return listName;
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=attribute-mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-mappers.js","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/attribute-mappers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAiB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QAChE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,OAAO,KAAK,CAAC;IACnE,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CA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;YACjC,sCAAsC;YACtC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,8BAA8B;QAC9B,MAAM,MAAM,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC5E,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,yEAAyE;QACzE,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CACV,iEAAiE,CAClE,CAAC;IACJ,CAAC;IAED,4CAA4C;IAC5C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processes a filter structure to translate any human-readable attribute names to their slug equivalents
|
|
3
|
+
*
|
|
4
|
+
* @param filters - The filters object possibly containing human-readable attribute names
|
|
5
|
+
* @param objectType - Optional object type for more specific attribute mapping
|
|
6
|
+
* @returns A new filters object with attribute names translated to slugs where applicable
|
|
7
|
+
*/
|
|
8
|
+
export declare function translateAttributeNamesInFilters(filters: any, objectType?: string): any;
|
|
9
|
+
//# sourceMappingURL=filter-translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-translator.d.ts","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/filter-translator.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,GAAG,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,GAAG,CA+BL"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter translation functionality for converting attribute names in filters
|
|
3
|
+
*/
|
|
4
|
+
import { getAttributeSlug } from './attribute-mappers.js';
|
|
5
|
+
/**
|
|
6
|
+
* Processes a filter structure to translate any human-readable attribute names to their slug equivalents
|
|
7
|
+
*
|
|
8
|
+
* @param filters - The filters object possibly containing human-readable attribute names
|
|
9
|
+
* @param objectType - Optional object type for more specific attribute mapping
|
|
10
|
+
* @returns A new filters object with attribute names translated to slugs where applicable
|
|
11
|
+
*/
|
|
12
|
+
export function translateAttributeNamesInFilters(filters, objectType) {
|
|
13
|
+
// Handle null, undefined, or non-object filters
|
|
14
|
+
if (!filters || typeof filters !== 'object') {
|
|
15
|
+
return filters;
|
|
16
|
+
}
|
|
17
|
+
// Handle array of filters
|
|
18
|
+
if (Array.isArray(filters)) {
|
|
19
|
+
return filters.map((filter) => translateAttributeNamesInFilters(filter, objectType));
|
|
20
|
+
}
|
|
21
|
+
// Deep clone the filters object to avoid modifying the original
|
|
22
|
+
const translatedFilters = { ...filters };
|
|
23
|
+
// Handle direct filter objects with attribute.slug
|
|
24
|
+
if (isDirectFilterObject(translatedFilters)) {
|
|
25
|
+
return translateDirectFilter(translatedFilters, objectType);
|
|
26
|
+
}
|
|
27
|
+
// Handle nested filter structures
|
|
28
|
+
if (hasNestedFilters(translatedFilters)) {
|
|
29
|
+
translatedFilters.filters = translateNestedFilters(translatedFilters.filters, objectType);
|
|
30
|
+
}
|
|
31
|
+
// Process all other properties recursively
|
|
32
|
+
return translateRemainingProperties(translatedFilters, objectType);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Checks if an object is a direct filter with attribute.slug
|
|
36
|
+
*/
|
|
37
|
+
function isDirectFilterObject(filter) {
|
|
38
|
+
return filter.attribute && filter.attribute.slug;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Translates a direct filter object
|
|
42
|
+
*/
|
|
43
|
+
function translateDirectFilter(filter, objectType) {
|
|
44
|
+
// Determine the object type to use for translation
|
|
45
|
+
// Priority: filter's own objectType > parent objectType
|
|
46
|
+
const typeToUse = filter.objectType || objectType;
|
|
47
|
+
// Create a new object with translated slug
|
|
48
|
+
return {
|
|
49
|
+
...filter,
|
|
50
|
+
attribute: {
|
|
51
|
+
...filter.attribute,
|
|
52
|
+
slug: getAttributeSlug(filter.attribute.slug, typeToUse),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks if an object has nested filters
|
|
58
|
+
*/
|
|
59
|
+
function hasNestedFilters(filter) {
|
|
60
|
+
return filter.filters && Array.isArray(filter.filters);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Translates nested filters
|
|
64
|
+
*/
|
|
65
|
+
function translateNestedFilters(filters, objectType) {
|
|
66
|
+
return filters.map((filter) => {
|
|
67
|
+
if (isDirectFilterObject(filter)) {
|
|
68
|
+
// Determine the object type to use for this specific filter
|
|
69
|
+
const typeToUse = filter.objectType || objectType;
|
|
70
|
+
// Translate the attribute slug if it's a human-readable name
|
|
71
|
+
return translateDirectFilter(filter, typeToUse);
|
|
72
|
+
}
|
|
73
|
+
return translateAttributeNamesInFilters(filter, objectType);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Translates remaining properties in the filter object
|
|
78
|
+
*/
|
|
79
|
+
function translateRemainingProperties(filter, objectType) {
|
|
80
|
+
for (const key of Object.keys(filter)) {
|
|
81
|
+
if (typeof filter[key] === 'object' && filter[key] !== null) {
|
|
82
|
+
// Special handling for object-specific sections
|
|
83
|
+
const typeToUse = determineObjectTypeContext(key, filter, objectType);
|
|
84
|
+
filter[key] = translateAttributeNamesInFilters(filter[key], typeToUse);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return filter;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Determines the object type context for a property
|
|
91
|
+
*/
|
|
92
|
+
function determineObjectTypeContext(key, filter, parentObjectType) {
|
|
93
|
+
// If this key is an object type (companies, people), use it as the type context
|
|
94
|
+
if (key === 'companies' || key === 'people') {
|
|
95
|
+
return key;
|
|
96
|
+
}
|
|
97
|
+
// If this is a resource-specific section with explicit object type, use that
|
|
98
|
+
if (filter.objectType) {
|
|
99
|
+
return filter.objectType;
|
|
100
|
+
}
|
|
101
|
+
// Otherwise use the parent context
|
|
102
|
+
return parentObjectType;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=filter-translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-translator.js","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/filter-translator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAC9C,OAAY,EACZ,UAAmB;IAEnB,gDAAgD;IAChD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0BAA0B;IAC1B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC5B,gCAAgC,CAAC,MAAM,EAAE,UAAU,CAAC,CACrD,CAAC;IACJ,CAAC;IAED,gEAAgE;IAChE,MAAM,iBAAiB,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IAEzC,mDAAmD;IACnD,IAAI,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC5C,OAAO,qBAAqB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC;IAED,kCAAkC;IAClC,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACxC,iBAAiB,CAAC,OAAO,GAAG,sBAAsB,CAChD,iBAAiB,CAAC,OAAO,EACzB,UAAU,CACX,CAAC;IACJ,CAAC;IAED,2CAA2C;IAC3C,OAAO,4BAA4B,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB,CAAC,MAAW;IACv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AC;YAC5D,gDAAgD;YAChD,MAAM,SAAS,GAAG,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YAEtE,MAAM,CAAC,GAAG,CAAC,GAAG,gCAAgC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CACjC,GAAW,EACX,MAAW,EACX,gBAAyB;IAEzB,gFAAgF;IAChF,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,6EAA6E;IAC7E,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,mCAAmC;IACnC,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for attribute mapping system
|
|
3
|
+
* Re-exports all attribute mapping functionality
|
|
4
|
+
*/
|
|
5
|
+
export * from './attribute-mappers.js';
|
|
6
|
+
export * from './legacy-maps.js';
|
|
7
|
+
export * from './filter-translator.js';
|
|
8
|
+
export { getAttributeSlug, getObjectSlug, getListSlug, } from './attribute-mappers.js';
|
|
9
|
+
export { translateAttributeNamesInFilters } from './filter-translator.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AAIvC,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for attribute mapping system
|
|
3
|
+
* Re-exports all attribute mapping functionality
|
|
4
|
+
*/
|
|
5
|
+
export * from './attribute-mappers.js';
|
|
6
|
+
export * from './legacy-maps.js';
|
|
7
|
+
export * from './filter-translator.js';
|
|
8
|
+
// For backward compatibility - reexport specific functions
|
|
9
|
+
// from their respective modules for simpler imports
|
|
10
|
+
export { getAttributeSlug, getObjectSlug, getListSlug, } from './attribute-mappers.js';
|
|
11
|
+
export { translateAttributeNamesInFilters } from './filter-translator.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AAEvC,2DAA2D;AAC3D,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy mapping data for backward compatibility
|
|
3
|
+
* This is kept in a separate file for better code organization
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Legacy mapping for backward compatibility
|
|
7
|
+
* This is kept for reference and to ensure backward compatibility
|
|
8
|
+
*/
|
|
9
|
+
export declare const LEGACY_ATTRIBUTE_MAP: Record<string, string>;
|
|
10
|
+
export declare const COMMON_ATTRIBUTE_MAP: Record<string, string>;
|
|
11
|
+
//# sourceMappingURL=legacy-maps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-maps.d.ts","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/legacy-maps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4CvD,CAAC;AAGF,eAAO,MAAM,oBAAoB,wBAAuB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy mapping data for backward compatibility
|
|
3
|
+
* This is kept in a separate file for better code organization
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Legacy mapping for backward compatibility
|
|
7
|
+
* This is kept for reference and to ensure backward compatibility
|
|
8
|
+
*/
|
|
9
|
+
export const LEGACY_ATTRIBUTE_MAP = {
|
|
10
|
+
// Company attributes
|
|
11
|
+
Name: 'name',
|
|
12
|
+
Website: 'website',
|
|
13
|
+
Industry: 'industry',
|
|
14
|
+
Revenue: 'annual_revenue',
|
|
15
|
+
'Annual Revenue': 'annual_revenue',
|
|
16
|
+
'Employee Count': 'employee_count',
|
|
17
|
+
Employees: 'employee_count',
|
|
18
|
+
'Company Name': 'name',
|
|
19
|
+
'Company Website': 'website',
|
|
20
|
+
'B2B Segment': 'type_persona',
|
|
21
|
+
'Type Persona': 'type_persona',
|
|
22
|
+
'Created At': 'created_at',
|
|
23
|
+
'Updated At': 'updated_at',
|
|
24
|
+
'Last Interaction': 'last_interaction',
|
|
25
|
+
'Interaction Type': 'interaction_type',
|
|
26
|
+
'Company Type': 'company_type',
|
|
27
|
+
Notes: 'notes',
|
|
28
|
+
Address: 'address',
|
|
29
|
+
City: 'city',
|
|
30
|
+
State: 'state',
|
|
31
|
+
Country: 'country',
|
|
32
|
+
ZIP: 'postal_code',
|
|
33
|
+
'Postal Code': 'postal_code',
|
|
34
|
+
// People attributes
|
|
35
|
+
'First Name': 'first_name',
|
|
36
|
+
'Last Name': 'last_name',
|
|
37
|
+
'Full Name': 'name',
|
|
38
|
+
Email: 'email',
|
|
39
|
+
Phone: 'phone',
|
|
40
|
+
Mobile: 'mobile',
|
|
41
|
+
Title: 'title',
|
|
42
|
+
'Job Title': 'title',
|
|
43
|
+
Position: 'title',
|
|
44
|
+
Department: 'department',
|
|
45
|
+
Company: 'company',
|
|
46
|
+
// General attributes (date-based)
|
|
47
|
+
Created: 'created_at',
|
|
48
|
+
Modified: 'updated_at',
|
|
49
|
+
Updated: 'updated_at',
|
|
50
|
+
'Last Activity': 'last_interaction',
|
|
51
|
+
};
|
|
52
|
+
// For backward compatibility
|
|
53
|
+
export const COMMON_ATTRIBUTE_MAP = LEGACY_ATTRIBUTE_MAP;
|
|
54
|
+
//# sourceMappingURL=legacy-maps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-maps.js","sourceRoot":"","sources":["../../../src/utils/attribute-mapping/legacy-maps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA2B;IAC1D,qBAAqB;IACrB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,gBAAgB;IACzB,gBAAgB,EAAE,gBAAgB;IAClC,gBAAgB,EAAE,gBAAgB;IAClC,SAAS,EAAE,gBAAgB;IAC3B,cAAc,EAAE,MAAM;IACtB,iBAAiB,EAAE,SAAS;IAC5B,aAAa,EAAE,cAAc;IAC7B,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,kBAAkB,EAAE,kBAAkB;IACtC,kBAAkB,EAAE,kBAAkB;IACtC,cAAc,EAAE,cAAc;IAC9B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,aAAa;IAClB,aAAa,EAA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