@intentius/sql-yodeler 0.6.0 → 0.8.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 (92) hide show
  1. package/README.md +7 -7
  2. package/dist/apply-steps/index.d.ts +73 -21
  3. package/dist/apply-steps/index.js +171 -49
  4. package/dist/apply-steps/index.js.map +1 -1
  5. package/dist/approval-mode/index.d.ts +7 -0
  6. package/dist/approval-mode/index.js +10 -3
  7. package/dist/approval-mode/index.js.map +1 -1
  8. package/dist/chant/apply.d.ts +15 -3
  9. package/dist/chant/apply.js +22 -3
  10. package/dist/chant/apply.js.map +1 -1
  11. package/dist/ci/render.d.ts +7 -2
  12. package/dist/ci/render.js +13 -3
  13. package/dist/ci/render.js.map +1 -1
  14. package/dist/commands/apply.d.ts +2 -0
  15. package/dist/commands/apply.js +196 -87
  16. package/dist/commands/apply.js.map +1 -1
  17. package/dist/commands/approve.d.ts +51 -1
  18. package/dist/commands/approve.js +177 -14
  19. package/dist/commands/approve.js.map +1 -1
  20. package/dist/commands/cleanup.d.ts +1 -0
  21. package/dist/commands/cleanup.js +11 -7
  22. package/dist/commands/cleanup.js.map +1 -1
  23. package/dist/commands/create.d.ts +31 -0
  24. package/dist/commands/create.js +171 -0
  25. package/dist/commands/create.js.map +1 -0
  26. package/dist/commands/drift.js +8 -8
  27. package/dist/commands/drift.js.map +1 -1
  28. package/dist/commands/emulator.d.ts +17 -0
  29. package/dist/commands/emulator.js +78 -0
  30. package/dist/commands/emulator.js.map +1 -0
  31. package/dist/commands/index.js +4 -0
  32. package/dist/commands/index.js.map +1 -1
  33. package/dist/commands/init.js +7 -5
  34. package/dist/commands/init.js.map +1 -1
  35. package/dist/commands/override.js +46 -22
  36. package/dist/commands/override.js.map +1 -1
  37. package/dist/commands/plan.js +20 -20
  38. package/dist/commands/plan.js.map +1 -1
  39. package/dist/commands/revert.js +10 -7
  40. package/dist/commands/revert.js.map +1 -1
  41. package/dist/config/define.d.ts +5 -5
  42. package/dist/mcp/tools.d.ts +2 -2
  43. package/dist/mcp/tools.js +7 -5
  44. package/dist/mcp/tools.js.map +1 -1
  45. package/dist/notify/index.d.ts +30 -95
  46. package/dist/notify/index.js +50 -153
  47. package/dist/notify/index.js.map +1 -1
  48. package/dist/notify/verify.d.ts +17 -31
  49. package/dist/notify/verify.js +16 -47
  50. package/dist/notify/verify.js.map +1 -1
  51. package/dist/pr/forge.d.ts +33 -38
  52. package/dist/pr/forge.js +74 -97
  53. package/dist/pr/forge.js.map +1 -1
  54. package/dist/pr/issue.d.ts +16 -33
  55. package/dist/pr/issue.js +17 -88
  56. package/dist/pr/issue.js.map +1 -1
  57. package/dist/pr/model.d.ts +5 -3
  58. package/dist/pr/model.js +12 -6
  59. package/dist/pr/model.js.map +1 -1
  60. package/dist/pr/render.js +7 -6
  61. package/dist/pr/render.js.map +1 -1
  62. package/dist/pr/tenants.js +2 -2
  63. package/dist/pr/tenants.js.map +1 -1
  64. package/dist/release/index.d.ts +63 -0
  65. package/dist/release/index.js +122 -0
  66. package/dist/release/index.js.map +1 -0
  67. package/dist/report/audit.d.ts +18 -19
  68. package/dist/report/audit.js +57 -27
  69. package/dist/report/audit.js.map +1 -1
  70. package/dist/report/model.js +18 -5
  71. package/dist/report/model.js.map +1 -1
  72. package/dist/tenants/wave.d.ts +9 -3
  73. package/dist/tenants/wave.js +4 -5
  74. package/dist/tenants/wave.js.map +1 -1
  75. package/dist/versioned/approval.js +1 -1
  76. package/dist/versioned/approval.js.map +1 -1
  77. package/dist/versioned/policy.d.ts +44 -24
  78. package/dist/versioned/policy.js +70 -37
  79. package/dist/versioned/policy.js.map +1 -1
  80. package/dist/waves/index.d.ts +9 -13
  81. package/dist/waves/index.js +12 -36
  82. package/dist/waves/index.js.map +1 -1
  83. package/package.json +7 -7
  84. package/schemas/apply.schema.json +2 -0
  85. package/schemas/cleanup.schema.json +1 -0
  86. package/schemas/event.schema.json +218 -25
  87. package/schemas/init.schema.json +1 -0
  88. package/schemas/plan.schema.json +3 -1
  89. package/schemas/revert.schema.json +2 -1
  90. package/dist/pr/comment.d.ts +0 -32
  91. package/dist/pr/comment.js +0 -99
  92. package/dist/pr/comment.js.map +0 -1
@@ -125,6 +125,7 @@
125
125
  "description": "gated: the command a person runs to approve. An agent prints it and never runs it.",
126
126
  "type": "string"
127
127
  },
128
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
128
129
  "gatePlanDigest": {
129
130
  "type": "string"
130
131
  },
@@ -289,6 +290,7 @@
289
290
  "description": "gated: the command a person runs to approve. An agent prints it and never runs it.",
290
291
  "type": "string"
291
292
  },
293
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
292
294
  "planDigest": {
293
295
  "type": "string"
294
296
  },
@@ -35,6 +35,7 @@
35
35
  "due": { "type": "integer", "minimum": 0 },
36
36
  "planDigest": { "description": "When something is due: the digest an approval of the drop binds.", "type": "string" },
37
37
  "approve": { "description": "When something is due and not approved: the command that approves it.", "type": "string" },
38
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
38
39
  "dropped": { "$ref": "common.schema.json#/$defs/stringList" }
39
40
  }
40
41
  }
@@ -1,36 +1,229 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://intentius.io/sql-yodeler/schemas/v1/event.schema.json",
4
- "title": "a yodel webhook event",
5
- "description": "Version 1. The body yodel apply, yodel plan and yodel drift post to the webhook yodel.config.ts notify names, signed with HMAC-SHA256 over '<x-yodel-timestamp>.<body>' in the x-yodel-signature header. Within a version, fields are only added; a receiver ignores fields it does not know.",
4
+ "title": "a yodel webhook event (chant.notify/v1)",
5
+ "description": "Version 1. The body yodel apply, yodel plan and yodel drift post to the webhook yodel.config.ts notify names: chant's chant.notify/v1 event (https://intentius.io/chant/schemas/notify/v1/notify.schema.json), with source sql-yodeler and the command that sent it in detail.command. Signed with HMAC-SHA256 over '<x-yodel-timestamp>.<body>' in the x-yodel-signature header. A field is only ever added within a version; a receiver ignores fields it does not know.",
6
6
  "type": "object",
7
- "additionalProperties": false,
8
- "required": ["version", "id", "event", "at", "environment", "command", "status", "summary", "migrations"],
7
+ "required": [
8
+ "schema",
9
+ "id",
10
+ "event",
11
+ "at",
12
+ "source",
13
+ "project",
14
+ "summary",
15
+ "targets",
16
+ "environment",
17
+ "detail"
18
+ ],
9
19
  "properties": {
10
- "version": { "const": 1 },
11
- "id": { "type": "string", "description": "Unique per event; also the x-yodel-delivery header." },
12
- "event": { "enum": ["waiting", "refused", "failed", "drift"] },
13
- "at": { "type": "string", "format": "date-time" },
14
- "environment": { "type": "string" },
15
- "command": { "enum": ["apply", "plan", "drift"] },
16
- "status": { "type": "string", "description": "The command's own word for the outcome: gated, refused, denied, failed, incomplete, drifted." },
17
- "summary": { "type": "string" },
18
- "migrations": { "type": "array", "items": { "type": "string" }, "description": "The pending migrations, for apply and plan." },
19
- "digest": { "type": "string", "description": "The plan digest the run computed." },
20
- "approve": { "type": "string", "description": "On waiting: the command that approves the plan." },
21
- "reason": { "type": "string" },
20
+ "schema": {
21
+ "const": "chant.notify/v1"
22
+ },
23
+ "id": {
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "description": "The same for every send of one event about one digest (else drift fingerprint, else commit), so a receiver can drop a repeat; random when there is none. The delivery header carries it too."
27
+ },
28
+ "event": {
29
+ "enum": [
30
+ "waiting",
31
+ "refused",
32
+ "failed",
33
+ "drift"
34
+ ]
35
+ },
36
+ "at": {
37
+ "type": "string",
38
+ "description": "When it was sent, ISO 8601 UTC."
39
+ },
40
+ "source": {
41
+ "const": "sql-yodeler"
42
+ },
43
+ "project": {
44
+ "type": "string",
45
+ "description": "What the run belongs to: the repository, or a name the product gives."
46
+ },
47
+ "summary": {
48
+ "type": "string",
49
+ "description": "One line a person can read."
50
+ },
51
+ "wave": {
52
+ "type": "object",
53
+ "required": [
54
+ "number"
55
+ ],
56
+ "properties": {
57
+ "number": {
58
+ "type": "integer",
59
+ "minimum": 1
60
+ },
61
+ "name": {
62
+ "type": "string"
63
+ },
64
+ "gate": {
65
+ "type": "string",
66
+ "description": "The gate the wave waits on."
67
+ }
68
+ }
69
+ },
70
+ "environment": {
71
+ "type": "string",
72
+ "description": "The environment the run is for."
73
+ },
74
+ "targets": {
75
+ "type": "array",
76
+ "items": {
77
+ "type": "string"
78
+ },
79
+ "description": "The migrations concerned: the pending ones for apply and plan; empty for drift."
80
+ },
81
+ "digest": {
82
+ "type": "string",
83
+ "description": "The plan digest an approval binds."
84
+ },
85
+ "approve": {
86
+ "type": "object",
87
+ "description": "On waiting: how a person approves it.",
88
+ "required": [
89
+ "command"
90
+ ],
91
+ "properties": {
92
+ "command": {
93
+ "type": "string",
94
+ "description": "The command to run, as the product prints it."
95
+ },
96
+ "chant": {
97
+ "type": "string",
98
+ "description": "chant's own command for the same approval, when the product's differs."
99
+ },
100
+ "review": {
101
+ "type": "object",
102
+ "description": "Under pr-review: the pull request whose approving review would approve it.",
103
+ "required": [
104
+ "pr",
105
+ "url"
106
+ ],
107
+ "properties": {
108
+ "pr": {
109
+ "type": "integer"
110
+ },
111
+ "url": {
112
+ "type": "string"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ "status": {
119
+ "type": "string",
120
+ "description": "The command's own word for the outcome: gated, refused, denied, failed, incomplete, drifted."
121
+ },
122
+ "reason": {
123
+ "type": "string",
124
+ "description": "On refused and failed: why."
125
+ },
126
+ "exitCode": {
127
+ "type": "integer"
128
+ },
22
129
  "drift": {
23
130
  "type": "object",
24
- "additionalProperties": false,
25
- "required": ["changed", "missing"],
131
+ "required": [
132
+ "changed"
133
+ ],
26
134
  "properties": {
27
- "changed": { "type": "array", "items": { "type": "string" } },
28
- "missing": { "type": "array", "items": { "type": "string" } },
29
- "fingerprint": { "type": "string", "description": "The same drift has the same fingerprint run after run, so a receiver can tell a repeat from new drift." }
135
+ "changed": {
136
+ "type": "array",
137
+ "items": {
138
+ "type": "string"
139
+ }
140
+ },
141
+ "missing": {
142
+ "type": "array",
143
+ "items": {
144
+ "type": "string"
145
+ }
146
+ },
147
+ "failed": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string"
151
+ },
152
+ "description": "What could not be checked."
153
+ },
154
+ "fingerprint": {
155
+ "type": "string",
156
+ "description": "The same drift has the same fingerprint, run after run."
157
+ }
30
158
  }
31
159
  },
32
- "runUrl": { "type": "string" },
33
- "repository": { "type": "string" },
34
- "commit": { "type": "string" }
35
- }
160
+ "run": {
161
+ "type": "object",
162
+ "properties": {
163
+ "url": {
164
+ "type": "string",
165
+ "description": "The CI run's page (GitHub, Forgejo) or job's page (GitLab)."
166
+ },
167
+ "forge": {
168
+ "enum": [
169
+ "github",
170
+ "gitlab",
171
+ "forgejo"
172
+ ]
173
+ },
174
+ "repository": {
175
+ "type": "string"
176
+ },
177
+ "commit": {
178
+ "type": "string"
179
+ },
180
+ "pr": {
181
+ "type": "integer"
182
+ }
183
+ }
184
+ },
185
+ "reportUrl": {
186
+ "type": "string"
187
+ },
188
+ "detail": {
189
+ "type": "object",
190
+ "required": [
191
+ "command"
192
+ ],
193
+ "properties": {
194
+ "command": {
195
+ "enum": [
196
+ "apply",
197
+ "plan",
198
+ "drift"
199
+ ],
200
+ "description": "The yodel command that sent it."
201
+ }
202
+ }
203
+ }
204
+ },
205
+ "allOf": [
206
+ {
207
+ "if": {
208
+ "required": [
209
+ "event"
210
+ ],
211
+ "properties": {
212
+ "event": {
213
+ "const": "drift"
214
+ }
215
+ }
216
+ },
217
+ "then": {
218
+ "required": [
219
+ "drift"
220
+ ],
221
+ "properties": {
222
+ "drift": {
223
+ "type": "object"
224
+ }
225
+ }
226
+ }
227
+ }
228
+ ]
36
229
  }
@@ -51,6 +51,7 @@
51
51
  "op": { "type": "string" },
52
52
  "gate": { "type": "string" },
53
53
  "approve": { "type": "string" },
54
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
54
55
  "gatePlanDigest": { "type": "string" },
55
56
  "history": { "description": "Where the baseline's row was recorded (status recorded).", "type": "string" },
56
57
  "exitCode": { "type": "integer" }
@@ -305,6 +305,7 @@
305
305
  "description": "The command a person runs to approve this plan. An agent prints it and never runs it.",
306
306
  "type": "string"
307
307
  },
308
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
308
309
  "approvalMode": {
309
310
  "description": "Which approvals of the migrations Op's gate count, as yodel.config.ts at the base commit has it, when not ledger: sealed counts only an approval sealed by a key the signers file at base lists for its approver.",
310
311
  "enum": ["sealed"]
@@ -432,9 +433,10 @@
432
433
  "type": "string"
433
434
  },
434
435
  "approve": {
435
- "description": "The chant approve command for the wave, for a person to run.",
436
+ "description": "The yodel approve command for the wave, for a person to run at a terminal.",
436
437
  "type": "string"
437
438
  },
439
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
438
440
  "approval": {
439
441
  "description": "Which approvals of the wave's digest count, as yodel.config.ts at the base commit has the wave, when not ledger.",
440
442
  "enum": ["pr-review", "sealed"]
@@ -62,7 +62,8 @@
62
62
  },
63
63
  "op": { "type": "string" },
64
64
  "gate": { "type": "string" },
65
- "approve": { "description": "The chant approve command that approves this revert.", "type": "string" },
65
+ "approve": { "description": "The yodel approve command that approves this revert, for a person to run at a terminal.", "type": "string" },
66
+ "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
66
67
  "gatePlanDigest": { "type": "string" },
67
68
  "exitCode": { "type": "integer" }
68
69
  }
@@ -1,32 +0,0 @@
1
- /**
2
- * One comment per environment on the pull request: found by its marker and
3
- * updated, else created. The three forges' REST APIs:
4
- *
5
- * GitHub GET/POST {api}/repos/{owner}/{repo}/issues/{n}/comments
6
- * PATCH {api}/repos/{owner}/{repo}/issues/comments/{id}
7
- * GitLab GET/POST {api}/projects/{id}/merge_requests/{iid}/notes
8
- * PUT {api}/projects/{id}/merge_requests/{iid}/notes/{note_id}
9
- * Forgejo GET/POST {api}/repos/{owner}/{repo}/issues/{n}/comments (Gitea's API, /api/v1)
10
- * PATCH {api}/repos/{owner}/{repo}/issues/comments/{id}
11
- */
12
- import type { ForgeTarget } from "./forge.js";
13
- export interface ForgeComment {
14
- id: number;
15
- body: string;
16
- url?: string | undefined;
17
- }
18
- export interface CommentClient {
19
- list(): Promise<ForgeComment[]>;
20
- create(body: string): Promise<ForgeComment>;
21
- update(id: number, body: string): Promise<ForgeComment>;
22
- }
23
- type Fetch = typeof fetch;
24
- export declare function commentClient(t: ForgeTarget, f?: Fetch): CommentClient;
25
- /** The comment carrying `marker`, the newest when several do. */
26
- export declare function findComment(c: CommentClient, marker: string): Promise<ForgeComment | undefined>;
27
- /** Updates the comment carrying `marker`, or creates one. */
28
- export declare function upsertComment(c: CommentClient, marker: string, body: string, existing?: ForgeComment): Promise<{
29
- action: "created" | "updated" | "unchanged";
30
- comment: ForgeComment;
31
- }>;
32
- export {};
@@ -1,99 +0,0 @@
1
- /**
2
- * One comment per environment on the pull request: found by its marker and
3
- * updated, else created. The three forges' REST APIs:
4
- *
5
- * GitHub GET/POST {api}/repos/{owner}/{repo}/issues/{n}/comments
6
- * PATCH {api}/repos/{owner}/{repo}/issues/comments/{id}
7
- * GitLab GET/POST {api}/projects/{id}/merge_requests/{iid}/notes
8
- * PUT {api}/projects/{id}/merge_requests/{iid}/notes/{note_id}
9
- * Forgejo GET/POST {api}/repos/{owner}/{repo}/issues/{n}/comments (Gitea's API, /api/v1)
10
- * PATCH {api}/repos/{owner}/{repo}/issues/comments/{id}
11
- */
12
- import { YodelError } from "../project.js";
13
- const PAGE = 100;
14
- const MAX_PAGES = 50;
15
- function client(t, f, shape) {
16
- const call = async (method, url, body) => {
17
- let res;
18
- try {
19
- res = await f(url, { method, headers: { ...shape.headers, ...(body ? { "Content-Type": "application/json" } : {}) }, ...(body ? { body: JSON.stringify(body) } : {}) });
20
- }
21
- catch (e) {
22
- throw new YodelError(`${t.forge}: ${method} ${url} failed: ${e instanceof Error ? e.message : String(e)}`);
23
- }
24
- const text = await res.text();
25
- if (!res.ok)
26
- throw new YodelError(`${t.forge}: ${method} ${url} answered ${String(res.status)}: ${text.slice(0, 300).replaceAll(t.token, "[token]")}`);
27
- return text ? JSON.parse(text) : {};
28
- };
29
- const toComment = (c) => ({ id: Number(c.id), body: typeof c.body === "string" ? c.body : "", url: shape.webUrl?.(c) ?? (typeof c.html_url === "string" ? c.html_url : undefined) });
30
- return {
31
- async list() {
32
- const all = [];
33
- for (let page = 1; page <= MAX_PAGES; page++) {
34
- const got = (await call("GET", shape.list(page)));
35
- if (!Array.isArray(got))
36
- throw new YodelError(`${t.forge}: listing comments did not return a list`);
37
- all.push(...got.filter((c) => shape.keep?.(c) ?? true).map(toComment));
38
- if (got.length < PAGE)
39
- break;
40
- }
41
- return all;
42
- },
43
- async create(body) {
44
- return toComment((await call("POST", shape.create, { body })));
45
- },
46
- async update(id, body) {
47
- return toComment((await call(shape.updateMethod, shape.update(id), { body })));
48
- },
49
- };
50
- }
51
- const repoPath = (repo) => repo.split("/").map(encodeURIComponent).join("/");
52
- export function commentClient(t, f = fetch) {
53
- if (t.forge === "gitlab") {
54
- const base = `${t.apiUrl}/projects/${encodeURIComponent(t.repo)}/merge_requests/${String(t.pr)}/notes`;
55
- return client(t, f, {
56
- headers: { "PRIVATE-TOKEN": t.token, Accept: "application/json" },
57
- list: (page) => `${base}?per_page=${String(PAGE)}&page=${String(page)}&sort=asc&order_by=created_at`,
58
- create: base,
59
- update: (id) => `${base}/${String(id)}`,
60
- updateMethod: "PUT",
61
- // System notes ("added 1 commit") are the forge's own, never ours.
62
- keep: (c) => c.system !== true,
63
- });
64
- }
65
- if (t.forge === "forgejo") {
66
- const base = `${t.apiUrl}/repos/${repoPath(t.repo)}/issues`;
67
- return client(t, f, {
68
- headers: { Authorization: `token ${t.token}`, Accept: "application/json" },
69
- list: (page) => `${base}/${String(t.pr)}/comments?limit=${String(PAGE)}&page=${String(page)}`,
70
- create: `${base}/${String(t.pr)}/comments`,
71
- update: (id) => `${base}/comments/${String(id)}`,
72
- updateMethod: "PATCH",
73
- });
74
- }
75
- const base = `${t.apiUrl}/repos/${repoPath(t.repo)}/issues`;
76
- return client(t, f, {
77
- headers: { Authorization: `Bearer ${t.token}`, Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28" },
78
- list: (page) => `${base}/${String(t.pr)}/comments?per_page=${String(PAGE)}&page=${String(page)}`,
79
- create: `${base}/${String(t.pr)}/comments`,
80
- update: (id) => `${base}/comments/${String(id)}`,
81
- updateMethod: "PATCH",
82
- });
83
- }
84
- /** The comment carrying `marker`, the newest when several do. */
85
- export async function findComment(c, marker) {
86
- return (await c.list()).filter((x) => x.body.includes(marker)).at(-1);
87
- }
88
- /** Updates the comment carrying `marker`, or creates one. */
89
- export async function upsertComment(c, marker, body, existing) {
90
- if (!body.includes(marker))
91
- throw new YodelError("the comment body has no marker; it could never be found again to update");
92
- const found = existing ?? (await findComment(c, marker));
93
- if (!found)
94
- return { action: "created", comment: await c.create(body) };
95
- if (found.body === body)
96
- return { action: "unchanged", comment: found };
97
- return { action: "updated", comment: await c.update(found.id, body) };
98
- }
99
- //# sourceMappingURL=comment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"comment.js","sourceRoot":"","sources":["../../src/pr/comment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwB3C,MAAM,IAAI,GAAG,GAAG,CAAC;AACjB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,MAAM,CAAC,CAAc,EAAE,CAAQ,EAAE,KAQzC;IACC,MAAM,IAAI,GAA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