@budibase/pro 2.6.19-alpha.14 → 2.6.19-alpha.16

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.
Files changed (106) hide show
  1. package/dist/index.js +1 -0
  2. package/dist/package.json +5 -5
  3. package/dist/src/api/controllers/apps/backups.d.ts +7 -0
  4. package/dist/src/api/controllers/global/auditLogs.d.ts +6 -0
  5. package/dist/src/api/controllers/global/environmentVariables.d.ts +6 -0
  6. package/dist/src/api/controllers/global/groups.d.ts +10 -0
  7. package/dist/src/api/controllers/global/index.d.ts +2 -0
  8. package/dist/src/api/controllers/global/scim/groups.d.ts +5 -0
  9. package/dist/src/api/controllers/global/scim/users.d.ts +5 -0
  10. package/dist/src/api/controllers/schedules/index.d.ts +9 -0
  11. package/dist/src/api/errors.d.ts +4 -0
  12. package/dist/src/api/index.d.ts +6 -0
  13. package/dist/src/api/routes/apps/backups.d.ts +4 -0
  14. package/dist/src/api/routes/global/auditLogs.d.ts +4 -0
  15. package/dist/src/api/routes/global/environmentVariables.d.ts +4 -0
  16. package/dist/src/api/routes/global/groups.d.ts +4 -0
  17. package/dist/src/api/routes/global/scim.d.ts +4 -0
  18. package/dist/src/api/routes/schedules/index.d.ts +4 -0
  19. package/dist/src/constants/index.d.ts +4 -0
  20. package/dist/src/constants/licenses.d.ts +14 -0
  21. package/dist/src/constants/misc.d.ts +1 -0
  22. package/dist/src/constants/quotas.d.ts +71 -0
  23. package/dist/src/constants/version.d.ts +6 -0
  24. package/dist/src/db/auditLogs.d.ts +9 -0
  25. package/dist/src/db/automations.d.ts +22 -0
  26. package/dist/src/db/backups.d.ts +16 -0
  27. package/dist/src/db/environmentVariables.d.ts +8 -0
  28. package/dist/src/db/groups.d.ts +43 -0
  29. package/dist/src/db/index.d.ts +5 -0
  30. package/dist/src/db/licenseInfo.d.ts +7 -0
  31. package/dist/src/db/quotas/index.d.ts +2 -0
  32. package/dist/src/db/quotas/quotas.d.ts +16 -0
  33. package/dist/src/db/quotas/utils.d.ts +8 -0
  34. package/dist/src/db/utils/pagination.d.ts +8 -0
  35. package/dist/src/db/utils/retention.d.ts +2 -0
  36. package/dist/src/db/utils/views.d.ts +6 -0
  37. package/dist/src/db/views/groups.d.ts +5 -0
  38. package/dist/src/db/views/index.d.ts +2 -0
  39. package/dist/src/db/views/staticViews.d.ts +1 -0
  40. package/dist/src/index.d.ts +7 -0
  41. package/dist/src/mappers/groups.d.ts +3 -0
  42. package/dist/src/mappers/index.d.ts +2 -0
  43. package/dist/src/mappers/users.d.ts +5 -0
  44. package/dist/src/middleware/doInScimContext.d.ts +2 -0
  45. package/dist/src/middleware/feature.d.ts +2 -0
  46. package/dist/src/middleware/index.d.ts +4 -0
  47. package/dist/src/middleware/licensing.d.ts +3 -0
  48. package/dist/src/middleware/requireSCIM.d.ts +2 -0
  49. package/dist/src/sdk/api/api.d.ts +2 -0
  50. package/dist/src/sdk/api/index.d.ts +1 -0
  51. package/dist/src/sdk/auditLogs/auditLogs.d.ts +14 -0
  52. package/dist/src/sdk/auditLogs/index.d.ts +1 -0
  53. package/dist/src/sdk/auditLogs/utils.d.ts +12 -0
  54. package/dist/src/sdk/automations/index.d.ts +1 -0
  55. package/dist/src/sdk/automations/logging/index.d.ts +10 -0
  56. package/dist/src/sdk/backups/backup.d.ts +35 -0
  57. package/dist/src/sdk/backups/index.d.ts +35 -0
  58. package/dist/src/sdk/backups/processing.d.ts +2 -0
  59. package/dist/src/sdk/backups/queue.d.ts +3 -0
  60. package/dist/src/sdk/branding/branding.d.ts +2 -0
  61. package/dist/src/sdk/branding/index.d.ts +1 -0
  62. package/dist/src/sdk/environmentVariables/environmentVariables.d.ts +9 -0
  63. package/dist/src/sdk/environmentVariables/index.d.ts +1 -0
  64. package/dist/src/sdk/features/features.d.ts +11 -0
  65. package/dist/src/sdk/features/index.d.ts +1 -0
  66. package/dist/src/sdk/groups/groups.d.ts +33 -0
  67. package/dist/src/sdk/groups/index.d.ts +1 -0
  68. package/dist/src/sdk/index.d.ts +14 -0
  69. package/dist/src/sdk/init.d.ts +2 -0
  70. package/dist/src/sdk/licensing/cache/cache.d.ts +4 -0
  71. package/dist/src/sdk/licensing/cache/index.d.ts +1 -0
  72. package/dist/src/sdk/licensing/cache/redis.d.ts +1 -0
  73. package/dist/src/sdk/licensing/index.d.ts +2 -0
  74. package/dist/src/sdk/licensing/licenses/client.d.ts +4 -0
  75. package/dist/src/sdk/licensing/licenses/index.d.ts +3 -0
  76. package/dist/src/sdk/licensing/licenses/licenses.d.ts +5 -0
  77. package/dist/src/sdk/licensing/licenses/offline.d.ts +4 -0
  78. package/dist/src/sdk/plugins/index.d.ts +4 -0
  79. package/dist/src/sdk/quotas/helpers/apps.d.ts +6 -0
  80. package/dist/src/sdk/quotas/helpers/automations.d.ts +5 -0
  81. package/dist/src/sdk/quotas/helpers/dayPasses.d.ts +2 -0
  82. package/dist/src/sdk/quotas/helpers/groups.d.ts +2 -0
  83. package/dist/src/sdk/quotas/helpers/index.d.ts +8 -0
  84. package/dist/src/sdk/quotas/helpers/plugins.d.ts +3 -0
  85. package/dist/src/sdk/quotas/helpers/queries.d.ts +5 -0
  86. package/dist/src/sdk/quotas/helpers/rows.d.ts +8 -0
  87. package/dist/src/sdk/quotas/helpers/users.d.ts +2 -0
  88. package/dist/src/sdk/quotas/index.d.ts +3 -0
  89. package/dist/src/sdk/quotas/quotas.d.ts +57 -0
  90. package/dist/src/sdk/scim/index.d.ts +1 -0
  91. package/dist/src/sdk/scim/users.d.ts +25 -0
  92. package/dist/src/sdk/users/index.d.ts +1 -0
  93. package/dist/src/sdk/users/users.d.ts +1 -0
  94. package/dist/src/sdk/utils/apps.d.ts +1 -0
  95. package/dist/src/sdk/utils/index.d.ts +1 -0
  96. package/dist/src/types/api.d.ts +13 -0
  97. package/dist/src/types/documents/index.d.ts +1 -0
  98. package/dist/src/types/documents/license.d.ts +5 -0
  99. package/dist/src/types/index.d.ts +4 -0
  100. package/dist/src/types/init.d.ts +27 -0
  101. package/dist/src/types/license.d.ts +18 -0
  102. package/dist/src/utilities/api.d.ts +12 -0
  103. package/dist/src/utilities/delay.d.ts +2 -0
  104. package/dist/src/utilities/fileSystem.d.ts +1 -0
  105. package/dist/src/utilities/index.d.ts +1 -0
  106. package/package.json +6 -6
@@ -0,0 +1,7 @@
1
+ export * from "./types";
2
+ export * from "./sdk";
3
+ export * as sdk from "./sdk";
4
+ export * as constants from "./constants";
5
+ export * as middleware from "./middleware";
6
+ export * as api from "./api";
7
+ export * as mappers from "./mappers";
@@ -0,0 +1,3 @@
1
+ import { ScimCreateGroupRequest, ScimGroupResponse } from "@budibase/types";
2
+ export declare const toScimGroupResponse: (group: UserGroup) => ScimGroupResponse;
3
+ export declare const fromScimGroup: (group: ScimGroupResponse | ScimCreateGroupRequest) => UserGroup;
@@ -0,0 +1,2 @@
1
+ export * as user from "./users";
2
+ export * as group from "./groups";
@@ -0,0 +1,5 @@
1
+ import { ScimUserResponse, ScimCreateUserRequest } from "@budibase/types";
2
+ import { GetUsersFilters } from "../sdk/scim/users";
3
+ export declare const toScimUserResponse: (user: User) => ScimUserResponse;
4
+ export declare const fromScimUser: (scimUser: ScimUserResponse | ScimCreateUserRequest) => User;
5
+ export declare const userFilters: (filter: string) => GetUsersFilters;
@@ -0,0 +1,2 @@
1
+ import { Next } from "koa";
2
+ export declare const doInScimContext: (ctx: any, next: Next) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { Next } from "koa";
2
+ export declare const requireFeature: (featureFlag: Feature) => (ctx: any, next: Next) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ export { default as licensing } from "./licensing";
2
+ export * as feature from "./feature";
3
+ export * from "./doInScimContext";
4
+ export * from "./requireSCIM";
@@ -0,0 +1,3 @@
1
+ import { LicenseMiddlewareOptions } from "../types";
2
+ declare const licensing: (opts?: LicenseMiddlewareOptions) => (ctx: any, next: any) => Promise<any>;
3
+ export default licensing;
@@ -0,0 +1,2 @@
1
+ import { Next } from "koa";
2
+ export declare const requireSCIM: (ctx: any, next: Next) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { PostAccountUserActivityResponse } from "@budibase/types";
2
+ export declare const createActivity: (userId: string, data: PostAccountUserActivity) => Promise<PostAccountUserActivityResponse | undefined>;
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import { AuditLogDoc, AuditLogSearchParams, AuditWriteOpts, Event } from "@budibase/types";
3
+ import { Readable } from "stream";
4
+ export declare function write(event: Event, metadata: any, opts?: AuditWriteOpts): Promise<AuditLogDoc | undefined>;
5
+ export declare function fetch(params: AuditLogSearchParams): Promise<{
6
+ hasNextPage: any;
7
+ bookmark: any;
8
+ data: AuditLogEnriched[];
9
+ }>;
10
+ export declare function download(params: AuditLogSearchParams): {
11
+ promise: Promise<void>;
12
+ stream: Readable;
13
+ };
14
+ export declare function definitions(): Record<string, string>;
@@ -0,0 +1 @@
1
+ export * from "./auditLogs";
@@ -0,0 +1,12 @@
1
+ import { AuditLogSearchParams, Event, FallbackInfo } from "@budibase/types";
2
+ export declare enum ResourceType {
3
+ USER = "user",
4
+ APP = "app"
5
+ }
6
+ export declare function fillDates(params: AuditLogSearchParams): AuditLogSearchParams;
7
+ export declare function getSearchFilters(params: AuditLogSearchParams): SearchFilters;
8
+ export declare function escapeCharacter(str: string, characters: string[]): string;
9
+ export declare function deleted(id: string, resourceType: ResourceType, fallbackInfo?: FallbackInfo): DeletedResourceInfo;
10
+ export declare function removeTemplateStrings(friendlyName: string): string;
11
+ export declare function auditLogsEnabled(): Promise<any>;
12
+ export declare function getEventFriendlyName(event: Event, metadata: any): any;
@@ -0,0 +1 @@
1
+ export * as logs from "./logging";
@@ -0,0 +1,10 @@
1
+ import { AutomationResults, AutomationStatus, Automation } from "@budibase/types";
2
+ export declare const oldestLogDate: () => Promise<string>;
3
+ export interface LogSearchOptions {
4
+ startDate: string;
5
+ status?: AutomationStatus;
6
+ automationId?: string;
7
+ page?: string;
8
+ }
9
+ export declare function logSearch(options: LogSearchOptions): Promise<AutomationLogPage>;
10
+ export declare function storeLog(automation: Automation, results: AutomationResults): Promise<void>;
@@ -0,0 +1,35 @@
1
+ import * as features from "../features";
2
+ /**
3
+ * Rather than exporting functions directly from licensed sdks,
4
+ * we use the licensed function wrapper to apply license restrictions
5
+ * with minimal interference to internal logic.
6
+ */
7
+ declare const pkg: {
8
+ isEnabled: typeof features.isBackupsEnabled;
9
+ triggerAppRestore: (appId: string, backupId: string, nameForBackup: string, createdBy?: string | undefined) => Promise<Promise<void | {
10
+ restoreId: string;
11
+ metadata: any;
12
+ }>>;
13
+ triggerAppBackup: (appId: string, trigger: AppBackupTrigger, opts?: {
14
+ createdBy?: string | undefined;
15
+ name?: string | undefined;
16
+ } | undefined) => Promise<Promise<string | undefined>>;
17
+ downloadAppBackup: (backupId: string) => Promise<Promise<{
18
+ metadata: AppBackup;
19
+ path: any;
20
+ }>>;
21
+ fetchAppBackups: (appId: string, opts?: any) => Promise<Promise<{
22
+ data: AppBackup[];
23
+ hasNextPage: boolean;
24
+ nextPage?: string | undefined;
25
+ }>>;
26
+ storeAppBackupMetadata: (metadata: AppBackupMetadata, opts?: {
27
+ filename?: string | undefined;
28
+ } | undefined) => Promise<Promise<PutResponse>>;
29
+ updateBackupStatus: (id: string, rev: string, status: AppBackupStatus, contents?: any, filename?: string | undefined) => Promise<Promise<PutResponse>>;
30
+ updateRestoreStatus: (id: string, rev: string, status: AppBackupStatus) => Promise<Promise<PutResponse>>;
31
+ getAppBackup: (backupId: string) => Promise<Promise<AppBackup>>;
32
+ updateAppBackup: (backupId: string, backupName: string) => Promise<Promise<PutResponse>>;
33
+ deleteAppBackup: (backupId: string) => Promise<Promise<void>>;
34
+ };
35
+ export default pkg;
@@ -0,0 +1,35 @@
1
+ import * as processing from "./processing";
2
+ import { BackupInitOpts } from "../../types";
3
+ import { getBackupQueue } from "./queue";
4
+ declare const _default: {
5
+ processing: typeof processing;
6
+ init: (opts: BackupInitOpts) => Promise<void>;
7
+ getBackupQueue: typeof getBackupQueue;
8
+ isEnabled: typeof import("../features").isBackupsEnabled;
9
+ triggerAppRestore: (appId: string, backupId: string, nameForBackup: string, createdBy?: string | undefined) => Promise<Promise<void | {
10
+ restoreId: string;
11
+ metadata: any;
12
+ }>>;
13
+ triggerAppBackup: (appId: string, trigger: AppBackupTrigger, opts?: {
14
+ createdBy?: string | undefined;
15
+ name?: string | undefined;
16
+ } | undefined) => Promise<Promise<string | undefined>>;
17
+ downloadAppBackup: (backupId: string) => Promise<Promise<{
18
+ metadata: AppBackup;
19
+ path: any;
20
+ }>>;
21
+ fetchAppBackups: (appId: string, opts?: any) => Promise<Promise<{
22
+ data: AppBackup[];
23
+ hasNextPage: boolean;
24
+ nextPage?: string | undefined;
25
+ }>>;
26
+ storeAppBackupMetadata: (metadata: AppBackupMetadata, opts?: {
27
+ filename?: string | undefined;
28
+ } | undefined) => Promise<Promise<PutResponse>>;
29
+ updateBackupStatus: (id: string, rev: string, status: AppBackupStatus, contents?: any, filename?: string | undefined) => Promise<Promise<PutResponse>>;
30
+ updateRestoreStatus: (id: string, rev: string, status: AppBackupStatus) => Promise<Promise<PutResponse>>;
31
+ getAppBackup: (backupId: string) => Promise<Promise<AppBackup>>;
32
+ updateAppBackup: (backupId: string, backupName: string) => Promise<Promise<PutResponse>>;
33
+ deleteAppBackup: (backupId: string) => Promise<Promise<void>>;
34
+ };
35
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { BackupProcessingOpts } from "../../types";
2
+ export declare function init(opts: BackupProcessingOpts): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { Queue } from "bull";
2
+ export declare function init(): void;
3
+ export declare function getBackupQueue(): Queue<AppBackupQueueData>;
@@ -0,0 +1,2 @@
1
+ import { SettingsBrandingConfig, SettingsInnerConfig } from "@budibase/types";
2
+ export declare function getBrandingConfig(config: SettingsInnerConfig & SettingsBrandingConfig): Promise<SettingsBrandingConfig>;
@@ -0,0 +1 @@
1
+ export * from "./branding";
@@ -0,0 +1,9 @@
1
+ import { AppEnvironment, EnvironmentVariableValue } from "@budibase/types";
2
+ export declare function isEncryptionKeyAvailable(): boolean;
3
+ export declare function fetch(): Promise<string[]>;
4
+ export declare function fetchValues(environment: AppEnvironment): Promise<{
5
+ [key: string]: string;
6
+ }>;
7
+ export declare function update(varName: string, value: EnvironmentVariableValue): Promise<void>;
8
+ export declare function remove(varName: string): Promise<void>;
9
+ export declare function isValid(str: string): boolean;
@@ -0,0 +1 @@
1
+ export * from "./environmentVariables";
@@ -0,0 +1,11 @@
1
+ import { Feature } from "@budibase/types";
2
+ import { SettingsInnerConfig } from "@budibase/types";
3
+ export declare function checkFeature(featureFlag: Feature): Promise<void>;
4
+ export declare function checkBackups<Args extends any[], Return>(targetFunction: (...parameters: Args) => Return): (...parameters: Args) => Promise<Return>;
5
+ export declare function isBackupsEnabled(): Promise<any>;
6
+ export declare function isBrandingEnabled(): Promise<any>;
7
+ export declare function isEnforceableSSO(): Promise<any>;
8
+ export declare function isSSOEnforced(opts?: {
9
+ config: SettingsInnerConfig;
10
+ }): Promise<boolean>;
11
+ export declare const checkSCIM: () => Promise<boolean>;
@@ -0,0 +1 @@
1
+ export * from "./features";
@@ -0,0 +1,33 @@
1
+ import { UserGroup, User } from "@budibase/types";
2
+ export declare function getGroupRoleId(user: User, appId: string, opts?: {
3
+ groups?: UserGroup[];
4
+ }): Promise<any>;
5
+ export declare function enrichUserRolesFromGroups(user: User): Promise<User>;
6
+ export declare function fetch(): Promise<any[]>;
7
+ export declare function get(id: string): Promise<UserGroup>;
8
+ export declare function getBulk(ids: string[], opts?: {
9
+ enriched: boolean;
10
+ }): Promise<UserGroup[]>;
11
+ export declare function save(group: UserGroup): Promise<{
12
+ id: string;
13
+ rev: string;
14
+ }>;
15
+ export declare function remove(groupId: string, revision: string): Promise<any>;
16
+ export declare function addUsers(groupId: string, userIds: string[]): Promise<User[]>;
17
+ export declare function removeUsers(groupId: string, userIds: string[]): Promise<User[]>;
18
+ export declare function updateGroupApps(groupId: string, opts: {
19
+ appsToRemove?: {
20
+ appId: string;
21
+ }[];
22
+ appsToAdd?: {
23
+ appId: string;
24
+ roleId: string;
25
+ }[];
26
+ }): Promise<{
27
+ id: string;
28
+ rev: string;
29
+ }>;
30
+ export declare function cleanupApp(appId: string): Promise<{
31
+ id: string;
32
+ rev?: string | undefined;
33
+ }[]>;
@@ -0,0 +1 @@
1
+ export * from "./groups";
@@ -0,0 +1,14 @@
1
+ export * as branding from "./branding";
2
+ export * as licensing from "./licensing";
3
+ export * as quotas from "./quotas";
4
+ export * as users from "./users";
5
+ export * as automations from "./automations";
6
+ export * as features from "./features";
7
+ export * as groups from "./groups";
8
+ export * as plugins from "./plugins";
9
+ export * as environmentVariables from "./environmentVariables";
10
+ export * as auditLogs from "./auditLogs";
11
+ export { default as backups } from "./backups";
12
+ export * as utils from "./utils";
13
+ export * from "./init";
14
+ export * from "./scim";
@@ -0,0 +1,2 @@
1
+ import { InitOpts } from "../types";
2
+ export declare const init: (opts: InitOpts) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { GetCachedLicenseOptions, CachedLicense } from "../../../types";
2
+ export declare const refresh: () => Promise<void>;
3
+ export declare const getCachedLicense: (ctx?: any, opts?: GetCachedLicenseOptions) => Promise<CachedLicense>;
4
+ export declare const invalidate: () => Promise<void>;
@@ -0,0 +1 @@
1
+ export * from "./cache";
@@ -0,0 +1 @@
1
+ export declare const getClient: () => Promise<any>;
@@ -0,0 +1,2 @@
1
+ export * as cache from "./cache";
2
+ export * from "./licenses";
@@ -0,0 +1,4 @@
1
+ import { License } from "@budibase/types";
2
+ export declare const getLicense: () => Promise<any>;
3
+ export declare const triggerQuota: (body: QuotaTriggeredRequest) => Promise<void | undefined>;
4
+ export declare const activateLicenseKey: (licenseKey: string) => Promise<License | undefined>;
@@ -0,0 +1,3 @@
1
+ export * from "./licenses";
2
+ export * as client from "./client";
3
+ export * as offline from "./offline";
@@ -0,0 +1,5 @@
1
+ export declare const getLicenseInfo: () => Promise<import("../../..").SelfHostLicenseInfo | undefined>;
2
+ export declare const deleteLicenseInfo: () => Promise<void>;
3
+ export declare const activateLicenseKey: (licenseKey: string) => Promise<void>;
4
+ export declare const getLicense: () => Promise<any>;
5
+ export declare const getFreeLicense: () => License;
@@ -0,0 +1,4 @@
1
+ import { License } from "@budibase/types";
2
+ export declare function getOfflineLicense(): License | undefined;
3
+ export declare function writeOfflineLicenseToDisk(signedLicense: string): void;
4
+ export declare function deleteOfflineLicense(): void;
@@ -0,0 +1,4 @@
1
+ import { PluginSource } from "@budibase/types";
2
+ export declare function storePlugin(metadata: any, directory: any, source?: PluginSource): Promise<any>;
3
+ export declare function deletePlugin(pluginId: string): Promise<void>;
4
+ export declare function checkPluginQuotas(): Promise<void>;
@@ -0,0 +1,6 @@
1
+ interface AppOpts {
2
+ appId?: string;
3
+ }
4
+ export declare const addApp: (addAppFn: any, { appId }?: AppOpts) => Promise<any>;
5
+ export declare const removeApp: ({ appId }?: AppOpts) => Promise<void>;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ declare type AutomationOpts = {
2
+ automationId?: string;
3
+ };
4
+ export declare const addAutomation: (runAutomationFn: any, { automationId }?: AutomationOpts) => Promise<any>;
5
+ export {};
@@ -0,0 +1,2 @@
1
+ import { BBContext } from "@budibase/types";
2
+ export declare function checkDayPass(ctx: BBContext): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare const addGroup: <T>(addGroupFn: () => Promise<T>) => Promise<T>;
2
+ export declare const removeGroup: () => Promise<void>;
@@ -0,0 +1,8 @@
1
+ export * from "./apps";
2
+ export * from "./queries";
3
+ export * from "./rows";
4
+ export * from "./automations";
5
+ export * from "./dayPasses";
6
+ export * from "./groups";
7
+ export * from "./plugins";
8
+ export * from "./users";
@@ -0,0 +1,3 @@
1
+ export declare const addPlugin: (addPluginFn: any) => Promise<any>;
2
+ export declare const removePlugin: () => Promise<void>;
3
+ export declare const updatePluginCount: (count: number) => Promise<QuotaUsage>;
@@ -0,0 +1,5 @@
1
+ declare type QueryOpts = {
2
+ datasourceId?: string;
3
+ };
4
+ export declare const addQuery: (runQueryFunction: any, { datasourceId }?: QueryOpts) => Promise<any>;
5
+ export {};
@@ -0,0 +1,8 @@
1
+ declare type RowOpts = {
2
+ tableId?: string;
3
+ };
4
+ export declare const addRow: (addRowFn: any, { tableId }?: RowOpts) => Promise<any>;
5
+ export declare const removeRow: ({ tableId }?: RowOpts) => Promise<void>;
6
+ export declare const addRows: (change: number, addRowsFn?: () => Promise<any>, { tableId }?: RowOpts) => Promise<any>;
7
+ export declare const removeRows: (change: number, { tableId }?: RowOpts) => Promise<void>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const addUsers: <T>(change: number, addUsersFn?: (() => Promise<T>) | undefined) => Promise<T>;
2
+ export declare const removeUsers: (change: number) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ export * from "../../db/quotas";
2
+ export * from "./helpers";
3
+ export * from "./quotas";
@@ -0,0 +1,57 @@
1
+ import { ConstantQuotaName, MonthlyQuotaName, Quota, StaticQuotaName } from "@budibase/types";
2
+ interface IncrementOptions {
3
+ /**
4
+ * The function being wrapped by this quota usage.
5
+ */
6
+ fn?: () => Promise<any>;
7
+ /**
8
+ * If provided, the new usage value will be calculated using this function.
9
+ */
10
+ valueFn?: () => Promise<number>;
11
+ /**
12
+ * Turn on or off error logging when a quotas has been exceeded
13
+ */
14
+ suppressErrorLog?: boolean;
15
+ /**
16
+ * If using a specific resource which has an ID, can pass this ID for granular quotas.
17
+ */
18
+ id?: string;
19
+ }
20
+ export declare const increment: (name: MeteredQuotaName, type: QuotaUsageType, opts?: IncrementOptions) => Promise<any>;
21
+ export declare const incrementMany: (change: number, name: MeteredQuotaName, type: QuotaUsageType, opts?: IncrementOptions) => Promise<any>;
22
+ interface DecrementOptions {
23
+ /**
24
+ * If provided, the new usage value will be calculated using this function.
25
+ */
26
+ valueFn?: () => Promise<number>;
27
+ /**
28
+ * If using a specific resource which has an ID, can pass this ID for granular quotas.
29
+ */
30
+ id?: string;
31
+ }
32
+ export declare const decrement: (name: MeteredQuotaName, type: QuotaUsageType, opts?: DecrementOptions) => Promise<void>;
33
+ export declare const decrementMany: (change: number, name: MeteredQuotaName, type: QuotaUsageType, opts?: DecrementOptions) => Promise<void>;
34
+ export declare const set: (name: MeteredQuotaName, type: QuotaUsageType, value: number) => Promise<QuotaUsage>;
35
+ interface UpdateUsageOptions {
36
+ /**
37
+ * If provided and true, the usage quota will not be updated.
38
+ * Used to verify that a quota is not exceeded before running.
39
+ */
40
+ dryRun?: boolean;
41
+ /**
42
+ * If provided, the new usage value will be calculated using this function.
43
+ */
44
+ valueFn?: () => Promise<number>;
45
+ /**
46
+ * Turn on or off error logging when a quotas has been exceeded
47
+ */
48
+ suppressErrorLog?: boolean;
49
+ /**
50
+ * If using a specific resource which has an ID, can pass this ID for granular quotas.
51
+ */
52
+ id?: string;
53
+ }
54
+ export declare const updateUsage: (usageChange: number, name: MeteredQuotaName, type: QuotaUsageType, opts?: UpdateUsageOptions) => Promise<void>;
55
+ export declare const getLicensedQuota: (quotaType: QuotaType, name: MonthlyQuotaName | StaticQuotaName | ConstantQuotaName, usageType?: any) => Promise<Quota>;
56
+ export declare const usageLimitIsExceeded: (name: MeteredQuotaName, type: QuotaUsageType) => Promise<boolean>;
57
+ export {};
@@ -0,0 +1 @@
1
+ export * as scimUsers from "./users";
@@ -0,0 +1,25 @@
1
+ import { SaveUserOpts, User } from "@budibase/types";
2
+ export interface ScimUserServiceConfig {
3
+ functions: {
4
+ saveUser: (user: User, opts?: SaveUserOpts) => Promise<User>;
5
+ removeUser: (id: string) => Promise<void>;
6
+ };
7
+ }
8
+ export interface GetUsersFilters {
9
+ equal?: Record<string, any>;
10
+ }
11
+ interface GetParams {
12
+ pageSize: number;
13
+ skip?: number;
14
+ filters?: GetUsersFilters;
15
+ }
16
+ export declare const init: (config: ScimUserServiceConfig) => void;
17
+ export declare const get: (query: GetParams) => Promise<{
18
+ users: User[];
19
+ total: number;
20
+ }>;
21
+ export declare const find: (id: string) => Promise<any>;
22
+ export declare const create: (user: User) => Promise<User>;
23
+ export declare const update: (user: User) => Promise<User>;
24
+ export declare const remove: (id: string) => Promise<void>;
25
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./users";
@@ -0,0 +1 @@
1
+ export declare const createActivity: (userId: string) => Promise<any>;
@@ -0,0 +1 @@
1
+ export declare function appExists(appId: string): Promise<boolean>;
@@ -0,0 +1 @@
1
+ export * from "./apps";
@@ -0,0 +1,13 @@
1
+ export interface Options {
2
+ headers?: {
3
+ [key: string]: string;
4
+ };
5
+ body?: any;
6
+ }
7
+ export declare enum Method {
8
+ POST = "POST",
9
+ GET = "GET",
10
+ PATCH = "PATCH",
11
+ DELETE = "DELETE",
12
+ PUT = "PUT"
13
+ }
@@ -0,0 +1 @@
1
+ export * from "./license";
@@ -0,0 +1,5 @@
1
+ export interface SelfHostLicenseInfo {
2
+ _id?: string;
3
+ _rev?: string;
4
+ licenseKey: string;
5
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./api";
2
+ export * from "./license";
3
+ export * from "./documents";
4
+ export * from "./init";
@@ -0,0 +1,27 @@
1
+ import { AppBackupContents } from "@budibase/types";
2
+ import { ScimUserServiceConfig } from "../sdk/scim/users";
3
+ export interface InitOpts {
4
+ backups?: BackupInitOpts;
5
+ scimUserServiceConfig?: ScimUserServiceConfig;
6
+ }
7
+ export interface BackupInitOpts {
8
+ processing: BackupProcessingOpts;
9
+ }
10
+ export interface ImportAppConfig {
11
+ file: {
12
+ type: string;
13
+ path: string;
14
+ };
15
+ key: string;
16
+ }
17
+ declare type ExportAppFn = (devAppId: string, opts: {
18
+ tar: boolean;
19
+ }) => Promise<string>;
20
+ declare type ImportAppFn = (devAppId: string, db: any, config: ImportAppConfig) => Promise<string>;
21
+ declare type StatsFn = (devAppId: string) => Promise<AppBackupContents>;
22
+ export interface BackupProcessingOpts {
23
+ exportAppFn: ExportAppFn;
24
+ importAppFn: ImportAppFn;
25
+ statsFn: StatsFn;
26
+ }
27
+ export {};
@@ -0,0 +1,18 @@
1
+ import { License } from "@budibase/types";
2
+ export interface CachedLicense extends License {
3
+ refreshedAt?: string;
4
+ version?: string;
5
+ }
6
+ export interface LicenseMiddlewareOptions {
7
+ checkDayPasses: boolean;
8
+ checkUsersLimit: boolean;
9
+ refreshVersion: boolean;
10
+ licensingCheck?: (ctx: any) => boolean;
11
+ populateLicense?: (tenantId: string) => Promise<License | undefined>;
12
+ populateFreeLicense?: (ctx: any, tenantId: string) => License;
13
+ }
14
+ export interface GetCachedLicenseOptions {
15
+ populateLicense?: (tenantId: string) => Promise<License | undefined>;
16
+ populateFreeLicense?: (ctx: any, tenantId: string) => License;
17
+ refreshVersion: boolean;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { Method, Options } from "../types";
2
+ declare class API {
3
+ host: string;
4
+ constructor(host: string);
5
+ apiCall: (method: Method) => (url?: string, options?: Options) => Promise<import("node-fetch").Response>;
6
+ post: (url?: string, options?: Options) => Promise<import("node-fetch").Response>;
7
+ get: (url?: string, options?: Options) => Promise<import("node-fetch").Response>;
8
+ patch: (url?: string, options?: Options) => Promise<import("node-fetch").Response>;
9
+ del: (url?: string, options?: Options) => Promise<import("node-fetch").Response>;
10
+ put: (url?: string, options?: Options) => Promise<import("node-fetch").Response>;
11
+ }
12
+ export default API;
@@ -0,0 +1,2 @@
1
+ export declare function randomDelay(fn: any): Promise<unknown>;
2
+ export declare function backOff(fn: any, errMsg: string): Promise<any>;
@@ -0,0 +1 @@
1
+ export declare function loadJSFile(directory: string, name: string): string;
@@ -0,0 +1 @@
1
+ export { default as API } from "./api";