@budibase/backend-core 3.2.4 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +11 -4
- package/dist/plugins.js.meta.json +1 -1
- package/package.json +11 -4
- package/src/accounts/accounts.ts +0 -82
- package/src/accounts/api.ts +0 -59
- package/src/accounts/index.ts +0 -1
- package/src/auth/auth.ts +0 -210
- package/src/auth/index.ts +0 -1
- package/src/auth/tests/auth.spec.ts +0 -14
- package/src/blacklist/blacklist.ts +0 -54
- package/src/blacklist/index.ts +0 -1
- package/src/blacklist/tests/blacklist.spec.ts +0 -46
- package/src/cache/appMetadata.ts +0 -88
- package/src/cache/base/index.ts +0 -150
- package/src/cache/docWritethrough.ts +0 -105
- package/src/cache/generic.ts +0 -33
- package/src/cache/index.ts +0 -8
- package/src/cache/invite.ts +0 -86
- package/src/cache/passwordReset.ts +0 -49
- package/src/cache/tests/docWritethrough.spec.ts +0 -296
- package/src/cache/tests/user.spec.ts +0 -145
- package/src/cache/tests/writethrough.spec.ts +0 -139
- package/src/cache/user.ts +0 -154
- package/src/cache/writethrough.ts +0 -133
- package/src/configs/configs.ts +0 -263
- package/src/configs/index.ts +0 -1
- package/src/configs/tests/configs.spec.ts +0 -184
- package/src/constants/db.ts +0 -75
- package/src/constants/index.ts +0 -2
- package/src/constants/misc.ts +0 -36
- package/src/context/Context.ts +0 -14
- package/src/context/identity.ts +0 -58
- package/src/context/index.ts +0 -3
- package/src/context/mainContext.ts +0 -422
- package/src/context/tests/index.spec.ts +0 -255
- package/src/context/types.ts +0 -26
- package/src/db/Replication.ts +0 -94
- package/src/db/couch/DatabaseImpl.ts +0 -511
- package/src/db/couch/connections.ts +0 -89
- package/src/db/couch/index.ts +0 -4
- package/src/db/couch/pouchDB.ts +0 -97
- package/src/db/couch/pouchDump.ts +0 -0
- package/src/db/couch/tests/DatabaseImpl.spec.ts +0 -118
- package/src/db/couch/utils.ts +0 -55
- package/src/db/db.ts +0 -34
- package/src/db/errors.ts +0 -14
- package/src/db/index.ts +0 -12
- package/src/db/instrumentation.ts +0 -199
- package/src/db/lucene.ts +0 -721
- package/src/db/searchIndexes/index.ts +0 -1
- package/src/db/searchIndexes/searchIndexes.ts +0 -62
- package/src/db/tests/DatabaseImpl.spec.ts +0 -55
- package/src/db/tests/connections.spec.ts +0 -22
- package/src/db/tests/index.spec.ts +0 -32
- package/src/db/tests/lucene.spec.ts +0 -400
- package/src/db/tests/pouch.spec.js +0 -62
- package/src/db/tests/utils.spec.ts +0 -63
- package/src/db/utils.ts +0 -208
- package/src/db/views.ts +0 -245
- package/src/docIds/conversions.ts +0 -60
- package/src/docIds/ids.ts +0 -126
- package/src/docIds/index.ts +0 -2
- package/src/docIds/newid.ts +0 -5
- package/src/docIds/params.ts +0 -189
- package/src/docUpdates/index.ts +0 -24
- package/src/environment.ts +0 -293
- package/src/errors/errors.ts +0 -119
- package/src/errors/index.ts +0 -1
- package/src/events/analytics.ts +0 -6
- 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/backfill.ts +0 -183
- package/src/events/documentId.ts +0 -56
- package/src/events/events.ts +0 -47
- package/src/events/identification.ts +0 -311
- package/src/events/index.ts +0 -15
- package/src/events/processors/AnalyticsProcessor.ts +0 -64
- package/src/events/processors/AuditLogsProcessor.ts +0 -92
- package/src/events/processors/LoggingProcessor.ts +0 -36
- package/src/events/processors/Processors.ts +0 -52
- package/src/events/processors/async/DocumentUpdateProcessor.ts +0 -38
- package/src/events/processors/index.ts +0 -19
- package/src/events/processors/posthog/PosthogProcessor.ts +0 -118
- package/src/events/processors/posthog/index.ts +0 -3
- package/src/events/processors/posthog/rateLimiting.ts +0 -106
- package/src/events/processors/posthog/tests/PosthogProcessor.spec.ts +0 -164
- package/src/events/processors/types.ts +0 -1
- package/src/events/publishers/account.ts +0 -41
- package/src/events/publishers/ai.ts +0 -21
- package/src/events/publishers/app.ts +0 -168
- package/src/events/publishers/auditLog.ts +0 -26
- package/src/events/publishers/auth.ts +0 -73
- package/src/events/publishers/automation.ts +0 -110
- package/src/events/publishers/backfill.ts +0 -74
- package/src/events/publishers/backup.ts +0 -42
- package/src/events/publishers/datasource.ts +0 -48
- package/src/events/publishers/email.ts +0 -17
- package/src/events/publishers/environmentVariable.ts +0 -38
- package/src/events/publishers/group.ts +0 -99
- package/src/events/publishers/index.ts +0 -25
- package/src/events/publishers/installation.ts +0 -38
- package/src/events/publishers/layout.ts +0 -26
- package/src/events/publishers/license.ts +0 -84
- package/src/events/publishers/org.ts +0 -37
- package/src/events/publishers/plugin.ts +0 -47
- package/src/events/publishers/query.ts +0 -89
- package/src/events/publishers/role.ts +0 -62
- package/src/events/publishers/rows.ts +0 -29
- package/src/events/publishers/screen.ts +0 -36
- package/src/events/publishers/serve.ts +0 -43
- package/src/events/publishers/table.ts +0 -70
- package/src/events/publishers/user.ts +0 -202
- package/src/events/publishers/view.ts +0 -107
- package/src/features/features.ts +0 -277
- package/src/features/index.ts +0 -2
- package/src/features/tests/features.spec.ts +0 -267
- package/src/features/tests/utils.ts +0 -64
- package/src/helpers.ts +0 -9
- package/src/index.ts +0 -59
- package/src/installation.ts +0 -115
- package/src/logging/alerts.ts +0 -26
- package/src/logging/correlation/correlation.ts +0 -15
- package/src/logging/correlation/index.ts +0 -1
- package/src/logging/correlation/middleware.ts +0 -18
- package/src/logging/index.ts +0 -4
- package/src/logging/pino/logger.ts +0 -239
- package/src/logging/pino/middleware.ts +0 -48
- package/src/logging/system.ts +0 -81
- package/src/logging/tests/system.spec.ts +0 -61
- package/src/middleware/adminOnly.ts +0 -9
- package/src/middleware/auditLog.ts +0 -6
- package/src/middleware/authenticated.ts +0 -247
- package/src/middleware/builderOnly.ts +0 -21
- package/src/middleware/builderOrAdmin.ts +0 -21
- package/src/middleware/contentSecurityPolicy.ts +0 -113
- package/src/middleware/csrf.ts +0 -81
- package/src/middleware/errorHandling.ts +0 -43
- package/src/middleware/index.ts +0 -24
- package/src/middleware/internalApi.ts +0 -23
- package/src/middleware/ip.ts +0 -12
- package/src/middleware/joi-validator.ts +0 -58
- package/src/middleware/matchers.ts +0 -39
- package/src/middleware/passport/datasource/google.ts +0 -102
- package/src/middleware/passport/local.ts +0 -54
- package/src/middleware/passport/sso/google.ts +0 -77
- package/src/middleware/passport/sso/oidc.ts +0 -152
- package/src/middleware/passport/sso/sso.ts +0 -138
- package/src/middleware/passport/sso/tests/google.spec.ts +0 -68
- package/src/middleware/passport/sso/tests/oidc.spec.ts +0 -144
- package/src/middleware/passport/sso/tests/sso.spec.ts +0 -197
- package/src/middleware/passport/utils.ts +0 -38
- package/src/middleware/querystringToBody.ts +0 -28
- package/src/middleware/tenancy.ts +0 -36
- package/src/middleware/tests/builder.spec.ts +0 -181
- package/src/middleware/tests/contentSecurityPolicy.spec.ts +0 -75
- package/src/middleware/tests/matchers.spec.ts +0 -100
- package/src/migrations/definitions.ts +0 -40
- package/src/migrations/index.ts +0 -2
- package/src/migrations/migrations.ts +0 -186
- package/src/migrations/tests/__snapshots__/migrations.spec.ts.snap +0 -11
- package/src/migrations/tests/migrations.spec.ts +0 -64
- package/src/objectStore/buckets/app.ts +0 -53
- package/src/objectStore/buckets/global.ts +0 -29
- package/src/objectStore/buckets/index.ts +0 -3
- package/src/objectStore/buckets/plugins.ts +0 -71
- package/src/objectStore/buckets/tests/app.spec.ts +0 -161
- package/src/objectStore/buckets/tests/global.spec.ts +0 -74
- package/src/objectStore/buckets/tests/plugins.spec.ts +0 -111
- package/src/objectStore/cloudfront.ts +0 -41
- package/src/objectStore/index.ts +0 -3
- package/src/objectStore/objectStore.ts +0 -585
- package/src/objectStore/utils.ts +0 -113
- package/src/platform/index.ts +0 -3
- package/src/platform/platformDb.ts +0 -6
- package/src/platform/tenants.ts +0 -101
- package/src/platform/tests/tenants.spec.ts +0 -26
- package/src/platform/users.ts +0 -129
- package/src/plugin/index.ts +0 -1
- package/src/plugin/tests/validation.spec.ts +0 -209
- package/src/plugin/utils.ts +0 -175
- package/src/queue/constants.ts +0 -8
- package/src/queue/inMemoryQueue.ts +0 -189
- package/src/queue/index.ts +0 -2
- package/src/queue/listeners.ts +0 -199
- package/src/queue/queue.ts +0 -84
- package/src/redis/index.ts +0 -6
- package/src/redis/init.ts +0 -118
- package/src/redis/redis.ts +0 -358
- package/src/redis/redlockImpl.ts +0 -155
- package/src/redis/tests/redis.spec.ts +0 -207
- package/src/redis/tests/redlockImpl.spec.ts +0 -105
- package/src/redis/utils.ts +0 -128
- package/src/security/auth.ts +0 -24
- package/src/security/encryption.ts +0 -185
- package/src/security/index.ts +0 -1
- package/src/security/permissions.ts +0 -166
- package/src/security/roles.ts +0 -655
- package/src/security/secrets.ts +0 -20
- package/src/security/sessions.ts +0 -123
- package/src/security/tests/auth.spec.ts +0 -45
- package/src/security/tests/encryption.spec.ts +0 -31
- package/src/security/tests/permissions.spec.ts +0 -146
- package/src/security/tests/secrets.spec.ts +0 -35
- package/src/security/tests/sessions.spec.ts +0 -12
- package/src/sql/designDoc.ts +0 -17
- package/src/sql/index.ts +0 -5
- package/src/sql/sql.ts +0 -1854
- package/src/sql/sqlTable.ts +0 -319
- package/src/sql/utils.ts +0 -193
- package/src/tenancy/db.ts +0 -6
- package/src/tenancy/index.ts +0 -2
- package/src/tenancy/tenancy.ts +0 -148
- package/src/tenancy/tests/tenancy.spec.ts +0 -184
- package/src/timers/index.ts +0 -1
- package/src/timers/timers.ts +0 -22
- package/src/users/db.ts +0 -582
- package/src/users/events.ts +0 -176
- package/src/users/index.ts +0 -4
- package/src/users/lookup.ts +0 -99
- package/src/users/test/db.spec.ts +0 -188
- package/src/users/test/utils.spec.ts +0 -67
- package/src/users/users.ts +0 -353
- package/src/users/utils.ts +0 -81
- package/src/utils/Duration.ts +0 -56
- package/src/utils/hashing.ts +0 -15
- package/src/utils/index.ts +0 -4
- package/src/utils/stringUtils.ts +0 -8
- package/src/utils/tests/Duration.spec.ts +0 -19
- package/src/utils/tests/utils.spec.ts +0 -204
- package/src/utils/utils.ts +0 -249
- package/tests/core/logging.ts +0 -34
- package/tests/core/users/users.spec.js +0 -53
- package/tests/core/utilities/index.ts +0 -7
- package/tests/core/utilities/jestUtils.ts +0 -33
- package/tests/core/utilities/mocks/alerts.ts +0 -4
- package/tests/core/utilities/mocks/date.ts +0 -3
- package/tests/core/utilities/mocks/events.ts +0 -132
- package/tests/core/utilities/mocks/index.ts +0 -9
- package/tests/core/utilities/mocks/licenses.ts +0 -119
- package/tests/core/utilities/queue.ts +0 -9
- package/tests/core/utilities/structures/Chance.ts +0 -20
- package/tests/core/utilities/structures/accounts.ts +0 -80
- package/tests/core/utilities/structures/apps.ts +0 -21
- package/tests/core/utilities/structures/common.ts +0 -7
- package/tests/core/utilities/structures/db.ts +0 -12
- package/tests/core/utilities/structures/documents/index.ts +0 -1
- package/tests/core/utilities/structures/documents/platform/index.ts +0 -1
- package/tests/core/utilities/structures/documents/platform/installation.ts +0 -12
- package/tests/core/utilities/structures/generator.ts +0 -3
- package/tests/core/utilities/structures/index.ts +0 -15
- package/tests/core/utilities/structures/koa.ts +0 -16
- package/tests/core/utilities/structures/licenses.ts +0 -190
- package/tests/core/utilities/structures/plugins.ts +0 -19
- package/tests/core/utilities/structures/quotas.ts +0 -72
- package/tests/core/utilities/structures/scim.ts +0 -80
- package/tests/core/utilities/structures/sso.ts +0 -118
- package/tests/core/utilities/structures/tenants.ts +0 -5
- package/tests/core/utilities/structures/userGroups.ts +0 -10
- package/tests/core/utilities/structures/users.ts +0 -89
- package/tests/core/utilities/testContainerUtils.ts +0 -165
- package/tests/core/utilities/utils/index.ts +0 -2
- package/tests/core/utilities/utils/queue.ts +0 -27
- package/tests/core/utilities/utils/time.ts +0 -3
- package/tests/extra/DBTestConfiguration.ts +0 -36
- package/tests/extra/index.ts +0 -2
- package/tests/extra/testEnv.ts +0 -95
- package/tests/index.ts +0 -2
- package/tests/jestEnv.ts +0 -10
- package/tests/jestSetup.ts +0 -36
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
beforeAll(async () => {
|
|
2
|
-
const processors = await import("../../../../src/events/processors")
|
|
3
|
-
const events = await import("../../../../src/events")
|
|
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, "duplicated")
|
|
19
|
-
jest.spyOn(events.app, "deleted")
|
|
20
|
-
jest.spyOn(events.app, "published")
|
|
21
|
-
jest.spyOn(events.app, "unpublished")
|
|
22
|
-
jest.spyOn(events.app, "templateImported")
|
|
23
|
-
jest.spyOn(events.app, "fileImported")
|
|
24
|
-
jest.spyOn(events.app, "versionUpdated")
|
|
25
|
-
jest.spyOn(events.app, "versionReverted")
|
|
26
|
-
jest.spyOn(events.app, "reverted")
|
|
27
|
-
jest.spyOn(events.app, "exported")
|
|
28
|
-
|
|
29
|
-
jest.spyOn(events.auth, "login")
|
|
30
|
-
jest.spyOn(events.auth, "logout")
|
|
31
|
-
jest.spyOn(events.auth, "SSOCreated")
|
|
32
|
-
jest.spyOn(events.auth, "SSOUpdated")
|
|
33
|
-
jest.spyOn(events.auth, "SSOActivated")
|
|
34
|
-
jest.spyOn(events.auth, "SSODeactivated")
|
|
35
|
-
|
|
36
|
-
jest.spyOn(events.automation, "created")
|
|
37
|
-
jest.spyOn(events.automation, "deleted")
|
|
38
|
-
jest.spyOn(events.automation, "tested")
|
|
39
|
-
jest.spyOn(events.automation, "stepCreated")
|
|
40
|
-
jest.spyOn(events.automation, "stepDeleted")
|
|
41
|
-
jest.spyOn(events.automation, "triggerUpdated")
|
|
42
|
-
|
|
43
|
-
jest.spyOn(events.datasource, "created")
|
|
44
|
-
jest.spyOn(events.datasource, "updated")
|
|
45
|
-
jest.spyOn(events.datasource, "deleted")
|
|
46
|
-
|
|
47
|
-
jest.spyOn(events.email, "SMTPCreated")
|
|
48
|
-
jest.spyOn(events.email, "SMTPUpdated")
|
|
49
|
-
|
|
50
|
-
jest.spyOn(events.layout, "created")
|
|
51
|
-
jest.spyOn(events.layout, "deleted")
|
|
52
|
-
|
|
53
|
-
jest.spyOn(events.org, "nameUpdated")
|
|
54
|
-
jest.spyOn(events.org, "logoUpdated")
|
|
55
|
-
jest.spyOn(events.org, "platformURLUpdated")
|
|
56
|
-
jest.spyOn(events.org, "analyticsOptOut")
|
|
57
|
-
|
|
58
|
-
jest.spyOn(events.installation, "versionChecked")
|
|
59
|
-
|
|
60
|
-
jest.spyOn(events.query, "created")
|
|
61
|
-
jest.spyOn(events.query, "updated")
|
|
62
|
-
jest.spyOn(events.query, "deleted")
|
|
63
|
-
jest.spyOn(events.query, "imported")
|
|
64
|
-
jest.spyOn(events.query, "previewed")
|
|
65
|
-
|
|
66
|
-
jest.spyOn(events.role, "created")
|
|
67
|
-
jest.spyOn(events.role, "updated")
|
|
68
|
-
jest.spyOn(events.role, "deleted")
|
|
69
|
-
jest.spyOn(events.role, "assigned")
|
|
70
|
-
jest.spyOn(events.role, "unassigned")
|
|
71
|
-
|
|
72
|
-
jest.spyOn(events.rows, "imported")
|
|
73
|
-
jest.spyOn(events.rows, "created")
|
|
74
|
-
|
|
75
|
-
jest.spyOn(events.screen, "created")
|
|
76
|
-
jest.spyOn(events.screen, "deleted")
|
|
77
|
-
|
|
78
|
-
jest.spyOn(events.user, "created")
|
|
79
|
-
jest.spyOn(events.user, "updated")
|
|
80
|
-
jest.spyOn(events.user, "deleted")
|
|
81
|
-
jest.spyOn(events.user, "permissionAdminAssigned")
|
|
82
|
-
jest.spyOn(events.user, "permissionAdminRemoved")
|
|
83
|
-
jest.spyOn(events.user, "permissionBuilderAssigned")
|
|
84
|
-
jest.spyOn(events.user, "permissionBuilderRemoved")
|
|
85
|
-
jest.spyOn(events.user, "invited")
|
|
86
|
-
jest.spyOn(events.user, "inviteAccepted")
|
|
87
|
-
jest.spyOn(events.user, "passwordForceReset")
|
|
88
|
-
jest.spyOn(events.user, "passwordUpdated")
|
|
89
|
-
jest.spyOn(events.user, "passwordResetRequested")
|
|
90
|
-
jest.spyOn(events.user, "passwordReset")
|
|
91
|
-
|
|
92
|
-
jest.spyOn(events.group, "created")
|
|
93
|
-
jest.spyOn(events.group, "updated")
|
|
94
|
-
jest.spyOn(events.group, "deleted")
|
|
95
|
-
jest.spyOn(events.group, "usersAdded")
|
|
96
|
-
jest.spyOn(events.group, "usersDeleted")
|
|
97
|
-
jest.spyOn(events.group, "createdOnboarding")
|
|
98
|
-
jest.spyOn(events.group, "permissionsEdited")
|
|
99
|
-
|
|
100
|
-
jest.spyOn(events.serve, "servedBuilder")
|
|
101
|
-
jest.spyOn(events.serve, "servedApp")
|
|
102
|
-
jest.spyOn(events.serve, "servedAppPreview")
|
|
103
|
-
|
|
104
|
-
jest.spyOn(events.table, "created")
|
|
105
|
-
jest.spyOn(events.table, "updated")
|
|
106
|
-
jest.spyOn(events.table, "deleted")
|
|
107
|
-
jest.spyOn(events.table, "exported")
|
|
108
|
-
jest.spyOn(events.table, "imported")
|
|
109
|
-
|
|
110
|
-
jest.spyOn(events.view, "created")
|
|
111
|
-
jest.spyOn(events.view, "updated")
|
|
112
|
-
jest.spyOn(events.view, "deleted")
|
|
113
|
-
jest.spyOn(events.view, "exported")
|
|
114
|
-
jest.spyOn(events.view, "filterCreated")
|
|
115
|
-
jest.spyOn(events.view, "filterUpdated")
|
|
116
|
-
jest.spyOn(events.view, "filterDeleted")
|
|
117
|
-
jest.spyOn(events.view, "calculationCreated")
|
|
118
|
-
jest.spyOn(events.view, "calculationUpdated")
|
|
119
|
-
jest.spyOn(events.view, "calculationDeleted")
|
|
120
|
-
|
|
121
|
-
jest.spyOn(events.plugin, "init")
|
|
122
|
-
jest.spyOn(events.plugin, "imported")
|
|
123
|
-
jest.spyOn(events.plugin, "deleted")
|
|
124
|
-
|
|
125
|
-
jest.spyOn(events.license, "planChanged")
|
|
126
|
-
jest.spyOn(events.license, "activated")
|
|
127
|
-
jest.spyOn(events.license, "checkoutOpened")
|
|
128
|
-
jest.spyOn(events.license, "checkoutSuccess")
|
|
129
|
-
jest.spyOn(events.license, "portalOpened")
|
|
130
|
-
jest.spyOn(events.license, "paymentFailed")
|
|
131
|
-
jest.spyOn(events.license, "paymentRecovered")
|
|
132
|
-
})
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
jest.mock("../../../../src/accounts")
|
|
2
|
-
import * as _accounts from "../../../../src/accounts"
|
|
3
|
-
|
|
4
|
-
export const accounts = jest.mocked(_accounts)
|
|
5
|
-
|
|
6
|
-
export * as date from "./date"
|
|
7
|
-
export * as licenses from "./licenses"
|
|
8
|
-
export * from "./alerts"
|
|
9
|
-
import "./events"
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Feature, License, Quotas } from "@budibase/types"
|
|
2
|
-
import cloneDeep from "lodash/cloneDeep"
|
|
3
|
-
|
|
4
|
-
let CLOUD_FREE_LICENSE: License
|
|
5
|
-
let UNLIMITED_LICENSE: License
|
|
6
|
-
let getCachedLicense: any
|
|
7
|
-
|
|
8
|
-
// init for the packages other than pro
|
|
9
|
-
export function init(proPkg: any) {
|
|
10
|
-
initInternal({
|
|
11
|
-
CLOUD_FREE_LICENSE: proPkg.constants.licenses.CLOUD_FREE_LICENSE,
|
|
12
|
-
UNLIMITED_LICENSE: proPkg.constants.licenses.UNLIMITED_LICENSE,
|
|
13
|
-
getCachedLicense: proPkg.licensing.cache.getCachedLicense,
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// init for the pro package
|
|
18
|
-
export function initInternal(opts: {
|
|
19
|
-
CLOUD_FREE_LICENSE: License
|
|
20
|
-
UNLIMITED_LICENSE: License
|
|
21
|
-
getCachedLicense: any
|
|
22
|
-
}) {
|
|
23
|
-
CLOUD_FREE_LICENSE = opts.CLOUD_FREE_LICENSE
|
|
24
|
-
UNLIMITED_LICENSE = opts.UNLIMITED_LICENSE
|
|
25
|
-
getCachedLicense = opts.getCachedLicense
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface UseLicenseOpts {
|
|
29
|
-
features?: Feature[]
|
|
30
|
-
quotas?: Quotas
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// LICENSES
|
|
34
|
-
|
|
35
|
-
export const useLicense = (license: License, opts?: UseLicenseOpts) => {
|
|
36
|
-
if (opts) {
|
|
37
|
-
if (opts.features) {
|
|
38
|
-
license.features.push(...opts.features)
|
|
39
|
-
}
|
|
40
|
-
if (opts.quotas) {
|
|
41
|
-
license.quotas = opts.quotas
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getCachedLicense.mockReturnValue(license)
|
|
46
|
-
|
|
47
|
-
return license
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const useUnlimited = (opts?: UseLicenseOpts) => {
|
|
51
|
-
return useLicense(UNLIMITED_LICENSE, opts)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const useCloudFree = () => {
|
|
55
|
-
return useLicense(CLOUD_FREE_LICENSE)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// FEATURES
|
|
59
|
-
|
|
60
|
-
const useFeature = (feature: Feature) => {
|
|
61
|
-
const license = cloneDeep(getCachedLicense() || UNLIMITED_LICENSE)
|
|
62
|
-
const opts: UseLicenseOpts = {
|
|
63
|
-
features: [feature],
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return useLicense(license, opts)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const useBackups = () => {
|
|
70
|
-
return useFeature(Feature.APP_BACKUPS)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export const useEnforceableSSO = () => {
|
|
74
|
-
return useFeature(Feature.ENFORCEABLE_SSO)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const useGroups = () => {
|
|
78
|
-
return useFeature(Feature.USER_GROUPS)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export const useEnvironmentVariables = () => {
|
|
82
|
-
return useFeature(Feature.ENVIRONMENT_VARIABLES)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export const useAuditLogs = () => {
|
|
86
|
-
return useFeature(Feature.AUDIT_LOGS)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export const useExpandedPublicApi = () => {
|
|
90
|
-
return useFeature(Feature.EXPANDED_PUBLIC_API)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export const useScimIntegration = () => {
|
|
94
|
-
return useFeature(Feature.SCIM)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export const useSyncAutomations = () => {
|
|
98
|
-
return useFeature(Feature.SYNC_AUTOMATIONS)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const useAppBuilders = () => {
|
|
102
|
-
return useFeature(Feature.APP_BUILDERS)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const useBudibaseAI = () => {
|
|
106
|
-
return useFeature(Feature.BUDIBASE_AI)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const useAICustomConfigs = () => {
|
|
110
|
-
return useFeature(Feature.AI_CUSTOM_CONFIGS)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// QUOTAS
|
|
114
|
-
|
|
115
|
-
export const setAutomationLogsQuota = (value: number) => {
|
|
116
|
-
const license = cloneDeep(UNLIMITED_LICENSE)
|
|
117
|
-
license.quotas.constant.automationLogRetentionDays.value = value
|
|
118
|
-
return useLicense(license)
|
|
119
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Chance from "chance"
|
|
2
|
-
|
|
3
|
-
export default class CustomChance extends Chance {
|
|
4
|
-
arrayOf<T>(
|
|
5
|
-
generateFn: () => T,
|
|
6
|
-
opts: { min?: number; max?: number } = {}
|
|
7
|
-
): T[] {
|
|
8
|
-
const itemCount = this.integer({
|
|
9
|
-
min: opts.min != null ? opts.min : 1,
|
|
10
|
-
max: opts.max != null ? opts.max : 50,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const items = []
|
|
14
|
-
for (let i = 0; i < itemCount; i++) {
|
|
15
|
-
items.push(generateFn())
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return items
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { generator, quotas, uuid } from "."
|
|
2
|
-
import { generateGlobalUserID } from "../../../../src/docIds"
|
|
3
|
-
import {
|
|
4
|
-
Account,
|
|
5
|
-
AccountSSOProvider,
|
|
6
|
-
AccountSSOProviderType,
|
|
7
|
-
AuthType,
|
|
8
|
-
CloudAccount,
|
|
9
|
-
Hosting,
|
|
10
|
-
SSOAccount,
|
|
11
|
-
} from "@budibase/types"
|
|
12
|
-
import sample from "lodash/sample"
|
|
13
|
-
|
|
14
|
-
export const account = (partial: Partial<Account> = {}): Account => {
|
|
15
|
-
return {
|
|
16
|
-
accountId: uuid(),
|
|
17
|
-
tenantId: generator.word(),
|
|
18
|
-
email: generator.email({ domain: "example.com" }),
|
|
19
|
-
accountName: generator.word(),
|
|
20
|
-
tenantName: generator.word(),
|
|
21
|
-
hosting: Hosting.SELF,
|
|
22
|
-
createdAt: Date.now(),
|
|
23
|
-
verified: true,
|
|
24
|
-
verificationSent: true,
|
|
25
|
-
authType: AuthType.PASSWORD,
|
|
26
|
-
name: generator.name(),
|
|
27
|
-
size: "10+",
|
|
28
|
-
profession: "Software Engineer",
|
|
29
|
-
quotaUsage: quotas.usage(),
|
|
30
|
-
...partial,
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function selfHostAccount() {
|
|
35
|
-
return account()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const cloudAccount = (): CloudAccount => {
|
|
39
|
-
return {
|
|
40
|
-
...account(),
|
|
41
|
-
hosting: Hosting.CLOUD,
|
|
42
|
-
budibaseUserId: generateGlobalUserID(),
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function providerType(): AccountSSOProviderType {
|
|
47
|
-
return sample(Object.values(AccountSSOProviderType)) as AccountSSOProviderType
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function provider(): AccountSSOProvider {
|
|
51
|
-
return sample(Object.values(AccountSSOProvider)) as AccountSSOProvider
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function ssoAccount(account: Account = cloudAccount()): SSOAccount {
|
|
55
|
-
return {
|
|
56
|
-
...account,
|
|
57
|
-
authType: AuthType.SSO,
|
|
58
|
-
oauth2: {
|
|
59
|
-
accessToken: generator.string(),
|
|
60
|
-
refreshToken: generator.string(),
|
|
61
|
-
},
|
|
62
|
-
provider: provider(),
|
|
63
|
-
providerType: providerType(),
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function verifiableSsoAccount(
|
|
68
|
-
account: Account = cloudAccount()
|
|
69
|
-
): SSOAccount {
|
|
70
|
-
return {
|
|
71
|
-
...account,
|
|
72
|
-
authType: AuthType.SSO,
|
|
73
|
-
oauth2: {
|
|
74
|
-
accessToken: generator.string(),
|
|
75
|
-
refreshToken: generator.string(),
|
|
76
|
-
},
|
|
77
|
-
provider: AccountSSOProvider.MICROSOFT,
|
|
78
|
-
providerType: AccountSSOProviderType.MICROSOFT,
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { generator } from "."
|
|
2
|
-
import { App } from "@budibase/types"
|
|
3
|
-
import { DEFAULT_TENANT_ID, DocumentType } from "../../../../src/constants"
|
|
4
|
-
|
|
5
|
-
export function app(id: string): App {
|
|
6
|
-
return {
|
|
7
|
-
_id: DocumentType.APP_METADATA,
|
|
8
|
-
appId: id,
|
|
9
|
-
type: "",
|
|
10
|
-
version: "0.0.1",
|
|
11
|
-
componentLibraries: [],
|
|
12
|
-
name: generator.name(),
|
|
13
|
-
url: `/custom-url`,
|
|
14
|
-
instance: {
|
|
15
|
-
_id: id,
|
|
16
|
-
},
|
|
17
|
-
tenantId: DEFAULT_TENANT_ID,
|
|
18
|
-
status: "",
|
|
19
|
-
template: undefined,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { generator } from "./generator"
|
|
2
|
-
import { newid } from "../../../../src/docIds/newid"
|
|
3
|
-
|
|
4
|
-
export function id() {
|
|
5
|
-
return `db_${newid()}`
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function rev() {
|
|
9
|
-
return `${generator.character({
|
|
10
|
-
numeric: true,
|
|
11
|
-
})}-${generator.guid().replace(/-/, "")}`
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./platform"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as installation from "./installation"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { generator } from "../../generator"
|
|
2
|
-
import { Installation } from "@budibase/types"
|
|
3
|
-
import * as db from "../../db"
|
|
4
|
-
|
|
5
|
-
export function install(): Installation {
|
|
6
|
-
return {
|
|
7
|
-
_id: "install",
|
|
8
|
-
_rev: db.rev(),
|
|
9
|
-
installId: generator.guid(),
|
|
10
|
-
version: generator.string(),
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from "./common"
|
|
2
|
-
export * as accounts from "./accounts"
|
|
3
|
-
export * as apps from "./apps"
|
|
4
|
-
export * as db from "./db"
|
|
5
|
-
export * as docs from "./documents"
|
|
6
|
-
export * as koa from "./koa"
|
|
7
|
-
export * as licenses from "./licenses"
|
|
8
|
-
export * as plugins from "./plugins"
|
|
9
|
-
export * as sso from "./sso"
|
|
10
|
-
export * as tenant from "./tenants"
|
|
11
|
-
export * as users from "./users"
|
|
12
|
-
export * as userGroups from "./userGroups"
|
|
13
|
-
export { generator } from "./generator"
|
|
14
|
-
export * as scim from "./scim"
|
|
15
|
-
export * as quotas from "./quotas"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createMockContext, createMockCookies } from "@shopify/jest-koa-mocks"
|
|
2
|
-
import { BBContext } from "@budibase/types"
|
|
3
|
-
|
|
4
|
-
export const newContext = (): BBContext => {
|
|
5
|
-
const ctx = createMockContext() as any
|
|
6
|
-
return {
|
|
7
|
-
...ctx,
|
|
8
|
-
path: "/",
|
|
9
|
-
cookies: createMockCookies(),
|
|
10
|
-
request: {
|
|
11
|
-
...ctx.request,
|
|
12
|
-
headers: {},
|
|
13
|
-
body: {},
|
|
14
|
-
},
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Billing,
|
|
3
|
-
Customer,
|
|
4
|
-
Feature,
|
|
5
|
-
License,
|
|
6
|
-
OfflineIdentifier,
|
|
7
|
-
OfflineLicense,
|
|
8
|
-
PlanModel,
|
|
9
|
-
PlanType,
|
|
10
|
-
PriceDuration,
|
|
11
|
-
PurchasedPlan,
|
|
12
|
-
PurchasedPrice,
|
|
13
|
-
Quotas,
|
|
14
|
-
Subscription,
|
|
15
|
-
} from "@budibase/types"
|
|
16
|
-
import { generator } from "./generator"
|
|
17
|
-
|
|
18
|
-
export function price(): PurchasedPrice {
|
|
19
|
-
return {
|
|
20
|
-
amount: 10000,
|
|
21
|
-
amountMonthly: 10000,
|
|
22
|
-
currency: "usd",
|
|
23
|
-
duration: PriceDuration.MONTHLY,
|
|
24
|
-
priceId: "price_123",
|
|
25
|
-
dayPasses: undefined,
|
|
26
|
-
isPerUser: true,
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const plan = (type: PlanType = PlanType.FREE): PurchasedPlan => {
|
|
31
|
-
return {
|
|
32
|
-
type,
|
|
33
|
-
usesInvoicing: false,
|
|
34
|
-
model: PlanModel.PER_USER,
|
|
35
|
-
price: type !== PlanType.FREE ? price() : undefined,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function quotas(): Quotas {
|
|
40
|
-
return {
|
|
41
|
-
usage: {
|
|
42
|
-
monthly: {
|
|
43
|
-
queries: {
|
|
44
|
-
name: "Queries",
|
|
45
|
-
value: 1,
|
|
46
|
-
triggers: [],
|
|
47
|
-
},
|
|
48
|
-
automations: {
|
|
49
|
-
name: "Queries",
|
|
50
|
-
value: 1,
|
|
51
|
-
triggers: [],
|
|
52
|
-
},
|
|
53
|
-
dayPasses: {
|
|
54
|
-
name: "Queries",
|
|
55
|
-
value: 1,
|
|
56
|
-
triggers: [],
|
|
57
|
-
},
|
|
58
|
-
budibaseAICredits: {
|
|
59
|
-
name: "Budibase AI Credits",
|
|
60
|
-
value: 1,
|
|
61
|
-
triggers: [],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
static: {
|
|
65
|
-
rows: {
|
|
66
|
-
name: "Rows",
|
|
67
|
-
value: 1,
|
|
68
|
-
triggers: [],
|
|
69
|
-
},
|
|
70
|
-
apps: {
|
|
71
|
-
name: "Apps",
|
|
72
|
-
value: 1,
|
|
73
|
-
triggers: [],
|
|
74
|
-
},
|
|
75
|
-
users: {
|
|
76
|
-
name: "Users",
|
|
77
|
-
value: 1,
|
|
78
|
-
triggers: [],
|
|
79
|
-
},
|
|
80
|
-
creators: {
|
|
81
|
-
name: "Creators",
|
|
82
|
-
value: 1,
|
|
83
|
-
triggers: [],
|
|
84
|
-
},
|
|
85
|
-
userGroups: {
|
|
86
|
-
name: "User Groups",
|
|
87
|
-
value: 1,
|
|
88
|
-
triggers: [],
|
|
89
|
-
},
|
|
90
|
-
plugins: {
|
|
91
|
-
name: "Plugins",
|
|
92
|
-
value: 1,
|
|
93
|
-
triggers: [],
|
|
94
|
-
},
|
|
95
|
-
aiCustomConfigs: {
|
|
96
|
-
name: "Plugins",
|
|
97
|
-
value: 1,
|
|
98
|
-
triggers: [],
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
constant: {
|
|
103
|
-
automationLogRetentionDays: {
|
|
104
|
-
name: "Automation Logs",
|
|
105
|
-
value: 1,
|
|
106
|
-
triggers: [],
|
|
107
|
-
},
|
|
108
|
-
appBackupRetentionDays: {
|
|
109
|
-
name: "Backups",
|
|
110
|
-
value: 1,
|
|
111
|
-
triggers: [],
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export function billing(
|
|
118
|
-
opts: { customer?: Customer; subscription?: Subscription } = {}
|
|
119
|
-
): Billing {
|
|
120
|
-
return {
|
|
121
|
-
customer: opts.customer || customer(),
|
|
122
|
-
subscription: opts.subscription || subscription(),
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function customer(): Customer {
|
|
127
|
-
return {
|
|
128
|
-
balance: 0,
|
|
129
|
-
currency: "usd",
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function subscription(): Subscription {
|
|
134
|
-
return {
|
|
135
|
-
amount: 10000,
|
|
136
|
-
amounts: {
|
|
137
|
-
user: 10000,
|
|
138
|
-
creator: 0,
|
|
139
|
-
},
|
|
140
|
-
cancelAt: undefined,
|
|
141
|
-
currency: "usd",
|
|
142
|
-
currentPeriodEnd: 0,
|
|
143
|
-
currentPeriodStart: 0,
|
|
144
|
-
downgradeAt: 0,
|
|
145
|
-
duration: PriceDuration.MONTHLY,
|
|
146
|
-
pastDueAt: undefined,
|
|
147
|
-
quantity: 0,
|
|
148
|
-
quantities: {
|
|
149
|
-
user: 0,
|
|
150
|
-
creator: 0,
|
|
151
|
-
},
|
|
152
|
-
status: "active",
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
interface GenerateLicenseOpts {
|
|
157
|
-
quotas?: Quotas
|
|
158
|
-
plan?: PurchasedPlan
|
|
159
|
-
planType?: PlanType
|
|
160
|
-
features?: Feature[]
|
|
161
|
-
billing?: Billing
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export const license = (opts: GenerateLicenseOpts = {}): License => {
|
|
165
|
-
return {
|
|
166
|
-
features: opts.features || [],
|
|
167
|
-
quotas: opts.quotas || quotas(),
|
|
168
|
-
plan: opts.plan || plan(opts.planType),
|
|
169
|
-
billing: opts.billing || billing(),
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export function offlineLicense(opts: GenerateLicenseOpts = {}): OfflineLicense {
|
|
174
|
-
const base = license(opts)
|
|
175
|
-
return {
|
|
176
|
-
...base,
|
|
177
|
-
expireAt: new Date().toISOString(),
|
|
178
|
-
identifier: offlineIdentifier(),
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export function offlineIdentifier(
|
|
183
|
-
installId: string = generator.guid(),
|
|
184
|
-
tenantId: string = generator.guid()
|
|
185
|
-
): OfflineIdentifier {
|
|
186
|
-
return {
|
|
187
|
-
installId,
|
|
188
|
-
tenantId,
|
|
189
|
-
}
|
|
190
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { generator } from "."
|
|
2
|
-
import { Plugin, PluginSource, PluginType } from "@budibase/types"
|
|
3
|
-
|
|
4
|
-
export function plugin(): Plugin {
|
|
5
|
-
return {
|
|
6
|
-
description: generator.word(),
|
|
7
|
-
name: generator.word(),
|
|
8
|
-
version: "1.0.0",
|
|
9
|
-
source: PluginSource.FILE,
|
|
10
|
-
package: {
|
|
11
|
-
name: generator.word,
|
|
12
|
-
},
|
|
13
|
-
hash: generator.hash(),
|
|
14
|
-
schema: {
|
|
15
|
-
type: PluginType.DATASOURCE,
|
|
16
|
-
},
|
|
17
|
-
iconFileName: "icon.svg",
|
|
18
|
-
}
|
|
19
|
-
}
|