@eventcatalog/sdk 2.13.0 → 2.13.1
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 +8 -89
- package/package.json +1 -10
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
## @eventcatalog/sdk
|
|
2
2
|
|
|
3
|
-
SDK
|
|
3
|
+
SDK to interact with your EventCatalog programmatically in JavaScript/TypeScript.
|
|
4
4
|
|
|
5
5
|
### Motivation
|
|
6
6
|
|
|
7
|
-
EventCatalog vision is to integrate with any broker or
|
|
7
|
+
EventCatalog vision is to integrate with any broker or technology in the world. As its powered by Markdown and contents are built at build time, you can use the SDK
|
|
8
8
|
to generate these resources. For example you can integrate with your systems, create domains, services and messages for EventCatalog using this SDK.
|
|
9
9
|
|
|
10
10
|
The SDK supports standard CRUD operations for domains, service and messages in EventCatalog.
|
|
11
11
|
|
|
12
|
-
The SDK is useful for creating your own EventCatalog plugins and integrations
|
|
12
|
+
The SDK is useful for creating your own EventCatalog plugins and integrations.
|
|
13
13
|
|
|
14
14
|
**Features**
|
|
15
15
|
|
|
16
16
|
- Create, read and delete resources in EventCatalog
|
|
17
17
|
- Version any resource in EventCatalog using the `version` SDK api.
|
|
18
18
|
- Add files or schemas to resources in EventCatalog
|
|
19
|
-
- and more
|
|
19
|
+
- and more...
|
|
20
20
|
|
|
21
21
|
### Installation
|
|
22
22
|
|
|
@@ -41,95 +41,14 @@ const event2 = await getEvent('InventoryEvent', '1.0.0');
|
|
|
41
41
|
await versionEvent('InventoryEvent');
|
|
42
42
|
|
|
43
43
|
// Returns the service /services/PaymentService
|
|
44
|
-
const service await getService('PaymentService');
|
|
44
|
+
const service = await getService('PaymentService');
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
### CLI
|
|
47
|
+
### CLI
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Looking for command-line usage? See [@eventcatalog/cli](../cli).
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
You can run the CLI directly using `npx` without installing the package:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npx @eventcatalog/sdk --dir <catalog-path> <function-name> [args...]
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
#### Running after installation
|
|
60
|
-
|
|
61
|
-
If you've installed the package, the `eventcatalog` command is available:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
eventcatalog --dir <catalog-path> <function-name> [args...]
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### Common Operations
|
|
68
|
-
|
|
69
|
-
**List all available functions:**
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
npx @eventcatalog/sdk list
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Get an event:**
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvent "OrderCreated"
|
|
79
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvent "OrderCreated" "1.0.0"
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**Get all events:**
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvents
|
|
86
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvents '{"latestOnly":true}'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Write an event:**
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npx @eventcatalog/sdk --dir ./my-catalog writeEvent '{"id":"OrderCreated","name":"Order Created","version":"1.0.0","markdown":"# Order Created Event"}'
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Get a service:**
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
npx @eventcatalog/sdk --dir ./my-catalog getService "InventoryService"
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Add an event to a service:**
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
npx @eventcatalog/sdk --dir ./my-catalog addEventToService "InventoryService" "sends" '{"id":"OrderCreated","version":"1.0.0"}'
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
#### Piping to Other Tools
|
|
108
|
-
|
|
109
|
-
Output is JSON by default, making it easy to pipe to tools like `jq`:
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Get all events and filter by version
|
|
113
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvents | jq '.[] | select(.version == "1.0.0")'
|
|
114
|
-
|
|
115
|
-
# Count total events
|
|
116
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvents | jq 'length'
|
|
117
|
-
|
|
118
|
-
# Extract event IDs
|
|
119
|
-
npx @eventcatalog/sdk --dir ./my-catalog getEvents | jq '.[].id'
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
#### Arguments Format
|
|
123
|
-
|
|
124
|
-
Arguments are automatically parsed:
|
|
125
|
-
|
|
126
|
-
- **JSON objects:** `'{"key":"value"}'` - parsed as object
|
|
127
|
-
- **JSON arrays:** `'["item1","item2"]'` - parsed as array
|
|
128
|
-
- **Booleans:** `true` or `false` - parsed as boolean
|
|
129
|
-
- **Numbers:** `42` or `3.14` - parsed as number
|
|
130
|
-
- **Strings:** anything else - kept as string
|
|
131
|
-
|
|
132
|
-
See the [SDK docs](https://www.eventcatalog.dev/docs/sdk) for more information and examples
|
|
51
|
+
See the [SDK docs](https://www.eventcatalog.dev/docs/sdk) for more information and examples.
|
|
133
52
|
|
|
134
53
|
# Enterprise support
|
|
135
54
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventcatalog/sdk",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"description": "SDK to integrate with EventCatalog",
|
|
5
|
-
"bin": {
|
|
6
|
-
"eventcatalog": "./dist/cli/index.js"
|
|
7
|
-
},
|
|
8
5
|
"publishConfig": {
|
|
9
6
|
"access": "public"
|
|
10
7
|
},
|
|
@@ -33,11 +30,6 @@
|
|
|
33
30
|
],
|
|
34
31
|
"require": "./dist/index.js",
|
|
35
32
|
"import": "./dist/index.mjs"
|
|
36
|
-
},
|
|
37
|
-
"./cli-docs": {
|
|
38
|
-
"types": "./dist/cli-docs.d.ts",
|
|
39
|
-
"require": "./dist/cli-docs.js",
|
|
40
|
-
"import": "./dist/cli-docs.mjs"
|
|
41
33
|
}
|
|
42
34
|
},
|
|
43
35
|
"main": "./dist/index.js",
|
|
@@ -45,7 +37,6 @@
|
|
|
45
37
|
"types": "./dist/index.d.ts",
|
|
46
38
|
"dependencies": {
|
|
47
39
|
"@changesets/cli": "^2.29.8",
|
|
48
|
-
"commander": "^12.0.0",
|
|
49
40
|
"fs-extra": "^11.3.2",
|
|
50
41
|
"glob": "^11.1.0",
|
|
51
42
|
"gray-matter": "^4.0.3",
|