dd-trace 5.80.0 → 5.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-3rdparty.csv +79 -88
- package/ext/tags.d.ts +1 -0
- package/ext/tags.js +1 -0
- package/index.d.ts +42 -35
- package/loader-hook.mjs +16 -4
- package/package.json +33 -56
- package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
- package/packages/datadog-esbuild/index.js +44 -26
- package/packages/datadog-esbuild/src/utils.js +14 -2
- package/packages/datadog-instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/aerospike.js +3 -2
- package/packages/datadog-instrumentations/src/ai.js +2 -2
- package/packages/datadog-instrumentations/src/amqp10.js +1 -1
- package/packages/datadog-instrumentations/src/amqplib.js +4 -4
- package/packages/datadog-instrumentations/src/anthropic.js +14 -2
- package/packages/datadog-instrumentations/src/apollo-server-core.js +2 -2
- package/packages/datadog-instrumentations/src/apollo-server.js +1 -1
- package/packages/datadog-instrumentations/src/apollo.js +3 -2
- package/packages/datadog-instrumentations/src/avsc.js +1 -1
- package/packages/datadog-instrumentations/src/aws-sdk.js +6 -2
- package/packages/datadog-instrumentations/src/azure-event-hubs.js +4 -3
- package/packages/datadog-instrumentations/src/azure-functions.js +2 -2
- package/packages/datadog-instrumentations/src/azure-service-bus.js +3 -4
- package/packages/datadog-instrumentations/src/bluebird.js +1 -1
- package/packages/datadog-instrumentations/src/bullmq.js +11 -0
- package/packages/datadog-instrumentations/src/bunyan.js +1 -1
- package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
- package/packages/datadog-instrumentations/src/child_process.js +2 -2
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +3 -3
- package/packages/datadog-instrumentations/src/couchbase.js +1 -1
- package/packages/datadog-instrumentations/src/crypto.js +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +12 -13
- package/packages/datadog-instrumentations/src/cypress.js +1 -1
- package/packages/datadog-instrumentations/src/dns.js +1 -1
- package/packages/datadog-instrumentations/src/elasticsearch.js +1 -1
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +1 -1
- package/packages/datadog-instrumentations/src/express.js +1 -1
- package/packages/datadog-instrumentations/src/find-my-way.js +6 -5
- package/packages/datadog-instrumentations/src/fs.js +1 -1
- package/packages/datadog-instrumentations/src/generic-pool.js +1 -1
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +137 -15
- package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +2 -3
- package/packages/datadog-instrumentations/src/google-genai.js +120 -0
- package/packages/datadog-instrumentations/src/graphql.js +21 -1
- package/packages/datadog-instrumentations/src/grpc/client.js +1 -1
- package/packages/datadog-instrumentations/src/grpc/server.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hook.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +11 -1
- package/packages/datadog-instrumentations/src/helpers/register.js +12 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +27 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +152 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/bullmq.json +106 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langchain.js +237 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.js +9 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +11 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +139 -0
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/shared-utils.js +9 -0
- package/packages/datadog-instrumentations/src/hono.js +55 -10
- package/packages/datadog-instrumentations/src/ioredis.js +1 -1
- package/packages/datadog-instrumentations/src/iovalkey.js +1 -1
- package/packages/datadog-instrumentations/src/jest.js +2 -2
- package/packages/datadog-instrumentations/src/kafkajs.js +3 -3
- package/packages/datadog-instrumentations/src/knex.js +1 -1
- package/packages/datadog-instrumentations/src/langchain.js +3 -109
- package/packages/datadog-instrumentations/src/ldapjs.js +1 -1
- package/packages/datadog-instrumentations/src/light-my-request.js +93 -0
- package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
- package/packages/datadog-instrumentations/src/lodash.js +1 -2
- package/packages/datadog-instrumentations/src/mariadb.js +1 -2
- package/packages/datadog-instrumentations/src/memcached.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
- package/packages/datadog-instrumentations/src/mongodb.js +1 -1
- package/packages/datadog-instrumentations/src/mongoose.js +1 -1
- package/packages/datadog-instrumentations/src/mquery.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +2 -2
- package/packages/datadog-instrumentations/src/net.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +1 -1
- package/packages/datadog-instrumentations/src/nyc.js +1 -1
- package/packages/datadog-instrumentations/src/openai.js +2 -2
- package/packages/datadog-instrumentations/src/opensearch.js +1 -1
- package/packages/datadog-instrumentations/src/oracledb.js +1 -1
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +1 -1
- package/packages/datadog-instrumentations/src/pg.js +3 -3
- package/packages/datadog-instrumentations/src/pino.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +46 -17
- package/packages/datadog-instrumentations/src/prisma.js +52 -37
- package/packages/datadog-instrumentations/src/process.js +1 -1
- package/packages/datadog-instrumentations/src/promise-js.js +1 -1
- package/packages/datadog-instrumentations/src/promise.js +1 -1
- package/packages/datadog-instrumentations/src/protobufjs.js +1 -1
- package/packages/datadog-instrumentations/src/q.js +1 -1
- package/packages/datadog-instrumentations/src/redis.js +1 -1
- package/packages/datadog-instrumentations/src/rhea.js +1 -1
- package/packages/datadog-instrumentations/src/router.js +1 -1
- package/packages/datadog-instrumentations/src/selenium.js +4 -2
- package/packages/datadog-instrumentations/src/sequelize.js +1 -2
- package/packages/datadog-instrumentations/src/sharedb.js +1 -1
- package/packages/datadog-instrumentations/src/tedious.js +1 -1
- package/packages/datadog-instrumentations/src/undici.js +4 -4
- package/packages/datadog-instrumentations/src/url.js +1 -1
- package/packages/datadog-instrumentations/src/vitest.js +1 -1
- package/packages/datadog-instrumentations/src/vm.js +1 -1
- package/packages/datadog-instrumentations/src/when.js +1 -1
- package/packages/datadog-instrumentations/src/winston.js +1 -1
- package/packages/datadog-instrumentations/src/ws.js +38 -19
- package/packages/datadog-plugin-amqp10/src/index.js +1 -1
- package/packages/datadog-plugin-amqplib/src/index.js +1 -1
- package/packages/datadog-plugin-anthropic/src/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +4 -4
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/util.js +3 -3
- package/packages/datadog-plugin-azure-event-hubs/src/index.js +1 -1
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +19 -5
- package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +4 -0
- package/packages/datadog-plugin-bullmq/src/consumer.js +60 -0
- package/packages/datadog-plugin-bullmq/src/index.js +18 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +178 -0
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +1 -1
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +23 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +2 -2
- package/packages/datadog-plugin-cypress/src/support.js +73 -31
- package/packages/datadog-plugin-express/src/index.js +1 -1
- package/packages/datadog-plugin-fastify/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +13 -3
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +171 -12
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +160 -13
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +217 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
- package/packages/datadog-plugin-google-genai/src/index.js +17 -0
- package/packages/datadog-plugin-google-genai/src/tracing.js +41 -0
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +5 -4
- package/packages/datadog-plugin-grpc/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +2 -1
- package/packages/datadog-plugin-http/src/index.js +25 -5
- package/packages/datadog-plugin-http2/src/client.js +2 -2
- package/packages/datadog-plugin-http2/src/index.js +1 -1
- package/packages/datadog-plugin-jest/src/util.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/index.js +1 -1
- package/packages/datadog-plugin-langchain/src/tracing.js +7 -3
- package/packages/datadog-plugin-moleculer/src/index.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +6 -2
- package/packages/datadog-plugin-next/src/index.js +11 -3
- package/packages/datadog-plugin-openai/src/index.js +1 -1
- package/packages/datadog-plugin-openai/src/stream-helpers.js +30 -10
- package/packages/datadog-plugin-openai/src/tracing.js +2 -2
- package/packages/datadog-plugin-rhea/src/index.js +1 -1
- package/packages/datadog-plugin-ws/src/close.js +56 -3
- package/packages/datadog-plugin-ws/src/index.js +4 -0
- package/packages/datadog-plugin-ws/src/producer.js +39 -4
- package/packages/datadog-plugin-ws/src/receiver.js +39 -3
- package/packages/datadog-plugin-ws/src/server.js +13 -1
- package/packages/datadog-plugin-ws/src/util.js +107 -0
- package/packages/datadog-shimmer/src/shimmer.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +21 -13
- package/packages/dd-trace/src/appsec/api_security_sampler.js +1 -1
- package/packages/dd-trace/src/appsec/graphql.js +2 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/command-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-base-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ldap-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +3 -3
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/untrusted-deserialization-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/unvalidated-redirect-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +3 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-randomness-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +3 -3
- package/packages/dd-trace/src/appsec/iast/index.js +5 -5
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +1 -1
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +11 -16
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
- package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +4 -4
- package/packages/dd-trace/src/appsec/index.js +8 -8
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/index.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/lfi.js +1 -1
- package/packages/dd-trace/src/appsec/rc-products.js +10 -0
- package/packages/dd-trace/src/appsec/recommended.json +230 -3
- package/packages/dd-trace/src/appsec/remote_config.js +177 -0
- package/packages/dd-trace/src/appsec/reporter.js +3 -7
- package/packages/dd-trace/src/appsec/rule_manager.js +37 -20
- package/packages/dd-trace/src/appsec/sdk/index.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
- package/packages/dd-trace/src/appsec/user_tracking.js +2 -2
- package/packages/dd-trace/src/appsec/waf/index.js +17 -3
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +11 -0
- package/packages/dd-trace/src/azure_metadata.js +8 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +8 -6
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +1 -1
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +4 -2
- package/packages/dd-trace/src/config/remote_config.js +34 -0
- package/packages/dd-trace/src/config.js +109 -34
- package/packages/dd-trace/src/config_defaults.js +16 -3
- package/packages/dd-trace/src/constants.js +5 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +10 -1
- package/packages/dd-trace/src/datastreams/checkpointer.js +2 -2
- package/packages/dd-trace/src/datastreams/encoding.js +23 -6
- package/packages/dd-trace/src/datastreams/index.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +41 -2
- package/packages/dd-trace/src/datastreams/processor.js +3 -3
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +1 -1
- package/packages/dd-trace/src/datastreams/writer.js +2 -2
- package/packages/dd-trace/src/debugger/config.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +15 -5
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/config.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +37 -17
- package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +24 -18
- package/packages/dd-trace/src/debugger/devtools_client/send.js +21 -11
- package/packages/dd-trace/src/debugger/devtools_client/session.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +103 -15
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +25 -0
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +56 -25
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +64 -23
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +404 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +8 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +3 -3
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/dogstatsd.js +3 -2
- package/packages/dd-trace/src/encode/0.4.js +1 -1
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +2 -2
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
- package/packages/dd-trace/src/encode/span-stats.js +13 -2
- package/packages/dd-trace/src/exporter.js +2 -2
- package/packages/dd-trace/src/exporters/agent/index.js +1 -1
- package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +1 -1
- package/packages/dd-trace/src/exporters/common/request.js +2 -2
- package/packages/dd-trace/src/exporters/common/writer.js +1 -1
- package/packages/dd-trace/src/exporters/span-stats/index.js +1 -1
- package/packages/dd-trace/src/external-logger/src/index.js +1 -2
- package/packages/dd-trace/src/flare/index.js +1 -1
- package/packages/dd-trace/src/guardrails/index.js +6 -3
- package/packages/dd-trace/src/histogram.js +1 -1
- package/packages/dd-trace/src/id.js +60 -0
- package/packages/dd-trace/src/index.js +1 -1
- package/packages/dd-trace/src/lambda/handler.js +4 -4
- package/packages/dd-trace/src/lambda/index.js +1 -1
- package/packages/dd-trace/src/lambda/runtime/patch.js +4 -4
- package/packages/dd-trace/src/lambda/runtime/ritm.js +2 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +8 -1
- package/packages/dd-trace/src/llmobs/index.js +8 -9
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +38 -7
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +30 -9
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +3 -3
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +104 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +486 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/llm.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +2 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +16 -0
- package/packages/dd-trace/src/llmobs/plugins/{openai.js → openai/index.js} +63 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +126 -0
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +1 -1
- package/packages/dd-trace/src/llmobs/sdk.js +20 -22
- package/packages/dd-trace/src/llmobs/span_processor.js +15 -14
- package/packages/dd-trace/src/llmobs/tagger.js +4 -0
- package/packages/dd-trace/src/llmobs/telemetry.js +3 -4
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -2
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -2
- package/packages/dd-trace/src/log/index.js +1 -1
- package/packages/dd-trace/src/noop/proxy.js +2 -2
- package/packages/dd-trace/src/noop/span.js +1 -1
- package/packages/dd-trace/src/openfeature/index.js +2 -2
- package/packages/dd-trace/src/openfeature/noop.js +14 -14
- package/packages/dd-trace/src/openfeature/remote_config.js +31 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +5 -5
- package/packages/dd-trace/src/openfeature/writers/exposures.js +9 -9
- package/packages/dd-trace/src/opentelemetry/context_manager.js +2 -2
- package/packages/dd-trace/src/opentelemetry/logs/index.js +2 -2
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +3 -2
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +5 -3
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +17 -16
- package/packages/dd-trace/src/opentelemetry/metrics/constants.js +34 -0
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +81 -0
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +225 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +171 -0
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +54 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +62 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +251 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +557 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +10 -18
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +47 -32
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +1 -1
- package/packages/dd-trace/src/opentelemetry/span.js +3 -3
- package/packages/dd-trace/src/opentelemetry/tracer.js +4 -4
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +1 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +24 -8
- package/packages/dd-trace/src/opentracing/span.js +3 -3
- package/packages/dd-trace/src/opentracing/tracer.js +5 -5
- package/packages/dd-trace/src/payload-tagging/index.js +8 -4
- package/packages/dd-trace/src/plugin_manager.js +5 -3
- package/packages/dd-trace/src/plugins/apollo.js +1 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +27 -27
- package/packages/dd-trace/src/plugins/database.js +1 -1
- package/packages/dd-trace/src/plugins/index.js +6 -1
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
- package/packages/dd-trace/src/plugins/outbound.js +1 -1
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +8 -8
- package/packages/dd-trace/src/plugins/util/stacktrace.js +1 -1
- package/packages/dd-trace/src/plugins/util/test.js +27 -27
- package/packages/dd-trace/src/plugins/util/url.js +119 -1
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +1 -1
- package/packages/dd-trace/src/plugins/util/web.js +18 -46
- package/packages/dd-trace/src/priority_sampler.js +15 -16
- package/packages/dd-trace/src/process-tags/index.js +83 -0
- package/packages/dd-trace/src/profiling/config.js +33 -22
- package/packages/dd-trace/src/profiling/exporter_cli.js +4 -4
- package/packages/dd-trace/src/profiling/exporters/agent.js +5 -5
- package/packages/dd-trace/src/profiling/index.js +1 -1
- package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
- package/packages/dd-trace/src/profiling/profiler.js +4 -5
- package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/events.js +11 -2
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/proxy.js +17 -18
- package/packages/dd-trace/src/rate_limiter.js +1 -1
- package/packages/dd-trace/src/remote_config/index.js +541 -137
- package/packages/dd-trace/src/require-package-json.js +1 -1
- package/packages/dd-trace/src/ritm.js +50 -27
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +1 -1
- package/packages/dd-trace/src/serverless.js +16 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
- package/packages/dd-trace/src/span_format.js +10 -5
- package/packages/dd-trace/src/span_processor.js +8 -3
- package/packages/dd-trace/src/span_stats.js +21 -8
- package/packages/dd-trace/src/spanleak.js +1 -1
- package/packages/dd-trace/src/standalone/index.js +1 -1
- package/packages/dd-trace/src/startup-log.js +3 -3
- package/packages/dd-trace/src/supported-configurations.json +16 -0
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -4
- package/packages/dd-trace/src/telemetry/endpoints.js +8 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +22 -8
- package/packages/dd-trace/src/tracer.js +3 -3
- package/packages/dd-trace/src/tracer_metadata.js +19 -15
- package/vendor/dist/@datadog/sketches-js/LICENSE +39 -0
- package/vendor/dist/@datadog/sketches-js/index.js +1 -0
- package/vendor/dist/@datadog/source-map/LICENSE +28 -0
- package/vendor/dist/@datadog/source-map/index.js +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +55 -0
- package/vendor/dist/@isaacs/ttlcache/index.js +1 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/core/index.js +1 -0
- package/vendor/dist/@opentelemetry/resources/LICENSE +201 -0
- package/vendor/dist/@opentelemetry/resources/index.js +1 -0
- package/vendor/dist/astring/LICENSE +19 -0
- package/vendor/dist/astring/index.js +1 -0
- package/vendor/dist/crypto-randomuuid/index.js +1 -0
- package/vendor/dist/escape-string-regexp/LICENSE +9 -0
- package/vendor/dist/escape-string-regexp/index.js +1 -0
- package/vendor/dist/esquery/LICENSE +24 -0
- package/vendor/dist/esquery/index.js +1 -0
- package/vendor/dist/ignore/LICENSE +21 -0
- package/vendor/dist/ignore/index.js +1 -0
- package/vendor/dist/istanbul-lib-coverage/LICENSE +24 -0
- package/vendor/dist/istanbul-lib-coverage/index.js +1 -0
- package/vendor/dist/jest-docblock/LICENSE +21 -0
- package/vendor/dist/jest-docblock/index.js +1 -0
- package/vendor/dist/jsonpath-plus/LICENSE +22 -0
- package/vendor/dist/jsonpath-plus/index.js +1 -0
- package/vendor/dist/limiter/LICENSE +19 -0
- package/vendor/dist/limiter/index.js +1 -0
- package/vendor/dist/lodash.sortby/LICENSE +47 -0
- package/vendor/dist/lodash.sortby/index.js +1 -0
- package/vendor/dist/lru-cache/LICENSE +15 -0
- package/vendor/dist/lru-cache/index.js +1 -0
- package/vendor/dist/meriyah/LICENSE +7 -0
- package/vendor/dist/meriyah/index.js +1 -0
- package/vendor/dist/module-details-from-path/LICENSE +21 -0
- package/vendor/dist/module-details-from-path/index.js +1 -0
- package/vendor/dist/mutexify/promise/LICENSE +21 -0
- package/vendor/dist/mutexify/promise/index.js +1 -0
- package/vendor/dist/opentracing/LICENSE +201 -0
- package/vendor/dist/opentracing/binary_carrier.d.ts +11 -0
- package/vendor/dist/opentracing/constants.d.ts +61 -0
- package/vendor/dist/opentracing/examples/demo/demo.d.ts +2 -0
- package/vendor/dist/opentracing/ext/tags.d.ts +90 -0
- package/vendor/dist/opentracing/functions.d.ts +20 -0
- package/vendor/dist/opentracing/global_tracer.d.ts +14 -0
- package/vendor/dist/opentracing/index.d.ts +12 -0
- package/vendor/dist/opentracing/index.js +1 -0
- package/vendor/dist/opentracing/mock_tracer/index.d.ts +5 -0
- package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +13 -0
- package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +16 -0
- package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +50 -0
- package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +26 -0
- package/vendor/dist/opentracing/noop.d.ts +8 -0
- package/vendor/dist/opentracing/reference.d.ts +33 -0
- package/vendor/dist/opentracing/span.d.ts +147 -0
- package/vendor/dist/opentracing/span_context.d.ts +26 -0
- package/vendor/dist/opentracing/test/api_compatibility.d.ts +16 -0
- package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +3 -0
- package/vendor/dist/opentracing/test/noop_implementation.d.ts +4 -0
- package/vendor/dist/opentracing/test/opentracing_api.d.ts +3 -0
- package/vendor/dist/opentracing/test/unittest.d.ts +2 -0
- package/vendor/dist/opentracing/tracer.d.ts +127 -0
- package/vendor/dist/path-to-regexp/LICENSE +21 -0
- package/vendor/dist/path-to-regexp/index.js +1 -0
- package/vendor/dist/pprof-format/LICENSE +8 -0
- package/vendor/dist/pprof-format/index.js +1 -0
- package/vendor/dist/protobufjs/LICENSE +39 -0
- package/vendor/dist/protobufjs/index.js +1 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +39 -0
- package/vendor/dist/protobufjs/minimal/index.js +1 -0
- package/vendor/dist/retry/LICENSE +21 -0
- package/vendor/dist/retry/index.js +1 -0
- package/vendor/dist/rfdc/LICENSE +15 -0
- package/vendor/dist/rfdc/index.js +1 -0
- package/vendor/dist/semifies/LICENSE +201 -0
- package/vendor/dist/semifies/index.js +1 -0
- package/vendor/dist/shell-quote/LICENSE +24 -0
- package/vendor/dist/shell-quote/index.js +1 -0
- package/vendor/dist/source-map/LICENSE +28 -0
- package/vendor/dist/source-map/index.js +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +28 -0
- package/vendor/dist/source-map/lib/util/index.js +1 -0
- package/vendor/dist/source-map/mappings.wasm +0 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +21 -0
- package/vendor/dist/tlhunter-sorted-set/index.js +1 -0
- package/vendor/dist/ttl-set/LICENSE +21 -0
- package/vendor/dist/ttl-set/index.js +1 -0
- package/packages/dd-trace/src/remote_config/manager.js +0 -368
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright 2012-2015 Yahoo! Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
* Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
* Neither the name of the Yahoo! Inc. nor the
|
|
12
|
+
names of its contributors may be used to endorse or promote products
|
|
13
|
+
derived from this software without specific prior written permission.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
|
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={"./istanbul-lib-coverage/index.js":function(e,t,a){let{FileCoverage:r}=a("./istanbul-lib-coverage/lib/file-coverage.js"),{CoverageMap:s}=a("./istanbul-lib-coverage/lib/coverage-map.js"),{CoverageSummary:n}=a("./istanbul-lib-coverage/lib/coverage-summary.js");e.exports={createCoverageSummary:e=>e&&e instanceof n?e:new n(e),createCoverageMap:e=>e&&e instanceof s?e:new s(e),createFileCoverage:e=>e&&e instanceof r?e:new r(e)},e.exports.classes={FileCoverage:r}},"./istanbul-lib-coverage/lib/coverage-map.js":function(e,t,a){let{FileCoverage:r}=a("./istanbul-lib-coverage/lib/file-coverage.js"),{CoverageSummary:s}=a("./istanbul-lib-coverage/lib/coverage-summary.js");function n(e,t){return e instanceof t?e:new t(e)}class i{constructor(e){e instanceof i?this.data=e.data:this.data=function(e){let t=Object.create(null);return e&&Object.entries(e).forEach(([e,a])=>{t[e]=n(a,r)}),t}(e)}merge(e){Object.values(n(e,i).data).forEach(e=>{this.addFileCoverage(e)})}filter(e){Object.keys(this.data).forEach(t=>{e(t)||delete this.data[t]})}toJSON(){return this.data}files(){return Object.keys(this.data)}fileCoverageFor(e){let t=this.data[e];if(!t)throw Error(`No file coverage available for: ${e}`);return t}addFileCoverage(e){let t=new r(e),{path:a}=t;this.data[a]?this.data[a].merge(t):this.data[a]=t}getCoverageSummary(){let e=new s;return Object.values(this.data).forEach(t=>{e.merge(t.toSummary())}),e}}e.exports={CoverageMap:i}},"./istanbul-lib-coverage/lib/coverage-summary.js":function(e,t,a){let r=a("./istanbul-lib-coverage/lib/percent.js"),s=a("./istanbul-lib-coverage/lib/data-properties.js");class n{constructor(e){e?e instanceof n?this.data=e.data:this.data=e:this.data=function(){let e=()=>({total:0,covered:0,skipped:0,pct:"Unknown"});return{lines:e(),statements:e(),functions:e(),branches:e(),branchesTrue:e()}}(),function(e){if(!(e&&e.lines&&e.statements&&e.functions&&e.branches))throw Error("Invalid summary coverage object, missing keys, found:"+Object.keys(e).join(","))}(this.data)}merge(e){return["lines","statements","branches","functions","branchesTrue"].forEach(t=>{e[t]&&(this[t].total+=e[t].total,this[t].covered+=e[t].covered,this[t].skipped+=e[t].skipped,this[t].pct=r(this[t].covered,this[t].total))}),this}toJSON(){return this.data}isEmpty(){return 0===this.lines.total}}s(n,["lines","statements","functions","branches","branchesTrue"]),e.exports={CoverageSummary:n}},"./istanbul-lib-coverage/lib/data-properties.js":function(e){e.exports=function(e,t){t.forEach(t=>{Object.defineProperty(e.prototype,t,{enumerable:!0,get(){return this.data[t]}})})}},"./istanbul-lib-coverage/lib/file-coverage.js":function(e,t,a){let r=a("./istanbul-lib-coverage/lib/percent.js"),s=a("./istanbul-lib-coverage/lib/data-properties.js"),{CoverageSummary:n}=a("./istanbul-lib-coverage/lib/coverage-summary.js"),i=({start:e,end:t})=>`${e.line}|${e.column}|${t.line}|${t.column}`,o=e=>!!e&&"object"==typeof e,l=e=>o(e)&&"number"==typeof e.line&&"number"==typeof e.column,c=e=>o(e)&&l(e.start)&&l(e.end),u=e=>c(e)?e:c(e.loc)?e.loc:null,h=(e,t)=>{let a=u(e);if(!a)return null;let r=null,s=null,n=null;for(let[e,i]of Object.entries(t)){let t=u(i);if(!t)continue;let o=[a.start.line-t.start.line,a.start.column-t.start.column,t.end.line-a.end.line,t.end.column-a.end.column];if(o[0]<0||o[2]<0||0===o[0]&&o[1]<0||0===o[2]&&o[3]<0)continue;if(null===r){s=o,r=i,n=e;continue}let l=o[0]<s[0]||0===o[0]&&o[1]<s[1],c=o[2]<s[2]||0===o[2]&&o[3]<s[3];(l||c)&&(s=o,r=i,n=e)}return n},b=(e,t)=>"number"==typeof e&&"number"==typeof t?e+t:Array.isArray(e)&&Array.isArray(t)?e.map((e,a)=>(e||0)+(t[a]||0)):null,f=(e,t,a,r)=>{let s=h(e,a);return s?b(t,r[s]):t},p=(e,t,a,r,s=i)=>{let n={};for(let[a,r]of Object.entries(e)){let e=t[a];n[s(e)]=[r,e]}let o={};for(let[e,t]of Object.entries(a)){let a=r[e];o[s(a)]=[t,a]}let l={};for(let[e,t]of Object.entries(n)){let s=t[0],n=t[1],i=o[e];s=i?b(s,i[0]):f(n,s,r,a),l[e]=[s,n]}for(let[a,r]of Object.entries(o)){let s=r[0],n=r[1];l[a]||(s=f(n,s,t,e),l[a]=[s,n])}let c={},u={};return Object.values(l).forEach(([e,t],a)=>{c[a]=e,u[a]=t}),[c,u]};class d{constructor(e,t=!1){if(!e)throw Error("Coverage must be initialized with a path or an object");if("string"==typeof e)this.data=function(e,t){let a={path:e,statementMap:{},fnMap:{},branchMap:{},s:{},f:{},b:{}};return t&&(a.bT={}),a}(e,t);else if(e instanceof d)this.data=e.data;else if("object"==typeof e)this.data=e;else throw Error("Invalid argument to coverage constructor");!function(e){if(!(e&&e.path&&e.statementMap&&e.fnMap&&e.branchMap&&e.s&&e.f&&e.b))throw Error("Invalid file coverage object, missing keys, found:"+Object.keys(e).join(","))}(this.data)}getLineCoverage(){let e=this.data.statementMap,t=this.data.s,a=Object.create(null);return Object.entries(t).forEach(([t,r])=>{if(!e[t])return;let{line:s}=e[t].start,n=a[s];(void 0===n||n<r)&&(a[s]=r)}),a}getUncoveredLines(){let e=this.getLineCoverage(),t=[];return Object.entries(e).forEach(([e,a])=>{0===a&&t.push(e)}),t}getBranchCoverageByLine(){let e=this.branchMap,t=this.b,a={};return Object.entries(e).forEach(([e,r])=>{let s=r.line||r.loc.start.line,n=t[e];a[s]=a[s]||[],a[s].push(...n)}),Object.entries(a).forEach(([e,t])=>{let r=t.filter(e=>e>0),s=r.length/t.length*100;a[e]={covered:r.length,total:t.length,coverage:s}}),a}toJSON(){return this.data}merge(e){if(!0===e.all)return;if(!0===this.all){this.data=e.data;return}let[t,a]=p(this.s,this.statementMap,e.s,e.statementMap);this.data.s=t,this.data.statementMap=a;let r=e=>i(e.locations[0]);[t,a]=p(this.f,this.fnMap,e.f,e.fnMap,e=>i(e.loc)),this.data.f=t,this.data.fnMap=a,[t,a]=p(this.b,this.branchMap,e.b,e.branchMap,r),this.data.b=t,this.data.branchMap=a,this.bT&&e.bT&&([t,a]=p(this.bT,this.branchMap,e.bT,e.branchMap,r),this.data.bT=t)}computeSimpleTotals(e){let t=this[e];"function"==typeof t&&(t=t.call(this));let a={total:Object.keys(t).length,covered:Object.values(t).filter(e=>!!e).length,skipped:0};return a.pct=r(a.covered,a.total),a}computeBranchTotals(e){let t=this[e],a={total:0,covered:0,skipped:0};return Object.values(t).forEach(e=>{a.covered+=e.filter(e=>e>0).length,a.total+=e.length}),a.pct=r(a.covered,a.total),a}resetHits(){let e=this.s,t=this.f,a=this.b,r=this.bT;Object.keys(e).forEach(t=>{e[t]=0}),Object.keys(t).forEach(e=>{t[e]=0}),Object.keys(a).forEach(e=>{a[e].fill(0)}),r&&Object.keys(r).forEach(e=>{r[e].fill(0)})}toSummary(){let e={};return e.lines=this.computeSimpleTotals("getLineCoverage"),e.functions=this.computeSimpleTotals("f","fnMap"),e.statements=this.computeSimpleTotals("s","statementMap"),e.branches=this.computeBranchTotals("b"),this.bT&&(e.branchesTrue=this.computeBranchTotals("bT")),new n(e)}}s(d,["path","statementMap","fnMap","branchMap","s","f","b","bT","all"]),e.exports={FileCoverage:d,findNearestContainer:h,addHits:b,addNearestContainerHits:f}},"./istanbul-lib-coverage/lib/percent.js":function(e){e.exports=function(e,t){return t>0?Math.floor(1e5*e/t/10)/100:100}}},t={},a=function a(r){var s=t[r];if(void 0!==s)return s.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,a),n.exports}("./istanbul-lib-coverage/index.js");module.exports=a})();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={"./detect-newline/index.js":function(e){let r=e=>{if("string"!=typeof e)throw TypeError("Expected a string");let r=e.match(/(?:\r?\n)/g)||[];if(0===r.length)return;let t=r.filter(e=>"\r\n"===e).length,n=r.length-t;return t>n?"\r\n":"\n"};e.exports=r,e.exports.graceful=e=>"string"==typeof e&&r(e)||"\n"},os:function(e){e.exports=require("os")}},r={};function t(n){var i=r[n];if(void 0!==i)return i.exports;var l=r[n]={exports:{}};return e[n](l,l.exports,t),l.exports}var n={};(()=>{function e(){let r=t("os");return e=function(){return r},r}function r(){var e;let n=(e=t("./detect-newline/index.js"))&&e.__esModule?e:{default:e};return r=function(){return n},n}Object.defineProperty(n,"__esModule",{value:!0}),n.extract=function(e){let r=e.match(a);return r?r[0].trimLeft():""},n.parse=function(e){return g(e).pragmas},n.parseWithComments=g,n.print=function({comments:t="",pragmas:n={}}){let i=(0,r().default)(t)??e().EOL,l=Object.keys(n),a=l.flatMap(e=>m(e,n[e])).map(e=>` * ${e}${i}`).join("");if(!t){if(0===l.length)return"";if(1===l.length&&!Array.isArray(n[l[0]])){let e=n[l[0]];return`/** ${m(l[0],e)[0]} */`}}let o=t.split(i).map(e=>` * ${e}`).join(i)+i;return"/**"+i+(t?o:"")+(t&&l.length?" *"+i:"")+a+" */"},n.strip=function(e){let r=e.match(a);return r&&r[0]?e.substring(r[0].length):e};let i=/\*\/$/,l=/^\/\*\*?/,a=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,o=/(^|\s+)\/\/([^\r\n]*)/g,u=/^(\r?\n)+/,c=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,s=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,p=/(\r?\n|^) *\* ?/g,f=[];function g(t){let n,a=(0,r().default)(t)??e().EOL;t=t.replace(l,"").replace(i,"").replace(p,"$1");let g="";for(;g!==t;)g=t,t=t.replace(c,`${a}$1 $2${a}`);t=t.replace(u,"").trimRight();let m=Object.create(null),h=t.replace(s,"").replace(u,"").trimRight();for(;n=s.exec(t);){let e=n[2].replace(o,"");"string"==typeof m[n[1]]||Array.isArray(m[n[1]])?m[n[1]]=f.concat(m[n[1]],e):m[n[1]]=e}return{comments:h,pragmas:m}}function m(e,r){return f.concat(r).map(r=>`@${e} ${r}`.trim())}})(),module.exports=n})();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011-2019 Stefan Goessner, Subbu Allamaraju, Mike Brevoort,
|
|
4
|
+
Robert Krahn, Brett Zamir, Richard Schneider
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={};e.d=(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{JSONPath:()=>u});let r=require("vm");class i{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+i.version}static addUnaryOp(e){return i.max_unop_len=Math.max(e.length,i.max_unop_len),i.unary_ops[e]=1,i}static addBinaryOp(e,t,r){return i.max_binop_len=Math.max(e.length,i.max_binop_len),i.binary_ops[e]=t,r?i.right_associative.add(e):i.right_associative.delete(e),i}static addIdentifierChar(e){return i.additional_identifier_chars.add(e),i}static addLiteral(e,t){return i.literals[e]=t,i}static removeUnaryOp(e){return delete i.unary_ops[e],e.length===i.max_unop_len&&(i.max_unop_len=i.getMaxKeyLen(i.unary_ops)),i}static removeAllUnaryOps(){return i.unary_ops={},i.max_unop_len=0,i}static removeIdentifierChar(e){return i.additional_identifier_chars.delete(e),i}static removeBinaryOp(e){return delete i.binary_ops[e],e.length===i.max_binop_len&&(i.max_binop_len=i.getMaxKeyLen(i.binary_ops)),i.right_associative.delete(e),i}static removeAllBinaryOps(){return i.binary_ops={},i.max_binop_len=0,i}static removeLiteral(e){return delete i.literals[e],i}static removeAllLiterals(){return i.literals={},i}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new i(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return i.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!i.binary_ops[String.fromCharCode(e)]||i.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return i.isIdentifierStart(e)||i.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(i.hooks[e]){let r={context:this,node:t};return i.hooks.run(e,r),r.node}return t}searchHook(e){if(i.hooks[e]){let t={context:this};return i.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===i.SPACE_CODE||e===i.TAB_CODE||e===i.LF_CODE||e===i.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:i.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,s;for(;this.index<this.expr.length;)if((r=this.code)===i.SEMCOL_CODE||r===i.COMMA_CODE)this.index++;else if(s=this.gobbleExpression())t.push(s);else if(this.index<this.expr.length){if(r===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,i.max_binop_len),t=e.length;for(;t>0;){if(i.binary_ops.hasOwnProperty(e)&&(!i.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,s,n,a,o,l,h;if(!(a=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return a;for(n={value:t,prec:i.binaryPrecedence(t),right_a:i.right_associative.has(t)},(o=this.gobbleToken())||this.throwError("Expected expression after "+t),s=[a,n,o];t=this.gobbleBinaryOp();){if(0===(r=i.binaryPrecedence(t))){this.index-=t.length;break}n={value:t,prec:r,right_a:i.right_associative.has(t)},h=t;let l=e=>n.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;s.length>2&&l(s[s.length-2]);)o=s.pop(),t=s.pop().value,a=s.pop(),e={type:i.BINARY_EXP,operator:t,left:a,right:o},s.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+h),s.push(n,e)}for(l=s.length-1,e=s[l];l>1;)e={type:i.BINARY_EXP,operator:s[l-1].value,left:s[l-2],right:e},l-=2;return e}gobbleToken(){let e,t,r,s;if(this.gobbleSpaces(),s=this.searchHook("gobble-token"))return this.runHook("after-token",s);if(e=this.code,i.isDecimalDigit(e)||e===i.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===i.SQUOTE_CODE||e===i.DQUOTE_CODE)s=this.gobbleStringLiteral();else if(e===i.OBRACK_CODE)s=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,i.max_unop_len)).length;r>0;){if(i.unary_ops.hasOwnProperty(t)&&(!i.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!i.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:i.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}i.isIdentifierStart(e)?(s=this.gobbleIdentifier(),i.literals.hasOwnProperty(s.name)?s={type:i.LITERAL,value:i.literals[s.name],raw:s.name}:s.name===i.this_str&&(s={type:i.THIS_EXP})):e===i.OPAREN_CODE&&(s=this.gobbleGroup())}return s?(s=this.gobbleTokenProperty(s),this.runHook("after-token",s)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===i.PERIOD_CODE||t===i.OBRACK_CODE||t===i.OPAREN_CODE||t===i.QUMARK_CODE;){let r;if(t===i.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==i.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===i.OBRACK_CODE?((e={type:i.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==i.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===i.OPAREN_CODE?e={type:i.CALL_EXP,arguments:this.gobbleArguments(i.CPAREN_CODE),callee:e}:(t===i.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:i.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===i.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));i.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);i.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,i.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===i.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===i.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:i.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),s=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){s=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return s||this.throwError('Unclosed quote after "'+e+'"'),{type:i.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(i.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,i.isIdentifierPart(e))this.index++;else break;return{type:i.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,s=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let n=this.code;if(n===e){r=!0,this.index++,e===i.CPAREN_CODE&&s&&s>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(n===i.COMMA_CODE){if(this.index++,++s!==t.length){if(e===i.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===i.CBRACK_CODE)for(let e=t.length;e<s;e++)t.push(null)}}else if(t.length!==s&&0!==s)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==i.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(i.CPAREN_CODE);if(this.code===i.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:i.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:i.ARRAY_EXP,elements:this.gobbleArguments(i.CBRACK_CODE)}}}Object.assign(i,{hooks:new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(i),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),i.max_unop_len=i.getMaxKeyLen(i.unary_ops),i.max_binop_len=i.getMaxKeyLen(i.binary_ops);let s=e=>new i(e).parse(),n=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(i).filter(e=>!n.includes(e)&&void 0===s[e]).forEach(e=>{s[e]=i[e]}),s.Jsep=i,s.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let s=this.gobbleExpression();if(s||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:i,alternate:s},r.operator&&e.binary_ops[r.operator]<=.9){let i=r;for(;i.right.operator&&e.binary_ops[i.right.operator]<=.9;)i=i.right;t.node.test=i.right,i.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let a={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(e){let t=[e.IDENTIFIER,e.MEMBER_EXP];a.assignmentOperators.forEach(t=>e.addBinaryOp(t,a.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(e){let r=this.code;a.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add("after-token",function(e){if(e.node){let r=this.code;a.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:e.node,prefix:!1})}}),e.hooks.add("after-expression",function(e){e.node&&function e(t){a.assignmentOperators.has(t.operator)?(t.type="AssignmentExpression",e(t.left),e(t.right)):t.operator||Object.values(t).forEach(t=>{t&&"object"==typeof t&&e(t)})}(e.node)})}};s.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,i=!1;for(;this.index<this.expr.length;){if(47===this.code&&!i){let i,s=this.expr.slice(r,this.index),n="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)n+=this.char;else break}try{i=new RegExp(s,n)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:i,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?i=!0:i&&this.code===e.CBRACK_CODE&&(i=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}},a),s.addUnaryOp("typeof"),s.addLiteral("null",null),s.addLiteral("undefined",void 0);let o=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),l={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return l.evalBinaryExpression(e,t);case"Compound":return l.evalCompound(e,t);case"ConditionalExpression":return l.evalConditionalExpression(e,t);case"Identifier":return l.evalIdentifier(e,t);case"Literal":return l.evalLiteral(e,t);case"MemberExpression":return l.evalMemberExpression(e,t);case"UnaryExpression":return l.evalUnaryExpression(e,t);case"ArrayExpression":return l.evalArrayExpression(e,t);case"CallExpression":return l.evalCallExpression(e,t);case"AssignmentExpression":return l.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression:(e,t)=>({"||":(e,t)=>e||t(),"&&":(e,t)=>e&&t(),"|":(e,t)=>e|t(),"^":(e,t)=>e^t(),"&":(e,t)=>e&t(),"==":(e,t)=>e==t(),"!=":(e,t)=>e!=t(),"===":(e,t)=>e===t(),"!==":(e,t)=>e!==t(),"<":(e,t)=>e<t(),">":(e,t)=>e>t(),"<=":(e,t)=>e<=t(),">=":(e,t)=>e>=t(),"<<":(e,t)=>e<<t(),">>":(e,t)=>e>>t(),">>>":(e,t)=>e>>>t(),"+":(e,t)=>e+t(),"-":(e,t)=>e-t(),"*":(e,t)=>e*t(),"/":(e,t)=>e/t(),"%":(e,t)=>e%t()})[e.operator](l.evalAst(e.left,t),()=>l.evalAst(e.right,t)),evalCompound(e,t){let r;for(let i=0;i<e.body.length;i++){"Identifier"===e.body[i].type&&["var","let","const"].includes(e.body[i].name)&&e.body[i+1]&&"AssignmentExpression"===e.body[i+1].type&&(i+=1);let s=e.body[i];r=l.evalAst(s,t)}return r},evalConditionalExpression:(e,t)=>l.evalAst(e.test,t)?l.evalAst(e.consequent,t):l.evalAst(e.alternate,t),evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:e=>e.value,evalMemberExpression(e,t){let r=String(e.computed?l.evalAst(e.property):e.property.name),i=l.evalAst(e.object,t);if(null==i||!Object.hasOwn(i,r)&&o.has(r))throw TypeError(`Cannot read properties of ${i} (reading '${r}')`);let s=i[r];return"function"==typeof s?s.bind(i):s},evalUnaryExpression:(e,t)=>({"-":e=>-l.evalAst(e,t),"!":e=>!l.evalAst(e,t),"~":e=>~l.evalAst(e,t),"+":e=>+l.evalAst(e,t),typeof:e=>typeof l.evalAst(e,t)})[e.operator](e.argument),evalArrayExpression:(e,t)=>e.elements.map(e=>l.evalAst(e,t)),evalCallExpression(e,t){let r=e.arguments.map(e=>l.evalAst(e,t));return l.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if("Identifier"!==e.left.type)throw SyntaxError("Invalid left-hand side in assignment");let r=e.left.name,i=l.evalAst(e.right,t);return t[r]=i,t[r]}};function h(e,t){return(e=e.slice()).push(t),e}function p(e,t){return(t=t.slice()).unshift(e),t}class c extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function u(e,t,r,i,s){if(!(this instanceof u))try{return new u(e,t,r,i,s)}catch(e){if(!e.avoidNew)throw e;return e.value}"string"==typeof e&&(s=i,i=r,r=t,t=e,e=null);let n=e&&"object"==typeof e;if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=!Object.hasOwn(e,"wrap")||e.wrap,this.sandbox=e.sandbox||{},this.eval=void 0===e.eval?"safe":e.eval,this.ignoreEvalErrors=void 0!==e.ignoreEvalErrors&&e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||i||null,this.otherTypeCallback=e.otherTypeCallback||s||function(){throw TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==e.autostart){let i={path:n?e.path:t};n?"json"in e&&(i.json=e.json):i.json=r;let s=this.evaluate(i);if(!s||"object"!=typeof s)throw new c(s);return s}}u.prototype.evaluate=function(e,t,r,i){let s=this.parent,n=this.parentProperty,{flatten:a,wrap:o}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,(e=e||this.path)&&"object"==typeof e&&!Array.isArray(e)){if(!e.path&&""!==e.path)throw TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),a=Object.hasOwn(e,"flatten")?e.flatten:a,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,o=Object.hasOwn(e,"wrap")?e.wrap:o,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,s=Object.hasOwn(e,"parent")?e.parent:s,n=Object.hasOwn(e,"parentProperty")?e.parentProperty:n,e=e.path}if(s=s||null,n=n||null,Array.isArray(e)&&(e=u.toPathString(e)),!e&&""!==e||!t)return;let l=u.toPathArray(e);"$"===l[0]&&l.length>1&&l.shift(),this._hasParentSelector=null;let h=this._trace(l,t,["$"],s,n,r).filter(function(e){return e&&!e.isParentSelector});return h.length?o||1!==h.length||h[0].hasArrExpr?h.reduce((e,t)=>{let r=this._getPreferredOutput(t);return a&&Array.isArray(r)?e=e.concat(r):e.push(r),e},[]):this._getPreferredOutput(h[0]):o?[]:void 0},u.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let t=Array.isArray(e.path)?e.path:u.toPathArray(e.path);return e.pointer=u.toPointer(t),e.path="string"==typeof e.path?e.path:u.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return u.toPathString(e[t]);case"pointer":return u.toPointer(e.path);default:throw TypeError("Unknown result type")}},u.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:u.toPathString(e.path),t(i,r,e)}},u.prototype._trace=function(e,t,r,i,s,n,a,o){let l;if(!e.length)return l={path:r,value:t,parent:i,parentProperty:s,hasArrExpr:a},this._handleCallback(l,n,"value"),l;let c=e[0],u=e.slice(1),d=[];function b(e){Array.isArray(e)?e.forEach(e=>{d.push(e)}):d.push(e)}if(("string"!=typeof c||o)&&t&&Object.hasOwn(t,c))b(this._trace(u,t[c],h(r,c),t,c,n,a));else if("*"===c)this._walk(t,e=>{b(this._trace(u,t[e],h(r,e),t,e,n,!0,!0))});else if(".."===c)b(this._trace(u,t,r,i,s,n,a)),this._walk(t,i=>{"object"==typeof t[i]&&b(this._trace(e.slice(),t[i],h(r,i),t,i,n,!0))});else if("^"===c)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};else if("~"===c)return l={path:h(r,c),value:s,parent:i,parentProperty:null},this._handleCallback(l,n,"property"),l;else if("$"===c)b(this._trace(u,t,r,null,null,n,a));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))b(this._slice(c,u,t,r,i,s,n));else if(0===c.indexOf("?(")){if(!1===this.currEval)throw Error("Eval [?(expr)] prevented in JSONPath expression.");let e=c.replace(/^\?\((.*?)\)$/u,"$1"),a=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(e);a?this._walk(t,e=>{let o=[a[2]],l=a[1]?t[e][a[1]]:t[e];this._trace(o,l,r,i,s,n,!0).length>0&&b(this._trace(u,t[e],h(r,e),t,e,n,!0))}):this._walk(t,a=>{this._eval(e,t[a],a,r,i,s)&&b(this._trace(u,t[a],h(r,a),t,a,n,!0))})}else if("("===c[0]){if(!1===this.currEval)throw Error("Eval [(expr)] prevented in JSONPath expression.");b(this._trace(p(this._eval(c,t,r.at(-1),r.slice(0,-1),i,s),u),t,r,i,s,n,a))}else if("@"===c[0]){let e=!1,a=c.slice(1,-2);switch(a){case"scalar":t&&["object","function"].includes(typeof t)||(e=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===a&&(e=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(e=!0);break;case"number":Number.isFinite(t)&&(e=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(e=!0);break;case"object":t&&typeof t===a&&(e=!0);break;case"array":Array.isArray(t)&&(e=!0);break;case"other":e=this.currOtherTypeCallback(t,r,i,s);break;case"null":null===t&&(e=!0);break;default:throw TypeError("Unknown value type "+a)}if(e)return l={path:r,value:t,parent:i,parentProperty:s},this._handleCallback(l,n,"value"),l}else if("`"===c[0]&&t&&Object.hasOwn(t,c.slice(1))){let e=c.slice(1);b(this._trace(u,t[e],h(r,e),t,e,n,a,!0))}else if(c.includes(","))for(let e of c.split(","))b(this._trace(p(e,u),t,r,i,s,n,!0));else!o&&t&&Object.hasOwn(t,c)&&b(this._trace(u,t[c],h(r,c),t,c,n,a,!0));if(this._hasParentSelector)for(let e=0;e<d.length;e++){let r=d[e];if(r&&r.isParentSelector){let o=this._trace(r.expr,t,r.path,i,s,n,a);if(Array.isArray(o)){d[e]=o[0];let t=o.length;for(let r=1;r<t;r++)e++,d.splice(e,0,o[r])}else d[e]=o}}return d},u.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let e=0;e<r;e++)t(e)}else e&&"object"==typeof e&&Object.keys(e).forEach(e=>{t(e)})},u.prototype._slice=function(e,t,r,i,s,n,a){if(!Array.isArray(r))return;let o=r.length,l=e.split(":"),h=l[2]&&Number.parseInt(l[2])||1,c=l[0]&&Number.parseInt(l[0])||0,u=l[1]&&Number.parseInt(l[1])||o;c=c<0?Math.max(0,c+o):Math.min(o,c),u=u<0?Math.max(0,u+o):Math.min(o,u);let d=[];for(let e=c;e<u;e+=h)this._trace(p(e,t),r,i,s,n,a,!0).forEach(e=>{d.push(e)});return d},u.prototype._eval=function(e,t,r,i,s,n){this.currSandbox._$_parentProperty=n,this.currSandbox._$_parent=s,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let a=e.includes("@path");a&&(this.currSandbox._$_path=u.toPathString(i.concat([r])));let o=this.currEval+"Script:"+e;if(!u.cache[o]){let t=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(a&&(t=t.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)u.cache[o]=new this.safeVm.Script(t);else if("native"===this.currEval)u.cache[o]=new this.vm.Script(t);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){let e=this.currEval;u.cache[o]=new e(t)}else if("function"==typeof this.currEval)u.cache[o]={runInNewContext:e=>this.currEval(t,e)};else throw TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return u.cache[o].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw Error("jsonPath: "+t.message+": "+e)}},u.cache={},u.toPathString=function(e){let t=e.length,r="$";for(let i=1;i<t;i++)/^(~|\^|@.*?\(\))$/u.test(e[i])||(r+=/^[0-9*]+$/u.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return r},u.toPointer=function(e){let t=e.length,r="";for(let i=1;i<t;i++)/^(~|\^|@.*?\(\))$/u.test(e[i])||(r+="/"+e[i].toString().replaceAll("~","~0").replaceAll("/","~1"));return r},u.toPathArray=function(e){let{cache:t}=u;if(t[e])return t[e].concat();let r=[],i=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(e,t){return"[#"+(r.push(t)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(e,t){return"['"+t.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(e,t){return";"+t.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(e){let t=e.match(/#(\d+)/u);return t&&t[1]?r[t[1]]:e});return t[e]=i,t[e].concat()},u.prototype.safeVm={Script:class{constructor(e){this.code=e,this.ast=s(this.code)}runInNewContext(e){let t=Object.assign(Object.create(null),e);return l.evalAst(this.ast,t)}}},u.prototype.vm=r,module.exports=t})();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (C) 2011 by John Hurliman
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var t={"./limiter/lib/clock.js":function(t){t.exports=function(){if("undefined"!=typeof process&&process.hrtime){var t=process.hrtime();return 1e3*t[0]+Math.floor(t[1]/1e6)}return new Date().getTime()}},"./limiter/lib/rateLimiter.js":function(t,e,n){var i=n("./limiter/lib/tokenBucket.js"),r=n("./limiter/lib/clock.js"),s=function(t,e,n){this.tokenBucket=new i(t,t,e,null),this.tokenBucket.content=t,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(t,e){if(t>this.tokenBucket.bucketSize)return process.nextTick(e.bind(null,"Requested tokens "+t+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var n=this,i=r();if((i<this.curIntervalStart||i-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=i,this.tokensThisInterval=0),t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return this.fireImmediately?process.nextTick(e.bind(null,null,-1)):setTimeout(function(){n.tokenBucket.removeTokens(t,s)},Math.ceil(this.curIntervalStart+this.tokenBucket.interval-i)),!1;return this.tokenBucket.removeTokens(t,s);function s(i,r){if(i)return e(i,null);n.tokensThisInterval+=t,e(null,r)}},tryRemoveTokens:function(t){if(t>this.tokenBucket.bucketSize)return!1;var e=r();if((e<this.curIntervalStart||e-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=e,this.tokensThisInterval=0),t>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(t);return n&&(this.tokensThisInterval+=t),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},t.exports=s},"./limiter/lib/tokenBucket.js":function(t){var e=function(t,e,n,i){if(this.bucketSize=t,this.tokensPerInterval=e,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};e.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(t,e){var n=this;if(!this.bucketSize)return process.nextTick(e.bind(null,null,t,1/0)),!0;if(t>this.bucketSize)return process.nextTick(e.bind(null,"Requested tokens "+t+" exceeds bucket size "+this.bucketSize,null)),!1;if(this.drip(),t>this.content)return i();if(this.parentBucket)return this.parentBucket.removeTokens(t,function(r,s){return r?e(r,null):t>n.content?i():void(n.content-=t,e(null,Math.min(s,n.content)))});return this.content-=t,process.nextTick(e.bind(null,null,this.content)),!0;function i(){return setTimeout(function(){n.removeTokens(t,e)},Math.ceil((t-n.content)*(n.interval/n.tokensPerInterval))),!1}},tryRemoveTokens:function(t){return!this.bucketSize||!(t>this.bucketSize)&&(this.drip(),!(t>this.content)&&(!this.parentBucket||!!this.parentBucket.tryRemoveTokens(t))&&(this.content-=t,!0))},drip:function(){if(!this.tokensPerInterval){this.content=this.bucketSize;return}var t=+new Date,e=Math.max(t-this.lastDrip,0);this.lastDrip=t;var n=e*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}},t.exports=e}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}var i={};i.RateLimiter=n("./limiter/lib/rateLimiter.js"),i.TokenBucket=n("./limiter/lib/tokenBucket.js"),module.exports=i})();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
2
|
+
|
|
3
|
+
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
4
|
+
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
5
|
+
|
|
6
|
+
This software consists of voluntary contributions made by many
|
|
7
|
+
individuals. For exact contribution history, see the revision history
|
|
8
|
+
available at https://github.com/lodash/lodash
|
|
9
|
+
|
|
10
|
+
The following license applies to all parts of this software except as
|
|
11
|
+
documented below:
|
|
12
|
+
|
|
13
|
+
====
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
16
|
+
a copy of this software and associated documentation files (the
|
|
17
|
+
"Software"), to deal in the Software without restriction, including
|
|
18
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
19
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
20
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
21
|
+
the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be
|
|
24
|
+
included in all copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
27
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
28
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
29
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
30
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
31
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
32
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
====
|
|
35
|
+
|
|
36
|
+
Copyright and related rights for sample code are waived via CC0. Sample
|
|
37
|
+
code is defined as all source code displayed within the prose of the
|
|
38
|
+
documentation.
|
|
39
|
+
|
|
40
|
+
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
41
|
+
|
|
42
|
+
====
|
|
43
|
+
|
|
44
|
+
Files located in the node_modules and vendor directories are externally
|
|
45
|
+
maintained libraries used by this software which have their own
|
|
46
|
+
licenses; we recommend you read them, as their terms may differ from the
|
|
47
|
+
terms above.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var t={"./lodash.sortby/index.js":function(t,r,n){t=n.nmd(t);var e,o,a,u,i,c,f="__lodash_hash_undefined__",l=1/0,s="[object Arguments]",h="[object Array]",v="[object Boolean]",p="[object Date]",_="[object Error]",d="[object Function]",y="[object Map]",b="[object Number]",g="[object Object]",j="[object Promise]",w="[object RegExp]",m="[object Set]",A="[object String]",O="[object Symbol]",x="[object WeakMap]",k="[object ArrayBuffer]",S="[object DataView]",$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,E=/^\w*$/,F=/^\./,C=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,I=/\\(\\)?/g,M=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,T={};T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T[s]=T[h]=T[k]=T[v]=T[S]=T[p]=T[_]=T[d]=T[y]=T[b]=T[g]=T[w]=T[m]=T[A]=T[x]=!1;var U="object"==typeof global&&global&&global.Object===Object&&global,z="object"==typeof self&&self&&self.Object===Object&&self,L=U||z||Function("return this")(),B=r&&!r.nodeType&&r,D=B&&t&&!t.nodeType&&t,R=D&&D.exports===B&&U.process,V=function(){try{return R&&R.binding("util")}catch(t){}}(),W=V&&V.isTypedArray;function G(t,r){for(var n=-1,e=t?t.length:0,o=Array(e);++n<e;)o[n]=r(t[n],n,t);return o}function N(t){return function(r){return t(r)}}function q(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(t){}return r}function H(t){var r=-1,n=Array(t.size);return t.forEach(function(t,e){n[++r]=[e,t]}),n}function J(t){var r=-1,n=Array(t.size);return t.forEach(function(t){n[++r]=t}),n}var K=Array.prototype,Q=Function.prototype,X=Object.prototype,Y=L["__core-js_shared__"],Z=(o=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"",tt=Q.toString,tr=X.hasOwnProperty,tn=X.toString,te=RegExp("^"+tt.call(tr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),to=L.Symbol,ta=L.Uint8Array,tu=X.propertyIsEnumerable,ti=K.splice,tc=to?to.isConcatSpreadable:void 0,tf=(a=Object.keys,u=Object,function(t){return a(u(t))}),tl=Math.max,ts=tB(L,"DataView"),th=tB(L,"Map"),tv=tB(L,"Promise"),tp=tB(L,"Set"),t_=tB(L,"WeakMap"),td=tB(Object,"create"),ty=tJ(ts),tb=tJ(th),tg=tJ(tv),tj=tJ(tp),tw=tJ(t_),tm=to?to.prototype:void 0,tA=tm?tm.valueOf:void 0,tO=tm?tm.toString:void 0;function tx(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function tk(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function tS(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function t$(t){var r=-1,n=t?t.length:0;for(this.__data__=new tS;++r<n;)this.add(t[r])}function tE(t){this.__data__=new tk(t)}function tF(t,r){for(var n=t.length;n--;)if(tX(t[n][0],r))return n;return -1}tx.prototype.clear=function(){this.__data__=td?td(null):{}},tx.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},tx.prototype.get=function(t){var r=this.__data__;if(td){var n=r[t];return n===f?void 0:n}return tr.call(r,t)?r[t]:void 0},tx.prototype.has=function(t){var r=this.__data__;return td?void 0!==r[t]:tr.call(r,t)},tx.prototype.set=function(t,r){return this.__data__[t]=td&&void 0===r?f:r,this},tk.prototype.clear=function(){this.__data__=[]},tk.prototype.delete=function(t){var r=this.__data__,n=tF(r,t);return!(n<0)&&(n==r.length-1?r.pop():ti.call(r,n,1),!0)},tk.prototype.get=function(t){var r=this.__data__,n=tF(r,t);return n<0?void 0:r[n][1]},tk.prototype.has=function(t){return tF(this.__data__,t)>-1},tk.prototype.set=function(t,r){var n=this.__data__,e=tF(n,t);return e<0?n.push([t,r]):n[e][1]=r,this},tS.prototype.clear=function(){this.__data__={hash:new tx,map:new(th||tk),string:new tx}},tS.prototype.delete=function(t){return tL(this,t).delete(t)},tS.prototype.get=function(t){return tL(this,t).get(t)},tS.prototype.has=function(t){return tL(this,t).has(t)},tS.prototype.set=function(t,r){return tL(this,t).set(t,r),this},t$.prototype.add=t$.prototype.push=function(t){return this.__data__.set(t,f),this},t$.prototype.has=function(t){return this.__data__.has(t)},tE.prototype.clear=function(){this.__data__=new tk},tE.prototype.delete=function(t){return this.__data__.delete(t)},tE.prototype.get=function(t){return this.__data__.get(t)},tE.prototype.has=function(t){return this.__data__.has(t)},tE.prototype.set=function(t,r){var n=this.__data__;if(n instanceof tk){var e=n.__data__;if(!th||e.length<199)return e.push([t,r]),this;n=this.__data__=new tS(e)}return n.set(t,r),this};var tC=(e=function(t,r){return t&&tI(t,r,t4)},function(t,r){if(null==t)return t;if(!t1(t))return e(t,r);for(var n=t.length,o=-1,a=Object(t);++o<n&&!1!==r(a[o],o,a););return t}),tI=function(t,r,n){for(var e=-1,o=Object(t),a=n(t),u=a.length;u--;){var i=a[++e];if(!1===r(o[i],i,o))break}return t};function tM(t,r){var n;r=tG(r,t)?[r]:tZ(n=r)?n:tq(n);for(var e=0,o=r.length;null!=t&&e<o;)t=t[tH(r[e++])];return e&&e==o?t:void 0}function tP(t,r){return null!=t&&r in Object(t)}function tT(t,r,n,e,o){return t===r||(null!=t&&null!=r&&(t3(t)||t8(r))?function(t,r,n,e,o,a){var u=tZ(t),i=tZ(r),c=h,f=h;u||(c=(c=tD(t))==s?g:c),i||(f=(f=tD(r))==s?g:f);var l=c==g&&!q(t),d=f==g&&!q(r),j=c==f;if(j&&!l)return a||(a=new tE),u||t9(t)?tz(t,r,n,e,o,a):function(t,r,n,e,o,a,u){switch(n){case S:if(t.byteLength!=r.byteLength||t.byteOffset!=r.byteOffset)break;t=t.buffer,r=r.buffer;case k:if(t.byteLength!=r.byteLength||!e(new ta(t),new ta(r)))break;return!0;case v:case p:case b:return tX(+t,+r);case _:return t.name==r.name&&t.message==r.message;case w:case A:return t==r+"";case y:var i=H;case m:var c=2&a;if(i||(i=J),t.size!=r.size&&!c)break;var f=u.get(t);if(f)return f==r;a|=1,u.set(t,r);var l=tz(i(t),i(r),e,o,a,u);return u.delete(t),l;case O:if(tA)return tA.call(t)==tA.call(r)}return!1}(t,r,c,n,e,o,a);if(!(2&o)){var x=l&&tr.call(t,"__wrapped__"),$=d&&tr.call(r,"__wrapped__");if(x||$){var E=x?t.value():t,F=$?r.value():r;return a||(a=new tE),n(E,F,e,o,a)}}return!!j&&(a||(a=new tE),function(t,r,n,e,o,a){var u=2&o,i=t4(t),c=i.length;if(c!=t4(r).length&&!u)return!1;for(var f=c;f--;){var l=i[f];if(!(u?l in r:tr.call(r,l)))return!1}var s=a.get(t);if(s&&a.get(r))return s==r;var h=!0;a.set(t,r),a.set(r,t);for(var v=u;++f<c;){var p=t[l=i[f]],_=r[l];if(e)var d=u?e(_,p,l,r,t,a):e(p,_,l,t,r,a);if(!(void 0===d?p===_||n(p,_,e,o,a):d)){h=!1;break}v||(v="constructor"==l)}if(h&&!v){var y=t.constructor,b=r.constructor;y!=b&&"constructor"in t&&"constructor"in r&&!("function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b)&&(h=!1)}return a.delete(t),a.delete(r),h}(t,r,n,e,o,a))}(t,r,tT,n,e,o):t!=t&&r!=r)}function tU(t){var r,n,e,o;return"function"==typeof t?t:null==t?t5:"object"==typeof t?tZ(t)?(r=t[0],n=t[1],tG(r)&&function(t){return t==t&&!t3(t)}(n)?tN(tH(r),n):function(t){var e,o,a,u,i,c=(e=t,o=r,void 0===(a=null==e?void 0:tM(e,o))?void 0:a);return void 0===c&&c===n?(u=t,i=r,null!=u&&function(t,r,n){r=tG(r,t)?[r]:tZ(e=r)?e:tq(e);for(var e,o,a=-1,u=r.length;++a<u;){var i=tH(r[a]);if(!(o=null!=t&&n(t,i)))break;t=t[i]}if(o)return o;var u=t?t.length:0;return!!u&&t2(u)&&tV(i,u)&&(tZ(t)||tY(t))}(u,i,tP)):tT(n,c,void 0,3)}):1==(o=function(t){for(var r=t4(t),n=r.length;n--;){var e=r[n],o=t[e];r[n]=[e,o,function(t){return t==t&&!t3(t)}(o)]}return r}(e=t)).length&&o[0][2]?tN(o[0][0],o[0][1]):function(t){return t===e||function(t,r,n,e){var o=n.length,a=o;if(null==t)return!a;for(t=Object(t);o--;){var u=n[o];if((0,u[2])?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var i=(u=n[o])[0],c=t[i],f=u[1];if(0,u[2]){if(void 0===c&&!(i in t))return!1}else{var l,s=new tE;if(!(void 0===l?tT(f,c,void 0,3,s):l))return!1}}return!0}(t,0,o)}:function(t){var r;return tG(t)?(r=tH(t),function(t){return null==t?void 0:t[r]}):function(r){return tM(r,t)}}(t)}function tz(t,r,n,e,o,a){var u=2&o,i=t.length,c=r.length;if(i!=c&&!(u&&c>i))return!1;var f=a.get(t);if(f&&a.get(r))return f==r;var l=-1,s=!0,h=1&o?new t$:void 0;for(a.set(t,r),a.set(r,t);++l<i;){var v=t[l],p=r[l];if(e)var _=u?e(p,v,l,r,t,a):e(v,p,l,t,r,a);if(void 0!==_){if(_)continue;s=!1;break}if(h){if(!function(t,r){for(var n=-1,e=t?t.length:0;++n<e;)if(r(t[n],n,t))return!0;return!1}(r,function(t,r){if(!h.has(r)&&(v===t||n(v,t,e,o,a)))return h.add(r)})){s=!1;break}}else if(!(v===p||n(v,p,e,o,a))){s=!1;break}}return a.delete(t),a.delete(r),s}function tL(t,r){var n,e,o=t.__data__;return("string"==(e=typeof(n=r))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==n:null===n)?o["string"==typeof r?"string":"hash"]:o.map}function tB(t,r){var n,e=null==t?void 0:t[r];return!(!t3(e)||(n=e,Z&&Z in n))&&(t0(e)||q(e)?te:M).test(tJ(e))?e:void 0}var tD=function(t){return tn.call(t)};function tR(t){return tZ(t)||tY(t)||!!(tc&&t&&t[tc])}function tV(t,r){return!!(r=null==r?0x1fffffffffffff:r)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<r}function tW(t,r,n){if(!t3(n))return!1;var e=typeof r;return("number"==e?!!(t1(n)&&tV(r,n.length)):"string"==e&&r in n)&&tX(n[r],t)}function tG(t,r){if(tZ(t))return!1;var n=typeof t;return!!("number"==n||"symbol"==n||"boolean"==n||null==t||t6(t))||E.test(t)||!$.test(t)||null!=r&&t in Object(r)}function tN(t,r){return function(n){return null!=n&&n[t]===r&&(void 0!==r||t in Object(n))}}(ts&&tD(new ts(new ArrayBuffer(1)))!=S||th&&tD(new th)!=y||tv&&tD(tv.resolve())!=j||tp&&tD(new tp)!=m||t_&&tD(new t_)!=x)&&(tD=function(t){var r=tn.call(t),n=r==g?t.constructor:void 0,e=n?tJ(n):void 0;if(e)switch(e){case ty:return S;case tb:return y;case tg:return j;case tj:return m;case tw:return x}return r});var tq=tQ(function(t){t=null==(r=t)?"":function(t){if("string"==typeof t)return t;if(t6(t))return tO?tO.call(t):"";var r=t+"";return"0"==r&&1/t==-l?"-0":r}(r);var r,n=[];return F.test(t)&&n.push(""),t.replace(C,function(t,r,e,o){n.push(e?o.replace(I,"$1"):r||t)}),n});function tH(t){if("string"==typeof t||t6(t))return t;var r=t+"";return"0"==r&&1/t==-l?"-0":r}function tJ(t){if(null!=t){try{return tt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var tK=(i=function(t,r){if(null==t)return[];var n=r.length;return n>1&&tW(t,r[0],r[1])?r=[]:n>2&&tW(r[0],r[1],r[2])&&(r=[r[0]]),function(t,r,n){var e,o,a,u=-1;r=G(r.length?r:[t5],N(tU));var i=(e=function(t,n,e){return{criteria:G(r,function(r){return r(t)}),index:++u,value:t}},o=-1,a=t1(t)?Array(t.length):[],tC(t,function(t,r,n){a[++o]=e(t,r,n)}),a),c=i.length;for(i.sort(function(t,r){return function(t,r,n){for(var e=-1,o=t.criteria,a=r.criteria,u=o.length,i=n.length;++e<u;){var c=function(t,r){if(t!==r){var n=void 0!==t,e=null===t,o=t==t,a=t6(t),u=void 0!==r,i=null===r,c=r==r,f=t6(r);if(!i&&!f&&!a&&t>r||a&&u&&c&&!i&&!f||e&&u&&c||!n&&c||!o)return 1;if(!e&&!a&&!f&&t<r||f&&n&&o&&!e&&!a||i&&n&&o||!u&&o||!c)return -1}return 0}(o[e],a[e]);if(c){if(e>=i)return c;return c*("desc"==n[e]?-1:1)}}return t.index-r.index}(t,r,n)});c--;)i[c]=i[c].value;return i}(t,function t(r,n,e,o,a){var u=-1,i=r.length;for(e||(e=tR),a||(a=[]);++u<i;){var c=r[u];n>0&&e(c)?n>1?t(c,n-1,e,o,a):function(t,r){for(var n=-1,e=r.length,o=t.length;++n<e;)t[o+n]=r[n]}(a,c):o||(a[a.length]=c)}return a}(r,1),[])},c=tl(void 0===c?i.length-1:c,0),function(){for(var t=arguments,r=-1,n=tl(t.length-c,0),e=Array(n);++r<n;)e[r]=t[c+r];r=-1;for(var o=Array(c+1);++r<c;)o[r]=t[r];o[c]=e;switch(o.length){case 0:return i.call(this);case 1:return i.call(this,o[0]);case 2:return i.call(this,o[0],o[1]);case 3:return i.call(this,o[0],o[1],o[2])}return i.apply(this,o)});function tQ(t,r){if("function"!=typeof t||r&&"function"!=typeof r)throw TypeError("Expected a function");var n=function(){var e=arguments,o=r?r.apply(this,e):e[0],a=n.cache;if(a.has(o))return a.get(o);var u=t.apply(this,e);return n.cache=a.set(o,u),u};return n.cache=new(tQ.Cache||tS),n}function tX(t,r){return t===r||t!=t&&r!=r}function tY(t){var r;return t8(r=t)&&t1(r)&&tr.call(t,"callee")&&(!tu.call(t,"callee")||tn.call(t)==s)}tQ.Cache=tS;var tZ=Array.isArray;function t1(t){return null!=t&&t2(t.length)&&!t0(t)}function t0(t){var r=t3(t)?tn.call(t):"";return r==d||"[object GeneratorFunction]"==r}function t2(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=0x1fffffffffffff}function t3(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function t8(t){return!!t&&"object"==typeof t}function t6(t){return"symbol"==typeof t||t8(t)&&tn.call(t)==O}var t9=W?N(W):function(t){return t8(t)&&t2(t.length)&&!!T[tn.call(t)]};function t4(t){return t1(t)?function(t,r){var n=tZ(t)||tY(t)?function(t,r){for(var n=-1,e=Array(t);++n<t;)e[n]=r(n);return e}(t.length,String):[],e=n.length,o=!!e;for(var a in t)tr.call(t,a)&&!(o&&("length"==a||tV(a,e)))&&n.push(a);return n}(t):function(t){if(n=(r=t)&&r.constructor,r!==("function"==typeof n&&n.prototype||X))return tf(t);var r,n,e=[];for(var o in Object(t))tr.call(t,o)&&"constructor"!=o&&e.push(o);return e}(t)}function t5(t){return t}t.exports=tK}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={id:e,loaded:!1,exports:{}};return t[e](a,a.exports,n),a.loaded=!0,a.exports}n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var e=n("./lodash.sortby/index.js");module.exports=e})();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var t={};t.d=(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var e={};t.r(e),t.d(e,{LRUCache:()=>u});let i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=new Set,h="object"==typeof process&&process?process:{},r=(t,e,i,s)=>{"function"==typeof h.emitWarning?h.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)},o=globalThis.AbortController,a=globalThis.AbortSignal;if(void 0===o){a=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},o=class{constructor(){e()}signal=new a;abort(t){if(!this.signal.aborted){for(let e of(this.signal.reason=t,this.signal.aborted=!0,this.signal._onabort))e(t);this.signal.onabort?.(t)}}};let t=h.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,r("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}Symbol("type");let l=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),n=t=>l(t)?t<=256?Uint8Array:t<=65536?Uint16Array:t<=0x100000000?Uint32Array:t<=Number.MAX_SAFE_INTEGER?d:null:null;class d extends Array{constructor(t){super(t),this.fill(0)}}class c{heap;length;static #t=!1;static create(t){let e=n(t);if(!e)return[];c.#t=!0;let i=new c(t,e);return c.#t=!1,i}constructor(t,e){if(!c.#t)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class u{#e;#i;#s;#h;#r;#o;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#l;#n;#d;#c;#u;#f;#p;#g;#v;#m;#y;#S;#z;#L;#_;#x;static unsafeExposeInternals(t){return{starts:t.#S,ttls:t.#z,sizes:t.#y,keyMap:t.#n,keyList:t.#d,valList:t.#c,next:t.#u,prev:t.#f,get head(){return t.#p},get tail(){return t.#g},free:t.#v,isBackgroundFetch:e=>t.#k(e),backgroundFetch:(e,i,s,h)=>t.#F(e,i,s,h),moveToTail:e=>t.#T(e),indexes:e=>t.#b(e),rindexes:e=>t.#A(e),isStale:e=>t.#w(e)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#l}get size(){return this.#a}get fetchMethod(){return this.#r}get memoMethod(){return this.#o}get dispose(){return this.#s}get disposeAfter(){return this.#h}constructor(t){const{max:e=0,ttl:i,ttlResolution:h=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:d,allowStale:f,dispose:p,disposeAfter:g,noDisposeOnSet:v,noUpdateTTL:m,maxSize:y=0,maxEntrySize:S=0,sizeCalculation:z,fetchMethod:L,memoMethod:_,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:k,allowStaleOnFetchRejection:F,allowStaleOnFetchAbort:T,ignoreFetchAbort:b}=t;if(0!==e&&!l(e))throw TypeError("max option must be a nonnegative integer");const A=e?n(e):Array;if(!A)throw Error("invalid max value: "+e);if(this.#e=e,this.#i=y,this.maxEntrySize=S||this.#i,this.sizeCalculation=z,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==_&&"function"!=typeof _)throw TypeError("memoMethod must be a function if defined");if(this.#o=_,void 0!==L&&"function"!=typeof L)throw TypeError("fetchMethod must be a function if specified");if(this.#r=L,this.#_=!!L,this.#n=new Map,this.#d=Array(e).fill(void 0),this.#c=Array(e).fill(void 0),this.#u=new A(e),this.#f=new A(e),this.#p=0,this.#g=0,this.#v=c.create(e),this.#a=0,this.#l=0,"function"==typeof p&&(this.#s=p),"function"==typeof g?(this.#h=g,this.#m=[]):(this.#h=void 0,this.#m=void 0),this.#L=!!this.#s,this.#x=!!this.#h,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!b,0!==this.maxEntrySize){if(0!==this.#i&&!l(this.#i))throw TypeError("maxSize must be a positive integer if specified");if(!l(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#E()}if(this.allowStale=!!f,this.noDeleteOnStaleGet=!!k,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!d,this.ttlResolution=l(h)||0===h?h:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!l(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#M()}if(0===this.#e&&0===this.ttl&&0===this.#i)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#i){const t="LRU_CACHE_UNBOUNDED";s.has(t)||(s.add(t),r("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,u))}}getRemainingTTL(t){return this.#n.has(t)?1/0:0}#M(){let t=new d(this.#e),e=new d(this.#e);this.#z=t,this.#S=e,this.#O=(s,h,r=i.now())=>{if(e[s]=0!==h?r:0,t[s]=h,0!==h&&this.ttlAutopurge){let t=setTimeout(()=>{this.#w(s)&&this.#D(this.#d[s],"expire")},h+1);t.unref&&t.unref()}},this.#C=s=>{e[s]=0!==t[s]?i.now():0},this.#W=(i,r)=>{if(t[r]){let o=t[r],a=e[r];if(!o||!a)return;i.ttl=o,i.start=a,i.now=s||h();let l=i.now-a;i.remainingTTL=o-l}};let s=0,h=()=>{let t=i.now();if(this.ttlResolution>0){s=t;let e=setTimeout(()=>s=0,this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{let r=this.#n.get(i);if(void 0===r)return 0;let o=t[r],a=e[r];return o&&a?o-((s||h())-a):1/0},this.#w=i=>{let r=e[i],o=t[i];return!!o&&!!r&&(s||h())-r>o}}#C=()=>{};#W=()=>{};#O=()=>{};#w=()=>!1;#E(){let t=new d(this.#e);this.#l=0,this.#y=t,this.#R=e=>{this.#l-=t[e],t[e]=0},this.#I=(t,e,i,s)=>{if(this.#k(e))return 0;if(!l(i))if(s){if("function"!=typeof s)throw TypeError("sizeCalculation must be a function");if(!l(i=s(e,t)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#B=(e,i,s)=>{if(t[e]=i,this.#i){let i=this.#i-t[e];for(;this.#l>i;)this.#U(!0)}this.#l+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#l)}}#R=t=>{};#B=(t,e,i)=>{};#I=(t,e,i,s)=>{if(i||s)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#b({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#g;this.#j(e)&&((t||!this.#w(e))&&(yield e),e!==this.#p);)e=this.#f[e]}*#A({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#p;this.#j(e)&&((t||!this.#w(e))&&(yield e),e!==this.#g);)e=this.#u[e]}#j(t){return void 0!==t&&this.#n.get(this.#d[t])===t}*entries(){for(let t of this.#b())void 0===this.#c[t]||void 0===this.#d[t]||this.#k(this.#c[t])||(yield[this.#d[t],this.#c[t]])}*rentries(){for(let t of this.#A())void 0===this.#c[t]||void 0===this.#d[t]||this.#k(this.#c[t])||(yield[this.#d[t],this.#c[t]])}*keys(){for(let t of this.#b()){let e=this.#d[t];void 0===e||this.#k(this.#c[t])||(yield e)}}*rkeys(){for(let t of this.#A()){let e=this.#d[t];void 0===e||this.#k(this.#c[t])||(yield e)}}*values(){for(let t of this.#b())void 0===this.#c[t]||this.#k(this.#c[t])||(yield this.#c[t])}*rvalues(){for(let t of this.#A())void 0===this.#c[t]||this.#k(this.#c[t])||(yield this.#c[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#b()){let s=this.#c[i],h=this.#k(s)?s.__staleWhileFetching:s;if(void 0!==h&&t(h,this.#d[i],this))return this.get(this.#d[i],e)}}forEach(t,e=this){for(let i of this.#b()){let s=this.#c[i],h=this.#k(s)?s.__staleWhileFetching:s;void 0!==h&&t.call(e,h,this.#d[i],this)}}rforEach(t,e=this){for(let i of this.#A()){let s=this.#c[i],h=this.#k(s)?s.__staleWhileFetching:s;void 0!==h&&t.call(e,h,this.#d[i],this)}}purgeStale(){let t=!1;for(let e of this.#A({allowStale:!0}))this.#w(e)&&(this.#D(this.#d[e],"expire"),t=!0);return t}info(t){let e=this.#n.get(t);if(void 0===e)return;let s=this.#c[e],h=this.#k(s)?s.__staleWhileFetching:s;if(void 0===h)return;let r={value:h};if(this.#z&&this.#S){let t=this.#z[e],s=this.#S[e];t&&s&&(r.ttl=t-(i.now()-s),r.start=Date.now())}return this.#y&&(r.size=this.#y[e]),r}dump(){let t=[];for(let e of this.#b({allowStale:!0})){let s=this.#d[e],h=this.#c[e],r=this.#k(h)?h.__staleWhileFetching:h;if(void 0===r||void 0===s)continue;let o={value:r};if(this.#z&&this.#S){o.ttl=this.#z[e];let t=i.now()-this.#S[e];o.start=Math.floor(Date.now()-t)}this.#y&&(o.size=this.#y[e]),t.unshift([s,o])}return t}load(t){for(let[e,s]of(this.clear(),t)){if(s.start){let t=Date.now()-s.start;s.start=i.now()-t}this.set(e,s.value,s)}}set(t,e,i={}){if(void 0===e)return this.delete(t),this;let{ttl:s=this.ttl,start:h,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:a}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,n=this.#I(t,e,i.size||0,o);if(this.maxEntrySize&&n>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#D(t,"set"),this;let d=0===this.#a?void 0:this.#n.get(t);if(void 0===d)d=0===this.#a?this.#g:0!==this.#v.length?this.#v.pop():this.#a===this.#e?this.#U(!1):this.#a,this.#d[d]=t,this.#c[d]=e,this.#n.set(t,d),this.#u[this.#g]=d,this.#f[d]=this.#g,this.#g=d,this.#a++,this.#B(d,n,a),a&&(a.set="add"),l=!1;else{this.#T(d);let i=this.#c[d];if(e!==i){if(this.#_&&this.#k(i)){i.__abortController.abort(Error("replaced"));let{__staleWhileFetching:e}=i;void 0!==e&&!r&&(this.#L&&this.#s?.(e,t,"set"),this.#x&&this.#m?.push([e,t,"set"]))}else!r&&(this.#L&&this.#s?.(i,t,"set"),this.#x&&this.#m?.push([i,t,"set"]));if(this.#R(d),this.#B(d,n,a),this.#c[d]=e,a){a.set="replace";let t=i&&this.#k(i)?i.__staleWhileFetching:i;void 0!==t&&(a.oldValue=t)}}else a&&(a.set="update")}if(0===s||this.#z||this.#M(),this.#z&&(l||this.#O(d,s,h),a&&this.#W(a,d)),!r&&this.#x&&this.#m){let t,e=this.#m;for(;t=e?.shift();)this.#h?.(...t)}return this}pop(){try{for(;this.#a;){let t=this.#c[this.#p];if(this.#U(!0),this.#k(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#x&&this.#m){let t,e=this.#m;for(;t=e?.shift();)this.#h?.(...t)}}}#U(t){let e=this.#p,i=this.#d[e],s=this.#c[e];return this.#_&&this.#k(s)?s.__abortController.abort(Error("evicted")):(this.#L||this.#x)&&(this.#L&&this.#s?.(s,i,"evict"),this.#x&&this.#m?.push([s,i,"evict"])),this.#R(e),t&&(this.#d[e]=void 0,this.#c[e]=void 0,this.#v.push(e)),1===this.#a?(this.#p=this.#g=0,this.#v.length=0):this.#p=this.#u[e],this.#n.delete(i),this.#a--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,h=this.#n.get(t);if(void 0!==h){let t=this.#c[h];if(this.#k(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#w(h))return i&&this.#C(h),s&&(s.has="hit",this.#W(s,h)),!0;s&&(s.has="stale",this.#W(s,h))}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#n.get(t);if(void 0===s||!i&&this.#w(s))return;let h=this.#c[s];return this.#k(h)?h.__staleWhileFetching:h}#F(t,e,i,s){let h=void 0===e?void 0:this.#c[e];if(this.#k(h))return h;let r=new o,{signal:a}=i;a?.addEventListener("abort",()=>r.abort(a.reason),{signal:r.signal});let l={signal:r.signal,options:i,context:s},n=(s,h=!1)=>{let{aborted:o}=r.signal,a=i.ignoreFetchAbort&&void 0!==s;return(i.status&&(o&&!h?(i.status.fetchAborted=!0,i.status.fetchError=r.signal.reason,a&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),!o||a||h)?(this.#c[e]===u&&(void 0===s?u.__staleWhileFetching?this.#c[e]=u.__staleWhileFetching:this.#D(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,s,l.options))),s):d(r.signal.reason)},d=s=>{let{aborted:h}=r.signal,o=h&&i.allowStaleOnFetchAbort,a=o||i.allowStaleOnFetchRejection,l=a||i.noDeleteOnFetchRejection;if(this.#c[e]===u&&(l&&void 0!==u.__staleWhileFetching?o||(this.#c[e]=u.__staleWhileFetching):this.#D(t,"fetch")),a)return i.status&&void 0!==u.__staleWhileFetching&&(i.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw s},c=(e,s)=>{let o=this.#r?.(t,h,l);o&&o instanceof Promise&&o.then(t=>e(void 0===t?void 0:t),s),r.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(e(void 0),i.allowStaleOnFetchAbort&&(e=t=>n(t,!0)))})};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(c).then(n,t=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=t),d(t))),f=Object.assign(u,{__abortController:r,__staleWhileFetching:h,__returned:void 0});return void 0===e?(this.set(t,f,{...l.options,status:void 0}),e=this.#n.get(t)):this.#c[e]=f,f}#k(t){return!!this.#_&&!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof o}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:h=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:n=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:u=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=!1,status:v,signal:m}=e;if(!this.#_)return v&&(v.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:h,status:v});let y={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:h,ttl:r,noDisposeOnSet:o,size:a,sizeCalculation:l,noUpdateTTL:n,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:f,ignoreFetchAbort:u,status:v,signal:m},S=this.#n.get(t);if(void 0===S){v&&(v.fetch="miss");let e=this.#F(t,S,y,p);return e.__returned=e}{let e=this.#c[S];if(this.#k(e)){let t=i&&void 0!==e.__staleWhileFetching;return v&&(v.fetch="inflight",t&&(v.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}let h=this.#w(S);if(!g&&!h)return v&&(v.fetch="hit"),this.#T(S),s&&this.#C(S),v&&this.#W(v,S),e;let r=this.#F(t,S,y,p),o=void 0!==r.__staleWhileFetching&&i;return v&&(v.fetch=h?"stale":"refresh",o&&h&&(v.returnedStale=!0)),o?r.__staleWhileFetching:r.__returned=r}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(void 0===i)throw Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#o;if(!i)throw Error("no memoMethod provided to constructor");let{context:s,forceRefresh:h,...r}=e,o=this.get(t,r);if(!h&&void 0!==o)return o;let a=i(t,o,{options:r,context:s});return this.set(t,a,r),a}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:h=this.noDeleteOnStaleGet,status:r}=e,o=this.#n.get(t);if(void 0!==o){let e=this.#c[o],a=this.#k(e);return(r&&this.#W(r,o),this.#w(o))?(r&&(r.get="stale"),a)?(r&&i&&void 0!==e.__staleWhileFetching&&(r.returnedStale=!0),i?e.__staleWhileFetching:void 0):(h||this.#D(t,"expire"),r&&i&&(r.returnedStale=!0),i?e:void 0):(r&&(r.get="hit"),a)?e.__staleWhileFetching:(this.#T(o),s&&this.#C(o),e)}r&&(r.get="miss")}#G(t,e){this.#f[e]=t,this.#u[t]=e}#T(t){t!==this.#g&&(t===this.#p?this.#p=this.#u[t]:this.#G(this.#f[t],this.#u[t]),this.#G(this.#g,t),this.#g=t)}delete(t){return this.#D(t,"delete")}#D(t,e){let i=!1;if(0!==this.#a){let s=this.#n.get(t);if(void 0!==s)if(i=!0,1===this.#a)this.#N(e);else{this.#R(s);let i=this.#c[s];if(this.#k(i)?i.__abortController.abort(Error("deleted")):(this.#L||this.#x)&&(this.#L&&this.#s?.(i,t,e),this.#x&&this.#m?.push([i,t,e])),this.#n.delete(t),this.#d[s]=void 0,this.#c[s]=void 0,s===this.#g)this.#g=this.#f[s];else if(s===this.#p)this.#p=this.#u[s];else{let t=this.#f[s];this.#u[t]=this.#u[s];let e=this.#u[s];this.#f[e]=this.#f[s]}this.#a--,this.#v.push(s)}}if(this.#x&&this.#m?.length){let t,e=this.#m;for(;t=e?.shift();)this.#h?.(...t)}return i}clear(){return this.#N("delete")}#N(t){for(let e of this.#A({allowStale:!0})){let i=this.#c[e];if(this.#k(i))i.__abortController.abort(Error("deleted"));else{let s=this.#d[e];this.#L&&this.#s?.(i,s,t),this.#x&&this.#m?.push([i,s,t])}}if(this.#n.clear(),this.#c.fill(void 0),this.#d.fill(void 0),this.#z&&this.#S&&(this.#z.fill(0),this.#S.fill(0)),this.#y&&this.#y.fill(0),this.#p=0,this.#g=0,this.#v.length=0,this.#l=0,this.#a=0,this.#x&&this.#m){let t,e=this.#m;for(;t=e?.shift();)this.#h?.(...t)}}}module.exports=e})();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 and later, KFlash and others.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|