@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,161 @@
1
+ import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types';
2
+ import { Paths } from '../public-types/typescript.public-types';
3
+ /**
4
+ * The mutation type.
5
+ * @category Database
6
+ */
7
+ export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
8
+ /**
9
+ * @category Database
10
+ */
11
+ export type MutationType = (typeof MUTATION_TYPES)[number];
12
+ /**
13
+ * Base fields shared by all document mutations.
14
+ * @category Database
15
+ */
16
+ export interface BaseMutation {
17
+ /** The type of the mutation. */
18
+ type: MutationType;
19
+ /** The identity of the mutated document. */
20
+ squidDocIdObj: SquidDocIdObj;
21
+ }
22
+ /**
23
+ * A mutation on a document.
24
+ * @category Database
25
+ */
26
+ export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
27
+ /**
28
+ * Represents a delete mutation on a document.
29
+ * @category Database
30
+ */
31
+ export interface DeleteMutation extends BaseMutation {
32
+ /** Specifies that the mutation is a deletion. */
33
+ type: 'delete';
34
+ }
35
+ /**
36
+ * Represents an update mutation on a document.
37
+ * @category Database
38
+ */
39
+ export interface UpdateMutation<T = any> extends BaseMutation {
40
+ /** Specifies that the mutation is an update. */
41
+ type: 'update';
42
+ /** The updated properties */
43
+ properties: {
44
+ [key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
45
+ };
46
+ }
47
+ /**
48
+ * Represents an insert mutation on a document.
49
+ * @category Database
50
+ */
51
+ export interface InsertMutation<T = any> extends BaseMutation {
52
+ /** Specifies that the mutation is an insertion. */
53
+ type: 'insert';
54
+ /** The inserted document */
55
+ properties: T;
56
+ }
57
+ /**
58
+ * A representation of a single property update.
59
+ * @category Database
60
+ */
61
+ export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
62
+ /**
63
+ * A value update property mutation.
64
+ * @category Database
65
+ */
66
+ export interface ValueUpdatePropertyMutation<Value = any> {
67
+ /** Specifies that the mutation updates a value. */
68
+ type: 'update';
69
+ /** New value to be set. */
70
+ value: Value;
71
+ }
72
+ /**
73
+ * Applying a numeric function to a property.
74
+ * @category Database
75
+ */
76
+ export interface ApplyNumericFnPropertyMutation {
77
+ /** Specifies that the mutation applies a numeric function. */
78
+ type: 'applyNumericFn';
79
+ /** Numeric function to apply. */
80
+ fn: 'increment';
81
+ /** Value to use in the numeric function. */
82
+ value: number;
83
+ }
84
+ /**
85
+ * A property update that removes a property from a document.
86
+ * @category Database
87
+ */
88
+ export interface RemovePropertyMutation {
89
+ /** Specifies that the mutation removes a property. */
90
+ type: 'removeProperty';
91
+ }
92
+ /**
93
+ * A property mutation that appends a value to the existing string.
94
+ * @category Database
95
+ */
96
+ export interface ApplyExtendString {
97
+ /** Specifies that the mutation applies a string function. */
98
+ type: 'applyStringFn';
99
+ /** String function to extend the existing string. */
100
+ fn: 'extendString';
101
+ /** String value to append. */
102
+ value: string;
103
+ }
104
+ /**
105
+ * A property mutation that trims the existing string.
106
+ * @category Database
107
+ */
108
+ export interface ApplyTrimString {
109
+ /** Specifies that the mutation applies a string function. */
110
+ type: 'applyStringFn';
111
+ /** String function to trim the existing string. */
112
+ fn: 'trim';
113
+ }
114
+ /**
115
+ * A property mutation that modifies a string.
116
+ * @category Database
117
+ */
118
+ export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
119
+ /**
120
+ * The before and after documents of a document change.
121
+ * @category Database
122
+ */
123
+ export interface BeforeAndAfterDocs<T = SquidDocument> {
124
+ /** Document state before the mutation. */
125
+ before: T | undefined;
126
+ /** Document state after the mutation. */
127
+ after: T | undefined;
128
+ }
129
+ /**
130
+ * The mutation context that will be provided to the security function.
131
+ * @category Database
132
+ */
133
+ export declare class MutationContext<T = any> {
134
+ readonly mutation: Mutation<T>;
135
+ readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
136
+ readonly serverTimeStamp: Date;
137
+ /**
138
+ * Returns the state of the document before the mutation was applied.
139
+ */
140
+ get before(): T | undefined;
141
+ /**
142
+ * Returns the state of the document after the mutation was applied.
143
+ */
144
+ get after(): T | undefined;
145
+ /**
146
+ * Returns the type of the mutation (insert, update, or delete).
147
+ */
148
+ getMutationType(): MutationType;
149
+ /** Returns true if the mutation affects the provided path. */
150
+ affectsPath(path: Paths<T>): boolean;
151
+ /**
152
+ * Find all affected paths starting from a root path.
153
+ *
154
+ * @example
155
+ * doc before - { a: { b: 1, c: 2 }, d: 3 }
156
+ * doc after - { a: { b: 1, c: 3 }, d: 4 }
157
+ * doc.affectedPaths('a') // ['a.c']
158
+ */
159
+ affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
160
+ private checkPath;
161
+ }
@@ -0,0 +1,75 @@
1
+ import { IntegrationId } from '../public-types/communication.public-types';
2
+ /**
3
+ * Represents the type of native query request, either relational, elastic or MongoDB.
4
+ * @category Database
5
+ */
6
+ export type NativeQueryRequestType = 'relational' | 'mongo' | 'elasticsearch' | 'pure';
7
+ /**
8
+ * Base fields shared by all native query contexts.
9
+ * @category Database
10
+ */
11
+ export interface BaseNativeQueryContext {
12
+ /** Type of the native query request. */
13
+ type: NativeQueryRequestType;
14
+ /** Identifier for the integration. */
15
+ integrationId: IntegrationId;
16
+ }
17
+ /**
18
+ * Context for executing a relational database query.
19
+ * @category Database
20
+ */
21
+ export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
22
+ /** Specifies that the query is for a relational database. */
23
+ type: 'relational';
24
+ /** SQL query string to be executed. */
25
+ query: string;
26
+ /** Parameters to be used in the query. */
27
+ params: Record<string, any>;
28
+ }
29
+ /**
30
+ * Context for executing a MongoDB query.
31
+ * @category Database
32
+ */
33
+ export interface MongoNativeQueryContext extends BaseNativeQueryContext {
34
+ /** Specifies that the query is for a Mongo database. */
35
+ type: 'mongo';
36
+ /** Name of the MongoDB collection to query. */
37
+ collectionName: string;
38
+ /** Array of aggregation pipeline stages. */
39
+ aggregationPipeline: Array<any | undefined>;
40
+ }
41
+ /**
42
+ * Context for executing an Elasticsearch query.
43
+ * @category Database
44
+ */
45
+ export interface ElasticsearchNativeQueryContext {
46
+ /** Specifies that the query is for an Elasticsearch database. */
47
+ type: 'elasticsearch';
48
+ /** Elasticsearch index to query. */
49
+ index: string;
50
+ /** Elasticsearch query string. */
51
+ endpoint?: string;
52
+ /** HTTP method to use for the request. */
53
+ method?: 'GET' | 'POST';
54
+ /** Body of the request. */
55
+ body: Record<string, any>;
56
+ /** Headers to include in the request. */
57
+ integrationId: IntegrationId;
58
+ }
59
+ /**
60
+ * Context for executing a pure database query.
61
+ * @category Database
62
+ */
63
+ export interface PureNativeQueryContext extends BaseNativeQueryContext {
64
+ /** Specifies that the query is for a relational database. */
65
+ type: 'pure';
66
+ /** SQL query string to be executed. */
67
+ query: string;
68
+ /** Parameters to be used in the query. */
69
+ params: Record<string, any>;
70
+ }
71
+ /**
72
+ * Union type representing either a relational or MongoDB native query context.
73
+ * @category Database
74
+ */
75
+ export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext;
@@ -0,0 +1,193 @@
1
+ import { AiQueryOptions } from '../public-types/ai-query.public-types';
2
+ import { IntegrationId } from '../public-types/communication.public-types';
3
+ import { CollectionName, DocumentData, FieldName } from '../public-types/document.public-types';
4
+ import { FieldSort, Operator, Query, SimpleCondition } from '../public-types/query.public-types';
5
+ import { DeepRecord, FieldOf, PartialBy, Paths } from '../public-types/typescript.public-types';
6
+ /**
7
+ * The information provided to the secureAiQuery function about the AI query being executed.
8
+ * @category AI
9
+ */
10
+ export interface AiQueryContext {
11
+ /** The prompt provided for the AI query. */
12
+ prompt: string;
13
+ /** The options used for executing the AI query. */
14
+ options: AiQueryOptions;
15
+ }
16
+ /**
17
+ * Represents the Squid query context.
18
+ * Passed to methods that require query details, such as those annotated with the `@secureCollection` annotation.
19
+ * @category Database
20
+ */
21
+ export declare class QueryContext<T extends DocumentData = any> {
22
+ readonly query: Query<T>;
23
+ /**
24
+ * The ID of the integration being queried.
25
+ */
26
+ get integrationId(): IntegrationId;
27
+ /**
28
+ * The name of the collection being queried.
29
+ */
30
+ get collectionName(): CollectionName;
31
+ /**
32
+ * The query limit if one exists, -1 otherwise.
33
+ */
34
+ get limit(): number;
35
+ /**
36
+ * The fields to project (include) in query results, or undefined if all fields should be returned.
37
+ */
38
+ get projectFields(): Array<FieldName> | undefined;
39
+ /**
40
+ * Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
41
+ * parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
42
+ * additional fields in its sort order, but only after the specified sorts.
43
+ *
44
+ * @param sorts An array of field sorts.
45
+ * @returns Whether the query's sorts matches the provided field sorts.
46
+ */
47
+ sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
48
+ /**
49
+ * Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
50
+ * `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
51
+ * in the query.
52
+ *
53
+ * @param sorts An array of field sorts.
54
+ * @returns Whether the query's sorts exactly match the provided field sorts.
55
+ */
56
+ sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
57
+ /**
58
+ * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
59
+ * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
60
+ * additional conditions, as these only narrow the result set.
61
+ *
62
+ * @param fieldName The name of the field for the condition.
63
+ * @param operator The operator of the condition.
64
+ * @param value The value of the condition.
65
+ * @returns Whether the query is a subquery of the parent condition.
66
+ */
67
+ isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
68
+ /**
69
+ * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
70
+ * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
71
+ * additional conditions, as these only narrow the result set.
72
+ *
73
+ * @param condition The condition to validate.
74
+ * @returns Whether the query is a subquery of the parent condition.
75
+ */
76
+ isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
77
+ /**
78
+ * Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
79
+ * to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
80
+ * additional conditions, as these only narrow the result set.
81
+ *
82
+ * @param conditions The conditions to validate.
83
+ * @returns Whether the query includes subquery of the parent conditions.
84
+ */
85
+ isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
86
+ /**
87
+ * Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
88
+ * to a subset of the results that obtained for the parent query, including sorts and limits.
89
+ *
90
+ * @param query The query to validate.
91
+ * @returns Whether the query is a subquery of the parent query.
92
+ */
93
+ isSubqueryOfQuery(query: Query<T>): boolean;
94
+ /**
95
+ * Checks if this query's projectFields are a subset of the parent query's projectFields.
96
+ * A query can only be a child of another if the parent provides all fields the child needs.
97
+ *
98
+ * @param childFields - The projectFields of this query (the potential child)
99
+ * @param parentFields - The projectFields of the candidate parent query
100
+ * @returns Whether the child's fields are available from the parent
101
+ */
102
+ private isProjectFieldsSubset;
103
+ /**
104
+ * Returns all conditions that apply to any of the specified field names. This method
105
+ * provides a convenient way to retrieve all conditions that involve a specific set of fields.
106
+ *
107
+ * @param fieldNames The field names for which to retrieve conditions.
108
+ * @returns An array of conditions that involve any of the specified field names.
109
+ */
110
+ getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
111
+ /**
112
+ * Returns all conditions that apply to the specified field name. This method provides
113
+ * a convenient way to retrieve all conditions that involve a specific field.
114
+ *
115
+ * @param fieldName The field name for which to retrieve conditions.
116
+ * @returns An array of conditions that involve the specified field name.
117
+ */
118
+ getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
119
+ /**
120
+ * Returns true if the given document can be a result of the query.
121
+ * The method does not account for limit and sort order.
122
+ */
123
+ documentMatchesQuery(doc: DocumentData): boolean;
124
+ }
125
+ /**
126
+ * A list of context conditions.
127
+ * @category Database
128
+ */
129
+ export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
130
+ /**
131
+ * A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'.
132
+ * @category Database
133
+ */
134
+ export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
135
+ /**
136
+ * A condition using the 'in' operator to match values within a set.
137
+ * @category Database
138
+ */
139
+ export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
140
+ /** Specifies the 'in' operator to check if a value exists within an array. */
141
+ operator: 'in';
142
+ /** An array of values to match against the field. */
143
+ value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
144
+ }
145
+ /**
146
+ * A condition using the 'not in' operator to exclude values within a set.
147
+ * @category Database
148
+ */
149
+ export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
150
+ /** Specifies the 'not in' operator to check if a value does not exist within an array. */
151
+ operator: 'not in';
152
+ /** An array of values to exclude from the field. */
153
+ value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
154
+ }
155
+ /**
156
+ * A condition using operators other than 'in' or 'not in' for field comparisons.
157
+ * @category Database
158
+ */
159
+ export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
160
+ /** The operator to use for the comparison, excluding 'in' and 'not in'. */
161
+ operator: Exclude<ContextOperator, 'in' | 'not in'>;
162
+ /** The value to compare against the field. */
163
+ value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
164
+ }
165
+ /**
166
+ * A condition that includes all operators, including 'in' and 'not in', for general use.
167
+ * @category Database
168
+ */
169
+ export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
170
+ /** The operator to apply to the condition, including all possible operators. */
171
+ operator: AllOperators;
172
+ /** The value to use in the condition comparison. */
173
+ value: any;
174
+ }
175
+ /**
176
+ * A list of general conditions.
177
+ * @category Database
178
+ */
179
+ export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
180
+ /**
181
+ * @category Database
182
+ */
183
+ export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
184
+ /**
185
+ * Set of operators supported by query context conditions, including list membership.
186
+ * @category Database
187
+ */
188
+ export type AllOperators = Operator | 'in' | 'not in';
189
+ /**
190
+ * A generic value that can exist in a query.
191
+ * @category Database
192
+ */
193
+ export type GenericValue<Doc = any, F extends Paths<Doc> = Paths<Doc>, O extends AllOperators = any> = O extends 'in' ? Array<DeepRecord<Doc>[F]> | null : O extends 'not in' ? Array<DeepRecord<Doc>[F]> | null : DeepRecord<Doc>[F] | null;
@@ -0,0 +1,15 @@
1
+ import { IntegrationId } from '../public-types/communication.public-types';
2
+ import { StorageActionType } from './bundle-data.public-types';
3
+ /** Supported types of storage operations. */
4
+ export type StorageFunctionality = 'fileUpload' | 'getFileMetadata' | 'getDownloadUrl' | 'deleteFiles' | 'listDirectoryContents';
5
+ /** Context for performing a storage-related operation. */
6
+ export interface StorageContext {
7
+ /** Identifier of the integration performing the storage action. */
8
+ integrationId: IntegrationId;
9
+ /** List of paths within the storage bucket relevant to the action. */
10
+ pathsInBucket: Array<string>;
11
+ /** Type of action being performed on the storage. */
12
+ action: StorageActionType;
13
+ /** Specific storage functionality being used. */
14
+ functionality: StorageFunctionality;
15
+ }
@@ -0,0 +1,17 @@
1
+ import { IntegrationId } from '../public-types/communication.public-types';
2
+ /** Context used when reading from a topic. */
3
+ export interface TopicReadContext {
4
+ /** Identifier of the integration the topic belongs to. */
5
+ integrationId: IntegrationId;
6
+ /** Name of the topic being read. */
7
+ topicName: string;
8
+ }
9
+ /** Context used when writing to a topic. */
10
+ export interface TopicWriteContext<T> {
11
+ /** Identifier of the integration the topic belongs to. */
12
+ integrationId: IntegrationId;
13
+ /** Name of the topic being written to. */
14
+ topicName: string;
15
+ /** Messages to write to the topic. */
16
+ messages: Array<T>;
17
+ }
@@ -0,0 +1,98 @@
1
+ /** A common prefix for all applications created by console web monitoring test. */
2
+ export declare const E2E_TEST_APP_ID_PREFIX = "e2e";
3
+ /**
4
+ * Console application id (prod).
5
+ * This application may have a special behavior (like it can't be removed).
6
+ */
7
+ export declare const CONSOLE_APP_ID = "console";
8
+ export declare const CONSOLE_DEV_APP_ID = "console-dev";
9
+ export declare const TEST_APP_ID = "test";
10
+ /** Returns true if the appId is the static 'test' app or a per-suite test app (e.g. 'testqueries1a2b'). */
11
+ export declare function isTestAppId(appId: string): boolean;
12
+ /** Used instead of null/undefined or an empty value in requests to tenant. */
13
+ export declare const NO_USER_CODE_URL = "no-user-code";
14
+ /**
15
+ * Per-application override of the tenant pod's size and of the Python sandbox limits inside it, set by
16
+ * a sysadmin so a large customer can be given more room. Every field is optional and an absent one
17
+ * keeps the platform default, so an unconfigured application gets the platform-default pod.
18
+ */
19
+ export interface TenantResources {
20
+ /** CPU request of the tenant pod, in millicores. */
21
+ cpuMillis?: number;
22
+ /** Memory request of the tenant pod, in mebibytes. */
23
+ memoryMi?: number;
24
+ /** Address-space ceiling of a single Python sandbox, in megabytes (nsjail `--rlimit_as`). */
25
+ pythonMemoryMb?: number;
26
+ /** Number of CPUs a single Python sandbox may use (nsjail `--max_cpus`). */
27
+ pythonMaxCpus?: number;
28
+ /**
29
+ * Interpreters one pod may hold, stated outright. Set it when the derived capacity is not the number
30
+ * you want: it replaces the calculation entirely rather than adjusting an input to it, so neither the
31
+ * pod's memory nor the sandbox ceiling is consulted once it is present.
32
+ */
33
+ forcedPythonsPerPod?: number;
34
+ /** Replica floor of the tenant's autoscaler. */
35
+ minPods?: number;
36
+ /** Replica ceiling of the tenant's autoscaler. */
37
+ maxPods?: number;
38
+ }
39
+ /** Tenant pod CPU request applied when the application sets no override. */
40
+ export declare const DEFAULT_TENANT_CPU_MILLIS = 100;
41
+ /** Tenant pod memory request applied when the application sets no override. */
42
+ export declare const DEFAULT_TENANT_MEMORY_MI = 1024;
43
+ /** Python sandbox address-space ceiling applied when the application sets no override. */
44
+ export declare const DEFAULT_PYTHON_MEMORY_MB = 512;
45
+ /** Python sandbox CPU count applied when the application sets no override. */
46
+ export declare const DEFAULT_PYTHON_MAX_CPUS = 1;
47
+ /** Replica floor of a tenant that is kept awake, and of every other tenant. */
48
+ export declare const DEFAULT_KEEP_ALIVE_MIN_PODS = 2;
49
+ export declare const DEFAULT_MIN_PODS = 1;
50
+ /** Replica ceiling of the tenant's autoscaler when the application sets no override. */
51
+ export declare const DEFAULT_MAX_PODS = 10;
52
+ /**
53
+ * Env vars through which core hands the Python sandbox overrides to the connector running inside the
54
+ * tenant pod. Set on the pod only when the application overrides them, so their absence is what makes
55
+ * the connector keep the defaults above.
56
+ */
57
+ export declare const PYTHON_MEMORY_MB_ENV = "SQUID_PYTHON_MEMORY_LIMIT_MB";
58
+ export declare const PYTHON_MAX_CPUS_ENV = "SQUID_PYTHON_MAX_CPUS";
59
+ export declare const PYTHONS_PER_POD_ENV = "SQUID_PYTHONS_PER_POD";
60
+ /**
61
+ * Accepted range of every field. The pod maxima fit the smallest supported node, the installer's
62
+ * default `Standard_D4ads_v6` at 4 vCPU and 16 GiB, which leaves roughly 3.86 CPU and 12.6 GiB
63
+ * allocatable: a request the node cannot satisfy leaves the pod Pending, and because a resize keeps
64
+ * the old pod serving, the application only disappears later, when the idle sweeper hibernates it and
65
+ * the wake-up has nothing schedulable to start.
66
+ */
67
+ export declare const TENANT_RESOURCES_BOUNDS: Record<keyof TenantResources, {
68
+ min: number;
69
+ max: number;
70
+ }>;
71
+ /** Returns how many interpreters one worker of a pod of this size may hold. */
72
+ export declare function getDerivedPythonsPerWorker(podMemoryMi: number, pythonMemoryMb: number): number;
73
+ /** Returns how many interpreters a pod of this size holds in total, which is what a sysadmin sizes. */
74
+ export declare function getDerivedPythonsPerPod(podMemoryMi: number, pythonMemoryMb: number): number;
75
+ /** Every field of the override, for callers that have to walk them all. */
76
+ export declare const TENANT_RESOURCES_FIELDS: Array<keyof TenantResources>;
77
+ /** Returns the reason the override is invalid, or undefined when it can be applied. */
78
+ export declare function getTenantResourcesValidationError(resources: TenantResources): string | undefined;
79
+ /** The console's daily report of every application it has, sent to each core it is the registry for. */
80
+ export interface CleanupOrphanDatabasesRequest {
81
+ /** Every application id the console knows, both environments, across the regions it owns. */
82
+ activeAppIds: string[];
83
+ }
84
+ /** What a core answers with: the sweep runs on after the response, and logs what it did. */
85
+ export interface CleanupOrphanDatabasesResponse {
86
+ /** Applications the core has databases for and the report does not list. */
87
+ orphanCount: number;
88
+ /** False when a sweep was already running, in which case this report was only counted. */
89
+ started: boolean;
90
+ /**
91
+ * When the sweep that is already running started, ISO 8601, set only when [started] is false.
92
+ *
93
+ * A sweep is bounded by nothing but the work it has left, so one that never finishes turns every
94
+ * later night into a refusal. A date from a previous night is what tells that apart from two
95
+ * reports arriving on the same one.
96
+ */
97
+ sweepStartedAt?: string;
98
+ }
@@ -0,0 +1,55 @@
1
+ import { HttpStatusCode } from '../public-types/http-status.public-types';
2
+ import { JobId } from '../public-types/job.public-types';
3
+ import { ConnectorId } from './connector.types';
4
+ export interface AppRunConfiguration {
5
+ /** List of enabled connectors packages. */
6
+ connectors: Array<ConnectorRunConfiguration>;
7
+ }
8
+ export interface ConnectorRunConfiguration {
9
+ /** Connector ID. */
10
+ id: ConnectorId;
11
+ /** Signed download connector code URL. */
12
+ codeUrl: string;
13
+ /**
14
+ * Non-signed, original connector URL id.
15
+ * Example:
16
+ * https://squid-code-bucket-prod-us-east-1.s3.us-east-1.amazonaws.com/connectors/built_in_db/bundle-built_in_db-0.0.1.zip.
17
+ */
18
+ codeUrlId: string;
19
+ }
20
+ /**
21
+ * Success response type for function execution.
22
+ * ok is always true, functionResponse is always present.
23
+ */
24
+ export interface TenantExecuteFunctionSuccess<T = unknown> {
25
+ ok: true;
26
+ functionResponse: T;
27
+ }
28
+ /**
29
+ * Error response type for function execution.
30
+ * ok is always false, error and functionName are always present.
31
+ */
32
+ export interface TenantExecuteFunctionError {
33
+ ok: false;
34
+ error: string;
35
+ functionName: string;
36
+ details?: string;
37
+ /** Set when `error === 'VALIDATION_ERROR'`. */
38
+ statusCode?: HttpStatusCode;
39
+ }
40
+ /** Longest a Python execution run as a long-running job may take: generous, yet a stalled one still fails its job. */
41
+ export declare const LONG_RUNNING_TIMEOUT_MS: number;
42
+ /**
43
+ * Started response for a long-running function execution.
44
+ * Returned instead of the function result: the tenant has started a job with the given id and will resolve it on completion.
45
+ */
46
+ export interface TenantLongRunningStarted {
47
+ ok: true;
48
+ longRunningStarted: true;
49
+ jobId: JobId;
50
+ }
51
+ /**
52
+ * Unified response type for function execution - discriminated union of success, error and long-running-started cases.
53
+ * Used for type-safe communication between tenant (producer) and core (consumer).
54
+ */
55
+ export type TenantExecuteFunctionResult<T = unknown> = TenantExecuteFunctionSuccess<T> | TenantExecuteFunctionError | TenantLongRunningStarted;
@@ -0,0 +1,18 @@
1
+ import { AppId } from '../public-types/communication.public-types';
2
+ /** Console DB collection name for application redeployment history. */
3
+ export declare const APPLICATION_DEPLOYMENT_HISTORY_COLLECTION = "appDeploymentHistory";
4
+ export type ApplicationDeploymentHistoryActionType = 'deploy' | 'undeploy';
5
+ /** Console DB type document type for application redeployment history. */
6
+ export interface ApplicationDeploymentHistoryEntry {
7
+ /** Unique history record id. */
8
+ id: string;
9
+ appId: AppId;
10
+ timestamp: Date;
11
+ actionType: ApplicationDeploymentHistoryActionType;
12
+ /** Last 4 digits of the API key used for the deployment. */
13
+ apiKeySuffix: string;
14
+ /** Present only for failed deployments. If present: the deployment is failed. */
15
+ errorMessage?: string;
16
+ /** Bundle information for the deployed application. Present only for successfully deployed applications. */
17
+ bundleData?: ApplicationBundleData;
18
+ }