@appbuildersph/core 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. package/README.md +76 -0
  2. package/package.json +6 -6
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @appbuildersph/core
2
+
3
+ The Trust, Identity, Monitoring & AI SDK for Modern Applications — a single
4
+ `AppBuilders.init()` call wires up identity, logging, notifications, the
5
+ verified badge, and (opt-in) app health watching.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @appbuildersph/core
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { AppBuilders } from "@appbuildersph/core";
17
+
18
+ AppBuilders.init({
19
+ appName: "My App",
20
+ organization: "Acme Inc",
21
+ developer: "jane@acme.com",
22
+ environment: "production", // defaults to NODE_ENV-derived value
23
+
24
+ // feature flags — see table below for defaults
25
+ identity: true,
26
+ logger: true,
27
+ notifications: true,
28
+ badge: true,
29
+ watcher: false,
30
+
31
+ plugins: [
32
+ {
33
+ name: "my-plugin",
34
+ setup: ({ config, registerHook }) => {
35
+ registerHook("incident", (incident) => console.error("incident!", incident));
36
+ },
37
+ },
38
+ ],
39
+ });
40
+
41
+ AppBuilders.verify(); // true once identity is generated
42
+ AppBuilders.identity().get(); // IdentitySnapshot | null
43
+ AppBuilders.logger()?.info("server started");
44
+ await AppBuilders.notifications()?.success("Deployed", "v1.2.3 is live");
45
+ AppBuilders.badge(); // Badge | null — auto-mounted on init() in a browser
46
+ AppBuilders.watcher()?.health(); // only non-null if `watcher: true` (auto-started)
47
+
48
+ AppBuilders.shutdown(); // stops the watcher and unmounts the badge
49
+ ```
50
+
51
+ ## Feature flags
52
+
53
+ | Config key | Default | Package |
54
+ | ---------------- | ------- | ----------------------------------------------- |
55
+ | `identity` | `true` | built-in (application identity + verification hash) |
56
+ | `logger` | `true` | [`@appbuildersph/logger`](../logger) |
57
+ | `notifications` | `true` | [`@appbuildersph/notifications`](../notifications) |
58
+ | `badge` | `true` | [`@appbuildersph/badge`](../badge) |
59
+ | `watcher` | `false` | [`@appbuildersph/watcher`](../watcher) — opt-in since it starts an interval timer and installs process crash hooks |
60
+
61
+ Each accessor (`logger()`, `notifications()`, `badge()`, `watcher()`) returns
62
+ `null` if its flag is disabled — always guard with `?.` or a null check.
63
+
64
+ ## Plugins
65
+
66
+ `plugins` is a list of `{ name, setup(ctx) }` objects run once during
67
+ `init()`. `ctx.registerHook(event, handler)` subscribes to internal events —
68
+ currently `"incident"` and `"metrics"`, both emitted by the watcher when
69
+ enabled.
70
+
71
+ ## Identity
72
+
73
+ Every app gets a signed `IdentitySnapshot` (uuid, org/developer, environment,
74
+ git commit/branch, hostname, a SHA-256 verification hash) unless
75
+ `identity: false`. See `AppBuilders.identity()` for `get()`, `refresh()`,
76
+ `verify()`, and `export()` (JSON string).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appbuildersph/core",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "The Trust, Identity, Monitoring & AI SDK for Modern Applications.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -17,11 +17,11 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@appbuildersph/shared": "0.0.2",
21
- "@appbuildersph/notifications": "0.0.2",
22
- "@appbuildersph/badge": "0.1.0",
23
- "@appbuildersph/watcher": "0.0.2",
24
- "@appbuildersph/logger": "0.0.2"
20
+ "@appbuildersph/shared": "0.0.3",
21
+ "@appbuildersph/badge": "0.1.1",
22
+ "@appbuildersph/watcher": "0.0.3",
23
+ "@appbuildersph/notifications": "0.0.3",
24
+ "@appbuildersph/logger": "0.0.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsup": "^8.3.5",