@budibase/worker 3.0.2 → 3.0.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.4",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"author": "Budibase",
|
|
38
38
|
"license": "GPL-3.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@budibase/backend-core": "3.0.
|
|
41
|
-
"@budibase/pro": "3.0.
|
|
42
|
-
"@budibase/string-templates": "3.0.
|
|
43
|
-
"@budibase/types": "3.0.
|
|
40
|
+
"@budibase/backend-core": "3.0.4",
|
|
41
|
+
"@budibase/pro": "3.0.4",
|
|
42
|
+
"@budibase/string-templates": "3.0.4",
|
|
43
|
+
"@budibase/types": "3.0.4",
|
|
44
44
|
"@koa/router": "8.0.8",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.3",
|
|
46
46
|
"@types/global-agent": "2.1.1",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "2d42ac82463b0c0aa59d07f2aeac554543764d3d"
|
|
111
111
|
}
|
|
@@ -12,27 +12,29 @@ import {
|
|
|
12
12
|
} from "@budibase/backend-core"
|
|
13
13
|
import { checkAnyUserExists } from "../../../utilities/users"
|
|
14
14
|
import {
|
|
15
|
+
AIConfig,
|
|
16
|
+
AIInnerConfig,
|
|
15
17
|
Config,
|
|
16
18
|
ConfigType,
|
|
17
19
|
Ctx,
|
|
18
20
|
GetPublicOIDCConfigResponse,
|
|
19
21
|
GetPublicSettingsResponse,
|
|
20
22
|
GoogleInnerConfig,
|
|
23
|
+
isAIConfig,
|
|
21
24
|
isGoogleConfig,
|
|
22
25
|
isOIDCConfig,
|
|
23
26
|
isSettingsConfig,
|
|
24
27
|
isSMTPConfig,
|
|
25
28
|
OIDCConfigs,
|
|
29
|
+
OIDCLogosConfig,
|
|
30
|
+
PASSWORD_REPLACEMENT,
|
|
31
|
+
QuotaUsageType,
|
|
26
32
|
SettingsBrandingConfig,
|
|
27
33
|
SettingsInnerConfig,
|
|
28
34
|
SSOConfig,
|
|
29
35
|
SSOConfigType,
|
|
36
|
+
StaticQuotaName,
|
|
30
37
|
UserCtx,
|
|
31
|
-
OIDCLogosConfig,
|
|
32
|
-
AIConfig,
|
|
33
|
-
PASSWORD_REPLACEMENT,
|
|
34
|
-
isAIConfig,
|
|
35
|
-
AIInnerConfig,
|
|
36
38
|
} from "@budibase/types"
|
|
37
39
|
import * as pro from "@budibase/pro"
|
|
38
40
|
|
|
@@ -83,6 +85,12 @@ const getEventFns = async (config: Config, existing?: Config) => {
|
|
|
83
85
|
fns.push(events.email.SMTPUpdated)
|
|
84
86
|
} else if (isAIConfig(config)) {
|
|
85
87
|
fns.push(() => events.ai.AIConfigUpdated)
|
|
88
|
+
if (
|
|
89
|
+
Object.keys(existing.config).length > Object.keys(config.config).length
|
|
90
|
+
) {
|
|
91
|
+
fns.push(() => pro.quotas.removeCustomAIConfig())
|
|
92
|
+
}
|
|
93
|
+
fns.push(() => pro.quotas.addCustomAIConfig())
|
|
86
94
|
} else if (isGoogleConfig(config)) {
|
|
87
95
|
fns.push(() => events.auth.SSOUpdated(ConfigType.GOOGLE))
|
|
88
96
|
if (!existing.config.activated && config.config.activated) {
|
|
@@ -248,7 +256,6 @@ export async function save(ctx: UserCtx<Config>) {
|
|
|
248
256
|
if (existingConfig) {
|
|
249
257
|
await verifyAIConfig(config, existingConfig)
|
|
250
258
|
}
|
|
251
|
-
await pro.quotas.addCustomAIConfig()
|
|
252
259
|
break
|
|
253
260
|
}
|
|
254
261
|
} catch (err: any) {
|
|
@@ -518,7 +525,11 @@ export async function destroy(ctx: UserCtx) {
|
|
|
518
525
|
await db.remove(id, rev)
|
|
519
526
|
await cache.destroy(cache.CacheKey.CHECKLIST)
|
|
520
527
|
if (id === configs.generateConfigID(ConfigType.AI)) {
|
|
521
|
-
await pro.quotas.
|
|
528
|
+
await pro.quotas.set(
|
|
529
|
+
StaticQuotaName.AI_CUSTOM_CONFIGS,
|
|
530
|
+
QuotaUsageType.STATIC,
|
|
531
|
+
0
|
|
532
|
+
)
|
|
522
533
|
}
|
|
523
534
|
ctx.body = { message: "Config deleted successfully" }
|
|
524
535
|
} catch (err: any) {
|