@budibase/backend-core 2.9.39-alpha.8 → 2.9.39
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/jest.config.js +25 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/package.json +5 -5
- package/dist/src/accounts/accounts.js +75 -92
- package/dist/src/accounts/accounts.js.map +1 -7
- package/dist/src/accounts/api.js +85 -71
- package/dist/src/accounts/api.js.map +1 -7
- package/dist/src/accounts/index.js +16 -21
- package/dist/src/accounts/index.js.map +1 -7
- package/dist/src/auth/auth.js +178 -197
- package/dist/src/auth/auth.js.map +1 -7
- package/dist/src/auth/index.js +16 -21
- package/dist/src/auth/index.js.map +1 -7
- package/dist/src/blacklist/blacklist.js +69 -81
- package/dist/src/blacklist/blacklist.js.map +1 -7
- package/dist/src/blacklist/index.js +16 -21
- package/dist/src/blacklist/index.js.map +1 -7
- package/dist/src/cache/appMetadata.js +88 -78
- package/dist/src/cache/appMetadata.js.map +1 -7
- package/dist/src/cache/base/index.js +110 -92
- package/dist/src/cache/base/index.js.map +1 -7
- package/dist/src/cache/generic.js +26 -64
- package/dist/src/cache/generic.js.map +1 -7
- package/dist/src/cache/index.js +32 -48
- package/dist/src/cache/index.js.map +1 -7
- package/dist/src/cache/user.js +115 -91
- package/dist/src/cache/user.js.map +1 -7
- package/dist/src/cache/writethrough.js +144 -129
- package/dist/src/cache/writethrough.js.map +1 -7
- package/dist/src/configs/configs.js +265 -215
- package/dist/src/configs/configs.js.map +1 -7
- package/dist/src/configs/index.js +16 -21
- package/dist/src/configs/index.js.map +1 -7
- package/dist/src/constants/db.js +64 -104
- package/dist/src/constants/db.js.map +1 -7
- package/dist/src/constants/index.js +17 -23
- package/dist/src/constants/index.js.map +1 -7
- package/dist/src/constants/misc.js +53 -91
- package/dist/src/constants/misc.js.map +1 -7
- package/dist/src/context/Context.js +11 -33
- package/dist/src/context/Context.js.map +1 -7
- package/dist/src/context/identity.js +60 -75
- package/dist/src/context/identity.js.map +1 -7
- package/dist/src/context/index.js +31 -42
- package/dist/src/context/index.js.map +1 -7
- package/dist/src/context/mainContext.js +275 -264
- package/dist/src/context/mainContext.js.map +1 -7
- package/dist/src/context/types.js +2 -16
- package/dist/src/context/types.js.map +1 -7
- package/dist/src/db/Replication.js +81 -85
- package/dist/src/db/Replication.js.map +1 -7
- package/dist/src/db/constants.js +11 -37
- package/dist/src/db/constants.js.map +1 -7
- package/dist/src/db/couch/DatabaseImpl.js +236 -212
- package/dist/src/db/couch/DatabaseImpl.js.map +1 -7
- package/dist/src/db/couch/connections.js +81 -96
- package/dist/src/db/couch/connections.js.map +1 -7
- package/dist/src/db/couch/index.js +25 -42
- package/dist/src/db/couch/index.js.map +1 -7
- package/dist/src/db/couch/pouchDB.js +93 -103
- package/dist/src/db/couch/pouchDB.js.map +1 -7
- package/dist/src/db/couch/pouchDump.js +1 -1
- package/dist/src/db/couch/pouchDump.js.map +1 -7
- package/dist/src/db/couch/utils.js +49 -70
- package/dist/src/db/couch/utils.js.map +1 -7
- package/dist/src/db/db.js +49 -63
- package/dist/src/db/db.js.map +1 -7
- package/dist/src/db/errors.js +17 -38
- package/dist/src/db/errors.js.map +1 -7
- package/dist/src/db/index.js +45 -61
- package/dist/src/db/index.js.map +1 -7
- package/dist/src/db/lucene.js +655 -582
- package/dist/src/db/lucene.js.map +1 -7
- package/dist/src/db/searchIndexes/index.js +16 -21
- package/dist/src/db/searchIndexes/index.js.map +1 -7
- package/dist/src/db/searchIndexes/searchIndexes.js +72 -77
- package/dist/src/db/searchIndexes/searchIndexes.js.map +1 -7
- package/dist/src/db/utils.js +199 -184
- package/dist/src/db/utils.js.map +1 -7
- package/dist/src/db/views.js +187 -191
- package/dist/src/db/views.js.map +1 -7
- package/dist/src/docIds/conversions.js +48 -69
- package/dist/src/docIds/conversions.js.map +1 -7
- package/dist/src/docIds/ids.js +87 -76
- package/dist/src/docIds/ids.js.map +1 -7
- package/dist/src/docIds/index.js +17 -23
- package/dist/src/docIds/index.js.map +1 -7
- package/dist/src/docIds/newid.js +6 -29
- package/dist/src/docIds/newid.js.map +1 -7
- package/dist/src/docIds/params.js +111 -109
- package/dist/src/docIds/params.js.map +1 -7
- package/dist/src/docUpdates/index.js +29 -54
- package/dist/src/docUpdates/index.js.map +1 -7
- package/dist/src/environment.js +81 -152
- package/dist/src/environment.js.map +1 -7
- package/dist/src/errors/errors.js +77 -106
- package/dist/src/errors/errors.js.map +1 -7
- package/dist/src/errors/index.js +16 -21
- package/dist/src/errors/index.js.map +1 -7
- package/dist/src/events/analytics.js +38 -38
- package/dist/src/events/analytics.js.map +1 -7
- package/dist/src/events/asyncEvents/index.js +17 -23
- package/dist/src/events/asyncEvents/index.js.map +1 -7
- package/dist/src/events/asyncEvents/publisher.js +24 -36
- package/dist/src/events/asyncEvents/publisher.js.map +1 -7
- package/dist/src/events/asyncEvents/queue.js +21 -37
- package/dist/src/events/asyncEvents/queue.js.map +1 -7
- package/dist/src/events/backfill.js +170 -163
- package/dist/src/events/backfill.js.map +1 -7
- package/dist/src/events/documentId.js +23 -46
- package/dist/src/events/documentId.js.map +1 -7
- package/dist/src/events/events.js +68 -58
- package/dist/src/events/events.js.map +1 -7
- package/dist/src/events/identification.js +279 -254
- package/dist/src/events/identification.js.map +1 -7
- package/dist/src/events/index.js +42 -57
- package/dist/src/events/index.js.map +1 -7
- package/dist/src/events/processors/AnalyticsProcessor.js +81 -64
- package/dist/src/events/processors/AnalyticsProcessor.js.map +1 -7
- package/dist/src/events/processors/AuditLogsProcessor.js +79 -90
- package/dist/src/events/processors/AuditLogsProcessor.js.map +1 -7
- package/dist/src/events/processors/LoggingProcessor.js +39 -50
- package/dist/src/events/processors/LoggingProcessor.js.map +1 -7
- package/dist/src/events/processors/Processors.js +44 -49
- package/dist/src/events/processors/Processors.js.map +1 -7
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js +37 -46
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +1 -7
- package/dist/src/events/processors/index.js +18 -52
- package/dist/src/events/processors/index.js.map +1 -7
- package/dist/src/events/processors/posthog/PosthogProcessor.js +126 -113
- package/dist/src/events/processors/posthog/PosthogProcessor.js.map +1 -7
- package/dist/src/events/processors/posthog/index.js +6 -34
- package/dist/src/events/processors/posthog/index.js.map +1 -7
- package/dist/src/events/processors/posthog/rateLimiting.js +104 -90
- package/dist/src/events/processors/posthog/rateLimiting.js.map +1 -7
- package/dist/src/events/processors/types.js +2 -28
- package/dist/src/events/processors/types.js.map +1 -7
- package/dist/src/events/publishers/account.js +37 -43
- package/dist/src/events/publishers/account.js.map +1 -7
- package/dist/src/events/publishers/app.js +139 -131
- package/dist/src/events/publishers/app.js.map +1 -7
- package/dist/src/events/publishers/auditLog.js +29 -37
- package/dist/src/events/publishers/auditLog.js.map +1 -7
- package/dist/src/events/publishers/auth.js +71 -71
- package/dist/src/events/publishers/auth.js.map +1 -7
- package/dist/src/events/publishers/automation.js +108 -102
- package/dist/src/events/publishers/automation.js.map +1 -7
- package/dist/src/events/publishers/backfill.js +75 -82
- package/dist/src/events/publishers/backfill.js.map +1 -7
- package/dist/src/events/publishers/backup.js +36 -44
- package/dist/src/events/publishers/backup.js.map +1 -7
- package/dist/src/events/publishers/datasource.js +46 -51
- package/dist/src/events/publishers/datasource.js.map +1 -7
- package/dist/src/events/publishers/email.js +25 -33
- package/dist/src/events/publishers/email.js.map +1 -7
- package/dist/src/events/publishers/environmentVariable.js +38 -47
- package/dist/src/events/publishers/environmentVariable.js.map +1 -7
- package/dist/src/events/publishers/group.js +97 -95
- package/dist/src/events/publishers/group.js.map +1 -7
- package/dist/src/events/publishers/index.js +53 -106
- package/dist/src/events/publishers/index.js.map +1 -7
- package/dist/src/events/publishers/installation.js +45 -49
- package/dist/src/events/publishers/installation.js.map +1 -7
- package/dist/src/events/publishers/layout.js +29 -37
- package/dist/src/events/publishers/layout.js.map +1 -7
- package/dist/src/events/publishers/license.js +67 -68
- package/dist/src/events/publishers/license.js.map +1 -7
- package/dist/src/events/publishers/org.js +44 -45
- package/dist/src/events/publishers/org.js.map +1 -7
- package/dist/src/events/publishers/plugin.js +49 -55
- package/dist/src/events/publishers/plugin.js.map +1 -7
- package/dist/src/events/publishers/query.js +70 -81
- package/dist/src/events/publishers/query.js.map +1 -7
- package/dist/src/events/publishers/role.js +61 -63
- package/dist/src/events/publishers/role.js.map +1 -7
- package/dist/src/events/publishers/rows.js +28 -39
- package/dist/src/events/publishers/rows.js.map +1 -7
- package/dist/src/events/publishers/screen.js +41 -47
- package/dist/src/events/publishers/screen.js.map +1 -7
- package/dist/src/events/publishers/serve.js +41 -47
- package/dist/src/events/publishers/serve.js.map +1 -7
- package/dist/src/events/publishers/table.js +69 -71
- package/dist/src/events/publishers/table.js.map +1 -7
- package/dist/src/events/publishers/user.js +184 -173
- package/dist/src/events/publishers/user.js.map +1 -7
- package/dist/src/events/publishers/view.js +98 -89
- package/dist/src/events/publishers/view.js.map +1 -7
- package/dist/src/features/index.js +88 -93
- package/dist/src/features/index.js.map +1 -7
- package/dist/src/features/installation.js +16 -38
- package/dist/src/features/installation.js.map +1 -7
- package/dist/src/helpers.js +11 -28
- package/dist/src/helpers.js.map +1 -7
- package/dist/src/index.js +77 -148
- package/dist/src/index.js.map +1 -7
- package/dist/src/installation.js +127 -128
- package/dist/src/installation.js.map +1 -7
- package/dist/src/logging/alerts.js +14 -39
- package/dist/src/logging/alerts.js.map +1 -7
- package/dist/src/logging/correlation/correlation.js +11 -35
- package/dist/src/logging/correlation/correlation.js.map +1 -7
- package/dist/src/logging/correlation/index.js +16 -21
- package/dist/src/logging/correlation/index.js.map +1 -7
- package/dist/src/logging/correlation/middleware.js +13 -33
- package/dist/src/logging/correlation/middleware.js.map +1 -7
- package/dist/src/logging/index.js +32 -45
- package/dist/src/logging/index.js.map +1 -7
- package/dist/src/logging/pino/logger.js +206 -185
- package/dist/src/logging/pino/logger.js.map +1 -7
- package/dist/src/logging/pino/middleware.js +38 -68
- package/dist/src/logging/pino/middleware.js.map +1 -7
- package/dist/src/logging/system.js +86 -95
- package/dist/src/logging/system.js.map +1 -7
- package/dist/src/middleware/adminOnly.js +16 -28
- package/dist/src/middleware/adminOnly.js.map +1 -7
- package/dist/src/middleware/auditLog.js +13 -24
- package/dist/src/middleware/auditLog.js.map +1 -7
- package/dist/src/middleware/authenticated.js +191 -165
- package/dist/src/middleware/authenticated.js.map +1 -7
- package/dist/src/middleware/builderOnly.js +29 -44
- package/dist/src/middleware/builderOnly.js.map +1 -7
- package/dist/src/middleware/builderOrAdmin.js +29 -44
- package/dist/src/middleware/builderOrAdmin.js.map +1 -7
- package/dist/src/middleware/csrf.js +75 -54
- package/dist/src/middleware/csrf.js.map +1 -7
- package/dist/src/middleware/errorHandling.js +60 -58
- package/dist/src/middleware/errorHandling.js.map +1 -7
- package/dist/src/middleware/index.js +61 -91
- package/dist/src/middleware/index.js.map +1 -7
- package/dist/src/middleware/internalApi.js +27 -36
- package/dist/src/middleware/internalApi.js.map +1 -7
- package/dist/src/middleware/joi-validator.js +39 -65
- package/dist/src/middleware/joi-validator.js.map +1 -7
- package/dist/src/middleware/matchers.js +36 -55
- package/dist/src/middleware/matchers.js.map +1 -7
- package/dist/src/middleware/passport/datasource/google.js +88 -96
- package/dist/src/middleware/passport/datasource/google.js.map +1 -7
- package/dist/src/middleware/passport/local.js +74 -66
- package/dist/src/middleware/passport/local.js.map +1 -7
- package/dist/src/middleware/passport/sso/google.js +81 -84
- package/dist/src/middleware/passport/sso/google.js.map +1 -7
- package/dist/src/middleware/passport/sso/oidc.js +140 -124
- package/dist/src/middleware/passport/sso/oidc.js.map +1 -7
- package/dist/src/middleware/passport/sso/sso.js +157 -141
- package/dist/src/middleware/passport/sso/sso.js.map +1 -7
- package/dist/src/middleware/passport/utils.js +60 -56
- package/dist/src/middleware/passport/utils.js.map +1 -7
- package/dist/src/middleware/querystringToBody.js +26 -42
- package/dist/src/middleware/querystringToBody.js.map +1 -7
- package/dist/src/middleware/tenancy.js +33 -42
- package/dist/src/middleware/tenancy.js.map +1 -7
- package/dist/src/migrations/definitions.js +37 -61
- package/dist/src/migrations/definitions.js.map +1 -7
- package/dist/src/migrations/index.js +17 -23
- package/dist/src/migrations/index.js.map +1 -7
- package/dist/src/migrations/migrations.js +182 -162
- package/dist/src/migrations/migrations.js.map +1 -7
- package/dist/src/objectStore/buckets/app.js +65 -57
- package/dist/src/objectStore/buckets/app.js.map +1 -7
- package/dist/src/objectStore/buckets/global.js +50 -55
- package/dist/src/objectStore/buckets/global.js.map +1 -7
- package/dist/src/objectStore/buckets/index.js +18 -25
- package/dist/src/objectStore/buckets/index.js.map +1 -7
- package/dist/src/objectStore/buckets/plugins.js +76 -82
- package/dist/src/objectStore/buckets/plugins.js.map +1 -7
- package/dist/src/objectStore/cloudfront.js +27 -61
- package/dist/src/objectStore/cloudfront.js.map +1 -7
- package/dist/src/objectStore/index.js +18 -25
- package/dist/src/objectStore/index.js.map +1 -7
- package/dist/src/objectStore/objectStore.js +351 -341
- package/dist/src/objectStore/objectStore.js.map +1 -7
- package/dist/src/objectStore/utils.js +26 -52
- package/dist/src/objectStore/utils.js.map +1 -7
- package/dist/src/platform/index.js +30 -42
- package/dist/src/platform/index.js.map +1 -7
- package/dist/src/platform/platformDb.js +7 -30
- package/dist/src/platform/platformDb.js.map +1 -7
- package/dist/src/platform/tenants.js +126 -110
- package/dist/src/platform/tenants.js.map +1 -7
- package/dist/src/platform/users.js +84 -92
- package/dist/src/platform/users.js.map +1 -7
- package/dist/src/plugin/index.js +16 -21
- package/dist/src/plugin/index.js.map +1 -7
- package/dist/src/plugin/utils.js +129 -137
- package/dist/src/plugin/utils.js.map +1 -7
- package/dist/src/queue/constants.js +10 -34
- package/dist/src/queue/constants.js.map +1 -7
- package/dist/src/queue/inMemoryQueue.js +137 -131
- package/dist/src/queue/inMemoryQueue.js.map +1 -7
- package/dist/src/queue/index.js +17 -23
- package/dist/src/queue/index.js.map +1 -7
- package/dist/src/queue/listeners.js +170 -161
- package/dist/src/queue/listeners.js.map +1 -7
- package/dist/src/queue/queue.js +83 -76
- package/dist/src/queue/queue.js.map +1 -7
- package/dist/src/redis/index.js +34 -45
- package/dist/src/redis/index.js.map +1 -7
- package/dist/src/redis/init.js +125 -115
- package/dist/src/redis/init.js.map +1 -7
- package/dist/src/redis/redis.js +302 -244
- package/dist/src/redis/redis.js.map +1 -7
- package/dist/src/redis/redlockImpl.js +152 -135
- package/dist/src/redis/redlockImpl.js.map +1 -7
- package/dist/src/redis/utils.js +115 -128
- package/dist/src/redis/utils.js.map +1 -7
- package/dist/src/security/encryption.js +141 -162
- package/dist/src/security/encryption.js.map +1 -7
- package/dist/src/security/permissions.js +132 -170
- package/dist/src/security/permissions.js.map +1 -7
- package/dist/src/security/roles.js +319 -298
- package/dist/src/security/roles.js.map +1 -7
- package/dist/src/security/sessions.js +106 -120
- package/dist/src/security/sessions.js.map +1 -7
- package/dist/src/tenancy/db.js +7 -30
- package/dist/src/tenancy/db.js.map +1 -7
- package/dist/src/tenancy/index.js +17 -23
- package/dist/src/tenancy/index.js.map +1 -7
- package/dist/src/tenancy/tenancy.js +101 -114
- package/dist/src/tenancy/tenancy.js.map +1 -7
- package/dist/src/timers/index.js +16 -21
- package/dist/src/timers/index.js.map +1 -7
- package/dist/src/timers/timers.js +18 -43
- package/dist/src/timers/timers.js.map +1 -7
- package/dist/src/users/db.js +403 -357
- package/dist/src/users/db.js.map +1 -7
- package/dist/src/users/events.js +150 -133
- package/dist/src/users/events.js.map +1 -7
- package/dist/src/users/index.js +21 -34
- package/dist/src/users/index.js.map +1 -7
- package/dist/src/users/lookup.js +104 -102
- package/dist/src/users/lookup.js.map +1 -7
- package/dist/src/users/users.js +244 -240
- package/dist/src/users/users.js.map +1 -7
- package/dist/src/users/utils.js +87 -90
- package/dist/src/users/utils.js.map +1 -7
- package/dist/src/utils/hashing.js +42 -48
- package/dist/src/utils/hashing.js.map +1 -7
- package/dist/src/utils/index.js +18 -25
- package/dist/src/utils/index.js.map +1 -7
- package/dist/src/utils/stringUtils.js +6 -30
- package/dist/src/utils/stringUtils.js.map +1 -7
- package/dist/src/utils/utils.js +212 -172
- package/dist/src/utils/utils.js.map +1 -7
- package/dist/tests/core/logging.js +21 -45
- package/dist/tests/core/logging.js.map +1 -7
- package/dist/tests/core/utilities/index.js +34 -51
- package/dist/tests/core/utilities/index.js.map +1 -7
- package/dist/tests/core/utilities/jestUtils.js +16 -45
- package/dist/tests/core/utilities/jestUtils.js.map +1 -7
- package/dist/tests/core/utilities/mocks/alerts.js +27 -38
- package/dist/tests/core/utilities/mocks/alerts.js.map +1 -7
- package/dist/tests/core/utilities/mocks/date.js +5 -31
- package/dist/tests/core/utilities/mocks/date.js.map +1 -7
- package/dist/tests/core/utilities/mocks/events.js +141 -131
- package/dist/tests/core/utilities/mocks/events.js.map +1 -7
- package/dist/tests/core/utilities/mocks/fetch.js +10 -34
- package/dist/tests/core/utilities/mocks/fetch.js.map +1 -7
- package/dist/tests/core/utilities/mocks/index.js +39 -51
- package/dist/tests/core/utilities/mocks/index.js.map +1 -7
- package/dist/tests/core/utilities/mocks/licenses.js +67 -107
- package/dist/tests/core/utilities/mocks/licenses.js.map +1 -7
- package/dist/tests/core/utilities/mocks/posthog.js +6 -6
- package/dist/tests/core/utilities/mocks/posthog.js.map +1 -7
- package/dist/tests/core/utilities/structures/Chance.js +17 -44
- package/dist/tests/core/utilities/structures/Chance.js.map +1 -7
- package/dist/tests/core/utilities/structures/accounts.js +61 -131
- package/dist/tests/core/utilities/structures/accounts.js.map +1 -7
- package/dist/tests/core/utilities/structures/apps.js +21 -44
- package/dist/tests/core/utilities/structures/apps.js.map +1 -7
- package/dist/tests/core/utilities/structures/common.js +8 -32
- package/dist/tests/core/utilities/structures/common.js.map +1 -7
- package/dist/tests/core/utilities/structures/db.js +11 -35
- package/dist/tests/core/utilities/structures/db.js.map +1 -7
- package/dist/tests/core/utilities/structures/documents/index.js +16 -21
- package/dist/tests/core/utilities/structures/documents/index.js.map +1 -7
- package/dist/tests/core/utilities/structures/documents/platform/index.js +26 -37
- package/dist/tests/core/utilities/structures/documents/platform/index.js.map +1 -7
- package/dist/tests/core/utilities/structures/documents/platform/installation.js +34 -44
- package/dist/tests/core/utilities/structures/documents/platform/installation.js.map +1 -7
- package/dist/tests/core/utilities/structures/generator.js +7 -38
- package/dist/tests/core/utilities/structures/generator.js.map +1 -7
- package/dist/tests/core/utilities/structures/index.js +43 -78
- package/dist/tests/core/utilities/structures/index.js.map +1 -7
- package/dist/tests/core/utilities/structures/koa.js +7 -39
- package/dist/tests/core/utilities/structures/koa.js.map +1 -7
- package/dist/tests/core/utilities/structures/licenses.js +121 -156
- package/dist/tests/core/utilities/structures/licenses.js.map +1 -7
- package/dist/tests/core/utilities/structures/plugins.js +20 -43
- package/dist/tests/core/utilities/structures/plugins.js.map +1 -7
- package/dist/tests/core/utilities/structures/quotas.js +67 -90
- package/dist/tests/core/utilities/structures/quotas.js.map +1 -7
- package/dist/tests/core/utilities/structures/scim.js +57 -84
- package/dist/tests/core/utilities/structures/scim.js.map +1 -7
- package/dist/tests/core/utilities/structures/shared.js +9 -41
- package/dist/tests/core/utilities/structures/shared.js.map +1 -7
- package/dist/tests/core/utilities/structures/sso.js +112 -124
- package/dist/tests/core/utilities/structures/sso.js.map +1 -7
- package/dist/tests/core/utilities/structures/tenants.js +6 -29
- package/dist/tests/core/utilities/structures/tenants.js.map +1 -7
- package/dist/tests/core/utilities/structures/userGroups.js +10 -33
- package/dist/tests/core/utilities/structures/userGroups.js.map +1 -7
- package/dist/tests/core/utilities/structures/users.js +36 -84
- package/dist/tests/core/utilities/structures/users.js.map +1 -7
- package/dist/tests/core/utilities/testContainerUtils.js +59 -84
- package/dist/tests/core/utilities/testContainerUtils.js.map +1 -7
- package/dist/tests/core/utilities/utils/index.js +26 -37
- package/dist/tests/core/utilities/utils/index.js.map +1 -7
- package/dist/tests/core/utilities/utils/time.js +5 -28
- package/dist/tests/core/utilities/utils/time.js.map +1 -7
- package/dist/tests/extra/DBTestConfiguration.js +50 -56
- package/dist/tests/extra/DBTestConfiguration.js.map +1 -7
- package/dist/tests/extra/index.js +30 -39
- package/dist/tests/extra/index.js.map +1 -7
- package/dist/tests/extra/testEnv.js +105 -84
- package/dist/tests/extra/testEnv.js.map +1 -7
- package/dist/tests/index.js +16 -21
- package/dist/tests/index.js.map +1 -7
- package/dist/tests/jestEnv.js +1 -1
- package/dist/tests/jestEnv.js.map +1 -7
- package/dist/tests/jestSetup.js +20 -33
- package/dist/tests/jestSetup.js.map +1 -7
- package/package.json +5 -5
- package/dist/plugins.js +0 -290
- package/dist/plugins.js.map +0 -7
- package/dist/plugins.js.meta.json +0 -1
- package/dist/src/auth/tests/auth.spec.js +0 -37
- package/dist/src/auth/tests/auth.spec.js.map +0 -7
- package/dist/src/blacklist/tests/blacklist.spec.js +0 -61
- package/dist/src/blacklist/tests/blacklist.spec.js.map +0 -7
- package/dist/src/cache/tests/writethrough.spec.js +0 -132
- package/dist/src/cache/tests/writethrough.spec.js.map +0 -7
- package/dist/src/configs/tests/configs.spec.js +0 -182
- package/dist/src/configs/tests/configs.spec.js.map +0 -7
- package/dist/src/context/tests/index.spec.js +0 -147
- package/dist/src/context/tests/index.spec.js.map +0 -7
- package/dist/src/db/tests/index.spec.js +0 -24
- package/dist/src/db/tests/index.spec.js.map +0 -7
- package/dist/src/db/tests/lucene.spec.js +0 -312
- package/dist/src/db/tests/lucene.spec.js.map +0 -7
- package/dist/src/db/tests/pouch.spec.js +0 -63
- package/dist/src/db/tests/pouch.spec.js.map +0 -7
- package/dist/src/db/tests/utils.spec.js +0 -50
- package/dist/src/db/tests/utils.spec.js.map +0 -7
- package/dist/src/events/processors/posthog/tests/PosthogProcessor.spec.js +0 -154
- package/dist/src/events/processors/posthog/tests/PosthogProcessor.spec.js.map +0 -7
- package/dist/src/features/tests/featureFlags.spec.js +0 -86
- package/dist/src/features/tests/featureFlags.spec.js.map +0 -7
- package/dist/src/logging/tests/system.spec.js +0 -59
- package/dist/src/logging/tests/system.spec.js.map +0 -7
- package/dist/src/middleware/passport/sso/tests/google.spec.js +0 -77
- package/dist/src/middleware/passport/sso/tests/google.spec.js.map +0 -7
- package/dist/src/middleware/passport/sso/tests/oidc.spec.js +0 -143
- package/dist/src/middleware/passport/sso/tests/oidc.spec.js.map +0 -7
- package/dist/src/middleware/passport/sso/tests/sso.spec.js +0 -167
- package/dist/src/middleware/passport/sso/tests/sso.spec.js.map +0 -7
- package/dist/src/middleware/tests/builder.spec.js +0 -169
- package/dist/src/middleware/tests/builder.spec.js.map +0 -7
- package/dist/src/middleware/tests/matchers.spec.js +0 -120
- package/dist/src/middleware/tests/matchers.spec.js.map +0 -7
- package/dist/src/migrations/tests/migrations.spec.js +0 -78
- package/dist/src/migrations/tests/migrations.spec.js.map +0 -7
- package/dist/src/objectStore/buckets/tests/app.spec.js +0 -171
- package/dist/src/objectStore/buckets/tests/app.spec.js.map +0 -7
- package/dist/src/objectStore/buckets/tests/global.spec.js +0 -87
- package/dist/src/objectStore/buckets/tests/global.spec.js.map +0 -7
- package/dist/src/objectStore/buckets/tests/plugins.spec.js +0 -123
- package/dist/src/objectStore/buckets/tests/plugins.spec.js.map +0 -7
- package/dist/src/platform/tests/tenants.spec.js +0 -46
- package/dist/src/platform/tests/tenants.spec.js.map +0 -7
- package/dist/src/plugin/tests/validation.spec.js +0 -97
- package/dist/src/plugin/tests/validation.spec.js.map +0 -7
- package/dist/src/security/tests/encryption.spec.js +0 -51
- package/dist/src/security/tests/encryption.spec.js.map +0 -7
- package/dist/src/security/tests/permissions.spec.js +0 -154
- package/dist/src/security/tests/permissions.spec.js.map +0 -7
- package/dist/src/security/tests/sessions.spec.js +0 -33
- package/dist/src/security/tests/sessions.spec.js.map +0 -7
- package/dist/src/tenancy/tests/tenancy.spec.js +0 -154
- package/dist/src/tenancy/tests/tenancy.spec.js.map +0 -7
- package/dist/src/utils/tests/utils.spec.js +0 -165
- package/dist/src/utils/tests/utils.spec.js.map +0 -7
package/dist/src/redis/redis.js
CHANGED
|
@@ -1,277 +1,335 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
11
33
|
};
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
36
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var redis_exports = {};
|
|
30
|
-
__export(redis_exports, {
|
|
31
|
-
default: () => redis_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(redis_exports);
|
|
34
|
-
var import_environment = __toESM(require("../environment"));
|
|
35
|
-
var import_ioredis = __toESM(require("ioredis"));
|
|
36
|
-
var import_utils = require("./utils");
|
|
37
|
-
var timers = __toESM(require("../timers"));
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const environment_1 = __importDefault(require("../environment"));
|
|
39
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
40
|
+
// mock-redis doesn't have any typing
|
|
38
41
|
let MockRedis;
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (environment_1.default.MOCK_REDIS) {
|
|
43
|
+
try {
|
|
44
|
+
// ioredis mock is all in memory
|
|
45
|
+
MockRedis = require("ioredis-mock");
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
console.log("Mock redis unavailable");
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
51
|
+
const utils_1 = require("./utils");
|
|
52
|
+
const timers = __importStar(require("../timers"));
|
|
53
|
+
const RETRY_PERIOD_MS = 2000;
|
|
54
|
+
const STARTUP_TIMEOUT_MS = 5000;
|
|
55
|
+
const CLUSTERED = environment_1.default.REDIS_CLUSTERED;
|
|
56
|
+
const DEFAULT_SELECT_DB = utils_1.SelectableDatabase.DEFAULT;
|
|
57
|
+
// for testing just generate the client once
|
|
50
58
|
let CLOSED = false;
|
|
51
59
|
let CLIENTS = {};
|
|
52
60
|
0;
|
|
53
61
|
let CONNECTED = false;
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
// mock redis always connected
|
|
63
|
+
if (environment_1.default.MOCK_REDIS) {
|
|
64
|
+
CONNECTED = true;
|
|
56
65
|
}
|
|
57
66
|
function pickClient(selectDb) {
|
|
58
|
-
|
|
67
|
+
return CLIENTS[selectDb];
|
|
59
68
|
}
|
|
60
69
|
function connectionError(selectDb, timeout, err) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
// manually shut down, ignore errors
|
|
71
|
+
if (CLOSED) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
pickClient(selectDb).disconnect();
|
|
75
|
+
CLOSED = true;
|
|
76
|
+
// always clear this on error
|
|
77
|
+
clearTimeout(timeout);
|
|
78
|
+
CONNECTED = false;
|
|
79
|
+
console.error("Redis connection failed - " + err);
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
init();
|
|
82
|
+
}, RETRY_PERIOD_MS);
|
|
72
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Inits the system, will error if unable to connect to redis cluster (may take up to 10 seconds) otherwise
|
|
86
|
+
* will return the ioredis client which will be ready to use.
|
|
87
|
+
*/
|
|
73
88
|
function init(selectDb = DEFAULT_SELECT_DB) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (import_environment.default.MOCK_REDIS) {
|
|
82
|
-
CLIENTS[selectDb] = new RedisCore((0, import_utils.getRedisOptions)());
|
|
83
|
-
}
|
|
84
|
-
timeout = setTimeout(() => {
|
|
85
|
-
if (!CONNECTED) {
|
|
86
|
-
connectionError(
|
|
87
|
-
selectDb,
|
|
88
|
-
timeout,
|
|
89
|
-
"Did not successfully connect in timeout"
|
|
90
|
-
);
|
|
89
|
+
const RedisCore = environment_1.default.MOCK_REDIS && MockRedis ? MockRedis : ioredis_1.default;
|
|
90
|
+
let timeout;
|
|
91
|
+
CLOSED = false;
|
|
92
|
+
let client = pickClient(selectDb);
|
|
93
|
+
// already connected, ignore
|
|
94
|
+
if (client && CONNECTED) {
|
|
95
|
+
return;
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
const { redisProtocolUrl, opts, host, port } = (0, import_utils.getRedisOptions)();
|
|
97
|
-
if (CLUSTERED) {
|
|
98
|
-
client = new RedisCore.Cluster([{ host, port }], opts);
|
|
99
|
-
} else if (redisProtocolUrl) {
|
|
100
|
-
client = new RedisCore(redisProtocolUrl);
|
|
101
|
-
} else {
|
|
102
|
-
client = new RedisCore(opts);
|
|
103
|
-
}
|
|
104
|
-
client.on("end", (err) => {
|
|
105
|
-
if (import_environment.default.isTest()) {
|
|
106
|
-
return;
|
|
97
|
+
// testing uses a single in memory client
|
|
98
|
+
if (environment_1.default.MOCK_REDIS) {
|
|
99
|
+
CLIENTS[selectDb] = new RedisCore((0, utils_1.getRedisOptions)());
|
|
107
100
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
CLIENTS[selectDb] = client;
|
|
118
|
-
}
|
|
119
|
-
function waitForConnection(selectDb = DEFAULT_SELECT_DB) {
|
|
120
|
-
return new Promise((resolve) => {
|
|
121
|
-
if (pickClient(selectDb) == null) {
|
|
122
|
-
init();
|
|
123
|
-
} else if (CONNECTED) {
|
|
124
|
-
resolve("");
|
|
125
|
-
return;
|
|
101
|
+
// start the timer - only allowed 5 seconds to connect
|
|
102
|
+
timeout = setTimeout(() => {
|
|
103
|
+
if (!CONNECTED) {
|
|
104
|
+
connectionError(selectDb, timeout, "Did not successfully connect in timeout");
|
|
105
|
+
}
|
|
106
|
+
}, STARTUP_TIMEOUT_MS);
|
|
107
|
+
// disconnect any lingering client
|
|
108
|
+
if (client) {
|
|
109
|
+
client.disconnect();
|
|
126
110
|
}
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
111
|
+
const { redisProtocolUrl, opts, host, port } = (0, utils_1.getRedisOptions)();
|
|
112
|
+
if (CLUSTERED) {
|
|
113
|
+
client = new RedisCore.Cluster([{ host, port }], opts);
|
|
114
|
+
}
|
|
115
|
+
else if (redisProtocolUrl) {
|
|
116
|
+
client = new RedisCore(redisProtocolUrl);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
client = new RedisCore(opts);
|
|
120
|
+
}
|
|
121
|
+
// attach handlers
|
|
122
|
+
client.on("end", (err) => {
|
|
123
|
+
if (environment_1.default.isTest()) {
|
|
124
|
+
// don't try to re-connect in test env
|
|
125
|
+
// allow the process to exit
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
connectionError(selectDb, timeout, err);
|
|
142
129
|
});
|
|
143
|
-
|
|
144
|
-
|
|
130
|
+
client.on("error", (err) => {
|
|
131
|
+
connectionError(selectDb, timeout, err);
|
|
145
132
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
client.on("connect", () => {
|
|
134
|
+
clearTimeout(timeout);
|
|
135
|
+
CONNECTED = true;
|
|
136
|
+
});
|
|
137
|
+
CLIENTS[selectDb] = client;
|
|
138
|
+
}
|
|
139
|
+
function waitForConnection(selectDb = DEFAULT_SELECT_DB) {
|
|
140
|
+
return new Promise(resolve => {
|
|
141
|
+
if (pickClient(selectDb) == null) {
|
|
142
|
+
init();
|
|
152
143
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
144
|
+
else if (CONNECTED) {
|
|
145
|
+
resolve("");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// check if the connection is ready
|
|
149
|
+
const interval = timers.set(() => {
|
|
150
|
+
if (CONNECTED) {
|
|
151
|
+
timers.clear(interval);
|
|
152
|
+
resolve("");
|
|
153
|
+
}
|
|
154
|
+
}, 500);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Utility function, takes a redis stream and converts it to a promisified response -
|
|
159
|
+
* this can only be done with redis streams because they will have an end.
|
|
160
|
+
* @param stream A redis stream, specifically as this type of stream will have an end.
|
|
161
|
+
* @param client The client to use for further lookups.
|
|
162
|
+
* @return {Promise<object>} The final output of the stream
|
|
163
|
+
*/
|
|
164
|
+
function promisifyStream(stream, client) {
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
const outputKeys = new Set();
|
|
167
|
+
stream.on("data", (keys) => {
|
|
168
|
+
keys.forEach(key => {
|
|
169
|
+
outputKeys.add(key);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
stream.on("error", (err) => {
|
|
173
|
+
reject(err);
|
|
174
|
+
});
|
|
175
|
+
stream.on("end", () => __awaiter(this, void 0, void 0, function* () {
|
|
176
|
+
const keysArray = Array.from(outputKeys);
|
|
177
|
+
try {
|
|
178
|
+
let getPromises = [];
|
|
179
|
+
for (let key of keysArray) {
|
|
180
|
+
getPromises.push(client.get(key));
|
|
181
|
+
}
|
|
182
|
+
const jsonArray = yield Promise.all(getPromises);
|
|
183
|
+
resolve(keysArray.map(key => ({
|
|
184
|
+
key: (0, utils_1.removeDbPrefix)(key),
|
|
185
|
+
value: JSON.parse(jsonArray.shift()),
|
|
186
|
+
})));
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
reject(err);
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
163
192
|
});
|
|
164
|
-
});
|
|
165
193
|
}
|
|
166
194
|
class RedisWrapper {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
getClient() {
|
|
172
|
-
return pickClient(this._select);
|
|
173
|
-
}
|
|
174
|
-
async init() {
|
|
175
|
-
CLOSED = false;
|
|
176
|
-
init(this._select);
|
|
177
|
-
await waitForConnection(this._select);
|
|
178
|
-
if (this._select && !import_environment.default.isTest()) {
|
|
179
|
-
this.getClient().select(this._select);
|
|
195
|
+
constructor(db, selectDb = null) {
|
|
196
|
+
this._db = db;
|
|
197
|
+
this._select = selectDb || DEFAULT_SELECT_DB;
|
|
180
198
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
async finish() {
|
|
184
|
-
CLOSED = true;
|
|
185
|
-
this.getClient().disconnect();
|
|
186
|
-
}
|
|
187
|
-
async scan(key = "") {
|
|
188
|
-
const db = this._db;
|
|
189
|
-
key = `${db}${import_utils.SEPARATOR}${key}`;
|
|
190
|
-
let stream;
|
|
191
|
-
if (CLUSTERED) {
|
|
192
|
-
let node = this.getClient().nodes("master");
|
|
193
|
-
stream = node[0].scanStream({ match: key + "*", count: 100 });
|
|
194
|
-
} else {
|
|
195
|
-
stream = this.getClient().scanStream({ match: key + "*", count: 100 });
|
|
199
|
+
getClient() {
|
|
200
|
+
return pickClient(this._select);
|
|
196
201
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
async get(key) {
|
|
208
|
-
const db = this._db;
|
|
209
|
-
let response = await this.getClient().get((0, import_utils.addDbPrefix)(db, key));
|
|
210
|
-
if (response != null && response.key) {
|
|
211
|
-
response.key = key;
|
|
202
|
+
init() {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
CLOSED = false;
|
|
205
|
+
init(this._select);
|
|
206
|
+
yield waitForConnection(this._select);
|
|
207
|
+
if (this._select && !environment_1.default.isTest()) {
|
|
208
|
+
this.getClient().select(this._select);
|
|
209
|
+
}
|
|
210
|
+
return this;
|
|
211
|
+
});
|
|
212
212
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
finish() {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
CLOSED = true;
|
|
216
|
+
this.getClient().disconnect();
|
|
217
|
+
});
|
|
217
218
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
scan(key = "") {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const db = this._db;
|
|
222
|
+
key = `${db}${utils_1.SEPARATOR}${key}`;
|
|
223
|
+
let stream;
|
|
224
|
+
if (CLUSTERED) {
|
|
225
|
+
let node = this.getClient().nodes("master");
|
|
226
|
+
stream = node[0].scanStream({ match: key + "*", count: 100 });
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
stream = this.getClient().scanStream({ match: key + "*", count: 100 });
|
|
230
|
+
}
|
|
231
|
+
return promisifyStream(stream, this.getClient());
|
|
232
|
+
});
|
|
223
233
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
keys(pattern) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
+
const db = this._db;
|
|
237
|
+
return this.getClient().keys((0, utils_1.addDbPrefix)(db, pattern));
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
exists(key) {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
const db = this._db;
|
|
243
|
+
return yield this.getClient().exists((0, utils_1.addDbPrefix)(db, key));
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
get(key) {
|
|
247
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
const db = this._db;
|
|
249
|
+
let response = yield this.getClient().get((0, utils_1.addDbPrefix)(db, key));
|
|
250
|
+
// overwrite the prefixed key
|
|
251
|
+
if (response != null && response.key) {
|
|
252
|
+
response.key = key;
|
|
253
|
+
}
|
|
254
|
+
// if its not an object just return the response
|
|
255
|
+
try {
|
|
256
|
+
return JSON.parse(response);
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
return response;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
bulkGet(keys) {
|
|
264
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
const db = this._db;
|
|
266
|
+
if (keys.length === 0) {
|
|
267
|
+
return {};
|
|
268
|
+
}
|
|
269
|
+
const prefixedKeys = keys.map(key => (0, utils_1.addDbPrefix)(db, key));
|
|
270
|
+
let response = yield this.getClient().mget(prefixedKeys);
|
|
271
|
+
if (Array.isArray(response)) {
|
|
272
|
+
let final = {};
|
|
273
|
+
let count = 0;
|
|
274
|
+
for (let result of response) {
|
|
275
|
+
if (result) {
|
|
276
|
+
let parsed;
|
|
277
|
+
try {
|
|
278
|
+
parsed = JSON.parse(result);
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
parsed = result;
|
|
282
|
+
}
|
|
283
|
+
final[keys[count]] = parsed;
|
|
284
|
+
}
|
|
285
|
+
count++;
|
|
286
|
+
}
|
|
287
|
+
return final;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
throw new Error(`Invalid response: ${response}`);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
store(key, value, expirySeconds = null) {
|
|
295
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
296
|
+
const db = this._db;
|
|
297
|
+
if (typeof value === "object") {
|
|
298
|
+
value = JSON.stringify(value);
|
|
299
|
+
}
|
|
300
|
+
const prefixedKey = (0, utils_1.addDbPrefix)(db, key);
|
|
301
|
+
yield this.getClient().set(prefixedKey, value);
|
|
302
|
+
if (expirySeconds) {
|
|
303
|
+
yield this.getClient().expire(prefixedKey, expirySeconds);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
getTTL(key) {
|
|
308
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
const db = this._db;
|
|
310
|
+
const prefixedKey = (0, utils_1.addDbPrefix)(db, key);
|
|
311
|
+
return this.getClient().ttl(prefixedKey);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
setExpiry(key, expirySeconds) {
|
|
315
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
const db = this._db;
|
|
317
|
+
const prefixedKey = (0, utils_1.addDbPrefix)(db, key);
|
|
318
|
+
yield this.getClient().expire(prefixedKey, expirySeconds);
|
|
319
|
+
});
|
|
244
320
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
321
|
+
delete(key) {
|
|
322
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
323
|
+
const db = this._db;
|
|
324
|
+
yield this.getClient().del((0, utils_1.addDbPrefix)(db, key));
|
|
325
|
+
});
|
|
250
326
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
327
|
+
clear() {
|
|
328
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
329
|
+
let items = yield this.scan();
|
|
330
|
+
yield Promise.all(items.map((obj) => this.delete(obj.key)));
|
|
331
|
+
});
|
|
255
332
|
}
|
|
256
|
-
}
|
|
257
|
-
async getTTL(key) {
|
|
258
|
-
const db = this._db;
|
|
259
|
-
const prefixedKey = (0, import_utils.addDbPrefix)(db, key);
|
|
260
|
-
return this.getClient().ttl(prefixedKey);
|
|
261
|
-
}
|
|
262
|
-
async setExpiry(key, expirySeconds) {
|
|
263
|
-
const db = this._db;
|
|
264
|
-
const prefixedKey = (0, import_utils.addDbPrefix)(db, key);
|
|
265
|
-
await this.getClient().expire(prefixedKey, expirySeconds);
|
|
266
|
-
}
|
|
267
|
-
async delete(key) {
|
|
268
|
-
const db = this._db;
|
|
269
|
-
await this.getClient().del((0, import_utils.addDbPrefix)(db, key));
|
|
270
|
-
}
|
|
271
|
-
async clear() {
|
|
272
|
-
let items = await this.scan();
|
|
273
|
-
await Promise.all(items.map((obj) => this.delete(obj.key)));
|
|
274
|
-
}
|
|
275
333
|
}
|
|
276
|
-
|
|
277
|
-
//# sourceMappingURL=redis.js.map
|
|
334
|
+
exports.default = RedisWrapper;
|
|
335
|
+
//# sourceMappingURL=redis.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/redis/redis.ts"],
|
|
4
|
-
"sourcesContent": ["import env from \"../environment\"\nimport Redis from \"ioredis\"\n// mock-redis doesn't have any typing\nlet MockRedis: any | undefined\nif (env.MOCK_REDIS) {\n try {\n // ioredis mock is all in memory\n MockRedis = require(\"ioredis-mock\")\n } catch (err) {\n console.log(\"Mock redis unavailable\")\n }\n}\nimport {\n addDbPrefix,\n removeDbPrefix,\n getRedisOptions,\n SEPARATOR,\n SelectableDatabase,\n} from \"./utils\"\nimport * as timers from \"../timers\"\n\nconst RETRY_PERIOD_MS = 2000\nconst STARTUP_TIMEOUT_MS = 5000\nconst CLUSTERED = env.REDIS_CLUSTERED\nconst DEFAULT_SELECT_DB = SelectableDatabase.DEFAULT\n\n// for testing just generate the client once\nlet CLOSED = false\nlet CLIENTS: { [key: number]: any } = {}\n0\nlet CONNECTED = false\n\n// mock redis always connected\nif (env.MOCK_REDIS) {\n CONNECTED = true\n}\n\nfunction pickClient(selectDb: number): any {\n return CLIENTS[selectDb]\n}\n\nfunction connectionError(\n selectDb: number,\n timeout: NodeJS.Timeout,\n err: Error | string\n) {\n // manually shut down, ignore errors\n if (CLOSED) {\n return\n }\n pickClient(selectDb).disconnect()\n CLOSED = true\n // always clear this on error\n clearTimeout(timeout)\n CONNECTED = false\n console.error(\"Redis connection failed - \" + err)\n setTimeout(() => {\n init()\n }, RETRY_PERIOD_MS)\n}\n\n/**\n * Inits the system, will error if unable to connect to redis cluster (may take up to 10 seconds) otherwise\n * will return the ioredis client which will be ready to use.\n */\nfunction init(selectDb = DEFAULT_SELECT_DB) {\n const RedisCore = env.MOCK_REDIS && MockRedis ? MockRedis : Redis\n let timeout: NodeJS.Timeout\n CLOSED = false\n let client = pickClient(selectDb)\n // already connected, ignore\n if (client && CONNECTED) {\n return\n }\n // testing uses a single in memory client\n if (env.MOCK_REDIS) {\n CLIENTS[selectDb] = new RedisCore(getRedisOptions())\n }\n // start the timer - only allowed 5 seconds to connect\n timeout = setTimeout(() => {\n if (!CONNECTED) {\n connectionError(\n selectDb,\n timeout,\n \"Did not successfully connect in timeout\"\n )\n }\n }, STARTUP_TIMEOUT_MS)\n\n // disconnect any lingering client\n if (client) {\n client.disconnect()\n }\n const { redisProtocolUrl, opts, host, port } = getRedisOptions()\n\n if (CLUSTERED) {\n client = new RedisCore.Cluster([{ host, port }], opts)\n } else if (redisProtocolUrl) {\n client = new RedisCore(redisProtocolUrl)\n } else {\n client = new RedisCore(opts)\n }\n // attach handlers\n client.on(\"end\", (err: Error) => {\n if (env.isTest()) {\n // don't try to re-connect in test env\n // allow the process to exit\n return\n }\n connectionError(selectDb, timeout, err)\n })\n client.on(\"error\", (err: Error) => {\n connectionError(selectDb, timeout, err)\n })\n client.on(\"connect\", () => {\n clearTimeout(timeout)\n CONNECTED = true\n })\n CLIENTS[selectDb] = client\n}\n\nfunction waitForConnection(selectDb: number = DEFAULT_SELECT_DB) {\n return new Promise(resolve => {\n if (pickClient(selectDb) == null) {\n init()\n } else if (CONNECTED) {\n resolve(\"\")\n return\n }\n // check if the connection is ready\n const interval = timers.set(() => {\n if (CONNECTED) {\n timers.clear(interval)\n resolve(\"\")\n }\n }, 500)\n })\n}\n\n/**\n * Utility function, takes a redis stream and converts it to a promisified response -\n * this can only be done with redis streams because they will have an end.\n * @param stream A redis stream, specifically as this type of stream will have an end.\n * @param client The client to use for further lookups.\n * @return {Promise<object>} The final output of the stream\n */\nfunction promisifyStream(stream: any, client: RedisWrapper) {\n return new Promise((resolve, reject) => {\n const outputKeys = new Set()\n stream.on(\"data\", (keys: string[]) => {\n keys.forEach(key => {\n outputKeys.add(key)\n })\n })\n stream.on(\"error\", (err: Error) => {\n reject(err)\n })\n stream.on(\"end\", async () => {\n const keysArray: string[] = Array.from(outputKeys) as string[]\n try {\n let getPromises = []\n for (let key of keysArray) {\n getPromises.push(client.get(key))\n }\n const jsonArray = await Promise.all(getPromises)\n resolve(\n keysArray.map(key => ({\n key: removeDbPrefix(key),\n value: JSON.parse(jsonArray.shift()),\n }))\n )\n } catch (err) {\n reject(err)\n }\n })\n })\n}\n\nclass RedisWrapper {\n _db: string\n _select: number\n\n constructor(db: string, selectDb: number | null = null) {\n this._db = db\n this._select = selectDb || DEFAULT_SELECT_DB\n }\n\n getClient() {\n return pickClient(this._select)\n }\n\n async init() {\n CLOSED = false\n init(this._select)\n await waitForConnection(this._select)\n if (this._select && !env.isTest()) {\n this.getClient().select(this._select)\n }\n return this\n }\n\n async finish() {\n CLOSED = true\n this.getClient().disconnect()\n }\n\n async scan(key = \"\"): Promise<any> {\n const db = this._db\n key = `${db}${SEPARATOR}${key}`\n let stream\n if (CLUSTERED) {\n let node = this.getClient().nodes(\"master\")\n stream = node[0].scanStream({ match: key + \"*\", count: 100 })\n } else {\n stream = this.getClient().scanStream({ match: key + \"*\", count: 100 })\n }\n return promisifyStream(stream, this.getClient())\n }\n\n async keys(pattern: string) {\n const db = this._db\n return this.getClient().keys(addDbPrefix(db, pattern))\n }\n\n async exists(key: string) {\n const db = this._db\n return await this.getClient().exists(addDbPrefix(db, key))\n }\n\n async get(key: string) {\n const db = this._db\n let response = await this.getClient().get(addDbPrefix(db, key))\n // overwrite the prefixed key\n if (response != null && response.key) {\n response.key = key\n }\n // if its not an object just return the response\n try {\n return JSON.parse(response)\n } catch (err) {\n return response\n }\n }\n\n async bulkGet(keys: string[]) {\n const db = this._db\n if (keys.length === 0) {\n return {}\n }\n const prefixedKeys = keys.map(key => addDbPrefix(db, key))\n let response = await this.getClient().mget(prefixedKeys)\n if (Array.isArray(response)) {\n let final: any = {}\n let count = 0\n for (let result of response) {\n if (result) {\n let parsed\n try {\n parsed = JSON.parse(result)\n } catch (err) {\n parsed = result\n }\n final[keys[count]] = parsed\n }\n count++\n }\n return final\n } else {\n throw new Error(`Invalid response: ${response}`)\n }\n }\n\n async store(key: string, value: any, expirySeconds: number | null = null) {\n const db = this._db\n if (typeof value === \"object\") {\n value = JSON.stringify(value)\n }\n const prefixedKey = addDbPrefix(db, key)\n await this.getClient().set(prefixedKey, value)\n if (expirySeconds) {\n await this.getClient().expire(prefixedKey, expirySeconds)\n }\n }\n\n async getTTL(key: string) {\n const db = this._db\n const prefixedKey = addDbPrefix(db, key)\n return this.getClient().ttl(prefixedKey)\n }\n\n async setExpiry(key: string, expirySeconds: number | null) {\n const db = this._db\n const prefixedKey = addDbPrefix(db, key)\n await this.getClient().expire(prefixedKey, expirySeconds)\n }\n\n async delete(key: string) {\n const db = this._db\n await this.getClient().del(addDbPrefix(db, key))\n }\n\n async clear() {\n let items = await this.scan()\n await Promise.all(items.map((obj: any) => this.delete(obj.key)))\n }\n}\n\nexport default RedisWrapper\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAgB;AAChB,qBAAkB;AAWlB,mBAMO;AACP,aAAwB;AAhBxB,IAAI;AACJ,IAAI,mBAAAA,QAAI,YAAY;AAClB,MAAI;AAEF,gBAAY,QAAQ,cAAc;AAAA,EACpC,SAAS,KAAK;AACZ,YAAQ,IAAI,wBAAwB;AAAA,EACtC;AACF;AAUA,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,YAAY,mBAAAA,QAAI;AACtB,MAAM,oBAAoB,gCAAmB;AAG7C,IAAI,SAAS;AACb,IAAI,UAAkC,CAAC;AACvC;AACA,IAAI,YAAY;AAGhB,IAAI,mBAAAA,QAAI,YAAY;AAClB,cAAY;AACd;AAEA,SAAS,WAAW,UAAuB;AACzC,SAAO,QAAQ,QAAQ;AACzB;AAEA,SAAS,gBACP,UACA,SACA,KACA;AAEA,MAAI,QAAQ;AACV;AAAA,EACF;AACA,aAAW,QAAQ,EAAE,WAAW;AAChC,WAAS;AAET,eAAa,OAAO;AACpB,cAAY;AACZ,UAAQ,MAAM,+BAA+B,GAAG;AAChD,aAAW,MAAM;AACf,SAAK;AAAA,EACP,GAAG,eAAe;A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