@budibase/backend-core 3.2.41 → 3.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +3 -3
- package/dist/src/accounts/accounts.js +83 -0
- package/dist/src/accounts/accounts.js.map +1 -0
- package/dist/src/accounts/api.js +102 -0
- package/dist/src/accounts/api.js.map +1 -0
- package/dist/src/accounts/index.js +18 -0
- package/dist/src/accounts/index.js.map +1 -0
- package/dist/src/cache/appMetadata.js +96 -0
- package/dist/src/cache/appMetadata.js.map +1 -0
- package/dist/src/cache/base/index.js +189 -0
- package/dist/src/cache/base/index.js.map +1 -0
- package/dist/src/cache/docWritethrough.js +123 -0
- package/dist/src/cache/docWritethrough.js.map +1 -0
- package/dist/src/cache/generic.js +37 -0
- package/dist/src/cache/generic.js.map +1 -0
- package/dist/src/cache/index.js +48 -0
- package/dist/src/cache/index.js.map +1 -0
- package/dist/src/cache/invite.js +128 -0
- package/dist/src/cache/invite.js.map +1 -0
- package/dist/src/cache/passwordReset.js +92 -0
- package/dist/src/cache/passwordReset.js.map +1 -0
- package/dist/src/cache/user.js +183 -0
- package/dist/src/cache/user.js.map +1 -0
- package/dist/src/cache/writethrough.js +170 -0
- package/dist/src/cache/writethrough.js.map +1 -0
- package/dist/src/configs/configs.js +294 -0
- package/dist/src/configs/configs.js.map +1 -0
- package/dist/src/configs/index.js +18 -0
- package/dist/src/configs/index.js.map +1 -0
- package/dist/src/constants/db.js +75 -0
- package/dist/src/constants/db.js.map +1 -0
- package/dist/src/constants/index.js +19 -0
- package/dist/src/constants/index.js.map +1 -0
- package/dist/src/constants/misc.js +40 -0
- package/dist/src/constants/misc.js.map +1 -0
- package/dist/src/context/Context.js +14 -0
- package/dist/src/context/Context.js.map +1 -0
- package/dist/src/context/identity.js +81 -0
- package/dist/src/context/identity.js.map +1 -0
- package/dist/src/context/index.js +44 -0
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/mainContext.js +446 -0
- package/dist/src/context/mainContext.js.map +1 -0
- package/dist/src/context/types.js +3 -0
- package/dist/src/context/types.js.map +1 -0
- package/dist/src/db/Replication.js +90 -0
- package/dist/src/db/Replication.js.map +1 -0
- package/dist/src/db/couch/DatabaseImpl.js +475 -0
- package/dist/src/db/couch/DatabaseImpl.js.map +1 -0
- package/dist/src/db/couch/connections.js +101 -0
- package/dist/src/db/couch/connections.js.map +1 -0
- package/dist/src/db/couch/index.js +26 -0
- package/dist/src/db/couch/index.js.map +1 -0
- package/dist/src/db/couch/pouchDB.js +108 -0
- package/dist/src/db/couch/pouchDB.js.map +1 -0
- package/dist/src/db/couch/utils.js +60 -0
- package/dist/src/db/couch/utils.js.map +1 -0
- package/dist/src/db/db.js +47 -0
- package/dist/src/db/db.js.map +1 -0
- package/dist/src/db/errors.js +21 -0
- package/dist/src/db/errors.js.map +1 -0
- package/dist/src/db/index.js +58 -0
- package/dist/src/db/index.js.map +1 -0
- package/dist/src/db/instrumentation.js +202 -0
- package/dist/src/db/instrumentation.js.map +1 -0
- package/dist/src/db/lucene.js +638 -0
- package/dist/src/db/lucene.js.map +1 -0
- package/dist/src/db/searchIndexes/index.js +18 -0
- package/dist/src/db/searchIndexes/index.js.map +1 -0
- package/dist/src/db/searchIndexes/searchIndexes.js +76 -0
- package/dist/src/db/searchIndexes/searchIndexes.js.map +1 -0
- package/dist/src/db/utils.js +212 -0
- package/dist/src/db/utils.js.map +1 -0
- package/dist/src/db/views.js +224 -0
- package/dist/src/db/views.js.map +1 -0
- package/dist/src/docIds/conversions.js +62 -0
- package/dist/src/docIds/conversions.js.map +1 -0
- package/dist/src/docIds/ids.js +125 -0
- package/dist/src/docIds/ids.js.map +1 -0
- package/dist/src/docIds/index.js +19 -0
- package/dist/src/docIds/index.js.map +1 -0
- package/dist/src/docIds/newid.js +8 -0
- package/dist/src/docIds/newid.js.map +1 -0
- package/dist/src/docIds/params.js +141 -0
- package/dist/src/docIds/params.js.map +1 -0
- package/dist/src/environment.js +182 -0
- package/dist/src/environment.js.map +1 -0
- package/dist/src/errors/errors.js +97 -0
- package/dist/src/errors/errors.js.map +1 -0
- package/dist/src/errors/index.js +18 -0
- package/dist/src/errors/index.js.map +1 -0
- package/dist/src/events/analytics.js +52 -0
- package/dist/src/events/analytics.js.map +1 -0
- package/dist/src/events/asyncEvents/index.js +19 -0
- package/dist/src/events/asyncEvents/index.js.map +1 -0
- package/dist/src/events/asyncEvents/publisher.js +26 -0
- package/dist/src/events/asyncEvents/publisher.js.map +1 -0
- package/dist/src/events/asyncEvents/queue.js +26 -0
- package/dist/src/events/asyncEvents/queue.js.map +1 -0
- package/dist/src/events/backfill.js +189 -0
- package/dist/src/events/backfill.js.map +1 -0
- package/dist/src/events/events.js +87 -0
- package/dist/src/events/events.js.map +1 -0
- package/dist/src/events/identification.js +299 -0
- package/dist/src/events/identification.js.map +1 -0
- package/dist/src/events/index.js +59 -0
- package/dist/src/events/index.js.map +1 -0
- package/dist/src/events/processors/AnalyticsProcessor.js +103 -0
- package/dist/src/events/processors/AnalyticsProcessor.js.map +1 -0
- package/dist/src/events/processors/AuditLogsProcessor.js +86 -0
- package/dist/src/events/processors/AuditLogsProcessor.js.map +1 -0
- package/dist/src/events/processors/LoggingProcessor.js +47 -0
- package/dist/src/events/processors/LoggingProcessor.js.map +1 -0
- package/dist/src/events/processors/Processors.js +52 -0
- package/dist/src/events/processors/Processors.js.map +1 -0
- package/dist/src/events/processors/index.js +23 -0
- package/dist/src/events/processors/index.js.map +1 -0
- package/dist/src/events/processors/posthog/PosthogProcessor.js +147 -0
- package/dist/src/events/processors/posthog/PosthogProcessor.js.map +1 -0
- package/dist/src/events/processors/posthog/index.js +8 -0
- package/dist/src/events/processors/posthog/index.js.map +1 -0
- package/dist/src/events/processors/posthog/rateLimiting.js +129 -0
- package/dist/src/events/processors/posthog/rateLimiting.js.map +1 -0
- package/dist/src/events/processors/types.js +3 -0
- package/dist/src/events/processors/types.js.map +1 -0
- package/dist/src/events/publishers/account.js +43 -0
- package/dist/src/events/publishers/account.js.map +1 -0
- package/dist/src/events/publishers/ai.js +30 -0
- package/dist/src/events/publishers/ai.js.map +1 -0
- package/dist/src/events/publishers/app.js +166 -0
- package/dist/src/events/publishers/app.js.map +1 -0
- package/dist/src/events/publishers/auditLog.js +34 -0
- package/dist/src/events/publishers/auditLog.js.map +1 -0
- package/dist/src/events/publishers/auth.js +80 -0
- package/dist/src/events/publishers/auth.js.map +1 -0
- package/dist/src/events/publishers/automation.js +117 -0
- package/dist/src/events/publishers/automation.js.map +1 -0
- package/dist/src/events/publishers/backfill.js +85 -0
- package/dist/src/events/publishers/backfill.js.map +1 -0
- package/dist/src/events/publishers/backup.js +41 -0
- package/dist/src/events/publishers/backup.js.map +1 -0
- package/dist/src/events/publishers/datasource.js +54 -0
- package/dist/src/events/publishers/datasource.js.map +1 -0
- package/dist/src/events/publishers/email.js +30 -0
- package/dist/src/events/publishers/email.js.map +1 -0
- package/dist/src/events/publishers/environmentVariable.js +44 -0
- package/dist/src/events/publishers/environmentVariable.js.map +1 -0
- package/dist/src/events/publishers/group.js +107 -0
- package/dist/src/events/publishers/group.js.map +1 -0
- package/dist/src/events/publishers/index.js +59 -0
- package/dist/src/events/publishers/index.js.map +1 -0
- package/dist/src/events/publishers/installation.js +52 -0
- package/dist/src/events/publishers/installation.js.map +1 -0
- package/dist/src/events/publishers/layout.js +34 -0
- package/dist/src/events/publishers/layout.js.map +1 -0
- package/dist/src/events/publishers/license.js +77 -0
- package/dist/src/events/publishers/license.js.map +1 -0
- package/dist/src/events/publishers/org.js +52 -0
- package/dist/src/events/publishers/org.js.map +1 -0
- package/dist/src/events/publishers/plugin.js +55 -0
- package/dist/src/events/publishers/plugin.js.map +1 -0
- package/dist/src/events/publishers/query.js +73 -0
- package/dist/src/events/publishers/query.js.map +1 -0
- package/dist/src/events/publishers/role.js +69 -0
- package/dist/src/events/publishers/role.js.map +1 -0
- package/dist/src/events/publishers/rowAction.js +22 -0
- package/dist/src/events/publishers/rowAction.js.map +1 -0
- package/dist/src/events/publishers/rows.js +31 -0
- package/dist/src/events/publishers/rows.js.map +1 -0
- package/dist/src/events/publishers/screen.js +46 -0
- package/dist/src/events/publishers/screen.js.map +1 -0
- package/dist/src/events/publishers/serve.js +47 -0
- package/dist/src/events/publishers/serve.js.map +1 -0
- package/dist/src/events/publishers/table.js +95 -0
- package/dist/src/events/publishers/table.js.map +1 -0
- package/dist/src/events/publishers/user.js +201 -0
- package/dist/src/events/publishers/user.js.map +1 -0
- package/dist/src/events/publishers/view.js +123 -0
- package/dist/src/events/publishers/view.js.map +1 -0
- package/dist/src/helpers.js +13 -0
- package/dist/src/helpers.js.map +1 -0
- package/dist/src/installation.js +159 -0
- package/dist/src/installation.js.map +1 -0
- package/dist/src/logging/alerts.js +23 -0
- package/dist/src/logging/alerts.js.map +1 -0
- package/dist/src/logging/correlation/correlation.js +18 -0
- package/dist/src/logging/correlation/correlation.js.map +1 -0
- package/dist/src/logging/correlation/index.js +18 -0
- package/dist/src/logging/correlation/index.js.map +1 -0
- package/dist/src/logging/index.js +45 -0
- package/dist/src/logging/index.js.map +1 -0
- package/dist/src/logging/pino/logger.js +234 -0
- package/dist/src/logging/pino/logger.js.map +1 -0
- package/dist/src/logging/system.js +110 -0
- package/dist/src/logging/system.js.map +1 -0
- package/dist/src/objectStore/buckets/app.js +95 -0
- package/dist/src/objectStore/buckets/app.js.map +1 -0
- package/dist/src/objectStore/buckets/global.js +68 -0
- package/dist/src/objectStore/buckets/global.js.map +1 -0
- package/dist/src/objectStore/buckets/index.js +20 -0
- package/dist/src/objectStore/buckets/index.js.map +1 -0
- package/dist/src/objectStore/buckets/plugins.js +104 -0
- package/dist/src/objectStore/buckets/plugins.js.map +1 -0
- package/dist/src/objectStore/cloudfront.js +73 -0
- package/dist/src/objectStore/cloudfront.js.map +1 -0
- package/dist/src/objectStore/index.js +20 -0
- package/dist/src/objectStore/index.js.map +1 -0
- package/dist/src/objectStore/objectStore.js +509 -0
- package/dist/src/objectStore/objectStore.js.map +1 -0
- package/dist/src/objectStore/utils.js +148 -0
- package/dist/src/objectStore/utils.js.map +1 -0
- package/dist/src/platform/index.js +43 -0
- package/dist/src/platform/index.js.map +1 -0
- package/dist/src/platform/platformDb.js +9 -0
- package/dist/src/platform/platformDb.js.map +1 -0
- package/dist/src/platform/tenants.js +149 -0
- package/dist/src/platform/tenants.js.map +1 -0
- package/dist/src/platform/users.js +118 -0
- package/dist/src/platform/users.js.map +1 -0
- package/dist/src/queue/constants.js +13 -0
- package/dist/src/queue/constants.js.map +1 -0
- package/dist/src/queue/inMemoryQueue.js +192 -0
- package/dist/src/queue/inMemoryQueue.js.map +1 -0
- package/dist/src/queue/index.js +19 -0
- package/dist/src/queue/index.js.map +1 -0
- package/dist/src/queue/listeners.js +199 -0
- package/dist/src/queue/listeners.js.map +1 -0
- package/dist/src/queue/queue.js +124 -0
- package/dist/src/queue/queue.js.map +1 -0
- package/dist/src/redis/index.js +47 -0
- package/dist/src/redis/index.js.map +1 -0
- package/dist/src/redis/init.js +184 -0
- package/dist/src/redis/init.js.map +1 -0
- package/dist/src/redis/redis.js +396 -0
- package/dist/src/redis/redis.js.map +1 -0
- package/dist/src/redis/redlockImpl.js +181 -0
- package/dist/src/redis/redlockImpl.js.map +1 -0
- package/dist/src/redis/utils.js +131 -0
- package/dist/src/redis/utils.js.map +1 -0
- package/dist/src/security/auth.js +26 -0
- package/dist/src/security/auth.js.map +1 -0
- package/dist/src/security/index.js +18 -0
- package/dist/src/security/index.js.map +1 -0
- package/dist/src/security/roles.js +566 -0
- package/dist/src/security/roles.js.map +1 -0
- package/dist/src/security/sessions.js +156 -0
- package/dist/src/security/sessions.js.map +1 -0
- package/dist/src/sql/utils.js +180 -0
- package/dist/src/sql/utils.js.map +1 -0
- package/dist/src/tenancy/db.js +9 -0
- package/dist/src/tenancy/db.js.map +1 -0
- package/dist/src/tenancy/index.js +19 -0
- package/dist/src/tenancy/index.js.map +1 -0
- package/dist/src/tenancy/tenancy.js +125 -0
- package/dist/src/tenancy/tenancy.js.map +1 -0
- package/dist/src/timers/index.js +18 -0
- package/dist/src/timers/index.js.map +1 -0
- package/dist/src/timers/timers.js +25 -0
- package/dist/src/timers/timers.js.map +1 -0
- package/dist/src/users/db.js +489 -0
- package/dist/src/users/db.js.map +1 -0
- package/dist/src/users/events.js +179 -0
- package/dist/src/users/events.js.map +1 -0
- package/dist/src/users/index.js +23 -0
- package/dist/src/users/index.js.map +1 -0
- package/dist/src/users/lookup.js +126 -0
- package/dist/src/users/lookup.js.map +1 -0
- package/dist/src/users/users.js +376 -0
- package/dist/src/users/users.js.map +1 -0
- package/dist/src/users/utils.js +127 -0
- package/dist/src/users/utils.js.map +1 -0
- package/dist/src/utils/Duration.js +54 -0
- package/dist/src/utils/Duration.js.map +1 -0
- package/dist/src/utils/hashing.js +46 -0
- package/dist/src/utils/hashing.js.map +1 -0
- package/dist/src/utils/index.js +21 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/stringUtils.js +8 -0
- package/dist/src/utils/stringUtils.js.map +1 -0
- package/dist/src/utils/utils.js +267 -0
- package/dist/src/utils/utils.js.map +1 -0
- package/dist/tests/core/logging.js +33 -0
- package/dist/tests/core/logging.js.map +1 -0
- package/dist/tests/core/utilities/index.js +48 -0
- package/dist/tests/core/utilities/index.js.map +1 -0
- package/dist/tests/core/utilities/jestUtils.js +21 -0
- package/dist/tests/core/utilities/jestUtils.js.map +1 -0
- package/dist/tests/core/utilities/mocks/alerts.js +40 -0
- package/dist/tests/core/utilities/mocks/alerts.js.map +1 -0
- package/dist/tests/core/utilities/mocks/date.js +6 -0
- package/dist/tests/core/utilities/mocks/date.js.map +1 -0
- package/dist/tests/core/utilities/mocks/events.js +155 -0
- package/dist/tests/core/utilities/mocks/events.js.map +1 -0
- package/dist/tests/core/utilities/mocks/index.js +47 -0
- package/dist/tests/core/utilities/mocks/index.js.map +1 -0
- package/dist/tests/core/utilities/mocks/licenses.js +109 -0
- package/dist/tests/core/utilities/mocks/licenses.js.map +1 -0
- package/dist/tests/core/utilities/queue.js +21 -0
- package/dist/tests/core/utilities/queue.js.map +1 -0
- package/dist/tests/core/utilities/structures/Chance.js +21 -0
- package/dist/tests/core/utilities/structures/Chance.js.map +1 -0
- package/dist/tests/core/utilities/structures/accounts.js +43 -0
- package/dist/tests/core/utilities/structures/accounts.js.map +1 -0
- package/dist/tests/core/utilities/structures/apps.js +23 -0
- package/dist/tests/core/utilities/structures/apps.js.map +1 -0
- package/dist/tests/core/utilities/structures/common.js +11 -0
- package/dist/tests/core/utilities/structures/common.js.map +1 -0
- package/dist/tests/core/utilities/structures/db.js +15 -0
- package/dist/tests/core/utilities/structures/db.js.map +1 -0
- package/dist/tests/core/utilities/structures/documents/index.js +18 -0
- package/dist/tests/core/utilities/structures/documents/index.js.map +1 -0
- package/dist/tests/core/utilities/structures/documents/platform/index.js +38 -0
- package/dist/tests/core/utilities/structures/documents/platform/index.js.map +1 -0
- package/dist/tests/core/utilities/structures/documents/platform/installation.js +47 -0
- package/dist/tests/core/utilities/structures/documents/platform/installation.js.map +1 -0
- package/dist/tests/core/utilities/structures/generator.js +9 -0
- package/dist/tests/core/utilities/structures/generator.js.map +1 -0
- package/dist/tests/core/utilities/structures/index.js +56 -0
- package/dist/tests/core/utilities/structures/index.js.map +1 -0
- package/dist/tests/core/utilities/structures/koa.js +10 -0
- package/dist/tests/core/utilities/structures/koa.js.map +1 -0
- package/dist/tests/core/utilities/structures/licenses.js +157 -0
- package/dist/tests/core/utilities/structures/licenses.js.map +1 -0
- package/dist/tests/core/utilities/structures/plugins.js +22 -0
- package/dist/tests/core/utilities/structures/plugins.js.map +1 -0
- package/dist/tests/core/utilities/structures/quotas.js +73 -0
- package/dist/tests/core/utilities/structures/quotas.js.map +1 -0
- package/dist/tests/core/utilities/structures/scim.js +62 -0
- package/dist/tests/core/utilities/structures/scim.js.map +1 -0
- package/dist/tests/core/utilities/structures/sso.js +140 -0
- package/dist/tests/core/utilities/structures/sso.js.map +1 -0
- package/dist/tests/core/utilities/structures/tenants.js +8 -0
- package/dist/tests/core/utilities/structures/tenants.js.map +1 -0
- package/dist/tests/core/utilities/structures/userGroups.js +12 -0
- package/dist/tests/core/utilities/structures/userGroups.js.map +1 -0
- package/dist/tests/core/utilities/structures/users.js +53 -0
- package/dist/tests/core/utilities/structures/users.js.map +1 -0
- package/dist/tests/core/utilities/testContainerUtils.js +161 -0
- package/dist/tests/core/utilities/testContainerUtils.js.map +1 -0
- package/dist/tests/core/utilities/utils/index.js +39 -0
- package/dist/tests/core/utilities/utils/index.js.map +1 -0
- package/dist/tests/core/utilities/utils/queue.js +37 -0
- package/dist/tests/core/utilities/utils/queue.js.map +1 -0
- package/dist/tests/core/utilities/utils/time.js +7 -0
- package/dist/tests/core/utilities/utils/time.js.map +1 -0
- package/dist/tests/extra/DBTestConfiguration.js +65 -0
- package/dist/tests/extra/DBTestConfiguration.js.map +1 -0
- package/dist/tests/extra/index.js +43 -0
- package/dist/tests/extra/index.js.map +1 -0
- package/dist/tests/extra/testEnv.js +136 -0
- package/dist/tests/extra/testEnv.js.map +1 -0
- package/dist/tests/index.js +19 -0
- package/dist/tests/index.js.map +1 -0
- package/dist/tests/jestEnv.js +12 -0
- package/dist/tests/jestEnv.js.map +1 -0
- package/dist/tests/jestSetup.js +33 -0
- package/dist/tests/jestSetup.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
class Processor {
|
|
13
|
+
constructor(processors) {
|
|
14
|
+
this.initialised = false;
|
|
15
|
+
this.processors = [];
|
|
16
|
+
this.processors = processors;
|
|
17
|
+
}
|
|
18
|
+
processEvent(event, identity, properties, timestamp) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
for (const eventProcessor of this.processors) {
|
|
21
|
+
yield eventProcessor.processEvent(event, identity, properties, timestamp);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
identify(identity, timestamp) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
for (const eventProcessor of this.processors) {
|
|
28
|
+
if (eventProcessor.identify) {
|
|
29
|
+
yield eventProcessor.identify(identity, timestamp);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
identifyGroup(identity, timestamp) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
for (const eventProcessor of this.processors) {
|
|
37
|
+
if (eventProcessor.identifyGroup) {
|
|
38
|
+
yield eventProcessor.identifyGroup(identity, timestamp);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
shutdown() {
|
|
44
|
+
for (const eventProcessor of this.processors) {
|
|
45
|
+
if (eventProcessor.shutdown) {
|
|
46
|
+
eventProcessor.shutdown();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = Processor;
|
|
52
|
+
//# sourceMappingURL=Processors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Processors.js","sourceRoot":"","sources":["../../../../src/events/processors/Processors.ts"],"names":[],"mappings":";;;;;;;;;;;AAG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(mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.processors = exports.analyticsProcessor = void 0;
|
|
7
|
+
exports.init = init;
|
|
8
|
+
const AnalyticsProcessor_1 = __importDefault(require("./AnalyticsProcessor"));
|
|
9
|
+
const LoggingProcessor_1 = __importDefault(require("./LoggingProcessor"));
|
|
10
|
+
const AuditLogsProcessor_1 = __importDefault(require("./AuditLogsProcessor"));
|
|
11
|
+
const Processors_1 = __importDefault(require("./Processors"));
|
|
12
|
+
exports.analyticsProcessor = new AnalyticsProcessor_1.default();
|
|
13
|
+
const loggingProcessor = new LoggingProcessor_1.default();
|
|
14
|
+
const auditLogsProcessor = new AuditLogsProcessor_1.default();
|
|
15
|
+
function init(auditingFn) {
|
|
16
|
+
return AuditLogsProcessor_1.default.init(auditingFn);
|
|
17
|
+
}
|
|
18
|
+
exports.processors = new Processors_1.default([
|
|
19
|
+
exports.analyticsProcessor,
|
|
20
|
+
loggingProcessor,
|
|
21
|
+
auditLogsProcessor,
|
|
22
|
+
]);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/events/processors/index.ts"],"names":[],"mappings":";;;;;;AAUA,oBAEC;AAZD,8EAAqD;AACrD,0EAAiD;AACjD,8EAAqD;AACrD,8DAAqC;AAGxB,QAAA,kBAAkB,GAAG,IAAI,4BAAkB,EAAE,CAAA;AAC1D,MAAM,gBAAgB,GAAG,IAAI,0BAAgB,EAAE,CAAA;AAC/C,MAAM,kBAAkB,GAAG,IAAI,4BAAkB,EAAE,CAAA;AAEnD,SAAgB,IAAI,CAAC,UAAsB;IACzC,OAAO,4BAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAC5C,CAAC;AAEY,QAAA,UAAU,GAAG,IAAI,oBAAU,CAAC;IACvC,0BAAkB;IAClB,gBAAgB;IAChB,kBAAkB;CACnB,CAAC,CAAA"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
const posthog_node_1 = require("posthog-node");
|
|
49
|
+
const types_1 = require("@budibase/types");
|
|
50
|
+
const environment_1 = __importDefault(require("../../../environment"));
|
|
51
|
+
const context = __importStar(require("../../../context"));
|
|
52
|
+
const rateLimiting = __importStar(require("./rateLimiting"));
|
|
53
|
+
const EXCLUDED_EVENTS = [
|
|
54
|
+
types_1.Event.USER_UPDATED,
|
|
55
|
+
types_1.Event.EMAIL_SMTP_UPDATED,
|
|
56
|
+
types_1.Event.AUTH_SSO_UPDATED,
|
|
57
|
+
types_1.Event.APP_UPDATED,
|
|
58
|
+
types_1.Event.ROLE_UPDATED,
|
|
59
|
+
types_1.Event.DATASOURCE_UPDATED,
|
|
60
|
+
types_1.Event.QUERY_UPDATED,
|
|
61
|
+
types_1.Event.VIEW_UPDATED,
|
|
62
|
+
types_1.Event.VIEW_CALCULATION_UPDATED,
|
|
63
|
+
types_1.Event.AUTOMATION_TRIGGER_UPDATED,
|
|
64
|
+
types_1.Event.USER_GROUP_UPDATED,
|
|
65
|
+
];
|
|
66
|
+
class PosthogProcessor {
|
|
67
|
+
constructor(token) {
|
|
68
|
+
if (!token) {
|
|
69
|
+
throw new Error("Posthog token is not defined");
|
|
70
|
+
}
|
|
71
|
+
this.posthog = new posthog_node_1.PostHog(token);
|
|
72
|
+
}
|
|
73
|
+
processEvent(event, identity, properties, timestamp) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
// don't send excluded events
|
|
76
|
+
if (EXCLUDED_EVENTS.includes(event)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (yield rateLimiting.limited(event)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
properties = this.clearPIIProperties(properties);
|
|
83
|
+
properties.version = environment_1.default.VERSION;
|
|
84
|
+
properties.service = environment_1.default.SERVICE;
|
|
85
|
+
properties.environment = identity.environment;
|
|
86
|
+
properties.hosting = identity.hosting;
|
|
87
|
+
const appId = context.getAppId();
|
|
88
|
+
if (appId) {
|
|
89
|
+
properties.appId = appId;
|
|
90
|
+
}
|
|
91
|
+
const payload = { distinctId: identity.id, event, properties };
|
|
92
|
+
if (timestamp) {
|
|
93
|
+
payload.timestamp = new Date(timestamp);
|
|
94
|
+
}
|
|
95
|
+
// add groups to the event
|
|
96
|
+
if (identity.installationId || identity.tenantId) {
|
|
97
|
+
payload.groups = {};
|
|
98
|
+
if (identity.installationId) {
|
|
99
|
+
payload.groups.installation = identity.installationId;
|
|
100
|
+
payload.properties.installationId = identity.installationId;
|
|
101
|
+
}
|
|
102
|
+
if (identity.tenantId) {
|
|
103
|
+
payload.groups.tenant = identity.tenantId;
|
|
104
|
+
payload.properties.tenantId = identity.tenantId;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this.posthog.capture(payload);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
clearPIIProperties(properties) {
|
|
111
|
+
if (properties.email) {
|
|
112
|
+
delete properties.email;
|
|
113
|
+
}
|
|
114
|
+
if (properties.audited) {
|
|
115
|
+
delete properties.audited;
|
|
116
|
+
}
|
|
117
|
+
return properties;
|
|
118
|
+
}
|
|
119
|
+
identify(identity, timestamp) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const payload = { distinctId: identity.id, properties: identity };
|
|
122
|
+
if (timestamp) {
|
|
123
|
+
payload.timestamp = new Date(timestamp);
|
|
124
|
+
}
|
|
125
|
+
this.posthog.identify(payload);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
identifyGroup(group, timestamp) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
const payload = {
|
|
131
|
+
distinctId: group.id,
|
|
132
|
+
groupType: group.type,
|
|
133
|
+
groupKey: group.id,
|
|
134
|
+
properties: group,
|
|
135
|
+
};
|
|
136
|
+
if (timestamp) {
|
|
137
|
+
payload.timestamp = new Date(timestamp);
|
|
138
|
+
}
|
|
139
|
+
this.posthog.groupIdentify(payload);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
shutdown() {
|
|
143
|
+
this.posthog.shutdown();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.default = PosthogProcessor;
|
|
147
|
+
//# sourceMappingURL=PosthogProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PosthogProcessor.js","sourceRoot":"","sources":["../../../../../src/events/processors/posthog/PosthogProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsC;AACtC,2CAAmE;AAEnE,uEAAsC;AACtC,0DAA2C;AAC3C,6DAA8C;AAE9C,MAAM,eAAe,GAAY;IAC/B,aAAK,CAAC,YAAY;IAClB,aAAK,CAAC,kBAAkB;IACxB,aAAK,CAAC,gBAAgB;IACtB,aAAK,CAAC,WAAW;IACjB,aAAK,CAAC,YAAY;IAClB,aAAK,CAAC,kBAAkB;IACxB,aAAK,CAAC,aAAa;IACnB,aAAK,CAAC,YAAY;IAClB,aAAK,CAAC,wBAAwB;IAC9B,aAAK,CAAC,0BAA0B;IAChC,aAAK,CAAC,kBAAkB;CACzB,CA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AAE;gBAClB,UAAU,EAAE,KAAK;aAClB,CAAA;YAED,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAA;YACzC,CAAC;YACD,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;KAAA;IAED,QAAQ;QACN,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAA;IACzB,CAAC;CACF;AA9FD,mCA8FC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const PosthogProcessor_1 = __importDefault(require("./PosthogProcessor"));
|
|
7
|
+
exports.default = PosthogProcessor_1.default;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/events/processors/posthog/index.ts"],"names":[],"mappings":";;;;;AAAA,0EAAiD;AAEjD,kBAAe,0BAAgB,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.limited = void 0;
|
|
46
|
+
const types_1 = require("@budibase/types");
|
|
47
|
+
const generic_1 = require("../../../cache/generic");
|
|
48
|
+
const cache = __importStar(require("../../../cache/generic"));
|
|
49
|
+
const context = __importStar(require("../../../context"));
|
|
50
|
+
const isRateLimited = (event) => {
|
|
51
|
+
return (event === types_1.Event.SERVED_BUILDER ||
|
|
52
|
+
event === types_1.Event.SERVED_APP_PREVIEW ||
|
|
53
|
+
event === types_1.Event.SERVED_APP);
|
|
54
|
+
};
|
|
55
|
+
const isPerApp = (event) => {
|
|
56
|
+
return event === types_1.Event.SERVED_APP_PREVIEW || event === types_1.Event.SERVED_APP;
|
|
57
|
+
};
|
|
58
|
+
var RateLimit;
|
|
59
|
+
(function (RateLimit) {
|
|
60
|
+
RateLimit["CALENDAR_DAY"] = "calendarDay";
|
|
61
|
+
})(RateLimit || (RateLimit = {}));
|
|
62
|
+
const RATE_LIMITS = {
|
|
63
|
+
[types_1.Event.SERVED_APP]: RateLimit.CALENDAR_DAY,
|
|
64
|
+
[types_1.Event.SERVED_APP_PREVIEW]: RateLimit.CALENDAR_DAY,
|
|
65
|
+
[types_1.Event.SERVED_BUILDER]: RateLimit.CALENDAR_DAY,
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Check if this event should be sent right now
|
|
69
|
+
* Return false to signal the event SHOULD be sent
|
|
70
|
+
* Return true to signal the event should NOT be sent
|
|
71
|
+
*/
|
|
72
|
+
const limited = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
// not a rate limited event -- send
|
|
74
|
+
if (!isRateLimited(event)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const cachedEvent = yield readEvent(event);
|
|
78
|
+
if (cachedEvent) {
|
|
79
|
+
const timestamp = new Date(cachedEvent.timestamp);
|
|
80
|
+
const limit = RATE_LIMITS[event];
|
|
81
|
+
switch (limit) {
|
|
82
|
+
case RateLimit.CALENDAR_DAY: {
|
|
83
|
+
// get midnight at the start of the next day for the timestamp
|
|
84
|
+
timestamp.setDate(timestamp.getDate() + 1);
|
|
85
|
+
timestamp.setHours(0, 0, 0, 0);
|
|
86
|
+
// if we have passed the threshold into the next day
|
|
87
|
+
if (Date.now() > timestamp.getTime()) {
|
|
88
|
+
// update the timestamp in the event -- send
|
|
89
|
+
yield recordEvent(event, { timestamp: Date.now() });
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// still within the limited period -- don't send
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// no event present i.e. expired -- send
|
|
101
|
+
yield recordEvent(event, { timestamp: Date.now() });
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
exports.limited = limited;
|
|
106
|
+
const eventKey = (event) => {
|
|
107
|
+
let key = `${generic_1.CacheKey.EVENTS_RATE_LIMIT}:${event}`;
|
|
108
|
+
if (isPerApp(event)) {
|
|
109
|
+
key = key + ":" + context.getAppId();
|
|
110
|
+
}
|
|
111
|
+
return key;
|
|
112
|
+
};
|
|
113
|
+
const readEvent = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
const key = eventKey(event);
|
|
115
|
+
const result = yield cache.get(key);
|
|
116
|
+
return result;
|
|
117
|
+
});
|
|
118
|
+
const recordEvent = (event, properties) => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
+
const key = eventKey(event);
|
|
120
|
+
const limit = RATE_LIMITS[event];
|
|
121
|
+
let ttl;
|
|
122
|
+
switch (limit) {
|
|
123
|
+
case RateLimit.CALENDAR_DAY: {
|
|
124
|
+
ttl = generic_1.TTL.ONE_DAY;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
yield cache.store(key, properties, ttl);
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=rateLimiting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimiting.js","sourceRoot":"","sources":["../../../../../src/events/processors/posthog/rateLimiting.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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MAAyB,CAAA;AAClC,CAAC,CAAA,CAAA;AAED,MAAM,WAAW,GAAG,CAClB,KAAuB,EACvB,UAA2B,EAC3B,EAAE;IACF,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3B,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,GAAG,CAAA;IACP,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;YAC5B,GAAG,GAAG,aAAG,CAAC,OAAO,CAAA;QACnB,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAA;AACzC,CAAC,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/events/processors/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const events_1 = require("../events");
|
|
13
|
+
const types_1 = require("@budibase/types");
|
|
14
|
+
function created(account, identityOverride) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const properties = {
|
|
17
|
+
tenantId: account.tenantId,
|
|
18
|
+
};
|
|
19
|
+
yield (0, events_1.publishEvent)(types_1.Event.ACCOUNT_CREATED, properties, undefined, identityOverride);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function deleted(account) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const properties = {
|
|
25
|
+
tenantId: account.tenantId,
|
|
26
|
+
};
|
|
27
|
+
yield (0, events_1.publishEvent)(types_1.Event.ACCOUNT_DELETED, properties);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function verified(account) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const properties = {
|
|
33
|
+
tenantId: account.tenantId,
|
|
34
|
+
};
|
|
35
|
+
yield (0, events_1.publishEvent)(types_1.Event.ACCOUNT_VERIFIED, properties);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.default = {
|
|
39
|
+
created,
|
|
40
|
+
deleted,
|
|
41
|
+
verified,
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/events/publishers/account.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAwC;AACxC,2CAOwB;AAExB,SAAe,OAAO,CAAC,OAAgB,EAAE,gBAA2B;;QAClE,MAAM,UAAU,GAAwB;YACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAA;QACD,MAAM,IAAA,qBAAY,EAChB,aAAK,CAAC,eAAe,EACrB,UAAU,EACV,SAAS,EACT,gBAAgB,CACjB,CAAA;IACH,CAAC;CAAA;AAED,SAAe,OAAO,CAAC,OAAgB;;QACrC,MAAM,UAAU,GAAwB;YACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAA;QACD,MAAM,IAAA,qBAAY,EAAC,aAAK,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;IACvD,CAAC;CAAA;AAED,SAAe,QAAQ,CAAC,OAAgB;;QACtC,MAAM,UAAU,GAAyB;YACvC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAA;QACD,MAAM,IAAA,qBAAY,EAAC,aAAK,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;IACxD,CAAC;CAAA;AAED,kBAAe;IACb,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const events_1 = require("../events");
|
|
13
|
+
const types_1 = require("@budibase/types");
|
|
14
|
+
function AIConfigCreated(timestamp) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const properties = {};
|
|
17
|
+
yield (0, events_1.publishEvent)(types_1.Event.AI_CONFIG_CREATED, properties, timestamp);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function AIConfigUpdated() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const properties = {};
|
|
23
|
+
yield (0, events_1.publishEvent)(types_1.Event.AI_CONFIG_UPDATED, properties);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.default = {
|
|
27
|
+
AIConfigCreated,
|
|
28
|
+
AIConfigUpdated,
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../../../../src/events/publishers/ai.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAwC;AACxC,2CAIwB;AAExB,SAAe,eAAe,CAAC,SAA2B;;QACxD,MAAM,UAAU,GAAyB,EAAE,CAAA;QAC3C,MAAM,IAAA,qBAAY,EAAC,aAAK,CAAC,iBAAiB,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;IACpE,CAAC;CAAA;AAED,SAAe,eAAe;;QAC5B,MAAM,UAAU,GAAyB,EAAE,CAAA;QAC3C,MAAM,IAAA,qBAAY,EAAC,aAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAA;IACzD,CAAC;CAAA;AAED,kBAAe;IACb,eAAe;IACf,eAAe;CAChB,CAAA"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const events_1 = require("../events");
|
|
13
|
+
const types_1 = require("@budibase/types");
|
|
14
|
+
const created = (app, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const properties = {
|
|
16
|
+
appId: app.appId,
|
|
17
|
+
version: app.version,
|
|
18
|
+
audited: {
|
|
19
|
+
name: app.name,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_CREATED, properties, timestamp);
|
|
23
|
+
});
|
|
24
|
+
function updated(app) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const properties = {
|
|
27
|
+
appId: app.appId,
|
|
28
|
+
version: app.version,
|
|
29
|
+
audited: {
|
|
30
|
+
name: app.name,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_UPDATED, properties);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function deleted(app) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const properties = {
|
|
39
|
+
appId: app.appId,
|
|
40
|
+
audited: {
|
|
41
|
+
name: app.name,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_DELETED, properties);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function published(app, timestamp) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const properties = {
|
|
50
|
+
appId: app.appId,
|
|
51
|
+
audited: {
|
|
52
|
+
name: app.name,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_PUBLISHED, properties, timestamp);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function unpublished(app) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const properties = {
|
|
61
|
+
appId: app.appId,
|
|
62
|
+
audited: {
|
|
63
|
+
name: app.name,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_UNPUBLISHED, properties);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function fileImported(app) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const properties = {
|
|
72
|
+
appId: app.appId,
|
|
73
|
+
audited: {
|
|
74
|
+
name: app.name,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_FILE_IMPORTED, properties);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function duplicated(app, duplicateAppId) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const properties = {
|
|
83
|
+
duplicateAppId,
|
|
84
|
+
appId: app.appId,
|
|
85
|
+
audited: {
|
|
86
|
+
name: app.name,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_DUPLICATED, properties);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function templateImported(app, templateKey) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const properties = {
|
|
95
|
+
appId: app.appId,
|
|
96
|
+
templateKey,
|
|
97
|
+
audited: {
|
|
98
|
+
name: app.name,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_TEMPLATE_IMPORTED, properties);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function versionUpdated(app, currentVersion, updatedToVersion) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const properties = {
|
|
107
|
+
appId: app.appId,
|
|
108
|
+
currentVersion,
|
|
109
|
+
updatedToVersion,
|
|
110
|
+
audited: {
|
|
111
|
+
name: app.name,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_VERSION_UPDATED, properties);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function versionReverted(app, currentVersion, revertedToVersion) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
const properties = {
|
|
120
|
+
appId: app.appId,
|
|
121
|
+
currentVersion,
|
|
122
|
+
revertedToVersion,
|
|
123
|
+
audited: {
|
|
124
|
+
name: app.name,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_VERSION_REVERTED, properties);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function reverted(app) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const properties = {
|
|
133
|
+
appId: app.appId,
|
|
134
|
+
audited: {
|
|
135
|
+
name: app.name,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_REVERTED, properties);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function exported(app) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const properties = {
|
|
144
|
+
appId: app.appId,
|
|
145
|
+
audited: {
|
|
146
|
+
name: app.name,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
yield (0, events_1.publishEvent)(types_1.Event.APP_EXPORTED, properties);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
exports.default = {
|
|
153
|
+
created,
|
|
154
|
+
updated,
|
|
155
|
+
deleted,
|
|
156
|
+
published,
|
|
157
|
+
unpublished,
|
|
158
|
+
fileImported,
|
|
159
|
+
duplicated,
|
|
160
|
+
templateImported,
|
|
161
|
+
versionUpdated,
|
|
162
|
+
versionReverted,
|
|
163
|
+
reverted,
|
|
164
|
+
exported,
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../src/events/publishers/app.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAwC;AACxC,2CAewB;AAExB,MAAM,OAAO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