@saptools/cf-events 0.1.3 → 0.1.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 +1 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Point it at a `region/org/space/app` (or a bare app name) and instantly answer:
|
|
|
12
12
|
[](https://packagephobia.com/result?p=@saptools/cf-events)
|
|
13
13
|
[](https://www.typescriptlang.org)
|
|
14
14
|
|
|
15
|
-
[Install](#-install) • [Quick Start](#-quick-start) • [CLI](#-cli) • [
|
|
15
|
+
[Install](#-install) • [Quick Start](#-quick-start) • [CLI](#-cli) • [FAQ](#-faq)
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
@@ -172,52 +172,6 @@ cf-events watch orders-srv --interval 30000 --type crash --lookback 5m
|
|
|
172
172
|
|
|
173
173
|
---
|
|
174
174
|
|
|
175
|
-
## 🧑💻 Programmatic Usage
|
|
176
|
-
|
|
177
|
-
```ts
|
|
178
|
-
import {
|
|
179
|
-
CfEventsRuntime,
|
|
180
|
-
// also re-exported for advanced use:
|
|
181
|
-
// fetchAuditEvents, fetchApp, fetchSshEnabled, fetchWebProcessStats,
|
|
182
|
-
// parseTypeFilter, durationToCreatedAfter,
|
|
183
|
-
// formatEventsReport, formatSshStatusReport, formatCrashReport, formatStatusReport,
|
|
184
|
-
// resolveSelector, parseSelector,
|
|
185
|
-
// plus all types
|
|
186
|
-
} from "@saptools/cf-events";
|
|
187
|
-
|
|
188
|
-
const runtime = new CfEventsRuntime();
|
|
189
|
-
|
|
190
|
-
const events = await runtime.fetchEvents("orders-srv", {
|
|
191
|
-
email: process.env.SAP_EMAIL ?? "",
|
|
192
|
-
password: process.env.SAP_PASSWORD ?? "",
|
|
193
|
-
}, {
|
|
194
|
-
limit: 50,
|
|
195
|
-
since: "6h",
|
|
196
|
-
types: [], // or ["audit.app.crash"] or use parseTypeFilter("crash")
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
console.log(events.length);
|
|
200
|
-
|
|
201
|
-
// SSH inference + enabled flag
|
|
202
|
-
const ssh = await runtime.getSshStatus("orders-srv", creds, "24h");
|
|
203
|
-
|
|
204
|
-
// Crash summary
|
|
205
|
-
const crashes = await runtime.getCrashes("orders-srv", creds, { limit: 20 });
|
|
206
|
-
|
|
207
|
-
// Health + instances
|
|
208
|
-
const health = await runtime.getStatus("ap10/my-org/dev/orders-srv", creds);
|
|
209
|
-
|
|
210
|
-
// Live polling (call with AbortSignal)
|
|
211
|
-
const ac = new AbortController();
|
|
212
|
-
await runtime.watchEvents("orders-srv", creds, { intervalMs: 15000, lookback: "2m", types: [] }, (ev) => {
|
|
213
|
-
console.log(ev);
|
|
214
|
-
}, ac.signal);
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
The package is a full barrel; everything under `src/` (parsers, formatters, low-level CF session helpers, types) is exported for power users or custom tooling.
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
175
|
## 📁 Prerequisites & Snapshots
|
|
222
176
|
|
|
223
177
|
`cf-events` relies on a `cf-sync` snapshot at `~/.saptools/cf-structure.json` for bare-app-name resolution and validation of explicit paths.
|