@budibase/backend-core 3.2.26 → 3.2.27
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/index.js +62 -23
- package/dist/index.js.map +4 -4
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +7 -7
- package/dist/plugins.js.map +2 -2
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/events/processors/types.d.ts +1 -1
- package/dist/src/events/publishers/index.d.ts +1 -0
- package/dist/src/events/publishers/rowAction.d.ts +6 -0
- package/dist/src/events/publishers/table.d.ts +2 -2
- package/dist/src/events/publishers/view.d.ts +17 -6
- package/dist/src/index.d.ts +11 -11
- package/dist/src/platform/platformDb.d.ts +1 -1
- package/dist/src/queue/queue.d.ts +1 -1
- package/dist/src/tenancy/db.d.ts +1 -1
- package/package.json +7 -7
- package/dist/jest.config.js +0 -25
- package/dist/jest.config.js.map +0 -1
- package/dist/src/accounts/accounts.js +0 -83
- package/dist/src/accounts/accounts.js.map +0 -1
- package/dist/src/accounts/api.js +0 -102
- package/dist/src/accounts/api.js.map +0 -1
- package/dist/src/accounts/index.js +0 -18
- package/dist/src/accounts/index.js.map +0 -1
- package/dist/src/auth/auth.js +0 -198
- package/dist/src/auth/auth.js.map +0 -1
- package/dist/src/auth/index.js +0 -18
- package/dist/src/auth/index.js.map +0 -1
- package/dist/src/blacklist/blacklist.js +0 -75
- package/dist/src/blacklist/blacklist.js.map +0 -1
- package/dist/src/blacklist/index.js +0 -18
- package/dist/src/blacklist/index.js.map +0 -1
- package/dist/src/cache/appMetadata.js +0 -96
- package/dist/src/cache/appMetadata.js.map +0 -1
- package/dist/src/cache/base/index.js +0 -189
- package/dist/src/cache/base/index.js.map +0 -1
- package/dist/src/cache/docWritethrough.js +0 -123
- package/dist/src/cache/docWritethrough.js.map +0 -1
- package/dist/src/cache/generic.js +0 -37
- package/dist/src/cache/generic.js.map +0 -1
- package/dist/src/cache/index.js +0 -48
- package/dist/src/cache/index.js.map +0 -1
- package/dist/src/cache/invite.js +0 -128
- package/dist/src/cache/invite.js.map +0 -1
- package/dist/src/cache/passwordReset.js +0 -92
- package/dist/src/cache/passwordReset.js.map +0 -1
- package/dist/src/cache/user.js +0 -183
- package/dist/src/cache/user.js.map +0 -1
- package/dist/src/cache/writethrough.js +0 -170
- package/dist/src/cache/writethrough.js.map +0 -1
- package/dist/src/configs/configs.js +0 -294
- package/dist/src/configs/configs.js.map +0 -1
- package/dist/src/configs/index.js +0 -18
- package/dist/src/configs/index.js.map +0 -1
- package/dist/src/constants/db.js +0 -75
- package/dist/src/constants/db.js.map +0 -1
- package/dist/src/constants/index.js +0 -19
- package/dist/src/constants/index.js.map +0 -1
- package/dist/src/constants/misc.js +0 -40
- package/dist/src/constants/misc.js.map +0 -1
- package/dist/src/context/Context.js +0 -14
- package/dist/src/context/Context.js.map +0 -1
- package/dist/src/context/identity.js +0 -81
- package/dist/src/context/identity.js.map +0 -1
- package/dist/src/context/index.js +0 -44
- package/dist/src/context/index.js.map +0 -1
- package/dist/src/context/mainContext.js +0 -446
- package/dist/src/context/mainContext.js.map +0 -1
- package/dist/src/context/types.js +0 -3
- package/dist/src/context/types.js.map +0 -1
- package/dist/src/db/Replication.js +0 -90
- package/dist/src/db/Replication.js.map +0 -1
- package/dist/src/db/couch/DatabaseImpl.js +0 -475
- package/dist/src/db/couch/DatabaseImpl.js.map +0 -1
- package/dist/src/db/couch/connections.js +0 -101
- package/dist/src/db/couch/connections.js.map +0 -1
- package/dist/src/db/couch/index.js +0 -26
- package/dist/src/db/couch/index.js.map +0 -1
- package/dist/src/db/couch/pouchDB.js +0 -108
- package/dist/src/db/couch/pouchDB.js.map +0 -1
- package/dist/src/db/couch/pouchDump.js +0 -2
- package/dist/src/db/couch/pouchDump.js.map +0 -1
- package/dist/src/db/couch/utils.js +0 -60
- package/dist/src/db/couch/utils.js.map +0 -1
- package/dist/src/db/db.js +0 -47
- package/dist/src/db/db.js.map +0 -1
- package/dist/src/db/errors.js +0 -21
- package/dist/src/db/errors.js.map +0 -1
- package/dist/src/db/index.js +0 -58
- package/dist/src/db/index.js.map +0 -1
- package/dist/src/db/instrumentation.js +0 -202
- package/dist/src/db/instrumentation.js.map +0 -1
- package/dist/src/db/lucene.js +0 -638
- package/dist/src/db/lucene.js.map +0 -1
- package/dist/src/db/searchIndexes/index.js +0 -18
- package/dist/src/db/searchIndexes/index.js.map +0 -1
- package/dist/src/db/searchIndexes/searchIndexes.js +0 -76
- package/dist/src/db/searchIndexes/searchIndexes.js.map +0 -1
- package/dist/src/db/utils.js +0 -212
- package/dist/src/db/utils.js.map +0 -1
- package/dist/src/db/views.js +0 -224
- package/dist/src/db/views.js.map +0 -1
- package/dist/src/docIds/conversions.js +0 -62
- package/dist/src/docIds/conversions.js.map +0 -1
- package/dist/src/docIds/ids.js +0 -125
- package/dist/src/docIds/ids.js.map +0 -1
- package/dist/src/docIds/index.js +0 -19
- package/dist/src/docIds/index.js.map +0 -1
- package/dist/src/docIds/newid.js +0 -8
- package/dist/src/docIds/newid.js.map +0 -1
- package/dist/src/docIds/params.js +0 -141
- package/dist/src/docIds/params.js.map +0 -1
- package/dist/src/docUpdates/index.js +0 -35
- package/dist/src/docUpdates/index.js.map +0 -1
- package/dist/src/environment.js +0 -182
- package/dist/src/environment.js.map +0 -1
- package/dist/src/errors/errors.js +0 -97
- package/dist/src/errors/errors.js.map +0 -1
- package/dist/src/errors/index.js +0 -18
- package/dist/src/errors/index.js.map +0 -1
- package/dist/src/events/analytics.js +0 -52
- package/dist/src/events/analytics.js.map +0 -1
- package/dist/src/events/asyncEvents/index.js +0 -19
- package/dist/src/events/asyncEvents/index.js.map +0 -1
- package/dist/src/events/asyncEvents/publisher.js +0 -26
- package/dist/src/events/asyncEvents/publisher.js.map +0 -1
- package/dist/src/events/asyncEvents/queue.js +0 -26
- package/dist/src/events/asyncEvents/queue.js.map +0 -1
- package/dist/src/events/backfill.js +0 -189
- package/dist/src/events/backfill.js.map +0 -1
- package/dist/src/events/documentId.js +0 -27
- package/dist/src/events/documentId.js.map +0 -1
- package/dist/src/events/events.js +0 -87
- package/dist/src/events/events.js.map +0 -1
- package/dist/src/events/identification.js +0 -299
- package/dist/src/events/identification.js.map +0 -1
- package/dist/src/events/index.js +0 -59
- package/dist/src/events/index.js.map +0 -1
- package/dist/src/events/processors/AnalyticsProcessor.js +0 -103
- package/dist/src/events/processors/AnalyticsProcessor.js.map +0 -1
- package/dist/src/events/processors/AuditLogsProcessor.js +0 -86
- package/dist/src/events/processors/AuditLogsProcessor.js.map +0 -1
- package/dist/src/events/processors/LoggingProcessor.js +0 -47
- package/dist/src/events/processors/LoggingProcessor.js.map +0 -1
- package/dist/src/events/processors/Processors.js +0 -52
- package/dist/src/events/processors/Processors.js.map +0 -1
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js +0 -44
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +0 -1
- package/dist/src/events/processors/index.js +0 -23
- package/dist/src/events/processors/index.js.map +0 -1
- package/dist/src/events/processors/posthog/PosthogProcessor.js +0 -149
- package/dist/src/events/processors/posthog/PosthogProcessor.js.map +0 -1
- package/dist/src/events/processors/posthog/index.js +0 -8
- package/dist/src/events/processors/posthog/index.js.map +0 -1
- package/dist/src/events/processors/posthog/rateLimiting.js +0 -129
- package/dist/src/events/processors/posthog/rateLimiting.js.map +0 -1
- package/dist/src/events/processors/types.js +0 -3
- package/dist/src/events/processors/types.js.map +0 -1
- package/dist/src/events/publishers/account.js +0 -43
- package/dist/src/events/publishers/account.js.map +0 -1
- package/dist/src/events/publishers/ai.js +0 -30
- package/dist/src/events/publishers/ai.js.map +0 -1
- package/dist/src/events/publishers/app.js +0 -166
- package/dist/src/events/publishers/app.js.map +0 -1
- package/dist/src/events/publishers/auditLog.js +0 -34
- package/dist/src/events/publishers/auditLog.js.map +0 -1
- package/dist/src/events/publishers/auth.js +0 -80
- package/dist/src/events/publishers/auth.js.map +0 -1
- package/dist/src/events/publishers/automation.js +0 -117
- package/dist/src/events/publishers/automation.js.map +0 -1
- package/dist/src/events/publishers/backfill.js +0 -85
- package/dist/src/events/publishers/backfill.js.map +0 -1
- package/dist/src/events/publishers/backup.js +0 -41
- package/dist/src/events/publishers/backup.js.map +0 -1
- package/dist/src/events/publishers/datasource.js +0 -54
- package/dist/src/events/publishers/datasource.js.map +0 -1
- package/dist/src/events/publishers/email.js +0 -30
- package/dist/src/events/publishers/email.js.map +0 -1
- package/dist/src/events/publishers/environmentVariable.js +0 -44
- package/dist/src/events/publishers/environmentVariable.js.map +0 -1
- package/dist/src/events/publishers/group.js +0 -107
- package/dist/src/events/publishers/group.js.map +0 -1
- package/dist/src/events/publishers/index.js +0 -57
- package/dist/src/events/publishers/index.js.map +0 -1
- package/dist/src/events/publishers/installation.js +0 -52
- package/dist/src/events/publishers/installation.js.map +0 -1
- package/dist/src/events/publishers/layout.js +0 -34
- package/dist/src/events/publishers/layout.js.map +0 -1
- package/dist/src/events/publishers/license.js +0 -77
- package/dist/src/events/publishers/license.js.map +0 -1
- package/dist/src/events/publishers/org.js +0 -52
- package/dist/src/events/publishers/org.js.map +0 -1
- package/dist/src/events/publishers/plugin.js +0 -55
- package/dist/src/events/publishers/plugin.js.map +0 -1
- package/dist/src/events/publishers/query.js +0 -74
- package/dist/src/events/publishers/query.js.map +0 -1
- package/dist/src/events/publishers/role.js +0 -69
- package/dist/src/events/publishers/role.js.map +0 -1
- package/dist/src/events/publishers/rows.js +0 -32
- package/dist/src/events/publishers/rows.js.map +0 -1
- package/dist/src/events/publishers/screen.js +0 -46
- package/dist/src/events/publishers/screen.js.map +0 -1
- package/dist/src/events/publishers/serve.js +0 -47
- package/dist/src/events/publishers/serve.js.map +0 -1
- package/dist/src/events/publishers/table.js +0 -77
- package/dist/src/events/publishers/table.js.map +0 -1
- package/dist/src/events/publishers/user.js +0 -201
- package/dist/src/events/publishers/user.js.map +0 -1
- package/dist/src/events/publishers/view.js +0 -111
- package/dist/src/events/publishers/view.js.map +0 -1
- package/dist/src/features/features.js +0 -271
- package/dist/src/features/features.js.map +0 -1
- package/dist/src/features/index.js +0 -42
- package/dist/src/features/index.js.map +0 -1
- package/dist/src/features/tests/utils.js +0 -56
- package/dist/src/features/tests/utils.js.map +0 -1
- package/dist/src/helpers.js +0 -13
- package/dist/src/helpers.js.map +0 -1
- package/dist/src/index.js +0 -99
- package/dist/src/index.js.map +0 -1
- package/dist/src/installation.js +0 -159
- package/dist/src/installation.js.map +0 -1
- package/dist/src/logging/alerts.js +0 -23
- package/dist/src/logging/alerts.js.map +0 -1
- package/dist/src/logging/correlation/correlation.js +0 -18
- package/dist/src/logging/correlation/correlation.js.map +0 -1
- package/dist/src/logging/correlation/index.js +0 -18
- package/dist/src/logging/correlation/index.js.map +0 -1
- package/dist/src/logging/correlation/middleware.js +0 -17
- package/dist/src/logging/correlation/middleware.js.map +0 -1
- package/dist/src/logging/index.js +0 -45
- package/dist/src/logging/index.js.map +0 -1
- package/dist/src/logging/pino/logger.js +0 -234
- package/dist/src/logging/pino/logger.js.map +0 -1
- package/dist/src/logging/pino/middleware.js +0 -46
- package/dist/src/logging/pino/middleware.js.map +0 -1
- package/dist/src/logging/system.js +0 -110
- package/dist/src/logging/system.js.map +0 -1
- package/dist/src/middleware/adminOnly.js +0 -19
- package/dist/src/middleware/adminOnly.js.map +0 -1
- package/dist/src/middleware/auditLog.js +0 -18
- package/dist/src/middleware/auditLog.js.map +0 -1
- package/dist/src/middleware/authenticated.js +0 -254
- package/dist/src/middleware/authenticated.js.map +0 -1
- package/dist/src/middleware/builderOnly.js +0 -33
- package/dist/src/middleware/builderOnly.js.map +0 -1
- package/dist/src/middleware/builderOrAdmin.js +0 -33
- package/dist/src/middleware/builderOrAdmin.js.map +0 -1
- package/dist/src/middleware/contentSecurityPolicy.js +0 -124
- package/dist/src/middleware/contentSecurityPolicy.js.map +0 -1
- package/dist/src/middleware/csrf.js +0 -81
- package/dist/src/middleware/csrf.js.map +0 -1
- package/dist/src/middleware/errorHandling.js +0 -88
- package/dist/src/middleware/errorHandling.js.map +0 -1
- package/dist/src/middleware/index.js +0 -79
- package/dist/src/middleware/index.js.map +0 -1
- package/dist/src/middleware/internalApi.js +0 -30
- package/dist/src/middleware/internalApi.js.map +0 -1
- package/dist/src/middleware/ip.js +0 -23
- package/dist/src/middleware/ip.js.map +0 -1
- package/dist/src/middleware/joi-validator.js +0 -53
- package/dist/src/middleware/joi-validator.js.map +0 -1
- package/dist/src/middleware/matchers.js +0 -36
- package/dist/src/middleware/matchers.js.map +0 -1
- package/dist/src/middleware/passport/datasource/google.js +0 -107
- package/dist/src/middleware/passport/datasource/google.js.map +0 -1
- package/dist/src/middleware/passport/local.js +0 -91
- package/dist/src/middleware/passport/local.js.map +0 -1
- package/dist/src/middleware/passport/sso/google.js +0 -98
- package/dist/src/middleware/passport/sso/google.js.map +0 -1
- package/dist/src/middleware/passport/sso/oidc.js +0 -158
- package/dist/src/middleware/passport/sso/oidc.js.map +0 -1
- package/dist/src/middleware/passport/sso/sso.js +0 -150
- package/dist/src/middleware/passport/sso/sso.js.map +0 -1
- package/dist/src/middleware/passport/utils.js +0 -75
- package/dist/src/middleware/passport/utils.js.map +0 -1
- package/dist/src/middleware/querystringToBody.js +0 -29
- package/dist/src/middleware/querystringToBody.js.map +0 -1
- package/dist/src/middleware/tenancy.js +0 -37
- package/dist/src/middleware/tenancy.js.map +0 -1
- package/dist/src/migrations/definitions.js +0 -39
- package/dist/src/migrations/definitions.js.map +0 -1
- package/dist/src/migrations/index.js +0 -19
- package/dist/src/migrations/index.js.map +0 -1
- package/dist/src/migrations/migrations.js +0 -203
- package/dist/src/migrations/migrations.js.map +0 -1
- package/dist/src/objectStore/buckets/app.js +0 -95
- package/dist/src/objectStore/buckets/app.js.map +0 -1
- package/dist/src/objectStore/buckets/global.js +0 -68
- package/dist/src/objectStore/buckets/global.js.map +0 -1
- package/dist/src/objectStore/buckets/index.js +0 -20
- package/dist/src/objectStore/buckets/index.js.map +0 -1
- package/dist/src/objectStore/buckets/plugins.js +0 -104
- package/dist/src/objectStore/buckets/plugins.js.map +0 -1
- package/dist/src/objectStore/cloudfront.js +0 -73
- package/dist/src/objectStore/cloudfront.js.map +0 -1
- package/dist/src/objectStore/index.js +0 -20
- package/dist/src/objectStore/index.js.map +0 -1
- package/dist/src/objectStore/objectStore.js +0 -509
- package/dist/src/objectStore/objectStore.js.map +0 -1
- package/dist/src/objectStore/utils.js +0 -148
- package/dist/src/objectStore/utils.js.map +0 -1
- package/dist/src/platform/index.js +0 -43
- package/dist/src/platform/index.js.map +0 -1
- package/dist/src/platform/platformDb.js +0 -9
- package/dist/src/platform/platformDb.js.map +0 -1
- package/dist/src/platform/tenants.js +0 -149
- package/dist/src/platform/tenants.js.map +0 -1
- package/dist/src/platform/users.js +0 -118
- package/dist/src/platform/users.js.map +0 -1
- package/dist/src/plugin/index.js +0 -18
- package/dist/src/plugin/index.js.map +0 -1
- package/dist/src/plugin/utils.js +0 -158
- package/dist/src/plugin/utils.js.map +0 -1
- package/dist/src/queue/constants.js +0 -13
- package/dist/src/queue/constants.js.map +0 -1
- package/dist/src/queue/inMemoryQueue.js +0 -192
- package/dist/src/queue/inMemoryQueue.js.map +0 -1
- package/dist/src/queue/index.js +0 -19
- package/dist/src/queue/index.js.map +0 -1
- package/dist/src/queue/listeners.js +0 -199
- package/dist/src/queue/listeners.js.map +0 -1
- package/dist/src/queue/queue.js +0 -124
- package/dist/src/queue/queue.js.map +0 -1
- package/dist/src/redis/index.js +0 -47
- package/dist/src/redis/index.js.map +0 -1
- package/dist/src/redis/init.js +0 -184
- package/dist/src/redis/init.js.map +0 -1
- package/dist/src/redis/redis.js +0 -396
- package/dist/src/redis/redis.js.map +0 -1
- package/dist/src/redis/redlockImpl.js +0 -181
- package/dist/src/redis/redlockImpl.js.map +0 -1
- package/dist/src/redis/utils.js +0 -131
- package/dist/src/redis/utils.js.map +0 -1
- package/dist/src/security/auth.js +0 -26
- package/dist/src/security/auth.js.map +0 -1
- package/dist/src/security/encryption.js +0 -169
- package/dist/src/security/encryption.js.map +0 -1
- package/dist/src/security/index.js +0 -18
- package/dist/src/security/index.js.map +0 -1
- package/dist/src/security/permissions.js +0 -147
- package/dist/src/security/permissions.js.map +0 -1
- package/dist/src/security/roles.js +0 -566
- package/dist/src/security/roles.js.map +0 -1
- package/dist/src/security/secrets.js +0 -53
- package/dist/src/security/secrets.js.map +0 -1
- package/dist/src/security/sessions.js +0 -156
- package/dist/src/security/sessions.js.map +0 -1
- package/dist/src/sql/designDoc.js +0 -19
- package/dist/src/sql/designDoc.js.map +0 -1
- package/dist/src/sql/index.js +0 -47
- package/dist/src/sql/index.js.map +0 -1
- package/dist/src/sql/sql.js +0 -1536
- package/dist/src/sql/sql.js.map +0 -1
- package/dist/src/sql/sqlTable.js +0 -256
- package/dist/src/sql/sqlTable.js.map +0 -1
- package/dist/src/sql/utils.js +0 -179
- package/dist/src/sql/utils.js.map +0 -1
- package/dist/src/tenancy/db.js +0 -9
- package/dist/src/tenancy/db.js.map +0 -1
- package/dist/src/tenancy/index.js +0 -19
- package/dist/src/tenancy/index.js.map +0 -1
- package/dist/src/tenancy/tenancy.js +0 -125
- package/dist/src/tenancy/tenancy.js.map +0 -1
- package/dist/src/timers/index.js +0 -18
- package/dist/src/timers/index.js.map +0 -1
- package/dist/src/timers/timers.js +0 -25
- package/dist/src/timers/timers.js.map +0 -1
- package/dist/src/users/db.js +0 -489
- package/dist/src/users/db.js.map +0 -1
- package/dist/src/users/events.js +0 -179
- package/dist/src/users/events.js.map +0 -1
- package/dist/src/users/index.js +0 -23
- package/dist/src/users/index.js.map +0 -1
- package/dist/src/users/lookup.js +0 -126
- package/dist/src/users/lookup.js.map +0 -1
- package/dist/src/users/users.js +0 -376
- package/dist/src/users/users.js.map +0 -1
- package/dist/src/users/utils.js +0 -127
- package/dist/src/users/utils.js.map +0 -1
- package/dist/src/utils/Duration.js +0 -54
- package/dist/src/utils/Duration.js.map +0 -1
- package/dist/src/utils/hashing.js +0 -46
- package/dist/src/utils/hashing.js.map +0 -1
- package/dist/src/utils/index.js +0 -21
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/stringUtils.js +0 -8
- package/dist/src/utils/stringUtils.js.map +0 -1
- package/dist/src/utils/utils.js +0 -267
- package/dist/src/utils/utils.js.map +0 -1
- package/dist/tests/core/logging.js +0 -33
- package/dist/tests/core/logging.js.map +0 -1
- package/dist/tests/core/utilities/index.js +0 -48
- package/dist/tests/core/utilities/index.js.map +0 -1
- package/dist/tests/core/utilities/jestUtils.js +0 -21
- package/dist/tests/core/utilities/jestUtils.js.map +0 -1
- package/dist/tests/core/utilities/mocks/alerts.js +0 -40
- package/dist/tests/core/utilities/mocks/alerts.js.map +0 -1
- package/dist/tests/core/utilities/mocks/date.js +0 -6
- package/dist/tests/core/utilities/mocks/date.js.map +0 -1
- package/dist/tests/core/utilities/mocks/events.js +0 -154
- package/dist/tests/core/utilities/mocks/events.js.map +0 -1
- package/dist/tests/core/utilities/mocks/index.js +0 -47
- package/dist/tests/core/utilities/mocks/index.js.map +0 -1
- package/dist/tests/core/utilities/mocks/licenses.js +0 -109
- package/dist/tests/core/utilities/mocks/licenses.js.map +0 -1
- package/dist/tests/core/utilities/queue.js +0 -21
- package/dist/tests/core/utilities/queue.js.map +0 -1
- package/dist/tests/core/utilities/structures/Chance.js +0 -21
- package/dist/tests/core/utilities/structures/Chance.js.map +0 -1
- package/dist/tests/core/utilities/structures/accounts.js +0 -43
- package/dist/tests/core/utilities/structures/accounts.js.map +0 -1
- package/dist/tests/core/utilities/structures/apps.js +0 -23
- package/dist/tests/core/utilities/structures/apps.js.map +0 -1
- package/dist/tests/core/utilities/structures/common.js +0 -11
- package/dist/tests/core/utilities/structures/common.js.map +0 -1
- package/dist/tests/core/utilities/structures/db.js +0 -15
- package/dist/tests/core/utilities/structures/db.js.map +0 -1
- package/dist/tests/core/utilities/structures/documents/index.js +0 -18
- package/dist/tests/core/utilities/structures/documents/index.js.map +0 -1
- package/dist/tests/core/utilities/structures/documents/platform/index.js +0 -38
- package/dist/tests/core/utilities/structures/documents/platform/index.js.map +0 -1
- package/dist/tests/core/utilities/structures/documents/platform/installation.js +0 -47
- package/dist/tests/core/utilities/structures/documents/platform/installation.js.map +0 -1
- package/dist/tests/core/utilities/structures/generator.js +0 -9
- package/dist/tests/core/utilities/structures/generator.js.map +0 -1
- package/dist/tests/core/utilities/structures/index.js +0 -56
- package/dist/tests/core/utilities/structures/index.js.map +0 -1
- package/dist/tests/core/utilities/structures/koa.js +0 -10
- package/dist/tests/core/utilities/structures/koa.js.map +0 -1
- package/dist/tests/core/utilities/structures/licenses.js +0 -157
- package/dist/tests/core/utilities/structures/licenses.js.map +0 -1
- package/dist/tests/core/utilities/structures/plugins.js +0 -22
- package/dist/tests/core/utilities/structures/plugins.js.map +0 -1
- package/dist/tests/core/utilities/structures/quotas.js +0 -73
- package/dist/tests/core/utilities/structures/quotas.js.map +0 -1
- package/dist/tests/core/utilities/structures/scim.js +0 -62
- package/dist/tests/core/utilities/structures/scim.js.map +0 -1
- package/dist/tests/core/utilities/structures/sso.js +0 -140
- package/dist/tests/core/utilities/structures/sso.js.map +0 -1
- package/dist/tests/core/utilities/structures/tenants.js +0 -8
- package/dist/tests/core/utilities/structures/tenants.js.map +0 -1
- package/dist/tests/core/utilities/structures/userGroups.js +0 -12
- package/dist/tests/core/utilities/structures/userGroups.js.map +0 -1
- package/dist/tests/core/utilities/structures/users.js +0 -53
- package/dist/tests/core/utilities/structures/users.js.map +0 -1
- package/dist/tests/core/utilities/testContainerUtils.js +0 -161
- package/dist/tests/core/utilities/testContainerUtils.js.map +0 -1
- package/dist/tests/core/utilities/utils/index.js +0 -39
- package/dist/tests/core/utilities/utils/index.js.map +0 -1
- package/dist/tests/core/utilities/utils/queue.js +0 -37
- package/dist/tests/core/utilities/utils/queue.js.map +0 -1
- package/dist/tests/core/utilities/utils/time.js +0 -7
- package/dist/tests/core/utilities/utils/time.js.map +0 -1
- package/dist/tests/extra/DBTestConfiguration.js +0 -65
- package/dist/tests/extra/DBTestConfiguration.js.map +0 -1
- package/dist/tests/extra/index.js +0 -43
- package/dist/tests/extra/index.js.map +0 -1
- package/dist/tests/extra/testEnv.js +0 -136
- package/dist/tests/extra/testEnv.js.map +0 -1
- package/dist/tests/index.js +0 -19
- package/dist/tests/index.js.map +0 -1
- package/dist/tests/jestEnv.js +0 -12
- package/dist/tests/jestEnv.js.map +0 -1
- package/dist/tests/jestSetup.js +0 -33
- package/dist/tests/jestSetup.js.map +0 -1
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const events_1 = __importDefault(require("events"));
|
|
16
|
-
const utils_1 = require("../utils");
|
|
17
|
-
/**
|
|
18
|
-
* Bull works with a Job wrapper around all messages that contains a lot more information about
|
|
19
|
-
* the state of the message, this object constructor implements the same schema of Bull jobs
|
|
20
|
-
* for the sake of maintaining API consistency.
|
|
21
|
-
* @param queue The name of the queue which the message will be carried on.
|
|
22
|
-
* @param message The JSON message which will be passed back to the consumer.
|
|
23
|
-
* @returns A new job which can now be put onto the queue, this is mostly an
|
|
24
|
-
* internal structure so that an in memory queue can be easily swapped for a Bull queue.
|
|
25
|
-
*/
|
|
26
|
-
function newJob(queue, message, opts) {
|
|
27
|
-
return {
|
|
28
|
-
id: (0, utils_1.newid)(),
|
|
29
|
-
timestamp: Date.now(),
|
|
30
|
-
queue: queue,
|
|
31
|
-
data: message,
|
|
32
|
-
opts,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* This is designed to replicate Bull (https://github.com/OptimalBits/bull) in memory as a sort of mock.
|
|
37
|
-
* It is relatively simple, using an event emitter internally to register when messages are available
|
|
38
|
-
* to the consumers - in can support many inputs and many consumers.
|
|
39
|
-
*/
|
|
40
|
-
class InMemoryQueue {
|
|
41
|
-
/**
|
|
42
|
-
* The constructor the queue, exactly the same as that of Bulls.
|
|
43
|
-
* @param name The name of the queue which is being configured.
|
|
44
|
-
* @param opts This is not used by the in memory queue as there is no real use
|
|
45
|
-
* case when in memory, but is the same API as Bull
|
|
46
|
-
*/
|
|
47
|
-
constructor(name, opts) {
|
|
48
|
-
this._name = name;
|
|
49
|
-
this._opts = opts;
|
|
50
|
-
this._messages = [];
|
|
51
|
-
this._emitter = new events_1.default.EventEmitter();
|
|
52
|
-
this._runCount = 0;
|
|
53
|
-
this._addCount = 0;
|
|
54
|
-
this._queuedJobIds = new Set();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Same callback API as Bull, each callback passed to this will consume messages as they are
|
|
58
|
-
* available. Please note this is a queue service, not a notification service, so each
|
|
59
|
-
* consumer will receive different messages.
|
|
60
|
-
* as the Bull API, within this job the property "data" contains the JSON message. Please
|
|
61
|
-
* note this is incredibly limited compared to Bull as in reality the Job would contain
|
|
62
|
-
* a lot more information about the queue and current status of Bull cluster.
|
|
63
|
-
*/
|
|
64
|
-
process(concurrencyOrFunc, func) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
func = typeof concurrencyOrFunc === "number" ? func : concurrencyOrFunc;
|
|
67
|
-
this._emitter.on("message", () => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
var _a, _b, _c;
|
|
69
|
-
if (this._messages.length <= 0) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
let msg = this._messages.shift();
|
|
73
|
-
let resp = func(msg);
|
|
74
|
-
function retryFunc(fnc) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
try {
|
|
77
|
-
yield fnc;
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
yield new Promise(r => setTimeout(() => r(), 50));
|
|
81
|
-
yield retryFunc(func(msg));
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (resp.then != null) {
|
|
86
|
-
try {
|
|
87
|
-
yield retryFunc(resp);
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
console.error(e);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
this._runCount++;
|
|
94
|
-
const jobId = (_b = (_a = msg === null || msg === void 0 ? void 0 : msg.opts) === null || _a === void 0 ? void 0 : _a.jobId) === null || _b === void 0 ? void 0 : _b.toString();
|
|
95
|
-
if (jobId && ((_c = msg === null || msg === void 0 ? void 0 : msg.opts) === null || _c === void 0 ? void 0 : _c.removeOnComplete)) {
|
|
96
|
-
this._queuedJobIds.delete(jobId);
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
isReady() {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
return this;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
// simply puts a message to the queue and emits to the queue for processing
|
|
107
|
-
/**
|
|
108
|
-
* Simple function to replicate the add message functionality of Bull, putting
|
|
109
|
-
* a new message on the queue. This then emits an event which will be used to
|
|
110
|
-
* return the message to a consumer (if one is attached).
|
|
111
|
-
* @param msg A message to be transported over the queue, this should be
|
|
112
|
-
* a JSON message as this is required by Bull.
|
|
113
|
-
* @param repeat serves no purpose for the import queue.
|
|
114
|
-
*/
|
|
115
|
-
add(data, opts) {
|
|
116
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
var _a;
|
|
118
|
-
const jobId = (_a = opts === null || opts === void 0 ? void 0 : opts.jobId) === null || _a === void 0 ? void 0 : _a.toString();
|
|
119
|
-
if (jobId && this._queuedJobIds.has(jobId)) {
|
|
120
|
-
console.log(`Ignoring already queued job ${jobId}`);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (typeof data !== "object") {
|
|
124
|
-
throw "Queue only supports carrying JSON.";
|
|
125
|
-
}
|
|
126
|
-
if (jobId) {
|
|
127
|
-
this._queuedJobIds.add(jobId);
|
|
128
|
-
}
|
|
129
|
-
const pushMessage = () => {
|
|
130
|
-
this._messages.push(newJob(this._name, data, opts));
|
|
131
|
-
this._addCount++;
|
|
132
|
-
this._emitter.emit("message");
|
|
133
|
-
};
|
|
134
|
-
const delay = opts === null || opts === void 0 ? void 0 : opts.delay;
|
|
135
|
-
if (delay) {
|
|
136
|
-
setTimeout(pushMessage, delay);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
pushMessage();
|
|
140
|
-
}
|
|
141
|
-
return { id: jobId };
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* replicating the close function from bull, which waits for jobs to finish.
|
|
146
|
-
*/
|
|
147
|
-
close() {
|
|
148
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* This removes a cron which has been implemented, this is part of Bull API.
|
|
152
|
-
* @param cronJobId The cron which is to be removed.
|
|
153
|
-
*/
|
|
154
|
-
removeRepeatableByKey(cronJobId) {
|
|
155
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
// TODO: implement for testing
|
|
157
|
-
console.log(cronJobId);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Implemented for tests
|
|
162
|
-
*/
|
|
163
|
-
getRepeatableJobs() {
|
|
164
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
return [];
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
removeJobs(_pattern) {
|
|
169
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
// no-op
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Implemented for tests
|
|
175
|
-
*/
|
|
176
|
-
clean() {
|
|
177
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
return [];
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
getJob() {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
return null;
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
on() {
|
|
187
|
-
// do nothing
|
|
188
|
-
return this;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
exports.default = InMemoryQueue;
|
|
192
|
-
//# sourceMappingURL=inMemoryQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inMemoryQueue.js","sourceRoot":"","sources":["../../../src/queue/inMemoryQueue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA2B;AAC3B,oCAAgC;AAWhC;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAC,KAAa,EAAE,OAAY,EAAE,IAAiB;IAC5D,OAAO;QACL,EAAE,EAAE,IAAA,aAAK,GAAE;QACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,OAAO;QACb,IAAI;KACL,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,aAAa;IASjB;;;;;OAKG;IACH,YAAY,IAAY,EAAE,IAAmB;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,KAAK,GAAG,IA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;gBAChB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC/B,CAAC,CAAA;YAED,MAAM,KAAK,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA;YACzB,IAAI,KAAK,EAAE,CAAC;gBACV,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;YAChC,CAAC;iBAAM,CAAC;gBACN,WAAW,EAAE,CAAA;YACf,CAAC;YACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAS,CAAA;QAC7B,CAAC;KAAA;IAED;;OAEG;IACG,KAAK;8DAAI,CAAC;KAAA;IAEhB;;;OAGG;IACG,qBAAqB,CAAC,SAAiB;;YAC3C,8BAA8B;YAC9B,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QACxB,CAAC;KAAA;IAED;;OAEG;IACG,iBAAiB;;YACrB,OAAO,EAAE,CAAA;QACX,CAAC;KAAA;IAEK,UAAU,CAAC,QAAgB;;YAC/B,QAAQ;QACV,CAAC;KAAA;IAED;;OAEG;IACG,KAAK;;YACT,OAAO,EAAE,CAAA;QACX,CAAC;KAAA;IAEK,MAAM;;YACV,OAAO,IAAI,CAAA;QACb,CAAC;KAAA;IAED,EAAE;QACA,aAAa;QACb,OAAO,IAAW,CAAA;IACpB,CAAC;CACF;AAED,kBAAe,aAAa,CAAA"}
|
package/dist/src/queue/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./queue"), exports);
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/queue/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,8CAA2B"}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.addListeners = addListeners;
|
|
46
|
-
const constants_1 = require("./constants");
|
|
47
|
-
const context = __importStar(require("../context"));
|
|
48
|
-
function addListeners(queue, jobQueue, removeStalledCb) {
|
|
49
|
-
logging(queue, jobQueue);
|
|
50
|
-
if (removeStalledCb) {
|
|
51
|
-
handleStalled(queue, removeStalledCb);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function handleStalled(queue, removeStalledCb) {
|
|
55
|
-
queue.on("stalled", (job) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
if (removeStalledCb) {
|
|
57
|
-
yield removeStalledCb(job);
|
|
58
|
-
}
|
|
59
|
-
else if (job.opts.repeat) {
|
|
60
|
-
const jobId = job.id;
|
|
61
|
-
const repeatJobs = yield queue.getRepeatableJobs();
|
|
62
|
-
for (let repeatJob of repeatJobs) {
|
|
63
|
-
if (repeatJob.id === jobId) {
|
|
64
|
-
yield queue.removeRepeatableByKey(repeatJob.key);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
console.log(`jobId=${jobId} disabled`);
|
|
68
|
-
}
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
72
|
-
var _a, _b, _c;
|
|
73
|
-
const message = `[BULL] ${eventType}=${event}`;
|
|
74
|
-
const err = opts.error;
|
|
75
|
-
const bullLog = Object.assign({ _logKey: "bull", eventType,
|
|
76
|
-
event, job: opts.job, jobId: opts.jobId || ((_a = opts.job) === null || _a === void 0 ? void 0 : _a.id) }, extra);
|
|
77
|
-
let automationLog;
|
|
78
|
-
if ((_c = (_b = opts.job) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.automation) {
|
|
79
|
-
automationLog = {
|
|
80
|
-
_logKey: "automation",
|
|
81
|
-
trigger: opts.job
|
|
82
|
-
? opts.job.data.automation.definition.trigger.event
|
|
83
|
-
: undefined,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return [message, err, bullLog, automationLog];
|
|
87
|
-
}
|
|
88
|
-
var BullEvent;
|
|
89
|
-
(function (BullEvent) {
|
|
90
|
-
BullEvent["ERROR"] = "error";
|
|
91
|
-
BullEvent["WAITING"] = "waiting";
|
|
92
|
-
BullEvent["ACTIVE"] = "active";
|
|
93
|
-
BullEvent["STALLED"] = "stalled";
|
|
94
|
-
BullEvent["PROGRESS"] = "progress";
|
|
95
|
-
BullEvent["COMPLETED"] = "completed";
|
|
96
|
-
BullEvent["FAILED"] = "failed";
|
|
97
|
-
BullEvent["PAUSED"] = "paused";
|
|
98
|
-
BullEvent["RESUMED"] = "resumed";
|
|
99
|
-
BullEvent["CLEANED"] = "cleaned";
|
|
100
|
-
BullEvent["DRAINED"] = "drained";
|
|
101
|
-
BullEvent["REMOVED"] = "removed";
|
|
102
|
-
})(BullEvent || (BullEvent = {}));
|
|
103
|
-
var QueueEventType;
|
|
104
|
-
(function (QueueEventType) {
|
|
105
|
-
QueueEventType["AUTOMATION_EVENT"] = "automation-event";
|
|
106
|
-
QueueEventType["APP_BACKUP_EVENT"] = "app-backup-event";
|
|
107
|
-
QueueEventType["AUDIT_LOG_EVENT"] = "audit-log-event";
|
|
108
|
-
QueueEventType["SYSTEM_EVENT"] = "system-event";
|
|
109
|
-
QueueEventType["APP_MIGRATION"] = "app-migration";
|
|
110
|
-
QueueEventType["DOC_WRITETHROUGH"] = "doc-writethrough";
|
|
111
|
-
})(QueueEventType || (QueueEventType = {}));
|
|
112
|
-
const EventTypeMap = {
|
|
113
|
-
[constants_1.JobQueue.AUTOMATION]: QueueEventType.AUTOMATION_EVENT,
|
|
114
|
-
[constants_1.JobQueue.APP_BACKUP]: QueueEventType.APP_BACKUP_EVENT,
|
|
115
|
-
[constants_1.JobQueue.AUDIT_LOG]: QueueEventType.AUDIT_LOG_EVENT,
|
|
116
|
-
[constants_1.JobQueue.SYSTEM_EVENT_QUEUE]: QueueEventType.SYSTEM_EVENT,
|
|
117
|
-
[constants_1.JobQueue.APP_MIGRATION]: QueueEventType.APP_MIGRATION,
|
|
118
|
-
[constants_1.JobQueue.DOC_WRITETHROUGH_QUEUE]: QueueEventType.DOC_WRITETHROUGH,
|
|
119
|
-
};
|
|
120
|
-
function logging(queue, jobQueue) {
|
|
121
|
-
var _a;
|
|
122
|
-
const eventType = EventTypeMap[jobQueue];
|
|
123
|
-
function doInJobContext(job, task) {
|
|
124
|
-
var _a;
|
|
125
|
-
// if this is an automation job try to get the app id
|
|
126
|
-
const appId = (_a = job.data.event) === null || _a === void 0 ? void 0 : _a.appId;
|
|
127
|
-
if (appId) {
|
|
128
|
-
return context.doInContext(appId, task);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
task();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
queue
|
|
135
|
-
.on(BullEvent.STALLED, (job) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
// A job has been marked as stalled. This is useful for debugging job
|
|
137
|
-
// workers that crash or pause the event loop.
|
|
138
|
-
yield doInJobContext(job, () => {
|
|
139
|
-
console.error(...getLogParams(eventType, BullEvent.STALLED, { job }));
|
|
140
|
-
});
|
|
141
|
-
}))
|
|
142
|
-
.on(BullEvent.ERROR, (error) => {
|
|
143
|
-
// An error occurred.
|
|
144
|
-
console.error(...getLogParams(eventType, BullEvent.ERROR, { error }));
|
|
145
|
-
});
|
|
146
|
-
if ((_a = process.env.NODE_DEBUG) === null || _a === void 0 ? void 0 : _a.includes("bull")) {
|
|
147
|
-
queue
|
|
148
|
-
.on(BullEvent.WAITING, (jobId) => {
|
|
149
|
-
// A Job is waiting to be processed as soon as a worker is idling.
|
|
150
|
-
console.info(...getLogParams(eventType, BullEvent.WAITING, { jobId }));
|
|
151
|
-
})
|
|
152
|
-
.on(BullEvent.ACTIVE, (job) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
// A job has started. You can use `jobPromise.cancel()`` to abort it.
|
|
154
|
-
yield doInJobContext(job, () => {
|
|
155
|
-
console.info(...getLogParams(eventType, BullEvent.ACTIVE, { job }));
|
|
156
|
-
});
|
|
157
|
-
}))
|
|
158
|
-
.on(BullEvent.PROGRESS, (job, progress) => __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
// A job's progress was updated
|
|
160
|
-
yield doInJobContext(job, () => {
|
|
161
|
-
console.info(...getLogParams(eventType, BullEvent.PROGRESS, { job }, { progress }));
|
|
162
|
-
});
|
|
163
|
-
}))
|
|
164
|
-
.on(BullEvent.COMPLETED, (job, result) => __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
// A job successfully completed with a `result`.
|
|
166
|
-
yield doInJobContext(job, () => {
|
|
167
|
-
console.info(...getLogParams(eventType, BullEvent.COMPLETED, { job }, { result }));
|
|
168
|
-
});
|
|
169
|
-
}))
|
|
170
|
-
.on(BullEvent.FAILED, (job, error) => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
// A job failed with reason `err`!
|
|
172
|
-
yield doInJobContext(job, () => {
|
|
173
|
-
console.error(...getLogParams(eventType, BullEvent.FAILED, { job, error }));
|
|
174
|
-
});
|
|
175
|
-
}))
|
|
176
|
-
.on(BullEvent.PAUSED, () => {
|
|
177
|
-
// The queue has been paused.
|
|
178
|
-
console.info(...getLogParams(eventType, BullEvent.PAUSED));
|
|
179
|
-
})
|
|
180
|
-
.on(BullEvent.RESUMED, () => {
|
|
181
|
-
// The queue has been resumed.
|
|
182
|
-
console.info(...getLogParams(eventType, BullEvent.RESUMED));
|
|
183
|
-
})
|
|
184
|
-
.on(BullEvent.CLEANED, (jobs, type) => {
|
|
185
|
-
// Old jobs have been cleaned from the queue. `jobs` is an array of cleaned
|
|
186
|
-
// jobs, and `type` is the type of jobs cleaned.
|
|
187
|
-
console.info(...getLogParams(eventType, BullEvent.CLEANED, {}, { length: jobs.length, type }));
|
|
188
|
-
})
|
|
189
|
-
.on(BullEvent.DRAINED, () => {
|
|
190
|
-
// Emitted every time the queue has processed all the waiting jobs (even if there can be some delayed jobs not yet processed)
|
|
191
|
-
console.info(...getLogParams(eventType, BullEvent.DRAINED));
|
|
192
|
-
})
|
|
193
|
-
.on(BullEvent.REMOVED, (job) => {
|
|
194
|
-
// A job successfully removed.
|
|
195
|
-
console.info(...getLogParams(eventType, BullEvent.REMOVED, { job }));
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
//# sourceMappingURL=listeners.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../src/queue/listeners.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,EAAE;YAClC,8BAA8B;YAC9B,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QACtE,CAAC,CAAC,CAAA;IACN,CAAC;AACH,CAAC"}
|
package/dist/src/queue/queue.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.createQueue = createQueue;
|
|
49
|
-
exports.shutdown = shutdown;
|
|
50
|
-
const environment_1 = __importDefault(require("../environment"));
|
|
51
|
-
const utils_1 = require("../redis/utils");
|
|
52
|
-
const inMemoryQueue_1 = __importDefault(require("./inMemoryQueue"));
|
|
53
|
-
const bull_1 = __importDefault(require("bull"));
|
|
54
|
-
const listeners_1 = require("./listeners");
|
|
55
|
-
const utils_2 = require("../utils");
|
|
56
|
-
const timers = __importStar(require("../timers"));
|
|
57
|
-
// the queue lock is held for 5 minutes
|
|
58
|
-
const QUEUE_LOCK_MS = utils_2.Duration.fromMinutes(5).toMs();
|
|
59
|
-
// queue lock is refreshed every 30 seconds
|
|
60
|
-
const QUEUE_LOCK_RENEW_INTERNAL_MS = utils_2.Duration.fromSeconds(30).toMs();
|
|
61
|
-
// cleanup the queue every 60 seconds
|
|
62
|
-
const CLEANUP_PERIOD_MS = utils_2.Duration.fromSeconds(60).toMs();
|
|
63
|
-
let QUEUES = [];
|
|
64
|
-
let cleanupInterval;
|
|
65
|
-
function cleanup() {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
for (let queue of QUEUES) {
|
|
68
|
-
yield queue.clean(CLEANUP_PERIOD_MS, "completed");
|
|
69
|
-
yield queue.clean(CLEANUP_PERIOD_MS, "failed");
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function createQueue(jobQueue, opts = {}) {
|
|
74
|
-
const redisOpts = (0, utils_1.getRedisOptions)();
|
|
75
|
-
const queueConfig = {
|
|
76
|
-
redis: redisOpts,
|
|
77
|
-
settings: {
|
|
78
|
-
maxStalledCount: opts.maxStalledCount ? opts.maxStalledCount : 0,
|
|
79
|
-
lockDuration: QUEUE_LOCK_MS,
|
|
80
|
-
lockRenewTime: QUEUE_LOCK_RENEW_INTERNAL_MS,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
if (opts.jobOptions) {
|
|
84
|
-
queueConfig.defaultJobOptions = opts.jobOptions;
|
|
85
|
-
}
|
|
86
|
-
let queue;
|
|
87
|
-
if (!environment_1.default.isTest()) {
|
|
88
|
-
queue = new bull_1.default(jobQueue, queueConfig);
|
|
89
|
-
}
|
|
90
|
-
else if (process.env.BULL_TEST_REDIS_PORT &&
|
|
91
|
-
!isNaN(+process.env.BULL_TEST_REDIS_PORT)) {
|
|
92
|
-
queue = new bull_1.default(jobQueue, {
|
|
93
|
-
redis: { host: "localhost", port: +process.env.BULL_TEST_REDIS_PORT },
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
queue = new inMemoryQueue_1.default(jobQueue, queueConfig);
|
|
98
|
-
}
|
|
99
|
-
(0, listeners_1.addListeners)(queue, jobQueue, opts === null || opts === void 0 ? void 0 : opts.removeStalledCb);
|
|
100
|
-
QUEUES.push(queue);
|
|
101
|
-
if (!cleanupInterval && !environment_1.default.isTest()) {
|
|
102
|
-
cleanupInterval = timers.set(cleanup, CLEANUP_PERIOD_MS);
|
|
103
|
-
// fire off an initial cleanup
|
|
104
|
-
cleanup().catch(err => {
|
|
105
|
-
console.error(`Unable to cleanup ${jobQueue} initially - ${err}`);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
return queue;
|
|
109
|
-
}
|
|
110
|
-
function shutdown() {
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
if (cleanupInterval) {
|
|
113
|
-
timers.clear(cleanupInterval);
|
|
114
|
-
}
|
|
115
|
-
if (QUEUES.length) {
|
|
116
|
-
for (let queue of QUEUES) {
|
|
117
|
-
yield queue.close();
|
|
118
|
-
}
|
|
119
|
-
QUEUES = [];
|
|
120
|
-
}
|
|
121
|
-
console.log("Queues shutdown");
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=queue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../src/queue/queue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,kCA2CC;AAED,4BAWC;AAnFD,iEAAgC;AAChC,0CAAgD;AAEhD,oEAA2C;AAC3C,gDAA0D;AAC1D,2CAAqD;AACrD,oCAAmC;AACnC,kDAAmC;AAInC,uCAAuC;AACvC,MAAM,aAAa,GAAG,gBAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACpD,2CAA2C;AAC3C,MAAM,4BAA4B,GAAG,gBAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AACpE,qCAAqC;AACrC,MAAM,iBAAiB,GAAG,gBAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AACzD,IAAI,MAAM,GAAsB,EAAE,CAAA;AAClC,IAAI,eAA+B,CAAA;AAEnC,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ACD,IAAA,wBAAY,EAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,eAAe,CAAC,CAAA;IACpD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClB,IAAI,CAAC,eAAe,IAAI,CAAC,qBAAG,CAAC,MAAM,EAAE,EAAE,CAAC;QACtC,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAA;QACxD,8BAA8B;QAC9B,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,gBAAgB,GAAG,EAAE,CAAC,CAAA;QACnE,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAsB,QAAQ;;QAC5B,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAC/B,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;gBACzB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;YACrB,CAAC;YACD,MAAM,GAAG,EAAE,CAAA;QACb,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;IAChC,CAAC;CAAA"}
|
package/dist/src/redis/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.locks = exports.clients = exports.utils = exports.Client = void 0;
|
|
40
|
-
// Mimic the outer package export for usage in index.ts
|
|
41
|
-
// The outer exports can't be used as they now reference dist directly
|
|
42
|
-
var redis_1 = require("./redis");
|
|
43
|
-
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return __importDefault(redis_1).default; } });
|
|
44
|
-
exports.utils = __importStar(require("./utils"));
|
|
45
|
-
exports.clients = __importStar(require("./init"));
|
|
46
|
-
exports.locks = __importStar(require("./redlockImpl"));
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/redis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,sEAAsE;AACtE,iCAA2C;AAAlC,gHAAA,OAAO,OAAU;AAC1B,iDAAgC;AAChC,kDAAiC;AACjC,uDAAsC"}
|