@skedulo/pulse-solution-services 0.0.19 → 0.0.20

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 (43) hide show
  1. package/README.md +59 -4
  2. package/dist/clients/availability-api-client.js +1 -1
  3. package/dist/clients/base-client.js +1 -1
  4. package/dist/clients/graphql-client.js +1 -1
  5. package/dist/constants/tenant-endpoints.js +1 -1
  6. package/dist/index.d.ts +158 -15
  7. package/dist/services/graphql/graphql-query-builder.js +1 -1
  8. package/dist/services/graphql/graphql-service.js +1 -1
  9. package/dist/services/graphql/queries.js +1 -1
  10. package/package.json +2 -2
  11. package/CHANGELOG.md +0 -59
  12. package/dist/logging/decorators/index.d.ts +0 -1
  13. package/dist/logging/decorators/log-method.d.ts +0 -7
  14. package/dist/monitoring/decorators/monitor-call.d.ts +0 -6
  15. package/dist/services/cache/cache-service.d.ts +0 -70
  16. package/dist/services/cache/index.d.ts +0 -1
  17. package/dist/services/cache/storage/config-var-cache-storage.d.ts +0 -40
  18. package/dist/services/cache/storage/in-memory-cache-storage.d.ts +0 -32
  19. package/dist/services/cache/storage/index.d.ts +0 -2
  20. package/dist/services/graph-batch/configs/graph-batch-config.d.ts +0 -18
  21. package/dist/services/graph-batch/configs/unique-graph-batch-config.d.ts +0 -16
  22. package/dist/services/graph-batch/graph-batch.d.ts +0 -56
  23. package/dist/services/graph-batch/index.d.ts +0 -5
  24. package/dist/services/graph-batch/pagination-strategy.d.ts +0 -5
  25. package/dist/services/graph-batch/unique-graph-batch.d.ts +0 -28
  26. package/dist/services/graphql/graphql-batch-builder.d.ts +0 -138
  27. package/dist/services/graphql/graphql-query-batch.d.ts +0 -10
  28. package/dist/services/graphql/graphql-query-builder.d.ts +0 -86
  29. package/dist/services/graphql/graphql-service.d.ts +0 -106
  30. package/dist/services/graphql/index.d.ts +0 -2
  31. package/dist/services/graphql/queries.d.ts +0 -20
  32. package/dist/services/resource-availability/builder/data-service.d.ts +0 -10
  33. package/dist/services/resource-availability/builder/index.d.ts +0 -3
  34. package/dist/services/resource-availability/builder/resource-availability-service.d.ts +0 -8
  35. package/dist/services/resource-availability/builder/resource-builder.d.ts +0 -17
  36. package/dist/services/resource-availability/builder/resource-query-param.d.ts +0 -23
  37. package/dist/services/resource-availability/index.d.ts +0 -2
  38. package/dist/services/resource-availability/validator/index.d.ts +0 -4
  39. package/dist/services/resource-availability/validator/resource-job-validation.d.ts +0 -11
  40. package/dist/services/resource-availability/validator/resource-validation-option.d.ts +0 -5
  41. package/dist/services/resource-availability/validator/resource-validator.d.ts +0 -13
  42. package/dist/services/resource-availability/validator/validation-result.d.ts +0 -12
  43. package/yarn.lock +0 -3461
@@ -1,70 +0,0 @@
1
- export declare class CacheService<T> {
2
- private storage;
3
- private secondaryCache?;
4
- /**
5
- * Creates an instance of CacheService.
6
- * @param {CacheStorage<string>} storage - The cache storage implementation.
7
- */
8
- constructor(storage: CacheStorage<string>);
9
- /**
10
- * Sets a secondary cache service to use as a fallback.
11
- * @param {CacheService<T>} secondaryCache - The secondary cache service.
12
- * @returns {void}
13
- */
14
- setSecondaryCache(secondaryCache: CacheService<T>): void;
15
- /**
16
- * Retrieves a cached value by key.
17
- * If the value is not found, it attempts to retrieve it from a secondary service or loader.
18
- * @param {string} key - The cache key.
19
- * @param {object} options - Optional parameters.
20
- * @param {CacheLoader<T>} [options.loader] - A function to load the value if not cached.
21
- * @param {boolean} [options.useSecondaryCache] - Whether to use the secondary cache service.
22
- * @returns {Promise<T | null>} - The cached value or null if not found or expired.
23
- */
24
- get(key: string, options?: CacheOptions<T>): Promise<T | null>;
25
- /**
26
- * Stores a value in the cache with an optional TTL.
27
- * @param {string} key - The cache key.
28
- * @param {T} value - The value to store.
29
- * @param {object} options - Optional parameters.
30
- * @returns {Promise<void>}
31
- */
32
- set(key: string, value: T, options?: CacheOptions<T>): Promise<void>;
33
- /**
34
- * Deletes a specific key from the cache.
35
- * @param {string} key - The cache key to delete.
36
- * @returns {Promise<void>}
37
- */
38
- delete(key: string): Promise<void>;
39
- /**
40
- * Clears all cache entries.
41
- * @returns {Promise<void>}
42
- */
43
- clear(): Promise<void>;
44
- /**
45
- * Adds the cache key prefix to a key if it is not already present.
46
- * @param {string} key - The cache key.
47
- * @returns {string} - The key with the prefix
48
- */
49
- addPrefix(key: string): string;
50
- /**
51
- * Deserializes the cached metadata and returns the original value in the correct type.
52
- * @param {any} metadata - The cached metadata object.
53
- * @returns {T} - The deserialized value.
54
- */
55
- private deserialize;
56
- }
57
- /**
58
- * Interface for cache storage.
59
- * This defines the basic storage operations without loader logic.
60
- */
61
- export interface CacheStorage<T = any> {
62
- set(key: string, value: T): Promise<void>;
63
- get(key: string): Promise<T | null>;
64
- delete(key: string): Promise<void>;
65
- clear(): Promise<void>;
66
- }
67
- export interface CacheOptions<T> {
68
- ttl?: number;
69
- useSecondaryCache?: boolean;
70
- }
@@ -1 +0,0 @@
1
- export * from "./cache-service";
@@ -1,40 +0,0 @@
1
- import { ConfigVarClient } from "../../../clients";
2
- import { CacheStorage } from "../cache-service";
3
- /**
4
- * Implementation of CacheStorage using ConfigVarClient.
5
- * This class interacts with a configuration variable service to store and retrieve values.
6
- */
7
- export declare class ConfigVarCacheStorage<T = any> implements CacheStorage<T> {
8
- private configVarClient;
9
- /**
10
- * Creates an instance of ConfigVarCacheStorage.
11
- * @param {ConfigVarClient} configVarService - The client used to interact with the configuration variable service.
12
- */
13
- constructor(configVarService: ConfigVarClient);
14
- /**
15
- * Stores a value in the configuration variable service.
16
- * If the key already exists, it updates the value.
17
- * @param {string} key - The cache key.
18
- * @param {T} value - The value to store.
19
- * @returns {Promise<void>}
20
- */
21
- set(key: string, value: T): Promise<void>;
22
- /**
23
- * Retrieves a cached value by key from the configuration variable service.
24
- * @param {string} key - The cache key.
25
- * @returns {Promise<T | null>} - The cached value or null if not found.
26
- */
27
- get(key: string): Promise<T | null>;
28
- /**
29
- * Deletes a specific key from the cache.
30
- * @param {string} key - The cache key to delete.
31
- * @returns {Promise<void>}
32
- */
33
- delete(key: string): Promise<void>;
34
- /**
35
- * Clears all cache entries.
36
- * Note: This operation is not supported by ConfigVarCacheStorage.
37
- * @returns {Promise<void>}
38
- */
39
- clear(): Promise<void>;
40
- }
@@ -1,32 +0,0 @@
1
- import { CacheStorage } from "../cache-service";
2
- /**
3
- * Implementation of CacheStorage using an in-memory Map.
4
- * This class provides a simple key-value store that resides in memory.
5
- */
6
- export declare class InMemoryCacheStorage<T = any> implements CacheStorage<T> {
7
- private cache;
8
- /**
9
- * Stores a value in the cache.
10
- * @param {string} key - The cache key.
11
- * @param {T} value - The value to store.
12
- * @returns {Promise<void>}
13
- */
14
- set(key: string, value: T): Promise<void>;
15
- /**
16
- * Retrieves a cached value by key.
17
- * @param {string} key - The cache key.
18
- * @returns {Promise<T | null>} - The cached value or null if not found.
19
- */
20
- get(key: string): Promise<T | null>;
21
- /**
22
- * Deletes a specific key from the cache.
23
- * @param {string} key - The cache key to delete.
24
- * @returns {Promise<void>}
25
- */
26
- delete(key: string): Promise<void>;
27
- /**
28
- * Clears all cache entries.
29
- * @returns {Promise<void>}
30
- */
31
- clear(): Promise<void>;
32
- }
@@ -1,2 +0,0 @@
1
- export * from "./config-var-cache-storage";
2
- export * from "./in-memory-cache-storage";
@@ -1,18 +0,0 @@
1
- import { PaginationStrategy } from "../pagination-strategy";
2
- /**
3
- * Default configuration values for `GraphBatchConfig`.
4
- */
5
- export declare const DEFAULT_GRAPH_BATCH_CONFIG: GraphBatchConfig;
6
- /**
7
- * Configuration options for `GraphBatch`.
8
- */
9
- export interface GraphBatchConfig {
10
- strategy: PaginationStrategy;
11
- batchSize: number;
12
- maxBatches: number;
13
- delaySeconds: number;
14
- }
15
- /**
16
- * Merges user-provided config with default values.
17
- */
18
- export declare function initializeConfig(config: Partial<GraphBatchConfig> | undefined): GraphBatchConfig;
@@ -1,16 +0,0 @@
1
- import { GraphBatchConfig } from "./graph-batch-config";
2
- /**
3
- * Default configuration values for `UniqueGraphBatchConfig`.
4
- */
5
- export declare const DEFAULT_UNIQUE_GRAPH_BATCH_CONFIG: UniqueGraphBatchConfig;
6
- /**
7
- * Configuration options for `UniqueGraphBatch`.
8
- */
9
- export interface UniqueGraphBatchConfig extends GraphBatchConfig {
10
- name?: string;
11
- lockTtl?: number;
12
- }
13
- /**
14
- * Merges user-provided config with default values for `UniqueGraphBatch`.
15
- */
16
- export declare function initializeUniqueConfig(config: Partial<UniqueGraphBatchConfig> | undefined): UniqueGraphBatchConfig;
@@ -1,56 +0,0 @@
1
- import { ExecutionContext } from "../../core";
2
- import { QueryResult } from "../../interfaces";
3
- import { GraphQLQueryBuilder } from "../graphql";
4
- import { GraphBatchConfig } from "./configs/graph-batch-config";
5
- /**
6
- * Base class for batch processing with pagination support.
7
- */
8
- export declare abstract class GraphBatch {
9
- protected context: ExecutionContext;
10
- protected config: GraphBatchConfig;
11
- protected queryBuilder?: GraphQLQueryBuilder;
12
- protected queryResult?: QueryResult;
13
- private startTime;
14
- constructor(context: ExecutionContext, config?: Partial<GraphBatchConfig>);
15
- /**
16
- * Runs the batch process, handling pagination, execution, and accumulation of results.
17
- *
18
- * @returns The accumulated result of the batch process.
19
- */
20
- run(): Promise<void>;
21
- /**
22
- * Initializes the query builder. This method must be overridden in subclasses.
23
- *
24
- * @returns A configured GraphQL query builder.
25
- */
26
- protected abstract start(): Promise<GraphQLQueryBuilder>;
27
- /**
28
- * Processes a batch of records and accumulates the result.
29
- *
30
- * @param records The batch of records retrieved from the query.
31
- */
32
- protected abstract execute(records: any[]): Promise<void>;
33
- /**
34
- * Final cleanup or logging after the batch process completes.
35
- */
36
- protected finish(): Promise<void>;
37
- /**
38
- * Fetches the next page of data based on the pagination strategy.
39
- *
40
- * @returns The result of the query execution.
41
- */
42
- protected fetchNextPage(): Promise<QueryResult>;
43
- /**
44
- * Checks if the maximum number of batches has been reached.
45
- *
46
- * @param currentBatchCount The number of batches processed so far.
47
- * @returns `true` if the maximum limit is reached, otherwise `false`.
48
- */
49
- protected isMaxBatchesReached(currentBatchCount: number): boolean;
50
- /**
51
- * Delays execution for a specified time.
52
- *
53
- * @param ms The time in milliseconds to delay.
54
- */
55
- protected delay(ms: number): Promise<void>;
56
- }
@@ -1,5 +0,0 @@
1
- export * from "./configs/graph-batch-config";
2
- export * from "./configs/unique-graph-batch-config";
3
- export * from "./graph-batch";
4
- export * from "./pagination-strategy";
5
- export * from "./unique-graph-batch";
@@ -1,5 +0,0 @@
1
- export declare enum PaginationStrategy {
2
- CURSOR = "cursor",
3
- OFFSET = "offset",
4
- NONE = "none"
5
- }
@@ -1,28 +0,0 @@
1
- import { ExecutionContext } from "../../core/execution-context";
2
- import { GraphQLQueryBuilder } from "../graphql";
3
- import { UniqueGraphBatchConfig } from "./configs/unique-graph-batch-config";
4
- import { GraphBatch } from "./graph-batch";
5
- /**
6
- * UniqueGraphBatch ensures that only one instance of a batch with the same name can run at a time.
7
- */
8
- export declare class UniqueGraphBatch extends GraphBatch {
9
- private name;
10
- private lockTtl;
11
- constructor(context: ExecutionContext, config?: Partial<UniqueGraphBatchConfig>);
12
- /**
13
- * Runs the batch process with lock enforcement.
14
- */
15
- run(): Promise<void>;
16
- /**
17
- * Abstract method implementation - Initialize query builder.
18
- */
19
- protected start(): Promise<GraphQLQueryBuilder>;
20
- /**
21
- * Abstract method implementation - Process batch records.
22
- */
23
- protected execute(records: any[]): Promise<void>;
24
- /**
25
- * Overrides the finish method to ensure lock cleanup.
26
- */
27
- protected finish(): Promise<void>;
28
- }
@@ -1,138 +0,0 @@
1
- import { GraphQLService } from "./graphql-service";
2
- import { GraphqlQueryParams, QueryResult, MutationResult } from "../../interfaces/graphql";
3
- /**
4
- * A utility class for building GraphQL queries or mutations dynamically.
5
- */
6
- export declare class GraphQLQueryBuilder {
7
- private objectName;
8
- operationName: string;
9
- private operationType;
10
- private fields;
11
- private filters;
12
- private input;
13
- private first?;
14
- private offset?;
15
- private orderBy?;
16
- private after?;
17
- private parentQueries;
18
- private childQueries;
19
- private isParent;
20
- private graphqlService;
21
- private queryParams;
22
- /**
23
- * Creates an instance of GraphQLQueryBuilder.
24
- * @param queryParams - The parameters for the query or mutation.
25
- * @param isParent - Indicates if this is a parent query.
26
- */
27
- constructor(queryParams: GraphqlQueryParams, isParent?: boolean);
28
- /**
29
- * Sets the GraphQL service to use for executing the operation.
30
- * @param graphqlService - The GraphQL service instance.
31
- * @returns The query builder instance for chaining.
32
- */
33
- setGraphqlService(graphqlService: GraphQLService): this;
34
- /**
35
- * Specifies the fields to be retrieved. Prevents duplicates.
36
- * @param fields - Array of field names to include.
37
- * @returns The query builder instance for chaining.
38
- */
39
- withFields(fields: string[]): this;
40
- /**
41
- * Adds a filter condition to the query.
42
- * @param condition - The filter condition string.
43
- * @returns The query builder instance for chaining.
44
- * @throws Error if applied to a mutation or parent query.
45
- */
46
- withFilter(condition: string): this;
47
- /**
48
- * Sets the input object for a mutation.
49
- * @param input - The mutation input object.
50
- * @returns The query builder instance for chaining.
51
- * @throws Error if applied to a query.
52
- */
53
- withInput(input: Record<string, any>): this;
54
- /**
55
- * Sets a limit on the number of records to retrieve.
56
- * @param first - The maximum number of records.
57
- * @returns The query builder instance for chaining.
58
- * @throws Error if applied to a mutation or parent query.
59
- */
60
- withLimit(first: number): this;
61
- /**
62
- * Sets an offset for pagination.
63
- * @param offset - The number of records to skip.
64
- * @returns The query builder instance for chaining.
65
- * @throws Error if applied to a mutation or parent query.
66
- */
67
- withOffset(offset: number): this;
68
- /**
69
- * Sets the order in which records should be retrieved.
70
- * @param orderBy - The field to order by.
71
- * @returns The query builder instance for chaining.
72
- * @throws Error if applied to a mutation or parent query.
73
- */
74
- withOrderBy(orderBy: string): this;
75
- /**
76
- * Applies cursor-based pagination.
77
- * @param after - The cursor to paginate after.
78
- * @returns The query builder instance for chaining.
79
- * @throws Error if applied to a mutation or parent query.
80
- */
81
- withCursor(after: string): this;
82
- /**
83
- * Creates a parent query.
84
- * @param objectName - The name of the parent object.
85
- * @returns The parent query builder instance.
86
- */
87
- withParentQuery(objectName: string): GraphQLQueryBuilder;
88
- /**
89
- * Creates a child query.
90
- * @param objectName - The name of the child object.
91
- * @returns The child query builder instance.
92
- */
93
- withChildQuery(objectName: string): GraphQLQueryBuilder;
94
- /**
95
- * Recursively builds the GraphQL query fields, handling nested queries.
96
- * @returns The formatted fields string.
97
- */
98
- private formatQueryFields;
99
- /**
100
- * Builds the GraphQL operation parameters.
101
- * @returns The structured query or mutation parameters.
102
- */
103
- build(): GraphqlQueryParams;
104
- /**
105
- * Executes the query or mutation.
106
- * @returns A promise resolving to the operation result.
107
- * @throws Error if no GraphQL service is set.
108
- */
109
- execute(): Promise<QueryResult | MutationResult>;
110
- /**
111
- * Generates a string representation of the GraphQL operation for debugging.
112
- * @returns The formatted operation string.
113
- */
114
- toString(): string;
115
- }
116
- /**
117
- * A utility class for building and executing a batch of GraphQL queries and mutations.
118
- */
119
- export declare class GraphQLBatchBuilder {
120
- private operations;
121
- /**
122
- * Adds a query or mutation to the batch.
123
- * @param builder - The GraphQLQueryBuilder instance for the query or mutation.
124
- * @returns The batch builder instance for chaining.
125
- */
126
- add(builder: GraphQLQueryBuilder): this;
127
- /**
128
- * Executes the batch of queries and mutations.
129
- * @returns A promise resolving to an array of query or mutation results.
130
- * @throws Error if no operations are added or if GraphQL service is missing.
131
- */
132
- execute(): Promise<(QueryResult | MutationResult)[]>;
133
- /**
134
- * Generates a string representation of the batch for debugging.
135
- * @returns A string containing all operations in the batch.
136
- */
137
- toString(): string;
138
- }
@@ -1,10 +0,0 @@
1
- import { QueryResult } from "../../interfaces";
2
- import { GraphQLQueryBuilder } from "./graphql-query-builder";
3
- export declare class GraphQLQueryBatch {
4
- /**
5
- * Executes a batch of queries.
6
- * @param {GraphQLQueryBuilder[]} builders - Array of query builders.
7
- * @returns {Promise<QueryResult[]>} - Array of query results.
8
- */
9
- execute(builders: GraphQLQueryBuilder[]): Promise<QueryResult[]>;
10
- }
@@ -1,86 +0,0 @@
1
- import { GraphqlQueryParams, QueryResult } from "../../interfaces/graphql";
2
- import { GraphQLService } from "./graphql-service";
3
- /**
4
- * A utility class for building GraphQL queries dynamically.
5
- */
6
- export declare class GraphQLQueryBuilder {
7
- private objectName;
8
- operationName: string;
9
- private fields;
10
- private filters;
11
- private first?;
12
- private offset?;
13
- private orderBy?;
14
- private after?;
15
- private parentQueries;
16
- private childQueries;
17
- private isParent;
18
- private graphqlService;
19
- private queryParams;
20
- /**
21
- * Creates an instance of GraphQLQueryBuilder.
22
- * @param {GraphqlQueryParams} queryParams - The parameters for the query.
23
- * @param {boolean} [isParent=false] - Indicates if this query is a parent query.
24
- */
25
- constructor(queryParams: GraphqlQueryParams, isParent?: boolean);
26
- /**
27
- * Sets the GraphQL service to use for executing the query.
28
- */
29
- setGraphqlService(graphqlService: GraphQLService): void;
30
- /**
31
- * Specifies the fields to be retrieved. Prevents duplicates.
32
- */
33
- withFields(fields: string[]): this;
34
- /**
35
- * Adds a filter condition to the query.
36
- */
37
- withFilter(condition: string): this;
38
- /**
39
- * Sets a limit on the number of records to retrieve.
40
- */
41
- withLimit(first: number): this;
42
- /**
43
- * Sets an offset for pagination.
44
- */
45
- withOffset(offset: number): this;
46
- /**
47
- * Sets the order in which records should be retrieved.
48
- */
49
- withOrderBy(orderBy: string): this;
50
- /**
51
- * Applies cursor-based pagination.
52
- */
53
- withCursor(after: string): this;
54
- /**
55
- * Creates a parent query.
56
- */
57
- withParentQuery(objectName: string): GraphQLQueryBuilder;
58
- /**
59
- * Creates a child query.
60
- */
61
- withChildQuery(objectName: string): GraphQLQueryBuilder;
62
- /**
63
- * Recursively builds the GraphQL query fields, handling nested queries.
64
- */
65
- private formatQueryFields;
66
- /**
67
- * Builds the GraphQL query parameters in a structured format.
68
- */
69
- build(): GraphqlQueryParams;
70
- /**
71
- * Executes the query using the GraphQL service.
72
- */
73
- execute(): Promise<QueryResult>;
74
- /**
75
- * Executes all queries for the configured object, fetching records from the specified page range, up to a maximum of 20 pages.
76
- * @param {number} [fromPage=1] - The starting page number (1-based, defaults to 1).
77
- * @param {number} [toPage=20] - The ending page number (defaults to 20, capped at 20).
78
- * @returns {Promise<QueryResult>} - A query result containing all records in the page range and pagination info.
79
- * @throws {Error} - If the query execution fails, no GraphQL service is set, or invalid page parameters are provided.
80
- */
81
- executeAll(fromPage?: number, toPage?: number): Promise<QueryResult>;
82
- /**
83
- * Generates a string representation of the GraphQL query for debugging.
84
- */
85
- toString(): string;
86
- }
@@ -1,106 +0,0 @@
1
- import { GraphQLClient } from "../../clients/graphql-client";
2
- import { GraphqlMutationParams, GraphqlQueryParams, MutationResult, QueryResult } from "../../interfaces/graphql";
3
- import { GraphQLQueryBuilder } from "./graphql-query-builder";
4
- /**
5
- * Service for executing GraphQL queries and mutations.
6
- */
7
- export declare class GraphQLService {
8
- private client;
9
- /**
10
- * Constructor to initialize the GraphQL client.
11
- * @param {GraphQLClient} client - The GraphQL client instance.
12
- */
13
- constructor(client: GraphQLClient);
14
- /**
15
- * Executes a GraphQL query.
16
- * @param {GraphqlQueryParams} params - The parameters for the GraphQL query.
17
- * @returns {Promise<QueryResult>} - The query result containing records and pagination info.
18
- * @throws {Error} - If the query execution fails.
19
- */
20
- query(params: GraphqlQueryParams): Promise<QueryResult>;
21
- /**
22
- * Executes a batch of queries.
23
- * @param {GraphQLQueryBuilder[]} builders - Array of query builders.
24
- * @returns {Promise<QueryResult[]>} - Array of query results.
25
- */
26
- queryBatch(builders: GraphQLQueryBuilder[]): Promise<QueryResult[]>;
27
- /**
28
- * Executes a batch of GraphQL queries.
29
- * @param {GraphqlQueryParams[]} paramsArray - An array of query parameters.
30
- * @returns {Promise<QueryResult[]>} - An array of query results.
31
- * @throws {Error} - If the batch execution fails.
32
- */
33
- private executeBatchQueries;
34
- /**
35
- * Executes a GraphQL mutation.
36
- * @param {GraphqlMutationParams} params - The parameters for the GraphQL mutation.
37
- * @returns {Promise<MutationResult>} - The mutation result containing affected UIDs.
38
- * @throws {Error} - If the mutation execution fails or the operation is invalid.
39
- */
40
- mutate(params: GraphqlMutationParams): Promise<MutationResult>;
41
- /**
42
- * Executes a batch of GraphQL mutations.
43
- * @param {GraphqlMutationParams[]} paramsArray - An array of mutation parameters.
44
- * @returns {Promise<MutationResult[]>} - An array of mutation results.
45
- * @throws {Error} - If the batch execution fails or if any mutation has empty records.
46
- */
47
- mutateBatch(paramsArray: GraphqlMutationParams[]): Promise<MutationResult[]>;
48
- /**
49
- * Deletes objects using a GraphQL mutation.
50
- * @param {GraphqlMutationParams} params - The parameters for the delete mutation.
51
- * @returns {Promise<MutationResult>} - The mutation result containing deleted UIDs.
52
- * @throws {Error} - If the delete operation fails.
53
- */
54
- delete(params: GraphqlMutationParams): Promise<MutationResult>;
55
- /**
56
- * Updates objects using a GraphQL mutation.
57
- * @param {GraphqlMutationParams} params - The parameters for the update mutation.
58
- * @returns {Promise<MutationResult>} - The mutation result containing updated UIDs.
59
- * @throws {Error} - If the update operation fails.
60
- */
61
- update(params: GraphqlMutationParams): Promise<MutationResult>;
62
- /**
63
- * Inserts objects using a GraphQL mutation.
64
- * @param {GraphqlMutationParams} params - The parameters for the insert mutation.
65
- * @returns {Promise<MutationResult>} - The mutation result containing inserted UIDs.
66
- * @throws {Error} - If the insert operation fails.
67
- */
68
- insert(params: GraphqlMutationParams): Promise<MutationResult>;
69
- /**
70
- * Upserts objects using a GraphQL mutation.
71
- * @param {GraphqlMutationParams} params - The parameters for the upsert mutation, including keyField.
72
- * @returns {Promise<MutationResult>} - The mutation result containing upserted UIDs.
73
- * @throws {Error} - If the upsert operation fails.
74
- */
75
- upsert(params: GraphqlMutationParams): Promise<MutationResult>;
76
- /**
77
- * Extracts UIDs from a mutation response.
78
- * @param {MutationResult} response - The mutation response containing the schema.
79
- * @returns {string[]} - An array of UIDs extracted from the response.
80
- */
81
- extractUIDs(response: MutationResult): string[];
82
- /**
83
- * Converts object name to GraphQL query name format.
84
- * @param {string} objectName - The object name to convert.
85
- * @returns {string} - The formatted query name.
86
- */
87
- private getQueryName;
88
- /**
89
- * Generates headers for GraphQL queries.
90
- * @param {GraphqlQueryParams} params - The query parameters containing operationName and readOnly flag.
91
- * @returns {Record<string, string>} - The headers for the query request.
92
- */
93
- private getQueryHeaders;
94
- /**
95
- * Generates headers for GraphQL mutations.
96
- * @param {GraphqlMutationParams} params - The mutation parameters containing operationName and optional flags.
97
- * @returns {Record<string, string>} - The headers for the mutation request.
98
- */
99
- private getMutationHeaders;
100
- /**
101
- * Generates operation header for GraphQL requests.
102
- * @param {string} operationName - The name of the GraphQL operation.
103
- * @returns {Record<string, string>} - The operation header.
104
- */
105
- private getOperationHeader;
106
- }
@@ -1,2 +0,0 @@
1
- export * from "./graphql-query-builder";
2
- export * from "./graphql-service";
@@ -1,20 +0,0 @@
1
- import { GraphqlMutationParams, GraphqlQueryParams } from "../../interfaces/graphql";
2
- /**
3
- * Constructs a GraphQL query to fetch records for a given object.
4
- * @param {GraphqlQueryParams} params - The parameters for the GraphQL query.
5
- * @returns {string} - The constructed GraphQL query string.
6
- */
7
- export declare const FETCH_RECORDS_QUERY: ({ objectName, operationName, filter, first, offset, after, orderBy, fields, }: GraphqlQueryParams) => string;
8
- /**
9
- * Constructs a GraphQL mutation to delete objects.
10
- * @param {GraphqlMutationParams} params - The parameters for the GraphQL mutation.
11
- * @returns {string} - The constructed GraphQL mutation string.
12
- */
13
- export declare const DELETE_OBJECTS_MUTATION: ({ objectName, operationName, records }: GraphqlMutationParams) => string;
14
- /**
15
- * Constructs a GraphQL mutation to insert, update, or upsert objects.
16
- * @param {GraphqlMutationParams} params - The parameters for the GraphQL mutation.
17
- * @returns {string} - The constructed GraphQL mutation string.
18
- * @throws {Error} - If the operation type is invalid.
19
- */
20
- export declare const MUTATE_OBJECTS_MUTATION: ({ objectName, operationName, records, operation, keyField, }: GraphqlMutationParams) => string;
@@ -1,10 +0,0 @@
1
- import { GraphqlQueryParams } from "../../../interfaces";
2
- import { GraphQLQueryBuilder, GraphQLService } from "../../graphql";
3
- import { ResourceQueryParam } from "./resource-query-param";
4
- export declare class DataService {
5
- private graphqlService;
6
- constructor(graphqlService: GraphQLService);
7
- getResources(param: ResourceQueryParam): Promise<Record<string, any>[]>;
8
- getHolidays(regionIds: string[], startTime?: Date, endTime?: Date): Promise<Record<string, any>>;
9
- newQueryBuilder(params: GraphqlQueryParams): GraphQLQueryBuilder;
10
- }
@@ -1,3 +0,0 @@
1
- export * from "./resource-availability-service";
2
- export * from "./resource-builder";
3
- export * from "./resource-query-param";