@nifrajs/core 2.1.0 → 2.3.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 (138) hide show
  1. package/README.md +2 -2
  2. package/dist/assurance.d.ts +48 -4
  3. package/dist/assurance.d.ts.map +1 -1
  4. package/dist/assurance.js +87 -9
  5. package/dist/assurance.js.map +1 -1
  6. package/dist/binary.d.ts +54 -0
  7. package/dist/binary.d.ts.map +1 -0
  8. package/dist/binary.js +90 -0
  9. package/dist/binary.js.map +1 -0
  10. package/dist/budget.d.ts +1 -1
  11. package/dist/budget.js +1 -1
  12. package/dist/capabilities.d.ts +19 -2
  13. package/dist/capabilities.d.ts.map +1 -1
  14. package/dist/capabilities.js +60 -8
  15. package/dist/capabilities.js.map +1 -1
  16. package/dist/classification.d.ts +1 -1
  17. package/dist/classification.js +1 -1
  18. package/dist/diff.d.ts +6 -6
  19. package/dist/diff.js +6 -6
  20. package/dist/durable-adapters.d.ts.map +1 -1
  21. package/dist/durable-adapters.js +36 -70
  22. package/dist/durable-adapters.js.map +1 -1
  23. package/dist/durable-execution.d.ts +2 -2
  24. package/dist/durable-execution.js +2 -2
  25. package/dist/idempotency.d.ts +3 -3
  26. package/dist/idempotency.js +4 -4
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.js +3 -3
  29. package/dist/internal/brand.d.ts +1 -1
  30. package/dist/internal/brand.js +1 -1
  31. package/dist/internal/route-catalog.d.ts +58 -0
  32. package/dist/internal/route-catalog.d.ts.map +1 -0
  33. package/dist/internal/route-catalog.js +58 -0
  34. package/dist/internal/route-catalog.js.map +1 -0
  35. package/dist/internal/route-execution.d.ts +75 -0
  36. package/dist/internal/route-execution.d.ts.map +1 -0
  37. package/dist/internal/route-execution.js +2 -0
  38. package/dist/internal/route-execution.js.map +1 -0
  39. package/dist/internal/same-origin.d.ts +29 -0
  40. package/dist/internal/same-origin.d.ts.map +1 -0
  41. package/dist/internal/same-origin.js +47 -0
  42. package/dist/internal/same-origin.js.map +1 -0
  43. package/dist/internal/secret.d.ts +1 -1
  44. package/dist/internal/secret.js +1 -1
  45. package/dist/ledger.d.ts +9 -9
  46. package/dist/ledger.js +5 -5
  47. package/dist/reflection.d.ts +1 -1
  48. package/dist/router/pattern.d.ts +26 -1
  49. package/dist/router/pattern.d.ts.map +1 -1
  50. package/dist/router/pattern.js +164 -8
  51. package/dist/router/pattern.js.map +1 -1
  52. package/dist/router/router.d.ts.map +1 -1
  53. package/dist/router/router.js +52 -4
  54. package/dist/router/router.js.map +1 -1
  55. package/dist/schema/standard.d.ts +2 -2
  56. package/dist/schema/standard.js +2 -2
  57. package/dist/seo.d.ts +3 -3
  58. package/dist/seo.js +4 -4
  59. package/dist/server/body.d.ts +2 -2
  60. package/dist/server/body.js +2 -2
  61. package/dist/server/context.d.ts +18 -18
  62. package/dist/server/contract.d.ts +7 -7
  63. package/dist/server/contract.js +3 -3
  64. package/dist/server/cookies.d.ts +4 -4
  65. package/dist/server/cookies.js +8 -8
  66. package/dist/server/edge.d.ts +83 -0
  67. package/dist/server/edge.d.ts.map +1 -0
  68. package/dist/server/edge.js +71 -0
  69. package/dist/server/edge.js.map +1 -0
  70. package/dist/server/install.d.ts +2 -0
  71. package/dist/server/install.d.ts.map +1 -1
  72. package/dist/server/install.js +2 -0
  73. package/dist/server/install.js.map +1 -1
  74. package/dist/server/logger.d.ts +7 -7
  75. package/dist/server/logger.js +4 -4
  76. package/dist/server/registry.d.ts +5 -5
  77. package/dist/server/response-contract-lane.d.ts +91 -0
  78. package/dist/server/response-contract-lane.d.ts.map +1 -0
  79. package/dist/server/response-contract-lane.js +81 -0
  80. package/dist/server/response-contract-lane.js.map +1 -0
  81. package/dist/server/server.d.ts +52 -91
  82. package/dist/server/server.d.ts.map +1 -1
  83. package/dist/server/server.js +130 -186
  84. package/dist/server/server.js.map +1 -1
  85. package/dist/server/sse.d.ts +4 -4
  86. package/dist/server/sse.js +7 -7
  87. package/dist/server/webhook.d.ts +1 -1
  88. package/dist/server/webhook.js +5 -5
  89. package/dist/server/websocket.d.ts +19 -19
  90. package/dist/server/websocket.js +9 -9
  91. package/dist/server/ws-bun.d.ts +4 -4
  92. package/dist/server/ws-bun.js +3 -3
  93. package/dist/server.d.ts +3 -1
  94. package/dist/server.d.ts.map +1 -1
  95. package/dist/server.js +3 -1
  96. package/dist/server.js.map +1 -1
  97. package/dist/transport-codec.d.ts +13 -1
  98. package/dist/transport-codec.d.ts.map +1 -1
  99. package/dist/transport-codec.js +48 -9
  100. package/dist/transport-codec.js.map +1 -1
  101. package/package.json +12 -2
  102. package/src/assurance.ts +154 -8
  103. package/src/binary.ts +128 -0
  104. package/src/budget.ts +1 -1
  105. package/src/capabilities.ts +71 -9
  106. package/src/classification.ts +1 -1
  107. package/src/diff.ts +8 -8
  108. package/src/durable-adapters.ts +40 -70
  109. package/src/durable-execution.ts +2 -2
  110. package/src/idempotency.ts +4 -4
  111. package/src/index.ts +3 -3
  112. package/src/internal/brand.ts +1 -1
  113. package/src/internal/route-catalog.ts +94 -0
  114. package/src/internal/route-execution.ts +106 -0
  115. package/src/internal/same-origin.ts +43 -0
  116. package/src/internal/secret.ts +1 -1
  117. package/src/ledger.ts +11 -11
  118. package/src/reflection.ts +1 -1
  119. package/src/router/pattern.ts +179 -8
  120. package/src/router/router.ts +80 -6
  121. package/src/schema/standard.ts +2 -2
  122. package/src/seo.ts +6 -6
  123. package/src/server/body.ts +2 -2
  124. package/src/server/context.ts +18 -18
  125. package/src/server/contract.ts +13 -13
  126. package/src/server/cookies.ts +8 -8
  127. package/src/server/edge.ts +150 -0
  128. package/src/server/install.ts +5 -0
  129. package/src/server/logger.ts +8 -8
  130. package/src/server/registry.ts +5 -5
  131. package/src/server/response-contract-lane.ts +164 -0
  132. package/src/server/server.ts +159 -366
  133. package/src/server/sse.ts +11 -11
  134. package/src/server/webhook.ts +5 -5
  135. package/src/server/websocket.ts +22 -22
  136. package/src/server/ws-bun.ts +4 -4
  137. package/src/server.ts +8 -5
  138. package/src/transport-codec.ts +63 -10
@@ -22,7 +22,7 @@ const SENSITIVE_KEY_PARTS = [
22
22
  "ssn",
23
23
  ];
24
24
  /**
25
- * A conservative, high-signal set of patterns for {@link RedactOptions.valuePatterns} — opt in by
25
+ * A conservative, high-signal set of patterns for {@link RedactOptions.valuePatterns} - opt in by
26
26
  * passing it (or a subset) to `jsonLogger`/`redactLogFields`. Covers bearer tokens, JWTs, emails, and a
27
27
  * few well-known key formats (Stripe, GitHub, AWS access-key ids). Chosen to minimize false positives;
28
28
  * add your own (e.g. internal id formats) as needed. Every pattern is global so all matches are scrubbed.
@@ -72,7 +72,7 @@ function redactValue(value, seen, config) {
72
72
  return value.map((item) => redactValue(item, seen, config));
73
73
  const out = {};
74
74
  for (const [key, val] of Object.entries(value)) {
75
- // A sensitive key wins outright (don't scan it) — the whole value is replaced.
75
+ // A sensitive key wins outright (don't scan it) - the whole value is replaced.
76
76
  out[key] = isSensitiveKey(key, config.keyParts)
77
77
  ? config.placeholder
78
78
  : redactValue(val, seen, config);
@@ -92,7 +92,7 @@ function writeToStderr(line) {
92
92
  }
93
93
  /**
94
94
  * The default logger: one redacted JSON object per line. `write` is injectable for tests or
95
- * alternative sinks (defaults to stderr). `options` tunes redaction — pass `valuePatterns` (e.g.
95
+ * alternative sinks (defaults to stderr). `options` tunes redaction - pass `valuePatterns` (e.g.
96
96
  * {@link commonSecretPatterns}) to also scrub secrets embedded in values + the message. Framework keys
97
97
  * (`level`, `message`, `time`) always win over user fields of the same name.
98
98
  */
@@ -115,7 +115,7 @@ export function jsonLogger(write = writeToStderr, options) {
115
115
  };
116
116
  }
117
117
  const noop = () => undefined;
118
- /** Discards everything — for tests, or when log output is handled elsewhere. */
118
+ /** Discards everything - for tests, or when log output is handled elsewhere. */
119
119
  export const silentLogger = {
120
120
  debug: noop,
121
121
  info: noop,
@@ -83,20 +83,20 @@ export type WsRouteInfoFor<Path extends string, In extends StandardSchemaV1 | un
83
83
  /**
84
84
  * Merge a new route into the registry, combining methods that share a path.
85
85
  *
86
- * SCALING CEILING (measured — see many-routes.test-d.ts and the isolation study below): a single
87
- * fluent chain hits TS2589 at ~95-100 routes. This intersection is NOT the cause — in isolation it
86
+ * SCALING CEILING (measured - see many-routes.test-d.ts and the isolation study below): a single
87
+ * fluent chain hits TS2589 at ~95-100 routes. This intersection is NOT the cause - in isolation it
88
88
  * accumulates 1000+ routes cleanly, and heavy per-route `Params<Path>`/schema inference alone
89
89
  * reaches 600+. The wall is an INTERACTION unique to the fluent builder: each `.get(path, handler)`
90
90
  * both (a) computes the handler's context type from the path (`c.params.id` inferred from `:id`)
91
91
  * AND (b) returns `Server<AddRoute<growing-R, …>, Ctx>`. Neither alone strains the compiler; the
92
- * PRODUCT — recomputing the handler context while re-threading the ever-larger registry at each of
93
- * N steps — exhausts TypeScript's per-expression instantiation budget around N≈95. It is therefore
92
+ * PRODUCT - recomputing the handler context while re-threading the ever-larger registry at each of
93
+ * N steps - exhausts TypeScript's per-expression instantiation budget around N≈95. It is therefore
94
94
  * O(N) and inherent to any builder that infers handler context AND accumulates a typed route
95
95
  * registry (Elysia/tRPC/hono's typed clients cap the same way); it is not fixable by reshaping
96
96
  * AddRoute. Past ~90 routes, use a path that DOESN'T form the product: split into domain groups and
97
97
  * `.merge()` them (each group is a short chain; a merge is one `R & R2` intersection with no
98
98
  * per-call context work), or contract-first `implement()` (the registry is one object type declared
99
- * upfront — no grow-R-per-call, so no ceiling at all).
99
+ * upfront - no grow-R-per-call, so no ceiling at all).
100
100
  */
101
101
  export type AddRoute<R extends Registry, Method extends string, Path extends string, Info extends RouteInfo> = R & {
102
102
  [P in Path]: {
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Making a route's declared `response` schema mean something at runtime.
3
+ *
4
+ * ## The gap this closes
5
+ *
6
+ * A `response` schema is a LOWER bound, not an upper one. It says "at least these fields, of these
7
+ * types"; it never said "only these". TypeScript does not close the gap either - excess-property
8
+ * checking fires on a fresh object literal in an annotated position, and a handler is neither: it is a
9
+ * contextually-typed argument that usually returns a variable. So this compiles, and ships every field:
10
+ *
11
+ * app.get("/me", { response: PublicUser }, async () => {
12
+ * const user = await db.users.find(id) // { id, name, email, passwordHash, ... }
13
+ * return user // all of it goes on the wire
14
+ * })
15
+ *
16
+ * The client's type says `{ id, name }`, so the leak is invisible from both ends. And it can appear
17
+ * with no code change at all: add a column to `users`, and the next deploy ships it to browsers.
18
+ *
19
+ * ## Why the behaviour follows the schema, not this module
20
+ *
21
+ * Standard Schema exposes exactly one operation - `validate` - and no way to enumerate a schema's
22
+ * declared keys. So a projection of "just the declared fields" cannot be written generically here;
23
+ * the only clean value available is whatever `validate()` returns. That is deliberate on the spec's
24
+ * part, and it means enforcement inherits each validator's own semantics:
25
+ *
26
+ * - a STRIPPING schema (zod, valibot) returns a cleaned value -> the undeclared fields are removed
27
+ * - a STRICT schema (`@nifrajs/schema`'s `t.object`) reports issues -> the response is a violation
28
+ *
29
+ * That is not an inconsistency to paper over: a strict schema has already declared that extra fields
30
+ * are an error, and a stripping one has declared they are ignorable. Enforcement honours what the
31
+ * author wrote rather than overriding it.
32
+ */
33
+ import type { StandardSchemaV1 } from "../schema/standard.js";
34
+ import type { IdentityPlugin } from "./plugin.js";
35
+ /**
36
+ * How hard a declared `response` schema is held.
37
+ *
38
+ * - `warn` - check and log; the response is sent UNCHANGED, so enabling it cannot break anything.
39
+ * - `enforce` - serialize the validated value, so undeclared data cannot reach the wire.
40
+ *
41
+ * There is no `off`: not installing the plugin IS off, and that is what keeps this module out of an
42
+ * app's bundle entirely rather than shipping a disabled branch to everyone.
43
+ */
44
+ export type ResponseContractMode = "warn" | "enforce";
45
+ /** The outcome of checking one handler result against its declared response schema. */
46
+ export type ResponseContractOutcome =
47
+ /** Nothing to report. `value` is what should be serialized (the original result, or the cleaned one). */
48
+ {
49
+ readonly kind: "ok";
50
+ readonly value: unknown;
51
+ }
52
+ /** `warn` only: the payload differed from the contract. The ORIGINAL result is still served. */
53
+ | {
54
+ readonly kind: "warn";
55
+ readonly value: unknown;
56
+ readonly message: string;
57
+ }
58
+ /** `enforce` only: the payload cannot be reconciled with the contract, so it must not be sent. */
59
+ | {
60
+ readonly kind: "violation";
61
+ readonly message: string;
62
+ };
63
+ /**
64
+ * Check one result against the route's declared response schema.
65
+ *
66
+ * Returns synchronously when the schema does (the common case), so an app that opts in does not pay a
67
+ * microtask per response for a check that had no work to do.
68
+ */
69
+ export declare function checkResponseContract(schema: StandardSchemaV1, result: unknown, mode: "warn" | "enforce"): ResponseContractOutcome | Promise<ResponseContractOutcome>;
70
+ /**
71
+ * What the server holds when the plugin is installed. The kernel calls `check` through this object and
72
+ * never imports the implementation, so an app that does not install the plugin does not carry it.
73
+ */
74
+ export interface ResponseContractRuntime {
75
+ readonly mode: ResponseContractMode;
76
+ check(schema: StandardSchemaV1, result: unknown): ResponseContractOutcome | Promise<ResponseContractOutcome>;
77
+ }
78
+ /**
79
+ * Hold every route's declared `response` schema to what the handler actually returned.
80
+ *
81
+ * app.use(responseContract("enforce"))
82
+ *
83
+ * Install it before the routes it should cover - like `idempotency()`, the decision is made per route
84
+ * at registration, so routes registered earlier are not retroactively covered.
85
+ *
86
+ * A contracted route leaves the fused and native fast paths, because the check needs the handler's
87
+ * value before it becomes bytes. That is the same trade an idempotent route makes, and the reason this
88
+ * is opt-in rather than always on.
89
+ */
90
+ export declare function responseContract(mode?: ResponseContractMode): IdentityPlugin;
91
+ //# sourceMappingURL=response-contract-lane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-contract-lane.d.ts","sourceRoot":"","sources":["../../src/server/response-contract-lane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAiC,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAAA;AAErD,uFAAuF;AACvF,MAAM,MAAM,uBAAuB;AACjC,yGAAyG;AACvG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AAClD,gGAAgG;GAC9F;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAC9E,kGAAkG;GAChG;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AA0B5D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAQ5D;AA0BD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAA;IACnC,KAAK,CACH,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,OAAO,GACd,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;CAC9D;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,oBAA6B,GAAG,cAAc,CAUpF"}
@@ -0,0 +1,81 @@
1
+ import { INSTALL_RESPONSE_CONTRACT } from "./install.js";
2
+ const isPlainObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
3
+ /** Top-level keys present in the handler's result but absent from the validated value. */
4
+ function droppedKeys(result, value) {
5
+ if (!isPlainObject(result) || !isPlainObject(value))
6
+ return [];
7
+ return Object.keys(result).filter((k) => !(k in value));
8
+ }
9
+ function describeIssues(issues) {
10
+ return issues
11
+ .map((issue) => {
12
+ const path = Array.isArray(issue.path)
13
+ ? issue.path
14
+ .map((seg) => String(typeof seg === "object" && seg !== null ? seg.key : seg))
15
+ .join(".")
16
+ : "";
17
+ return path === "" ? issue.message : `${path}: ${issue.message}`;
18
+ })
19
+ .join("; ");
20
+ }
21
+ /**
22
+ * Check one result against the route's declared response schema.
23
+ *
24
+ * Returns synchronously when the schema does (the common case), so an app that opts in does not pay a
25
+ * microtask per response for a check that had no work to do.
26
+ */
27
+ export function checkResponseContract(schema, result, mode) {
28
+ // A handler may return a raw Response as deliberate control flow (a redirect, a stream). There is no
29
+ // JSON payload to hold to the contract, and re-serializing one would corrupt it.
30
+ if (result instanceof Response || result === undefined)
31
+ return { kind: "ok", value: result };
32
+ const settled = schema["~standard"].validate(result);
33
+ return settled instanceof Promise
34
+ ? settled.then((r) => interpret(r, result, mode))
35
+ : interpret(settled, result, mode);
36
+ }
37
+ function interpret(settled, result, mode) {
38
+ if (settled.issues !== undefined) {
39
+ const message = `response does not satisfy its declared contract: ${describeIssues(settled.issues)}`;
40
+ // `warn` never changes what is served - it reports and gets out of the way, so switching it on can
41
+ // never be the thing that broke production.
42
+ return mode === "warn"
43
+ ? { kind: "warn", value: result, message }
44
+ : { kind: "violation", message };
45
+ }
46
+ const dropped = droppedKeys(result, settled.value);
47
+ if (mode === "enforce")
48
+ return { kind: "ok", value: settled.value };
49
+ return dropped.length === 0
50
+ ? { kind: "ok", value: result }
51
+ : {
52
+ kind: "warn",
53
+ value: result,
54
+ message: `response carries fields its contract does not declare: ${dropped.join(", ")}. They are being sent; \`responseContract: "enforce"\` would strip them.`,
55
+ };
56
+ }
57
+ /**
58
+ * Hold every route's declared `response` schema to what the handler actually returned.
59
+ *
60
+ * app.use(responseContract("enforce"))
61
+ *
62
+ * Install it before the routes it should cover - like `idempotency()`, the decision is made per route
63
+ * at registration, so routes registered earlier are not retroactively covered.
64
+ *
65
+ * A contracted route leaves the fused and native fast paths, because the check needs the handler's
66
+ * value before it becomes bytes. That is the same trade an idempotent route makes, and the reason this
67
+ * is opt-in rather than always on.
68
+ */
69
+ export function responseContract(mode = "warn") {
70
+ const runtime = {
71
+ mode,
72
+ check: (schema, result) => checkResponseContract(schema, result, mode),
73
+ };
74
+ const apply = (app) => {
75
+ ;
76
+ app[INSTALL_RESPONSE_CONTRACT](runtime);
77
+ return app;
78
+ };
79
+ return Object.assign(apply, { pluginName: "nifra:response-contract" });
80
+ }
81
+ //# sourceMappingURL=response-contract-lane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-contract-lane.js","sourceRoot":"","sources":["../../src/server/response-contract-lane.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAwBxD,MAAM,aAAa,GAAG,CAAC,CAAU,EAAgC,EAAE,CACjE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAE1D,0FAA0F;AAC1F,SAAS,WAAW,CAAC,MAAe,EAAE,KAAc;IAClD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAA;AACzD,CAAC;AAED,SAAS,cAAc,CAAC,MAAoC;IAC1D,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;YACpC,CAAC,CAAC,KAAK,CAAC,IAAI;iBACP,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACX,MAAM,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC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