@budibase/backend-core 2.9.38 → 2.9.39-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3027 -3025
- package/dist/index.js.map +4 -4
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +5 -5
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +2 -2
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/accounts/accounts.js +100 -0
- package/dist/src/accounts/accounts.js.map +7 -0
- package/dist/src/accounts/api.js +78 -0
- package/dist/src/accounts/api.js.map +7 -0
- package/dist/src/accounts/index.js +23 -0
- package/dist/src/accounts/index.js.map +7 -0
- package/dist/src/auth/auth.js +208 -0
- package/dist/src/auth/auth.js.map +7 -0
- package/dist/src/auth/index.js +23 -0
- package/dist/src/auth/index.js.map +7 -0
- package/dist/src/auth/tests/auth.spec.js +37 -0
- package/dist/src/auth/tests/auth.spec.js.map +7 -0
- package/dist/src/blacklist/blacklist.js +88 -0
- package/dist/src/blacklist/blacklist.js.map +7 -0
- package/dist/src/blacklist/index.js +23 -0
- package/dist/src/blacklist/index.js.map +7 -0
- package/dist/src/blacklist/tests/blacklist.spec.js +61 -0
- package/dist/src/blacklist/tests/blacklist.spec.js.map +7 -0
- package/dist/src/cache/appMetadata.js +86 -0
- package/dist/src/cache/appMetadata.js.map +7 -0
- package/dist/src/cache/base/index.js +102 -0
- package/dist/src/cache/base/index.js.map +7 -0
- package/dist/src/cache/generic.js +69 -0
- package/dist/src/cache/generic.js.map +7 -0
- package/dist/src/cache/index.js +51 -0
- package/dist/src/cache/index.js.map +7 -0
- package/dist/src/cache/tests/writethrough.spec.js +132 -0
- package/dist/src/cache/tests/writethrough.spec.js.map +7 -0
- package/dist/src/cache/user.js +99 -0
- package/dist/src/cache/user.js.map +7 -0
- package/dist/src/cache/writethrough.js +144 -0
- package/dist/src/cache/writethrough.js.map +7 -0
- package/dist/src/configs/configs.js +228 -0
- package/dist/src/configs/configs.js.map +7 -0
- package/dist/src/configs/index.js +23 -0
- package/dist/src/configs/index.js.map +7 -0
- package/dist/src/configs/tests/configs.spec.js +182 -0
- package/dist/src/configs/tests/configs.spec.js.map +7 -0
- package/dist/src/constants/db.js +107 -0
- package/dist/src/constants/db.js.map +7 -0
- package/dist/src/constants/index.js +25 -0
- package/dist/src/constants/index.js.map +7 -0
- package/dist/src/constants/misc.js +92 -0
- package/dist/src/constants/misc.js.map +7 -0
- package/dist/src/context/Context.js +36 -0
- package/dist/src/context/Context.js.map +7 -0
- package/dist/src/context/identity.js +87 -0
- package/dist/src/context/identity.js.map +7 -0
- package/dist/src/context/index.js +45 -0
- package/dist/src/context/index.js.map +7 -0
- package/dist/src/context/mainContext.js +320 -0
- package/dist/src/context/mainContext.js.map +7 -0
- package/dist/src/context/tests/index.spec.js +147 -0
- package/dist/src/context/tests/index.spec.js.map +7 -0
- package/dist/src/context/types.js +17 -0
- package/dist/src/context/types.js.map +7 -0
- package/dist/src/db/Replication.js +89 -0
- package/dist/src/db/Replication.js.map +7 -0
- package/dist/src/db/constants.js +39 -0
- package/dist/src/db/constants.js.map +7 -0
- package/dist/src/db/couch/DatabaseImpl.js +224 -0
- package/dist/src/db/couch/DatabaseImpl.js.map +7 -0
- package/dist/src/db/couch/connections.js +103 -0
- package/dist/src/db/couch/connections.js.map +7 -0
- package/dist/src/db/couch/index.js +44 -0
- package/dist/src/db/couch/index.js.map +7 -0
- package/dist/src/db/couch/pouchDB.js +118 -0
- package/dist/src/db/couch/pouchDB.js.map +7 -0
- package/dist/src/db/couch/pouchDump.js +2 -0
- package/dist/src/db/couch/pouchDump.js.map +7 -0
- package/dist/src/db/couch/utils.js +76 -0
- package/dist/src/db/couch/utils.js.map +7 -0
- package/dist/src/db/db.d.ts +1 -1
- package/dist/src/db/db.js +73 -0
- package/dist/src/db/db.js.map +7 -0
- package/dist/src/db/errors.js +43 -0
- package/dist/src/db/errors.js.map +7 -0
- package/dist/src/db/index.js +64 -0
- package/dist/src/db/index.js.map +7 -0
- package/dist/src/db/lucene.d.ts +2 -1
- package/dist/src/db/lucene.js +595 -0
- package/dist/src/db/lucene.js.map +7 -0
- package/dist/src/db/searchIndexes/index.js +23 -0
- package/dist/src/db/searchIndexes/index.js.map +7 -0
- package/dist/src/db/searchIndexes/searchIndexes.js +82 -0
- package/dist/src/db/searchIndexes/searchIndexes.js.map +7 -0
- package/dist/src/db/tests/index.spec.js +24 -0
- package/dist/src/db/tests/index.spec.js.map +7 -0
- package/dist/src/db/tests/lucene.spec.js +312 -0
- package/dist/src/db/tests/lucene.spec.js.map +7 -0
- package/dist/src/db/tests/pouch.spec.js +63 -0
- package/dist/src/db/tests/pouch.spec.js.map +7 -0
- package/dist/src/db/tests/utils.spec.js +50 -0
- package/dist/src/db/tests/utils.spec.js.map +7 -0
- package/dist/src/db/utils.d.ts +1 -1
- package/dist/src/db/utils.js +198 -0
- package/dist/src/db/utils.js.map +7 -0
- package/dist/src/db/views.js +223 -0
- package/dist/src/db/views.js.map +7 -0
- package/dist/src/docIds/conversions.js +83 -0
- package/dist/src/docIds/conversions.js.map +7 -0
- package/dist/src/docIds/ids.js +101 -0
- package/dist/src/docIds/ids.js.map +7 -0
- package/dist/src/docIds/index.js +25 -0
- package/dist/src/docIds/index.js.map +7 -0
- package/dist/src/docIds/newid.js +32 -0
- package/dist/src/docIds/newid.js.map +7 -0
- package/dist/src/docIds/params.js +136 -0
- package/dist/src/docIds/params.js.map +7 -0
- package/dist/src/docUpdates/index.js +61 -0
- package/dist/src/docUpdates/index.js.map +7 -0
- package/dist/src/environment.js +181 -0
- package/dist/src/environment.js.map +7 -0
- package/dist/src/errors/errors.js +126 -0
- package/dist/src/errors/errors.js.map +7 -0
- package/dist/src/errors/index.js +23 -0
- package/dist/src/errors/index.js.map +7 -0
- package/dist/src/events/analytics.js +42 -0
- package/dist/src/events/analytics.js.map +7 -0
- package/dist/src/events/asyncEvents/index.js +25 -0
- package/dist/src/events/asyncEvents/index.js.map +7 -0
- package/dist/src/events/asyncEvents/publisher.js +39 -0
- package/dist/src/events/asyncEvents/publisher.js.map +7 -0
- package/dist/src/events/asyncEvents/queue.js +42 -0
- package/dist/src/events/asyncEvents/queue.js.map +7 -0
- package/dist/src/events/backfill.js +172 -0
- package/dist/src/events/backfill.js.map +7 -0
- package/dist/src/events/documentId.js +51 -0
- package/dist/src/events/documentId.js.map +7 -0
- package/dist/src/events/events.js +63 -0
- package/dist/src/events/events.js.map +7 -0
- package/dist/src/events/identification.js +275 -0
- package/dist/src/events/identification.js.map +7 -0
- package/dist/src/events/index.js +62 -0
- package/dist/src/events/index.js.map +7 -0
- package/dist/src/events/processors/AnalyticsProcessor.js +76 -0
- package/dist/src/events/processors/AnalyticsProcessor.js.map +7 -0
- package/dist/src/events/processors/AuditLogsProcessor.js +97 -0
- package/dist/src/events/processors/AuditLogsProcessor.js.map +7 -0
- package/dist/src/events/processors/LoggingProcessor.js +58 -0
- package/dist/src/events/processors/LoggingProcessor.js.map +7 -0
- package/dist/src/events/processors/Processors.js +57 -0
- package/dist/src/events/processors/Processors.js.map +7 -0
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js +53 -0
- package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +7 -0
- package/dist/src/events/processors/index.js +57 -0
- package/dist/src/events/processors/index.js.map +7 -0
- package/dist/src/events/processors/posthog/PosthogProcessor.js +126 -0
- package/dist/src/events/processors/posthog/PosthogProcessor.js.map +7 -0
- package/dist/src/events/processors/posthog/index.js +36 -0
- package/dist/src/events/processors/posthog/index.js.map +7 -0
- package/dist/src/events/processors/posthog/rateLimiting.js +105 -0
- package/dist/src/events/processors/posthog/rateLimiting.js.map +7 -0
- package/dist/src/events/processors/posthog/tests/PosthogProcessor.spec.js +154 -0
- package/dist/src/events/processors/posthog/tests/PosthogProcessor.spec.js.map +7 -0
- package/dist/src/events/processors/types.js +29 -0
- package/dist/src/events/processors/types.js.map +7 -0
- package/dist/src/events/publishers/account.js +49 -0
- package/dist/src/events/publishers/account.js.map +7 -0
- package/dist/src/events/publishers/app.js +145 -0
- package/dist/src/events/publishers/app.js.map +7 -0
- package/dist/src/events/publishers/auditLog.js +42 -0
- package/dist/src/events/publishers/auditLog.js.map +7 -0
- package/dist/src/events/publishers/auth.js +80 -0
- package/dist/src/events/publishers/auth.js.map +7 -0
- package/dist/src/events/publishers/automation.js +111 -0
- package/dist/src/events/publishers/automation.js.map +7 -0
- package/dist/src/events/publishers/backfill.js +92 -0
- package/dist/src/events/publishers/backfill.js.map +7 -0
- package/dist/src/events/publishers/backup.js +49 -0
- package/dist/src/events/publishers/backup.js.map +7 -0
- package/dist/src/events/publishers/datasource.js +59 -0
- package/dist/src/events/publishers/datasource.js.map +7 -0
- package/dist/src/events/publishers/email.js +38 -0
- package/dist/src/events/publishers/email.js.map +7 -0
- package/dist/src/events/publishers/environmentVariable.js +53 -0
- package/dist/src/events/publishers/environmentVariable.js.map +7 -0
- package/dist/src/events/publishers/group.js +105 -0
- package/dist/src/events/publishers/group.js.map +7 -0
- package/dist/src/events/publishers/index.js +108 -0
- package/dist/src/events/publishers/index.js.map +7 -0
- package/dist/src/events/publishers/installation.js +56 -0
- package/dist/src/events/publishers/installation.js.map +7 -0
- package/dist/src/events/publishers/layout.js +42 -0
- package/dist/src/events/publishers/layout.js.map +7 -0
- package/dist/src/events/publishers/license.js +78 -0
- package/dist/src/events/publishers/license.js.map +7 -0
- package/dist/src/events/publishers/org.js +53 -0
- package/dist/src/events/publishers/org.js.map +7 -0
- package/dist/src/events/publishers/plugin.js +61 -0
- package/dist/src/events/publishers/plugin.js.map +7 -0
- package/dist/src/events/publishers/query.js +85 -0
- package/dist/src/events/publishers/query.js.map +7 -0
- package/dist/src/events/publishers/role.js +71 -0
- package/dist/src/events/publishers/role.js.map +7 -0
- package/dist/src/events/publishers/rows.js +43 -0
- package/dist/src/events/publishers/rows.js.map +7 -0
- package/dist/src/events/publishers/screen.js +52 -0
- package/dist/src/events/publishers/screen.js.map +7 -0
- package/dist/src/events/publishers/serve.js +53 -0
- package/dist/src/events/publishers/serve.js.map +7 -0
- package/dist/src/events/publishers/table.js +79 -0
- package/dist/src/events/publishers/table.js.map +7 -0
- package/dist/src/events/publishers/user.js +191 -0
- package/dist/src/events/publishers/user.js.map +7 -0
- package/dist/src/events/publishers/view.js +102 -0
- package/dist/src/events/publishers/view.js.map +7 -0
- package/dist/src/{featureFlags → features}/index.d.ts +1 -0
- package/dist/src/features/index.js +105 -0
- package/dist/src/features/index.js.map +7 -0
- package/dist/src/features/installation.d.ts +1 -0
- package/dist/src/features/installation.js +42 -0
- package/dist/src/features/installation.js.map +7 -0
- package/dist/src/features/tests/featureFlags.spec.js +86 -0
- package/dist/src/features/tests/featureFlags.spec.js.map +7 -0
- package/dist/src/helpers.js +31 -0
- package/dist/src/helpers.js.map +7 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +154 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/installation.js +139 -0
- package/dist/src/installation.js.map +7 -0
- package/dist/src/logging/alerts.js +49 -0
- package/dist/src/logging/alerts.js.map +7 -0
- package/dist/src/logging/correlation/correlation.js +41 -0
- package/dist/src/logging/correlation/correlation.js.map +7 -0
- package/dist/src/logging/correlation/index.js +23 -0
- package/dist/src/logging/correlation/index.js.map +7 -0
- package/dist/src/logging/correlation/middleware.js +37 -0
- package/dist/src/logging/correlation/middleware.js.map +7 -0
- package/dist/src/logging/index.js +48 -0
- package/dist/src/logging/index.js.map +7 -0
- package/dist/src/logging/pino/logger.js +197 -0
- package/dist/src/logging/pino/logger.js.map +7 -0
- package/dist/src/logging/pino/middleware.js +77 -0
- package/dist/src/logging/pino/middleware.js.map +7 -0
- package/dist/src/logging/system.js +110 -0
- package/dist/src/logging/system.js.map +7 -0
- package/dist/src/logging/tests/system.spec.js +59 -0
- package/dist/src/logging/tests/system.spec.js.map +7 -0
- package/dist/src/middleware/adminOnly.js +31 -0
- package/dist/src/middleware/adminOnly.js.map +7 -0
- package/dist/src/middleware/auditLog.js +27 -0
- package/dist/src/middleware/auditLog.js.map +7 -0
- package/dist/src/middleware/authenticated.js +178 -0
- package/dist/src/middleware/authenticated.js.map +7 -0
- package/dist/src/middleware/builderOnly.js +48 -0
- package/dist/src/middleware/builderOnly.js.map +7 -0
- package/dist/src/middleware/builderOrAdmin.js +48 -0
- package/dist/src/middleware/builderOrAdmin.js.map +7 -0
- package/dist/src/middleware/csrf.js +60 -0
- package/dist/src/middleware/csrf.js.map +7 -0
- package/dist/src/middleware/errorHandling.js +62 -0
- package/dist/src/middleware/errorHandling.js.map +7 -0
- package/dist/src/middleware/index.js +95 -0
- package/dist/src/middleware/index.js.map +7 -0
- package/dist/src/middleware/internalApi.js +39 -0
- package/dist/src/middleware/internalApi.js.map +7 -0
- package/dist/src/middleware/joi-validator.js +73 -0
- package/dist/src/middleware/joi-validator.js.map +7 -0
- package/dist/src/middleware/matchers.js +62 -0
- package/dist/src/middleware/matchers.js.map +7 -0
- package/dist/src/middleware/passport/datasource/google.js +103 -0
- package/dist/src/middleware/passport/datasource/google.js.map +7 -0
- package/dist/src/middleware/passport/local.js +73 -0
- package/dist/src/middleware/passport/local.js.map +7 -0
- package/dist/src/middleware/passport/sso/google.js +93 -0
- package/dist/src/middleware/passport/sso/google.js.map +7 -0
- package/dist/src/middleware/passport/sso/oidc.js +135 -0
- package/dist/src/middleware/passport/sso/oidc.js.map +7 -0
- package/dist/src/middleware/passport/sso/sso.js +149 -0
- package/dist/src/middleware/passport/sso/sso.js.map +7 -0
- package/dist/src/middleware/passport/sso/tests/google.spec.js +77 -0
- package/dist/src/middleware/passport/sso/tests/google.spec.js.map +7 -0
- package/dist/src/middleware/passport/sso/tests/oidc.spec.js +143 -0
- package/dist/src/middleware/passport/sso/tests/oidc.spec.js.map +7 -0
- package/dist/src/middleware/passport/sso/tests/sso.spec.js +167 -0
- package/dist/src/middleware/passport/sso/tests/sso.spec.js.map +7 -0
- package/dist/src/middleware/passport/utils.js +62 -0
- package/dist/src/middleware/passport/utils.js.map +7 -0
- package/dist/src/middleware/querystringToBody.js +45 -0
- package/dist/src/middleware/querystringToBody.js.map +7 -0
- package/dist/src/middleware/tenancy.js +46 -0
- package/dist/src/middleware/tenancy.js.map +7 -0
- package/dist/src/middleware/tests/builder.spec.js +169 -0
- package/dist/src/middleware/tests/builder.spec.js.map +7 -0
- package/dist/src/middleware/tests/matchers.spec.js +120 -0
- package/dist/src/middleware/tests/matchers.spec.js.map +7 -0
- package/dist/src/migrations/definitions.js +63 -0
- package/dist/src/migrations/definitions.js.map +7 -0
- package/dist/src/migrations/index.js +25 -0
- package/dist/src/migrations/index.js.map +7 -0
- package/dist/src/migrations/migrations.js +178 -0
- package/dist/src/migrations/migrations.js.map +7 -0
- package/dist/src/migrations/tests/migrations.spec.js +78 -0
- package/dist/src/migrations/tests/migrations.spec.js.map +7 -0
- package/dist/src/objectStore/buckets/app.js +65 -0
- package/dist/src/objectStore/buckets/app.js.map +7 -0
- package/dist/src/objectStore/buckets/global.js +63 -0
- package/dist/src/objectStore/buckets/global.js.map +7 -0
- package/dist/src/objectStore/buckets/index.js +27 -0
- package/dist/src/objectStore/buckets/index.js.map +7 -0
- package/dist/src/objectStore/buckets/plugins.js +101 -0
- package/dist/src/objectStore/buckets/plugins.js.map +7 -0
- package/dist/src/objectStore/buckets/tests/app.spec.js +171 -0
- package/dist/src/objectStore/buckets/tests/app.spec.js.map +7 -0
- package/dist/src/objectStore/buckets/tests/global.spec.js +87 -0
- package/dist/src/objectStore/buckets/tests/global.spec.js.map +7 -0
- package/dist/src/objectStore/buckets/tests/plugins.spec.js +123 -0
- package/dist/src/objectStore/buckets/tests/plugins.spec.js.map +7 -0
- package/dist/src/objectStore/cloudfront.js +74 -0
- package/dist/src/objectStore/cloudfront.js.map +7 -0
- package/dist/src/objectStore/index.js +27 -0
- package/dist/src/objectStore/index.js.map +7 -0
- package/dist/src/objectStore/objectStore.js +372 -0
- package/dist/src/objectStore/objectStore.js.map +7 -0
- package/dist/src/objectStore/utils.js +58 -0
- package/dist/src/objectStore/utils.js.map +7 -0
- package/dist/src/platform/index.js +45 -0
- package/dist/src/platform/index.js.map +7 -0
- package/dist/src/platform/platformDb.js +33 -0
- package/dist/src/platform/platformDb.js.map +7 -0
- package/dist/src/platform/tenants.js +123 -0
- package/dist/src/platform/tenants.js.map +7 -0
- package/dist/src/platform/tests/tenants.spec.js +46 -0
- package/dist/src/platform/tests/tenants.spec.js.map +7 -0
- package/dist/src/platform/users.js +104 -0
- package/dist/src/platform/users.js.map +7 -0
- package/dist/src/plugin/index.js +23 -0
- package/dist/src/plugin/index.js.map +7 -0
- package/dist/src/plugin/tests/validation.spec.js +97 -0
- package/dist/src/plugin/tests/validation.spec.js.map +7 -0
- package/dist/src/plugin/utils.js +153 -0
- package/dist/src/plugin/utils.js.map +7 -0
- package/dist/src/queue/constants.js +35 -0
- package/dist/src/queue/constants.js.map +7 -0
- package/dist/src/queue/inMemoryQueue.js +139 -0
- package/dist/src/queue/inMemoryQueue.js.map +7 -0
- package/dist/src/queue/index.js +25 -0
- package/dist/src/queue/index.js.map +7 -0
- package/dist/src/queue/listeners.js +177 -0
- package/dist/src/queue/listeners.js.map +7 -0
- package/dist/src/queue/queue.js +85 -0
- package/dist/src/queue/queue.js.map +7 -0
- package/dist/src/redis/index.js +48 -0
- package/dist/src/redis/index.js.map +7 -0
- package/dist/src/redis/init.js +128 -0
- package/dist/src/redis/init.js.map +7 -0
- package/dist/src/redis/redis.js +277 -0
- package/dist/src/redis/redis.js.map +7 -0
- package/dist/src/redis/redlockImpl.js +145 -0
- package/dist/src/redis/redlockImpl.js.map +7 -0
- package/dist/src/redis/utils.js +136 -0
- package/dist/src/redis/utils.js.map +7 -0
- package/dist/src/security/encryption.js +184 -0
- package/dist/src/security/encryption.js.map +7 -0
- package/dist/src/security/permissions.js +188 -0
- package/dist/src/security/permissions.js.map +7 -0
- package/dist/src/security/roles.d.ts +1 -12
- package/dist/src/security/roles.js +337 -0
- package/dist/src/security/roles.js.map +7 -0
- package/dist/src/security/sessions.js +135 -0
- package/dist/src/security/sessions.js.map +7 -0
- package/dist/src/security/tests/encryption.spec.js +51 -0
- package/dist/src/security/tests/encryption.spec.js.map +7 -0
- package/dist/src/security/tests/permissions.spec.js +154 -0
- package/dist/src/security/tests/permissions.spec.js.map +7 -0
- package/dist/src/security/tests/sessions.spec.js +33 -0
- package/dist/src/security/tests/sessions.spec.js.map +7 -0
- package/dist/src/tenancy/db.js +33 -0
- package/dist/src/tenancy/db.js.map +7 -0
- package/dist/src/tenancy/index.js +25 -0
- package/dist/src/tenancy/index.js.map +7 -0
- package/dist/src/tenancy/tenancy.js +129 -0
- package/dist/src/tenancy/tenancy.js.map +7 -0
- package/dist/src/tenancy/tests/tenancy.spec.js +154 -0
- package/dist/src/tenancy/tests/tenancy.spec.js.map +7 -0
- package/dist/src/timers/index.js +23 -0
- package/dist/src/timers/index.js.map +7 -0
- package/dist/src/timers/timers.js +51 -0
- package/dist/src/timers/timers.js.map +7 -0
- package/dist/src/users/db.d.ts +9 -1
- package/dist/src/users/db.js +381 -0
- package/dist/src/users/db.js.map +7 -0
- package/dist/src/users/events.js +152 -0
- package/dist/src/users/events.js.map +7 -0
- package/dist/src/users/index.js +36 -0
- package/dist/src/users/index.js.map +7 -0
- package/dist/src/users/lookup.js +110 -0
- package/dist/src/users/lookup.js.map +7 -0
- package/dist/src/users/users.js +257 -0
- package/dist/src/users/users.js.map +7 -0
- package/dist/src/users/utils.js +95 -0
- package/dist/src/users/utils.js.map +7 -0
- package/dist/src/utils/hashing.js +53 -0
- package/dist/src/utils/hashing.js.map +7 -0
- package/dist/src/utils/index.js +27 -0
- package/dist/src/utils/index.js.map +7 -0
- package/dist/src/utils/stringUtils.js +33 -0
- package/dist/src/utils/stringUtils.js.map +7 -0
- package/dist/src/utils/tests/utils.spec.js +165 -0
- package/dist/src/utils/tests/utils.spec.js.map +7 -0
- package/dist/src/utils/utils.js +207 -0
- package/dist/src/utils/utils.js.map +7 -0
- package/dist/tests/core/logging.js +57 -0
- package/dist/tests/core/logging.js.map +7 -0
- package/dist/tests/core/utilities/index.js +54 -0
- package/dist/tests/core/utilities/index.js.map +7 -0
- package/dist/tests/core/utilities/jestUtils.js +50 -0
- package/dist/tests/core/utilities/jestUtils.js.map +7 -0
- package/dist/tests/core/utilities/mocks/alerts.js +41 -0
- package/dist/tests/core/utilities/mocks/alerts.js.map +7 -0
- package/dist/tests/core/utilities/mocks/date.js +32 -0
- package/dist/tests/core/utilities/mocks/date.js.map +7 -0
- package/dist/tests/core/utilities/mocks/events.js +133 -0
- package/dist/tests/core/utilities/mocks/events.js.map +7 -0
- package/dist/tests/core/utilities/mocks/fetch.js +39 -0
- package/dist/tests/core/utilities/mocks/fetch.js.map +7 -0
- package/dist/tests/core/utilities/mocks/index.js +55 -0
- package/dist/tests/core/utilities/mocks/index.js.map +7 -0
- package/dist/tests/core/utilities/mocks/licenses.d.ts +2 -0
- package/dist/tests/core/utilities/mocks/licenses.js +145 -0
- package/dist/tests/core/utilities/mocks/licenses.js.map +7 -0
- package/dist/tests/core/utilities/mocks/posthog.js +9 -0
- package/dist/tests/core/utilities/mocks/posthog.js.map +7 -0
- package/dist/tests/core/utilities/structures/Chance.js +48 -0
- package/dist/tests/core/utilities/structures/Chance.js.map +7 -0
- package/dist/tests/core/utilities/structures/accounts.js +148 -0
- package/dist/tests/core/utilities/structures/accounts.js.map +7 -0
- package/dist/tests/core/utilities/structures/apps.js +47 -0
- package/dist/tests/core/utilities/structures/apps.js.map +7 -0
- package/dist/tests/core/utilities/structures/common.js +35 -0
- package/dist/tests/core/utilities/structures/common.js.map +7 -0
- package/dist/tests/core/utilities/structures/db.js +40 -0
- package/dist/tests/core/utilities/structures/db.js.map +7 -0
- package/dist/tests/core/utilities/structures/documents/index.js +23 -0
- package/dist/tests/core/utilities/structures/documents/index.js.map +7 -0
- package/dist/tests/core/utilities/structures/documents/platform/index.js +39 -0
- package/dist/tests/core/utilities/structures/documents/platform/index.js.map +7 -0
- package/dist/tests/core/utilities/structures/documents/platform/installation.js +48 -0
- package/dist/tests/core/utilities/structures/documents/platform/installation.js.map +7 -0
- package/dist/tests/core/utilities/structures/generator.js +40 -0
- package/dist/tests/core/utilities/structures/generator.js.map +7 -0
- package/dist/tests/core/utilities/structures/index.js +81 -0
- package/dist/tests/core/utilities/structures/index.js.map +7 -0
- package/dist/tests/core/utilities/structures/koa.js +42 -0
- package/dist/tests/core/utilities/structures/koa.js.map +7 -0
- package/dist/tests/core/utilities/structures/licenses.js +175 -0
- package/dist/tests/core/utilities/structures/licenses.js.map +7 -0
- package/dist/tests/core/utilities/structures/plugins.js +46 -0
- package/dist/tests/core/utilities/structures/plugins.js.map +7 -0
- package/dist/tests/core/utilities/structures/quotas.js +94 -0
- package/dist/tests/core/utilities/structures/quotas.js.map +7 -0
- package/dist/tests/core/utilities/structures/scim.js +90 -0
- package/dist/tests/core/utilities/structures/scim.js.map +7 -0
- package/dist/tests/core/utilities/structures/shared.js +46 -0
- package/dist/tests/core/utilities/structures/shared.js.map +7 -0
- package/dist/tests/core/utilities/structures/sso.js +144 -0
- package/dist/tests/core/utilities/structures/sso.js.map +7 -0
- package/dist/tests/core/utilities/structures/tenants.js +32 -0
- package/dist/tests/core/utilities/structures/tenants.js.map +7 -0
- package/dist/tests/core/utilities/structures/userGroups.js +36 -0
- package/dist/tests/core/utilities/structures/userGroups.js.map +7 -0
- package/dist/tests/core/utilities/structures/users.js +96 -0
- package/dist/tests/core/utilities/structures/users.js.map +7 -0
- package/dist/tests/core/utilities/testContainerUtils.js +100 -0
- package/dist/tests/core/utilities/testContainerUtils.js.map +7 -0
- package/dist/tests/core/utilities/utils/index.js +39 -0
- package/dist/tests/core/utilities/utils/index.js.map +7 -0
- package/dist/tests/core/utilities/utils/time.js +31 -0
- package/dist/tests/core/utilities/utils/time.js.map +7 -0
- package/dist/tests/extra/DBTestConfiguration.js +61 -0
- package/dist/tests/extra/DBTestConfiguration.js.map +7 -0
- package/dist/tests/extra/index.js +42 -0
- package/dist/tests/extra/index.js.map +7 -0
- package/dist/tests/extra/testEnv.js +106 -0
- package/dist/tests/extra/testEnv.js.map +7 -0
- package/dist/tests/index.js +23 -0
- package/dist/tests/index.js.map +7 -0
- package/dist/tests/jestEnv.js +8 -0
- package/dist/tests/jestEnv.js.map +7 -0
- package/dist/tests/jestSetup.js +41 -0
- package/dist/tests/jestSetup.js.map +7 -0
- package/package.json +5 -5
- package/dist/tests.js +0 -8476
- package/dist/tests.js.map +0 -7
- package/dist/tests.js.meta.json +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var errors_exports = {};
|
|
20
|
+
__export(errors_exports, {
|
|
21
|
+
BadRequestError: () => BadRequestError,
|
|
22
|
+
BudibaseError: () => BudibaseError,
|
|
23
|
+
EmailUnavailableError: () => EmailUnavailableError,
|
|
24
|
+
ErrorCode: () => ErrorCode,
|
|
25
|
+
FeatureDisabledError: () => FeatureDisabledError,
|
|
26
|
+
HTTPError: () => HTTPError,
|
|
27
|
+
InvalidAPIKeyError: () => InvalidAPIKeyError,
|
|
28
|
+
NotFoundError: () => NotFoundError,
|
|
29
|
+
UsageLimitError: () => UsageLimitError,
|
|
30
|
+
getPublicError: () => getPublicError
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(errors_exports);
|
|
33
|
+
class BudibaseError extends Error {
|
|
34
|
+
constructor(message, code) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.code = code;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
40
|
+
ErrorCode2["USAGE_LIMIT_EXCEEDED"] = "usage_limit_exceeded";
|
|
41
|
+
ErrorCode2["FEATURE_DISABLED"] = "feature_disabled";
|
|
42
|
+
ErrorCode2["INVALID_API_KEY"] = "invalid_api_key";
|
|
43
|
+
ErrorCode2["HTTP"] = "http";
|
|
44
|
+
return ErrorCode2;
|
|
45
|
+
})(ErrorCode || {});
|
|
46
|
+
const getPublicError = (err) => {
|
|
47
|
+
let error;
|
|
48
|
+
if (err.code) {
|
|
49
|
+
error = {
|
|
50
|
+
code: err.code
|
|
51
|
+
};
|
|
52
|
+
if (err.getPublicError) {
|
|
53
|
+
error = {
|
|
54
|
+
...error,
|
|
55
|
+
// get any additional context from this error
|
|
56
|
+
...err.getPublicError()
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return error;
|
|
61
|
+
};
|
|
62
|
+
class HTTPError extends BudibaseError {
|
|
63
|
+
constructor(message, httpStatus, code = "http" /* HTTP */) {
|
|
64
|
+
super(message, code);
|
|
65
|
+
this.status = httpStatus;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class NotFoundError extends HTTPError {
|
|
69
|
+
constructor(message) {
|
|
70
|
+
super(message, 404);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
class BadRequestError extends HTTPError {
|
|
74
|
+
constructor(message) {
|
|
75
|
+
super(message, 400);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
class UsageLimitError extends HTTPError {
|
|
79
|
+
constructor(message, limitName) {
|
|
80
|
+
super(message, 400, "usage_limit_exceeded" /* USAGE_LIMIT_EXCEEDED */);
|
|
81
|
+
this.limitName = limitName;
|
|
82
|
+
}
|
|
83
|
+
getPublicError() {
|
|
84
|
+
return {
|
|
85
|
+
limitName: this.limitName
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
class FeatureDisabledError extends HTTPError {
|
|
90
|
+
constructor(message, featureName) {
|
|
91
|
+
super(message, 400, "feature_disabled" /* FEATURE_DISABLED */);
|
|
92
|
+
this.featureName = featureName;
|
|
93
|
+
}
|
|
94
|
+
getPublicError() {
|
|
95
|
+
return {
|
|
96
|
+
featureName: this.featureName
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class InvalidAPIKeyError extends BudibaseError {
|
|
101
|
+
constructor() {
|
|
102
|
+
super(
|
|
103
|
+
"Invalid API key - may need re-generated, or user doesn't exist",
|
|
104
|
+
"invalid_api_key" /* INVALID_API_KEY */
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
class EmailUnavailableError extends Error {
|
|
109
|
+
constructor(email) {
|
|
110
|
+
super(`Email already in use: '${email}'`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
BadRequestError,
|
|
116
|
+
BudibaseError,
|
|
117
|
+
EmailUnavailableError,
|
|
118
|
+
ErrorCode,
|
|
119
|
+
FeatureDisabledError,
|
|
120
|
+
HTTPError,
|
|
121
|
+
InvalidAPIKeyError,
|
|
122
|
+
NotFoundError,
|
|
123
|
+
UsageLimitError,
|
|
124
|
+
getPublicError
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/errors/errors.ts"],
|
|
4
|
+
"sourcesContent": ["// BASE\n\nexport abstract class BudibaseError extends Error {\n code: string\n\n constructor(message: string, code: ErrorCode) {\n super(message)\n this.code = code\n }\n\n protected getPublicError?(): any\n}\n\n// ERROR HANDLING\n\nexport enum ErrorCode {\n USAGE_LIMIT_EXCEEDED = \"usage_limit_exceeded\",\n FEATURE_DISABLED = \"feature_disabled\",\n INVALID_API_KEY = \"invalid_api_key\",\n HTTP = \"http\",\n}\n\n/**\n * For the given error, build the public representation that is safe\n * to be exposed over an api.\n */\nexport const getPublicError = (err: any) => {\n let error\n if (err.code) {\n // add generic error information\n error = {\n code: err.code,\n }\n\n if (err.getPublicError) {\n error = {\n ...error,\n // get any additional context from this error\n ...err.getPublicError(),\n }\n }\n }\n\n return error\n}\n\n// HTTP\n\nexport class HTTPError extends BudibaseError {\n status: number\n\n constructor(message: string, httpStatus: number, code = ErrorCode.HTTP) {\n super(message, code)\n this.status = httpStatus\n }\n}\n\nexport class NotFoundError extends HTTPError {\n constructor(message: string) {\n super(message, 404)\n }\n}\n\nexport class BadRequestError extends HTTPError {\n constructor(message: string) {\n super(message, 400)\n }\n}\n\n// LICENSING\n\nexport class UsageLimitError extends HTTPError {\n limitName: string\n\n constructor(message: string, limitName: string) {\n super(message, 400, ErrorCode.USAGE_LIMIT_EXCEEDED)\n this.limitName = limitName\n }\n\n getPublicError() {\n return {\n limitName: this.limitName,\n }\n }\n}\n\nexport class FeatureDisabledError extends HTTPError {\n featureName: string\n\n constructor(message: string, featureName: string) {\n super(message, 400, ErrorCode.FEATURE_DISABLED)\n this.featureName = featureName\n }\n\n getPublicError() {\n return {\n featureName: this.featureName,\n }\n }\n}\n\n// AUTH\n\nexport class InvalidAPIKeyError extends BudibaseError {\n constructor() {\n super(\n \"Invalid API key - may need re-generated, or user doesn't exist\",\n ErrorCode.INVALID_API_KEY\n )\n }\n}\n\n// USERS\n\nexport class EmailUnavailableError extends Error {\n constructor(email: string) {\n super(`Email already in use: '${email}'`)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAe,sBAAsB,MAAM;AAAA,EAGhD,YAAY,SAAiB,MAAiB;AAC5C,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AAGF;AAIO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,0BAAuB;AACvB,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,qBAAkB;AAClB,EAAAA,WAAA,UAAO;AAJG,SAAAA;AAAA,GAAA;AAWL,MAAM,iBAAiB,CAAC,QAAa;AAC1C,MAAI;AACJ,MAAI,IAAI,MAAM;AAEZ,YAAQ;AAAA,MACN,MAAM,IAAI;AAAA,IACZ;AAEA,QAAI,IAAI,gBAAgB;AACtB,cAAQ;AAAA,QACN,GAAG;AAAA;AAAA,QAEH,GAAG,IAAI,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAIO,MAAM,kBAAkB,cAAc;AAAA,EAG3C,YAAY,SAAiB,YAAoB,OAAO,mBAAgB;AACtE,UAAM,SAAS,IAAI;AACnB,SAAK,SAAS;AAAA,EAChB;AACF;AAEO,MAAM,sBAAsB,UAAU;AAAA,EAC3C,YAAY,SAAiB;AAC3B,UAAM,SAAS,GAAG;AAAA,EACpB;AACF;AAEO,MAAM,wBAAwB,UAAU;AAAA,EAC7C,YAAY,SAAiB;AAC3B,UAAM,SAAS,GAAG;AAAA,EACpB;AACF;AAIO,MAAM,wBAAwB,UAAU;AAAA,EAG7C,YAAY,SAAiB,WAAmB;AAC9C,UAAM,SAAS,KAAK,iDAA8B;AAClD,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA,iBAAiB;AACf,WAAO;AAAA,MACL,WAAW,KAAK;AAAA,IAClB;AAAA,EACF;AACF;AAEO,MAAM,6BAA6B,UAAU;AAAA,EAGlD,YAAY,SAAiB,aAAqB;AAChD,UAAM,SAAS,KAAK,yCAA0B;AAC9C,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,iBAAiB;AACf,WAAO;AAAA,MACL,aAAa,KAAK;AAAA,IACpB;AAAA,EACF;AACF;AAIO,MAAM,2BAA2B,cAAc;AAAA,EACpD,cAAc;AACZ;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAIO,MAAM,8BAA8B,MAAM;AAAA,EAC/C,YAAY,OAAe;AACzB,UAAM,0BAA0B,KAAK,GAAG;AAAA,EAC1C;AACF;",
|
|
6
|
+
"names": ["ErrorCode"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var errors_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(errors_exports);
|
|
18
|
+
__reExport(errors_exports, require("./errors"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./errors")
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var analytics_exports = {};
|
|
30
|
+
__export(analytics_exports, {
|
|
31
|
+
enabled: () => enabled
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(analytics_exports);
|
|
34
|
+
var configs = __toESM(require("../configs"));
|
|
35
|
+
const enabled = async () => {
|
|
36
|
+
return configs.analyticsEnabled();
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
enabled
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/events/analytics.ts"],
|
|
4
|
+
"sourcesContent": ["import * as configs from \"../configs\"\n\n// wrapper utility function\nexport const enabled = async () => {\n return configs.analyticsEnabled()\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAyB;AAGlB,MAAM,UAAU,YAAY;AACjC,SAAO,QAAQ,iBAAiB;AAClC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var asyncEvents_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(asyncEvents_exports);
|
|
18
|
+
__reExport(asyncEvents_exports, require("./queue"), module.exports);
|
|
19
|
+
__reExport(asyncEvents_exports, require("./publisher"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./queue"),
|
|
23
|
+
...require("./publisher")
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var publisher_exports = {};
|
|
20
|
+
__export(publisher_exports, {
|
|
21
|
+
publishAsyncEvent: () => publishAsyncEvent
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(publisher_exports);
|
|
24
|
+
var import_types = require("@budibase/types");
|
|
25
|
+
var import_queue = require("./queue");
|
|
26
|
+
async function publishAsyncEvent(payload) {
|
|
27
|
+
if (!import_queue.asyncEventQueue) {
|
|
28
|
+
(0, import_queue.init)();
|
|
29
|
+
}
|
|
30
|
+
const { event, identity } = payload;
|
|
31
|
+
if (import_types.AsyncEvents.indexOf(event) !== -1 && identity.tenantId) {
|
|
32
|
+
await import_queue.asyncEventQueue.add(payload);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
publishAsyncEvent
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=publisher.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/events/asyncEvents/publisher.ts"],
|
|
4
|
+
"sourcesContent": ["import { AsyncEvents } from \"@budibase/types\"\nimport { EventPayload, asyncEventQueue, init } from \"./queue\"\n\nexport async function publishAsyncEvent(payload: EventPayload) {\n if (!asyncEventQueue) {\n init()\n }\n const { event, identity } = payload\n if (AsyncEvents.indexOf(event) !== -1 && identity.tenantId) {\n await asyncEventQueue.add(payload)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B;AAC5B,mBAAoD;AAEpD,eAAsB,kBAAkB,SAAuB;AAC7D,MAAI,CAAC,8BAAiB;AACpB,2BAAK;AAAA,EACP;AACA,QAAM,EAAE,OAAO,SAAS,IAAI;AAC5B,MAAI,yBAAY,QAAQ,KAAK,MAAM,MAAM,SAAS,UAAU;AAC1D,UAAM,6BAAgB,IAAI,OAAO;AAAA,EACnC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var queue_exports = {};
|
|
20
|
+
__export(queue_exports, {
|
|
21
|
+
asyncEventQueue: () => asyncEventQueue,
|
|
22
|
+
init: () => init,
|
|
23
|
+
shutdown: () => shutdown
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(queue_exports);
|
|
26
|
+
var import_queue = require("../../queue");
|
|
27
|
+
let asyncEventQueue;
|
|
28
|
+
function init() {
|
|
29
|
+
asyncEventQueue = (0, import_queue.createQueue)(import_queue.JobQueue.SYSTEM_EVENT_QUEUE);
|
|
30
|
+
}
|
|
31
|
+
async function shutdown() {
|
|
32
|
+
if (asyncEventQueue) {
|
|
33
|
+
await asyncEventQueue.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
asyncEventQueue,
|
|
39
|
+
init,
|
|
40
|
+
shutdown
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=queue.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/events/asyncEvents/queue.ts"],
|
|
4
|
+
"sourcesContent": ["import BullQueue from \"bull\"\nimport { createQueue, JobQueue } from \"../../queue\"\nimport { Event, Identity } from \"@budibase/types\"\n\nexport interface EventPayload {\n event: Event\n identity: Identity\n properties: any\n timestamp?: string | number\n}\n\nexport let asyncEventQueue: BullQueue.Queue\n\nexport function init() {\n asyncEventQueue = createQueue<EventPayload>(JobQueue.SYSTEM_EVENT_QUEUE)\n}\n\nexport async function shutdown() {\n if (asyncEventQueue) {\n await asyncEventQueue.close()\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsC;AAU/B,IAAI;AAEJ,SAAS,OAAO;AACrB,wBAAkB,0BAA0B,sBAAS,kBAAkB;AACzE;AAEA,eAAsB,WAAW;AAC/B,MAAI,iBAAiB;AACnB,UAAM,gBAAgB,MAAM;AAAA,EAC9B;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var backfill_exports = {};
|
|
30
|
+
__export(backfill_exports, {
|
|
31
|
+
end: () => end,
|
|
32
|
+
isAlreadySent: () => isAlreadySent,
|
|
33
|
+
isBackfillingEvent: () => isBackfillingEvent,
|
|
34
|
+
recordEvent: () => recordEvent,
|
|
35
|
+
start: () => start
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(backfill_exports);
|
|
38
|
+
var import_types = require("@budibase/types");
|
|
39
|
+
var context = __toESM(require("../context"));
|
|
40
|
+
var import_generic = require("../cache/generic");
|
|
41
|
+
var cache = __toESM(require("../cache/generic"));
|
|
42
|
+
const start = async (events) => {
|
|
43
|
+
const metadata = {
|
|
44
|
+
eventWhitelist: events
|
|
45
|
+
};
|
|
46
|
+
return saveBackfillMetadata(metadata);
|
|
47
|
+
};
|
|
48
|
+
const recordEvent = async (event, properties) => {
|
|
49
|
+
const eventKey = getEventKey(event, properties);
|
|
50
|
+
await cache.store(eventKey, properties, void 0, { useTenancy: false });
|
|
51
|
+
};
|
|
52
|
+
const end = async () => {
|
|
53
|
+
await deleteBackfillMetadata();
|
|
54
|
+
await clearEvents();
|
|
55
|
+
};
|
|
56
|
+
const getBackfillMetadata = async () => {
|
|
57
|
+
return cache.get(import_generic.CacheKey.BACKFILL_METADATA);
|
|
58
|
+
};
|
|
59
|
+
const saveBackfillMetadata = async (backfill) => {
|
|
60
|
+
return cache.store(import_generic.CacheKey.BACKFILL_METADATA, backfill);
|
|
61
|
+
};
|
|
62
|
+
const deleteBackfillMetadata = async () => {
|
|
63
|
+
await cache.destroy(import_generic.CacheKey.BACKFILL_METADATA);
|
|
64
|
+
};
|
|
65
|
+
const clearEvents = async () => {
|
|
66
|
+
const pattern = getEventKey();
|
|
67
|
+
const keys = await cache.keys(pattern);
|
|
68
|
+
for (const key of keys) {
|
|
69
|
+
await cache.destroy(key, { useTenancy: false });
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const isBackfillingEvent = async (event) => {
|
|
73
|
+
const backfill = await getBackfillMetadata();
|
|
74
|
+
const events = backfill?.eventWhitelist;
|
|
75
|
+
if (events && events.includes(event)) {
|
|
76
|
+
return true;
|
|
77
|
+
} else {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const isAlreadySent = async (event, properties) => {
|
|
82
|
+
const eventKey = getEventKey(event, properties);
|
|
83
|
+
const cachedEvent = await cache.get(eventKey, {
|
|
84
|
+
useTenancy: false
|
|
85
|
+
});
|
|
86
|
+
return !!cachedEvent;
|
|
87
|
+
};
|
|
88
|
+
const CUSTOM_PROPERTY_SUFFIX = {
|
|
89
|
+
// APP EVENTS
|
|
90
|
+
[import_types.Event.AUTOMATION_CREATED]: (properties) => {
|
|
91
|
+
return properties.automationId;
|
|
92
|
+
},
|
|
93
|
+
[import_types.Event.AUTOMATION_STEP_CREATED]: (properties) => {
|
|
94
|
+
return properties.stepId;
|
|
95
|
+
},
|
|
96
|
+
[import_types.Event.DATASOURCE_CREATED]: (properties) => {
|
|
97
|
+
return properties.datasourceId;
|
|
98
|
+
},
|
|
99
|
+
[import_types.Event.LAYOUT_CREATED]: (properties) => {
|
|
100
|
+
return properties.layoutId;
|
|
101
|
+
},
|
|
102
|
+
[import_types.Event.QUERY_CREATED]: (properties) => {
|
|
103
|
+
return properties.queryId;
|
|
104
|
+
},
|
|
105
|
+
[import_types.Event.ROLE_CREATED]: (properties) => {
|
|
106
|
+
return properties.roleId;
|
|
107
|
+
},
|
|
108
|
+
[import_types.Event.SCREEN_CREATED]: (properties) => {
|
|
109
|
+
return properties.screenId;
|
|
110
|
+
},
|
|
111
|
+
[import_types.Event.TABLE_CREATED]: (properties) => {
|
|
112
|
+
return properties.tableId;
|
|
113
|
+
},
|
|
114
|
+
[import_types.Event.VIEW_CREATED]: (properties) => {
|
|
115
|
+
return properties.tableId;
|
|
116
|
+
},
|
|
117
|
+
[import_types.Event.VIEW_CALCULATION_CREATED]: (properties) => {
|
|
118
|
+
return properties.tableId;
|
|
119
|
+
},
|
|
120
|
+
[import_types.Event.VIEW_FILTER_CREATED]: (properties) => {
|
|
121
|
+
return properties.tableId;
|
|
122
|
+
},
|
|
123
|
+
[import_types.Event.APP_CREATED]: (properties) => {
|
|
124
|
+
return properties.appId;
|
|
125
|
+
},
|
|
126
|
+
[import_types.Event.APP_PUBLISHED]: (properties) => {
|
|
127
|
+
return properties.appId;
|
|
128
|
+
},
|
|
129
|
+
// GLOBAL EVENTS
|
|
130
|
+
[import_types.Event.AUTH_SSO_CREATED]: (properties) => {
|
|
131
|
+
return properties.type;
|
|
132
|
+
},
|
|
133
|
+
[import_types.Event.AUTH_SSO_ACTIVATED]: (properties) => {
|
|
134
|
+
return properties.type;
|
|
135
|
+
},
|
|
136
|
+
[import_types.Event.USER_CREATED]: (properties) => {
|
|
137
|
+
return properties.userId;
|
|
138
|
+
},
|
|
139
|
+
[import_types.Event.USER_PERMISSION_ADMIN_ASSIGNED]: (properties) => {
|
|
140
|
+
return properties.userId;
|
|
141
|
+
},
|
|
142
|
+
[import_types.Event.USER_PERMISSION_BUILDER_ASSIGNED]: (properties) => {
|
|
143
|
+
return properties.userId;
|
|
144
|
+
},
|
|
145
|
+
[import_types.Event.ROLE_ASSIGNED]: (properties) => {
|
|
146
|
+
return `${properties.roleId}-${properties.userId}`;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const getEventKey = (event, properties) => {
|
|
150
|
+
let eventKey;
|
|
151
|
+
const tenantId = context.getTenantId();
|
|
152
|
+
if (event) {
|
|
153
|
+
eventKey = `${import_generic.CacheKey.EVENTS}:${tenantId}:${event}`;
|
|
154
|
+
const custom = CUSTOM_PROPERTY_SUFFIX[event];
|
|
155
|
+
const suffix = custom ? custom(properties) : void 0;
|
|
156
|
+
if (suffix) {
|
|
157
|
+
eventKey = `${eventKey}:${suffix}`;
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
eventKey = `${import_generic.CacheKey.EVENTS}:${tenantId}:*`;
|
|
161
|
+
}
|
|
162
|
+
return eventKey;
|
|
163
|
+
};
|
|
164
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
165
|
+
0 && (module.exports = {
|
|
166
|
+
end,
|
|
167
|
+
isAlreadySent,
|
|
168
|
+
isBackfillingEvent,
|
|
169
|
+
recordEvent,
|
|
170
|
+
start
|
|
171
|
+
});
|
|
172
|
+
//# sourceMappingURL=backfill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/events/backfill.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n Event,\n BackfillMetadata,\n CachedEvent,\n SSOCreatedEvent,\n AutomationCreatedEvent,\n AutomationStepCreatedEvent,\n DatasourceCreatedEvent,\n LayoutCreatedEvent,\n QueryCreatedEvent,\n RoleCreatedEvent,\n ScreenCreatedEvent,\n TableCreatedEvent,\n ViewCreatedEvent,\n ViewCalculationCreatedEvent,\n ViewFilterCreatedEvent,\n AppPublishedEvent,\n UserCreatedEvent,\n RoleAssignedEvent,\n UserPermissionAssignedEvent,\n AppCreatedEvent,\n} from \"@budibase/types\"\nimport * as context from \"../context\"\nimport { CacheKey } from \"../cache/generic\"\nimport * as cache from \"../cache/generic\"\n\n// LIFECYCLE\n\nexport const start = async (events: Event[]) => {\n const metadata: BackfillMetadata = {\n eventWhitelist: events,\n }\n return saveBackfillMetadata(metadata)\n}\n\nexport const recordEvent = async (event: Event, properties: any) => {\n const eventKey = getEventKey(event, properties)\n // don't use a ttl - cleaned up by migration\n // don't use tenancy - already in the key\n await cache.store(eventKey, properties, undefined, { useTenancy: false })\n}\n\nexport const end = async () => {\n await deleteBackfillMetadata()\n await clearEvents()\n}\n\n// CRUD\n\nconst getBackfillMetadata = async (): Promise<BackfillMetadata | null> => {\n return cache.get(CacheKey.BACKFILL_METADATA)\n}\n\nconst saveBackfillMetadata = async (\n backfill: BackfillMetadata\n): Promise<void> => {\n // no TTL - deleted by backfill\n return cache.store(CacheKey.BACKFILL_METADATA, backfill)\n}\n\nconst deleteBackfillMetadata = async (): Promise<void> => {\n await cache.destroy(CacheKey.BACKFILL_METADATA)\n}\n\nconst clearEvents = async () => {\n // wildcard\n const pattern = getEventKey()\n const keys = await cache.keys(pattern)\n\n for (const key of keys) {\n // delete each key\n // don't use tenancy, already in the key\n await cache.destroy(key, { useTenancy: false })\n }\n}\n\n// HELPERS\n\nexport const isBackfillingEvent = async (event: Event) => {\n const backfill = await getBackfillMetadata()\n const events = backfill?.eventWhitelist\n if (events && events.includes(event)) {\n return true\n } else {\n return false\n }\n}\n\nexport const isAlreadySent = async (event: Event, properties: any) => {\n const eventKey = getEventKey(event, properties)\n const cachedEvent: CachedEvent = await cache.get(eventKey, {\n useTenancy: false,\n })\n return !!cachedEvent\n}\n\nconst CUSTOM_PROPERTY_SUFFIX: any = {\n // APP EVENTS\n [Event.AUTOMATION_CREATED]: (properties: AutomationCreatedEvent) => {\n return properties.automationId\n },\n [Event.AUTOMATION_STEP_CREATED]: (properties: AutomationStepCreatedEvent) => {\n return properties.stepId\n },\n [Event.DATASOURCE_CREATED]: (properties: DatasourceCreatedEvent) => {\n return properties.datasourceId\n },\n [Event.LAYOUT_CREATED]: (properties: LayoutCreatedEvent) => {\n return properties.layoutId\n },\n [Event.QUERY_CREATED]: (properties: QueryCreatedEvent) => {\n return properties.queryId\n },\n [Event.ROLE_CREATED]: (properties: RoleCreatedEvent) => {\n return properties.roleId\n },\n [Event.SCREEN_CREATED]: (properties: ScreenCreatedEvent) => {\n return properties.screenId\n },\n [Event.TABLE_CREATED]: (properties: TableCreatedEvent) => {\n return properties.tableId\n },\n [Event.VIEW_CREATED]: (properties: ViewCreatedEvent) => {\n return properties.tableId // best uniqueness\n },\n [Event.VIEW_CALCULATION_CREATED]: (\n properties: ViewCalculationCreatedEvent\n ) => {\n return properties.tableId // best uniqueness\n },\n [Event.VIEW_FILTER_CREATED]: (properties: ViewFilterCreatedEvent) => {\n return properties.tableId // best uniqueness\n },\n [Event.APP_CREATED]: (properties: AppCreatedEvent) => {\n return properties.appId // best uniqueness\n },\n [Event.APP_PUBLISHED]: (properties: AppPublishedEvent) => {\n return properties.appId // best uniqueness\n },\n // GLOBAL EVENTS\n [Event.AUTH_SSO_CREATED]: (properties: SSOCreatedEvent) => {\n return properties.type\n },\n [Event.AUTH_SSO_ACTIVATED]: (properties: SSOCreatedEvent) => {\n return properties.type\n },\n [Event.USER_CREATED]: (properties: UserCreatedEvent) => {\n return properties.userId\n },\n [Event.USER_PERMISSION_ADMIN_ASSIGNED]: (\n properties: UserPermissionAssignedEvent\n ) => {\n return properties.userId\n },\n [Event.USER_PERMISSION_BUILDER_ASSIGNED]: (\n properties: UserPermissionAssignedEvent\n ) => {\n return properties.userId\n },\n [Event.ROLE_ASSIGNED]: (properties: RoleAssignedEvent) => {\n return `${properties.roleId}-${properties.userId}`\n },\n}\n\nconst getEventKey = (event?: Event, properties?: any) => {\n let eventKey: string\n\n const tenantId = context.getTenantId()\n if (event) {\n eventKey = `${CacheKey.EVENTS}:${tenantId}:${event}`\n\n // use some properties to make the key more unique\n const custom = CUSTOM_PROPERTY_SUFFIX[event]\n const suffix = custom ? custom(properties) : undefined\n if (suffix) {\n eventKey = `${eventKey}:${suffix}`\n }\n } else {\n eventKey = `${CacheKey.EVENTS}:${tenantId}:*`\n }\n\n return eventKey\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var documentId_exports = {};
|
|
20
|
+
__export(documentId_exports, {
|
|
21
|
+
getDocumentId: () => getDocumentId
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(documentId_exports);
|
|
24
|
+
var import_types = require("@budibase/types");
|
|
25
|
+
const getEventProperties = {
|
|
26
|
+
[import_types.Event.USER_CREATED]: (properties) => properties.userId,
|
|
27
|
+
[import_types.Event.USER_UPDATED]: (properties) => properties.userId,
|
|
28
|
+
[import_types.Event.USER_DELETED]: (properties) => properties.userId,
|
|
29
|
+
[import_types.Event.USER_PERMISSION_ADMIN_ASSIGNED]: (properties) => properties.userId,
|
|
30
|
+
[import_types.Event.USER_PERMISSION_ADMIN_REMOVED]: (properties) => properties.userId,
|
|
31
|
+
[import_types.Event.USER_PERMISSION_BUILDER_ASSIGNED]: (properties) => properties.userId,
|
|
32
|
+
[import_types.Event.USER_PERMISSION_BUILDER_REMOVED]: (properties) => properties.userId,
|
|
33
|
+
[import_types.Event.USER_GROUP_CREATED]: (properties) => properties.groupId,
|
|
34
|
+
[import_types.Event.USER_GROUP_UPDATED]: (properties) => properties.groupId,
|
|
35
|
+
[import_types.Event.USER_GROUP_DELETED]: (properties) => properties.groupId,
|
|
36
|
+
[import_types.Event.USER_GROUP_USERS_ADDED]: (properties) => properties.groupId,
|
|
37
|
+
[import_types.Event.USER_GROUP_USERS_REMOVED]: (properties) => properties.groupId,
|
|
38
|
+
[import_types.Event.USER_GROUP_PERMISSIONS_EDITED]: (properties) => properties.groupId
|
|
39
|
+
};
|
|
40
|
+
function getDocumentId(event, properties) {
|
|
41
|
+
const extractor = getEventProperties[event];
|
|
42
|
+
if (!extractor) {
|
|
43
|
+
throw new Error("Event does not have a method of document ID extraction");
|
|
44
|
+
}
|
|
45
|
+
return extractor(properties);
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
getDocumentId
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=documentId.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/events/documentId.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n Event,\n UserCreatedEvent,\n UserUpdatedEvent,\n UserDeletedEvent,\n UserPermissionAssignedEvent,\n UserPermissionRemovedEvent,\n GroupCreatedEvent,\n GroupUpdatedEvent,\n GroupDeletedEvent,\n GroupUsersAddedEvent,\n GroupUsersDeletedEvent,\n GroupPermissionsEditedEvent,\n} from \"@budibase/types\"\n\nconst getEventProperties: Record<\n string,\n (properties: any) => string | undefined\n> = {\n [Event.USER_CREATED]: (properties: UserCreatedEvent) => properties.userId,\n [Event.USER_UPDATED]: (properties: UserUpdatedEvent) => properties.userId,\n [Event.USER_DELETED]: (properties: UserDeletedEvent) => properties.userId,\n [Event.USER_PERMISSION_ADMIN_ASSIGNED]: (\n properties: UserPermissionAssignedEvent\n ) => properties.userId,\n [Event.USER_PERMISSION_ADMIN_REMOVED]: (\n properties: UserPermissionRemovedEvent\n ) => properties.userId,\n [Event.USER_PERMISSION_BUILDER_ASSIGNED]: (\n properties: UserPermissionAssignedEvent\n ) => properties.userId,\n [Event.USER_PERMISSION_BUILDER_REMOVED]: (\n properties: UserPermissionRemovedEvent\n ) => properties.userId,\n [Event.USER_GROUP_CREATED]: (properties: GroupCreatedEvent) =>\n properties.groupId,\n [Event.USER_GROUP_UPDATED]: (properties: GroupUpdatedEvent) =>\n properties.groupId,\n [Event.USER_GROUP_DELETED]: (properties: GroupDeletedEvent) =>\n properties.groupId,\n [Event.USER_GROUP_USERS_ADDED]: (properties: GroupUsersAddedEvent) =>\n properties.groupId,\n [Event.USER_GROUP_USERS_REMOVED]: (properties: GroupUsersDeletedEvent) =>\n properties.groupId,\n [Event.USER_GROUP_PERMISSIONS_EDITED]: (\n properties: GroupPermissionsEditedEvent\n ) => properties.groupId,\n}\n\nexport function getDocumentId(event: Event, properties: any) {\n const extractor = getEventProperties[event]\n if (!extractor) {\n throw new Error(\"Event does not have a method of document ID extraction\")\n }\n return extractor(properties)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAaO;AAEP,MAAM,qBAGF;AAAA,EACF,CAAC,mBAAM,YAAY,GAAG,CAAC,eAAiC,WAAW;AAAA,EACnE,CAAC,mBAAM,YAAY,GAAG,CAAC,eAAiC,WAAW;AAAA,EACnE,CAAC,mBAAM,YAAY,GAAG,CAAC,eAAiC,WAAW;AAAA,EACnE,CAAC,mBAAM,8BAA8B,GAAG,CACtC,eACG,WAAW;AAAA,EAChB,CAAC,mBAAM,6BAA6B,GAAG,CACrC,eACG,WAAW;AAAA,EAChB,CAAC,mBAAM,gCAAgC,GAAG,CACxC,eACG,WAAW;AAAA,EAChB,CAAC,mBAAM,+BAA+B,GAAG,CACvC,eACG,WAAW;AAAA,EAChB,CAAC,mBAAM,kBAAkB,GAAG,CAAC,eAC3B,WAAW;AAAA,EACb,CAAC,mBAAM,kBAAkB,GAAG,CAAC,eAC3B,WAAW;AAAA,EACb,CAAC,mBAAM,kBAAkB,GAAG,CAAC,eAC3B,WAAW;AAAA,EACb,CAAC,mBAAM,sBAAsB,GAAG,CAAC,eAC/B,WAAW;AAAA,EACb,CAAC,mBAAM,wBAAwB,GAAG,CAAC,eACjC,WAAW;AAAA,EACb,CAAC,mBAAM,6BAA6B,GAAG,CACrC,eACG,WAAW;AAClB;AAEO,SAAS,cAAc,OAAc,YAAiB;AAC3D,QAAM,YAAY,mBAAmB,KAAK;AAC1C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AACA,SAAO,UAAU,UAAU;AAC7B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|