@amalgm/automations 0.2.3 → 0.2.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/AXIOMS.md +5 -3
- package/PURPOSE.md +4 -3
- package/README.md +2 -0
- package/dist/src/automations.js +2 -9
- package/package.json +1 -1
package/AXIOMS.md
CHANGED
|
@@ -24,9 +24,11 @@
|
|
|
24
24
|
9. Supabase is authoritative for automations, triggers, workflow source, and
|
|
25
25
|
permanent run history. A definition edit or deletion never rewrites prior
|
|
26
26
|
runs.
|
|
27
|
-
10. A webhook URL is a rotatable bearer capability for exactly one trigger.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
10. A webhook URL is a rotatable bearer capability for exactly one trigger.
|
|
28
|
+
Possession plus any configured provider proof admits that trigger; source
|
|
29
|
+
and event labels never form a second routing gate. Its random locator is not
|
|
30
|
+
sufficient without the hosted service's HMAC, and caller input never
|
|
31
|
+
supplies an owner or target.
|
|
30
32
|
11. Optional provider signing secrets are persisted but write-only: normal
|
|
31
33
|
reads reveal only that a secret is configured.
|
|
32
34
|
12. Run history is read-only in the control plane and always scoped to its
|
package/PURPOSE.md
CHANGED
|
@@ -47,9 +47,10 @@ trigger owns one opaque URL under `automations.amalgm.ai`; the URL resolves the
|
|
|
47
47
|
trigger, owner, and target, so a caller never supplies routing identity. The
|
|
48
48
|
adapter bounds and parses the body, optionally verifies the provider's signing
|
|
49
49
|
secret, deduplicates explicit provider delivery ids, and returns only after the
|
|
50
|
-
run has been stored in Supabase.
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
run has been stored in Supabase. Provider source and event labels describe the
|
|
51
|
+
occurrence; they are not a second routing gate after the URL has selected the
|
|
52
|
+
trigger. The signed URL can be rotated without changing the automation, and its
|
|
53
|
+
usable bearer token cannot be reconstructed from the database alone.
|
|
53
54
|
|
|
54
55
|
Amalgm supplies a resolved authenticated principal from its user session or
|
|
55
56
|
HMAC-refresh flow; future API keys resolve to the same principal capability.
|
package/README.md
CHANGED
|
@@ -99,6 +99,8 @@ Public webhook admission uses the URL returned on each webhook trigger:
|
|
|
99
99
|
POST https://automations.amalgm.ai/e/<opaque-capability>
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
That URL selects the exact trigger. Provider source and event labels are
|
|
103
|
+
recorded as occurrence metadata, not used as another routing condition.
|
|
102
104
|
`Idempotency-Key` and common provider delivery-id headers deduplicate retries
|
|
103
105
|
against the same trigger. The caller never supplies a user or target id.
|
|
104
106
|
|
package/dist/src/automations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nextCronAt } from './schedule.js';
|
|
2
|
-
import { eventReferences,
|
|
2
|
+
import { eventReferences, verifyEventSecret } from './webhook.js';
|
|
3
3
|
const noop = () => { };
|
|
4
4
|
export class EventRejectedError extends Error {
|
|
5
5
|
constructor() {
|
|
@@ -33,14 +33,7 @@ export class Automations {
|
|
|
33
33
|
const references = input.source && input.event
|
|
34
34
|
? { primary: { source: input.source, event: input.event } }
|
|
35
35
|
: eventReferences(input.headers, input.payload);
|
|
36
|
-
|
|
37
|
-
let matches = matchesEvent(trigger, reference.source, reference.event);
|
|
38
|
-
if (!matches && references.fallback) {
|
|
39
|
-
reference = references.fallback;
|
|
40
|
-
matches = matchesEvent(trigger, reference.source, reference.event);
|
|
41
|
-
}
|
|
42
|
-
if (!matches)
|
|
43
|
-
return { run: null, ...reference };
|
|
36
|
+
const reference = references.primary;
|
|
44
37
|
const now = input.now || new Date();
|
|
45
38
|
const runInput = { kind: 'event', ...reference, payload: input.payload };
|
|
46
39
|
const run = await this.store.enqueueEvent(trigger, runInput, now, input.deliveryKey);
|