@webda/cloudevents 4.0.0-beta.2 → 4.0.0-beta.4
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 +7 -7
- 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 -13
- package/lib/models/filters/index.d.ts.map +1 -1
- package/lib/models/filters/index.js +4 -32
- 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 -0
- package/lib/models/filters/logical.d.ts +1 -54
- 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 +11 -11
- 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 +25 -20
- package/lib/models/filters/sql.d.ts.map +1 -1
- package/lib/models/filters/sql.js +33 -29
- package/lib/models/filters/sql.js.map +1 -1
- package/lib/models/filters/string.d.ts +16 -40
- package/lib/models/filters/string.d.ts.map +1 -1
- package/lib/models/filters/string.js +14 -1
- 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 +12 -8
- package/lib/models/subscription.js.map +1 -1
- package/package.json +27 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/models/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAA6B,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,MAAM,EAAuC,MAAM,
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/models/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAA6B,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,MAAM,EAAuC,MAAM,oBAAoB,CAAC;AAGjF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAA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AM,EAAE,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG;;;YAWpC,MAAM;iBACD,MAAM;gBACP,MAAM,EAAE;iBACP;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE;kBACxB,MAAM,GAAG,MAAM,GAAG,OAAO;2BAChB,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY;cACtF,MAAM;iBACH,MAAM,EAAE;QAQjB;;;;WAIG;qBACU,UAAU,GAAG,OAAO;QASjC;;;WAGG;yBACc,eAAe;QAOhC;;;WAGG;oBACe,UAAU;;;EAS/B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { emitterFor, httpTransport } from "cloudevents";
|
|
2
|
-
import { FiltersHelper } from "./filters.js";
|
|
2
|
+
import { FiltersHelper } from "./filters/index.js";
|
|
3
|
+
import { randomUUID } from "crypto";
|
|
3
4
|
/**
|
|
4
5
|
* Subscription Mixin to add default behavior to a subscription
|
|
5
|
-
* @param clazz
|
|
6
|
-
* @returns
|
|
6
|
+
* @param clazz - the base class to extend
|
|
7
|
+
* @returns the extended class with subscription behavior
|
|
7
8
|
*/
|
|
8
9
|
export function SubscriptionMixIn(clazz) {
|
|
9
10
|
/**
|
|
@@ -15,16 +16,18 @@ export function SubscriptionMixIn(clazz) {
|
|
|
15
16
|
*/
|
|
16
17
|
let emitter;
|
|
17
18
|
return class extends clazz {
|
|
19
|
+
/** Create a new SubscriptionParameters. */
|
|
18
20
|
constructor() {
|
|
19
|
-
super(
|
|
21
|
+
super();
|
|
20
22
|
this.protocol = "HTTP";
|
|
21
23
|
this.sink = "";
|
|
22
24
|
this.filters = [];
|
|
25
|
+
this.id ?? (this.id = randomUUID());
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Verify that an event match its filters
|
|
26
|
-
* @param event
|
|
27
|
-
* @returns
|
|
29
|
+
* @param event - the cloud event to check
|
|
30
|
+
* @returns true if the event matches all filters
|
|
28
31
|
*/
|
|
29
32
|
match(event) {
|
|
30
33
|
// Need to filter first on types
|
|
@@ -36,16 +39,17 @@ export function SubscriptionMixIn(clazz) {
|
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Create the emitter for the subscription
|
|
39
|
-
* @returns
|
|
42
|
+
* @returns the emitter function for the configured protocol
|
|
40
43
|
*/
|
|
41
44
|
createEmitter() {
|
|
42
45
|
if (this.protocol === "HTTP") {
|
|
43
46
|
return emitterFor(httpTransport(this.sink), this.protocolsettings);
|
|
44
47
|
}
|
|
48
|
+
throw new Error("Unsupported protocol");
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Emit a cloudevent
|
|
48
|
-
* @param event
|
|
52
|
+
* @param event - the cloud event to emit
|
|
49
53
|
*/
|
|
50
54
|
async emit(event) {
|
|
51
55
|
// Ensure the subscription match the event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/models/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAgC,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/models/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAgC,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AA4LpC;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAU;IAC1C;;OAEG;IACH,IAAI,eAA6C,CAAC;IAElD;;OAEG;IACH,IAAI,OAAwB,CAAC;IAC7B,OAAO,KAAM,SAAQ,KAAK;QAUxB,2CAA2C;QAC3C;YACE,K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.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "Discovery and Subscriptions for CloudEvents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudevents",
|
|
@@ -10,52 +10,43 @@
|
|
|
10
10
|
"repository": "git://github.com/loopingz/webda.io.git",
|
|
11
11
|
"main": "lib/index.js",
|
|
12
12
|
"typings": "lib/index.d.ts",
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsc-esm",
|
|
15
|
-
"build:module": "webda build",
|
|
16
|
-
"build:watch": "webda build --watch",
|
|
17
|
-
"grammar": "antlr4ts -visitor src/stores/webdaql/WebdaQLLexer.g4 src/stores/webdaql/WebdaQLParser.g4 && yarn run lint:fix",
|
|
18
|
-
"pretest": "npm run build",
|
|
19
|
-
"lint": "prettier --check src/**/*",
|
|
20
|
-
"lint:fix": "prettier --write src/**/*",
|
|
21
|
-
"test": "NODE_OPTIONS='--no-warnings --experimental-vm-modules' jest",
|
|
22
|
-
"test:bun": "bun test --coverage"
|
|
23
|
-
},
|
|
24
13
|
"dependencies": {
|
|
25
|
-
"
|
|
14
|
+
"antlr4ts": "0.5.0-alpha.4",
|
|
15
|
+
"cloudevents": "^10.0.0"
|
|
26
16
|
},
|
|
27
17
|
"devDependencies": {
|
|
28
|
-
"@types/node": "
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
18
|
+
"@types/node": "25.5.0",
|
|
19
|
+
"jscodeshift": "^17.3.0",
|
|
20
|
+
"skott": "^0.35.8",
|
|
21
|
+
"tsx": "^4.21.0",
|
|
22
|
+
"typescript": "7.1.0-dev.20260929.1",
|
|
23
|
+
"vite": "^6.0.0",
|
|
24
|
+
"@webda/compiler": "^4.0.0-beta.4"
|
|
32
25
|
},
|
|
33
26
|
"files": [
|
|
34
27
|
"lib"
|
|
35
28
|
],
|
|
36
|
-
"c8": {
|
|
37
|
-
"report-dir": "./reports",
|
|
38
|
-
"reporter": [
|
|
39
|
-
"html",
|
|
40
|
-
"lcov",
|
|
41
|
-
"json",
|
|
42
|
-
"text"
|
|
43
|
-
],
|
|
44
|
-
"exclude": [
|
|
45
|
-
"src/test.ts",
|
|
46
|
-
"**/*.spec.ts",
|
|
47
|
-
"test/**/*",
|
|
48
|
-
"*/stores/webdaql/WebdaQL*"
|
|
49
|
-
],
|
|
50
|
-
"excludeNodeModules": true
|
|
51
|
-
},
|
|
52
29
|
"homepage": "https://webda.io",
|
|
53
30
|
"publishConfig": {
|
|
54
31
|
"access": "public"
|
|
55
32
|
},
|
|
56
33
|
"type": "module",
|
|
57
34
|
"engines": {
|
|
58
|
-
"node": ">=
|
|
35
|
+
"node": ">=22.0.0"
|
|
59
36
|
},
|
|
60
|
-
"
|
|
61
|
-
|
|
37
|
+
"license": "LGPL-3.0-only",
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p tsconfig.json",
|
|
40
|
+
"build:watch": "tsc -p tsconfig.json --watch",
|
|
41
|
+
"grammar": "antlr4ts -visitor src/stores/webdaql/WebdaQLLexer.g4 src/stores/webdaql/WebdaQLParser.g4 && node ../../scripts/add-import-extensions.mjs src && pnpm run lint:fix",
|
|
42
|
+
"pretest": "npm run build",
|
|
43
|
+
"lint": "eslint",
|
|
44
|
+
"lint:fix": "eslint --fix",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:bun": "bun test --coverage",
|
|
47
|
+
"format": "prettier --check src/**/*",
|
|
48
|
+
"format:fix": "prettier --write src/**/*",
|
|
49
|
+
"deps:graph": "skott --showCircularDependencies --no-trackTypeOnlyDependencies --displayMode=raw -e .ts -ig 'src/models/filters/sql/CESQL*.ts'",
|
|
50
|
+
"codemod": "jscodeshift --parser=ts --extensions=tsx,ts -t ../codemod/current.mjs src"
|
|
51
|
+
}
|
|
52
|
+
}
|