@directus/api 35.0.2 → 35.2.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/dist/_virtual/rolldown_runtime.js +1 -24
- package/dist/ai/chat/controllers/chat.post.js +9 -22
- package/dist/ai/chat/controllers/object.post.js +58 -0
- package/dist/ai/chat/lib/create-ui-stream.js +10 -18
- package/dist/ai/chat/lib/transform-file-parts.js +1 -3
- package/dist/ai/chat/middleware/load-settings.js +1 -2
- package/dist/ai/chat/models/chat-request.js +2 -9
- package/dist/ai/chat/models/object-request.js +19 -0
- package/dist/ai/chat/router.js +3 -2
- package/dist/ai/chat/utils/add-additional-properties-to-json-schema.js +37 -0
- package/dist/ai/chat/utils/chat-request-tool-to-ai-sdk-tool.js +3 -8
- package/dist/ai/chat/utils/fix-error-tool-calls.js +4 -6
- package/dist/ai/chat/utils/format-context.js +17 -27
- package/dist/ai/chat/utils/parse-json-schema-7.js +3 -6
- package/dist/ai/chat/utils/zod-jsonschema7-parser.js +16 -0
- package/dist/ai/devtools/index.js +1 -2
- package/dist/ai/files/adapters/anthropic.js +1 -3
- package/dist/ai/files/adapters/google.js +5 -12
- package/dist/ai/files/adapters/openai.js +1 -3
- package/dist/ai/files/controllers/upload.js +8 -24
- package/dist/ai/files/lib/fetch-provider.js +1 -3
- package/dist/ai/files/lib/upload-to-provider.js +6 -16
- package/dist/ai/mcp/server.js +58 -102
- package/dist/ai/mcp/transport.js +2 -6
- package/dist/ai/providers/anthropic-file-support.js +28 -41
- package/dist/ai/providers/anthropic-tool-search.js +10 -14
- package/dist/ai/providers/index.js +0 -1
- package/dist/ai/providers/options.js +2 -7
- package/dist/ai/providers/registry.js +38 -48
- package/dist/ai/telemetry/braintrust.js +3 -9
- package/dist/ai/telemetry/index.js +14 -13
- package/dist/ai/telemetry/langfuse.js +8 -22
- package/dist/ai/tools/assets/index.js +15 -23
- package/dist/ai/tools/collections/index.js +9 -19
- package/dist/ai/tools/fields/index.js +13 -27
- package/dist/ai/tools/files/index.js +11 -24
- package/dist/ai/tools/flows/index.js +8 -16
- package/dist/ai/tools/folders/index.js +11 -23
- package/dist/ai/tools/items/index.js +19 -44
- package/dist/ai/tools/operations/index.js +7 -13
- package/dist/ai/tools/relations/index.js +5 -11
- package/dist/ai/tools/schema/index.js +39 -91
- package/dist/ai/tools/trigger-flow/index.js +9 -16
- package/dist/ai/tools/utils.js +4 -8
- package/dist/app.js +19 -51
- package/dist/auth/auth.js +3 -9
- package/dist/auth/drivers/ldap.js +39 -82
- package/dist/auth/drivers/local.js +4 -12
- package/dist/auth/drivers/oauth2.js +32 -63
- package/dist/auth/drivers/openid.js +49 -89
- package/dist/auth/drivers/saml.js +16 -31
- package/dist/auth/utils/generate-callback-url.js +2 -7
- package/dist/auth/utils/resolve-login-redirect.js +11 -21
- package/dist/auth.js +2 -5
- package/dist/bus/lib/use-bus.js +3 -7
- package/dist/cache.js +11 -24
- package/dist/cli/commands/bootstrap/index.js +10 -19
- package/dist/cli/commands/cache/clear.js +1 -3
- package/dist/cli/commands/database/migrate.js +2 -5
- package/dist/cli/commands/init/index.js +3 -5
- package/dist/cli/commands/init/questions.js +2 -3
- package/dist/cli/commands/schema/apply.js +39 -81
- package/dist/cli/commands/schema/snapshot.js +3 -8
- package/dist/cli/commands/users/create.js +3 -5
- package/dist/cli/commands/users/passwd.js +2 -5
- package/dist/cli/index.js +1 -2
- package/dist/cli/load-extensions.js +3 -6
- package/dist/cli/utils/create-db-connection.js +7 -12
- package/dist/cli/utils/create-env/index.js +2 -6
- package/dist/cli/utils/drivers.js +1 -3
- package/dist/controllers/access.js +15 -30
- package/dist/controllers/activity.js +5 -10
- package/dist/controllers/assets.js +67 -62
- package/dist/controllers/auth.js +19 -52
- package/dist/controllers/collections.js +8 -17
- package/dist/controllers/comments.js +15 -30
- package/dist/controllers/dashboards.js +13 -25
- package/dist/controllers/deployment-webhooks.js +6 -12
- package/dist/controllers/deployment.js +39 -90
- package/dist/controllers/extensions.js +53 -98
- package/dist/controllers/fields.js +17 -38
- package/dist/controllers/files.js +31 -68
- package/dist/controllers/flows.js +15 -30
- package/dist/controllers/folders.js +16 -32
- package/dist/controllers/graphql.js +2 -6
- package/dist/controllers/items.js +18 -38
- package/dist/controllers/mcp.js +4 -8
- package/dist/controllers/metrics.js +4 -12
- package/dist/controllers/not-found.js +2 -5
- package/dist/controllers/notifications.js +16 -32
- package/dist/controllers/operations.js +13 -25
- package/dist/controllers/panels.js +13 -25
- package/dist/controllers/permissions.js +18 -35
- package/dist/controllers/policies.js +15 -30
- package/dist/controllers/presets.js +16 -32
- package/dist/controllers/relations.js +12 -24
- package/dist/controllers/revisions.js +2 -3
- package/dist/controllers/roles.js +13 -25
- package/dist/controllers/schema.js +21 -32
- package/dist/controllers/server.js +32 -44
- package/dist/controllers/settings.js +5 -9
- package/dist/controllers/shares.js +20 -40
- package/dist/controllers/translations.js +16 -32
- package/dist/controllers/tus.js +4 -11
- package/dist/controllers/users.js +46 -100
- package/dist/controllers/utils/handle-registry-error.js +26 -0
- package/dist/controllers/utils.js +20 -41
- package/dist/controllers/versions.js +20 -41
- package/dist/database/errors/dialects/mssql.js +8 -21
- package/dist/database/errors/dialects/mysql.js +7 -14
- package/dist/database/errors/dialects/oracle.js +3 -6
- package/dist/database/errors/dialects/postgres.js +8 -18
- package/dist/database/errors/dialects/sqlite.js +16 -21
- package/dist/database/errors/translate.js +1 -2
- package/dist/database/get-ast-from-query/get-ast-from-query.js +4 -12
- package/dist/database/get-ast-from-query/lib/convert-wildcards.js +15 -29
- package/dist/database/get-ast-from-query/lib/parse-fields.js +17 -41
- package/dist/database/get-ast-from-query/utils/get-allowed-sort.js +5 -14
- package/dist/database/get-ast-from-query/utils/get-related-collection.js +2 -6
- package/dist/database/helpers/date/dialects/mysql.js +1 -1
- package/dist/database/helpers/date/dialects/oracle.js +3 -9
- package/dist/database/helpers/date/dialects/sqlite.js +3 -9
- package/dist/database/helpers/date/types.js +1 -3
- package/dist/database/helpers/fn/dialects/mssql.js +4 -12
- package/dist/database/helpers/fn/dialects/mysql.js +5 -14
- package/dist/database/helpers/fn/dialects/oracle.js +4 -12
- package/dist/database/helpers/fn/dialects/postgres.js +5 -14
- package/dist/database/helpers/fn/dialects/sqlite.js +4 -12
- package/dist/database/helpers/fn/json/parse-function.js +9 -27
- package/dist/database/helpers/fn/types.js +1 -3
- package/dist/database/helpers/geometry/dialects/mssql.js +1 -3
- package/dist/database/helpers/geometry/dialects/oracle.js +1 -3
- package/dist/database/helpers/geometry/dialects/postgres.js +1 -2
- package/dist/database/helpers/geometry/dialects/redshift.js +1 -3
- package/dist/database/helpers/geometry/dialects/sqlite.js +1 -2
- package/dist/database/helpers/index.js +1 -2
- package/dist/database/helpers/number/dialects/postgres.js +1 -3
- package/dist/database/helpers/number/utils/decimal-limit.js +2 -4
- package/dist/database/helpers/number/utils/maybe-stringify-big-int.js +1 -3
- package/dist/database/helpers/schema/dialects/cockroachdb.js +8 -15
- package/dist/database/helpers/schema/dialects/mssql.js +8 -15
- package/dist/database/helpers/schema/dialects/mysql.js +8 -14
- package/dist/database/helpers/schema/dialects/oracle.js +13 -28
- package/dist/database/helpers/schema/dialects/postgres.js +6 -10
- package/dist/database/helpers/schema/dialects/sqlite.js +1 -3
- package/dist/database/helpers/schema/types.js +12 -35
- package/dist/database/helpers/schema/utils/prep-query-params.js +4 -7
- package/dist/database/helpers/sequence/types.js +1 -3
- package/dist/database/index.js +41 -79
- package/dist/database/migrations/20201029A-remove-system-relations.js +1 -5
- package/dist/database/migrations/20201029B-remove-system-collections.js +1 -5
- package/dist/database/migrations/20201029C-remove-system-fields.js +1 -5
- package/dist/database/migrations/20201105A-add-cascade-system-relations.js +9 -15
- package/dist/database/migrations/20210225A-add-relations-sort-field.js +4 -6
- package/dist/database/migrations/20210415A-make-filesize-nullable.js +2 -4
- package/dist/database/migrations/20210506A-rename-interfaces.js +13 -20
- package/dist/database/migrations/20210518A-add-foreign-key-constraints.js +7 -18
- package/dist/database/migrations/20210519A-add-system-fk-triggers.js +58 -67
- package/dist/database/migrations/20210626A-change-filesize-bigint.js +2 -8
- package/dist/database/migrations/20210802A-replace-groups.js +7 -9
- package/dist/database/migrations/20210805A-update-groups.js +4 -14
- package/dist/database/migrations/20210805B-change-image-metadata-structure.js +2 -6
- package/dist/database/migrations/20210920A-webhooks-url-not-null.js +2 -6
- package/dist/database/migrations/20210927A-replace-fields-group.js +5 -11
- package/dist/database/migrations/20211007A-update-presets.js +4 -12
- package/dist/database/migrations/20220303A-remove-default-project-color.js +2 -4
- package/dist/database/migrations/20220322A-rename-field-typecast-flags.js +2 -6
- package/dist/database/migrations/20220325A-fix-typecast-flags.js +3 -8
- package/dist/database/migrations/20220402A-remove-default-value-panel-icon.js +2 -4
- package/dist/database/migrations/20220429A-add-flows.js +2 -4
- package/dist/database/migrations/20220801A-update-notifications-timestamp-column.js +2 -4
- package/dist/database/migrations/20230401A-update-material-icons.js +2 -4
- package/dist/database/migrations/20230526A-migrate-translation-strings.js +9 -16
- package/dist/database/migrations/20230721A-require-shares-fields.js +9 -20
- package/dist/database/migrations/20231009A-update-csv-fields-to-text.js +15 -22
- package/dist/database/migrations/20231009B-update-panel-options.js +4 -12
- package/dist/database/migrations/20240204A-marketplace.js +20 -26
- package/dist/database/migrations/20240311A-deprecate-webhooks.js +1 -1
- package/dist/database/migrations/20240716A-update-files-date-fields.js +8 -14
- package/dist/database/migrations/20240806A-permissions-policies.js +17 -39
- package/dist/database/migrations/20240909A-separate-comments.js +14 -17
- package/dist/database/migrations/20240924A-migrate-legacy-comments.js +6 -11
- package/dist/database/migrations/20240924B-populate-versioning-deltas.js +1 -3
- package/dist/database/migrations/20250224A-visual-editor.js +1 -2
- package/dist/database/migrations/20250609A-license-banner.js +1 -2
- package/dist/database/migrations/20250613A-add-project-id.js +2 -5
- package/dist/database/migrations/20251014A-add-project-owner.js +7 -10
- package/dist/database/migrations/20251028A-add-retention-indexes.js +7 -15
- package/dist/database/migrations/20260113A-add-revisions-index.js +7 -15
- package/dist/database/migrations/run.js +23 -50
- package/dist/database/run-ast/lib/apply-query/add-join.js +8 -20
- package/dist/database/run-ast/lib/apply-query/aggregate.js +1 -3
- package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.js +3 -9
- package/dist/database/run-ast/lib/apply-query/filter/index.js +9 -27
- package/dist/database/run-ast/lib/apply-query/filter/operator.js +42 -107
- package/dist/database/run-ast/lib/apply-query/filter/validate-operator.js +3 -9
- package/dist/database/run-ast/lib/apply-query/get-filter-path.js +2 -6
- package/dist/database/run-ast/lib/apply-query/get-operation.js +9 -14
- package/dist/database/run-ast/lib/apply-query/index.js +20 -39
- package/dist/database/run-ast/lib/apply-query/join-filter-with-cases.js +3 -7
- package/dist/database/run-ast/lib/apply-query/pagination.js +2 -6
- package/dist/database/run-ast/lib/apply-query/search.js +17 -41
- package/dist/database/run-ast/lib/apply-query/sort.js +16 -30
- package/dist/database/run-ast/lib/get-db-query.js +7 -15
- package/dist/database/run-ast/lib/parse-current-level.js +10 -23
- package/dist/database/run-ast/modules/fetch-permitted-ast-root-fields.js +10 -14
- package/dist/database/run-ast/run-ast.js +30 -52
- package/dist/database/run-ast/utils/apply-case-when.js +1 -3
- package/dist/database/run-ast/utils/apply-function-to-column-name.js +2 -6
- package/dist/database/run-ast/utils/apply-parent-filters.js +14 -19
- package/dist/database/run-ast/utils/generate-alias.js +9 -14
- package/dist/database/run-ast/utils/get-column-pre-processor.js +14 -26
- package/dist/database/run-ast/utils/get-column.js +5 -14
- package/dist/database/run-ast/utils/get-inner-query-column-pre-processor.js +1 -3
- package/dist/database/run-ast/utils/merge-with-parent-items.js +31 -63
- package/dist/database/run-ast/utils/remove-temporary-fields.js +15 -29
- package/dist/database/run-ast/utils/with-preprocess-bindings.js +2 -6
- package/dist/database/seeds/run.js +19 -45
- package/dist/deployment/deployment.js +2 -8
- package/dist/deployment/drivers/netlify.js +43 -88
- package/dist/deployment/drivers/vercel.js +34 -72
- package/dist/deployment.js +8 -14
- package/dist/emitter.js +14 -21
- package/dist/extensions/index.js +1 -3
- package/dist/extensions/lib/get-extensions-path.js +1 -3
- package/dist/extensions/lib/get-extensions-settings.js +26 -42
- package/dist/extensions/lib/get-extensions.js +3 -7
- package/dist/extensions/lib/get-shared-deps-mapping.js +3 -7
- package/dist/extensions/lib/installation/index.js +1 -3
- package/dist/extensions/lib/installation/manager.js +12 -26
- package/dist/extensions/lib/sandbox/generate-host-function-reference.js +2 -5
- package/dist/extensions/lib/sandbox/register/call-reference.js +1 -1
- package/dist/extensions/lib/sandbox/register/filter.js +1 -2
- package/dist/extensions/lib/sandbox/register/operation.js +1 -2
- package/dist/extensions/lib/sandbox/register/route.js +2 -4
- package/dist/extensions/lib/sandbox/sdk/generators/log.js +1 -1
- package/dist/extensions/lib/sandbox/sdk/generators/request.js +13 -28
- package/dist/extensions/lib/sandbox/sdk/generators/sleep.js +2 -3
- package/dist/extensions/lib/sandbox/sdk/utils/wrap.js +4 -9
- package/dist/extensions/lib/sync/status.js +4 -11
- package/dist/extensions/lib/sync/sync.js +8 -14
- package/dist/extensions/lib/sync/tracker.js +7 -10
- package/dist/extensions/lib/sync/utils.js +5 -9
- package/dist/extensions/manager.js +62 -110
- package/dist/flows.js +237 -277
- package/dist/lock/lib/use-lock.js +3 -7
- package/dist/logger/index.js +37 -57
- package/dist/logger/redact-query.js +1 -3
- package/dist/mailer.js +12 -18
- package/dist/metrics/lib/create-metrics.js +69 -117
- package/dist/metrics/lib/use-metrics.js +3 -8
- package/dist/middleware/authenticate.js +1 -3
- package/dist/middleware/cache.js +5 -8
- package/dist/middleware/collection-exists.js +3 -8
- package/dist/middleware/cors.js +8 -10
- package/dist/middleware/error-handler.js +10 -21
- package/dist/middleware/extract-token.js +3 -9
- package/dist/middleware/graphql.js +16 -27
- package/dist/middleware/rate-limiter-global.js +1 -3
- package/dist/middleware/rate-limiter-ip.js +9 -11
- package/dist/middleware/rate-limiter-registration.js +9 -11
- package/dist/middleware/request-counter.js +8 -15
- package/dist/middleware/respond.js +8 -16
- package/dist/middleware/validate-batch.js +5 -15
- package/dist/operations/condition/index.js +4 -10
- package/dist/operations/exec/index.js +1 -2
- package/dist/operations/item-create/index.js +18 -26
- package/dist/operations/item-delete/index.js +21 -31
- package/dist/operations/item-read/index.js +21 -31
- package/dist/operations/item-update/index.js +23 -36
- package/dist/operations/log/index.js +1 -2
- package/dist/operations/mail/index.js +5 -8
- package/dist/operations/mail/rate-limiter.js +6 -10
- package/dist/operations/notification/index.js +13 -19
- package/dist/operations/request/index.js +8 -13
- package/dist/operations/throw-error/index.js +1 -2
- package/dist/operations/trigger/index.js +4 -8
- package/dist/packages/types/dist/index.js +219 -231
- package/dist/permissions/cache.js +2 -3
- package/dist/permissions/lib/fetch-permissions.js +1 -3
- package/dist/permissions/lib/fetch-policies.js +5 -10
- package/dist/permissions/modules/fetch-accountability-collection-access/fetch-accountability-collection-access.js +19 -32
- package/dist/permissions/modules/fetch-allowed-collections/fetch-allowed-collections.js +7 -12
- package/dist/permissions/modules/fetch-allowed-field-map/fetch-allowed-field-map.js +8 -17
- package/dist/permissions/modules/fetch-global-access/fetch-global-access.js +1 -1
- package/dist/permissions/modules/fetch-inconsistent-field-map/fetch-inconsistent-field-map.js +6 -10
- package/dist/permissions/modules/fetch-policies-ip-access/fetch-policies-ip-access.js +9 -15
- package/dist/permissions/modules/process-ast/lib/extract-fields-from-children.js +2 -8
- package/dist/permissions/modules/process-ast/lib/extract-fields-from-query.js +32 -34
- package/dist/permissions/modules/process-ast/lib/field-map-from-ast.js +2 -2
- package/dist/permissions/modules/process-ast/lib/get-cases.js +3 -8
- package/dist/permissions/modules/process-ast/lib/inject-cases.js +6 -19
- package/dist/permissions/modules/process-ast/process-ast.js +4 -12
- package/dist/permissions/modules/process-ast/utils/collections-in-field-map.js +2 -4
- package/dist/permissions/modules/process-ast/utils/dedupe-access.js +6 -10
- package/dist/permissions/modules/process-ast/utils/extract-paths-from-query.js +9 -25
- package/dist/permissions/modules/process-ast/utils/find-related-collection.js +1 -3
- package/dist/permissions/modules/process-ast/utils/flatten-filter.js +7 -10
- package/dist/permissions/modules/process-ast/utils/get-info-for-path.js +4 -6
- package/dist/permissions/modules/process-ast/utils/validate-path/create-error.js +1 -2
- package/dist/permissions/modules/process-ast/utils/validate-path/validate-path-existence.js +3 -8
- package/dist/permissions/modules/process-ast/utils/validate-path/validate-path-permissions.js +5 -13
- package/dist/permissions/modules/process-payload/lib/is-field-nullable.js +1 -2
- package/dist/permissions/modules/process-payload/process-payload.js +6 -15
- package/dist/permissions/modules/validate-access/lib/validate-collection-access.js +2 -3
- package/dist/permissions/modules/validate-access/lib/validate-item-access.js +14 -28
- package/dist/permissions/modules/validate-access/validate-access.js +5 -15
- package/dist/permissions/modules/validate-remaining-admin/validate-remaining-admin-count.js +1 -3
- package/dist/permissions/utils/extract-required-dynamic-variable-context.js +10 -15
- package/dist/permissions/utils/fetch-dynamic-variable-data.js +17 -35
- package/dist/permissions/utils/fetch-raw-permissions.js +3 -9
- package/dist/permissions/utils/fetch-share-info.js +1 -2
- package/dist/permissions/utils/filter-policies-by-ip.js +2 -6
- package/dist/permissions/utils/get-permissions-for-share.js +22 -47
- package/dist/permissions/utils/get-unaliased-field-key.js +2 -5
- package/dist/permissions/utils/merge-permissions.js +13 -36
- package/dist/permissions/utils/with-cache.js +1 -3
- package/dist/rate-limiter.js +2 -7
- package/dist/redis/lib/create-redis.js +1 -2
- package/dist/redis/lib/use-redis.js +1 -1
- package/dist/redis/utils/redis-config-available.js +1 -3
- package/dist/request/agent-with-ip-validation.js +3 -7
- package/dist/request/is-denied-ip.js +1 -3
- package/dist/schedules/metrics.js +4 -11
- package/dist/schedules/retention.js +17 -33
- package/dist/schedules/telemetry.js +1 -2
- package/dist/schedules/tus.js +5 -7
- package/dist/server.js +12 -24
- package/dist/services/access.js +1 -3
- package/dist/services/assets/name-deduper.js +2 -6
- package/dist/services/assets.js +43 -79
- package/dist/services/authentication.js +63 -96
- package/dist/services/collections.js +108 -218
- package/dist/services/comments.js +18 -32
- package/dist/services/deployment-projects.js +17 -31
- package/dist/services/deployment.js +63 -106
- package/dist/services/extensions.js +25 -63
- package/dist/services/fields/build-collection-and-field-relations.js +8 -14
- package/dist/services/fields/get-collection-meta-updates.js +4 -12
- package/dist/services/fields/get-collection-relation-list.js +2 -4
- package/dist/services/fields.js +162 -314
- package/dist/services/files/lib/extract-metadata.js +7 -20
- package/dist/services/files/utils/get-metadata.js +31 -64
- package/dist/services/files/utils/parse-image-metadata.js +7 -19
- package/dist/services/files.js +102 -173
- package/dist/services/flows.js +3 -6
- package/dist/services/folders.js +13 -17
- package/dist/services/graphql/errors/format.js +2 -2
- package/dist/services/graphql/index.js +4 -13
- package/dist/services/graphql/resolvers/get-collection-type.js +1 -3
- package/dist/services/graphql/resolvers/get-field-type.js +1 -3
- package/dist/services/graphql/resolvers/get-relation-type.js +1 -3
- package/dist/services/graphql/resolvers/mutation.js +6 -14
- package/dist/services/graphql/resolvers/query.js +3 -10
- package/dist/services/graphql/resolvers/system-admin.js +13 -27
- package/dist/services/graphql/resolvers/system-global.js +31 -71
- package/dist/services/graphql/resolvers/system.js +209 -245
- package/dist/services/graphql/schema/get-types.js +69 -101
- package/dist/services/graphql/schema/index.js +74 -92
- package/dist/services/graphql/schema/parse-args.js +1 -2
- package/dist/services/graphql/schema/parse-query.js +8 -21
- package/dist/services/graphql/schema/read.js +83 -106
- package/dist/services/graphql/schema/write.js +36 -41
- package/dist/services/graphql/subscription.js +30 -51
- package/dist/services/graphql/types/bigint.js +5 -15
- package/dist/services/graphql/types/string-or-float.js +2 -6
- package/dist/services/graphql/utils/add-path-to-validation-error.js +1 -3
- package/dist/services/graphql/utils/aggregate-query.js +2 -6
- package/dist/services/graphql/utils/dedupe-resolvers.js +8 -13
- package/dist/services/graphql/utils/filter-replace-m2a.js +9 -18
- package/dist/services/graphql/utils/process-error.js +21 -31
- package/dist/services/graphql/utils/replace-fragments.js +2 -5
- package/dist/services/graphql/utils/replace-funcs.js +2 -5
- package/dist/services/graphql/utils/sanitize-gql-schema.js +10 -21
- package/dist/services/import-export.js +68 -143
- package/dist/services/items.js +126 -271
- package/dist/services/mail/index.js +13 -26
- package/dist/services/mail/rate-limiter.js +6 -10
- package/dist/services/meta.js +4 -9
- package/dist/services/notifications.js +2 -3
- package/dist/services/operations.js +3 -6
- package/dist/services/payload.js +188 -316
- package/dist/services/permissions.js +14 -26
- package/dist/services/policies.js +7 -18
- package/dist/services/relations.js +82 -181
- package/dist/services/revisions.js +8 -15
- package/dist/services/roles.js +4 -12
- package/dist/services/schema.js +5 -10
- package/dist/services/server.js +31 -66
- package/dist/services/shares.js +25 -35
- package/dist/services/specifications.js +87 -139
- package/dist/services/tfa.js +8 -24
- package/dist/services/translations.js +6 -12
- package/dist/services/tus/data-store.js +23 -55
- package/dist/services/tus/lockers.js +4 -10
- package/dist/services/tus/server.js +2 -5
- package/dist/services/users.js +79 -153
- package/dist/services/utils.js +12 -31
- package/dist/services/versions.js +78 -121
- package/dist/services/websocket.js +8 -12
- package/dist/storage/get-storage-driver.js +2 -5
- package/dist/storage/register-drivers.js +1 -3
- package/dist/storage/register-locations.js +2 -4
- package/dist/synchronization.js +6 -17
- package/dist/telemetry/counter/use-buffered-counter.js +6 -22
- package/dist/telemetry/counter/use-counters.js +2 -6
- package/dist/telemetry/lib/send-report.js +2 -6
- package/dist/telemetry/lib/track.js +3 -8
- package/dist/telemetry/utils/check-user-limits.js +3 -9
- package/dist/telemetry/utils/format-api-request-counts.js +1 -3
- package/dist/telemetry/utils/get-extension-count.js +3 -8
- package/dist/telemetry/utils/get-item-count.js +2 -5
- package/dist/telemetry/utils/get-settings.js +2 -3
- package/dist/telemetry/utils/get-user-item-count.js +2 -4
- package/dist/telemetry/utils/should-check-user-limits.js +1 -3
- package/dist/types/index.js +0 -6
- package/dist/utils/apply-diff.js +111 -143
- package/dist/utils/apply-snapshot.js +1 -2
- package/dist/utils/calculate-field-depth.js +6 -19
- package/dist/utils/construct-flow-tree.js +5 -12
- package/dist/utils/create-admin.js +1 -2
- package/dist/utils/deep-map-response.js +31 -35
- package/dist/utils/encrypt.js +2 -3
- package/dist/utils/fetch-user-count/fetch-access-lookup.js +5 -15
- package/dist/utils/fetch-user-count/get-user-count-query.js +4 -12
- package/dist/utils/filter-items.js +9 -14
- package/dist/utils/freeze-schema.js +3 -8
- package/dist/utils/generate-translations.js +87 -137
- package/dist/utils/get-accountability-for-role.js +12 -17
- package/dist/utils/get-accountability-for-token.js +25 -31
- package/dist/utils/get-address.js +2 -7
- package/dist/utils/get-allowed-log-levels.js +1 -3
- package/dist/utils/get-auth-providers.js +12 -14
- package/dist/utils/get-cache-headers.js +2 -4
- package/dist/utils/get-cache-key.js +16 -4
- package/dist/utils/get-collection-from-alias.js +1 -6
- package/dist/utils/get-column-path.js +10 -21
- package/dist/utils/get-config-from-env.js +6 -15
- package/dist/utils/get-default-index-name.js +2 -4
- package/dist/utils/get-default-value.js +5 -9
- package/dist/utils/get-field-relational-depth.js +2 -5
- package/dist/utils/get-graphql-query-and-variables.js +1 -2
- package/dist/utils/get-graphql-type.js +1 -3
- package/dist/utils/get-ip-from-req.js +6 -15
- package/dist/utils/get-local-type.js +5 -13
- package/dist/utils/get-milliseconds.js +1 -3
- package/dist/utils/get-module-default.js +1 -3
- package/dist/utils/get-schema.js +9 -21
- package/dist/utils/get-secret.js +2 -6
- package/dist/utils/get-snapshot-diff.js +15 -23
- package/dist/utils/get-snapshot.js +6 -17
- package/dist/utils/is-directus-jwt.js +1 -2
- package/dist/utils/is-field-allowed.js +1 -3
- package/dist/utils/jwt.js +7 -13
- package/dist/utils/md.js +1 -2
- package/dist/utils/parse-filter-key.js +2 -4
- package/dist/utils/parse-numeric-string.js +5 -11
- package/dist/utils/permissions-cacheable.js +9 -22
- package/dist/utils/redact-object.js +27 -57
- package/dist/utils/reduce-schema.js +8 -25
- package/dist/utils/sanitize-query.js +46 -98
- package/dist/utils/sanitize-schema.js +2 -3
- package/dist/utils/schedule.js +2 -6
- package/dist/utils/should-clear-cache.js +2 -6
- package/dist/utils/should-skip-cache.js +3 -8
- package/dist/utils/split-fields.js +4 -12
- package/dist/utils/stall.js +1 -3
- package/dist/utils/store.js +2 -5
- package/dist/utils/transaction.js +29 -58
- package/dist/utils/transformations.js +28 -43
- package/dist/utils/translations-shared.js +4 -12
- package/dist/utils/url.js +3 -10
- package/dist/utils/user-name.js +4 -12
- package/dist/utils/validate-diff.js +17 -38
- package/dist/utils/validate-env.js +3 -5
- package/dist/utils/validate-keys.js +4 -10
- package/dist/utils/validate-query.js +67 -118
- package/dist/utils/validate-snapshot.js +3 -9
- package/dist/utils/validate-storage.js +12 -19
- package/dist/utils/validate-user-count-integrity.js +3 -9
- package/dist/utils/verify-session-jwt.js +2 -6
- package/dist/utils/versioning/handle-version.js +10 -29
- package/dist/utils/versioning/merge-version-data.js +1 -5
- package/dist/utils/versioning/split-recursive.js +6 -3
- package/dist/websocket/authenticate.js +7 -18
- package/dist/websocket/collab/calculate-cache-metadata.js +33 -51
- package/dist/websocket/collab/collab.js +49 -113
- package/dist/websocket/collab/filter-to-fields.js +2 -5
- package/dist/websocket/collab/messenger.js +48 -73
- package/dist/websocket/collab/payload-permissions.js +20 -51
- package/dist/websocket/collab/permissions-cache.js +17 -46
- package/dist/websocket/collab/room.js +57 -124
- package/dist/websocket/collab/verify-permissions.js +37 -48
- package/dist/websocket/controllers/base.js +34 -61
- package/dist/websocket/controllers/graphql.js +11 -18
- package/dist/websocket/controllers/index.js +3 -12
- package/dist/websocket/controllers/logs.js +3 -7
- package/dist/websocket/errors.js +2 -5
- package/dist/websocket/handlers/heartbeat.js +11 -19
- package/dist/websocket/handlers/index.js +5 -15
- package/dist/websocket/handlers/items.js +15 -26
- package/dist/websocket/handlers/logs.js +24 -41
- package/dist/websocket/handlers/subscribe.js +37 -66
- package/dist/websocket/utils/get-expires-at-for-token.js +1 -3
- package/dist/websocket/utils/items.js +10 -27
- package/dist/websocket/utils/message.js +6 -10
- package/package.json +28 -29
- package/dist/__utils__/items-utils.js +0 -32
- package/dist/__utils__/schemas.js +0 -297
- package/dist/__utils__/snapshots.js +0 -899
- package/dist/database/run-ast/lib/apply-query/mock.js +0 -9
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +0 -445
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/index.js +0 -176
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/system/policy.js +0 -54
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/any/any.js +0 -13
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/any/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/argument/argument.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/argument/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/array/array.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/array/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.js +0 -37
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/awaited/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/bigint/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/boolean/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/clone/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/clone/type.js +0 -17
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/clone/value.js +0 -35
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/composite/composite.js +0 -42
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/composite/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/computed/computed.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/computed/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/const/const.js +0 -52
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/const/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.js +0 -17
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/constructor/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.js +0 -14
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/create/immutable.js +0 -32
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/create/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/create/type.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/date/date.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/date/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/discard/discard.js +0 -12
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/discard/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/enum/enum.js +0 -23
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/enum/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/error/error.js +0 -10
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/error/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.js +0 -11
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.js +0 -25
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/exclude/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.js +0 -267
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.js +0 -29
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.js +0 -21
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.js +0 -21
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/extends.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extends/index.js +0 -7
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.js +0 -11
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/extract.js +0 -25
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/extract/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/function/function.js +0 -17
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/function/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/kind.js +0 -204
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/type.js +0 -293
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/guard/value.js +0 -68
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.js +0 -8
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/helpers/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/index.js +0 -6
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.js +0 -27
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.js +0 -24
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.js +0 -24
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.js +0 -67
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.js +0 -13
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.js +0 -102
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/integer/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/integer/integer.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.js +0 -23
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.js +0 -35
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.js +0 -17
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.js +0 -10
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.js +0 -8
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.js +0 -30
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.js +0 -54
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.js +0 -10
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.js +0 -10
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.js +0 -10
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/iterator/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/index.js +0 -6
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.js +0 -21
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.js +0 -17
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.js +0 -52
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.js +0 -38
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/literal/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/literal/literal.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/mapped/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.js +0 -14
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.js +0 -14
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.js +0 -86
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/module/compute.js +0 -144
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/module/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/module/module.js +0 -44
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/never/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/never/never.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/not/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/not/not.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/null/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/null/null.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/number/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/number/number.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/object/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/object/object.js +0 -33
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.js +0 -27
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.js +0 -21
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/omit/omit.js +0 -65
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/optional/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/optional/optional.js +0 -29
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/parameters/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.js +0 -14
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/partial/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.js +0 -21
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/partial/partial.js +0 -62
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/patterns/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.js +0 -12
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.js +0 -27
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.js +0 -21
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/pick/pick.js +0 -63
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/promise/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/promise/promise.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.js +0 -29
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.js +0 -13
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/record/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/record/record.js +0 -92
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/recursive/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.js +0 -24
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/ref/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/ref/ref.js +0 -19
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/regexp/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.js +0 -19
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/registry/format.js +0 -30
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/registry/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/registry/type.js +0 -30
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/required/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/required/required.js +0 -60
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/rest/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/rest/rest.js +0 -13
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/return-type/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.js +0 -13
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.js +0 -1
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/schema/index.js +0 -4
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/schema/schema.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/sets/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/sets/set.js +0 -42
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/static/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/static/static.js +0 -1
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/string/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/string/string.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/symbol/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/symbols/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.js +0 -14
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.js +0 -28
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.js +0 -37
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.js +0 -9
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.js +0 -125
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.js +0 -24
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.js +0 -55
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.js +0 -20
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.js +0 -16
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/transform/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/transform/transform.js +0 -51
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/tuple/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.js +0 -24
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/type/index.js +0 -10
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/type/javascript.js +0 -123
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/type/json.js +0 -263
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/type/type.js +0 -191
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/undefined/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/index.js +0 -5
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union-create.js +0 -14
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.js +0 -33
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union-type.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/union/union.js +0 -13
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/unknown/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.js +0 -12
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.js +0 -12
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/void/index.js +0 -3
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/type/void/void.js +0 -15
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/value/guard/guard.js +0 -140
- package/dist/node_modules/.pnpm/@sinclair_typebox@0.34.41/node_modules/@sinclair/typebox/build/esm/value/guard/index.js +0 -3
- package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.js +0 -1714
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +0 -1287
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +0 -2151
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.js +0 -8
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/utils.js +0 -8
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +0 -2082
- package/dist/node_modules/.pnpm/@vitest_spy@3.2.4/node_modules/@vitest/spy/dist/index.js +0 -192
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +0 -158
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.js +0 -1535
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.js +0 -155
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js +0 -244
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js +0 -621
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.js +0 -890
- package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js +0 -3558
- package/dist/node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/branding.js +0 -13
- package/dist/node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/index.js +0 -115
- package/dist/node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/messages.js +0 -77
- package/dist/node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/overloads.js +0 -13
- package/dist/node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/utils.js +0 -30
- package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +0 -398
- package/dist/node_modules/.pnpm/knex-mock-client@3.0.2_knex@3.1.0_mysql2@3.15.3_pg@8.16.3_sqlite3@5.1.7_tedious@18.6.1_/node_modules/knex-mock-client/dist/MockClient.js +0 -79
- package/dist/node_modules/.pnpm/knex-mock-client@3.0.2_knex@3.1.0_mysql2@3.15.3_pg@8.16.3_sqlite3@5.1.7_tedious@18.6.1_/node_modules/knex-mock-client/dist/MockConnection.js +0 -64
- package/dist/node_modules/.pnpm/knex-mock-client@3.0.2_knex@3.1.0_mysql2@3.15.3_pg@8.16.3_sqlite3@5.1.7_tedious@18.6.1_/node_modules/knex-mock-client/dist/Tracker.js +0 -185
- package/dist/node_modules/.pnpm/knex-mock-client@3.0.2_knex@3.1.0_mysql2@3.15.3_pg@8.16.3_sqlite3@5.1.7_tedious@18.6.1_/node_modules/knex-mock-client/dist/constants.js +0 -30
- package/dist/node_modules/.pnpm/knex-mock-client@3.0.2_knex@3.1.0_mysql2@3.15.3_pg@8.16.3_sqlite3@5.1.7_tedious@18.6.1_/node_modules/knex-mock-client/dist/index.js +0 -37
- package/dist/node_modules/.pnpm/knex-mock-client@3.0.2_knex@3.1.0_mysql2@3.15.3_pg@8.16.3_sqlite3@5.1.7_tedious@18.6.1_/node_modules/knex-mock-client/dist/utils.js +0 -17
- package/dist/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.js +0 -1486
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +0 -11
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +0 -18
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +0 -11
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +0 -19
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +0 -15
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +0 -39
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +0 -14
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +0 -141
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +0 -43
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +0 -138
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +0 -25
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +0 -22
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +0 -27
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +0 -6
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +0 -12
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +0 -18
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +0 -27
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +0 -10
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +0 -36
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +0 -1258
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -21
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -478
- package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.js +0 -84
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +0 -85
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +0 -15
- package/dist/node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.js +0 -158
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -8
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/chunks/benchmark.CYdenmiT.js +0 -41
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -50
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/chunks/index.CdQS2e2Q.js +0 -38
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -66
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -2986
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_node@22.13.14_@vitest_ui@3.2.4_happy-dom@20.8.9_jiti@2.6.1_jsdom@20_c24d183060b6f93f55300b66d0779768/node_modules/vitest/dist/index.js +0 -24
- package/dist/test-utils/cache.js +0 -64
- package/dist/test-utils/controllers.js +0 -101
- package/dist/test-utils/database.js +0 -54
- package/dist/test-utils/emitter.js +0 -38
- package/dist/test-utils/env.js +0 -77
- package/dist/test-utils/knex.js +0 -222
- package/dist/test-utils/schema.js +0 -35
- package/dist/test-utils/services/fields-service.js +0 -38
- package/dist/test-utils/services/files-service.js +0 -35
- package/dist/test-utils/services/folders-service.js +0 -34
- package/dist/test-utils/services/items-service.js +0 -52
- package/dist/test-utils/storage.js +0 -150
- package/dist/utils/job-queue.js +0 -29
package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.js
DELETED
|
@@ -1,1714 +0,0 @@
|
|
|
1
|
-
import { u } from "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js";
|
|
2
|
-
import { stringify } from "../../../../../@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js";
|
|
3
|
-
import { assertTypes, getType, isObject, noop } from "../../../../../@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js";
|
|
4
|
-
import "../../../../../@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.js";
|
|
5
|
-
import { diff, printDiffOrStringify } from "../../../../../@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.js";
|
|
6
|
-
import { isMockFunction } from "../../../../../@vitest_spy@3.2.4/node_modules/@vitest/spy/dist/index.js";
|
|
7
|
-
import { processError } from "../../../../../@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.js";
|
|
8
|
-
import { use, utils_exports } from "../../../../../chai@5.3.3/node_modules/chai/index.js";
|
|
9
|
-
|
|
10
|
-
//#region ../node_modules/.pnpm/@vitest+expect@3.2.4/node_modules/@vitest/expect/dist/index.js
|
|
11
|
-
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
12
|
-
const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
13
|
-
const GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
14
|
-
const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for("asymmetric-matchers-object");
|
|
15
|
-
const customMatchers = {
|
|
16
|
-
toSatisfy(actual, expected, message) {
|
|
17
|
-
const { printReceived: printReceived$1, printExpected: printExpected$1, matcherHint: matcherHint$1 } = this.utils;
|
|
18
|
-
const pass = expected(actual);
|
|
19
|
-
return {
|
|
20
|
-
pass,
|
|
21
|
-
message: () => pass ? `\
|
|
22
|
-
${matcherHint$1(".not.toSatisfy", "received", "")}
|
|
23
|
-
|
|
24
|
-
Expected value to not satisfy:
|
|
25
|
-
${message || printExpected$1(expected)}
|
|
26
|
-
Received:
|
|
27
|
-
${printReceived$1(actual)}` : `\
|
|
28
|
-
${matcherHint$1(".toSatisfy", "received", "")}
|
|
29
|
-
|
|
30
|
-
Expected value to satisfy:
|
|
31
|
-
${message || printExpected$1(expected)}
|
|
32
|
-
|
|
33
|
-
Received:
|
|
34
|
-
${printReceived$1(actual)}`
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
toBeOneOf(actual, expected) {
|
|
38
|
-
const { equals: equals$1, customTesters } = this;
|
|
39
|
-
const { printReceived: printReceived$1, printExpected: printExpected$1, matcherHint: matcherHint$1 } = this.utils;
|
|
40
|
-
if (!Array.isArray(expected)) {
|
|
41
|
-
throw new TypeError(`You must provide an array to ${matcherHint$1(".toBeOneOf")}, not '${typeof expected}'.`);
|
|
42
|
-
}
|
|
43
|
-
const pass = expected.length === 0 || expected.some((item) => equals$1(item, actual, customTesters));
|
|
44
|
-
return {
|
|
45
|
-
pass,
|
|
46
|
-
message: () => pass ? `\
|
|
47
|
-
${matcherHint$1(".not.toBeOneOf", "received", "")}
|
|
48
|
-
|
|
49
|
-
Expected value to not be one of:
|
|
50
|
-
${printExpected$1(expected)}
|
|
51
|
-
Received:
|
|
52
|
-
${printReceived$1(actual)}` : `\
|
|
53
|
-
${matcherHint$1(".toBeOneOf", "received", "")}
|
|
54
|
-
|
|
55
|
-
Expected value to be one of:
|
|
56
|
-
${printExpected$1(expected)}
|
|
57
|
-
|
|
58
|
-
Received:
|
|
59
|
-
${printReceived$1(actual)}`
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const EXPECTED_COLOR = u.green;
|
|
64
|
-
const RECEIVED_COLOR = u.red;
|
|
65
|
-
const INVERTED_COLOR = u.inverse;
|
|
66
|
-
const BOLD_WEIGHT = u.bold;
|
|
67
|
-
const DIM_COLOR = u.dim;
|
|
68
|
-
function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
|
|
69
|
-
const { comment = "", isDirectExpectCall = false, isNot = false, promise = "", secondArgument = "", expectedColor = EXPECTED_COLOR, receivedColor = RECEIVED_COLOR, secondArgumentColor = EXPECTED_COLOR } = options;
|
|
70
|
-
let hint = "";
|
|
71
|
-
let dimString = "expect";
|
|
72
|
-
if (!isDirectExpectCall && received !== "") {
|
|
73
|
-
hint += DIM_COLOR(`${dimString}(`) + receivedColor(received);
|
|
74
|
-
dimString = ")";
|
|
75
|
-
}
|
|
76
|
-
if (promise !== "") {
|
|
77
|
-
hint += DIM_COLOR(`${dimString}.`) + promise;
|
|
78
|
-
dimString = "";
|
|
79
|
-
}
|
|
80
|
-
if (isNot) {
|
|
81
|
-
hint += `${DIM_COLOR(`${dimString}.`)}not`;
|
|
82
|
-
dimString = "";
|
|
83
|
-
}
|
|
84
|
-
if (matcherName.includes(".")) {
|
|
85
|
-
dimString += matcherName;
|
|
86
|
-
} else {
|
|
87
|
-
hint += DIM_COLOR(`${dimString}.`) + matcherName;
|
|
88
|
-
dimString = "";
|
|
89
|
-
}
|
|
90
|
-
if (expected === "") {
|
|
91
|
-
dimString += "()";
|
|
92
|
-
} else {
|
|
93
|
-
hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected);
|
|
94
|
-
if (secondArgument) {
|
|
95
|
-
hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument);
|
|
96
|
-
}
|
|
97
|
-
dimString = ")";
|
|
98
|
-
}
|
|
99
|
-
if (comment !== "") {
|
|
100
|
-
dimString += ` // ${comment}`;
|
|
101
|
-
}
|
|
102
|
-
if (dimString !== "") {
|
|
103
|
-
hint += DIM_COLOR(dimString);
|
|
104
|
-
}
|
|
105
|
-
return hint;
|
|
106
|
-
}
|
|
107
|
-
const SPACE_SYMBOL = "·";
|
|
108
|
-
function replaceTrailingSpaces(text) {
|
|
109
|
-
return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
|
|
110
|
-
}
|
|
111
|
-
function printReceived(object) {
|
|
112
|
-
return RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
|
|
113
|
-
}
|
|
114
|
-
function printExpected(value) {
|
|
115
|
-
return EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
|
|
116
|
-
}
|
|
117
|
-
function getMatcherUtils() {
|
|
118
|
-
return {
|
|
119
|
-
EXPECTED_COLOR,
|
|
120
|
-
RECEIVED_COLOR,
|
|
121
|
-
INVERTED_COLOR,
|
|
122
|
-
BOLD_WEIGHT,
|
|
123
|
-
DIM_COLOR,
|
|
124
|
-
diff,
|
|
125
|
-
matcherHint,
|
|
126
|
-
printReceived,
|
|
127
|
-
printExpected,
|
|
128
|
-
printDiffOrStringify,
|
|
129
|
-
printWithType
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function printWithType(name, value, print) {
|
|
133
|
-
const type = getType(value);
|
|
134
|
-
const hasType = type !== "null" && type !== "undefined" ? `${name} has type: ${type}\n` : "";
|
|
135
|
-
const hasValue = `${name} has value: ${print(value)}`;
|
|
136
|
-
return hasType + hasValue;
|
|
137
|
-
}
|
|
138
|
-
function addCustomEqualityTesters(newTesters) {
|
|
139
|
-
if (!Array.isArray(newTesters)) {
|
|
140
|
-
throw new TypeError(`expect.customEqualityTesters: Must be set to an array of Testers. Was given "${getType(newTesters)}"`);
|
|
141
|
-
}
|
|
142
|
-
globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters.push(...newTesters);
|
|
143
|
-
}
|
|
144
|
-
function getCustomEqualityTesters() {
|
|
145
|
-
return globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters;
|
|
146
|
-
}
|
|
147
|
-
function equals(a, b, customTesters, strictCheck) {
|
|
148
|
-
customTesters = customTesters || [];
|
|
149
|
-
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
|
150
|
-
}
|
|
151
|
-
const functionToString = Function.prototype.toString;
|
|
152
|
-
function isAsymmetric(obj) {
|
|
153
|
-
return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch);
|
|
154
|
-
}
|
|
155
|
-
function hasAsymmetric(obj, seen = new Set()) {
|
|
156
|
-
if (seen.has(obj)) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
seen.add(obj);
|
|
160
|
-
if (isAsymmetric(obj)) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
if (Array.isArray(obj)) {
|
|
164
|
-
return obj.some((i) => hasAsymmetric(i, seen));
|
|
165
|
-
}
|
|
166
|
-
if (obj instanceof Set) {
|
|
167
|
-
return Array.from(obj).some((i) => hasAsymmetric(i, seen));
|
|
168
|
-
}
|
|
169
|
-
if (isObject(obj)) {
|
|
170
|
-
return Object.values(obj).some((v) => hasAsymmetric(v, seen));
|
|
171
|
-
}
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
function asymmetricMatch(a, b) {
|
|
175
|
-
const asymmetricA = isAsymmetric(a);
|
|
176
|
-
const asymmetricB = isAsymmetric(b);
|
|
177
|
-
if (asymmetricA && asymmetricB) {
|
|
178
|
-
return undefined;
|
|
179
|
-
}
|
|
180
|
-
if (asymmetricA) {
|
|
181
|
-
return a.asymmetricMatch(b);
|
|
182
|
-
}
|
|
183
|
-
if (asymmetricB) {
|
|
184
|
-
return b.asymmetricMatch(a);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function eq(a, b, aStack, bStack, customTesters, hasKey$1) {
|
|
188
|
-
let result = true;
|
|
189
|
-
const asymmetricResult = asymmetricMatch(a, b);
|
|
190
|
-
if (asymmetricResult !== undefined) {
|
|
191
|
-
return asymmetricResult;
|
|
192
|
-
}
|
|
193
|
-
const testerContext = { equals };
|
|
194
|
-
for (let i = 0; i < customTesters.length; i++) {
|
|
195
|
-
const customTesterResult = customTesters[i].call(testerContext, a, b, customTesters);
|
|
196
|
-
if (customTesterResult !== undefined) {
|
|
197
|
-
return customTesterResult;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (typeof URL === "function" && a instanceof URL && b instanceof URL) {
|
|
201
|
-
return a.href === b.href;
|
|
202
|
-
}
|
|
203
|
-
if (Object.is(a, b)) {
|
|
204
|
-
return true;
|
|
205
|
-
}
|
|
206
|
-
if (a === null || b === null) {
|
|
207
|
-
return a === b;
|
|
208
|
-
}
|
|
209
|
-
const className = Object.prototype.toString.call(a);
|
|
210
|
-
if (className !== Object.prototype.toString.call(b)) {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
switch (className) {
|
|
214
|
-
case "[object Boolean]":
|
|
215
|
-
case "[object String]":
|
|
216
|
-
case "[object Number]": if (typeof a !== typeof b) {
|
|
217
|
-
return false;
|
|
218
|
-
} else if (typeof a !== "object" && typeof b !== "object") {
|
|
219
|
-
return Object.is(a, b);
|
|
220
|
-
} else {
|
|
221
|
-
return Object.is(a.valueOf(), b.valueOf());
|
|
222
|
-
}
|
|
223
|
-
case "[object Date]": {
|
|
224
|
-
const numA = +a;
|
|
225
|
-
const numB = +b;
|
|
226
|
-
return numA === numB || Number.isNaN(numA) && Number.isNaN(numB);
|
|
227
|
-
}
|
|
228
|
-
case "[object RegExp]": return a.source === b.source && a.flags === b.flags;
|
|
229
|
-
case "[object Temporal.Instant]":
|
|
230
|
-
case "[object Temporal.ZonedDateTime]":
|
|
231
|
-
case "[object Temporal.PlainDateTime]":
|
|
232
|
-
case "[object Temporal.PlainDate]":
|
|
233
|
-
case "[object Temporal.PlainTime]":
|
|
234
|
-
case "[object Temporal.PlainYearMonth]":
|
|
235
|
-
case "[object Temporal.PlainMonthDay]": return a.equals(b);
|
|
236
|
-
case "[object Temporal.Duration]": return a.toString() === b.toString();
|
|
237
|
-
}
|
|
238
|
-
if (typeof a !== "object" || typeof b !== "object") {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
if (isDomNode(a) && isDomNode(b)) {
|
|
242
|
-
return a.isEqualNode(b);
|
|
243
|
-
}
|
|
244
|
-
let length = aStack.length;
|
|
245
|
-
while (length--) {
|
|
246
|
-
if (aStack[length] === a) {
|
|
247
|
-
return bStack[length] === b;
|
|
248
|
-
} else if (bStack[length] === b) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
aStack.push(a);
|
|
253
|
-
bStack.push(b);
|
|
254
|
-
if (className === "[object Array]" && a.length !== b.length) {
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
if (a instanceof Error && b instanceof Error) {
|
|
258
|
-
try {
|
|
259
|
-
return isErrorEqual(a, b, aStack, bStack, customTesters, hasKey$1);
|
|
260
|
-
} finally {
|
|
261
|
-
aStack.pop();
|
|
262
|
-
bStack.pop();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const aKeys = keys(a, hasKey$1);
|
|
266
|
-
let key;
|
|
267
|
-
let size = aKeys.length;
|
|
268
|
-
if (keys(b, hasKey$1).length !== size) {
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
while (size--) {
|
|
272
|
-
key = aKeys[size];
|
|
273
|
-
result = hasKey$1(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey$1);
|
|
274
|
-
if (!result) {
|
|
275
|
-
return false;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
aStack.pop();
|
|
279
|
-
bStack.pop();
|
|
280
|
-
return result;
|
|
281
|
-
}
|
|
282
|
-
function isErrorEqual(a, b, aStack, bStack, customTesters, hasKey$1) {
|
|
283
|
-
let result = Object.getPrototypeOf(a) === Object.getPrototypeOf(b) && a.name === b.name && a.message === b.message;
|
|
284
|
-
if (typeof b.cause !== "undefined") {
|
|
285
|
-
result && (result = eq(a.cause, b.cause, aStack, bStack, customTesters, hasKey$1));
|
|
286
|
-
}
|
|
287
|
-
if (a instanceof AggregateError && b instanceof AggregateError) {
|
|
288
|
-
result && (result = eq(a.errors, b.errors, aStack, bStack, customTesters, hasKey$1));
|
|
289
|
-
}
|
|
290
|
-
result && (result = eq({ ...a }, { ...b }, aStack, bStack, customTesters, hasKey$1));
|
|
291
|
-
return result;
|
|
292
|
-
}
|
|
293
|
-
function keys(obj, hasKey$1) {
|
|
294
|
-
const keys$1 = [];
|
|
295
|
-
for (const key in obj) {
|
|
296
|
-
if (hasKey$1(obj, key)) {
|
|
297
|
-
keys$1.push(key);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return keys$1.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
|
|
301
|
-
}
|
|
302
|
-
function hasDefinedKey(obj, key) {
|
|
303
|
-
return hasKey(obj, key) && obj[key] !== undefined;
|
|
304
|
-
}
|
|
305
|
-
function hasKey(obj, key) {
|
|
306
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
307
|
-
}
|
|
308
|
-
function isA(typeName, value) {
|
|
309
|
-
return Object.prototype.toString.apply(value) === `[object ${typeName}]`;
|
|
310
|
-
}
|
|
311
|
-
function isDomNode(obj) {
|
|
312
|
-
return obj !== null && typeof obj === "object" && "nodeType" in obj && typeof obj.nodeType === "number" && "nodeName" in obj && typeof obj.nodeName === "string" && "isEqualNode" in obj && typeof obj.isEqualNode === "function";
|
|
313
|
-
}
|
|
314
|
-
function fnNameFor(func) {
|
|
315
|
-
if (func.name) {
|
|
316
|
-
return func.name;
|
|
317
|
-
}
|
|
318
|
-
const matches = functionToString.call(func).match(/^(?:async)?\s*function\s*(?:\*\s*)?([\w$]+)\s*\(/);
|
|
319
|
-
return matches ? matches[1] : "<anonymous>";
|
|
320
|
-
}
|
|
321
|
-
function getPrototype(obj) {
|
|
322
|
-
if (Object.getPrototypeOf) {
|
|
323
|
-
return Object.getPrototypeOf(obj);
|
|
324
|
-
}
|
|
325
|
-
if (obj.constructor.prototype === obj) {
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
return obj.constructor.prototype;
|
|
329
|
-
}
|
|
330
|
-
function hasProperty(obj, property) {
|
|
331
|
-
if (!obj) {
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
|
-
if (Object.prototype.hasOwnProperty.call(obj, property)) {
|
|
335
|
-
return true;
|
|
336
|
-
}
|
|
337
|
-
return hasProperty(getPrototype(obj), property);
|
|
338
|
-
}
|
|
339
|
-
const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
340
|
-
const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
341
|
-
const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
342
|
-
const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
343
|
-
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
344
|
-
function isImmutableUnorderedKeyed(maybeKeyed) {
|
|
345
|
-
return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
|
|
346
|
-
}
|
|
347
|
-
function isImmutableUnorderedSet(maybeSet) {
|
|
348
|
-
return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
|
|
349
|
-
}
|
|
350
|
-
function isObjectLiteral(source) {
|
|
351
|
-
return source != null && typeof source === "object" && !Array.isArray(source);
|
|
352
|
-
}
|
|
353
|
-
function isImmutableList(source) {
|
|
354
|
-
return Boolean(source && isObjectLiteral(source) && source[IS_LIST_SENTINEL]);
|
|
355
|
-
}
|
|
356
|
-
function isImmutableOrderedKeyed(source) {
|
|
357
|
-
return Boolean(source && isObjectLiteral(source) && source[IS_KEYED_SENTINEL] && source[IS_ORDERED_SENTINEL]);
|
|
358
|
-
}
|
|
359
|
-
function isImmutableOrderedSet(source) {
|
|
360
|
-
return Boolean(source && isObjectLiteral(source) && source[IS_SET_SENTINEL] && source[IS_ORDERED_SENTINEL]);
|
|
361
|
-
}
|
|
362
|
-
function isImmutableRecord(source) {
|
|
363
|
-
return Boolean(source && isObjectLiteral(source) && source[IS_RECORD_SYMBOL]);
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the MIT license found in the
|
|
369
|
-
* LICENSE file in the root directory of this source tree.
|
|
370
|
-
*
|
|
371
|
-
*/
|
|
372
|
-
const IteratorSymbol = Symbol.iterator;
|
|
373
|
-
function hasIterator(object) {
|
|
374
|
-
return !!(object != null && object[IteratorSymbol]);
|
|
375
|
-
}
|
|
376
|
-
function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) {
|
|
377
|
-
if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
|
|
378
|
-
return undefined;
|
|
379
|
-
}
|
|
380
|
-
if (a.constructor !== b.constructor) {
|
|
381
|
-
return false;
|
|
382
|
-
}
|
|
383
|
-
let length = aStack.length;
|
|
384
|
-
while (length--) {
|
|
385
|
-
if (aStack[length] === a) {
|
|
386
|
-
return bStack[length] === b;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
aStack.push(a);
|
|
390
|
-
bStack.push(b);
|
|
391
|
-
const filteredCustomTesters = [...customTesters.filter((t) => t !== iterableEquality), iterableEqualityWithStack];
|
|
392
|
-
function iterableEqualityWithStack(a$1, b$1) {
|
|
393
|
-
return iterableEquality(a$1, b$1, [...customTesters], [...aStack], [...bStack]);
|
|
394
|
-
}
|
|
395
|
-
if (a.size !== undefined) {
|
|
396
|
-
if (a.size !== b.size) {
|
|
397
|
-
return false;
|
|
398
|
-
} else if (isA("Set", a) || isImmutableUnorderedSet(a)) {
|
|
399
|
-
let allFound = true;
|
|
400
|
-
for (const aValue of a) {
|
|
401
|
-
if (!b.has(aValue)) {
|
|
402
|
-
let has = false;
|
|
403
|
-
for (const bValue of b) {
|
|
404
|
-
const isEqual = equals(aValue, bValue, filteredCustomTesters);
|
|
405
|
-
if (isEqual === true) {
|
|
406
|
-
has = true;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
if (has === false) {
|
|
410
|
-
allFound = false;
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
aStack.pop();
|
|
416
|
-
bStack.pop();
|
|
417
|
-
return allFound;
|
|
418
|
-
} else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) {
|
|
419
|
-
let allFound = true;
|
|
420
|
-
for (const aEntry of a) {
|
|
421
|
-
if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), filteredCustomTesters)) {
|
|
422
|
-
let has = false;
|
|
423
|
-
for (const bEntry of b) {
|
|
424
|
-
const matchedKey = equals(aEntry[0], bEntry[0], filteredCustomTesters);
|
|
425
|
-
let matchedValue = false;
|
|
426
|
-
if (matchedKey === true) {
|
|
427
|
-
matchedValue = equals(aEntry[1], bEntry[1], filteredCustomTesters);
|
|
428
|
-
}
|
|
429
|
-
if (matchedValue === true) {
|
|
430
|
-
has = true;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
if (has === false) {
|
|
434
|
-
allFound = false;
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
aStack.pop();
|
|
440
|
-
bStack.pop();
|
|
441
|
-
return allFound;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
const bIterator = b[IteratorSymbol]();
|
|
445
|
-
for (const aValue of a) {
|
|
446
|
-
const nextB = bIterator.next();
|
|
447
|
-
if (nextB.done || !equals(aValue, nextB.value, filteredCustomTesters)) {
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (!bIterator.next().done) {
|
|
452
|
-
return false;
|
|
453
|
-
}
|
|
454
|
-
if (!isImmutableList(a) && !isImmutableOrderedKeyed(a) && !isImmutableOrderedSet(a) && !isImmutableRecord(a)) {
|
|
455
|
-
const aEntries = Object.entries(a);
|
|
456
|
-
const bEntries = Object.entries(b);
|
|
457
|
-
if (!equals(aEntries, bEntries, filteredCustomTesters)) {
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
aStack.pop();
|
|
462
|
-
bStack.pop();
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`.
|
|
467
|
-
*/
|
|
468
|
-
function hasPropertyInObject(object, key) {
|
|
469
|
-
const shouldTerminate = !object || typeof object !== "object" || object === Object.prototype;
|
|
470
|
-
if (shouldTerminate) {
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
|
|
474
|
-
}
|
|
475
|
-
function isObjectWithKeys(a) {
|
|
476
|
-
return isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date);
|
|
477
|
-
}
|
|
478
|
-
function subsetEquality(object, subset, customTesters = []) {
|
|
479
|
-
const filteredCustomTesters = customTesters.filter((t) => t !== subsetEquality);
|
|
480
|
-
const subsetEqualityWithContext = (seenReferences = new WeakMap()) => (object$1, subset$1) => {
|
|
481
|
-
if (!isObjectWithKeys(subset$1)) {
|
|
482
|
-
return undefined;
|
|
483
|
-
}
|
|
484
|
-
return Object.keys(subset$1).every((key) => {
|
|
485
|
-
if (subset$1[key] != null && typeof subset$1[key] === "object") {
|
|
486
|
-
if (seenReferences.has(subset$1[key])) {
|
|
487
|
-
return equals(object$1[key], subset$1[key], filteredCustomTesters);
|
|
488
|
-
}
|
|
489
|
-
seenReferences.set(subset$1[key], true);
|
|
490
|
-
}
|
|
491
|
-
const result = object$1 != null && hasPropertyInObject(object$1, key) && equals(object$1[key], subset$1[key], [...filteredCustomTesters, subsetEqualityWithContext(seenReferences)]);
|
|
492
|
-
seenReferences.delete(subset$1[key]);
|
|
493
|
-
return result;
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
return subsetEqualityWithContext()(object, subset);
|
|
497
|
-
}
|
|
498
|
-
function typeEquality(a, b) {
|
|
499
|
-
if (a == null || b == null || a.constructor === b.constructor) {
|
|
500
|
-
return undefined;
|
|
501
|
-
}
|
|
502
|
-
return false;
|
|
503
|
-
}
|
|
504
|
-
function arrayBufferEquality(a, b) {
|
|
505
|
-
let dataViewA = a;
|
|
506
|
-
let dataViewB = b;
|
|
507
|
-
if (!(a instanceof DataView && b instanceof DataView)) {
|
|
508
|
-
if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) {
|
|
509
|
-
return undefined;
|
|
510
|
-
}
|
|
511
|
-
try {
|
|
512
|
-
dataViewA = new DataView(a);
|
|
513
|
-
dataViewB = new DataView(b);
|
|
514
|
-
} catch {
|
|
515
|
-
return undefined;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
if (dataViewA.byteLength !== dataViewB.byteLength) {
|
|
519
|
-
return false;
|
|
520
|
-
}
|
|
521
|
-
for (let i = 0; i < dataViewA.byteLength; i++) {
|
|
522
|
-
if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) {
|
|
523
|
-
return false;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
return true;
|
|
527
|
-
}
|
|
528
|
-
function sparseArrayEquality(a, b, customTesters = []) {
|
|
529
|
-
if (!Array.isArray(a) || !Array.isArray(b)) {
|
|
530
|
-
return undefined;
|
|
531
|
-
}
|
|
532
|
-
const aKeys = Object.keys(a);
|
|
533
|
-
const bKeys = Object.keys(b);
|
|
534
|
-
const filteredCustomTesters = customTesters.filter((t) => t !== sparseArrayEquality);
|
|
535
|
-
return equals(a, b, filteredCustomTesters, true) && equals(aKeys, bKeys);
|
|
536
|
-
}
|
|
537
|
-
function generateToBeMessage(deepEqualityName, expected = "#{this}", actual = "#{exp}") {
|
|
538
|
-
const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality`;
|
|
539
|
-
if (["toStrictEqual", "toEqual"].includes(deepEqualityName)) {
|
|
540
|
-
return `${toBeMessage}\n\nIf it should pass with deep equality, replace "toBe" with "${deepEqualityName}"\n\nExpected: ${expected}\nReceived: serializes to the same string\n`;
|
|
541
|
-
}
|
|
542
|
-
return toBeMessage;
|
|
543
|
-
}
|
|
544
|
-
function pluralize(word, count) {
|
|
545
|
-
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
546
|
-
}
|
|
547
|
-
function getObjectKeys(object) {
|
|
548
|
-
return [...Object.keys(object), ...Object.getOwnPropertySymbols(object).filter((s) => {
|
|
549
|
-
var _Object$getOwnPropert;
|
|
550
|
-
return (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(object, s)) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.enumerable;
|
|
551
|
-
})];
|
|
552
|
-
}
|
|
553
|
-
function getObjectSubset(object, subset, customTesters) {
|
|
554
|
-
let stripped = 0;
|
|
555
|
-
const getObjectSubsetWithContext = (seenReferences = new WeakMap()) => (object$1, subset$1) => {
|
|
556
|
-
if (Array.isArray(object$1)) {
|
|
557
|
-
if (Array.isArray(subset$1) && subset$1.length === object$1.length) {
|
|
558
|
-
return subset$1.map((sub, i) => getObjectSubsetWithContext(seenReferences)(object$1[i], sub));
|
|
559
|
-
}
|
|
560
|
-
} else if (object$1 instanceof Date) {
|
|
561
|
-
return object$1;
|
|
562
|
-
} else if (isObject(object$1) && isObject(subset$1)) {
|
|
563
|
-
if (equals(object$1, subset$1, [
|
|
564
|
-
...customTesters,
|
|
565
|
-
iterableEquality,
|
|
566
|
-
subsetEquality
|
|
567
|
-
])) {
|
|
568
|
-
return subset$1;
|
|
569
|
-
}
|
|
570
|
-
const trimmed = {};
|
|
571
|
-
seenReferences.set(object$1, trimmed);
|
|
572
|
-
if (typeof object$1.constructor === "function" && typeof object$1.constructor.name === "string") {
|
|
573
|
-
Object.defineProperty(trimmed, "constructor", {
|
|
574
|
-
enumerable: false,
|
|
575
|
-
value: object$1.constructor
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
for (const key of getObjectKeys(object$1)) {
|
|
579
|
-
if (hasPropertyInObject(subset$1, key)) {
|
|
580
|
-
trimmed[key] = seenReferences.has(object$1[key]) ? seenReferences.get(object$1[key]) : getObjectSubsetWithContext(seenReferences)(object$1[key], subset$1[key]);
|
|
581
|
-
} else {
|
|
582
|
-
if (!seenReferences.has(object$1[key])) {
|
|
583
|
-
stripped += 1;
|
|
584
|
-
if (isObject(object$1[key])) {
|
|
585
|
-
stripped += getObjectKeys(object$1[key]).length;
|
|
586
|
-
}
|
|
587
|
-
getObjectSubsetWithContext(seenReferences)(object$1[key], subset$1[key]);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
if (getObjectKeys(trimmed).length > 0) {
|
|
592
|
-
return trimmed;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
return object$1;
|
|
596
|
-
};
|
|
597
|
-
return {
|
|
598
|
-
subset: getObjectSubsetWithContext()(object, subset),
|
|
599
|
-
stripped
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
603
|
-
const globalState = new WeakMap();
|
|
604
|
-
const matchers = Object.create(null);
|
|
605
|
-
const customEqualityTesters = [];
|
|
606
|
-
const asymmetricMatchers = Object.create(null);
|
|
607
|
-
Object.defineProperty(globalThis, MATCHERS_OBJECT, { get: () => globalState });
|
|
608
|
-
Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
|
|
609
|
-
configurable: true,
|
|
610
|
-
get: () => ({
|
|
611
|
-
state: globalState.get(globalThis[GLOBAL_EXPECT]),
|
|
612
|
-
matchers,
|
|
613
|
-
customEqualityTesters
|
|
614
|
-
})
|
|
615
|
-
});
|
|
616
|
-
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, { get: () => asymmetricMatchers });
|
|
617
|
-
}
|
|
618
|
-
function getState(expect) {
|
|
619
|
-
return globalThis[MATCHERS_OBJECT].get(expect);
|
|
620
|
-
}
|
|
621
|
-
function setState(state, expect) {
|
|
622
|
-
const map = globalThis[MATCHERS_OBJECT];
|
|
623
|
-
const current = map.get(expect) || {};
|
|
624
|
-
const results = Object.defineProperties(current, {
|
|
625
|
-
...Object.getOwnPropertyDescriptors(current),
|
|
626
|
-
...Object.getOwnPropertyDescriptors(state)
|
|
627
|
-
});
|
|
628
|
-
map.set(expect, results);
|
|
629
|
-
}
|
|
630
|
-
var AsymmetricMatcher = class {
|
|
631
|
-
$$typeof = Symbol.for("jest.asymmetricMatcher");
|
|
632
|
-
constructor(sample, inverse = false) {
|
|
633
|
-
this.sample = sample;
|
|
634
|
-
this.inverse = inverse;
|
|
635
|
-
}
|
|
636
|
-
getMatcherContext(expect) {
|
|
637
|
-
return {
|
|
638
|
-
...getState(expect || globalThis[GLOBAL_EXPECT]),
|
|
639
|
-
equals,
|
|
640
|
-
isNot: this.inverse,
|
|
641
|
-
customTesters: getCustomEqualityTesters(),
|
|
642
|
-
utils: {
|
|
643
|
-
...getMatcherUtils(),
|
|
644
|
-
diff,
|
|
645
|
-
stringify,
|
|
646
|
-
iterableEquality,
|
|
647
|
-
subsetEquality
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
AsymmetricMatcher.prototype[Symbol.for("chai/inspect")] = function(options) {
|
|
653
|
-
const result = stringify(this, options.depth, { min: true });
|
|
654
|
-
if (result.length <= options.truncate) {
|
|
655
|
-
return result;
|
|
656
|
-
}
|
|
657
|
-
return `${this.toString()}{…}`;
|
|
658
|
-
};
|
|
659
|
-
var StringContaining = class extends AsymmetricMatcher {
|
|
660
|
-
constructor(sample, inverse = false) {
|
|
661
|
-
if (!isA("String", sample)) {
|
|
662
|
-
throw new Error("Expected is not a string");
|
|
663
|
-
}
|
|
664
|
-
super(sample, inverse);
|
|
665
|
-
}
|
|
666
|
-
asymmetricMatch(other) {
|
|
667
|
-
const result = isA("String", other) && other.includes(this.sample);
|
|
668
|
-
return this.inverse ? !result : result;
|
|
669
|
-
}
|
|
670
|
-
toString() {
|
|
671
|
-
return `String${this.inverse ? "Not" : ""}Containing`;
|
|
672
|
-
}
|
|
673
|
-
getExpectedType() {
|
|
674
|
-
return "string";
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
var Anything = class extends AsymmetricMatcher {
|
|
678
|
-
asymmetricMatch(other) {
|
|
679
|
-
return other != null;
|
|
680
|
-
}
|
|
681
|
-
toString() {
|
|
682
|
-
return "Anything";
|
|
683
|
-
}
|
|
684
|
-
toAsymmetricMatcher() {
|
|
685
|
-
return "Anything";
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
var ObjectContaining = class extends AsymmetricMatcher {
|
|
689
|
-
constructor(sample, inverse = false) {
|
|
690
|
-
super(sample, inverse);
|
|
691
|
-
}
|
|
692
|
-
getPrototype(obj) {
|
|
693
|
-
if (Object.getPrototypeOf) {
|
|
694
|
-
return Object.getPrototypeOf(obj);
|
|
695
|
-
}
|
|
696
|
-
if (obj.constructor.prototype === obj) {
|
|
697
|
-
return null;
|
|
698
|
-
}
|
|
699
|
-
return obj.constructor.prototype;
|
|
700
|
-
}
|
|
701
|
-
hasProperty(obj, property) {
|
|
702
|
-
if (!obj) {
|
|
703
|
-
return false;
|
|
704
|
-
}
|
|
705
|
-
if (Object.prototype.hasOwnProperty.call(obj, property)) {
|
|
706
|
-
return true;
|
|
707
|
-
}
|
|
708
|
-
return this.hasProperty(this.getPrototype(obj), property);
|
|
709
|
-
}
|
|
710
|
-
asymmetricMatch(other) {
|
|
711
|
-
if (typeof this.sample !== "object") {
|
|
712
|
-
throw new TypeError(`You must provide an object to ${this.toString()}, not '${typeof this.sample}'.`);
|
|
713
|
-
}
|
|
714
|
-
let result = true;
|
|
715
|
-
const matcherContext = this.getMatcherContext();
|
|
716
|
-
for (const property in this.sample) {
|
|
717
|
-
if (!this.hasProperty(other, property) || !equals(this.sample[property], other[property], matcherContext.customTesters)) {
|
|
718
|
-
result = false;
|
|
719
|
-
break;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
return this.inverse ? !result : result;
|
|
723
|
-
}
|
|
724
|
-
toString() {
|
|
725
|
-
return `Object${this.inverse ? "Not" : ""}Containing`;
|
|
726
|
-
}
|
|
727
|
-
getExpectedType() {
|
|
728
|
-
return "object";
|
|
729
|
-
}
|
|
730
|
-
};
|
|
731
|
-
var ArrayContaining = class extends AsymmetricMatcher {
|
|
732
|
-
constructor(sample, inverse = false) {
|
|
733
|
-
super(sample, inverse);
|
|
734
|
-
}
|
|
735
|
-
asymmetricMatch(other) {
|
|
736
|
-
if (!Array.isArray(this.sample)) {
|
|
737
|
-
throw new TypeError(`You must provide an array to ${this.toString()}, not '${typeof this.sample}'.`);
|
|
738
|
-
}
|
|
739
|
-
const matcherContext = this.getMatcherContext();
|
|
740
|
-
const result = this.sample.length === 0 || Array.isArray(other) && this.sample.every((item) => other.some((another) => equals(item, another, matcherContext.customTesters)));
|
|
741
|
-
return this.inverse ? !result : result;
|
|
742
|
-
}
|
|
743
|
-
toString() {
|
|
744
|
-
return `Array${this.inverse ? "Not" : ""}Containing`;
|
|
745
|
-
}
|
|
746
|
-
getExpectedType() {
|
|
747
|
-
return "array";
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
var Any = class extends AsymmetricMatcher {
|
|
751
|
-
constructor(sample) {
|
|
752
|
-
if (typeof sample === "undefined") {
|
|
753
|
-
throw new TypeError("any() expects to be passed a constructor function. " + "Please pass one or use anything() to match any object.");
|
|
754
|
-
}
|
|
755
|
-
super(sample);
|
|
756
|
-
}
|
|
757
|
-
fnNameFor(func) {
|
|
758
|
-
if (func.name) {
|
|
759
|
-
return func.name;
|
|
760
|
-
}
|
|
761
|
-
const functionToString$1 = Function.prototype.toString;
|
|
762
|
-
const matches = functionToString$1.call(func).match(/^(?:async)?\s*function\s*(?:\*\s*)?([\w$]+)\s*\(/);
|
|
763
|
-
return matches ? matches[1] : "<anonymous>";
|
|
764
|
-
}
|
|
765
|
-
asymmetricMatch(other) {
|
|
766
|
-
if (this.sample === String) {
|
|
767
|
-
return typeof other == "string" || other instanceof String;
|
|
768
|
-
}
|
|
769
|
-
if (this.sample === Number) {
|
|
770
|
-
return typeof other == "number" || other instanceof Number;
|
|
771
|
-
}
|
|
772
|
-
if (this.sample === Function) {
|
|
773
|
-
return typeof other == "function" || typeof other === "function";
|
|
774
|
-
}
|
|
775
|
-
if (this.sample === Boolean) {
|
|
776
|
-
return typeof other == "boolean" || other instanceof Boolean;
|
|
777
|
-
}
|
|
778
|
-
if (this.sample === BigInt) {
|
|
779
|
-
return typeof other == "bigint" || other instanceof BigInt;
|
|
780
|
-
}
|
|
781
|
-
if (this.sample === Symbol) {
|
|
782
|
-
return typeof other == "symbol" || other instanceof Symbol;
|
|
783
|
-
}
|
|
784
|
-
if (this.sample === Object) {
|
|
785
|
-
return typeof other == "object";
|
|
786
|
-
}
|
|
787
|
-
return other instanceof this.sample;
|
|
788
|
-
}
|
|
789
|
-
toString() {
|
|
790
|
-
return "Any";
|
|
791
|
-
}
|
|
792
|
-
getExpectedType() {
|
|
793
|
-
if (this.sample === String) {
|
|
794
|
-
return "string";
|
|
795
|
-
}
|
|
796
|
-
if (this.sample === Number) {
|
|
797
|
-
return "number";
|
|
798
|
-
}
|
|
799
|
-
if (this.sample === Function) {
|
|
800
|
-
return "function";
|
|
801
|
-
}
|
|
802
|
-
if (this.sample === Object) {
|
|
803
|
-
return "object";
|
|
804
|
-
}
|
|
805
|
-
if (this.sample === Boolean) {
|
|
806
|
-
return "boolean";
|
|
807
|
-
}
|
|
808
|
-
return this.fnNameFor(this.sample);
|
|
809
|
-
}
|
|
810
|
-
toAsymmetricMatcher() {
|
|
811
|
-
return `Any<${this.fnNameFor(this.sample)}>`;
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
var StringMatching = class extends AsymmetricMatcher {
|
|
815
|
-
constructor(sample, inverse = false) {
|
|
816
|
-
if (!isA("String", sample) && !isA("RegExp", sample)) {
|
|
817
|
-
throw new Error("Expected is not a String or a RegExp");
|
|
818
|
-
}
|
|
819
|
-
super(new RegExp(sample), inverse);
|
|
820
|
-
}
|
|
821
|
-
asymmetricMatch(other) {
|
|
822
|
-
const result = isA("String", other) && this.sample.test(other);
|
|
823
|
-
return this.inverse ? !result : result;
|
|
824
|
-
}
|
|
825
|
-
toString() {
|
|
826
|
-
return `String${this.inverse ? "Not" : ""}Matching`;
|
|
827
|
-
}
|
|
828
|
-
getExpectedType() {
|
|
829
|
-
return "string";
|
|
830
|
-
}
|
|
831
|
-
};
|
|
832
|
-
var CloseTo = class extends AsymmetricMatcher {
|
|
833
|
-
precision;
|
|
834
|
-
constructor(sample, precision = 2, inverse = false) {
|
|
835
|
-
if (!isA("Number", sample)) {
|
|
836
|
-
throw new Error("Expected is not a Number");
|
|
837
|
-
}
|
|
838
|
-
if (!isA("Number", precision)) {
|
|
839
|
-
throw new Error("Precision is not a Number");
|
|
840
|
-
}
|
|
841
|
-
super(sample);
|
|
842
|
-
this.inverse = inverse;
|
|
843
|
-
this.precision = precision;
|
|
844
|
-
}
|
|
845
|
-
asymmetricMatch(other) {
|
|
846
|
-
if (!isA("Number", other)) {
|
|
847
|
-
return false;
|
|
848
|
-
}
|
|
849
|
-
let result = false;
|
|
850
|
-
if (other === Number.POSITIVE_INFINITY && this.sample === Number.POSITIVE_INFINITY) {
|
|
851
|
-
result = true;
|
|
852
|
-
} else if (other === Number.NEGATIVE_INFINITY && this.sample === Number.NEGATIVE_INFINITY) {
|
|
853
|
-
result = true;
|
|
854
|
-
} else {
|
|
855
|
-
result = Math.abs(this.sample - other) < 10 ** -this.precision / 2;
|
|
856
|
-
}
|
|
857
|
-
return this.inverse ? !result : result;
|
|
858
|
-
}
|
|
859
|
-
toString() {
|
|
860
|
-
return `Number${this.inverse ? "Not" : ""}CloseTo`;
|
|
861
|
-
}
|
|
862
|
-
getExpectedType() {
|
|
863
|
-
return "number";
|
|
864
|
-
}
|
|
865
|
-
toAsymmetricMatcher() {
|
|
866
|
-
return [
|
|
867
|
-
this.toString(),
|
|
868
|
-
this.sample,
|
|
869
|
-
`(${pluralize("digit", this.precision)})`
|
|
870
|
-
].join(" ");
|
|
871
|
-
}
|
|
872
|
-
};
|
|
873
|
-
const JestAsymmetricMatchers = (chai, utils) => {
|
|
874
|
-
utils.addMethod(chai.expect, "anything", () => new Anything());
|
|
875
|
-
utils.addMethod(chai.expect, "any", (expected) => new Any(expected));
|
|
876
|
-
utils.addMethod(chai.expect, "stringContaining", (expected) => new StringContaining(expected));
|
|
877
|
-
utils.addMethod(chai.expect, "objectContaining", (expected) => new ObjectContaining(expected));
|
|
878
|
-
utils.addMethod(chai.expect, "arrayContaining", (expected) => new ArrayContaining(expected));
|
|
879
|
-
utils.addMethod(chai.expect, "stringMatching", (expected) => new StringMatching(expected));
|
|
880
|
-
utils.addMethod(chai.expect, "closeTo", (expected, precision) => new CloseTo(expected, precision));
|
|
881
|
-
chai.expect.not = {
|
|
882
|
-
stringContaining: (expected) => new StringContaining(expected, true),
|
|
883
|
-
objectContaining: (expected) => new ObjectContaining(expected, true),
|
|
884
|
-
arrayContaining: (expected) => new ArrayContaining(expected, true),
|
|
885
|
-
stringMatching: (expected) => new StringMatching(expected, true),
|
|
886
|
-
closeTo: (expected, precision) => new CloseTo(expected, precision, true)
|
|
887
|
-
};
|
|
888
|
-
};
|
|
889
|
-
function createAssertionMessage(util, assertion, hasArgs) {
|
|
890
|
-
const not = util.flag(assertion, "negate") ? "not." : "";
|
|
891
|
-
const name = `${util.flag(assertion, "_name")}(${hasArgs ? "expected" : ""})`;
|
|
892
|
-
const promiseName = util.flag(assertion, "promise");
|
|
893
|
-
const promise = promiseName ? `.${promiseName}` : "";
|
|
894
|
-
return `expect(actual)${promise}.${not}${name}`;
|
|
895
|
-
}
|
|
896
|
-
function recordAsyncExpect(_test, promise, assertion, error) {
|
|
897
|
-
const test = _test;
|
|
898
|
-
if (test && promise instanceof Promise) {
|
|
899
|
-
promise = promise.finally(() => {
|
|
900
|
-
if (!test.promises) {
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
const index = test.promises.indexOf(promise);
|
|
904
|
-
if (index !== -1) {
|
|
905
|
-
test.promises.splice(index, 1);
|
|
906
|
-
}
|
|
907
|
-
});
|
|
908
|
-
if (!test.promises) {
|
|
909
|
-
test.promises = [];
|
|
910
|
-
}
|
|
911
|
-
test.promises.push(promise);
|
|
912
|
-
let resolved = false;
|
|
913
|
-
test.onFinished ?? (test.onFinished = []);
|
|
914
|
-
test.onFinished.push(() => {
|
|
915
|
-
if (!resolved) {
|
|
916
|
-
var _vitest_worker__;
|
|
917
|
-
const processor = ((_vitest_worker__ = globalThis.__vitest_worker__) === null || _vitest_worker__ === void 0 ? void 0 : _vitest_worker__.onFilterStackTrace) || ((s) => s || "");
|
|
918
|
-
const stack = processor(error.stack);
|
|
919
|
-
console.warn([
|
|
920
|
-
`Promise returned by \`${assertion}\` was not awaited. `,
|
|
921
|
-
"Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ",
|
|
922
|
-
"Please remember to await the assertion.\n",
|
|
923
|
-
stack
|
|
924
|
-
].join(""));
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
return {
|
|
928
|
-
then(onFulfilled, onRejected) {
|
|
929
|
-
resolved = true;
|
|
930
|
-
return promise.then(onFulfilled, onRejected);
|
|
931
|
-
},
|
|
932
|
-
catch(onRejected) {
|
|
933
|
-
return promise.catch(onRejected);
|
|
934
|
-
},
|
|
935
|
-
finally(onFinally) {
|
|
936
|
-
return promise.finally(onFinally);
|
|
937
|
-
},
|
|
938
|
-
[Symbol.toStringTag]: "Promise"
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
return promise;
|
|
942
|
-
}
|
|
943
|
-
function handleTestError(test, err) {
|
|
944
|
-
var _test$result;
|
|
945
|
-
test.result || (test.result = { state: "fail" });
|
|
946
|
-
test.result.state = "fail";
|
|
947
|
-
(_test$result = test.result).errors || (_test$result.errors = []);
|
|
948
|
-
test.result.errors.push(processError(err));
|
|
949
|
-
}
|
|
950
|
-
function wrapAssertion(utils, name, fn) {
|
|
951
|
-
return function(...args) {
|
|
952
|
-
if (name !== "withTest") {
|
|
953
|
-
utils.flag(this, "_name", name);
|
|
954
|
-
}
|
|
955
|
-
if (!utils.flag(this, "soft")) {
|
|
956
|
-
return fn.apply(this, args);
|
|
957
|
-
}
|
|
958
|
-
const test = utils.flag(this, "vitest-test");
|
|
959
|
-
if (!test) {
|
|
960
|
-
throw new Error("expect.soft() can only be used inside a test");
|
|
961
|
-
}
|
|
962
|
-
try {
|
|
963
|
-
const result = fn.apply(this, args);
|
|
964
|
-
if (result && typeof result === "object" && typeof result.then === "function") {
|
|
965
|
-
return result.then(noop, (err) => {
|
|
966
|
-
handleTestError(test, err);
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
return result;
|
|
970
|
-
} catch (err) {
|
|
971
|
-
handleTestError(test, err);
|
|
972
|
-
}
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
const JestChaiExpect = (chai, utils) => {
|
|
976
|
-
const { AssertionError } = chai;
|
|
977
|
-
const customTesters = getCustomEqualityTesters();
|
|
978
|
-
function def(name, fn) {
|
|
979
|
-
const addMethod = (n) => {
|
|
980
|
-
const softWrapper = wrapAssertion(utils, n, fn);
|
|
981
|
-
utils.addMethod(chai.Assertion.prototype, n, softWrapper);
|
|
982
|
-
utils.addMethod(globalThis[JEST_MATCHERS_OBJECT].matchers, n, softWrapper);
|
|
983
|
-
};
|
|
984
|
-
if (Array.isArray(name)) {
|
|
985
|
-
name.forEach((n) => addMethod(n));
|
|
986
|
-
} else {
|
|
987
|
-
addMethod(name);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
[
|
|
991
|
-
"throw",
|
|
992
|
-
"throws",
|
|
993
|
-
"Throw"
|
|
994
|
-
].forEach((m) => {
|
|
995
|
-
utils.overwriteMethod(chai.Assertion.prototype, m, (_super) => {
|
|
996
|
-
return function(...args) {
|
|
997
|
-
const promise = utils.flag(this, "promise");
|
|
998
|
-
const object = utils.flag(this, "object");
|
|
999
|
-
const isNot = utils.flag(this, "negate");
|
|
1000
|
-
if (promise === "rejects") {
|
|
1001
|
-
utils.flag(this, "object", () => {
|
|
1002
|
-
throw object;
|
|
1003
|
-
});
|
|
1004
|
-
} else if (promise === "resolves" && typeof object !== "function") {
|
|
1005
|
-
if (!isNot) {
|
|
1006
|
-
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
1007
|
-
const error = { showDiff: false };
|
|
1008
|
-
throw new AssertionError(message, error, utils.flag(this, "ssfi"));
|
|
1009
|
-
} else {
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
_super.apply(this, args);
|
|
1014
|
-
};
|
|
1015
|
-
});
|
|
1016
|
-
});
|
|
1017
|
-
def("withTest", function(test) {
|
|
1018
|
-
utils.flag(this, "vitest-test", test);
|
|
1019
|
-
return this;
|
|
1020
|
-
});
|
|
1021
|
-
def("toEqual", function(expected) {
|
|
1022
|
-
const actual = utils.flag(this, "object");
|
|
1023
|
-
const equal = equals(actual, expected, [...customTesters, iterableEquality]);
|
|
1024
|
-
return this.assert(equal, "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", expected, actual);
|
|
1025
|
-
});
|
|
1026
|
-
def("toStrictEqual", function(expected) {
|
|
1027
|
-
const obj = utils.flag(this, "object");
|
|
1028
|
-
const equal = equals(obj, expected, [
|
|
1029
|
-
...customTesters,
|
|
1030
|
-
iterableEquality,
|
|
1031
|
-
typeEquality,
|
|
1032
|
-
sparseArrayEquality,
|
|
1033
|
-
arrayBufferEquality
|
|
1034
|
-
], true);
|
|
1035
|
-
return this.assert(equal, "expected #{this} to strictly equal #{exp}", "expected #{this} to not strictly equal #{exp}", expected, obj);
|
|
1036
|
-
});
|
|
1037
|
-
def("toBe", function(expected) {
|
|
1038
|
-
const actual = this._obj;
|
|
1039
|
-
const pass = Object.is(actual, expected);
|
|
1040
|
-
let deepEqualityName = "";
|
|
1041
|
-
if (!pass) {
|
|
1042
|
-
const toStrictEqualPass = equals(actual, expected, [
|
|
1043
|
-
...customTesters,
|
|
1044
|
-
iterableEquality,
|
|
1045
|
-
typeEquality,
|
|
1046
|
-
sparseArrayEquality,
|
|
1047
|
-
arrayBufferEquality
|
|
1048
|
-
], true);
|
|
1049
|
-
if (toStrictEqualPass) {
|
|
1050
|
-
deepEqualityName = "toStrictEqual";
|
|
1051
|
-
} else {
|
|
1052
|
-
const toEqualPass = equals(actual, expected, [...customTesters, iterableEquality]);
|
|
1053
|
-
if (toEqualPass) {
|
|
1054
|
-
deepEqualityName = "toEqual";
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
return this.assert(pass, generateToBeMessage(deepEqualityName), "expected #{this} not to be #{exp} // Object.is equality", expected, actual);
|
|
1059
|
-
});
|
|
1060
|
-
def("toMatchObject", function(expected) {
|
|
1061
|
-
const actual = this._obj;
|
|
1062
|
-
const pass = equals(actual, expected, [
|
|
1063
|
-
...customTesters,
|
|
1064
|
-
iterableEquality,
|
|
1065
|
-
subsetEquality
|
|
1066
|
-
]);
|
|
1067
|
-
const isNot = utils.flag(this, "negate");
|
|
1068
|
-
const { subset: actualSubset, stripped } = getObjectSubset(actual, expected, customTesters);
|
|
1069
|
-
if (pass && isNot || !pass && !isNot) {
|
|
1070
|
-
const msg = utils.getMessage(this, [
|
|
1071
|
-
pass,
|
|
1072
|
-
"expected #{this} to match object #{exp}",
|
|
1073
|
-
"expected #{this} to not match object #{exp}",
|
|
1074
|
-
expected,
|
|
1075
|
-
actualSubset,
|
|
1076
|
-
false
|
|
1077
|
-
]);
|
|
1078
|
-
const message = stripped === 0 ? msg : `${msg}\n(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`;
|
|
1079
|
-
throw new AssertionError(message, {
|
|
1080
|
-
showDiff: true,
|
|
1081
|
-
expected,
|
|
1082
|
-
actual: actualSubset
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
});
|
|
1086
|
-
def("toMatch", function(expected) {
|
|
1087
|
-
const actual = this._obj;
|
|
1088
|
-
if (typeof actual !== "string") {
|
|
1089
|
-
throw new TypeError(`.toMatch() expects to receive a string, but got ${typeof actual}`);
|
|
1090
|
-
}
|
|
1091
|
-
return this.assert(typeof expected === "string" ? actual.includes(expected) : actual.match(expected), `expected #{this} to match #{exp}`, `expected #{this} not to match #{exp}`, expected, actual);
|
|
1092
|
-
});
|
|
1093
|
-
def("toContain", function(item) {
|
|
1094
|
-
const actual = this._obj;
|
|
1095
|
-
if (typeof Node !== "undefined" && actual instanceof Node) {
|
|
1096
|
-
if (!(item instanceof Node)) {
|
|
1097
|
-
throw new TypeError(`toContain() expected a DOM node as the argument, but got ${typeof item}`);
|
|
1098
|
-
}
|
|
1099
|
-
return this.assert(actual.contains(item), "expected #{this} to contain element #{exp}", "expected #{this} not to contain element #{exp}", item, actual);
|
|
1100
|
-
}
|
|
1101
|
-
if (typeof DOMTokenList !== "undefined" && actual instanceof DOMTokenList) {
|
|
1102
|
-
assertTypes(item, "class name", ["string"]);
|
|
1103
|
-
const isNot = utils.flag(this, "negate");
|
|
1104
|
-
const expectedClassList = isNot ? actual.value.replace(item, "").trim() : `${actual.value} ${item}`;
|
|
1105
|
-
return this.assert(actual.contains(item), `expected "${actual.value}" to contain "${item}"`, `expected "${actual.value}" not to contain "${item}"`, expectedClassList, actual.value);
|
|
1106
|
-
}
|
|
1107
|
-
if (typeof actual === "string" && typeof item === "string") {
|
|
1108
|
-
return this.assert(actual.includes(item), `expected #{this} to contain #{exp}`, `expected #{this} not to contain #{exp}`, item, actual);
|
|
1109
|
-
}
|
|
1110
|
-
if (actual != null && typeof actual !== "string") {
|
|
1111
|
-
utils.flag(this, "object", Array.from(actual));
|
|
1112
|
-
}
|
|
1113
|
-
return this.contain(item);
|
|
1114
|
-
});
|
|
1115
|
-
def("toContainEqual", function(expected) {
|
|
1116
|
-
const obj = utils.flag(this, "object");
|
|
1117
|
-
const index = Array.from(obj).findIndex((item) => {
|
|
1118
|
-
return equals(item, expected, customTesters);
|
|
1119
|
-
});
|
|
1120
|
-
this.assert(index !== -1, "expected #{this} to deep equally contain #{exp}", "expected #{this} to not deep equally contain #{exp}", expected);
|
|
1121
|
-
});
|
|
1122
|
-
def("toBeTruthy", function() {
|
|
1123
|
-
const obj = utils.flag(this, "object");
|
|
1124
|
-
this.assert(Boolean(obj), "expected #{this} to be truthy", "expected #{this} to not be truthy", true, obj);
|
|
1125
|
-
});
|
|
1126
|
-
def("toBeFalsy", function() {
|
|
1127
|
-
const obj = utils.flag(this, "object");
|
|
1128
|
-
this.assert(!obj, "expected #{this} to be falsy", "expected #{this} to not be falsy", false, obj);
|
|
1129
|
-
});
|
|
1130
|
-
def("toBeGreaterThan", function(expected) {
|
|
1131
|
-
const actual = this._obj;
|
|
1132
|
-
assertTypes(actual, "actual", ["number", "bigint"]);
|
|
1133
|
-
assertTypes(expected, "expected", ["number", "bigint"]);
|
|
1134
|
-
return this.assert(actual > expected, `expected ${actual} to be greater than ${expected}`, `expected ${actual} to be not greater than ${expected}`, expected, actual, false);
|
|
1135
|
-
});
|
|
1136
|
-
def("toBeGreaterThanOrEqual", function(expected) {
|
|
1137
|
-
const actual = this._obj;
|
|
1138
|
-
assertTypes(actual, "actual", ["number", "bigint"]);
|
|
1139
|
-
assertTypes(expected, "expected", ["number", "bigint"]);
|
|
1140
|
-
return this.assert(actual >= expected, `expected ${actual} to be greater than or equal to ${expected}`, `expected ${actual} to be not greater than or equal to ${expected}`, expected, actual, false);
|
|
1141
|
-
});
|
|
1142
|
-
def("toBeLessThan", function(expected) {
|
|
1143
|
-
const actual = this._obj;
|
|
1144
|
-
assertTypes(actual, "actual", ["number", "bigint"]);
|
|
1145
|
-
assertTypes(expected, "expected", ["number", "bigint"]);
|
|
1146
|
-
return this.assert(actual < expected, `expected ${actual} to be less than ${expected}`, `expected ${actual} to be not less than ${expected}`, expected, actual, false);
|
|
1147
|
-
});
|
|
1148
|
-
def("toBeLessThanOrEqual", function(expected) {
|
|
1149
|
-
const actual = this._obj;
|
|
1150
|
-
assertTypes(actual, "actual", ["number", "bigint"]);
|
|
1151
|
-
assertTypes(expected, "expected", ["number", "bigint"]);
|
|
1152
|
-
return this.assert(actual <= expected, `expected ${actual} to be less than or equal to ${expected}`, `expected ${actual} to be not less than or equal to ${expected}`, expected, actual, false);
|
|
1153
|
-
});
|
|
1154
|
-
def("toBeNaN", function() {
|
|
1155
|
-
const obj = utils.flag(this, "object");
|
|
1156
|
-
this.assert(Number.isNaN(obj), "expected #{this} to be NaN", "expected #{this} not to be NaN", Number.NaN, obj);
|
|
1157
|
-
});
|
|
1158
|
-
def("toBeUndefined", function() {
|
|
1159
|
-
const obj = utils.flag(this, "object");
|
|
1160
|
-
this.assert(undefined === obj, "expected #{this} to be undefined", "expected #{this} not to be undefined", undefined, obj);
|
|
1161
|
-
});
|
|
1162
|
-
def("toBeNull", function() {
|
|
1163
|
-
const obj = utils.flag(this, "object");
|
|
1164
|
-
this.assert(obj === null, "expected #{this} to be null", "expected #{this} not to be null", null, obj);
|
|
1165
|
-
});
|
|
1166
|
-
def("toBeDefined", function() {
|
|
1167
|
-
const obj = utils.flag(this, "object");
|
|
1168
|
-
this.assert(typeof obj !== "undefined", "expected #{this} to be defined", "expected #{this} to be undefined", obj);
|
|
1169
|
-
});
|
|
1170
|
-
def("toBeTypeOf", function(expected) {
|
|
1171
|
-
const actual = typeof this._obj;
|
|
1172
|
-
const equal = expected === actual;
|
|
1173
|
-
return this.assert(equal, "expected #{this} to be type of #{exp}", "expected #{this} not to be type of #{exp}", expected, actual);
|
|
1174
|
-
});
|
|
1175
|
-
def("toBeInstanceOf", function(obj) {
|
|
1176
|
-
return this.instanceOf(obj);
|
|
1177
|
-
});
|
|
1178
|
-
def("toHaveLength", function(length) {
|
|
1179
|
-
return this.have.length(length);
|
|
1180
|
-
});
|
|
1181
|
-
def("toHaveProperty", function(...args) {
|
|
1182
|
-
if (Array.isArray(args[0])) {
|
|
1183
|
-
args[0] = args[0].map((key) => String(key).replace(/([.[\]])/g, "\\$1")).join(".");
|
|
1184
|
-
}
|
|
1185
|
-
const actual = this._obj;
|
|
1186
|
-
const [propertyName, expected] = args;
|
|
1187
|
-
const getValue = () => {
|
|
1188
|
-
const hasOwn = Object.prototype.hasOwnProperty.call(actual, propertyName);
|
|
1189
|
-
if (hasOwn) {
|
|
1190
|
-
return {
|
|
1191
|
-
value: actual[propertyName],
|
|
1192
|
-
exists: true
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
return utils.getPathInfo(actual, propertyName);
|
|
1196
|
-
};
|
|
1197
|
-
const { value, exists } = getValue();
|
|
1198
|
-
const pass = exists && (args.length === 1 || equals(expected, value, customTesters));
|
|
1199
|
-
const valueString = args.length === 1 ? "" : ` with value ${utils.objDisplay(expected)}`;
|
|
1200
|
-
return this.assert(pass, `expected #{this} to have property "${propertyName}"${valueString}`, `expected #{this} to not have property "${propertyName}"${valueString}`, expected, exists ? value : undefined);
|
|
1201
|
-
});
|
|
1202
|
-
def("toBeCloseTo", function(received, precision = 2) {
|
|
1203
|
-
const expected = this._obj;
|
|
1204
|
-
let pass = false;
|
|
1205
|
-
let expectedDiff = 0;
|
|
1206
|
-
let receivedDiff = 0;
|
|
1207
|
-
if (received === Number.POSITIVE_INFINITY && expected === Number.POSITIVE_INFINITY) {
|
|
1208
|
-
pass = true;
|
|
1209
|
-
} else if (received === Number.NEGATIVE_INFINITY && expected === Number.NEGATIVE_INFINITY) {
|
|
1210
|
-
pass = true;
|
|
1211
|
-
} else {
|
|
1212
|
-
expectedDiff = 10 ** -precision / 2;
|
|
1213
|
-
receivedDiff = Math.abs(expected - received);
|
|
1214
|
-
pass = receivedDiff < expectedDiff;
|
|
1215
|
-
}
|
|
1216
|
-
return this.assert(pass, `expected #{this} to be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, `expected #{this} to not be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, received, expected, false);
|
|
1217
|
-
});
|
|
1218
|
-
function assertIsMock(assertion) {
|
|
1219
|
-
if (!isMockFunction(assertion._obj)) {
|
|
1220
|
-
throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
function getSpy(assertion) {
|
|
1224
|
-
assertIsMock(assertion);
|
|
1225
|
-
return assertion._obj;
|
|
1226
|
-
}
|
|
1227
|
-
def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
|
|
1228
|
-
const spy = getSpy(this);
|
|
1229
|
-
const spyName = spy.getMockName();
|
|
1230
|
-
const callCount = spy.mock.calls.length;
|
|
1231
|
-
return this.assert(callCount === number, `expected "${spyName}" to be called #{exp} times, but got ${callCount} times`, `expected "${spyName}" to not be called #{exp} times`, number, callCount, false);
|
|
1232
|
-
});
|
|
1233
|
-
def("toHaveBeenCalledOnce", function() {
|
|
1234
|
-
const spy = getSpy(this);
|
|
1235
|
-
const spyName = spy.getMockName();
|
|
1236
|
-
const callCount = spy.mock.calls.length;
|
|
1237
|
-
return this.assert(callCount === 1, `expected "${spyName}" to be called once, but got ${callCount} times`, `expected "${spyName}" to not be called once`, 1, callCount, false);
|
|
1238
|
-
});
|
|
1239
|
-
def(["toHaveBeenCalled", "toBeCalled"], function() {
|
|
1240
|
-
const spy = getSpy(this);
|
|
1241
|
-
const spyName = spy.getMockName();
|
|
1242
|
-
const callCount = spy.mock.calls.length;
|
|
1243
|
-
const called = callCount > 0;
|
|
1244
|
-
const isNot = utils.flag(this, "negate");
|
|
1245
|
-
let msg = utils.getMessage(this, [
|
|
1246
|
-
called,
|
|
1247
|
-
`expected "${spyName}" to be called at least once`,
|
|
1248
|
-
`expected "${spyName}" to not be called at all, but actually been called ${callCount} times`,
|
|
1249
|
-
true,
|
|
1250
|
-
called
|
|
1251
|
-
]);
|
|
1252
|
-
if (called && isNot) {
|
|
1253
|
-
msg = formatCalls(spy, msg);
|
|
1254
|
-
}
|
|
1255
|
-
if (called && isNot || !called && !isNot) {
|
|
1256
|
-
throw new AssertionError(msg);
|
|
1257
|
-
}
|
|
1258
|
-
});
|
|
1259
|
-
function equalsArgumentArray(a, b) {
|
|
1260
|
-
return a.length === b.length && a.every((aItem, i) => equals(aItem, b[i], [...customTesters, iterableEquality]));
|
|
1261
|
-
}
|
|
1262
|
-
def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
|
|
1263
|
-
const spy = getSpy(this);
|
|
1264
|
-
const spyName = spy.getMockName();
|
|
1265
|
-
const pass = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
|
|
1266
|
-
const isNot = utils.flag(this, "negate");
|
|
1267
|
-
const msg = utils.getMessage(this, [
|
|
1268
|
-
pass,
|
|
1269
|
-
`expected "${spyName}" to be called with arguments: #{exp}`,
|
|
1270
|
-
`expected "${spyName}" to not be called with arguments: #{exp}`,
|
|
1271
|
-
args
|
|
1272
|
-
]);
|
|
1273
|
-
if (pass && isNot || !pass && !isNot) {
|
|
1274
|
-
throw new AssertionError(formatCalls(spy, msg, args));
|
|
1275
|
-
}
|
|
1276
|
-
});
|
|
1277
|
-
def("toHaveBeenCalledExactlyOnceWith", function(...args) {
|
|
1278
|
-
const spy = getSpy(this);
|
|
1279
|
-
const spyName = spy.getMockName();
|
|
1280
|
-
const callCount = spy.mock.calls.length;
|
|
1281
|
-
const hasCallWithArgs = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args));
|
|
1282
|
-
const pass = hasCallWithArgs && callCount === 1;
|
|
1283
|
-
const isNot = utils.flag(this, "negate");
|
|
1284
|
-
const msg = utils.getMessage(this, [
|
|
1285
|
-
pass,
|
|
1286
|
-
`expected "${spyName}" to be called once with arguments: #{exp}`,
|
|
1287
|
-
`expected "${spyName}" to not be called once with arguments: #{exp}`,
|
|
1288
|
-
args
|
|
1289
|
-
]);
|
|
1290
|
-
if (pass && isNot || !pass && !isNot) {
|
|
1291
|
-
throw new AssertionError(formatCalls(spy, msg, args));
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
def(["toHaveBeenNthCalledWith", "nthCalledWith"], function(times, ...args) {
|
|
1295
|
-
const spy = getSpy(this);
|
|
1296
|
-
const spyName = spy.getMockName();
|
|
1297
|
-
const nthCall = spy.mock.calls[times - 1];
|
|
1298
|
-
const callCount = spy.mock.calls.length;
|
|
1299
|
-
const isCalled = times <= callCount;
|
|
1300
|
-
this.assert(nthCall && equalsArgumentArray(nthCall, args), `expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`, `expected ${ordinalOf(times)} "${spyName}" call to not have been called with #{exp}`, args, nthCall, isCalled);
|
|
1301
|
-
});
|
|
1302
|
-
def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
|
|
1303
|
-
const spy = getSpy(this);
|
|
1304
|
-
const spyName = spy.getMockName();
|
|
1305
|
-
const lastCall = spy.mock.calls[spy.mock.calls.length - 1];
|
|
1306
|
-
this.assert(lastCall && equalsArgumentArray(lastCall, args), `expected last "${spyName}" call to have been called with #{exp}`, `expected last "${spyName}" call to not have been called with #{exp}`, args, lastCall);
|
|
1307
|
-
});
|
|
1308
|
-
/**
|
|
1309
|
-
* Used for `toHaveBeenCalledBefore` and `toHaveBeenCalledAfter` to determine if the expected spy was called before the result spy.
|
|
1310
|
-
*/
|
|
1311
|
-
function isSpyCalledBeforeAnotherSpy(beforeSpy, afterSpy, failIfNoFirstInvocation) {
|
|
1312
|
-
const beforeInvocationCallOrder = beforeSpy.mock.invocationCallOrder;
|
|
1313
|
-
const afterInvocationCallOrder = afterSpy.mock.invocationCallOrder;
|
|
1314
|
-
if (beforeInvocationCallOrder.length === 0) {
|
|
1315
|
-
return !failIfNoFirstInvocation;
|
|
1316
|
-
}
|
|
1317
|
-
if (afterInvocationCallOrder.length === 0) {
|
|
1318
|
-
return false;
|
|
1319
|
-
}
|
|
1320
|
-
return beforeInvocationCallOrder[0] < afterInvocationCallOrder[0];
|
|
1321
|
-
}
|
|
1322
|
-
def(["toHaveBeenCalledBefore"], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
1323
|
-
const expectSpy = getSpy(this);
|
|
1324
|
-
if (!isMockFunction(resultSpy)) {
|
|
1325
|
-
throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
1326
|
-
}
|
|
1327
|
-
this.assert(isSpyCalledBeforeAnotherSpy(expectSpy, resultSpy, failIfNoFirstInvocation), `expected "${expectSpy.getMockName()}" to have been called before "${resultSpy.getMockName()}"`, `expected "${expectSpy.getMockName()}" to not have been called before "${resultSpy.getMockName()}"`, resultSpy, expectSpy);
|
|
1328
|
-
});
|
|
1329
|
-
def(["toHaveBeenCalledAfter"], function(resultSpy, failIfNoFirstInvocation = true) {
|
|
1330
|
-
const expectSpy = getSpy(this);
|
|
1331
|
-
if (!isMockFunction(resultSpy)) {
|
|
1332
|
-
throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`);
|
|
1333
|
-
}
|
|
1334
|
-
this.assert(isSpyCalledBeforeAnotherSpy(resultSpy, expectSpy, failIfNoFirstInvocation), `expected "${expectSpy.getMockName()}" to have been called after "${resultSpy.getMockName()}"`, `expected "${expectSpy.getMockName()}" to not have been called after "${resultSpy.getMockName()}"`, resultSpy, expectSpy);
|
|
1335
|
-
});
|
|
1336
|
-
def(["toThrow", "toThrowError"], function(expected) {
|
|
1337
|
-
if (typeof expected === "string" || typeof expected === "undefined" || expected instanceof RegExp) {
|
|
1338
|
-
return this.throws(expected === "" ? /^$/ : expected);
|
|
1339
|
-
}
|
|
1340
|
-
const obj = this._obj;
|
|
1341
|
-
const promise = utils.flag(this, "promise");
|
|
1342
|
-
const isNot = utils.flag(this, "negate");
|
|
1343
|
-
let thrown = null;
|
|
1344
|
-
if (promise === "rejects") {
|
|
1345
|
-
thrown = obj;
|
|
1346
|
-
} else if (promise === "resolves" && typeof obj !== "function") {
|
|
1347
|
-
if (!isNot) {
|
|
1348
|
-
const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't";
|
|
1349
|
-
const error = { showDiff: false };
|
|
1350
|
-
throw new AssertionError(message, error, utils.flag(this, "ssfi"));
|
|
1351
|
-
} else {
|
|
1352
|
-
return;
|
|
1353
|
-
}
|
|
1354
|
-
} else {
|
|
1355
|
-
let isThrow = false;
|
|
1356
|
-
try {
|
|
1357
|
-
obj();
|
|
1358
|
-
} catch (err) {
|
|
1359
|
-
isThrow = true;
|
|
1360
|
-
thrown = err;
|
|
1361
|
-
}
|
|
1362
|
-
if (!isThrow && !isNot) {
|
|
1363
|
-
const message = utils.flag(this, "message") || "expected function to throw an error, but it didn't";
|
|
1364
|
-
const error = { showDiff: false };
|
|
1365
|
-
throw new AssertionError(message, error, utils.flag(this, "ssfi"));
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
if (typeof expected === "function") {
|
|
1369
|
-
const name = expected.name || expected.prototype.constructor.name;
|
|
1370
|
-
return this.assert(thrown && thrown instanceof expected, `expected error to be instance of ${name}`, `expected error not to be instance of ${name}`, expected, thrown);
|
|
1371
|
-
}
|
|
1372
|
-
if (expected instanceof Error) {
|
|
1373
|
-
const equal = equals(thrown, expected, [...customTesters, iterableEquality]);
|
|
1374
|
-
return this.assert(equal, "expected a thrown error to be #{exp}", "expected a thrown error not to be #{exp}", expected, thrown);
|
|
1375
|
-
}
|
|
1376
|
-
if (typeof expected === "object" && "asymmetricMatch" in expected && typeof expected.asymmetricMatch === "function") {
|
|
1377
|
-
const matcher = expected;
|
|
1378
|
-
return this.assert(thrown && matcher.asymmetricMatch(thrown), "expected error to match asymmetric matcher", "expected error not to match asymmetric matcher", matcher, thrown);
|
|
1379
|
-
}
|
|
1380
|
-
throw new Error(`"toThrow" expects string, RegExp, function, Error instance or asymmetric matcher, got "${typeof expected}"`);
|
|
1381
|
-
});
|
|
1382
|
-
[{
|
|
1383
|
-
name: "toHaveResolved",
|
|
1384
|
-
condition: (spy) => spy.mock.settledResults.length > 0 && spy.mock.settledResults.some(({ type }) => type === "fulfilled"),
|
|
1385
|
-
action: "resolved"
|
|
1386
|
-
}, {
|
|
1387
|
-
name: ["toHaveReturned", "toReturn"],
|
|
1388
|
-
condition: (spy) => spy.mock.calls.length > 0 && spy.mock.results.some(({ type }) => type !== "throw"),
|
|
1389
|
-
action: "called"
|
|
1390
|
-
}].forEach(({ name, condition, action }) => {
|
|
1391
|
-
def(name, function() {
|
|
1392
|
-
const spy = getSpy(this);
|
|
1393
|
-
const spyName = spy.getMockName();
|
|
1394
|
-
const pass = condition(spy);
|
|
1395
|
-
this.assert(pass, `expected "${spyName}" to be successfully ${action} at least once`, `expected "${spyName}" to not be successfully ${action}`, pass, !pass, false);
|
|
1396
|
-
});
|
|
1397
|
-
});
|
|
1398
|
-
[{
|
|
1399
|
-
name: "toHaveResolvedTimes",
|
|
1400
|
-
condition: (spy, times) => spy.mock.settledResults.reduce((s, { type }) => type === "fulfilled" ? ++s : s, 0) === times,
|
|
1401
|
-
action: "resolved"
|
|
1402
|
-
}, {
|
|
1403
|
-
name: ["toHaveReturnedTimes", "toReturnTimes"],
|
|
1404
|
-
condition: (spy, times) => spy.mock.results.reduce((s, { type }) => type === "throw" ? s : ++s, 0) === times,
|
|
1405
|
-
action: "called"
|
|
1406
|
-
}].forEach(({ name, condition, action }) => {
|
|
1407
|
-
def(name, function(times) {
|
|
1408
|
-
const spy = getSpy(this);
|
|
1409
|
-
const spyName = spy.getMockName();
|
|
1410
|
-
const pass = condition(spy, times);
|
|
1411
|
-
this.assert(pass, `expected "${spyName}" to be successfully ${action} ${times} times`, `expected "${spyName}" to not be successfully ${action} ${times} times`, `expected resolved times: ${times}`, `received resolved times: ${pass}`, false);
|
|
1412
|
-
});
|
|
1413
|
-
});
|
|
1414
|
-
[{
|
|
1415
|
-
name: "toHaveResolvedWith",
|
|
1416
|
-
condition: (spy, value) => spy.mock.settledResults.some(({ type, value: result }) => type === "fulfilled" && equals(value, result)),
|
|
1417
|
-
action: "resolve"
|
|
1418
|
-
}, {
|
|
1419
|
-
name: ["toHaveReturnedWith", "toReturnWith"],
|
|
1420
|
-
condition: (spy, value) => spy.mock.results.some(({ type, value: result }) => type === "return" && equals(value, result)),
|
|
1421
|
-
action: "return"
|
|
1422
|
-
}].forEach(({ name, condition, action }) => {
|
|
1423
|
-
def(name, function(value) {
|
|
1424
|
-
const spy = getSpy(this);
|
|
1425
|
-
const pass = condition(spy, value);
|
|
1426
|
-
const isNot = utils.flag(this, "negate");
|
|
1427
|
-
if (pass && isNot || !pass && !isNot) {
|
|
1428
|
-
const spyName = spy.getMockName();
|
|
1429
|
-
const msg = utils.getMessage(this, [
|
|
1430
|
-
pass,
|
|
1431
|
-
`expected "${spyName}" to ${action} with: #{exp} at least once`,
|
|
1432
|
-
`expected "${spyName}" to not ${action} with: #{exp}`,
|
|
1433
|
-
value
|
|
1434
|
-
]);
|
|
1435
|
-
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
1436
|
-
throw new AssertionError(formatReturns(spy, results, msg, value));
|
|
1437
|
-
}
|
|
1438
|
-
});
|
|
1439
|
-
});
|
|
1440
|
-
[{
|
|
1441
|
-
name: "toHaveLastResolvedWith",
|
|
1442
|
-
condition: (spy, value) => {
|
|
1443
|
-
const result = spy.mock.settledResults[spy.mock.settledResults.length - 1];
|
|
1444
|
-
return result && result.type === "fulfilled" && equals(result.value, value);
|
|
1445
|
-
},
|
|
1446
|
-
action: "resolve"
|
|
1447
|
-
}, {
|
|
1448
|
-
name: ["toHaveLastReturnedWith", "lastReturnedWith"],
|
|
1449
|
-
condition: (spy, value) => {
|
|
1450
|
-
const result = spy.mock.results[spy.mock.results.length - 1];
|
|
1451
|
-
return result && result.type === "return" && equals(result.value, value);
|
|
1452
|
-
},
|
|
1453
|
-
action: "return"
|
|
1454
|
-
}].forEach(({ name, condition, action }) => {
|
|
1455
|
-
def(name, function(value) {
|
|
1456
|
-
const spy = getSpy(this);
|
|
1457
|
-
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
1458
|
-
const result = results[results.length - 1];
|
|
1459
|
-
const spyName = spy.getMockName();
|
|
1460
|
-
this.assert(condition(spy, value), `expected last "${spyName}" call to ${action} #{exp}`, `expected last "${spyName}" call to not ${action} #{exp}`, value, result === null || result === void 0 ? void 0 : result.value);
|
|
1461
|
-
});
|
|
1462
|
-
});
|
|
1463
|
-
[{
|
|
1464
|
-
name: "toHaveNthResolvedWith",
|
|
1465
|
-
condition: (spy, index, value) => {
|
|
1466
|
-
const result = spy.mock.settledResults[index - 1];
|
|
1467
|
-
return result && result.type === "fulfilled" && equals(result.value, value);
|
|
1468
|
-
},
|
|
1469
|
-
action: "resolve"
|
|
1470
|
-
}, {
|
|
1471
|
-
name: ["toHaveNthReturnedWith", "nthReturnedWith"],
|
|
1472
|
-
condition: (spy, index, value) => {
|
|
1473
|
-
const result = spy.mock.results[index - 1];
|
|
1474
|
-
return result && result.type === "return" && equals(result.value, value);
|
|
1475
|
-
},
|
|
1476
|
-
action: "return"
|
|
1477
|
-
}].forEach(({ name, condition, action }) => {
|
|
1478
|
-
def(name, function(nthCall, value) {
|
|
1479
|
-
const spy = getSpy(this);
|
|
1480
|
-
const spyName = spy.getMockName();
|
|
1481
|
-
const results = action === "return" ? spy.mock.results : spy.mock.settledResults;
|
|
1482
|
-
const result = results[nthCall - 1];
|
|
1483
|
-
const ordinalCall = `${ordinalOf(nthCall)} call`;
|
|
1484
|
-
this.assert(condition(spy, nthCall, value), `expected ${ordinalCall} "${spyName}" call to ${action} #{exp}`, `expected ${ordinalCall} "${spyName}" call to not ${action} #{exp}`, value, result === null || result === void 0 ? void 0 : result.value);
|
|
1485
|
-
});
|
|
1486
|
-
});
|
|
1487
|
-
def("withContext", function(context) {
|
|
1488
|
-
for (const key in context) {
|
|
1489
|
-
utils.flag(this, key, context[key]);
|
|
1490
|
-
}
|
|
1491
|
-
return this;
|
|
1492
|
-
});
|
|
1493
|
-
utils.addProperty(chai.Assertion.prototype, "resolves", function __VITEST_RESOLVES__() {
|
|
1494
|
-
const error = new Error("resolves");
|
|
1495
|
-
utils.flag(this, "promise", "resolves");
|
|
1496
|
-
utils.flag(this, "error", error);
|
|
1497
|
-
const test = utils.flag(this, "vitest-test");
|
|
1498
|
-
const obj = utils.flag(this, "object");
|
|
1499
|
-
if (utils.flag(this, "poll")) {
|
|
1500
|
-
throw new SyntaxError(`expect.poll() is not supported in combination with .resolves`);
|
|
1501
|
-
}
|
|
1502
|
-
if (typeof (obj === null || obj === void 0 ? void 0 : obj.then) !== "function") {
|
|
1503
|
-
throw new TypeError(`You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`);
|
|
1504
|
-
}
|
|
1505
|
-
const proxy = new Proxy(this, { get: (target, key, receiver) => {
|
|
1506
|
-
const result = Reflect.get(target, key, receiver);
|
|
1507
|
-
if (typeof result !== "function") {
|
|
1508
|
-
return result instanceof chai.Assertion ? proxy : result;
|
|
1509
|
-
}
|
|
1510
|
-
return (...args) => {
|
|
1511
|
-
utils.flag(this, "_name", key);
|
|
1512
|
-
const promise = obj.then((value) => {
|
|
1513
|
-
utils.flag(this, "object", value);
|
|
1514
|
-
return result.call(this, ...args);
|
|
1515
|
-
}, (err) => {
|
|
1516
|
-
const _error = new AssertionError(`promise rejected "${utils.inspect(err)}" instead of resolving`, { showDiff: false });
|
|
1517
|
-
_error.cause = err;
|
|
1518
|
-
_error.stack = error.stack.replace(error.message, _error.message);
|
|
1519
|
-
throw _error;
|
|
1520
|
-
});
|
|
1521
|
-
return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error);
|
|
1522
|
-
};
|
|
1523
|
-
} });
|
|
1524
|
-
return proxy;
|
|
1525
|
-
});
|
|
1526
|
-
utils.addProperty(chai.Assertion.prototype, "rejects", function __VITEST_REJECTS__() {
|
|
1527
|
-
const error = new Error("rejects");
|
|
1528
|
-
utils.flag(this, "promise", "rejects");
|
|
1529
|
-
utils.flag(this, "error", error);
|
|
1530
|
-
const test = utils.flag(this, "vitest-test");
|
|
1531
|
-
const obj = utils.flag(this, "object");
|
|
1532
|
-
const wrapper = typeof obj === "function" ? obj() : obj;
|
|
1533
|
-
if (utils.flag(this, "poll")) {
|
|
1534
|
-
throw new SyntaxError(`expect.poll() is not supported in combination with .rejects`);
|
|
1535
|
-
}
|
|
1536
|
-
if (typeof (wrapper === null || wrapper === void 0 ? void 0 : wrapper.then) !== "function") {
|
|
1537
|
-
throw new TypeError(`You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`);
|
|
1538
|
-
}
|
|
1539
|
-
const proxy = new Proxy(this, { get: (target, key, receiver) => {
|
|
1540
|
-
const result = Reflect.get(target, key, receiver);
|
|
1541
|
-
if (typeof result !== "function") {
|
|
1542
|
-
return result instanceof chai.Assertion ? proxy : result;
|
|
1543
|
-
}
|
|
1544
|
-
return (...args) => {
|
|
1545
|
-
utils.flag(this, "_name", key);
|
|
1546
|
-
const promise = wrapper.then((value) => {
|
|
1547
|
-
const _error = new AssertionError(`promise resolved "${utils.inspect(value)}" instead of rejecting`, {
|
|
1548
|
-
showDiff: true,
|
|
1549
|
-
expected: new Error("rejected promise"),
|
|
1550
|
-
actual: value
|
|
1551
|
-
});
|
|
1552
|
-
_error.stack = error.stack.replace(error.message, _error.message);
|
|
1553
|
-
throw _error;
|
|
1554
|
-
}, (err) => {
|
|
1555
|
-
utils.flag(this, "object", err);
|
|
1556
|
-
return result.call(this, ...args);
|
|
1557
|
-
});
|
|
1558
|
-
return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error);
|
|
1559
|
-
};
|
|
1560
|
-
} });
|
|
1561
|
-
return proxy;
|
|
1562
|
-
});
|
|
1563
|
-
};
|
|
1564
|
-
function ordinalOf(i) {
|
|
1565
|
-
const j = i % 10;
|
|
1566
|
-
const k = i % 100;
|
|
1567
|
-
if (j === 1 && k !== 11) {
|
|
1568
|
-
return `${i}st`;
|
|
1569
|
-
}
|
|
1570
|
-
if (j === 2 && k !== 12) {
|
|
1571
|
-
return `${i}nd`;
|
|
1572
|
-
}
|
|
1573
|
-
if (j === 3 && k !== 13) {
|
|
1574
|
-
return `${i}rd`;
|
|
1575
|
-
}
|
|
1576
|
-
return `${i}th`;
|
|
1577
|
-
}
|
|
1578
|
-
function formatCalls(spy, msg, showActualCall) {
|
|
1579
|
-
if (spy.mock.calls.length) {
|
|
1580
|
-
msg += u.gray(`\n\nReceived: \n\n${spy.mock.calls.map((callArg, i) => {
|
|
1581
|
-
let methodCall = u.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:\n\n`);
|
|
1582
|
-
if (showActualCall) {
|
|
1583
|
-
methodCall += diff(showActualCall, callArg, { omitAnnotationLines: true });
|
|
1584
|
-
} else {
|
|
1585
|
-
methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");
|
|
1586
|
-
}
|
|
1587
|
-
methodCall += "\n";
|
|
1588
|
-
return methodCall;
|
|
1589
|
-
}).join("\n")}`);
|
|
1590
|
-
}
|
|
1591
|
-
msg += u.gray(`\n\nNumber of calls: ${u.bold(spy.mock.calls.length)}\n`);
|
|
1592
|
-
return msg;
|
|
1593
|
-
}
|
|
1594
|
-
function formatReturns(spy, results, msg, showActualReturn) {
|
|
1595
|
-
if (results.length) {
|
|
1596
|
-
msg += u.gray(`\n\nReceived: \n\n${results.map((callReturn, i) => {
|
|
1597
|
-
let methodCall = u.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:\n\n`);
|
|
1598
|
-
if (showActualReturn) {
|
|
1599
|
-
methodCall += diff(showActualReturn, callReturn.value, { omitAnnotationLines: true });
|
|
1600
|
-
} else {
|
|
1601
|
-
methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n");
|
|
1602
|
-
}
|
|
1603
|
-
methodCall += "\n";
|
|
1604
|
-
return methodCall;
|
|
1605
|
-
}).join("\n")}`);
|
|
1606
|
-
}
|
|
1607
|
-
msg += u.gray(`\n\nNumber of calls: ${u.bold(spy.mock.calls.length)}\n`);
|
|
1608
|
-
return msg;
|
|
1609
|
-
}
|
|
1610
|
-
function getMatcherState(assertion, expect) {
|
|
1611
|
-
const obj = assertion._obj;
|
|
1612
|
-
const isNot = utils_exports.flag(assertion, "negate");
|
|
1613
|
-
const promise = utils_exports.flag(assertion, "promise") || "";
|
|
1614
|
-
const jestUtils = {
|
|
1615
|
-
...getMatcherUtils(),
|
|
1616
|
-
diff,
|
|
1617
|
-
stringify,
|
|
1618
|
-
iterableEquality,
|
|
1619
|
-
subsetEquality
|
|
1620
|
-
};
|
|
1621
|
-
const matcherState = {
|
|
1622
|
-
...getState(expect),
|
|
1623
|
-
customTesters: getCustomEqualityTesters(),
|
|
1624
|
-
isNot,
|
|
1625
|
-
utils: jestUtils,
|
|
1626
|
-
promise,
|
|
1627
|
-
equals,
|
|
1628
|
-
suppressedErrors: [],
|
|
1629
|
-
soft: utils_exports.flag(assertion, "soft"),
|
|
1630
|
-
poll: utils_exports.flag(assertion, "poll")
|
|
1631
|
-
};
|
|
1632
|
-
return {
|
|
1633
|
-
state: matcherState,
|
|
1634
|
-
isNot,
|
|
1635
|
-
obj
|
|
1636
|
-
};
|
|
1637
|
-
}
|
|
1638
|
-
var JestExtendError = class extends Error {
|
|
1639
|
-
constructor(message, actual, expected) {
|
|
1640
|
-
super(message);
|
|
1641
|
-
this.actual = actual;
|
|
1642
|
-
this.expected = expected;
|
|
1643
|
-
}
|
|
1644
|
-
};
|
|
1645
|
-
function JestExtendPlugin(c, expect, matchers) {
|
|
1646
|
-
return (_, utils) => {
|
|
1647
|
-
Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
|
|
1648
|
-
function expectWrapper(...args) {
|
|
1649
|
-
const { state, isNot, obj } = getMatcherState(this, expect);
|
|
1650
|
-
const result = expectAssertion.call(state, obj, ...args);
|
|
1651
|
-
if (result && typeof result === "object" && typeof result.then === "function") {
|
|
1652
|
-
const thenable = result;
|
|
1653
|
-
return thenable.then(({ pass: pass$1, message: message$1, actual: actual$1, expected: expected$1 }) => {
|
|
1654
|
-
if (pass$1 && isNot || !pass$1 && !isNot) {
|
|
1655
|
-
throw new JestExtendError(message$1(), actual$1, expected$1);
|
|
1656
|
-
}
|
|
1657
|
-
});
|
|
1658
|
-
}
|
|
1659
|
-
const { pass, message, actual, expected } = result;
|
|
1660
|
-
if (pass && isNot || !pass && !isNot) {
|
|
1661
|
-
throw new JestExtendError(message(), actual, expected);
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
const softWrapper = wrapAssertion(utils, expectAssertionName, expectWrapper);
|
|
1665
|
-
utils.addMethod(globalThis[JEST_MATCHERS_OBJECT].matchers, expectAssertionName, softWrapper);
|
|
1666
|
-
utils.addMethod(c.Assertion.prototype, expectAssertionName, softWrapper);
|
|
1667
|
-
class CustomMatcher extends AsymmetricMatcher {
|
|
1668
|
-
constructor(inverse = false, ...sample) {
|
|
1669
|
-
super(sample, inverse);
|
|
1670
|
-
}
|
|
1671
|
-
asymmetricMatch(other) {
|
|
1672
|
-
const { pass } = expectAssertion.call(this.getMatcherContext(expect), other, ...this.sample);
|
|
1673
|
-
return this.inverse ? !pass : pass;
|
|
1674
|
-
}
|
|
1675
|
-
toString() {
|
|
1676
|
-
return `${this.inverse ? "not." : ""}${expectAssertionName}`;
|
|
1677
|
-
}
|
|
1678
|
-
getExpectedType() {
|
|
1679
|
-
return "any";
|
|
1680
|
-
}
|
|
1681
|
-
toAsymmetricMatcher() {
|
|
1682
|
-
return `${this.toString()}<${this.sample.map((item) => stringify(item)).join(", ")}>`;
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
const customMatcher = (...sample) => new CustomMatcher(false, ...sample);
|
|
1686
|
-
Object.defineProperty(expect, expectAssertionName, {
|
|
1687
|
-
configurable: true,
|
|
1688
|
-
enumerable: true,
|
|
1689
|
-
value: customMatcher,
|
|
1690
|
-
writable: true
|
|
1691
|
-
});
|
|
1692
|
-
Object.defineProperty(expect.not, expectAssertionName, {
|
|
1693
|
-
configurable: true,
|
|
1694
|
-
enumerable: true,
|
|
1695
|
-
value: (...sample) => new CustomMatcher(true, ...sample),
|
|
1696
|
-
writable: true
|
|
1697
|
-
});
|
|
1698
|
-
Object.defineProperty(globalThis[ASYMMETRIC_MATCHERS_OBJECT], expectAssertionName, {
|
|
1699
|
-
configurable: true,
|
|
1700
|
-
enumerable: true,
|
|
1701
|
-
value: customMatcher,
|
|
1702
|
-
writable: true
|
|
1703
|
-
});
|
|
1704
|
-
});
|
|
1705
|
-
};
|
|
1706
|
-
}
|
|
1707
|
-
const JestExtend = (chai, utils) => {
|
|
1708
|
-
utils.addMethod(chai.expect, "extend", (expect, expects) => {
|
|
1709
|
-
use(JestExtendPlugin(chai, expect, expects));
|
|
1710
|
-
});
|
|
1711
|
-
};
|
|
1712
|
-
|
|
1713
|
-
//#endregion
|
|
1714
|
-
export { ASYMMETRIC_MATCHERS_OBJECT, GLOBAL_EXPECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, addCustomEqualityTesters, customMatchers, equals, getState, iterableEquality, setState, subsetEquality };
|