attio-mcp 1.0.0 → 1.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 +102 -3
- package/README.md +77 -1
- package/dist/api/attio-client.d.ts +25 -5
- package/dist/api/attio-client.d.ts.map +1 -1
- package/dist/api/attio-client.js +119 -125
- package/dist/api/attio-client.js.map +1 -1
- package/dist/api/client-cache.d.ts +43 -0
- package/dist/api/client-cache.d.ts.map +1 -0
- package/dist/api/client-cache.js +71 -0
- package/dist/api/client-cache.js.map +1 -0
- package/dist/api/client-config.d.ts +53 -0
- package/dist/api/client-config.d.ts.map +1 -0
- package/dist/api/client-config.js +101 -0
- package/dist/api/client-config.js.map +1 -0
- package/dist/api/client-context.js +1 -1
- package/dist/api/client-context.js.map +1 -1
- package/dist/api/client-strategies.d.ts +76 -0
- package/dist/api/client-strategies.d.ts.map +1 -0
- package/dist/api/client-strategies.js +218 -0
- package/dist/api/client-strategies.js.map +1 -0
- package/dist/api/lazy-client.d.ts +4 -3
- package/dist/api/lazy-client.d.ts.map +1 -1
- package/dist/api/lazy-client.js +20 -8
- package/dist/api/lazy-client.js.map +1 -1
- package/dist/api/operations/notes.d.ts +3 -2
- package/dist/api/operations/notes.d.ts.map +1 -1
- package/dist/api/operations/notes.js +4 -3
- package/dist/api/operations/notes.js.map +1 -1
- package/dist/api/operations/query-parser.d.ts +27 -0
- package/dist/api/operations/query-parser.d.ts.map +1 -0
- package/dist/api/operations/query-parser.js +123 -0
- package/dist/api/operations/query-parser.js.map +1 -0
- package/dist/api/operations/search.d.ts +2 -2
- package/dist/api/operations/search.d.ts.map +1 -1
- package/dist/api/operations/search.js +77 -22
- package/dist/api/operations/search.js.map +1 -1
- package/dist/api/operations/tasks.js +9 -15
- package/dist/api/operations/tasks.js.map +1 -1
- package/dist/api/operations/workspace-members.js +9 -15
- package/dist/api/operations/workspace-members.js.map +1 -1
- package/dist/cli.js +7 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/tool-aliases.d.ts +21 -0
- package/dist/config/tool-aliases.d.ts.map +1 -0
- package/dist/config/tool-aliases.js +98 -0
- package/dist/config/tool-aliases.js.map +1 -0
- package/dist/config/tool-mode.d.ts.map +1 -1
- package/dist/config/tool-mode.js +1 -6
- package/dist/config/tool-mode.js.map +1 -1
- package/dist/errors/enhanced-api-errors.d.ts +21 -7
- package/dist/errors/enhanced-api-errors.d.ts.map +1 -1
- package/dist/errors/enhanced-api-errors.js +18 -1
- package/dist/errors/enhanced-api-errors.js.map +1 -1
- package/dist/handlers/tool-configs/lists.d.ts +48 -0
- package/dist/handlers/tool-configs/lists.d.ts.map +1 -1
- package/dist/handlers/tool-configs/lists.js +126 -22
- package/dist/handlers/tool-configs/lists.js.map +1 -1
- package/dist/handlers/tool-configs/openai/index.d.ts +1 -1
- package/dist/handlers/tool-configs/openai/index.d.ts.map +1 -1
- package/dist/handlers/tool-configs/openai/index.js +1 -1
- package/dist/handlers/tool-configs/openai/index.js.map +1 -1
- package/dist/handlers/tool-configs/people/crud.d.ts +5 -0
- package/dist/handlers/tool-configs/people/crud.d.ts.map +1 -1
- package/dist/handlers/tool-configs/people/crud.js +7 -2
- package/dist/handlers/tool-configs/people/crud.js.map +1 -1
- package/dist/handlers/tool-configs/people/index.d.ts +5 -0
- package/dist/handlers/tool-configs/people/index.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/batch-search.d.ts +10 -0
- package/dist/handlers/tool-configs/universal/batch-search.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/batch-search.js +18 -5
- package/dist/handlers/tool-configs/universal/batch-search.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/crud-error-handlers.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/crud-error-handlers.js +39 -1
- package/dist/handlers/tool-configs/universal/core/crud-error-handlers.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/crud-operations.d.ts +22 -0
- package/dist/handlers/tool-configs/universal/core/crud-operations.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/detailed-info-operations.d.ts +4 -0
- package/dist/handlers/tool-configs/universal/core/detailed-info-operations.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/detailed-info-operations.js +10 -4
- package/dist/handlers/tool-configs/universal/core/detailed-info-operations.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/index.d.ts +61 -11
- package/dist/handlers/tool-configs/universal/core/index.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/index.js +10 -10
- package/dist/handlers/tool-configs/universal/core/index.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/metadata-operations.d.ts +8 -0
- package/dist/handlers/tool-configs/universal/core/metadata-operations.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/metadata-operations.js +19 -8
- package/dist/handlers/tool-configs/universal/core/metadata-operations.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/notes-operations.d.ts +10 -4
- package/dist/handlers/tool-configs/universal/core/notes-operations.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/notes-operations.js +69 -51
- package/dist/handlers/tool-configs/universal/core/notes-operations.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/record-details-operations.d.ts +5 -0
- package/dist/handlers/tool-configs/universal/core/record-details-operations.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/record-details-operations.js +10 -4
- package/dist/handlers/tool-configs/universal/core/record-details-operations.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/search-operations.d.ts +5 -0
- package/dist/handlers/tool-configs/universal/core/search-operations.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/core/search-operations.js +10 -4
- package/dist/handlers/tool-configs/universal/core/search-operations.js.map +1 -1
- package/dist/handlers/tool-configs/universal/core/utils/note-formatters.d.ts +14 -0
- package/dist/handlers/tool-configs/universal/core/utils/note-formatters.d.ts.map +1 -0
- package/dist/handlers/tool-configs/universal/core/utils/note-formatters.js +92 -0
- package/dist/handlers/tool-configs/universal/core/utils/note-formatters.js.map +1 -0
- package/dist/handlers/tool-configs/universal/index.d.ts +118 -98
- package/dist/handlers/tool-configs/universal/index.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/index.js +43 -73
- package/dist/handlers/tool-configs/universal/index.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/advanced-search.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/advanced-search.js +3 -3
- package/dist/handlers/tool-configs/universal/operations/advanced-search.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/batch-operations.js +3 -3
- package/dist/handlers/tool-configs/universal/operations/batch-operations.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/content-search.js +3 -3
- package/dist/handlers/tool-configs/universal/operations/content-search.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/index.d.ts +49 -10
- package/dist/handlers/tool-configs/universal/operations/index.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/index.js +47 -20
- package/dist/handlers/tool-configs/universal/operations/index.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/operations-array.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/operations-array.js +3 -1
- package/dist/handlers/tool-configs/universal/operations/operations-array.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/relationship-search.js +4 -4
- package/dist/handlers/tool-configs/universal/operations/relationship-search.js.map +1 -1
- package/dist/handlers/tool-configs/universal/operations/timeframe-search.js +3 -3
- package/dist/handlers/tool-configs/universal/operations/timeframe-search.js.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/advanced-schemas.d.ts +43 -0
- package/dist/handlers/tool-configs/universal/schemas/advanced-schemas.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/advanced-schemas.js +55 -0
- package/dist/handlers/tool-configs/universal/schemas/advanced-schemas.js.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/core-schemas.d.ts +32 -0
- package/dist/handlers/tool-configs/universal/schemas/core-schemas.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/core-schemas.js +40 -0
- package/dist/handlers/tool-configs/universal/schemas/core-schemas.js.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/utility-schemas.d.ts +8 -2
- package/dist/handlers/tool-configs/universal/schemas/utility-schemas.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/utility-schemas.js +9 -2
- package/dist/handlers/tool-configs/universal/schemas/utility-schemas.js.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/validation-schemas.d.ts +8 -0
- package/dist/handlers/tool-configs/universal/schemas/validation-schemas.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/schemas/validation-schemas.js +12 -0
- package/dist/handlers/tool-configs/universal/schemas/validation-schemas.js.map +1 -1
- package/dist/handlers/tool-configs/universal/validators/schema-validator.d.ts.map +1 -1
- package/dist/handlers/tool-configs/universal/validators/schema-validator.js +38 -3
- package/dist/handlers/tool-configs/universal/validators/schema-validator.js.map +1 -1
- package/dist/handlers/tool-configs/workspace-members.d.ts +25 -0
- package/dist/handlers/tool-configs/workspace-members.d.ts.map +1 -1
- package/dist/handlers/tool-configs/workspace-members.js +73 -40
- package/dist/handlers/tool-configs/workspace-members.js.map +1 -1
- package/dist/handlers/tools/dispatcher/core.d.ts.map +1 -1
- package/dist/handlers/tools/dispatcher/core.js +24 -31
- package/dist/handlers/tools/dispatcher/core.js.map +1 -1
- package/dist/handlers/tools/dispatcher/logging.d.ts +2 -10
- package/dist/handlers/tools/dispatcher/logging.d.ts.map +1 -1
- package/dist/handlers/tools/dispatcher/logging.js +3 -2
- package/dist/handlers/tools/dispatcher/logging.js.map +1 -1
- package/dist/handlers/tools/index.d.ts.map +1 -1
- package/dist/handlers/tools/index.js +35 -39
- package/dist/handlers/tools/index.js.map +1 -1
- package/dist/handlers/tools/registry.d.ts +269 -57
- package/dist/handlers/tools/registry.d.ts.map +1 -1
- package/dist/handlers/tools/registry.js +21 -13
- package/dist/handlers/tools/registry.js.map +1 -1
- package/dist/handlers/tools/standards/index.d.ts +17 -0
- package/dist/handlers/tools/standards/index.d.ts.map +1 -0
- package/dist/handlers/tools/standards/index.js +32 -0
- package/dist/handlers/tools/standards/index.js.map +1 -0
- package/dist/middleware/performance-enhanced.d.ts +4 -0
- package/dist/middleware/performance-enhanced.d.ts.map +1 -1
- package/dist/middleware/performance-enhanced.js +63 -3
- package/dist/middleware/performance-enhanced.js.map +1 -1
- package/dist/objects/batch-companies.d.ts.map +1 -1
- package/dist/objects/batch-companies.js +6 -2
- package/dist/objects/batch-companies.js.map +1 -1
- package/dist/objects/companies/search.d.ts.map +1 -1
- package/dist/objects/companies/search.js +6 -1
- package/dist/objects/companies/search.js.map +1 -1
- package/dist/objects/notes.d.ts.map +1 -1
- package/dist/objects/notes.js +21 -7
- package/dist/objects/notes.js.map +1 -1
- package/dist/prompts/error-handler.d.ts +8 -2
- package/dist/prompts/error-handler.d.ts.map +1 -1
- package/dist/prompts/error-handler.js +63 -4
- package/dist/prompts/error-handler.js.map +1 -1
- package/dist/prompts/handlers.d.ts +4 -1
- package/dist/prompts/handlers.d.ts.map +1 -1
- package/dist/prompts/handlers.js +146 -48
- package/dist/prompts/handlers.js.map +1 -1
- package/dist/prompts/v1/add-to-list.v1.d.ts +38 -0
- package/dist/prompts/v1/add-to-list.v1.d.ts.map +1 -0
- package/dist/prompts/v1/add-to-list.v1.js +91 -0
- package/dist/prompts/v1/add-to-list.v1.js.map +1 -0
- package/dist/prompts/v1/advance-deal.v1.d.ts +41 -0
- package/dist/prompts/v1/advance-deal.v1.d.ts.map +1 -0
- package/dist/prompts/v1/advance-deal.v1.js +100 -0
- package/dist/prompts/v1/advance-deal.v1.js.map +1 -0
- package/dist/prompts/v1/company-search.v1.d.ts +44 -0
- package/dist/prompts/v1/company-search.v1.d.ts.map +1 -0
- package/dist/prompts/v1/company-search.v1.js +114 -0
- package/dist/prompts/v1/company-search.v1.js.map +1 -0
- package/dist/prompts/v1/constants.d.ts +112 -0
- package/dist/prompts/v1/constants.d.ts.map +1 -0
- package/dist/prompts/v1/constants.js +119 -0
- package/dist/prompts/v1/constants.js.map +1 -0
- package/dist/prompts/v1/create-task.v1.d.ts +50 -0
- package/dist/prompts/v1/create-task.v1.d.ts.map +1 -0
- package/dist/prompts/v1/create-task.v1.js +136 -0
- package/dist/prompts/v1/create-task.v1.js.map +1 -0
- package/dist/prompts/v1/deal-search.v1.d.ts +44 -0
- package/dist/prompts/v1/deal-search.v1.d.ts.map +1 -0
- package/dist/prompts/v1/deal-search.v1.js +114 -0
- package/dist/prompts/v1/deal-search.v1.js.map +1 -0
- package/dist/prompts/v1/index.d.ts +56 -0
- package/dist/prompts/v1/index.d.ts.map +1 -0
- package/dist/prompts/v1/index.js +81 -0
- package/dist/prompts/v1/index.js.map +1 -0
- package/dist/prompts/v1/log-activity.v1.d.ts +48 -0
- package/dist/prompts/v1/log-activity.v1.d.ts.map +1 -0
- package/dist/prompts/v1/log-activity.v1.js +124 -0
- package/dist/prompts/v1/log-activity.v1.js.map +1 -0
- package/dist/prompts/v1/meeting-prep.v1.d.ts +42 -0
- package/dist/prompts/v1/meeting-prep.v1.d.ts.map +1 -0
- package/dist/prompts/v1/meeting-prep.v1.js +105 -0
- package/dist/prompts/v1/meeting-prep.v1.js.map +1 -0
- package/dist/prompts/v1/people-search.v1.d.ts +45 -0
- package/dist/prompts/v1/people-search.v1.d.ts.map +1 -0
- package/dist/prompts/v1/people-search.v1.js +115 -0
- package/dist/prompts/v1/people-search.v1.js.map +1 -0
- package/dist/prompts/v1/pipeline-health.v1.d.ts +48 -0
- package/dist/prompts/v1/pipeline-health.v1.d.ts.map +1 -0
- package/dist/prompts/v1/pipeline-health.v1.js +131 -0
- package/dist/prompts/v1/pipeline-health.v1.js.map +1 -0
- package/dist/prompts/v1/qualify-lead.v1.d.ts +51 -0
- package/dist/prompts/v1/qualify-lead.v1.d.ts.map +1 -0
- package/dist/prompts/v1/qualify-lead.v1.js +157 -0
- package/dist/prompts/v1/qualify-lead.v1.js.map +1 -0
- package/dist/prompts/v1/types.d.ts +134 -0
- package/dist/prompts/v1/types.d.ts.map +1 -0
- package/dist/prompts/v1/types.js +36 -0
- package/dist/prompts/v1/types.js.map +1 -0
- package/dist/prompts/v1/utils/telemetry.d.ts +64 -0
- package/dist/prompts/v1/utils/telemetry.d.ts.map +1 -0
- package/dist/prompts/v1/utils/telemetry.js +88 -0
- package/dist/prompts/v1/utils/telemetry.js.map +1 -0
- package/dist/prompts/v1/utils/token-metadata.d.ts +43 -0
- package/dist/prompts/v1/utils/token-metadata.d.ts.map +1 -0
- package/dist/prompts/v1/utils/token-metadata.js +90 -0
- package/dist/prompts/v1/utils/token-metadata.js.map +1 -0
- package/dist/prompts/v1/utils/validation.d.ts +69 -0
- package/dist/prompts/v1/utils/validation.d.ts.map +1 -0
- package/dist/prompts/v1/utils/validation.js +140 -0
- package/dist/prompts/v1/utils/validation.js.map +1 -0
- package/dist/server/createServer.d.ts +2 -2
- package/dist/server/createServer.d.ts.map +1 -1
- package/dist/server/createServer.js +2 -2
- package/dist/server/createServer.js.map +1 -1
- package/dist/services/ErrorService.d.ts +27 -0
- package/dist/services/ErrorService.d.ts.map +1 -1
- package/dist/services/ErrorService.js +92 -1
- package/dist/services/ErrorService.js.map +1 -1
- package/dist/services/UniversalUpdateService.d.ts.map +1 -1
- package/dist/services/UniversalUpdateService.js +32 -2
- package/dist/services/UniversalUpdateService.js.map +1 -1
- package/dist/services/create/data-normalizers.d.ts.map +1 -1
- package/dist/services/create/data-normalizers.js +18 -1
- package/dist/services/create/data-normalizers.js.map +1 -1
- package/dist/services/metadata/MetadataDiscoveryService.d.ts +4 -2
- package/dist/services/metadata/MetadataDiscoveryService.d.ts.map +1 -1
- package/dist/services/metadata/MetadataDiscoveryService.js +69 -157
- package/dist/services/metadata/MetadataDiscoveryService.js.map +1 -1
- package/dist/services/metadata/discovery-runner.d.ts +25 -0
- package/dist/services/metadata/discovery-runner.d.ts.map +1 -0
- package/dist/services/metadata/discovery-runner.js +66 -0
- package/dist/services/metadata/discovery-runner.js.map +1 -0
- package/dist/services/metadata/task-metadata.d.ts +13 -0
- package/dist/services/metadata/task-metadata.d.ts.map +1 -0
- package/dist/services/metadata/task-metadata.js +84 -0
- package/dist/services/metadata/task-metadata.js.map +1 -0
- package/dist/services/normalizers/AttributeAwareNormalizer.d.ts.map +1 -1
- package/dist/services/normalizers/AttributeAwareNormalizer.js +99 -5
- package/dist/services/normalizers/AttributeAwareNormalizer.js.map +1 -1
- package/dist/services/normalizers/PhoneNormalizer.d.ts +2 -2
- package/dist/services/normalizers/PhoneNormalizer.d.ts.map +1 -1
- package/dist/services/normalizers/PhoneNormalizer.js +1 -7
- package/dist/services/normalizers/PhoneNormalizer.js.map +1 -1
- package/dist/services/search-strategies/CompanySearchStrategy.d.ts.map +1 -1
- package/dist/services/search-strategies/CompanySearchStrategy.js +10 -4
- package/dist/services/search-strategies/CompanySearchStrategy.js.map +1 -1
- package/dist/services/search-strategies/PeopleSearchStrategy.d.ts.map +1 -1
- package/dist/services/search-strategies/PeopleSearchStrategy.js +21 -15
- package/dist/services/search-strategies/PeopleSearchStrategy.js.map +1 -1
- package/dist/services/search-strategies/query-filter-builder.d.ts +5 -0
- package/dist/services/search-strategies/query-filter-builder.d.ts.map +1 -0
- package/dist/services/search-strategies/query-filter-builder.js +129 -0
- package/dist/services/search-strategies/query-filter-builder.js.map +1 -0
- package/dist/services/utils/attribute-metadata.d.ts +7 -0
- package/dist/services/utils/attribute-metadata.d.ts.map +1 -0
- package/dist/services/utils/attribute-metadata.js +84 -0
- package/dist/services/utils/attribute-metadata.js.map +1 -0
- package/dist/smithery.d.ts +2 -2
- package/dist/smithery.d.ts.map +1 -1
- package/dist/smithery.js +4 -2
- package/dist/smithery.js.map +1 -1
- package/dist/types/attio.d.ts +32 -11
- package/dist/types/attio.d.ts.map +1 -1
- package/dist/types/attio.js.map +1 -1
- package/dist/types/list-types.d.ts +2 -0
- package/dist/types/list-types.d.ts.map +1 -1
- package/dist/types/list-types.js.map +1 -1
- package/dist/utils/attribute-format-helpers.d.ts.map +1 -1
- package/dist/utils/attribute-format-helpers.js +22 -0
- package/dist/utils/attribute-format-helpers.js.map +1 -1
- package/dist/utils/axios-error-mapper.d.ts +1 -0
- package/dist/utils/axios-error-mapper.d.ts.map +1 -1
- package/dist/utils/axios-error-mapper.js.map +1 -1
- package/dist/utils/client-resolver.d.ts +3 -3
- package/dist/utils/client-resolver.d.ts.map +1 -1
- package/dist/utils/client-resolver.js +28 -21
- package/dist/utils/client-resolver.js.map +1 -1
- package/dist/utils/error-handler.js +2 -2
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/error-sanitizer.d.ts.map +1 -1
- package/dist/utils/error-sanitizer.js +52 -3
- package/dist/utils/error-sanitizer.js.map +1 -1
- package/dist/utils/json-serializer.d.ts.map +1 -1
- package/dist/utils/json-serializer.js +55 -6
- package/dist/utils/json-serializer.js.map +1 -1
- package/dist/utils/log-sanitizer.d.ts +14 -0
- package/dist/utils/log-sanitizer.d.ts.map +1 -0
- package/dist/utils/log-sanitizer.js +248 -0
- package/dist/utils/log-sanitizer.js.map +1 -0
- package/dist/utils/logger.d.ts +15 -9
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +74 -42
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp-discovery.d.ts +16 -0
- package/dist/utils/mcp-discovery.d.ts.map +1 -0
- package/dist/utils/mcp-discovery.js +36 -0
- package/dist/utils/mcp-discovery.js.map +1 -0
- package/dist/utils/secure-error-handler.d.ts +16 -1
- package/dist/utils/secure-error-handler.d.ts.map +1 -1
- package/dist/utils/secure-error-handler.js +91 -12
- package/dist/utils/secure-error-handler.js.map +1 -1
- package/dist/utils/token-count.d.ts +5 -0
- package/dist/utils/token-count.d.ts.map +1 -0
- package/dist/utils/token-count.js +57 -0
- package/dist/utils/token-count.js.map +1 -0
- package/dist/utils/token-footprint-analyzer.d.ts +46 -0
- package/dist/utils/token-footprint-analyzer.d.ts.map +1 -0
- package/dist/utils/token-footprint-analyzer.js +221 -0
- package/dist/utils/token-footprint-analyzer.js.map +1 -0
- package/dist/utils/validation/phone-validation.d.ts +25 -0
- package/dist/utils/validation/phone-validation.d.ts.map +1 -0
- package/dist/utils/validation/phone-validation.js +133 -0
- package/dist/utils/validation/phone-validation.js.map +1 -0
- package/dist/utils/validation/uuid-validation.d.ts.map +1 -1
- package/dist/utils/validation/uuid-validation.js +1 -0
- package/dist/utils/validation/uuid-validation.js.map +1 -1
- package/package.json +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,104 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
17
|
|
|
18
18
|
### Deprecated
|
|
19
19
|
|
|
20
|
+
## [1.1.0] - 2025-10-06
|
|
21
|
+
|
|
22
|
+
This release enhances developer experience with intelligent prompts, comprehensive tool standardization, and strengthens enterprise readiness with security hardening and validation improvements.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **10 Pre-Built MCP Prompts for Common CRM Tasks** (#774) - Intelligent shortcuts that help Claude work faster and more efficiently with your Attio data
|
|
27
|
+
- **Search & Find** (5 prompts): `people_search.v1`, `company_search.v1`, `deal_search.v1`, `meeting_prep.v1`, `pipeline_health.v1`
|
|
28
|
+
- Natural language search with automatic formatting (table, JSON, or IDs)
|
|
29
|
+
- Meeting preparation summaries with recent activity context
|
|
30
|
+
- Pipeline analysis with bottleneck detection and conversion metrics
|
|
31
|
+
- **Take Actions** (4 prompts): `log_activity.v1`, `create_task.v1`, `advance_deal.v1`, `add_to_list.v1`
|
|
32
|
+
- Dry-run mode for safe preview before executing changes
|
|
33
|
+
- Consistent formatting across all write operations
|
|
34
|
+
- **Research & Qualify** (1 prompt): `qualify_lead.v1`
|
|
35
|
+
- Automated web research with BANT/CHAMP qualification frameworks
|
|
36
|
+
- Lead scoring and actionable recommendations
|
|
37
|
+
- **Key Features**:
|
|
38
|
+
- Token-efficient design (300-700 tokens per prompt)
|
|
39
|
+
- Server-side validation with helpful error messages
|
|
40
|
+
- Discoverable by Claude for smart suggestions
|
|
41
|
+
- Universal arguments for consistent behavior (format, fields_preset, verbosity)
|
|
42
|
+
- Optional telemetry and dev metadata modes for monitoring
|
|
43
|
+
- **Comprehensive Tool Standardization** (#776) - Complete audit and optimization of all 33 MCP tools
|
|
44
|
+
- **Phase 0+1** (PR #785): Infrastructure and core universal tools
|
|
45
|
+
- Fixed critical MCP naming compliance (`records.search` → `records_search`) across 89 files
|
|
46
|
+
- Created `formatToolDescription` template for consistent tool documentation
|
|
47
|
+
- Built schema linter with 300-character description limit and quality checks
|
|
48
|
+
- Token baseline established: 188 tokens/tool (60% better than industry average)
|
|
49
|
+
- Standardized 19 universal tools (search, create, update, delete, get-details, etc.)
|
|
50
|
+
- **Phase 2** (PR #792): List and note tools
|
|
51
|
+
- Standardized 11 list management tools with consistent patterns
|
|
52
|
+
- Standardized 2 note operation tools (create-note, list-notes)
|
|
53
|
+
- Added `additionalProperties: false` to all schemas for strict validation
|
|
54
|
+
- Enhanced with property-level examples throughout
|
|
55
|
+
- **Phase 3** (PR #796): Workspace member tools
|
|
56
|
+
- Standardized final 3 tools (list/search/get workspace members)
|
|
57
|
+
- Completed tool discovery snapshot baseline for regression prevention
|
|
58
|
+
- **Quality Improvements**:
|
|
59
|
+
- All tools follow verb-first naming with clear boundaries
|
|
60
|
+
- Enhanced JSON schemas with proper validation and examples
|
|
61
|
+
- Token-efficient descriptions optimized for LLM routing
|
|
62
|
+
- Automated quality gates prevent future regressions
|
|
63
|
+
- **Markdown Note Support** (#854, #862) - `create-note` tool now supports markdown formatting via optional `format` parameter ('plaintext' | 'markdown')
|
|
64
|
+
- Rich formatted notes with headers, lists, and emphasis
|
|
65
|
+
- Backward compatible with default plaintext format
|
|
66
|
+
- Full E2E test coverage for markdown creation
|
|
67
|
+
- **Enhanced Phone Validation** (#837, #863) - Structured validation with libphonenumber-js integration
|
|
68
|
+
- Central validation helpers (`validatePhoneNumber`, `isValidPhoneNumber`, `isPossiblePhoneNumber`)
|
|
69
|
+
- Actionable `PhoneValidationError` metadata with length/country/format guidance
|
|
70
|
+
- CLI auto-configures `libphonenumber-js` to use `min` metadata bundle
|
|
71
|
+
- Server runtime exposes `PHONE_METADATA_SOURCE` for diagnostics
|
|
72
|
+
- Phone normalization failures include aggregated issue counts and newline-delimited details
|
|
73
|
+
- **Intelligent Search Query Parsing** (#781) - Enhanced search capabilities for people and company resources
|
|
74
|
+
- International phone format support with multi-level domain extraction
|
|
75
|
+
- Consistent empty-filter handling across search strategies
|
|
76
|
+
- Stopword filtering and large query input protection
|
|
77
|
+
- **Phone Number UX Improvements** (#798) - Comprehensive enhancements for phone number handling
|
|
78
|
+
- Inline tool help with phone format examples and E.164 normalization guidance
|
|
79
|
+
- Common update patterns documentation (`docs/examples/common-update-patterns.md`)
|
|
80
|
+
- Field verification configuration guide (`docs/configuration/field-verification.md`)
|
|
81
|
+
- Enhanced error messages for phone number validation with format examples
|
|
82
|
+
- Pre-update field validation with automatic normalization
|
|
83
|
+
- Debug documentation for anonymized production placeholders used in diagnostic suites
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
|
|
87
|
+
- **Phone Number Normalization** (#798, #837) - Automatic transformation from user-friendly `phone_number` to Attio's `original_phone_number` format
|
|
88
|
+
- Additional fields (label, type, extension, is_primary) preserved during normalization
|
|
89
|
+
- `AttributeAwareNormalizer` now rejects invalid phone inputs with `UniversalValidationError`
|
|
90
|
+
- Precise length/country/format guidance instead of silent pass-through
|
|
91
|
+
- **Warning Suppression** (#798) - Update verification now filters out cosmetic formatting differences (e.g., `"Demo"` vs `Demo`)
|
|
92
|
+
- **Search Query Parsing** (#781) - Updated `parseQuery` to support international phone formats and robust multi-level domain extraction
|
|
93
|
+
- Enhanced people/company search strategies leverage parsed tokens and phone variants
|
|
94
|
+
- Swapped unit test fixtures/docs to anonymized examples (Alex Rivera / Example Medical Group / +1 555 010 4477)
|
|
95
|
+
|
|
96
|
+
### Fixed
|
|
97
|
+
|
|
98
|
+
- **Query Builder Issues** (#781) - Eliminated redundant `$or` filters and US-only phone assumptions in query filter builders
|
|
99
|
+
- **Token Processing** (#781) - Hardened token processing to ignore stopwords and guard against large query inputs
|
|
100
|
+
- **Phone Number Field Confusion** (#798) - Users can now use `phone_number` (user-friendly) which auto-converts to `original_phone_number` (Attio API format)
|
|
101
|
+
|
|
102
|
+
### Security
|
|
103
|
+
|
|
104
|
+
- **XSS Prevention** (#840, #841, #845) - Comprehensive protection against reflected XSS attacks
|
|
105
|
+
- Replaced regex-based HTML sanitization with `sanitize-html` library (CodeQL alert #121)
|
|
106
|
+
- URL scheme filtering (javascript:, data:, vbscript:, file:)
|
|
107
|
+
- Hardened prompt handlers against XSS injection
|
|
108
|
+
- Security test suite with 11 test cases covering XSS, protocol injection, double-encoding, and edge cases
|
|
109
|
+
- **Stack Trace Protection** (#841, #844) - Enhanced error handling to prevent sensitive information exposure
|
|
110
|
+
- Stack traces no longer exposed in client-facing errors
|
|
111
|
+
- File paths and system information sanitized
|
|
112
|
+
- Correlation IDs for debugging without exposing internals
|
|
113
|
+
- **Enhanced Error Context** (#844) - Safe metadata enrichment without information leakage
|
|
114
|
+
- Field type metadata preserved in error responses
|
|
115
|
+
- Network information (localhost, ports, connection strings) sanitized
|
|
116
|
+
- Error type consistency across all response formats
|
|
117
|
+
|
|
20
118
|
## [1.0.0] - 2025-09-27
|
|
21
119
|
|
|
22
120
|
🎉 **MAJOR RELEASE** - Complete Attio CRM Coverage + ChatGPT Integration
|
|
@@ -276,9 +374,10 @@ Users upgrading from v0.1.x should note:
|
|
|
276
374
|
- Troubleshooting guides
|
|
277
375
|
- Development and contribution guidelines
|
|
278
376
|
|
|
279
|
-
[Unreleased]: https://github.com/kesslerio/attio-mcp-server/compare/v1.
|
|
280
|
-
[1.
|
|
281
|
-
[0.
|
|
377
|
+
[Unreleased]: https://github.com/kesslerio/attio-mcp-server/compare/v1.1.0...HEAD
|
|
378
|
+
[1.1.0]: https://github.com/kesslerio/attio-mcp-server/compare/v1.0.0...v1.1.0
|
|
379
|
+
[1.0.0]: https://github.com/kesslerio/attio-mcp-server/compare/v0.2.0...v1.0.0
|
|
380
|
+
[0.2.0]: https://github.com/kesslerio/attio-mcp-server/compare/v0.1.2...v0.2.0
|
|
282
381
|
[0.1.2]: https://github.com/kesslerio/attio-mcp-server/compare/v0.1.1...v0.1.2
|
|
283
382
|
[0.1.1]: https://github.com/kesslerio/attio-mcp-server/compare/v0.1.0...v0.1.1
|
|
284
383
|
[0.1.0]: https://github.com/kesslerio/attio-mcp-server/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -91,6 +91,76 @@ Transform your CRM workflows with AI-powered automation. Instead of clicking thr
|
|
|
91
91
|
- **Data Export**: JSON serialization for integrations
|
|
92
92
|
- **Real-time Updates**: Live data synchronization with Attio
|
|
93
93
|
|
|
94
|
+
### 💬 **Pre-Built Prompts** (10 Prompts)
|
|
95
|
+
|
|
96
|
+
Intelligent shortcuts that help Claude work faster with your CRM data:
|
|
97
|
+
|
|
98
|
+
- **Search & Find** (5): people_search, company_search, deal_search, meeting_prep, pipeline_health
|
|
99
|
+
- **Take Actions** (4): log_activity, create_task, advance_deal, add_to_list with dry-run safety
|
|
100
|
+
- **Research & Qualify** (1): qualify_lead with automated web research and BANT/CHAMP frameworks
|
|
101
|
+
- **Token-efficient**: 300-700 tokens per prompt with consistent formatting
|
|
102
|
+
- **Discoverable**: Claude automatically suggests relevant prompts for your tasks
|
|
103
|
+
|
|
104
|
+
See [Using Out-of-the-Box Prompts](#-using-out-of-the-box-prompts) for detailed documentation and examples.
|
|
105
|
+
|
|
106
|
+
## 🎯 **Using Out-of-the-Box Prompts**
|
|
107
|
+
|
|
108
|
+
**NEW**: 10 pre-built MCP prompts for common Sales workflows. No setup required—just use them!
|
|
109
|
+
|
|
110
|
+
### Available Prompts
|
|
111
|
+
|
|
112
|
+
| Prompt | Description | Key Arguments | Example |
|
|
113
|
+
| -------------------- | ----------------------------------------------- | ------------------------------------------------ | ---------------------------------- |
|
|
114
|
+
| `people_search.v1` | Find people by title, company, territory | `query`, `limit`, `format` | Find AE in fintech, SF |
|
|
115
|
+
| `company_search.v1` | Query companies by domain, segment, plan | `query`, `limit`, `format` | Find SaaS companies >100 employees |
|
|
116
|
+
| `deal_search.v1` | Filter deals by owner, stage, value, close date | `query`, `limit`, `format` | Find deals >$50k closing Q1 |
|
|
117
|
+
| `log_activity.v1` | Log calls/meetings/emails to records | `target`, `type`, `summary`, `dry_run` | Log call with Nina at Acme |
|
|
118
|
+
| `create_task.v1` | Create tasks with natural language due dates | `title`, `content`, `due_date`, `dry_run` | Create task: Follow up tomorrow |
|
|
119
|
+
| `advance_deal.v1` | Move deal to target stage with next action | `deal`, `target_stage`, `create_task`, `dry_run` | Advance deal to "Proposal Sent" |
|
|
120
|
+
| `add_to_list.v1` | Add records to a List by name or ID | `records`, `list`, `dry_run` | Add 5 companies to Q1 Outreach |
|
|
121
|
+
| `qualify_lead.v1` | Research lead with web + BANT/CHAMP scoring | `target`, `framework`, `limit_web`, `dry_run` | Qualify Acme Corp with BANT |
|
|
122
|
+
| `meeting_prep.v1` | 360° prep: notes, tasks, deals, agenda | `target`, `format`, `verbosity` | Prep for meeting with Acme CEO |
|
|
123
|
+
| `pipeline_health.v1` | Weekly snapshot: created/won/slipped + risks | `owner`, `timeframe`, `segment` | Pipeline health for @me last 30d |
|
|
124
|
+
|
|
125
|
+
### Quick Examples
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Search for prospects
|
|
129
|
+
"Use people_search.v1: Find Account Executives in San Francisco at fintech companies, limit 25"
|
|
130
|
+
|
|
131
|
+
# Log activity
|
|
132
|
+
"Use log_activity.v1: Log a call with Nina at Acme Corp, discussed Q1 pricing, create follow-up task"
|
|
133
|
+
|
|
134
|
+
# Qualify a lead (with web research)
|
|
135
|
+
"Use qualify_lead.v1: Qualify Acme Corp using BANT framework, dry run mode"
|
|
136
|
+
|
|
137
|
+
# Meeting prep
|
|
138
|
+
"Use meeting_prep.v1: Prepare for meeting with contact at Acme Corp"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Universal Arguments
|
|
142
|
+
|
|
143
|
+
**All read prompts** support:
|
|
144
|
+
|
|
145
|
+
- `format`: `table` | `json` | `ids` (default: `table`)
|
|
146
|
+
- `fields_preset`: `sales_short` | `full` (default: `sales_short`)
|
|
147
|
+
- `verbosity`: `brief` | `normal` (default: `brief`)
|
|
148
|
+
|
|
149
|
+
**All write prompts** support:
|
|
150
|
+
|
|
151
|
+
- `dry_run`: `true` | `false` (default: `false`) - Preview changes without executing
|
|
152
|
+
|
|
153
|
+
### Token Awareness Features
|
|
154
|
+
|
|
155
|
+
Prompts include built-in token optimization:
|
|
156
|
+
|
|
157
|
+
- **Budget Guards**: Prompts stay within token limits (people_search <500, qualify_lead <400)
|
|
158
|
+
- **Dev Metadata**: Set `MCP_DEV_META=true` for token counts in responses
|
|
159
|
+
- **Telemetry**: Set `PROMPT_TELEMETRY_ENABLED=true` for usage logging
|
|
160
|
+
- **Configurable Limits**: Override with `MAX_PROMPT_TOKENS` environment variable
|
|
161
|
+
|
|
162
|
+
For complete prompt documentation, see [docs/prompts/v1-catalog.md](./docs/prompts/v1-catalog.md).
|
|
163
|
+
|
|
94
164
|
## ⚠️ **Known Limitations & Important Notes**
|
|
95
165
|
|
|
96
166
|
### **Current Limitations**
|
|
@@ -107,7 +177,7 @@ Transform your CRM workflows with AI-powered automation. Instead of clicking thr
|
|
|
107
177
|
### 🤝 **OpenAI MCP Compatibility**
|
|
108
178
|
|
|
109
179
|
- **Developer Mode Ready**: Every tool now publishes MCP safety annotations (`readOnlyHint`, `destructiveHint`) so OpenAI Developer Mode can auto-approve reads and request confirmation for writes.
|
|
110
|
-
- **Search Compatibility Surface**: The `search` and `fetch` tools remain available for OpenAI
|
|
180
|
+
- **Search Compatibility Surface**: The `search` and `fetch` tools remain available for OpenAI's baseline MCP support. Set `ATTIO_MCP_TOOL_MODE=search` to expose only these read-only endpoints (plus `aaa-health-check`) when Developer Mode is unavailable.
|
|
111
181
|
- **Default Behaviour**: With `ATTIO_MCP_TOOL_MODE` unset, the full universal tool set is exposed—matching Claude’s experience—while OpenAI users still see the compatibility wrappers.
|
|
112
182
|
- **Detailed Guide**: See [docs/chatgpt-developer-mode.md](./docs/chatgpt-developer-mode.md) for environment variables, approval flows, and validation tips.
|
|
113
183
|
- **User Documentation**: See the [ChatGPT Developer Mode docs](./docs/chatgpt-developer-mode.md) for a complete walkthrough of approval flows and setup instructions.
|
|
@@ -534,6 +604,11 @@ Comprehensive documentation is available in the [docs directory](./docs):
|
|
|
534
604
|
- [Claude Desktop Configuration](./docs/claude-desktop-config.md)
|
|
535
605
|
- [Troubleshooting Guide](./TROUBLESHOOTING.md)
|
|
536
606
|
|
|
607
|
+
### **Configuration**
|
|
608
|
+
|
|
609
|
+
- [Warning Filter Configuration](./docs/configuration/warning-filters.md) - Understanding cosmetic vs semantic mismatches, ESLint budgets, and suppression strategies
|
|
610
|
+
- [Field Verification Configuration](./docs/configuration/field-verification.md) - Field persistence verification and validation settings
|
|
611
|
+
|
|
537
612
|
### **API Reference**
|
|
538
613
|
|
|
539
614
|
📋 **Implementation Status**: These docs describe the Attio API endpoints. For MCP tool usage, refer to universal tools documentation above.
|
|
@@ -669,6 +744,7 @@ See the [Testing Guide](./docs/testing.md) and [E2E Troubleshooting Guide](./doc
|
|
|
669
744
|
npm run build # Build TypeScript
|
|
670
745
|
npm run test # Run all tests
|
|
671
746
|
npm run test:offline # Run tests without API calls
|
|
747
|
+
npm run analyze:token-footprint # Generate baseline MCP token footprint report
|
|
672
748
|
npm run lint # Check code style
|
|
673
749
|
npm run check # Full quality check
|
|
674
750
|
npm run setup:test-data # Create test data for integration tests
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Attio API client and related utilities
|
|
3
|
+
* Unified client factory with strategy pattern for different environments
|
|
3
4
|
*/
|
|
4
5
|
import { AxiosInstance } from 'axios';
|
|
5
6
|
import { AttioAttributeSchema, AttioSelectOption, AttioStatusOption } from './types.js';
|
|
7
|
+
import { ClientConfig } from './client-config.js';
|
|
6
8
|
export declare const __MODULE_PATH__ = "attio-client";
|
|
7
9
|
export type AttioClient = AxiosInstance;
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
11
|
+
* UNIFIED CLIENT FACTORY: Support new createAttioClient(config) signature
|
|
12
|
+
*
|
|
13
|
+
* @param config - Client configuration options
|
|
14
|
+
* @returns Configured Axios instance
|
|
15
|
+
*/
|
|
16
|
+
export declare function createAttioClient(config?: ClientConfig): AxiosInstance;
|
|
17
|
+
/**
|
|
18
|
+
* BACKWARD COMPATIBILITY: Support old createAttioClient(apiKey) signature
|
|
19
|
+
*
|
|
20
|
+
* @param apiKey - The Attio API key (legacy signature)
|
|
21
|
+
* @returns Configured Axios instance
|
|
22
|
+
*/
|
|
23
|
+
export declare function createAttioClient(apiKey: string): AxiosInstance;
|
|
24
|
+
/**
|
|
25
|
+
* LEGACY: Centralized authenticated Attio client builder
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Use createAttioClient() instead for unified interface
|
|
10
28
|
* Guarantees proper Authorization header and fails fast if API key is missing
|
|
11
29
|
*/
|
|
12
30
|
export declare function buildAttioClient(opts?: {
|
|
@@ -15,12 +33,13 @@ export declare function buildAttioClient(opts?: {
|
|
|
15
33
|
timeoutMs?: number;
|
|
16
34
|
}): AttioClient;
|
|
17
35
|
/**
|
|
18
|
-
* Creates and configures an Axios instance for the Attio API
|
|
36
|
+
* LEGACY: Creates and configures an Axios instance for the Attio API
|
|
19
37
|
*
|
|
38
|
+
* @deprecated Use createAttioClient(config) instead for unified interface
|
|
20
39
|
* @param apiKey - The Attio API key
|
|
21
40
|
* @returns Configured Axios instance
|
|
22
41
|
*/
|
|
23
|
-
export declare function
|
|
42
|
+
export declare function createLegacyAttioClient(apiKey: string): AxiosInstance;
|
|
24
43
|
/**
|
|
25
44
|
* Gets the schema for a specific attribute.
|
|
26
45
|
* @param objectSlug - The slug of the object (e.g., 'companies').
|
|
@@ -45,13 +64,14 @@ export declare function getStatusOptions(objectSlug: string, attributeSlug: stri
|
|
|
45
64
|
/**
|
|
46
65
|
* Initializes the global API client with the provided API key
|
|
47
66
|
*
|
|
67
|
+
* @deprecated Use createAttioClient() with ClientCache instead
|
|
48
68
|
* @param apiKey - The Attio API key
|
|
49
69
|
*/
|
|
50
70
|
export declare function initializeAttioClient(apiKey: string): AxiosInstance;
|
|
51
71
|
/**
|
|
52
|
-
* Gets the global API client instance
|
|
72
|
+
* Gets the global API client instance - SIMPLIFIED using unified architecture
|
|
53
73
|
*
|
|
54
|
-
* @deprecated Use
|
|
74
|
+
* @deprecated Use createAttioClient() or getLazyAttioClient() instead
|
|
55
75
|
* @returns The Axios instance for the Attio API
|
|
56
76
|
* @throws If the API client hasn't been initialized and no API key is available
|
|
57
77
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attio-client.d.ts","sourceRoot":"","sources":["../../src/api/attio-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"attio-client.d.ts","sourceRoot":"","sources":["../../src/api/attio-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EAGb,MAAM,oBAAoB,CAAC;AAa5B,eAAO,MAAM,eAAe,iBAAc,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAmCxC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;AACxE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;AA8DjE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,WAAW,CAqBd;AAID;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CA0DrE;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,oBAAoB,CAAC,CAe/B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAe9B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAe9B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAInE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAoEzE"}
|
package/dist/api/attio-client.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Attio API client and related utilities
|
|
3
|
+
* Unified client factory with strategy pattern for different environments
|
|
3
4
|
*/
|
|
4
5
|
import axios from 'axios';
|
|
5
6
|
import { debug, error, OperationType } from '../utils/logger.js';
|
|
6
7
|
import { getContextApiKey, validateApiKey } from './client-context.js';
|
|
7
8
|
import { configureStandardInterceptors } from './client-interceptors.js';
|
|
8
|
-
import {
|
|
9
|
+
import { ClientMode, EnvironmentModeHandler, } from './client-config.js';
|
|
10
|
+
import { ClientStrategyFactory } from './client-strategies.js';
|
|
11
|
+
import { ClientCache } from './client-cache.js';
|
|
9
12
|
// Module identification for debugging (compatible with both ESM and CJS)
|
|
10
13
|
const MODULE_FILE = 'attio-client';
|
|
11
14
|
// Debug loading info - use logger instead of console.log to avoid JSON parsing issues
|
|
@@ -33,54 +36,85 @@ function validateAndThrowForApiKey(apiKey, source = 'provided') {
|
|
|
33
36
|
throw new Error(`Invalid API key: API key appears to be too short (source: ${source})`);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
|
-
// Global API client instance
|
|
39
|
+
// LEGACY: Global API client instance - replaced by ClientCache
|
|
37
40
|
let apiInstance = null;
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Guarantees proper Authorization header and fails fast if API key is missing
|
|
42
|
+
* Implementation of overloaded createAttioClient function
|
|
41
43
|
*/
|
|
42
|
-
export function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
export function createAttioClient(configOrApiKey = {}) {
|
|
45
|
+
// Handle legacy string API key parameter
|
|
46
|
+
if (typeof configOrApiKey === 'string') {
|
|
47
|
+
debug('attio-client', 'createAttioClient (LEGACY string signature) - redirecting to unified version');
|
|
48
|
+
return createLegacyAttioClient(configOrApiKey);
|
|
49
|
+
}
|
|
50
|
+
// Handle new config object parameter - this is the main implementation we defined above
|
|
51
|
+
const config = configOrApiKey;
|
|
52
|
+
// Get API key from config, environment, or context
|
|
53
|
+
const apiKey = config.apiKey ?? process.env.ATTIO_API_KEY ?? getContextApiKey() ?? '';
|
|
54
|
+
// Determine the source for better error messages
|
|
55
|
+
const apiKeySource = config.apiKey
|
|
56
|
+
? 'config parameter'
|
|
49
57
|
: process.env.ATTIO_API_KEY
|
|
50
58
|
? 'environment variable'
|
|
51
59
|
: 'context configuration';
|
|
60
|
+
// Validate API key using standardized validation
|
|
52
61
|
validateAndThrowForApiKey(apiKey, apiKeySource);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
client.defaults.headers.common['Accept'] = 'application/json';
|
|
57
|
-
client.defaults.headers.post['Content-Type'] = 'application/json';
|
|
58
|
-
// Response interceptor to attach serverData for error handling
|
|
59
|
-
client.interceptors.response.use((response) => response, (error) => {
|
|
60
|
-
const data = error?.response?.data;
|
|
61
|
-
if (isAttioErrorData(data)) {
|
|
62
|
-
// Mirror serverData onto the error so wrappers can preserve it
|
|
63
|
-
const attioError = error;
|
|
64
|
-
attioError.serverData = {
|
|
65
|
-
status_code: data.status_code ?? error.response?.status,
|
|
66
|
-
type: data.type,
|
|
67
|
-
code: data.code,
|
|
68
|
-
message: data.message,
|
|
69
|
-
};
|
|
70
|
-
return Promise.reject(attioError);
|
|
71
|
-
}
|
|
72
|
-
return Promise.reject(error);
|
|
62
|
+
// Get environment-aware configuration
|
|
63
|
+
const environmentConfig = EnvironmentModeHandler.getClientConfig({
|
|
64
|
+
rawE2E: config.mode === ClientMode.E2E_RAW,
|
|
73
65
|
});
|
|
74
|
-
|
|
66
|
+
// Merge configurations: environment defaults < config parameter
|
|
67
|
+
const finalConfig = {
|
|
68
|
+
...environmentConfig,
|
|
69
|
+
...config,
|
|
70
|
+
apiKey, // Always use the validated API key
|
|
71
|
+
interceptors: {
|
|
72
|
+
...environmentConfig.interceptors,
|
|
73
|
+
...config.interceptors,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
debug('attio-client', 'Creating unified client', {
|
|
77
|
+
mode: finalConfig.mode,
|
|
78
|
+
hasApiKey: Boolean(apiKey),
|
|
79
|
+
apiKeySource,
|
|
80
|
+
bypassCache: finalConfig.bypassCache,
|
|
81
|
+
baseURL: finalConfig.baseURL,
|
|
82
|
+
timeout: finalConfig.timeout,
|
|
83
|
+
});
|
|
84
|
+
// Use strategy factory to create the appropriate client
|
|
85
|
+
return ClientStrategyFactory.createClient(finalConfig);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* LEGACY: Centralized authenticated Attio client builder
|
|
89
|
+
*
|
|
90
|
+
* @deprecated Use createAttioClient() instead for unified interface
|
|
91
|
+
* Guarantees proper Authorization header and fails fast if API key is missing
|
|
92
|
+
*/
|
|
93
|
+
export function buildAttioClient(opts) {
|
|
94
|
+
// Convert legacy options to new config format
|
|
95
|
+
const config = {
|
|
96
|
+
apiKey: opts?.apiKey,
|
|
97
|
+
baseURL: opts?.baseURL,
|
|
98
|
+
timeout: opts?.timeoutMs,
|
|
99
|
+
mode: ClientMode.PRODUCTION, // buildAttioClient was used for production
|
|
100
|
+
};
|
|
101
|
+
debug('attio-client', 'buildAttioClient (LEGACY) - redirecting to unified createAttioClient', {
|
|
102
|
+
hasApiKey: Boolean(opts?.apiKey),
|
|
103
|
+
baseURL: opts?.baseURL,
|
|
104
|
+
timeout: opts?.timeoutMs,
|
|
105
|
+
});
|
|
106
|
+
// Use the new unified client factory
|
|
107
|
+
return createAttioClient(config);
|
|
75
108
|
}
|
|
76
109
|
// Legacy getAttioClient exists below - it's already implemented
|
|
77
110
|
/**
|
|
78
|
-
* Creates and configures an Axios instance for the Attio API
|
|
111
|
+
* LEGACY: Creates and configures an Axios instance for the Attio API
|
|
79
112
|
*
|
|
113
|
+
* @deprecated Use createAttioClient(config) instead for unified interface
|
|
80
114
|
* @param apiKey - The Attio API key
|
|
81
115
|
* @returns Configured Axios instance
|
|
82
116
|
*/
|
|
83
|
-
export function
|
|
117
|
+
export function createLegacyAttioClient(apiKey) {
|
|
84
118
|
// Use standardized validation
|
|
85
119
|
validateAndThrowForApiKey(apiKey, 'parameter');
|
|
86
120
|
// Log client initialization for debugging (without exposing sensitive data)
|
|
@@ -181,114 +215,74 @@ export async function getStatusOptions(objectSlug, attributeSlug) {
|
|
|
181
215
|
/**
|
|
182
216
|
* Initializes the global API client with the provided API key
|
|
183
217
|
*
|
|
218
|
+
* @deprecated Use createAttioClient() with ClientCache instead
|
|
184
219
|
* @param apiKey - The Attio API key
|
|
185
220
|
*/
|
|
186
221
|
export function initializeAttioClient(apiKey) {
|
|
187
|
-
apiInstance = createAttioClient(apiKey);
|
|
222
|
+
apiInstance = createAttioClient(apiKey); // This will use the legacy signature
|
|
223
|
+
ClientCache.setInstance(apiInstance);
|
|
188
224
|
return apiInstance;
|
|
189
225
|
}
|
|
190
226
|
/**
|
|
191
|
-
* Gets the global API client instance
|
|
227
|
+
* Gets the global API client instance - SIMPLIFIED using unified architecture
|
|
192
228
|
*
|
|
193
|
-
* @deprecated Use
|
|
229
|
+
* @deprecated Use createAttioClient() or getLazyAttioClient() instead
|
|
194
230
|
* @returns The Axios instance for the Attio API
|
|
195
231
|
* @throws If the API client hasn't been initialized and no API key is available
|
|
196
232
|
*/
|
|
197
233
|
export function getAttioClient(opts) {
|
|
198
|
-
|
|
199
|
-
const useMocks = process.env.USE_MOCK_DATA === 'true' || process.env.OFFLINE_MODE === 'true';
|
|
200
|
-
const forceReal = isE2E && !useMocks;
|
|
201
|
-
// Debug log the client mode selection
|
|
202
|
-
debug('attio-client', 'Client mode selection', {
|
|
203
|
-
isE2E,
|
|
204
|
-
useMocks,
|
|
205
|
-
forceReal,
|
|
234
|
+
debug('attio-client', 'getAttioClient (LEGACY) called', {
|
|
206
235
|
rawE2E: opts?.rawE2E,
|
|
207
|
-
|
|
236
|
+
hasCache: ClientCache.hasInstance(),
|
|
208
237
|
E2E_MODE: process.env.E2E_MODE,
|
|
209
238
|
USE_MOCK_DATA: process.env.USE_MOCK_DATA,
|
|
210
|
-
OFFLINE_MODE: process.env.OFFLINE_MODE,
|
|
211
|
-
});
|
|
212
|
-
debug('AttioClient', 'mode', {
|
|
213
|
-
isE2E,
|
|
214
|
-
useMocks,
|
|
215
|
-
forceReal,
|
|
216
|
-
rawE2E: opts?.rawE2E,
|
|
217
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
218
239
|
});
|
|
219
|
-
//
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const rawClient = axios.create({
|
|
238
|
-
baseURL,
|
|
239
|
-
timeout: 20000,
|
|
240
|
-
headers: {
|
|
241
|
-
Authorization: `Bearer ${apiKey}`,
|
|
242
|
-
'Content-Type': 'application/json',
|
|
243
|
-
Accept: 'application/json',
|
|
244
|
-
},
|
|
245
|
-
// do NOT transform the response; we want raw server JSON
|
|
246
|
-
transformResponse: [
|
|
247
|
-
(data) => {
|
|
248
|
-
try {
|
|
249
|
-
return JSON.parse(data);
|
|
250
|
-
}
|
|
251
|
-
catch {
|
|
252
|
-
return data;
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
validateStatus: (s) => s >= 200 && s < 300, // don't swallow 4xx/5xx
|
|
257
|
-
});
|
|
258
|
-
// Configure E2E interceptors using centralized module
|
|
259
|
-
debug('attio-client', 'Configuring E2E raw client interceptors', {
|
|
260
|
-
baseURL,
|
|
261
|
-
});
|
|
262
|
-
configureStandardInterceptors(rawClient, {
|
|
263
|
-
prefix: 'E2E-RAW',
|
|
264
|
-
enableDiagnostics: true,
|
|
265
|
-
enableErrorHandling: true,
|
|
266
|
-
});
|
|
267
|
-
debug('AttioClient', 'Returning E2E raw client');
|
|
268
|
-
return rawClient;
|
|
240
|
+
// Check if we should bypass cache and create fresh client
|
|
241
|
+
const shouldBypassCache = EnvironmentModeHandler.shouldUseRealClient() || opts?.rawE2E;
|
|
242
|
+
if (shouldBypassCache) {
|
|
243
|
+
debug('attio-client', 'Bypassing cache - creating fresh client');
|
|
244
|
+
// Clear cache to ensure fresh client
|
|
245
|
+
ClientCache.clearInstance();
|
|
246
|
+
apiInstance = null;
|
|
247
|
+
// Determine mode based on rawE2E option
|
|
248
|
+
const mode = opts?.rawE2E
|
|
249
|
+
? ClientMode.E2E_RAW
|
|
250
|
+
: EnvironmentModeHandler.determineMode();
|
|
251
|
+
const config = {
|
|
252
|
+
mode,
|
|
253
|
+
bypassCache: true,
|
|
254
|
+
};
|
|
255
|
+
const client = createAttioClient(config);
|
|
256
|
+
debug('attio-client', 'Returning fresh E2E client');
|
|
257
|
+
return client;
|
|
269
258
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
: 'context configuration';
|
|
276
|
-
try {
|
|
277
|
-
validateAndThrowForApiKey(apiKey, apiKeySource);
|
|
278
|
-
debug('attio-client', `Creating default client (auto-init from ${apiKeySource})`);
|
|
279
|
-
debug('attio-client', `API client not initialized, auto-initializing from ${apiKeySource}`, undefined, 'initialization', OperationType.SYSTEM);
|
|
280
|
-
apiInstance = createAttioClient(apiKey);
|
|
281
|
-
}
|
|
282
|
-
catch (validationError) {
|
|
283
|
-
const errorMessage = validationError instanceof Error
|
|
284
|
-
? validationError.message
|
|
285
|
-
: String(validationError);
|
|
286
|
-
throw new Error(`API client not initialized and no valid API key available. ${errorMessage} Call initializeAttioClient first or set ATTIO_API_KEY environment variable.`);
|
|
287
|
-
}
|
|
259
|
+
// Check cache first
|
|
260
|
+
const cachedClient = ClientCache.getInstance();
|
|
261
|
+
if (cachedClient) {
|
|
262
|
+
debug('attio-client', 'Returning cached client from ClientCache');
|
|
263
|
+
return cachedClient;
|
|
288
264
|
}
|
|
289
|
-
|
|
290
|
-
|
|
265
|
+
// Check legacy cache
|
|
266
|
+
if (apiInstance) {
|
|
267
|
+
debug('attio-client', 'Returning cached client from legacy apiInstance');
|
|
268
|
+
return apiInstance;
|
|
269
|
+
}
|
|
270
|
+
// No cached client - create new one
|
|
271
|
+
debug('attio-client', 'No cached client found - creating new client');
|
|
272
|
+
try {
|
|
273
|
+
const config = {}; // Use environment defaults
|
|
274
|
+
const client = createAttioClient(config);
|
|
275
|
+
// Cache the client in both new and legacy systems
|
|
276
|
+
ClientCache.setInstance(client);
|
|
277
|
+
apiInstance = client;
|
|
278
|
+
debug('attio-client', 'Created and cached new client');
|
|
279
|
+
return client;
|
|
280
|
+
}
|
|
281
|
+
catch (validationError) {
|
|
282
|
+
const errorMessage = validationError instanceof Error
|
|
283
|
+
? validationError.message
|
|
284
|
+
: String(validationError);
|
|
285
|
+
throw new Error(`API client not initialized and no valid API key available. ${errorMessage} Call initializeAttioClient first or set ATTIO_API_KEY environment variable.`);
|
|
291
286
|
}
|
|
292
|
-
return apiInstance;
|
|
293
287
|
}
|
|
294
288
|
//# sourceMappingURL=attio-client.js.map
|