@bpinternal/const 0.0.1 → 0.0.3

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.cjs CHANGED
@@ -20,11 +20,88 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ limitConfigs: () => limitConfigs,
23
24
  objectToPrefixMap: () => objectToPrefixMap,
24
- prefixToObjectMap: () => prefixToObjectMap
25
+ prefixToObjectMap: () => prefixToObjectMap,
26
+ quotaConfigs: () => quotaConfigs,
27
+ quotaTypes: () => quotaTypes
25
28
  });
26
29
  module.exports = __toCommonJS(src_exports);
27
30
 
31
+ // src/limits.ts
32
+ var limitConfigs = {
33
+ bot_configuration_bytes: {
34
+ value: 20480,
35
+ // 20 KB
36
+ unit: "bytes"
37
+ },
38
+ bot_installed_integrations_count: {
39
+ value: 30,
40
+ unit: "count"
41
+ },
42
+ bot_integration_configuration_bytes: {
43
+ value: 20480,
44
+ // 20 KB
45
+ unit: "bytes"
46
+ },
47
+ bot_recurring_event_count: {
48
+ value: 5,
49
+ unit: "count"
50
+ },
51
+ bot_recurring_event_payload_bytes: {
52
+ value: 131072,
53
+ // 128 KB
54
+ unit: "bytes"
55
+ },
56
+ event_definition_count: {
57
+ value: 20,
58
+ unit: "count"
59
+ },
60
+ integration_channel_count: {
61
+ value: 10,
62
+ unit: "count"
63
+ },
64
+ integration_channel_message_type_count: {
65
+ value: 20,
66
+ unit: "count"
67
+ },
68
+ integration_identifier_count: {
69
+ value: 50,
70
+ unit: "count"
71
+ },
72
+ integration_version_count: {
73
+ value: 50,
74
+ unit: "count"
75
+ },
76
+ integrations_owned_count: {
77
+ value: 20,
78
+ unit: "count"
79
+ },
80
+ message_payload_bytes: {
81
+ value: 131072,
82
+ // 128 KB
83
+ unit: "bytes"
84
+ },
85
+ schema_bytes: {
86
+ value: 102400,
87
+ // 100 KB
88
+ unit: "bytes"
89
+ },
90
+ state_definition_count: {
91
+ value: 5,
92
+ unit: "count"
93
+ },
94
+ state_item_payload_bytes: {
95
+ value: 131072,
96
+ // 128 KB
97
+ unit: "bytes"
98
+ },
99
+ tag_definition_count: {
100
+ value: 50,
101
+ unit: "count"
102
+ }
103
+ };
104
+
28
105
  // src/prefixes.ts
29
106
  var prefixToObjectMap = {
30
107
  action: "action",
@@ -92,8 +169,82 @@ var objectToPrefixMap = {
92
169
  webhook: "webhook",
93
170
  workspace: "wkspace"
94
171
  };
172
+
173
+ // src/quotas.ts
174
+ var quotaTypes = [
175
+ "invocation_timeout",
176
+ "invocation_calls",
177
+ "storage_count",
178
+ "bot_count",
179
+ "knowledgebase_vector_count",
180
+ "bot_ratelimit",
181
+ "table_row_count",
182
+ "workspace_member_count"
183
+ ];
184
+ var quotaConfigs = {
185
+ invocation_timeout: {
186
+ name: "Invocation Timeout",
187
+ description: "Maximum time in milliseconds a bot can run before timing out.",
188
+ default: 6e4,
189
+ kind: "bot",
190
+ category: "timeout"
191
+ },
192
+ storage_count: {
193
+ name: "Storage Count",
194
+ description: "Maximum number of storage bytes that can be stored.",
195
+ default: 104857600,
196
+ // 100 MB
197
+ kind: "bot",
198
+ category: "count"
199
+ },
200
+ bot_count: {
201
+ name: "Bot Count",
202
+ description: "Maximum number of bots that can be created.",
203
+ default: 5,
204
+ kind: "workspace",
205
+ category: "count"
206
+ },
207
+ workspace_member_count: {
208
+ name: "Workspace Member Count",
209
+ description: "Maximum number of members that can be added to a workspace.",
210
+ default: 3,
211
+ kind: "workspace",
212
+ category: "count"
213
+ },
214
+ knowledgebase_vector_count: {
215
+ name: "Knowledgebase Vector Count",
216
+ description: "Maximum number of knowledgebase vectors that can be created.",
217
+ default: 5e3,
218
+ kind: "bot",
219
+ category: "count"
220
+ },
221
+ table_row_count: {
222
+ name: "Table Row Count",
223
+ description: "Maximum number of rows that can be stored in a table.",
224
+ default: 5e3,
225
+ kind: "bot",
226
+ category: "count"
227
+ },
228
+ invocation_calls: {
229
+ name: "Invocation Calls",
230
+ description: "Maximum number of times a bot can be invoked in a month.",
231
+ default: 25e3,
232
+ kind: "bot",
233
+ category: "calls"
234
+ },
235
+ bot_ratelimit: {
236
+ name: "Bot Ratelimit",
237
+ description: "Maximum number of times a bot can be invoked in a minute.",
238
+ default: 100,
239
+ kind: "bot",
240
+ category: "ratelimit"
241
+ }
242
+ };
95
243
  // Annotate the CommonJS export names for ESM import in node:
96
244
  0 && (module.exports = {
245
+ limitConfigs,
97
246
  objectToPrefixMap,
98
- prefixToObjectMap
247
+ prefixToObjectMap,
248
+ quotaConfigs,
249
+ quotaTypes
99
250
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,77 @@
1
+ // src/limits.ts
2
+ var limitConfigs = {
3
+ bot_configuration_bytes: {
4
+ value: 20480,
5
+ // 20 KB
6
+ unit: "bytes"
7
+ },
8
+ bot_installed_integrations_count: {
9
+ value: 30,
10
+ unit: "count"
11
+ },
12
+ bot_integration_configuration_bytes: {
13
+ value: 20480,
14
+ // 20 KB
15
+ unit: "bytes"
16
+ },
17
+ bot_recurring_event_count: {
18
+ value: 5,
19
+ unit: "count"
20
+ },
21
+ bot_recurring_event_payload_bytes: {
22
+ value: 131072,
23
+ // 128 KB
24
+ unit: "bytes"
25
+ },
26
+ event_definition_count: {
27
+ value: 20,
28
+ unit: "count"
29
+ },
30
+ integration_channel_count: {
31
+ value: 10,
32
+ unit: "count"
33
+ },
34
+ integration_channel_message_type_count: {
35
+ value: 20,
36
+ unit: "count"
37
+ },
38
+ integration_identifier_count: {
39
+ value: 50,
40
+ unit: "count"
41
+ },
42
+ integration_version_count: {
43
+ value: 50,
44
+ unit: "count"
45
+ },
46
+ integrations_owned_count: {
47
+ value: 20,
48
+ unit: "count"
49
+ },
50
+ message_payload_bytes: {
51
+ value: 131072,
52
+ // 128 KB
53
+ unit: "bytes"
54
+ },
55
+ schema_bytes: {
56
+ value: 102400,
57
+ // 100 KB
58
+ unit: "bytes"
59
+ },
60
+ state_definition_count: {
61
+ value: 5,
62
+ unit: "count"
63
+ },
64
+ state_item_payload_bytes: {
65
+ value: 131072,
66
+ // 128 KB
67
+ unit: "bytes"
68
+ },
69
+ tag_definition_count: {
70
+ value: 50,
71
+ unit: "count"
72
+ }
73
+ };
74
+
1
75
  // src/prefixes.ts
2
76
  var prefixToObjectMap = {
3
77
  action: "action",
@@ -65,7 +139,81 @@ var objectToPrefixMap = {
65
139
  webhook: "webhook",
66
140
  workspace: "wkspace"
67
141
  };
142
+
143
+ // src/quotas.ts
144
+ var quotaTypes = [
145
+ "invocation_timeout",
146
+ "invocation_calls",
147
+ "storage_count",
148
+ "bot_count",
149
+ "knowledgebase_vector_count",
150
+ "bot_ratelimit",
151
+ "table_row_count",
152
+ "workspace_member_count"
153
+ ];
154
+ var quotaConfigs = {
155
+ invocation_timeout: {
156
+ name: "Invocation Timeout",
157
+ description: "Maximum time in milliseconds a bot can run before timing out.",
158
+ default: 6e4,
159
+ kind: "bot",
160
+ category: "timeout"
161
+ },
162
+ storage_count: {
163
+ name: "Storage Count",
164
+ description: "Maximum number of storage bytes that can be stored.",
165
+ default: 104857600,
166
+ // 100 MB
167
+ kind: "bot",
168
+ category: "count"
169
+ },
170
+ bot_count: {
171
+ name: "Bot Count",
172
+ description: "Maximum number of bots that can be created.",
173
+ default: 5,
174
+ kind: "workspace",
175
+ category: "count"
176
+ },
177
+ workspace_member_count: {
178
+ name: "Workspace Member Count",
179
+ description: "Maximum number of members that can be added to a workspace.",
180
+ default: 3,
181
+ kind: "workspace",
182
+ category: "count"
183
+ },
184
+ knowledgebase_vector_count: {
185
+ name: "Knowledgebase Vector Count",
186
+ description: "Maximum number of knowledgebase vectors that can be created.",
187
+ default: 5e3,
188
+ kind: "bot",
189
+ category: "count"
190
+ },
191
+ table_row_count: {
192
+ name: "Table Row Count",
193
+ description: "Maximum number of rows that can be stored in a table.",
194
+ default: 5e3,
195
+ kind: "bot",
196
+ category: "count"
197
+ },
198
+ invocation_calls: {
199
+ name: "Invocation Calls",
200
+ description: "Maximum number of times a bot can be invoked in a month.",
201
+ default: 25e3,
202
+ kind: "bot",
203
+ category: "calls"
204
+ },
205
+ bot_ratelimit: {
206
+ name: "Bot Ratelimit",
207
+ description: "Maximum number of times a bot can be invoked in a minute.",
208
+ default: 100,
209
+ kind: "bot",
210
+ category: "ratelimit"
211
+ }
212
+ };
68
213
  export {
214
+ limitConfigs,
69
215
  objectToPrefixMap,
70
- prefixToObjectMap
216
+ prefixToObjectMap,
217
+ quotaConfigs,
218
+ quotaTypes
71
219
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinternal/const",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Constant utilities for Botpress",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -1 +1,3 @@
1
+ export * from './limits';
1
2
  export * from './prefixes';
3
+ export * from './quotas';
package/src/limits.ts ADDED
@@ -0,0 +1,80 @@
1
+ type Limit = {
2
+ /**
3
+ * The maximum value for the limit.
4
+ */
5
+ value: number
6
+ /**
7
+ * The unit of the limit.
8
+ */
9
+ unit: LimitUnit
10
+ }
11
+
12
+ export type LimitType = keyof typeof limitConfigs
13
+ export type LimitUnit = 'count' | 'bytes'
14
+
15
+ export const limitConfigs = {
16
+ bot_configuration_bytes: {
17
+ value: 20480, // 20 KB
18
+ unit: 'bytes',
19
+ },
20
+ bot_installed_integrations_count: {
21
+ value: 30,
22
+ unit: 'count',
23
+ },
24
+ bot_integration_configuration_bytes: {
25
+ value: 20480, // 20 KB
26
+ unit: 'bytes',
27
+ },
28
+ bot_recurring_event_count: {
29
+ value: 5,
30
+ unit: 'count',
31
+ },
32
+ bot_recurring_event_payload_bytes: {
33
+ value: 131072, // 128 KB
34
+ unit: 'bytes',
35
+ },
36
+ event_definition_count: {
37
+ value: 20,
38
+ unit: 'count',
39
+ },
40
+ integration_channel_count: {
41
+ value: 10,
42
+ unit: 'count',
43
+ },
44
+ integration_channel_message_type_count: {
45
+ value: 20,
46
+ unit: 'count',
47
+ },
48
+ integration_identifier_count: {
49
+ value: 50,
50
+ unit: 'count',
51
+ },
52
+ integration_version_count: {
53
+ value: 50,
54
+ unit: 'count',
55
+ },
56
+ integrations_owned_count: {
57
+ value: 20,
58
+ unit: 'count',
59
+ },
60
+ message_payload_bytes: {
61
+ value: 131072, // 128 KB
62
+ unit: 'bytes',
63
+ },
64
+ schema_bytes: {
65
+ value: 102400, // 100 KB
66
+ unit: 'bytes',
67
+ },
68
+ state_definition_count: {
69
+ value: 5,
70
+ unit: 'count',
71
+ },
72
+ state_item_payload_bytes: {
73
+ value: 131072, // 128 KB
74
+ unit: 'bytes',
75
+ },
76
+ tag_definition_count: {
77
+ value: 50,
78
+ unit: 'count',
79
+ },
80
+ } as const satisfies Record<string, Limit>
package/src/quotas.ts ADDED
@@ -0,0 +1,96 @@
1
+ type Quota = {
2
+ /**
3
+ * Friendly name of the usage type.
4
+ */
5
+ name: string
6
+ /**
7
+ * Description of the usage type.
8
+ */
9
+ description: string
10
+ /**
11
+ * The default limit for the usage type. This is the fallback value if the limit is not set.
12
+ */
13
+ default: number
14
+ /**
15
+ * The kind of usage type. This is used to determine the object linked to the usage type.
16
+ */
17
+ kind: QuotaKind
18
+ /**
19
+ * The usage category determine how the usage is calculated.
20
+ */
21
+ category: QuotaCategory
22
+ }
23
+
24
+ export type QuotaKind = 'workspace' | 'bot'
25
+ export type QuotaCategory = 'ratelimit' | 'count' | 'calls' | 'timeout'
26
+ export type QuotaType = typeof quotaTypes[number]
27
+
28
+ export const quotaTypes = [
29
+ 'invocation_timeout',
30
+ 'invocation_calls',
31
+ 'storage_count',
32
+ 'bot_count',
33
+ 'knowledgebase_vector_count',
34
+ 'bot_ratelimit',
35
+ 'table_row_count',
36
+ 'workspace_member_count',
37
+ ] as const
38
+
39
+ export const quotaConfigs = {
40
+ invocation_timeout: {
41
+ name: 'Invocation Timeout',
42
+ description: 'Maximum time in milliseconds a bot can run before timing out.',
43
+ default: 60_000,
44
+ kind: 'bot',
45
+ category: 'timeout',
46
+ },
47
+ storage_count: {
48
+ name: 'Storage Count',
49
+ description: 'Maximum number of storage bytes that can be stored.',
50
+ default: 104_857_600, // 100 MB
51
+ kind: 'bot',
52
+ category: 'count',
53
+ },
54
+ bot_count: {
55
+ name: 'Bot Count',
56
+ description: 'Maximum number of bots that can be created.',
57
+ default: 5,
58
+ kind: 'workspace',
59
+ category: 'count',
60
+ },
61
+ workspace_member_count: {
62
+ name: 'Workspace Member Count',
63
+ description: 'Maximum number of members that can be added to a workspace.',
64
+ default: 3,
65
+ kind: 'workspace',
66
+ category: 'count',
67
+ },
68
+ knowledgebase_vector_count: {
69
+ name: 'Knowledgebase Vector Count',
70
+ description: 'Maximum number of knowledgebase vectors that can be created.',
71
+ default: 5_000,
72
+ kind: 'bot',
73
+ category: 'count',
74
+ },
75
+ table_row_count: {
76
+ name: 'Table Row Count',
77
+ description: 'Maximum number of rows that can be stored in a table.',
78
+ default: 5_000,
79
+ kind: 'bot',
80
+ category: 'count',
81
+ },
82
+ invocation_calls: {
83
+ name: 'Invocation Calls',
84
+ description: 'Maximum number of times a bot can be invoked in a month.',
85
+ default: 25_000,
86
+ kind: 'bot',
87
+ category: 'calls',
88
+ },
89
+ bot_ratelimit: {
90
+ name: 'Bot Ratelimit',
91
+ description: 'Maximum number of times a bot can be invoked in a minute.',
92
+ default: 100,
93
+ kind: 'bot',
94
+ category: 'ratelimit',
95
+ },
96
+ } as const satisfies Record<QuotaType, Quota>