@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,81 +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 constants_1 = require("../constants");
|
|
14
|
-
const matchers_1 = require("./matchers");
|
|
15
|
-
/**
|
|
16
|
-
* GET, HEAD and OPTIONS methods are considered safe operations
|
|
17
|
-
*
|
|
18
|
-
* POST, PUT, PATCH, and DELETE methods, being state changing verbs,
|
|
19
|
-
* should have a CSRF token attached to the request
|
|
20
|
-
*/
|
|
21
|
-
const EXCLUDED_METHODS = ["GET", "HEAD", "OPTIONS"];
|
|
22
|
-
/**
|
|
23
|
-
* There are only three content type values that can be used in cross domain requests.
|
|
24
|
-
* If any other value is used, e.g. application/json, the browser will first make a OPTIONS
|
|
25
|
-
* request which will be protected by CORS.
|
|
26
|
-
*/
|
|
27
|
-
const INCLUDED_CONTENT_TYPES = [
|
|
28
|
-
"application/x-www-form-urlencoded",
|
|
29
|
-
"multipart/form-data",
|
|
30
|
-
"text/plain",
|
|
31
|
-
];
|
|
32
|
-
/**
|
|
33
|
-
* Validate the CSRF token generated aganst the user session.
|
|
34
|
-
* Compare the token with the x-csrf-token header.
|
|
35
|
-
*
|
|
36
|
-
* If the token is not found within the request or the value provided
|
|
37
|
-
* does not match the value within the user session, the request is rejected.
|
|
38
|
-
*
|
|
39
|
-
* CSRF protection provided using the 'Synchronizer Token Pattern'
|
|
40
|
-
* https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
function default_1(opts = { noCsrfPatterns: [] }) {
|
|
44
|
-
const noCsrfOptions = (0, matchers_1.buildMatcherRegex)(opts.noCsrfPatterns);
|
|
45
|
-
return ((ctx, next) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
var _a;
|
|
47
|
-
// don't apply for excluded paths
|
|
48
|
-
const found = (0, matchers_1.matches)(ctx, noCsrfOptions);
|
|
49
|
-
if (found) {
|
|
50
|
-
return next();
|
|
51
|
-
}
|
|
52
|
-
// don't apply for the excluded http methods
|
|
53
|
-
if (EXCLUDED_METHODS.indexOf(ctx.method) !== -1) {
|
|
54
|
-
return next();
|
|
55
|
-
}
|
|
56
|
-
// don't apply when the content type isn't supported
|
|
57
|
-
let contentType = ctx.get("content-type")
|
|
58
|
-
? ctx.get("content-type").toLowerCase()
|
|
59
|
-
: "";
|
|
60
|
-
if (!INCLUDED_CONTENT_TYPES.filter(type => contentType.includes(type)).length) {
|
|
61
|
-
return next();
|
|
62
|
-
}
|
|
63
|
-
// don't apply csrf when the internal api key has been used
|
|
64
|
-
if (ctx.internal) {
|
|
65
|
-
return next();
|
|
66
|
-
}
|
|
67
|
-
// apply csrf when there is a token in the session (new logins)
|
|
68
|
-
// in future there should be a hard requirement that the token is present
|
|
69
|
-
const userToken = (_a = ctx.user) === null || _a === void 0 ? void 0 : _a.csrfToken;
|
|
70
|
-
if (!userToken) {
|
|
71
|
-
return next();
|
|
72
|
-
}
|
|
73
|
-
// reject if no token in request or mismatch
|
|
74
|
-
const requestToken = ctx.get(constants_1.Header.CSRF_TOKEN);
|
|
75
|
-
if (!requestToken || requestToken !== userToken) {
|
|
76
|
-
ctx.throw(403, "Invalid CSRF token");
|
|
77
|
-
}
|
|
78
|
-
return next();
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=csrf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csrf.js","sourceRoot":"","sources":["../../../src/middleware/csrf.ts"],"names":[],"mappings":";;;;;;;;;;;AAmCA,4BA8CC;AAjFD,4CAAqC;AACrC,yCAAuD;AAIvD;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;AAEnD;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;IAC7B,mCAAmC;IACnC,qBAAqB;IACrB,YAAY;CACb,CAAA;AAED;;;;;;;;;;GAUG;AACH,mBACE,OAA8C,EAAE,cAAc,EAAE,EAAE,EAAE;IAEpE,MAAM,aAAa,GAAG,IAAA,4BAAiB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC5D,OAAO,CAAC,CAAO,GAAQ,EAAE,IAAU,EAAE,EAAE;;QACrC,iCAAiC;QACjC,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,EAAE,aAAa,CAAC,CAAA;QACzC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,4CAA4C;QAC5C,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAChD,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,oDAAoD;QACpD,IAAI,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;YACvC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE;YACvC,CAAC,CAAC,EAAE,CAAA;QACN,IACE,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EACzE,CAAC;YACD,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,2DAA2D;QAC3D,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACjB,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,+DAA+D;QAC/D,yEAAyE;QACzE,MAAM,SAAS,GAAG,MAAA,GAAG,CAAC,IAAI,0CAAE,SAAS,CAAA;QACrC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,4CAA4C;QAC5C,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CAAC,kBAAM,CAAC,UAAU,CAAC,CAAA;QAC/C,IAAI,CAAC,YAAY,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAChD,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAA;QACtC,CAAC;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA,CAAe,CAAA;AAClB,CAAC"}
|
|
@@ -1,88 +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.errorHandling = errorHandling;
|
|
49
|
-
const errors = __importStar(require("../errors"));
|
|
50
|
-
const environment_1 = __importDefault(require("../environment"));
|
|
51
|
-
const secrets_1 = require("../security/secrets");
|
|
52
|
-
function errorHandling(ctx, next) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
try {
|
|
55
|
-
yield next();
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
const status = err.status || err.statusCode || 500;
|
|
59
|
-
ctx.status = status;
|
|
60
|
-
if (status >= 400 && status < 500) {
|
|
61
|
-
console.warn(err);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
console.error("Got 400 response code", err);
|
|
65
|
-
}
|
|
66
|
-
let error = {
|
|
67
|
-
message: err.message,
|
|
68
|
-
status,
|
|
69
|
-
validationErrors: err.validation,
|
|
70
|
-
error: errors.getPublicError(err),
|
|
71
|
-
};
|
|
72
|
-
if ((0, secrets_1.stringContainsSecret)(JSON.stringify(error))) {
|
|
73
|
-
error = {
|
|
74
|
-
message: "Unexpected error",
|
|
75
|
-
status,
|
|
76
|
-
error: "Unexpected error",
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
if (environment_1.default.isTest() && ctx.headers["x-budibase-include-stacktrace"]) {
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
error.stack = err.stack;
|
|
82
|
-
}
|
|
83
|
-
ctx.body = error;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.default = errorHandling;
|
|
88
|
-
//# sourceMappingURL=errorHandling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../../src/middleware/errorHandling.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,sCAmCC;AAvCD,kDAAmC;AACnC,iEAAwC;AACxC,iDAA0D;AAE1D,SAAsB,aAAa,CAAC,GAAQ,EAAE,IAAS;;QACrD,IAAI,CAAC;YACH,MAAM,IAAI,EAAE,CAAA;QACd,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAA;YAClD,GAAG,CAAC,MAAM,GAAG,MAAM,CAAA;YAEnB,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAA;YAC7C,CAAC;YAED,IAAI,KAAK,GAAa;gBACpB,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,MAAM;gBACN,gBAAgB,EAAE,GAAG,CAAC,UAAU;gBAChC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC;aAClC,CAAA;YAED,IAAI,IAAA,8BAAoB,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAChD,KAAK,GAAG;oBACN,OAAO,EAAE,kBAAkB;oBAC3B,MAAM;oBACN,KAAK,EAAE,kBAAkB;iBAC1B,CAAA;YACH,CAAC;YAED,IAAI,qBAAW,CAAC,MAAM,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,+BAA+B,CAAC,EAAE,CAAC;gBACzE,aAAa;gBACb,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;YACzB,CAAC;YAED,GAAG,CAAC,IAAI,GAAG,KAAK,CAAA;QAClB,CAAC;IACH,CAAC;CAAA;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ip = exports.joiValidator = exports.csp = exports.querystringToBody = exports.errorHandling = exports.correlation = exports.pino = exports.builderOnly = exports.builderOrAdmin = exports.adminOnly = exports.csrf = exports.internalApi = exports.tenancy = exports.auditLog = exports.authenticated = exports.ssoCallbackUrl = exports.authError = exports.datasource = exports.oidc = exports.google = exports.local = void 0;
|
|
40
|
-
exports.local = __importStar(require("./passport/local"));
|
|
41
|
-
exports.google = __importStar(require("./passport/sso/google"));
|
|
42
|
-
exports.oidc = __importStar(require("./passport/sso/oidc"));
|
|
43
|
-
const datasourceGoogle = __importStar(require("./passport/datasource/google"));
|
|
44
|
-
exports.datasource = {
|
|
45
|
-
google: datasourceGoogle,
|
|
46
|
-
};
|
|
47
|
-
var utils_1 = require("./passport/utils");
|
|
48
|
-
Object.defineProperty(exports, "authError", { enumerable: true, get: function () { return utils_1.authError; } });
|
|
49
|
-
Object.defineProperty(exports, "ssoCallbackUrl", { enumerable: true, get: function () { return utils_1.ssoCallbackUrl; } });
|
|
50
|
-
var authenticated_1 = require("./authenticated");
|
|
51
|
-
Object.defineProperty(exports, "authenticated", { enumerable: true, get: function () { return __importDefault(authenticated_1).default; } });
|
|
52
|
-
var auditLog_1 = require("./auditLog");
|
|
53
|
-
Object.defineProperty(exports, "auditLog", { enumerable: true, get: function () { return __importDefault(auditLog_1).default; } });
|
|
54
|
-
var tenancy_1 = require("./tenancy");
|
|
55
|
-
Object.defineProperty(exports, "tenancy", { enumerable: true, get: function () { return __importDefault(tenancy_1).default; } });
|
|
56
|
-
var internalApi_1 = require("./internalApi");
|
|
57
|
-
Object.defineProperty(exports, "internalApi", { enumerable: true, get: function () { return __importDefault(internalApi_1).default; } });
|
|
58
|
-
var csrf_1 = require("./csrf");
|
|
59
|
-
Object.defineProperty(exports, "csrf", { enumerable: true, get: function () { return __importDefault(csrf_1).default; } });
|
|
60
|
-
var adminOnly_1 = require("./adminOnly");
|
|
61
|
-
Object.defineProperty(exports, "adminOnly", { enumerable: true, get: function () { return __importDefault(adminOnly_1).default; } });
|
|
62
|
-
var builderOrAdmin_1 = require("./builderOrAdmin");
|
|
63
|
-
Object.defineProperty(exports, "builderOrAdmin", { enumerable: true, get: function () { return __importDefault(builderOrAdmin_1).default; } });
|
|
64
|
-
var builderOnly_1 = require("./builderOnly");
|
|
65
|
-
Object.defineProperty(exports, "builderOnly", { enumerable: true, get: function () { return __importDefault(builderOnly_1).default; } });
|
|
66
|
-
var middleware_1 = require("../logging/pino/middleware");
|
|
67
|
-
Object.defineProperty(exports, "pino", { enumerable: true, get: function () { return __importDefault(middleware_1).default; } });
|
|
68
|
-
var middleware_2 = require("../logging/correlation/middleware");
|
|
69
|
-
Object.defineProperty(exports, "correlation", { enumerable: true, get: function () { return __importDefault(middleware_2).default; } });
|
|
70
|
-
var errorHandling_1 = require("./errorHandling");
|
|
71
|
-
Object.defineProperty(exports, "errorHandling", { enumerable: true, get: function () { return __importDefault(errorHandling_1).default; } });
|
|
72
|
-
var querystringToBody_1 = require("./querystringToBody");
|
|
73
|
-
Object.defineProperty(exports, "querystringToBody", { enumerable: true, get: function () { return __importDefault(querystringToBody_1).default; } });
|
|
74
|
-
var contentSecurityPolicy_1 = require("./contentSecurityPolicy");
|
|
75
|
-
Object.defineProperty(exports, "csp", { enumerable: true, get: function () { return __importDefault(contentSecurityPolicy_1).default; } });
|
|
76
|
-
exports.joiValidator = __importStar(require("./joi-validator"));
|
|
77
|
-
var ip_1 = require("./ip");
|
|
78
|
-
Object.defineProperty(exports, "ip", { enumerable: true, get: function () { return __importDefault(ip_1).default; } });
|
|
79
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/middleware/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAyC;AACzC,gEAA+C;AAC/C,4DAA2C;AAC3C,+EAAgE;AAEnD,QAAA,UAAU,GAAG;IACxB,MAAM,EAAE,gBAAgB;CACzB,CAAA;AACD,0CAA4D;AAAnD,kGAAA,SAAS,OAAA;AAAE,uGAAA,cAAc,OAAA;AAClC,iDAA0D;AAAjD,+HAAA,OAAO,OAAiB;AACjC,uCAAgD;AAAvC,qHAAA,OAAO,OAAY;AAC5B,qCAA8C;AAArC,mHAAA,OAAO,OAAW;AAC3B,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,+BAAwC;AAA/B,6GAAA,OAAO,OAAQ;AACxB,yCAAkD;AAAzC,uHAAA,OAAO,OAAa;AAC7B,mDAA4D;AAAnD,iIAAA,OAAO,OAAkB;AAClC,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,yDAA4D;AAAnD,mHAAA,OAAO,OAAQ;AACxB,gEAA0E;AAAjE,0HAAA,OAAO,OAAe;AAC/B,iDAA0D;AAAjD,+HAAA,OAAO,OAAiB;AACjC,yDAAkE;AAAzD,uIAAA,OAAO,OAAqB;AACrC,iEAAwD;AAA/C,6HAAA,OAAO,OAAO;AACvB,gEAA+C;AAC/C,2BAAoC;AAA3B,yGAAA,OAAO,OAAM"}
|
|
@@ -1,30 +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 constants_1 = require("../constants");
|
|
13
|
-
const utils_1 = require("../utils");
|
|
14
|
-
/**
|
|
15
|
-
* API Key only endpoint.
|
|
16
|
-
*/
|
|
17
|
-
exports.default = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const apiKey = ctx.request.headers[constants_1.Header.API_KEY];
|
|
19
|
-
if (!apiKey) {
|
|
20
|
-
ctx.throw(403, "Unauthorized");
|
|
21
|
-
}
|
|
22
|
-
if (Array.isArray(apiKey)) {
|
|
23
|
-
ctx.throw(403, "Unauthorized");
|
|
24
|
-
}
|
|
25
|
-
if (!(0, utils_1.isValidInternalAPIKey)(apiKey)) {
|
|
26
|
-
ctx.throw(403, "Unauthorized");
|
|
27
|
-
}
|
|
28
|
-
return next();
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=internalApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internalApi.js","sourceRoot":"","sources":["../../../src/middleware/internalApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAAqC;AAErC,oCAAgD;AAEhD;;GAEG;AACH,kBAAe,CAAO,GAAQ,EAAE,IAAS,EAAE,EAAE;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAM,CAAC,OAAO,CAAC,CAAA;IAClD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,CAAC,IAAA,6BAAqB,EAAC,MAAM,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,IAAI,EAAE,CAAA;AACf,CAAC,CAAA,CAAA"}
|
|
@@ -1,23 +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
|
-
exports.default = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
if (ctx.ip) {
|
|
15
|
-
return yield (0, context_1.doInIPContext)(ctx.ip, () => {
|
|
16
|
-
return next();
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return next();
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=ip.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ip.js","sourceRoot":"","sources":["../../../src/middleware/ip.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,wCAA0C;AAE1C,kBAAe,CAAO,GAAQ,EAAE,IAAS,EAAE,EAAE;IAC3C,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;QACX,OAAO,MAAM,IAAA,uBAAa,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE;YACtC,OAAO,IAAI,EAAE,CAAA;QACf,CAAC,CAAC,CAAA;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,EAAE,CAAA;IACf,CAAC;AACH,CAAC,CAAA,CAAA"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.body = body;
|
|
7
|
-
exports.params = params;
|
|
8
|
-
const joi_1 = __importDefault(require("joi"));
|
|
9
|
-
function validate(schema, property, opts) {
|
|
10
|
-
var _a;
|
|
11
|
-
const errorPrefix = (_a = opts === null || opts === void 0 ? void 0 : opts.errorPrefix) !== null && _a !== void 0 ? _a : `Invalid ${property}`;
|
|
12
|
-
// Return a Koa middleware function
|
|
13
|
-
return (ctx, next) => {
|
|
14
|
-
var _a;
|
|
15
|
-
if (!schema) {
|
|
16
|
-
return next();
|
|
17
|
-
}
|
|
18
|
-
let params = null;
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
let reqProp = (_a = ctx.request) === null || _a === void 0 ? void 0 : _a[property];
|
|
21
|
-
if (ctx[property] != null) {
|
|
22
|
-
params = ctx[property];
|
|
23
|
-
}
|
|
24
|
-
else if (reqProp != null) {
|
|
25
|
-
params = reqProp;
|
|
26
|
-
}
|
|
27
|
-
// not all schemas have the append property e.g. array schemas
|
|
28
|
-
if (schema.append) {
|
|
29
|
-
schema = schema.append({
|
|
30
|
-
createdAt: joi_1.default.any().optional(),
|
|
31
|
-
updatedAt: joi_1.default.any().optional(),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const { error } = schema.validate(params, {
|
|
35
|
-
allowUnknown: opts === null || opts === void 0 ? void 0 : opts.allowUnknown,
|
|
36
|
-
});
|
|
37
|
-
if (error) {
|
|
38
|
-
let message = error.message;
|
|
39
|
-
if (errorPrefix) {
|
|
40
|
-
message = `Invalid ${property} - ${message}`;
|
|
41
|
-
}
|
|
42
|
-
ctx.throw(400, message);
|
|
43
|
-
}
|
|
44
|
-
return next();
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function body(schema, opts) {
|
|
48
|
-
return validate(schema, "body", opts);
|
|
49
|
-
}
|
|
50
|
-
function params(schema, opts) {
|
|
51
|
-
return validate(schema, "params", opts);
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=joi-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"joi-validator.js","sourceRoot":"","sources":["../../../src/middleware/joi-validator.ts"],"names":[],"mappings":";;;;;AA6CA,oBAKC;AAED,wBAKC;AAzDD,8CAAqB;AAGrB,SAAS,QAAQ,CACf,MAA0C,EAC1C,QAAgB,EAChB,IAAuD;;IAEvD,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,mCAAI,WAAW,QAAQ,EAAE,CAAA;IAC9D,mCAAmC;IACnC,OAAO,CAAC,GAAQ,EAAE,IAAS,EAAE,EAAE;;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QACD,IAAI,MAAM,GAAG,IAAI,CAAA;QACjB,aAAa;QACb,IAAI,OAAO,GAAG,MAAA,GAAG,CAAC,OAAO,0CAAG,QAAQ,CAAC,CAAA;QACrC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;YAC1B,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAA;QACxB,CAAC;aAAM,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YAC3B,MAAM,GAAG,OAAO,CAAA;QAClB,CAAC;QAED,8DAA8D;QAC9D,IAAK,MAA2B,CAAC,MAAM,EAAE,CAAC;YACxC,MAAM,GAAI,MAA2B,CAAC,MAAM,CAAC;gBAC3C,SAAS,EAAE,aAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;gBAC/B,SAAS,EAAE,aAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;aAChC,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;YACxC,YAAY,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY;SACjC,CAAC,CAAA;QACF,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;YAC3B,IAAI,WAAW,EAAE,CAAC;gBAChB,OAAO,GAAG,WAAW,QAAQ,MAAM,OAAO,EAAE,CAAA;YAC9C,CAAC;YACD,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC;QACD,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,IAAI,CAClB,MAA0C,EAC1C,IAAuD;IAEvD,OAAO,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;AACvC,CAAC;AAED,SAAgB,MAAM,CACpB,MAA0C,EAC1C,IAA8B;IAE9B,OAAO,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.matches = exports.buildMatcherRegex = void 0;
|
|
4
|
-
const PARAM_REGEX = /\/:(.*?)(\/.*)?$/g;
|
|
5
|
-
const buildMatcherRegex = (patterns) => {
|
|
6
|
-
if (!patterns) {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
return patterns.map(pattern => {
|
|
10
|
-
let route = pattern.route;
|
|
11
|
-
const method = pattern.method;
|
|
12
|
-
// if there is a param in the route
|
|
13
|
-
// use a wildcard pattern
|
|
14
|
-
const matches = route.match(PARAM_REGEX);
|
|
15
|
-
if (matches) {
|
|
16
|
-
for (let match of matches) {
|
|
17
|
-
const suffix = match.endsWith("/") ? "/" : "";
|
|
18
|
-
const pattern = "/.*" + suffix;
|
|
19
|
-
route = route.replace(match, pattern);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return { regex: new RegExp(route), method, route };
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
exports.buildMatcherRegex = buildMatcherRegex;
|
|
26
|
-
const matches = (ctx, options) => {
|
|
27
|
-
return options.find(({ regex, method }) => {
|
|
28
|
-
const urlMatch = regex.test(ctx.request.url);
|
|
29
|
-
const methodMatch = method === "ALL"
|
|
30
|
-
? true
|
|
31
|
-
: ctx.request.method.toLowerCase() === method.toLowerCase();
|
|
32
|
-
return urlMatch && methodMatch;
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
exports.matches = matches;
|
|
36
|
-
//# sourceMappingURL=matchers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchers.js","sourceRoot":"","sources":["../../../src/middleware/matchers.ts"],"names":[],"mappings":";;;AAEA,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEhC,MAAM,iBAAiB,GAAG,CAC/B,QAA2B,EACX,EAAE;IAClB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAA;IACX,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QACzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAE7B,mCAAmC;QACnC,yBAAyB;QACzB,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACxC,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;gBAC7C,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;gBAC9B,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;IACpD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAvBY,QAAA,iBAAiB,qBAuB7B;AAEM,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAE,OAAuB,EAAE,EAAE;IAC3D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC5C,MAAM,WAAW,GACf,MAAM,KAAK,KAAK;YACd,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,WAAW,EAAE,CAAA;QAC/D,OAAO,QAAQ,IAAI,WAAW,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AATY,QAAA,OAAO,WASnB"}
|
|
@@ -1,107 +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.preAuth = preAuth;
|
|
46
|
-
exports.postAuth = postAuth;
|
|
47
|
-
const google = __importStar(require("../sso/google"));
|
|
48
|
-
const constants_1 = require("../../../constants");
|
|
49
|
-
const configs = __importStar(require("../../../configs"));
|
|
50
|
-
const cache = __importStar(require("../../../cache"));
|
|
51
|
-
const utils = __importStar(require("../../../utils"));
|
|
52
|
-
const sso_1 = require("../sso/sso");
|
|
53
|
-
const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy;
|
|
54
|
-
function fetchGoogleCreds() {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
let config = yield configs.getGoogleDatasourceConfig();
|
|
57
|
-
if (!config) {
|
|
58
|
-
throw new Error("No google configuration found");
|
|
59
|
-
}
|
|
60
|
-
return config;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function preAuth(passport, ctx, next) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
// get the relevant config
|
|
66
|
-
const googleConfig = yield fetchGoogleCreds();
|
|
67
|
-
const platformUrl = yield configs.getPlatformUrl({ tenantAware: false });
|
|
68
|
-
let callbackUrl = `${platformUrl}/api/global/auth/datasource/google/callback`;
|
|
69
|
-
const strategy = yield google.strategyFactory(googleConfig, callbackUrl, sso_1.ssoSaveUserNoOp);
|
|
70
|
-
if (!ctx.query.appId) {
|
|
71
|
-
ctx.throw(400, "appId query param not present.");
|
|
72
|
-
}
|
|
73
|
-
return passport.authenticate(strategy, {
|
|
74
|
-
scope: ["profile", "email", "https://www.googleapis.com/auth/spreadsheets"],
|
|
75
|
-
accessType: "offline",
|
|
76
|
-
prompt: "consent",
|
|
77
|
-
})(ctx, next);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function postAuth(passport, ctx, next) {
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
// get the relevant config
|
|
83
|
-
const config = yield fetchGoogleCreds();
|
|
84
|
-
const platformUrl = yield configs.getPlatformUrl({ tenantAware: false });
|
|
85
|
-
let callbackUrl = `${platformUrl}/api/global/auth/datasource/google/callback`;
|
|
86
|
-
const authStateCookie = utils.getCookie(ctx, constants_1.Cookie.DatasourceAuth);
|
|
87
|
-
if (!authStateCookie) {
|
|
88
|
-
throw new Error("Unable to fetch datasource auth cookie");
|
|
89
|
-
}
|
|
90
|
-
return passport.authenticate(new GoogleStrategy({
|
|
91
|
-
clientID: config.clientID,
|
|
92
|
-
clientSecret: config.clientSecret,
|
|
93
|
-
callbackURL: callbackUrl,
|
|
94
|
-
}, (accessToken, refreshToken, _profile, done) => {
|
|
95
|
-
utils.clearCookie(ctx, constants_1.Cookie.DatasourceAuth);
|
|
96
|
-
done(null, { accessToken, refreshToken });
|
|
97
|
-
}), { successRedirect: "/", failureRedirect: "/error" }, (err, tokens) => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const baseUrl = `/builder/app/${authStateCookie.appId}/data`;
|
|
99
|
-
const id = utils.newid();
|
|
100
|
-
yield cache.store(`datasource:creation:${authStateCookie.appId}:google:${id}`, {
|
|
101
|
-
tokens,
|
|
102
|
-
});
|
|
103
|
-
ctx.redirect(`${baseUrl}/new?continue_google_setup=${id}`);
|
|
104
|
-
}))(ctx, next);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=google.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../../../src/middleware/passport/datasource/google.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,0BAyBC;AAED,4BAmDC;AArGD,sDAAuC;AACvC,kDAA2C;AAC3C,0DAA2C;AAC3C,sDAAuC;AACvC,sDAAuC;AAEvC,oCAA4C;AAE5C,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,cAAc,CAAA;AAMtE,SAAe,gBAAgB;;QAC7B,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,yBAAyB,EAAE,CAAA;QAEtD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;QAClD,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAED,SAAsB,OAAO,CAC3B,QAAkB,EAClB,GAAY,EACZ,IAAc;;QAEd,0BAA0B;QAC1B,MAAM,YAAY,GAAG,MAAM,gBAAgB,EAAE,CAAA;QAC7C,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAA;QAExE,IAAI,WAAW,GAAG,GAAG,WAAW,6CAA6C,CAAA;QAC7E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,eAAe,CAC3C,YAAY,EACZ,WAAW,EACX,qBAAe,CAChB,CAAA;QAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACrB,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,gCAAgC,CAAC,CAAA;QAClD,CAAC;QAED,OAAO,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE;YACrC,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,8CAA8C,CAAC;YAC3E,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACf,CAAC;CAAA;AAED,SAAsB,QAAQ,CAC5B,QAAkB,EAClB,GAAY,EACZ,IAAc;;QAEd,0BAA0B;QAC1B,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAA;QACvC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAA;QAExE,IAAI,WAAW,GAAG,GAAG,WAAW,6CAA6C,CAAA;QAC7E,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CACrC,GAAG,EACH,kBAAM,CAAC,cAAc,CACtB,CAAA;QAED,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC3D,CAAC;QAED,OAAO,QAAQ,CAAC,YAAY,CAC1B,IAAI,cAAc,CAChB;YACE,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,WAAW,EAAE,WAAW;SACzB,EACD,CACE,WAAmB,EACnB,YAAoB,EACpB,QAAoB,EACpB,IAAc,EACd,EAAE;YACF,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,kBAAM,CAAC,cAAc,CAAC,CAAA;YAC7C,IAAI,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAA;QAC3C,CAAC,CACF,EACD,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,EACnD,CAAO,GAAQ,EAAE,MAAgB,EAAE,EAAE;YACnC,MAAM,OAAO,GAAG,gBAAgB,eAAe,CAAC,KAAK,OAAO,CAAA;YAE5D,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;YACxB,MAAM,KAAK,CAAC,KAAK,CACf,uBAAuB,eAAe,CAAC,KAAK,WAAW,EAAE,EAAE,EAC3D;gBACE,MAAM;aACP,CACF,CAAA;YAED,GAAG,CAAC,QAAQ,CAAC,GAAG,OAAO,8BAA8B,EAAE,EAAE,CAAC,CAAA;QAC5D,CAAC,CAAA,CACF,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACd,CAAC;CAAA"}
|
|
@@ -1,91 +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.options = void 0;
|
|
46
|
-
exports.authenticate = authenticate;
|
|
47
|
-
const constants_1 = require("../../constants");
|
|
48
|
-
const utils_1 = require("../../utils");
|
|
49
|
-
const users = __importStar(require("../../users"));
|
|
50
|
-
const utils_2 = require("./utils");
|
|
51
|
-
const INVALID_ERR = "Invalid credentials";
|
|
52
|
-
const EXPIRED = "This account has expired. Please reset your password";
|
|
53
|
-
exports.options = {
|
|
54
|
-
passReqToCallback: true,
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Passport Local Authentication Middleware.
|
|
58
|
-
* @param ctx the request structure
|
|
59
|
-
* @param email username to login with
|
|
60
|
-
* @param password plain text password to log in with
|
|
61
|
-
* @param done callback from passport to return user information and errors
|
|
62
|
-
* @returns The authenticated user, or errors if they occur
|
|
63
|
-
*/
|
|
64
|
-
function authenticate(ctx, email, password, done) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
if (!email)
|
|
67
|
-
return (0, utils_2.authError)(done, "Email Required");
|
|
68
|
-
if (!password)
|
|
69
|
-
return (0, utils_2.authError)(done, "Password Required");
|
|
70
|
-
const dbUser = yield users.getGlobalUserByEmail(email);
|
|
71
|
-
if (dbUser == null) {
|
|
72
|
-
console.info(`user=${email} could not be found`);
|
|
73
|
-
return (0, utils_2.authError)(done, INVALID_ERR);
|
|
74
|
-
}
|
|
75
|
-
if (dbUser.status === constants_1.UserStatus.INACTIVE) {
|
|
76
|
-
console.info(`user=${email} is inactive`, dbUser);
|
|
77
|
-
return (0, utils_2.authError)(done, INVALID_ERR);
|
|
78
|
-
}
|
|
79
|
-
if (!dbUser.password) {
|
|
80
|
-
console.info(`user=${email} has no password set`, dbUser);
|
|
81
|
-
return (0, utils_2.authError)(done, EXPIRED);
|
|
82
|
-
}
|
|
83
|
-
if (!(yield (0, utils_1.compare)(password, dbUser.password))) {
|
|
84
|
-
return (0, utils_2.authError)(done, INVALID_ERR);
|
|
85
|
-
}
|
|
86
|
-
// intentionally remove the users password in payload
|
|
87
|
-
delete dbUser.password;
|
|
88
|
-
return done(null, dbUser);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=local.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../src/middleware/passport/local.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,oCAgCC;AArDD,+CAA4C;AAC5C,uCAAqC;AACrC,mDAAoC;AACpC,mCAAmC;AAGnC,MAAM,WAAW,GAAG,qBAAqB,CAAA;AACzC,MAAM,OAAO,GAAG,sDAAsD,CAAA;AAEzD,QAAA,OAAO,GAAG;IACrB,iBAAiB,EAAE,IAAI;CACxB,CAAA;AAED;;;;;;;GAOG;AACH,SAAsB,YAAY,CAChC,GAAQ,EACR,KAAa,EACb,QAAgB,EAChB,IAAc;;QAEd,IAAI,CAAC,KAAK;YAAE,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;QACpD,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;QAE1D,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAA;QACtD,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,qBAAqB,CAAC,CAAA;YAChD,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QACrC,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,sBAAU,CAAC,QAAQ,EAAE,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,cAAc,EAAE,MAAM,CAAC,CAAA;YACjD,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QACrC,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,sBAAsB,EAAE,MAAM,CAAC,CAAA;YACzD,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACjC,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,IAAA,eAAO,EAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YAChD,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QACrC,CAAC;QAED,qDAAqD;QACrD,OAAO,MAAM,CAAC,QAAQ,CAAA;QACtB,OAAO,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC3B,CAAC;CAAA"}
|