@boostercloud/framework-provider-azure 0.28.6 → 0.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CosmosClient } from '@azure/cosmos';
|
|
2
2
|
import { BoosterConfig, FilterFor, ReadModelListResult, SortFor } from '@boostercloud/framework-types';
|
|
3
|
-
export declare function search<TResult>(cosmosDb: CosmosClient, config: BoosterConfig, containerName: string, filters: FilterFor<unknown>, limit?: number | undefined, afterCursor?: Record<string, string> | undefined, paginatedVersion?: boolean, order?: SortFor<unknown
|
|
3
|
+
export declare function search<TResult>(cosmosDb: CosmosClient, config: BoosterConfig, containerName: string, filters: FilterFor<unknown>, limit?: number | undefined, afterCursor?: Record<string, string> | undefined, paginatedVersion?: boolean, order?: SortFor<unknown>, projections?: string): Promise<Array<TResult> | ReadModelListResult<TResult>>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.search = void 0;
|
|
4
4
|
const framework_types_1 = require("@boostercloud/framework-types");
|
|
5
5
|
const framework_common_helpers_1 = require("@boostercloud/framework-common-helpers");
|
|
6
|
-
async function search(cosmosDb, config, containerName, filters, limit, afterCursor, paginatedVersion = false, order) {
|
|
6
|
+
async function search(cosmosDb, config, containerName, filters, limit, afterCursor, paginatedVersion = false, order, projections = '*') {
|
|
7
7
|
const logger = (0, framework_common_helpers_1.getLogger)(config, 'query-helper#search');
|
|
8
8
|
const filterExpression = buildFilterExpression(filters);
|
|
9
|
-
const queryDefinition = `SELECT
|
|
9
|
+
const queryDefinition = `SELECT ${projections} FROM c ${filterExpression !== '' ? `WHERE ${filterExpression}` : filterExpression}`;
|
|
10
10
|
const queryWithOrder = queryDefinition + buildOrderExpression(order);
|
|
11
11
|
let finalQuery = queryWithOrder;
|
|
12
12
|
if (paginatedVersion && limit) {
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ const Provider = (rockets) => ({
|
|
|
34
34
|
forEntitySince: events_adapter_1.readEntityEventsSince.bind(null, cosmosClient),
|
|
35
35
|
latestEntitySnapshot: events_adapter_1.readEntityLatestSnapshot.bind(null, cosmosClient),
|
|
36
36
|
search: events_searcher_adapter_1.searchEvents.bind(null, cosmosClient),
|
|
37
|
+
searchEntitiesIDs: events_searcher_adapter_1.searchEntitiesIds.bind(null, cosmosClient),
|
|
37
38
|
},
|
|
38
39
|
// ProviderReadModelsLibrary
|
|
39
40
|
readModels: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { BoosterConfig, EventSearchParameters, EventSearchResponse } from '@boostercloud/framework-types';
|
|
1
|
+
import { BoosterConfig, EventSearchParameters, EventSearchResponse, PaginatedEntitiesIdsResult } from '@boostercloud/framework-types';
|
|
2
2
|
import { CosmosClient } from '@azure/cosmos';
|
|
3
3
|
export declare function searchEvents(cosmosDb: CosmosClient, config: BoosterConfig, parameters: EventSearchParameters): Promise<Array<EventSearchResponse>>;
|
|
4
|
+
export declare function searchEntitiesIds(cosmosDb: CosmosClient, config: BoosterConfig, limit: number, afterCursor: Record<string, string> | undefined, entityTypeName: string): Promise<PaginatedEntitiesIdsResult>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchEvents = void 0;
|
|
3
|
+
exports.searchEntitiesIds = exports.searchEvents = void 0;
|
|
4
4
|
const framework_common_helpers_1 = require("@boostercloud/framework-common-helpers");
|
|
5
5
|
const query_helper_1 = require("../helpers/query-helper");
|
|
6
6
|
const events_searcher_builder_1 = require("./events-searcher-builder");
|
|
@@ -19,3 +19,13 @@ async function searchEvents(cosmosDb, config, parameters) {
|
|
|
19
19
|
return eventEnvelopes;
|
|
20
20
|
}
|
|
21
21
|
exports.searchEvents = searchEvents;
|
|
22
|
+
async function searchEntitiesIds(cosmosDb, config, limit, afterCursor, entityTypeName) {
|
|
23
|
+
const logger = (0, framework_common_helpers_1.getLogger)(config, 'events-searcher-adapter#searchEntitiesIds');
|
|
24
|
+
logger.debug(`Initiating a paginated events search. limit: ${limit}, afterCursor: ${JSON.stringify(afterCursor)}, entityTypeName: ${entityTypeName}`);
|
|
25
|
+
const filterQuery = { kind: { eq: 'event' }, entityTypeName: { eq: entityTypeName } };
|
|
26
|
+
const eventStore = config.resourceNames.eventsStore;
|
|
27
|
+
const result = (await (0, query_helper_1.search)(cosmosDb, config, eventStore, filterQuery, limit, afterCursor, true, undefined, 'DISTINCT c.entityID'));
|
|
28
|
+
logger.debug('Unique events search result', result);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
exports.searchEntitiesIds = searchEntitiesIds;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boostercloud/framework-provider-azure",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.2",
|
|
4
4
|
"description": "Handle Booster's integration with Azure",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework-provider-azure"
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@azure/cosmos": "3.7.3",
|
|
24
24
|
"@azure/functions": "^1.2.2",
|
|
25
|
-
"@boostercloud/framework-common-helpers": "^0.
|
|
26
|
-
"@boostercloud/framework-types": "^0.
|
|
25
|
+
"@boostercloud/framework-common-helpers": "^0.29.2",
|
|
26
|
+
"@boostercloud/framework-types": "^0.29.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"chai": "4.2.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"bugs": {
|
|
47
47
|
"url": "https://github.com/boostercloud/booster/issues"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "4e8de338f2db58f7bf37c1cc341580cccc0ef489"
|
|
50
50
|
}
|