@prisma-next/contract 0.3.0-pr.111.14 → 0.3.0-pr.111.16

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.
@@ -1,11 +1,6 @@
1
- // Shared types
2
- // Document family types
3
- // Plan types - target-family agnostic execution types
4
- // Emitter types (moved from @prisma-next/emitter)
5
- // Parameterized codec descriptor types
6
1
  export type {
7
- ___CoreHashBrand___,
8
- ___ProfileHashBrand___,
2
+ __Brand__,
3
+ Brand,
9
4
  ContractBase,
10
5
  ContractMarkerRecord,
11
6
  CoreHashBase,
@@ -16,7 +11,6 @@ export type {
16
11
  ExecutionPlan,
17
12
  Expr,
18
13
  FieldType,
19
- // Type generation options for parameterized codecs
20
14
  GenerateContractTypesOptions,
21
15
  OperationManifest,
22
16
  ParamDescriptor,
@@ -24,6 +18,7 @@ export type {
24
18
  PlanMeta,
25
19
  PlanRefs,
26
20
  ProfileHashBase,
21
+ RenderTypeContext,
27
22
  ResultType,
28
23
  Source,
29
24
  TargetFamilyHook,
@@ -33,5 +28,4 @@ export type {
33
28
  TypesImportSpec,
34
29
  ValidationContext,
35
30
  } from '../types';
36
- // Type guards
37
31
  export { isDocumentContract } from '../types';
@@ -1,4 +1,4 @@
1
- import type { OperationManifest, TypesImportSpec } from './types';
1
+ import type { OperationManifest, RenderTypeContext, TypesImportSpec } from './types';
2
2
 
3
3
  // ============================================================================
4
4
  // Type Renderer Types (for parameterized codec emission)
@@ -15,14 +15,6 @@ import type { OperationManifest, TypesImportSpec } from './types';
15
15
  //
16
16
  // ============================================================================
17
17
 
18
- /**
19
- * Context passed to type renderers during contract.d.ts generation.
20
- */
21
- export interface RenderTypeContext {
22
- /** The name of the CodecTypes type alias (typically 'CodecTypes') */
23
- readonly codecTypesName: string;
24
- }
25
-
26
18
  /**
27
19
  * A template-based type renderer (structured form).
28
20
  * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are
package/src/types.ts CHANGED
@@ -1,25 +1,35 @@
1
1
  import type { OperationRegistry } from '@prisma-next/operations';
2
- import type { RenderTypeContext } from './framework-components';
3
2
  import type { ContractIR } from './ir';
4
3
 
5
- export declare const ___CoreHashBrand___: unique symbol;
6
- export declare const ___ProfileHashBrand___: unique symbol;
4
+ export const __Brand__: unique symbol = Symbol('__prisma_next_brand__');
5
+
6
+ export type Brand<TName extends string | number | symbol> = {
7
+ [__Brand__]: {
8
+ [K in TName]: true;
9
+ };
10
+ };
11
+
12
+ /**
13
+ * Context passed to type renderers during contract.d.ts generation.
14
+ */
15
+ export interface RenderTypeContext {
16
+ /** The name of the CodecTypes type alias (typically 'CodecTypes') */
17
+ readonly codecTypesName: string;
18
+ }
7
19
 
8
20
  /**
9
21
  * Base type for core contract hashes.
10
22
  * Emitted contract.d.ts files use this with the hash value as a type parameter:
11
23
  * `type CoreHash = CoreHashBase<'sha256:abc123...'>`
12
24
  */
13
- export type CoreHashBase<THash extends string> = THash & { readonly [___CoreHashBrand___]: true };
25
+ export type CoreHashBase<THash extends string> = THash & Brand<'CoreHash'>;
14
26
 
15
27
  /**
16
28
  * Base type for profile contract hashes.
17
29
  * Emitted contract.d.ts files use this with the hash value as a type parameter:
18
30
  * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`
19
31
  */
20
- export type ProfileHashBase<THash extends string> = THash & {
21
- readonly [___ProfileHashBrand___]: true;
22
- };
32
+ export type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
23
33
 
24
34
  export interface ContractBase<
25
35
  TCoreHash extends CoreHashBase<string> = CoreHashBase<string>,
@@ -320,9 +330,6 @@ export interface OperationManifest {
320
330
  //
321
331
  // ============================================================================
322
332
 
323
- // Re-export RenderTypeContext so it's available alongside TypeRenderer
324
- export type { RenderTypeContext };
325
-
326
333
  /**
327
334
  * Declarative type renderer that produces a TypeScript type expression.
328
335
  *