@budibase/backend-core 2.5.6-alpha.9 → 2.5.7
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 +12 -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 +12 -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/tsconfig.json +8 -3
- 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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as processors from "../../../src/events/processors"
|
|
2
|
+
import * as events from "../../../src/events"
|
|
3
|
+
|
|
4
|
+
jest.spyOn(processors.analyticsProcessor, "processEvent")
|
|
5
|
+
|
|
6
|
+
jest.spyOn(events.identification, "identifyTenantGroup")
|
|
7
|
+
jest.spyOn(events.identification, "identifyUser")
|
|
8
|
+
|
|
9
|
+
jest.spyOn(events.backfill, "appSucceeded")
|
|
10
|
+
jest.spyOn(events.backfill, "tenantSucceeded")
|
|
11
|
+
|
|
12
|
+
jest.spyOn(events.account, "created")
|
|
13
|
+
jest.spyOn(events.account, "deleted")
|
|
14
|
+
jest.spyOn(events.account, "verified")
|
|
15
|
+
|
|
16
|
+
jest.spyOn(events.app, "created")
|
|
17
|
+
jest.spyOn(events.app, "updated")
|
|
18
|
+
jest.spyOn(events.app, "deleted")
|
|
19
|
+
jest.spyOn(events.app, "published")
|
|
20
|
+
jest.spyOn(events.app, "unpublished")
|
|
21
|
+
jest.spyOn(events.app, "templateImported")
|
|
22
|
+
jest.spyOn(events.app, "fileImported")
|
|
23
|
+
jest.spyOn(events.app, "versionUpdated")
|
|
24
|
+
jest.spyOn(events.app, "versionReverted")
|
|
25
|
+
jest.spyOn(events.app, "reverted")
|
|
26
|
+
jest.spyOn(events.app, "exported")
|
|
27
|
+
|
|
28
|
+
jest.spyOn(events.auth, "login")
|
|
29
|
+
jest.spyOn(events.auth, "logout")
|
|
30
|
+
jest.spyOn(events.auth, "SSOCreated")
|
|
31
|
+
jest.spyOn(events.auth, "SSOUpdated")
|
|
32
|
+
jest.spyOn(events.auth, "SSOActivated")
|
|
33
|
+
jest.spyOn(events.auth, "SSODeactivated")
|
|
34
|
+
|
|
35
|
+
jest.spyOn(events.automation, "created")
|
|
36
|
+
jest.spyOn(events.automation, "deleted")
|
|
37
|
+
jest.spyOn(events.automation, "tested")
|
|
38
|
+
jest.spyOn(events.automation, "stepCreated")
|
|
39
|
+
jest.spyOn(events.automation, "stepDeleted")
|
|
40
|
+
jest.spyOn(events.automation, "triggerUpdated")
|
|
41
|
+
|
|
42
|
+
jest.spyOn(events.datasource, "created")
|
|
43
|
+
jest.spyOn(events.datasource, "updated")
|
|
44
|
+
jest.spyOn(events.datasource, "deleted")
|
|
45
|
+
|
|
46
|
+
jest.spyOn(events.email, "SMTPCreated")
|
|
47
|
+
jest.spyOn(events.email, "SMTPUpdated")
|
|
48
|
+
|
|
49
|
+
jest.spyOn(events.layout, "created")
|
|
50
|
+
jest.spyOn(events.layout, "deleted")
|
|
51
|
+
|
|
52
|
+
jest.spyOn(events.org, "nameUpdated")
|
|
53
|
+
jest.spyOn(events.org, "logoUpdated")
|
|
54
|
+
jest.spyOn(events.org, "platformURLUpdated")
|
|
55
|
+
jest.spyOn(events.org, "analyticsOptOut")
|
|
56
|
+
|
|
57
|
+
jest.spyOn(events.installation, "versionChecked")
|
|
58
|
+
|
|
59
|
+
jest.spyOn(events.query, "created")
|
|
60
|
+
jest.spyOn(events.query, "updated")
|
|
61
|
+
jest.spyOn(events.query, "deleted")
|
|
62
|
+
jest.spyOn(events.query, "imported")
|
|
63
|
+
jest.spyOn(events.query, "previewed")
|
|
64
|
+
|
|
65
|
+
jest.spyOn(events.role, "created")
|
|
66
|
+
jest.spyOn(events.role, "updated")
|
|
67
|
+
jest.spyOn(events.role, "deleted")
|
|
68
|
+
jest.spyOn(events.role, "assigned")
|
|
69
|
+
jest.spyOn(events.role, "unassigned")
|
|
70
|
+
|
|
71
|
+
jest.spyOn(events.rows, "imported")
|
|
72
|
+
jest.spyOn(events.rows, "created")
|
|
73
|
+
|
|
74
|
+
jest.spyOn(events.screen, "created")
|
|
75
|
+
jest.spyOn(events.screen, "deleted")
|
|
76
|
+
|
|
77
|
+
jest.spyOn(events.user, "created")
|
|
78
|
+
jest.spyOn(events.user, "updated")
|
|
79
|
+
jest.spyOn(events.user, "deleted")
|
|
80
|
+
jest.spyOn(events.user, "permissionAdminAssigned")
|
|
81
|
+
jest.spyOn(events.user, "permissionAdminRemoved")
|
|
82
|
+
jest.spyOn(events.user, "permissionBuilderAssigned")
|
|
83
|
+
jest.spyOn(events.user, "permissionBuilderRemoved")
|
|
84
|
+
jest.spyOn(events.user, "invited")
|
|
85
|
+
jest.spyOn(events.user, "inviteAccepted")
|
|
86
|
+
jest.spyOn(events.user, "passwordForceReset")
|
|
87
|
+
jest.spyOn(events.user, "passwordUpdated")
|
|
88
|
+
jest.spyOn(events.user, "passwordResetRequested")
|
|
89
|
+
jest.spyOn(events.user, "passwordReset")
|
|
90
|
+
|
|
91
|
+
jest.spyOn(events.group, "created")
|
|
92
|
+
jest.spyOn(events.group, "updated")
|
|
93
|
+
jest.spyOn(events.group, "deleted")
|
|
94
|
+
jest.spyOn(events.group, "usersAdded")
|
|
95
|
+
jest.spyOn(events.group, "usersDeleted")
|
|
96
|
+
jest.spyOn(events.group, "createdOnboarding")
|
|
97
|
+
jest.spyOn(events.group, "permissionsEdited")
|
|
98
|
+
|
|
99
|
+
jest.spyOn(events.serve, "servedBuilder")
|
|
100
|
+
jest.spyOn(events.serve, "servedApp")
|
|
101
|
+
jest.spyOn(events.serve, "servedAppPreview")
|
|
102
|
+
|
|
103
|
+
jest.spyOn(events.table, "created")
|
|
104
|
+
jest.spyOn(events.table, "updated")
|
|
105
|
+
jest.spyOn(events.table, "deleted")
|
|
106
|
+
jest.spyOn(events.table, "exported")
|
|
107
|
+
jest.spyOn(events.table, "imported")
|
|
108
|
+
|
|
109
|
+
jest.spyOn(events.view, "created")
|
|
110
|
+
jest.spyOn(events.view, "updated")
|
|
111
|
+
jest.spyOn(events.view, "deleted")
|
|
112
|
+
jest.spyOn(events.view, "exported")
|
|
113
|
+
jest.spyOn(events.view, "filterCreated")
|
|
114
|
+
jest.spyOn(events.view, "filterUpdated")
|
|
115
|
+
jest.spyOn(events.view, "filterDeleted")
|
|
116
|
+
jest.spyOn(events.view, "calculationCreated")
|
|
117
|
+
jest.spyOn(events.view, "calculationUpdated")
|
|
118
|
+
jest.spyOn(events.view, "calculationDeleted")
|
|
119
|
+
|
|
120
|
+
jest.spyOn(events.plugin, "init")
|
|
121
|
+
jest.spyOn(events.plugin, "imported")
|
|
122
|
+
jest.spyOn(events.plugin, "deleted")
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
jest.mock("
|
|
2
|
-
import * as _accounts from "
|
|
1
|
+
jest.mock("../../../src/accounts")
|
|
2
|
+
import * as _accounts from "../../../src/accounts"
|
|
3
3
|
export const accounts = jest.mocked(_accounts)
|
|
4
4
|
|
|
5
5
|
export * as date from "./date"
|
|
6
6
|
export * as licenses from "./licenses"
|
|
7
7
|
export { default as fetch } from "./fetch"
|
|
8
|
-
export * from "./alerts"
|
|
9
|
-
import "./events"
|
|
10
8
|
import "./posthog"
|
|
9
|
+
import "./events"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generator, uuid } from "."
|
|
2
|
-
import
|
|
2
|
+
import * as db from "../../../src/db/utils"
|
|
3
3
|
import {
|
|
4
4
|
Account,
|
|
5
5
|
AccountSSOProvider,
|
|
@@ -39,7 +39,7 @@ export const cloudAccount = (): CloudAccount => {
|
|
|
39
39
|
return {
|
|
40
40
|
...account(),
|
|
41
41
|
hosting: Hosting.CLOUD,
|
|
42
|
-
budibaseUserId: generateGlobalUserID(),
|
|
42
|
+
budibaseUserId: db.generateGlobalUserID(),
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generator } from "."
|
|
2
2
|
import { App } from "@budibase/types"
|
|
3
|
-
import { DEFAULT_TENANT_ID, DocumentType } from "
|
|
3
|
+
import { DEFAULT_TENANT_ID, DocumentType } from "../../../src/constants"
|
|
4
4
|
|
|
5
5
|
export function app(id: string): App {
|
|
6
6
|
return {
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./searchIndexes";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./searchIndexes"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/db/searchIndexes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createUserIndex(): Promise<void>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.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
|
|
@@ -1 +0,0 @@
|
|
|
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,GAA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,CAAC,UAAU,CAAC,0BAAc,CAAC,EAAE;QAC9C,OAAO,KAAK,CAAA;KACb;IACD,wFAAwF;IACxF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,sBAAU,CAAC,CAAA;IACrC,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,sBAAU,CAAC,CAAA;IACnC,OAAO,GAAG,0BAAc,GAAG,IAAI,EAAE,CAAA;AACnC,CAAC;AATD,kDASC;AACY,QAAA,WAAW,GAAG,mBAAmB,CAAA;AAE9C;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,0BAAc,CAAC,EAAE;QAC/C,OAAO,KAAK,CAAA;KACb;IACD,2FAA2F;IAC3F,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,0BAAc,CAAC,CAAA;IACzC,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,0BAAc,CAAC,CAAA;IACvC,OAAO,GAAG,sBAAU,GAAG,IAAI,EAAE,CAAA;AAC/B,CAAC;AATD,oCASC;AAED,SAAgB,cAAc,CAAC,EAAU;IACvC,MAAM,KAAK,GAAG,CAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,KAAK,CAAC,GAAG,CAAC,KAAI,EAAE,CAAA;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACtD,CAAC;AAHD,wCAGC"}
|
package/dist/src/docIds/ids.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a new app ID.
|
|
3
|
-
* @returns {string} The new app ID which the app doc can be stored under.
|
|
4
|
-
*/
|
|
5
|
-
export declare const generateAppID: (tenantId?: string | null) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Gets a new row ID for the specified table.
|
|
8
|
-
* @param {string} tableId The table which the row is being created for.
|
|
9
|
-
* @param {string|null} id If an ID is to be used then the UUID can be substituted for this.
|
|
10
|
-
* @returns {string} The new ID which a row doc can be stored under.
|
|
11
|
-
*/
|
|
12
|
-
export declare function generateRowID(tableId: string, id?: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Generates a new workspace ID.
|
|
15
|
-
* @returns {string} The new workspace ID which the workspace doc can be stored under.
|
|
16
|
-
*/
|
|
17
|
-
export declare function generateWorkspaceID(): string;
|
|
18
|
-
/**
|
|
19
|
-
* Generates a new global user ID.
|
|
20
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
21
|
-
*/
|
|
22
|
-
export declare function generateGlobalUserID(id?: any): string;
|
|
23
|
-
/**
|
|
24
|
-
* Generates a new user ID based on the passed in global ID.
|
|
25
|
-
* @param {string} globalId The ID of the global user.
|
|
26
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
27
|
-
*/
|
|
28
|
-
export declare function generateUserMetadataID(globalId: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Breaks up the ID to get the global ID.
|
|
31
|
-
*/
|
|
32
|
-
export declare function getGlobalIDFromUserMetadataID(id: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Generates a template ID.
|
|
35
|
-
* @param ownerId The owner/user of the template, this could be global or a workspace level.
|
|
36
|
-
*/
|
|
37
|
-
export declare function generateTemplateID(ownerId: any): string;
|
|
38
|
-
export declare function generateAppUserID(prodAppId: string, userId: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Generates a new role ID.
|
|
41
|
-
* @returns {string} The new role ID which the role doc can be stored under.
|
|
42
|
-
*/
|
|
43
|
-
export declare function generateRoleID(id?: any): string;
|
|
44
|
-
/**
|
|
45
|
-
* Generates a new dev info document ID - this is scoped to a user.
|
|
46
|
-
* @returns {string} The new dev info ID which info for dev (like api key) can be stored under.
|
|
47
|
-
*/
|
|
48
|
-
export declare const generateDevInfoID: (userId: any) => string;
|
|
49
|
-
/**
|
|
50
|
-
* Generates a new plugin ID - to be used in the global DB.
|
|
51
|
-
* @returns {string} The new plugin ID which a plugin metadata document can be stored under.
|
|
52
|
-
*/
|
|
53
|
-
export declare const generatePluginID: (name: string) => string;
|
package/dist/src/docIds/ids.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generatePluginID = exports.generateDevInfoID = exports.generateRoleID = exports.generateAppUserID = exports.generateTemplateID = exports.getGlobalIDFromUserMetadataID = exports.generateUserMetadataID = exports.generateGlobalUserID = exports.generateWorkspaceID = exports.generateRowID = exports.generateAppID = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
5
|
-
const newid_1 = require("./newid");
|
|
6
|
-
/**
|
|
7
|
-
* Generates a new app ID.
|
|
8
|
-
* @returns {string} The new app ID which the app doc can be stored under.
|
|
9
|
-
*/
|
|
10
|
-
const generateAppID = (tenantId) => {
|
|
11
|
-
let id = constants_1.APP_PREFIX;
|
|
12
|
-
if (tenantId) {
|
|
13
|
-
id += `${tenantId}${constants_1.SEPARATOR}`;
|
|
14
|
-
}
|
|
15
|
-
return `${id}${(0, newid_1.newid)()}`;
|
|
16
|
-
};
|
|
17
|
-
exports.generateAppID = generateAppID;
|
|
18
|
-
/**
|
|
19
|
-
* Gets a new row ID for the specified table.
|
|
20
|
-
* @param {string} tableId The table which the row is being created for.
|
|
21
|
-
* @param {string|null} id If an ID is to be used then the UUID can be substituted for this.
|
|
22
|
-
* @returns {string} The new ID which a row doc can be stored under.
|
|
23
|
-
*/
|
|
24
|
-
function generateRowID(tableId, id) {
|
|
25
|
-
id = id || (0, newid_1.newid)();
|
|
26
|
-
return `${constants_1.DocumentType.ROW}${constants_1.SEPARATOR}${tableId}${constants_1.SEPARATOR}${id}`;
|
|
27
|
-
}
|
|
28
|
-
exports.generateRowID = generateRowID;
|
|
29
|
-
/**
|
|
30
|
-
* Generates a new workspace ID.
|
|
31
|
-
* @returns {string} The new workspace ID which the workspace doc can be stored under.
|
|
32
|
-
*/
|
|
33
|
-
function generateWorkspaceID() {
|
|
34
|
-
return `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${(0, newid_1.newid)()}`;
|
|
35
|
-
}
|
|
36
|
-
exports.generateWorkspaceID = generateWorkspaceID;
|
|
37
|
-
/**
|
|
38
|
-
* Generates a new global user ID.
|
|
39
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
40
|
-
*/
|
|
41
|
-
function generateGlobalUserID(id) {
|
|
42
|
-
return `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${id || (0, newid_1.newid)()}`;
|
|
43
|
-
}
|
|
44
|
-
exports.generateGlobalUserID = generateGlobalUserID;
|
|
45
|
-
/**
|
|
46
|
-
* Generates a new user ID based on the passed in global ID.
|
|
47
|
-
* @param {string} globalId The ID of the global user.
|
|
48
|
-
* @returns {string} The new user ID which the user doc can be stored under.
|
|
49
|
-
*/
|
|
50
|
-
function generateUserMetadataID(globalId) {
|
|
51
|
-
return generateRowID(constants_1.InternalTable.USER_METADATA, globalId);
|
|
52
|
-
}
|
|
53
|
-
exports.generateUserMetadataID = generateUserMetadataID;
|
|
54
|
-
/**
|
|
55
|
-
* Breaks up the ID to get the global ID.
|
|
56
|
-
*/
|
|
57
|
-
function getGlobalIDFromUserMetadataID(id) {
|
|
58
|
-
const prefix = `${constants_1.DocumentType.ROW}${constants_1.SEPARATOR}${constants_1.InternalTable.USER_METADATA}${constants_1.SEPARATOR}`;
|
|
59
|
-
if (!id || !id.includes(prefix)) {
|
|
60
|
-
return id;
|
|
61
|
-
}
|
|
62
|
-
return id.split(prefix)[1];
|
|
63
|
-
}
|
|
64
|
-
exports.getGlobalIDFromUserMetadataID = getGlobalIDFromUserMetadataID;
|
|
65
|
-
/**
|
|
66
|
-
* Generates a template ID.
|
|
67
|
-
* @param ownerId The owner/user of the template, this could be global or a workspace level.
|
|
68
|
-
*/
|
|
69
|
-
function generateTemplateID(ownerId) {
|
|
70
|
-
return `${constants_1.DocumentType.TEMPLATE}${constants_1.SEPARATOR}${ownerId}${constants_1.SEPARATOR}${(0, newid_1.newid)()}`;
|
|
71
|
-
}
|
|
72
|
-
exports.generateTemplateID = generateTemplateID;
|
|
73
|
-
function generateAppUserID(prodAppId, userId) {
|
|
74
|
-
return `${prodAppId}${constants_1.SEPARATOR}${userId}`;
|
|
75
|
-
}
|
|
76
|
-
exports.generateAppUserID = generateAppUserID;
|
|
77
|
-
/**
|
|
78
|
-
* Generates a new role ID.
|
|
79
|
-
* @returns {string} The new role ID which the role doc can be stored under.
|
|
80
|
-
*/
|
|
81
|
-
function generateRoleID(id) {
|
|
82
|
-
return `${constants_1.DocumentType.ROLE}${constants_1.SEPARATOR}${id || (0, newid_1.newid)()}`;
|
|
83
|
-
}
|
|
84
|
-
exports.generateRoleID = generateRoleID;
|
|
85
|
-
/**
|
|
86
|
-
* Generates a new dev info document ID - this is scoped to a user.
|
|
87
|
-
* @returns {string} The new dev info ID which info for dev (like api key) can be stored under.
|
|
88
|
-
*/
|
|
89
|
-
const generateDevInfoID = (userId) => {
|
|
90
|
-
return `${constants_1.DocumentType.DEV_INFO}${constants_1.SEPARATOR}${userId}`;
|
|
91
|
-
};
|
|
92
|
-
exports.generateDevInfoID = generateDevInfoID;
|
|
93
|
-
/**
|
|
94
|
-
* Generates a new plugin ID - to be used in the global DB.
|
|
95
|
-
* @returns {string} The new plugin ID which a plugin metadata document can be stored under.
|
|
96
|
-
*/
|
|
97
|
-
const generatePluginID = (name) => {
|
|
98
|
-
return `${constants_1.DocumentType.PLUGIN}${constants_1.SEPARATOR}${name}`;
|
|
99
|
-
};
|
|
100
|
-
exports.generatePluginID = generatePluginID;
|
|
101
|
-
//# sourceMappingURL=ids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
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(k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ids"), exports);
|
|
18
|
-
__exportStar(require("./params"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/docIds/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,2CAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"newid.js","sourceRoot":"","sources":["../../../src/docIds/newid.ts"],"names":[],"mappings":";;;AAAA,+BAAyB;AAEzB,SAAgB,KAAK;IACnB,OAAO,IAAA,SAAE,GAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAC/B,CAAC;AAFD,sBAEC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ViewName } from "../constants";
|
|
2
|
-
/**
|
|
3
|
-
* If creating DB allDocs/query params with only a single top level ID this can be used, this
|
|
4
|
-
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
|
|
5
|
-
* More complex cases such as link docs and rows which have multiple levels of IDs that their
|
|
6
|
-
* ID consists of need their own functions to build the allDocs parameters.
|
|
7
|
-
* @param {string} docType The type of document which input params are being built for, e.g. user,
|
|
8
|
-
* link, app, table and so on.
|
|
9
|
-
* @param {string|null} docId The ID of the document minus its type - this is only needed if looking
|
|
10
|
-
* for a singular document.
|
|
11
|
-
* @param {object} otherProps Add any other properties onto the request, e.g. include_docs.
|
|
12
|
-
* @returns {object} Parameters which can then be used with an allDocs request.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getDocParams(docType: string, docId?: string | null, otherProps?: any): any;
|
|
15
|
-
/**
|
|
16
|
-
* Gets the DB allDocs/query params for retrieving a row.
|
|
17
|
-
* @param {string|null} tableId The table in which the rows have been stored.
|
|
18
|
-
* @param {string|null} rowId The ID of the row which is being specifically queried for. This can be
|
|
19
|
-
* left null to get all the rows in the table.
|
|
20
|
-
* @param {object} otherProps Any other properties to add to the request.
|
|
21
|
-
* @returns {object} Parameters which can then be used with an allDocs request.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getRowParams(tableId?: string | null, rowId?: string | null, otherProps?: {}): any;
|
|
24
|
-
/**
|
|
25
|
-
* Retrieve the correct index for a view based on default design DB.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getQueryIndex(viewName: ViewName): string;
|
|
28
|
-
/**
|
|
29
|
-
* Check if a given ID is that of a table.
|
|
30
|
-
* @returns {boolean}
|
|
31
|
-
*/
|
|
32
|
-
export declare const isTableId: (id: string) => boolean | "";
|
|
33
|
-
/**
|
|
34
|
-
* Check if a given ID is that of a datasource or datasource plus.
|
|
35
|
-
* @returns {boolean}
|
|
36
|
-
*/
|
|
37
|
-
export declare const isDatasourceId: (id: string) => boolean | "";
|
|
38
|
-
/**
|
|
39
|
-
* Gets parameters for retrieving workspaces.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getWorkspaceParams(id?: string, otherProps?: {}): {
|
|
42
|
-
startkey: string;
|
|
43
|
-
endkey: string;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Gets parameters for retrieving users.
|
|
47
|
-
*/
|
|
48
|
-
export declare function getGlobalUserParams(globalId: any, otherProps?: any): any;
|
|
49
|
-
/**
|
|
50
|
-
* Gets parameters for retrieving users, this is a utility function for the getDocParams function.
|
|
51
|
-
*/
|
|
52
|
-
export declare function getUserMetadataParams(userId?: string | null, otherProps?: {}): any;
|
|
53
|
-
export declare function getUsersByAppParams(appId: any, otherProps?: any): any;
|
|
54
|
-
/**
|
|
55
|
-
* Gets parameters for retrieving templates. Owner ID must be specified, either global or a workspace level.
|
|
56
|
-
*/
|
|
57
|
-
export declare function getTemplateParams(ownerId: any, templateId: any, otherProps?: {}): {
|
|
58
|
-
startkey: any;
|
|
59
|
-
endkey: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Gets parameters for retrieving a role, this is a utility function for the getDocParams function.
|
|
63
|
-
*/
|
|
64
|
-
export declare function getRoleParams(roleId?: string | null, otherProps?: {}): any;
|
|
65
|
-
export declare function getStartEndKeyURL(baseKey: any, tenantId?: string): string;
|
|
66
|
-
/**
|
|
67
|
-
* Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
|
|
68
|
-
*/
|
|
69
|
-
export declare const getPluginParams: (pluginId?: string | null, otherProps?: {}) => any;
|