@cclabsnz/sf-core 0.3.0 → 0.5.0
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/CHANGELOG.md +149 -0
- package/README.md +32 -8
- package/lib/events/rteCatalog.d.ts +17 -1
- package/lib/events/rteCatalog.js +28 -4
- package/lib/graph/coverage.d.ts +3 -0
- package/lib/graph/coverage.js +10 -0
- package/lib/graph/index.d.ts +9 -0
- package/lib/graph/index.js +10 -0
- package/lib/graph/kinds.d.ts +109 -0
- package/lib/graph/kinds.js +39 -0
- package/lib/graph/merge.d.ts +24 -0
- package/lib/graph/merge.js +175 -0
- package/lib/graph/roleOf.d.ts +17 -0
- package/lib/graph/roleOf.js +56 -0
- package/lib/graph/rules.d.ts +34 -0
- package/lib/graph/rules.js +30 -0
- package/lib/graph/schema.d.ts +170 -0
- package/lib/graph/schema.js +91 -0
- package/lib/graph/types.d.ts +84 -0
- package/lib/graph/types.js +10 -0
- package/lib/graph/validate.d.ts +8 -0
- package/lib/graph/validate.js +200 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/lib/order.d.ts +2 -0
- package/lib/lib/order.js +10 -0
- package/lib/report/branding.js +1 -1
- package/package.json +12 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@cclabsnz/sf-core` are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) loosely, and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
Each released entry mirrors the [GitHub Release](https://github.com/cclabsnz/sf-core/releases)
|
|
8
|
+
for that tag, which is the canonical published note and carries the provenance attestation and
|
|
9
|
+
CycloneDX SBOM for the build.
|
|
10
|
+
|
|
11
|
+
## [Unreleased]
|
|
12
|
+
|
|
13
|
+
Nothing yet.
|
|
14
|
+
|
|
15
|
+
## [0.5.0] — 2026-09-09
|
|
16
|
+
|
|
17
|
+
**The canonical org graph, and a merge that refuses to state something false.**
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **The canonical org graph.** `CanonicalGraph`, `GraphNode`/`GraphEdge`, `GRAPH_SCHEMA`,
|
|
22
|
+
`validateGraph`, `GRAPH_KIND_TABLE` and the `GRAPH_RULES` codes, moved here from the
|
|
23
|
+
`sf-orgviz` plugin that owned them. Two tools can now produce fragments of one schema without
|
|
24
|
+
either depending on the other. `GRAPH_KIND_TABLE` declares which producer owns each node kind,
|
|
25
|
+
so the split is enforced rather than documented — ownership is per kind and not per layer
|
|
26
|
+
because node ids are `prefix.name`, which makes disjoint kinds the thing that actually keeps
|
|
27
|
+
ids disjoint.
|
|
28
|
+
- **`mergeGraphs(fragments)`.** Unions fragments and refuses the merge when it would state
|
|
29
|
+
something false: fragments from different orgs, fragments at different schema versions, one
|
|
30
|
+
node id claimed twice, or a producer emitting a kind it does not own. A rejection returns no
|
|
31
|
+
graph at all, because a partial merge that still looks like a complete picture is worse than
|
|
32
|
+
none. `capturedAt` on a merged graph is the **oldest** fragment's — a merged picture is only as
|
|
33
|
+
fresh as its stalest part, and taking the newest would let a fresh run make a stale one look
|
|
34
|
+
current — and coverage is unioned, so a fact one producer could not read stays unread after
|
|
35
|
+
merging with one that could.
|
|
36
|
+
- **Attribute contributions.** A producer may state a measurement about a node another producer
|
|
37
|
+
owns, applied under the contributor's own namespace so that who asserted a value stays
|
|
38
|
+
answerable and two producers writing one key cannot become a silent last-writer-wins. An
|
|
39
|
+
unresolved contribution is reported rather than fatal: it means a fragment is missing, not that
|
|
40
|
+
the graph is wrong.
|
|
41
|
+
- **`roleOf(objectName)`.** The seven-role Salesforce object classifier, ported from
|
|
42
|
+
`sf-orgintel`, returning the already-published `ObjectLayer`. Renamed from `layerOf` on the way
|
|
43
|
+
in, because this package also exports `layerOfKind`, which classifies on an entirely different
|
|
44
|
+
axis.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- `ajv` moved from a development dependency to a runtime one. The graph validator ships from here
|
|
49
|
+
now, so consumers receive it transitively; this package previously declared no runtime
|
|
50
|
+
dependencies at all. The existing `fast-uri@3` override, which exists because of ajv's own
|
|
51
|
+
dependency chain, is unchanged.
|
|
52
|
+
|
|
53
|
+
## [0.4.0] — 2026-09-09
|
|
54
|
+
|
|
55
|
+
**Four missing Real-Time Event objects, and triage that matches what ships.**
|
|
56
|
+
|
|
57
|
+
Minor rather than patch: a consumer that changes nothing now captures four event
|
|
58
|
+
types it did not capture before, so output moves under it. The exported surface is
|
|
59
|
+
unchanged.
|
|
60
|
+
|
|
61
|
+
### Security
|
|
62
|
+
|
|
63
|
+
- `js-yaml` override raised to the first patched version, closing GHSA-5p4m-2wfm-xmqj
|
|
64
|
+
(quadratic CPU consumption in `!!omap` resolution). The override already permitted the fix
|
|
65
|
+
without requiring it, so the lockfile stayed on the vulnerable version: a caret that allows a
|
|
66
|
+
patch is not a floor that forces one. Development-scope transitive dependency; nothing shipped
|
|
67
|
+
to consumers was affected. (#8)
|
|
68
|
+
- `SECURITY.md` rewritten. It was `sf-audit`'s, copied verbatim: it described this package as a
|
|
69
|
+
security audit plugin, named the wrong package throughout, and told reporters to run a CLI
|
|
70
|
+
command that does not apply to a library. Private vulnerability reporting has also been enabled
|
|
71
|
+
on the repository, which the policy had named as the preferred channel while it was switched
|
|
72
|
+
off. (#9)
|
|
73
|
+
- `/.superpowers/` added to `.gitignore`. Execution ledgers quote live-org detail as a matter of
|
|
74
|
+
course, and this repository is public. Nothing was ever tracked under that path. (#9)
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- **Four Real-Time Event objects were missing from the catalog**, and had been since it was
|
|
79
|
+
written: `LoginAnomalyEvent`, `UniversalAnomalyEvent`, `IdentityVerificationEvent` and
|
|
80
|
+
`ApiPrtcPolicyChangeEvent`. All four were verified across eight orgs. `LoginAnomalyEvent` is
|
|
81
|
+
the one that mattered — login anomaly is precisely the signal this catalog exists to retain.
|
|
82
|
+
The 0.3.0 probe checked that every declared object behaved as declared and found nothing
|
|
83
|
+
wrong; it never asked the inverse question. A missing entry raises no error anywhere, so the
|
|
84
|
+
pull simply never asked for these objects and the manifest recorded no gap, leaving a
|
|
85
|
+
consumer to read the silence as "this org had no such events" rather than "we did not look".
|
|
86
|
+
Re-probing now runs in both directions. (#13)
|
|
87
|
+
- **A catalog invariant passed vacuously.** The test asserting that a directly-queryable object
|
|
88
|
+
declares no `*Store` read `find(...)?.store`, which is `undefined` both for an entry with no
|
|
89
|
+
Store and for an entry that is absent entirely — so it could not fail for a missing object,
|
|
90
|
+
which is how `IdentityVerificationEvent` stayed missing. It now asserts the entry exists
|
|
91
|
+
first. (#13)
|
|
92
|
+
- **The Socket triage claimed something untrue of this package.** `socket.yml` stated that it
|
|
93
|
+
"makes no outbound network call of its own". `src/api/RestClientImpl.ts` calls global
|
|
94
|
+
`fetch` to stream an EventLogFile download, which is why Socket reports network access and
|
|
95
|
+
records `net: true`. The surrounding sentences were right about the destination, so the
|
|
96
|
+
claim read as true while the sentence carrying it was false — the worst shape for a
|
|
97
|
+
statement a reviewer is invited to verify. It now says what the call is: one `fetch`, to
|
|
98
|
+
the instance URL of an org the caller already authenticated against, on the caller's own
|
|
99
|
+
session. The OFL-1.1 licence alert, previously unanswered, is answered in the same place:
|
|
100
|
+
it describes the bundled fonts, not the code, which stays Apache-2.0. Neither rule is
|
|
101
|
+
suppressed. (#15)
|
|
102
|
+
|
|
103
|
+
### Added
|
|
104
|
+
|
|
105
|
+
- `CONTRIBUTING.md` and this changelog.
|
|
106
|
+
- `docs/RELEASE_TRACKING.md`: what a Salesforce release does and does not require of this
|
|
107
|
+
package, the per-release checklist, and a record of each release assessed. Winter '27
|
|
108
|
+
(API v68.0) is assessed and changes nothing here — no API version is pinned anywhere in
|
|
109
|
+
`src/`, so the release is inert for this package. The catalog re-probe against a v68.0
|
|
110
|
+
preview org remains open, and is recorded there as outstanding rather than assumed. (#13)
|
|
111
|
+
- README: an **Event capture** row in the capability table, which had no entry for `src/events/`
|
|
112
|
+
despite it being the largest module and fully exported; the Real-Time Event base/`*Store`
|
|
113
|
+
split added to the list of platform behaviours; and a statement of where the contract-test
|
|
114
|
+
guarantee stops — a test can refuse a wrong read, but it cannot notice an object the catalog
|
|
115
|
+
never lists. (#13)
|
|
116
|
+
|
|
117
|
+
## [0.3.0] — 2026-08-04
|
|
118
|
+
|
|
119
|
+
**Capture integrity, verified RTE catalog.**
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
|
|
123
|
+
- **The Real-Time Event catalog was wrong in both directions**, because it rested on a naming
|
|
124
|
+
convention rather than on the platform. Probing five orgs settled it; one org would not have.
|
|
125
|
+
A store that could not be read was also reported as a store containing nothing, which
|
|
126
|
+
manufactured false coverage gaps on every quiet hour. (#3)
|
|
127
|
+
|
|
128
|
+
### Security
|
|
129
|
+
|
|
130
|
+
- **Presence on disk now means complete.** Captures are written atomically, so a partial file is
|
|
131
|
+
never mistaken for a finished one. (#4)
|
|
132
|
+
- **Paths built from org data are confined.** `EventType`, object names, org ids and file ids all
|
|
133
|
+
arrive from query results and were joined straight into a filesystem path. Each is now reduced
|
|
134
|
+
to a single safe segment, so a value like `../../..` cannot place captured evidence outside the
|
|
135
|
+
store. (#4)
|
|
136
|
+
|
|
137
|
+
## [0.2.0] — 2026-08-03
|
|
138
|
+
|
|
139
|
+
**Hourly EventLogFile and Real-Time Event capture.** Adds the event baseline store and the
|
|
140
|
+
hourly capture path that dependants build on.
|
|
141
|
+
|
|
142
|
+
## [0.1.x]
|
|
143
|
+
|
|
144
|
+
Initial internal releases: API clients, org context, findings model and report rendering.
|
|
145
|
+
|
|
146
|
+
[Unreleased]: https://github.com/cclabsnz/sf-core/compare/v0.4.0...HEAD
|
|
147
|
+
[0.4.0]: https://github.com/cclabsnz/sf-core/releases/tag/v0.4.0
|
|
148
|
+
[0.3.0]: https://github.com/cclabsnz/sf-core/releases/tag/v0.3.0
|
|
149
|
+
[0.2.0]: https://github.com/cclabsnz/sf-core/releases/tag/v0.2.0
|
package/README.md
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
# @cclabsnz/sf-core
|
|
2
2
|
|
|
3
|
+
[](https://github.com/cclabsnz/sf-core/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/cclabsnz/sf-core/actions/workflows/codeql.yml)
|
|
5
|
+
[](https://github.com/cclabsnz/sf-core/actions/workflows/semgrep.yml)
|
|
6
|
+
[](https://securityscorecards.dev/viewer/?uri=github.com/cclabsnz/sf-core)
|
|
7
|
+
[](https://www.bestpractices.dev/projects/14150)
|
|
8
|
+
[](https://www.npmjs.com/package/@cclabsnz/sf-core)
|
|
9
|
+
[](https://www.npmjs.com/package/@cclabsnz/sf-core#provenance)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
3
12
|
> Shared platform layer for the CloudCounsel Salesforce `sf` plugins.
|
|
4
13
|
|
|
14
|
+
[Architecture](docs/ARCHITECTURE.md) · [Assurance case](docs/ASSURANCE_CASE.md) · [Release tracking](docs/RELEASE_TRACKING.md) · [Governance](GOVERNANCE.md) · [Roadmap](ROADMAP.md) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [Changelog](CHANGELOG.md)
|
|
15
|
+
|
|
5
16
|
The read-only API surface, platform-behaviour knowledge, report shell and versioned IR
|
|
6
17
|
contracts behind [`@cclabsnz/sf-audit`](https://www.npmjs.com/package/@cclabsnz/sf-audit)
|
|
7
18
|
(security auditing) and `@cclabsnz/sf-orgintel` (org intelligence).
|
|
@@ -10,8 +21,9 @@ contracts behind [`@cclabsnz/sf-audit`](https://www.npmjs.com/package/@cclabsnz/
|
|
|
10
21
|
|
|
11
22
|
| Area | What it provides |
|
|
12
23
|
| --- | --- |
|
|
13
|
-
| **API clients** | `SoqlClient`, `ToolingClient`, `RestClient`, `MetadataClient
|
|
24
|
+
| **API clients** | `SoqlClient`, `ToolingClient`, `RestClient`, `MetadataClient`: read-only wrappers over a `@salesforce/core` `Connection` |
|
|
14
25
|
| **Platform behaviour** | `FlowRepository`, `ApexRepository`, `isSalesforceId`, `describeSalesforceError`, `mapWithConcurrency` |
|
|
26
|
+
| **Event capture** | `EventBaselineStore`, `RTE_CATALOG`, `pullEventLogs`, `pullRealtimeEvents`, `CaptureManifest`: bounded, resumable EventLogFile and Real-Time Event pulls |
|
|
15
27
|
| **IR contracts** | Typed interfaces plus JSON Schemas for `coupling-graph`, `landscape-manifest` and `process-graph` |
|
|
16
28
|
| **Report shell** | Branding resolution and embedded webfonts for self-contained HTML reports |
|
|
17
29
|
| **Test invariants** | Static guards that fail a build on org writes or network egress |
|
|
@@ -21,22 +33,34 @@ contracts behind [`@cclabsnz/sf-audit`](https://www.npmjs.com/package/@cclabsnz/
|
|
|
21
33
|
Salesforce has behaviours that are easy to get wrong and expensive to discover, and each one
|
|
22
34
|
here was learned by running against a real org:
|
|
23
35
|
|
|
24
|
-
- `FlowDefinitionView` is a **standard** object
|
|
36
|
+
- `FlowDefinitionView` is a **standard** object, so querying it through Tooling answers
|
|
25
37
|
*"sObject type 'FlowDefinitionView' is not supported."*
|
|
26
|
-
- `Flow.Metadata` **is** Tooling, and is strictly **one row per query
|
|
38
|
+
- `Flow.Metadata` **is** Tooling, and is strictly **one row per query**. An `Id IN (...)`
|
|
27
39
|
batch is rejected outright, so bulk reads need bounded concurrency.
|
|
28
|
-
- `ApexClass` has a `SymbolTable` column; **`ApexTrigger` does not
|
|
40
|
+
- `ApexClass` has a `SymbolTable` column; **`ApexTrigger` does not**, and selecting it fails the
|
|
29
41
|
entire query.
|
|
30
42
|
- Managed-package flows return a **durable name** (`ns__Flow-1`) where an Id is expected;
|
|
31
43
|
feeding that to a `WHERE` clause yields `invalid ID field`.
|
|
32
|
-
- `expr0` is Salesforce's own aggregate alias and **cannot be requested
|
|
44
|
+
- `expr0` is Salesforce's own aggregate alias and **cannot be requested**. An explicit
|
|
33
45
|
`COUNT(Id) expr0` is rejected with *"alias is reserved: expr0"*.
|
|
46
|
+
- Real-Time Event objects split unevenly between the streaming base and a retained-rows
|
|
47
|
+
`*Store`, and **the split cannot be derived from the name**. Roughly half the base objects
|
|
48
|
+
reject a `SELECT` outright while their `*Store` answers fine. `ListViewEvent` is queryable
|
|
49
|
+
and has no Store at all; `GuestUserAnomalyEvent` is the exact inverse.
|
|
34
50
|
|
|
35
51
|
Encoding these once means a consumer cannot rediscover them by shipping the bug first. The
|
|
36
52
|
contract tests are the point: their mocks refuse exactly as an org refuses, so a query sent to
|
|
37
53
|
the wrong API or asking for a non-existent column fails the build rather than degrading
|
|
38
54
|
silently in production.
|
|
39
55
|
|
|
56
|
+
That guarantee has one edge, and it is worth stating because this package has been caught by
|
|
57
|
+
it. A contract test can only refuse what the code asks for; it cannot notice an object the
|
|
58
|
+
catalog never lists. A missing entry raises no error anywhere — the read is simply never
|
|
59
|
+
attempted, and the resulting absence is indistinguishable from an org that had nothing to
|
|
60
|
+
report. So the catalogs are re-probed against live orgs in **both** directions, asking not
|
|
61
|
+
only whether every listed object still behaves as listed but what `describe` returns that is
|
|
62
|
+
not listed at all. See [docs/RELEASE_TRACKING.md](docs/RELEASE_TRACKING.md).
|
|
63
|
+
|
|
40
64
|
## Install
|
|
41
65
|
|
|
42
66
|
```bash
|
|
@@ -52,7 +76,7 @@ const flows = new FlowRepository(soqlClient, toolingClient);
|
|
|
52
76
|
const definitions = await flows.listDefinitions();
|
|
53
77
|
const { versions, managedSkipped } = FlowRepository.selectVersions(definitions);
|
|
54
78
|
|
|
55
|
-
// Flow.Metadata is one row per query
|
|
79
|
+
// Flow.Metadata is one row per query; concurrency is the only lever.
|
|
56
80
|
await mapWithConcurrency(versions, 8, async (v) => {
|
|
57
81
|
const metadata = await flows.fetchMetadata(v.id);
|
|
58
82
|
// ...
|
|
@@ -68,7 +92,7 @@ const couplingGraphSchema = loadSchema('coupling-graph');
|
|
|
68
92
|
|
|
69
93
|
## Guarantees
|
|
70
94
|
|
|
71
|
-
Both are enforced as tests, not asserted in prose
|
|
95
|
+
Both are enforced as tests, not asserted in prose. Run them yourself with `pnpm test`:
|
|
72
96
|
|
|
73
97
|
- **Read-only.** No jsforce mutation API, HTTP write verb, or bulk/composite write path may
|
|
74
98
|
appear in source. Every org request is a SOQL query, a REST **GET**, or a Metadata read.
|
|
@@ -84,5 +108,5 @@ version bump on the contract, not a silent edit.
|
|
|
84
108
|
|
|
85
109
|
## Licence
|
|
86
110
|
|
|
87
|
-
Apache-2.0
|
|
111
|
+
Apache-2.0, see [LICENSE](LICENSE). Bundled fonts are SIL OFL 1.1; see
|
|
88
112
|
[`src/assets/fonts/NOTICE.md`](src/assets/fonts/NOTICE.md).
|
|
@@ -7,7 +7,7 @@ export interface RteType {
|
|
|
7
7
|
preferredFields: string[];
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
10
|
+
* The 23 known RTE types, split by how the org actually serves them.
|
|
11
11
|
*
|
|
12
12
|
* Probed against a live sandbox on 2026-08-03, which replaced the naming convention this
|
|
13
13
|
* table was first built on. The convention was wrong in both directions, and the real rule
|
|
@@ -27,6 +27,22 @@ export interface RteType {
|
|
|
27
27
|
* Re-probed across five orgs — two sandboxes and three production — on 2026-08-03. Every
|
|
28
28
|
* verdict was identical in all five, including the absences, so the negatives are no longer
|
|
29
29
|
* a single-org observation that a different licence might overturn.
|
|
30
|
+
*
|
|
31
|
+
* Re-probed again across eight orgs on 2026-09-02, on API v67.0. Every existing verdict held
|
|
32
|
+
* unchanged. The probe was widened to ask the inverse question — what does describe return
|
|
33
|
+
* that this table does not list — and found four objects that had been invisible since the
|
|
34
|
+
* table was written, each unanimous across all eight orgs:
|
|
35
|
+
*
|
|
36
|
+
* - `LoginAnomalyEvent` and `UniversalAnomalyEvent` are ordinary threat-detection pairs
|
|
37
|
+
* that simply were never enumerated. `LoginAnomalyEvent` is the costly omission: login
|
|
38
|
+
* anomaly is exactly the signal this catalog exists to retain.
|
|
39
|
+
* - `IdentityVerificationEvent` is an audit event, directly queryable with no Store.
|
|
40
|
+
* - `ApiPrtcPolicyChangeEvent` is streaming-only with no Store, so it joins the bucket
|
|
41
|
+
* that can never be captured retroactively.
|
|
42
|
+
*
|
|
43
|
+
* The lesson is the same one the naming convention taught: this table's failure mode is
|
|
44
|
+
* silent omission, not a wrong entry. A missing object produces no error anywhere — the pull
|
|
45
|
+
* simply never asks for it — so only an inverse probe against describe can find one.
|
|
30
46
|
*/
|
|
31
47
|
export declare const RTE_CATALOG: readonly RteType[];
|
|
32
48
|
//# sourceMappingURL=rteCatalog.d.ts.map
|
package/lib/events/rteCatalog.js
CHANGED
|
@@ -46,7 +46,7 @@ const CONTEXT_FIELDS = [
|
|
|
46
46
|
];
|
|
47
47
|
const ALL_PREFERRED = [...COMMON_FIELDS, ...EXFIL_FIELDS, ...CONTEXT_FIELDS];
|
|
48
48
|
/**
|
|
49
|
-
* The
|
|
49
|
+
* The 23 known RTE types, split by how the org actually serves them.
|
|
50
50
|
*
|
|
51
51
|
* Probed against a live sandbox on 2026-08-03, which replaced the naming convention this
|
|
52
52
|
* table was first built on. The convention was wrong in both directions, and the real rule
|
|
@@ -66,6 +66,22 @@ const ALL_PREFERRED = [...COMMON_FIELDS, ...EXFIL_FIELDS, ...CONTEXT_FIELDS];
|
|
|
66
66
|
* Re-probed across five orgs — two sandboxes and three production — on 2026-08-03. Every
|
|
67
67
|
* verdict was identical in all five, including the absences, so the negatives are no longer
|
|
68
68
|
* a single-org observation that a different licence might overturn.
|
|
69
|
+
*
|
|
70
|
+
* Re-probed again across eight orgs on 2026-09-02, on API v67.0. Every existing verdict held
|
|
71
|
+
* unchanged. The probe was widened to ask the inverse question — what does describe return
|
|
72
|
+
* that this table does not list — and found four objects that had been invisible since the
|
|
73
|
+
* table was written, each unanimous across all eight orgs:
|
|
74
|
+
*
|
|
75
|
+
* - `LoginAnomalyEvent` and `UniversalAnomalyEvent` are ordinary threat-detection pairs
|
|
76
|
+
* that simply were never enumerated. `LoginAnomalyEvent` is the costly omission: login
|
|
77
|
+
* anomaly is exactly the signal this catalog exists to retain.
|
|
78
|
+
* - `IdentityVerificationEvent` is an audit event, directly queryable with no Store.
|
|
79
|
+
* - `ApiPrtcPolicyChangeEvent` is streaming-only with no Store, so it joins the bucket
|
|
80
|
+
* that can never be captured retroactively.
|
|
81
|
+
*
|
|
82
|
+
* The lesson is the same one the naming convention taught: this table's failure mode is
|
|
83
|
+
* silent omission, not a wrong entry. A missing object produces no error anywhere — the pull
|
|
84
|
+
* simply never asks for it — so only an inverse probe against describe can find one.
|
|
69
85
|
*/
|
|
70
86
|
export const RTE_CATALOG = [
|
|
71
87
|
// Directly queryable; no Store counterpart exists. Verified queryable in the probe org.
|
|
@@ -78,8 +94,9 @@ export const RTE_CATALOG = [
|
|
|
78
94
|
{ base: 'LightningUriEvent', preferredFields: ALL_PREFERRED },
|
|
79
95
|
{ base: 'LoginAsEvent', preferredFields: ALL_PREFERRED },
|
|
80
96
|
{ base: 'IdentityProviderEventStore', preferredFields: ALL_PREFERRED },
|
|
81
|
-
|
|
82
|
-
//
|
|
97
|
+
{ base: 'IdentityVerificationEvent', preferredFields: ALL_PREFERRED },
|
|
98
|
+
// Streaming-only base, retained rows in the Store. All ten Stores verified queryable, and
|
|
99
|
+
// all ten bases verified to reject a query with "does not support query".
|
|
83
100
|
{ base: 'ApiAnomalyEvent', store: 'ApiAnomalyEventStore', preferredFields: ALL_PREFERRED },
|
|
84
101
|
{ base: 'BulkApiResultEvent', store: 'BulkApiResultEventStore', preferredFields: ALL_PREFERRED },
|
|
85
102
|
{
|
|
@@ -100,6 +117,12 @@ export const RTE_CATALOG = [
|
|
|
100
117
|
store: 'SessionHijackingEventStore',
|
|
101
118
|
preferredFields: ALL_PREFERRED,
|
|
102
119
|
},
|
|
120
|
+
{ base: 'LoginAnomalyEvent', store: 'LoginAnomalyEventStore', preferredFields: ALL_PREFERRED },
|
|
121
|
+
{
|
|
122
|
+
base: 'UniversalAnomalyEvent',
|
|
123
|
+
store: 'UniversalAnomalyEventStore',
|
|
124
|
+
preferredFields: ALL_PREFERRED,
|
|
125
|
+
},
|
|
103
126
|
// Exist, but are streaming-only with no Store in any org probed — so they can never be
|
|
104
127
|
// captured retroactively. Kept deliberately: the manifest recording them as `not-queryable`
|
|
105
128
|
// is real coverage information. "This event type exists and cannot be read after the fact"
|
|
@@ -107,7 +130,8 @@ export const RTE_CATALOG = [
|
|
|
107
130
|
// apart before it reports an absence.
|
|
108
131
|
{ base: 'ConcurLongRunApexErrEvent', preferredFields: ALL_PREFERRED },
|
|
109
132
|
{ base: 'OrgLifecycleNotification', preferredFields: ALL_PREFERRED },
|
|
110
|
-
|
|
133
|
+
{ base: 'ApiPrtcPolicyChangeEvent', preferredFields: ALL_PREFERRED },
|
|
134
|
+
// `ApexExecutionEvent` was here and is gone: absent from describe in all eight orgs, so the
|
|
111
135
|
// name appears not to exist rather than to be unlicensed. It cost a 404 per pull.
|
|
112
136
|
];
|
|
113
137
|
//# sourceMappingURL=rteCatalog.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function summariseGraphCoverage(coverage) {
|
|
2
|
+
const lines = [];
|
|
3
|
+
for (const note of coverage.notes)
|
|
4
|
+
lines.push(` note: ${note}`);
|
|
5
|
+
for (const u of coverage.unavailable) {
|
|
6
|
+
lines.push(` not read: ${u.scope} (${u.reason}) — ${u.detail}`);
|
|
7
|
+
}
|
|
8
|
+
return lines;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './kinds.js';
|
|
3
|
+
export * from './rules.js';
|
|
4
|
+
export * from './schema.js';
|
|
5
|
+
export * from './validate.js';
|
|
6
|
+
export * from './coverage.js';
|
|
7
|
+
export * from './roleOf.js';
|
|
8
|
+
export * from './merge.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/graph/index.ts
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './kinds.js';
|
|
4
|
+
export * from './rules.js';
|
|
5
|
+
export * from './schema.js';
|
|
6
|
+
export * from './validate.js';
|
|
7
|
+
export * from './coverage.js';
|
|
8
|
+
export * from './roleOf.js';
|
|
9
|
+
export * from './merge.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { GraphLayer, GraphLevel, GraphProducer } from './types.js';
|
|
2
|
+
export interface GraphKindEntry {
|
|
3
|
+
layer: GraphLayer;
|
|
4
|
+
level: GraphLevel;
|
|
5
|
+
owner: GraphProducer;
|
|
6
|
+
}
|
|
7
|
+
export declare const GRAPH_KIND_TABLE: {
|
|
8
|
+
readonly org: {
|
|
9
|
+
readonly layer: "landscape";
|
|
10
|
+
readonly level: 0;
|
|
11
|
+
readonly owner: "orgviz";
|
|
12
|
+
};
|
|
13
|
+
readonly trustBoundary: {
|
|
14
|
+
readonly layer: "landscape";
|
|
15
|
+
readonly level: 0;
|
|
16
|
+
readonly owner: "orgviz";
|
|
17
|
+
};
|
|
18
|
+
readonly rollup: {
|
|
19
|
+
readonly layer: "landscape";
|
|
20
|
+
readonly level: 0;
|
|
21
|
+
readonly owner: "orgviz";
|
|
22
|
+
};
|
|
23
|
+
readonly domain: {
|
|
24
|
+
readonly layer: "domain";
|
|
25
|
+
readonly level: 1;
|
|
26
|
+
readonly owner: "orgviz";
|
|
27
|
+
};
|
|
28
|
+
readonly connectedApp: {
|
|
29
|
+
readonly layer: "landscape";
|
|
30
|
+
readonly level: 2;
|
|
31
|
+
readonly owner: "orgviz";
|
|
32
|
+
};
|
|
33
|
+
readonly namedCredential: {
|
|
34
|
+
readonly layer: "landscape";
|
|
35
|
+
readonly level: 2;
|
|
36
|
+
readonly owner: "orgviz";
|
|
37
|
+
};
|
|
38
|
+
readonly integration: {
|
|
39
|
+
readonly layer: "landscape";
|
|
40
|
+
readonly level: 2;
|
|
41
|
+
readonly owner: "orgviz";
|
|
42
|
+
};
|
|
43
|
+
readonly sobject: {
|
|
44
|
+
readonly layer: "data";
|
|
45
|
+
readonly level: 2;
|
|
46
|
+
readonly owner: "orgviz";
|
|
47
|
+
};
|
|
48
|
+
readonly profile: {
|
|
49
|
+
readonly layer: "access";
|
|
50
|
+
readonly level: 2;
|
|
51
|
+
readonly owner: "orgviz";
|
|
52
|
+
};
|
|
53
|
+
readonly permissionSet: {
|
|
54
|
+
readonly layer: "access";
|
|
55
|
+
readonly level: 2;
|
|
56
|
+
readonly owner: "orgviz";
|
|
57
|
+
};
|
|
58
|
+
readonly permissionSetGroup: {
|
|
59
|
+
readonly layer: "access";
|
|
60
|
+
readonly level: 2;
|
|
61
|
+
readonly owner: "orgviz";
|
|
62
|
+
};
|
|
63
|
+
readonly user: {
|
|
64
|
+
readonly layer: "access";
|
|
65
|
+
readonly level: 2;
|
|
66
|
+
readonly owner: "orgviz";
|
|
67
|
+
};
|
|
68
|
+
readonly flow: {
|
|
69
|
+
readonly layer: "process";
|
|
70
|
+
readonly level: 2;
|
|
71
|
+
readonly owner: "orgintel";
|
|
72
|
+
};
|
|
73
|
+
readonly apexClass: {
|
|
74
|
+
readonly layer: "process";
|
|
75
|
+
readonly level: 2;
|
|
76
|
+
readonly owner: "orgintel";
|
|
77
|
+
};
|
|
78
|
+
readonly trigger: {
|
|
79
|
+
readonly layer: "process";
|
|
80
|
+
readonly level: 2;
|
|
81
|
+
readonly owner: "orgintel";
|
|
82
|
+
};
|
|
83
|
+
readonly execution: {
|
|
84
|
+
readonly layer: "runtime";
|
|
85
|
+
readonly level: 2;
|
|
86
|
+
readonly owner: "orgintel";
|
|
87
|
+
};
|
|
88
|
+
readonly field: {
|
|
89
|
+
readonly layer: "data";
|
|
90
|
+
readonly level: 3;
|
|
91
|
+
readonly owner: "orgviz";
|
|
92
|
+
};
|
|
93
|
+
readonly grant: {
|
|
94
|
+
readonly layer: "access";
|
|
95
|
+
readonly level: 3;
|
|
96
|
+
readonly owner: "orgviz";
|
|
97
|
+
};
|
|
98
|
+
readonly flowElement: {
|
|
99
|
+
readonly layer: "process";
|
|
100
|
+
readonly level: 3;
|
|
101
|
+
readonly owner: "orgintel";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export type GraphNodeKind = keyof typeof GRAPH_KIND_TABLE;
|
|
105
|
+
export declare function isKnownGraphKind(kind: string): kind is GraphNodeKind;
|
|
106
|
+
export declare function levelOfKind(kind: GraphNodeKind): GraphLevel;
|
|
107
|
+
export declare function layerOfKind(kind: GraphNodeKind): GraphLayer;
|
|
108
|
+
export declare function ownerOfKind(kind: GraphNodeKind): GraphProducer;
|
|
109
|
+
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const GRAPH_KIND_TABLE = {
|
|
2
|
+
// Level 0 — the coarsest rollup. Deliberately tiny, so "about a dozen nodes" survives an
|
|
3
|
+
// org with forty connected apps. Spec section 2.2.
|
|
4
|
+
org: { layer: 'landscape', level: 0, owner: 'orgviz' },
|
|
5
|
+
trustBoundary: { layer: 'landscape', level: 0, owner: 'orgviz' },
|
|
6
|
+
rollup: { layer: 'landscape', level: 0, owner: 'orgviz' },
|
|
7
|
+
// Level 1 — mined groupings.
|
|
8
|
+
domain: { layer: 'domain', level: 1, owner: 'orgviz' },
|
|
9
|
+
// Level 2 — concrete entities.
|
|
10
|
+
connectedApp: { layer: 'landscape', level: 2, owner: 'orgviz' },
|
|
11
|
+
namedCredential: { layer: 'landscape', level: 2, owner: 'orgviz' },
|
|
12
|
+
integration: { layer: 'landscape', level: 2, owner: 'orgviz' },
|
|
13
|
+
sobject: { layer: 'data', level: 2, owner: 'orgviz' },
|
|
14
|
+
profile: { layer: 'access', level: 2, owner: 'orgviz' },
|
|
15
|
+
permissionSet: { layer: 'access', level: 2, owner: 'orgviz' },
|
|
16
|
+
permissionSetGroup: { layer: 'access', level: 2, owner: 'orgviz' },
|
|
17
|
+
user: { layer: 'access', level: 2, owner: 'orgviz' },
|
|
18
|
+
flow: { layer: 'process', level: 2, owner: 'orgintel' },
|
|
19
|
+
apexClass: { layer: 'process', level: 2, owner: 'orgintel' },
|
|
20
|
+
trigger: { layer: 'process', level: 2, owner: 'orgintel' },
|
|
21
|
+
execution: { layer: 'runtime', level: 2, owner: 'orgintel' },
|
|
22
|
+
// Level 3 — members.
|
|
23
|
+
field: { layer: 'data', level: 3, owner: 'orgviz' },
|
|
24
|
+
grant: { layer: 'access', level: 3, owner: 'orgviz' },
|
|
25
|
+
flowElement: { layer: 'process', level: 3, owner: 'orgintel' },
|
|
26
|
+
};
|
|
27
|
+
export function isKnownGraphKind(kind) {
|
|
28
|
+
return Object.prototype.hasOwnProperty.call(GRAPH_KIND_TABLE, kind);
|
|
29
|
+
}
|
|
30
|
+
export function levelOfKind(kind) {
|
|
31
|
+
return GRAPH_KIND_TABLE[kind].level;
|
|
32
|
+
}
|
|
33
|
+
export function layerOfKind(kind) {
|
|
34
|
+
return GRAPH_KIND_TABLE[kind].layer;
|
|
35
|
+
}
|
|
36
|
+
export function ownerOfKind(kind) {
|
|
37
|
+
return GRAPH_KIND_TABLE[kind].owner;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=kinds.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CanonicalGraph, GraphProducer } from './types.js';
|
|
2
|
+
import { type GraphDiagnostic } from './rules.js';
|
|
3
|
+
export interface GraphFragmentCapture {
|
|
4
|
+
producer: GraphProducer | null;
|
|
5
|
+
capturedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GraphMergeReport {
|
|
8
|
+
fragments: GraphFragmentCapture[];
|
|
9
|
+
contributionsApplied: number;
|
|
10
|
+
}
|
|
11
|
+
export interface GraphMergeResult {
|
|
12
|
+
/**
|
|
13
|
+
* Null if and only if one of the four rejections fired: org mismatch, schema version mismatch
|
|
14
|
+
* (including a merged document that would carry an unsupported version), id collision, or kind
|
|
15
|
+
* not owned. An unresolved or unattributed contribution is a different class of thing -- the
|
|
16
|
+
* same class as a dangling edge endpoint, which this design also reports rather than treats as
|
|
17
|
+
* fatal -- so it comes back as a finding alongside a non-null graph, never in place of one.
|
|
18
|
+
*/
|
|
19
|
+
graph: CanonicalGraph | null;
|
|
20
|
+
findings: GraphDiagnostic[];
|
|
21
|
+
report: GraphMergeReport;
|
|
22
|
+
}
|
|
23
|
+
export declare function mergeGraphs(fragments: CanonicalGraph[]): GraphMergeResult;
|
|
24
|
+
//# sourceMappingURL=merge.d.ts.map
|