@forklaunch/internal 0.3.0 → 0.3.2

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/lib/index.d.mts CHANGED
@@ -1,18 +1,6 @@
1
- import { IdiomaticSchema, Schema, AnySchemaValidator, UnboxedObjectSchema } from '@forklaunch/validator';
1
+ import { IdiomaticSchema, Schema, AnySchemaValidator } from '@forklaunch/validator';
2
2
  import { TypeboxSchemaValidator } from '@forklaunch/validator/typebox';
3
3
  import { ZodSchemaValidator } from '@forklaunch/validator/zod';
4
- import { InstanceTypeRecord } from '@forklaunch/common';
5
-
6
- declare class IdentityRequestMapper<T> {
7
- dto: T;
8
- _Entity: T;
9
- deserializeDtoToEntity(dto: T): Promise<T>;
10
- }
11
- declare class IdentityResponseMapper<T> {
12
- dto: T;
13
- _Entity: T;
14
- serializeEntityToDto(entity: T): Promise<T>;
15
- }
16
4
 
17
5
  declare function testSchemaEquality<Schematic>(): <Z extends IdiomaticSchema<ZodSchemaValidator>, T extends IdiomaticSchema<TypeboxSchemaValidator>>(zodSchema: Z, typeBoxSchema: T, testData: Schematic extends Schema<Z, ZodSchemaValidator> ? Schema<Z, ZodSchemaValidator> extends Schematic ? Schematic extends Schema<T, TypeboxSchemaValidator> ? Schema<T, TypeboxSchemaValidator> extends Schematic ? Schematic : {
18
6
  _success: never;
@@ -41,70 +29,4 @@ declare function serviceSchemaResolver<Options extends Record<string, unknown>,
41
29
  validator: SchemaValidator;
42
30
  }) => SchemasByValidator<SchemaValidator, (options: Options) => TypeBoxSchemas, (options: Options) => ZodSchemas>;
43
31
 
44
- type InternalMapper<Mapper extends Record<string, {
45
- dto: unknown;
46
- _Entity: unknown;
47
- serializeEntityToDto: unknown;
48
- } | {
49
- dto: unknown;
50
- _Entity: unknown;
51
- deserializeDtoToEntity: unknown;
52
- }>> = {
53
- [K in keyof Mapper]: Mapper[K] extends {
54
- dto: unknown;
55
- _Entity: unknown;
56
- serializeEntityToDto: unknown;
57
- } ? {
58
- serializeEntityToDto: Mapper[K]['serializeEntityToDto'];
59
- } : Mapper[K] extends {
60
- dto: unknown;
61
- _Entity: unknown;
62
- deserializeDtoToEntity: unknown;
63
- } ? {
64
- deserializeDtoToEntity: Mapper[K]['deserializeDtoToEntity'];
65
- } : never;
66
- };
67
-
68
- declare function transformIntoInternalMapper<SchemaValidator extends AnySchemaValidator, Mapper extends Record<string, new (schemaValidator: SchemaValidator) => {
69
- dto: unknown;
70
- _Entity: unknown;
71
- serializeEntityToDto: unknown;
72
- } | {
73
- dto: unknown;
74
- _Entity: unknown;
75
- deserializeDtoToEntity: unknown;
76
- }>>(mappers: Mapper, schemaValidator: SchemaValidator): InternalMapper<InstanceTypeRecord<Mapper>>;
77
-
78
- /**
79
- * Type representing a schema validator object for an entity mapper.
80
- *
81
- * @template SV - A type that extends AnySchemaValidator.
82
- * @typedef {SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>} MapperSchemaValidatorObject
83
- */
84
- type MapperSchemaValidatorObject<SV extends AnySchemaValidator> = SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>;
85
- /**
86
- * Type representing a response DTO mapper for an entity mapper.
87
- *
88
- * @template SchemaValidator - A type that extends AnySchemaValidator.
89
- * @template Dto - The type of the DTO object.
90
- * @template Entity - The type of the entity object.
91
- */
92
- type ResponseMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, SerializeEntityToDto extends (entity: Entity, ...additionalArgs: never[]) => Promise<Dto> = (entity: Entity, ...additionalArgs: never[]) => Promise<Dto>> = new (schemaValidator: SchemaValidator) => {
93
- dto: Dto;
94
- _Entity: Entity;
95
- serializeEntityToDto: SerializeEntityToDto;
96
- };
97
- /**
98
- * Type representing a request DTO mapper for an entity mapper.
99
- *
100
- * @template SV - A type that extends AnySchemaValidator.
101
- * @template Dto - The type of the DTO object.
102
- * @template Entity - The type of the entity object.
103
- */
104
- type RequestMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, DeserializeDtoToEntity extends (dto: Dto, ...additionalArgs: never[]) => Promise<Entity> = (dto: Dto, ...additionalArgs: never[]) => Promise<Entity>> = new (schemaValidator: SchemaValidator) => {
105
- dto: Dto;
106
- _Entity: Entity;
107
- deserializeDtoToEntity: DeserializeDtoToEntity;
108
- };
109
-
110
- export { DummyEnum, IdentityRequestMapper, IdentityResponseMapper, type InternalMapper, type MapperSchemaValidatorObject, type RequestMapperConstructor, type ResponseMapperConstructor, type SchemasByValidator, serviceSchemaResolver, testSchemaEquality, transformIntoInternalMapper };
32
+ export { DummyEnum, type SchemasByValidator, serviceSchemaResolver, testSchemaEquality };
package/lib/index.d.ts CHANGED
@@ -1,18 +1,6 @@
1
- import { IdiomaticSchema, Schema, AnySchemaValidator, UnboxedObjectSchema } from '@forklaunch/validator';
1
+ import { IdiomaticSchema, Schema, AnySchemaValidator } from '@forklaunch/validator';
2
2
  import { TypeboxSchemaValidator } from '@forklaunch/validator/typebox';
3
3
  import { ZodSchemaValidator } from '@forklaunch/validator/zod';
4
- import { InstanceTypeRecord } from '@forklaunch/common';
5
-
6
- declare class IdentityRequestMapper<T> {
7
- dto: T;
8
- _Entity: T;
9
- deserializeDtoToEntity(dto: T): Promise<T>;
10
- }
11
- declare class IdentityResponseMapper<T> {
12
- dto: T;
13
- _Entity: T;
14
- serializeEntityToDto(entity: T): Promise<T>;
15
- }
16
4
 
17
5
  declare function testSchemaEquality<Schematic>(): <Z extends IdiomaticSchema<ZodSchemaValidator>, T extends IdiomaticSchema<TypeboxSchemaValidator>>(zodSchema: Z, typeBoxSchema: T, testData: Schematic extends Schema<Z, ZodSchemaValidator> ? Schema<Z, ZodSchemaValidator> extends Schematic ? Schematic extends Schema<T, TypeboxSchemaValidator> ? Schema<T, TypeboxSchemaValidator> extends Schematic ? Schematic : {
18
6
  _success: never;
@@ -41,70 +29,4 @@ declare function serviceSchemaResolver<Options extends Record<string, unknown>,
41
29
  validator: SchemaValidator;
42
30
  }) => SchemasByValidator<SchemaValidator, (options: Options) => TypeBoxSchemas, (options: Options) => ZodSchemas>;
43
31
 
44
- type InternalMapper<Mapper extends Record<string, {
45
- dto: unknown;
46
- _Entity: unknown;
47
- serializeEntityToDto: unknown;
48
- } | {
49
- dto: unknown;
50
- _Entity: unknown;
51
- deserializeDtoToEntity: unknown;
52
- }>> = {
53
- [K in keyof Mapper]: Mapper[K] extends {
54
- dto: unknown;
55
- _Entity: unknown;
56
- serializeEntityToDto: unknown;
57
- } ? {
58
- serializeEntityToDto: Mapper[K]['serializeEntityToDto'];
59
- } : Mapper[K] extends {
60
- dto: unknown;
61
- _Entity: unknown;
62
- deserializeDtoToEntity: unknown;
63
- } ? {
64
- deserializeDtoToEntity: Mapper[K]['deserializeDtoToEntity'];
65
- } : never;
66
- };
67
-
68
- declare function transformIntoInternalMapper<SchemaValidator extends AnySchemaValidator, Mapper extends Record<string, new (schemaValidator: SchemaValidator) => {
69
- dto: unknown;
70
- _Entity: unknown;
71
- serializeEntityToDto: unknown;
72
- } | {
73
- dto: unknown;
74
- _Entity: unknown;
75
- deserializeDtoToEntity: unknown;
76
- }>>(mappers: Mapper, schemaValidator: SchemaValidator): InternalMapper<InstanceTypeRecord<Mapper>>;
77
-
78
- /**
79
- * Type representing a schema validator object for an entity mapper.
80
- *
81
- * @template SV - A type that extends AnySchemaValidator.
82
- * @typedef {SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>} MapperSchemaValidatorObject
83
- */
84
- type MapperSchemaValidatorObject<SV extends AnySchemaValidator> = SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>;
85
- /**
86
- * Type representing a response DTO mapper for an entity mapper.
87
- *
88
- * @template SchemaValidator - A type that extends AnySchemaValidator.
89
- * @template Dto - The type of the DTO object.
90
- * @template Entity - The type of the entity object.
91
- */
92
- type ResponseMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, SerializeEntityToDto extends (entity: Entity, ...additionalArgs: never[]) => Promise<Dto> = (entity: Entity, ...additionalArgs: never[]) => Promise<Dto>> = new (schemaValidator: SchemaValidator) => {
93
- dto: Dto;
94
- _Entity: Entity;
95
- serializeEntityToDto: SerializeEntityToDto;
96
- };
97
- /**
98
- * Type representing a request DTO mapper for an entity mapper.
99
- *
100
- * @template SV - A type that extends AnySchemaValidator.
101
- * @template Dto - The type of the DTO object.
102
- * @template Entity - The type of the entity object.
103
- */
104
- type RequestMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, DeserializeDtoToEntity extends (dto: Dto, ...additionalArgs: never[]) => Promise<Entity> = (dto: Dto, ...additionalArgs: never[]) => Promise<Entity>> = new (schemaValidator: SchemaValidator) => {
105
- dto: Dto;
106
- _Entity: Entity;
107
- deserializeDtoToEntity: DeserializeDtoToEntity;
108
- };
109
-
110
- export { DummyEnum, IdentityRequestMapper, IdentityResponseMapper, type InternalMapper, type MapperSchemaValidatorObject, type RequestMapperConstructor, type ResponseMapperConstructor, type SchemasByValidator, serviceSchemaResolver, testSchemaEquality, transformIntoInternalMapper };
32
+ export { DummyEnum, type SchemasByValidator, serviceSchemaResolver, testSchemaEquality };
package/lib/index.js CHANGED
@@ -21,30 +21,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  DummyEnum: () => DummyEnum,
24
- IdentityRequestMapper: () => IdentityRequestMapper,
25
- IdentityResponseMapper: () => IdentityResponseMapper,
26
24
  serviceSchemaResolver: () => serviceSchemaResolver,
27
- testSchemaEquality: () => testSchemaEquality,
28
- transformIntoInternalMapper: () => transformIntoInternalMapper
25
+ testSchemaEquality: () => testSchemaEquality
29
26
  });
30
27
  module.exports = __toCommonJS(index_exports);
31
28
 
32
- // src/identityMappers.ts
33
- var IdentityRequestMapper = class {
34
- dto;
35
- _Entity;
36
- async deserializeDtoToEntity(dto) {
37
- return dto;
38
- }
39
- };
40
- var IdentityResponseMapper = class {
41
- dto;
42
- _Entity;
43
- async serializeEntityToDto(entity) {
44
- return entity;
45
- }
46
- };
47
-
48
29
  // src/schemaEquality.ts
49
30
  var import_common = require("@forklaunch/common");
50
31
  var import_typebox = require("@forklaunch/validator/typebox");
@@ -85,22 +66,9 @@ function serviceSchemaResolver(TypeBoxSchemas, ZodSchemas) {
85
66
  }
86
67
  };
87
68
  }
88
-
89
- // src/transformIntoInternalMapper.ts
90
- function transformIntoInternalMapper(mappers, schemaValidator) {
91
- return Object.fromEntries(
92
- Object.entries(mappers).map(([key, value]) => [
93
- key,
94
- new value(schemaValidator)
95
- ])
96
- );
97
- }
98
69
  // Annotate the CommonJS export names for ESM import in node:
99
70
  0 && (module.exports = {
100
71
  DummyEnum,
101
- IdentityRequestMapper,
102
- IdentityResponseMapper,
103
72
  serviceSchemaResolver,
104
- testSchemaEquality,
105
- transformIntoInternalMapper
73
+ testSchemaEquality
106
74
  });
package/lib/index.mjs CHANGED
@@ -1,19 +1,3 @@
1
- // src/identityMappers.ts
2
- var IdentityRequestMapper = class {
3
- dto;
4
- _Entity;
5
- async deserializeDtoToEntity(dto) {
6
- return dto;
7
- }
8
- };
9
- var IdentityResponseMapper = class {
10
- dto;
11
- _Entity;
12
- async serializeEntityToDto(entity) {
13
- return entity;
14
- }
15
- };
16
-
17
1
  // src/schemaEquality.ts
18
2
  import { safeStringify, sortObjectKeys } from "@forklaunch/common";
19
3
  import {
@@ -58,21 +42,8 @@ function serviceSchemaResolver(TypeBoxSchemas, ZodSchemas) {
58
42
  }
59
43
  };
60
44
  }
61
-
62
- // src/transformIntoInternalMapper.ts
63
- function transformIntoInternalMapper(mappers, schemaValidator) {
64
- return Object.fromEntries(
65
- Object.entries(mappers).map(([key, value]) => [
66
- key,
67
- new value(schemaValidator)
68
- ])
69
- );
70
- }
71
45
  export {
72
46
  DummyEnum,
73
- IdentityRequestMapper,
74
- IdentityResponseMapper,
75
47
  serviceSchemaResolver,
76
- testSchemaEquality,
77
- transformIntoInternalMapper
48
+ testSchemaEquality
78
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/internal",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Internal package for utilities and other internal code.",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@mikro-orm/core": "^6.5.1",
32
- "@forklaunch/common": "0.6.0",
33
- "@forklaunch/validator": "0.10.0"
32
+ "@forklaunch/validator": "0.10.2",
33
+ "@forklaunch/common": "0.6.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@eslint/js": "^9.34.0",
37
37
  "@types/node": "^24.3.0",
38
- "@typescript/native-preview": "7.0.0-dev.20250827.1",
38
+ "@typescript/native-preview": "7.0.0-dev.20250828.1",
39
39
  "depcheck": "^1.4.7",
40
40
  "eslint": "^9.34.0",
41
41
  "globals": "^16.3.0",