@castleio/sdk 2.3.3 → 3.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/README.md +352 -31
- package/dist/index.d.mts +966 -0
- package/dist/index.d.ts +966 -8
- package/dist/index.js +1536 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1473 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -37
- package/CHANGELOG.md +0 -199
- package/dist/Castle.d.ts +0 -36
- package/dist/Castle.js +0 -194
- package/dist/Castle.js.map +0 -1
- package/dist/api/api.module.d.ts +0 -1
- package/dist/api/api.module.js +0 -18
- package/dist/api/api.module.js.map +0 -1
- package/dist/api/services/api-approve-device.service.d.ts +0 -5
- package/dist/api/services/api-approve-device.service.js +0 -26
- package/dist/api/services/api-approve-device.service.js.map +0 -1
- package/dist/api/services/api-archive-list-item.service.d.ts +0 -5
- package/dist/api/services/api-archive-list-item.service.js +0 -26
- package/dist/api/services/api-archive-list-item.service.js.map +0 -1
- package/dist/api/services/api-authenticate.service.d.ts +0 -6
- package/dist/api/services/api-authenticate.service.js +0 -58
- package/dist/api/services/api-authenticate.service.js.map +0 -1
- package/dist/api/services/api-batch-upsert-list-items.service.d.ts +0 -5
- package/dist/api/services/api-batch-upsert-list-items.service.js +0 -26
- package/dist/api/services/api-batch-upsert-list-items.service.js.map +0 -1
- package/dist/api/services/api-count-list-items.service.d.ts +0 -5
- package/dist/api/services/api-count-list-items.service.js +0 -26
- package/dist/api/services/api-count-list-items.service.js.map +0 -1
- package/dist/api/services/api-create-list-item.service.d.ts +0 -5
- package/dist/api/services/api-create-list-item.service.js +0 -26
- package/dist/api/services/api-create-list-item.service.js.map +0 -1
- package/dist/api/services/api-create-list.service.d.ts +0 -5
- package/dist/api/services/api-create-list.service.js +0 -26
- package/dist/api/services/api-create-list.service.js.map +0 -1
- package/dist/api/services/api-delete-list.service.d.ts +0 -5
- package/dist/api/services/api-delete-list.service.js +0 -26
- package/dist/api/services/api-delete-list.service.js.map +0 -1
- package/dist/api/services/api-delete-user-data.service.d.ts +0 -5
- package/dist/api/services/api-delete-user-data.service.js +0 -26
- package/dist/api/services/api-delete-user-data.service.js.map +0 -1
- package/dist/api/services/api-fetch-all-lists.service.d.ts +0 -4
- package/dist/api/services/api-fetch-all-lists.service.js +0 -26
- package/dist/api/services/api-fetch-all-lists.service.js.map +0 -1
- package/dist/api/services/api-fetch-list-item.service.d.ts +0 -5
- package/dist/api/services/api-fetch-list-item.service.js +0 -26
- package/dist/api/services/api-fetch-list-item.service.js.map +0 -1
- package/dist/api/services/api-fetch-list.service.d.ts +0 -5
- package/dist/api/services/api-fetch-list.service.js +0 -26
- package/dist/api/services/api-fetch-list.service.js.map +0 -1
- package/dist/api/services/api-filter.service.d.ts +0 -5
- package/dist/api/services/api-filter.service.js +0 -57
- package/dist/api/services/api-filter.service.js.map +0 -1
- package/dist/api/services/api-get-device.service.d.ts +0 -5
- package/dist/api/services/api-get-device.service.js +0 -26
- package/dist/api/services/api-get-device.service.js.map +0 -1
- package/dist/api/services/api-get-devices-for-user.service.d.ts +0 -5
- package/dist/api/services/api-get-devices-for-user.service.js +0 -26
- package/dist/api/services/api-get-devices-for-user.service.js.map +0 -1
- package/dist/api/services/api-get-events-schema.service.d.ts +0 -5
- package/dist/api/services/api-get-events-schema.service.js +0 -26
- package/dist/api/services/api-get-events-schema.service.js.map +0 -1
- package/dist/api/services/api-group-events.service.d.ts +0 -5
- package/dist/api/services/api-group-events.service.js +0 -26
- package/dist/api/services/api-group-events.service.js.map +0 -1
- package/dist/api/services/api-log.service.d.ts +0 -5
- package/dist/api/services/api-log.service.js +0 -26
- package/dist/api/services/api-log.service.js.map +0 -1
- package/dist/api/services/api-report-device.service.d.ts +0 -5
- package/dist/api/services/api-report-device.service.js +0 -26
- package/dist/api/services/api-report-device.service.js.map +0 -1
- package/dist/api/services/api-request-user-data.service.d.ts +0 -5
- package/dist/api/services/api-request-user-data.service.js +0 -26
- package/dist/api/services/api-request-user-data.service.js.map +0 -1
- package/dist/api/services/api-risk.service.d.ts +0 -5
- package/dist/api/services/api-risk.service.js +0 -57
- package/dist/api/services/api-risk.service.js.map +0 -1
- package/dist/api/services/api-search-events.service.d.ts +0 -5
- package/dist/api/services/api-search-events.service.js +0 -26
- package/dist/api/services/api-search-events.service.js.map +0 -1
- package/dist/api/services/api-search-list-items.service.d.ts +0 -5
- package/dist/api/services/api-search-list-items.service.js +0 -26
- package/dist/api/services/api-search-list-items.service.js.map +0 -1
- package/dist/api/services/api-search-lists.service.d.ts +0 -5
- package/dist/api/services/api-search-lists.service.js +0 -26
- package/dist/api/services/api-search-lists.service.js.map +0 -1
- package/dist/api/services/api-track.service.d.ts +0 -5
- package/dist/api/services/api-track.service.js +0 -26
- package/dist/api/services/api-track.service.js.map +0 -1
- package/dist/api/services/api-unarchive-list-item.service.d.ts +0 -5
- package/dist/api/services/api-unarchive-list-item.service.js +0 -26
- package/dist/api/services/api-unarchive-list-item.service.js.map +0 -1
- package/dist/api/services/api-update-list-item.service.d.ts +0 -5
- package/dist/api/services/api-update-list-item.service.js +0 -26
- package/dist/api/services/api-update-list-item.service.js.map +0 -1
- package/dist/api/services/api-update-list.service.d.ts +0 -5
- package/dist/api/services/api-update-list.service.js +0 -26
- package/dist/api/services/api-update-list.service.js.map +0 -1
- package/dist/api/services/api.service.d.ts +0 -8
- package/dist/api/services/api.service.js +0 -40
- package/dist/api/services/api.service.js.map +0 -1
- package/dist/api/services/index.d.ts +0 -29
- package/dist/api/services/index.js +0 -46
- package/dist/api/services/index.js.map +0 -1
- package/dist/client-id/client-id.module.d.ts +0 -1
- package/dist/client-id/client-id.module.js +0 -18
- package/dist/client-id/client-id.module.js.map +0 -1
- package/dist/client-id/services/client-id-extract.service.d.ts +0 -4
- package/dist/client-id/services/client-id-extract.service.js +0 -12
- package/dist/client-id/services/client-id-extract.service.js.map +0 -1
- package/dist/client-id/services/index.d.ts +0 -1
- package/dist/client-id/services/index.js +0 -18
- package/dist/client-id/services/index.js.map +0 -1
- package/dist/command/command.module.d.ts +0 -1
- package/dist/command/command.module.js +0 -18
- package/dist/command/command.module.js.map +0 -1
- package/dist/command/services/command-approve-device.service.d.ts +0 -16
- package/dist/command/services/command-approve-device.service.js +0 -12
- package/dist/command/services/command-approve-device.service.js.map +0 -1
- package/dist/command/services/command-archive-list-item.service.d.ts +0 -16
- package/dist/command/services/command-archive-list-item.service.js +0 -12
- package/dist/command/services/command-archive-list-item.service.js.map +0 -1
- package/dist/command/services/command-authenticate.service.d.ts +0 -16
- package/dist/command/services/command-authenticate.service.js +0 -12
- package/dist/command/services/command-authenticate.service.js.map +0 -1
- package/dist/command/services/command-batch-upsert-list-items.service.d.ts +0 -16
- package/dist/command/services/command-batch-upsert-list-items.service.js +0 -12
- package/dist/command/services/command-batch-upsert-list-items.service.js.map +0 -1
- package/dist/command/services/command-count-list-items.service.d.ts +0 -16
- package/dist/command/services/command-count-list-items.service.js +0 -12
- package/dist/command/services/command-count-list-items.service.js.map +0 -1
- package/dist/command/services/command-create-list-item.service.d.ts +0 -16
- package/dist/command/services/command-create-list-item.service.js +0 -12
- package/dist/command/services/command-create-list-item.service.js.map +0 -1
- package/dist/command/services/command-create-list.service.d.ts +0 -16
- package/dist/command/services/command-create-list.service.js +0 -10
- package/dist/command/services/command-create-list.service.js.map +0 -1
- package/dist/command/services/command-delete-list.service.d.ts +0 -16
- package/dist/command/services/command-delete-list.service.js +0 -12
- package/dist/command/services/command-delete-list.service.js.map +0 -1
- package/dist/command/services/command-delete-user-data.service.d.ts +0 -16
- package/dist/command/services/command-delete-user-data.service.js +0 -10
- package/dist/command/services/command-delete-user-data.service.js.map +0 -1
- package/dist/command/services/command-fetch-all-lists.service.d.ts +0 -15
- package/dist/command/services/command-fetch-all-lists.service.js +0 -10
- package/dist/command/services/command-fetch-all-lists.service.js.map +0 -1
- package/dist/command/services/command-fetch-list-item.service.d.ts +0 -16
- package/dist/command/services/command-fetch-list-item.service.js +0 -12
- package/dist/command/services/command-fetch-list-item.service.js.map +0 -1
- package/dist/command/services/command-fetch-list.service.d.ts +0 -16
- package/dist/command/services/command-fetch-list.service.js +0 -12
- package/dist/command/services/command-fetch-list.service.js.map +0 -1
- package/dist/command/services/command-filter.service.d.ts +0 -16
- package/dist/command/services/command-filter.service.js +0 -12
- package/dist/command/services/command-filter.service.js.map +0 -1
- package/dist/command/services/command-generate.service.d.ts +0 -17
- package/dist/command/services/command-generate.service.js +0 -18
- package/dist/command/services/command-generate.service.js.map +0 -1
- package/dist/command/services/command-get-device.service.d.ts +0 -16
- package/dist/command/services/command-get-device.service.js +0 -12
- package/dist/command/services/command-get-device.service.js.map +0 -1
- package/dist/command/services/command-get-devices-for-user.service.d.ts +0 -16
- package/dist/command/services/command-get-devices-for-user.service.js +0 -12
- package/dist/command/services/command-get-devices-for-user.service.js.map +0 -1
- package/dist/command/services/command-get-events-schema.service.d.ts +0 -15
- package/dist/command/services/command-get-events-schema.service.js +0 -10
- package/dist/command/services/command-get-events-schema.service.js.map +0 -1
- package/dist/command/services/command-group-events.service.d.ts +0 -16
- package/dist/command/services/command-group-events.service.js +0 -10
- package/dist/command/services/command-group-events.service.js.map +0 -1
- package/dist/command/services/command-log.service.d.ts +0 -16
- package/dist/command/services/command-log.service.js +0 -12
- package/dist/command/services/command-log.service.js.map +0 -1
- package/dist/command/services/command-report-device.service.d.ts +0 -16
- package/dist/command/services/command-report-device.service.js +0 -12
- package/dist/command/services/command-report-device.service.js.map +0 -1
- package/dist/command/services/command-request-user-data.service.d.ts +0 -16
- package/dist/command/services/command-request-user-data.service.js +0 -10
- package/dist/command/services/command-request-user-data.service.js.map +0 -1
- package/dist/command/services/command-risk.service.d.ts +0 -16
- package/dist/command/services/command-risk.service.js +0 -12
- package/dist/command/services/command-risk.service.js.map +0 -1
- package/dist/command/services/command-search-events.service.d.ts +0 -16
- package/dist/command/services/command-search-events.service.js +0 -10
- package/dist/command/services/command-search-events.service.js.map +0 -1
- package/dist/command/services/command-search-list-items.service.d.ts +0 -16
- package/dist/command/services/command-search-list-items.service.js +0 -12
- package/dist/command/services/command-search-list-items.service.js.map +0 -1
- package/dist/command/services/command-search-lists.service.d.ts +0 -16
- package/dist/command/services/command-search-lists.service.js +0 -10
- package/dist/command/services/command-search-lists.service.js.map +0 -1
- package/dist/command/services/command-track.service.d.ts +0 -16
- package/dist/command/services/command-track.service.js +0 -12
- package/dist/command/services/command-track.service.js.map +0 -1
- package/dist/command/services/command-unarchive-list-item.service.d.ts +0 -16
- package/dist/command/services/command-unarchive-list-item.service.js +0 -12
- package/dist/command/services/command-unarchive-list-item.service.js.map +0 -1
- package/dist/command/services/command-update-list-item.service.d.ts +0 -16
- package/dist/command/services/command-update-list-item.service.js +0 -12
- package/dist/command/services/command-update-list-item.service.js.map +0 -1
- package/dist/command/services/command-update-list.service.d.ts +0 -16
- package/dist/command/services/command-update-list.service.js +0 -12
- package/dist/command/services/command-update-list.service.js.map +0 -1
- package/dist/command/services/index.d.ts +0 -29
- package/dist/command/services/index.js +0 -46
- package/dist/command/services/index.js.map +0 -1
- package/dist/configuration.d.ts +0 -32
- package/dist/configuration.js +0 -34
- package/dist/configuration.js.map +0 -1
- package/dist/constants.d.ts +0 -4
- package/dist/constants.js +0 -42
- package/dist/constants.js.map +0 -1
- package/dist/context/context.module.d.ts +0 -1
- package/dist/context/context.module.js +0 -18
- package/dist/context/context.module.js.map +0 -1
- package/dist/context/services/context-get-default.service.d.ts +0 -9
- package/dist/context/services/context-get-default.service.js +0 -34
- package/dist/context/services/context-get-default.service.js.map +0 -1
- package/dist/context/services/context-prepare.service.d.ts +0 -9
- package/dist/context/services/context-prepare.service.js +0 -15
- package/dist/context/services/context-prepare.service.js.map +0 -1
- package/dist/context/services/context-sanitize.service.d.ts +0 -7
- package/dist/context/services/context-sanitize.service.js +0 -19
- package/dist/context/services/context-sanitize.service.js.map +0 -1
- package/dist/context/services/index.d.ts +0 -3
- package/dist/context/services/index.js +0 -20
- package/dist/context/services/index.js.map +0 -1
- package/dist/core/core.module.d.ts +0 -1
- package/dist/core/core.module.js +0 -18
- package/dist/core/core.module.js.map +0 -1
- package/dist/core/services/core-generate-default-headers.service.d.ts +0 -7
- package/dist/core/services/core-generate-default-headers.service.js +0 -12
- package/dist/core/services/core-generate-default-headers.service.js.map +0 -1
- package/dist/core/services/core-generate-request-body.service.d.ts +0 -5
- package/dist/core/services/core-generate-request-body.service.js +0 -9
- package/dist/core/services/core-generate-request-body.service.js.map +0 -1
- package/dist/core/services/core-process-response.service.d.ts +0 -3
- package/dist/core/services/core-process-response.service.js +0 -61
- package/dist/core/services/core-process-response.service.js.map +0 -1
- package/dist/core/services/index.d.ts +0 -3
- package/dist/core/services/index.js +0 -20
- package/dist/core/services/index.js.map +0 -1
- package/dist/errors.d.ts +0 -36
- package/dist/errors.js +0 -88
- package/dist/errors.js.map +0 -1
- package/dist/failover/failover.module.d.ts +0 -1
- package/dist/failover/failover.module.js +0 -18
- package/dist/failover/failover.module.js.map +0 -1
- package/dist/failover/models/failover-strategy.d.ts +0 -6
- package/dist/failover/models/failover-strategy.js +0 -11
- package/dist/failover/models/failover-strategy.js.map +0 -1
- package/dist/failover/models/index.d.ts +0 -1
- package/dist/failover/models/index.js +0 -18
- package/dist/failover/models/index.js.map +0 -1
- package/dist/headers/headers.module.d.ts +0 -1
- package/dist/headers/headers.module.js +0 -18
- package/dist/headers/headers.module.js.map +0 -1
- package/dist/headers/services/headers-extract.service.d.ts +0 -9
- package/dist/headers/services/headers-extract.service.js +0 -30
- package/dist/headers/services/headers-extract.service.js.map +0 -1
- package/dist/headers/services/headers-get-cookie.service.d.ts +0 -3
- package/dist/headers/services/headers-get-cookie.service.js +0 -17
- package/dist/headers/services/headers-get-cookie.service.js.map +0 -1
- package/dist/headers/services/index.d.ts +0 -2
- package/dist/headers/services/index.js +0 -19
- package/dist/headers/services/index.js.map +0 -1
- package/dist/ips/ips.module.d.ts +0 -1
- package/dist/ips/ips.module.js +0 -18
- package/dist/ips/ips.module.js.map +0 -1
- package/dist/ips/services/index.d.ts +0 -1
- package/dist/ips/services/index.js +0 -18
- package/dist/ips/services/index.js.map +0 -1
- package/dist/ips/services/ips-extract.service.d.ts +0 -5
- package/dist/ips/services/ips-extract.service.js +0 -50
- package/dist/ips/services/ips-extract.service.js.map +0 -1
- package/dist/logger/logger.module.d.ts +0 -2
- package/dist/logger/logger.module.js +0 -19
- package/dist/logger/logger.module.js.map +0 -1
- package/dist/logger/models/index.d.ts +0 -1
- package/dist/logger/models/index.js +0 -18
- package/dist/logger/models/index.js.map +0 -1
- package/dist/logger/models/logging-parameters.d.ts +0 -7
- package/dist/logger/models/logging-parameters.js +0 -3
- package/dist/logger/models/logging-parameters.js.map +0 -1
- package/dist/logger/services/index.d.ts +0 -4
- package/dist/logger/services/index.js +0 -21
- package/dist/logger/services/index.js.map +0 -1
- package/dist/logger/services/logger-error-formatter.service.d.ts +0 -3
- package/dist/logger/services/logger-error-formatter.service.js +0 -10
- package/dist/logger/services/logger-error-formatter.service.js.map +0 -1
- package/dist/logger/services/logger-request-formatter.service.d.ts +0 -4
- package/dist/logger/services/logger-request-formatter.service.js +0 -16
- package/dist/logger/services/logger-request-formatter.service.js.map +0 -1
- package/dist/logger/services/logger-response-formatter.service.d.ts +0 -3
- package/dist/logger/services/logger-response-formatter.service.js +0 -10
- package/dist/logger/services/logger-response-formatter.service.js.map +0 -1
- package/dist/logger/services/logger.service.d.ts +0 -4
- package/dist/logger/services/logger.service.js +0 -25
- package/dist/logger/services/logger.service.js.map +0 -1
- package/dist/models/action.d.ts +0 -5
- package/dist/models/action.js +0 -10
- package/dist/models/action.js.map +0 -1
- package/dist/models/authenticate-result.d.ts +0 -18
- package/dist/models/authenticate-result.js +0 -3
- package/dist/models/authenticate-result.js.map +0 -1
- package/dist/models/device.d.ts +0 -3
- package/dist/models/device.js +0 -3
- package/dist/models/device.js.map +0 -1
- package/dist/models/events.d.ts +0 -17
- package/dist/models/events.js +0 -23
- package/dist/models/events.js.map +0 -1
- package/dist/models/index.d.ts +0 -8
- package/dist/models/index.js +0 -25
- package/dist/models/index.js.map +0 -1
- package/dist/models/list-item.d.ts +0 -15
- package/dist/models/list-item.js +0 -3
- package/dist/models/list-item.js.map +0 -1
- package/dist/models/list.d.ts +0 -11
- package/dist/models/list.js +0 -3
- package/dist/models/list.js.map +0 -1
- package/dist/models/risk-policy.d.ts +0 -9
- package/dist/models/risk-policy.js +0 -3
- package/dist/models/risk-policy.js.map +0 -1
- package/dist/models/signals.d.ts +0 -3
- package/dist/models/signals.js +0 -3
- package/dist/models/signals.js.map +0 -1
- package/dist/payload/models/address_payload.d.ts +0 -8
- package/dist/payload/models/address_payload.js +0 -3
- package/dist/payload/models/address_payload.js.map +0 -1
- package/dist/payload/models/device_payload.d.ts +0 -7
- package/dist/payload/models/device_payload.js +0 -3
- package/dist/payload/models/device_payload.js.map +0 -1
- package/dist/payload/models/event_payload.d.ts +0 -89
- package/dist/payload/models/event_payload.js +0 -29
- package/dist/payload/models/event_payload.js.map +0 -1
- package/dist/payload/models/event_response.d.ts +0 -346
- package/dist/payload/models/event_response.js +0 -51
- package/dist/payload/models/event_response.js.map +0 -1
- package/dist/payload/models/filter_payload.d.ts +0 -68
- package/dist/payload/models/filter_payload.js +0 -3
- package/dist/payload/models/filter_payload.js.map +0 -1
- package/dist/payload/models/index.d.ts +0 -11
- package/dist/payload/models/index.js +0 -28
- package/dist/payload/models/index.js.map +0 -1
- package/dist/payload/models/list-payload.d.ts +0 -26
- package/dist/payload/models/list-payload.js +0 -3
- package/dist/payload/models/list-payload.js.map +0 -1
- package/dist/payload/models/list_item_payload.d.ts +0 -45
- package/dist/payload/models/list_item_payload.js +0 -3
- package/dist/payload/models/list_item_payload.js.map +0 -1
- package/dist/payload/models/log_payload.d.ts +0 -42
- package/dist/payload/models/log_payload.js +0 -3
- package/dist/payload/models/log_payload.js.map +0 -1
- package/dist/payload/models/payload.d.ts +0 -15
- package/dist/payload/models/payload.js +0 -3
- package/dist/payload/models/payload.js.map +0 -1
- package/dist/payload/models/privacy_payload.d.ts +0 -8
- package/dist/payload/models/privacy_payload.js +0 -3
- package/dist/payload/models/privacy_payload.js.map +0 -1
- package/dist/payload/models/risk_payload.d.ts +0 -75
- package/dist/payload/models/risk_payload.js +0 -3
- package/dist/payload/models/risk_payload.js.map +0 -1
- package/dist/payload/payload.module.d.ts +0 -2
- package/dist/payload/payload.module.js +0 -19
- package/dist/payload/payload.module.js.map +0 -1
- package/dist/payload/services/index.d.ts +0 -1
- package/dist/payload/services/index.js +0 -18
- package/dist/payload/services/index.js.map +0 -1
- package/dist/payload/services/payload-prepare-service.d.ts +0 -13
- package/dist/payload/services/payload-prepare-service.js +0 -15
- package/dist/payload/services/payload-prepare-service.js.map +0 -1
- package/dist/validator/services/index.d.ts +0 -1
- package/dist/validator/services/index.js +0 -18
- package/dist/validator/services/index.js.map +0 -1
- package/dist/validator/services/validator-present.service.d.ts +0 -3
- package/dist/validator/services/validator-present.service.js +0 -15
- package/dist/validator/services/validator-present.service.js.map +0 -1
- package/dist/validator/validator.module.d.ts +0 -1
- package/dist/validator/validator.module.js +0 -18
- package/dist/validator/validator.module.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,1538 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
APIError: () => APIError,
|
|
34
|
+
Action: () => Action,
|
|
35
|
+
BadRequestError: () => BadRequestError,
|
|
36
|
+
Castle: () => Castle,
|
|
37
|
+
ConfigurationError: () => ConfigurationError,
|
|
38
|
+
ContextPrepareService: () => ContextPrepareService,
|
|
39
|
+
DEFAULT_ALLOWLIST: () => DEFAULT_ALLOWLIST,
|
|
40
|
+
DEFAULT_API_URL: () => DEFAULT_API_URL,
|
|
41
|
+
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
42
|
+
EventAuthenticationMethod: () => EventAuthenticationMethod,
|
|
43
|
+
EventSignal: () => EventSignal,
|
|
44
|
+
EventStatus: () => EventStatus,
|
|
45
|
+
EventType: () => EventType,
|
|
46
|
+
FailoverStrategy: () => FailoverStrategy,
|
|
47
|
+
ForbiddenError: () => ForbiddenError,
|
|
48
|
+
InternalServerError: () => InternalServerError,
|
|
49
|
+
InvalidParametersError: () => InvalidParametersError,
|
|
50
|
+
InvalidRequestTokenError: () => InvalidRequestTokenError,
|
|
51
|
+
NotFoundError: () => NotFoundError,
|
|
52
|
+
PayloadPrepareService: () => PayloadPrepareService,
|
|
53
|
+
RateLimitError: () => RateLimitError,
|
|
54
|
+
SearchEventsQueryFilterOperator: () => SearchEventsQueryFilterOperator,
|
|
55
|
+
SearchEventsQueryType: () => SearchEventsQueryType,
|
|
56
|
+
SecureModeService: () => SecureModeService,
|
|
57
|
+
TRUSTED_PROXIES: () => TRUSTED_PROXIES,
|
|
58
|
+
UnauthorizedError: () => UnauthorizedError,
|
|
59
|
+
UserUnauthorizedError: () => UserUnauthorizedError,
|
|
60
|
+
WebhookVerificationError: () => WebhookVerificationError,
|
|
61
|
+
WebhookVerifyService: () => WebhookVerifyService
|
|
62
|
+
});
|
|
63
|
+
module.exports = __toCommonJS(index_exports);
|
|
64
|
+
|
|
65
|
+
// src/core/services/core-generate-default-headers.service.ts
|
|
66
|
+
var CoreGenerateDefaultHeadersService = {
|
|
67
|
+
call: (configuration) => {
|
|
68
|
+
return {
|
|
69
|
+
Authorization: `Basic ${Buffer.from(
|
|
70
|
+
`:${configuration.apiSecret}`
|
|
71
|
+
).toString("base64")}`,
|
|
72
|
+
"Content-Type": "application/json"
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/core/services/core-generate-request-body.service.ts
|
|
78
|
+
var CoreGenerateRequestBody = {
|
|
79
|
+
call: (payload) => {
|
|
80
|
+
return JSON.stringify({
|
|
81
|
+
sent_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
82
|
+
...payload
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// src/errors.ts
|
|
88
|
+
var ConfigurationError = class extends Error {
|
|
89
|
+
constructor(message) {
|
|
90
|
+
super(message);
|
|
91
|
+
this.name = "ConfigurationError";
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var APIError = class extends Error {
|
|
95
|
+
constructor(message) {
|
|
96
|
+
super(message);
|
|
97
|
+
this.name = "APIError";
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var BadRequestError = class extends APIError {
|
|
101
|
+
constructor(message) {
|
|
102
|
+
super(message);
|
|
103
|
+
this.name = "BadRequestError";
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var UnauthorizedError = class extends APIError {
|
|
107
|
+
constructor(message) {
|
|
108
|
+
super(message);
|
|
109
|
+
this.name = "UnauthorizedError";
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var ForbiddenError = class extends APIError {
|
|
113
|
+
constructor(message) {
|
|
114
|
+
super(message);
|
|
115
|
+
this.name = "ForbiddenError";
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var NotFoundError = class extends APIError {
|
|
119
|
+
constructor(message) {
|
|
120
|
+
super(message);
|
|
121
|
+
this.name = "NotFoundError";
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var UserUnauthorizedError = class extends APIError {
|
|
125
|
+
constructor(message) {
|
|
126
|
+
super(message);
|
|
127
|
+
this.name = "UserUnauthorizedError";
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var InvalidParametersError = class extends APIError {
|
|
131
|
+
constructor(message) {
|
|
132
|
+
super(message);
|
|
133
|
+
this.name = "InvalidParametersError";
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var InvalidRequestTokenError = class extends InvalidParametersError {
|
|
137
|
+
constructor(message) {
|
|
138
|
+
super(message);
|
|
139
|
+
this.name = "InvalidRequestTokenError";
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var RateLimitError = class extends APIError {
|
|
143
|
+
constructor(message) {
|
|
144
|
+
super(message);
|
|
145
|
+
this.name = "RateLimitError";
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var InternalServerError = class extends APIError {
|
|
149
|
+
constructor(message) {
|
|
150
|
+
super(message);
|
|
151
|
+
this.name = "InternalServerError";
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var WebhookVerificationError = class extends Error {
|
|
155
|
+
constructor(message) {
|
|
156
|
+
super(message);
|
|
157
|
+
this.name = "WebhookVerificationError";
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/logger/services/logger-error-formatter.service.ts
|
|
162
|
+
var LoggerErrorFormatterService = {
|
|
163
|
+
call: (err) => err ? `
|
|
164
|
+
Error name: ${err.name}
|
|
165
|
+
Error message: ${err.message}
|
|
166
|
+
`.trim() : ""
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// src/logger/services/logger-request-formatter.service.ts
|
|
170
|
+
var LoggerRequestFormatterService = {
|
|
171
|
+
call: ({
|
|
172
|
+
requestUrl,
|
|
173
|
+
requestOptions,
|
|
174
|
+
response,
|
|
175
|
+
err,
|
|
176
|
+
body
|
|
177
|
+
}) => `
|
|
178
|
+
-- Castle request
|
|
179
|
+
URL: ${requestUrl}
|
|
180
|
+
Request: ${JSON.stringify(requestOptions)}
|
|
181
|
+
-- Castle response
|
|
182
|
+
${response ? LoggerResponseFormatterService.call(response, body) : LoggerErrorFormatterService.call(err)}
|
|
183
|
+
`
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// src/logger/services/logger-response-formatter.service.ts
|
|
187
|
+
var LoggerResponseFormatterService = {
|
|
188
|
+
call: (response, body) => `
|
|
189
|
+
Response status: ${response.status}
|
|
190
|
+
Response body: ${JSON.stringify(body)}
|
|
191
|
+
`.trim()
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// src/logger/services/logger.service.ts
|
|
195
|
+
var LoggerService = {
|
|
196
|
+
call: async ({ requestUrl, requestOptions, response, body, err }, logger) => {
|
|
197
|
+
return logger.info(
|
|
198
|
+
LoggerRequestFormatterService.call({
|
|
199
|
+
requestUrl,
|
|
200
|
+
requestOptions,
|
|
201
|
+
response,
|
|
202
|
+
err,
|
|
203
|
+
body
|
|
204
|
+
})
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// src/core/services/core-process-response.service.ts
|
|
210
|
+
var RESPONSE_ERRORS = {
|
|
211
|
+
"400": BadRequestError,
|
|
212
|
+
"401": UnauthorizedError,
|
|
213
|
+
"403": ForbiddenError,
|
|
214
|
+
"404": NotFoundError,
|
|
215
|
+
"419": UserUnauthorizedError,
|
|
216
|
+
"422": InvalidParametersError,
|
|
217
|
+
"429": RateLimitError
|
|
218
|
+
};
|
|
219
|
+
var RESPONSE_SUB_ERRORS = {
|
|
220
|
+
invalid_request_token: InvalidRequestTokenError
|
|
221
|
+
};
|
|
222
|
+
var getBody = async (response) => {
|
|
223
|
+
if (response.cachedBody) {
|
|
224
|
+
return response.cachedBody;
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const preparsedResponse = await response.text();
|
|
228
|
+
if (preparsedResponse) {
|
|
229
|
+
response.cachedBody = await JSON.parse(preparsedResponse);
|
|
230
|
+
} else {
|
|
231
|
+
response.cachedBody = {};
|
|
232
|
+
}
|
|
233
|
+
} catch (e) {
|
|
234
|
+
throw new APIError("Castle: Malformed JSON response");
|
|
235
|
+
}
|
|
236
|
+
return response.cachedBody;
|
|
237
|
+
};
|
|
238
|
+
var CoreProcessResponseService = {
|
|
239
|
+
call: async (requestUrl, requestOptions, response, logger) => {
|
|
240
|
+
const body = await getBody(response);
|
|
241
|
+
LoggerService.call({ requestUrl, requestOptions, response, body }, logger);
|
|
242
|
+
if (response.status >= 200 && response.status <= 299) {
|
|
243
|
+
return body;
|
|
244
|
+
}
|
|
245
|
+
if (response.status >= 500 && response.status <= 599) {
|
|
246
|
+
throw new InternalServerError(
|
|
247
|
+
`Castle: Responded with ${response.status} code`
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
const err = RESPONSE_SUB_ERRORS[body.type] || RESPONSE_ERRORS[response.status.toString()] || APIError;
|
|
251
|
+
throw new err(`Castle: Responded with ${response.status} code`);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// src/api/services/api.service.ts
|
|
256
|
+
var APIService = {
|
|
257
|
+
call: async (controller, { requestUrl, requestOptions }, configuration) => {
|
|
258
|
+
const fetcher = configuration.overrideFetch || fetch;
|
|
259
|
+
let response;
|
|
260
|
+
const timeout = setTimeout(() => {
|
|
261
|
+
controller.abort();
|
|
262
|
+
}, configuration.timeout);
|
|
263
|
+
try {
|
|
264
|
+
response = await fetcher(requestUrl, requestOptions);
|
|
265
|
+
} catch (err) {
|
|
266
|
+
LoggerService.call(
|
|
267
|
+
{ requestUrl, requestOptions, err },
|
|
268
|
+
configuration.logger
|
|
269
|
+
);
|
|
270
|
+
throw err;
|
|
271
|
+
} finally {
|
|
272
|
+
clearTimeout(timeout);
|
|
273
|
+
}
|
|
274
|
+
const processedResponse = await CoreProcessResponseService.call(
|
|
275
|
+
requestUrl,
|
|
276
|
+
requestOptions,
|
|
277
|
+
response,
|
|
278
|
+
configuration.logger
|
|
279
|
+
);
|
|
280
|
+
return processedResponse;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/command/services/command-generate.service.ts
|
|
285
|
+
var combineURLs = (baseURL, relativeURL) => {
|
|
286
|
+
return baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "");
|
|
287
|
+
};
|
|
288
|
+
var CommandGenerateService = {
|
|
289
|
+
call: (controller, path, options, method, configuration) => {
|
|
290
|
+
return {
|
|
291
|
+
requestUrl: new URL(combineURLs(configuration.baseUrl.toString(), path)),
|
|
292
|
+
requestOptions: {
|
|
293
|
+
signal: controller.signal,
|
|
294
|
+
method,
|
|
295
|
+
headers: CoreGenerateDefaultHeadersService.call(configuration),
|
|
296
|
+
...method !== "GET" && {
|
|
297
|
+
body: CoreGenerateRequestBody.call(options)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/utils/object.ts
|
|
305
|
+
var isPlainObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
306
|
+
var deepMerge = (target, ...sources) => {
|
|
307
|
+
for (const source of sources) {
|
|
308
|
+
if (source === null || source === void 0) {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
for (const key of Object.keys(source)) {
|
|
312
|
+
const sourceValue = source[key];
|
|
313
|
+
const targetValue = target[key];
|
|
314
|
+
if (sourceValue === void 0) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
|
|
318
|
+
deepMerge(targetValue, sourceValue);
|
|
319
|
+
} else if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
320
|
+
deepMerge(targetValue, sourceValue);
|
|
321
|
+
} else if (isPlainObject(sourceValue)) {
|
|
322
|
+
target[key] = deepMerge({}, sourceValue);
|
|
323
|
+
} else if (Array.isArray(sourceValue)) {
|
|
324
|
+
target[key] = deepMerge([], sourceValue);
|
|
325
|
+
} else {
|
|
326
|
+
target[key] = sourceValue;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return target;
|
|
331
|
+
};
|
|
332
|
+
var isEmpty = (value) => {
|
|
333
|
+
if (value === null || value === void 0) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
if (Array.isArray(value) || typeof value === "string") {
|
|
337
|
+
return value.length === 0;
|
|
338
|
+
}
|
|
339
|
+
if (value instanceof Map || value instanceof Set) {
|
|
340
|
+
return value.size === 0;
|
|
341
|
+
}
|
|
342
|
+
if (typeof value === "object") {
|
|
343
|
+
return Object.keys(value).length === 0;
|
|
344
|
+
}
|
|
345
|
+
return true;
|
|
346
|
+
};
|
|
347
|
+
var pickByTruthy = (object) => Object.entries(object).reduce((accumulator, [key, value]) => {
|
|
348
|
+
if (value) {
|
|
349
|
+
accumulator[key] = value;
|
|
350
|
+
}
|
|
351
|
+
return accumulator;
|
|
352
|
+
}, {});
|
|
353
|
+
|
|
354
|
+
// src/headers/services/headers-extract.service.ts
|
|
355
|
+
var ALWAYS_ALLOWLISTED = ["user-agent"];
|
|
356
|
+
var ALWAYS_DENYLISTED = ["cookie", "authorization"];
|
|
357
|
+
var HeadersExtractService = {
|
|
358
|
+
call: (headers, configuration) => {
|
|
359
|
+
return Object.entries(headers).reduce(
|
|
360
|
+
(accumulator, [key, value]) => {
|
|
361
|
+
if (ALWAYS_DENYLISTED.includes(key.toLowerCase())) {
|
|
362
|
+
return {
|
|
363
|
+
...accumulator,
|
|
364
|
+
[key]: true
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
if (ALWAYS_ALLOWLISTED.includes(key.toLowerCase())) {
|
|
368
|
+
return {
|
|
369
|
+
...accumulator,
|
|
370
|
+
[key]: value
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
if (configuration.denylisted.includes(key.toLowerCase())) {
|
|
374
|
+
return {
|
|
375
|
+
...accumulator,
|
|
376
|
+
[key]: true
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (configuration.allowlisted.length === 0 || configuration.allowlisted.includes(key.toLowerCase())) {
|
|
380
|
+
return {
|
|
381
|
+
...accumulator,
|
|
382
|
+
[key]: value
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
...accumulator,
|
|
387
|
+
[key]: true
|
|
388
|
+
};
|
|
389
|
+
},
|
|
390
|
+
{}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// src/constants.ts
|
|
396
|
+
var DEFAULT_API_URL = "https://api.castle.io/v1";
|
|
397
|
+
var DEFAULT_TIMEOUT = 1500;
|
|
398
|
+
var DEFAULT_ALLOWLIST = [
|
|
399
|
+
"accept",
|
|
400
|
+
"accept-charset",
|
|
401
|
+
"accept-datetime",
|
|
402
|
+
"accept-encoding",
|
|
403
|
+
"accept-language",
|
|
404
|
+
"cache-control",
|
|
405
|
+
"connection",
|
|
406
|
+
"content-length",
|
|
407
|
+
"content-type",
|
|
408
|
+
"dnt",
|
|
409
|
+
"host",
|
|
410
|
+
"origin",
|
|
411
|
+
"pragma",
|
|
412
|
+
"referer",
|
|
413
|
+
"sec-fetch-dest",
|
|
414
|
+
"sec-fetch-mode",
|
|
415
|
+
"sec-fetch-site",
|
|
416
|
+
"sec-fetch-user",
|
|
417
|
+
"te",
|
|
418
|
+
"upgrade-insecure-requests",
|
|
419
|
+
"user-agent",
|
|
420
|
+
"x-requested-with"
|
|
421
|
+
];
|
|
422
|
+
var TRUSTED_PROXIES = [
|
|
423
|
+
new RegExp(
|
|
424
|
+
[
|
|
425
|
+
/^127\.0\.0\.1$|/,
|
|
426
|
+
/^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.|/,
|
|
427
|
+
/^::1\Z|\Afd[0-9a-f]{2}:.+|/,
|
|
428
|
+
/^localhost$|/,
|
|
429
|
+
/^unix$|/,
|
|
430
|
+
/^unix:/
|
|
431
|
+
].map((r) => r.source).join("")
|
|
432
|
+
)
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
// src/ips/services/ips-extract.service.ts
|
|
436
|
+
var DEFAULT = ["x-forwarded-for", "remote-addr"];
|
|
437
|
+
var DEPTH_RELATED = ["x-forwarded-for"];
|
|
438
|
+
var checkInternal = (ipAddress, proxies) => {
|
|
439
|
+
return proxies.some((proxyRegexp) => proxyRegexp.test(ipAddress));
|
|
440
|
+
};
|
|
441
|
+
var limitProxyDepth = (ips, ipHeader, trustedProxyDepth) => {
|
|
442
|
+
if (DEPTH_RELATED.includes(ipHeader)) {
|
|
443
|
+
ips.splice(ips.length - 1, trustedProxyDepth);
|
|
444
|
+
}
|
|
445
|
+
return ips;
|
|
446
|
+
};
|
|
447
|
+
var IPsFrom = (ipHeader, headers, trustedProxyDepth) => {
|
|
448
|
+
if (!headers) {
|
|
449
|
+
return [];
|
|
450
|
+
}
|
|
451
|
+
const headerValue = headers[ipHeader];
|
|
452
|
+
if (!headerValue) {
|
|
453
|
+
return [];
|
|
454
|
+
}
|
|
455
|
+
const ips = headerValue.trim().split(/[,\s]+/);
|
|
456
|
+
return limitProxyDepth(ips, ipHeader, trustedProxyDepth);
|
|
457
|
+
};
|
|
458
|
+
var removeProxies = (ips, trustProxyChain, proxiesList) => {
|
|
459
|
+
if (trustProxyChain) {
|
|
460
|
+
return ips[0];
|
|
461
|
+
}
|
|
462
|
+
const filteredIps = ips.filter((ip) => !checkInternal(ip, proxiesList));
|
|
463
|
+
return filteredIps[filteredIps.length - 1];
|
|
464
|
+
};
|
|
465
|
+
var IPsExtractService = {
|
|
466
|
+
call: (headers, {
|
|
467
|
+
ipHeaders = [],
|
|
468
|
+
trustedProxies = [],
|
|
469
|
+
trustProxyChain = false,
|
|
470
|
+
trustedProxyDepth = 0
|
|
471
|
+
}) => {
|
|
472
|
+
const ipHeadersList = ipHeaders.length ? ipHeaders : DEFAULT;
|
|
473
|
+
const proxiesList = trustedProxies.concat(TRUSTED_PROXIES);
|
|
474
|
+
let allIPs = [];
|
|
475
|
+
for (const ipHeader of ipHeadersList) {
|
|
476
|
+
const IPs = IPsFrom(ipHeader, headers, trustedProxyDepth);
|
|
477
|
+
const IPValue = removeProxies(IPs, trustProxyChain, proxiesList);
|
|
478
|
+
if (IPValue) {
|
|
479
|
+
return IPValue;
|
|
480
|
+
}
|
|
481
|
+
allIPs = [...allIPs, ...IPs];
|
|
482
|
+
}
|
|
483
|
+
return allIPs[0];
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// package.json
|
|
488
|
+
var version = "3.1.0";
|
|
489
|
+
|
|
490
|
+
// src/context/services/context-get-default.service.ts
|
|
491
|
+
var requestContextData = (request, configuration) => {
|
|
492
|
+
if (isEmpty(request)) {
|
|
493
|
+
return {};
|
|
494
|
+
}
|
|
495
|
+
return {
|
|
496
|
+
headers: HeadersExtractService.call(request.headers, configuration),
|
|
497
|
+
ip: IPsExtractService.call(request.headers, configuration)
|
|
498
|
+
};
|
|
499
|
+
};
|
|
500
|
+
var ContextGetDefaultService = {
|
|
501
|
+
call: (request, configuration) => {
|
|
502
|
+
return {
|
|
503
|
+
...pickByTruthy(requestContextData(request, configuration)),
|
|
504
|
+
library: {
|
|
505
|
+
name: "castle-node",
|
|
506
|
+
version
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
// src/context/services/context-prepare.service.ts
|
|
513
|
+
var ContextPrepareService = {
|
|
514
|
+
call: (request, options, configuration) => {
|
|
515
|
+
const defaultContext = ContextGetDefaultService.call(
|
|
516
|
+
request,
|
|
517
|
+
configuration
|
|
518
|
+
);
|
|
519
|
+
return deepMerge(defaultContext, options?.context);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
// src/context/services/context-sanitize.service.ts
|
|
524
|
+
var ContextSanitizeService = {
|
|
525
|
+
call: (context) => {
|
|
526
|
+
if (!context) {
|
|
527
|
+
return {};
|
|
528
|
+
}
|
|
529
|
+
if (!("active" in context)) {
|
|
530
|
+
return context;
|
|
531
|
+
}
|
|
532
|
+
if (typeof context.active === "boolean") {
|
|
533
|
+
return context;
|
|
534
|
+
}
|
|
535
|
+
delete context.active;
|
|
536
|
+
return context;
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
// src/command/services/command-filter.service.ts
|
|
541
|
+
var CommandFilterService = {
|
|
542
|
+
call: (controller, options, configuration) => {
|
|
543
|
+
const context = ContextSanitizeService.call(options.context);
|
|
544
|
+
return CommandGenerateService.call(
|
|
545
|
+
controller,
|
|
546
|
+
"filter",
|
|
547
|
+
{ ...options, ...{ context } },
|
|
548
|
+
"POST",
|
|
549
|
+
configuration
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
// src/command/services/command-log.service.ts
|
|
555
|
+
var CommandLogService = {
|
|
556
|
+
call: (controller, options, configuration) => {
|
|
557
|
+
const context = ContextSanitizeService.call(options.context);
|
|
558
|
+
return CommandGenerateService.call(
|
|
559
|
+
controller,
|
|
560
|
+
"log",
|
|
561
|
+
{ ...options, ...{ context } },
|
|
562
|
+
"POST",
|
|
563
|
+
configuration
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// src/command/services/command-risk.service.ts
|
|
569
|
+
var CommandRiskService = {
|
|
570
|
+
call: (controller, options, configuration) => {
|
|
571
|
+
const context = ContextSanitizeService.call(options.context);
|
|
572
|
+
return CommandGenerateService.call(
|
|
573
|
+
controller,
|
|
574
|
+
"risk",
|
|
575
|
+
{ ...options, ...{ context } },
|
|
576
|
+
"POST",
|
|
577
|
+
configuration
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/validator/services/validator-present.service.ts
|
|
583
|
+
var ValidatorPresentService = {
|
|
584
|
+
call: (options, keys) => {
|
|
585
|
+
for (const key of keys) {
|
|
586
|
+
if (options[key]) {
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
throw new InvalidParametersError(`Castle: ${key} is missing or empty`);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
// src/command/services/command-create-list-item.service.ts
|
|
595
|
+
var CommandCreateListItemService = {
|
|
596
|
+
call: (controller, options, configuration) => {
|
|
597
|
+
ValidatorPresentService.call(options, ["list_id"]);
|
|
598
|
+
return CommandGenerateService.call(
|
|
599
|
+
controller,
|
|
600
|
+
`lists/${options.list_id}/items`,
|
|
601
|
+
options,
|
|
602
|
+
"POST",
|
|
603
|
+
configuration
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
// src/command/services/command-search-list-items.service.ts
|
|
609
|
+
var CommandSearchListItemsService = {
|
|
610
|
+
call: (controller, options, configuration) => {
|
|
611
|
+
ValidatorPresentService.call(options, ["list_id"]);
|
|
612
|
+
return CommandGenerateService.call(
|
|
613
|
+
controller,
|
|
614
|
+
`lists/${options.list_id}/items/query`,
|
|
615
|
+
options,
|
|
616
|
+
"POST",
|
|
617
|
+
configuration
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
// src/command/services/command-update-list-item.service.ts
|
|
623
|
+
var CommandUpdateListItemService = {
|
|
624
|
+
call: (controller, options, configuration) => {
|
|
625
|
+
ValidatorPresentService.call(options, ["id", "list_id"]);
|
|
626
|
+
return CommandGenerateService.call(
|
|
627
|
+
controller,
|
|
628
|
+
`lists/${options.list_id}/items/${options.id}`,
|
|
629
|
+
options,
|
|
630
|
+
"PUT",
|
|
631
|
+
configuration
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// src/command/services/command-archive-list-item.service.ts
|
|
637
|
+
var CommandArchiveListItemService = {
|
|
638
|
+
call: (controller, options, configuration) => {
|
|
639
|
+
ValidatorPresentService.call(options, ["id", "list_id"]);
|
|
640
|
+
return CommandGenerateService.call(
|
|
641
|
+
controller,
|
|
642
|
+
`lists/${options.list_id}/items/${options.id}/archive`,
|
|
643
|
+
{},
|
|
644
|
+
"DELETE",
|
|
645
|
+
configuration
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
// src/command/services/command-unarchive-list-item.service.ts
|
|
651
|
+
var CommandUnarchiveListItemService = {
|
|
652
|
+
call: (controller, options, configuration) => {
|
|
653
|
+
ValidatorPresentService.call(options, ["id", "list_id"]);
|
|
654
|
+
return CommandGenerateService.call(
|
|
655
|
+
controller,
|
|
656
|
+
`lists/${options.list_id}/items/${options.id}/unarchive`,
|
|
657
|
+
{},
|
|
658
|
+
"PUT",
|
|
659
|
+
configuration
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
// src/command/services/command-fetch-list-item.service.ts
|
|
665
|
+
var CommandFetchListItemService = {
|
|
666
|
+
call: (controller, options, configuration) => {
|
|
667
|
+
ValidatorPresentService.call(options, ["id", "list_id"]);
|
|
668
|
+
return CommandGenerateService.call(
|
|
669
|
+
controller,
|
|
670
|
+
`lists/${options.list_id}/items/${options.id}`,
|
|
671
|
+
{},
|
|
672
|
+
"GET",
|
|
673
|
+
configuration
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// src/command/services/command-fetch-list.service.ts
|
|
679
|
+
var CommandFetchListService = {
|
|
680
|
+
call: (controller, options, configuration) => {
|
|
681
|
+
ValidatorPresentService.call(options, ["id"]);
|
|
682
|
+
return CommandGenerateService.call(
|
|
683
|
+
controller,
|
|
684
|
+
`lists/${options.id}`,
|
|
685
|
+
{},
|
|
686
|
+
"GET",
|
|
687
|
+
configuration
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
// src/command/services/command-delete-list.service.ts
|
|
693
|
+
var CommandDeleteListService = {
|
|
694
|
+
call: (controller, options, configuration) => {
|
|
695
|
+
ValidatorPresentService.call(options, ["id"]);
|
|
696
|
+
return CommandGenerateService.call(
|
|
697
|
+
controller,
|
|
698
|
+
`lists/${options.id}`,
|
|
699
|
+
{},
|
|
700
|
+
"DELETE",
|
|
701
|
+
configuration
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
// src/command/services/command-fetch-all-lists.service.ts
|
|
707
|
+
var CommandFetchAllListsService = {
|
|
708
|
+
call: (controller, configuration) => {
|
|
709
|
+
return CommandGenerateService.call(
|
|
710
|
+
controller,
|
|
711
|
+
`lists`,
|
|
712
|
+
{},
|
|
713
|
+
"GET",
|
|
714
|
+
configuration
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// src/command/services/command-search-lists.service.ts
|
|
720
|
+
var CommandSearchListsService = {
|
|
721
|
+
call: (controller, options, configuration) => {
|
|
722
|
+
return CommandGenerateService.call(
|
|
723
|
+
controller,
|
|
724
|
+
`lists/query`,
|
|
725
|
+
options,
|
|
726
|
+
"POST",
|
|
727
|
+
configuration
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// src/command/services/command-update-list.service.ts
|
|
733
|
+
var CommandUpdateListService = {
|
|
734
|
+
call: (controller, options, configuration) => {
|
|
735
|
+
ValidatorPresentService.call(options, ["id"]);
|
|
736
|
+
return CommandGenerateService.call(
|
|
737
|
+
controller,
|
|
738
|
+
`lists/${options.id}`,
|
|
739
|
+
options,
|
|
740
|
+
"PUT",
|
|
741
|
+
configuration
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
// src/command/services/command-create-list.service.ts
|
|
747
|
+
var CommandCreateListService = {
|
|
748
|
+
call: (controller, options, configuration) => {
|
|
749
|
+
return CommandGenerateService.call(
|
|
750
|
+
controller,
|
|
751
|
+
`lists`,
|
|
752
|
+
options,
|
|
753
|
+
"POST",
|
|
754
|
+
configuration
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
// src/command/services/command-get-events-schema.service.ts
|
|
760
|
+
var CommandGetEventsSchemaService = {
|
|
761
|
+
call: (controller, configuration) => {
|
|
762
|
+
return CommandGenerateService.call(
|
|
763
|
+
controller,
|
|
764
|
+
"events/schema",
|
|
765
|
+
{},
|
|
766
|
+
"GET",
|
|
767
|
+
configuration
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// src/command/services/command-group-events.service.ts
|
|
773
|
+
var CommandGroupEventsService = {
|
|
774
|
+
call: (controller, options, configuration) => {
|
|
775
|
+
return CommandGenerateService.call(
|
|
776
|
+
controller,
|
|
777
|
+
"events/group",
|
|
778
|
+
options,
|
|
779
|
+
"POST",
|
|
780
|
+
configuration
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
// src/command/services/command-search-events.service.ts
|
|
786
|
+
var CommandSearchEventsService = {
|
|
787
|
+
call: (controller, options, configuration) => {
|
|
788
|
+
return CommandGenerateService.call(
|
|
789
|
+
controller,
|
|
790
|
+
"events/query",
|
|
791
|
+
options,
|
|
792
|
+
"POST",
|
|
793
|
+
configuration
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
// src/command/services/command-count-list-items.service.ts
|
|
799
|
+
var CommandCountListItemsService = {
|
|
800
|
+
call: (controller, options, configuration) => {
|
|
801
|
+
ValidatorPresentService.call(options, ["list_id"]);
|
|
802
|
+
return CommandGenerateService.call(
|
|
803
|
+
controller,
|
|
804
|
+
`lists/${options.list_id}/items/count`,
|
|
805
|
+
options,
|
|
806
|
+
"POST",
|
|
807
|
+
configuration
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
// src/command/services/command-batch-upsert-list-items.service.ts
|
|
813
|
+
var CommandBatchUpsertListItemsService = {
|
|
814
|
+
call: (controller, options, configuration) => {
|
|
815
|
+
ValidatorPresentService.call(options, ["list_id"]);
|
|
816
|
+
return CommandGenerateService.call(
|
|
817
|
+
controller,
|
|
818
|
+
`lists/${options.list_id}/items/batch`,
|
|
819
|
+
options,
|
|
820
|
+
"POST",
|
|
821
|
+
configuration
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
// src/command/services/command-request-user-data.service.ts
|
|
827
|
+
var CommandRequestUserDataService = {
|
|
828
|
+
call: (controller, options, configuration) => {
|
|
829
|
+
return CommandGenerateService.call(
|
|
830
|
+
controller,
|
|
831
|
+
"privacy/users",
|
|
832
|
+
options,
|
|
833
|
+
"POST",
|
|
834
|
+
configuration
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
// src/command/services/command-delete-user-data.service.ts
|
|
840
|
+
var CommandDeleteUserDataService = {
|
|
841
|
+
call: (controller, options, configuration) => {
|
|
842
|
+
return CommandGenerateService.call(
|
|
843
|
+
controller,
|
|
844
|
+
"privacy/users",
|
|
845
|
+
options,
|
|
846
|
+
"DELETE",
|
|
847
|
+
configuration
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
// src/failover/models/failover-strategy.ts
|
|
853
|
+
var FailoverStrategy = /* @__PURE__ */ ((FailoverStrategy2) => {
|
|
854
|
+
FailoverStrategy2["allow"] = "allow";
|
|
855
|
+
FailoverStrategy2["deny"] = "deny";
|
|
856
|
+
FailoverStrategy2["challenge"] = "challenge";
|
|
857
|
+
FailoverStrategy2["throw"] = "throw";
|
|
858
|
+
return FailoverStrategy2;
|
|
859
|
+
})(FailoverStrategy || {});
|
|
860
|
+
|
|
861
|
+
// src/api/services/api-risk.service.ts
|
|
862
|
+
var handleFailover = (reason, configuration, err) => {
|
|
863
|
+
if (configuration.failoverStrategy === "throw" /* throw */) {
|
|
864
|
+
throw err;
|
|
865
|
+
}
|
|
866
|
+
return {
|
|
867
|
+
policy: {
|
|
868
|
+
action: configuration.failoverStrategy
|
|
869
|
+
},
|
|
870
|
+
action: configuration.failoverStrategy,
|
|
871
|
+
failover: true,
|
|
872
|
+
failover_reason: reason
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
var isTimeoutError = (e) => e.name === "AbortError";
|
|
876
|
+
var APIRiskService = {
|
|
877
|
+
call: async (options, configuration) => {
|
|
878
|
+
const controller = new AbortController();
|
|
879
|
+
const command = CommandRiskService.call(controller, options, configuration);
|
|
880
|
+
let processedResponse;
|
|
881
|
+
try {
|
|
882
|
+
processedResponse = await APIService.call(
|
|
883
|
+
controller,
|
|
884
|
+
command,
|
|
885
|
+
configuration
|
|
886
|
+
);
|
|
887
|
+
} catch (e) {
|
|
888
|
+
if (isTimeoutError(e)) {
|
|
889
|
+
return handleFailover("timeout", configuration, e);
|
|
890
|
+
} else if (e instanceof InternalServerError) {
|
|
891
|
+
return handleFailover("server error", configuration);
|
|
892
|
+
} else {
|
|
893
|
+
throw e;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return processedResponse;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
// src/api/services/api-log.service.ts
|
|
901
|
+
var APILogService = {
|
|
902
|
+
call: async (options, configuration) => {
|
|
903
|
+
const controller = new AbortController();
|
|
904
|
+
const command = CommandLogService.call(controller, options, configuration);
|
|
905
|
+
APIService.call(controller, command, configuration);
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
// src/api/services/api-filter.service.ts
|
|
910
|
+
var handleFailover2 = (reason, configuration, err) => {
|
|
911
|
+
if (configuration.failoverStrategy === "throw" /* throw */) {
|
|
912
|
+
throw err;
|
|
913
|
+
}
|
|
914
|
+
return {
|
|
915
|
+
policy: {
|
|
916
|
+
action: configuration.failoverStrategy
|
|
917
|
+
},
|
|
918
|
+
action: configuration.failoverStrategy,
|
|
919
|
+
failover: true,
|
|
920
|
+
failover_reason: reason
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
var isTimeoutError2 = (e) => e.name === "AbortError";
|
|
924
|
+
var APIFilterService = {
|
|
925
|
+
call: async (options, configuration) => {
|
|
926
|
+
const controller = new AbortController();
|
|
927
|
+
const command = CommandFilterService.call(
|
|
928
|
+
controller,
|
|
929
|
+
options,
|
|
930
|
+
configuration
|
|
931
|
+
);
|
|
932
|
+
let processedResponse;
|
|
933
|
+
try {
|
|
934
|
+
processedResponse = await APIService.call(
|
|
935
|
+
controller,
|
|
936
|
+
command,
|
|
937
|
+
configuration
|
|
938
|
+
);
|
|
939
|
+
} catch (e) {
|
|
940
|
+
if (isTimeoutError2(e)) {
|
|
941
|
+
return handleFailover2("timeout", configuration, e);
|
|
942
|
+
} else if (e instanceof InternalServerError) {
|
|
943
|
+
return handleFailover2("server error", configuration, e);
|
|
944
|
+
} else {
|
|
945
|
+
throw e;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
return processedResponse;
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
// src/api/services/api-create-list-item.service.ts
|
|
953
|
+
var APICreateListItemService = {
|
|
954
|
+
call: async (options, configuration) => {
|
|
955
|
+
const controller = new AbortController();
|
|
956
|
+
const command = CommandCreateListItemService.call(
|
|
957
|
+
controller,
|
|
958
|
+
options,
|
|
959
|
+
configuration
|
|
960
|
+
);
|
|
961
|
+
return APIService.call(controller, command, configuration);
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
// src/api/services/api-create-list.service.ts
|
|
966
|
+
var APICreateListService = {
|
|
967
|
+
call: async (options, configuration) => {
|
|
968
|
+
const controller = new AbortController();
|
|
969
|
+
const command = CommandCreateListService.call(
|
|
970
|
+
controller,
|
|
971
|
+
options,
|
|
972
|
+
configuration
|
|
973
|
+
);
|
|
974
|
+
return APIService.call(controller, command, configuration);
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
// src/api/services/api-archive-list-item.service.ts
|
|
979
|
+
var APIArchiveListItemService = {
|
|
980
|
+
call: async (options, configuration) => {
|
|
981
|
+
const controller = new AbortController();
|
|
982
|
+
const command = CommandArchiveListItemService.call(
|
|
983
|
+
controller,
|
|
984
|
+
options,
|
|
985
|
+
configuration
|
|
986
|
+
);
|
|
987
|
+
return APIService.call(controller, command, configuration);
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
// src/api/services/api-delete-list.service.ts
|
|
992
|
+
var APIDeleteListService = {
|
|
993
|
+
call: async (options, configuration) => {
|
|
994
|
+
const controller = new AbortController();
|
|
995
|
+
const command = CommandDeleteListService.call(
|
|
996
|
+
controller,
|
|
997
|
+
options,
|
|
998
|
+
configuration
|
|
999
|
+
);
|
|
1000
|
+
return APIService.call(controller, command, configuration);
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
// src/api/services/api-unarchive-list-item.service.ts
|
|
1005
|
+
var APIUnarchiveListItemService = {
|
|
1006
|
+
call: async (options, configuration) => {
|
|
1007
|
+
const controller = new AbortController();
|
|
1008
|
+
const command = CommandUnarchiveListItemService.call(
|
|
1009
|
+
controller,
|
|
1010
|
+
options,
|
|
1011
|
+
configuration
|
|
1012
|
+
);
|
|
1013
|
+
return APIService.call(controller, command, configuration);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
// src/api/services/api-fetch-list-item.service.ts
|
|
1018
|
+
var APIFetchListItemService = {
|
|
1019
|
+
call: async (options, configuration) => {
|
|
1020
|
+
const controller = new AbortController();
|
|
1021
|
+
const command = CommandFetchListItemService.call(
|
|
1022
|
+
controller,
|
|
1023
|
+
options,
|
|
1024
|
+
configuration
|
|
1025
|
+
);
|
|
1026
|
+
return APIService.call(controller, command, configuration);
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
// src/api/services/api-fetch-list.service.ts
|
|
1031
|
+
var APIFetchListService = {
|
|
1032
|
+
call: async (options, configuration) => {
|
|
1033
|
+
const controller = new AbortController();
|
|
1034
|
+
const command = CommandFetchListService.call(
|
|
1035
|
+
controller,
|
|
1036
|
+
options,
|
|
1037
|
+
configuration
|
|
1038
|
+
);
|
|
1039
|
+
return APIService.call(controller, command, configuration);
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
// src/api/services/api-search-list-items.service.ts
|
|
1044
|
+
var APISearchListItemsService = {
|
|
1045
|
+
call: async (options, configuration) => {
|
|
1046
|
+
const controller = new AbortController();
|
|
1047
|
+
const command = CommandSearchListItemsService.call(
|
|
1048
|
+
controller,
|
|
1049
|
+
options,
|
|
1050
|
+
configuration
|
|
1051
|
+
);
|
|
1052
|
+
return APIService.call(controller, command, configuration);
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
// src/api/services/api-search-lists.service.ts
|
|
1057
|
+
var APISearchListsService = {
|
|
1058
|
+
call: async (options, configuration) => {
|
|
1059
|
+
const controller = new AbortController();
|
|
1060
|
+
const command = CommandSearchListsService.call(
|
|
1061
|
+
controller,
|
|
1062
|
+
options,
|
|
1063
|
+
configuration
|
|
1064
|
+
);
|
|
1065
|
+
return APIService.call(controller, command, configuration);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
// src/api/services/api-update-list-item.service.ts
|
|
1070
|
+
var APIUpdateListItemService = {
|
|
1071
|
+
call: async (options, configuration) => {
|
|
1072
|
+
const controller = new AbortController();
|
|
1073
|
+
const command = CommandUpdateListItemService.call(
|
|
1074
|
+
controller,
|
|
1075
|
+
options,
|
|
1076
|
+
configuration
|
|
1077
|
+
);
|
|
1078
|
+
return APIService.call(controller, command, configuration);
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
// src/api/services/api-update-list.service.ts
|
|
1083
|
+
var APIUpdateListService = {
|
|
1084
|
+
call: async (options, configuration) => {
|
|
1085
|
+
const controller = new AbortController();
|
|
1086
|
+
const command = CommandUpdateListService.call(
|
|
1087
|
+
controller,
|
|
1088
|
+
options,
|
|
1089
|
+
configuration
|
|
1090
|
+
);
|
|
1091
|
+
return APIService.call(controller, command, configuration);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
// src/api/services/api-fetch-all-lists.service.ts
|
|
1096
|
+
var APIFetchAllListsService = {
|
|
1097
|
+
call: async (configuration) => {
|
|
1098
|
+
const controller = new AbortController();
|
|
1099
|
+
const command = CommandFetchAllListsService.call(controller, configuration);
|
|
1100
|
+
return APIService.call(controller, command, configuration);
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
// src/api/services/api-get-events-schema.service.ts
|
|
1105
|
+
var APIGetEventsSchemaService = {
|
|
1106
|
+
call: async (configuration) => {
|
|
1107
|
+
const controller = new AbortController();
|
|
1108
|
+
const command = CommandGetEventsSchemaService.call(
|
|
1109
|
+
controller,
|
|
1110
|
+
configuration
|
|
1111
|
+
);
|
|
1112
|
+
return APIService.call(controller, command, configuration);
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
// src/api/services/api-group-events.service.ts
|
|
1117
|
+
var APIGroupEventsService = {
|
|
1118
|
+
call: async (options, configuration) => {
|
|
1119
|
+
const controller = new AbortController();
|
|
1120
|
+
const command = CommandGroupEventsService.call(
|
|
1121
|
+
controller,
|
|
1122
|
+
options,
|
|
1123
|
+
configuration
|
|
1124
|
+
);
|
|
1125
|
+
return APIService.call(controller, command, configuration);
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
// src/api/services/api-search-events.service.ts
|
|
1130
|
+
var APISearchEventsService = {
|
|
1131
|
+
call: async (options, configuration) => {
|
|
1132
|
+
const controller = new AbortController();
|
|
1133
|
+
const command = CommandSearchEventsService.call(
|
|
1134
|
+
controller,
|
|
1135
|
+
options,
|
|
1136
|
+
configuration
|
|
1137
|
+
);
|
|
1138
|
+
return APIService.call(controller, command, configuration);
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// src/api/services/api-count-list-items.service.ts
|
|
1143
|
+
var APICountListItemsService = {
|
|
1144
|
+
call: async (options, configuration) => {
|
|
1145
|
+
const controller = new AbortController();
|
|
1146
|
+
const command = CommandCountListItemsService.call(
|
|
1147
|
+
controller,
|
|
1148
|
+
options,
|
|
1149
|
+
configuration
|
|
1150
|
+
);
|
|
1151
|
+
return APIService.call(controller, command, configuration);
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
// src/api/services/api-batch-upsert-list-items.service.ts
|
|
1156
|
+
var APIBatchUpsertListItemsService = {
|
|
1157
|
+
call: async (options, configuration) => {
|
|
1158
|
+
const controller = new AbortController();
|
|
1159
|
+
const command = CommandBatchUpsertListItemsService.call(
|
|
1160
|
+
controller,
|
|
1161
|
+
options,
|
|
1162
|
+
configuration
|
|
1163
|
+
);
|
|
1164
|
+
return APIService.call(controller, command, configuration);
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1168
|
+
// src/api/services/api-request-user-data.service.ts
|
|
1169
|
+
var APIRequestUserDataService = {
|
|
1170
|
+
call: async (options, configuration) => {
|
|
1171
|
+
const controller = new AbortController();
|
|
1172
|
+
const command = CommandRequestUserDataService.call(
|
|
1173
|
+
controller,
|
|
1174
|
+
options,
|
|
1175
|
+
configuration
|
|
1176
|
+
);
|
|
1177
|
+
return APIService.call(controller, command, configuration);
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
// src/api/services/api-delete-user-data.service.ts
|
|
1182
|
+
var APIDeleteUserDataService = {
|
|
1183
|
+
call: async (options, configuration) => {
|
|
1184
|
+
const controller = new AbortController();
|
|
1185
|
+
const command = CommandDeleteUserDataService.call(
|
|
1186
|
+
controller,
|
|
1187
|
+
options,
|
|
1188
|
+
configuration
|
|
1189
|
+
);
|
|
1190
|
+
return APIService.call(controller, command, configuration);
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1194
|
+
// src/webhook/services/webhook-verify.service.ts
|
|
1195
|
+
var import_crypto = require("crypto");
|
|
1196
|
+
var secureCompare = (a, b) => {
|
|
1197
|
+
const bufferA = Buffer.from(a);
|
|
1198
|
+
const bufferB = Buffer.from(b);
|
|
1199
|
+
if (bufferA.length !== bufferB.length) {
|
|
1200
|
+
return false;
|
|
1201
|
+
}
|
|
1202
|
+
return (0, import_crypto.timingSafeEqual)(bufferA, bufferB);
|
|
1203
|
+
};
|
|
1204
|
+
var WebhookVerifyService = {
|
|
1205
|
+
// Verifies the `X-Castle-Signature` of an incoming webhook against the raw
|
|
1206
|
+
// request body. Throws `WebhookVerificationError` when it does not match.
|
|
1207
|
+
call: (payload, signature, configuration) => {
|
|
1208
|
+
if (!payload || payload.length === 0) {
|
|
1209
|
+
throw new WebhookVerificationError("Invalid webhook from Castle API");
|
|
1210
|
+
}
|
|
1211
|
+
const expectedSignature = (0, import_crypto.createHmac)("sha256", configuration.apiSecret).update(payload).digest("base64");
|
|
1212
|
+
if (!signature || !secureCompare(signature, expectedSignature)) {
|
|
1213
|
+
throw new WebhookVerificationError(
|
|
1214
|
+
"Signature not matching the expected signature"
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
// src/secure-mode/services/secure-mode.service.ts
|
|
1221
|
+
var import_crypto2 = require("crypto");
|
|
1222
|
+
var SecureModeService = {
|
|
1223
|
+
// Computes the secure-mode signature for a user id: a hex HMAC-SHA256 of the
|
|
1224
|
+
// user id keyed with the API secret. Use it to authenticate the user id sent
|
|
1225
|
+
// to Castle from the browser.
|
|
1226
|
+
call: (userId, configuration) => (0, import_crypto2.createHmac)("sha256", configuration.apiSecret).update(userId).digest("hex")
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
// src/configuration.ts
|
|
1230
|
+
var import_pino = __toESM(require("pino"));
|
|
1231
|
+
var import_pino_pretty = __toESM(require("pino-pretty"));
|
|
1232
|
+
var Configuration = class {
|
|
1233
|
+
apiSecret;
|
|
1234
|
+
baseUrl;
|
|
1235
|
+
timeout;
|
|
1236
|
+
allowlisted;
|
|
1237
|
+
denylisted;
|
|
1238
|
+
overrideFetch;
|
|
1239
|
+
failoverStrategy;
|
|
1240
|
+
doNotTrack;
|
|
1241
|
+
ipHeaders;
|
|
1242
|
+
trustedProxies;
|
|
1243
|
+
trustProxyChain;
|
|
1244
|
+
trustedProxyDepth;
|
|
1245
|
+
logger;
|
|
1246
|
+
constructor({
|
|
1247
|
+
apiSecret,
|
|
1248
|
+
baseUrl = DEFAULT_API_URL,
|
|
1249
|
+
timeout = DEFAULT_TIMEOUT,
|
|
1250
|
+
allowlisted = [],
|
|
1251
|
+
denylisted = [],
|
|
1252
|
+
overrideFetch = fetch,
|
|
1253
|
+
failoverStrategy = "allow" /* allow */,
|
|
1254
|
+
doNotTrack = false,
|
|
1255
|
+
ipHeaders = [],
|
|
1256
|
+
trustedProxies = [],
|
|
1257
|
+
trustProxyChain = false,
|
|
1258
|
+
trustedProxyDepth = 0,
|
|
1259
|
+
logger = (0, import_pino.default)((0, import_pino_pretty.default)({ levelFirst: true }))
|
|
1260
|
+
}) {
|
|
1261
|
+
if (!apiSecret) {
|
|
1262
|
+
throw new ConfigurationError(
|
|
1263
|
+
"Castle: Unable to instantiate Castle client, API secret is missing."
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
this.apiSecret = apiSecret;
|
|
1267
|
+
this.baseUrl = new URL(baseUrl);
|
|
1268
|
+
this.timeout = timeout;
|
|
1269
|
+
this.allowlisted = allowlisted.map((x) => x.toLowerCase());
|
|
1270
|
+
this.denylisted = denylisted.map((x) => x.toLowerCase());
|
|
1271
|
+
this.overrideFetch = overrideFetch;
|
|
1272
|
+
this.failoverStrategy = failoverStrategy;
|
|
1273
|
+
this.doNotTrack = doNotTrack;
|
|
1274
|
+
this.ipHeaders = ipHeaders;
|
|
1275
|
+
this.trustedProxies = trustedProxies.map((proxy) => new RegExp(proxy));
|
|
1276
|
+
this.trustProxyChain = trustProxyChain;
|
|
1277
|
+
this.trustedProxyDepth = trustedProxyDepth;
|
|
1278
|
+
this.logger = logger;
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
// src/Castle.ts
|
|
1283
|
+
var Castle = class {
|
|
1284
|
+
configuration;
|
|
1285
|
+
constructor(configAttributes) {
|
|
1286
|
+
this.configuration = new Configuration(configAttributes);
|
|
1287
|
+
}
|
|
1288
|
+
async risk(params) {
|
|
1289
|
+
if (this.configuration.doNotTrack) {
|
|
1290
|
+
return this.generateDoNotTrackResponse(params.user?.id);
|
|
1291
|
+
}
|
|
1292
|
+
return APIRiskService.call(params, this.configuration);
|
|
1293
|
+
}
|
|
1294
|
+
async filter(params) {
|
|
1295
|
+
if (this.configuration.doNotTrack) {
|
|
1296
|
+
return this.generateDoNotTrackResponse(params.matching_user_id);
|
|
1297
|
+
}
|
|
1298
|
+
return APIFilterService.call(params, this.configuration);
|
|
1299
|
+
}
|
|
1300
|
+
async log(params) {
|
|
1301
|
+
if (this.configuration.doNotTrack) {
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
APILogService.call(params, this.configuration);
|
|
1305
|
+
}
|
|
1306
|
+
async createListItem(params) {
|
|
1307
|
+
return APICreateListItemService.call(params, this.configuration);
|
|
1308
|
+
}
|
|
1309
|
+
async createList(params) {
|
|
1310
|
+
return APICreateListService.call(params, this.configuration);
|
|
1311
|
+
}
|
|
1312
|
+
async updateListItem(params) {
|
|
1313
|
+
return APIUpdateListItemService.call(params, this.configuration);
|
|
1314
|
+
}
|
|
1315
|
+
async updateList(params) {
|
|
1316
|
+
return APIUpdateListService.call(params, this.configuration);
|
|
1317
|
+
}
|
|
1318
|
+
async archiveListItem(params) {
|
|
1319
|
+
return APIArchiveListItemService.call(params, this.configuration);
|
|
1320
|
+
}
|
|
1321
|
+
async unarchiveListItem(params) {
|
|
1322
|
+
return APIUnarchiveListItemService.call(params, this.configuration);
|
|
1323
|
+
}
|
|
1324
|
+
async deleteList(params) {
|
|
1325
|
+
return APIDeleteListService.call(params, this.configuration);
|
|
1326
|
+
}
|
|
1327
|
+
async fetchListItem(params) {
|
|
1328
|
+
return APIFetchListItemService.call(params, this.configuration);
|
|
1329
|
+
}
|
|
1330
|
+
async fetchList(params) {
|
|
1331
|
+
return APIFetchListService.call(params, this.configuration);
|
|
1332
|
+
}
|
|
1333
|
+
async fetchAllLists() {
|
|
1334
|
+
return APIFetchAllListsService.call(this.configuration);
|
|
1335
|
+
}
|
|
1336
|
+
async searchListItems(params) {
|
|
1337
|
+
return APISearchListItemsService.call(params, this.configuration);
|
|
1338
|
+
}
|
|
1339
|
+
async searchLists(params) {
|
|
1340
|
+
return APISearchListsService.call(params, this.configuration);
|
|
1341
|
+
}
|
|
1342
|
+
async batchUpdateListItems(params) {
|
|
1343
|
+
return APIBatchUpsertListItemsService.call(params, this.configuration);
|
|
1344
|
+
}
|
|
1345
|
+
async countListItems(params) {
|
|
1346
|
+
return APICountListItemsService.call(params, this.configuration);
|
|
1347
|
+
}
|
|
1348
|
+
async queryEvents(params) {
|
|
1349
|
+
return APISearchEventsService.call(params, this.configuration);
|
|
1350
|
+
}
|
|
1351
|
+
async eventsSchema() {
|
|
1352
|
+
return APIGetEventsSchemaService.call(this.configuration);
|
|
1353
|
+
}
|
|
1354
|
+
async groupEvents(params) {
|
|
1355
|
+
return APIGroupEventsService.call(params, this.configuration);
|
|
1356
|
+
}
|
|
1357
|
+
/** Alias of {@link Castle.queryEvents}. */
|
|
1358
|
+
async searchEvents(params) {
|
|
1359
|
+
return this.queryEvents(params);
|
|
1360
|
+
}
|
|
1361
|
+
/** Alias of {@link Castle.eventsSchema}. */
|
|
1362
|
+
async getEventsSchema() {
|
|
1363
|
+
return this.eventsSchema();
|
|
1364
|
+
}
|
|
1365
|
+
async requestUserData(params) {
|
|
1366
|
+
return APIRequestUserDataService.call(params, this.configuration);
|
|
1367
|
+
}
|
|
1368
|
+
async deleteUserData(params) {
|
|
1369
|
+
return APIDeleteUserDataService.call(params, this.configuration);
|
|
1370
|
+
}
|
|
1371
|
+
verifyWebhookSignature(payload, signature) {
|
|
1372
|
+
WebhookVerifyService.call(payload, signature, this.configuration);
|
|
1373
|
+
}
|
|
1374
|
+
secureModeSignature(userId) {
|
|
1375
|
+
return SecureModeService.call(userId, this.configuration);
|
|
1376
|
+
}
|
|
1377
|
+
generateDoNotTrackResponse(userId) {
|
|
1378
|
+
return {
|
|
1379
|
+
policy: {
|
|
1380
|
+
action: "allow" /* allow */
|
|
1381
|
+
},
|
|
1382
|
+
action: "allow" /* allow */,
|
|
1383
|
+
user_id: userId,
|
|
1384
|
+
failover: true,
|
|
1385
|
+
failover_reason: "do not track"
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
// src/models/events.ts
|
|
1391
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
1392
|
+
EventType2["CHALLENGE"] = "$challenge";
|
|
1393
|
+
EventType2["CUSTOM"] = "$custom";
|
|
1394
|
+
EventType2["LOGIN"] = "$login";
|
|
1395
|
+
EventType2["LOGOUT"] = "$logout";
|
|
1396
|
+
EventType2["PASSWORD_RESET_REQUEST"] = "$password_reset_request";
|
|
1397
|
+
EventType2["PROFILE_RESET"] = "$profile_reset";
|
|
1398
|
+
EventType2["PROFILE_UPDATE"] = "$profile_update";
|
|
1399
|
+
EventType2["REGISTRATION"] = "$registration";
|
|
1400
|
+
EventType2["TRANSACTION"] = "$transaction";
|
|
1401
|
+
return EventType2;
|
|
1402
|
+
})(EventType || {});
|
|
1403
|
+
var EventStatus = /* @__PURE__ */ ((EventStatus2) => {
|
|
1404
|
+
EventStatus2["ATTEMPTED"] = "$attempted";
|
|
1405
|
+
EventStatus2["FAILED"] = "$failed";
|
|
1406
|
+
EventStatus2["REQUESTED"] = "$requested";
|
|
1407
|
+
EventStatus2["SUCCEEDED"] = "$succeeded";
|
|
1408
|
+
return EventStatus2;
|
|
1409
|
+
})(EventStatus || {});
|
|
1410
|
+
|
|
1411
|
+
// src/models/action.ts
|
|
1412
|
+
var Action = /* @__PURE__ */ ((Action2) => {
|
|
1413
|
+
Action2["allow"] = "allow";
|
|
1414
|
+
Action2["deny"] = "deny";
|
|
1415
|
+
Action2["challenge"] = "challenge";
|
|
1416
|
+
return Action2;
|
|
1417
|
+
})(Action || {});
|
|
1418
|
+
|
|
1419
|
+
// src/payload/models/event_payload.ts
|
|
1420
|
+
var SearchEventsQueryType = /* @__PURE__ */ ((SearchEventsQueryType2) => {
|
|
1421
|
+
SearchEventsQueryType2["COUNT"] = "$count";
|
|
1422
|
+
SearchEventsQueryType2["RECORDS"] = "$records";
|
|
1423
|
+
SearchEventsQueryType2["RECORDS_WITH_COUNT"] = "$records_with_count";
|
|
1424
|
+
return SearchEventsQueryType2;
|
|
1425
|
+
})(SearchEventsQueryType || {});
|
|
1426
|
+
var SearchEventsQueryFilterOperator = /* @__PURE__ */ ((SearchEventsQueryFilterOperator2) => {
|
|
1427
|
+
SearchEventsQueryFilterOperator2["IN"] = "$in";
|
|
1428
|
+
SearchEventsQueryFilterOperator2["NIN"] = "$nin";
|
|
1429
|
+
SearchEventsQueryFilterOperator2["EQ"] = "$eq";
|
|
1430
|
+
SearchEventsQueryFilterOperator2["NEQ"] = "$neq";
|
|
1431
|
+
SearchEventsQueryFilterOperator2["LIKE"] = "$like";
|
|
1432
|
+
SearchEventsQueryFilterOperator2["NLIKE"] = "$nlike";
|
|
1433
|
+
SearchEventsQueryFilterOperator2["CONTAINS"] = "$contains";
|
|
1434
|
+
SearchEventsQueryFilterOperator2["NCONTAINS"] = "$ncontains";
|
|
1435
|
+
SearchEventsQueryFilterOperator2["STARTS_WITH"] = "$starts_with";
|
|
1436
|
+
SearchEventsQueryFilterOperator2["NSTARTS_WITH"] = "$nstarts_with";
|
|
1437
|
+
SearchEventsQueryFilterOperator2["ENDS_WITH"] = "$ends_with";
|
|
1438
|
+
SearchEventsQueryFilterOperator2["NENDS_WITH"] = "$nends_with";
|
|
1439
|
+
SearchEventsQueryFilterOperator2["MATCHES"] = "$matches";
|
|
1440
|
+
SearchEventsQueryFilterOperator2["NMATCHES"] = "$nmatches";
|
|
1441
|
+
SearchEventsQueryFilterOperator2["IP_RANGE"] = "$ip_range";
|
|
1442
|
+
SearchEventsQueryFilterOperator2["NIP_RANGE"] = "$nip_range";
|
|
1443
|
+
return SearchEventsQueryFilterOperator2;
|
|
1444
|
+
})(SearchEventsQueryFilterOperator || {});
|
|
1445
|
+
|
|
1446
|
+
// src/payload/models/event_response.ts
|
|
1447
|
+
var EventSignal = /* @__PURE__ */ ((EventSignal2) => {
|
|
1448
|
+
EventSignal2["ABUSE_IP"] = "abuse_ip";
|
|
1449
|
+
EventSignal2["BOT_BEHAVIOR"] = "bot_behavior";
|
|
1450
|
+
EventSignal2["CREDENTIAL_STUFFING"] = "credential_stuffing";
|
|
1451
|
+
EventSignal2["DISPOSABLE_EMAIL_DOMAIN"] = "disposable_email_domain";
|
|
1452
|
+
EventSignal2["GENERATED_EMAIL"] = "generated_email";
|
|
1453
|
+
EventSignal2["HEADLESS_BROWSER"] = "headless_browser";
|
|
1454
|
+
EventSignal2["HTTP_CLIENT_LIBRARY"] = "http_client_library";
|
|
1455
|
+
EventSignal2["IMPOSSIBLE_TRAVEL"] = "impossible_travel";
|
|
1456
|
+
EventSignal2["INVALID_EMAIL"] = "invalid_email";
|
|
1457
|
+
EventSignal2["INVALID_DEVICE_DATA"] = "invalid_device_data";
|
|
1458
|
+
EventSignal2["MISSING_DEVICE_DATA"] = "missing_device_data";
|
|
1459
|
+
EventSignal2["MISSING_HEADERS"] = "missing_headers";
|
|
1460
|
+
EventSignal2["MULTIPLE_ACCOUNTS_PER_DEVICE"] = "multiple_accounts_per_device";
|
|
1461
|
+
EventSignal2["MULTIPLE_ALIASES_PER_EMAIL"] = "multiple_aliases_per_email";
|
|
1462
|
+
EventSignal2["NEW_COUNTRY"] = "new_country";
|
|
1463
|
+
EventSignal2["NEW_DEVICE"] = "new_device";
|
|
1464
|
+
EventSignal2["NEW_DEVICE_TYPE"] = "new_device_type";
|
|
1465
|
+
EventSignal2["NEW_ISP"] = "new_isp";
|
|
1466
|
+
EventSignal2["NEW_LANGUAGE"] = "new_language";
|
|
1467
|
+
EventSignal2["NEW_OS"] = "new_os";
|
|
1468
|
+
EventSignal2["HIGH_ACTIVITY_DEVICE"] = "high_activity_device";
|
|
1469
|
+
EventSignal2["HIGH_ACTIVITY_IP"] = "high_activity_ip";
|
|
1470
|
+
EventSignal2["HIGH_ACTIVITY_ACCOUNT"] = "high_activity_account";
|
|
1471
|
+
EventSignal2["SPOOFED_DEVICE"] = "spoofed_device";
|
|
1472
|
+
EventSignal2["WEB_CRAWLER"] = "web_crawler";
|
|
1473
|
+
return EventSignal2;
|
|
1474
|
+
})(EventSignal || {});
|
|
1475
|
+
var EventAuthenticationMethod = /* @__PURE__ */ ((EventAuthenticationMethod2) => {
|
|
1476
|
+
EventAuthenticationMethod2["AUTHENTICATOR"] = "$authenticator";
|
|
1477
|
+
EventAuthenticationMethod2["BIOMETRICS"] = "$biometrics";
|
|
1478
|
+
EventAuthenticationMethod2["EMAIL"] = "$email";
|
|
1479
|
+
EventAuthenticationMethod2["PASSWORD"] = "$password";
|
|
1480
|
+
EventAuthenticationMethod2["PHONE"] = "$phone";
|
|
1481
|
+
EventAuthenticationMethod2["PUSH"] = "$push";
|
|
1482
|
+
EventAuthenticationMethod2["SECURITY_KEY"] = "$security_key";
|
|
1483
|
+
EventAuthenticationMethod2["SOCIAL"] = "$social";
|
|
1484
|
+
EventAuthenticationMethod2["SSO"] = "$sso";
|
|
1485
|
+
EventAuthenticationMethod2["KBA"] = "$kba";
|
|
1486
|
+
EventAuthenticationMethod2["ELECTRONIC_ID"] = "$electronic_id";
|
|
1487
|
+
EventAuthenticationMethod2["PHYSICAL_ID"] = "$physical_id";
|
|
1488
|
+
EventAuthenticationMethod2["DOCUMENT"] = "$document";
|
|
1489
|
+
EventAuthenticationMethod2["VIDEO"] = "$video";
|
|
1490
|
+
EventAuthenticationMethod2["PASSKEY"] = "$passkey";
|
|
1491
|
+
EventAuthenticationMethod2["OTHER"] = "$other";
|
|
1492
|
+
return EventAuthenticationMethod2;
|
|
1493
|
+
})(EventAuthenticationMethod || {});
|
|
1494
|
+
|
|
1495
|
+
// src/payload/services/payload-prepare-service.ts
|
|
1496
|
+
var PayloadPrepareService = {
|
|
1497
|
+
call: (payloadParams, request, configuration, options = {}) => {
|
|
1498
|
+
const context = ContextPrepareService.call(
|
|
1499
|
+
request,
|
|
1500
|
+
deepMerge(payloadParams, options),
|
|
1501
|
+
configuration
|
|
1502
|
+
);
|
|
1503
|
+
return deepMerge(payloadParams, { context });
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1507
|
+
0 && (module.exports = {
|
|
1508
|
+
APIError,
|
|
1509
|
+
Action,
|
|
1510
|
+
BadRequestError,
|
|
1511
|
+
Castle,
|
|
1512
|
+
ConfigurationError,
|
|
1513
|
+
ContextPrepareService,
|
|
1514
|
+
DEFAULT_ALLOWLIST,
|
|
1515
|
+
DEFAULT_API_URL,
|
|
1516
|
+
DEFAULT_TIMEOUT,
|
|
1517
|
+
EventAuthenticationMethod,
|
|
1518
|
+
EventSignal,
|
|
1519
|
+
EventStatus,
|
|
1520
|
+
EventType,
|
|
1521
|
+
FailoverStrategy,
|
|
1522
|
+
ForbiddenError,
|
|
1523
|
+
InternalServerError,
|
|
1524
|
+
InvalidParametersError,
|
|
1525
|
+
InvalidRequestTokenError,
|
|
1526
|
+
NotFoundError,
|
|
1527
|
+
PayloadPrepareService,
|
|
1528
|
+
RateLimitError,
|
|
1529
|
+
SearchEventsQueryFilterOperator,
|
|
1530
|
+
SearchEventsQueryType,
|
|
1531
|
+
SecureModeService,
|
|
1532
|
+
TRUSTED_PROXIES,
|
|
1533
|
+
UnauthorizedError,
|
|
1534
|
+
UserUnauthorizedError,
|
|
1535
|
+
WebhookVerificationError,
|
|
1536
|
+
WebhookVerifyService
|
|
1537
|
+
});
|
|
27
1538
|
//# sourceMappingURL=index.js.map
|