@budibase/backend-core 2.9.16 → 2.9.18
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 +12544 -0
- package/dist/index.js.map +7 -0
- package/dist/index.js.meta.json +1 -0
- package/dist/package.json +5 -5
- package/dist/plugins.js +288 -16
- package/dist/plugins.js.map +7 -1
- package/dist/plugins.js.meta.json +1 -0
- package/dist/tests.js +8476 -0
- package/dist/tests.js.map +7 -0
- package/dist/tests.js.meta.json +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/scripts/build.js +6 -0
- package/tsconfig.build.json +5 -1
- package/tsconfig.json +0 -8
- package/dist/jest.config.js +0 -25
- package/dist/jest.config.js.map +0 -1
- package/dist/plugins.d.ts +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 -92
- 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 -189
- 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 -76
- 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 -120
- package/dist/src/cache/base/index.js.map +0 -1
- package/dist/src/cache/generic.js +0 -31
- package/dist/src/cache/generic.js.map +0 -1
- package/dist/src/cache/index.js +0 -35
- package/dist/src/cache/index.js.map +0 -1
- package/dist/src/cache/user.js +0 -108
- package/dist/src/cache/user.js.map +0 -1
- package/dist/src/cache/writethrough.js +0 -159
- package/dist/src/cache/writethrough.js.map +0 -1
- package/dist/src/configs/configs.js +0 -278
- 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 -67
- 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 -54
- 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 -72
- package/dist/src/context/identity.js.map +0 -1
- package/dist/src/context/index.js +0 -34
- package/dist/src/context/index.js.map +0 -1
- package/dist/src/context/mainContext.js +0 -331
- 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 -85
- package/dist/src/db/Replication.js.map +0 -1
- package/dist/src/db/constants.js +0 -13
- package/dist/src/db/constants.js.map +0 -1
- package/dist/src/db/couch/DatabaseImpl.js +0 -248
- package/dist/src/db/couch/DatabaseImpl.js.map +0 -1
- package/dist/src/db/couch/connections.js +0 -88
- package/dist/src/db/couch/connections.js.map +0 -1
- package/dist/src/db/couch/index.js +0 -27
- 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 -55
- package/dist/src/db/couch/utils.js.map +0 -1
- package/dist/src/db/db.js +0 -59
- package/dist/src/db/db.js.map +0 -1
- package/dist/src/db/errors.js +0 -22
- package/dist/src/db/errors.js.map +0 -1
- package/dist/src/db/index.js +0 -48
- package/dist/src/db/index.js.map +0 -1
- package/dist/src/db/lucene.js +0 -650
- 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 -77
- package/dist/src/db/searchIndexes/searchIndexes.js.map +0 -1
- package/dist/src/db/utils.js +0 -213
- package/dist/src/db/utils.js.map +0 -1
- package/dist/src/db/views.js +0 -219
- 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 -112
- 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 -9
- package/dist/src/docIds/newid.js.map +0 -1
- package/dist/src/docIds/params.js +0 -138
- package/dist/src/docIds/params.js.map +0 -1
- package/dist/src/docUpdates/index.js +0 -36
- package/dist/src/docUpdates/index.js.map +0 -1
- package/dist/src/environment.js +0 -110
- 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 -42
- 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 -27
- 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 -179
- package/dist/src/events/backfill.js.map +0 -1
- package/dist/src/events/documentId.js +0 -28
- package/dist/src/events/documentId.js.map +0 -1
- package/dist/src/events/events.js +0 -73
- package/dist/src/events/events.js.map +0 -1
- package/dist/src/events/identification.js +0 -300
- package/dist/src/events/identification.js.map +0 -1
- package/dist/src/events/index.js +0 -47
- package/dist/src/events/index.js.map +0 -1
- package/dist/src/events/processors/AnalyticsProcessor.js +0 -93
- 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 -139
- 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 -119
- 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/app.js +0 -153
- 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 -55
- 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 -202
- 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/featureFlags/index.js +0 -96
- package/dist/src/featureFlags/index.js.map +0 -1
- package/dist/src/helpers.js +0 -14
- package/dist/src/helpers.js.map +0 -1
- package/dist/src/index.js +0 -82
- package/dist/src/index.js.map +0 -1
- package/dist/src/installation.js +0 -138
- package/dist/src/installation.js.map +0 -1
- package/dist/src/logging/alerts.js +0 -24
- package/dist/src/logging/alerts.js.map +0 -1
- package/dist/src/logging/correlation/correlation.js +0 -17
- 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 -35
- package/dist/src/logging/index.js.map +0 -1
- package/dist/src/logging/pino/logger.js +0 -218
- package/dist/src/logging/pino/logger.js.map +0 -1
- package/dist/src/logging/pino/middleware.js +0 -47
- package/dist/src/logging/pino/middleware.js.map +0 -1
- package/dist/src/logging/system.js +0 -101
- 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 -16
- package/dist/src/middleware/auditLog.js.map +0 -1
- package/dist/src/middleware/authenticated.js +0 -204
- 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/csrf.js +0 -81
- package/dist/src/middleware/csrf.js.map +0 -1
- package/dist/src/middleware/errorHandling.js +0 -64
- package/dist/src/middleware/errorHandling.js.map +0 -1
- package/dist/src/middleware/index.js +0 -65
- 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/joi-validator.js +0 -47
- package/dist/src/middleware/joi-validator.js.map +0 -1
- package/dist/src/middleware/matchers.js +0 -43
- package/dist/src/middleware/matchers.js.map +0 -1
- package/dist/src/middleware/passport/datasource/google.js +0 -95
- package/dist/src/middleware/passport/datasource/google.js.map +0 -1
- package/dist/src/middleware/passport/local.js +0 -81
- package/dist/src/middleware/passport/local.js.map +0 -1
- package/dist/src/middleware/passport/sso/google.js +0 -90
- package/dist/src/middleware/passport/sso/google.js.map +0 -1
- package/dist/src/middleware/passport/sso/oidc.js +0 -151
- package/dist/src/middleware/passport/sso/oidc.js.map +0 -1
- package/dist/src/middleware/passport/sso/sso.js +0 -165
- package/dist/src/middleware/passport/sso/sso.js.map +0 -1
- package/dist/src/middleware/passport/utils.js +0 -66
- 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 -198
- package/dist/src/migrations/migrations.js.map +0 -1
- package/dist/src/objectStore/buckets/app.js +0 -73
- package/dist/src/objectStore/buckets/app.js.map +0 -1
- package/dist/src/objectStore/buckets/global.js +0 -58
- 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 -95
- package/dist/src/objectStore/buckets/plugins.js.map +0 -1
- package/dist/src/objectStore/cloudfront.js +0 -40
- 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 -382
- package/dist/src/objectStore/objectStore.js.map +0 -1
- package/dist/src/objectStore/utils.js +0 -32
- package/dist/src/objectStore/utils.js.map +0 -1
- package/dist/src/platform/index.js +0 -33
- package/dist/src/platform/index.js.map +0 -1
- package/dist/src/platform/platformDb.js +0 -10
- package/dist/src/platform/platformDb.js.map +0 -1
- package/dist/src/platform/tenants.js +0 -139
- package/dist/src/platform/tenants.js.map +0 -1
- package/dist/src/platform/users.js +0 -96
- 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 -145
- package/dist/src/plugin/utils.js.map +0 -1
- package/dist/src/queue/constants.js +0 -11
- package/dist/src/queue/constants.js.map +0 -1
- package/dist/src/queue/inMemoryQueue.js +0 -145
- 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 -186
- package/dist/src/queue/listeners.js.map +0 -1
- package/dist/src/queue/queue.js +0 -92
- package/dist/src/queue/queue.js.map +0 -1
- package/dist/src/redis/index.js +0 -37
- package/dist/src/redis/index.js.map +0 -1
- package/dist/src/redis/init.js +0 -138
- package/dist/src/redis/init.js.map +0 -1
- package/dist/src/redis/redis.js +0 -335
- package/dist/src/redis/redis.js.map +0 -1
- package/dist/src/redis/redlockImpl.js +0 -162
- package/dist/src/redis/redlockImpl.js.map +0 -1
- package/dist/src/redis/utils.js +0 -123
- package/dist/src/redis/utils.js.map +0 -1
- package/dist/src/security/encryption.js +0 -163
- package/dist/src/security/encryption.js.map +0 -1
- package/dist/src/security/permissions.js +0 -151
- package/dist/src/security/permissions.js.map +0 -1
- package/dist/src/security/roles.js +0 -388
- package/dist/src/security/roles.js.map +0 -1
- package/dist/src/security/sessions.js +0 -121
- package/dist/src/security/sessions.js.map +0 -1
- package/dist/src/tenancy/db.js +0 -10
- 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 -116
- 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 -26
- package/dist/src/timers/timers.js.map +0 -1
- package/dist/src/users/db.js +0 -407
- package/dist/src/users/db.js.map +0 -1
- package/dist/src/users/events.js +0 -169
- 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 -112
- package/dist/src/users/lookup.js.map +0 -1
- package/dist/src/users/users.js +0 -261
- package/dist/src/users/users.js.map +0 -1
- package/dist/src/users/utils.js +0 -92
- package/dist/src/users/utils.js.map +0 -1
- package/dist/src/utils/hashing.js +0 -47
- package/dist/src/utils/hashing.js.map +0 -1
- package/dist/src/utils/index.js +0 -20
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/stringUtils.js +0 -9
- package/dist/src/utils/stringUtils.js.map +0 -1
- package/dist/src/utils/utils.js +0 -247
- 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 -37
- 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 -30
- 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 -143
- package/dist/tests/core/utilities/mocks/events.js.map +0 -1
- package/dist/tests/core/utilities/mocks/fetch.js +0 -15
- package/dist/tests/core/utilities/mocks/fetch.js.map +0 -1
- package/dist/tests/core/utilities/mocks/index.js +0 -43
- package/dist/tests/core/utilities/mocks/index.js.map +0 -1
- package/dist/tests/core/utilities/mocks/licenses.js +0 -97
- package/dist/tests/core/utilities/mocks/licenses.js.map +0 -1
- package/dist/tests/core/utilities/mocks/posthog.js +0 -9
- package/dist/tests/core/utilities/mocks/posthog.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 -78
- package/dist/tests/core/utilities/structures/accounts.js.map +0 -1
- package/dist/tests/core/utilities/structures/apps.js +0 -24
- 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 -16
- 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 -28
- package/dist/tests/core/utilities/structures/documents/platform/index.js.map +0 -1
- package/dist/tests/core/utilities/structures/documents/platform/installation.js +0 -38
- 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 -46
- 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 -140
- package/dist/tests/core/utilities/structures/licenses.js.map +0 -1
- package/dist/tests/core/utilities/structures/plugins.js +0 -23
- package/dist/tests/core/utilities/structures/plugins.js.map +0 -1
- package/dist/tests/core/utilities/structures/quotas.js +0 -71
- package/dist/tests/core/utilities/structures/quotas.js.map +0 -1
- package/dist/tests/core/utilities/structures/scim.js +0 -63
- package/dist/tests/core/utilities/structures/scim.js.map +0 -1
- package/dist/tests/core/utilities/structures/shared.js +0 -14
- package/dist/tests/core/utilities/structures/shared.js.map +0 -1
- package/dist/tests/core/utilities/structures/sso.js +0 -132
- package/dist/tests/core/utilities/structures/sso.js.map +0 -1
- package/dist/tests/core/utilities/structures/tenants.js +0 -9
- package/dist/tests/core/utilities/structures/tenants.js.map +0 -1
- package/dist/tests/core/utilities/structures/userGroups.js +0 -13
- package/dist/tests/core/utilities/structures/userGroups.js.map +0 -1
- package/dist/tests/core/utilities/structures/users.js +0 -48
- package/dist/tests/core/utilities/structures/users.js.map +0 -1
- package/dist/tests/core/utilities/testContainerUtils.js +0 -84
- package/dist/tests/core/utilities/testContainerUtils.js.map +0 -1
- package/dist/tests/core/utilities/utils/index.js +0 -28
- package/dist/tests/core/utilities/utils/index.js.map +0 -1
- package/dist/tests/core/utilities/utils/time.js +0 -8
- package/dist/tests/core/utilities/utils/time.js.map +0 -1
- package/dist/tests/extra/DBTestConfiguration.js +0 -55
- package/dist/tests/extra/DBTestConfiguration.js.map +0 -1
- package/dist/tests/extra/index.js +0 -33
- package/dist/tests/extra/index.js.map +0 -1
- package/dist/tests/extra/testEnv.js +0 -127
- package/dist/tests/extra/testEnv.js.map +0 -1
- package/dist/tests/index.js +0 -18
- package/dist/tests/index.js.map +0 -1
- package/dist/tests/jestEnv.js +0 -8
- package/dist/tests/jestEnv.js.map +0 -1
- package/dist/tests/jestSetup.js +0 -28
- package/dist/tests/jestSetup.js.map +0 -1
- package/plugins.ts +0 -1
|
@@ -1,165 +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 (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
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.authenticate = exports.ssoSaveUserNoOp = void 0;
|
|
39
|
-
const db_1 = require("../../../db");
|
|
40
|
-
const utils_1 = require("../utils");
|
|
41
|
-
const users = __importStar(require("../../../users"));
|
|
42
|
-
const context = __importStar(require("../../../context"));
|
|
43
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
44
|
-
// no-op function for user save
|
|
45
|
-
// - this allows datasource auth and access token refresh to work correctly
|
|
46
|
-
// - prefer no-op over an optional argument to ensure function is provided to login flows
|
|
47
|
-
const ssoSaveUserNoOp = (user, opts) => Promise.resolve(user);
|
|
48
|
-
exports.ssoSaveUserNoOp = ssoSaveUserNoOp;
|
|
49
|
-
/**
|
|
50
|
-
* Common authentication logic for third parties. e.g. OAuth, OIDC.
|
|
51
|
-
*/
|
|
52
|
-
function authenticate(details, requireLocalAccount = true, done, saveUserFn) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
if (!saveUserFn) {
|
|
55
|
-
throw new Error("Save user function must be provided");
|
|
56
|
-
}
|
|
57
|
-
if (!details.userId) {
|
|
58
|
-
return (0, utils_1.authError)(done, "sso user id required");
|
|
59
|
-
}
|
|
60
|
-
if (!details.email) {
|
|
61
|
-
return (0, utils_1.authError)(done, "sso user email required");
|
|
62
|
-
}
|
|
63
|
-
// use the third party id
|
|
64
|
-
const userId = (0, db_1.generateGlobalUserID)(details.userId);
|
|
65
|
-
let dbUser;
|
|
66
|
-
// try to load by id
|
|
67
|
-
try {
|
|
68
|
-
dbUser = yield users.getById(userId);
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
// abort when not 404 error
|
|
72
|
-
if (!err.status || err.status !== 404) {
|
|
73
|
-
return (0, utils_1.authError)(done, "Unexpected error when retrieving existing user", err);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// fallback to loading by email
|
|
77
|
-
if (!dbUser) {
|
|
78
|
-
dbUser = yield users.getGlobalUserByEmail(details.email);
|
|
79
|
-
}
|
|
80
|
-
// exit early if there is still no user and auto creation is disabled
|
|
81
|
-
if (!dbUser && requireLocalAccount) {
|
|
82
|
-
return (0, utils_1.authError)(done, "Email does not yet exist. You must set up your local budibase account first.");
|
|
83
|
-
}
|
|
84
|
-
// first time creation
|
|
85
|
-
if (!dbUser) {
|
|
86
|
-
// setup a blank user using the third party id
|
|
87
|
-
dbUser = {
|
|
88
|
-
_id: userId,
|
|
89
|
-
email: details.email,
|
|
90
|
-
roles: {},
|
|
91
|
-
tenantId: context.getTenantId(),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
let ssoUser = yield syncUser(dbUser, details);
|
|
95
|
-
// never prompt for password reset
|
|
96
|
-
ssoUser.forceResetPassword = false;
|
|
97
|
-
try {
|
|
98
|
-
// don't try to re-save any existing password
|
|
99
|
-
delete ssoUser.password;
|
|
100
|
-
// create or sync the user
|
|
101
|
-
ssoUser = (yield saveUserFn(ssoUser, {
|
|
102
|
-
hashPassword: false,
|
|
103
|
-
requirePassword: false,
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
return (0, utils_1.authError)(done, "Error saving user", err);
|
|
108
|
-
}
|
|
109
|
-
return done(null, ssoUser);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
exports.authenticate = authenticate;
|
|
113
|
-
function getProfilePictureUrl(user, details) {
|
|
114
|
-
var _a;
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
const pictureUrl = (_a = details.profile) === null || _a === void 0 ? void 0 : _a._json.picture;
|
|
117
|
-
if (pictureUrl) {
|
|
118
|
-
const response = yield (0, node_fetch_1.default)(pictureUrl);
|
|
119
|
-
if (response.status === 200) {
|
|
120
|
-
const type = response.headers.get("content-type");
|
|
121
|
-
if (type.startsWith("image/")) {
|
|
122
|
-
return pictureUrl;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @returns a user that has been sync'd with third party information
|
|
130
|
-
*/
|
|
131
|
-
function syncUser(user, details) {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
let firstName;
|
|
134
|
-
let lastName;
|
|
135
|
-
let pictureUrl;
|
|
136
|
-
let oauth2;
|
|
137
|
-
let thirdPartyProfile;
|
|
138
|
-
if (details.profile) {
|
|
139
|
-
const profile = details.profile;
|
|
140
|
-
if (profile.name) {
|
|
141
|
-
const name = profile.name;
|
|
142
|
-
// first name
|
|
143
|
-
if (name.givenName) {
|
|
144
|
-
firstName = name.givenName;
|
|
145
|
-
}
|
|
146
|
-
// last name
|
|
147
|
-
if (name.familyName) {
|
|
148
|
-
lastName = name.familyName;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
pictureUrl = yield getProfilePictureUrl(user, details);
|
|
152
|
-
thirdPartyProfile = Object.assign({}, profile._json);
|
|
153
|
-
}
|
|
154
|
-
// oauth tokens for future use
|
|
155
|
-
if (details.oauth2) {
|
|
156
|
-
oauth2 = Object.assign({}, details.oauth2);
|
|
157
|
-
}
|
|
158
|
-
return Object.assign(Object.assign({}, user), { provider: details.provider, providerType: details.providerType, firstName,
|
|
159
|
-
lastName,
|
|
160
|
-
thirdPartyProfile,
|
|
161
|
-
pictureUrl,
|
|
162
|
-
oauth2 });
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=sso.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso.js","sourceRoot":"","sources":["../../../../../src/middleware/passport/sso/sso.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAkD;AAClD,oCAAoC;AACpC,sDAAuC;AACvC,0DAA2C;AAC3C,4DAA8B;AAS9B,+BAA+B;AAC/B,2EAA2E;AAC3E,yFAAyF;AAClF,MAAM,eAAe,GAAwB,CAClD,IAAa,EACb,IAAkB,EAClB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAHb,QAAA,eAAe,mBAGF;AAE1B;;GAEG;AACH,SAAsB,YAAY,CAChC,OAAuB,EACvB,sBAA+B,IAAI,EACnC,IAAS,EACT,UAA+B;;QAE/B,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;SACvD;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAA;SAC/C;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAO,IAAA,iB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,CAAC,UAAU,CAAA;iBAC3B;aACF;YAED,UAAU,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAEtD,iBAAiB,qBACZ,OAAO,CAAC,KAAK,CACjB,CAAA;SACF;QAED,8BAA8B;QAC9B,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,MAAM,qBACD,OAAO,CAAC,MAAM,CAClB,CAAA;SACF;QAED,uCACK,IAAI,KACP,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,SAAS;YACT,QAAQ;YACR,iBAAiB;YACjB,UAAU;YACV,MAAM,IACP;IACH,CAAC;CAAA"}
|
|
@@ -1,66 +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 (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
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.ssoCallbackUrl = exports.authError = void 0;
|
|
36
|
-
const context_1 = require("../../context");
|
|
37
|
-
const configs = __importStar(require("../../configs"));
|
|
38
|
-
/**
|
|
39
|
-
* Utility to handle authentication errors.
|
|
40
|
-
*
|
|
41
|
-
* @param {*} done The passport callback.
|
|
42
|
-
* @param {*} message Message that will be returned in the response body
|
|
43
|
-
* @param {*} err (Optional) error that will be logged
|
|
44
|
-
*/
|
|
45
|
-
function authError(done, message, err) {
|
|
46
|
-
return done(err, null, // never return a user
|
|
47
|
-
{ message: message });
|
|
48
|
-
}
|
|
49
|
-
exports.authError = authError;
|
|
50
|
-
function ssoCallbackUrl(type, config) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
// incase there is a callback URL from before
|
|
53
|
-
if (config && config.callbackURL) {
|
|
54
|
-
return config.callbackURL;
|
|
55
|
-
}
|
|
56
|
-
const settingsConfig = yield configs.getSettingsConfig();
|
|
57
|
-
let callbackUrl = `/api/global/auth`;
|
|
58
|
-
if ((0, context_1.isMultiTenant)()) {
|
|
59
|
-
callbackUrl += `/${(0, context_1.getTenantId)()}`;
|
|
60
|
-
}
|
|
61
|
-
callbackUrl += `/${type}/callback`;
|
|
62
|
-
return `${settingsConfig.platformUrl}${callbackUrl}`;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
exports.ssoCallbackUrl = ssoCallbackUrl;
|
|
66
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/middleware/passport/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,uDAAwC;AAGxC;;;;;;GAMG;AAEH,SAAgB,SAAS,CAAC,IAAc,EAAE,OAAe,EAAE,GAAS;IAClE,OAAO,IAAI,CACT,GAAG,EACH,IAAI,EAAE,sBAAsB;IAC5B,EAAE,OAAO,EAAE,OAAO,EAAE,CACrB,CAAA;AACH,CAAC;AAND,8BAMC;AAED,SAAsB,cAAc,CAClC,IAAgB,EAChB,MAA0B;;QAE1B,6CAA6C;QAC7C,IAAI,MAAM,IAAK,MAA4B,CAAC,WAAW,EAAE;YACvD,OAAQ,MAA4B,CAAC,WAAqB,CAAA;SAC3D;QACD,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,iBAAiB,EAAE,CAAA;QAExD,IAAI,WAAW,GAAG,kBAAkB,CAAA;QACpC,IAAI,IAAA,uBAAa,GAAE,EAAE;YACnB,WAAW,IAAI,IAAI,IAAA,qBAAW,GAAE,EAAE,CAAA;SACnC;QACD,WAAW,IAAI,IAAI,IAAI,WAAW,CAAA;QAElC,OAAO,GAAG,cAAc,CAAC,WAAW,GAAG,WAAW,EAAE,CAAA;IACtD,CAAC;CAAA;AAjBD,wCAiBC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Expects a standard "query" query string property which is the JSON body
|
|
5
|
-
* of the request, which has to be sent via query string due to the requirement
|
|
6
|
-
* of making an endpoint a GET request e.g. downloading a file stream.
|
|
7
|
-
*/
|
|
8
|
-
function default_1(ctx, next) {
|
|
9
|
-
var _a;
|
|
10
|
-
const queryString = (_a = ctx.request.query) === null || _a === void 0 ? void 0 : _a.query;
|
|
11
|
-
if (ctx.request.method.toLowerCase() !== "get") {
|
|
12
|
-
ctx.throw(500, "Query to download middleware can only be used for get requests.");
|
|
13
|
-
}
|
|
14
|
-
if (!queryString) {
|
|
15
|
-
return next();
|
|
16
|
-
}
|
|
17
|
-
const decoded = decodeURIComponent(queryString);
|
|
18
|
-
let json;
|
|
19
|
-
try {
|
|
20
|
-
json = JSON.parse(decoded);
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
return next();
|
|
24
|
-
}
|
|
25
|
-
ctx.request.body = json;
|
|
26
|
-
return next();
|
|
27
|
-
}
|
|
28
|
-
exports.default = default_1;
|
|
29
|
-
//# sourceMappingURL=querystringToBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"querystringToBody.js","sourceRoot":"","sources":["../../../src/middleware/querystringToBody.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;AACH,mBAAyB,GAAQ,EAAE,IAAS;;IAC1C,MAAM,WAAW,GAAG,MAAA,GAAG,CAAC,OAAO,CAAC,KAAK,0CAAE,KAA2B,CAAA;IAClE,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;QAC9C,GAAG,CAAC,KAAK,CACP,GAAG,EACH,iEAAiE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,EAAE,CAAA;KACd;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAC/C,IAAI,IAAI,CAAA;IACR,IAAI;QACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;KAC3B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,IAAI,EAAE,CAAA;KACd;IACD,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;IACvB,OAAO,IAAI,EAAE,CAAA;AACf,CAAC;AApBD,4BAoBC"}
|
|
@@ -1,37 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const context_1 = require("../context");
|
|
13
|
-
const tenancy_1 = require("../tenancy");
|
|
14
|
-
const matchers_1 = require("./matchers");
|
|
15
|
-
const constants_1 = require("../constants");
|
|
16
|
-
const types_1 = require("@budibase/types");
|
|
17
|
-
function default_1(allowQueryStringPatterns, noTenancyPatterns, opts = { noTenancyRequired: false }) {
|
|
18
|
-
const allowQsOptions = (0, matchers_1.buildMatcherRegex)(allowQueryStringPatterns);
|
|
19
|
-
const noTenancyOptions = (0, matchers_1.buildMatcherRegex)(noTenancyPatterns);
|
|
20
|
-
return function (ctx, next) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const allowNoTenant = opts.noTenancyRequired || !!(0, matchers_1.matches)(ctx, noTenancyOptions);
|
|
23
|
-
const tenantOpts = {
|
|
24
|
-
allowNoTenant,
|
|
25
|
-
};
|
|
26
|
-
const allowQs = !!(0, matchers_1.matches)(ctx, allowQsOptions);
|
|
27
|
-
if (!allowQs) {
|
|
28
|
-
tenantOpts.excludeStrategies = [types_1.TenantResolutionStrategy.QUERY];
|
|
29
|
-
}
|
|
30
|
-
const tenantId = (0, tenancy_1.getTenantIDFromCtx)(ctx, tenantOpts);
|
|
31
|
-
ctx.set(constants_1.Header.TENANT_ID, tenantId);
|
|
32
|
-
return (0, context_1.doInTenant)(tenantId, next);
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.default = default_1;
|
|
37
|
-
//# sourceMappingURL=tenancy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tenancy.js","sourceRoot":"","sources":["../../../src/middleware/tenancy.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,wCAAuC;AACvC,wCAA+C;AAC/C,yCAAuD;AACvD,4CAAqC;AACrC,2CAKwB;AAExB,mBACE,wBAA2C,EAC3C,iBAAoC,EACpC,OAAwC,EAAE,iBAAiB,EAAE,KAAK,EAAE;IAEpE,MAAM,cAAc,GAAG,IAAA,4BAAiB,EAAC,wBAAwB,CAAC,CAAA;IAClE,MAAM,gBAAgB,GAAG,IAAA,4BAAiB,EAAC,iBAAiB,CAAC,CAAA;IAE7D,OAAO,UAAgB,GAAoB,EAAE,IAAS;;YACpD,MAAM,aAAa,GACjB,IAAI,CAAC,iBAAiB,IAAI,CAAC,CAAC,IAAA,kBAAO,EAAC,GAAG,EAAE,gBAAgB,CAAC,CAAA;YAC5D,MAAM,UAAU,GAAuB;gBACrC,aAAa;aACd,CAAA;YAED,MAAM,OAAO,GAAG,CAAC,CAAC,IAAA,kBAAO,EAAC,GAAG,EAAE,cAAc,CAAC,CAAA;YAC9C,IAAI,CAAC,OAAO,EAAE;gBACZ,UAAU,CAAC,iBAAiB,GAAG,CAAC,gCAAwB,CAAC,KAAK,CAAC,CAAA;aAChE;YAED,MAAM,QAAQ,GAAG,IAAA,4BAAkB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAA;YACpD,GAAG,CAAC,GAAG,CAAC,kBAAM,CAAC,SAAS,EAAE,QAAkB,CAAC,CAAA;YAC7C,OAAO,IAAA,oBAAU,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QACnC,CAAC;KAAA,CAAA;AACH,CAAC;AAxBD,4BAwBC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFINITIONS = void 0;
|
|
4
|
-
const types_1 = require("@budibase/types");
|
|
5
|
-
exports.DEFINITIONS = [
|
|
6
|
-
{
|
|
7
|
-
type: types_1.MigrationType.GLOBAL,
|
|
8
|
-
name: types_1.MigrationName.USER_EMAIL_VIEW_CASING,
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
type: types_1.MigrationType.GLOBAL,
|
|
12
|
-
name: types_1.MigrationName.SYNC_QUOTAS,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: types_1.MigrationType.APP,
|
|
16
|
-
name: types_1.MigrationName.APP_URLS,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: types_1.MigrationType.APP,
|
|
20
|
-
name: types_1.MigrationName.EVENT_APP_BACKFILL,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: types_1.MigrationType.APP,
|
|
24
|
-
name: types_1.MigrationName.TABLE_SETTINGS_LINKS_TO_ACTIONS,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: types_1.MigrationType.GLOBAL,
|
|
28
|
-
name: types_1.MigrationName.EVENT_GLOBAL_BACKFILL,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: types_1.MigrationType.INSTALLATION,
|
|
32
|
-
name: types_1.MigrationName.EVENT_INSTALLATION_BACKFILL,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: types_1.MigrationType.GLOBAL,
|
|
36
|
-
name: types_1.MigrationName.GLOBAL_INFO_SYNC_USERS,
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/migrations/definitions.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AAEX,QAAA,WAAW,GAA0B;IAChD;QACE,IAAI,EAAE,qBAAa,CAAC,MAAM;QAC1B,IAAI,EAAE,qBAAa,CAAC,sBAAsB;KAC3C;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,MAAM;QAC1B,IAAI,EAAE,qBAAa,CAAC,WAAW;KAChC;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,GAAG;QACvB,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,GAAG;QACvB,IAAI,EAAE,qBAAa,CAAC,kBAAkB;KACvC;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,GAAG;QACvB,IAAI,EAAE,qBAAa,CAAC,+BAA+B;KACpD;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,MAAM;QAC1B,IAAI,EAAE,qBAAa,CAAC,qBAAqB;KAC1C;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,YAAY;QAChC,IAAI,EAAE,qBAAa,CAAC,2BAA2B;KAChD;IACD;QACE,IAAI,EAAE,qBAAa,CAAC,MAAM;QAC1B,IAAI,EAAE,qBAAa,CAAC,sBAAsB;KAC3C;CACF,CAAA"}
|
|
@@ -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("./migrations"), exports);
|
|
18
|
-
__exportStar(require("./definitions"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,gDAA6B"}
|
|
@@ -1,198 +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 (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
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.runMigrations = exports.runMigration = exports.backPopulateMigrations = exports.getMigrationsDoc = void 0;
|
|
39
|
-
const constants_1 = require("../constants");
|
|
40
|
-
const db_1 = require("../db");
|
|
41
|
-
const environment_1 = __importDefault(require("../environment"));
|
|
42
|
-
const platform = __importStar(require("../platform"));
|
|
43
|
-
const context = __importStar(require("../context"));
|
|
44
|
-
const _1 = require(".");
|
|
45
|
-
const types_1 = require("@budibase/types");
|
|
46
|
-
const getMigrationsDoc = (db) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
// get the migrations doc
|
|
48
|
-
try {
|
|
49
|
-
return yield db.get(db_1.DocumentType.MIGRATIONS);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
if (err.status && err.status === 404) {
|
|
53
|
-
return { _id: db_1.DocumentType.MIGRATIONS };
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
console.error(err);
|
|
57
|
-
throw err;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
exports.getMigrationsDoc = getMigrationsDoc;
|
|
62
|
-
const backPopulateMigrations = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
// filter migrations to the type and populate a no-op migration
|
|
64
|
-
const migrations = _1.DEFINITIONS.filter(def => def.type === opts.type).map(d => (Object.assign(Object.assign({}, d), { fn: () => { } })));
|
|
65
|
-
yield (0, exports.runMigrations)(migrations, { noOp: opts });
|
|
66
|
-
});
|
|
67
|
-
exports.backPopulateMigrations = backPopulateMigrations;
|
|
68
|
-
const runMigration = (migration, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
const migrationType = migration.type;
|
|
70
|
-
let tenantId;
|
|
71
|
-
if (migrationType !== types_1.MigrationType.INSTALLATION) {
|
|
72
|
-
tenantId = context.getTenantId();
|
|
73
|
-
}
|
|
74
|
-
const migrationName = migration.name;
|
|
75
|
-
const silent = migration.silent;
|
|
76
|
-
const log = (message) => {
|
|
77
|
-
if (!silent) {
|
|
78
|
-
console.log(message);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
// get the db to store the migration in
|
|
82
|
-
let dbNames;
|
|
83
|
-
if (migrationType === types_1.MigrationType.GLOBAL) {
|
|
84
|
-
dbNames = [(0, db_1.getGlobalDBName)()];
|
|
85
|
-
}
|
|
86
|
-
else if (migrationType === types_1.MigrationType.APP) {
|
|
87
|
-
if (options.noOp) {
|
|
88
|
-
if (!options.noOp.appId) {
|
|
89
|
-
throw new Error("appId is required for noOp app migration");
|
|
90
|
-
}
|
|
91
|
-
dbNames = [options.noOp.appId];
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
const apps = (yield (0, db_1.getAllApps)(migration.appOpts));
|
|
95
|
-
dbNames = apps.map(app => app.appId);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else if (migrationType === types_1.MigrationType.INSTALLATION) {
|
|
99
|
-
dbNames = [db_1.StaticDatabases.PLATFORM_INFO.name];
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
throw new Error(`Unrecognised migration type [${migrationType}]`);
|
|
103
|
-
}
|
|
104
|
-
const length = dbNames.length;
|
|
105
|
-
let count = 0;
|
|
106
|
-
// run the migration against each db
|
|
107
|
-
for (const dbName of dbNames) {
|
|
108
|
-
count++;
|
|
109
|
-
const lengthStatement = length > 1 ? `[${count}/${length}]` : "";
|
|
110
|
-
const db = (0, db_1.getDB)(dbName);
|
|
111
|
-
try {
|
|
112
|
-
const doc = yield (0, exports.getMigrationsDoc)(db);
|
|
113
|
-
// the migration has already been run
|
|
114
|
-
if (doc[migrationName]) {
|
|
115
|
-
// check for force
|
|
116
|
-
if (options.force &&
|
|
117
|
-
options.force[migrationType] &&
|
|
118
|
-
options.force[migrationType].includes(migrationName)) {
|
|
119
|
-
log(`[Migration: ${migrationName}] [DB: ${dbName}] Forcing`);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
// no force, exit
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// check if the migration is not a no-op
|
|
127
|
-
if (!options.noOp) {
|
|
128
|
-
log(`[Migration: ${migrationName}] [DB: ${dbName}] Running ${lengthStatement}`);
|
|
129
|
-
if (migration.preventRetry) {
|
|
130
|
-
// eagerly set the completion date
|
|
131
|
-
// so that we never run this migration twice even upon failure
|
|
132
|
-
doc[migrationName] = Date.now();
|
|
133
|
-
const response = yield db.put(doc);
|
|
134
|
-
doc._rev = response.rev;
|
|
135
|
-
}
|
|
136
|
-
// run the migration
|
|
137
|
-
if (migrationType === types_1.MigrationType.APP) {
|
|
138
|
-
yield context.doInAppContext(db.name, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
-
yield migration.fn(db);
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
yield migration.fn(db);
|
|
144
|
-
}
|
|
145
|
-
log(`[Migration: ${migrationName}] [DB: ${dbName}] Complete`);
|
|
146
|
-
}
|
|
147
|
-
// mark as complete
|
|
148
|
-
doc[migrationName] = Date.now();
|
|
149
|
-
yield db.put(doc);
|
|
150
|
-
}
|
|
151
|
-
catch (err) {
|
|
152
|
-
console.error(`[Migration: ${migrationName}] [DB: ${dbName}] Error: `, err);
|
|
153
|
-
throw err;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
exports.runMigration = runMigration;
|
|
158
|
-
const runMigrations = (migrations, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
159
|
-
let tenantIds;
|
|
160
|
-
if (environment_1.default.MULTI_TENANCY) {
|
|
161
|
-
if (options.noOp) {
|
|
162
|
-
tenantIds = [options.noOp.tenantId];
|
|
163
|
-
}
|
|
164
|
-
else if (!options.tenantIds || !options.tenantIds.length) {
|
|
165
|
-
// run for all tenants
|
|
166
|
-
tenantIds = yield platform.tenants.getTenantIds();
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
tenantIds = options.tenantIds;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
// single tenancy
|
|
174
|
-
tenantIds = [constants_1.DEFAULT_TENANT_ID];
|
|
175
|
-
}
|
|
176
|
-
if (tenantIds.length > 1) {
|
|
177
|
-
console.log(`Checking migrations for ${tenantIds.length} tenants`);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
console.log("Checking migrations");
|
|
181
|
-
}
|
|
182
|
-
let count = 0;
|
|
183
|
-
// for all tenants
|
|
184
|
-
for (const tenantId of tenantIds) {
|
|
185
|
-
count++;
|
|
186
|
-
if (tenantIds.length > 1) {
|
|
187
|
-
console.log(`Progress [${count}/${tenantIds.length}]`);
|
|
188
|
-
}
|
|
189
|
-
// for all migrations
|
|
190
|
-
for (const migration of migrations) {
|
|
191
|
-
// run the migration
|
|
192
|
-
yield context.doInTenant(tenantId, () => __awaiter(void 0, void 0, void 0, function* () { return yield (0, exports.runMigration)(migration, options); }));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
console.log("Migrations complete");
|
|
196
|
-
});
|
|
197
|
-
exports.runMigrations = runMigrations;
|
|
198
|
-
//# sourceMappingURL=migrations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../../src/migrations/migrations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAgD;AAChD,8BAMc;AACd,iEAAwC;AACxC,sDAAuC;AACvC,oDAAqC;AACrC,wBAA+B;AAC/B,2CAMwB;AAEjB,MAAM,gBAAgB,GAAG,CAAO,EAAO,EAAE,EAAE;IAChD,yBAAyB;IACzB,IAAI;QACF,OAAO,MAAM,EAAE,CAAC,GAAG,CAAC,iBAAY,CAAC,UAAU,CAAC,CAAA;KAC7C;IAAC,OAAO,GAAQ,EAAE;QACjB,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;YACpC,OAAO,EAAE,GAAG,EAAE,iBAAY,CAAC,UAAU,EAAE,CAAA;SACxC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,MAAM,GAAG,CAAA;SACV;KACF;AACH,CAAC,CAAA,CAAA;AAZY,QAAA,gBAAgB,oBAY5B;AAEM,MAAM,sBAAsB,GAAG,CAAO,IAA0B,EAAE,EAAE;IACzE,+DAA+D;IAC/D,MAAM,UAAU,GAAgB,cAAW,CAAC,MAAM,CAChD,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAC9B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iCAAM,CAAC,KAAE,EAAE,EAA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