@eventcatalog/sdk 2.13.0 → 2.13.2

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 CHANGED
@@ -1,22 +1,22 @@
1
1
  ## @eventcatalog/sdk
2
2
 
3
- SDK and CLI tool to interact with your EventCatalog. Use programmatically in JavaScript/TypeScript or directly from the command line to automate your EventCatalog.
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 technlogy in the world. As its powered by Markdown and contents are built at build time, you can use the SDK
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 (open source plugins coming in July 2024)
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 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 Usage
47
+ ### CLI
48
48
 
49
- The SDK includes a command-line interface for executing SDK functions directly from your terminal.
49
+ Looking for command-line usage? See [@eventcatalog/cli](../cli).
50
50
 
51
- #### Running with npx (no installation required)
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