@gigadrive/network-config 3.4.17 → 4.0.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/index.d.mts +75 -61
- package/dist/index.d.ts +75 -61
- package/dist/index.js +131 -157
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +131 -157
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs-adapter.d.mts +16 -4
- package/dist/nextjs-adapter.d.ts +17 -3
- package/dist/nextjs-adapter.js +81 -260
- package/dist/nextjs-adapter.js.map +1 -1
- package/dist/nextjs-adapter.mjs +78 -261
- package/dist/nextjs-adapter.mjs.map +1 -1
- package/package.json +3 -8
- package/dist/nextjs-entrypoint-templates/edge-web.mjs +0 -90
- package/dist/nextjs-entrypoint-templates/node-middleware-web.mjs +0 -98
- package/dist/nextjs-entrypoint-templates/node-route.mjs +0 -73
- package/dist/nextjs-ppr-runtime.d.mts +0 -46
- package/dist/nextjs-ppr-runtime.d.ts +0 -46
- package/dist/nextjs-ppr-runtime.js +0 -177
- package/dist/nextjs-ppr-runtime.js.map +0 -1
- package/dist/nextjs-ppr-runtime.mjs +0 -149
- package/dist/nextjs-ppr-runtime.mjs.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// src/nextjs-runtime-cache-client.ts
|
|
2
|
-
var cachedToken;
|
|
3
|
-
var apiBaseUrl = () => (process.env.GIGADRIVE_API_URL ?? "https://api.gigadrive.network").replace(/\/$/, "");
|
|
4
|
-
var encodeBinary = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
5
|
-
if (value instanceof Uint8Array) {
|
|
6
|
-
return { __gigadriveType: "bytes", value: Buffer.from(value).toString("base64") };
|
|
7
|
-
}
|
|
8
|
-
if (value instanceof ArrayBuffer) {
|
|
9
|
-
return { __gigadriveType: "bytes", value: Buffer.from(value).toString("base64") };
|
|
10
|
-
}
|
|
11
|
-
if (Array.isArray(value)) return value.map((item) => encodeBinary(item, seen));
|
|
12
|
-
if (typeof value !== "object" || value === null) return value;
|
|
13
|
-
if (seen.has(value)) throw new Error("Next.js cache entry contains a circular value");
|
|
14
|
-
seen.add(value);
|
|
15
|
-
const result = {};
|
|
16
|
-
for (const [key, item] of Object.entries(value)) result[key] = encodeBinary(item, seen);
|
|
17
|
-
seen.delete(value);
|
|
18
|
-
return result;
|
|
19
|
-
};
|
|
20
|
-
var getAccessToken = async () => {
|
|
21
|
-
if (cachedToken && cachedToken.expiresAt > Date.now() + 3e4) return cachedToken.value;
|
|
22
|
-
const clientId = process.env.GIGADRIVE_CLIENT_ID;
|
|
23
|
-
const clientSecret = process.env.GIGADRIVE_CLIENT_SECRET;
|
|
24
|
-
if (!clientId || !clientSecret) throw new Error("Gigadrive workload credentials are unavailable");
|
|
25
|
-
const response = await fetch(`${apiBaseUrl()}/oauth2/token`, {
|
|
26
|
-
method: "POST",
|
|
27
|
-
headers: {
|
|
28
|
-
authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString("base64")}`,
|
|
29
|
-
"content-type": "application/x-www-form-urlencoded"
|
|
30
|
-
},
|
|
31
|
-
body: "grant_type=client_credentials"
|
|
32
|
-
});
|
|
33
|
-
if (!response.ok) throw new Error(`Gigadrive workload authentication failed with status ${response.status}`);
|
|
34
|
-
const token = await response.json();
|
|
35
|
-
if (!token.access_token) throw new Error("Gigadrive workload authentication returned no access token");
|
|
36
|
-
cachedToken = {
|
|
37
|
-
value: token.access_token,
|
|
38
|
-
expiresAt: Date.now() + Math.max(60, token.expires_in ?? 300) * 1e3
|
|
39
|
-
};
|
|
40
|
-
return token.access_token;
|
|
41
|
-
};
|
|
42
|
-
var request = async (pathname, init, attempt = 0) => {
|
|
43
|
-
const token = await getAccessToken();
|
|
44
|
-
try {
|
|
45
|
-
const response = await fetch(`${apiBaseUrl()}${pathname}`, {
|
|
46
|
-
...init,
|
|
47
|
-
headers: {
|
|
48
|
-
authorization: `Bearer ${token}`,
|
|
49
|
-
"content-type": "application/json",
|
|
50
|
-
"x-gigadrive-deployment-id": process.env.GIGADRIVE_DEPLOYMENT_ID ?? process.env.NEBULA_DEPLOYMENT_ID ?? "",
|
|
51
|
-
"x-gigadrive-build-id": process.env.NEXT_BUILD_ID ?? "",
|
|
52
|
-
...init.headers
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
if (response.status === 401 && attempt === 0) {
|
|
56
|
-
cachedToken = void 0;
|
|
57
|
-
return request(pathname, init, attempt + 1);
|
|
58
|
-
}
|
|
59
|
-
if (response.status >= 500 && attempt < 2) return request(pathname, init, attempt + 1);
|
|
60
|
-
return response;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
if (attempt < 2) return request(pathname, init, attempt + 1);
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var cachePath = (kind, key) => `/internal/runtime-cache/v1/entries/${encodeURIComponent(kind)}/${encodeURIComponent(key)}`;
|
|
67
|
-
var writeRuntimeCache = async (kind, key, value, tags = []) => {
|
|
68
|
-
const response = await request(cachePath(kind, key), {
|
|
69
|
-
method: "PUT",
|
|
70
|
-
body: JSON.stringify({ value: encodeBinary(value), tags })
|
|
71
|
-
});
|
|
72
|
-
if (!response.ok) throw new Error(`Gigadrive runtime cache write failed with status ${response.status}`);
|
|
73
|
-
};
|
|
74
|
-
var revalidateRuntimeCacheTags = async (kind, tags, durations) => {
|
|
75
|
-
const response = await request("/internal/runtime-cache/v1/tags/revalidate", {
|
|
76
|
-
method: "POST",
|
|
77
|
-
body: JSON.stringify({ kind, tags, durations })
|
|
78
|
-
});
|
|
79
|
-
if (!response.ok) throw new Error(`Gigadrive runtime cache revalidation failed with status ${response.status}`);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/nextjs-ppr-runtime.ts
|
|
83
|
-
var normalizeHeaders = (value) => {
|
|
84
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
85
|
-
const headers = {};
|
|
86
|
-
for (const [name, item] of Object.entries(value)) {
|
|
87
|
-
if (typeof item === "string" || typeof item === "number") headers[name] = String(item);
|
|
88
|
-
else if (Array.isArray(item) && item.every((entry) => typeof entry === "string" || typeof entry === "number")) {
|
|
89
|
-
headers[name] = item.map(String);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return headers;
|
|
93
|
-
};
|
|
94
|
-
var normalizeCacheKey = (value) => {
|
|
95
|
-
try {
|
|
96
|
-
const url = new URL(value, "https://gigadrive.invalid");
|
|
97
|
-
return `${url.pathname || "/"}${url.search}`;
|
|
98
|
-
} catch {
|
|
99
|
-
return value.startsWith("/") ? value : `/${value}`;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var readShell = (value) => {
|
|
103
|
-
if (typeof value === "string") return value;
|
|
104
|
-
if (typeof value !== "object" || value === null) return null;
|
|
105
|
-
const toUnchunkedString = value.toUnchunkedString;
|
|
106
|
-
return typeof toUnchunkedString === "function" ? String(toUnchunkedString.call(value)) : null;
|
|
107
|
-
};
|
|
108
|
-
var persistPprCacheEntry = async (cacheKey, cacheEntry) => {
|
|
109
|
-
if (cacheEntry.value?.kind !== "APP_PAGE") return;
|
|
110
|
-
const shell = readShell(cacheEntry.value.html);
|
|
111
|
-
if (shell === null) return;
|
|
112
|
-
const headers = normalizeHeaders(cacheEntry.value.headers);
|
|
113
|
-
const tags = (headers["x-next-cache-tags"] ?? []).toString().split(",").map((tag) => tag.trim()).filter(Boolean);
|
|
114
|
-
const value = {
|
|
115
|
-
shell,
|
|
116
|
-
...typeof cacheEntry.value.postponed === "string" ? { postponedState: cacheEntry.value.postponed } : {},
|
|
117
|
-
headers,
|
|
118
|
-
...typeof cacheEntry.value.status === "number" ? { status: cacheEntry.value.status } : {},
|
|
119
|
-
...cacheEntry.cacheControl === void 0 ? {} : { cacheControl: cacheEntry.cacheControl }
|
|
120
|
-
};
|
|
121
|
-
await writeRuntimeCache("incremental", `ppr:${normalizeCacheKey(cacheKey)}`, value, tags);
|
|
122
|
-
};
|
|
123
|
-
var revalidateNextPath = async (input) => {
|
|
124
|
-
if (!input.urlPath.startsWith("/")) throw new Error("Next.js revalidation requires an absolute application path");
|
|
125
|
-
if (!input.hostname) throw new Error("Next.js revalidation requires the application hostname");
|
|
126
|
-
const pathname = new URL(input.urlPath, "https://gigadrive.invalid").pathname;
|
|
127
|
-
await revalidateRuntimeCacheTags("incremental", [`path:${pathname}`]);
|
|
128
|
-
const origin = process.env.GIGADRIVE_APPLICATION_ORIGIN ?? `https://${input.hostname}`;
|
|
129
|
-
const originUrl = new URL(origin);
|
|
130
|
-
if (originUrl.protocol !== "https:" && originUrl.protocol !== "http:") {
|
|
131
|
-
throw new Error("Next.js revalidation requires an HTTP application origin");
|
|
132
|
-
}
|
|
133
|
-
const url = new URL(input.urlPath, originUrl);
|
|
134
|
-
if (url.origin !== originUrl.origin)
|
|
135
|
-
throw new Error("Next.js revalidation path must remain on the application origin");
|
|
136
|
-
url.searchParams.set("__gigadrive_revalidate", `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);
|
|
137
|
-
const headers = new Headers(input.headers);
|
|
138
|
-
headers.set("cache-control", "no-cache");
|
|
139
|
-
const response = await fetch(url, { method: "HEAD", headers, redirect: "manual" });
|
|
140
|
-
const cacheStatus = response.headers.get("x-gigadrive-cache") ?? response.headers.get("x-nextjs-cache");
|
|
141
|
-
if (cacheStatus?.toUpperCase() !== "REVALIDATED" && response.status !== 200 && !(response.status === 404 && input.opts.unstable_onlyGenerated)) {
|
|
142
|
-
throw new Error(`Next.js revalidation failed with status ${response.status}`);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
export {
|
|
146
|
-
persistPprCacheEntry,
|
|
147
|
-
revalidateNextPath
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=nextjs-ppr-runtime.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nextjs-runtime-cache-client.ts","../src/nextjs-ppr-runtime.ts"],"sourcesContent":["interface RuntimeCacheEnvelope {\n value: unknown;\n}\n\ninterface AccessTokenResponse {\n access_token: string;\n expires_in?: number;\n}\n\nexport interface RuntimeCacheTagState {\n stale: number;\n expired: number;\n}\n\nlet cachedToken: { value: string; expiresAt: number } | undefined;\n\nconst apiBaseUrl = (): string => (process.env.GIGADRIVE_API_URL ?? 'https://api.gigadrive.network').replace(/\\/$/, '');\n\nconst encodeBinary = (value: unknown, seen = new WeakSet<object>()): unknown => {\n if (value instanceof Uint8Array) {\n return { __gigadriveType: 'bytes', value: Buffer.from(value).toString('base64') };\n }\n if (value instanceof ArrayBuffer) {\n return { __gigadriveType: 'bytes', value: Buffer.from(value).toString('base64') };\n }\n if (Array.isArray(value)) return value.map((item) => encodeBinary(item, seen));\n if (typeof value !== 'object' || value === null) return value;\n if (seen.has(value)) throw new Error('Next.js cache entry contains a circular value');\n seen.add(value);\n const result: Record<string, unknown> = {};\n for (const [key, item] of Object.entries(value)) result[key] = encodeBinary(item, seen);\n seen.delete(value);\n return result;\n};\n\nconst decodeBinary = (value: unknown): unknown => {\n if (Array.isArray(value)) return value.map(decodeBinary);\n if (typeof value !== 'object' || value === null) return value;\n const record = value as Record<string, unknown>;\n if (record.__gigadriveType === 'bytes' && typeof record.value === 'string')\n return Buffer.from(record.value, 'base64');\n return Object.fromEntries(Object.entries(record).map(([key, item]) => [key, decodeBinary(item)]));\n};\n\nconst getAccessToken = async (): Promise<string> => {\n if (cachedToken && cachedToken.expiresAt > Date.now() + 30_000) return cachedToken.value;\n const clientId = process.env.GIGADRIVE_CLIENT_ID;\n const clientSecret = process.env.GIGADRIVE_CLIENT_SECRET;\n if (!clientId || !clientSecret) throw new Error('Gigadrive workload credentials are unavailable');\n\n const response = await fetch(`${apiBaseUrl()}/oauth2/token`, {\n method: 'POST',\n headers: {\n authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`,\n 'content-type': 'application/x-www-form-urlencoded',\n },\n body: 'grant_type=client_credentials',\n });\n if (!response.ok) throw new Error(`Gigadrive workload authentication failed with status ${response.status}`);\n const token = (await response.json()) as AccessTokenResponse;\n if (!token.access_token) throw new Error('Gigadrive workload authentication returned no access token');\n cachedToken = {\n value: token.access_token,\n expiresAt: Date.now() + Math.max(60, token.expires_in ?? 300) * 1000,\n };\n return token.access_token;\n};\n\nconst request = async (pathname: string, init: RequestInit, attempt = 0): Promise<Response> => {\n const token = await getAccessToken();\n try {\n const response = await fetch(`${apiBaseUrl()}${pathname}`, {\n ...init,\n headers: {\n authorization: `Bearer ${token}`,\n 'content-type': 'application/json',\n 'x-gigadrive-deployment-id': process.env.GIGADRIVE_DEPLOYMENT_ID ?? process.env.NEBULA_DEPLOYMENT_ID ?? '',\n 'x-gigadrive-build-id': process.env.NEXT_BUILD_ID ?? '',\n ...init.headers,\n },\n });\n if (response.status === 401 && attempt === 0) {\n cachedToken = undefined;\n return request(pathname, init, attempt + 1);\n }\n if (response.status >= 500 && attempt < 2) return request(pathname, init, attempt + 1);\n return response;\n } catch (error) {\n if (attempt < 2) return request(pathname, init, attempt + 1);\n throw error;\n }\n};\n\nconst cachePath = (kind: string, key: string): string =>\n `/internal/runtime-cache/v1/entries/${encodeURIComponent(kind)}/${encodeURIComponent(key)}`;\n\nexport const readRuntimeCache = async (kind: string, key: string): Promise<unknown | undefined> => {\n try {\n const response = await request(cachePath(kind, key), { method: 'GET' });\n if (response.status === 404) return undefined;\n if (!response.ok) return undefined;\n const envelope = (await response.json()) as RuntimeCacheEnvelope;\n return decodeBinary(envelope.value);\n } catch {\n return undefined;\n }\n};\n\nexport const writeRuntimeCache = async (\n kind: string,\n key: string,\n value: unknown,\n tags: readonly string[] = []\n): Promise<void> => {\n const response = await request(cachePath(kind, key), {\n method: 'PUT',\n body: JSON.stringify({ value: encodeBinary(value), tags }),\n });\n if (!response.ok) throw new Error(`Gigadrive runtime cache write failed with status ${response.status}`);\n};\n\nexport const revalidateRuntimeCacheTags = async (\n kind: string,\n tags: readonly string[],\n durations?: { expire?: number }\n): Promise<void> => {\n const response = await request('/internal/runtime-cache/v1/tags/revalidate', {\n method: 'POST',\n body: JSON.stringify({ kind, tags, durations }),\n });\n if (!response.ok) throw new Error(`Gigadrive runtime cache revalidation failed with status ${response.status}`);\n};\n\nexport const getRuntimeCacheTagExpiration = async (kind: string, tags: readonly string[]): Promise<number> => {\n try {\n const response = await request('/internal/runtime-cache/v1/tags/expiration', {\n method: 'POST',\n body: JSON.stringify({ kind, tags }),\n });\n if (!response.ok) return 0;\n const value = (await response.json()) as { expiration?: unknown };\n return typeof value.expiration === 'number' ? value.expiration : 0;\n } catch {\n return 0;\n }\n};\n\nexport const getRuntimeCacheTagState = async (kind: string, tags: readonly string[]): Promise<RuntimeCacheTagState> => {\n try {\n const response = await request('/internal/runtime-cache/v1/tags/state', {\n method: 'POST',\n body: JSON.stringify({ kind, tags }),\n });\n if (!response.ok) return { stale: 0, expired: 0 };\n const value = (await response.json()) as { stale?: unknown; expired?: unknown };\n return {\n stale: typeof value.stale === 'number' ? value.stale : 0,\n expired: typeof value.expired === 'number' ? value.expired : 0,\n };\n } catch {\n return { stale: 0, expired: 0 };\n }\n};\n\nexport const resetRuntimeCacheClientForTests = (): void => {\n cachedToken = undefined;\n};\n","import { revalidateRuntimeCacheTags, writeRuntimeCache } from './nextjs-runtime-cache-client';\n\ninterface ResponseCacheEntry {\n cacheControl?: unknown;\n value?: {\n kind?: unknown;\n html?: unknown;\n postponed?: unknown;\n headers?: unknown;\n status?: unknown;\n } | null;\n}\n\ninterface PersistedPprCacheEntry {\n shell: string;\n postponedState?: string;\n headers: Record<string, string | string[]>;\n status?: number;\n cacheControl?: unknown;\n}\n\ninterface NextInternalRevalidateInput {\n urlPath: string;\n headers: Record<string, string>;\n opts: { unstable_onlyGenerated?: boolean };\n hostname: string | undefined;\n}\n\nconst normalizeHeaders = (value: unknown): Record<string, string | string[]> => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return {};\n const headers: Record<string, string | string[]> = {};\n for (const [name, item] of Object.entries(value)) {\n if (typeof item === 'string' || typeof item === 'number') headers[name] = String(item);\n else if (Array.isArray(item) && item.every((entry) => typeof entry === 'string' || typeof entry === 'number')) {\n headers[name] = item.map(String);\n }\n }\n return headers;\n};\n\nconst normalizeCacheKey = (value: string): string => {\n try {\n const url = new URL(value, 'https://gigadrive.invalid');\n return `${url.pathname || '/'}${url.search}`;\n } catch {\n return value.startsWith('/') ? value : `/${value}`;\n }\n};\n\nconst readShell = (value: unknown): string | null => {\n if (typeof value === 'string') return value;\n if (typeof value !== 'object' || value === null) return null;\n const toUnchunkedString = (value as { toUnchunkedString?: unknown }).toUnchunkedString;\n return typeof toUnchunkedString === 'function' ? String(toUnchunkedString.call(value)) : null;\n};\n\n/**\n * Persists the atomic shell/postponed pair emitted by Next's PPR response cache.\n *\n * @param cacheKey - The response-cache URL or pathname associated with the PPR entry.\n * @param cacheEntry - The Next response-cache entry emitted by `onCacheEntryV2`.\n * @returns A promise that settles after the entry is written, or immediately for unsupported entries.\n *\n * @example\n * ```ts\n * await persistPprCacheEntry('/products/one', {\n * value: { kind: 'APP_PAGE', html: '<html>shell</html>', postponed: 'opaque-state' },\n * });\n * ```\n */\nexport const persistPprCacheEntry = async (cacheKey: string, cacheEntry: ResponseCacheEntry): Promise<void> => {\n if (cacheEntry.value?.kind !== 'APP_PAGE') return;\n const shell = readShell(cacheEntry.value.html);\n if (shell === null) return;\n\n const headers = normalizeHeaders(cacheEntry.value.headers);\n const tags = (headers['x-next-cache-tags'] ?? [])\n .toString()\n .split(',')\n .map((tag) => tag.trim())\n .filter(Boolean);\n const value: PersistedPprCacheEntry = {\n shell,\n ...(typeof cacheEntry.value.postponed === 'string' ? { postponedState: cacheEntry.value.postponed } : {}),\n headers,\n ...(typeof cacheEntry.value.status === 'number' ? { status: cacheEntry.value.status } : {}),\n ...(cacheEntry.cacheControl === undefined ? {} : { cacheControl: cacheEntry.cacheControl }),\n };\n\n await writeRuntimeCache('incremental', `ppr:${normalizeCacheKey(cacheKey)}`, value, tags);\n};\n\n/**\n * Runs Next's synchronous Pages Router on-demand revalidation protocol.\n *\n * The CDN path is evicted before a cache-busting request reaches the split page\n * function. Next then regenerates the shared incremental-cache entry before this\n * promise resolves, preserving the blocking semantics of `response.revalidate()`.\n *\n * @param input - The internal revalidation request emitted by Next's Pages API runtime.\n * @returns A promise that settles after Next has regenerated the requested path.\n */\nexport const revalidateNextPath = async (input: NextInternalRevalidateInput): Promise<void> => {\n if (!input.urlPath.startsWith('/')) throw new Error('Next.js revalidation requires an absolute application path');\n if (!input.hostname) throw new Error('Next.js revalidation requires the application hostname');\n\n const pathname = new URL(input.urlPath, 'https://gigadrive.invalid').pathname;\n await revalidateRuntimeCacheTags('incremental', [`path:${pathname}`]);\n\n const origin = process.env.GIGADRIVE_APPLICATION_ORIGIN ?? `https://${input.hostname}`;\n const originUrl = new URL(origin);\n if (originUrl.protocol !== 'https:' && originUrl.protocol !== 'http:') {\n throw new Error('Next.js revalidation requires an HTTP application origin');\n }\n const url = new URL(input.urlPath, originUrl);\n if (url.origin !== originUrl.origin)\n throw new Error('Next.js revalidation path must remain on the application origin');\n url.searchParams.set('__gigadrive_revalidate', `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);\n\n const headers = new Headers(input.headers);\n headers.set('cache-control', 'no-cache');\n const response = await fetch(url, { method: 'HEAD', headers, redirect: 'manual' });\n // Prefer the platform-owned cache-status header; fall back to the header Next\n // itself emits. Never rely on CDN-vendor header names here.\n const cacheStatus = response.headers.get('x-gigadrive-cache') ?? response.headers.get('x-nextjs-cache');\n if (\n cacheStatus?.toUpperCase() !== 'REVALIDATED' &&\n response.status !== 200 &&\n !(response.status === 404 && input.opts.unstable_onlyGenerated)\n ) {\n throw new Error(`Next.js revalidation failed with status ${response.status}`);\n }\n};\n"],"mappings":";AAcA,IAAI;AAEJ,IAAM,aAAa,OAAe,QAAQ,IAAI,qBAAqB,iCAAiC,QAAQ,OAAO,EAAE;AAErH,IAAM,eAAe,CAAC,OAAgB,OAAO,oBAA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