@cat-factory/server 0.244.0 → 0.246.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/dist/modules/notificationWebhook/NotificationWebhookController.d.ts +8 -2
- package/dist/modules/notificationWebhook/NotificationWebhookController.d.ts.map +1 -1
- package/dist/modules/notificationWebhook/NotificationWebhookController.js +35 -7
- package/dist/modules/notificationWebhook/NotificationWebhookController.js.map +1 -1
- package/dist/modules/publicApi/PublicNotificationWebhookController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicNotificationWebhookController.js +50 -5
- package/dist/modules/publicApi/PublicNotificationWebhookController.js.map +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.d.ts +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.d.ts.map +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.js +1 -1
- package/dist/modules/publicApi/openapiDocument.generated.js.map +1 -1
- package/dist/persistence/rpc-allowlist.d.ts.map +1 -1
- package/dist/persistence/rpc-allowlist.js +13 -10
- package/dist/persistence/rpc-allowlist.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import type { AppEnv } from '../../http/env.js';
|
|
3
3
|
/**
|
|
4
|
-
* Workspace-scoped management of the OUTBOUND notification
|
|
4
|
+
* Workspace-scoped management of the OUTBOUND notification webhooks: the HTTPS endpoints a
|
|
5
5
|
* workspace registers to receive its notifications by push. This is how a headless integration —
|
|
6
6
|
* which has no in-app inbox and no browser WebSocket — learns that a run parked on a human
|
|
7
7
|
* decision (see `docs/initiatives/headless-clarification-loop.md`, D3).
|
|
8
8
|
*
|
|
9
|
+
* Two shapes over one store: the SINGULAR routes address the `default` id, the COLLECTION
|
|
10
|
+
* addresses any of them. Neither has logic of its own — both delegate to the same service methods
|
|
11
|
+
* the public surface calls, so the id defaulting is the only thing the singular half adds.
|
|
12
|
+
*
|
|
9
13
|
* The signing secret is write-only: `put` accepts it, the projection reports only `hasSecret`, and
|
|
10
14
|
* nothing reads it back. Mounted under `/workspaces/:workspaceId` behind `integrations.manage` —
|
|
11
15
|
* one permission for the whole controller, so a route added later inherits the correct gate (see
|
|
12
|
-
* the workspace-RBAC section of CLAUDE.md).
|
|
16
|
+
* the workspace-RBAC section of CLAUDE.md). BOTH prefixes are listed: `/notification-webhook` is
|
|
17
|
+
* registered as `ALL /notification-webhook/*`, which does not match the plural path, so the
|
|
18
|
+
* collection would otherwise be ungated.
|
|
13
19
|
*/
|
|
14
20
|
export declare function notificationWebhookController(): Hono<AppEnv>;
|
|
15
21
|
//# sourceMappingURL=NotificationWebhookController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationWebhookController.d.ts","sourceRoot":"","sources":["../../../src/modules/notificationWebhook/NotificationWebhookController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationWebhookController.d.ts","sourceRoot":"","sources":["../../../src/modules/notificationWebhook/NotificationWebhookController.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAa/C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAAC,MAAM,CAAC,CAwD5D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteNotificationWebhookContract, getNotificationWebhookContract, putNotificationWebhookContract, } from '@cat-factory/contracts';
|
|
1
|
+
import { DEFAULT_NOTIFICATION_WEBHOOK_ID, deleteNamedNotificationWebhookContract, deleteNotificationWebhookContract, getNamedNotificationWebhookContract, getNotificationWebhookContract, listNotificationWebhooksContract, putNamedNotificationWebhookContract, putNotificationWebhookContract, } from '@cat-factory/contracts';
|
|
2
2
|
import { buildHonoRoute } from '@toad-contracts/hono';
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import { mountWorkspacePermission } from '../../http/workspaceAccess.js';
|
|
@@ -9,31 +9,59 @@ function requireWebhooks(c) {
|
|
|
9
9
|
return requireCapability(c.get('container').notificationWebhooks, 'Notification webhooks are not configured');
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Workspace-scoped management of the OUTBOUND notification
|
|
12
|
+
* Workspace-scoped management of the OUTBOUND notification webhooks: the HTTPS endpoints a
|
|
13
13
|
* workspace registers to receive its notifications by push. This is how a headless integration —
|
|
14
14
|
* which has no in-app inbox and no browser WebSocket — learns that a run parked on a human
|
|
15
15
|
* decision (see `docs/initiatives/headless-clarification-loop.md`, D3).
|
|
16
16
|
*
|
|
17
|
+
* Two shapes over one store: the SINGULAR routes address the `default` id, the COLLECTION
|
|
18
|
+
* addresses any of them. Neither has logic of its own — both delegate to the same service methods
|
|
19
|
+
* the public surface calls, so the id defaulting is the only thing the singular half adds.
|
|
20
|
+
*
|
|
17
21
|
* The signing secret is write-only: `put` accepts it, the projection reports only `hasSecret`, and
|
|
18
22
|
* nothing reads it back. Mounted under `/workspaces/:workspaceId` behind `integrations.manage` —
|
|
19
23
|
* one permission for the whole controller, so a route added later inherits the correct gate (see
|
|
20
|
-
* the workspace-RBAC section of CLAUDE.md).
|
|
24
|
+
* the workspace-RBAC section of CLAUDE.md). BOTH prefixes are listed: `/notification-webhook` is
|
|
25
|
+
* registered as `ALL /notification-webhook/*`, which does not match the plural path, so the
|
|
26
|
+
* collection would otherwise be ungated.
|
|
21
27
|
*/
|
|
22
28
|
export function notificationWebhookController() {
|
|
23
29
|
const app = new Hono();
|
|
24
|
-
mountWorkspacePermission(app, 'integrations.manage', [
|
|
30
|
+
mountWorkspacePermission(app, 'integrations.manage', [
|
|
31
|
+
'/notification-webhook',
|
|
32
|
+
'/notification-webhooks',
|
|
33
|
+
]);
|
|
25
34
|
buildHonoRoute(app, getNotificationWebhookContract, async (c) => {
|
|
26
35
|
const webhooks = requireWebhooks(c);
|
|
27
|
-
return c.json(await webhooks.get(param(c, 'workspaceId')), 200);
|
|
36
|
+
return c.json(await webhooks.get(param(c, 'workspaceId'), DEFAULT_NOTIFICATION_WEBHOOK_ID), 200);
|
|
28
37
|
});
|
|
29
38
|
buildHonoRoute(app, putNotificationWebhookContract, async (c) => {
|
|
30
39
|
const webhooks = requireWebhooks(c);
|
|
31
|
-
const saved = await webhooks.put(param(c, 'workspaceId'), c.req.valid('json'));
|
|
40
|
+
const saved = await webhooks.put(param(c, 'workspaceId'), DEFAULT_NOTIFICATION_WEBHOOK_ID, c.req.valid('json'));
|
|
32
41
|
return c.json(saved, 200);
|
|
33
42
|
});
|
|
34
43
|
buildHonoRoute(app, deleteNotificationWebhookContract, async (c) => {
|
|
35
44
|
const webhooks = requireWebhooks(c);
|
|
36
|
-
await webhooks.remove(param(c, 'workspaceId'));
|
|
45
|
+
await webhooks.remove(param(c, 'workspaceId'), DEFAULT_NOTIFICATION_WEBHOOK_ID);
|
|
46
|
+
return c.body(null, 204);
|
|
47
|
+
});
|
|
48
|
+
buildHonoRoute(app, listNotificationWebhooksContract, async (c) => {
|
|
49
|
+
const webhooks = requireWebhooks(c);
|
|
50
|
+
return c.json({ webhooks: await webhooks.list(param(c, 'workspaceId')) }, 200);
|
|
51
|
+
});
|
|
52
|
+
buildHonoRoute(app, getNamedNotificationWebhookContract, async (c) => {
|
|
53
|
+
const webhooks = requireWebhooks(c);
|
|
54
|
+
const webhook = await webhooks.get(param(c, 'workspaceId'), param(c, 'webhookId'));
|
|
55
|
+
return c.json({ webhook }, 200);
|
|
56
|
+
});
|
|
57
|
+
buildHonoRoute(app, putNamedNotificationWebhookContract, async (c) => {
|
|
58
|
+
const webhooks = requireWebhooks(c);
|
|
59
|
+
const saved = await webhooks.put(param(c, 'workspaceId'), param(c, 'webhookId'), c.req.valid('json'));
|
|
60
|
+
return c.json(saved, 200);
|
|
61
|
+
});
|
|
62
|
+
buildHonoRoute(app, deleteNamedNotificationWebhookContract, async (c) => {
|
|
63
|
+
const webhooks = requireWebhooks(c);
|
|
64
|
+
await webhooks.remove(param(c, 'workspaceId'), param(c, 'webhookId'));
|
|
37
65
|
return c.body(null, 204);
|
|
38
66
|
});
|
|
39
67
|
return app;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationWebhookController.js","sourceRoot":"","sources":["../../../src/modules/notificationWebhook/NotificationWebhookController.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD,iFAAiF;AACjF,SAAS,eAAe,CAAmB,CAAa;IACtD,OAAO,iBAAiB,CACtB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,oBAAoB,EACvC,0CAA0C,CAC3C,CAAA;AACH,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"NotificationWebhookController.js","sourceRoot":"","sources":["../../../src/modules/notificationWebhook/NotificationWebhookController.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,sCAAsC,EACtC,iCAAiC,EACjC,mCAAmC,EACnC,8BAA8B,EAC9B,gCAAgC,EAChC,mCAAmC,EACnC,8BAA8B,GAC/B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAA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CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,EAAE,sCAAsC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACtE,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAA;QACrE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicNotificationWebhookController.d.ts","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicNotificationWebhookController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PublicNotificationWebhookController.d.ts","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicNotificationWebhookController.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AA+C/C,wBAAgB,mCAAmC,IAAI,IAAI,CAAC,MAAM,CAAC,CAyFlE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deletePublicNotificationWebhookContract, getPublicNotificationWebhookContract, putPublicNotificationWebhookContract, } from '@cat-factory/contracts';
|
|
1
|
+
import { DEFAULT_NOTIFICATION_WEBHOOK_ID, deletePublicNamedNotificationWebhookContract, deletePublicNotificationWebhookContract, getPublicNamedNotificationWebhookContract, getPublicNotificationWebhookContract, listPublicNotificationWebhooksContract, putPublicNamedNotificationWebhookContract, putPublicNotificationWebhookContract, } from '@cat-factory/contracts';
|
|
2
2
|
import { buildHonoRoute } from '@toad-contracts/hono';
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import { authorize, refuse } from './publicApiAuth.js';
|
|
@@ -23,7 +23,7 @@ import { authorize, refuse } from './publicApiAuth.js';
|
|
|
23
23
|
// one is the reversible one.
|
|
24
24
|
// 2. **No parallel logic.** Every verb delegates to the same `NotificationWebhookService` method
|
|
25
25
|
// the session controller calls, so the SSRF guard on the endpoint, the keep-on-omit rule for
|
|
26
|
-
// each field and the
|
|
26
|
+
// each field and the per-workspace endpoint cap hold identically whichever surface
|
|
27
27
|
// writes. A `ValidationError` from the URL guard propagates to `handleError` rather than being
|
|
28
28
|
// re-mapped here, so the refusal keeps its `details`.
|
|
29
29
|
// 3. **The secret stays write-only.** `put` accepts one and `get` reports `hasSecret`; nothing
|
|
@@ -50,7 +50,7 @@ export function publicNotificationWebhookController() {
|
|
|
50
50
|
const webhooks = webhooksOf(c);
|
|
51
51
|
if (!webhooks)
|
|
52
52
|
return unavailable(c);
|
|
53
|
-
return c.json({ webhook: await webhooks.get(gate.auth.workspaceId) }, 200);
|
|
53
|
+
return c.json({ webhook: await webhooks.get(gate.auth.workspaceId, DEFAULT_NOTIFICATION_WEBHOOK_ID) }, 200);
|
|
54
54
|
});
|
|
55
55
|
// Register, edit or rotate. A field the body omits KEEPS its stored value (the service's rule,
|
|
56
56
|
// not this controller's), so an integration that only wants to add `runEvents` sends that one
|
|
@@ -62,7 +62,7 @@ export function publicNotificationWebhookController() {
|
|
|
62
62
|
const webhooks = webhooksOf(c);
|
|
63
63
|
if (!webhooks)
|
|
64
64
|
return unavailable(c);
|
|
65
|
-
const saved = await webhooks.put(gate.auth.workspaceId, c.req.valid('json'));
|
|
65
|
+
const saved = await webhooks.put(gate.auth.workspaceId, DEFAULT_NOTIFICATION_WEBHOOK_ID, c.req.valid('json'));
|
|
66
66
|
return c.json(saved, 200);
|
|
67
67
|
});
|
|
68
68
|
// Deregister. Idempotent, so a teardown script need not first ask whether anything is there.
|
|
@@ -73,7 +73,52 @@ export function publicNotificationWebhookController() {
|
|
|
73
73
|
const webhooks = webhooksOf(c);
|
|
74
74
|
if (!webhooks)
|
|
75
75
|
return unavailable(c);
|
|
76
|
-
await webhooks.remove(gate.auth.workspaceId);
|
|
76
|
+
await webhooks.remove(gate.auth.workspaceId, DEFAULT_NOTIFICATION_WEBHOOK_ID);
|
|
77
|
+
return c.body(null, 204);
|
|
78
|
+
});
|
|
79
|
+
// ---- the collection: several named endpoints, one per integration ----
|
|
80
|
+
//
|
|
81
|
+
// Every one of these is the corresponding singular route with the id supplied instead of
|
|
82
|
+
// defaulted. That is the whole difference, deliberately: the enrolment rules a caller has to
|
|
83
|
+
// reason about (keep-on-omit, the write-only secret, the SSRF guard, `admin` scope) must not
|
|
84
|
+
// depend on which of the two shapes it happened to call.
|
|
85
|
+
buildHonoRoute(app, listPublicNotificationWebhooksContract, async (c) => {
|
|
86
|
+
const gate = await authorize(c, listPublicNotificationWebhooksContract.minScope);
|
|
87
|
+
if ('fail' in gate)
|
|
88
|
+
return refuse(c, gate.fail);
|
|
89
|
+
const webhooks = webhooksOf(c);
|
|
90
|
+
if (!webhooks)
|
|
91
|
+
return unavailable(c);
|
|
92
|
+
return c.json({ webhooks: await webhooks.list(gate.auth.workspaceId) }, 200);
|
|
93
|
+
});
|
|
94
|
+
buildHonoRoute(app, getPublicNamedNotificationWebhookContract, async (c) => {
|
|
95
|
+
const gate = await authorize(c, getPublicNamedNotificationWebhookContract.minScope);
|
|
96
|
+
if ('fail' in gate)
|
|
97
|
+
return refuse(c, gate.fail);
|
|
98
|
+
const webhooks = webhooksOf(c);
|
|
99
|
+
if (!webhooks)
|
|
100
|
+
return unavailable(c);
|
|
101
|
+
const webhook = await webhooks.get(gate.auth.workspaceId, c.req.valid('param').webhookId);
|
|
102
|
+
return c.json({ webhook }, 200);
|
|
103
|
+
});
|
|
104
|
+
buildHonoRoute(app, putPublicNamedNotificationWebhookContract, async (c) => {
|
|
105
|
+
const gate = await authorize(c, putPublicNamedNotificationWebhookContract.minScope);
|
|
106
|
+
if ('fail' in gate)
|
|
107
|
+
return refuse(c, gate.fail);
|
|
108
|
+
const webhooks = webhooksOf(c);
|
|
109
|
+
if (!webhooks)
|
|
110
|
+
return unavailable(c);
|
|
111
|
+
const saved = await webhooks.put(gate.auth.workspaceId, c.req.valid('param').webhookId, c.req.valid('json'));
|
|
112
|
+
return c.json(saved, 200);
|
|
113
|
+
});
|
|
114
|
+
buildHonoRoute(app, deletePublicNamedNotificationWebhookContract, async (c) => {
|
|
115
|
+
const gate = await authorize(c, deletePublicNamedNotificationWebhookContract.minScope);
|
|
116
|
+
if ('fail' in gate)
|
|
117
|
+
return refuse(c, gate.fail);
|
|
118
|
+
const webhooks = webhooksOf(c);
|
|
119
|
+
if (!webhooks)
|
|
120
|
+
return unavailable(c);
|
|
121
|
+
await webhooks.remove(gate.auth.workspaceId, c.req.valid('param').webhookId);
|
|
77
122
|
return c.body(null, 204);
|
|
78
123
|
});
|
|
79
124
|
return app;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicNotificationWebhookController.js","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicNotificationWebhookController.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,oCAAoC,EACpC,oCAAoC,GACrC,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEtD,sEAAsE;AACtE,kGAAkG;AAClG,mBAAmB;AACnB,EAAE;AACF,gGAAgG;AAChG,iGAAiG;AACjG,uFAAuF;AACvF,kGAAkG;AAClG,iGAAiG;AACjG,gGAAgG;AAChG,EAAE;AACF,sCAAsC;AACtC,EAAE;AACF,mGAAmG;AACnG,iGAAiG;AACjG,6FAA6F;AAC7F,4FAA4F;AAC5F,mGAAmG;AACnG,iCAAiC;AACjC,kGAAkG;AAClG,iGAAiG;AACjG,
|
|
1
|
+
{"version":3,"file":"PublicNotificationWebhookController.js","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicNotificationWebhookController.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,4CAA4C,EAC5C,uCAAuC,EACvC,yCAAyC,EACzC,oCAAoC,EACpC,sCAAsC,EACtC,yCAAyC,EACzC,oCAAoC,GACrC,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEtD,sEAAsE;AACtE,kGAAkG;AAClG,mBAAmB;AACnB,EAAE;AACF,gGAAgG;AAChG,iGAAiG;AACjG,uFAAuF;AACvF,kGAAkG;AAClG,iGAAiG;AACjG,gGAAgG;AAChG,EAAE;AACF,sCAAsC;AACtC,EAAE;AACF,mGAAmG;AACnG,iGAAiG;AACjG,6FAA6F;AAC7F,4FAA4F;AAC5F,mGAAmG;AACnG,iCAAiC;AACjC,kGAAkG;AAClG,iGAAiG;AACjG,uFAAuF;AACvF,mGAAmG;AACnG,0DAA0D;AAC1D,gGAAgG;AAChG,+FAA+F;AAC/F,8FAA8F;AAC9F,qDAAqD;AACrD,EAAE;AACF,gGAAgG;AAChG,8FAA8F;AAC9F,8EAA8E;AAE9E,2FAA2F;AAC3F,SAAS,UAAU,CAAmB,CAAa;IACjD,OAAO,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,oBAAoB,IAAI,IAAI,CAAA;AACxD,CAAC;AAED,MAAM,WAAW,GAAG,CAAmB,CAAa,EAAE,EAAE,CACtD,CAAC,CAAC,IAAI,CACJ,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,0CAA0C,EAAE,EAAE,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