@orgloop/transform-enrich 0.1.0 → 0.1.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.
- package/README.md +53 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @orgloop/transform-enrich
|
|
2
|
+
|
|
3
|
+
Add, copy, and compute fields on events before delivery.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @orgloop/transform-enrich
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
transforms:
|
|
15
|
+
- name: add-metadata
|
|
16
|
+
type: package
|
|
17
|
+
package: "@orgloop/transform-enrich"
|
|
18
|
+
config:
|
|
19
|
+
set:
|
|
20
|
+
payload.team: platform
|
|
21
|
+
payload.environment: production
|
|
22
|
+
copy:
|
|
23
|
+
payload.author: provenance.author
|
|
24
|
+
compute:
|
|
25
|
+
payload.is_critical: "payload.priority === 'P0'"
|
|
26
|
+
payload.large_diff: "payload.lines_changed > 500"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Config options
|
|
30
|
+
|
|
31
|
+
| Field | Type | Description |
|
|
32
|
+
|-------|------|-------------|
|
|
33
|
+
| `set` | `object` | Static values to add. Keys are target dot-paths, values are literals. |
|
|
34
|
+
| `copy` | `object` | Copy fields. Keys are target dot-paths, values are source dot-paths. |
|
|
35
|
+
| `compute` | `object` | Computed fields. Keys are target dot-paths, values are comparison expressions. |
|
|
36
|
+
|
|
37
|
+
## Behavior
|
|
38
|
+
|
|
39
|
+
Operations apply in order on a shallow clone of the event:
|
|
40
|
+
|
|
41
|
+
1. **set** -- Assigns static values at dot-paths. Intermediate objects are created as needed.
|
|
42
|
+
2. **copy** -- Reads from source path, writes to target path. Skipped if source is undefined.
|
|
43
|
+
3. **compute** -- Evaluates simple comparison expressions (no `eval()`). Supported operators: `===`, `!==`, `>`, `<`, `>=`, `<=`. Values can be quoted strings (`'value'`), numbers, or unquoted identifiers.
|
|
44
|
+
|
|
45
|
+
All field paths use dot notation for nested access (e.g., `payload.review.state`).
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
Full documentation at [orgloop.ai](https://orgloop.ai)
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orgloop/transform-enrich",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "OrgLoop enrich transform — add, copy, and compute fields on events",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@orgloop/sdk": "0.1.
|
|
9
|
+
"@orgloop/sdk": "0.1.3"
|
|
10
10
|
},
|
|
11
11
|
"orgloop": {
|
|
12
12
|
"type": "transform",
|