@bpinternal/const 0.0.1 → 0.0.2

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,40 @@ 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: 20480,
34
+ // 20 KB
35
+ bot_installed_integrations_count: 30,
36
+ bot_integration_configuration_bytes: 20480,
37
+ // 20 KB
38
+ bot_recurring_event_count: 5,
39
+ bot_recurring_event_payload_bytes: 131072,
40
+ // 128 KB
41
+ event_definition_count: 20,
42
+ integration_channel_count: 10,
43
+ integration_channel_message_type_count: 20,
44
+ integration_identifier_count: 50,
45
+ integration_version_count: 50,
46
+ integrations_owned_count: 20,
47
+ message_payload_bytes: 131072,
48
+ // 128 KB
49
+ schema_bytes: 102400,
50
+ // 100 KB
51
+ state_definition_count: 5,
52
+ state_item_payload_bytes: 131072,
53
+ // 128 KB
54
+ tag_definition_count: 50
55
+ };
56
+
28
57
  // src/prefixes.ts
29
58
  var prefixToObjectMap = {
30
59
  action: "action",
@@ -92,8 +121,82 @@ var objectToPrefixMap = {
92
121
  webhook: "webhook",
93
122
  workspace: "wkspace"
94
123
  };
124
+
125
+ // src/quotas.ts
126
+ var quotaTypes = [
127
+ "invocation_timeout",
128
+ "invocation_calls",
129
+ "storage_count",
130
+ "bot_count",
131
+ "knowledgebase_vector_count",
132
+ "bot_ratelimit",
133
+ "table_row_count",
134
+ "workspace_member_count"
135
+ ];
136
+ var quotaConfigs = {
137
+ invocation_timeout: {
138
+ name: "Invocation Timeout",
139
+ description: "Maximum time in milliseconds a bot can run before timing out.",
140
+ default: 6e4,
141
+ kind: "bot",
142
+ category: "timeout"
143
+ },
144
+ storage_count: {
145
+ name: "Storage Count",
146
+ description: "Maximum number of storage bytes that can be stored.",
147
+ default: 104857600,
148
+ // 100 MB
149
+ kind: "bot",
150
+ category: "count"
151
+ },
152
+ bot_count: {
153
+ name: "Bot Count",
154
+ description: "Maximum number of bots that can be created.",
155
+ default: 5,
156
+ kind: "workspace",
157
+ category: "count"
158
+ },
159
+ workspace_member_count: {
160
+ name: "Workspace Member Count",
161
+ description: "Maximum number of members that can be added to a workspace.",
162
+ default: 3,
163
+ kind: "workspace",
164
+ category: "count"
165
+ },
166
+ knowledgebase_vector_count: {
167
+ name: "Knowledgebase Vector Count",
168
+ description: "Maximum number of knowledgebase vectors that can be created.",
169
+ default: 5e3,
170
+ kind: "bot",
171
+ category: "count"
172
+ },
173
+ table_row_count: {
174
+ name: "Table Row Count",
175
+ description: "Maximum number of rows that can be stored in a table.",
176
+ default: 5e3,
177
+ kind: "bot",
178
+ category: "count"
179
+ },
180
+ invocation_calls: {
181
+ name: "Invocation Calls",
182
+ description: "Maximum number of times a bot can be invoked in a month.",
183
+ default: 25e3,
184
+ kind: "bot",
185
+ category: "calls"
186
+ },
187
+ bot_ratelimit: {
188
+ name: "Bot Ratelimit",
189
+ description: "Maximum number of times a bot can be invoked in a minute.",
190
+ default: 100,
191
+ kind: "bot",
192
+ category: "ratelimit"
193
+ }
194
+ };
95
195
  // Annotate the CommonJS export names for ESM import in node:
96
196
  0 && (module.exports = {
197
+ limitConfigs,
97
198
  objectToPrefixMap,
98
- prefixToObjectMap
199
+ prefixToObjectMap,
200
+ quotaConfigs,
201
+ quotaTypes
99
202
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,29 @@
1
+ // src/limits.ts
2
+ var limitConfigs = {
3
+ bot_configuration_bytes: 20480,
4
+ // 20 KB
5
+ bot_installed_integrations_count: 30,
6
+ bot_integration_configuration_bytes: 20480,
7
+ // 20 KB
8
+ bot_recurring_event_count: 5,
9
+ bot_recurring_event_payload_bytes: 131072,
10
+ // 128 KB
11
+ event_definition_count: 20,
12
+ integration_channel_count: 10,
13
+ integration_channel_message_type_count: 20,
14
+ integration_identifier_count: 50,
15
+ integration_version_count: 50,
16
+ integrations_owned_count: 20,
17
+ message_payload_bytes: 131072,
18
+ // 128 KB
19
+ schema_bytes: 102400,
20
+ // 100 KB
21
+ state_definition_count: 5,
22
+ state_item_payload_bytes: 131072,
23
+ // 128 KB
24
+ tag_definition_count: 50
25
+ };
26
+
1
27
  // src/prefixes.ts
2
28
  var prefixToObjectMap = {
3
29
  action: "action",
@@ -65,7 +91,81 @@ var objectToPrefixMap = {
65
91
  webhook: "webhook",
66
92
  workspace: "wkspace"
67
93
  };
94
+
95
+ // src/quotas.ts
96
+ var quotaTypes = [
97
+ "invocation_timeout",
98
+ "invocation_calls",
99
+ "storage_count",
100
+ "bot_count",
101
+ "knowledgebase_vector_count",
102
+ "bot_ratelimit",
103
+ "table_row_count",
104
+ "workspace_member_count"
105
+ ];
106
+ var quotaConfigs = {
107
+ invocation_timeout: {
108
+ name: "Invocation Timeout",
109
+ description: "Maximum time in milliseconds a bot can run before timing out.",
110
+ default: 6e4,
111
+ kind: "bot",
112
+ category: "timeout"
113
+ },
114
+ storage_count: {
115
+ name: "Storage Count",
116
+ description: "Maximum number of storage bytes that can be stored.",
117
+ default: 104857600,
118
+ // 100 MB
119
+ kind: "bot",
120
+ category: "count"
121
+ },
122
+ bot_count: {
123
+ name: "Bot Count",
124
+ description: "Maximum number of bots that can be created.",
125
+ default: 5,
126
+ kind: "workspace",
127
+ category: "count"
128
+ },
129
+ workspace_member_count: {
130
+ name: "Workspace Member Count",
131
+ description: "Maximum number of members that can be added to a workspace.",
132
+ default: 3,
133
+ kind: "workspace",
134
+ category: "count"
135
+ },
136
+ knowledgebase_vector_count: {
137
+ name: "Knowledgebase Vector Count",
138
+ description: "Maximum number of knowledgebase vectors that can be created.",
139
+ default: 5e3,
140
+ kind: "bot",
141
+ category: "count"
142
+ },
143
+ table_row_count: {
144
+ name: "Table Row Count",
145
+ description: "Maximum number of rows that can be stored in a table.",
146
+ default: 5e3,
147
+ kind: "bot",
148
+ category: "count"
149
+ },
150
+ invocation_calls: {
151
+ name: "Invocation Calls",
152
+ description: "Maximum number of times a bot can be invoked in a month.",
153
+ default: 25e3,
154
+ kind: "bot",
155
+ category: "calls"
156
+ },
157
+ bot_ratelimit: {
158
+ name: "Bot Ratelimit",
159
+ description: "Maximum number of times a bot can be invoked in a minute.",
160
+ default: 100,
161
+ kind: "bot",
162
+ category: "ratelimit"
163
+ }
164
+ };
68
165
  export {
166
+ limitConfigs,
69
167
  objectToPrefixMap,
70
- prefixToObjectMap
168
+ prefixToObjectMap,
169
+ quotaConfigs,
170
+ quotaTypes
71
171
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinternal/const",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
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,20 @@
1
+ export type LimitType = keyof typeof limitConfigs
2
+
3
+ export const limitConfigs = {
4
+ bot_configuration_bytes: 20480, // 20 KB
5
+ bot_installed_integrations_count: 30,
6
+ bot_integration_configuration_bytes: 20480, // 20 KB
7
+ bot_recurring_event_count: 5,
8
+ bot_recurring_event_payload_bytes: 131072, // 128 KB
9
+ event_definition_count: 20,
10
+ integration_channel_count: 10,
11
+ integration_channel_message_type_count: 20,
12
+ integration_identifier_count: 50,
13
+ integration_version_count: 50,
14
+ integrations_owned_count: 20,
15
+ message_payload_bytes: 131072, // 128 KB
16
+ schema_bytes: 102400, // 100 KB
17
+ state_definition_count: 5,
18
+ state_item_payload_bytes: 131072, // 128 KB
19
+ tag_definition_count: 50,
20
+ } as const satisfies Record<string, number>
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>