start-slicemachine 0.12.62-beta.4 → 0.12.62-beta.6
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/dist/StartSliceMachineProcess.cjs +1 -4
- package/dist/StartSliceMachineProcess.cjs.map +1 -1
- package/dist/StartSliceMachineProcess.js +1 -4
- package/dist/StartSliceMachineProcess.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/api.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/api.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/baseclient.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/baseclient.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/baseclient.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/checkin.cjs +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/checkin.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/checkin.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/checkin.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/envelope.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/envelope.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/envelope.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs +7 -13
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js +8 -14
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integration.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integration.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/functiontostring.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/functiontostring.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/inboundfilters.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/inboundfilters.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/linkederrors.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/linkederrors.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/requestdata.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/requestdata.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/integrations/requestdata.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/aggregator.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/aggregator.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/envelope.cjs +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/envelope.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/envelope.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/envelope.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/instance.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/instance.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/instance.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/metric-summary.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/metric-summary.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/utils.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/metrics/utils.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/sdk.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/sdk.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/sdk.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/server-runtime-client.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/server-runtime-client.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs +1 -3
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js +1 -3
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/sessionflusher.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/sessionflusher.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/errors.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/errors.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/hubextensions.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/hubextensions.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/sampling.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/sampling.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/span.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/span.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/span.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/spanstatus.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/spanstatus.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/trace.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/trace.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/transaction.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/transaction.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/transaction.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/utils.cjs +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/utils.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/utils.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/utils.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/transports/base.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/transports/base.js +2 -2
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/transports/base.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/hasTracingEnabled.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/hasTracingEnabled.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/isSentryRequestUrl.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/isSentryRequestUrl.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js +2 -2
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/sdkMetadata.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/sdkMetadata.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/aggregate-errors.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/aggregate-errors.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/baggage.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/baggage.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/browser.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/browser.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/buildPolyfills/_optionalChain.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/buildPolyfills/_optionalChain.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/cookie.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/cookie.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/dsn.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/dsn.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/envelope.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/envelope.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/error.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/error.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/eventbuilder.cjs +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/eventbuilder.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/eventbuilder.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/eventbuilder.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/_handlers.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/_handlers.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/console.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/console.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/globalError.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/globalError.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/lru.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/lru.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/memo.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/memo.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs +3 -3
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js +3 -3
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/node-stack-trace.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/node-stack-trace.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/normalize.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/normalize.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/path.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/path.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/promisebuffer.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/promisebuffer.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/promisebuffer.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/ratelimit.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/ratelimit.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/requestdata.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/requestdata.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/stacktrace.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/stacktrace.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/string.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/string.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/tracing.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/tracing.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/url.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/url.js.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js +1 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/domain.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/domain.js +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/domain.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/hooks.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/hooks.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/index.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/async/index.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/client.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/client.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/console.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/console.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/context.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/context.js +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/context.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/contextlines.cjs +3 -5
- package/dist/_node_modules/@sentry/node/esm/integrations/contextlines.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/contextlines.js +3 -5
- package/dist/_node_modules/@sentry/node/esm/integrations/contextlines.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/http.cjs +3 -3
- package/dist/_node_modules/@sentry/node/esm/integrations/http.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/http.js +3 -3
- package/dist/_node_modules/@sentry/node/esm/integrations/http.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/local-variables/common.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/local-variables/common.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/local-variables/local-variables-sync.cjs +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/local-variables/local-variables-sync.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/local-variables/local-variables-sync.js +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/local-variables/local-variables-sync.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/modules.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/modules.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/onuncaughtexception.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/onuncaughtexception.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/onunhandledrejection.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/onunhandledrejection.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/spotlight.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/spotlight.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/undici/index.cjs +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/undici/index.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/undici/index.js +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/undici/index.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/utils/errorhandling.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/utils/errorhandling.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/utils/http.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/integrations/utils/http.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/module.cjs +4 -4
- package/dist/_node_modules/@sentry/node/esm/module.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/module.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/nodeVersion.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/proxy/base.cjs +1 -2
- package/dist/_node_modules/@sentry/node/esm/proxy/base.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/proxy/base.js +1 -2
- package/dist/_node_modules/@sentry/node/esm/proxy/base.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/proxy/index.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/proxy/index.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/proxy/parse-proxy-response.cjs +3 -6
- package/dist/_node_modules/@sentry/node/esm/proxy/parse-proxy-response.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/proxy/parse-proxy-response.js +3 -6
- package/dist/_node_modules/@sentry/node/esm/proxy/parse-proxy-response.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/sdk.cjs +16 -16
- package/dist/_node_modules/@sentry/node/esm/sdk.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/sdk.js +6 -6
- package/dist/_node_modules/@sentry/node/esm/sdk.js.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/transports/http.cjs.map +1 -1
- package/dist/_node_modules/@sentry/node/esm/transports/http.js.map +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -1
- package/dist/_node_modules/fetch-blob/file.cjs +9 -21
- package/dist/_node_modules/fetch-blob/file.cjs.map +1 -1
- package/dist/_node_modules/fetch-blob/file.js +8 -20
- package/dist/_node_modules/fetch-blob/file.js.map +1 -1
- package/dist/_node_modules/fetch-blob/from.cjs +9 -0
- package/dist/_node_modules/fetch-blob/from.cjs.map +1 -0
- package/dist/_node_modules/fetch-blob/from.js +9 -0
- package/dist/_node_modules/fetch-blob/from.js.map +1 -0
- package/dist/_node_modules/fetch-blob/index.cjs +8 -21
- package/dist/_node_modules/fetch-blob/index.cjs.map +1 -1
- package/dist/_node_modules/fetch-blob/index.js +8 -21
- package/dist/_node_modules/fetch-blob/index.js.map +1 -1
- package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -1
- package/dist/_node_modules/fetch-blob/streams.js.map +1 -1
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs +12 -29
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -1
- package/dist/_node_modules/formdata-polyfill/esm.min.js +12 -29
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -1
- package/dist/_node_modules/lru-cache/index.cjs +1 -2
- package/dist/_node_modules/lru-cache/index.cjs.map +1 -1
- package/dist/_node_modules/lru-cache/index.js +1 -2
- package/dist/_node_modules/lru-cache/index.js.map +1 -1
- package/dist/_node_modules/node-domexception/index.cjs.map +1 -1
- package/dist/_node_modules/node-domexception/index.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/body.cjs +4 -7
- package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/body.js +5 -8
- package/dist/_node_modules/node-fetch/src/body.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/headers.cjs +1 -2
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/headers.js +1 -2
- package/dist/_node_modules/node-fetch/src/headers.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/index.cjs +2 -4
- package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/index.js +3 -5
- package/dist/_node_modules/node-fetch/src/index.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/request.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/response.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/response.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs +2 -5
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js +2 -5
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -1
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -1
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +5 -10
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -1
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +5 -10
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -1
- package/dist/_node_modules/yallist/iterator.cjs +1 -2
- package/dist/_node_modules/yallist/iterator.cjs.map +1 -1
- package/dist/_node_modules/yallist/iterator.js +1 -2
- package/dist/_node_modules/yallist/iterator.js.map +1 -1
- package/dist/_node_modules/yallist/yallist.cjs.map +1 -1
- package/dist/_node_modules/yallist/yallist.js.map +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/legacyMigrations/detectFramework.cjs.map +1 -1
- package/dist/legacyMigrations/detectFramework.js.map +1 -1
- package/dist/legacyMigrations/migrateAssets.cjs.map +1 -1
- package/dist/legacyMigrations/migrateAssets.js.map +1 -1
- package/dist/legacyMigrations/migrateSMJSON.cjs.map +1 -1
- package/dist/legacyMigrations/migrateSMJSON.js.map +1 -1
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/createSliceMachineExpressApp.cjs +1 -2
- package/dist/lib/createSliceMachineExpressApp.cjs.map +1 -1
- package/dist/lib/createSliceMachineExpressApp.js +1 -2
- package/dist/lib/createSliceMachineExpressApp.js.map +1 -1
- package/dist/lib/locateFileUpward.cjs.map +1 -1
- package/dist/lib/locateFileUpward.js.map +1 -1
- package/dist/lib/safelyExecute.cjs.map +1 -1
- package/dist/lib/safelyExecute.js.map +1 -1
- package/dist/lib/sentryErrorHandlers.cjs +2 -4
- package/dist/lib/sentryErrorHandlers.cjs.map +1 -1
- package/dist/lib/sentryErrorHandlers.js +2 -4
- package/dist/lib/sentryErrorHandlers.js.map +1 -1
- package/dist/lib/sentryFrontendTunnel.cjs.map +1 -1
- package/dist/lib/sentryFrontendTunnel.js.map +1 -1
- package/dist/lib/setupSentry.cjs +0 -4
- package/dist/lib/setupSentry.cjs.map +1 -1
- package/dist/lib/setupSentry.js +0 -4
- package/dist/lib/setupSentry.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/comparator.cjs +1 -2
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/comparator.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/comparator.js +1 -2
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/comparator.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/range.cjs +1 -2
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/range.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/range.js +1 -2
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/range.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/semver.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/classes/semver.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/clean.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/cmp.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/cmp.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/coerce.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/coerce.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/compare-build.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/compare-loose.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/compare.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/diff.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/diff.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/eq.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/gt.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/gte.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/inc.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/inc.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/lt.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/lte.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/major.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/minor.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/neq.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/parse.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/parse.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/patch.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/prerelease.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/rcompare.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/rsort.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/satisfies.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/satisfies.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/sort.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/functions/valid.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/index.cjs +4 -4
- package/dist/packages/start-slicemachine/_node_modules/semver/index.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/index.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/debug.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/debug.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/identifiers.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/identifiers.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/parse-options.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/parse-options.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/re.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/internal/re.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/gtr.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/intersects.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/intersects.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/ltr.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/max-satisfying.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/max-satisfying.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/min-satisfying.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/min-satisfying.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/min-version.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/min-version.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/outside.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/outside.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/simplify.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/simplify.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/subset.cjs +10 -11
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/subset.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/subset.js +10 -11
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/subset.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/to-comparators.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/to-comparators.js.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/valid.cjs.map +1 -1
- package/dist/packages/start-slicemachine/_node_modules/semver/ranges/valid.js.map +1 -1
- package/dist/packages/start-slicemachine/package.json.cjs +1 -1
- package/dist/packages/start-slicemachine/package.json.js +1 -1
- package/package.json +3 -3
- package/dist/lib/checkIsSentryEnabled.cjs +0 -5
- package/dist/lib/checkIsSentryEnabled.cjs.map +0 -1
- package/dist/lib/checkIsSentryEnabled.js +0 -5
- package/dist/lib/checkIsSentryEnabled.js.map +0 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
6
|
const chalk = require("chalk");
|
|
10
7
|
const open = require("open");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartSliceMachineProcess.cjs","sources":["../../src/StartSliceMachineProcess.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport type { AddressInfo } from \"node:net\";\nimport chalk from \"chalk\";\nimport open from \"open\";\nimport os from \"node:os\";\n\nimport {\n\tPrismicUserProfile,\n\tSliceMachineManager,\n\tcreateSliceMachineManager,\n} from \"@slicemachine/manager\";\n\nimport { createSliceMachineExpressApp } from \"./lib/createSliceMachineExpressApp\";\nimport { setupSentry } from \"./lib/setupSentry\";\nimport { migrateSMJSON } from \"./legacyMigrations/migrateSMJSON\";\nimport { migrateAssets } from \"./legacyMigrations/migrateAssets\";\nimport { SLICE_MACHINE_NPM_PACKAGE_NAME } from \"./constants\";\nimport { safelyExecute } from \"./lib/safelyExecute\";\n\nconst DEFAULT_SERVER_PORT = 9999;\n\ntype CreateStartSliceMachineProcessArgs = ConstructorParameters<\n\ttypeof StartSliceMachineProcess\n>;\n\nexport const createStartSliceMachineProcess = (\n\t...args: CreateStartSliceMachineProcessArgs\n): StartSliceMachineProcess => {\n\treturn new StartSliceMachineProcess(...args);\n};\n\nexport type StartSliceMachineProcessConstructorArgs = {\n\topen: boolean;\n\tport?: number;\n};\n\n/**\n * Manages the process that runs Slice Machine's server.\n */\nexport class StartSliceMachineProcess {\n\t/**\n\t * Determines if Slice Machine should automatically be opened once the server\n\t * starts.\n\t *\n\t * @defaultValue `false`\n\t */\n\topen: boolean;\n\n\t/**\n\t * The port on which to start the Slice Machine server.\n\t *\n\t * @defaultValue `9999`\n\t */\n\tport: number;\n\n\t/**\n\t * The Slice Machine manager used for the process.\n\t */\n\tprivate _sliceMachineManager: SliceMachineManager;\n\n\tconstructor(args: StartSliceMachineProcessConstructorArgs) {\n\t\tthis._sliceMachineManager = createSliceMachineManager();\n\n\t\tthis.open = args.open ?? false;\n\t\tthis.port = args.port ?? DEFAULT_SERVER_PORT;\n\t}\n\n\t/**\n\t * Runs the process.\n\t */\n\tasync run(): Promise<void> {\n\t\t// This migration needs to run before the plugins are initialised\n\t\t// Nothing can start without the config file\n\t\tawait migrateSMJSON(this._sliceMachineManager);\n\n\t\t// Initialize Segment and Sentry\n\t\tconst appVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\t\tawait this._sliceMachineManager.telemetry.initTelemetry({\n\t\t\tappName: SLICE_MACHINE_NPM_PACKAGE_NAME,\n\t\t\tappVersion,\n\t\t});\n\t\tconst isTelemetryEnabled =\n\t\t\tawait this._sliceMachineManager.telemetry.checkIsTelemetryEnabled();\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tawait setupSentry(this._sliceMachineManager);\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed tracking set up. We probably couldn't determine the\n\t\t\t\t// Sentry environment.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error setting up Sentry:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this._sliceMachineManager.plugins.initPlugins();\n\n\t\t// TODO: MIGRATION - Move this to the Migration Manager\n\t\tawait migrateAssets(this._sliceMachineManager);\n\n\t\tawait this._validateProject();\n\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tthis._trackStart();\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed start event tracking.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error tracking start event:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst app = await createSliceMachineExpressApp({\n\t\t\tsliceMachineManager: this._sliceMachineManager,\n\t\t});\n\n\t\tconst server = app.listen(this.port);\n\t\tserver.on(\"error\", (error: NodeJS.ErrnoException) => {\n\t\t\tif (error.code === \"EADDRINUSE\") {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`Error starting Slice Machine: Port ${this.port} is already in use. Please try a different port.`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error(\"Error starting Slice Machine:\", error);\n\t\t\t}\n\t\t\tprocess.exit(1);\n\t\t});\n\n\t\tconst address = server.address() as AddressInfo;\n\t\tconst url = `http://localhost:${address.port}`;\n\n\t\tif (this.open) {\n\t\t\tawait open(url);\n\t\t}\n\n\t\tconsole.log();\n\t\tconsole.log(\n\t\t\tawait this._buildSliceMachineRunningLine(\n\t\t\t\t`Running at ${chalk.magenta(url)}`,\n\t\t\t),\n\t\t);\n\t\tconsole.log();\n\n\t\tconst profile = await this._fetchProfile();\n\n\t\tif (profile) {\n\t\t\tthis._sliceMachineManager.telemetry.identify({\n\t\t\t\tuserID: profile.shortId,\n\t\t\t\tintercomHash: profile.intercomHash,\n\t\t\t});\n\n\t\t\tawait Promise.allSettled([\n\t\t\t\t// noop - We'll try again when needed.\n\t\t\t\tthis._sliceMachineManager.user.refreshAuthenticationToken(),\n\t\t\t\t// noop - We'll try again before uploading a screenshot.\n\t\t\t\tthis._sliceMachineManager.screenshots.initS3ACL(),\n\t\t\t]);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a string with Slice Machine info formatted for the console.\n\t *\n\t * @param value - Info to display.\n\t *\n\t * @returns String to pass to the console.\n\t */\n\tprivate async _buildSliceMachineRunningLine(value: string): Promise<string> {\n\t\tconst currentVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\n\t\treturn `${chalk.bgBlack(\n\t\t\t` ${chalk.bold.white(\"Slice Machine\")} ${chalk.magenta(\n\t\t\t\t`v${currentVersion}`,\n\t\t\t)} `,\n\t\t)} ${chalk.dim(\"→\")} ${value}`;\n\t}\n\n\t/**\n\t * Validates the project's config and content models.\n\t *\n\t * @throws Throws if a Library name is invalid.\n\t * @throws Throws if a Slice model is invalid.\n\t * @throws Throws if a Custom Type model is invalid.\n\t */\n\tprivate async _validateProject(): Promise<void> {\n\t\t// Validate Slice Machine config.\n\t\tconst config =\n\t\t\tawait this._sliceMachineManager.project.loadSliceMachineConfig();\n\n\t\t// Validate Library IDs\n\t\tconst invalidLibraries =\n\t\t\tconfig.libraries?.filter(\n\t\t\t\t(library) => library.startsWith(\"@\") || library.startsWith(\"~\"),\n\t\t\t) || [];\n\t\tif (invalidLibraries.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`The following Slice libraries have invalid names: ${invalidLibraries.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Slice library names must not start with \"@\" nor \"~\".`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Slice models.\n\t\tconst allSlices = await this._sliceMachineManager.slices.readAllSlices();\n\t\tif (allSlices.errors.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Errors occurred while validating your project's slices.\\n\\n${allSlices.errors.join(\n\t\t\t\t\t\"\\n\\n\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Custom Type models.\n\t\tconst allCustomTypes =\n\t\t\tawait this._sliceMachineManager.customTypes.readAllCustomTypes();\n\t\tif (allCustomTypes.errors.length > 0) {\n\t\t\t// TODO: Provide better error message.\n\t\t\tthrow new Error(allCustomTypes.errors.join(\", \"));\n\t\t}\n\t}\n\n\t/**\n\t * Fetches the logged in Prismic user's profile. If the user is not logged in,\n\t * `undefined` is returned.\n\t *\n\t * @returns The logged in Prismic user's profile, or `undefined` if not logged\n\t * in.\n\t */\n\tprivate async _fetchProfile(): Promise<PrismicUserProfile | undefined> {\n\t\tconst isLoggedIn = await this._sliceMachineManager.user.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\treturn await this._sliceMachineManager.user.getProfile();\n\t\t}\n\t}\n\n\t/**\n\t * Tracks the start of Slice Machine.\n\t *\n\t * This method is called after Slice Machine has started and so it will not\n\t * cause the process to wait for the tracking to complete.\n\t */\n\tprivate async _trackStart(): Promise<void> {\n\t\tconst [\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tcustomTypes,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tpackageManager,\n\t\t\tsimulatorUrl,\n\t\t\tsliceMachineVersion,\n\t\t\tslices,\n\t\t\tversionControlSystem,\n\t\t] = await Promise.all([\n\t\t\tsafelyExecute(() => this._sliceMachineManager.project.getAdapterName()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningAdapterVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.customTypes.readAllCustomTypes(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsAdapterUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.user.checkIsLoggedIn()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsSliceMachineUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.checkIsTypeScript(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectPackageManager(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.simulator.getLocalSliceSimulatorURL(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningSliceMachineVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.slices.readAllSlices()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectVersionControlSystem(),\n\t\t\t),\n\t\t]);\n\n\t\tthis._sliceMachineManager.telemetry.track({\n\t\t\tevent: \"slice-machine:start\",\n\t\t\t_includeEnvironmentKind: true,\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tnodeVersion: process.versions.node,\n\t\t\tnumberOfCustomTypes: customTypes?.models.length,\n\t\t\tnumberOfSlices: slices?.models.length,\n\t\t\tosPlatform: os.platform(),\n\t\t\t// Ensure we escape the \"@\" character to prevent it from being interpreted\n\t\t\t// as an email address and being considered sensitive and stripped off.\n\t\t\tpackageManager: packageManager?.replace(\"@\", \"[at]\"),\n\t\t\tprojectPort: simulatorUrl ? new URL(simulatorUrl).port : undefined,\n\t\t\tsliceMachineVersion,\n\t\t\tversionControlSystem,\n\t\t});\n\t}\n}\n"],"names":["createSliceMachineManager","migrateSMJSON","SLICE_MACHINE_NPM_PACKAGE_NAME","setupSentry","migrateAssets","createSliceMachineExpressApp","safelyExecute"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBAAsB;AAMf,MAAA,iCAAiC,IAC1C,SAC0B;AACtB,SAAA,IAAI,yBAAyB,GAAG,IAAI;AAC5C;MAUa,yBAAwB;AAAA,EAqBpC,YAAY,MAA6C;AAdzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKQ;AAAA;AAAA;AAAA;AAGP,SAAK,uBAAuBA,QAAAA;AAEvB,SAAA,OAAO,KAAK,QAAQ;AACpB,SAAA,OAAO,KAAK,QAAQ;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MAAG;AAGF,UAAAC,cAAA,cAAc,KAAK,oBAAoB;AAG7C,UAAM,aACL,MAAM,KAAK,qBAAqB,SAAS,8BAA6B;AACjE,UAAA,KAAK,qBAAqB,UAAU,cAAc;AAAA,MACvD,SAASC,UAAA;AAAA,MACT;AAAA,IAAA,CACA;AACD,UAAM,qBACL,MAAM,KAAK,qBAAqB,UAAU,wBAAuB;AAClE,QAAI,oBAAoB;AACnB,UAAA;AACG,cAAAC,YAAA,YAAY,KAAK,oBAAoB;AAAA,eACnC,OAAO;AAAA,MAQhB;AAAA,IACD;AAEM,UAAA,KAAK,qBAAqB,QAAQ;AAGlC,UAAAC,cAAA,cAAc,KAAK,oBAAoB;AAE7C,UAAM,KAAK;AAEX,QAAI,oBAAoB;AACnB,UAAA;AACH,aAAK,YAAW;AAAA,eACR,OAAO;AAAA,MAOhB;AAAA,IACD;AAEM,UAAA,MAAM,MAAMC,0DAA6B;AAAA,MAC9C,qBAAqB,KAAK;AAAA,IAAA,CAC1B;AAED,UAAM,SAAS,IAAI,OAAO,KAAK,IAAI;AAC5B,WAAA,GAAG,SAAS,CAAC,UAAgC;AAC/C,UAAA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AAA,MAExEA,cAAAA,cAAc,MACb,KAAK,qBAAqB,QAAQ,mBAAmB;AAAA,MAEtDA,cAAAA,cAAc,MACb,KAAK,qBAAqB,QAAQ,sBAAsB;AAAA,MAEzDA,cAAAA,cAAc,MACb,KAAK,qBAAqB,UAAU,2BAA2B;AAAA,MAEhEA,cAAAA,cAAc,MACb,KAAK,qBAAqB,SAAS,+BAA+B;AAAA,MAEnEA,cAAAA,cAAc,MAAM,KAAK,qBAAqB,OAAO,eAAe;AAAA,MACpEA,cAAAA,cAAc,MACb,KAAK,qBAAqB,QAAQ,4BAA4B;AAAA,IAAA,CAE/D;AAEI,SAAA,qBAAqB,UAAU,MAAM;AAAA,MACzC,OAAO;AAAA,MACP,yBAAyB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,QAAQ,SAAS;AAAA,MAC9B,qBAAqB,2CAAa,OAAO;AAAA,MACzC,gBAAgB,iCAAQ,OAAO;AAAA,MAC/B,YAAY,GAAG,SAAU;AAAA;AAAA;AAAA,MAGzB,gBAAgB,iDAAgB,QAAQ,KAAK;AAAA,MAC7C,aAAa,eAAe,IAAI,IAAI,YAAY,EAAE,OAAO;AAAA,MACzD;AAAA,MACA;AAAA,IAAA,CACA;AAAA,EACF;AACA;;;"}
|
|
1
|
+
{"version":3,"file":"StartSliceMachineProcess.cjs","sources":["../../src/StartSliceMachineProcess.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport type { AddressInfo } from \"node:net\";\nimport chalk from \"chalk\";\nimport open from \"open\";\nimport os from \"node:os\";\n\nimport {\n\tPrismicUserProfile,\n\tSliceMachineManager,\n\tcreateSliceMachineManager,\n} from \"@slicemachine/manager\";\n\nimport { createSliceMachineExpressApp } from \"./lib/createSliceMachineExpressApp\";\nimport { setupSentry } from \"./lib/setupSentry\";\nimport { migrateSMJSON } from \"./legacyMigrations/migrateSMJSON\";\nimport { migrateAssets } from \"./legacyMigrations/migrateAssets\";\nimport { SLICE_MACHINE_NPM_PACKAGE_NAME } from \"./constants\";\nimport { safelyExecute } from \"./lib/safelyExecute\";\n\nconst DEFAULT_SERVER_PORT = 9999;\n\ntype CreateStartSliceMachineProcessArgs = ConstructorParameters<\n\ttypeof StartSliceMachineProcess\n>;\n\nexport const createStartSliceMachineProcess = (\n\t...args: CreateStartSliceMachineProcessArgs\n): StartSliceMachineProcess => {\n\treturn new StartSliceMachineProcess(...args);\n};\n\nexport type StartSliceMachineProcessConstructorArgs = {\n\topen: boolean;\n\tport?: number;\n};\n\n/**\n * Manages the process that runs Slice Machine's server.\n */\nexport class StartSliceMachineProcess {\n\t/**\n\t * Determines if Slice Machine should automatically be opened once the server\n\t * starts.\n\t *\n\t * @defaultValue `false`\n\t */\n\topen: boolean;\n\n\t/**\n\t * The port on which to start the Slice Machine server.\n\t *\n\t * @defaultValue `9999`\n\t */\n\tport: number;\n\n\t/**\n\t * The Slice Machine manager used for the process.\n\t */\n\tprivate _sliceMachineManager: SliceMachineManager;\n\n\tconstructor(args: StartSliceMachineProcessConstructorArgs) {\n\t\tthis._sliceMachineManager = createSliceMachineManager();\n\n\t\tthis.open = args.open ?? false;\n\t\tthis.port = args.port ?? DEFAULT_SERVER_PORT;\n\t}\n\n\t/**\n\t * Runs the process.\n\t */\n\tasync run(): Promise<void> {\n\t\t// This migration needs to run before the plugins are initialised\n\t\t// Nothing can start without the config file\n\t\tawait migrateSMJSON(this._sliceMachineManager);\n\n\t\t// Initialize Segment and Sentry\n\t\tconst appVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\t\tawait this._sliceMachineManager.telemetry.initTelemetry({\n\t\t\tappName: SLICE_MACHINE_NPM_PACKAGE_NAME,\n\t\t\tappVersion,\n\t\t});\n\t\tconst isTelemetryEnabled =\n\t\t\tawait this._sliceMachineManager.telemetry.checkIsTelemetryEnabled();\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tawait setupSentry(this._sliceMachineManager);\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed tracking set up. We probably couldn't determine the\n\t\t\t\t// Sentry environment.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error setting up Sentry:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this._sliceMachineManager.plugins.initPlugins();\n\n\t\t// TODO: MIGRATION - Move this to the Migration Manager\n\t\tawait migrateAssets(this._sliceMachineManager);\n\n\t\tawait this._validateProject();\n\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tthis._trackStart();\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed start event tracking.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error tracking start event:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst app = await createSliceMachineExpressApp({\n\t\t\tsliceMachineManager: this._sliceMachineManager,\n\t\t});\n\n\t\tconst server = app.listen(this.port);\n\t\tserver.on(\"error\", (error: NodeJS.ErrnoException) => {\n\t\t\tif (error.code === \"EADDRINUSE\") {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`Error starting Slice Machine: Port ${this.port} is already in use. Please try a different port.`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error(\"Error starting Slice Machine:\", error);\n\t\t\t}\n\t\t\tprocess.exit(1);\n\t\t});\n\n\t\tconst address = server.address() as AddressInfo;\n\t\tconst url = `http://localhost:${address.port}`;\n\n\t\tif (this.open) {\n\t\t\tawait open(url);\n\t\t}\n\n\t\tconsole.log();\n\t\tconsole.log(\n\t\t\tawait this._buildSliceMachineRunningLine(\n\t\t\t\t`Running at ${chalk.magenta(url)}`,\n\t\t\t),\n\t\t);\n\t\tconsole.log();\n\n\t\tconst profile = await this._fetchProfile();\n\n\t\tif (profile) {\n\t\t\tthis._sliceMachineManager.telemetry.identify({\n\t\t\t\tuserID: profile.shortId,\n\t\t\t\tintercomHash: profile.intercomHash,\n\t\t\t});\n\n\t\t\tawait Promise.allSettled([\n\t\t\t\t// noop - We'll try again when needed.\n\t\t\t\tthis._sliceMachineManager.user.refreshAuthenticationToken(),\n\t\t\t\t// noop - We'll try again before uploading a screenshot.\n\t\t\t\tthis._sliceMachineManager.screenshots.initS3ACL(),\n\t\t\t]);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a string with Slice Machine info formatted for the console.\n\t *\n\t * @param value - Info to display.\n\t *\n\t * @returns String to pass to the console.\n\t */\n\tprivate async _buildSliceMachineRunningLine(value: string): Promise<string> {\n\t\tconst currentVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\n\t\treturn `${chalk.bgBlack(\n\t\t\t` ${chalk.bold.white(\"Slice Machine\")} ${chalk.magenta(\n\t\t\t\t`v${currentVersion}`,\n\t\t\t)} `,\n\t\t)} ${chalk.dim(\"→\")} ${value}`;\n\t}\n\n\t/**\n\t * Validates the project's config and content models.\n\t *\n\t * @throws Throws if a Library name is invalid.\n\t * @throws Throws if a Slice model is invalid.\n\t * @throws Throws if a Custom Type model is invalid.\n\t */\n\tprivate async _validateProject(): Promise<void> {\n\t\t// Validate Slice Machine config.\n\t\tconst config =\n\t\t\tawait this._sliceMachineManager.project.loadSliceMachineConfig();\n\n\t\t// Validate Library IDs\n\t\tconst invalidLibraries =\n\t\t\tconfig.libraries?.filter(\n\t\t\t\t(library) => library.startsWith(\"@\") || library.startsWith(\"~\"),\n\t\t\t) || [];\n\t\tif (invalidLibraries.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`The following Slice libraries have invalid names: ${invalidLibraries.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Slice library names must not start with \"@\" nor \"~\".`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Slice models.\n\t\tconst allSlices = await this._sliceMachineManager.slices.readAllSlices();\n\t\tif (allSlices.errors.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Errors occurred while validating your project's slices.\\n\\n${allSlices.errors.join(\n\t\t\t\t\t\"\\n\\n\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Custom Type models.\n\t\tconst allCustomTypes =\n\t\t\tawait this._sliceMachineManager.customTypes.readAllCustomTypes();\n\t\tif (allCustomTypes.errors.length > 0) {\n\t\t\t// TODO: Provide better error message.\n\t\t\tthrow new Error(allCustomTypes.errors.join(\", \"));\n\t\t}\n\t}\n\n\t/**\n\t * Fetches the logged in Prismic user's profile. If the user is not logged in,\n\t * `undefined` is returned.\n\t *\n\t * @returns The logged in Prismic user's profile, or `undefined` if not logged\n\t * in.\n\t */\n\tprivate async _fetchProfile(): Promise<PrismicUserProfile | undefined> {\n\t\tconst isLoggedIn = await this._sliceMachineManager.user.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\treturn await this._sliceMachineManager.user.getProfile();\n\t\t}\n\t}\n\n\t/**\n\t * Tracks the start of Slice Machine.\n\t *\n\t * This method is called after Slice Machine has started and so it will not\n\t * cause the process to wait for the tracking to complete.\n\t */\n\tprivate async _trackStart(): Promise<void> {\n\t\tconst [\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tcustomTypes,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tpackageManager,\n\t\t\tsimulatorUrl,\n\t\t\tsliceMachineVersion,\n\t\t\tslices,\n\t\t\tversionControlSystem,\n\t\t] = await Promise.all([\n\t\t\tsafelyExecute(() => this._sliceMachineManager.project.getAdapterName()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningAdapterVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.customTypes.readAllCustomTypes(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsAdapterUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.user.checkIsLoggedIn()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsSliceMachineUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.checkIsTypeScript(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectPackageManager(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.simulator.getLocalSliceSimulatorURL(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningSliceMachineVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.slices.readAllSlices()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectVersionControlSystem(),\n\t\t\t),\n\t\t]);\n\n\t\tthis._sliceMachineManager.telemetry.track({\n\t\t\tevent: \"slice-machine:start\",\n\t\t\t_includeEnvironmentKind: true,\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tnodeVersion: process.versions.node,\n\t\t\tnumberOfCustomTypes: customTypes?.models.length,\n\t\t\tnumberOfSlices: slices?.models.length,\n\t\t\tosPlatform: os.platform(),\n\t\t\t// Ensure we escape the \"@\" character to prevent it from being interpreted\n\t\t\t// as an email address and being considered sensitive and stripped off.\n\t\t\tpackageManager: packageManager?.replace(\"@\", \"[at]\"),\n\t\t\tprojectPort: simulatorUrl ? new URL(simulatorUrl).port : undefined,\n\t\t\tsliceMachineVersion,\n\t\t\tversionControlSystem,\n\t\t});\n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AAAA,cAAc,MACb,KAAK,qBAAqB,SAAS,oCAAoC;AAAA,MAExEA,cAAAA,cAAc,MACb,KAAK,qBAAqB,QAAQ,mBAAmB;AAAA,MAEtDA,cAAAA,cAAc,MACb,KAAK,qBAAqB,QAAQ,sBAAsB;AAAA,MAEzDA,cAAAA,cAAc,MACb,KAAK,qBAAqB,UAAU,2BAA2B;AAAA,MAEhEA,cAAAA,cAAc,MACb,KAAK,qBAAqB,SAAS,+BAA+B;AAAA,MAEnEA,cAAAA,cAAc,MAAM,KAAK,qBAAqB,OAAO,eAAe;AAAA,MACpEA,cAAAA,cAAc,MACb,KAAK,qBAAqB,QAAQ,4BAA4B;AAAA,IAAA,CAE/D;AAED,SAAK,qBAAqB,UAAU,MAAM;AAAA,MACzC,OAAO;AAAA,MACP,yBAAyB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,QAAQ,SAAS;AAAA,MAC9B,qBAAqB,2CAAa,OAAO;AAAA,MACzC,gBAAgB,iCAAQ,OAAO;AAAA,MAC/B,YAAY,GAAG,SAAA;AAAA;AAAA;AAAA,MAGf,gBAAgB,iDAAgB,QAAQ,KAAK;AAAA,MAC7C,aAAa,eAAe,IAAI,IAAI,YAAY,EAAE,OAAO;AAAA,MACzD;AAAA,MACA;AAAA,IAAA,CACA;AAAA,EACF;AACA;;;"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import chalk from "chalk";
|
|
8
5
|
import open from "open";
|
|
9
6
|
import os from "node:os";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartSliceMachineProcess.js","sources":["../../src/StartSliceMachineProcess.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport type { AddressInfo } from \"node:net\";\nimport chalk from \"chalk\";\nimport open from \"open\";\nimport os from \"node:os\";\n\nimport {\n\tPrismicUserProfile,\n\tSliceMachineManager,\n\tcreateSliceMachineManager,\n} from \"@slicemachine/manager\";\n\nimport { createSliceMachineExpressApp } from \"./lib/createSliceMachineExpressApp\";\nimport { setupSentry } from \"./lib/setupSentry\";\nimport { migrateSMJSON } from \"./legacyMigrations/migrateSMJSON\";\nimport { migrateAssets } from \"./legacyMigrations/migrateAssets\";\nimport { SLICE_MACHINE_NPM_PACKAGE_NAME } from \"./constants\";\nimport { safelyExecute } from \"./lib/safelyExecute\";\n\nconst DEFAULT_SERVER_PORT = 9999;\n\ntype CreateStartSliceMachineProcessArgs = ConstructorParameters<\n\ttypeof StartSliceMachineProcess\n>;\n\nexport const createStartSliceMachineProcess = (\n\t...args: CreateStartSliceMachineProcessArgs\n): StartSliceMachineProcess => {\n\treturn new StartSliceMachineProcess(...args);\n};\n\nexport type StartSliceMachineProcessConstructorArgs = {\n\topen: boolean;\n\tport?: number;\n};\n\n/**\n * Manages the process that runs Slice Machine's server.\n */\nexport class StartSliceMachineProcess {\n\t/**\n\t * Determines if Slice Machine should automatically be opened once the server\n\t * starts.\n\t *\n\t * @defaultValue `false`\n\t */\n\topen: boolean;\n\n\t/**\n\t * The port on which to start the Slice Machine server.\n\t *\n\t * @defaultValue `9999`\n\t */\n\tport: number;\n\n\t/**\n\t * The Slice Machine manager used for the process.\n\t */\n\tprivate _sliceMachineManager: SliceMachineManager;\n\n\tconstructor(args: StartSliceMachineProcessConstructorArgs) {\n\t\tthis._sliceMachineManager = createSliceMachineManager();\n\n\t\tthis.open = args.open ?? false;\n\t\tthis.port = args.port ?? DEFAULT_SERVER_PORT;\n\t}\n\n\t/**\n\t * Runs the process.\n\t */\n\tasync run(): Promise<void> {\n\t\t// This migration needs to run before the plugins are initialised\n\t\t// Nothing can start without the config file\n\t\tawait migrateSMJSON(this._sliceMachineManager);\n\n\t\t// Initialize Segment and Sentry\n\t\tconst appVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\t\tawait this._sliceMachineManager.telemetry.initTelemetry({\n\t\t\tappName: SLICE_MACHINE_NPM_PACKAGE_NAME,\n\t\t\tappVersion,\n\t\t});\n\t\tconst isTelemetryEnabled =\n\t\t\tawait this._sliceMachineManager.telemetry.checkIsTelemetryEnabled();\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tawait setupSentry(this._sliceMachineManager);\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed tracking set up. We probably couldn't determine the\n\t\t\t\t// Sentry environment.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error setting up Sentry:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this._sliceMachineManager.plugins.initPlugins();\n\n\t\t// TODO: MIGRATION - Move this to the Migration Manager\n\t\tawait migrateAssets(this._sliceMachineManager);\n\n\t\tawait this._validateProject();\n\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tthis._trackStart();\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed start event tracking.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error tracking start event:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst app = await createSliceMachineExpressApp({\n\t\t\tsliceMachineManager: this._sliceMachineManager,\n\t\t});\n\n\t\tconst server = app.listen(this.port);\n\t\tserver.on(\"error\", (error: NodeJS.ErrnoException) => {\n\t\t\tif (error.code === \"EADDRINUSE\") {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`Error starting Slice Machine: Port ${this.port} is already in use. Please try a different port.`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error(\"Error starting Slice Machine:\", error);\n\t\t\t}\n\t\t\tprocess.exit(1);\n\t\t});\n\n\t\tconst address = server.address() as AddressInfo;\n\t\tconst url = `http://localhost:${address.port}`;\n\n\t\tif (this.open) {\n\t\t\tawait open(url);\n\t\t}\n\n\t\tconsole.log();\n\t\tconsole.log(\n\t\t\tawait this._buildSliceMachineRunningLine(\n\t\t\t\t`Running at ${chalk.magenta(url)}`,\n\t\t\t),\n\t\t);\n\t\tconsole.log();\n\n\t\tconst profile = await this._fetchProfile();\n\n\t\tif (profile) {\n\t\t\tthis._sliceMachineManager.telemetry.identify({\n\t\t\t\tuserID: profile.shortId,\n\t\t\t\tintercomHash: profile.intercomHash,\n\t\t\t});\n\n\t\t\tawait Promise.allSettled([\n\t\t\t\t// noop - We'll try again when needed.\n\t\t\t\tthis._sliceMachineManager.user.refreshAuthenticationToken(),\n\t\t\t\t// noop - We'll try again before uploading a screenshot.\n\t\t\t\tthis._sliceMachineManager.screenshots.initS3ACL(),\n\t\t\t]);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a string with Slice Machine info formatted for the console.\n\t *\n\t * @param value - Info to display.\n\t *\n\t * @returns String to pass to the console.\n\t */\n\tprivate async _buildSliceMachineRunningLine(value: string): Promise<string> {\n\t\tconst currentVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\n\t\treturn `${chalk.bgBlack(\n\t\t\t` ${chalk.bold.white(\"Slice Machine\")} ${chalk.magenta(\n\t\t\t\t`v${currentVersion}`,\n\t\t\t)} `,\n\t\t)} ${chalk.dim(\"→\")} ${value}`;\n\t}\n\n\t/**\n\t * Validates the project's config and content models.\n\t *\n\t * @throws Throws if a Library name is invalid.\n\t * @throws Throws if a Slice model is invalid.\n\t * @throws Throws if a Custom Type model is invalid.\n\t */\n\tprivate async _validateProject(): Promise<void> {\n\t\t// Validate Slice Machine config.\n\t\tconst config =\n\t\t\tawait this._sliceMachineManager.project.loadSliceMachineConfig();\n\n\t\t// Validate Library IDs\n\t\tconst invalidLibraries =\n\t\t\tconfig.libraries?.filter(\n\t\t\t\t(library) => library.startsWith(\"@\") || library.startsWith(\"~\"),\n\t\t\t) || [];\n\t\tif (invalidLibraries.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`The following Slice libraries have invalid names: ${invalidLibraries.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Slice library names must not start with \"@\" nor \"~\".`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Slice models.\n\t\tconst allSlices = await this._sliceMachineManager.slices.readAllSlices();\n\t\tif (allSlices.errors.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Errors occurred while validating your project's slices.\\n\\n${allSlices.errors.join(\n\t\t\t\t\t\"\\n\\n\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Custom Type models.\n\t\tconst allCustomTypes =\n\t\t\tawait this._sliceMachineManager.customTypes.readAllCustomTypes();\n\t\tif (allCustomTypes.errors.length > 0) {\n\t\t\t// TODO: Provide better error message.\n\t\t\tthrow new Error(allCustomTypes.errors.join(\", \"));\n\t\t}\n\t}\n\n\t/**\n\t * Fetches the logged in Prismic user's profile. If the user is not logged in,\n\t * `undefined` is returned.\n\t *\n\t * @returns The logged in Prismic user's profile, or `undefined` if not logged\n\t * in.\n\t */\n\tprivate async _fetchProfile(): Promise<PrismicUserProfile | undefined> {\n\t\tconst isLoggedIn = await this._sliceMachineManager.user.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\treturn await this._sliceMachineManager.user.getProfile();\n\t\t}\n\t}\n\n\t/**\n\t * Tracks the start of Slice Machine.\n\t *\n\t * This method is called after Slice Machine has started and so it will not\n\t * cause the process to wait for the tracking to complete.\n\t */\n\tprivate async _trackStart(): Promise<void> {\n\t\tconst [\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tcustomTypes,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tpackageManager,\n\t\t\tsimulatorUrl,\n\t\t\tsliceMachineVersion,\n\t\t\tslices,\n\t\t\tversionControlSystem,\n\t\t] = await Promise.all([\n\t\t\tsafelyExecute(() => this._sliceMachineManager.project.getAdapterName()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningAdapterVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.customTypes.readAllCustomTypes(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsAdapterUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.user.checkIsLoggedIn()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsSliceMachineUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.checkIsTypeScript(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectPackageManager(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.simulator.getLocalSliceSimulatorURL(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningSliceMachineVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.slices.readAllSlices()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectVersionControlSystem(),\n\t\t\t),\n\t\t]);\n\n\t\tthis._sliceMachineManager.telemetry.track({\n\t\t\tevent: \"slice-machine:start\",\n\t\t\t_includeEnvironmentKind: true,\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tnodeVersion: process.versions.node,\n\t\t\tnumberOfCustomTypes: customTypes?.models.length,\n\t\t\tnumberOfSlices: slices?.models.length,\n\t\t\tosPlatform: os.platform(),\n\t\t\t// Ensure we escape the \"@\" character to prevent it from being interpreted\n\t\t\t// as an email address and being considered sensitive and stripped off.\n\t\t\tpackageManager: packageManager?.replace(\"@\", \"[at]\"),\n\t\t\tprojectPort: simulatorUrl ? new URL(simulatorUrl).port : undefined,\n\t\t\tsliceMachineVersion,\n\t\t\tversionControlSystem,\n\t\t});\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,sBAAsB;AAMf,MAAA,iCAAiC,IAC1C,SAC0B;AACtB,SAAA,IAAI,yBAAyB,GAAG,IAAI;AAC5C;MAUa,yBAAwB;AAAA,EAqBpC,YAAY,MAA6C;AAdzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKQ;AAAA;AAAA;AAAA;AAGP,SAAK,uBAAuB;AAEvB,SAAA,OAAO,KAAK,QAAQ;AACpB,SAAA,OAAO,KAAK,QAAQ;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MAAG;AAGF,UAAA,cAAc,KAAK,oBAAoB;AAG7C,UAAM,aACL,MAAM,KAAK,qBAAqB,SAAS,8BAA6B;AACjE,UAAA,KAAK,qBAAqB,UAAU,cAAc;AAAA,MACvD,SAAS;AAAA,MACT;AAAA,IAAA,CACA;AACD,UAAM,qBACL,MAAM,KAAK,qBAAqB,UAAU,wBAAuB;AAClE,QAAI,oBAAoB;AACnB,UAAA;AACG,cAAA,YAAY,KAAK,oBAAoB;AAAA,eACnC,OAAO;AAAA,MAQhB;AAAA,IACD;AAE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AAK,qBAAqB,QAAQ,gBAAgB;AAAA,MACtE,cAAc,MACb,KAAK,qBAAqB,SAAS,0BAA0B;AAAA,MAE9D,cAAc,MACb,KAAK,qBAAqB,YAAY,oBAAoB;AAAA,MAE3D,cAAc,MACb,KAAK,qBAAqB,SAAS,+BAA+B;AAAA,MAEnE,cAAc,MAAM,KAAK,qBAAqB,KAAK,iBAAiB;AAAA,MACpE,cAAc,MACb,KAAK,qBAAqB,SAAS,oCAAoC;AAAA,MAExE,cAAc,MACb,KAAK,qBAAqB,QAAQ,mBAAmB;AAAA,MAEtD,cAAc,MACb,KAAK,qBAAqB,QAAQ,sBAAsB;AAAA,MAEzD,cAAc,MACb,KAAK,qBAAqB,UAAU,2BAA2B;AAAA,MAEhE,cAAc,MACb,KAAK,qBAAqB,SAAS,+BAA+B;AAAA,MAEnE,cAAc,MAAM,KAAK,qBAAqB,OAAO,eAAe;AAAA,MACpE,cAAc,MACb,KAAK,qBAAqB,QAAQ,4BAA4B;AAAA,IAAA,CAE/D;AAEI,SAAA,qBAAqB,UAAU,MAAM;AAAA,MACzC,OAAO;AAAA,MACP,yBAAyB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,QAAQ,SAAS;AAAA,MAC9B,qBAAqB,2CAAa,OAAO;AAAA,MACzC,gBAAgB,iCAAQ,OAAO;AAAA,MAC/B,YAAY,GAAG,SAAU;AAAA;AAAA;AAAA,MAGzB,gBAAgB,iDAAgB,QAAQ,KAAK;AAAA,MAC7C,aAAa,eAAe,IAAI,IAAI,YAAY,EAAE,OAAO;AAAA,MACzD;AAAA,MACA;AAAA,IAAA,CACA;AAAA,EACF;AACA;"}
|
|
1
|
+
{"version":3,"file":"StartSliceMachineProcess.js","sources":["../../src/StartSliceMachineProcess.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport type { AddressInfo } from \"node:net\";\nimport chalk from \"chalk\";\nimport open from \"open\";\nimport os from \"node:os\";\n\nimport {\n\tPrismicUserProfile,\n\tSliceMachineManager,\n\tcreateSliceMachineManager,\n} from \"@slicemachine/manager\";\n\nimport { createSliceMachineExpressApp } from \"./lib/createSliceMachineExpressApp\";\nimport { setupSentry } from \"./lib/setupSentry\";\nimport { migrateSMJSON } from \"./legacyMigrations/migrateSMJSON\";\nimport { migrateAssets } from \"./legacyMigrations/migrateAssets\";\nimport { SLICE_MACHINE_NPM_PACKAGE_NAME } from \"./constants\";\nimport { safelyExecute } from \"./lib/safelyExecute\";\n\nconst DEFAULT_SERVER_PORT = 9999;\n\ntype CreateStartSliceMachineProcessArgs = ConstructorParameters<\n\ttypeof StartSliceMachineProcess\n>;\n\nexport const createStartSliceMachineProcess = (\n\t...args: CreateStartSliceMachineProcessArgs\n): StartSliceMachineProcess => {\n\treturn new StartSliceMachineProcess(...args);\n};\n\nexport type StartSliceMachineProcessConstructorArgs = {\n\topen: boolean;\n\tport?: number;\n};\n\n/**\n * Manages the process that runs Slice Machine's server.\n */\nexport class StartSliceMachineProcess {\n\t/**\n\t * Determines if Slice Machine should automatically be opened once the server\n\t * starts.\n\t *\n\t * @defaultValue `false`\n\t */\n\topen: boolean;\n\n\t/**\n\t * The port on which to start the Slice Machine server.\n\t *\n\t * @defaultValue `9999`\n\t */\n\tport: number;\n\n\t/**\n\t * The Slice Machine manager used for the process.\n\t */\n\tprivate _sliceMachineManager: SliceMachineManager;\n\n\tconstructor(args: StartSliceMachineProcessConstructorArgs) {\n\t\tthis._sliceMachineManager = createSliceMachineManager();\n\n\t\tthis.open = args.open ?? false;\n\t\tthis.port = args.port ?? DEFAULT_SERVER_PORT;\n\t}\n\n\t/**\n\t * Runs the process.\n\t */\n\tasync run(): Promise<void> {\n\t\t// This migration needs to run before the plugins are initialised\n\t\t// Nothing can start without the config file\n\t\tawait migrateSMJSON(this._sliceMachineManager);\n\n\t\t// Initialize Segment and Sentry\n\t\tconst appVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\t\tawait this._sliceMachineManager.telemetry.initTelemetry({\n\t\t\tappName: SLICE_MACHINE_NPM_PACKAGE_NAME,\n\t\t\tappVersion,\n\t\t});\n\t\tconst isTelemetryEnabled =\n\t\t\tawait this._sliceMachineManager.telemetry.checkIsTelemetryEnabled();\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tawait setupSentry(this._sliceMachineManager);\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed tracking set up. We probably couldn't determine the\n\t\t\t\t// Sentry environment.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error setting up Sentry:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this._sliceMachineManager.plugins.initPlugins();\n\n\t\t// TODO: MIGRATION - Move this to the Migration Manager\n\t\tawait migrateAssets(this._sliceMachineManager);\n\n\t\tawait this._validateProject();\n\n\t\tif (isTelemetryEnabled) {\n\t\t\ttry {\n\t\t\t\tthis._trackStart();\n\t\t\t} catch (error) {\n\t\t\t\t// noop - We don't want to stop the user from using Slice Machine\n\t\t\t\t// because of failed start event tracking.\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tconsole.error(\"Error tracking start event:\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst app = await createSliceMachineExpressApp({\n\t\t\tsliceMachineManager: this._sliceMachineManager,\n\t\t});\n\n\t\tconst server = app.listen(this.port);\n\t\tserver.on(\"error\", (error: NodeJS.ErrnoException) => {\n\t\t\tif (error.code === \"EADDRINUSE\") {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`Error starting Slice Machine: Port ${this.port} is already in use. Please try a different port.`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error(\"Error starting Slice Machine:\", error);\n\t\t\t}\n\t\t\tprocess.exit(1);\n\t\t});\n\n\t\tconst address = server.address() as AddressInfo;\n\t\tconst url = `http://localhost:${address.port}`;\n\n\t\tif (this.open) {\n\t\t\tawait open(url);\n\t\t}\n\n\t\tconsole.log();\n\t\tconsole.log(\n\t\t\tawait this._buildSliceMachineRunningLine(\n\t\t\t\t`Running at ${chalk.magenta(url)}`,\n\t\t\t),\n\t\t);\n\t\tconsole.log();\n\n\t\tconst profile = await this._fetchProfile();\n\n\t\tif (profile) {\n\t\t\tthis._sliceMachineManager.telemetry.identify({\n\t\t\t\tuserID: profile.shortId,\n\t\t\t\tintercomHash: profile.intercomHash,\n\t\t\t});\n\n\t\t\tawait Promise.allSettled([\n\t\t\t\t// noop - We'll try again when needed.\n\t\t\t\tthis._sliceMachineManager.user.refreshAuthenticationToken(),\n\t\t\t\t// noop - We'll try again before uploading a screenshot.\n\t\t\t\tthis._sliceMachineManager.screenshots.initS3ACL(),\n\t\t\t]);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a string with Slice Machine info formatted for the console.\n\t *\n\t * @param value - Info to display.\n\t *\n\t * @returns String to pass to the console.\n\t */\n\tprivate async _buildSliceMachineRunningLine(value: string): Promise<string> {\n\t\tconst currentVersion =\n\t\t\tawait this._sliceMachineManager.versions.getRunningSliceMachineVersion();\n\n\t\treturn `${chalk.bgBlack(\n\t\t\t` ${chalk.bold.white(\"Slice Machine\")} ${chalk.magenta(\n\t\t\t\t`v${currentVersion}`,\n\t\t\t)} `,\n\t\t)} ${chalk.dim(\"→\")} ${value}`;\n\t}\n\n\t/**\n\t * Validates the project's config and content models.\n\t *\n\t * @throws Throws if a Library name is invalid.\n\t * @throws Throws if a Slice model is invalid.\n\t * @throws Throws if a Custom Type model is invalid.\n\t */\n\tprivate async _validateProject(): Promise<void> {\n\t\t// Validate Slice Machine config.\n\t\tconst config =\n\t\t\tawait this._sliceMachineManager.project.loadSliceMachineConfig();\n\n\t\t// Validate Library IDs\n\t\tconst invalidLibraries =\n\t\t\tconfig.libraries?.filter(\n\t\t\t\t(library) => library.startsWith(\"@\") || library.startsWith(\"~\"),\n\t\t\t) || [];\n\t\tif (invalidLibraries.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`The following Slice libraries have invalid names: ${invalidLibraries.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)}. Slice library names must not start with \"@\" nor \"~\".`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Slice models.\n\t\tconst allSlices = await this._sliceMachineManager.slices.readAllSlices();\n\t\tif (allSlices.errors.length > 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Errors occurred while validating your project's slices.\\n\\n${allSlices.errors.join(\n\t\t\t\t\t\"\\n\\n\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\t// Validate Custom Type models.\n\t\tconst allCustomTypes =\n\t\t\tawait this._sliceMachineManager.customTypes.readAllCustomTypes();\n\t\tif (allCustomTypes.errors.length > 0) {\n\t\t\t// TODO: Provide better error message.\n\t\t\tthrow new Error(allCustomTypes.errors.join(\", \"));\n\t\t}\n\t}\n\n\t/**\n\t * Fetches the logged in Prismic user's profile. If the user is not logged in,\n\t * `undefined` is returned.\n\t *\n\t * @returns The logged in Prismic user's profile, or `undefined` if not logged\n\t * in.\n\t */\n\tprivate async _fetchProfile(): Promise<PrismicUserProfile | undefined> {\n\t\tconst isLoggedIn = await this._sliceMachineManager.user.checkIsLoggedIn();\n\n\t\tif (isLoggedIn) {\n\t\t\treturn await this._sliceMachineManager.user.getProfile();\n\t\t}\n\t}\n\n\t/**\n\t * Tracks the start of Slice Machine.\n\t *\n\t * This method is called after Slice Machine has started and so it will not\n\t * cause the process to wait for the tracking to complete.\n\t */\n\tprivate async _trackStart(): Promise<void> {\n\t\tconst [\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tcustomTypes,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tpackageManager,\n\t\t\tsimulatorUrl,\n\t\t\tsliceMachineVersion,\n\t\t\tslices,\n\t\t\tversionControlSystem,\n\t\t] = await Promise.all([\n\t\t\tsafelyExecute(() => this._sliceMachineManager.project.getAdapterName()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningAdapterVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.customTypes.readAllCustomTypes(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsAdapterUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.user.checkIsLoggedIn()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.checkIsSliceMachineUpdateAvailable(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.checkIsTypeScript(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectPackageManager(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.simulator.getLocalSliceSimulatorURL(),\n\t\t\t),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.versions.getRunningSliceMachineVersion(),\n\t\t\t),\n\t\t\tsafelyExecute(() => this._sliceMachineManager.slices.readAllSlices()),\n\t\t\tsafelyExecute(() =>\n\t\t\t\tthis._sliceMachineManager.project.detectVersionControlSystem(),\n\t\t\t),\n\t\t]);\n\n\t\tthis._sliceMachineManager.telemetry.track({\n\t\t\tevent: \"slice-machine:start\",\n\t\t\t_includeEnvironmentKind: true,\n\t\t\tadapter,\n\t\t\tadapterVersion,\n\t\t\tisAdapterUpdateAvailable,\n\t\t\tisLoggedIn,\n\t\t\tisSliceMachineUpdateAvailable,\n\t\t\tisTypeScriptProject,\n\t\t\tnodeVersion: process.versions.node,\n\t\t\tnumberOfCustomTypes: customTypes?.models.length,\n\t\t\tnumberOfSlices: slices?.models.length,\n\t\t\tosPlatform: os.platform(),\n\t\t\t// Ensure we escape the \"@\" character to prevent it from being interpreted\n\t\t\t// as an email address and being considered sensitive and stripped off.\n\t\t\tpackageManager: packageManager?.replace(\"@\", \"[at]\"),\n\t\t\tprojectPort: simulatorUrl ? new URL(simulatorUrl).port : undefined,\n\t\t\tsliceMachineVersion,\n\t\t\tversionControlSystem,\n\t\t});\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,sBAAsB;AAMrB,MAAM,iCAAiC,IAC1C,SAC0B;AAC7B,SAAO,IAAI,yBAAyB,GAAG,IAAI;AAC5C;MAUa,yBAAwB;AAAA,EAqBpC,YAAY,MAA6C;AAdzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKQ;AAAA;AAAA;AAAA;AAGP,SAAK,uBAAuB,0BAAA;AAE5B,SAAK,OAAO,KAAK,QAAQ;AACzB,SAAK,OAAO,KAAK,QAAQ;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MAAG;AAGR,UAAM,cAAc,KAAK,oBAAoB;AAG7C,UAAM,aACL,MAAM,KAAK,qBAAqB,SAAS,8BAAA;AAC1C,UAAM,KAAK,qBAAqB,UAAU,cAAc;AAAA,MACvD,SAAS;AAAA,MACT;AAAA,IAAA,CACA;AACD,UAAM,qBACL,MAAM,KAAK,qBAAqB,UAAU,wBAAA;AAC3C,QAAI,oBAAoB;AACvB,UAAI;AACH,cAAM,YAAY,KAAK,oBAAoB;AAAA,MAC5C,SAAS,OAAO;AAAA,MAQhB;AAAA,IACD;AAEA,UAAM,KAAK,qBAAqB,QAAQ,YAAA;AAGxC,UAAM,cAAc,KAAK,oBAAoB;AAE7C,UAAM,KAAK,iBAAA;AAEX,QAAI,oBAAoB;AACvB,UAAI;AACH,aAAK,YAAA;AAAA,MACN,SAAS,OAAO;AAAA,MAOhB;AAAA,IACD;AAEA,UAAM,MAAM,MAAM,6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,MAEnE,cAAc,MAAM,KAAK,qBAAqB,KAAK,iBAAiB;AAAA,MACpE,cAAc,MACb,KAAK,qBAAqB,SAAS,oCAAoC;AAAA,MAExE,cAAc,MACb,KAAK,qBAAqB,QAAQ,mBAAmB;AAAA,MAEtD,cAAc,MACb,KAAK,qBAAqB,QAAQ,sBAAsB;AAAA,MAEzD,cAAc,MACb,KAAK,qBAAqB,UAAU,2BAA2B;AAAA,MAEhE,cAAc,MACb,KAAK,qBAAqB,SAAS,+BAA+B;AAAA,MAEnE,cAAc,MAAM,KAAK,qBAAqB,OAAO,eAAe;AAAA,MACpE,cAAc,MACb,KAAK,qBAAqB,QAAQ,4BAA4B;AAAA,IAAA,CAE/D;AAED,SAAK,qBAAqB,UAAU,MAAM;AAAA,MACzC,OAAO;AAAA,MACP,yBAAyB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,QAAQ,SAAS;AAAA,MAC9B,qBAAqB,2CAAa,OAAO;AAAA,MACzC,gBAAgB,iCAAQ,OAAO;AAAA,MAC/B,YAAY,GAAG,SAAA;AAAA;AAAA;AAAA,MAGf,gBAAgB,iDAAgB,QAAQ,KAAK;AAAA,MAC7C,aAAa,eAAe,IAAI,IAAI,YAAY,EAAE,OAAO;AAAA,MACzD;AAAA,MACA;AAAA,IAAA,CACA;AAAA,EACF;AACA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/api.js"],"sourcesContent":["import { makeDsn, dsnToString, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Returns the prefix to construct Sentry ingestion API endpoints. */\nfunction getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}\n\n/** Returns the ingest API endpoint for target. */\nfunction _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}\n\n/** Returns a URL-encoded string with auth config suitable for a query string. */\nfunction _encodedAuth(dsn, sdkInfo) {\n return urlEncode({\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.publicKey,\n sentry_version: SENTRY_API_VERSION,\n ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }),\n });\n}\n\n/**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\nfunction getEnvelopeEndpointWithUrlEncodedAuth(\n dsn,\n // TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below\n // options: ClientOptions = {} as ClientOptions,\n tunnelOrOptions = {} ,\n) {\n // TODO (v8): Use this code instead\n // const { tunnel, _metadata = {} } = options;\n // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`;\n\n const tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel;\n const sdkInfo =\n typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk;\n\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(\n dsnLike,\n dialogOptions\n\n,\n) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n\n if (key === 'onClose') {\n continue;\n }\n\n if (key === 'user') {\n const user = dialogOptions.user;\n if (!user) {\n continue;\n }\n if (user.name) {\n encodedOptions += `&name=${encodeURIComponent(user.name)}`;\n }\n if (user.email) {\n encodedOptions += `&email=${encodeURIComponent(user.email)}`;\n }\n } else {\n encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;\n }\n }\n\n return `${endpoint}?${encodedOptions}`;\n}\n\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n//# sourceMappingURL=api.js.map\n"],"names":["urlEncode"],"mappings":";;;AAEA,MAAM,qBAAqB;AAG3B,SAAS,mBAAmB,KAAK;AAC/B,QAAM,WAAW,IAAI,WAAW,GAAG,IAAI,QAAQ,MAAM;AACrD,QAAM,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK;AACzC,SAAO,GAAG,QAAQ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE;AACzE;AAGA,SAAS,mBAAmB,KAAK;AAC/B,SAAO,GAAG,mBAAmB,GAAG,CAAC,GAAG,IAAI,SAAS;AACnD;AAGA,SAAS,aAAa,KAAK,SAAS;AAClC,SAAOA,iBAAU;AAAA;AAAA;AAAA,IAGf,YAAY,IAAI;AAAA,IAChB,gBAAgB;AAAA,IAChB,GAAI,WAAW,EAAE,eAAe,GAAG,QAAQ,IAAI,IAAI,QAAQ,OAAO;EACtE,CAAG;AACH;AAOA,SAAS,sCACP,KAGA,kBAAkB,
|
|
1
|
+
{"version":3,"file":"api.cjs","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/api.js"],"sourcesContent":["import { makeDsn, dsnToString, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Returns the prefix to construct Sentry ingestion API endpoints. */\nfunction getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}\n\n/** Returns the ingest API endpoint for target. */\nfunction _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}\n\n/** Returns a URL-encoded string with auth config suitable for a query string. */\nfunction _encodedAuth(dsn, sdkInfo) {\n return urlEncode({\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.publicKey,\n sentry_version: SENTRY_API_VERSION,\n ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }),\n });\n}\n\n/**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\nfunction getEnvelopeEndpointWithUrlEncodedAuth(\n dsn,\n // TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below\n // options: ClientOptions = {} as ClientOptions,\n tunnelOrOptions = {} ,\n) {\n // TODO (v8): Use this code instead\n // const { tunnel, _metadata = {} } = options;\n // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`;\n\n const tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel;\n const sdkInfo =\n typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk;\n\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(\n dsnLike,\n dialogOptions\n\n,\n) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n\n if (key === 'onClose') {\n continue;\n }\n\n if (key === 'user') {\n const user = dialogOptions.user;\n if (!user) {\n continue;\n }\n if (user.name) {\n encodedOptions += `&name=${encodeURIComponent(user.name)}`;\n }\n if (user.email) {\n encodedOptions += `&email=${encodeURIComponent(user.email)}`;\n }\n } else {\n encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;\n }\n }\n\n return `${endpoint}?${encodedOptions}`;\n}\n\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n//# sourceMappingURL=api.js.map\n"],"names":["urlEncode"],"mappings":";;;AAEA,MAAM,qBAAqB;AAG3B,SAAS,mBAAmB,KAAK;AAC/B,QAAM,WAAW,IAAI,WAAW,GAAG,IAAI,QAAQ,MAAM;AACrD,QAAM,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK;AACzC,SAAO,GAAG,QAAQ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE;AACzE;AAGA,SAAS,mBAAmB,KAAK;AAC/B,SAAO,GAAG,mBAAmB,GAAG,CAAC,GAAG,IAAI,SAAS;AACnD;AAGA,SAAS,aAAa,KAAK,SAAS;AAClC,SAAOA,iBAAU;AAAA;AAAA;AAAA,IAGf,YAAY,IAAI;AAAA,IAChB,gBAAgB;AAAA,IAChB,GAAI,WAAW,EAAE,eAAe,GAAG,QAAQ,IAAI,IAAI,QAAQ,OAAO;EACtE,CAAG;AACH;AAOA,SAAS,sCACP,KAGA,kBAAkB,CAAA,GAClB;AAKA,QAAM,SAAS,OAAO,oBAAoB,WAAW,kBAAkB,gBAAgB;AACvF,QAAM,UACJ,OAAO,oBAAoB,YAAY,CAAC,gBAAgB,YAAY,SAAY,gBAAgB,UAAU;AAE5G,SAAO,SAAS,SAAS,GAAG,mBAAmB,GAAG,CAAC,IAAI,aAAa,KAAK,OAAO,CAAC;AACnF;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/api.js"],"sourcesContent":["import { makeDsn, dsnToString, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Returns the prefix to construct Sentry ingestion API endpoints. */\nfunction getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}\n\n/** Returns the ingest API endpoint for target. */\nfunction _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}\n\n/** Returns a URL-encoded string with auth config suitable for a query string. */\nfunction _encodedAuth(dsn, sdkInfo) {\n return urlEncode({\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.publicKey,\n sentry_version: SENTRY_API_VERSION,\n ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }),\n });\n}\n\n/**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\nfunction getEnvelopeEndpointWithUrlEncodedAuth(\n dsn,\n // TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below\n // options: ClientOptions = {} as ClientOptions,\n tunnelOrOptions = {} ,\n) {\n // TODO (v8): Use this code instead\n // const { tunnel, _metadata = {} } = options;\n // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`;\n\n const tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel;\n const sdkInfo =\n typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk;\n\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(\n dsnLike,\n dialogOptions\n\n,\n) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n\n if (key === 'onClose') {\n continue;\n }\n\n if (key === 'user') {\n const user = dialogOptions.user;\n if (!user) {\n continue;\n }\n if (user.name) {\n encodedOptions += `&name=${encodeURIComponent(user.name)}`;\n }\n if (user.email) {\n encodedOptions += `&email=${encodeURIComponent(user.email)}`;\n }\n } else {\n encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;\n }\n }\n\n return `${endpoint}?${encodedOptions}`;\n}\n\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n//# sourceMappingURL=api.js.map\n"],"names":[],"mappings":";AAEA,MAAM,qBAAqB;AAG3B,SAAS,mBAAmB,KAAK;AAC/B,QAAM,WAAW,IAAI,WAAW,GAAG,IAAI,QAAQ,MAAM;AACrD,QAAM,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK;AACzC,SAAO,GAAG,QAAQ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE;AACzE;AAGA,SAAS,mBAAmB,KAAK;AAC/B,SAAO,GAAG,mBAAmB,GAAG,CAAC,GAAG,IAAI,SAAS;AACnD;AAGA,SAAS,aAAa,KAAK,SAAS;AAClC,SAAO,UAAU;AAAA;AAAA;AAAA,IAGf,YAAY,IAAI;AAAA,IAChB,gBAAgB;AAAA,IAChB,GAAI,WAAW,EAAE,eAAe,GAAG,QAAQ,IAAI,IAAI,QAAQ,OAAO;EACtE,CAAG;AACH;AAOA,SAAS,sCACP,KAGA,kBAAkB,
|
|
1
|
+
{"version":3,"file":"api.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/api.js"],"sourcesContent":["import { makeDsn, dsnToString, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Returns the prefix to construct Sentry ingestion API endpoints. */\nfunction getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}\n\n/** Returns the ingest API endpoint for target. */\nfunction _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}\n\n/** Returns a URL-encoded string with auth config suitable for a query string. */\nfunction _encodedAuth(dsn, sdkInfo) {\n return urlEncode({\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.publicKey,\n sentry_version: SENTRY_API_VERSION,\n ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }),\n });\n}\n\n/**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\nfunction getEnvelopeEndpointWithUrlEncodedAuth(\n dsn,\n // TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below\n // options: ClientOptions = {} as ClientOptions,\n tunnelOrOptions = {} ,\n) {\n // TODO (v8): Use this code instead\n // const { tunnel, _metadata = {} } = options;\n // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`;\n\n const tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel;\n const sdkInfo =\n typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk;\n\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(\n dsnLike,\n dialogOptions\n\n,\n) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n\n if (key === 'onClose') {\n continue;\n }\n\n if (key === 'user') {\n const user = dialogOptions.user;\n if (!user) {\n continue;\n }\n if (user.name) {\n encodedOptions += `&name=${encodeURIComponent(user.name)}`;\n }\n if (user.email) {\n encodedOptions += `&email=${encodeURIComponent(user.email)}`;\n }\n } else {\n encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;\n }\n }\n\n return `${endpoint}?${encodedOptions}`;\n}\n\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n//# sourceMappingURL=api.js.map\n"],"names":[],"mappings":";AAEA,MAAM,qBAAqB;AAG3B,SAAS,mBAAmB,KAAK;AAC/B,QAAM,WAAW,IAAI,WAAW,GAAG,IAAI,QAAQ,MAAM;AACrD,QAAM,OAAO,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK;AACzC,SAAO,GAAG,QAAQ,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE;AACzE;AAGA,SAAS,mBAAmB,KAAK;AAC/B,SAAO,GAAG,mBAAmB,GAAG,CAAC,GAAG,IAAI,SAAS;AACnD;AAGA,SAAS,aAAa,KAAK,SAAS;AAClC,SAAO,UAAU;AAAA;AAAA;AAAA,IAGf,YAAY,IAAI;AAAA,IAChB,gBAAgB;AAAA,IAChB,GAAI,WAAW,EAAE,eAAe,GAAG,QAAQ,IAAI,IAAI,QAAQ,OAAO;EACtE,CAAG;AACH;AAOA,SAAS,sCACP,KAGA,kBAAkB,CAAA,GAClB;AAKA,QAAM,SAAS,OAAO,oBAAoB,WAAW,kBAAkB,gBAAgB;AACvF,QAAM,UACJ,OAAO,oBAAoB,YAAY,CAAC,gBAAgB,YAAY,SAAY,gBAAgB,UAAU;AAE5G,SAAO,SAAS,SAAS,GAAG,mBAAmB,GAAG,CAAC,IAAI,aAAa,KAAK,OAAO,CAAC;AACnF;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseclient.cjs","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/baseclient.js"],"sourcesContent":["import { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nimport { getClient } from './exports.js';\nimport { getIsolationScope } from './hub.js';\nimport { setupIntegration, afterSetupIntegrations, setupIntegrations } from './integration.js';\nimport { createMetricEnvelope } from './metrics/envelope.js';\nimport { updateSession } from './session.js';\nimport { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';\nimport { prepareEvent } from './utils/prepareEvent.js';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link BaseClient._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nclass BaseClient {\n /**\n * A reference to a metrics aggregator\n *\n * @experimental Note this is alpha API. It may experience breaking changes in the future.\n */\n\n /** Options passed to the SDK. */\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n\n /** Array of set up integrations. */\n\n /** Indicates whether this client's integrations have been set up. */\n\n /** Number of calls being processed */\n\n /** Holds flushable */\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n constructor(options) {\n this._options = options;\n this._integrations = {};\n this._integrationsInitialized = false;\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && logger.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options);\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n captureException(exception, hint, scope) {\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n this._process(\n this.eventFromException(exception, hint)\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureMessage(\n message,\n // eslint-disable-next-line deprecation/deprecation\n level,\n hint,\n scope,\n ) {\n let eventId = hint && hint.event_id;\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n\n const promisedEvent = isPrimitive(message)\n ? this.eventFromMessage(eventMessage, level, hint)\n : this.eventFromException(message, hint);\n\n this._process(\n promisedEvent\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, scope) {\n // ensure we haven't captured this very object before\n if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;\n\n this._process(\n this._captureEvent(event, hint, capturedSpanScope || scope).then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureSession(session) {\n if (!(typeof session.release === 'string')) {\n DEBUG_BUILD && logger.warn('Discarded session because of missing or non-string release');\n } else {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n }\n\n /**\n * @inheritDoc\n */\n getDsn() {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n getOptions() {\n return this._options;\n }\n\n /**\n * @see SdkMetadata in @sentry/types\n *\n * @return The metadata of the SDK\n */\n getSdkMetadata() {\n return this._options._metadata;\n }\n\n /**\n * @inheritDoc\n */\n getTransport() {\n return this._transport;\n }\n\n /**\n * @inheritDoc\n */\n flush(timeout) {\n const transport = this._transport;\n if (transport) {\n if (this.metricsAggregator) {\n this.metricsAggregator.flush();\n }\n return this._isClientDoneProcessing(timeout).then(clientFinished => {\n return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);\n });\n } else {\n return resolvedSyncPromise(true);\n }\n }\n\n /**\n * @inheritDoc\n */\n close(timeout) {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n if (this.metricsAggregator) {\n this.metricsAggregator.close();\n }\n return result;\n });\n }\n\n /** Get all installed event processors. */\n getEventProcessors() {\n return this._eventProcessors;\n }\n\n /** @inheritDoc */\n addEventProcessor(eventProcessor) {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * This is an internal function to setup all integrations that should run on the client.\n * @deprecated Use `client.init()` instead.\n */\n setupIntegrations(forceInitialize) {\n if ((forceInitialize && !this._integrationsInitialized) || (this._isEnabled() && !this._integrationsInitialized)) {\n this._setupIntegrations();\n }\n }\n\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its `id`.\n *\n * @returns The installed integration or `undefined` if no integration with that `id` was installed.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegrationById(integrationId) {\n return this.getIntegrationByName(integrationId);\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns The installed integration or `undefined` if no integration with that `name` was installed.\n */\n getIntegrationByName(integrationName) {\n return this._integrations[integrationName] ;\n }\n\n /**\n * Returns the client's instance of the given integration class, it any.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n try {\n return (this._integrations[integration.id] ) || null;\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit('beforeSendEvent', event, hint);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(\n env,\n createAttachmentEnvelopeItem(\n attachment,\n this._options.transportOptions && this._options.transportOptions.textEncoder,\n ),\n );\n }\n\n const promise = this._sendEnvelope(env);\n if (promise) {\n promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendSession(session) {\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(env);\n }\n\n /**\n * @inheritDoc\n */\n recordDroppedEvent(reason, category, _event) {\n // Note: we use `event` in replay, where we overwrite this hook.\n\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && logger.log(`Adding outcome: \"${key}\"`);\n\n // The following works because undefined + 1 === NaN and NaN is falsy\n this._outcomes[key] = this._outcomes[key] + 1 || 1;\n }\n }\n\n /**\n * @inheritDoc\n */\n captureAggregateMetrics(metricBucketItems) {\n DEBUG_BUILD && logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);\n const metricsEnvelope = createMetricEnvelope(\n metricBucketItems,\n this._dsn,\n this._options._metadata,\n this._options.tunnel,\n );\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(metricsEnvelope);\n }\n\n // Keep on() & emit() signatures in sync with types' client.ts interface\n /* eslint-disable @typescript-eslint/unified-signatures */\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n on(hook, callback) {\n if (!this._hooks[hook]) {\n this._hooks[hook] = [];\n }\n\n // @ts-expect-error We assue the types are correct\n this._hooks[hook].push(callback);\n }\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n emit(hook, ...rest) {\n if (this._hooks[hook]) {\n this._hooks[hook].forEach(callback => callback(...rest));\n }\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n _setupIntegrations() {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n\n // TODO v8: We don't need this flag anymore\n this._integrationsInitialized = true;\n }\n\n /** Updates existing session based on the provided event */\n _updateSessionFromEvent(session, event) {\n let crashed = false;\n let errored = false;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n _isClientDoneProcessing(timeout) {\n return new SyncPromise(resolve => {\n let ticked = 0;\n const tick = 1;\n\n const interval = setInterval(() => {\n if (this._numProcessing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n _isEnabled() {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(\n event,\n hint,\n scope,\n isolationScope = getIsolationScope(),\n ) {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations.length > 0) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n return prepareEvent(options, event, hint, scope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n const propagationContext = {\n ...isolationScope.getPropagationContext(),\n ...(scope ? scope.getPropagationContext() : undefined),\n };\n\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;\n evt.contexts = {\n trace: {\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId,\n },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n }\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n _captureEvent(event, hint = {}, scope) {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for\n // control flow, log just the message (no stack) as a log-level log.\n const sentryError = reason ;\n if (sentryError.logLevel === 'log') {\n logger.log(sentryError.message);\n } else {\n logger.warn(sentryError);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n _processEvent(event, hint, scope) {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (isError && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n this.recordDroppedEvent('sample_rate', 'error', event);\n return rejectedSyncPromise(\n new SentryError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n 'log',\n ),\n );\n }\n\n const dataCategory = eventType === 'replay_event' ? 'replay' : eventType;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;\n\n return this._prepareEvent(event, hint, scope, capturedSpanIsolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory, event);\n throw new SentryError('An event processor returned `null`, will not send event.', 'log');\n }\n\n const isInternalException = hint.data && (hint.data ).__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory, event);\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, 'log');\n }\n\n const session = scope && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n return reason;\n },\n );\n }\n\n /**\n * @inheritdoc\n */\n _sendEnvelope(envelope) {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n return this._transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && logger.error('Error while sending event:', reason);\n });\n } else {\n DEBUG_BUILD && logger.error('Transport disabled');\n }\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n _clearOutcomes() {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.keys(outcomes).map(key => {\n const [reason, category] = key.split(':') ;\n return {\n reason,\n category,\n quantity: outcomes[key],\n };\n });\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult,\n beforeSendLabel,\n) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n },\n e => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw new SentryError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n options,\n event,\n hint,\n) {\n const { beforeSend, beforeSendTransaction } = options;\n\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n\n if (isTransactionEvent(event) && beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n\n return event;\n}\n\nfunction isErrorEvent(event) {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event) {\n return event.type === 'transaction';\n}\n\n/**\n * Add an event processor to the current client.\n * This event processor will run for all events processed by this client.\n */\nfunction addEventProcessor(callback) {\n const client = getClient();\n\n if (!client || !client.addEventProcessor) {\n return;\n }\n\n client.addEventProcessor(callback);\n}\n\nexport { BaseClient, addEventProcessor };\n//# sourceMappingURL=baseclient.js.map\n"],"names":["makeDsn","DEBUG_BUILD","logger","getEnvelopeEndpointWithUrlEncodedAuth","checkOrSetAlreadyCaught","isParameterizedString","isPrimitive","session","updateSession","resolvedSyncPromise","integration","setupIntegration","afterSetupIntegrations","createEventEnvelope","addItemToEnvelope","createAttachmentEnvelopeItem","createSessionEnvelope","createMetricEnvelope","setupIntegrations","SyncPromise","getIsolationScope","prepareEvent","dynamicSamplingContext","getDynamicSamplingContextFromClient","rejectedSyncPromise","SentryError","envelope","isThenable","isPlainObject"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAM,qBAAqB;AAiC3B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bd,YAAY,SAAS;AACpB,SAAK,WAAW;AAChB,SAAK,gBAAgB;AACrB,SAAK,2BAA2B;AAChC,SAAK,iBAAiB;AACtB,SAAK,YAAY;AACjB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;AAAA,QACxC;AACD,eAAO;AAAA,MACR;AAAA,MACD,OAAK;AACH,cAAM,IAAIA,MAAW,YAAC,GAAG,eAAe,kBAAkB,CAAC,EAAE;AAAA,MAC9D;AAAA,IACP;AAAA,EACG,WAAU,CAACG,GAAa,cAAC,gBAAgB,KAAK,qBAAqB,MAAM;AACxE,UAAM,IAAIH,MAAAA,YAAY,iBAAiB;AAAA,EACxC;AACD,SAAO;AACT;AAKA,SAAS,kBACP,SACA,OACA,MACA;AACA,QAAM,EAAE,YAAY,sBAAuB,IAAG;AAE9C,MAAI,aAAa,KAAK,KAAK,YAAY;AACrC,WAAO,WAAW,OAAO,IAAI;AAAA,EAC9B;AAED,MAAI,mBAAmB,KAAK,KAAK,uBAAuB;AACtD,WAAO,sBAAsB,OAAO,IAAI;AAAA,EACzC;AAED,SAAO;AACT;AAEA,SAAS,aAAa,OAAO;AAC3B,SAAO,MAAM,SAAS;AACxB;AAEA,SAAS,mBAAmB,OAAO;AACjC,SAAO,MAAM,SAAS;AACxB;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"baseclient.cjs","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/baseclient.js"],"sourcesContent":["import { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nimport { getClient } from './exports.js';\nimport { getIsolationScope } from './hub.js';\nimport { setupIntegration, afterSetupIntegrations, setupIntegrations } from './integration.js';\nimport { createMetricEnvelope } from './metrics/envelope.js';\nimport { updateSession } from './session.js';\nimport { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';\nimport { prepareEvent } from './utils/prepareEvent.js';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link BaseClient._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nclass BaseClient {\n /**\n * A reference to a metrics aggregator\n *\n * @experimental Note this is alpha API. It may experience breaking changes in the future.\n */\n\n /** Options passed to the SDK. */\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n\n /** Array of set up integrations. */\n\n /** Indicates whether this client's integrations have been set up. */\n\n /** Number of calls being processed */\n\n /** Holds flushable */\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n constructor(options) {\n this._options = options;\n this._integrations = {};\n this._integrationsInitialized = false;\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && logger.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options);\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n captureException(exception, hint, scope) {\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n this._process(\n this.eventFromException(exception, hint)\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureMessage(\n message,\n // eslint-disable-next-line deprecation/deprecation\n level,\n hint,\n scope,\n ) {\n let eventId = hint && hint.event_id;\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n\n const promisedEvent = isPrimitive(message)\n ? this.eventFromMessage(eventMessage, level, hint)\n : this.eventFromException(message, hint);\n\n this._process(\n promisedEvent\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, scope) {\n // ensure we haven't captured this very object before\n if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;\n\n this._process(\n this._captureEvent(event, hint, capturedSpanScope || scope).then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureSession(session) {\n if (!(typeof session.release === 'string')) {\n DEBUG_BUILD && logger.warn('Discarded session because of missing or non-string release');\n } else {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n }\n\n /**\n * @inheritDoc\n */\n getDsn() {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n getOptions() {\n return this._options;\n }\n\n /**\n * @see SdkMetadata in @sentry/types\n *\n * @return The metadata of the SDK\n */\n getSdkMetadata() {\n return this._options._metadata;\n }\n\n /**\n * @inheritDoc\n */\n getTransport() {\n return this._transport;\n }\n\n /**\n * @inheritDoc\n */\n flush(timeout) {\n const transport = this._transport;\n if (transport) {\n if (this.metricsAggregator) {\n this.metricsAggregator.flush();\n }\n return this._isClientDoneProcessing(timeout).then(clientFinished => {\n return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);\n });\n } else {\n return resolvedSyncPromise(true);\n }\n }\n\n /**\n * @inheritDoc\n */\n close(timeout) {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n if (this.metricsAggregator) {\n this.metricsAggregator.close();\n }\n return result;\n });\n }\n\n /** Get all installed event processors. */\n getEventProcessors() {\n return this._eventProcessors;\n }\n\n /** @inheritDoc */\n addEventProcessor(eventProcessor) {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * This is an internal function to setup all integrations that should run on the client.\n * @deprecated Use `client.init()` instead.\n */\n setupIntegrations(forceInitialize) {\n if ((forceInitialize && !this._integrationsInitialized) || (this._isEnabled() && !this._integrationsInitialized)) {\n this._setupIntegrations();\n }\n }\n\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its `id`.\n *\n * @returns The installed integration or `undefined` if no integration with that `id` was installed.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegrationById(integrationId) {\n return this.getIntegrationByName(integrationId);\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns The installed integration or `undefined` if no integration with that `name` was installed.\n */\n getIntegrationByName(integrationName) {\n return this._integrations[integrationName] ;\n }\n\n /**\n * Returns the client's instance of the given integration class, it any.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n try {\n return (this._integrations[integration.id] ) || null;\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit('beforeSendEvent', event, hint);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(\n env,\n createAttachmentEnvelopeItem(\n attachment,\n this._options.transportOptions && this._options.transportOptions.textEncoder,\n ),\n );\n }\n\n const promise = this._sendEnvelope(env);\n if (promise) {\n promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendSession(session) {\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(env);\n }\n\n /**\n * @inheritDoc\n */\n recordDroppedEvent(reason, category, _event) {\n // Note: we use `event` in replay, where we overwrite this hook.\n\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && logger.log(`Adding outcome: \"${key}\"`);\n\n // The following works because undefined + 1 === NaN and NaN is falsy\n this._outcomes[key] = this._outcomes[key] + 1 || 1;\n }\n }\n\n /**\n * @inheritDoc\n */\n captureAggregateMetrics(metricBucketItems) {\n DEBUG_BUILD && logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);\n const metricsEnvelope = createMetricEnvelope(\n metricBucketItems,\n this._dsn,\n this._options._metadata,\n this._options.tunnel,\n );\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(metricsEnvelope);\n }\n\n // Keep on() & emit() signatures in sync with types' client.ts interface\n /* eslint-disable @typescript-eslint/unified-signatures */\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n on(hook, callback) {\n if (!this._hooks[hook]) {\n this._hooks[hook] = [];\n }\n\n // @ts-expect-error We assue the types are correct\n this._hooks[hook].push(callback);\n }\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n emit(hook, ...rest) {\n if (this._hooks[hook]) {\n this._hooks[hook].forEach(callback => callback(...rest));\n }\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n _setupIntegrations() {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n\n // TODO v8: We don't need this flag anymore\n this._integrationsInitialized = true;\n }\n\n /** Updates existing session based on the provided event */\n _updateSessionFromEvent(session, event) {\n let crashed = false;\n let errored = false;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n _isClientDoneProcessing(timeout) {\n return new SyncPromise(resolve => {\n let ticked = 0;\n const tick = 1;\n\n const interval = setInterval(() => {\n if (this._numProcessing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n _isEnabled() {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(\n event,\n hint,\n scope,\n isolationScope = getIsolationScope(),\n ) {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations.length > 0) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n return prepareEvent(options, event, hint, scope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n const propagationContext = {\n ...isolationScope.getPropagationContext(),\n ...(scope ? scope.getPropagationContext() : undefined),\n };\n\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;\n evt.contexts = {\n trace: {\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId,\n },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n }\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n _captureEvent(event, hint = {}, scope) {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for\n // control flow, log just the message (no stack) as a log-level log.\n const sentryError = reason ;\n if (sentryError.logLevel === 'log') {\n logger.log(sentryError.message);\n } else {\n logger.warn(sentryError);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n _processEvent(event, hint, scope) {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (isError && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n this.recordDroppedEvent('sample_rate', 'error', event);\n return rejectedSyncPromise(\n new SentryError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n 'log',\n ),\n );\n }\n\n const dataCategory = eventType === 'replay_event' ? 'replay' : eventType;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;\n\n return this._prepareEvent(event, hint, scope, capturedSpanIsolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory, event);\n throw new SentryError('An event processor returned `null`, will not send event.', 'log');\n }\n\n const isInternalException = hint.data && (hint.data ).__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory, event);\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, 'log');\n }\n\n const session = scope && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n return reason;\n },\n );\n }\n\n /**\n * @inheritdoc\n */\n _sendEnvelope(envelope) {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n return this._transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && logger.error('Error while sending event:', reason);\n });\n } else {\n DEBUG_BUILD && logger.error('Transport disabled');\n }\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n _clearOutcomes() {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.keys(outcomes).map(key => {\n const [reason, category] = key.split(':') ;\n return {\n reason,\n category,\n quantity: outcomes[key],\n };\n });\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult,\n beforeSendLabel,\n) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n },\n e => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw new SentryError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n options,\n event,\n hint,\n) {\n const { beforeSend, beforeSendTransaction } = options;\n\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n\n if (isTransactionEvent(event) && beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n\n return event;\n}\n\nfunction isErrorEvent(event) {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event) {\n return event.type === 'transaction';\n}\n\n/**\n * Add an event processor to the current client.\n * This event processor will run for all events processed by this client.\n */\nfunction addEventProcessor(callback) {\n const client = getClient();\n\n if (!client || !client.addEventProcessor) {\n return;\n }\n\n client.addEventProcessor(callback);\n}\n\nexport { BaseClient, addEventProcessor };\n//# sourceMappingURL=baseclient.js.map\n"],"names":["makeDsn","DEBUG_BUILD","logger","getEnvelopeEndpointWithUrlEncodedAuth","checkOrSetAlreadyCaught","isParameterizedString","isPrimitive","session","updateSession","resolvedSyncPromise","integration","setupIntegration","afterSetupIntegrations","createEventEnvelope","addItemToEnvelope","createAttachmentEnvelopeItem","createSessionEnvelope","createMetricEnvelope","setupIntegrations","SyncPromise","getIsolationScope","prepareEvent","dynamicSamplingContext","getDynamicSamplingContextFromClient","rejectedSyncPromise","SentryError","envelope","isThenable","isPlainObject"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAM,qBAAqB;AAiC3B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bd,YAAY,SAAS;AACpB,SAAK,WAAW;AAChB,SAAK,gBAAgB,CAAA;AACrB,SAAK,2BAA2B;AAChC,SAAK,iBAAiB;AACtB,SAAK,YAAY,CAAA;AACjB,SAAK,SAAS,CAAA;AACd,SAAK,mBAAmB,CAAA;AAExB,QAAI,QAAQ,KAAK;AACf,WAAK,OAAOA,YAAQ,QAAQ,GAAG;AAAA,IACjC,OAAO;AACLC,gCAAeC,OAAAA,OAAO,KAAK,+CAA+C;AAAA,IAC5E;AAEA,QAAI,KAAK,MAAM;AACb,YAAM,MAAMC,IAAAA,sCAAsC,KAAK,MAAM,OAAO;AACpE,WAAK,aAAa,QAAQ,UAAU;AAAA,QAClC,QAAQ,KAAK,SAAS;AAAA,QACtB,oBAAoB,KAAK,mBAAmB,KAAK,IAAI;AAAA,QACrD,GAAG,QAAQ;AAAA,QACX;AAAA,MACR,CAAO;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMC,iBAAiB,WAAW,MAAM,OAAO;AAExC,QAAIC,KAAAA,wBAAwB,SAAS,GAAG;AACtCH,gCAAeC,OAAAA,OAAO,IAAI,kBAAkB;AAC5C;AAAA,IACF;AAEA,QAAI,UAAU,QAAQ,KAAK;AAE3B,SAAK;AAAA,MACH,KAAK,mBAAmB,WAAW,IAAI,EACpC,KAAK,WAAS,KAAK,cAAc,OAAO,MAAM,KAAK,CAAC,EACpD,KAAK,YAAU;AACd,kBAAU;AAAA,MACZ,CAAC;AAAA,I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Dsn } from "../../utils/esm/dsn.js";
|
|
11
11
|
import { logger } from "../../utils/esm/logger.js";
|
|
12
12
|
import { checkOrSetAlreadyCaught } from "../../utils/esm/misc.js";
|
|
13
|
-
import { isPrimitive, isThenable, isPlainObject
|
|
13
|
+
import { isPrimitive, isParameterizedString, isThenable, isPlainObject } from "../../utils/esm/is.js";
|
|
14
14
|
import { resolvedSyncPromise, SyncPromise, rejectedSyncPromise } from "../../utils/esm/syncpromise.js";
|
|
15
15
|
import { addItemToEnvelope, createAttachmentEnvelopeItem } from "../../utils/esm/envelope.js";
|
|
16
16
|
import { SentryError } from "../../utils/esm/error.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseclient.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/baseclient.js"],"sourcesContent":["import { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nimport { getClient } from './exports.js';\nimport { getIsolationScope } from './hub.js';\nimport { setupIntegration, afterSetupIntegrations, setupIntegrations } from './integration.js';\nimport { createMetricEnvelope } from './metrics/envelope.js';\nimport { updateSession } from './session.js';\nimport { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';\nimport { prepareEvent } from './utils/prepareEvent.js';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link BaseClient._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nclass BaseClient {\n /**\n * A reference to a metrics aggregator\n *\n * @experimental Note this is alpha API. It may experience breaking changes in the future.\n */\n\n /** Options passed to the SDK. */\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n\n /** Array of set up integrations. */\n\n /** Indicates whether this client's integrations have been set up. */\n\n /** Number of calls being processed */\n\n /** Holds flushable */\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n constructor(options) {\n this._options = options;\n this._integrations = {};\n this._integrationsInitialized = false;\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && logger.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options);\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n captureException(exception, hint, scope) {\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n this._process(\n this.eventFromException(exception, hint)\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureMessage(\n message,\n // eslint-disable-next-line deprecation/deprecation\n level,\n hint,\n scope,\n ) {\n let eventId = hint && hint.event_id;\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n\n const promisedEvent = isPrimitive(message)\n ? this.eventFromMessage(eventMessage, level, hint)\n : this.eventFromException(message, hint);\n\n this._process(\n promisedEvent\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, scope) {\n // ensure we haven't captured this very object before\n if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;\n\n this._process(\n this._captureEvent(event, hint, capturedSpanScope || scope).then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureSession(session) {\n if (!(typeof session.release === 'string')) {\n DEBUG_BUILD && logger.warn('Discarded session because of missing or non-string release');\n } else {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n }\n\n /**\n * @inheritDoc\n */\n getDsn() {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n getOptions() {\n return this._options;\n }\n\n /**\n * @see SdkMetadata in @sentry/types\n *\n * @return The metadata of the SDK\n */\n getSdkMetadata() {\n return this._options._metadata;\n }\n\n /**\n * @inheritDoc\n */\n getTransport() {\n return this._transport;\n }\n\n /**\n * @inheritDoc\n */\n flush(timeout) {\n const transport = this._transport;\n if (transport) {\n if (this.metricsAggregator) {\n this.metricsAggregator.flush();\n }\n return this._isClientDoneProcessing(timeout).then(clientFinished => {\n return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);\n });\n } else {\n return resolvedSyncPromise(true);\n }\n }\n\n /**\n * @inheritDoc\n */\n close(timeout) {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n if (this.metricsAggregator) {\n this.metricsAggregator.close();\n }\n return result;\n });\n }\n\n /** Get all installed event processors. */\n getEventProcessors() {\n return this._eventProcessors;\n }\n\n /** @inheritDoc */\n addEventProcessor(eventProcessor) {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * This is an internal function to setup all integrations that should run on the client.\n * @deprecated Use `client.init()` instead.\n */\n setupIntegrations(forceInitialize) {\n if ((forceInitialize && !this._integrationsInitialized) || (this._isEnabled() && !this._integrationsInitialized)) {\n this._setupIntegrations();\n }\n }\n\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its `id`.\n *\n * @returns The installed integration or `undefined` if no integration with that `id` was installed.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegrationById(integrationId) {\n return this.getIntegrationByName(integrationId);\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns The installed integration or `undefined` if no integration with that `name` was installed.\n */\n getIntegrationByName(integrationName) {\n return this._integrations[integrationName] ;\n }\n\n /**\n * Returns the client's instance of the given integration class, it any.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n try {\n return (this._integrations[integration.id] ) || null;\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit('beforeSendEvent', event, hint);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(\n env,\n createAttachmentEnvelopeItem(\n attachment,\n this._options.transportOptions && this._options.transportOptions.textEncoder,\n ),\n );\n }\n\n const promise = this._sendEnvelope(env);\n if (promise) {\n promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendSession(session) {\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(env);\n }\n\n /**\n * @inheritDoc\n */\n recordDroppedEvent(reason, category, _event) {\n // Note: we use `event` in replay, where we overwrite this hook.\n\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && logger.log(`Adding outcome: \"${key}\"`);\n\n // The following works because undefined + 1 === NaN and NaN is falsy\n this._outcomes[key] = this._outcomes[key] + 1 || 1;\n }\n }\n\n /**\n * @inheritDoc\n */\n captureAggregateMetrics(metricBucketItems) {\n DEBUG_BUILD && logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);\n const metricsEnvelope = createMetricEnvelope(\n metricBucketItems,\n this._dsn,\n this._options._metadata,\n this._options.tunnel,\n );\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(metricsEnvelope);\n }\n\n // Keep on() & emit() signatures in sync with types' client.ts interface\n /* eslint-disable @typescript-eslint/unified-signatures */\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n on(hook, callback) {\n if (!this._hooks[hook]) {\n this._hooks[hook] = [];\n }\n\n // @ts-expect-error We assue the types are correct\n this._hooks[hook].push(callback);\n }\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n emit(hook, ...rest) {\n if (this._hooks[hook]) {\n this._hooks[hook].forEach(callback => callback(...rest));\n }\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n _setupIntegrations() {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n\n // TODO v8: We don't need this flag anymore\n this._integrationsInitialized = true;\n }\n\n /** Updates existing session based on the provided event */\n _updateSessionFromEvent(session, event) {\n let crashed = false;\n let errored = false;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n _isClientDoneProcessing(timeout) {\n return new SyncPromise(resolve => {\n let ticked = 0;\n const tick = 1;\n\n const interval = setInterval(() => {\n if (this._numProcessing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n _isEnabled() {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(\n event,\n hint,\n scope,\n isolationScope = getIsolationScope(),\n ) {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations.length > 0) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n return prepareEvent(options, event, hint, scope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n const propagationContext = {\n ...isolationScope.getPropagationContext(),\n ...(scope ? scope.getPropagationContext() : undefined),\n };\n\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;\n evt.contexts = {\n trace: {\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId,\n },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n }\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n _captureEvent(event, hint = {}, scope) {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for\n // control flow, log just the message (no stack) as a log-level log.\n const sentryError = reason ;\n if (sentryError.logLevel === 'log') {\n logger.log(sentryError.message);\n } else {\n logger.warn(sentryError);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n _processEvent(event, hint, scope) {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (isError && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n this.recordDroppedEvent('sample_rate', 'error', event);\n return rejectedSyncPromise(\n new SentryError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n 'log',\n ),\n );\n }\n\n const dataCategory = eventType === 'replay_event' ? 'replay' : eventType;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;\n\n return this._prepareEvent(event, hint, scope, capturedSpanIsolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory, event);\n throw new SentryError('An event processor returned `null`, will not send event.', 'log');\n }\n\n const isInternalException = hint.data && (hint.data ).__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory, event);\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, 'log');\n }\n\n const session = scope && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n return reason;\n },\n );\n }\n\n /**\n * @inheritdoc\n */\n _sendEnvelope(envelope) {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n return this._transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && logger.error('Error while sending event:', reason);\n });\n } else {\n DEBUG_BUILD && logger.error('Transport disabled');\n }\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n _clearOutcomes() {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.keys(outcomes).map(key => {\n const [reason, category] = key.split(':') ;\n return {\n reason,\n category,\n quantity: outcomes[key],\n };\n });\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult,\n beforeSendLabel,\n) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n },\n e => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw new SentryError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n options,\n event,\n hint,\n) {\n const { beforeSend, beforeSendTransaction } = options;\n\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n\n if (isTransactionEvent(event) && beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n\n return event;\n}\n\nfunction isErrorEvent(event) {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event) {\n return event.type === 'transaction';\n}\n\n/**\n * Add an event processor to the current client.\n * This event processor will run for all events processed by this client.\n */\nfunction addEventProcessor(callback) {\n const client = getClient();\n\n if (!client || !client.addEventProcessor) {\n return;\n }\n\n client.addEventProcessor(callback);\n}\n\nexport { BaseClient, addEventProcessor };\n//# sourceMappingURL=baseclient.js.map\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAM,qBAAqB;AAiC3B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bd,YAAY,SAAS;AACpB,SAAK,WAAW;AAChB,SAAK,gBAAgB;AACrB,SAAK,2BAA2B;AAChC,SAAK,iBAAiB;AACtB,SAAK,YAAY;AACjB,SAAK,SAAS;AACd,SAAK,mBAAmB;AAExB,QAAI,QAAQ,KAAK;AACf,WAAK,OAAO,QAAQ,QAAQ,GAAG;AAAA,IACrC,OAAW;AACL,qBAAe,OAAO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BAAmB,OAAO;AACjC,SAAO,MAAM,SAAS;AACxB;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"baseclient.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/baseclient.js"],"sourcesContent":["import { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nimport { getClient } from './exports.js';\nimport { getIsolationScope } from './hub.js';\nimport { setupIntegration, afterSetupIntegrations, setupIntegrations } from './integration.js';\nimport { createMetricEnvelope } from './metrics/envelope.js';\nimport { updateSession } from './session.js';\nimport { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';\nimport { prepareEvent } from './utils/prepareEvent.js';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link BaseClient._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient<NodeOptions> {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nclass BaseClient {\n /**\n * A reference to a metrics aggregator\n *\n * @experimental Note this is alpha API. It may experience breaking changes in the future.\n */\n\n /** Options passed to the SDK. */\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n\n /** Array of set up integrations. */\n\n /** Indicates whether this client's integrations have been set up. */\n\n /** Number of calls being processed */\n\n /** Holds flushable */\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n constructor(options) {\n this._options = options;\n this._integrations = {};\n this._integrationsInitialized = false;\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && logger.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options);\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n captureException(exception, hint, scope) {\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n this._process(\n this.eventFromException(exception, hint)\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureMessage(\n message,\n // eslint-disable-next-line deprecation/deprecation\n level,\n hint,\n scope,\n ) {\n let eventId = hint && hint.event_id;\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n\n const promisedEvent = isPrimitive(message)\n ? this.eventFromMessage(eventMessage, level, hint)\n : this.eventFromException(message, hint);\n\n this._process(\n promisedEvent\n .then(event => this._captureEvent(event, hint, scope))\n .then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, scope) {\n // ensure we haven't captured this very object before\n if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n\n let eventId = hint && hint.event_id;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;\n\n this._process(\n this._captureEvent(event, hint, capturedSpanScope || scope).then(result => {\n eventId = result;\n }),\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureSession(session) {\n if (!(typeof session.release === 'string')) {\n DEBUG_BUILD && logger.warn('Discarded session because of missing or non-string release');\n } else {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n }\n\n /**\n * @inheritDoc\n */\n getDsn() {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n getOptions() {\n return this._options;\n }\n\n /**\n * @see SdkMetadata in @sentry/types\n *\n * @return The metadata of the SDK\n */\n getSdkMetadata() {\n return this._options._metadata;\n }\n\n /**\n * @inheritDoc\n */\n getTransport() {\n return this._transport;\n }\n\n /**\n * @inheritDoc\n */\n flush(timeout) {\n const transport = this._transport;\n if (transport) {\n if (this.metricsAggregator) {\n this.metricsAggregator.flush();\n }\n return this._isClientDoneProcessing(timeout).then(clientFinished => {\n return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);\n });\n } else {\n return resolvedSyncPromise(true);\n }\n }\n\n /**\n * @inheritDoc\n */\n close(timeout) {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n if (this.metricsAggregator) {\n this.metricsAggregator.close();\n }\n return result;\n });\n }\n\n /** Get all installed event processors. */\n getEventProcessors() {\n return this._eventProcessors;\n }\n\n /** @inheritDoc */\n addEventProcessor(eventProcessor) {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * This is an internal function to setup all integrations that should run on the client.\n * @deprecated Use `client.init()` instead.\n */\n setupIntegrations(forceInitialize) {\n if ((forceInitialize && !this._integrationsInitialized) || (this._isEnabled() && !this._integrationsInitialized)) {\n this._setupIntegrations();\n }\n }\n\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its `id`.\n *\n * @returns The installed integration or `undefined` if no integration with that `id` was installed.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegrationById(integrationId) {\n return this.getIntegrationByName(integrationId);\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns The installed integration or `undefined` if no integration with that `name` was installed.\n */\n getIntegrationByName(integrationName) {\n return this._integrations[integrationName] ;\n }\n\n /**\n * Returns the client's instance of the given integration class, it any.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n try {\n return (this._integrations[integration.id] ) || null;\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit('beforeSendEvent', event, hint);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(\n env,\n createAttachmentEnvelopeItem(\n attachment,\n this._options.transportOptions && this._options.transportOptions.textEncoder,\n ),\n );\n }\n\n const promise = this._sendEnvelope(env);\n if (promise) {\n promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendSession(session) {\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(env);\n }\n\n /**\n * @inheritDoc\n */\n recordDroppedEvent(reason, category, _event) {\n // Note: we use `event` in replay, where we overwrite this hook.\n\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && logger.log(`Adding outcome: \"${key}\"`);\n\n // The following works because undefined + 1 === NaN and NaN is falsy\n this._outcomes[key] = this._outcomes[key] + 1 || 1;\n }\n }\n\n /**\n * @inheritDoc\n */\n captureAggregateMetrics(metricBucketItems) {\n DEBUG_BUILD && logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);\n const metricsEnvelope = createMetricEnvelope(\n metricBucketItems,\n this._dsn,\n this._options._metadata,\n this._options.tunnel,\n );\n\n // _sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._sendEnvelope(metricsEnvelope);\n }\n\n // Keep on() & emit() signatures in sync with types' client.ts interface\n /* eslint-disable @typescript-eslint/unified-signatures */\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n on(hook, callback) {\n if (!this._hooks[hook]) {\n this._hooks[hook] = [];\n }\n\n // @ts-expect-error We assue the types are correct\n this._hooks[hook].push(callback);\n }\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n emit(hook, ...rest) {\n if (this._hooks[hook]) {\n this._hooks[hook].forEach(callback => callback(...rest));\n }\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n _setupIntegrations() {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n\n // TODO v8: We don't need this flag anymore\n this._integrationsInitialized = true;\n }\n\n /** Updates existing session based on the provided event */\n _updateSessionFromEvent(session, event) {\n let crashed = false;\n let errored = false;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n _isClientDoneProcessing(timeout) {\n return new SyncPromise(resolve => {\n let ticked = 0;\n const tick = 1;\n\n const interval = setInterval(() => {\n if (this._numProcessing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n _isEnabled() {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(\n event,\n hint,\n scope,\n isolationScope = getIsolationScope(),\n ) {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations.length > 0) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n return prepareEvent(options, event, hint, scope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n const propagationContext = {\n ...isolationScope.getPropagationContext(),\n ...(scope ? scope.getPropagationContext() : undefined),\n };\n\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;\n evt.contexts = {\n trace: {\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId,\n },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n }\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n _captureEvent(event, hint = {}, scope) {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for\n // control flow, log just the message (no stack) as a log-level log.\n const sentryError = reason ;\n if (sentryError.logLevel === 'log') {\n logger.log(sentryError.message);\n } else {\n logger.warn(sentryError);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n _processEvent(event, hint, scope) {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n if (isError && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n this.recordDroppedEvent('sample_rate', 'error', event);\n return rejectedSyncPromise(\n new SentryError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n 'log',\n ),\n );\n }\n\n const dataCategory = eventType === 'replay_event' ? 'replay' : eventType;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;\n\n return this._prepareEvent(event, hint, scope, capturedSpanIsolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory, event);\n throw new SentryError('An event processor returned `null`, will not send event.', 'log');\n }\n\n const isInternalException = hint.data && (hint.data ).__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory, event);\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, 'log');\n }\n\n const session = scope && scope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n return reason;\n },\n );\n }\n\n /**\n * @inheritdoc\n */\n _sendEnvelope(envelope) {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n return this._transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && logger.error('Error while sending event:', reason);\n });\n } else {\n DEBUG_BUILD && logger.error('Transport disabled');\n }\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n _clearOutcomes() {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.keys(outcomes).map(key => {\n const [reason, category] = key.split(':') ;\n return {\n reason,\n category,\n quantity: outcomes[key],\n };\n });\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult,\n beforeSendLabel,\n) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n },\n e => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw new SentryError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n options,\n event,\n hint,\n) {\n const { beforeSend, beforeSendTransaction } = options;\n\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n\n if (isTransactionEvent(event) && beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n\n return event;\n}\n\nfunction isErrorEvent(event) {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event) {\n return event.type === 'transaction';\n}\n\n/**\n * Add an event processor to the current client.\n * This event processor will run for all events processed by this client.\n */\nfunction addEventProcessor(callback) {\n const client = getClient();\n\n if (!client || !client.addEventProcessor) {\n return;\n }\n\n client.addEventProcessor(callback);\n}\n\nexport { BaseClient, addEventProcessor };\n//# sourceMappingURL=baseclient.js.map\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAM,qBAAqB;AAiC3B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0Bd,YAAY,SAAS;AACpB,SAAK,WAAW;AAChB,SAAK,gBAAgB,CAAA;AACrB,SAAK,2BAA2B;AAChC,SAAK,iBAAiB;AACtB,SAAK,YAAY,CAAA;AACjB,SAAK,SAAS,CAAA;AACd,SAAK,mBAAmB,CAAA;AAExB,QAAI,QAAQ,KAAK;AACf,WAAK,OAAO,QAAQ,QAAQ,GAAG;AAAA,IACjC,OAAO;AACL,qBAAe,OAAO,KAAK,+CAA+C;AAAA,IAC5E;AAEA,QAAI,KAAK,MAAM;AACb,YAAM,MAAM,sCAAsC,KAAK,MAAM,OAAO;AACpE,WAAK,aAAa,QAAQ,UAAU;AAAA,QAClC,QAAQ,KAAK,SAAS;AAAA,QACtB,oBAAoB,KAAK,mBAAmB,KAAK,IAAI;AAAA,QACrD,GAAG,QAAQ;AAAA,QACX;AAAA,MACR,CAAO;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMC,iBAAiB,WA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SAAO;AACtC,YAAM,CAAC,QAAQ,QAAQ,IAAI,IAAI,MAAM,GAAG;AACxC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,UAAU,SAAS,GAAG;AAAA,MAC9B;AAAA,IACI,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAOF;AAKA,SAAS,0BACP,kBACA,iBACA;AACA,QAAM,oBAAoB,GAAG,eAAe;AAC5C,MAAI,WAAW,gBAAgB,GAAG;AAChC,WAAO,iBAAiB;AAAA,MACtB,WAAS;AACP,YAAI,CAAC,cAAc,KAAK,KAAK,UAAU,MAAM;AAC3C,gBAAM,IAAI,YAAY,iBAAiB;AAAA,QACzC;AACA,eAAO;AAAA,MACT;AAAA,MACA,OAAK;AACH,cAAM,IAAI,YAAY,GAAG,eAAe,kBAAkB,CAAC,EAAE;AAAA,MAC/D;AAAA,IACN;AAAA,EACE,WAAW,CAAC,cAAc,gBAAgB,KAAK,qBAAqB,MAAM;AACxE,UAAM,IAAI,YAAY,iBAAiB;AAAA,EACzC;AACA,SAAO;AACT;AAKA,SAAS,kBACP,SACA,OACA,MACA;AACA,QAAM,EAAE,YAAY,sBAAqB,IAAK;AAE9C,MAAI,aAAa,KAAK,KAAK,YAAY;AACrC,WAAO,WAAW,OAAO,IAAI;AAAA,EAC/B;AAEA,MAAI,mBAAmB,KAAK,KAAK,uBAAuB;AACtD,WAAO,sBAAsB,OAAO,IAAI;AAAA,EAC1C;AAEA,SAAO;AACT;AAEA,SAAS,aAAa,OAAO;AAC3B,SAAO,MAAM,SAAS;AACxB;AAEA,SAAS,mBAAmB,OAAO;AACjC,SAAO,MAAM,SAAS;AACxB;","x_google_ignoreList":[0]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dsn = require("../../utils/esm/dsn.cjs");
|
|
3
4
|
const object = require("../../utils/esm/object.cjs");
|
|
4
5
|
const envelope = require("../../utils/esm/envelope.cjs");
|
|
5
|
-
const dsn = require("../../utils/esm/dsn.cjs");
|
|
6
6
|
function createCheckInEnvelope(checkIn, dynamicSamplingContext, metadata, tunnel, dsn$1) {
|
|
7
7
|
const headers = {
|
|
8
8
|
sent_at: (/* @__PURE__ */ new Date()).toISOString()
|