@sfdxy/anypoint-connect 0.16.2 → 0.17.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.
Files changed (141) hide show
  1. package/README.md +17 -6
  2. package/dist/analysis/audit-actors.d.ts +36 -0
  3. package/dist/analysis/audit-actors.d.ts.map +1 -0
  4. package/dist/analysis/audit-actors.js +93 -0
  5. package/dist/analysis/audit-actors.js.map +1 -0
  6. package/dist/analysis/credentials.d.ts +49 -0
  7. package/dist/analysis/credentials.d.ts.map +1 -0
  8. package/dist/analysis/credentials.js +118 -0
  9. package/dist/analysis/credentials.js.map +1 -0
  10. package/dist/analysis/parser.d.ts +5 -0
  11. package/dist/analysis/parser.d.ts.map +1 -1
  12. package/dist/analysis/parser.js +10 -1
  13. package/dist/analysis/parser.js.map +1 -1
  14. package/dist/api/AlertsApi.d.ts +138 -0
  15. package/dist/api/AlertsApi.d.ts.map +1 -0
  16. package/dist/api/AlertsApi.js +168 -0
  17. package/dist/api/AlertsApi.js.map +1 -0
  18. package/dist/api/LogsApi.d.ts +38 -5
  19. package/dist/api/LogsApi.d.ts.map +1 -1
  20. package/dist/api/LogsApi.js +70 -13
  21. package/dist/api/LogsApi.js.map +1 -1
  22. package/dist/cli.js +5 -1
  23. package/dist/cli.js.map +1 -1
  24. package/dist/client/AnypointClient.d.ts +2 -0
  25. package/dist/client/AnypointClient.d.ts.map +1 -1
  26. package/dist/client/AnypointClient.js +3 -0
  27. package/dist/client/AnypointClient.js.map +1 -1
  28. package/dist/commands/alerts.d.ts +16 -0
  29. package/dist/commands/alerts.d.ts.map +1 -0
  30. package/dist/commands/alerts.js +358 -0
  31. package/dist/commands/alerts.js.map +1 -0
  32. package/dist/commands/api.d.ts.map +1 -1
  33. package/dist/commands/api.js +8 -3
  34. package/dist/commands/api.js.map +1 -1
  35. package/dist/commands/app-change-cli.d.ts +5 -2
  36. package/dist/commands/app-change-cli.d.ts.map +1 -1
  37. package/dist/commands/app-change-cli.js +19 -5
  38. package/dist/commands/app-change-cli.js.map +1 -1
  39. package/dist/commands/apps.d.ts.map +1 -1
  40. package/dist/commands/apps.js +26 -21
  41. package/dist/commands/apps.js.map +1 -1
  42. package/dist/commands/deploy.d.ts.map +1 -1
  43. package/dist/commands/deploy.js +17 -6
  44. package/dist/commands/deploy.js.map +1 -1
  45. package/dist/commands/index.d.ts +1 -0
  46. package/dist/commands/index.d.ts.map +1 -1
  47. package/dist/commands/index.js +1 -0
  48. package/dist/commands/index.js.map +1 -1
  49. package/dist/commands/logs.d.ts +3 -2
  50. package/dist/commands/logs.d.ts.map +1 -1
  51. package/dist/commands/logs.js +65 -4
  52. package/dist/commands/logs.js.map +1 -1
  53. package/dist/config/profiles.d.ts +10 -2
  54. package/dist/config/profiles.d.ts.map +1 -1
  55. package/dist/config/profiles.js +52 -21
  56. package/dist/config/profiles.js.map +1 -1
  57. package/dist/index.d.ts +8 -1
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +7 -0
  60. package/dist/index.js.map +1 -1
  61. package/dist/mcp/server.d.ts.map +1 -1
  62. package/dist/mcp/server.js +3 -2
  63. package/dist/mcp/server.js.map +1 -1
  64. package/dist/mcp/tools/alerts.d.ts +82 -0
  65. package/dist/mcp/tools/alerts.d.ts.map +1 -0
  66. package/dist/mcp/tools/alerts.js +409 -0
  67. package/dist/mcp/tools/alerts.js.map +1 -0
  68. package/dist/mcp/tools/api-manager.d.ts.map +1 -1
  69. package/dist/mcp/tools/api-manager.js +6 -1
  70. package/dist/mcp/tools/api-manager.js.map +1 -1
  71. package/dist/mcp/tools/app-inputs.d.ts +4 -2
  72. package/dist/mcp/tools/app-inputs.d.ts.map +1 -1
  73. package/dist/mcp/tools/app-inputs.js +14 -2
  74. package/dist/mcp/tools/app-inputs.js.map +1 -1
  75. package/dist/mcp/tools/apps-deploy.d.ts.map +1 -1
  76. package/dist/mcp/tools/apps-deploy.js +48 -12
  77. package/dist/mcp/tools/apps-deploy.js.map +1 -1
  78. package/dist/mcp/tools/apps-lifecycle.d.ts.map +1 -1
  79. package/dist/mcp/tools/apps-lifecycle.js +27 -12
  80. package/dist/mcp/tools/apps-lifecycle.js.map +1 -1
  81. package/dist/mcp/tools/audit.d.ts.map +1 -1
  82. package/dist/mcp/tools/audit.js +17 -4
  83. package/dist/mcp/tools/audit.js.map +1 -1
  84. package/dist/mcp/tools/exchange.d.ts.map +1 -1
  85. package/dist/mcp/tools/exchange.js +38 -18
  86. package/dist/mcp/tools/exchange.js.map +1 -1
  87. package/dist/mcp/tools/identity.d.ts.map +1 -1
  88. package/dist/mcp/tools/identity.js +4 -1
  89. package/dist/mcp/tools/identity.js.map +1 -1
  90. package/dist/mcp/tools/index.d.ts +1 -0
  91. package/dist/mcp/tools/index.d.ts.map +1 -1
  92. package/dist/mcp/tools/index.js +1 -0
  93. package/dist/mcp/tools/index.js.map +1 -1
  94. package/dist/mcp/tools/logs.d.ts +5 -3
  95. package/dist/mcp/tools/logs.d.ts.map +1 -1
  96. package/dist/mcp/tools/logs.js +60 -11
  97. package/dist/mcp/tools/logs.js.map +1 -1
  98. package/dist/mcp/tools/profile.d.ts +17 -3
  99. package/dist/mcp/tools/profile.d.ts.map +1 -1
  100. package/dist/mcp/tools/profile.js +122 -10
  101. package/dist/mcp/tools/profile.js.map +1 -1
  102. package/dist/mcp/tools/shared.d.ts +22 -2
  103. package/dist/mcp/tools/shared.d.ts.map +1 -1
  104. package/dist/mcp/tools/shared.js +29 -4
  105. package/dist/mcp/tools/shared.js.map +1 -1
  106. package/dist/safety/artifact.d.ts +45 -0
  107. package/dist/safety/artifact.d.ts.map +1 -1
  108. package/dist/safety/artifact.js +109 -0
  109. package/dist/safety/artifact.js.map +1 -1
  110. package/dist/safety/deployment.d.ts.map +1 -1
  111. package/dist/safety/deployment.js +9 -8
  112. package/dist/safety/deployment.js.map +1 -1
  113. package/dist/safety/guards.d.ts +10 -0
  114. package/dist/safety/guards.d.ts.map +1 -1
  115. package/dist/safety/guards.js +16 -0
  116. package/dist/safety/guards.js.map +1 -1
  117. package/dist/safety/preapproval.d.ts +102 -0
  118. package/dist/safety/preapproval.d.ts.map +1 -0
  119. package/dist/safety/preapproval.js +251 -0
  120. package/dist/safety/preapproval.js.map +1 -0
  121. package/dist/safety/secrets.d.ts +7 -0
  122. package/dist/safety/secrets.d.ts.map +1 -1
  123. package/dist/safety/secrets.js +16 -0
  124. package/dist/safety/secrets.js.map +1 -1
  125. package/dist/workflows/alerts.d.ts +299 -0
  126. package/dist/workflows/alerts.d.ts.map +1 -0
  127. package/dist/workflows/alerts.js +595 -0
  128. package/dist/workflows/alerts.js.map +1 -0
  129. package/dist/workflows/app-change.d.ts +25 -1
  130. package/dist/workflows/app-change.d.ts.map +1 -1
  131. package/dist/workflows/app-change.js +22 -1
  132. package/dist/workflows/app-change.js.map +1 -1
  133. package/dist/workflows/artifact-verification.d.ts +52 -0
  134. package/dist/workflows/artifact-verification.d.ts.map +1 -0
  135. package/dist/workflows/artifact-verification.js +85 -0
  136. package/dist/workflows/artifact-verification.js.map +1 -0
  137. package/dist/workflows/jar-deployment.d.ts +36 -10
  138. package/dist/workflows/jar-deployment.d.ts.map +1 -1
  139. package/dist/workflows/jar-deployment.js +40 -12
  140. package/dist/workflows/jar-deployment.js.map +1 -1
  141. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="docs/assets/logo.svg" alt="Anypoint Connect — CLI and MCP toolkit for Anypoint Platform" width="640" />
2
+ <img src="docs/assets/logo.svg" alt="Anypoint Connect: CLI and MCP toolkit for Anypoint Platform, with production safeguards" width="640" />
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <strong>Operate Anypoint Platform from a CLI, an MCP client, or JavaScript—with guarded mutations and one shared authentication layer.</strong>
12
+ <strong>Operate Anypoint Platform from a CLI, an MCP client, or JavaScript, with guarded mutations and one shared authentication layer.</strong>
13
13
  </p>
14
14
 
15
15
  <p align="center">
@@ -65,12 +65,21 @@ release does not support the `client_credentials` grant, and its encrypted token
65
65
  | --- | --- |
66
66
  | Applications | Status with a start-up-aware phase, deployment spec, resources, cross-environment comparison, publish and deploy a JAR, one-call `update_app` (version, runtime, settings and update strategy, in place or stop-then-start), runtime catalogs with retired-runtime refusal, asset naming conventions, rollback, restart, scale, stop, start, delete, and a check of what runs against a repo or JAR |
67
67
  | Settings | Add, change, remove and move properties; secret values read from project files or environment variables; secret-looking plain values masked and flagged |
68
- | Logs | Tail, search over message, logger and stack trace, download with filters, summaries and file output, error clustering with context, recurring patterns, log health statistics |
68
+ | Logs | Tail, search over message, logger and stack trace, download with filters, summaries and file output, error clustering with context, recurring patterns, log health statistics, counts of lines that carry session or bearer credentials (never the values) |
69
69
  | Monitoring | Traffic, failures, and p50–p99 latency per app, worker, or route; heap, old-generation pressure, GC, CPU, and RAM per worker; time series from 1-minute to 1-day buckets; freeform AMQL |
70
+ | Alerts | List, create, change, enable, disable and delete Anypoint Monitoring metric alerts on apps and API instances, recipients masked by default; read Runtime Manager event alerts (undocumented API, see [Alerts](https://avinava.github.io/anypoint-connect/alerts/)) |
70
71
  | Exchange | Search, asset details, spec download, application JAR publication |
71
72
  | API Manager and Governance | Instances, policies, SLA tiers, alerts, contracts, client applications with masked credentials, smoke tests with the client's credentials, governance rulesets and conformance |
72
73
  | Design Center | Projects, branches, file reads, preview-then-apply file sync, verified Exchange publication |
73
- | Platform services | Environments, entitlements, audit log, Anypoint MQ, Object Store v2 |
74
+ | Platform services | Environments, entitlements, audit log with actor classes (platform patch, replica, infrastructure, or user and pipeline), Anypoint MQ, Object Store v2 |
75
+
76
+ New in 0.17:
77
+
78
+ - Production deploys through these tools take only jars whose mule-build marker (`META-INF/mule-build/build-info.json`) says production deployable, checked on the Exchange artifact: [build markers gate production](https://avinava.github.io/anypoint-connect/safety/#build-markers-gate-production)
79
+ - `scan_logs_for_credentials`: [check logs for leaked credentials](https://avinava.github.io/anypoint-connect/recipes/#check-logs-for-leaked-credentials)
80
+ - `get_audit_log` actor classes: [find who changed an app](https://avinava.github.io/anypoint-connect/recipes/#find-who-changed-an-app)
81
+ - Alert management: `list_alerts`, `get_alert`, `create_alert`, `update_alert`, `set_alert_enabled`, `delete_alert` and `anc alerts`: [alerts](https://avinava.github.io/anypoint-connect/alerts/)
82
+ - `set_production_preapproval`, stored per organization and environment outside the repository: [production pre-approval](https://avinava.github.io/anypoint-connect/safety/#production-pre-approval)
74
83
 
75
84
  New in 0.16, each with a recipe:
76
85
 
@@ -97,7 +106,7 @@ OAuth tokens; it sends tool calls to the local server that owns the session.
97
106
  "mcpServers": {
98
107
  "anypoint-connect": {
99
108
  "command": "npx",
100
- "args": ["-y", "@sfdxy/anypoint-connect@0.16.2", "mcp"]
109
+ "args": ["-y", "@sfdxy/anypoint-connect@0.17.0", "mcp"]
101
110
  }
102
111
  }
103
112
  }
@@ -119,7 +128,9 @@ Preview a deployment of target/sample-orders-api-1.3.0-mule-application.jar to S
119
128
  ## Safety
120
129
 
121
130
  Every MCP write tool returns a preview first and changes nothing until it is called again with
122
- `confirm: true`; in production it also needs `confirmProduction: true`. `anc deploy --dry-run` and
131
+ `confirm: true`; in production it also needs `confirmProduction: true`, unless you pre-approved that tool
132
+ for that organization and environment in your user-level settings. Production deploys made through these
133
+ tools check the artifact's build marker and refuse a jar not marked production deployable. `anc deploy --dry-run` and
123
134
  `anc apps update --dry-run` print the same plan.
124
135
  Publishing binds the JAR's SHA-256. A change to an existing app is one update that carries only what you
125
136
  asked to change, with the runtime checked against the target first. Secret values come from project files
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Audit log actor classification
3
+ * Tells platform-initiated audit entries (staff patches, replica moves, infrastructure patches)
4
+ * apart from changes made by a user or a pipeline, so "who changed this app?" is not answered with
5
+ * a platform maintenance event. Every rule lives in ACTOR_RULES; the first match wins.
6
+ *
7
+ * Every platform-* class requires a recognized platform identity: a staff or service user name, or
8
+ * the platform patcher's client name. An entry with no user and an unrecognized client (a connected
9
+ * app, a pipeline) stays user-or-pipeline. There is no caller-supplied override: a client ID alone
10
+ * never makes an entry "platform".
11
+ */
12
+ import type { AuditLogEntry } from '../api/AuditLogApi.js';
13
+ export declare const ACTOR_CLASSES: readonly ["platform-patch", "platform-replica", "platform-infrastructure", "user-or-pipeline"];
14
+ export type ActorClass = (typeof ACTOR_CLASSES)[number];
15
+ export interface ActorRule {
16
+ id: string;
17
+ actorClass: Exclude<ActorClass, 'user-or-pipeline'>;
18
+ description: string;
19
+ matches(entry: AuditLogEntry): boolean;
20
+ }
21
+ /** Whether the actor is a recognized platform staff or service identity. */
22
+ export declare function isPlatformIdentity(entry: AuditLogEntry): boolean;
23
+ /** The matching rules, in order. Keep every classification decision here. */
24
+ export declare const ACTOR_RULES: readonly ActorRule[];
25
+ export interface ActorClassification {
26
+ actorClass: ActorClass;
27
+ /** The rule that matched, or "default" for user-or-pipeline. */
28
+ actorRule: string;
29
+ }
30
+ export declare function classifyAuditActor(entry: AuditLogEntry): ActorClassification;
31
+ /** Classify entries and count them by class (every class present, zeros included). */
32
+ export declare function classifyAuditEntries(entries: AuditLogEntry[]): {
33
+ entries: Array<AuditLogEntry & ActorClassification>;
34
+ byClass: Record<ActorClass, number>;
35
+ };
36
+ //# sourceMappingURL=audit-actors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-actors.d.ts","sourceRoot":"","sources":["../../src/analysis/audit-actors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,eAAO,MAAM,aAAa,gGAKhB,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;CAC1C;AAmBD,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAGhE;AAED,6EAA6E;AAC7E,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAwC3C,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,mBAAmB,CAK5E;AAED,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG;IAC5D,OAAO,EAAE,KAAK,CAAC,aAAa,GAAG,mBAAmB,CAAC,CAAC;IACpD,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;CACvC,CAQA"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Audit log actor classification
3
+ * Tells platform-initiated audit entries (staff patches, replica moves, infrastructure patches)
4
+ * apart from changes made by a user or a pipeline, so "who changed this app?" is not answered with
5
+ * a platform maintenance event. Every rule lives in ACTOR_RULES; the first match wins.
6
+ *
7
+ * Every platform-* class requires a recognized platform identity: a staff or service user name, or
8
+ * the platform patcher's client name. An entry with no user and an unrecognized client (a connected
9
+ * app, a pipeline) stays user-or-pipeline. There is no caller-supplied override: a client ID alone
10
+ * never makes an entry "platform".
11
+ */
12
+ export const ACTOR_CLASSES = [
13
+ 'platform-patch',
14
+ 'platform-replica',
15
+ 'platform-infrastructure',
16
+ 'user-or-pipeline',
17
+ ];
18
+ /** User names the platform uses for its own staff and service identities. */
19
+ const PLATFORM_USER = /\b(anypoint|mulesoft|cloudhub|platform)\s+(staff|support|operations|ops|system|automation)\b/i;
20
+ /** Client names of the platform's automatic patcher. */
21
+ const PATCHER_CLIENT = /\b(auto(matic)?[\s_-]?patch(er|ing)?|patch(ing)?[\s_-]?(service|automation|bot))\b/i;
22
+ const MODIFY_ACTION = /^(modify|update|patch)$/i;
23
+ const REPLICA = /\breplicas?\b/i;
24
+ /** Whole words only, so "Remove" is not "move". */
25
+ const REPLICA_MOVE = /\b(restart(ed)?|move[ds]?|relocated?|rescheduled?|migrated?|evicted?|recreated?|replaced?|recovered?)\b/i;
26
+ const INFRA_PATCH_ACTION = /^patch\s*(fabric|network)\b/i;
27
+ const PATCH_ACTION = /\bpatch(ed)?\b/i;
28
+ const INFRA_OBJECT = /\b(fabric|network)\b/i;
29
+ function objectTypes(entry) {
30
+ return (entry.objects ?? []).map((o) => o.objectType ?? '');
31
+ }
32
+ /** Whether the actor is a recognized platform staff or service identity. */
33
+ export function isPlatformIdentity(entry) {
34
+ if (entry.userName && PLATFORM_USER.test(entry.userName))
35
+ return true;
36
+ return Boolean(entry.clientName && PATCHER_CLIENT.test(entry.clientName));
37
+ }
38
+ /** The matching rules, in order. Keep every classification decision here. */
39
+ export const ACTOR_RULES = [
40
+ {
41
+ id: 'infrastructure-patch-action',
42
+ actorClass: 'platform-infrastructure',
43
+ description: 'Patch Fabric or Patch Network by a platform identity',
44
+ matches: (entry) => INFRA_PATCH_ACTION.test(entry.action) && isPlatformIdentity(entry),
45
+ },
46
+ {
47
+ id: 'infrastructure-patch-object',
48
+ actorClass: 'platform-infrastructure',
49
+ description: 'A patch action on a fabric or network object by a platform identity',
50
+ matches: (entry) => PATCH_ACTION.test(entry.action) &&
51
+ objectTypes(entry).some((t) => INFRA_OBJECT.test(t)) &&
52
+ isPlatformIdentity(entry),
53
+ },
54
+ {
55
+ id: 'replica-restarted-or-moved',
56
+ actorClass: 'platform-replica',
57
+ description: 'A replica restarted, moved or rescheduled by a platform identity',
58
+ matches: (entry) => (REPLICA.test(entry.action) || objectTypes(entry).some((t) => REPLICA.test(t))) &&
59
+ REPLICA_MOVE.test(entry.action) &&
60
+ isPlatformIdentity(entry),
61
+ },
62
+ {
63
+ id: 'platform-modify-application',
64
+ actorClass: 'platform-patch',
65
+ description: 'Modify on an Application by a platform staff or patcher identity',
66
+ matches: (entry) => MODIFY_ACTION.test(entry.action) &&
67
+ objectTypes(entry).some((t) => /^application$/i.test(t)) &&
68
+ isPlatformIdentity(entry),
69
+ },
70
+ {
71
+ id: 'platform-identity',
72
+ actorClass: 'platform-patch',
73
+ description: 'Any other action by a platform staff or patcher identity',
74
+ matches: (entry) => isPlatformIdentity(entry),
75
+ },
76
+ ];
77
+ export function classifyAuditActor(entry) {
78
+ const rule = ACTOR_RULES.find((r) => r.matches(entry));
79
+ return rule
80
+ ? { actorClass: rule.actorClass, actorRule: rule.id }
81
+ : { actorClass: 'user-or-pipeline', actorRule: 'default' };
82
+ }
83
+ /** Classify entries and count them by class (every class present, zeros included). */
84
+ export function classifyAuditEntries(entries) {
85
+ const byClass = Object.fromEntries(ACTOR_CLASSES.map((c) => [c, 0]));
86
+ const classified = entries.map((entry) => {
87
+ const result = classifyAuditActor(entry);
88
+ byClass[result.actorClass]++;
89
+ return { ...entry, ...result };
90
+ });
91
+ return { entries: classified, byClass };
92
+ }
93
+ //# sourceMappingURL=audit-actors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-actors.js","sourceRoot":"","sources":["../../src/analysis/audit-actors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,gBAAgB;IAChB,kBAAkB;IAClB,yBAAyB;IACzB,kBAAkB;CACZ,CAAC;AAUX,6EAA6E;AAC7E,MAAM,aAAa,GAAG,+FAA+F,CAAC;AACtH,wDAAwD;AACxD,MAAM,cAAc,GAAG,qFAAqF,CAAC;AAC7G,MAAM,aAAa,GAAG,0BAA0B,CAAC;AACjD,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,mDAAmD;AACnD,MAAM,YAAY,GACd,0GAA0G,CAAC;AAC/G,MAAM,kBAAkB,GA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CAAC;AACnE,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,oBAAoB,CAAC,OAAwB;IAIzD,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAA+B,CAAC;IACnG,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Log Analysis - Credential markers
3
+ * Counts log lines that carry session or bearer credentials (Authorization headers, session IDs,
4
+ * OAuth token parameters, JWTs) per marker, per spec and per replica. Only counts leave this
5
+ * module: matching lines and values are never returned, so a scan is safe to show in a transcript.
6
+ */
7
+ import type { LogPart } from '../api/LogsApi.js';
8
+ export interface CredentialMarker {
9
+ id: string;
10
+ description: string;
11
+ pattern: RegExp;
12
+ }
13
+ /** Every marker the scan looks for. A line can count under more than one marker. */
14
+ export declare const CREDENTIAL_MARKERS: readonly CredentialMarker[];
15
+ export type MarkerCounts = Record<string, number>;
16
+ export interface ReplicaScan {
17
+ replica: string;
18
+ linesWithMarkers: number;
19
+ byMarker: MarkerCounts;
20
+ }
21
+ export interface SpecScan {
22
+ specId: string;
23
+ scannedLines: number;
24
+ linesWithMarkers: number;
25
+ byMarker: MarkerCounts;
26
+ byReplica: ReplicaScan[];
27
+ }
28
+ export interface CredentialScan {
29
+ scannedLines: number;
30
+ linesWithMarkers: number;
31
+ clean: boolean;
32
+ /** Every marker, zeros included. */
33
+ byMarker: MarkerCounts;
34
+ bySpec: SpecScan[];
35
+ }
36
+ /** Lines before the first entry header of a file have no replica. */
37
+ export declare const UNKNOWN_REPLICA = "(unknown)";
38
+ /** The ids of the markers a line carries. */
39
+ export declare function markersIn(line: string): string[];
40
+ /**
41
+ * Scan each spec's log text line by line. Continuation lines (stack traces, JSON Logger bodies,
42
+ * HTTP dumps) belong to the entry above them and share its time and replica. With a window, lines
43
+ * outside it are skipped, and so are lines before a file's first entry, whose time is unknown.
44
+ */
45
+ export declare function scanForCredentials(parts: LogPart[], window?: {
46
+ startTime?: number;
47
+ endTime?: number;
48
+ }): CredentialScan;
49
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/analysis/credentials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,EAAE,SAAS,gBAAgB,EAoCzD,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;CAC1B;AAED,MAAM,WAAW,QAAQ;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,oCAAoC;IACpC,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,qEAAqE;AACrE,eAAO,MAAM,eAAe,cAAc,CAAC;AAU3C,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,OAAO,EAAE,EAChB,MAAM,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACtD,cAAc,CAsDhB"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Log Analysis - Credential markers
3
+ * Counts log lines that carry session or bearer credentials (Authorization headers, session IDs,
4
+ * OAuth token parameters, JWTs) per marker, per spec and per replica. Only counts leave this
5
+ * module: matching lines and values are never returned, so a scan is safe to show in a transcript.
6
+ */
7
+ import { lineHeader } from './parser.js';
8
+ /** Every marker the scan looks for. A line can count under more than one marker. */
9
+ export const CREDENTIAL_MARKERS = [
10
+ {
11
+ id: 'authorization-bearer',
12
+ description: 'Authorization header (or field) with a Bearer value',
13
+ pattern: /authorization["']?\s*[:=]\s*["']?bearer\s+\S/i,
14
+ },
15
+ {
16
+ id: 'bearer-token',
17
+ description: 'Bearer followed by a token-shaped value',
18
+ pattern: /\bbearer\s+[A-Za-z0-9._~+/-]{16,}/i,
19
+ },
20
+ {
21
+ id: 'session-id',
22
+ description: 'sessionId or session_id with a value (field, parameter or XML element)',
23
+ pattern: /\bsession_?id["']?\s*[:=]\s*["']?[A-Za-z0-9!._-]{8,}|<(?:\w+:)?sessionId>\s*[^<\s]{8,}/i,
24
+ },
25
+ {
26
+ id: 'sforce-session',
27
+ description: 'Sforce-Session header with a value',
28
+ pattern: /\bsforce-session["']?\s*[:=]\s*["']?[A-Za-z0-9!._-]{8,}/i,
29
+ },
30
+ {
31
+ id: 'salesforce-session-id',
32
+ description: 'Salesforce session ID shape (org ID, "!", token)',
33
+ pattern: /\b00D[A-Za-z0-9]{12,15}![A-Za-z0-9._]{20,}/,
34
+ },
35
+ {
36
+ id: 'oauth-token-param',
37
+ description: 'access_token, refresh_token or id_token with a value',
38
+ pattern: /\b(?:access|refresh|id)_token["']?\s*[:=]\s*["']?[^\s"'&,;]{8,}/i,
39
+ },
40
+ {
41
+ id: 'jwt',
42
+ description: 'JWT-shaped value (base64url header.payload.signature)',
43
+ pattern: /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]*/,
44
+ },
45
+ ];
46
+ /** Lines before the first entry header of a file have no replica. */
47
+ export const UNKNOWN_REPLICA = '(unknown)';
48
+ function zeroCounts() {
49
+ return Object.fromEntries(CREDENTIAL_MARKERS.map((m) => [m.id, 0]));
50
+ }
51
+ function nonZero(counts) {
52
+ return Object.fromEntries(Object.entries(counts).filter(([, n]) => n > 0));
53
+ }
54
+ /** The ids of the markers a line carries. */
55
+ export function markersIn(line) {
56
+ return CREDENTIAL_MARKERS.filter((m) => m.pattern.test(line)).map((m) => m.id);
57
+ }
58
+ /**
59
+ * Scan each spec's log text line by line. Continuation lines (stack traces, JSON Logger bodies,
60
+ * HTTP dumps) belong to the entry above them and share its time and replica. With a window, lines
61
+ * outside it are skipped, and so are lines before a file's first entry, whose time is unknown.
62
+ */
63
+ export function scanForCredentials(parts, window = {}) {
64
+ const total = zeroCounts();
65
+ const bounded = window.startTime !== undefined || window.endTime !== undefined;
66
+ let scannedLines = 0;
67
+ let linesWithMarkers = 0;
68
+ const bySpec = [];
69
+ for (const part of parts) {
70
+ const spec = { scannedLines: 0, linesWithMarkers: 0, byMarker: zeroCounts() };
71
+ const replicas = new Map();
72
+ let current = null;
73
+ for (const line of part.text.split(/\r?\n/)) {
74
+ if (!line.trim())
75
+ continue;
76
+ current = lineHeader(line) ?? current;
77
+ if (bounded) {
78
+ if (!current)
79
+ continue;
80
+ if (window.startTime !== undefined && current.timestamp < window.startTime)
81
+ continue;
82
+ if (window.endTime !== undefined && current.timestamp > window.endTime)
83
+ continue;
84
+ }
85
+ spec.scannedLines++;
86
+ const found = markersIn(line);
87
+ if (found.length === 0)
88
+ continue;
89
+ const replicaId = current?.instanceId || UNKNOWN_REPLICA;
90
+ const replica = replicas.get(replicaId) ?? { linesWithMarkers: 0, byMarker: zeroCounts() };
91
+ replicas.set(replicaId, replica);
92
+ spec.linesWithMarkers++;
93
+ replica.linesWithMarkers++;
94
+ for (const id of found) {
95
+ spec.byMarker[id]++;
96
+ replica.byMarker[id]++;
97
+ total[id]++;
98
+ }
99
+ }
100
+ scannedLines += spec.scannedLines;
101
+ linesWithMarkers += spec.linesWithMarkers;
102
+ bySpec.push({
103
+ specId: part.specId,
104
+ scannedLines: spec.scannedLines,
105
+ linesWithMarkers: spec.linesWithMarkers,
106
+ byMarker: nonZero(spec.byMarker),
107
+ byReplica: [...replicas.entries()]
108
+ .map(([replica, r]) => ({
109
+ replica,
110
+ linesWithMarkers: r.linesWithMarkers,
111
+ byMarker: nonZero(r.byMarker),
112
+ }))
113
+ .sort((a, b) => b.linesWithMarkers - a.linesWithMarkers || a.replica.localeCompare(b.replica)),
114
+ });
115
+ }
116
+ return { scannedLines, linesWithMarkers, clean: linesWithMarkers === 0, byMarker: total, bySpec };
117
+ }
118
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/analysis/credentials.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQzC,oFAAoF;AACpF,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC3D;QACI,EAAE,EAAE,sBAAsB;QAC1B,WAAW,EAAE,qDAAqD;QAClE,OAAO,EAAE,+CAA+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,CAAC,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;SACrG,CAAC,CAAC;IACP,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACtG,CAAC"}
@@ -4,6 +4,11 @@
4
4
  * Handles: JSON Logger blocks, stack traces, HTTP dumps, continuation lines.
5
5
  */
6
6
  import type { EnrichedLogEntry } from './types.js';
7
+ /** The time and replica of a line that starts an entry, or null for a continuation line. */
8
+ export declare function lineHeader(line: string): {
9
+ timestamp: number;
10
+ instanceId: string;
11
+ } | null;
7
12
  /**
8
13
  * Parse raw log text into enriched entries, joining multi-line blocks.
9
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/analysis/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAuCnD;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAkFhE"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/analysis/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA4CnD,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAGzF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAkFhE"}
@@ -26,6 +26,15 @@ function parseHeader(line) {
26
26
  }
27
27
  return null;
28
28
  }
29
+ /** Epoch milliseconds of a header timestamp (accepts +hhmm offsets). */
30
+ function headerTime(timestamp) {
31
+ return new Date(timestamp.replace(/([+-]\d{2})(\d{2})$/, '$1:$2')).getTime();
32
+ }
33
+ /** The time and replica of a line that starts an entry, or null for a continuation line. */
34
+ export function lineHeader(line) {
35
+ const loose = line.match(LOOSE_LINE_REGEX);
36
+ return loose ? { timestamp: headerTime(loose[1]), instanceId: loose[3] } : null;
37
+ }
29
38
  /**
30
39
  * Parse raw log text into enriched entries, joining multi-line blocks.
31
40
  */
@@ -50,7 +59,7 @@ export function parseRawLogs(rawText) {
50
59
  entries.push(current);
51
60
  }
52
61
  current = {
53
- timestamp: new Date(header.timestamp.replace(/([+-]\d{2})(\d{2})$/, '$1:$2')).getTime(),
62
+ timestamp: headerTime(header.timestamp),
54
63
  priority: header.level,
55
64
  instanceId: header.instanceId,
56
65
  loggerName: header.loggerName,
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/analysis/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,gFAAgF;AAChF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,yGAAyG,CAAC;AAE1I;;;GAGG;AACH,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,qDAAqD,CAAC,CAAC;AAEnH,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,UAAU,CAAC,CAAC;AAY1E,gFAAgF;AAChF,SAAS,WAAW,CAAC,IAAY;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACxC,IAAI,IAAI,EAAE,CAAC;QACP,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,IA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alerts.
5
+ *
6
+ * These endpoints are not publicly documented. Shapes follow observed responses and may change; a
7
+ * family that answers 404 or 403 on list is reported as unsupported (AlertsUnsupportedError) rather
8
+ * than as "no alerts".
9
+ */
10
+ import type { HttpClient } from '../client/HttpClient.js';
11
+ export declare const ALERT_METRIC_IDS: readonly ["cpu_utilization", "memory_utilization", "thread_count", "message_count", "message_error_count", "message_response_time", "api_request_count", "api_response_time", "api_response_code_count", "api_policy_violation_count"];
12
+ export type AlertMetricId = (typeof ALERT_METRIC_IDS)[number];
13
+ export declare const ALERT_OPERATORS: readonly ["GREATER_THAN", "LESS_THAN", "GREATER_THAN_EQUAL_TO", "LESS_THAN_EQUAL_TO", "EQUALS"];
14
+ export type AlertOperator = (typeof ALERT_OPERATORS)[number];
15
+ export type AlertStatus = 'PENDING' | 'ACTIVE' | 'DELETED';
16
+ export type AlertDeploymentType = 'CLOUDHUB' | 'CLOUDHUB2' | 'RTF' | 'HYBRID';
17
+ export type AlertEntityType = 'application' | 'api' | 'server';
18
+ export interface AlertSettings {
19
+ metricId: string;
20
+ aggregationFunction: 'AVG' | 'SUM';
21
+ evaluationOperator: AlertOperator;
22
+ aggregationInterval: string;
23
+ /** A fraction (0..1) for percent metrics. */
24
+ threshold: number;
25
+ evaluationInterval: string;
26
+ numWindows?: number;
27
+ }
28
+ export interface AlertApiFilter {
29
+ property: 'POLICY' | 'RESPONSE_CODE';
30
+ operator: 'IN';
31
+ values: string[];
32
+ }
33
+ export interface AlertEntity {
34
+ entityType: AlertEntityType;
35
+ subOrgId?: string;
36
+ masterOrgId?: string;
37
+ environmentId: string;
38
+ environmentName?: string;
39
+ appId?: string;
40
+ clusterId?: string;
41
+ deploymentType?: AlertDeploymentType;
42
+ deploymentId?: string;
43
+ flowId?: string;
44
+ endpoint?: string;
45
+ apiName?: string;
46
+ apiInstanceId?: string;
47
+ filters?: AlertApiFilter[];
48
+ entityName?: string;
49
+ }
50
+ export interface AlertNotification {
51
+ [field: string]: unknown;
52
+ type: 'EMAIL' | 'SLACK';
53
+ recipients?: string[];
54
+ subject?: string;
55
+ messageTemplate?: string;
56
+ channelId?: string;
57
+ carrierId?: string;
58
+ }
59
+ export interface MonitoringAlert {
60
+ id: string;
61
+ name: string;
62
+ alertStatus?: AlertStatus;
63
+ severity: number;
64
+ enabled: boolean;
65
+ alertOn?: string;
66
+ settings: AlertSettings;
67
+ entity: AlertEntity;
68
+ tags?: Record<string, unknown>;
69
+ state?: {
70
+ currentState?: 'OK' | 'ALERTING' | string;
71
+ };
72
+ /** The read side of `notifications`. */
73
+ notificationTemplates?: AlertNotification[];
74
+ notifications?: AlertNotification[];
75
+ createdAt?: string;
76
+ updatedAt?: string;
77
+ }
78
+ /** The body for create (no id) and update (full body with id); notifications are written as `notifications`. */
79
+ export interface AlertWriteBody {
80
+ /** Writable fields of the existing alert this tool does not model (tags, alertOn, ...) are resent as is. */
81
+ [field: string]: unknown;
82
+ id?: string;
83
+ name: string;
84
+ severity: number;
85
+ enabled: boolean;
86
+ settings: AlertSettings;
87
+ entity: AlertEntity;
88
+ notifications: AlertNotification[];
89
+ }
90
+ /** A Runtime Manager event alert, as returned (best effort; the shape is not documented). */
91
+ export type RuntimeManagerAlert = Record<string, unknown> & {
92
+ id?: string;
93
+ name?: string;
94
+ };
95
+ export declare class AlertsUnsupportedError extends Error {
96
+ readonly family: string;
97
+ readonly status: number;
98
+ constructor(family: string, status: number);
99
+ }
100
+ export declare class AlertPendingError extends Error {
101
+ constructor(id: string);
102
+ }
103
+ /**
104
+ * Map platform errors to messages that say what happened. Platform text is sanitized first: an alert
105
+ * error can echo recipients or tokens, and it ends up in MCP responses and CLI output.
106
+ */
107
+ export declare function alertError(error: unknown, id?: string): Error;
108
+ export declare class AlertsApi {
109
+ private readonly http;
110
+ constructor(http: HttpClient);
111
+ private url;
112
+ /** Every Monitoring alert of the organization, optionally narrowed by environment ID and exact name. */
113
+ list(orgId: string, filter?: {
114
+ environmentId?: string;
115
+ name?: string;
116
+ }): Promise<MonitoringAlert[]>;
117
+ /**
118
+ * Like {@link list}, and says whether the listing is complete. It is not when the page cap was
119
+ * reached with more pages left; callers must not infer that an alert is absent from such a listing.
120
+ */
121
+ listAll(orgId: string, filter?: {
122
+ environmentId?: string;
123
+ name?: string;
124
+ }): Promise<{
125
+ alerts: MonitoringAlert[];
126
+ complete: boolean;
127
+ }>;
128
+ /** One alert, or null when it does not exist (any more). */
129
+ get(orgId: string, id: string): Promise<MonitoringAlert | null>;
130
+ create(orgId: string, body: AlertWriteBody): Promise<MonitoringAlert | undefined>;
131
+ /** Replace an alert. The platform needs the full body; a partial one is rejected. */
132
+ update(orgId: string, id: string, body: AlertWriteBody): Promise<void>;
133
+ /** Request deletion. It is asynchronous: the alert can stay PENDING for a while before it is gone. */
134
+ delete(orgId: string, id: string): Promise<'accepted' | 'not-found'>;
135
+ /** Runtime Manager event alerts (deployment failed and similar) for one environment. Read only. */
136
+ listRuntimeManager(orgId: string, envId: string): Promise<RuntimeManagerAlert[]>;
137
+ }
138
+ //# sourceMappingURL=AlertsApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertsApi.d.ts","sourceRoot":"","sources":["../../src/api/AlertsApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,eAAO,MAAM,gBAAgB,wOAWnB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,eAAe,iGAMlB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC9E,MAAM,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