@squidcloud/backend 1.0.337 → 1.0.339

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.
@@ -1,5 +1,7 @@
1
- import { AiFunctionAttributes, AiFunctionParam, ApiEndpointId, CollectionName, CronExpression, CronExpressionString, DatabaseActionType, IntegrationId, MetricActionType, MutationType, SchedulerId, StorageActionType, TopicActionType, TopicName, TriggerId, WebhookId } from '@squidcloud/client';
2
- import { ActionMethodDecorator, AiFunctionAction, ClientConnectionStateChangeAction, ExecutableAction, LimitedAction, LimiterConfig, LimiterOptions, SchedulerAction, SecureAiAgentAction, SecureApiAction, SecureDatabaseAction, SecureDistributedLockAction, SecureGraphQLAction, SecureMetricAction, SecureNativeQueryAction, SecureStorageAction, SecureTopicAction, TriggerAction, WebhookAction } from '../../internal-common/src/public-types-backend/bundle-api.public-types';
1
+ import { ApiEndpointId, CollectionName, IntegrationId, TopicName } from '@squidcloud/client';
2
+ import { ActionMethodDecorator, AiFunctionAction, ClientConnectionStateChangeAction, ExecutableAction, LimitsAction, LimiterConfig, SchedulerAction, SecureAiAgentAction, SecureApiAction, SecureDatabaseAction, SecureDistributedLockAction, SecureGraphQLAction, SecureMetricAction, SecureNativeQueryAction, SecureStorageAction, SecureTopicAction, TriggerAction, WebhookAction } from '../../internal-common/src/public-types-backend/bundle-api.public-types';
3
+ import { CronExpression, CronExpressionString, MutationType, SchedulerId, TriggerId, WebhookId } from './public-types';
4
+ import { AiFunctionAttributes, AiFunctionParam, DatabaseActionType, MetricActionType, StorageActionType, TopicActionType } from '../../internal-common/src/public-types-backend/bundle-data.public-types';
3
5
  /**
4
6
  * Decorator that marks a function for securing a database.
5
7
  * The decorator takes a type of action and an optional integration ID.
@@ -14,6 +16,8 @@ import { ActionMethodDecorator, AiFunctionAction, ClientConnectionStateChangeAct
14
16
  * {@link https://docs.getsquid.ai/docs/security/security-rules/secure-data-access#securedatabase documentation}.
15
17
  * @param type The type of action to secure.
16
18
  * @param integrationId The ID of the integration to secure.
19
+ * @category Database
20
+ * @category Decorator
17
21
  */
18
22
  export declare function secureDatabase<T extends DatabaseActionType>(type: T, integrationId?: IntegrationId): ActionMethodDecorator<SecureDatabaseAction<T>>;
19
23
  /**
@@ -31,9 +35,15 @@ export declare function secureDatabase<T extends DatabaseActionType>(type: T, in
31
35
  * @param collectionName The name of the collection to secure.
32
36
  * @param type The type of action to secure.
33
37
  * @param integrationId The ID of the integration to secure.
38
+ * @category Database
39
+ * @category Decorator
34
40
  */
35
41
  export declare function secureCollection<T extends DatabaseActionType>(collectionName: CollectionName, type: T, integrationId?: IntegrationId): ActionMethodDecorator<SecureDatabaseAction<T>>;
36
- /** The decorator allows protects storage buckets so only authorized users can access it. */
42
+ /**
43
+ * The decorator allows protects storage buckets so only authorized users can access it.
44
+ * @category Storage
45
+ * @category Decorator
46
+ */
37
47
  export declare function secureStorage<T extends StorageActionType>(type: T, integrationId?: IntegrationId): ActionMethodDecorator<SecureStorageAction<T>>;
38
48
  /**
39
49
  * Decorator that marks a function for securing a topic in a message queue.
@@ -48,6 +58,8 @@ export declare function secureStorage<T extends StorageActionType>(type: T, inte
48
58
  * @param topicName The name of the topic to secure.
49
59
  * @param type The type of action to secure.
50
60
  * @param integrationId The ID of the integration to secure.
61
+ * @category Queue
62
+ * @category Decorator
51
63
  */
52
64
  export declare function secureTopic<T extends TopicActionType>(topicName: TopicName, type: T, integrationId?: IntegrationId): ActionMethodDecorator<SecureTopicAction<T>>;
53
65
  /**
@@ -56,15 +68,17 @@ export declare function secureTopic<T extends TopicActionType>(topicName: TopicN
56
68
  *
57
69
  * The function should return a boolean or a `Promise` of a boolean indicating
58
70
  * whether the action is allowed.
71
+ * @category Decorator
59
72
  */
60
73
  export declare function secureMetric<T extends MetricActionType>(options: SecureMetricOptions<T>): ActionMethodDecorator<SecureMetricAction<T>>;
61
74
  /**
62
- * Options for 'secureMetrics' decorator.
63
- * @param metricNamePrefix The name prefix of the metric to secure.
64
- * @param type The type of action to secure.
75
+ * Options for '@secureMetrics' decorator.
76
+ * @category Platform
65
77
  */
66
78
  export interface SecureMetricOptions<T extends MetricActionType> {
79
+ /** The name prefix of the metric to secure. */
67
80
  metricNamePrefix?: string;
81
+ /** The type of action to secure. */
68
82
  type: T;
69
83
  }
70
84
  /**
@@ -80,6 +94,7 @@ export interface SecureMetricOptions<T extends MetricActionType> {
80
94
  * {@link https://docs.getsquid.ai/docs/security/security-rules/secure-api documentation}.
81
95
  * @param integrationId The ID of the integration to secure.
82
96
  * @param endpointId The ID of the endpoint to secure.
97
+ * @category Decorator
83
98
  */
84
99
  export declare function secureApi(integrationId: IntegrationId, endpointId?: ApiEndpointId): ActionMethodDecorator<SecureApiAction>;
85
100
  /**
@@ -92,6 +107,7 @@ export declare function secureApi(integrationId: IntegrationId, endpointId?: Api
92
107
  * To read more about securing a GraphQL integration, see the
93
108
  * {@link https://docs.getsquid.ai/docs/security/security-rules/secure-graphql/ documentation}.
94
109
  * @param integrationId
110
+ * @category Decorator
95
111
  */
96
112
  export declare function secureGraphQL(integrationId: IntegrationId): ActionMethodDecorator<SecureGraphQLAction>;
97
113
  /**
@@ -105,12 +121,19 @@ export declare function secureGraphQL(integrationId: IntegrationId): ActionMetho
105
121
  *
106
122
  * For detailed guidance on executable functions, see:
107
123
  * {@link https://docs.getsquid.ai/docs/backend/executables/ documentation}
124
+ * @category Decorator
108
125
  */
109
126
  export declare function executable(): ActionMethodDecorator<ExecutableAction>;
110
- /** Options for the `@aiFunction` annotation. */
127
+ /**
128
+ * Options for the `@aiFunction` annotation.
129
+ * @category AI
130
+ */
111
131
  export interface AiFunctionOptions {
132
+ /** Describes the capabilities of the function. This is used by the AI agent to determine when to call it. */
112
133
  description: string;
134
+ /** Parameters for the AI function. These parameters are passed to the function by the calling agent. */
113
135
  params: Array<AiFunctionParam>;
136
+ /** Additional optional attributes for the function. Example: related integrations. */
114
137
  attributes?: AiFunctionAttributes;
115
138
  }
116
139
  /**
@@ -119,6 +142,8 @@ export interface AiFunctionOptions {
119
142
  *
120
143
  * To read more about exposing an executable, see the
121
144
  * {@link https://docs.getsquid.ai/docs/ai/ai-functions/ documentation}.
145
+ * @category AI
146
+ * @category Decorator
122
147
  */
123
148
  export declare function aiFunction<ParamType extends Record<string, any> = any>(description: string, params: Array<AiFunctionParam>, attributes?: AiFunctionAttributes): ActionMethodDecorator<AiFunctionAction<ParamType>>;
124
149
  /**
@@ -127,9 +152,14 @@ export declare function aiFunction<ParamType extends Record<string, any> = any>(
127
152
  *
128
153
  * To read more about exposing an executable, see the
129
154
  * {@link https://docs.getsquid.ai/docs/ai/ai-functions/ documentation}.
155
+ * @category AI
156
+ * @category Decorator
130
157
  */
131
158
  export declare function aiFunction<ParamType extends Record<string, any> = any>(options: AiFunctionOptions): ActionMethodDecorator<AiFunctionAction<ParamType>>;
132
- /** Options for the `@trigger` annotation. */
159
+ /**
160
+ * Options for the `@trigger` annotation.
161
+ * @category Platform
162
+ */
133
163
  export interface TriggerOptions {
134
164
  /**
135
165
  * The ID of the trigger. Should be unique.
@@ -158,6 +188,7 @@ export interface TriggerOptions {
158
188
  * @param collectionName The name of the collection to trigger on.
159
189
  * @param integrationId The ID of the integration to trigger on. If not provided, the `built_in_db` integration is
160
190
  * used.
191
+ * @category Decorator
161
192
  */
162
193
  export declare function trigger(id: TriggerId, collectionName: CollectionName, integrationId?: IntegrationId): ActionMethodDecorator<TriggerAction>;
163
194
  /**
@@ -167,9 +198,13 @@ export declare function trigger(id: TriggerId, collectionName: CollectionName, i
167
198
  *
168
199
  * To read more about triggers, see the
169
200
  * {@link https://docs.getsquid.ai/docs/backend/triggers/ documentation}.
201
+ * @category Decorator
170
202
  */
171
203
  export declare function trigger(options: TriggerOptions): ActionMethodDecorator<TriggerAction>;
172
- /** Options for the `@scheduler` annotation. */
204
+ /**
205
+ * Options for the `@scheduler` annotation.
206
+ * @category Platform
207
+ */
173
208
  export interface SchedulerOptions {
174
209
  /** The cron expression (in UTC) to schedule the function on. */
175
210
  cron: CronExpression | CronExpressionString;
@@ -196,6 +231,7 @@ export interface SchedulerOptions {
196
231
  * @param cronExpression The cron expression (in UTC) to schedule the function on.
197
232
  * @param exclusive Whether the scheduler should be exclusive. If set to true, the scheduler will not trigger if the
198
233
  * previous scheduler is still running. Default: true.
234
+ * @category Decorator
199
235
  */
200
236
  export declare function scheduler(id: SchedulerId, cronExpression: CronExpression | CronExpressionString, exclusive?: boolean): ActionMethodDecorator<SchedulerAction>;
201
237
  /**
@@ -204,6 +240,7 @@ export declare function scheduler(id: SchedulerId, cronExpression: CronExpressio
204
240
  *
205
241
  * To read more about schedulers, see the
206
242
  * {@link https://docs.getsquid.ai/docs/backend/schedulers/ documentation}.
243
+ * @category Decorator
207
244
  */
208
245
  export declare function scheduler(options: SchedulerOptions): ActionMethodDecorator<SchedulerAction>;
209
246
  /**
@@ -219,6 +256,7 @@ export declare function scheduler(options: SchedulerOptions): ActionMethodDecora
219
256
  * To read more about webhooks, see the
220
257
  * {@link https://docs.getsquid.ai/docs/backend/webhooks/ documentation}.
221
258
  * @param id The ID of the webhook. Should be unique.
259
+ * @category Decorator
222
260
  */
223
261
  export declare function webhook(id: WebhookId): ActionMethodDecorator<WebhookAction>;
224
262
  /**
@@ -234,6 +272,8 @@ export declare function webhook(id: WebhookId): ActionMethodDecorator<WebhookAct
234
272
  *
235
273
  * @param integrationId The database integration ID.
236
274
  * @returns A decorator function that can be used to secure a native query.
275
+ * @category Database
276
+ * @category Decorator
237
277
  */
238
278
  export declare function secureNativeQuery(integrationId: IntegrationId): ActionMethodDecorator<SecureNativeQueryAction>;
239
279
  /**
@@ -245,6 +285,7 @@ export declare function secureNativeQuery(integrationId: IntegrationId): ActionM
245
285
  * the request.
246
286
  *
247
287
  * @param mutex The mutex to lock on. If none provided, the rule will apply for all mutexes.
288
+ * @category Decorator
248
289
  */
249
290
  export declare function secureDistributedLock(mutex?: string): ActionMethodDecorator<SecureDistributedLockAction>;
250
291
  /**
@@ -258,6 +299,8 @@ export declare function secureDistributedLock(mutex?: string): ActionMethodDecor
258
299
  * {@link https://docs.getsquid.ai/docs/security/security-rules/secure-ai-agents documentation}.
259
300
  *
260
301
  @param agentId The ID of the agent to secure - if not provided, this will apply to all agents.
302
+ @category AI
303
+ @category Decorator
261
304
  */
262
305
  export declare function secureAiAgent(agentId?: string): ActionMethodDecorator<SecureAiAgentAction>;
263
306
  /**
@@ -325,15 +368,11 @@ export declare function secureAiAgent(agentId?: string): ActionMethodDecorator<S
325
368
  * consumed in addition to a "global" scoped limit.
326
369
  *
327
370
  * @param options LimiterConfig object specifying what kind of limits are desired.
371
+ * @category Decorator
328
372
  */
329
- export declare function limits(options: LimiterConfig): ActionMethodDecorator<LimitedAction>;
330
- /** Decorator that marks a function for handling a client connection state change */
331
- export declare function clientConnectionStateHandler(): ActionMethodDecorator<ClientConnectionStateChangeAction>;
373
+ export declare function limits(options: LimiterConfig): ActionMethodDecorator<LimitsAction>;
332
374
  /**
333
- * Convert LimiterConfig to LimiterOptions.
334
- *
335
- * This decouples the required syntax for the developer from the internal implementation.
336
- *
337
- * @param config LimiterConfig to convert.
375
+ * Decorator that marks a function for handling a client connection state change.
376
+ * @category Platform
338
377
  */
339
- export declare function limiterConfigToOptions(config: LimiterConfig): LimiterOptions;
378
+ export declare function clientConnectionStateHandler(): ActionMethodDecorator<ClientConnectionStateChangeAction>;
@@ -1,5 +1,6 @@
1
- export * from '../../internal-common/src/public-types-backend/ai-chatbot.public-context';
1
+ export * from '../../internal-common/src/public-types-backend/ai-agent.public-context';
2
2
  export * from '../../internal-common/src/public-types-backend/api-call.public-context';
3
+ export * from '../../internal-common/src/public-types-backend/application.public-types';
3
4
  export * from '../../internal-common/src/public-types-backend/bundle-api.public-types';
4
5
  export * from '../../internal-common/src/public-types-backend/distributed-lock.public-context';
5
6
  export * from '../../internal-common/src/public-types-backend/graphql.public-context';