@prisma-next/adapter-postgres 0.0.1

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/README.md ADDED
@@ -0,0 +1,259 @@
1
+ # @prisma-next/adapter-postgres
2
+
3
+ PostgreSQL adapter for Prisma Next.
4
+
5
+ ## Package Classification
6
+
7
+ - **Domain**: targets
8
+ - **Layer**: adapters
9
+ - **Plane**: multi-plane (shared, migration, runtime)
10
+
11
+ ## Overview
12
+
13
+ The PostgreSQL adapter implements the adapter SPI for PostgreSQL databases. It provides SQL lowering, capability discovery, codec definitions, and error mapping for PostgreSQL-specific behavior.
14
+
15
+ This package is an extension pack that extends Prisma Next with PostgreSQL-specific capabilities. It includes a manifest declaring its capabilities and codec types, and provides the adapter implementation that lowers SQL ASTs to PostgreSQL dialect SQL.
16
+
17
+ ## Purpose
18
+
19
+ Provide PostgreSQL-specific adapter implementation, codecs, and capabilities. Enable PostgreSQL dialect support in Prisma Next through the adapter SPI.
20
+
21
+ ## Responsibilities
22
+
23
+ - **Adapter Implementation**: Implement `Adapter` SPI for PostgreSQL
24
+ - Lower SQL ASTs to PostgreSQL dialect SQL
25
+ - Render `includeMany` as `LEFT JOIN LATERAL` with `json_agg` for nested array includes
26
+ - Advertise PostgreSQL capabilities (`lateral`, `jsonAgg`)
27
+ - Normalize PostgreSQL EXPLAIN output
28
+ - Map PostgreSQL errors to `RuntimeError` envelope
29
+ - **Codec Definitions**: Define PostgreSQL codecs for type conversion
30
+ - Wire format to JavaScript type decoding
31
+ - JavaScript type to wire format encoding
32
+ - **Codec Types**: Export TypeScript types for PostgreSQL codecs
33
+ - **Extension Pack**: Provide manifest declaring capabilities and codec types
34
+
35
+ **Non-goals:**
36
+ - Transport/pooling management (drivers)
37
+ - Query compilation (sql-query)
38
+ - Runtime execution (runtime)
39
+
40
+ ## Architecture
41
+
42
+ This package spans multiple planes:
43
+
44
+ - **Shared plane** (`src/core/**`): Core adapter implementation, codecs, and types that can be imported by both migration and runtime planes
45
+ - **Migration plane** (`src/exports/cli.ts`): CLI entry point that exports `AdapterDescriptor` for config files
46
+ - **Runtime plane** (`src/exports/runtime.ts`): Runtime entry point for DB-connected commands (future)
47
+
48
+ ```mermaid
49
+ flowchart TD
50
+ subgraph "Runtime"
51
+ RT[Runtime]
52
+ PLAN[Plan]
53
+ end
54
+
55
+ subgraph "Postgres Adapter"
56
+ ADAPTER[Adapter]
57
+ LOWERER[Lowerer]
58
+ CODECS[Codecs]
59
+ CAPS[Capabilities]
60
+ end
61
+
62
+ subgraph "Postgres Driver"
63
+ DRIVER[Driver]
64
+ PG[(PostgreSQL)]
65
+ end
66
+
67
+ subgraph "Extension Pack"
68
+ MANIFEST[Manifest]
69
+ CODECTYPES[Codec Types]
70
+ end
71
+
72
+ RT --> PLAN
73
+ PLAN --> ADAPTER
74
+ ADAPTER --> LOWERER
75
+ ADAPTER --> CODECS
76
+ ADAPTER --> CAPS
77
+ ADAPTER --> DRIVER
78
+ DRIVER --> PG
79
+ MANIFEST --> RT
80
+ CODECTYPES --> RT
81
+ CODECS --> CODECTYPES
82
+ ```
83
+
84
+ ## Components
85
+
86
+ ### Core (`src/core/`)
87
+
88
+ **Adapter (`adapter.ts`)**
89
+ - Main adapter implementation
90
+ - Lowers SQL ASTs to PostgreSQL SQL
91
+ - Renders joins (INNER, LEFT, RIGHT, FULL) with ON conditions
92
+ - Renders `includeMany` as `LEFT JOIN LATERAL` with `json_agg` for nested array includes
93
+ - Renders DML operations (INSERT, UPDATE, DELETE) with RETURNING clauses
94
+ - Advertises PostgreSQL capabilities (`lateral`, `jsonAgg`, `returning`)
95
+ - Maps PostgreSQL errors to `RuntimeError`
96
+
97
+ **Codecs (`codecs.ts`)**
98
+ - PostgreSQL codec definitions
99
+ - Type conversion between wire format and JavaScript
100
+ - Supports PostgreSQL types: `int2`, `int4`, `int8`, `float4`, `float8`, `text`, `timestamp`, `timestamptz`, `bool`
101
+
102
+ **Types (`types.ts`)**
103
+ - PostgreSQL-specific types and utilities
104
+ - Re-exports SQL contract types
105
+
106
+ ### Exports (`src/exports/`)
107
+
108
+ **CLI Entry Point (`cli.ts`)**
109
+ - Exports `AdapterDescriptor` for CLI config
110
+ - Loads adapter manifest from `packs/manifest.json`
111
+ - Used by `prisma-next.config.ts` to declare the adapter
112
+
113
+ **Runtime Entry Point (`runtime.ts`)**
114
+ - Placeholder for future DB-connected commands
115
+ - Will export runtime factory functions
116
+
117
+ **Adapter Export (`adapter.ts`)**
118
+ - Re-exports `createPostgresAdapter` from core
119
+
120
+ **Codec Types Export (`codec-types.ts`)**
121
+ - Exports TypeScript type definitions for PostgreSQL codecs
122
+ - Used in `contract.d.ts` generation
123
+
124
+ **Types Export (`types.ts`)**
125
+ - Re-exports PostgreSQL-specific types
126
+
127
+ ### Manifest (`packs/manifest.json`)
128
+
129
+ - Extension pack manifest
130
+ - Declares capabilities and codec types import
131
+ - Provides canonical scalar map for type canonicalization
132
+
133
+ ## Dependencies
134
+
135
+ - **`@prisma-next/sql-contract`**: SQL contract types
136
+ - **`@prisma-next/sql-relational-core`**: SQL AST types and codec registry
137
+ - **`@prisma-next/cli`**: CLI config types and extension pack manifest types
138
+
139
+ ## Related Subsystems
140
+
141
+ - **[Adapters & Targets](../../docs/architecture%20docs/subsystems/5.%20Adapters%20&%20Targets.md)**: Detailed adapter specification
142
+ - **[Ecosystem Extensions & Packs](../../docs/architecture%20docs/subsystems/6.%20Ecosystem%20Extensions%20&%20Packs.md)**: Extension pack model
143
+
144
+ ## Related ADRs
145
+
146
+ - [ADR 005 - Thin Core Fat Targets](../../docs/architecture%20docs/adrs/ADR%20005%20-%20Thin%20Core%20Fat%20Targets.md)
147
+ - [ADR 016 - Adapter SPI for Lowering](../../docs/architecture%20docs/adrs/ADR%20016%20-%20Adapter%20SPI%20for%20Lowering.md)
148
+ - [ADR 030 - Result decoding & codecs registry](../../docs/architecture%20docs/adrs/ADR%20030%20-%20Result%20decoding%20&%20codecs%20registry.md)
149
+ - [ADR 065 - Adapter capability schema & negotiation v1](../../docs/architecture%20docs/adrs/ADR%20065%20-%20Adapter%20capability%20schema%20&%20negotiation%20v1.md)
150
+ - [ADR 068 - Error mapping to RuntimeError](../../docs/architecture%20docs/adrs/ADR%20068%20-%20Error%20mapping%20to%20RuntimeError.md)
151
+ - [ADR 112 - Target Extension Packs](../../docs/architecture%20docs/adrs/ADR%20112%20-%20Target%20Extension%20Packs.md)
152
+ - [ADR 114 - Extension codecs & branded types](../../docs/architecture%20docs/adrs/ADR%20114%20-%20Extension%20codecs%20&%20branded%20types.md)
153
+
154
+ ## Usage
155
+
156
+ ### Runtime
157
+
158
+ ```typescript
159
+ import { createPostgresAdapter } from '@prisma-next/adapter-postgres/adapter';
160
+ import { createRuntime } from '@prisma-next/sql-runtime';
161
+
162
+ const runtime = createRuntime({
163
+ contract,
164
+ adapter: createPostgresAdapter(),
165
+ driver: postgresDriver,
166
+ });
167
+ ```
168
+
169
+ ### CLI Config
170
+
171
+ ```typescript
172
+ import postgresAdapter from '@prisma-next/adapter-postgres/control';
173
+
174
+ export default defineConfig({
175
+ family: sql,
176
+ target: postgres,
177
+ adapter: postgresAdapter,
178
+ extensions: [],
179
+ });
180
+ ```
181
+
182
+ ## Capabilities
183
+
184
+ The adapter declares the following PostgreSQL capabilities:
185
+
186
+ - **`orderBy: true`** - Supports ORDER BY clauses
187
+ - **`limit: true`** - Supports LIMIT clauses
188
+ - **`lateral: true`** - Supports LATERAL joins for `includeMany` nested array includes
189
+ - **`jsonAgg: true`** - Supports JSON aggregation functions (`json_agg`) for `includeMany`
190
+ - **`returning: true`** - Supports RETURNING clauses for DML operations (INSERT, UPDATE, DELETE)
191
+
192
+ **Important**: Capabilities must be declared in **both** places:
193
+
194
+ 1. **`packs/manifest.json`**: Capabilities are read by the CLI during emission and included in the contract
195
+ 2. **`src/core/adapter.ts`**: The `defaultCapabilities` constant is used at runtime via `adapter.profile.capabilities`
196
+
197
+ The capabilities in the manifest must match the capabilities in code. If they don't match, the contract won't include the capabilities, causing runtime capability checks to fail.
198
+
199
+ See `.cursor/rules/adapter-capability-declaration.mdc` for detailed guidelines.
200
+
201
+ ## includeMany Support
202
+
203
+ The adapter supports `includeMany` for nested array includes using PostgreSQL's `LATERAL` joins and `json_agg`:
204
+
205
+ **Lowering Strategy:**
206
+ - Renders `includeMany` as `LEFT JOIN LATERAL` with a subquery that uses `json_agg(json_build_object(...))` to aggregate child rows into a JSON array
207
+ - The ON condition from the include is moved into the WHERE clause of the lateral subquery
208
+ - When both `ORDER BY` and `LIMIT` are present, wraps the query in an inner SELECT that projects individual columns with aliases, then uses `json_agg(row_to_json(sub.*))` on the result
209
+ - Uses different aliases for the table (`{alias}_lateral`) and column (`{alias}`) to avoid ambiguity
210
+
211
+ **Capabilities Required:**
212
+ - `lateral: true` - Enables LATERAL join support
213
+ - `jsonAgg: true` - Enables `json_agg` function support
214
+
215
+ **Example SQL Output:**
216
+ ```sql
217
+ SELECT "user"."id" AS "id", "posts_lateral"."posts" AS "posts"
218
+ FROM "user"
219
+ LEFT JOIN LATERAL (
220
+ SELECT json_agg(json_build_object('id', "post"."id", 'title', "post"."title")) AS "posts"
221
+ FROM "post"
222
+ WHERE "user"."id" = "post"."userId"
223
+ ) AS "posts_lateral" ON true
224
+ ```
225
+
226
+ ## DML Operations with RETURNING
227
+
228
+ The adapter supports RETURNING clauses for DML operations (INSERT, UPDATE, DELETE), allowing you to return affected rows:
229
+
230
+ **Lowering Strategy:**
231
+ - Renders `RETURNING` clause after INSERT, UPDATE, or DELETE statements
232
+ - Returns specified columns from affected rows
233
+ - Supports returning multiple columns
234
+
235
+ **Capability Required:**
236
+ - `returning: true` - Enables RETURNING clause support
237
+
238
+ **Example SQL Output:**
239
+ ```sql
240
+ -- INSERT with RETURNING
241
+ INSERT INTO "user" ("email", "createdAt") VALUES ($1, $2) RETURNING "user"."id", "user"."email"
242
+
243
+ -- UPDATE with RETURNING
244
+ UPDATE "user" SET "email" = $1 WHERE "user"."id" = $2 RETURNING "user"."id", "user"."email"
245
+
246
+ -- DELETE with RETURNING
247
+ DELETE FROM "user" WHERE "user"."id" = $1 RETURNING "user"."id", "user"."email"
248
+ ```
249
+
250
+ **Note:** MySQL does not support RETURNING clauses. A future MySQL adapter would declare `returning: false` and either reject plans with RETURNING or provide an alternative implementation.
251
+
252
+ ## Exports
253
+
254
+ - `./adapter`: Adapter implementation (`createPostgresAdapter`)
255
+ - `./codec-types`: PostgreSQL codec types (`CodecTypes`, `dataTypes`)
256
+ - `./types`: PostgreSQL-specific types
257
+ - `./cli`: CLI entry point (`AdapterDescriptor`)
258
+ - `./runtime`: Runtime entry point (placeholder for future)
259
+
@@ -0,0 +1,19 @@
1
+ import { Adapter, QueryAst, AdapterProfile, LowererContext } from '@prisma-next/sql-relational-core/ast';
2
+ import { PostgresAdapterOptions, PostgresContract, PostgresLoweredStatement } from './types.js';
3
+ import '@prisma-next/sql-contract/types';
4
+
5
+ declare class PostgresAdapterImpl implements Adapter<QueryAst, PostgresContract, PostgresLoweredStatement> {
6
+ readonly profile: AdapterProfile<'postgres'>;
7
+ private readonly codecRegistry;
8
+ constructor(options?: PostgresAdapterOptions);
9
+ lower(ast: QueryAst, context: LowererContext<PostgresContract>): Readonly<{
10
+ profileId: string;
11
+ body: Readonly<{
12
+ sql: string;
13
+ params: unknown[];
14
+ }>;
15
+ }>;
16
+ }
17
+ declare function createPostgresAdapter(options?: PostgresAdapterOptions): Readonly<PostgresAdapterImpl>;
18
+
19
+ export { createPostgresAdapter };
@@ -0,0 +1,8 @@
1
+ import {
2
+ createPostgresAdapter
3
+ } from "./chunk-NOYZK3LL.js";
4
+ import "./chunk-CPAKRHXM.js";
5
+ export {
6
+ createPostgresAdapter
7
+ };
8
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,162 @@
1
+ // src/core/codecs.ts
2
+ import { codec, defineCodecs } from "@prisma-next/sql-relational-core/ast";
3
+ var pgTextCodec = codec({
4
+ typeId: "pg/text@1",
5
+ targetTypes: ["text"],
6
+ encode: (value) => value,
7
+ decode: (wire) => wire,
8
+ meta: {
9
+ db: {
10
+ sql: {
11
+ postgres: {
12
+ nativeType: "text"
13
+ }
14
+ }
15
+ }
16
+ }
17
+ });
18
+ var pgInt4Codec = codec({
19
+ typeId: "pg/int4@1",
20
+ targetTypes: ["int4"],
21
+ encode: (value) => value,
22
+ decode: (wire) => wire,
23
+ meta: {
24
+ db: {
25
+ sql: {
26
+ postgres: {
27
+ nativeType: "integer"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ });
33
+ var pgInt2Codec = codec({
34
+ typeId: "pg/int2@1",
35
+ targetTypes: ["int2"],
36
+ encode: (value) => value,
37
+ decode: (wire) => wire,
38
+ meta: {
39
+ db: {
40
+ sql: {
41
+ postgres: {
42
+ nativeType: "smallint"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ });
48
+ var pgInt8Codec = codec({
49
+ typeId: "pg/int8@1",
50
+ targetTypes: ["int8"],
51
+ encode: (value) => value,
52
+ decode: (wire) => wire,
53
+ meta: {
54
+ db: {
55
+ sql: {
56
+ postgres: {
57
+ nativeType: "bigint"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ });
63
+ var pgFloat4Codec = codec({
64
+ typeId: "pg/float4@1",
65
+ targetTypes: ["float4"],
66
+ encode: (value) => value,
67
+ decode: (wire) => wire,
68
+ meta: {
69
+ db: {
70
+ sql: {
71
+ postgres: {
72
+ nativeType: "real"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ });
78
+ var pgFloat8Codec = codec({
79
+ typeId: "pg/float8@1",
80
+ targetTypes: ["float8"],
81
+ encode: (value) => value,
82
+ decode: (wire) => wire,
83
+ meta: {
84
+ db: {
85
+ sql: {
86
+ postgres: {
87
+ nativeType: "double precision"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ });
93
+ var pgTimestampCodec = codec({
94
+ typeId: "pg/timestamp@1",
95
+ targetTypes: ["timestamp"],
96
+ encode: (value) => {
97
+ if (value instanceof Date) return value.toISOString();
98
+ if (typeof value === "string") return value;
99
+ return String(value);
100
+ },
101
+ decode: (wire) => {
102
+ if (typeof wire === "string") return wire;
103
+ if (wire instanceof Date) return wire.toISOString();
104
+ return String(wire);
105
+ },
106
+ meta: {
107
+ db: {
108
+ sql: {
109
+ postgres: {
110
+ nativeType: "timestamp without time zone"
111
+ }
112
+ }
113
+ }
114
+ }
115
+ });
116
+ var pgTimestamptzCodec = codec({
117
+ typeId: "pg/timestamptz@1",
118
+ targetTypes: ["timestamptz"],
119
+ encode: (value) => {
120
+ if (value instanceof Date) return value.toISOString();
121
+ if (typeof value === "string") return value;
122
+ return String(value);
123
+ },
124
+ decode: (wire) => {
125
+ if (typeof wire === "string") return wire;
126
+ if (wire instanceof Date) return wire.toISOString();
127
+ return String(wire);
128
+ },
129
+ meta: {
130
+ db: {
131
+ sql: {
132
+ postgres: {
133
+ nativeType: "timestamp with time zone"
134
+ }
135
+ }
136
+ }
137
+ }
138
+ });
139
+ var pgBoolCodec = codec({
140
+ typeId: "pg/bool@1",
141
+ targetTypes: ["bool"],
142
+ encode: (value) => value,
143
+ decode: (wire) => wire,
144
+ meta: {
145
+ db: {
146
+ sql: {
147
+ postgres: {
148
+ nativeType: "boolean"
149
+ }
150
+ }
151
+ }
152
+ }
153
+ });
154
+ var codecs = defineCodecs().add("text", pgTextCodec).add("int4", pgInt4Codec).add("int2", pgInt2Codec).add("int8", pgInt8Codec).add("float4", pgFloat4Codec).add("float8", pgFloat8Codec).add("timestamp", pgTimestampCodec).add("timestamptz", pgTimestamptzCodec).add("bool", pgBoolCodec);
155
+ var codecDefinitions = codecs.codecDefinitions;
156
+ var dataTypes = codecs.dataTypes;
157
+
158
+ export {
159
+ codecDefinitions,
160
+ dataTypes
161
+ };
162
+ //# sourceMappingURL=chunk-CPAKRHXM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/codecs.ts"],"sourcesContent":["/**\n * Unified codec definitions for Postgres adapter.\n *\n * This file contains a single source of truth for all codec information:\n * - Scalar names\n * - Type IDs\n * - Codec implementations (runtime)\n * - Type information (compile-time)\n *\n * This structure is used both at runtime (to populate the registry) and\n * at compile time (to derive CodecTypes).\n */\n\nimport { codec, defineCodecs } from '@prisma-next/sql-relational-core/ast';\n\n// Create individual codec instances\nconst pgTextCodec = codec({\n typeId: 'pg/text@1',\n targetTypes: ['text'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'text',\n },\n },\n },\n },\n});\n\nconst pgInt4Codec = codec<'pg/int4@1', number, number>({\n typeId: 'pg/int4@1',\n targetTypes: ['int4'],\n encode: (value) => value,\n decode: (wire) => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'integer',\n },\n },\n },\n },\n});\n\nconst pgInt2Codec = codec<'pg/int2@1', number, number>({\n typeId: 'pg/int2@1',\n targetTypes: ['int2'],\n encode: (value) => value,\n decode: (wire) => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'smallint',\n },\n },\n },\n },\n});\n\nconst pgInt8Codec = codec<'pg/int8@1', number, number>({\n typeId: 'pg/int8@1',\n targetTypes: ['int8'],\n encode: (value) => value,\n decode: (wire) => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'bigint',\n },\n },\n },\n },\n});\n\nconst pgFloat4Codec = codec<'pg/float4@1', number, number>({\n typeId: 'pg/float4@1',\n targetTypes: ['float4'],\n encode: (value) => value,\n decode: (wire) => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'real',\n },\n },\n },\n },\n});\n\nconst pgFloat8Codec = codec<'pg/float8@1', number, number>({\n typeId: 'pg/float8@1',\n targetTypes: ['float8'],\n encode: (value) => value,\n decode: (wire) => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'double precision',\n },\n },\n },\n },\n});\n\nconst pgTimestampCodec = codec<'pg/timestamp@1', string | Date, string>({\n typeId: 'pg/timestamp@1',\n targetTypes: ['timestamp'],\n encode: (value: string | Date): string => {\n if (value instanceof Date) return value.toISOString();\n if (typeof value === 'string') return value;\n return String(value);\n },\n decode: (wire: string | Date): string => {\n if (typeof wire === 'string') return wire;\n if (wire instanceof Date) return wire.toISOString();\n return String(wire);\n },\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'timestamp without time zone',\n },\n },\n },\n },\n});\n\nconst pgTimestamptzCodec = codec<'pg/timestamptz@1', string | Date, string>({\n typeId: 'pg/timestamptz@1',\n targetTypes: ['timestamptz'],\n encode: (value: string | Date): string => {\n if (value instanceof Date) return value.toISOString();\n if (typeof value === 'string') return value;\n return String(value);\n },\n decode: (wire: string | Date): string => {\n if (typeof wire === 'string') return wire;\n if (wire instanceof Date) return wire.toISOString();\n return String(wire);\n },\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'timestamp with time zone',\n },\n },\n },\n },\n});\n\nconst pgBoolCodec = codec<'pg/bool@1', boolean, boolean>({\n typeId: 'pg/bool@1',\n targetTypes: ['bool'],\n encode: (value) => value,\n decode: (wire) => wire,\n meta: {\n db: {\n sql: {\n postgres: {\n nativeType: 'boolean',\n },\n },\n },\n },\n});\n\n// Build codec definitions using the builder DSL\nconst codecs = defineCodecs()\n .add('text', pgTextCodec)\n .add('int4', pgInt4Codec)\n .add('int2', pgInt2Codec)\n .add('int8', pgInt8Codec)\n .add('float4', pgFloat4Codec)\n .add('float8', pgFloat8Codec)\n .add('timestamp', pgTimestampCodec)\n .add('timestamptz', pgTimestamptzCodec)\n .add('bool', pgBoolCodec);\n\n// Export derived structures directly from codecs builder\nexport const codecDefinitions = codecs.codecDefinitions;\nexport const dataTypes = codecs.dataTypes;\n\n// Export types derived from codecs builder\nexport type CodecTypes = typeof codecs.CodecTypes;\n"],"mappings":";AAaA,SAAS,OAAO,oBAAoB;AAGpC,IAAM,cAAc,MAAM;AAAA,EACxB,QAAQ;AAAA,EACR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