@tmlmobilidade/interfaces 20250922.953.29 → 20250924.1603.53
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.
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export * from './src/interfaces/index.js';
|
|
|
3
3
|
export * from './src/mongo-collection.js';
|
|
4
4
|
export * from './src/mongo-transaction.js';
|
|
5
5
|
export * from './src/providers/index.js';
|
|
6
|
-
export type { Collection, DeleteOptions, Document, Filter, FindOptions, IndexDescription, InsertOneOptions, InsertOneResult, MongoClientOptions, OptionalUnlessRequiredId, Sort, UpdateOptions, UpdateResult, WithId, } from 'mongodb';
|
|
6
|
+
export type { ChangeStreamDeleteDocument, ChangeStreamDocument, ChangeStreamInsertDocument, ChangeStreamUpdateDocument, Collection, DeleteOptions, Document, Filter, FindOptions, IndexDescription, InsertOneOptions, InsertOneResult, MongoClientOptions, OptionalUnlessRequiredId, Sort, UpdateDescription, UpdateOptions, UpdateResult, WithId, } from 'mongodb';
|
|
@@ -41,7 +41,7 @@ class RideAcceptanceClass extends MongoCollectionClass {
|
|
|
41
41
|
const flattenedDiff = flattenObject(diff);
|
|
42
42
|
data.comments = data.comments || prevAcceptance.comments || [];
|
|
43
43
|
for (const key of Object.keys(flattenedDiff)) {
|
|
44
|
-
if (key === 'is_locked' || key === 'acceptance_status' || key === 'justification') {
|
|
44
|
+
if (key === 'is_locked' || key === 'acceptance_status' || key === 'justification' || key === 'analysis_summary') {
|
|
45
45
|
data.comments.push({
|
|
46
46
|
created_at: Dates.now('utc').unix_timestamp,
|
|
47
47
|
created_by: data.updated_by || 'system',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MongoConnector } from '@tmlmobilidade/connectors';
|
|
2
2
|
import { type UnixTimestamp } from '@tmlmobilidade/types';
|
|
3
|
-
import { Collection, DeleteOptions, DeleteResult, Document, Filter, FindOptions, IndexDescription, InsertOneOptions, InsertOneResult, MongoClientOptions, UpdateOptions, UpdateResult, WithId } from 'mongodb';
|
|
3
|
+
import { AggregateOptions, AggregationCursor, Collection, DeleteOptions, DeleteResult, Document, Filter, FindOptions, IndexDescription, InsertOneOptions, InsertOneResult, MongoClientOptions, UpdateOptions, UpdateResult, WithId } from 'mongodb';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { AggregationPipeline } from './aggregation-pipeline.js';
|
|
6
6
|
export declare abstract class MongoCollectionClass<T extends Document, TCreate, TUpdate> {
|
|
@@ -11,9 +11,15 @@ export declare abstract class MongoCollectionClass<T extends Document, TCreate,
|
|
|
11
11
|
/**
|
|
12
12
|
* Aggregates documents in the collection.
|
|
13
13
|
* @param pipeline - The aggregation pipeline to execute
|
|
14
|
+
* @param options - The options for the aggregation operation
|
|
14
15
|
* @returns A promise that resolves to an array of aggregated documents
|
|
15
16
|
*/
|
|
16
|
-
aggregate(pipeline: AggregationPipeline<T
|
|
17
|
+
aggregate(pipeline: AggregationPipeline<T>, options?: AggregateOptions & {
|
|
18
|
+
returnResult?: true;
|
|
19
|
+
}): Promise<T[]>;
|
|
20
|
+
aggregate(pipeline: AggregationPipeline<T>, options: AggregateOptions & {
|
|
21
|
+
returnResult: false;
|
|
22
|
+
}): Promise<AggregationCursor<T>>;
|
|
17
23
|
/**
|
|
18
24
|
* Gets all documents in the collection.
|
|
19
25
|
* @returns A promise that resolves to an array of all documents
|
|
@@ -8,13 +8,12 @@ export class MongoCollectionClass {
|
|
|
8
8
|
mongoCollection;
|
|
9
9
|
mongoConnector;
|
|
10
10
|
updateSchema = null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return await this.mongoCollection.aggregate(pipeline).toArray();
|
|
11
|
+
async aggregate(pipeline, options) {
|
|
12
|
+
const aggregation = this.mongoCollection.aggregate(pipeline, options);
|
|
13
|
+
if (options?.returnResult === false) {
|
|
14
|
+
return aggregation;
|
|
15
|
+
}
|
|
16
|
+
return aggregation.toArray();
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Gets all documents in the collection.
|
package/package.json
CHANGED