@squidcloud/client 1.0.279 → 1.0.281

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 (36) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +1 -0
  3. package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +2 -0
  4. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +5 -0
  5. package/dist/internal-common/src/public-types/integrations/api.public-types.d.ts +3 -0
  6. package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +21 -0
  7. package/dist/typescript-client/src/extraction-client.d.ts +2 -2
  8. package/dist/typescript-client/src/index.d.ts +1 -0
  9. package/dist/typescript-client/src/public-types.d.ts +1 -0
  10. package/dist/typescript-client/src/scheduler-client.d.ts +9 -0
  11. package/dist/typescript-client/src/squid.d.ts +3 -0
  12. package/dist/typescript-client/src/version.d.ts +1 -1
  13. package/package.json +3 -3
  14. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -21
  15. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -18
  16. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -123
  17. package/dist/internal-common/src/types/ai-assistant.types.d.ts +0 -1
  18. package/dist/internal-common/src/types/ai-chatbot.types.d.ts +0 -13
  19. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  20. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  21. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  22. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  23. package/dist/internal-common/src/types/query.types.d.ts +0 -10
  24. package/dist/internal-common/src/types/secret.types.d.ts +0 -2
  25. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  26. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  27. package/dist/internal-common/src/utils/array.d.ts +0 -1
  28. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  29. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  30. package/dist/internal-common/src/utils/http.d.ts +0 -2
  31. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  32. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  33. package/dist/internal-common/src/utils/object.d.ts +0 -48
  34. package/dist/internal-common/src/utils/serialization.d.ts +0 -5
  35. package/dist/internal-common/src/utils/validation.d.ts +0 -20
  36. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -159,6 +159,7 @@ export interface AiChatbotContextBase {
159
159
  type: AiChatbotContextType;
160
160
  data: string;
161
161
  metadata?: AiContextMetadata;
162
+ password?: string;
162
163
  }
163
164
  export interface AiSearchResponse {
164
165
  chunks: Array<AiSearchResultChunk>;
@@ -17,3 +17,5 @@ export interface AiFunctionParam {
17
17
  required: boolean;
18
18
  }
19
19
  export type TopicName = string;
20
+ export type ServiceName = string;
21
+ export type ServiceFunctionName = `${ServiceName}:${FunctionName}`;
@@ -1,9 +1,13 @@
1
1
  export type DocumentFileDataType = 'image';
2
+ export interface ExtractDataFromDocumentFileOptions {
3
+ password?: string;
4
+ }
2
5
  export interface DocumentFileData {
3
6
  type: DocumentFileDataType;
4
7
  pathInBucket: string;
5
8
  }
6
9
  export interface DocumentPageData {
10
+ title?: string;
7
11
  text: string;
8
12
  fileDataList: DocumentFileData[];
9
13
  }
@@ -13,6 +17,7 @@ export interface ExtractDataFromDocumentResponse {
13
17
  }
14
18
  export interface TextOnlyPageData {
15
19
  text: string;
20
+ title?: string;
16
21
  }
17
22
  export interface DocumentTextDataResponse {
18
23
  pages: TextOnlyPageData[];
@@ -1,5 +1,6 @@
1
1
  import { IntegrationType } from '../integration.public-types';
2
2
  import { FieldName } from '../document.public-types';
3
+ import { IntegrationId } from '../communication.public-types';
3
4
  export type HttpMethod = 'post' | 'get' | 'delete' | 'patch' | 'put';
4
5
  export type ApiEndpointId = string;
5
6
  export type ApiParameterLocation = 'query' | 'body' | 'header' | 'path';
@@ -56,9 +57,11 @@ export interface ApiEndpoint {
56
57
  tags?: Array<string>;
57
58
  }
58
59
  export interface DiscoverOpenApiSchemaRequest {
60
+ integrationId: IntegrationId;
59
61
  integrationType: IntegrationType.api;
60
62
  discoveryOptions: OpenApiDiscoveryOptions;
61
63
  }
62
64
  export interface DiscoverOpenApiSchemaFromFileRequest {
65
+ integrationId: IntegrationId;
63
66
  integrationType: IntegrationType.api;
64
67
  }
@@ -0,0 +1,21 @@
1
+ import { ServiceFunctionName } from './bundle-data.public-types';
2
+ export interface SchedulerConfig {
3
+ functionName: ServiceFunctionName;
4
+ cronExpression: string;
5
+ exclusive: boolean;
6
+ }
7
+ export interface SchedulerInfo {
8
+ schedulerId: string;
9
+ config: SchedulerConfig;
10
+ enabled: boolean;
11
+ }
12
+ export interface ListSchedulersResponse {
13
+ schedulers: SchedulerInfo[];
14
+ }
15
+ export interface UpdateSchedulerOptions {
16
+ schedulerId: string;
17
+ enabled?: boolean;
18
+ }
19
+ export interface UpdateSchedulersRequest {
20
+ schedulers: UpdateSchedulerOptions[];
21
+ }
@@ -1,6 +1,6 @@
1
1
  import { BlobAndFilename } from './types';
2
- import { DocumentTextDataResponse } from '../../internal-common/src/public-types/extraction.public-types';
2
+ import { DocumentTextDataResponse, ExtractDataFromDocumentFileOptions } from '../../internal-common/src/public-types/extraction.public-types';
3
3
  export declare class ExtractionClient {
4
4
  private readonly rpcManager;
5
- extractDataFromDocumentFile(file: File | BlobAndFilename): Promise<DocumentTextDataResponse>;
5
+ extractDataFromDocumentFile(file: File | BlobAndFilename, options?: ExtractDataFromDocumentFileOptions): Promise<DocumentTextDataResponse>;
6
6
  }
@@ -36,6 +36,7 @@ export * from './rate-limiter';
36
36
  export * from './rpc.manager';
37
37
  export * from './observability-client';
38
38
  export * from './secret.client';
39
+ export * from './scheduler-client';
39
40
  export * from './socket.manager';
40
41
  export * from './squid-http-client';
41
42
  export * from './squid';
@@ -18,6 +18,7 @@ export * from '../../internal-common/src/public-types/regions.public-types';
18
18
  export * from '../../internal-common/src/public-types/schema.public-types';
19
19
  export * from '../../internal-common/src/public-types/secret.public-types';
20
20
  export * from '../../internal-common/src/public-types/serialized-query.public-types';
21
+ export * from '../../internal-common/src/public-types/scheduler.public-types';
21
22
  export * from '../../internal-common/src/public-types/socket.public-types';
22
23
  export * from '../../internal-common/src/public-types/storage.types';
23
24
  export * from '../../internal-common/src/public-types/typescript.public-types';
@@ -0,0 +1,9 @@
1
+ import { SchedulerInfo } from './public-types';
2
+ export declare class SchedulerClient {
3
+ private readonly rpcManager;
4
+ list(): Promise<SchedulerInfo[]>;
5
+ enable(schedulerId: string | string[]): Promise<void>;
6
+ disable(schedulerId: string | string[]): Promise<void>;
7
+ private update;
8
+ private createUpdateSchedulerOptions;
9
+ }
@@ -10,6 +10,7 @@ import { StorageClient } from './storage-client';
10
10
  import { TransactionId } from './types';
11
11
  import { ExtractionClient } from './extraction-client';
12
12
  import { PersonalStorageClient } from './personal-storage-client';
13
+ import { SchedulerClient } from './scheduler-client';
13
14
  /** The different options that can be used to initialize a Squid instance. */
14
15
  export interface SquidOptions {
15
16
  /**
@@ -102,6 +103,7 @@ export declare class Squid {
102
103
  private readonly apiClient;
103
104
  private readonly observabilityClient;
104
105
  private readonly queueManagerFactory;
106
+ private readonly schedulerClient;
105
107
  /**
106
108
  * Creates a new instance of Squid with the given options.
107
109
  *
@@ -205,6 +207,7 @@ export declare class Squid {
205
207
  personalStorage(integrationId: IntegrationId): PersonalStorageClient;
206
208
  extraction(): ExtractionClient;
207
209
  get secrets(): SecretClient;
210
+ get schedulers(): SchedulerClient;
208
211
  /**
209
212
  * Returns a distributed lock for the given mutex. The lock can be used to synchronize access to a shared resource.
210
213
  * The lock will be released when the release method on the returned object is invoked or whenever the connection
@@ -1 +1 @@
1
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.279";
1
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.281";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.279",
3
+ "version": "1.0.281",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",
@@ -49,14 +49,14 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@supercharge/promise-pool": "^2.3.2",
52
- "@webpack-cli/generators": "^3.0.0",
52
+ "@webpack-cli/generators": "^3.0.7",
53
53
  "copy-webpack-plugin": "^12.0.2",
54
54
  "cpx": "^1.5.0",
55
55
  "generate-package-json-webpack-plugin": "^2.6.0",
56
56
  "otrie": "^1.1.3",
57
57
  "tsconfig-paths-webpack-plugin": "^4.1.0",
58
58
  "tscpaths": "^0.0.9",
59
- "webpack": "^5.92.1",
59
+ "webpack": "^5.95.0",
60
60
  "webpack-cli": "^5.1.4"
61
61
  }
62
62
  }
@@ -1,21 +0,0 @@
1
- import { ApiEndpointId, HttpMethod } from '../public-types/integrations/api.public-types';
2
- import { IntegrationId } from '../public-types/communication.public-types';
3
- import { ApiOptions } from '../public-types/api-client.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
- export interface CallApiRequest<BodyType = any> {
16
- integrationId: IntegrationId;
17
- endpointId: ApiEndpointId;
18
- body?: BodyType;
19
- overrideMethod?: HttpMethod;
20
- options: ApiOptions;
21
- }
@@ -1,18 +0,0 @@
1
- import { IntegrationId } from '../public-types/communication.public-types';
2
- export type NativeQueryRequestType = 'relational' | 'mongo';
3
- interface BaseNativeQueryContext {
4
- type: NativeQueryRequestType;
5
- integrationId: IntegrationId;
6
- }
7
- export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
8
- type: 'relational';
9
- query: string;
10
- params: Record<string, any>;
11
- }
12
- export interface MongoNativeQueryContext extends BaseNativeQueryContext {
13
- type: 'mongo';
14
- collectionName: string;
15
- aggregationPipeline: Array<any | undefined>;
16
- }
17
- export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext;
18
- export {};
@@ -1,123 +0,0 @@
1
- import { FieldSort, Operator, Query, SimpleCondition } from '../public-types/query.public-types';
2
- import { DeepRecord, FieldOf, PartialBy, Paths } from '../public-types/typescript.public-types';
3
- import { CollectionName, DocumentData } from '../public-types/document.public-types';
4
- import { IntegrationId } from '../public-types/communication.public-types';
5
- export declare class QueryContext<T extends DocumentData = any> {
6
- readonly query: Query<T>;
7
- /**
8
- * The ID of the integration being queried.
9
- */
10
- get integrationId(): IntegrationId;
11
- /**
12
- * The name of the collection being queried.
13
- */
14
- get collectionName(): CollectionName;
15
- /**
16
- * The query limit if one exists, -1 otherwise.
17
- */
18
- get limit(): number;
19
- /**
20
- * Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts`
21
- * parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include
22
- * additional fields in its sort order, but only after the specified sorts.
23
- *
24
- * @param sorts An array of field sorts.
25
- * @returns Whether the query's sorts matches the provided field sorts.
26
- */
27
- sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
28
- /**
29
- * Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the
30
- * `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present
31
- * in the query.
32
- *
33
- * @param sorts An array of field sorts.
34
- * @returns Whether the query's sorts exactly match the provided field sorts.
35
- */
36
- sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean;
37
- /**
38
- * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
39
- * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
40
- * additional conditions, as these only narrow the result set.
41
- *
42
- * @param fieldName The name of the field for the condition.
43
- * @param operator The operator of the condition.
44
- * @param value The value of the condition.
45
- * @returns Whether the query is a subquery of the parent condition.
46
- */
47
- isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean;
48
- /**
49
- * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates
50
- * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include
51
- * additional conditions, as these only narrow the result set.
52
- *
53
- * @param condition The condition to validate.
54
- * @returns Whether the query is a subquery of the parent condition.
55
- */
56
- isSubqueryOfCondition(condition: GeneralCondition<T>): boolean;
57
- /**
58
- * Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates
59
- * to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include
60
- * additional conditions, as these only narrow the result set.
61
- *
62
- * @param conditions The conditions to validate.
63
- * @returns Whether the query includes subquery of the parent conditions.
64
- */
65
- isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean;
66
- /**
67
- * Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates
68
- * to a subset of the results that obtained for the parent query, including sorts and limits.
69
- *
70
- * @param query The query to validate.
71
- * @returns Whether the query is a subquery of the parent query.
72
- */
73
- isSubqueryOfQuery(query: Query<T>): boolean;
74
- /**
75
- * Returns all conditions that apply to any of the specified field names. This method
76
- * provides a convenient way to retrieve all conditions that involve a specific set of fields.
77
- *
78
- * @param fieldNames The field names for which to retrieve conditions.
79
- * @returns An array of conditions that involve any of the specified field names.
80
- */
81
- getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>;
82
- /**
83
- * Returns all conditions that apply to the specified field name. This method provides
84
- * a convenient way to retrieve all conditions that involve a specific field.
85
- *
86
- * @param fieldName The field name for which to retrieve conditions.
87
- * @returns An array of conditions that involve the specified field name.
88
- */
89
- getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>;
90
- /**
91
- * Returns true if the given document can be a result of the query.
92
- * The method does not account for limit and sort order.
93
- */
94
- documentMatchesQuery(doc: DocumentData): boolean;
95
- }
96
- /** A list of context conditions */
97
- export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
98
- /** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
99
- export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
100
- export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
101
- operator: 'in';
102
- value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
103
- }
104
- export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
105
- operator: 'not in';
106
- value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
107
- }
108
- export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
109
- operator: Exclude<ContextOperator, 'in' | 'not in'>;
110
- value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
111
- }
112
- /** A condition that includes the 'in' and 'not in' operators. */
113
- export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
114
- operator: AllOperators;
115
- value: any;
116
- }
117
- /** A list of general conditions. */
118
- export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
119
- export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
120
- type AllOperators = Operator | 'in' | 'not in';
121
- /** A generic value that can exist in a query. */
122
- 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;
123
- export {};
@@ -1,13 +0,0 @@
1
- import { AiFileUrl } from '../public-types/ai-chatbot.public-types';
2
- import { FunctionName } from '../public-types/bundle-data.public-types';
3
- export type AiChatResponseFormat = 'text' | 'json_object';
4
- export interface AiChatOptions {
5
- maxTokens: number;
6
- responseFormat: AiChatResponseFormat;
7
- temperature: number;
8
- topP: number;
9
- instructions: Array<string>;
10
- clientId: string;
11
- fileUrls: Array<AiFileUrl>;
12
- functions?: Array<FunctionName>;
13
- }
@@ -1 +0,0 @@
1
- export type ChatId = string;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Generates the regex pattern, handling special characters as follows:
3
- * - `_` is replaced with a `.`
4
- * - `%` is replaced with `[\s\S]*`.
5
- * - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`.
6
- * - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \
7
- *
8
- * Exported for testing purposes.
9
- * */
10
- export declare function replaceSpecialCharacters(input: string): string;
@@ -1,2 +0,0 @@
1
- export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
2
- export declare const APP_API_KEY = "APP_API_KEY";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- /** Returns true if the application is run by a Playwright test. */
2
- export declare function isPlaywrightTestMode(): boolean | undefined;
@@ -1 +0,0 @@
1
- export declare function isTimestampEnabled(): boolean;
@@ -1,2 +0,0 @@
1
- export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
2
- export declare function getApplicationHttpHeaders(regionPrefix: string, appId: string): Record<string, string>;
@@ -1,14 +0,0 @@
1
- type LockMutex = string;
2
- /**
3
- * A simple lock manager that locks a list of mutexes.
4
- * When locking a list of mutexes, the lock will start only when all the mutexes are available - preventing partial lock
5
- * and potential deadlocks.
6
- */
7
- export declare class LockManager {
8
- private readonly locks;
9
- lock(...mutexes: LockMutex[]): Promise<void>;
10
- release(...mutexes: LockMutex[]): void;
11
- canGetLock(...mutexes: LockMutex[]): boolean;
12
- lockSync(...mutexes: LockMutex[]): void;
13
- }
14
- export {};
@@ -1,4 +0,0 @@
1
- import { QueryMetricsRequestCommon, QueryMetricsResultGroup } from '../public-types/metric.public-types';
2
- export type QueryMetricsRequestIntervals = Required<Pick<QueryMetricsRequestCommon, 'fillValue' | 'fn' | 'groupByTags' | 'periodEndSeconds' | 'periodStartSeconds' | 'pointIntervalAlignment' | 'pointIntervalSeconds' | 'tagDomains' | 'noDataBehavior'>>;
3
- /** Adds missed known tag domain groups and fills all missed points with a request.fillValue. */
4
- export declare function fillMissedPoints(request: QueryMetricsRequestIntervals, resultGroups: Array<QueryMetricsResultGroup>): void;
@@ -1,48 +0,0 @@
1
- /** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
2
- export declare function getInPath(obj: unknown, path: string): any;
3
- export declare function isDateObject(value: unknown): value is Date;
4
- /** Sets a value by path . Does not support array indexes. */
5
- export declare function setInPath(obj: object, path: string, value: unknown, delimiter?: string): void;
6
- export declare function deleteInPath(obj: object, path: string, delimiter?: string): void;
7
- export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
8
- export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
9
- export declare function isNil(obj: unknown): obj is null | undefined;
10
- export declare function isEqual(a: unknown, b: unknown): boolean;
11
- export declare function isEmpty(a: unknown): boolean;
12
- export declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...fieldsToRemove: K): Pick<T, Exclude<keyof T, K[number]>>;
13
- export type CloneCustomizer = (value: unknown) => unknown | undefined;
14
- /**
15
- * Creates a deep copy of the specified object, including all nested objects and specifically handling Date, Map, and
16
- * Set fields.
17
- *
18
- * The customizer function can modify the cloning process for the object and its fields. If the customizer
19
- * returns 'undefined' for any input, the function falls back to the standard cloning logic.
20
- *
21
- * The cloning process is recursive, ensuring deep cloning of all objects.
22
- *
23
- * Note: This function does not support cloning objects with circular dependencies and will throw a system stack
24
- * overflow error if encountered.
25
- */
26
- export declare function cloneDeep<R = unknown>(value: R, customizer?: CloneCustomizer): R;
27
- /** Creates a shallow clone of the object. */
28
- export declare function cloneShallow<T>(value: T): T;
29
- /** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
30
- export declare function compareValues(v1: unknown, v2: unknown): number;
31
- /** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */
32
- export declare function mapValues<ResultType extends object = Record<string, unknown>, InputType extends Record<string, unknown> = Record<string, unknown>>(obj: InputType, valueMapperFn: (value: any, key: keyof InputType, obj: InputType) => unknown): ResultType;
33
- /** Groups elements of the array by key. See _.groupBy for details. */
34
- export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (item: T) => K): Record<K, T[]>;
35
- /**
36
- * Picks selected fields from the object and returns a new object with the fields selected.
37
- * The selected fields are assigned by reference (there is no cloning).
38
- */
39
- export declare function pick<T extends object, K extends keyof T>(obj: T, keys: ReadonlyArray<K>): Pick<T, K>;
40
- /** Inverts the record: swaps keys and values. */
41
- export declare function invert<K extends string | number, V extends string | number>(record: Record<K, V>): Record<V, K>;
42
- /**
43
- * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
44
- * If end is less than start a zero-length range is created unless a negative step is specified.
45
- *
46
- * Same as lodash range but with an additional parameter: `maximumNumberOfItems`.
47
- */
48
- export declare function range(start: number, end: number, step: number, maximumNumberOfItems?: number): number[];
@@ -1,5 +0,0 @@
1
- export declare function normalizeJsonAsString(json: unknown): string;
2
- export declare function serializeObj(obj: unknown): string;
3
- export declare function deserializeObj<T = any>(str: string): T;
4
- export declare function encodeValueForMapping(value: unknown): string;
5
- export declare function decodeValueForMapping(encodedString: string): any;
@@ -1,20 +0,0 @@
1
- import { HttpStatus } from '../public-types/http-status.enum';
2
- export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT | HttpStatus.INTERNAL_SERVER_ERROR;
3
- export declare class ValidationError extends Error {
4
- readonly statusCode: StatusCode;
5
- readonly details?: any;
6
- constructor(error: string, statusCode: StatusCode, details?: Record<string, any>);
7
- }
8
- export declare function isValidId(id: unknown, maxLength?: number): boolean;
9
- export declare function validateFieldSort(fieldSort: unknown): void;
10
- export declare function validateQueryLimit(limit: unknown): void;
11
- /**
12
- * All type names returned by 'typeof' supported by JavaScript:
13
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}.
14
- * and a few other supported types.
15
- */
16
- export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function';
17
- /** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */
18
- export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean;
19
- /** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */
20
- export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;
@@ -1,26 +0,0 @@
1
- interface Options {
2
- maxAttempts?: number;
3
- protocols?: string[];
4
- onmessage?: (event: any) => void;
5
- onopen?: (event: any) => void;
6
- onclose?: (event: any) => void;
7
- onerror?: (event: any) => void;
8
- onreconnect?: (event: any) => void;
9
- onmaximum?: (event: any) => void;
10
- timeoutMillis?: number;
11
- }
12
- export interface WebSocketWrapper {
13
- open: () => void;
14
- reconnect: (e: any) => void;
15
- json: (x: any) => void;
16
- send: (x: string) => void;
17
- close: (x?: number, y?: string) => void;
18
- connected: boolean;
19
- /**
20
- * Websocket is explicitly closed by calling socket.close().
21
- * Used to ignore errors after socket.closed() is called.
22
- */
23
- closeCalled: boolean;
24
- }
25
- export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper;
26
- export {};