@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,98 +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.buildVerifyFn = buildVerifyFn;
|
|
46
|
-
exports.strategyFactory = strategyFactory;
|
|
47
|
-
exports.getCallbackUrl = getCallbackUrl;
|
|
48
|
-
const utils_1 = require("../utils");
|
|
49
|
-
const sso = __importStar(require("./sso"));
|
|
50
|
-
const types_1 = require("@budibase/types");
|
|
51
|
-
const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy;
|
|
52
|
-
function buildVerifyFn(saveUserFn) {
|
|
53
|
-
return (accessToken, refreshToken, profile, done) => {
|
|
54
|
-
const details = {
|
|
55
|
-
provider: "google",
|
|
56
|
-
providerType: types_1.SSOProviderType.GOOGLE,
|
|
57
|
-
userId: profile.id,
|
|
58
|
-
profile: profile,
|
|
59
|
-
email: profile._json.email,
|
|
60
|
-
oauth2: {
|
|
61
|
-
accessToken,
|
|
62
|
-
refreshToken,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
return sso.authenticate(details, true, // require local accounts to exist
|
|
66
|
-
done, saveUserFn);
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Create an instance of the google passport strategy. This wrapper fetches the configuration
|
|
71
|
-
* from couchDB rather than environment variables, using this factory is necessary for dynamically configuring passport.
|
|
72
|
-
* @returns Dynamically configured Passport Google Strategy
|
|
73
|
-
*/
|
|
74
|
-
function strategyFactory(config, callbackUrl, saveUserFn) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
try {
|
|
77
|
-
const { clientID, clientSecret } = config;
|
|
78
|
-
if (!clientID || !clientSecret) {
|
|
79
|
-
throw new Error("Configuration invalid. Must contain google clientID and clientSecret");
|
|
80
|
-
}
|
|
81
|
-
const verify = buildVerifyFn(saveUserFn);
|
|
82
|
-
return new GoogleStrategy({
|
|
83
|
-
clientID: config.clientID,
|
|
84
|
-
clientSecret: config.clientSecret,
|
|
85
|
-
callbackURL: callbackUrl,
|
|
86
|
-
}, verify);
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
throw new Error(`Error constructing google authentication strategy: ${err}`);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function getCallbackUrl(config) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
return (0, utils_1.ssoCallbackUrl)(types_1.ConfigType.GOOGLE, config);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=google.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../../../src/middleware/passport/sso/google.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,sCA0BC;AAOD,0CA0BC;AAED,wCAEC;AA5ED,oCAAyC;AACzC,2CAA4B;AAC5B,2CAOwB;AAExB,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,cAAc,CAAA;AAEtE,SAAgB,aAAa,CAAC,UAA+B;IAC3D,OAAO,CACL,WAAmB,EACnB,YAAoB,EACpB,OAAmB,EACnB,IAAc,EACd,EAAE;QACF,MAAM,OAAO,GAAmB;YAC9B,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,uBAAe,CAAC,MAAM;YACpC,MAAM,EAAE,OAAO,CAAC,EAAE;YAClB,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;YAC1B,MAAM,EAAE;gBACN,WAAW;gBACX,YAAY;aACb;SACF,CAAA;QAED,OAAO,GAAG,CAAC,YAAY,CACrB,OAAO,EACP,IAAI,EAAE,kCAAkC;QACxC,IAAI,EACJ,UAAU,CACX,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAsB,eAAe,CACnC,MAAyB,EACzB,WAAmB,EACnB,UAA+B;;QAE/B,IAAI,CAAC;YACH,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAAA;YAEzC,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAA;YACH,CAAC;YAED,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;YACxC,OAAO,IAAI,cAAc,CACvB;gBACE,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,WAAW,EAAE,WAAW;aACzB,EACD,MAAM,CACP,CAAA;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,sDAAsD,GAAG,EAAE,CAAC,CAAA;QAC9E,CAAC;IACH,CAAC;CAAA;AAED,SAAsB,cAAc,CAAC,MAAyB;;QAC5D,OAAO,IAAA,sBAAc,EAAC,kBAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClD,CAAC;CAAA"}
|
|
@@ -1,158 +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.buildVerifyFn = buildVerifyFn;
|
|
49
|
-
exports.strategyFactory = strategyFactory;
|
|
50
|
-
exports.fetchStrategyConfig = fetchStrategyConfig;
|
|
51
|
-
exports.getCallbackUrl = getCallbackUrl;
|
|
52
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
53
|
-
const sso = __importStar(require("./sso"));
|
|
54
|
-
const utils_1 = require("../utils");
|
|
55
|
-
const utils_2 = require("../../../utils");
|
|
56
|
-
const types_1 = require("@budibase/types");
|
|
57
|
-
const OIDCStrategy = require("@techpass/passport-openidconnect").Strategy;
|
|
58
|
-
function buildVerifyFn(saveUserFn) {
|
|
59
|
-
/**
|
|
60
|
-
* @param issuer The identity provider base URL
|
|
61
|
-
* @param sub The user ID
|
|
62
|
-
* @param profile The user profile information. Created by passport from the /userinfo response
|
|
63
|
-
* @param jwtClaims The parsed id_token claims
|
|
64
|
-
* @param accessToken The access_token for contacting the identity provider - may or may not be a JWT
|
|
65
|
-
* @param refreshToken The refresh_token for obtaining a new access_token - usually not a JWT
|
|
66
|
-
* @param idToken The id_token - always a JWT
|
|
67
|
-
* @param params The response body from requesting an access_token
|
|
68
|
-
* @param done The passport callback: err, user, info
|
|
69
|
-
*/
|
|
70
|
-
return (issuer, sub, profile, jwtClaims, accessToken, refreshToken, idToken, params, done) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const details = {
|
|
72
|
-
// store the issuer info to enable sync in future
|
|
73
|
-
provider: issuer,
|
|
74
|
-
providerType: types_1.SSOProviderType.OIDC,
|
|
75
|
-
userId: profile.id,
|
|
76
|
-
profile: profile,
|
|
77
|
-
email: getEmail(profile, jwtClaims),
|
|
78
|
-
oauth2: {
|
|
79
|
-
accessToken: accessToken,
|
|
80
|
-
refreshToken: refreshToken,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
return sso.authenticate(details, false, // don't require local accounts to exist
|
|
84
|
-
done, saveUserFn);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @param profile The structured profile created by passport using the user info endpoint
|
|
89
|
-
* @param jwtClaims The claims returned in the id token
|
|
90
|
-
*/
|
|
91
|
-
function getEmail(profile, jwtClaims) {
|
|
92
|
-
// profile not guaranteed to contain email e.g. github connected azure ad account
|
|
93
|
-
if (profile._json.email) {
|
|
94
|
-
return profile._json.email;
|
|
95
|
-
}
|
|
96
|
-
// fallback to id token email
|
|
97
|
-
if (jwtClaims.email) {
|
|
98
|
-
return jwtClaims.email;
|
|
99
|
-
}
|
|
100
|
-
// fallback to id token preferred username
|
|
101
|
-
const username = jwtClaims.preferred_username;
|
|
102
|
-
if (username && (0, utils_2.validEmail)(username)) {
|
|
103
|
-
return username;
|
|
104
|
-
}
|
|
105
|
-
throw new Error(`Could not determine user email from profile ${JSON.stringify(profile)} and claims ${JSON.stringify(jwtClaims)}`);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Create an instance of the oidc passport strategy. This wrapper fetches the configuration
|
|
109
|
-
* from couchDB rather than environment variables, using this factory is necessary for dynamically configuring passport.
|
|
110
|
-
* @returns Dynamically configured Passport OIDC Strategy
|
|
111
|
-
*/
|
|
112
|
-
function strategyFactory(config, saveUserFn) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
try {
|
|
115
|
-
const verify = buildVerifyFn(saveUserFn);
|
|
116
|
-
const strategy = new OIDCStrategy(config, verify);
|
|
117
|
-
strategy.name = "oidc";
|
|
118
|
-
return strategy;
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
throw new Error(`Error constructing OIDC authentication strategy - ${err}`);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function fetchStrategyConfig(oidcConfig, callbackUrl) {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
try {
|
|
128
|
-
const { clientID, clientSecret, configUrl } = oidcConfig;
|
|
129
|
-
if (!clientID || !clientSecret || !callbackUrl || !configUrl) {
|
|
130
|
-
// check for remote config and all required elements
|
|
131
|
-
throw new Error("Configuration invalid. Must contain clientID, clientSecret, callbackUrl and configUrl");
|
|
132
|
-
}
|
|
133
|
-
const response = yield (0, node_fetch_1.default)(configUrl);
|
|
134
|
-
if (!response.ok) {
|
|
135
|
-
throw new Error(`Unexpected response when fetching openid-configuration: ${response.statusText}`);
|
|
136
|
-
}
|
|
137
|
-
const body = yield response.json();
|
|
138
|
-
return {
|
|
139
|
-
issuer: body.issuer,
|
|
140
|
-
authorizationURL: body.authorization_endpoint,
|
|
141
|
-
tokenURL: body.token_endpoint,
|
|
142
|
-
userInfoURL: body.userinfo_endpoint,
|
|
143
|
-
clientID: clientID,
|
|
144
|
-
clientSecret: clientSecret,
|
|
145
|
-
callbackURL: callbackUrl,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
throw new Error(`Error constructing OIDC authentication configuration - ${err}`);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function getCallbackUrl() {
|
|
154
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
return (0, utils_1.ssoCallbackUrl)(types_1.ConfigType.OIDC);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
//# sourceMappingURL=oidc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.js","sourceRoot":"","sources":["../../../../../src/middleware/passport/sso/oidc.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,150 +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.ssoSaveUserNoOp = void 0;
|
|
46
|
-
exports.authenticate = authenticate;
|
|
47
|
-
const db_1 = require("../../../db");
|
|
48
|
-
const utils_1 = require("../utils");
|
|
49
|
-
const users = __importStar(require("../../../users"));
|
|
50
|
-
const context = __importStar(require("../../../context"));
|
|
51
|
-
// no-op function for user save
|
|
52
|
-
// - this allows datasource auth and access token refresh to work correctly
|
|
53
|
-
// - prefer no-op over an optional argument to ensure function is provided to login flows
|
|
54
|
-
const ssoSaveUserNoOp = (user) => Promise.resolve(user);
|
|
55
|
-
exports.ssoSaveUserNoOp = ssoSaveUserNoOp;
|
|
56
|
-
/**
|
|
57
|
-
* Common authentication logic for third parties. e.g. OAuth, OIDC.
|
|
58
|
-
*/
|
|
59
|
-
function authenticate(details_1) {
|
|
60
|
-
return __awaiter(this, arguments, void 0, function* (details, requireLocalAccount = true, done, saveUserFn) {
|
|
61
|
-
if (!saveUserFn) {
|
|
62
|
-
throw new Error("Save user function must be provided");
|
|
63
|
-
}
|
|
64
|
-
if (!details.userId) {
|
|
65
|
-
return (0, utils_1.authError)(done, "sso user id required");
|
|
66
|
-
}
|
|
67
|
-
if (!details.email) {
|
|
68
|
-
return (0, utils_1.authError)(done, "sso user email required");
|
|
69
|
-
}
|
|
70
|
-
// use the third party id
|
|
71
|
-
const userId = (0, db_1.generateGlobalUserID)(details.userId);
|
|
72
|
-
let dbUser;
|
|
73
|
-
// try to load by id
|
|
74
|
-
try {
|
|
75
|
-
dbUser = yield users.getById(userId);
|
|
76
|
-
}
|
|
77
|
-
catch (err) {
|
|
78
|
-
// abort when not 404 error
|
|
79
|
-
if (!err.status || err.status !== 404) {
|
|
80
|
-
return (0, utils_1.authError)(done, "Unexpected error when retrieving existing user", err);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// fallback to loading by email
|
|
84
|
-
if (!dbUser) {
|
|
85
|
-
dbUser = yield users.getGlobalUserByEmail(details.email);
|
|
86
|
-
}
|
|
87
|
-
// exit early if there is still no user and auto creation is disabled
|
|
88
|
-
if (!dbUser && requireLocalAccount) {
|
|
89
|
-
return (0, utils_1.authError)(done, "Email does not yet exist. You must set up your local budibase account first.");
|
|
90
|
-
}
|
|
91
|
-
// first time creation
|
|
92
|
-
if (!dbUser) {
|
|
93
|
-
// setup a blank user using the third party id
|
|
94
|
-
dbUser = {
|
|
95
|
-
_id: userId,
|
|
96
|
-
email: details.email,
|
|
97
|
-
roles: {},
|
|
98
|
-
tenantId: context.getTenantId(),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
let ssoUser = yield syncUser(dbUser, details);
|
|
102
|
-
// never prompt for password reset
|
|
103
|
-
ssoUser.forceResetPassword = false;
|
|
104
|
-
try {
|
|
105
|
-
// don't try to re-save any existing password
|
|
106
|
-
delete ssoUser.password;
|
|
107
|
-
// create or sync the user
|
|
108
|
-
ssoUser = (yield saveUserFn(ssoUser, {
|
|
109
|
-
hashPassword: false,
|
|
110
|
-
requirePassword: false,
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
return (0, utils_1.authError)(done, "Error saving user", err);
|
|
115
|
-
}
|
|
116
|
-
return done(null, ssoUser);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @returns a user that has been sync'd with third party information
|
|
121
|
-
*/
|
|
122
|
-
function syncUser(user, details) {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
let firstName;
|
|
125
|
-
let lastName;
|
|
126
|
-
let oauth2;
|
|
127
|
-
if (details.profile) {
|
|
128
|
-
const profile = details.profile;
|
|
129
|
-
if (profile.name) {
|
|
130
|
-
const name = profile.name;
|
|
131
|
-
// first name
|
|
132
|
-
if (name.givenName) {
|
|
133
|
-
firstName = name.givenName;
|
|
134
|
-
}
|
|
135
|
-
// last name
|
|
136
|
-
if (name.familyName) {
|
|
137
|
-
lastName = name.familyName;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// oauth tokens for future use
|
|
142
|
-
if (details.oauth2) {
|
|
143
|
-
oauth2 = Object.assign({}, details.oauth2);
|
|
144
|
-
}
|
|
145
|
-
return Object.assign(Object.assign({}, user), { provider: details.provider, providerType: details.providerType, firstName,
|
|
146
|
-
lastName,
|
|
147
|
-
oauth2 });
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=sso.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso.js","sourceRoot":"","sources":["../../../../../src/middleware/passport/sso/sso.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,75 +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.authError = authError;
|
|
46
|
-
exports.ssoCallbackUrl = ssoCallbackUrl;
|
|
47
|
-
const context_1 = require("../../context");
|
|
48
|
-
const configs = __importStar(require("../../configs"));
|
|
49
|
-
/**
|
|
50
|
-
* Utility to handle authentication errors.
|
|
51
|
-
*
|
|
52
|
-
* @param done The passport callback.
|
|
53
|
-
* @param message Message that will be returned in the response body
|
|
54
|
-
* @param err (Optional) error that will be logged
|
|
55
|
-
*/
|
|
56
|
-
function authError(done, message, err) {
|
|
57
|
-
return done(err, null, // never return a user
|
|
58
|
-
{ message: message });
|
|
59
|
-
}
|
|
60
|
-
function ssoCallbackUrl(type, config) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
// incase there is a callback URL from before
|
|
63
|
-
if (config && config.callbackURL) {
|
|
64
|
-
return config.callbackURL;
|
|
65
|
-
}
|
|
66
|
-
const settingsConfig = yield configs.getSettingsConfig();
|
|
67
|
-
let callbackUrl = `/api/global/auth`;
|
|
68
|
-
if ((0, context_1.isMultiTenant)()) {
|
|
69
|
-
callbackUrl += `/${(0, context_1.getTenantId)()}`;
|
|
70
|
-
}
|
|
71
|
-
callbackUrl += `/${type}/callback`;
|
|
72
|
-
return `${settingsConfig.platformUrl}${callbackUrl}`;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/middleware/passport/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,8BAMC;AAED,wCAiBC;AArCD,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;AAED,SAAsB,cAAc,CAClC,IAAgB,EAChB,MAA0B;;QAE1B,6CAA6C;QAC7C,IAAI,MAAM,IAAK,MAA4B,CAAC,WAAW,EAAE,CAAC;YACxD,OAAQ,MAA4B,CAAC,WAAqB,CAAA;QAC5D,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,iBAAiB,EAAE,CAAA;QAExD,IAAI,WAAW,GAAG,kBAAkB,CAAA;QACpC,IAAI,IAAA,uBAAa,GAAE,EAAE,CAAC;YACpB,WAAW,IAAI,IAAI,IAAA,qBAAW,GAAE,EAAE,CAAA;QACpC,CAAC;QACD,WAAW,IAAI,IAAI,IAAI,WAAW,CAAA;QAElC,OAAO,GAAG,cAAc,CAAC,WAAW,GAAG,WAAW,EAAE,CAAA;IACtD,CAAC;CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
/**
|
|
5
|
-
* Expects a standard "query" query string property which is the JSON body
|
|
6
|
-
* of the request, which has to be sent via query string due to the requirement
|
|
7
|
-
* of making an endpoint a GET request e.g. downloading a file stream.
|
|
8
|
-
*/
|
|
9
|
-
function default_1(ctx, next) {
|
|
10
|
-
var _a;
|
|
11
|
-
const queryString = (_a = ctx.request.query) === null || _a === void 0 ? void 0 : _a.query;
|
|
12
|
-
if (ctx.request.method.toLowerCase() !== "get") {
|
|
13
|
-
ctx.throw(500, "Query to download middleware can only be used for get requests.");
|
|
14
|
-
}
|
|
15
|
-
if (!queryString) {
|
|
16
|
-
return next();
|
|
17
|
-
}
|
|
18
|
-
const decoded = decodeURIComponent(queryString);
|
|
19
|
-
let json;
|
|
20
|
-
try {
|
|
21
|
-
json = JSON.parse(decoded);
|
|
22
|
-
}
|
|
23
|
-
catch (err) {
|
|
24
|
-
return next();
|
|
25
|
-
}
|
|
26
|
-
ctx.request.body = json;
|
|
27
|
-
return next();
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=querystringToBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"querystringToBody.js","sourceRoot":"","sources":["../../../src/middleware/querystringToBody.ts"],"names":[],"mappings":";;AAOA,4BAoBC;AAzBD;;;;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,CAAC;QAC/C,GAAG,CAAC,KAAK,CACP,GAAG,EACH,iEAAiE,CAClE,CAAA;IACH,CAAC;IACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAC/C,IAAI,IAAI,CAAA;IACR,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;IACD,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;IACvB,OAAO,IAAI,EAAE,CAAA;AACf,CAAC"}
|
|
@@ -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
|
-
exports.default = default_1;
|
|
13
|
-
const context_1 = require("../context");
|
|
14
|
-
const tenancy_1 = require("../tenancy");
|
|
15
|
-
const matchers_1 = require("./matchers");
|
|
16
|
-
const constants_1 = require("../constants");
|
|
17
|
-
const types_1 = require("@budibase/types");
|
|
18
|
-
function default_1(allowQueryStringPatterns, noTenancyPatterns, opts = { noTenancyRequired: false }) {
|
|
19
|
-
const allowQsOptions = (0, matchers_1.buildMatcherRegex)(allowQueryStringPatterns);
|
|
20
|
-
const noTenancyOptions = (0, matchers_1.buildMatcherRegex)(noTenancyPatterns);
|
|
21
|
-
return function (ctx, next) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const allowNoTenant = opts.noTenancyRequired || !!(0, matchers_1.matches)(ctx, noTenancyOptions);
|
|
24
|
-
const tenantOpts = {
|
|
25
|
-
allowNoTenant,
|
|
26
|
-
};
|
|
27
|
-
const allowQs = !!(0, matchers_1.matches)(ctx, allowQsOptions);
|
|
28
|
-
if (!allowQs) {
|
|
29
|
-
tenantOpts.excludeStrategies = [types_1.TenantResolutionStrategy.QUERY];
|
|
30
|
-
}
|
|
31
|
-
const tenantId = (0, tenancy_1.getTenantIDFromCtx)(ctx, tenantOpts);
|
|
32
|
-
ctx.set(constants_1.Header.TENANT_ID, tenantId);
|
|
33
|
-
return (0, context_1.doInTenant)(tenantId, next);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=tenancy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tenancy.js","sourceRoot":"","sources":["../../../src/middleware/tenancy.ts"],"names":[],"mappings":";;;;;;;;;;;AAYA,4BAwBC;AApCD,wCAAuC;AACvC,wCAA+C;AAC/C,yCAAuD;AACvD,4CAAqC;AACrC,2CAKwB;AAGxB,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,GAAQ,EAAE,IAAU;;YACzC,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,CAAC;gBACb,UAAU,CAAC,iBAAiB,GAAG,CAAC,gCAAwB,CAAC,KAAK,CAAC,CAAA;YACjE,CAAC;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;KAAc,CAAA;AACjB,CAAC"}
|
|
@@ -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"}
|