@budibase/backend-core 2.5.8 → 2.5.10-alpha.0
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 +13 -10
- package/dist/src/configs/configs.d.ts +2 -1
- package/dist/src/configs/configs.js +9 -1
- package/dist/src/configs/configs.js.map +1 -1
- package/dist/src/constants/db.d.ts +1 -0
- package/dist/src/constants/db.js +1 -0
- package/dist/src/constants/db.js.map +1 -1
- package/dist/src/constants/misc.d.ts +4 -2
- package/dist/src/constants/misc.js +2 -0
- package/dist/src/constants/misc.js.map +1 -1
- package/dist/src/context/mainContext.d.ts +5 -2
- package/dist/src/context/mainContext.js +20 -3
- package/dist/src/context/mainContext.js.map +1 -1
- package/dist/src/context/types.d.ts +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 +2 -1
- package/dist/src/db/index.js +15 -2
- package/dist/src/db/index.js.map +1 -1
- package/dist/src/db/lucene.d.ts +8 -14
- package/dist/src/db/lucene.js +164 -97
- package/dist/src/db/lucene.js.map +1 -1
- package/dist/src/db/searchIndexes/index.d.ts +1 -0
- package/dist/src/db/searchIndexes/index.js +18 -0
- package/dist/src/db/searchIndexes/index.js.map +1 -0
- package/dist/src/db/searchIndexes/searchIndexes.d.ts +1 -0
- package/dist/src/db/searchIndexes/searchIndexes.js +77 -0
- package/dist/src/db/searchIndexes/searchIndexes.js.map +1 -0
- package/dist/src/db/utils.d.ts +5 -126
- package/dist/src/db/utils.js +20 -232
- package/dist/src/db/utils.js.map +1 -1
- package/dist/src/db/views.d.ts +3 -1
- package/dist/src/db/views.js +61 -30
- package/dist/src/db/views.js.map +1 -1
- package/dist/src/docIds/conversions.js.map +1 -0
- package/dist/src/docIds/ids.d.ts +53 -0
- package/dist/src/docIds/ids.js +101 -0
- package/dist/src/docIds/ids.js.map +1 -0
- package/dist/src/docIds/index.d.ts +2 -0
- package/dist/src/docIds/index.js +19 -0
- package/dist/src/docIds/index.js.map +1 -0
- package/dist/src/docIds/newid.js.map +1 -0
- package/dist/src/docIds/params.d.ts +69 -0
- package/dist/src/docIds/params.js +138 -0
- package/dist/src/docIds/params.js.map +1 -0
- package/dist/src/docUpdates/index.d.ts +2 -0
- package/dist/src/docUpdates/index.js +36 -0
- package/dist/src/docUpdates/index.js.map +1 -0
- package/dist/src/environment.d.ts +4 -2
- package/dist/src/environment.js +35 -2
- package/dist/src/environment.js.map +1 -1
- package/dist/src/errors/errors.d.ts +3 -0
- package/dist/src/errors/errors.js +8 -1
- package/dist/src/errors/errors.js.map +1 -1
- package/dist/src/events/asyncEvents/index.d.ts +2 -0
- package/dist/src/events/asyncEvents/index.js +19 -0
- package/dist/src/events/asyncEvents/index.js.map +1 -0
- package/dist/src/events/asyncEvents/publisher.d.ts +2 -0
- package/dist/src/events/asyncEvents/publisher.js +27 -0
- package/dist/src/events/asyncEvents/publisher.js.map +1 -0
- package/dist/src/events/asyncEvents/queue.d.ts +11 -0
- package/dist/src/events/asyncEvents/queue.js +26 -0
- package/dist/src/events/asyncEvents/queue.js.map +1 -0
- package/dist/src/events/documentId.d.ts +2 -0
- package/dist/src/events/documentId.js +28 -0
- package/dist/src/events/documentId.js.map +1 -0
- package/dist/src/events/events.js +9 -0
- package/dist/src/events/events.js.map +1 -1
- package/dist/src/events/identification.d.ts +1 -0
- package/dist/src/events/identification.js +3 -2
- package/dist/src/events/identification.js.map +1 -1
- package/dist/src/events/index.d.ts +1 -0
- package/dist/src/events/index.js +3 -1
- package/dist/src/events/index.js.map +1 -1
- package/dist/src/events/processors/LoggingProcessor.js +3 -17
- package/dist/src/events/processors/LoggingProcessor.js.map +1 -1
- package/dist/src/events/processors/Processors.js +9 -3
- package/dist/src/events/processors/Processors.js.map +1 -1
- package/dist/src/events/processors/async/DocumentUpdateProcessor.d.ts +13 -0
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js +44 -0
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +1 -0
- package/dist/src/events/processors/posthog/PosthogProcessor.js +1 -2
- package/dist/src/events/processors/posthog/PosthogProcessor.js.map +1 -1
- package/dist/src/events/processors/types.d.ts +1 -11
- package/dist/src/events/processors/types.js +0 -6
- package/dist/src/events/processors/types.js.map +1 -1
- package/dist/src/events/publishers/group.js +6 -0
- package/dist/src/events/publishers/group.js.map +1 -1
- package/dist/src/events/publishers/license.d.ts +9 -4
- package/dist/src/events/publishers/license.js +2 -17
- package/dist/src/events/publishers/license.js.map +1 -1
- package/dist/src/events/publishers/user.js +4 -0
- package/dist/src/events/publishers/user.js.map +1 -1
- package/dist/src/index.d.ts +6 -2
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/installation.d.ts +1 -0
- package/dist/src/installation.js +7 -6
- package/dist/src/installation.js.map +1 -1
- package/dist/src/{logging.d.ts → logging/alerts.d.ts} +0 -5
- package/dist/src/logging/alerts.js +24 -0
- package/dist/src/logging/alerts.js.map +1 -0
- package/dist/src/logging/correlation/correlation.d.ts +2 -0
- package/dist/src/logging/correlation/correlation.js +17 -0
- package/dist/src/logging/correlation/correlation.js.map +1 -0
- package/dist/src/logging/correlation/index.d.ts +1 -0
- package/dist/src/logging/correlation/index.js +18 -0
- package/dist/src/logging/correlation/index.js.map +1 -0
- package/dist/src/logging/correlation/middleware.d.ts +2 -0
- package/dist/src/logging/correlation/middleware.js +17 -0
- package/dist/src/logging/correlation/middleware.js.map +1 -0
- package/dist/src/logging/index.d.ts +4 -0
- package/dist/src/logging/index.js +36 -0
- package/dist/src/logging/index.js.map +1 -0
- package/dist/src/logging/pino/logger.d.ts +2 -0
- package/dist/src/logging/pino/logger.js +167 -0
- package/dist/src/logging/pino/logger.js.map +1 -0
- package/dist/src/logging/pino/middleware.d.ts +4 -0
- package/dist/src/logging/pino/middleware.js +47 -0
- package/dist/src/logging/pino/middleware.js.map +1 -0
- package/dist/src/middleware/authenticated.js +6 -3
- package/dist/src/middleware/authenticated.js.map +1 -1
- package/dist/src/middleware/errorHandling.js +5 -7
- package/dist/src/middleware/errorHandling.js.map +1 -1
- package/dist/src/middleware/index.d.ts +2 -1
- package/dist/src/middleware/index.js +5 -3
- package/dist/src/middleware/index.js.map +1 -1
- package/dist/src/middleware/passport/sso/oidc.js +2 -5
- package/dist/src/middleware/passport/sso/oidc.js.map +1 -1
- package/dist/src/middleware/tenancy.d.ts +1 -1
- package/dist/src/migrations/migrations.js +4 -4
- package/dist/src/migrations/migrations.js.map +1 -1
- package/dist/src/objectStore/objectStore.js +3 -3
- package/dist/src/objectStore/objectStore.js.map +1 -1
- package/dist/src/plugin/utils.js +53 -2
- package/dist/src/plugin/utils.js.map +1 -1
- package/dist/src/queue/constants.d.ts +2 -1
- package/dist/src/queue/constants.js +1 -0
- package/dist/src/queue/constants.js.map +1 -1
- package/dist/src/redis/redlockImpl.js +4 -1
- package/dist/src/redis/redlockImpl.js.map +1 -1
- package/dist/src/security/encryption.d.ts +1 -0
- package/dist/src/security/encryption.js +2 -1
- package/dist/src/security/encryption.js.map +1 -1
- package/dist/src/security/permissions.d.ts +35 -2
- package/dist/src/security/permissions.js +9 -6
- package/dist/src/security/permissions.js.map +1 -1
- package/dist/src/tenancy/tenancy.js +1 -5
- package/dist/src/tenancy/tenancy.js.map +1 -1
- package/dist/src/users.d.ts +11 -1
- package/dist/src/users.js +45 -1
- 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 +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/stringUtils.d.ts +1 -0
- package/dist/src/utils/stringUtils.js +9 -0
- package/dist/src/utils/stringUtils.js.map +1 -0
- package/dist/src/utils/utils.d.ts +0 -1
- package/dist/src/utils/utils.js +1 -24
- package/dist/src/utils/utils.js.map +1 -1
- package/dist/tests/core/logging.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/index.d.ts +1 -2
- package/dist/tests/{utilities → core/utilities}/index.js +2 -7
- package/dist/tests/core/utilities/index.js.map +1 -0
- package/dist/tests/core/utilities/jestUtils.js.map +1 -0
- package/dist/tests/core/utilities/mocks/alerts.d.ts +3 -0
- package/dist/tests/core/utilities/mocks/alerts.js +30 -0
- package/dist/tests/core/utilities/mocks/alerts.js.map +1 -0
- package/dist/tests/core/utilities/mocks/date.js.map +1 -0
- package/dist/tests/core/utilities/mocks/events.js +144 -0
- package/dist/tests/core/utilities/mocks/events.js.map +1 -0
- package/dist/tests/core/utilities/mocks/fetch.d.ts +33 -0
- package/dist/tests/core/utilities/mocks/fetch.js +15 -0
- package/dist/tests/core/utilities/mocks/fetch.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/mocks/index.d.ts +4 -3
- package/dist/tests/{utilities → core/utilities}/mocks/index.js +7 -3
- package/dist/tests/core/utilities/mocks/index.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/mocks/licenses.d.ts +1 -0
- package/dist/tests/{utilities → core/utilities}/mocks/licenses.js +5 -1
- package/dist/tests/core/utilities/mocks/licenses.js.map +1 -0
- package/dist/tests/core/utilities/mocks/posthog.js.map +1 -0
- package/dist/tests/core/utilities/structures/Chance.d.ts +7 -0
- package/dist/tests/core/utilities/structures/Chance.js +21 -0
- package/dist/tests/core/utilities/structures/Chance.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/structures/accounts.js +3 -25
- package/dist/tests/core/utilities/structures/accounts.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/structures/apps.js +1 -1
- package/dist/tests/core/utilities/structures/apps.js.map +1 -0
- package/dist/tests/core/utilities/structures/common.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/structures/db.js +1 -1
- package/dist/tests/core/utilities/structures/db.js.map +1 -0
- package/dist/tests/core/utilities/structures/generator.d.ts +2 -0
- package/dist/tests/{utilities → core/utilities}/structures/generator.js +2 -2
- package/dist/tests/core/utilities/structures/generator.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/structures/index.d.ts +2 -0
- package/dist/tests/{utilities → core/utilities}/structures/index.js +3 -1
- package/dist/tests/core/utilities/structures/index.js.map +1 -0
- package/dist/tests/core/utilities/structures/koa.js.map +1 -0
- package/dist/tests/core/utilities/structures/licenses.d.ts +17 -0
- package/dist/tests/core/utilities/structures/licenses.js +127 -0
- package/dist/tests/core/utilities/structures/licenses.js.map +1 -0
- package/dist/tests/core/utilities/structures/plugins.js.map +1 -0
- package/dist/tests/core/utilities/structures/quotas.d.ts +2 -0
- package/dist/tests/core/utilities/structures/quotas.js +71 -0
- package/dist/tests/core/utilities/structures/quotas.js.map +1 -0
- package/dist/tests/core/utilities/structures/scim.d.ts +14 -0
- package/dist/tests/core/utilities/structures/scim.js +67 -0
- package/dist/tests/core/utilities/structures/scim.js.map +1 -0
- package/dist/tests/core/utilities/structures/shared.js.map +1 -0
- package/dist/tests/core/utilities/structures/sso.js.map +1 -0
- package/dist/tests/{utilities → core/utilities}/structures/tenants.js +1 -1
- package/dist/tests/core/utilities/structures/tenants.js.map +1 -0
- package/dist/tests/core/utilities/structures/userGroups.js.map +1 -0
- package/dist/tests/core/utilities/structures/users.js.map +1 -0
- package/dist/tests/core/utilities/testContainerUtils.js.map +1 -0
- package/dist/tests/core/utilities/utils/index.d.ts +1 -0
- package/dist/tests/core/utilities/utils/index.js +28 -0
- package/dist/tests/core/utilities/utils/index.js.map +1 -0
- package/dist/tests/core/utilities/utils/time.d.ts +1 -0
- package/dist/tests/core/utilities/utils/time.js +8 -0
- package/dist/tests/core/utilities/utils/time.js.map +1 -0
- package/dist/tests/{utilities → extra}/DBTestConfiguration.d.ts +1 -1
- package/dist/tests/{utilities → extra}/DBTestConfiguration.js +2 -2
- package/dist/tests/extra/DBTestConfiguration.js.map +1 -0
- package/dist/tests/extra/index.d.ts +2 -0
- package/dist/tests/extra/index.js +33 -0
- package/dist/tests/extra/index.js.map +1 -0
- package/dist/tests/{utilities → extra}/testEnv.d.ts +1 -1
- package/dist/tests/{utilities → extra}/testEnv.js +1 -1
- package/dist/tests/extra/testEnv.js.map +1 -0
- 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 +0 -1
- 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/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/src/auth/tests/auth.spec.ts +2 -1
- package/src/cache/tests/writethrough.spec.ts +4 -3
- package/src/configs/configs.ts +9 -0
- package/src/configs/tests/configs.spec.ts +2 -6
- package/src/constants/db.ts +1 -0
- package/src/constants/misc.ts +2 -0
- package/src/context/mainContext.ts +22 -5
- package/src/context/tests/index.spec.ts +16 -3
- package/src/context/types.ts +1 -0
- package/src/db/couch/DatabaseImpl.ts +1 -1
- package/src/db/index.ts +2 -1
- package/src/db/lucene.ts +156 -99
- package/src/db/searchIndexes/index.ts +1 -0
- package/src/db/searchIndexes/searchIndexes.ts +62 -0
- package/src/db/tests/lucene.spec.ts +101 -1
- package/src/db/tests/utils.spec.ts +1 -1
- package/src/db/utils.ts +7 -275
- package/src/db/views.ts +64 -25
- package/src/docIds/ids.ts +102 -0
- package/src/docIds/index.ts +2 -0
- package/src/docIds/params.ts +174 -0
- package/src/docUpdates/index.ts +29 -0
- package/src/environment.ts +44 -2
- package/src/errors/errors.ts +8 -0
- package/src/events/asyncEvents/index.ts +2 -0
- package/src/events/asyncEvents/publisher.ts +12 -0
- package/src/events/asyncEvents/queue.ts +22 -0
- package/src/events/documentId.ts +56 -0
- package/src/events/events.ts +10 -1
- package/src/events/identification.ts +3 -3
- package/src/events/index.ts +2 -0
- package/src/events/processors/LoggingProcessor.ts +3 -22
- package/src/events/processors/Processors.ts +9 -3
- package/src/events/processors/async/DocumentUpdateProcessor.ts +43 -0
- package/src/events/processors/posthog/PosthogProcessor.ts +1 -2
- package/src/events/processors/posthog/tests/PosthogProcessor.spec.ts +1 -1
- package/src/events/processors/types.ts +1 -18
- package/src/events/publishers/group.ts +6 -1
- package/src/events/publishers/license.ts +12 -13
- package/src/events/publishers/user.ts +4 -0
- package/src/index.ts +1 -0
- package/src/installation.ts +4 -5
- package/src/logging/alerts.ts +26 -0
- package/src/logging/correlation/correlation.ts +13 -0
- package/src/logging/correlation/index.ts +1 -0
- package/src/logging/correlation/middleware.ts +17 -0
- package/src/logging/index.ts +6 -0
- package/src/logging/pino/logger.ts +173 -0
- package/src/logging/pino/middleware.ts +45 -0
- package/src/middleware/authenticated.ts +9 -3
- package/src/middleware/errorHandling.ts +4 -4
- package/src/middleware/index.ts +2 -1
- package/src/middleware/passport/sso/oidc.ts +2 -9
- package/src/middleware/passport/sso/tests/sso.spec.ts +2 -1
- package/src/migrations/migrations.ts +4 -8
- 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 +2 -1
- package/src/objectStore/objectStore.ts +3 -3
- package/src/platform/tests/tenants.spec.ts +2 -1
- package/src/plugin/tests/validation.spec.ts +83 -0
- package/src/plugin/utils.ts +63 -3
- package/src/queue/constants.ts +1 -0
- package/src/redis/redlockImpl.ts +9 -3
- package/src/security/encryption.ts +1 -1
- package/src/security/permissions.ts +5 -5
- package/src/security/tests/encryption.spec.ts +31 -0
- package/src/security/tests/permissions.spec.ts +145 -0
- package/src/tenancy/tenancy.ts +2 -2
- package/src/tenancy/tests/tenancy.spec.ts +184 -0
- package/src/users.ts +56 -7
- package/src/utils/hashing.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/stringUtils.ts +8 -0
- package/src/utils/tests/utils.spec.ts +2 -1
- package/src/utils/utils.ts +3 -23
- package/tests/{utilities → core/utilities}/index.ts +1 -4
- package/tests/core/utilities/mocks/alerts.ts +3 -0
- package/tests/core/utilities/mocks/events.ts +133 -0
- package/tests/core/utilities/mocks/fetch.ts +17 -0
- package/tests/{utilities → core/utilities}/mocks/index.ts +4 -3
- package/tests/{utilities → core/utilities}/mocks/licenses.ts +4 -0
- package/tests/core/utilities/structures/Chance.ts +20 -0
- package/tests/{utilities → core/utilities}/structures/accounts.ts +4 -3
- package/tests/{utilities → core/utilities}/structures/apps.ts +1 -1
- package/tests/{utilities → core/utilities}/structures/db.ts +1 -1
- package/tests/{utilities → core/utilities}/structures/generator.ts +1 -1
- package/tests/{utilities → core/utilities}/structures/index.ts +2 -0
- package/tests/core/utilities/structures/licenses.ts +145 -0
- package/tests/core/utilities/structures/quotas.ts +67 -0
- package/tests/core/utilities/structures/scim.ts +81 -0
- package/tests/{utilities → core/utilities}/structures/tenants.ts +1 -1
- package/tests/core/utilities/utils/index.ts +1 -0
- package/tests/core/utilities/utils/time.ts +3 -0
- package/tests/{utilities → extra}/DBTestConfiguration.ts +2 -2
- package/tests/extra/index.ts +2 -0
- package/tests/{utilities → extra}/testEnv.ts +1 -1
- package/tests/index.ts +1 -1
- package/tests/jestEnv.ts +0 -1
- package/tests/jestSetup.ts +2 -2
- package/tsconfig.build.json +3 -7
- package/dist/src/db/conversions.js.map +0 -1
- package/dist/src/logging.js +0 -56
- package/dist/src/logging.js.map +0 -1
- package/dist/src/middleware/logging.d.ts +0 -2
- package/dist/src/middleware/logging.js +0 -106
- package/dist/src/middleware/logging.js.map +0 -1
- package/dist/src/newid.js.map +0 -1
- package/dist/tests/logging.js.map +0 -1
- package/dist/tests/utilities/DBTestConfiguration.js.map +0 -1
- package/dist/tests/utilities/index.js.map +0 -1
- package/dist/tests/utilities/jestUtils.js.map +0 -1
- package/dist/tests/utilities/mocks/date.js.map +0 -1
- package/dist/tests/utilities/mocks/events.js +0 -126
- package/dist/tests/utilities/mocks/events.js.map +0 -1
- package/dist/tests/utilities/mocks/fetch.d.ts +0 -31
- package/dist/tests/utilities/mocks/fetch.js +0 -8
- package/dist/tests/utilities/mocks/fetch.js.map +0 -1
- package/dist/tests/utilities/mocks/index.js.map +0 -1
- package/dist/tests/utilities/mocks/licenses.js.map +0 -1
- package/dist/tests/utilities/mocks/posthog.js.map +0 -1
- package/dist/tests/utilities/structures/accounts.js.map +0 -1
- package/dist/tests/utilities/structures/apps.js.map +0 -1
- package/dist/tests/utilities/structures/common.js.map +0 -1
- package/dist/tests/utilities/structures/db.js.map +0 -1
- package/dist/tests/utilities/structures/generator.d.ts +0 -1
- package/dist/tests/utilities/structures/generator.js.map +0 -1
- package/dist/tests/utilities/structures/index.js.map +0 -1
- package/dist/tests/utilities/structures/koa.js.map +0 -1
- package/dist/tests/utilities/structures/licenses.d.ts +0 -5
- package/dist/tests/utilities/structures/licenses.js +0 -18
- package/dist/tests/utilities/structures/licenses.js.map +0 -1
- package/dist/tests/utilities/structures/plugins.js.map +0 -1
- package/dist/tests/utilities/structures/shared.js.map +0 -1
- package/dist/tests/utilities/structures/sso.js.map +0 -1
- package/dist/tests/utilities/structures/tenants.js.map +0 -1
- package/dist/tests/utilities/structures/userGroups.js.map +0 -1
- package/dist/tests/utilities/structures/users.js.map +0 -1
- package/dist/tests/utilities/testContainerUtils.js.map +0 -1
- package/dist/tests/utilities/testEnv.js.map +0 -1
- package/src/logging.ts +0 -60
- package/src/middleware/logging.ts +0 -90
- package/tests/utilities/mocks/events.ts +0 -122
- package/tests/utilities/mocks/fetch.ts +0 -10
- package/tests/utilities/structures/licenses.ts +0 -18
- /package/dist/src/{db → docIds}/conversions.d.ts +0 -0
- /package/dist/src/{db → docIds}/conversions.js +0 -0
- /package/dist/src/{newid.d.ts → docIds/newid.d.ts} +0 -0
- /package/dist/src/{newid.js → docIds/newid.js} +0 -0
- /package/dist/tests/{logging.d.ts → core/logging.d.ts} +0 -0
- /package/dist/tests/{logging.js → core/logging.js} +0 -0
- /package/dist/tests/{utilities → core/utilities}/jestUtils.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/jestUtils.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/mocks/date.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/mocks/date.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/mocks/events.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/mocks/posthog.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/mocks/posthog.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/accounts.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/apps.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/common.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/common.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/db.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/koa.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/koa.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/plugins.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/plugins.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/shared.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/shared.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/sso.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/sso.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/tenants.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/userGroups.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/userGroups.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/users.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/structures/users.js +0 -0
- /package/dist/tests/{utilities → core/utilities}/testContainerUtils.d.ts +0 -0
- /package/dist/tests/{utilities → core/utilities}/testContainerUtils.js +0 -0
- /package/src/{db → docIds}/conversions.ts +0 -0
- /package/src/{newid.ts → docIds/newid.ts} +0 -0
- /package/tests/{logging.ts → core/logging.ts} +0 -0
- /package/tests/{utilities → core/utilities}/jestUtils.ts +0 -0
- /package/tests/{utilities → core/utilities}/mocks/date.ts +0 -0
- /package/tests/{utilities → core/utilities}/mocks/posthog.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/common.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/koa.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/plugins.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/shared.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/sso.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/userGroups.ts +0 -0
- /package/tests/{utilities → core/utilities}/structures/users.ts +0 -0
- /package/tests/{utilities → core/utilities}/testContainerUtils.ts +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
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.createUserIndex = void 0;
|
|
13
|
+
const types_1 = require("@budibase/types");
|
|
14
|
+
const context_1 = require("../../context");
|
|
15
|
+
function createUserIndex() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const db = (0, context_1.getGlobalDB)();
|
|
18
|
+
let designDoc;
|
|
19
|
+
try {
|
|
20
|
+
designDoc = yield db.get("_design/database");
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
if (err.status === 404) {
|
|
24
|
+
designDoc = { _id: "_design/database" };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const fn = function (user) {
|
|
28
|
+
if (user._id && !user._id.startsWith("us_")) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const ignoredFields = [
|
|
32
|
+
"_id",
|
|
33
|
+
"_rev",
|
|
34
|
+
"password",
|
|
35
|
+
"account",
|
|
36
|
+
"license",
|
|
37
|
+
"budibaseAccess",
|
|
38
|
+
"accountPortalAccess",
|
|
39
|
+
"csrfToken",
|
|
40
|
+
];
|
|
41
|
+
function idx(input, prev) {
|
|
42
|
+
for (let key of Object.keys(input)) {
|
|
43
|
+
if (ignoredFields.includes(key)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
let idxKey = prev != null ? `${prev}.${key}` : key;
|
|
47
|
+
if (typeof input[key] === "string") {
|
|
48
|
+
// eslint-disable-next-line no-undef
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
index(idxKey, input[key].toLowerCase(), { facet: true });
|
|
51
|
+
}
|
|
52
|
+
else if (typeof input[key] !== "object") {
|
|
53
|
+
// eslint-disable-next-line no-undef
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
index(idxKey, input[key], { facet: true });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
idx(input[key], idxKey);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
idx(user);
|
|
63
|
+
};
|
|
64
|
+
designDoc.indexes = {
|
|
65
|
+
[types_1.SearchIndex.USER]: {
|
|
66
|
+
index: fn.toString(),
|
|
67
|
+
analyzer: {
|
|
68
|
+
default: "keyword",
|
|
69
|
+
name: "perfield",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
yield db.put(designDoc);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
exports.createUserIndex = createUserIndex;
|
|
77
|
+
//# sourceMappingURL=searchIndexes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchIndexes.js","sourceRoot":"","sources":["../../../../src/db/searchIndexes/searchIndexes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmD;AACnD,2CAA2C;AAE3C,SAAsB,eAAe;;QACnC,MAAM,EAAE,GAAG,IAAA,qBAAW,GAAE,CAAA;QACxB,IAAI,SAAS,CAAA;QACb,IAAI;YACF,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;SAC7C;QAAC,OAAO,GAAQ,EAAE;YACjB,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACtB,SAAS,GAAG,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAA;aACxC;SACF;QAED,MAAM,EAAE,GAAG,UAAU,IAAU;YAC7B,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBAC3C,OAAM;aACP;YACD,MAAM,aAAa,GAAG;gBACpB,KAAK;gBACL,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,SAAS;gBACT,gBAAgB;gBAChB,qBAAqB;gBACrB,WAAW;aACZ,CAAA;YAED,SAAS,GAAG,CAAC,KAA0B,EAAE,IAAa;gBACpD,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;oBAClC,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;wBAC/B,SAAQ;qBACT;oBACD,IAAI,MAAM,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;oBAClD,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;wBAClC,oCAAoC;wBACpC,aAAa;wBACb,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;qBACzD;yBAAM,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;wBACzC,oCAAoC;wBACpC,aAAa;wBACb,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;qBAC3C;yBAAM;wBACL,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;qBACxB;iBACF;YACH,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,CAAA;QACX,CAAC,CAAA;QAED,SAAS,CAAC,OAAO,GAAG;YAClB,CAAC,mBAAW,CAAC,IAAI,CAAC,EAAE;gBAClB,KAAK,EAAE,EAAE,CAAC,QAAQ,EAAE;gBACpB,QAAQ,EAAE;oBACR,OAAO,EAAE,SAAS;oBAClB,IAAI,EAAE,UAAU;iBACjB;aACF;SACF,CAAA;QACD,MAAM,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;CAAA;AA1DD,0CA0DC"}
|
package/dist/src/db/utils.d.ts
CHANGED
|
@@ -1,112 +1,5 @@
|
|
|
1
|
-
import { ViewName } from "../constants";
|
|
2
1
|
import { App } from "@budibase/types";
|
|
3
|
-
|
|
4
|
-
* Generates a new app ID.
|
|
5
|
-
* @returns {string} The new app ID which the app doc can be stored under.
|
|
6
|
-
*/
|
|
7
|
-
export declare const generateAppID: (tenantId?: string | null) => string;
|
|
8
|
-
/**
|
|
9
|
-
* If creating DB allDocs/query params with only a single top level ID this can be used, this
|
|
10
|
-
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
11
|
-
* More complex cases such as link docs and rows which have multiple levels of IDs that their
|
|
12
|
-
* ID consists of need their own functions to build the allDocs parameters.
|
|
13
|
-
* @param {string} docType The type of document which input params are being built for, e.g. user,
|
|
14
|
-
* link, app, table and so on.
|
|
15
|
-
* @param {string|null} docId The ID of the document minus its type - this is only needed if looking
|
|
16
|
-
* for a singular document.
|
|
17
|
-
* @param {object} otherProps Add any other properties onto the request, e.g. include_docs.
|
|
18
|
-
* @returns {object} Parameters which can then be used with an allDocs request.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getDocParams(docType: string, docId?: string | null, otherProps?: any): any;
|
|
21
|
-
/**
|
|
22
|
-
* Gets the DB allDocs/query params for retrieving a row.
|
|
23
|
-
* @param {string|null} tableId The table in which the rows have been stored.
|
|
24
|
-
* @param {string|null} rowId The ID of the row which is being specifically queried for. This can be
|
|
25
|
-
* left null to get all the rows in the table.
|
|
26
|
-
* @param {object} otherProps Any other properties to add to the request.
|
|
27
|
-
* @returns {object} Parameters which can then be used with an allDocs request.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getRowParams(tableId?: string | null, rowId?: string | null, otherProps?: {}): any;
|
|
30
|
-
/**
|
|
31
|
-
* Retrieve the correct index for a view based on default design DB.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getQueryIndex(viewName: ViewName): string;
|
|
34
|
-
/**
|
|
35
|
-
* Gets a new row ID for the specified table.
|
|
36
|
-
* @param {string} tableId The table which the row is being created for.
|
|
37
|
-
* @param {string|null} id If an ID is to be used then the UUID can be substituted for this.
|
|
38
|
-
* @returns {string} The new ID which a row doc can be stored under.
|
|
39
|
-
*/
|
|
40
|
-
export declare function generateRowID(tableId: string, id?: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Check if a given ID is that of a table.
|
|
43
|
-
* @returns {boolean}
|
|
44
|
-
*/
|
|
45
|
-
export declare const isTableId: (id: string) => boolean | "";
|
|
46
|
-
/**
|
|
47
|
-
* Check if a given ID is that of a datasource or datasource plus.
|
|
48
|
-
* @returns {boolean}
|
|
49
|
-
*/
|
|
50
|
-
export declare const isDatasourceId: (id: string) => boolean | "";
|
|
51
|
-
/**
|
|
52
|
-
* Generates a new workspace ID.
|
|
53
|
-
* @returns {string} The new workspace ID which the workspace doc can be stored under.
|
|
54
|
-
*/
|
|
55
|
-
export declare function generateWorkspaceID(): string;
|
|
56
|
-
/**
|
|
57
|
-
* Gets parameters for retrieving workspaces.
|
|
58
|
-
*/
|
|
59
|
-
export declare function getWorkspaceParams(id?: string, otherProps?: {}): {
|
|
60
|
-
startkey: string;
|
|
61
|
-
endkey: string;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Generates a new global user ID.
|
|
65
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
66
|
-
*/
|
|
67
|
-
export declare function generateGlobalUserID(id?: any): string;
|
|
68
|
-
/**
|
|
69
|
-
* Gets parameters for retrieving users.
|
|
70
|
-
*/
|
|
71
|
-
export declare function getGlobalUserParams(globalId: any, otherProps?: any): any;
|
|
72
|
-
/**
|
|
73
|
-
* Gets parameters for retrieving users, this is a utility function for the getDocParams function.
|
|
74
|
-
*/
|
|
75
|
-
export declare function getUserMetadataParams(userId?: string | null, otherProps?: {}): any;
|
|
76
|
-
/**
|
|
77
|
-
* Generates a new user ID based on the passed in global ID.
|
|
78
|
-
* @param {string} globalId The ID of the global user.
|
|
79
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
80
|
-
*/
|
|
81
|
-
export declare function generateUserMetadataID(globalId: string): string;
|
|
82
|
-
/**
|
|
83
|
-
* Breaks up the ID to get the global ID.
|
|
84
|
-
*/
|
|
85
|
-
export declare function getGlobalIDFromUserMetadataID(id: string): string;
|
|
86
|
-
export declare function getUsersByAppParams(appId: any, otherProps?: any): any;
|
|
87
|
-
/**
|
|
88
|
-
* Generates a template ID.
|
|
89
|
-
* @param ownerId The owner/user of the template, this could be global or a workspace level.
|
|
90
|
-
*/
|
|
91
|
-
export declare function generateTemplateID(ownerId: any): string;
|
|
92
|
-
export declare function generateAppUserID(prodAppId: string, userId: string): string;
|
|
93
|
-
/**
|
|
94
|
-
* Gets parameters for retrieving templates. Owner ID must be specified, either global or a workspace level.
|
|
95
|
-
*/
|
|
96
|
-
export declare function getTemplateParams(ownerId: any, templateId: any, otherProps?: {}): {
|
|
97
|
-
startkey: any;
|
|
98
|
-
endkey: string;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Generates a new role ID.
|
|
102
|
-
* @returns {string} The new role ID which the role doc can be stored under.
|
|
103
|
-
*/
|
|
104
|
-
export declare function generateRoleID(id?: any): string;
|
|
105
|
-
/**
|
|
106
|
-
* Gets parameters for retrieving a role, this is a utility function for the getDocParams function.
|
|
107
|
-
*/
|
|
108
|
-
export declare function getRoleParams(roleId?: string | null, otherProps?: {}): any;
|
|
109
|
-
export declare function getStartEndKeyURL(baseKey: any, tenantId?: string): string;
|
|
2
|
+
export * from "../docIds";
|
|
110
3
|
/**
|
|
111
4
|
* if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing
|
|
112
5
|
* when using Pouch it will use the pouchdb-all-dbs package.
|
|
@@ -134,30 +27,16 @@ export declare function getProdAppIDs(): Promise<string[]>;
|
|
|
134
27
|
export declare function getDevAppIDs(): Promise<string[]>;
|
|
135
28
|
export declare function isSameAppID(appId1: string | undefined, appId2: string | undefined): boolean;
|
|
136
29
|
export declare function dbExists(dbName: any): Promise<any>;
|
|
137
|
-
|
|
138
|
-
* Generates a new dev info document ID - this is scoped to a user.
|
|
139
|
-
* @returns {string} The new dev info ID which info for dev (like api key) can be stored under.
|
|
140
|
-
*/
|
|
141
|
-
export declare const generateDevInfoID: (userId: any) => string;
|
|
142
|
-
/**
|
|
143
|
-
* Generates a new plugin ID - to be used in the global DB.
|
|
144
|
-
* @returns {string} The new plugin ID which a plugin metadata document can be stored under.
|
|
145
|
-
*/
|
|
146
|
-
export declare const generatePluginID: (name: string) => string;
|
|
147
|
-
/**
|
|
148
|
-
* Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
|
|
149
|
-
*/
|
|
150
|
-
export declare const getPluginParams: (pluginId?: string | null, otherProps?: {}) => any;
|
|
151
|
-
export declare function pagination(data: any[], pageSize: number, { paginate, property, getKey, }?: {
|
|
30
|
+
export declare function pagination<T>(data: T[], pageSize: number, { paginate, property, getKey, }?: {
|
|
152
31
|
paginate: boolean;
|
|
153
32
|
property: string;
|
|
154
|
-
getKey?: (doc:
|
|
33
|
+
getKey?: (doc: T) => string | undefined;
|
|
155
34
|
}): {
|
|
156
|
-
data:
|
|
35
|
+
data: T[];
|
|
157
36
|
hasNextPage: boolean;
|
|
158
37
|
nextPage?: undefined;
|
|
159
38
|
} | {
|
|
160
|
-
data:
|
|
39
|
+
data: T[];
|
|
161
40
|
hasNextPage: boolean;
|
|
162
41
|
nextPage: string | undefined;
|
|
163
42
|
};
|
package/dist/src/db/utils.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
18
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,218 +26,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
27
|
};
|
|
14
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.pagination = exports.
|
|
16
|
-
const newid_1 = require("../newid");
|
|
29
|
+
exports.pagination = exports.dbExists = exports.isSameAppID = exports.getDevAppIDs = exports.getProdAppIDs = exports.getAppsByIDs = exports.getAllApps = exports.getAllDbs = void 0;
|
|
17
30
|
const environment_1 = __importDefault(require("../environment"));
|
|
18
31
|
const constants_1 = require("../constants");
|
|
19
32
|
const context_1 = require("../context");
|
|
20
33
|
const db_1 = require("./db");
|
|
21
34
|
const appMetadata_1 = require("../cache/appMetadata");
|
|
22
|
-
const conversions_1 = require("
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @returns {string} The new app ID which the app doc can be stored under.
|
|
26
|
-
*/
|
|
27
|
-
const generateAppID = (tenantId) => {
|
|
28
|
-
let id = constants_1.APP_PREFIX;
|
|
29
|
-
if (tenantId) {
|
|
30
|
-
id += `${tenantId}${constants_1.SEPARATOR}`;
|
|
31
|
-
}
|
|
32
|
-
return `${id}${(0, newid_1.newid)()}`;
|
|
33
|
-
};
|
|
34
|
-
exports.generateAppID = generateAppID;
|
|
35
|
-
/**
|
|
36
|
-
* If creating DB allDocs/query params with only a single top level ID this can be used, this
|
|
37
|
-
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
38
|
-
* More complex cases such as link docs and rows which have multiple levels of IDs that their
|
|
39
|
-
* ID consists of need their own functions to build the allDocs parameters.
|
|
40
|
-
* @param {string} docType The type of document which input params are being built for, e.g. user,
|
|
41
|
-
* link, app, table and so on.
|
|
42
|
-
* @param {string|null} docId The ID of the document minus its type - this is only needed if looking
|
|
43
|
-
* for a singular document.
|
|
44
|
-
* @param {object} otherProps Add any other properties onto the request, e.g. include_docs.
|
|
45
|
-
* @returns {object} Parameters which can then be used with an allDocs request.
|
|
46
|
-
*/
|
|
47
|
-
function getDocParams(docType, docId, otherProps = {}) {
|
|
48
|
-
if (docId == null) {
|
|
49
|
-
docId = "";
|
|
50
|
-
}
|
|
51
|
-
return Object.assign(Object.assign({}, otherProps), { startkey: `${docType}${constants_1.SEPARATOR}${docId}`, endkey: `${docType}${constants_1.SEPARATOR}${docId}${constants_1.UNICODE_MAX}` });
|
|
52
|
-
}
|
|
53
|
-
exports.getDocParams = getDocParams;
|
|
54
|
-
/**
|
|
55
|
-
* Gets the DB allDocs/query params for retrieving a row.
|
|
56
|
-
* @param {string|null} tableId The table in which the rows have been stored.
|
|
57
|
-
* @param {string|null} rowId The ID of the row which is being specifically queried for. This can be
|
|
58
|
-
* left null to get all the rows in the table.
|
|
59
|
-
* @param {object} otherProps Any other properties to add to the request.
|
|
60
|
-
* @returns {object} Parameters which can then be used with an allDocs request.
|
|
61
|
-
*/
|
|
62
|
-
function getRowParams(tableId, rowId, otherProps = {}) {
|
|
63
|
-
if (tableId == null) {
|
|
64
|
-
return getDocParams(constants_1.DocumentType.ROW, null, otherProps);
|
|
65
|
-
}
|
|
66
|
-
const endOfKey = rowId == null ? `${tableId}${constants_1.SEPARATOR}` : rowId;
|
|
67
|
-
return getDocParams(constants_1.DocumentType.ROW, endOfKey, otherProps);
|
|
68
|
-
}
|
|
69
|
-
exports.getRowParams = getRowParams;
|
|
70
|
-
/**
|
|
71
|
-
* Retrieve the correct index for a view based on default design DB.
|
|
72
|
-
*/
|
|
73
|
-
function getQueryIndex(viewName) {
|
|
74
|
-
return `database/${viewName}`;
|
|
75
|
-
}
|
|
76
|
-
exports.getQueryIndex = getQueryIndex;
|
|
77
|
-
/**
|
|
78
|
-
* Gets a new row ID for the specified table.
|
|
79
|
-
* @param {string} tableId The table which the row is being created for.
|
|
80
|
-
* @param {string|null} id If an ID is to be used then the UUID can be substituted for this.
|
|
81
|
-
* @returns {string} The new ID which a row doc can be stored under.
|
|
82
|
-
*/
|
|
83
|
-
function generateRowID(tableId, id) {
|
|
84
|
-
id = id || (0, newid_1.newid)();
|
|
85
|
-
return `${constants_1.DocumentType.ROW}${constants_1.SEPARATOR}${tableId}${constants_1.SEPARATOR}${id}`;
|
|
86
|
-
}
|
|
87
|
-
exports.generateRowID = generateRowID;
|
|
88
|
-
/**
|
|
89
|
-
* Check if a given ID is that of a table.
|
|
90
|
-
* @returns {boolean}
|
|
91
|
-
*/
|
|
92
|
-
const isTableId = (id) => {
|
|
93
|
-
// this includes datasource plus tables
|
|
94
|
-
return (id &&
|
|
95
|
-
(id.startsWith(`${constants_1.DocumentType.TABLE}${constants_1.SEPARATOR}`) ||
|
|
96
|
-
id.startsWith(`${constants_1.DocumentType.DATASOURCE_PLUS}${constants_1.SEPARATOR}`)));
|
|
97
|
-
};
|
|
98
|
-
exports.isTableId = isTableId;
|
|
99
|
-
/**
|
|
100
|
-
* Check if a given ID is that of a datasource or datasource plus.
|
|
101
|
-
* @returns {boolean}
|
|
102
|
-
*/
|
|
103
|
-
const isDatasourceId = (id) => {
|
|
104
|
-
// this covers both datasources and datasource plus
|
|
105
|
-
return id && id.startsWith(`${constants_1.DocumentType.DATASOURCE}${constants_1.SEPARATOR}`);
|
|
106
|
-
};
|
|
107
|
-
exports.isDatasourceId = isDatasourceId;
|
|
108
|
-
/**
|
|
109
|
-
* Generates a new workspace ID.
|
|
110
|
-
* @returns {string} The new workspace ID which the workspace doc can be stored under.
|
|
111
|
-
*/
|
|
112
|
-
function generateWorkspaceID() {
|
|
113
|
-
return `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${(0, newid_1.newid)()}`;
|
|
114
|
-
}
|
|
115
|
-
exports.generateWorkspaceID = generateWorkspaceID;
|
|
116
|
-
/**
|
|
117
|
-
* Gets parameters for retrieving workspaces.
|
|
118
|
-
*/
|
|
119
|
-
function getWorkspaceParams(id = "", otherProps = {}) {
|
|
120
|
-
return Object.assign(Object.assign({}, otherProps), { startkey: `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${id}`, endkey: `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${id}${constants_1.UNICODE_MAX}` });
|
|
121
|
-
}
|
|
122
|
-
exports.getWorkspaceParams = getWorkspaceParams;
|
|
123
|
-
/**
|
|
124
|
-
* Generates a new global user ID.
|
|
125
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
126
|
-
*/
|
|
127
|
-
function generateGlobalUserID(id) {
|
|
128
|
-
return `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${id || (0, newid_1.newid)()}`;
|
|
129
|
-
}
|
|
130
|
-
exports.generateGlobalUserID = generateGlobalUserID;
|
|
131
|
-
/**
|
|
132
|
-
* Gets parameters for retrieving users.
|
|
133
|
-
*/
|
|
134
|
-
function getGlobalUserParams(globalId, otherProps = {}) {
|
|
135
|
-
if (!globalId) {
|
|
136
|
-
globalId = "";
|
|
137
|
-
}
|
|
138
|
-
const startkey = otherProps === null || otherProps === void 0 ? void 0 : otherProps.startkey;
|
|
139
|
-
return Object.assign(Object.assign({}, otherProps), {
|
|
140
|
-
// need to include this incase pagination
|
|
141
|
-
startkey: startkey
|
|
142
|
-
? startkey
|
|
143
|
-
: `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${globalId}`, endkey: `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${globalId}${constants_1.UNICODE_MAX}` });
|
|
144
|
-
}
|
|
145
|
-
exports.getGlobalUserParams = getGlobalUserParams;
|
|
146
|
-
/**
|
|
147
|
-
* Gets parameters for retrieving users, this is a utility function for the getDocParams function.
|
|
148
|
-
*/
|
|
149
|
-
function getUserMetadataParams(userId, otherProps = {}) {
|
|
150
|
-
return getRowParams(constants_1.InternalTable.USER_METADATA, userId, otherProps);
|
|
151
|
-
}
|
|
152
|
-
exports.getUserMetadataParams = getUserMetadataParams;
|
|
153
|
-
/**
|
|
154
|
-
* Generates a new user ID based on the passed in global ID.
|
|
155
|
-
* @param {string} globalId The ID of the global user.
|
|
156
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
157
|
-
*/
|
|
158
|
-
function generateUserMetadataID(globalId) {
|
|
159
|
-
return generateRowID(constants_1.InternalTable.USER_METADATA, globalId);
|
|
160
|
-
}
|
|
161
|
-
exports.generateUserMetadataID = generateUserMetadataID;
|
|
162
|
-
/**
|
|
163
|
-
* Breaks up the ID to get the global ID.
|
|
164
|
-
*/
|
|
165
|
-
function getGlobalIDFromUserMetadataID(id) {
|
|
166
|
-
const prefix = `${constants_1.DocumentType.ROW}${constants_1.SEPARATOR}${constants_1.InternalTable.USER_METADATA}${constants_1.SEPARATOR}`;
|
|
167
|
-
if (!id || !id.includes(prefix)) {
|
|
168
|
-
return id;
|
|
169
|
-
}
|
|
170
|
-
return id.split(prefix)[1];
|
|
171
|
-
}
|
|
172
|
-
exports.getGlobalIDFromUserMetadataID = getGlobalIDFromUserMetadataID;
|
|
173
|
-
function getUsersByAppParams(appId, otherProps = {}) {
|
|
174
|
-
const prodAppId = (0, conversions_1.getProdAppID)(appId);
|
|
175
|
-
return Object.assign(Object.assign({}, otherProps), { startkey: prodAppId, endkey: `${prodAppId}${constants_1.UNICODE_MAX}` });
|
|
176
|
-
}
|
|
177
|
-
exports.getUsersByAppParams = getUsersByAppParams;
|
|
178
|
-
/**
|
|
179
|
-
* Generates a template ID.
|
|
180
|
-
* @param ownerId The owner/user of the template, this could be global or a workspace level.
|
|
181
|
-
*/
|
|
182
|
-
function generateTemplateID(ownerId) {
|
|
183
|
-
return `${constants_1.DocumentType.TEMPLATE}${constants_1.SEPARATOR}${ownerId}${constants_1.SEPARATOR}${(0, newid_1.newid)()}`;
|
|
184
|
-
}
|
|
185
|
-
exports.generateTemplateID = generateTemplateID;
|
|
186
|
-
function generateAppUserID(prodAppId, userId) {
|
|
187
|
-
return `${prodAppId}${constants_1.SEPARATOR}${userId}`;
|
|
188
|
-
}
|
|
189
|
-
exports.generateAppUserID = generateAppUserID;
|
|
190
|
-
/**
|
|
191
|
-
* Gets parameters for retrieving templates. Owner ID must be specified, either global or a workspace level.
|
|
192
|
-
*/
|
|
193
|
-
function getTemplateParams(ownerId, templateId, otherProps = {}) {
|
|
194
|
-
if (!templateId) {
|
|
195
|
-
templateId = "";
|
|
196
|
-
}
|
|
197
|
-
let final;
|
|
198
|
-
if (templateId) {
|
|
199
|
-
final = templateId;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
final = `${constants_1.DocumentType.TEMPLATE}${constants_1.SEPARATOR}${ownerId}${constants_1.SEPARATOR}`;
|
|
203
|
-
}
|
|
204
|
-
return Object.assign(Object.assign({}, otherProps), { startkey: final, endkey: `${final}${constants_1.UNICODE_MAX}` });
|
|
205
|
-
}
|
|
206
|
-
exports.getTemplateParams = getTemplateParams;
|
|
207
|
-
/**
|
|
208
|
-
* Generates a new role ID.
|
|
209
|
-
* @returns {string} The new role ID which the role doc can be stored under.
|
|
210
|
-
*/
|
|
211
|
-
function generateRoleID(id) {
|
|
212
|
-
return `${constants_1.DocumentType.ROLE}${constants_1.SEPARATOR}${id || (0, newid_1.newid)()}`;
|
|
213
|
-
}
|
|
214
|
-
exports.generateRoleID = generateRoleID;
|
|
215
|
-
/**
|
|
216
|
-
* Gets parameters for retrieving a role, this is a utility function for the getDocParams function.
|
|
217
|
-
*/
|
|
218
|
-
function getRoleParams(roleId, otherProps = {}) {
|
|
219
|
-
return getDocParams(constants_1.DocumentType.ROLE, roleId, otherProps);
|
|
220
|
-
}
|
|
221
|
-
exports.getRoleParams = getRoleParams;
|
|
222
|
-
function getStartEndKeyURL(baseKey, tenantId) {
|
|
223
|
-
const tenancy = tenantId ? `${constants_1.SEPARATOR}${tenantId}` : "";
|
|
224
|
-
return `startkey="${baseKey}${tenancy}"&endkey="${baseKey}${tenancy}${constants_1.UNICODE_MAX}"`;
|
|
225
|
-
}
|
|
226
|
-
exports.getStartEndKeyURL = getStartEndKeyURL;
|
|
35
|
+
const conversions_1 = require("../docIds/conversions");
|
|
36
|
+
const docIds_1 = require("../docIds");
|
|
37
|
+
__exportStar(require("../docIds"), exports);
|
|
227
38
|
/**
|
|
228
39
|
* if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing
|
|
229
40
|
* when using Pouch it will use the pouchdb-all-dbs package.
|
|
@@ -251,9 +62,9 @@ function getAllDbs(opts = { efficient: false }) {
|
|
|
251
62
|
}
|
|
252
63
|
else {
|
|
253
64
|
// get prod apps
|
|
254
|
-
yield addDbs(getStartEndKeyURL(constants_1.DocumentType.APP, tenantId));
|
|
65
|
+
yield addDbs((0, docIds_1.getStartEndKeyURL)(constants_1.DocumentType.APP, tenantId));
|
|
255
66
|
// get dev apps
|
|
256
|
-
yield addDbs(getStartEndKeyURL(constants_1.DocumentType.APP_DEV, tenantId));
|
|
67
|
+
yield addDbs((0, docIds_1.getStartEndKeyURL)(constants_1.DocumentType.APP_DEV, tenantId));
|
|
257
68
|
// add global db name
|
|
258
69
|
dbs.push((0, context_1.getGlobalDBName)(tenantId));
|
|
259
70
|
}
|
|
@@ -372,29 +183,6 @@ function dbExists(dbName) {
|
|
|
372
183
|
});
|
|
373
184
|
}
|
|
374
185
|
exports.dbExists = dbExists;
|
|
375
|
-
/**
|
|
376
|
-
* Generates a new dev info document ID - this is scoped to a user.
|
|
377
|
-
* @returns {string} The new dev info ID which info for dev (like api key) can be stored under.
|
|
378
|
-
*/
|
|
379
|
-
const generateDevInfoID = (userId) => {
|
|
380
|
-
return `${constants_1.DocumentType.DEV_INFO}${constants_1.SEPARATOR}${userId}`;
|
|
381
|
-
};
|
|
382
|
-
exports.generateDevInfoID = generateDevInfoID;
|
|
383
|
-
/**
|
|
384
|
-
* Generates a new plugin ID - to be used in the global DB.
|
|
385
|
-
* @returns {string} The new plugin ID which a plugin metadata document can be stored under.
|
|
386
|
-
*/
|
|
387
|
-
const generatePluginID = (name) => {
|
|
388
|
-
return `${constants_1.DocumentType.PLUGIN}${constants_1.SEPARATOR}${name}`;
|
|
389
|
-
};
|
|
390
|
-
exports.generatePluginID = generatePluginID;
|
|
391
|
-
/**
|
|
392
|
-
* Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
|
|
393
|
-
*/
|
|
394
|
-
const getPluginParams = (pluginId, otherProps = {}) => {
|
|
395
|
-
return getDocParams(constants_1.DocumentType.PLUGIN, pluginId, otherProps);
|
|
396
|
-
};
|
|
397
|
-
exports.getPluginParams = getPluginParams;
|
|
398
186
|
function pagination(data, pageSize, { paginate, property, getKey, } = {
|
|
399
187
|
paginate: true,
|
|
400
188
|
property: "_id",
|
package/dist/src/db/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/db/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oCAAgC;AAChC,iEAAgC;AAChC,4CAQqB;AACrB,wCAAyD;AACzD,6BAAkD;AAClD,sDAAqD;AACrD,+CAAkE;AAGlE;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAC,QAAwB,EAAE,EAAE;IACxD,IAAI,EAAE,GAAG,sBAAU,CAAA;IACnB,IAAI,QAAQ,EAAE;QACZ,EAAE,IAAI,GAAG,QAAQ,GAAG,qBAAS,EAAE,CAAA;KAChC;IACD,OAAO,GAAG,EAAE,GAAG,IAAA,aAAK,GAAE,EAAE,CAAA;AAC1B,CAAC,CAAA;AANY,QAAA,aAAa,iBAMzB;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,KAAqB,EACrB,aAAkB,EAAE;IAEpB,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,KAAK,GAAG,EAAE,CAAA;KACX;IACD,uCACK,UAAU,KACb,QAAQ,EAAE,GAAG,OAAO,GAAG,qBAAS,GAAG,KAAK,EAAE,EAC1C,MAAM,EAAE,GAAG,OAAO,GAAG,qBAAS,GAAG,KAAK,GAAG,uBAAW,EAAE,IACvD;AACH,CAAC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E,UAAU,EAAE,IAAI,EAAE,CACrB,CAAA;IACH,CAAC;CAAA;AARD,4BAQC;AAED,SAAgB,UAAU,CACxB,IAAS,EACT,QAAgB,EAChB,EACE,QAAQ,EACR,QAAQ,EACR,MAAM,MAKJ;IACF,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAK;CAChB;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAA;KACpC;IACD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAA;IAC1C,IAAI,QAAQ,GAAG,SAAS,CAAA;IACxB,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,GAAG,CAAC,CAAA;KAC/D;IACD,IAAI,WAAW,EAAE;QACf,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;KAClC;IACD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC;QAC7B,WAAW;QACX,QAAQ;KACT,CAAA;AACH,CAAC;AAhCD,gCAgCC"}
|
package/dist/src/db/views.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ViewName } from "../constants";
|
|
2
|
-
import { Database, DatabaseQueryOpts } from "@budibase/types";
|
|
2
|
+
import { AllDocsResponse, Database, DatabaseQueryOpts } from "@budibase/types";
|
|
3
3
|
export declare function createView(db: any, viewJs: string, viewName: string): Promise<void>;
|
|
4
4
|
export declare const createNewUserEmailView: () => Promise<void>;
|
|
5
5
|
export declare const createUserAppView: () => Promise<void>;
|
|
@@ -8,8 +8,10 @@ export declare const createUserBuildersView: () => Promise<void>;
|
|
|
8
8
|
export interface QueryViewOptions {
|
|
9
9
|
arrayResponse?: boolean;
|
|
10
10
|
}
|
|
11
|
+
export declare function queryViewRaw<T>(viewName: ViewName, params: DatabaseQueryOpts, db: Database, createFunc: any, opts?: QueryViewOptions): Promise<AllDocsResponse<T>>;
|
|
11
12
|
export declare const queryView: <T>(viewName: ViewName, params: DatabaseQueryOpts, db: Database, createFunc: any, opts?: QueryViewOptions) => Promise<T | T[] | undefined>;
|
|
12
13
|
export declare const createPlatformAccountEmailView: () => Promise<void>;
|
|
13
14
|
export declare const createPlatformUserView: () => Promise<void>;
|
|
14
15
|
export declare const queryPlatformView: <T>(viewName: ViewName, params: DatabaseQueryOpts, opts?: QueryViewOptions) => Promise<T | T[] | undefined>;
|
|
15
16
|
export declare const queryGlobalView: <T>(viewName: ViewName, params: DatabaseQueryOpts, db?: Database, opts?: QueryViewOptions) => Promise<T | T[] | undefined>;
|
|
17
|
+
export declare function queryGlobalViewRaw<T>(viewName: ViewName, params: DatabaseQueryOpts, opts?: QueryViewOptions): Promise<AllDocsResponse<T>>;
|