@mavenmachines/event-handler-lib 1.5.0-fix-1 → 1.5.0-rc.0
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/README.md +1 -271
- package/dist/config/default.d.ts +0 -6
- package/dist/config/default.js +0 -6
- package/dist/config/default.js.map +1 -1
- package/dist/package.json +2 -4
- package/dist/src/app.module.d.ts +2 -2
- package/dist/src/app.module.js +2 -2
- package/dist/src/app.module.js.map +1 -1
- package/dist/src/clients/openSearch/errors.d.ts +0 -2
- package/dist/src/clients/openSearch/errors.js +1 -4
- package/dist/src/clients/openSearch/errors.js.map +1 -1
- package/dist/src/clients/openSearch/mappings.d.ts +2 -6
- package/dist/src/clients/openSearch/mappings.js +2 -25
- package/dist/src/clients/openSearch/mappings.js.map +1 -1
- package/dist/src/clients/openSearch/openSearchClient.d.ts +3 -22
- package/dist/src/clients/openSearch/openSearchClient.js +60 -267
- package/dist/src/clients/openSearch/openSearchClient.js.map +1 -1
- package/dist/src/configs/inversifyConfig.d.ts +0 -1
- package/dist/src/configs/inversifyConfig.js +3 -20
- package/dist/src/configs/inversifyConfig.js.map +1 -1
- package/dist/src/{handlers/commandHandlers → eventHandlers}/baseCommandHandler.d.ts +19 -19
- package/dist/src/{handlers/commandHandlers → eventHandlers}/baseCommandHandler.js +7 -7
- package/dist/src/eventHandlers/baseCommandHandler.js.map +1 -0
- package/dist/src/{handlers/eventHandlers → eventHandlers}/baseEventHandler.d.ts +18 -18
- package/dist/src/{handlers/eventHandlers → eventHandlers}/baseEventHandler.js +3 -3
- package/dist/src/eventHandlers/baseEventHandler.js.map +1 -0
- package/dist/src/{handlers → eventHandlers}/baseHandler.d.ts +3 -3
- package/dist/src/{handlers → eventHandlers}/baseHandler.js +5 -2
- package/dist/src/eventHandlers/baseHandler.js.map +1 -0
- package/dist/src/{handlers/commandHandlers → eventHandlers}/commandHandlingModule.d.ts +3 -3
- package/dist/src/{handlers/commandHandlers → eventHandlers}/commandHandlingModule.js +3 -3
- package/dist/src/eventHandlers/commandHandlingModule.js.map +1 -0
- package/dist/src/{handlers/eventHandlers → eventHandlers}/eventHandlingModule.d.ts +7 -7
- package/dist/src/{handlers/eventHandlers → eventHandlers}/eventHandlingModule.js +8 -8
- package/dist/src/eventHandlers/eventHandlingModule.js.map +1 -0
- package/dist/src/{handlers/eventHandlers → eventHandlers}/syncFirestoreEvents.d.ts +3 -3
- package/dist/src/{handlers/eventHandlers → eventHandlers}/syncFirestoreEvents.js +3 -3
- package/dist/src/eventHandlers/syncFirestoreEvents.js.map +1 -0
- package/dist/src/exports/clients.d.ts +0 -1
- package/dist/src/exports/clients.js +1 -3
- package/dist/src/exports/clients.js.map +1 -1
- package/dist/src/exports/services.d.ts +2 -2
- package/dist/src/exports/services.js +2 -2
- package/dist/src/exports/services.js.map +1 -1
- package/dist/src/exports/sourcing.d.ts +3 -4
- package/dist/src/exports/sourcing.js +3 -18
- package/dist/src/exports/sourcing.js.map +1 -1
- package/dist/src/exports/utils.d.ts +0 -2
- package/dist/src/exports/utils.js +0 -2
- package/dist/src/exports/utils.js.map +1 -1
- package/dist/src/helpers/classConverter.d.ts +1 -0
- package/dist/src/helpers/classConverter.js +18 -0
- package/dist/src/helpers/classConverter.js.map +1 -1
- package/dist/src/helpers/dataStructure.helpers.d.ts +0 -2
- package/dist/src/helpers/dataStructure.helpers.js +0 -33
- package/dist/src/helpers/dataStructure.helpers.js.map +1 -1
- package/dist/src/initializers/logger.service.d.ts +0 -4
- package/dist/src/initializers/logger.service.js +0 -14
- package/dist/src/initializers/logger.service.js.map +1 -1
- package/dist/src/initializers/queue-manager.service.d.ts +1 -1
- package/dist/src/initializers/queue-manager.service.js +0 -1
- package/dist/src/initializers/queue-manager.service.js.map +1 -1
- package/dist/src/repositories/projectionRepository.d.ts +8 -4
- package/dist/src/repositories/projectionRepository.js +30 -13
- package/dist/src/repositories/projectionRepository.js.map +1 -1
- package/dist/src/rpc/rpcModule.js +1 -4
- package/dist/src/rpc/rpcModule.js.map +1 -1
- package/dist/src/testUtils/testDependencies.d.ts +2 -1
- package/dist/src/testUtils/testDependencies.js +13 -10
- package/dist/src/testUtils/testDependencies.js.map +1 -1
- package/dist/test/testImplementations/testCommandHandler.d.ts +1 -1
- package/dist/test/testImplementations/testCommandHandler.js +1 -1
- package/dist/test/testImplementations/testCommandHandler.js.map +1 -1
- package/dist/test/testImplementations/testEventHandler.d.ts +10 -3
- package/dist/test/testImplementations/testEventHandler.js +32 -4
- package/dist/test/testImplementations/testEventHandler.js.map +1 -1
- package/dist/test/testImplementations/testFirestoreEventSync.js +1 -1
- package/dist/test/testImplementations/testFirestoreEventSync.js.map +1 -1
- package/dist/test/tests/clients/opensearch.client.spec.js +72 -1
- package/dist/test/tests/clients/opensearch.client.spec.js.map +1 -1
- package/dist/test/tests/common.js +5 -3
- package/dist/test/tests/common.js.map +1 -1
- package/dist/test/tests/eventHandlers/baseEventHandler.spec.js +19 -6
- package/dist/test/tests/eventHandlers/baseEventHandler.spec.js.map +1 -1
- package/dist/test/tests/eventHandlers/firestoreEventSyncHandler.spec.js +16 -6
- package/dist/test/tests/eventHandlers/firestoreEventSyncHandler.spec.js.map +1 -1
- package/dist/test/tests/helpers/classConverter.spec.js +21 -0
- package/dist/test/tests/helpers/classConverter.spec.js.map +1 -1
- package/dist/test/tests/helpers/syncOpensearch.spec.js +43 -0
- package/dist/test/tests/helpers/syncOpensearch.spec.js.map +1 -1
- package/dist/test/tests/repositories/projectionRepository.spec.js +4 -3
- package/dist/test/tests/repositories/projectionRepository.spec.js.map +1 -1
- package/package.json +2 -4
- package/dist/src/handlers/baseHandler.js.map +0 -1
- package/dist/src/handlers/commandHandlers/baseCommandHandler.js.map +0 -1
- package/dist/src/handlers/commandHandlers/commandHandlingModule.js.map +0 -1
- package/dist/src/handlers/crud/baseHandlers.d.ts +0 -21
- package/dist/src/handlers/crud/baseHandlers.js +0 -90
- package/dist/src/handlers/crud/baseHandlers.js.map +0 -1
- package/dist/src/handlers/crud/createProjectionHandler.d.ts +0 -9
- package/dist/src/handlers/crud/createProjectionHandler.js +0 -37
- package/dist/src/handlers/crud/createProjectionHandler.js.map +0 -1
- package/dist/src/handlers/crud/createUpdateProjectionHandler.d.ts +0 -10
- package/dist/src/handlers/crud/createUpdateProjectionHandler.js +0 -40
- package/dist/src/handlers/crud/createUpdateProjectionHandler.js.map +0 -1
- package/dist/src/handlers/crud/decorators.d.ts +0 -4
- package/dist/src/handlers/crud/decorators.js +0 -9
- package/dist/src/handlers/crud/decorators.js.map +0 -1
- package/dist/src/handlers/crud/deleteProjectionHandler.d.ts +0 -9
- package/dist/src/handlers/crud/deleteProjectionHandler.js +0 -43
- package/dist/src/handlers/crud/deleteProjectionHandler.js.map +0 -1
- package/dist/src/handlers/crud/getProjectionHandler.d.ts +0 -11
- package/dist/src/handlers/crud/getProjectionHandler.js +0 -30
- package/dist/src/handlers/crud/getProjectionHandler.js.map +0 -1
- package/dist/src/handlers/crud/getProjectionsHandler.d.ts +0 -10
- package/dist/src/handlers/crud/getProjectionsHandler.js +0 -57
- package/dist/src/handlers/crud/getProjectionsHandler.js.map +0 -1
- package/dist/src/handlers/crud/helpers.d.ts +0 -22
- package/dist/src/handlers/crud/helpers.js +0 -179
- package/dist/src/handlers/crud/helpers.js.map +0 -1
- package/dist/src/handlers/crud/index.d.ts +0 -31
- package/dist/src/handlers/crud/index.js +0 -88
- package/dist/src/handlers/crud/index.js.map +0 -1
- package/dist/src/handlers/crud/searchProjectionsHandler.d.ts +0 -8
- package/dist/src/handlers/crud/searchProjectionsHandler.js +0 -162
- package/dist/src/handlers/crud/searchProjectionsHandler.js.map +0 -1
- package/dist/src/handlers/crud/types.d.ts +0 -46
- package/dist/src/handlers/crud/types.js +0 -42
- package/dist/src/handlers/crud/types.js.map +0 -1
- package/dist/src/handlers/eventHandlers/baseEventHandler.js.map +0 -1
- package/dist/src/handlers/eventHandlers/eventHandlingModule.js.map +0 -1
- package/dist/src/handlers/eventHandlers/syncFirestoreEvents.js.map +0 -1
- package/dist/src/helpers/string.helpers.d.ts +0 -3
- package/dist/src/helpers/string.helpers.js +0 -24
- package/dist/src/helpers/string.helpers.js.map +0 -1
- package/dist/src/helpers/typeManipulation/classValidation.d.ts +0 -7
- package/dist/src/helpers/typeManipulation/classValidation.js +0 -30
- package/dist/src/helpers/typeManipulation/classValidation.js.map +0 -1
- package/dist/src/helpers/typeManipulation/decorators.d.ts +0 -18
- package/dist/src/helpers/typeManipulation/decorators.js +0 -86
- package/dist/src/helpers/typeManipulation/decorators.js.map +0 -1
- package/dist/src/helpers/typeManipulation/dynamicClasses.d.ts +0 -8
- package/dist/src/helpers/typeManipulation/dynamicClasses.js +0 -27
- package/dist/src/helpers/typeManipulation/dynamicClasses.js.map +0 -1
- package/dist/src/helpers/typeManipulation/index.d.ts +0 -3
- package/dist/src/helpers/typeManipulation/index.js +0 -20
- package/dist/src/helpers/typeManipulation/index.js.map +0 -1
- package/dist/src/testUtils/mocks/openSearch.client.mock.d.ts +0 -102
- package/dist/src/testUtils/mocks/openSearch.client.mock.js +0 -405
- package/dist/src/testUtils/mocks/openSearch.client.mock.js.map +0 -1
- package/dist/test/testImplementations/testCrud.d.ts +0 -22
- package/dist/test/testImplementations/testCrud.js +0 -123
- package/dist/test/testImplementations/testCrud.js.map +0 -1
- package/dist/test/tests/eventHandlers/crudHandlers.spec.d.ts +0 -1
- package/dist/test/tests/eventHandlers/crudHandlers.spec.js +0 -555
- package/dist/test/tests/eventHandlers/crudHandlers.spec.js.map +0 -1
- package/dist/test/tests/helpers/decorators.spec.d.ts +0 -1
- package/dist/test/tests/helpers/decorators.spec.js +0 -109
- package/dist/test/tests/helpers/decorators.spec.js.map +0 -1
package/README.md
CHANGED
|
@@ -382,7 +382,7 @@ If the document ID should not be the same as the Projection's `entityId`, you
|
|
|
382
382
|
can overload `getDocumentId(EventSourcedProjection<PayloadT>): string` to get
|
|
383
383
|
the correct subpath for the Firestore document.
|
|
384
384
|
|
|
385
|
-
####
|
|
385
|
+
#### Parital Document Update
|
|
386
386
|
|
|
387
387
|
If you need to make partial modifications to Firestore documents, you can use
|
|
388
388
|
the `UpdateFirestoreProjection` plugin, which has an additional property,
|
|
@@ -464,276 +464,6 @@ Note that `name` can either be the instance of your class, or any string that
|
|
|
464
464
|
you want to call it. It is only used for logging purposes in the event of a
|
|
465
465
|
failure.
|
|
466
466
|
|
|
467
|
-
## Implementing CRUD Interfaces
|
|
468
|
-
|
|
469
|
-
There are many instances where one may want to expose a Projection type to a CRUD
|
|
470
|
-
(Create-Retrieve-Update-Delete) Interface via RPCs. Many entities are the
|
|
471
|
-
accumulation of events, but many also begin their lives externally, needing to be
|
|
472
|
-
created or updated via a command, and retrieved via ID or searched.
|
|
473
|
-
|
|
474
|
-
### Annotating a Projection for CRUD support.
|
|
475
|
-
|
|
476
|
-
In addition to supporting `class-validator` and `class-transformer` decorators,
|
|
477
|
-
`event-handler-lib` provides CRUD-specific decorators to allow a developer control
|
|
478
|
-
over the behavior of their Projection in a CRUD app.
|
|
479
|
-
|
|
480
|
-
Firstly, all supported projections must have the `@ProjectionType` decorator, so
|
|
481
|
-
that the framework knows where the representation lives in Dynamo and Opensearch.
|
|
482
|
-
|
|
483
|
-
To allow Update calls, fields can be marked with `@IsEditable()`. If a field is
|
|
484
|
-
not marked with `@IsEditable()`, Update requests that provide values for that field
|
|
485
|
-
will fail.
|
|
486
|
-
|
|
487
|
-
To allow Search functionality, the OpenSearch indexes must be properly configured.
|
|
488
|
-
Adding an `@IsSearchable()` decorator will tell the service to ensure that the
|
|
489
|
-
Mapping is properly set for those fields. In the event of a conflict with an existing
|
|
490
|
-
mapping, the service will fail to start.
|
|
491
|
-
|
|
492
|
-
Caveats:
|
|
493
|
-
|
|
494
|
-
- All `Projection` types must have an `id: string` field representing their `entityId`
|
|
495
|
-
- Only `number` and `string` indexes are supported for now, but more will come
|
|
496
|
-
- While the binding keys are defined by convention, the service must still provide
|
|
497
|
-
them to `Pump` via the `bindingKeys.config.json` file.
|
|
498
|
-
- This is the expected location for binding keys at Maven, and we do not want
|
|
499
|
-
to hide important diagnostic information in case of emergencies.
|
|
500
|
-
|
|
501
|
-
### Example
|
|
502
|
-
|
|
503
|
-
The `@ProjectionType()`, decorator will guide the names of the RabbitMQ binding keys
|
|
504
|
-
for a given Projection. Given the following examples:
|
|
505
|
-
|
|
506
|
-
```
|
|
507
|
-
@ProjectionType("salesProduct")
|
|
508
|
-
export class SalesProductProjection {
|
|
509
|
-
@IsString()
|
|
510
|
-
id: string;
|
|
511
|
-
|
|
512
|
-
@IsString()
|
|
513
|
-
@IsSearchable()
|
|
514
|
-
productCode: string;
|
|
515
|
-
|
|
516
|
-
@IsString()
|
|
517
|
-
@IsSearchable()
|
|
518
|
-
upc: string
|
|
519
|
-
|
|
520
|
-
@IsOptional()
|
|
521
|
-
@IsString()
|
|
522
|
-
@IsSearchable()
|
|
523
|
-
@IsEditable()
|
|
524
|
-
description: string;
|
|
525
|
-
|
|
526
|
-
@ValidateNested()
|
|
527
|
-
@Type(() => MetadataFields)
|
|
528
|
-
metadata: MetadataFields;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
export class MetadataFields {
|
|
532
|
-
@IsOptional()
|
|
533
|
-
@IsString()
|
|
534
|
-
@IsSearchable()
|
|
535
|
-
@IsEditable()
|
|
536
|
-
owner?: string;
|
|
537
|
-
|
|
538
|
-
@IsNumber()
|
|
539
|
-
@IsSearchable()
|
|
540
|
-
internalId: number
|
|
541
|
-
}
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
#### Create Request: `createSalesProduct`
|
|
545
|
-
|
|
546
|
-
The `create` requests are similar to standard RPC requests. The `id` field is not
|
|
547
|
-
supported, and a `companyId` must be provided.
|
|
548
|
-
|
|
549
|
-
```
|
|
550
|
-
{
|
|
551
|
-
companyId: 1234,
|
|
552
|
-
productCode: "Product-ABC",
|
|
553
|
-
upc: "00000-2334342",
|
|
554
|
-
metadata: {
|
|
555
|
-
owner: "this is optional",
|
|
556
|
-
internalId: 12359
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
The response is simply `{id: UUID}`.
|
|
562
|
-
|
|
563
|
-
### Update Request: `updateSalesProduct`
|
|
564
|
-
|
|
565
|
-
The `update` requests are also similar, except all fields are optional to both
|
|
566
|
-
TypeScript and `class-validator`. Unfortunately, it is impossible to remove
|
|
567
|
-
non-editable fields from the request type at compile-time, but server-side validation
|
|
568
|
-
will ensure they are not modified:
|
|
569
|
-
|
|
570
|
-
```
|
|
571
|
-
{
|
|
572
|
-
companyId: 1234,
|
|
573
|
-
id: "XXXX-XXXXXX-XXXXX-XXXXX-XXXX",
|
|
574
|
-
metadata: {
|
|
575
|
-
owner: "new owner",
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
The response is `{ modified: boolean }`, indicating whether or not the request
|
|
581
|
-
resulted in a modification to the projection.
|
|
582
|
-
|
|
583
|
-
### Delete Request: `deleteSalesProduct`
|
|
584
|
-
|
|
585
|
-
The `delete` requests simply require a `companyId` and `id`, as the `projectionType`
|
|
586
|
-
is inherently tied to the endpoint.
|
|
587
|
-
|
|
588
|
-
```
|
|
589
|
-
{
|
|
590
|
-
companyId: 1234,
|
|
591
|
-
id: "XXXX-XXXXXX-XXXXX-XXXXX-XXXX",
|
|
592
|
-
}
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
The response is empty on success, and will fail with `"errorKey": "NOT_FOUND"`
|
|
596
|
-
if the entity does not exist.
|
|
597
|
-
|
|
598
|
-
### Get Request: `getSalesProduct`
|
|
599
|
-
|
|
600
|
-
The `get` request also takes a `companyId` and `id`;
|
|
601
|
-
|
|
602
|
-
```
|
|
603
|
-
{
|
|
604
|
-
companyId: 1234,
|
|
605
|
-
id: "XXXX-XXXXXX-XXXXX-XXXXX-XXXX",
|
|
606
|
-
}
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
The response will contain the projections `payload` in its `projection` field if
|
|
610
|
-
it is found. If the entity does not exist, the `projection` field will be `undefined`:
|
|
611
|
-
|
|
612
|
-
```
|
|
613
|
-
{
|
|
614
|
-
projection: {
|
|
615
|
-
id: "XXXX-XXXXXX-XXXXX-XXXXX-XXXX",
|
|
616
|
-
productCode: "Product-ABC",
|
|
617
|
-
upc: "0000-12312342432",
|
|
618
|
-
metadata: {
|
|
619
|
-
owner: "this is optional",
|
|
620
|
-
internalId: 12359
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
### Get Multiple Request: `getSalesProducts`.
|
|
627
|
-
|
|
628
|
-
The framework also exposes a multi-get endpoint, where you can provide several `ids`
|
|
629
|
-
and retrieve them all.
|
|
630
|
-
|
|
631
|
-
```
|
|
632
|
-
{
|
|
633
|
-
companyId: 1234,
|
|
634
|
-
ids: ["UUID1", "UUID2", "UUID3"]
|
|
635
|
-
}
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
The response now has two array fields, `projections` holding the projections that
|
|
639
|
-
were found, and `missing` holding the `id`s of those that were not:
|
|
640
|
-
|
|
641
|
-
```
|
|
642
|
-
{
|
|
643
|
-
projections: [
|
|
644
|
-
{
|
|
645
|
-
id: "UUID2",
|
|
646
|
-
...
|
|
647
|
-
}
|
|
648
|
-
],
|
|
649
|
-
missing: ["UUID1", "UUID3"]
|
|
650
|
-
}
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
If all or none of the projections are found, the arrays will still exist in the
|
|
654
|
-
response, they will simply be empty.
|
|
655
|
-
|
|
656
|
-
### Searching Projections: `searchSalesProducts`
|
|
657
|
-
|
|
658
|
-
Finally, the framework provides search functionality. Any field marked
|
|
659
|
-
`@IsSearchable()` will have an appropriate index created. These fields can be
|
|
660
|
-
used in the query for filtering or sorting.
|
|
661
|
-
|
|
662
|
-
For example, to find fields with a matching `metadata.owner`, sorted by descending
|
|
663
|
-
`upc`, you can provide:
|
|
664
|
-
|
|
665
|
-
```
|
|
666
|
-
{
|
|
667
|
-
companyId: 1234,
|
|
668
|
-
query: {
|
|
669
|
-
metadata: {
|
|
670
|
-
owner: "Owner Name"
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
sort: {
|
|
674
|
-
upc: "desc"
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
By default, the searches are limited to 10 results per query, and will return
|
|
680
|
-
a `continuationToken`.
|
|
681
|
-
|
|
682
|
-
The optional fields are:
|
|
683
|
-
|
|
684
|
-
1. `limit` to determine how many results are returned
|
|
685
|
-
2. `page` the 1-indexed page number. If provided, the results will start at `limit * (page - 1)`
|
|
686
|
-
3. The returned `continuationToken` can be sent back in another search to continue
|
|
687
|
-
where you left off.
|
|
688
|
-
|
|
689
|
-
Response:
|
|
690
|
-
|
|
691
|
-
```
|
|
692
|
-
{
|
|
693
|
-
results: [{
|
|
694
|
-
id: "XXXXX",
|
|
695
|
-
productCode: "etc",
|
|
696
|
-
}, { ... }],
|
|
697
|
-
continuationToken: "XXXX"
|
|
698
|
-
}
|
|
699
|
-
```
|
|
700
|
-
|
|
701
|
-
When paging through search results, the `continuationToken` will be valid for
|
|
702
|
-
ten minutes, after which it will expire and queries will fail. During that time,
|
|
703
|
-
OpenSearch maintains a point-in-time snapshot of the data, so the results will
|
|
704
|
-
be consistent _at the time of the query_.
|
|
705
|
-
|
|
706
|
-
### Binding a CRUD handler for a Projection
|
|
707
|
-
|
|
708
|
-
If you want all of the functionality, the `CrudHandlerFactory` can set it all
|
|
709
|
-
up for you with on line of code.
|
|
710
|
-
|
|
711
|
-
```
|
|
712
|
-
CrudHandlerFactory.bind(appContainer, SalesProductProjection)
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
If you need to request an explicit subset, a list of `actions` can be provided,
|
|
716
|
-
followed by an optional `multi: boolean = true` to determine if the multi-Get endpoint
|
|
717
|
-
is provided.
|
|
718
|
-
|
|
719
|
-
### Client-Side
|
|
720
|
-
|
|
721
|
-
The `event-handler-lib` provides utility types for clients:
|
|
722
|
-
|
|
723
|
-
- `CreateRequest<T>`/`CreatedResponse`
|
|
724
|
-
- `UpdateRequest<T>`/`ModifiedResponse`
|
|
725
|
-
- `DeleteProjectionRequest`/`DeleteProjectionResponse`
|
|
726
|
-
- `GetProjectionRequest`/`GetProjectionResponse<T>`
|
|
727
|
-
- `GetProjectionsRequest`/`GetProjectionsResponse<T>`
|
|
728
|
-
- `SearchRequest<T>`/`SearchResults<T>`
|
|
729
|
-
|
|
730
|
-
Additionally, if you need to create the types with validation includes, the
|
|
731
|
-
`CrudCommandFactory` provides `createRequest`, `updateRequest`, and `searchRequest`
|
|
732
|
-
members, all of which take the `ClassConstructor<ProjectionType>`.
|
|
733
|
-
|
|
734
|
-
These are not required for `Get` and `Delete`, as `class-validator` and
|
|
735
|
-
`class-transformer` manipulation are not required.
|
|
736
|
-
|
|
737
467
|
## Testing
|
|
738
468
|
|
|
739
469
|
### Stubbing EventHandler services
|
package/dist/config/default.d.ts
CHANGED
|
@@ -10,12 +10,6 @@ declare const _default: {
|
|
|
10
10
|
disableLogging: boolean;
|
|
11
11
|
bindingKeys: {
|
|
12
12
|
testRpcRequest: string;
|
|
13
|
-
createExampleProjection: string;
|
|
14
|
-
updateExampleProjection: string;
|
|
15
|
-
deleteExampleProjection: string;
|
|
16
|
-
getExampleProjection: string;
|
|
17
|
-
getExampleProjections: string;
|
|
18
|
-
searchExampleProjections: string;
|
|
19
13
|
};
|
|
20
14
|
routingKey: {};
|
|
21
15
|
};
|
package/dist/config/default.js
CHANGED
|
@@ -54,12 +54,6 @@ exports.default = {
|
|
|
54
54
|
disableLogging: process.env.rabbitmq_disablelogging === "true",
|
|
55
55
|
bindingKeys: {
|
|
56
56
|
testRpcRequest: "#.eventHandlerLib.test.rpcRequest",
|
|
57
|
-
createExampleProjection: "#.eventHandlerLib.test.exampleProjection.create",
|
|
58
|
-
updateExampleProjection: "#.eventHandlerLib.test.exampleProjection.update",
|
|
59
|
-
deleteExampleProjection: "#.eventHandlerLib.test.exampleProjection.delete",
|
|
60
|
-
getExampleProjection: "#.eventHandlerLib.test.exampleProjection.get",
|
|
61
|
-
getExampleProjections: "#.eventHandlerLib.test.get.exampleProjections",
|
|
62
|
-
searchExampleProjections: "#.eventHandlerLib.test.search.exampleProjections",
|
|
63
57
|
},
|
|
64
58
|
routingKey: {},
|
|
65
59
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../config/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAAuE;AACvE,+CAAiC;AAEjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAEjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,uBAAuB,GAAG,EAAE;CACnC,CAAC,CAAC;AAEH,IAAI,KAAK,EAAE,CAAC;IACV,MAAM,KAAK,CAAC;AACd,CAAC;AAED,kBAAe;IACb,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACpC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,kBAAkB;QACrD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,aAAa;QACxD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,mBAAmB;QACxD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC;QAChD,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,MAAM;QAC3D,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,MAAM;QAC9D,WAAW,EAAE;YACX,cAAc,EAAE,mCAAmC;
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../config/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAAuE;AACvE,+CAAiC;AAEjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAEjC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,uBAAuB,GAAG,EAAE;CACnC,CAAC,CAAC;AAEH,IAAI,KAAK,EAAE,CAAC;IACV,MAAM,KAAK,CAAC;AACd,CAAC;AAED,kBAAe;IACb,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACpC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,kBAAkB;QACrD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,aAAa;QACxD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,mBAAmB;QACxD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC;QAChD,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,MAAM;QAC3D,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,MAAM;QAC9D,WAAW,EAAE;YACX,cAAc,EAAE,mCAAmC;SACpD;QACD,UAAU,EAAE,EAAE;KACf;IACD,UAAU,EAAE;QACV,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;KACjE;IACD,kBAAkB,EAAlB,uCAAkB;CACnB,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mavenmachines/event-handler-lib",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Helper libraries for creating an Event Handler",
|
|
5
5
|
"module": "./dist/src/index.mjs",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"depcruise": "npx depcruise src test",
|
|
19
19
|
"build": "npm run clean && tsc",
|
|
20
20
|
"clean": "rm -rf ./dist",
|
|
21
|
-
"test": "NODE_ENV=test mocha --config config/.mocharc.json",
|
|
21
|
+
"test": "NODE_ENV=test nyc mocha --config config/.mocharc.json",
|
|
22
22
|
"format": "npx prettier --write \"*/**/*.ts\"",
|
|
23
23
|
"lint-check": "npx eslint \"src/**/*.ts\"",
|
|
24
24
|
"lint": "npx eslint \"src/**/*.ts\" --fix",
|
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
"@mavenmachines/feature-flags-client": "^1.2.0",
|
|
72
72
|
"@mavenmachines/prometheus-nodejs-client": "^1.0.2",
|
|
73
73
|
"@mavenmachines/pump": "^1.5.4",
|
|
74
|
-
"@nestjs/mapped-types": "^2.1.0",
|
|
75
74
|
"@opensearch-project/opensearch": "^3.5.1",
|
|
76
75
|
"amqplib": "^0.10.5",
|
|
77
76
|
"async-mutex": "^0.5.0",
|
|
@@ -84,7 +83,6 @@
|
|
|
84
83
|
"dotenv": "^16.4.7",
|
|
85
84
|
"express": "^4.21.2",
|
|
86
85
|
"firebase-admin": "^12.1.1",
|
|
87
|
-
"haversine-distance": "^1.2.4",
|
|
88
86
|
"inversify": "^6.0.2",
|
|
89
87
|
"lodash": "^4.17.21",
|
|
90
88
|
"lru-cache": "^11.0.2",
|
package/dist/src/app.module.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { LoggerService } from "./initializers/logger.service";
|
|
3
|
-
import { EventHandlingModule } from "./
|
|
4
|
-
import { CommandHandlingModule } from "./
|
|
3
|
+
import { EventHandlingModule } from "./eventHandlers/eventHandlingModule";
|
|
4
|
+
import { CommandHandlingModule } from "./eventHandlers/commandHandlingModule";
|
|
5
5
|
import { RpcModule } from "./rpc/rpcModule";
|
|
6
6
|
import { QueueManagerService } from "./initializers/queue-manager.service";
|
|
7
7
|
export declare class AppModule {
|
package/dist/src/app.module.js
CHANGED
|
@@ -16,8 +16,8 @@ exports.AppModule = void 0;
|
|
|
16
16
|
require("reflect-metadata");
|
|
17
17
|
const inversify_1 = require("inversify");
|
|
18
18
|
const logger_service_1 = require("./initializers/logger.service");
|
|
19
|
-
const eventHandlingModule_1 = require("./
|
|
20
|
-
const commandHandlingModule_1 = require("./
|
|
19
|
+
const eventHandlingModule_1 = require("./eventHandlers/eventHandlingModule");
|
|
20
|
+
const commandHandlingModule_1 = require("./eventHandlers/commandHandlingModule");
|
|
21
21
|
const rpcModule_1 = require("./rpc/rpcModule");
|
|
22
22
|
const dependencyTypes_1 = require("./dependencies/dependencyTypes");
|
|
23
23
|
const queue_manager_service_1 = require("./initializers/queue-manager.service");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4BAA0B;AAC1B,yCAA+C;AAC/C,kEAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4BAA0B;AAC1B,yCAA+C;AAC/C,kEAAsE;AACtE,6EAA0E;AAC1E,iFAA8E;AAC9E,+CAA4C;AAC5C,oEAAuD;AACvD,gFAA2E;AAGpE,IAAM,SAAS,GAAf,MAAM,SAAS;IAGpB,YAC8C,WAAmB,EAE9C,YAAiC,EAE1C,mBAAwC,EAExC,qBAA4C,EAC7B,aAA4B,EACf,SAAoB;QARZ,gBAAW,GAAX,WAAW,CAAQ;QAE9C,iBAAY,GAAZ,YAAY,CAAqB;QAE1C,wBAAmB,GAAnB,mBAAmB,CAAqB;QAExC,0BAAqB,GAArB,qBAAqB,CAAuB;QAEhB,cAAS,GAAT,SAAS,CAAW;QAExD,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAgD;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,iBAAiB,CAAC,CAAC;QACvD,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAClC,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK;YAC9B,SAAS,EAAE,KAAK,EAAE,SAAS;SAC5B,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QAClC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAG1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,WAAW,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AA9BY,8BAAS;oBAAT,SAAS;IADrB,IAAA,sBAAU,GAAE;IAKR,WAAA,IAAA,kBAAM,EAAC,uBAAK,CAAC,WAAW,CAAC,CAAA;IACzB,WAAA,IAAA,kBAAM,EAAC,2CAAmB,CAAC,CAAA;IAE3B,WAAA,IAAA,kBAAM,EAAC,yCAAmB,CAAC,CAAA;IAE3B,WAAA,IAAA,kBAAM,EAAC,6CAAqB,CAAC,CAAA;IAE7B,WAAA,IAAA,kBAAM,EAAC,8BAAa,CAAC,CAAA;IACrB,WAAA,IAAA,kBAAM,EAAC,qBAAS,CAAC,CAAA;6CANa,2CAAmB;QAErB,yCAAmB;QAEjB,6CAAqB;QACd,8BAAa;QACJ,qBAAS;GAZ/C,SAAS,CA8BrB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export declare class OpenSearchError extends Error {
|
|
2
2
|
}
|
|
3
|
-
export declare class ExpiredPointInTime extends OpenSearchError {
|
|
4
|
-
}
|
|
5
3
|
export declare class MappingError extends OpenSearchError {
|
|
6
4
|
}
|
|
7
5
|
export declare class MaxRecursionSanitizationReached extends MappingError {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MaxRecursionSanitizationReached = exports.MappingError = exports.
|
|
3
|
+
exports.MaxRecursionSanitizationReached = exports.MappingError = exports.OpenSearchError = void 0;
|
|
4
4
|
class OpenSearchError extends Error {
|
|
5
5
|
}
|
|
6
6
|
exports.OpenSearchError = OpenSearchError;
|
|
7
|
-
class ExpiredPointInTime extends OpenSearchError {
|
|
8
|
-
}
|
|
9
|
-
exports.ExpiredPointInTime = ExpiredPointInTime;
|
|
10
7
|
class MappingError extends OpenSearchError {
|
|
11
8
|
}
|
|
12
9
|
exports.MappingError = MappingError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/clients/openSearch/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;CAAG;AAA7C,0CAA6C;AAC7C,MAAa,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/clients/openSearch/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;CAAG;AAA7C,0CAA6C;AAC7C,MAAa,YAAa,SAAQ,eAAe;CAAG;AAApD,oCAAoD;AACpD,MAAa,+BAAgC,SAAQ,YAAY;IAC/D,YACkB,KAAa,EACb,IAAY,EACZ,IAAyB,EACzB,aAA8B;QAE9C,KAAK,CAAC,iBAAiB,KAAK,qBAAqB,IAAI,EAAE,CAAC,CAAC;QALzC,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAqB;QACzB,kBAAa,GAAb,aAAa,CAAiB;IAGhD,CAAC;CACF;AATD,0EASC"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { BooleanProperty, DateProperty,
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const NUM_MAPPING: DoubleNumberProperty;
|
|
1
|
+
import { BooleanProperty, DateProperty, LongNumberProperty, TextProperty, TypeMapping } from "@opensearch-project/opensearch/api/_types/_common.mapping";
|
|
2
|
+
export declare const NUM_MAPPING: LongNumberProperty;
|
|
4
3
|
export declare const STRING_MAPPING: TextProperty;
|
|
5
4
|
export declare const DATE_MAPPING: DateProperty;
|
|
6
5
|
export declare const BOOLEAN_MAPPING: BooleanProperty;
|
|
7
|
-
export declare const GEOPOINT_MAPPING: GeoPointProperty;
|
|
8
6
|
export declare const DEFAULT_MAPPING: TypeMapping;
|
|
9
|
-
export type FieldTypeNames = "string" | "number" | "id" | "boolean" | "geopoint";
|
|
10
|
-
export declare function getTypeMapping(type: FieldTypeNames): Property;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_MAPPING = exports.
|
|
4
|
-
exports.getTypeMapping = getTypeMapping;
|
|
5
|
-
exports.KEYWORD_MAPPING = {
|
|
6
|
-
type: "keyword",
|
|
7
|
-
};
|
|
3
|
+
exports.DEFAULT_MAPPING = exports.BOOLEAN_MAPPING = exports.DATE_MAPPING = exports.STRING_MAPPING = exports.NUM_MAPPING = void 0;
|
|
8
4
|
exports.NUM_MAPPING = {
|
|
9
|
-
type: "
|
|
5
|
+
type: "long",
|
|
10
6
|
};
|
|
11
7
|
exports.STRING_MAPPING = {
|
|
12
8
|
fields: {
|
|
@@ -24,9 +20,6 @@ exports.DATE_MAPPING = {
|
|
|
24
20
|
exports.BOOLEAN_MAPPING = {
|
|
25
21
|
type: "boolean",
|
|
26
22
|
};
|
|
27
|
-
exports.GEOPOINT_MAPPING = {
|
|
28
|
-
type: "geo_point",
|
|
29
|
-
};
|
|
30
23
|
exports.DEFAULT_MAPPING = {
|
|
31
24
|
dynamic: "false",
|
|
32
25
|
properties: {
|
|
@@ -58,20 +51,4 @@ exports.DEFAULT_MAPPING = {
|
|
|
58
51
|
isDeleted: exports.BOOLEAN_MAPPING,
|
|
59
52
|
},
|
|
60
53
|
};
|
|
61
|
-
function getTypeMapping(type) {
|
|
62
|
-
switch (type) {
|
|
63
|
-
case "string":
|
|
64
|
-
return exports.STRING_MAPPING;
|
|
65
|
-
case "number":
|
|
66
|
-
return exports.NUM_MAPPING;
|
|
67
|
-
case "id":
|
|
68
|
-
return exports.KEYWORD_MAPPING;
|
|
69
|
-
case "boolean":
|
|
70
|
-
return exports.BOOLEAN_MAPPING;
|
|
71
|
-
case "geopoint":
|
|
72
|
-
return exports.GEOPOINT_MAPPING;
|
|
73
|
-
default:
|
|
74
|
-
throw new Error(`Unknown field type ${type}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
54
|
//# sourceMappingURL=mappings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappings.js","sourceRoot":"","sources":["../../../../src/clients/openSearch/mappings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mappings.js","sourceRoot":"","sources":["../../../../src/clients/openSearch/mappings.ts"],"names":[],"mappings":";;;AAQa,QAAA,WAAW,GAAuB;IAC7C,IAAI,EAAE,MAAM;CACb,CAAC;AAEW,QAAA,cAAc,GAAiB;IAC1C,MAAM,EAAE;QACN,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,YAAY,EAAE,GAAG;SAClB;KACF;IACD,IAAI,EAAE,MAAM;CACb,CAAC;AAEW,QAAA,YAAY,GAAiB;IACxC,IAAI,EAAE,MAAM;IAEZ,MAAM,EAAE,WAAW;CACpB,CAAC;AAEW,QAAA,eAAe,GAAoB;IAC9C,IAAI,EAAE,SAAS;CAChB,CAAC;AAEW,QAAA,eAAe,GAAgB;IAC1C,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE;QACV,SAAS,EAAE,mBAAW;QACtB,iCAAiC,EAAE,sBAAc;QACjD,QAAQ,EAAE,sBAAc;QACxB,YAAY,EAAE;YACZ,IAAI,EAAE,aAAa;SACpB;QACD,OAAO,EAAE,sBAAc;QACvB,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE;gBACV,OAAO,EAAE,sBAAc;gBACvB,SAAS,EAAE,sBAAc;gBACzB,QAAQ,EAAE,sBAAc;aACzB;SACF;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE;gBACV,SAAS,EAAE,sBAAc;gBACzB,OAAO,EAAE,sBAAc;aACxB;SACF;QACD,oBAAoB,EAAE,oBAAY;QAClC,SAAS,EAAE,uBAAe;KAC3B;CACF,CAAC"}
|
|
@@ -2,15 +2,10 @@ import { Client } from "@opensearch-project/opensearch";
|
|
|
2
2
|
import { EventSourcedProjection } from "../../types/eventSourcedProjection.type";
|
|
3
3
|
import { Logger, LoggerService } from "../../initializers/logger.service";
|
|
4
4
|
import { DistributedLocking } from "../redisClient";
|
|
5
|
-
import { FieldTypeNames } from "./mappings";
|
|
6
|
-
import { Sort } from "@opensearch-project/opensearch/api/_types/_common";
|
|
7
|
-
import { TypeMapping } from "@opensearch-project/opensearch/api/_types/_common.mapping";
|
|
8
|
-
import { DeepSearchable } from "../../handlers/crud/types";
|
|
9
5
|
declare class BaseOpenSearchClient {
|
|
10
6
|
protected readonly client: Client;
|
|
11
7
|
protected readonly distributedLocking: DistributedLocking;
|
|
12
8
|
constructor(loggerService: LoggerService, client: Client, distributedLocking: DistributedLocking);
|
|
13
|
-
get isFakeClient(): boolean;
|
|
14
9
|
readonly isConnected: boolean;
|
|
15
10
|
protected readonly logger: Logger;
|
|
16
11
|
}
|
|
@@ -18,12 +13,13 @@ export type AddedIndexFields = {
|
|
|
18
13
|
openSearchUpdateTime?: string;
|
|
19
14
|
};
|
|
20
15
|
export type ProjectionIndex<T extends Record<string, any> = Record<string, any>> = Pick<EventSourcedProjection<T>, "projectionType" | "entityId" | "companyId" | "payload" | "referenceIds" | "version" | "traceId"> & AddedIndexFields;
|
|
16
|
+
export declare const MAX_OPENSEARCH_SANTIZE_RECURSION = 20;
|
|
21
17
|
export declare class OpenSearchClient extends BaseOpenSearchClient {
|
|
22
18
|
private readonly indexCache;
|
|
23
|
-
indexProjection<T extends Record<string, any>>(projection: EventSourcedProjection<T> | ProjectionIndex<T
|
|
19
|
+
indexProjection<T extends Record<string, any>>(projection: EventSourcedProjection<T> | ProjectionIndex<T>, maxDepth?: number): Promise<void>;
|
|
20
|
+
private indexSanitizedProjection;
|
|
24
21
|
private getIndexName;
|
|
25
22
|
private getAliasName;
|
|
26
|
-
private getWriteIndex;
|
|
27
23
|
private createAliasedIndex;
|
|
28
24
|
ensureIndex(projection: {
|
|
29
25
|
projectionType: string;
|
|
@@ -44,26 +40,11 @@ export declare class OpenSearchClient extends BaseOpenSearchClient {
|
|
|
44
40
|
projectionType: string;
|
|
45
41
|
entityId: string;
|
|
46
42
|
}): Promise<void>;
|
|
47
|
-
getMapping(index: string): Promise<TypeMapping>;
|
|
48
|
-
private ensureMapping;
|
|
49
|
-
ensureMappings(projectionType: string, fields: Record<string, FieldTypeNames>): Promise<void>;
|
|
50
|
-
private generateFieldQuery;
|
|
51
|
-
private zeroContinuation;
|
|
52
|
-
private parseContinuation;
|
|
53
|
-
private toContinuation;
|
|
54
|
-
private doSearch;
|
|
55
|
-
searchProjections<T extends object>(companyId: number, projectionType: string, fields: DeepSearchable<T>, sort?: Record<string, Sort>, limit?: number, page?: number, continuationToken?: string, pointInTime?: boolean): Promise<{
|
|
56
|
-
results: EventSourcedProjection<T>[];
|
|
57
|
-
continuation?: string;
|
|
58
|
-
}>;
|
|
59
43
|
}
|
|
60
44
|
export declare class OpensearchAdminClient extends BaseOpenSearchClient {
|
|
61
45
|
getIndexes(): Promise<string[]>;
|
|
62
46
|
removeIndex(index: string): Promise<void>;
|
|
63
|
-
clearIndex(index: string): Promise<void>;
|
|
64
47
|
cleanAliases(): Promise<void>;
|
|
65
48
|
clean(): Promise<void>;
|
|
66
|
-
clearIndexes(): Promise<void>;
|
|
67
|
-
expirePointInTime(pit_id: string): Promise<void>;
|
|
68
49
|
}
|
|
69
50
|
export {};
|