@budibase/backend-core 2.5.6-alpha.6 → 2.5.6
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/package.json +10 -12
- package/dist/src/cache/writethrough.js +1 -1
- package/dist/src/cache/writethrough.js.map +1 -1
- package/dist/src/configs/configs.d.ts +1 -2
- package/dist/src/configs/configs.js +1 -9
- package/dist/src/configs/configs.js.map +1 -1
- package/dist/src/constants/misc.d.ts +2 -4
- package/dist/src/constants/misc.js +0 -2
- package/dist/src/constants/misc.js.map +1 -1
- package/dist/src/context/mainContext.d.ts +1 -4
- package/dist/src/context/mainContext.js +3 -20
- package/dist/src/context/mainContext.js.map +1 -1
- package/dist/src/context/types.d.ts +0 -1
- package/dist/src/db/conversions.js.map +1 -0
- package/dist/src/db/couch/DatabaseImpl.js +1 -1
- package/dist/src/db/couch/DatabaseImpl.js.map +1 -1
- package/dist/src/db/index.d.ts +1 -2
- package/dist/src/db/index.js +2 -15
- package/dist/src/db/index.js.map +1 -1
- package/dist/src/db/lucene.d.ts +14 -8
- package/dist/src/db/lucene.js +86 -152
- package/dist/src/db/lucene.js.map +1 -1
- package/dist/src/db/utils.d.ts +126 -5
- package/dist/src/db/utils.js +232 -20
- package/dist/src/db/utils.js.map +1 -1
- package/dist/src/db/views.js +1 -16
- package/dist/src/db/views.js.map +1 -1
- package/dist/src/environment.d.ts +2 -2
- package/dist/src/environment.js +2 -9
- package/dist/src/environment.js.map +1 -1
- package/dist/src/errors/errors.d.ts +0 -3
- package/dist/src/errors/errors.js +1 -8
- package/dist/src/errors/errors.js.map +1 -1
- package/dist/src/events/events.js +0 -9
- package/dist/src/events/events.js.map +1 -1
- package/dist/src/events/identification.js +0 -1
- package/dist/src/events/identification.js.map +1 -1
- package/dist/src/events/index.d.ts +0 -1
- package/dist/src/events/index.js +1 -3
- package/dist/src/events/index.js.map +1 -1
- package/dist/src/events/processors/LoggingProcessor.js +17 -3
- package/dist/src/events/processors/LoggingProcessor.js.map +1 -1
- package/dist/src/events/processors/Processors.js +3 -9
- package/dist/src/events/processors/Processors.js.map +1 -1
- package/dist/src/events/processors/types.d.ts +11 -1
- package/dist/src/events/processors/types.js +6 -0
- package/dist/src/events/processors/types.js.map +1 -1
- package/dist/src/events/publishers/group.js +0 -6
- package/dist/src/events/publishers/group.js.map +1 -1
- package/dist/src/events/publishers/user.js +0 -4
- package/dist/src/events/publishers/user.js.map +1 -1
- package/dist/src/index.d.ts +1 -5
- package/dist/src/index.js +1 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/{logging/alerts.d.ts → logging.d.ts} +5 -0
- package/dist/src/logging.js +56 -0
- package/dist/src/logging.js.map +1 -0
- package/dist/src/middleware/authenticated.js +2 -5
- package/dist/src/middleware/authenticated.js.map +1 -1
- package/dist/src/middleware/errorHandling.js +7 -5
- package/dist/src/middleware/errorHandling.js.map +1 -1
- package/dist/src/middleware/index.d.ts +1 -2
- package/dist/src/middleware/index.js +3 -5
- package/dist/src/middleware/index.js.map +1 -1
- package/dist/src/middleware/logging.d.ts +2 -0
- package/dist/src/middleware/logging.js +106 -0
- package/dist/src/middleware/logging.js.map +1 -0
- package/dist/src/middleware/passport/sso/oidc.js +5 -2
- package/dist/src/middleware/passport/sso/oidc.js.map +1 -1
- package/dist/src/migrations/migrations.js +4 -4
- package/dist/src/migrations/migrations.js.map +1 -1
- package/dist/src/newid.js.map +1 -0
- package/dist/src/objectStore/objectStore.js +3 -3
- package/dist/src/objectStore/objectStore.js.map +1 -1
- package/dist/src/plugin/utils.js +2 -53
- package/dist/src/plugin/utils.js.map +1 -1
- package/dist/src/queue/constants.d.ts +1 -2
- package/dist/src/queue/constants.js +0 -1
- package/dist/src/queue/constants.js.map +1 -1
- package/dist/src/security/encryption.d.ts +0 -1
- package/dist/src/security/encryption.js +1 -2
- package/dist/src/security/encryption.js.map +1 -1
- package/dist/src/security/permissions.d.ts +2 -35
- package/dist/src/security/permissions.js +6 -9
- package/dist/src/security/permissions.js.map +1 -1
- package/dist/src/tenancy/tenancy.js +5 -1
- package/dist/src/tenancy/tenancy.js.map +1 -1
- package/dist/src/users.d.ts +1 -10
- package/dist/src/users.js +1 -35
- package/dist/src/users.js.map +1 -1
- package/dist/src/utils/hashing.d.ts +1 -1
- package/dist/src/utils/hashing.js +1 -1
- package/dist/src/utils/hashing.js.map +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/tests/index.d.ts +1 -1
- package/dist/tests/index.js +1 -1
- package/dist/tests/index.js.map +1 -1
- package/dist/tests/jestEnv.js +1 -0
- package/dist/tests/jestEnv.js.map +1 -1
- package/dist/tests/jestSetup.d.ts +1 -1
- package/dist/tests/jestSetup.js +2 -2
- package/dist/tests/jestSetup.js.map +1 -1
- package/dist/tests/logging.js.map +1 -0
- package/dist/tests/{extra → utilities}/DBTestConfiguration.d.ts +1 -1
- package/dist/tests/{extra → utilities}/DBTestConfiguration.js +2 -2
- package/dist/tests/utilities/DBTestConfiguration.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/index.d.ts +2 -0
- package/dist/tests/{core/utilities → utilities}/index.js +7 -1
- package/dist/tests/utilities/index.js.map +1 -0
- package/dist/tests/utilities/jestUtils.js.map +1 -0
- package/dist/tests/utilities/mocks/date.js.map +1 -0
- package/dist/tests/utilities/mocks/events.d.ts +1 -0
- package/dist/tests/utilities/mocks/events.js +126 -0
- package/dist/tests/utilities/mocks/events.js.map +1 -0
- package/dist/tests/utilities/mocks/fetch.d.ts +31 -0
- package/dist/tests/utilities/mocks/fetch.js +8 -0
- package/dist/tests/utilities/mocks/fetch.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/mocks/index.d.ts +3 -4
- package/dist/tests/{core/utilities → utilities}/mocks/index.js +3 -7
- package/dist/tests/utilities/mocks/index.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/mocks/licenses.d.ts +0 -1
- package/dist/tests/{core/utilities → utilities}/mocks/licenses.js +1 -5
- package/dist/tests/utilities/mocks/licenses.js.map +1 -0
- package/dist/tests/utilities/mocks/posthog.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/structures/accounts.js +25 -2
- package/dist/tests/utilities/structures/accounts.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/structures/apps.js +1 -1
- package/dist/tests/utilities/structures/apps.js.map +1 -0
- package/dist/tests/utilities/structures/common.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/structures/db.js +1 -1
- package/dist/tests/utilities/structures/db.js.map +1 -0
- package/dist/tests/utilities/structures/generator.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/structures/index.d.ts +0 -1
- package/dist/tests/{core/utilities → utilities}/structures/index.js +1 -2
- package/dist/tests/utilities/structures/index.js.map +1 -0
- package/dist/tests/utilities/structures/koa.js.map +1 -0
- package/dist/tests/utilities/structures/licenses.js.map +1 -0
- package/dist/tests/utilities/structures/plugins.js.map +1 -0
- package/dist/tests/utilities/structures/shared.js.map +1 -0
- package/dist/tests/utilities/structures/sso.js.map +1 -0
- package/dist/tests/{core/utilities → utilities}/structures/tenants.js +1 -1
- package/dist/tests/utilities/structures/tenants.js.map +1 -0
- package/dist/tests/utilities/structures/userGroups.js.map +1 -0
- package/dist/tests/utilities/structures/users.js.map +1 -0
- package/dist/tests/utilities/testContainerUtils.js.map +1 -0
- package/dist/tests/{extra → utilities}/testEnv.js +1 -1
- package/dist/tests/utilities/testEnv.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -12
- package/src/auth/tests/auth.spec.ts +1 -2
- package/src/cache/tests/writethrough.spec.ts +3 -4
- package/src/cache/writethrough.ts +2 -1
- package/src/configs/configs.ts +0 -9
- package/src/configs/tests/configs.spec.ts +6 -2
- package/src/constants/misc.ts +0 -2
- package/src/context/mainContext.ts +2 -19
- package/src/context/tests/index.spec.ts +3 -16
- package/src/context/types.ts +0 -1
- package/src/db/couch/DatabaseImpl.ts +1 -1
- package/src/db/index.ts +1 -2
- package/src/db/lucene.ts +88 -143
- package/src/db/tests/lucene.spec.ts +1 -101
- package/src/db/tests/utils.spec.ts +1 -1
- package/src/db/utils.ts +275 -7
- package/src/db/views.ts +2 -18
- package/src/environment.ts +2 -11
- package/src/errors/errors.ts +0 -8
- package/src/events/events.ts +1 -10
- package/src/events/identification.ts +0 -1
- package/src/events/index.ts +0 -2
- package/src/events/processors/LoggingProcessor.ts +22 -3
- package/src/events/processors/Processors.ts +3 -9
- package/src/events/processors/posthog/tests/PosthogProcessor.spec.ts +1 -1
- package/src/events/processors/types.ts +18 -1
- package/src/events/publishers/group.ts +1 -6
- package/src/events/publishers/user.ts +0 -4
- package/src/index.ts +0 -1
- package/src/logging.ts +60 -0
- package/src/middleware/authenticated.ts +2 -8
- package/src/middleware/errorHandling.ts +4 -4
- package/src/middleware/index.ts +1 -2
- package/src/middleware/logging.ts +90 -0
- package/src/middleware/passport/sso/oidc.ts +9 -2
- package/src/middleware/passport/sso/tests/sso.spec.ts +1 -2
- package/src/migrations/migrations.ts +8 -4
- package/src/migrations/tests/__snapshots__/migrations.spec.ts.snap +1 -1
- package/src/migrations/tests/migrations.spec.ts +1 -1
- package/src/objectStore/buckets/tests/app.spec.ts +1 -1
- package/src/objectStore/buckets/tests/global.spec.ts +1 -1
- package/src/objectStore/buckets/tests/plugins.spec.ts +1 -2
- package/src/objectStore/objectStore.ts +3 -3
- package/src/platform/tests/tenants.spec.ts +1 -2
- package/src/plugin/utils.ts +3 -63
- package/src/queue/constants.ts +0 -1
- package/src/security/encryption.ts +1 -1
- package/src/security/permissions.ts +5 -5
- package/src/tenancy/tenancy.ts +2 -2
- package/src/users.ts +1 -41
- package/src/utils/hashing.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/tests/utils.spec.ts +1 -2
- package/tests/index.ts +1 -1
- package/tests/jestEnv.ts +1 -0
- package/tests/jestSetup.ts +2 -2
- package/tests/{extra → utilities}/DBTestConfiguration.ts +2 -2
- package/tests/{core/utilities → utilities}/index.ts +3 -0
- package/tests/utilities/mocks/events.ts +122 -0
- package/tests/utilities/mocks/fetch.ts +10 -0
- package/tests/{core/utilities → utilities}/mocks/index.ts +3 -4
- package/tests/{core/utilities → utilities}/mocks/licenses.ts +0 -4
- package/tests/{core/utilities → utilities}/structures/accounts.ts +2 -2
- package/tests/{core/utilities → utilities}/structures/apps.ts +1 -1
- package/tests/{core/utilities → utilities}/structures/db.ts +1 -1
- package/tests/{core/utilities → utilities}/structures/index.ts +0 -1
- package/tests/{core/utilities → utilities}/structures/tenants.ts +1 -1
- package/tests/{extra → utilities}/testEnv.ts +1 -1
- package/dist/src/db/searchIndexes/index.d.ts +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.d.ts +0 -1
- package/dist/src/db/searchIndexes/searchIndexes.js +0 -77
- package/dist/src/db/searchIndexes/searchIndexes.js.map +0 -1
- package/dist/src/docIds/conversions.js.map +0 -1
- package/dist/src/docIds/ids.d.ts +0 -53
- package/dist/src/docIds/ids.js +0 -101
- package/dist/src/docIds/ids.js.map +0 -1
- package/dist/src/docIds/index.d.ts +0 -2
- package/dist/src/docIds/index.js +0 -19
- package/dist/src/docIds/index.js.map +0 -1
- package/dist/src/docIds/newid.js.map +0 -1
- package/dist/src/docIds/params.d.ts +0 -69
- package/dist/src/docIds/params.js +0 -138
- package/dist/src/docIds/params.js.map +0 -1
- package/dist/src/docUpdates/index.d.ts +0 -2
- package/dist/src/docUpdates/index.js +0 -36
- package/dist/src/docUpdates/index.js.map +0 -1
- package/dist/src/events/asyncEvents/index.d.ts +0 -2
- 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.d.ts +0 -2
- package/dist/src/events/asyncEvents/publisher.js +0 -27
- package/dist/src/events/asyncEvents/publisher.js.map +0 -1
- package/dist/src/events/asyncEvents/queue.d.ts +0 -11
- package/dist/src/events/asyncEvents/queue.js +0 -26
- package/dist/src/events/asyncEvents/queue.js.map +0 -1
- package/dist/src/events/documentId.d.ts +0 -2
- package/dist/src/events/documentId.js +0 -28
- package/dist/src/events/documentId.js.map +0 -1
- package/dist/src/events/processors/async/DocumentUpdateProcessor.d.ts +0 -13
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js +0 -44
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +0 -1
- package/dist/src/logging/alerts.js +0 -24
- package/dist/src/logging/alerts.js.map +0 -1
- package/dist/src/logging/correlation/correlation.d.ts +0 -2
- package/dist/src/logging/correlation/correlation.js +0 -17
- package/dist/src/logging/correlation/correlation.js.map +0 -1
- package/dist/src/logging/correlation/index.d.ts +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.d.ts +0 -2
- package/dist/src/logging/correlation/middleware.js +0 -17
- package/dist/src/logging/correlation/middleware.js.map +0 -1
- package/dist/src/logging/index.d.ts +0 -4
- package/dist/src/logging/index.js +0 -37
- package/dist/src/logging/index.js.map +0 -1
- package/dist/src/logging/pino/logger.d.ts +0 -3
- package/dist/src/logging/pino/logger.js +0 -181
- package/dist/src/logging/pino/logger.js.map +0 -1
- package/dist/src/logging/pino/middleware.d.ts +0 -4
- package/dist/src/logging/pino/middleware.js +0 -47
- package/dist/src/logging/pino/middleware.js.map +0 -1
- package/dist/src/utils/stringUtils.d.ts +0 -1
- package/dist/src/utils/stringUtils.js +0 -9
- package/dist/src/utils/stringUtils.js.map +0 -1
- package/dist/tests/core/logging.js.map +0 -1
- package/dist/tests/core/utilities/index.js.map +0 -1
- package/dist/tests/core/utilities/jestUtils.js.map +0 -1
- package/dist/tests/core/utilities/mocks/alerts.d.ts +0 -3
- package/dist/tests/core/utilities/mocks/alerts.js +0 -30
- package/dist/tests/core/utilities/mocks/alerts.js.map +0 -1
- package/dist/tests/core/utilities/mocks/date.js.map +0 -1
- package/dist/tests/core/utilities/mocks/events.d.ts +0 -0
- package/dist/tests/core/utilities/mocks/events.js +0 -136
- package/dist/tests/core/utilities/mocks/events.js.map +0 -1
- package/dist/tests/core/utilities/mocks/fetch.d.ts +0 -33
- package/dist/tests/core/utilities/mocks/fetch.js +0 -15
- package/dist/tests/core/utilities/mocks/fetch.js.map +0 -1
- package/dist/tests/core/utilities/mocks/index.js.map +0 -1
- package/dist/tests/core/utilities/mocks/licenses.js.map +0 -1
- package/dist/tests/core/utilities/mocks/posthog.js.map +0 -1
- package/dist/tests/core/utilities/structures/accounts.js.map +0 -1
- package/dist/tests/core/utilities/structures/apps.js.map +0 -1
- package/dist/tests/core/utilities/structures/common.js.map +0 -1
- package/dist/tests/core/utilities/structures/db.js.map +0 -1
- package/dist/tests/core/utilities/structures/generator.js.map +0 -1
- package/dist/tests/core/utilities/structures/index.js.map +0 -1
- package/dist/tests/core/utilities/structures/koa.js.map +0 -1
- package/dist/tests/core/utilities/structures/licenses.js.map +0 -1
- package/dist/tests/core/utilities/structures/plugins.js.map +0 -1
- package/dist/tests/core/utilities/structures/scim.d.ts +0 -14
- package/dist/tests/core/utilities/structures/scim.js +0 -67
- package/dist/tests/core/utilities/structures/scim.js.map +0 -1
- package/dist/tests/core/utilities/structures/shared.js.map +0 -1
- package/dist/tests/core/utilities/structures/sso.js.map +0 -1
- package/dist/tests/core/utilities/structures/tenants.js.map +0 -1
- package/dist/tests/core/utilities/structures/userGroups.js.map +0 -1
- package/dist/tests/core/utilities/structures/users.js.map +0 -1
- package/dist/tests/core/utilities/testContainerUtils.js.map +0 -1
- package/dist/tests/extra/DBTestConfiguration.js.map +0 -1
- package/dist/tests/extra/index.d.ts +0 -2
- package/dist/tests/extra/index.js +0 -33
- package/dist/tests/extra/index.js.map +0 -1
- package/dist/tests/extra/testEnv.js.map +0 -1
- package/src/db/searchIndexes/index.ts +0 -1
- package/src/db/searchIndexes/searchIndexes.ts +0 -62
- package/src/docIds/ids.ts +0 -102
- package/src/docIds/index.ts +0 -2
- package/src/docIds/params.ts +0 -174
- package/src/docUpdates/index.ts +0 -29
- package/src/events/asyncEvents/index.ts +0 -2
- package/src/events/asyncEvents/publisher.ts +0 -12
- package/src/events/asyncEvents/queue.ts +0 -22
- package/src/events/documentId.ts +0 -56
- package/src/events/processors/async/DocumentUpdateProcessor.ts +0 -43
- package/src/logging/alerts.ts +0 -26
- package/src/logging/correlation/correlation.ts +0 -13
- package/src/logging/correlation/index.ts +0 -1
- package/src/logging/correlation/middleware.ts +0 -17
- package/src/logging/index.ts +0 -6
- package/src/logging/pino/logger.ts +0 -188
- package/src/logging/pino/middleware.ts +0 -45
- package/src/plugin/tests/validation.spec.ts +0 -83
- package/src/security/tests/encryption.spec.ts +0 -31
- package/src/security/tests/permissions.spec.ts +0 -145
- package/src/tenancy/tests/tenancy.spec.ts +0 -184
- package/src/utils/stringUtils.ts +0 -8
- package/tests/core/utilities/mocks/alerts.ts +0 -3
- package/tests/core/utilities/mocks/events.ts +0 -123
- package/tests/core/utilities/mocks/fetch.ts +0 -17
- package/tests/core/utilities/structures/scim.ts +0 -81
- package/tests/extra/index.ts +0 -2
- /package/dist/src/{docIds → db}/conversions.d.ts +0 -0
- /package/dist/src/{docIds → db}/conversions.js +0 -0
- /package/dist/src/{docIds/newid.d.ts → newid.d.ts} +0 -0
- /package/dist/src/{docIds/newid.js → newid.js} +0 -0
- /package/dist/tests/{core/logging.d.ts → logging.d.ts} +0 -0
- /package/dist/tests/{core/logging.js → logging.js} +0 -0
- /package/dist/tests/{core/utilities → utilities}/jestUtils.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/jestUtils.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/mocks/date.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/mocks/date.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/mocks/posthog.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/mocks/posthog.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/accounts.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/apps.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/common.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/common.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/db.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/generator.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/generator.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/koa.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/koa.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/licenses.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/licenses.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/plugins.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/plugins.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/shared.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/shared.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/sso.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/sso.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/tenants.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/userGroups.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/userGroups.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/users.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/structures/users.js +0 -0
- /package/dist/tests/{core/utilities → utilities}/testContainerUtils.d.ts +0 -0
- /package/dist/tests/{core/utilities → utilities}/testContainerUtils.js +0 -0
- /package/dist/tests/{extra → utilities}/testEnv.d.ts +0 -0
- /package/src/{docIds → db}/conversions.ts +0 -0
- /package/src/{docIds/newid.ts → newid.ts} +0 -0
- /package/tests/{core/logging.ts → logging.ts} +0 -0
- /package/tests/{core/utilities → utilities}/jestUtils.ts +0 -0
- /package/tests/{core/utilities → utilities}/mocks/date.ts +0 -0
- /package/tests/{core/utilities → utilities}/mocks/posthog.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/common.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/generator.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/koa.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/licenses.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/plugins.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/shared.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/sso.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/userGroups.ts +0 -0
- /package/tests/{core/utilities → utilities}/structures/users.ts +0 -0
- /package/tests/{core/utilities → utilities}/testContainerUtils.ts +0 -0
|
@@ -96,15 +96,9 @@ export default function (
|
|
|
96
96
|
}
|
|
97
97
|
try {
|
|
98
98
|
// check the actual user is authenticated first, try header or cookie
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
const headerToken = ctx.request.headers[Header.TOKEN]
|
|
101
100
|
const authCookie = getCookie(ctx, Cookie.Auth) || openJwt(headerToken)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!apiKey && ctx.request.headers[Header.AUTHORIZATION]) {
|
|
105
|
-
apiKey = ctx.request.headers[Header.AUTHORIZATION].split(" ")[1]
|
|
106
|
-
}
|
|
107
|
-
|
|
101
|
+
const apiKey = ctx.request.headers[Header.API_KEY]
|
|
108
102
|
const tenantId = ctx.request.headers[Header.TENANT_ID]
|
|
109
103
|
let authenticated = false,
|
|
110
104
|
user = null,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIError } from "@budibase/types"
|
|
2
2
|
import * as errors from "../errors"
|
|
3
|
+
import env from "../environment"
|
|
3
4
|
|
|
4
5
|
export async function errorHandling(ctx: any, next: any) {
|
|
5
6
|
try {
|
|
@@ -8,10 +9,9 @@ export async function errorHandling(ctx: any, next: any) {
|
|
|
8
9
|
const status = err.status || err.statusCode || 500
|
|
9
10
|
ctx.status = status
|
|
10
11
|
|
|
11
|
-
if (status
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
console.error(err)
|
|
12
|
+
if (status > 499 || env.ENABLE_4XX_HTTP_LOGGING) {
|
|
13
|
+
ctx.log.error(err)
|
|
14
|
+
console.trace(err)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const error = errors.getPublicError(err)
|
package/src/middleware/index.ts
CHANGED
|
@@ -14,8 +14,7 @@ export { default as csrf } from "./csrf"
|
|
|
14
14
|
export { default as adminOnly } from "./adminOnly"
|
|
15
15
|
export { default as builderOrAdmin } from "./builderOrAdmin"
|
|
16
16
|
export { default as builderOnly } from "./builderOnly"
|
|
17
|
-
export { default as
|
|
18
|
-
export { default as correlation } from "../logging/correlation/middleware"
|
|
17
|
+
export { default as logging } from "./logging"
|
|
19
18
|
export { default as errorHandling } from "./errorHandling"
|
|
20
19
|
export { default as querystringToBody } from "./querystringToBody"
|
|
21
20
|
export * as joiValidator from "./joi-validator"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const correlator = require("correlation-id")
|
|
2
|
+
import { Header } from "../constants"
|
|
3
|
+
import { v4 as uuid } from "uuid"
|
|
4
|
+
import * as context from "../context"
|
|
5
|
+
|
|
6
|
+
const debug = console.warn
|
|
7
|
+
const trace = console.trace
|
|
8
|
+
const log = console.log
|
|
9
|
+
const info = console.info
|
|
10
|
+
const warn = console.warn
|
|
11
|
+
const error = console.error
|
|
12
|
+
|
|
13
|
+
const getTenantId = () => {
|
|
14
|
+
let tenantId
|
|
15
|
+
try {
|
|
16
|
+
tenantId = context.getTenantId()
|
|
17
|
+
} catch (e: any) {
|
|
18
|
+
// do nothing
|
|
19
|
+
}
|
|
20
|
+
return tenantId
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const getAppId = () => {
|
|
24
|
+
let appId
|
|
25
|
+
try {
|
|
26
|
+
appId = context.getAppId()
|
|
27
|
+
} catch (e) {
|
|
28
|
+
// do nothing
|
|
29
|
+
}
|
|
30
|
+
return appId
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const getIdentityId = () => {
|
|
34
|
+
let identityId
|
|
35
|
+
try {
|
|
36
|
+
const identity = context.getIdentity()
|
|
37
|
+
identityId = identity?._id
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// do nothing
|
|
40
|
+
}
|
|
41
|
+
return identityId
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const print = (fn: any, data: any[]) => {
|
|
45
|
+
let message = ""
|
|
46
|
+
|
|
47
|
+
const correlationId = correlator.getId()
|
|
48
|
+
if (correlationId) {
|
|
49
|
+
message = message + `[correlationId=${correlator.getId()}]`
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const tenantId = getTenantId()
|
|
53
|
+
if (tenantId) {
|
|
54
|
+
message = message + ` [tenantId=${tenantId}]`
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const appId = getAppId()
|
|
58
|
+
if (appId) {
|
|
59
|
+
message = message + ` [appId=${appId}]`
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const identityId = getIdentityId()
|
|
63
|
+
if (identityId) {
|
|
64
|
+
message = message + ` [identityId=${identityId}]`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!process.env.CI) {
|
|
68
|
+
fn(message, data)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const logging = (ctx: any, next: any) => {
|
|
73
|
+
// use the provided correlation id header if present
|
|
74
|
+
let correlationId = ctx.headers[Header.CORRELATION_ID]
|
|
75
|
+
if (!correlationId) {
|
|
76
|
+
correlationId = uuid()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return correlator.withId(correlationId, () => {
|
|
80
|
+
console.debug = data => print(debug, data)
|
|
81
|
+
console.trace = data => print(trace, data)
|
|
82
|
+
console.log = data => print(log, data)
|
|
83
|
+
console.info = data => print(info, data)
|
|
84
|
+
console.warn = data => print(warn, data)
|
|
85
|
+
console.error = data => print(error, data)
|
|
86
|
+
return next()
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default logging
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fetch from "node-fetch"
|
|
2
2
|
import * as sso from "./sso"
|
|
3
3
|
import { ssoCallbackUrl } from "../utils"
|
|
4
|
-
import { validEmail } from "../../../utils"
|
|
5
4
|
import {
|
|
6
5
|
ConfigType,
|
|
7
6
|
OIDCInnerConfig,
|
|
@@ -12,7 +11,6 @@ import {
|
|
|
12
11
|
JwtClaims,
|
|
13
12
|
SaveSSOUserFunction,
|
|
14
13
|
} from "@budibase/types"
|
|
15
|
-
|
|
16
14
|
const OIDCStrategy = require("@techpass/passport-openidconnect").Strategy
|
|
17
15
|
|
|
18
16
|
export function buildVerifyFn(saveUserFn: SaveSSOUserFunction) {
|
|
@@ -88,6 +86,15 @@ function getEmail(profile: SSOProfile, jwtClaims: JwtClaims) {
|
|
|
88
86
|
)
|
|
89
87
|
}
|
|
90
88
|
|
|
89
|
+
function validEmail(value: string) {
|
|
90
|
+
return (
|
|
91
|
+
value &&
|
|
92
|
+
!!value.match(
|
|
93
|
+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
/**
|
|
92
99
|
* Create an instance of the oidc passport strategy. This wrapper fetches the configuration
|
|
93
100
|
* from couchDB rather than environment variables, using this factory is necessary for dynamically configuring passport.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { structures, mocks } from "../../../../../tests"
|
|
2
|
-
import { testEnv } from "../../../../../tests/extra"
|
|
1
|
+
import { structures, testEnv, mocks } from "../../../../../tests"
|
|
3
2
|
import { SSOAuthDetails, User } from "@budibase/types"
|
|
4
3
|
|
|
5
4
|
import { HTTPError } from "../../../../errors"
|
|
@@ -99,7 +99,9 @@ export const runMigration = async (
|
|
|
99
99
|
options.force[migrationType] &&
|
|
100
100
|
options.force[migrationType].includes(migrationName)
|
|
101
101
|
) {
|
|
102
|
-
log(
|
|
102
|
+
log(
|
|
103
|
+
`[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Forcing`
|
|
104
|
+
)
|
|
103
105
|
} else {
|
|
104
106
|
// no force, exit
|
|
105
107
|
return
|
|
@@ -109,7 +111,7 @@ export const runMigration = async (
|
|
|
109
111
|
// check if the migration is not a no-op
|
|
110
112
|
if (!options.noOp) {
|
|
111
113
|
log(
|
|
112
|
-
`[Migration: ${migrationName}] [DB: ${dbName}] Running ${lengthStatement}`
|
|
114
|
+
`[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Running ${lengthStatement}`
|
|
113
115
|
)
|
|
114
116
|
|
|
115
117
|
if (migration.preventRetry) {
|
|
@@ -129,7 +131,9 @@ export const runMigration = async (
|
|
|
129
131
|
await migration.fn(db)
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
log(
|
|
134
|
+
log(
|
|
135
|
+
`[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Complete`
|
|
136
|
+
)
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
// mark as complete
|
|
@@ -137,7 +141,7 @@ export const runMigration = async (
|
|
|
137
141
|
await db.put(doc)
|
|
138
142
|
} catch (err) {
|
|
139
143
|
console.error(
|
|
140
|
-
`[Migration: ${migrationName}] [DB: ${dbName}] Error: `,
|
|
144
|
+
`[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Error: `,
|
|
141
145
|
err
|
|
142
146
|
)
|
|
143
147
|
throw err
|
|
@@ -3,7 +3,7 @@ import AWS from "aws-sdk"
|
|
|
3
3
|
import stream from "stream"
|
|
4
4
|
import fetch from "node-fetch"
|
|
5
5
|
import tar from "tar-fs"
|
|
6
|
-
|
|
6
|
+
const zlib = require("zlib")
|
|
7
7
|
import { promisify } from "util"
|
|
8
8
|
import { join } from "path"
|
|
9
9
|
import fs from "fs"
|
|
@@ -415,7 +415,7 @@ export const downloadTarballDirect = async (
|
|
|
415
415
|
throw new Error(`unexpected response ${response.statusText}`)
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
await streamPipeline(response.body, zlib.
|
|
418
|
+
await streamPipeline(response.body, zlib.Unzip(), tar.extract(path))
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
export const downloadTarball = async (
|
|
@@ -431,7 +431,7 @@ export const downloadTarball = async (
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
const tmpPath = join(budibaseTempDir(), path)
|
|
434
|
-
await streamPipeline(response.body, zlib.
|
|
434
|
+
await streamPipeline(response.body, zlib.Unzip(), tar.extract(tmpPath))
|
|
435
435
|
if (!env.isTest() && env.SELF_HOSTED) {
|
|
436
436
|
await uploadDirectory(bucketName, tmpPath, path)
|
|
437
437
|
}
|
package/src/plugin/utils.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DatasourceFieldType,
|
|
3
|
-
QueryType,
|
|
4
|
-
PluginType,
|
|
5
|
-
AutomationStepType,
|
|
6
|
-
AutomationStepIdArray,
|
|
7
|
-
AutomationIOType,
|
|
8
|
-
AutomationCustomIOType,
|
|
9
|
-
} from "@budibase/types"
|
|
1
|
+
import { DatasourceFieldType, QueryType, PluginType } from "@budibase/types"
|
|
10
2
|
import joi from "joi"
|
|
11
3
|
|
|
12
4
|
const DATASOURCE_TYPES = [
|
|
@@ -27,7 +19,7 @@ function runJoi(validator: joi.Schema, schema: any) {
|
|
|
27
19
|
|
|
28
20
|
function validateComponent(schema: any) {
|
|
29
21
|
const validator = joi.object({
|
|
30
|
-
type: joi.string().allow(
|
|
22
|
+
type: joi.string().allow("component").required(),
|
|
31
23
|
metadata: joi.object().unknown(true).required(),
|
|
32
24
|
hash: joi.string().optional(),
|
|
33
25
|
version: joi.string().optional(),
|
|
@@ -61,7 +53,7 @@ function validateDatasource(schema: any) {
|
|
|
61
53
|
.required()
|
|
62
54
|
|
|
63
55
|
const validator = joi.object({
|
|
64
|
-
type: joi.string().allow(
|
|
56
|
+
type: joi.string().allow("datasource").required(),
|
|
65
57
|
metadata: joi.object().unknown(true).required(),
|
|
66
58
|
hash: joi.string().optional(),
|
|
67
59
|
version: joi.string().optional(),
|
|
@@ -90,55 +82,6 @@ function validateDatasource(schema: any) {
|
|
|
90
82
|
runJoi(validator, schema)
|
|
91
83
|
}
|
|
92
84
|
|
|
93
|
-
function validateAutomation(schema: any) {
|
|
94
|
-
const basePropsValidator = joi.object().pattern(joi.string(), {
|
|
95
|
-
type: joi
|
|
96
|
-
.string()
|
|
97
|
-
.allow(...Object.values(AutomationIOType))
|
|
98
|
-
.required(),
|
|
99
|
-
customType: joi.string().allow(...Object.values(AutomationCustomIOType)),
|
|
100
|
-
title: joi.string(),
|
|
101
|
-
description: joi.string(),
|
|
102
|
-
enum: joi.array().items(joi.string()),
|
|
103
|
-
pretty: joi.array().items(joi.string()),
|
|
104
|
-
})
|
|
105
|
-
const stepSchemaValidator = joi
|
|
106
|
-
.object({
|
|
107
|
-
properties: basePropsValidator,
|
|
108
|
-
required: joi.array().items(joi.string()),
|
|
109
|
-
})
|
|
110
|
-
.concat(basePropsValidator)
|
|
111
|
-
.required()
|
|
112
|
-
const validator = joi.object({
|
|
113
|
-
type: joi.string().allow(PluginType.AUTOMATION).required(),
|
|
114
|
-
metadata: joi.object().unknown(true).required(),
|
|
115
|
-
hash: joi.string().optional(),
|
|
116
|
-
version: joi.string().optional(),
|
|
117
|
-
schema: joi.object({
|
|
118
|
-
name: joi.string().required(),
|
|
119
|
-
tagline: joi.string().required(),
|
|
120
|
-
icon: joi.string().required(),
|
|
121
|
-
description: joi.string().required(),
|
|
122
|
-
type: joi
|
|
123
|
-
.string()
|
|
124
|
-
.allow(AutomationStepType.ACTION, AutomationStepType.LOGIC)
|
|
125
|
-
.required(),
|
|
126
|
-
stepId: joi
|
|
127
|
-
.string()
|
|
128
|
-
.disallow(...AutomationStepIdArray)
|
|
129
|
-
.required(),
|
|
130
|
-
inputs: joi.object().optional(),
|
|
131
|
-
schema: joi
|
|
132
|
-
.object({
|
|
133
|
-
inputs: stepSchemaValidator,
|
|
134
|
-
outputs: stepSchemaValidator,
|
|
135
|
-
})
|
|
136
|
-
.required(),
|
|
137
|
-
}),
|
|
138
|
-
})
|
|
139
|
-
runJoi(validator, schema)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
85
|
export function validate(schema: any) {
|
|
143
86
|
switch (schema?.type) {
|
|
144
87
|
case PluginType.COMPONENT:
|
|
@@ -147,9 +90,6 @@ export function validate(schema: any) {
|
|
|
147
90
|
case PluginType.DATASOURCE:
|
|
148
91
|
validateDatasource(schema)
|
|
149
92
|
break
|
|
150
|
-
case PluginType.AUTOMATION:
|
|
151
|
-
validateAutomation(schema)
|
|
152
|
-
break
|
|
153
93
|
default:
|
|
154
94
|
throw new Error(`Unknown plugin type - check schema.json: ${schema.type}`)
|
|
155
95
|
}
|
package/src/queue/constants.ts
CHANGED
|
@@ -12,7 +12,7 @@ export enum SecretOption {
|
|
|
12
12
|
ENCRYPTION = "encryption",
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
function getSecret(secretOption: SecretOption): string {
|
|
16
16
|
let secret, secretName
|
|
17
17
|
switch (secretOption) {
|
|
18
18
|
case SecretOption.ENCRYPTION:
|
|
@@ -24,7 +24,7 @@ export enum PermissionType {
|
|
|
24
24
|
QUERY = "query",
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
class Permission {
|
|
28
28
|
type: PermissionType
|
|
29
29
|
level: PermissionLevel
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ export class Permission {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
function levelToNumber(perm: PermissionLevel) {
|
|
38
38
|
switch (perm) {
|
|
39
39
|
// not everything has execute privileges
|
|
40
40
|
case PermissionLevel.EXECUTE:
|
|
@@ -55,7 +55,7 @@ export function levelToNumber(perm: PermissionLevel) {
|
|
|
55
55
|
* @param {string} userPermLevel The permission level of the user.
|
|
56
56
|
* @return {string[]} All the permission levels this user is allowed to carry out.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
function getAllowedLevels(userPermLevel: PermissionLevel) {
|
|
59
59
|
switch (userPermLevel) {
|
|
60
60
|
case PermissionLevel.EXECUTE:
|
|
61
61
|
return [PermissionLevel.EXECUTE]
|
|
@@ -64,9 +64,9 @@ export function getAllowedLevels(userPermLevel: PermissionLevel): string[] {
|
|
|
64
64
|
case PermissionLevel.WRITE:
|
|
65
65
|
case PermissionLevel.ADMIN:
|
|
66
66
|
return [
|
|
67
|
-
PermissionLevel.EXECUTE,
|
|
68
67
|
PermissionLevel.READ,
|
|
69
68
|
PermissionLevel.WRITE,
|
|
69
|
+
PermissionLevel.EXECUTE,
|
|
70
70
|
]
|
|
71
71
|
default:
|
|
72
72
|
return []
|
|
@@ -81,7 +81,7 @@ export enum BuiltinPermissionID {
|
|
|
81
81
|
POWER = "power",
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const BUILTIN_PERMISSIONS = {
|
|
85
85
|
PUBLIC: {
|
|
86
86
|
_id: BuiltinPermissionID.PUBLIC,
|
|
87
87
|
name: "Public",
|
package/src/tenancy/tenancy.ts
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
getTenantId,
|
|
4
4
|
getTenantIDFromAppID,
|
|
5
5
|
isMultiTenant,
|
|
6
|
-
getPlatformURL,
|
|
7
6
|
} from "../context"
|
|
7
|
+
import env from "../environment"
|
|
8
8
|
import {
|
|
9
9
|
BBContext,
|
|
10
10
|
TenantResolutionStrategy,
|
|
@@ -93,7 +93,7 @@ export const getTenantIDFromCtx = (
|
|
|
93
93
|
// subdomain
|
|
94
94
|
if (isAllowed(TenantResolutionStrategy.SUBDOMAIN)) {
|
|
95
95
|
// e.g. budibase.app or local.com:10000
|
|
96
|
-
const platformHost = new URL(
|
|
96
|
+
const platformHost = new URL(env.PLATFORM_URL).host.split(":")[0]
|
|
97
97
|
// e.g. tenant.budibase.app or tenant.local.com
|
|
98
98
|
const requestHost = ctx.host
|
|
99
99
|
// parse the tenant id from the difference
|
package/src/users.ts
CHANGED
|
@@ -8,10 +8,8 @@ import {
|
|
|
8
8
|
DocumentType,
|
|
9
9
|
SEPARATOR,
|
|
10
10
|
directCouchFind,
|
|
11
|
-
getGlobalUserParams,
|
|
12
|
-
pagination,
|
|
13
11
|
} from "./db"
|
|
14
|
-
import { BulkDocsResponse,
|
|
12
|
+
import { BulkDocsResponse, User } from "@budibase/types"
|
|
15
13
|
import { getGlobalDB } from "./context"
|
|
16
14
|
import * as context from "./context"
|
|
17
15
|
|
|
@@ -201,41 +199,3 @@ export const searchGlobalUsersByEmail = async (
|
|
|
201
199
|
}
|
|
202
200
|
return users
|
|
203
201
|
}
|
|
204
|
-
|
|
205
|
-
const PAGE_LIMIT = 8
|
|
206
|
-
export const paginatedUsers = async ({
|
|
207
|
-
page,
|
|
208
|
-
email,
|
|
209
|
-
appId,
|
|
210
|
-
}: SearchUsersRequest = {}) => {
|
|
211
|
-
const db = getGlobalDB()
|
|
212
|
-
// get one extra document, to have the next page
|
|
213
|
-
const opts: any = {
|
|
214
|
-
include_docs: true,
|
|
215
|
-
limit: PAGE_LIMIT + 1,
|
|
216
|
-
}
|
|
217
|
-
// add a startkey if the page was specified (anchor)
|
|
218
|
-
if (page) {
|
|
219
|
-
opts.startkey = page
|
|
220
|
-
}
|
|
221
|
-
// property specifies what to use for the page/anchor
|
|
222
|
-
let userList: User[],
|
|
223
|
-
property = "_id",
|
|
224
|
-
getKey
|
|
225
|
-
if (appId) {
|
|
226
|
-
userList = await searchGlobalUsersByApp(appId, opts)
|
|
227
|
-
getKey = (doc: any) => getGlobalUserByAppPage(appId, doc)
|
|
228
|
-
} else if (email) {
|
|
229
|
-
userList = await searchGlobalUsersByEmail(email, opts)
|
|
230
|
-
property = "email"
|
|
231
|
-
} else {
|
|
232
|
-
// no search, query allDocs
|
|
233
|
-
const response = await db.allDocs(getGlobalUserParams(null, opts))
|
|
234
|
-
userList = response.rows.map((row: any) => row.doc)
|
|
235
|
-
}
|
|
236
|
-
return pagination(userList, PAGE_LIMIT, {
|
|
237
|
-
paginate: true,
|
|
238
|
-
property,
|
|
239
|
-
getKey,
|
|
240
|
-
})
|
|
241
|
-
}
|
package/src/utils/hashing.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { structures } from "../../../tests"
|
|
2
|
-
import { DBTestConfiguration } from "../../../tests/extra"
|
|
1
|
+
import { structures, DBTestConfiguration } from "../../../tests"
|
|
3
2
|
import * as utils from "../../utils"
|
|
4
3
|
import * as db from "../../db"
|
|
5
4
|
import { Header } from "../../constants"
|
package/tests/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./utilities"
|
package/tests/jestEnv.ts
CHANGED
package/tests/jestSetup.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./logging"
|
|
2
2
|
import env from "../src/environment"
|
|
3
3
|
import { cleanup } from "../src/timers"
|
|
4
|
-
import { mocks, testContainerUtils } from "./
|
|
4
|
+
import { mocks, testContainerUtils } from "./utilities"
|
|
5
5
|
|
|
6
6
|
// must explicitly enable fetch mock
|
|
7
7
|
mocks.fetch.enable()
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * as mocks from "./mocks"
|
|
2
2
|
export * as structures from "./structures"
|
|
3
3
|
export { generator } from "./structures"
|
|
4
|
+
export * as testEnv from "./testEnv"
|
|
4
5
|
export * as testContainerUtils from "./testContainerUtils"
|
|
5
6
|
|
|
6
7
|
export * from "./jestUtils"
|
|
8
|
+
|
|
9
|
+
export { default as DBTestConfiguration } from "./DBTestConfiguration"
|