@webda/cloudevents 4.0.0-beta.3 → 4.0.0-beta.5
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 +88 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/models/cloudevent.d.ts +18 -0
- package/lib/models/cloudevent.d.ts.map +1 -0
- package/lib/models/cloudevent.js +72 -0
- package/lib/models/cloudevent.js.map +1 -0
- package/lib/models/filters/abstract.d.ts +5 -1
- package/lib/models/filters/abstract.d.ts.map +1 -1
- package/lib/models/filters/abstract.js +4 -0
- package/lib/models/filters/abstract.js.map +1 -1
- package/lib/models/filters/helper.d.ts +60 -0
- package/lib/models/filters/helper.d.ts.map +1 -0
- package/lib/models/filters/helper.js +93 -0
- package/lib/models/filters/helper.js.map +1 -0
- package/lib/models/filters/index.d.ts +4 -26
- package/lib/models/filters/index.d.ts.map +1 -1
- package/lib/models/filters/index.js +4 -40
- package/lib/models/filters/index.js.map +1 -1
- package/lib/models/filters/interfaces.d.ts +1 -0
- package/lib/models/filters/interfaces.js +1 -1
- package/lib/models/filters/logical.d.ts +1 -55
- package/lib/models/filters/logical.d.ts.map +1 -1
- package/lib/models/filters/logical.js +1 -48
- package/lib/models/filters/logical.js.map +1 -1
- package/lib/models/filters/sql/CESQLParserLexer.d.ts.map +1 -1
- package/lib/models/filters/sql/CESQLParserLexer.js.map +1 -1
- package/lib/models/filters/sql/CESQLParserListener.d.ts.map +1 -1
- package/lib/models/filters/sql/CESQLParserParser.d.ts.map +1 -1
- package/lib/models/filters/sql/CESQLParserParser.js.map +1 -1
- package/lib/models/filters/sql/CESQLParserVisitor.d.ts.map +1 -1
- package/lib/models/filters/sql.d.ts +21 -17
- package/lib/models/filters/sql.d.ts.map +1 -1
- package/lib/models/filters/sql.js +20 -16
- package/lib/models/filters/sql.js.map +1 -1
- package/lib/models/filters/string.d.ts +15 -40
- package/lib/models/filters/string.d.ts.map +1 -1
- package/lib/models/filters/string.js +13 -0
- package/lib/models/filters/string.js.map +1 -1
- package/lib/models/filters/types.d.ts +77 -0
- package/lib/models/filters/types.d.ts.map +1 -0
- package/lib/models/filters/types.js +2 -0
- package/lib/models/filters/types.js.map +1 -0
- package/lib/models/subscription.d.ts +7 -7
- package/lib/models/subscription.d.ts.map +1 -1
- package/lib/models/subscription.js +8 -7
- package/lib/models/subscription.js.map +1 -1
- package/package.json +31 -40
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @webda/cloudevents module
|
|
2
|
+
|
|
3
|
+
This module is part of Webda Application Framework that allows you to quickly develop applications with all modern prerequisites: Security, Extensibility, GraphQL, REST, CloudNative [https://webda.io](https://webda.io)
|
|
4
|
+
|
|
5
|
+
<img src="https://webda.io/images/webda.svg" width="128" />
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
[](https://gitter.im/loopingz/webda?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
10
|
+
[](https://codecov.io/gh/loopingz/webda.io)
|
|
11
|
+
[](https://sonarcloud.io/summary/new_code?id=loopingz_webda.io)
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
<!-- README_HEADER -->
|
|
15
|
+
|
|
16
|
+
# @webda/cloudevents
|
|
17
|
+
|
|
18
|
+
> CloudEvents v1.0 producer and consumer utilities for Webda — validate, emit, and subscribe to CloudEvents over HTTP or AMQP transports, with a store-backed subscription model.
|
|
19
|
+
|
|
20
|
+
## When to use it
|
|
21
|
+
|
|
22
|
+
- You need to publish events from a Webda store save/update as CloudEvents to an external sink (webhook, AMQP broker, MQTT).
|
|
23
|
+
- You want to receive and validate incoming CloudEvents from third-party producers.
|
|
24
|
+
- You are building an event-driven integration that must conform to the CNCF CloudEvents v1.0 specification.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @webda/cloudevents
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
`@webda/cloudevents` exports model and utility classes — it does not register a service bean with the Webda DI container. Wire it up by using the exported `CloudEvent`, `Subscription`, and `isCloudEvent` helpers directly in a custom service.
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { isCloudEvent } from "@webda/cloudevents";
|
|
40
|
+
import { CloudEvent, emitterFor, httpTransport } from "cloudevents";
|
|
41
|
+
import { Subscription } from "@webda/cloudevents";
|
|
42
|
+
|
|
43
|
+
// Validate an incoming payload
|
|
44
|
+
const body = await ctx.getRequestBody();
|
|
45
|
+
if (!isCloudEvent(body, true /* strict */)) {
|
|
46
|
+
throw new Error("Invalid CloudEvent");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Publish a CloudEvent via HTTP to an external sink
|
|
50
|
+
const event = new CloudEvent({
|
|
51
|
+
type: "com.myapp.order.created",
|
|
52
|
+
source: "/orders",
|
|
53
|
+
data: { orderId: "abc-123" }
|
|
54
|
+
});
|
|
55
|
+
const emit = emitterFor(httpTransport("https://sink.example.com/events"));
|
|
56
|
+
await emit(event);
|
|
57
|
+
|
|
58
|
+
// Use a Subscription model to persist a subscriber's endpoint
|
|
59
|
+
const sub = new Subscription();
|
|
60
|
+
sub.sink = "https://receiver.example.com/hook";
|
|
61
|
+
sub.types = ["com.myapp.order.created"];
|
|
62
|
+
await sub.save();
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Reference
|
|
66
|
+
|
|
67
|
+
- API reference: see the auto-generated typedoc at `docs/pages/Modules/cloudevents/`.
|
|
68
|
+
- Source: [`packages/cloudevents`](https://github.com/loopingz/webda.io/tree/main/packages/cloudevents)
|
|
69
|
+
- Related: [`@webda/amqp`](../amqp) for AMQP-based event delivery; [`@webda/core`](../core) for the base `CoreModel` and store integration; [cloudevents SDK](https://github.com/cloudevents/sdk-javascript) which this package builds on.
|
|
70
|
+
|
|
71
|
+
<!-- README_FOOTER -->
|
|
72
|
+
## Sponsors
|
|
73
|
+
|
|
74
|
+
<!--
|
|
75
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](mailto:sponsor@webda.io)
|
|
76
|
+
-->
|
|
77
|
+
|
|
78
|
+
Arize AI is a machine learning observability and model monitoring platform. It helps you visualize, monitor, and explain your machine learning models. [Learn more](https://arize.com)
|
|
79
|
+
|
|
80
|
+
[<img src="https://arize.com/hubfs/arize/brand/arize-logomark-1.png" width="200">](https://arize.com)
|
|
81
|
+
|
|
82
|
+
Loopingz is a software development company that provides consulting and development services. [Learn more](https://loopingz.com)
|
|
83
|
+
|
|
84
|
+
[<img src="https://loopingz.com/images/logo.png" width="200">](https://loopingz.com)
|
|
85
|
+
|
|
86
|
+
Tellae is an innovative consulting firm specialized in cities transportation issues. We provide our clients, both public and private, with solutions to support your strategic and operational decisions. [Learn more](https://tellae.fr)
|
|
87
|
+
|
|
88
|
+
[<img src="https://tellae.fr/" width="200">](https://tellae.fr)
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if an object conforms to the CloudEvents specification.
|
|
3
|
+
*
|
|
4
|
+
* In loose mode (default), verifies that the required attributes (`specversion`,
|
|
5
|
+
* `type`, `source`, `id`) exist and are strings.
|
|
6
|
+
*
|
|
7
|
+
* In strict mode, additionally validates:
|
|
8
|
+
* - `specversion` equals `"1.0"`
|
|
9
|
+
* - Required attributes are non-empty strings
|
|
10
|
+
* - Optional attributes (`time`, `datacontenttype`, `dataschema`, `subject`),
|
|
11
|
+
* when present, have valid values
|
|
12
|
+
*
|
|
13
|
+
* @param obj - the object to check
|
|
14
|
+
* @param strict - enable strict validation (default: false)
|
|
15
|
+
* @returns true if the object matches the CloudEvents spec
|
|
16
|
+
*/
|
|
17
|
+
export declare function isCloudEvent(obj: unknown, strict?: boolean): boolean;
|
|
18
|
+
//# sourceMappingURL=cloudevent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudevent.d.ts","sourceRoot":"","sources":["../../src/models/cloudevent.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,OAAe,GAAG,OAAO,CA8C3E"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC3339 timestamp pattern.
|
|
3
|
+
*/
|
|
4
|
+
const RFC3339_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
|
|
5
|
+
/**
|
|
6
|
+
* Required CloudEvents attributes per the v1.0 spec.
|
|
7
|
+
*/
|
|
8
|
+
const REQUIRED_ATTRIBUTES = ["specversion", "type", "source", "id"];
|
|
9
|
+
/**
|
|
10
|
+
* Check if a value is a non-empty string.
|
|
11
|
+
* @param value - the value to check
|
|
12
|
+
* @returns true if the value is a non-empty string
|
|
13
|
+
*/
|
|
14
|
+
function isNonEmptyString(value) {
|
|
15
|
+
return typeof value === "string" && value.length > 0;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if an object conforms to the CloudEvents specification.
|
|
19
|
+
*
|
|
20
|
+
* In loose mode (default), verifies that the required attributes (`specversion`,
|
|
21
|
+
* `type`, `source`, `id`) exist and are strings.
|
|
22
|
+
*
|
|
23
|
+
* In strict mode, additionally validates:
|
|
24
|
+
* - `specversion` equals `"1.0"`
|
|
25
|
+
* - Required attributes are non-empty strings
|
|
26
|
+
* - Optional attributes (`time`, `datacontenttype`, `dataschema`, `subject`),
|
|
27
|
+
* when present, have valid values
|
|
28
|
+
*
|
|
29
|
+
* @param obj - the object to check
|
|
30
|
+
* @param strict - enable strict validation (default: false)
|
|
31
|
+
* @returns true if the object matches the CloudEvents spec
|
|
32
|
+
*/
|
|
33
|
+
export function isCloudEvent(obj, strict = false) {
|
|
34
|
+
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const record = obj;
|
|
38
|
+
// Check required attributes exist and are strings
|
|
39
|
+
for (const attr of REQUIRED_ATTRIBUTES) {
|
|
40
|
+
if (typeof record[attr] !== "string") {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!strict) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
// Strict: required attributes must be non-empty
|
|
48
|
+
for (const attr of REQUIRED_ATTRIBUTES) {
|
|
49
|
+
if (!isNonEmptyString(record[attr])) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Strict: specversion must be "1.0"
|
|
54
|
+
if (record.specversion !== "1.0") {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
// Strict: validate optional attributes when present
|
|
58
|
+
if ("time" in record && record.time !== undefined) {
|
|
59
|
+
if (typeof record.time !== "string" || !RFC3339_REGEX.test(record.time)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const attr of ["datacontenttype", "dataschema", "subject"]) {
|
|
64
|
+
if (attr in record && record[attr] !== undefined) {
|
|
65
|
+
if (!isNonEmptyString(record[attr])) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=cloudevent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudevent.js","sourceRoot":"","sources":["../../src/models/cloudevent.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,aAAa,GAAG,kEAAkE,CAAC;AAEzF;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAU,CAAC;AAE7E;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,MAAM,GAAY,KAAK;IAChE,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,MAAM,GAAG,GAA8B,CAAC;IAE9C,kDAAkD;IAClD,KAAK,MAAM,IAAI,IAAI,mBAAmB,EAAE,CAAC;QACvC,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gDAAgD;IAChD,KAAK,MAAM,IAAI,IAAI,mBAAmB,EAAE,CAAC;QACvC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,oCAAoC;IACpC,IAAI,MAAM,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oDAAoD;IACpD,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClD,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACxE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAE,SAAS,CAAU,EAAE,CAAC;QACzE,IAAI,IAAI,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACjD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBACpC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CloudEvent } from "cloudevents";
|
|
2
|
-
import { Filter } from "
|
|
2
|
+
import { Filter } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Implementation of a defined filter
|
|
5
5
|
*/
|
|
@@ -8,6 +8,9 @@ export declare abstract class FilterImplementation<T extends Filter> {
|
|
|
8
8
|
* Definition from the spec
|
|
9
9
|
*/
|
|
10
10
|
definition: T;
|
|
11
|
+
/** Create a new FilterImplementation.
|
|
12
|
+
* @param definition - the filter definition
|
|
13
|
+
*/
|
|
11
14
|
constructor(definition: T);
|
|
12
15
|
/**
|
|
13
16
|
* Return true if it match the filter, false otherwise
|
|
@@ -19,6 +22,7 @@ export declare abstract class FilterImplementation<T extends Filter> {
|
|
|
19
22
|
* Option to return an optimized version of the filter
|
|
20
23
|
*
|
|
21
24
|
* For example a LEFT(type, 4) = "com." can be optimized to PREFIX(type, "com.")
|
|
25
|
+
* @returns the optimized filter implementation
|
|
22
26
|
*/
|
|
23
27
|
optimize(): FilterImplementation<Filter>;
|
|
24
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../src/models/filters/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../src/models/filters/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,8BAAsB,oBAAoB,CAAC,CAAC,SAAS,MAAM;IACzD;;OAEG;IACH,UAAU,EAAE,CAAC,CAAC;IACd;;OAEG;IACH,YAAY,UAAU,EAAE,CAAC,EAExB;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAEpD;;;;;OAKG;IACH,QAAQ,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAEvC;CACF"}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Implementation of a defined filter
|
|
3
3
|
*/
|
|
4
4
|
export class FilterImplementation {
|
|
5
|
+
/** Create a new FilterImplementation.
|
|
6
|
+
* @param definition - the filter definition
|
|
7
|
+
*/
|
|
5
8
|
constructor(definition) {
|
|
6
9
|
this.definition = definition;
|
|
7
10
|
}
|
|
@@ -9,6 +12,7 @@ export class FilterImplementation {
|
|
|
9
12
|
* Option to return an optimized version of the filter
|
|
10
13
|
*
|
|
11
14
|
* For example a LEFT(type, 4) = "com." can be optimized to PREFIX(type, "com.")
|
|
15
|
+
* @returns the optimized filter implementation
|
|
12
16
|
*/
|
|
13
17
|
optimize() {
|
|
14
18
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/models/filters/abstract.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAgB,oBAAoB;IAKxC,YAAY,UAAa;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IASD
|
|
1
|
+
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/models/filters/abstract.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAgB,oBAAoB;IAKxC;;OAEG;IACH,YAAY,UAAa;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IASD;;;;;OAKG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CloudEvent } from "cloudevents";
|
|
2
|
+
import { FilterImplementation } from "./abstract.js";
|
|
3
|
+
import type { AllFilter, AnyFilter, Filter } from "./types.js";
|
|
4
|
+
interface FilterImplementationConstructor {
|
|
5
|
+
new (definition: any): FilterImplementation<Filter>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Use of this MUST include a nested array of filter expressions, where all nested filter
|
|
9
|
+
* expressions MUST evaluate to true in order for the all filter expression to be true.
|
|
10
|
+
*
|
|
11
|
+
* Note: there MUST be at least one filter expression in the array.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AllFilterImplementation extends FilterImplementation<AllFilter> {
|
|
14
|
+
filters: FilterImplementation<Filter>[];
|
|
15
|
+
/** Create a new AllFilterImplementation.
|
|
16
|
+
* @param definition - the all-filter definition
|
|
17
|
+
*/
|
|
18
|
+
constructor(definition: AllFilter);
|
|
19
|
+
/**
|
|
20
|
+
* @override
|
|
21
|
+
*/
|
|
22
|
+
match(event: CloudEvent): boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Use of this MUST include one nested array of filter expressions, where at least one nested
|
|
26
|
+
* filter expressions MUST evaluate to true in order for the any filter expression to be true.
|
|
27
|
+
*
|
|
28
|
+
* Note: there MUST be at least one filter expression in the array.
|
|
29
|
+
*/
|
|
30
|
+
export declare class AnyFilterImplementation extends FilterImplementation<AnyFilter> {
|
|
31
|
+
filters: FilterImplementation<Filter>[];
|
|
32
|
+
/** Create a new AnyFilterImplementation.
|
|
33
|
+
* @param definition - the any-filter definition
|
|
34
|
+
*/
|
|
35
|
+
constructor(definition: AnyFilter);
|
|
36
|
+
/**
|
|
37
|
+
* @override
|
|
38
|
+
*/
|
|
39
|
+
match(event: CloudEvent): boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Retrieve an FilterImplementation object based on the
|
|
43
|
+
* definition
|
|
44
|
+
*/
|
|
45
|
+
export declare class FiltersHelper {
|
|
46
|
+
/**
|
|
47
|
+
* Get the filter implementation
|
|
48
|
+
* @param filter - the filter definition
|
|
49
|
+
* @returns the resolved filter implementation
|
|
50
|
+
*/
|
|
51
|
+
static get<T extends Filter>(filter: T): FilterImplementation<Filter>;
|
|
52
|
+
/**
|
|
53
|
+
* Register a custom filter implementation
|
|
54
|
+
* @param name - the filter type name
|
|
55
|
+
* @param clazz - the filter implementation class
|
|
56
|
+
*/
|
|
57
|
+
register(name: string, clazz: FilterImplementationConstructor): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/models/filters/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAI/D,UAAU,+BAA+B;IACvC,KAAK,UAAU,EAAE,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;CACrD;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,oBAAoB,CAAC,SAAS,CAAC;IAC1E,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;IACxC;;OAEG;IACH,YAAY,UAAU,EAAE,SAAS,EAGhC;IACD;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAOhC;CACF;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,oBAAoB,CAAC,SAAS,CAAC;IAC1E,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;IACxC;;OAEG;IACH,YAAY,UAAU,EAAE,SAAS,EAGhC;IACD;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAOhC;CACF;AAcD;;;GAGG;AACH,qBAAa,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAMpE;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,+BAA+B,QAE5D;CACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FilterImplementation } from "./abstract.js";
|
|
2
|
+
import { SqlFilterImplementation } from "./sql.js";
|
|
3
|
+
import { ExactFilterImplementation, PrefixFilterImplementation, SuffixFilterImplementation } from "./string.js";
|
|
4
|
+
/**
|
|
5
|
+
* Use of this MUST include a nested array of filter expressions, where all nested filter
|
|
6
|
+
* expressions MUST evaluate to true in order for the all filter expression to be true.
|
|
7
|
+
*
|
|
8
|
+
* Note: there MUST be at least one filter expression in the array.
|
|
9
|
+
*/
|
|
10
|
+
export class AllFilterImplementation extends FilterImplementation {
|
|
11
|
+
/** Create a new AllFilterImplementation.
|
|
12
|
+
* @param definition - the all-filter definition
|
|
13
|
+
*/
|
|
14
|
+
constructor(definition) {
|
|
15
|
+
super(definition);
|
|
16
|
+
this.filters = this.definition.all.map(f => FiltersHelper.get(f));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @override
|
|
20
|
+
*/
|
|
21
|
+
match(event) {
|
|
22
|
+
for (const filter of this.filters) {
|
|
23
|
+
if (!filter.match(event)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Use of this MUST include one nested array of filter expressions, where at least one nested
|
|
32
|
+
* filter expressions MUST evaluate to true in order for the any filter expression to be true.
|
|
33
|
+
*
|
|
34
|
+
* Note: there MUST be at least one filter expression in the array.
|
|
35
|
+
*/
|
|
36
|
+
export class AnyFilterImplementation extends FilterImplementation {
|
|
37
|
+
/** Create a new AnyFilterImplementation.
|
|
38
|
+
* @param definition - the any-filter definition
|
|
39
|
+
*/
|
|
40
|
+
constructor(definition) {
|
|
41
|
+
super(definition);
|
|
42
|
+
this.filters = definition.any.map(f => FiltersHelper.get(f));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @override
|
|
46
|
+
*/
|
|
47
|
+
match(event) {
|
|
48
|
+
for (const filter of this.filters) {
|
|
49
|
+
if (filter.match(event)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Filter Implementation registry
|
|
58
|
+
*/
|
|
59
|
+
const FilterImplementations = {
|
|
60
|
+
exact: ExactFilterImplementation,
|
|
61
|
+
prefix: PrefixFilterImplementation,
|
|
62
|
+
suffix: SuffixFilterImplementation,
|
|
63
|
+
all: AllFilterImplementation,
|
|
64
|
+
any: AnyFilterImplementation,
|
|
65
|
+
sql: SqlFilterImplementation
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Retrieve an FilterImplementation object based on the
|
|
69
|
+
* definition
|
|
70
|
+
*/
|
|
71
|
+
export class FiltersHelper {
|
|
72
|
+
/**
|
|
73
|
+
* Get the filter implementation
|
|
74
|
+
* @param filter - the filter definition
|
|
75
|
+
* @returns the resolved filter implementation
|
|
76
|
+
*/
|
|
77
|
+
static get(filter) {
|
|
78
|
+
const type = Object.keys(filter).pop();
|
|
79
|
+
if (type === undefined || !FilterImplementations[type]) {
|
|
80
|
+
throw new Error(`Unsupported filter type '${type}'`);
|
|
81
|
+
}
|
|
82
|
+
return new FilterImplementations[type](filter).optimize();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Register a custom filter implementation
|
|
86
|
+
* @param name - the filter type name
|
|
87
|
+
* @param clazz - the filter implementation class
|
|
88
|
+
*/
|
|
89
|
+
register(name, clazz) {
|
|
90
|
+
FilterImplementations[name] = clazz;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/models/filters/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAMhH;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,oBAA+B;IAE1E;;OAEG;IACH,YAAY,UAAqB;QAC/B,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IACD;;OAEG;IACH,KAAK,CAAC,KAAiB;QACrB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,oBAA+B;IAE1E;;OAEG;IACH,YAAY,UAAqB;QAC/B,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD;;OAEG;IACH,KAAK,CAAC,KAAiB;QACrB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;GAEG;AACH,MAAM,qBAAqB,GAAuD;IAChF,KAAK,EAAE,yBAAyB;IAChC,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,0BAA0B;IAClC,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,uBAAuB;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAmB,MAAS;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;QACvC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,GAAG,CAAC,CAAC;QACvD,CAAC;QACD,OAAgC,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAAY,EAAE,KAAsC;QAC3D,qBAAqB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
import { FilterImplementation } from "./abstract.js";
|
|
2
|
-
import { AllFilter, AnyFilter, NotFilter } from "./logical.js";
|
|
3
|
-
import { SqlFilter } from "./sql.js";
|
|
4
|
-
import { ExactFilter, PrefixFilter, SuffixFilter } from "./string.js";
|
|
5
1
|
export * from "./abstract.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* Retrieve an FilterImplementation object based on the
|
|
12
|
-
* definition
|
|
13
|
-
*/
|
|
14
|
-
export declare class FiltersHelper {
|
|
15
|
-
/**
|
|
16
|
-
* Get the filter implementation
|
|
17
|
-
* @param filter
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
static get<T extends Filter>(filter: T): FilterImplementation<Filter>;
|
|
21
|
-
/**
|
|
22
|
-
* Register a custom filter implementation
|
|
23
|
-
* @param name
|
|
24
|
-
* @param clazz
|
|
25
|
-
*/
|
|
26
|
-
register(name: string, clazz: FilterImplementationConstructor): void;
|
|
27
|
-
}
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
export * from "./helper.js";
|
|
4
|
+
export { SqlFilterImplementation } from "./sql.js";
|
|
5
|
+
export { ExactFilterImplementation, PrefixFilterImplementation, SuffixFilterImplementation } from "./string.js";
|
|
28
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/filters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,aAAa,CAAC"}
|
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
import { AllFilterImplementation, AnyFilterImplementation } from "./logical.js";
|
|
2
|
-
import { SqlFilterImplementation } from "./sql.js";
|
|
3
|
-
import { ExactFilterImplementation, PrefixFilterImplementation, SuffixFilterImplementation } from "./string.js";
|
|
4
1
|
export * from "./abstract.js";
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exact: ExactFilterImplementation,
|
|
10
|
-
prefix: PrefixFilterImplementation,
|
|
11
|
-
suffix: SuffixFilterImplementation,
|
|
12
|
-
all: AllFilterImplementation,
|
|
13
|
-
any: AnyFilterImplementation,
|
|
14
|
-
sql: SqlFilterImplementation
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Retrieve an FilterImplementation object based on the
|
|
18
|
-
* definition
|
|
19
|
-
*/
|
|
20
|
-
export class FiltersHelper {
|
|
21
|
-
/**
|
|
22
|
-
* Get the filter implementation
|
|
23
|
-
* @param filter
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
static get(filter) {
|
|
27
|
-
const type = Object.keys(filter).pop();
|
|
28
|
-
if (type === undefined || !FilterImplementations[type]) {
|
|
29
|
-
throw new Error(`Unsupported filter type '${type}'`);
|
|
30
|
-
}
|
|
31
|
-
return new FilterImplementations[type](filter).optimize();
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Register a custom filter implementation
|
|
35
|
-
* @param name
|
|
36
|
-
* @param clazz
|
|
37
|
-
*/
|
|
38
|
-
register(name, clazz) {
|
|
39
|
-
FilterImplementations[name] = clazz;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
export * from "./helper.js";
|
|
4
|
+
export { SqlFilterImplementation } from "./sql.js";
|
|
5
|
+
export { ExactFilterImplementation, PrefixFilterImplementation, SuffixFilterImplementation } from "./string.js";
|
|
42
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/filters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,aAAa,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Filter } from "..js";
|
|
3
|
-
import { FilterImplementation } from "./abstract.js";
|
|
4
|
-
/**
|
|
5
|
-
* Use of this MUST include one nested filter expression, where the result of this
|
|
6
|
-
* filter expression is the inverse of the result of the nested expression. In other words,
|
|
7
|
-
* if the nested expression evaluated to true, then the not filter expression's result is false.
|
|
8
|
-
*/
|
|
9
|
-
export interface NotFilter {
|
|
10
|
-
not: Filter;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Use of this MUST include one nested array of filter expressions, where at least one nested
|
|
14
|
-
* filter expressions MUST evaluate to true in order for the any filter expression to be true.
|
|
15
|
-
*/
|
|
16
|
-
export interface AnyFilter {
|
|
17
|
-
any: Filter[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Use of this MUST include a nested array of filter expressions, where all nested filter
|
|
21
|
-
* expressions MUST evaluate to true in order for the all filter expression to be true.
|
|
22
|
-
*
|
|
23
|
-
* Note: there MUST be at least one filter expression in the array.
|
|
24
|
-
*/
|
|
25
|
-
export interface AllFilter {
|
|
26
|
-
all: Filter[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Use of this MUST include a nested array of filter expressions, where all nested filter
|
|
30
|
-
* expressions MUST evaluate to true in order for the all filter expression to be true.
|
|
31
|
-
*
|
|
32
|
-
* Note: there MUST be at least one filter expression in the array.
|
|
33
|
-
*/
|
|
34
|
-
export declare class AllFilterImplementation extends FilterImplementation<AllFilter> {
|
|
35
|
-
filters: FilterImplementation<Filter>[];
|
|
36
|
-
constructor(definition: AllFilter);
|
|
37
|
-
/**
|
|
38
|
-
* @override
|
|
39
|
-
*/
|
|
40
|
-
match(event: CloudEvent): boolean;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Use of this MUST include one nested array of filter expressions, where at least one nested
|
|
44
|
-
* filter expressions MUST evaluate to true in order for the any filter expression to be true.
|
|
45
|
-
*
|
|
46
|
-
* Note: there MUST be at least one filter expression in the array.
|
|
47
|
-
*/
|
|
48
|
-
export declare class AnyFilterImplementation extends FilterImplementation<AnyFilter> {
|
|
49
|
-
filters: FilterImplementation<Filter>[];
|
|
50
|
-
constructor(definition: AnyFilter);
|
|
51
|
-
/**
|
|
52
|
-
* @override
|
|
53
|
-
*/
|
|
54
|
-
match(event: CloudEvent): boolean;
|
|
55
|
-
}
|
|
1
|
+
export type { NotFilter, AnyFilter, AllFilter } from "./types.js";
|
|
56
2
|
//# sourceMappingURL=logical.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logical.d.ts","sourceRoot":"","sources":["../../../src/models/filters/logical.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"logical.d.ts","sourceRoot":"","sources":["../../../src/models/filters/logical.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { FilterImplementation } from "./abstract.js";
|
|
3
|
-
/**
|
|
4
|
-
* Use of this MUST include a nested array of filter expressions, where all nested filter
|
|
5
|
-
* expressions MUST evaluate to true in order for the all filter expression to be true.
|
|
6
|
-
*
|
|
7
|
-
* Note: there MUST be at least one filter expression in the array.
|
|
8
|
-
*/
|
|
9
|
-
export class AllFilterImplementation extends FilterImplementation {
|
|
10
|
-
constructor(definition) {
|
|
11
|
-
super(definition);
|
|
12
|
-
this.filters = this.definition.all.map(f => FiltersHelper.get(f));
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @override
|
|
16
|
-
*/
|
|
17
|
-
match(event) {
|
|
18
|
-
for (const filter of this.filters) {
|
|
19
|
-
if (!filter.match(event)) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Use of this MUST include one nested array of filter expressions, where at least one nested
|
|
28
|
-
* filter expressions MUST evaluate to true in order for the any filter expression to be true.
|
|
29
|
-
*
|
|
30
|
-
* Note: there MUST be at least one filter expression in the array.
|
|
31
|
-
*/
|
|
32
|
-
export class AnyFilterImplementation extends FilterImplementation {
|
|
33
|
-
constructor(definition) {
|
|
34
|
-
super(definition);
|
|
35
|
-
this.filters = definition.any.map(f => FiltersHelper.get(f));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @override
|
|
39
|
-
*/
|
|
40
|
-
match(event) {
|
|
41
|
-
for (const filter of this.filters) {
|
|
42
|
-
if (filter.match(event)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
export {};
|
|
49
2
|
//# sourceMappingURL=logical.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logical.js","sourceRoot":"","sources":["../../../src/models/filters/logical.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logical.js","sourceRoot":"","sources":["../../../src/models/filters/logical.ts"],"names":[],"mappings":""}
|