@squidcloud/freshdesk-client 1.0.496 → 1.0.498

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 (64) hide show
  1. package/dist/connectors/freshdesk/common/src/freshdesk-types.d.ts +1 -28
  2. package/dist/internal-common/src/ai/system-openai-compatible.d.ts +35 -0
  3. package/dist/internal-common/src/public-types/ai-agent-integrations.public-types.d.ts +71 -0
  4. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +1594 -0
  5. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +303 -0
  6. package/dist/internal-common/src/public-types/ai-function.public-types.d.ts +114 -0
  7. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +2378 -0
  8. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +266 -0
  9. package/dist/internal-common/src/public-types/api-client.public-types.d.ts +9 -0
  10. package/dist/internal-common/src/public-types/api.public-types.d.ts +99 -0
  11. package/dist/internal-common/src/public-types/backend.public-types.d.ts +61 -0
  12. package/dist/internal-common/src/public-types/connector.public-types.d.ts +12 -0
  13. package/dist/internal-common/src/public-types/context.public-types.d.ts +83 -0
  14. package/dist/internal-common/src/public-types/document.public-types.d.ts +71 -0
  15. package/dist/internal-common/src/public-types/event.public-types.d.ts +18 -0
  16. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +405 -0
  17. package/dist/internal-common/src/public-types/http-status.public-types.d.ts +415 -0
  18. package/dist/internal-common/src/public-types/integration.public-types.d.ts +65 -0
  19. package/dist/internal-common/src/public-types/job.public-types.d.ts +101 -0
  20. package/dist/internal-common/src/public-types/langgraph.public-types.d.ts +50 -0
  21. package/dist/internal-common/src/public-types/metadata-filter.public-types.d.ts +106 -0
  22. package/dist/internal-common/src/public-types/query.public-types.d.ts +149 -0
  23. package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +43 -0
  24. package/dist/internal-common/src/public-types/schema.public-types.d.ts +88 -0
  25. package/dist/internal-common/src/public-types/secret.public-types.d.ts +82 -0
  26. package/dist/internal-common/src/public-types/socket.public-types.d.ts +4 -0
  27. package/dist/internal-common/src/public-types/source-code.public-types.d.ts +208 -0
  28. package/dist/internal-common/src/public-types/typescript.public-types.d.ts +20 -0
  29. package/dist/internal-common/src/public-types-backend/ai-agent.public-context.d.ts +101 -0
  30. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
  31. package/dist/internal-common/src/public-types-backend/application.public-types.d.ts +94 -0
  32. package/dist/internal-common/src/public-types-backend/bundle-api.public-types.d.ts +199 -0
  33. package/dist/internal-common/src/public-types-backend/bundle-data.public-types.d.ts +18 -0
  34. package/dist/internal-common/src/public-types-backend/distributed-lock.public-context.d.ts +4 -0
  35. package/dist/internal-common/src/public-types-backend/graphql.public-context.d.ts +7 -0
  36. package/dist/internal-common/src/public-types-backend/langgraph.public-context.d.ts +16 -0
  37. package/dist/internal-common/src/public-types-backend/mcp.public-types.d.ts +55 -0
  38. package/dist/internal-common/src/public-types-backend/metric.public-context.d.ts +12 -0
  39. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
  40. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
  41. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
  42. package/dist/internal-common/src/public-types-backend/storage.public-types.d.ts +15 -0
  43. package/dist/internal-common/src/public-types-backend/topic.public-context.d.ts +17 -0
  44. package/dist/internal-common/src/types/application.types.d.ts +98 -0
  45. package/dist/internal-common/src/types/backend-run.types.d.ts +55 -0
  46. package/dist/internal-common/src/types/bundle-data.types.d.ts +18 -0
  47. package/dist/internal-common/src/types/connector.types.d.ts +77 -0
  48. package/dist/internal-common/src/types/integrations/ai.types.d.ts +1 -0
  49. package/dist/internal-common/src/types/integrations/api.types.d.ts +76 -0
  50. package/dist/internal-common/src/types/integrations/auth.types.d.ts +1 -0
  51. package/dist/internal-common/src/types/integrations/database.types.d.ts +44 -0
  52. package/dist/internal-common/src/types/integrations/observability.types.d.ts +1 -0
  53. package/dist/internal-common/src/types/integrations/queue-types.d.ts +1 -0
  54. package/dist/internal-common/src/types/integrations/schemas.d.ts +6 -0
  55. package/dist/internal-common/src/types/integrations/storage-types.d.ts +22 -0
  56. package/dist/internal-common/src/types/langgraph.types.d.ts +1 -0
  57. package/dist/internal-common/src/types/openapi.types.d.ts +1 -0
  58. package/dist/internal-common/src/types/query.types.d.ts +21 -0
  59. package/dist/internal-common/src/types/secret.types.d.ts +7 -0
  60. package/dist/internal-common/src/types/time-units.d.ts +1 -0
  61. package/dist/internal-common/src/utils/object.d.ts +88 -0
  62. package/dist/internal-common/src/utils/serialization.d.ts +30 -0
  63. package/dist/internal-common/src/utils/worker-manager-utils.d.ts +2 -0
  64. package/package.json +2 -2
@@ -0,0 +1,20 @@
1
+ /** Makes the specified keys in a type optional, leaving the rest unchanged. */
2
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
3
+ type PropertiesWithPrefix<Prefix extends string> = {
4
+ [key in `${Prefix}${string}`]: any;
5
+ };
6
+ type Pred = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
7
+ /**
8
+ * Recursively flattens all keys of a type into dot notation paths up to a fixed depth.
9
+ * Used to map deeply nested fields with their access paths.
10
+ */
11
+ export type DeepRecord<T, RemainingDepth extends number & keyof Pred = 5, Prefix extends string = ''> = RemainingDepth extends 0 ? PropertiesWithPrefix<Prefix> : {
12
+ [k in keyof T]-?: k extends string | number ? Record<`${Prefix}${k}`, T[k]> | (Required<T>[k] extends any[] ? never : Required<T>[k] extends object ? DeepRecord<Required<T>[k], Pred[RemainingDepth], `${Prefix}${k}.`> : never) : never;
13
+ }[keyof T];
14
+ /** Gets the union of keys from a union of object types. */
15
+ export type UnionKeys<T> = T extends any ? keyof T : never;
16
+ /** Extracts the type of specific field `K` from a union of object types `T`. */
17
+ export type FieldOf<T, K extends UnionKeys<T>> = Extract<T, Record<K, any>>[K];
18
+ /** All possible deeply nested field paths of a type, joined by dot notation. */
19
+ export type Paths<T> = UnionKeys<DeepRecord<T>>;
20
+ export {};
@@ -0,0 +1,101 @@
1
+ import { AiConnectedIntegrationMetadata, AiSessionContext, AllAiAgentChatOptions } from '../public-types/ai-agent.public-types';
2
+ import { AiFunctionId } from '../public-types/backend.public-types';
3
+ import { AiAgentId, IntegrationId } from '../public-types/communication.public-types';
4
+ import { AuthWithBearer } from '../public-types/context.public-types';
5
+ import { IntegrationType } from '../public-types/integration.public-types';
6
+ /**
7
+ * Context object passed as a second parameter to every AI function call,
8
+ * providing both agent-specific and function-specific context.
9
+ * @category AI
10
+ */
11
+ export interface AiFunctionCallContext<FunctionContextType = unknown, AgentContextType = unknown> {
12
+ /** Unique identifier for the AI agent making the call. */
13
+ agentId: AiAgentId;
14
+ /**
15
+ * Persistent context of the AI agent that calls the function.
16
+ * Same for all AI functions used by this agent.
17
+ */
18
+ agentContext: AgentContextType;
19
+ /**
20
+ * Context specific to each individual AI function call.
21
+ * Can contain parameters or data unique to the current function invocation
22
+ * or current function connection to the AI agent.
23
+ */
24
+ functionContext: FunctionContextType;
25
+ /** The session associated with this AI function call. */
26
+ sessionContext: AiSessionContext;
27
+ /**
28
+ * Instructions of the calling AI agent, when the function runs an AI sub-agent that should
29
+ * honor them (e.g. formatting rules or domain conventions). For integration-connected functions
30
+ * this carries the integration's instructions instead (see AiConnectedIntegrationMetadata).
31
+ */
32
+ instructions?: string;
33
+ }
34
+ /** AiFunctionContext for the connected integration function. Contains predefined integration data. */
35
+ export interface AiFunctionCallContextWithIntegration<AiConnectedIntegrationOptionsType = unknown, FunctionContextType = unknown, AgentContextType = unknown> extends AiFunctionCallContext<FunctionContextType, AgentContextType>, AiConnectedIntegrationMetadata<AiConnectedIntegrationOptionsType> {
36
+ /** Access token the caller supplied for this integration on the current request, if any. */
37
+ accessToken?: string;
38
+ }
39
+ /**
40
+ * Provides context to the security rules of an AI Agent for each new user prompt.
41
+ * Refer to the `@secureAiAgent` annotation for more details.
42
+ * @category AI
43
+ */
44
+ export declare class SecureAiAgentContext {
45
+ readonly prompt?: string;
46
+ readonly agentId: AiAgentId;
47
+ readonly options?: AllAiAgentChatOptions;
48
+ }
49
+ /**
50
+ * Provides context to a knowledge base's `accessControl.scopeResolver` function, which turns the caller
51
+ * into the set of access scopes they hold for one knowledge base search.
52
+ *
53
+ * The caller is taken from the authenticated request, never from anything the client can shape, so a
54
+ * client cannot ask for another user's scopes. `auth` is `undefined` for an unauthenticated caller and
55
+ * for one authenticating with an API key rather than a user token — in both cases the search sees only
56
+ * content stamped public, so returning an empty array is the correct answer for a caller you cannot
57
+ * identify.
58
+ *
59
+ * @category AI
60
+ */
61
+ export interface ResolveKbScopesContext {
62
+ /** The knowledge base being searched. */
63
+ knowledgeBaseId: string;
64
+ /**
65
+ * The authenticated caller, carrying their `userId` and JWT `attributes`. The same object
66
+ * `this.squid.getUserAuth()` returns inside the function.
67
+ */
68
+ auth: AuthWithBearer | undefined;
69
+ }
70
+ /**
71
+ * A type defining an AI functions configurator request.
72
+ * @category AI
73
+ */
74
+ export interface AiFunctionsConfiguratorRequest {
75
+ /** ID of the connected integration to configure. */
76
+ integrationId: IntegrationId;
77
+ /** Type of the integration to configure. */
78
+ integrationType: IntegrationType;
79
+ /** Current connected integration metadata with custom options. */
80
+ metadata: AiConnectedIntegrationMetadata;
81
+ }
82
+ /**
83
+ * Result of the configurator function call:
84
+ * details how to override the set of AI functions available in the bundle.
85
+ */
86
+ export interface AiFunctionsConfiguratorResponse {
87
+ /**
88
+ * Map of overridden functions.
89
+ * If a function is not mentioned in the map - there is no override.
90
+ */
91
+ functionOverrides: Record<AiFunctionId, AiFunctionOverrideDetails>;
92
+ }
93
+ /** An override for a single AI function. */
94
+ export interface AiFunctionOverrideDetails {
95
+ /** Overridden AI function ID. */
96
+ id: AiFunctionId;
97
+ /** If set to true, the function won't be available for the connector agent. */
98
+ isExcluded?: boolean;
99
+ /** Set of parameters to fill with a predefined values. */
100
+ predefinedParameters: Record<string, unknown>;
101
+ }
@@ -0,0 +1,30 @@
1
+ import { ApiOptions } from '../public-types/api-client.public-types';
2
+ import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
3
+ import { IntegrationId } from '../public-types/communication.public-types';
4
+ /** The headers of an API call. */
5
+ export type ApiHeaders = Record<string, string | number | boolean>;
6
+ /** The context of an API call. */
7
+ export declare class ApiCallContext {
8
+ readonly integrationId: IntegrationId;
9
+ readonly endpointId: ApiEndpointId;
10
+ readonly url: string;
11
+ readonly method: HttpMethod;
12
+ readonly body: unknown;
13
+ readonly options: ApiOptions;
14
+ }
15
+ /**
16
+ * Represents a request to call an API through a specified integration and endpoint.
17
+ * Includes optional method override and additional request options.
18
+ */
19
+ export interface CallApiRequest<BodyType = any> {
20
+ /** The identifier of the integration through which the API is called. */
21
+ integrationId: IntegrationId;
22
+ /** Target API endpoint to invoke. */
23
+ endpointId: ApiEndpointId;
24
+ /** Optional request payload. */
25
+ body?: BodyType;
26
+ /** Optional HTTP method override. Default is POST. */
27
+ overrideMethod?: HttpMethod;
28
+ /** Additional request options. */
29
+ options: ApiOptions;
30
+ }
@@ -0,0 +1,94 @@
1
+ /** A type alias for a string that represents a webhook. */
2
+ export type WebhookId = string;
3
+ /** A type alias for a string that represents a trigger ID. */
4
+ export type TriggerId = string;
5
+ /** A type alias for a string that represents a scheduler ID. */
6
+ export type SchedulerId = string;
7
+ /** The supported cron expression string. */
8
+ export type CronExpressionString = `${string} ${string} ${string} ${string} ${string}` | `${string} ${string} ${string} ${string}`;
9
+ /** A set of predefined cron expressions. */
10
+ export declare enum CronExpression {
11
+ EVERY_SECOND = "* * * * * *",
12
+ EVERY_5_SECONDS = "*/5 * * * * *",
13
+ EVERY_10_SECONDS = "*/10 * * * * *",
14
+ EVERY_30_SECONDS = "*/30 * * * * *",
15
+ EVERY_MINUTE = "*/1 * * * *",
16
+ EVERY_5_MINUTES = "0 */5 * * * *",
17
+ EVERY_10_MINUTES = "0 */10 * * * *",
18
+ EVERY_30_MINUTES = "0 */30 * * * *",
19
+ EVERY_HOUR = "0 0-23/1 * * *",
20
+ EVERY_2_HOURS = "0 0-23/2 * * *",
21
+ EVERY_3_HOURS = "0 0-23/3 * * *",
22
+ EVERY_4_HOURS = "0 0-23/4 * * *",
23
+ EVERY_5_HOURS = "0 0-23/5 * * *",
24
+ EVERY_6_HOURS = "0 0-23/6 * * *",
25
+ EVERY_7_HOURS = "0 0-23/7 * * *",
26
+ EVERY_8_HOURS = "0 0-23/8 * * *",
27
+ EVERY_9_HOURS = "0 0-23/9 * * *",
28
+ EVERY_10_HOURS = "0 0-23/10 * * *",
29
+ EVERY_11_HOURS = "0 0-23/11 * * *",
30
+ EVERY_12_HOURS = "0 0-23/12 * * *",
31
+ EVERY_DAY_AT_1AM = "0 01 * * *",
32
+ EVERY_DAY_AT_2AM = "0 02 * * *",
33
+ EVERY_DAY_AT_3AM = "0 03 * * *",
34
+ EVERY_DAY_AT_4AM = "0 04 * * *",
35
+ EVERY_DAY_AT_5AM = "0 05 * * *",
36
+ EVERY_DAY_AT_6AM = "0 06 * * *",
37
+ EVERY_DAY_AT_7AM = "0 07 * * *",
38
+ EVERY_DAY_AT_8AM = "0 08 * * *",
39
+ EVERY_DAY_AT_9AM = "0 09 * * *",
40
+ EVERY_DAY_AT_10AM = "0 10 * * *",
41
+ EVERY_DAY_AT_11AM = "0 11 * * *",
42
+ EVERY_DAY_AT_NOON = "0 12 * * *",
43
+ EVERY_DAY_AT_1PM = "0 13 * * *",
44
+ EVERY_DAY_AT_2PM = "0 14 * * *",
45
+ EVERY_DAY_AT_3PM = "0 15 * * *",
46
+ EVERY_DAY_AT_4PM = "0 16 * * *",
47
+ EVERY_DAY_AT_5PM = "0 17 * * *",
48
+ EVERY_DAY_AT_6PM = "0 18 * * *",
49
+ EVERY_DAY_AT_7PM = "0 19 * * *",
50
+ EVERY_DAY_AT_8PM = "0 20 * * *",
51
+ EVERY_DAY_AT_9PM = "0 21 * * *",
52
+ EVERY_DAY_AT_10PM = "0 22 * * *",
53
+ EVERY_DAY_AT_11PM = "0 23 * * *",
54
+ EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
55
+ EVERY_WEEK = "0 0 * * 7",
56
+ EVERY_WEEKDAY = "0 0 * * 1-5",
57
+ EVERY_WEEKEND = "0 0 * * 6,7",
58
+ EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
59
+ EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
60
+ EVERY_2ND_HOUR = "0 */2 * * *",
61
+ EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
62
+ EVERY_2ND_MONTH = "0 0 1 */2 *",
63
+ EVERY_QUARTER = "0 0 1 */3 *",
64
+ EVERY_6_MONTHS = "0 0 1 */6 *",
65
+ EVERY_YEAR = "0 0 1 1 *",
66
+ EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
67
+ EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
68
+ EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
69
+ MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
70
+ MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
71
+ MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
72
+ MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
73
+ MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
74
+ MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
75
+ MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
76
+ MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
77
+ MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
78
+ MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
79
+ MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
80
+ MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
81
+ MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
82
+ MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
83
+ MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
84
+ MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
85
+ MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
86
+ MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
87
+ MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
88
+ MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
89
+ MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
90
+ MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
91
+ MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
92
+ MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
93
+ MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
94
+ }
@@ -0,0 +1,199 @@
1
+ import { UserAiAskResponse, UserAiChatOptions } from '../public-types/ai-agent.public-types';
2
+ import { ClientId, IntegrationId } from '../public-types/communication.public-types';
3
+ import { CollectionName, DocIdOrDocIdObj, DocumentData } from '../public-types/document.public-types';
4
+ import { TriggerEvent } from '../public-types/event.public-types';
5
+ import { ClientConnectionState } from '../public-types/socket.public-types';
6
+ import { AiFunctionCallContextWithIntegration, SecureAiAgentContext } from './ai-agent.public-context';
7
+ import { ApiCallContext } from './api-call.public-context';
8
+ import { DatabaseActionType, MetricActionType, StorageActionType, TopicActionType } from './bundle-data.public-types';
9
+ import { DistributedLockContext } from './distributed-lock.public-context';
10
+ import { GraphqlContext } from './graphql.public-context';
11
+ import { SecureLangGraphContext } from './langgraph.public-context';
12
+ import { McpAuthorizationRequest } from './mcp.public-types';
13
+ import { SecureMetricContext } from './metric.public-context';
14
+ import { MutationContext, MutationType } from './mutation.public-context';
15
+ import { NativeQueryContext } from './native-query.public-context';
16
+ import { AiQueryContext, QueryContext } from './query.public-context';
17
+ import { StorageContext } from './storage.public-types';
18
+ import { TopicReadContext, TopicWriteContext } from './topic.public-context';
19
+ /** Event types live in the client-visible public-types; re-exported here for the backend SDK surface. */
20
+ export { EmitEventRequest, TriggerEvent } from '../public-types/event.public-types';
21
+ /**
22
+ * @category Database
23
+ */
24
+ export type SecureDatabaseAction<T extends DatabaseActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? ((context: QueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: MutationContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
25
+ /**
26
+ * @category Database
27
+ * @category AI
28
+ */
29
+ export type SecureAiQueryAction = ((context: AiQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
30
+ /**
31
+ * @category Storage
32
+ */
33
+ export type SecureStorageAction<T extends StorageActionType> = T extends 'all' ? () => boolean | Promise<boolean> : (context: StorageContext) => boolean | Promise<boolean>;
34
+ /**
35
+ * @category Queue
36
+ */
37
+ export type SecureTopicAction<T extends TopicActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? ((context: TopicReadContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: TopicWriteContext<T>) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
38
+ /** A function that determines access to a metric based on the action type T. */
39
+ export type SecureMetricAction<T extends MetricActionType> = T extends 'all' ? ((context: SecureMetricContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : T extends 'write' ? ((context: SecureMetricContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : never;
40
+ /** A function that determines access to an API call, optionally using the call context. */
41
+ export type SecureApiAction = ((context: ApiCallContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
42
+ /** A function that determines access to a native query, optionally using the query context. */
43
+ export type SecureNativeQueryAction = ((context: NativeQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
44
+ /** A function that determines access to a distributed lock, optionally using the lock context. */
45
+ export type SecureDistributedLockAction = ((context: DistributedLockContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
46
+ /** A function that determines access to a GraphQL operation, optionally using the GraphQL context. */
47
+ export type SecureGraphQLAction = ((context: GraphqlContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
48
+ /**
49
+ * @category AI
50
+ */
51
+ export type SecureAiAgentAction = ((context: SecureAiAgentContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
52
+ /**
53
+ * @category AI
54
+ */
55
+ export type SecureLangGraphAction = ((context: SecureLangGraphContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
56
+ /** A type defining a function that handles changes in client connection state. */
57
+ export type ClientConnectionStateChangeAction = (clientId: ClientId, clientConnectionState: ClientConnectionState) => Promise<void> | void;
58
+ /** A type representing a generic executable function with variable arguments. */
59
+ export type ExecutableAction = (...args: any[]) => any;
60
+ /**
61
+ * A type defining an AI function action with parameters and context.
62
+ * The context object may be AiFunctionCallContext (for functions with no integration type) or
63
+ * AiFunctionCallContextWithIntegration.
64
+ * @category AI
65
+ */
66
+ export type AiFunctionAction<T extends Record<string, any> = any> = (params: T, context: AiFunctionCallContextWithIntegration<any, any, any>) => any;
67
+ /**
68
+ * A type defining an MCP tool with parameters.
69
+ * @category AI
70
+ */
71
+ export type McpToolAction<T extends Record<string, any> = any> = (params: T) => any;
72
+ /**
73
+ * A type defining an MCP authorizer action that can authorize requests.
74
+ * @category AI
75
+ */
76
+ export type McpAuthorizerAction = ((request: McpAuthorizationRequest) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
77
+ /** A type defining a queue message handler function that responds to messages on a topic. */
78
+ export type QueueMessageAction<T = unknown> = (request: QueueMessageRequest<T>) => void | Promise<void>;
79
+ /** The context provided to a queue message handler function. */
80
+ export interface QueueMessageRequest<T = unknown> {
81
+ /** The ID of the integration the topic belongs to. */
82
+ integrationId: IntegrationId;
83
+ /** The name of the topic the message was received on. */
84
+ topicName: string;
85
+ /** The message payload. */
86
+ message: T;
87
+ }
88
+ /** A type defining an event handler function that responds to an emitted `TriggerEvent`. */
89
+ export type EventHandlerAction<T = unknown> = (event: TriggerEvent<T>) => void | Promise<void>;
90
+ /** A type defining a trigger function that responds to document changes. */
91
+ export type TriggerAction = ((request: TriggerRequest) => void | Promise<void>) | (() => void | Promise<void>);
92
+ /** The context provided to a trigger function. */
93
+ export interface TriggerRequest<T extends DocumentData = any> {
94
+ /** The ID of the integration associated with the trigger. */
95
+ integrationId: IntegrationId;
96
+ /** The name of the collection affected by the trigger. */
97
+ collectionName: CollectionName;
98
+ /** The document ID or object representing the affected document. */
99
+ docId: DocIdOrDocIdObj;
100
+ /** The type of mutation that triggered the action. */
101
+ mutationType: MutationType;
102
+ /** The document state before the mutation, if available. */
103
+ docBefore?: T;
104
+ /** The document state after the mutation, if available. */
105
+ docAfter?: T;
106
+ }
107
+ /** A type defining a scheduled task action. */
108
+ export type SchedulerAction = () => void | Promise<void>;
109
+ /** Defines a function with rate or quota limits. */
110
+ export type LimitsAction = (...args: any[]) => any | Promise<any>;
111
+ /** Specifies the scope of a limiter, such as per IP, user, or global. */
112
+ export type LimiterScope = 'ip' | 'user' | 'global';
113
+ /** Specifies the renewal period for a quota limit. */
114
+ export type QuotaRenewPeriod = 'hourly' | 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'annually';
115
+ /** Options for rate limiting. */
116
+ export interface RateLimitOptions {
117
+ /** Number of executions permitted per second, allowing bursts up to 3x this limit. */
118
+ value: number;
119
+ /** Specifies the scope of the rate limit, such as per user, IP, or global. */
120
+ scope?: LimiterScope;
121
+ }
122
+ /** Options for quota limiting. */
123
+ export interface QuotaLimitOptions {
124
+ /** Total number of executions allowed, reset upon backend redeployment. */
125
+ value: number;
126
+ /** Specifies the scope of the quota limit, such as per user, IP, or global. */
127
+ scope?: LimiterScope;
128
+ /** Defines the period after which the quota resets. */
129
+ renewPeriod?: QuotaRenewPeriod;
130
+ }
131
+ /**
132
+ * Options for rate and quota limiting backend functions.
133
+ *
134
+ * It is not the type the developer defines in their code, which is LimiterConfig.
135
+ */
136
+ export interface LimiterOptions {
137
+ /** Array of rate limit configurations, allowing different limits at different scopes. */
138
+ rateLimit?: RateLimitOptions[];
139
+ /** Array of quota limit configurations, allowing different limits at different scopes. */
140
+ quotaLimit?: QuotaLimitOptions[];
141
+ }
142
+ /** A configuration type for defining rate and quota limits in a flexible format. */
143
+ export type LimiterConfig = {
144
+ /** The rate limit, specified as a number, a single RateLimitOptions object, or an array of RateLimitOptions. */
145
+ rateLimit?: number | RateLimitOptions | Array<RateLimitOptions>;
146
+ /** The quota limit, specified as a number, a single QuotaLimitOptions object, or an array of QuotaLimitOptions. */
147
+ quotaLimit?: number | QuotaLimitOptions | Array<QuotaLimitOptions>;
148
+ };
149
+ /** A type defining a webhook function that processes incoming requests, with or without request context. */
150
+ export type WebhookAction = ((request: WebhookRequest) => any) | (() => any);
151
+ /** The context provided to a webhook function. */
152
+ export interface WebhookRequest<T = any> {
153
+ /** The parsed body of the webhook request. */
154
+ body: T;
155
+ /** The unparsed body of the webhook request as a string, if available. */
156
+ rawBody?: string;
157
+ /** A record of query parameters included in the webhook request. */
158
+ queryParams: Record<string, string>;
159
+ /** A record of HTTP headers included in the webhook request. */
160
+ headers: Record<string, string>;
161
+ /** The HTTP method used for the webhook request. */
162
+ httpMethod: 'post' | 'get' | 'put' | 'delete';
163
+ /** An array of files uploaded with the webhook request, if any. */
164
+ files?: Array<SquidFile>;
165
+ }
166
+ /** An interface representing the response structure returned by a webhook function. */
167
+ export interface WebhookResponse {
168
+ /** A record of HTTP headers to include in the webhook response. */
169
+ headers: Record<string, any>;
170
+ /** The body content of the webhook response. */
171
+ body: any;
172
+ /** The HTTP status code for the webhook response. */
173
+ statusCode: number;
174
+ /** A flag indicating this is a webhook response object. */
175
+ __isWebhookResponse__: true;
176
+ }
177
+ /** An interface representing a file in some Squid operations. */
178
+ export interface SquidFile {
179
+ /** The binary data of the file. */
180
+ data: Uint8Array;
181
+ /** The name of the form field containing the file. */
182
+ fieldName: string;
183
+ /** The MIME type of the uploaded file. */
184
+ mimetype: string;
185
+ /** The original filename as provided by the uploader. */
186
+ originalName: string;
187
+ /** The size of the file in bytes. */
188
+ size: number;
189
+ /** The encoding of the file, if specified. */
190
+ encoding?: string;
191
+ /** An indicator that this is a Squid file. */
192
+ __isSquidFile__: true;
193
+ }
194
+ /** Defines a function for asking an LLM model a prompt. */
195
+ export type LlmAskAction = (prompt: string, options: UserAiChatOptions) => Promise<UserAiAskResponse>;
196
+ /**
197
+ * Base type for all decorators used in backend projects.
198
+ */
199
+ export type ActionMethodDecorator<U> = <T extends U>(target: Object, propertyName: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
@@ -0,0 +1,18 @@
1
+ /** Re-exported AI function types from public-types for backwards compatibility. */
2
+ export { AiFunctionAttributes, AiFunctionMetadata, AiFunctionParam, AiFunctionParamSchema, AiFunctionParamType, AiFunctionResponseWithFiles, FUNCTION_AFFINITY_SCOPES, FunctionAffinityScope, } from '../public-types/ai-function.public-types';
3
+ /** The different types of actions that can be performed on a database. */
4
+ export type DatabaseActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
5
+ /** The different types of actions that can be performed for storage. */
6
+ export type StorageActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
7
+ /** The different types of actions that can be performed on a topic. */
8
+ export type TopicActionType = 'read' | 'write' | 'all';
9
+ /** The different type of actions for metrics. */
10
+ export type MetricActionType = 'write' | 'all';
11
+ /** ID of the tenant module: either user code (see USER_CODE_MODULE_ID) or a connector ID. */
12
+ export type TenantModuleId = string;
13
+ /** Type for the user code module loaded by worker/local-backend code. */
14
+ export declare const USER_CODE_MODULE_ID: TenantModuleId;
15
+ /** Type for the Python user code module in hybrid (TS + Python) projects. */
16
+ export declare const USER_CODE_PYTHON_MODULE_ID: TenantModuleId;
17
+ /** The modules an application's own code is stored under: TypeScript, plus Python in hybrid projects. */
18
+ export declare const USER_CODE_MODULE_IDS: TenantModuleId[];
@@ -0,0 +1,4 @@
1
+ /** The context provided to a secure distributed lock function. */
2
+ export declare class DistributedLockContext {
3
+ readonly mutex: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ /** The context provided to a secure GraphQL function. */
2
+ export declare class GraphqlContext {
3
+ readonly isGraphiQL: boolean;
4
+ readonly query: string | undefined;
5
+ readonly variables: string | Record<string, any> | undefined;
6
+ readonly operationName: string | undefined;
7
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Which client-facing LangGraph action triggered this security check.
3
+ * @category AI
4
+ */
5
+ export type SecureLangGraphOperation = 'invoke' | 'resume' | 'getState' | 'deleteThread';
6
+ /**
7
+ * Provides context to the security rules of a LangGraph invocation.
8
+ * @category AI
9
+ */
10
+ export declare class SecureLangGraphContext {
11
+ readonly operation: SecureLangGraphOperation;
12
+ readonly graphId: string;
13
+ readonly threadId?: string;
14
+ readonly input?: Record<string, unknown>;
15
+ readonly resumePayload?: unknown;
16
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * OAuth configuration for an MCP server
3
+ */
4
+ export interface McpOAuthOptions {
5
+ /** The ID of an auth integration registered for this app */
6
+ integrationId: string;
7
+ }
8
+ /**
9
+ * Options for the `@mcpServer` decorator.
10
+ */
11
+ export interface McpServerOptions {
12
+ /** Unique ID for this MCP server that will also be used in the MCP url. */
13
+ id: string;
14
+ /**
15
+ * The MCP description.
16
+ */
17
+ description: string;
18
+ /** The MCP name - it will be exposed in the MCP manifest. */
19
+ name: string;
20
+ /**
21
+ * The version of the MCP server.
22
+ * This will be exposed in the MCP manifest.
23
+ */
24
+ version: string;
25
+ /**
26
+ * Optional OAuth configuration. When set, MCP requests must include a valid bearer
27
+ * token from the referenced auth integration. If an `@mcpAuthorizer` is also
28
+ * defined, it runs after OAuth validation with the validated claims available.
29
+ */
30
+ oauth?: McpOAuthOptions;
31
+ }
32
+ /** Validated auth context available to `@mcpAuthorizer` after OAuth validation. */
33
+ export interface McpAuthContext {
34
+ /** Auth mechanism that produced this context. */
35
+ type: 'oauth';
36
+ /** ID of the auth integration used to validate the request. */
37
+ integrationId: string;
38
+ /** Validated JWT claims (sub, aud, iss, exp, and any custom claims). */
39
+ claims: Record<string, unknown>;
40
+ }
41
+ /**
42
+ * Represents a request to authorize an MCP request.
43
+ *
44
+ * @category MCP
45
+ */
46
+ export interface McpAuthorizationRequest {
47
+ /** The parsed body of the webhook request. */
48
+ body: any;
49
+ /** A record of query parameters included in the webhook request. */
50
+ queryParams: Record<string, string>;
51
+ /** A record of HTTP headers included in the webhook request. */
52
+ headers: Record<string, string>;
53
+ /** Validated auth context, present when this MCP request passed OAuth validation. */
54
+ auth?: McpAuthContext;
55
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A context passed to functions annotated with the '@secureMetric' decorator.
3
+ * @category Platform
4
+ */
5
+ export interface SecureMetricContext {
6
+ /** Name of the metric to check. */
7
+ name: string;
8
+ /** Key-value pairs for tagging the metric. */
9
+ tags: Record<string, string>;
10
+ /** Numeric value of the metric. */
11
+ value: number;
12
+ }